[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Can a merge follow changes in paths in trunk/branch?

From: Blair Zajac <blair_at_orcaware.com>
Date: 2006-02-11 06:53:46 CET

On Feb 10, 2006, at 6:21 PM, Matt England wrote:

> The consequences don't (yet) appear to be as bad as I thought in
> this scenario (play back the email thread for more info). A
> "merge" doesn't happen, but the system still identified a conflict
> file, it just doesn't diff/merge it very well...and I can probably
> deal with that, for I don't think I have that many files that were
> edited in both my trunk and branch.
>
> Example below of a trunk-branch comparison that both had their
> folders renamed to the same thing and then only one (of the four)
> files were changed (new-file.txt). The system doens't really merge
> the one changed file very well (because it doesn't keep track of
> which files are the same, it just shows the entire file as
> different)...but at least it identifies which ones were changed and
> which ones wheren't...simply because the merged-in files are
> overwritten on top of the ones in trunk and don't show up on 'svn
> status' if they weren't changed. I can use a merge tool or just
> manage it by hand for all the conflicted files...I hope.
>
> Maybe this was obvious to everybody else...but it wasn't to me.
>
> Hopefully this will go as well as I hope right now. We'll see.
>
> -Matt

Hi Matt,

In your case, what I recommend doing is the following. This should
avoid the use of third party merge tools and be pretty efficient in
steps.

1) First deciding which way the merge is going (from branch to trunk
or trunk to branch). For example, here, I'll assume you're going
from the branch (branches/b1) to the trunk.

2) Do an 'svn log -v' on the source of the merge (branches/b1) and
noting all of the revisions that changed the contents of the files,
not any that do any renames. Hopefully, you have no commits that
rename and change the contents of files.

3) Merge the revisions over that contain file content changes. If
the changes where made to files, say in 'branches/b1/olddir/file.txt'
at older revisions, and now you have 'trunk/newdir/file.txt' in the
target location, you can merge the revision at the level of 'olddir'
over, not at the 'branches/b1':

cd trunk/newdir
svn merge -r N:N+n ../../branches/b1/olddir

Ideally, you should be able to pull over large swathes of directories
and revisions using this technique. You just have to break up
revision ranges across directory and/or file renames.

BTW, you can merge changes to files even if the files have changed.
See the transcript below:

Regards,
Blair

-- 
Blair Zajac, Ph.D.
CTO, OrcaWare Technologies
<blair@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/
svnadmin create repos
svn co file://`pwd`/repos wc
cd wc/
svn mkdir trunk
cd trunk/
cp /etc/passwd .
svn add passwd
cd ..
svn ci -m ''
svn mkdir branches
svn ci -m ''
svn cp trunk branches/b1
svn ci -m ''
cd branches/
cd b1/
vi passwd (delete line number 1)
svn ci -m ''
svn mv passwd passwd.1
svn ci -m ''
cd ../../
svn update
cd trunk/
ls
vi passwd (delete line number 2)
svn ci -m ''
svn update
cd ..
svu
svn update
cd branches/b1
svn merge -r 5:6 ../../trunk (this will fail)
svn merge -r 5:6 ../../trunk/passwd passwd.1 (this will work)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Feb 11 06:55:23 2006

This is an archived mail posted to the Subversion Users mailing list.