You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Lieven Govaerts <lg...@mobsol.be> on 2006/03/20 13:19:22 UTC

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

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

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

Posted by Lieven Govaerts <lg...@mobsol.be>.
Quoting Jorge <jo...@gmail.com>:

> Lieven Govaerts <lgo <at> mobsol.be> writes:
> > # now merge the new folder to trunk
> > cd ..
> > svn merge -r 2:4 file:///tmp/svnissue/issue/branch trunk
> >
>
>
> Did you try using "--ignore-ancestry"?
> It should help because your delete+add has really broken the historic-line of
> the folder (the newly added is really another folder)
[..]

Using --ignore-ancestry is another workaround indeed. The only problem with that
option is that it applies to all changes being merged, and it 'throws away' the
history of the folder being deleted+added in branch.

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

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

Posted by Jorge <jo...@gmail.com>.
Lieven Govaerts <lgo <at> mobsol.be> writes:
> # now merge the new folder to trunk
> cd ..
> svn merge -r 2:4 file:///tmp/svnissue/issue/branch trunk
> 


Did you try using "--ignore-ancestry"?
It should help because your delete+add has really broken the historic-line of
the folder (the newly added is really another folder)

Anyway... I think this option is under-documented; I find myself using it often
when promoting branches (not changes). The fact of TortoiseSVN not providing it
doesn't help neither; too much of my users are afraid of command line, I guess.

Regards,

_
Jorge





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Lieven Govaerts <lg...@mobsol.be>.
That code is merged to trunk right? I'll check it tonight then to see if it's
really solved. Thanks for the input.

Lieven.

Quoting Ben Collins-Sussman <su...@red-bean.com>:

> I believe this bug is fixed in svn 1.4, it was one of the major
> motivations for all the libsvn_wc changes.
>
> On 3/20/06, Lieven Govaerts <lg...@mobsol.be> wrote:
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>




----------------------------------------------------------------
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

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

Posted by Lieven Govaerts <lg...@mobsol.be>.
I read on irc-dev that I was already the fourth guy asking this question this
month. I'm sorry for that, but my search on users and dev didn't show anything
related.

Isn't it appropriate then to file this issue in the issue tracker? It will serve
as documentation for users experiencing the problem, and it contains an
acceptance test which can be used to validate that the bug is fixed in 1.4.

Lieven.

Quoting Ben Collins-Sussman <su...@red-bean.com>:

> I believe this bug is fixed in svn 1.4, it was one of the major
> motivations for all the libsvn_wc changes.
>
> On 3/20/06, Lieven Govaerts <lg...@mobsol.be> wrote:
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>




----------------------------------------------------------------
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

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

Posted by Ben Collins-Sussman <su...@red-bean.com>.
I believe this bug is fixed in svn 1.4, it was one of the major
motivations for all the libsvn_wc changes.

On 3/20/06, Lieven Govaerts <lg...@mobsol.be> wrote:
> 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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org