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

Merge Scenario & Expectations

From: Kyle McKay <mackyle_at_tigris.org>
Date: 2007-07-31 12:11:10 CEST

I was talking with a co-worker today about Subversion and merges. He
is evaluating other version control systems for a possible move away
from Subversion. Lack of integrated merge tracking is a huge issue
-- I encouraged him to hold out for Subversion 1.5 before making any
final decisions.

In the course of our discussion, he brought up one of the test
scenarios he's using to evaluate the different version control
systems. Subversion (at least in 1.4.x) does not currently pass his
test, so I thought it would be worthwhile sharing the test.

Step 1:
Create a branch1 area containing:
file1: contents "file1"
file2: contents "file2"

Step 2:
Copy branch1 to branch2

Step 3:
In a working copy of branch1:
rename file1 to newfile1
add a line change2 to file2
check in these changes

Step 4:
In a working copy of branch2
add a line change1 to file1
rename file2 to newfile2
check in these changes

Step 5:
Merge the changes from Step 3 into branch2

His expectation at this point is that branch2 will now contain:
newfile1: contents "file1\nchange1"
newfile2: contents "file2\nchange2"

But that is not what happens.

Here is a simple bash shell script that demonstrates this situation
using svnmerge.py to provide the correct revision range for the merge
in Step 5:

# create a test repository in /tmp
svnadmin create /tmp/svntest
REPO=file:///tmp/svntest

# Step 1
svn mkdir -mbranch1 $REPO/branch1
svn co $REPO/branch1 && cd branch1
echo file1 > file1
echo file2 > file2
svn add file1 file2
svn ci -mfiles
cd ..

# Step 2
svn cp -mbranch2 $REPO/branch1 $REPO/branch2
svn co $REPO/branch2 && cd branch2
svnmerge.py init
svn ci -mtracking

# Step 3
cd ../branch1
svn mv file1 newfile1
echo change2 >> file2
svn ci -mchange1

# Step 4
cd ../branch2
echo change1 >> file1
svn mv file2 newfile2
svn ci -mchange2

# Step 5
svnmerge.py -s merge

# At this point what you have in branch2 wc
# is almost certainly not what you want

Is Subversion 1.5 expected to do a better job handling this scenario
or is this sort of merging-of-renamed-items still further on down the
roadmap?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 31 12:09:44 2007

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.