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

[BUG] svn merge doesn't merge delete+add of folder

From: Lieven Govaerts <lgo_at_mobsol.be>
Date: 2006-03-20 14:19:22 CET

Hi,

my users are encountering an issue with merging delete+add of a folder from one
branch to another. I've seen this problem for some time now, but I'm so used to
just provide them with the workaround that I forgot to report it here.

0. Context
----------
Tested on:
- Subversion 1.2.3 on Windows ( standard Windows installer )
- Subversion 1.3.0 on Linux ( Suse 9, built from source )

1. The problem in short
-----------------------
r1: create a repository
    add trunk, add trunk/folder and add some files in the folder + commit

r2: create branch from trunk
r3: on branch, delete the folder 'folder' + commit

r4: on branch, add folder again, with some files + commit

Now merge the changes from branch ( r2:4 ) to trunk.

This merge will fail with error:
svn: Revision 4 doesn't match existing revision 2 in 'trunk/folder'
In trunk's working copy, only the delete of 'folder' has been merged, adding the
new 'folder' has failed.

2. The workaround
-----------------
Once you decipher the error message, the workaround is to split the merge in two
parts:
- find the revision in which 'folder' was deleted from to branch.
- merge up to that revision to trunk + commit
- merge the rest of the revisions to trunk + commit

3. Issue?
---------
The fact that merge can not replace a folder by a new folder with the same name
is an issue for me. The error message is also pretty unclear. In fact, I have
no idea what it is trying to say. The revisions it shows are normally totally
unrelated to the revisions in which the delete and add where committed.

I've seen this problem reported on the users list before, so I guessed an issue
was already reported in the issue tracker, but I can't find any that looks
related. Maybe someone else can confirm this?

4. Reproduction recipe
----------------------
# create a new empty repository ( fixed path in /tmp/svnissue )
cd /tmp
mkdir svnissue
cd svnissue/
svnadmin create issue
svn checkout file:///tmp/svnissue/issue issuewc
cd issuewc

# add trunk
mkdir trunk
mkdir trunk/folder
echo "test content" > trunk/folder/testfile
svn add trunk
svn ci trunk -m "added trunk with folder"

# create branch from this trunk
svn cp file:///tmp/svnissue/issue/trunk file:///tmp/svnissue/issue/branch -m
"created branch from trunk@1"

svn update

# delete original folder
cd branch/
svn del folder
svn ci . -m "deleted folder"

# add new folder ( reusing the same name! )
mkdir folder
echo "new content" > folder/otherfile
svn add folder
svn ci . -m "add folder again"

# now merge the new folder to trunk
cd ..
svn merge -r 2:4 file:///tmp/svnissue/issue/branch trunk

# You'll notice an exception: svn: Revision 4 doesn't match existing revision 2
in 'trunk/folder'
# Only the delete of folder will be merged, adding the new folder fails.
---------------------------

regards,

Lieven.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 20 14:20:54 2006

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.