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

Re: Cherry-picking merges

From: Daniel Becroft <djcbecroft_at_gmail.com>
Date: Thu, 29 Apr 2010 17:47:20 +1000

 On Thu, Apr 29, 2010 at 10:08 AM, Vadym Chepkov <vchepkov_at_gmail.com> wrote:

> Hi,
>
> I know, this is maybe not the best practice, but, unfortunately, our
> subversion users do this all the time: they merge form one branch to another
> back and forward.
> The question is, how to properly do it without introducing conflicts.
> Here is the test case, which one would think should be handled properly,
> but for some reason it's not:
>
> [~]$ svnadmin create mergerepo
> [~]$ svn co file://`pwd`/mergerepo mergework
> Checked out revision 0.
>
> [mergework]$ svn mkdir --parents branches/b1
> A /home/vvc/mergework/branches
> A /home/vvc/mergework/branches/b1
>
> [mergework]$ svn commit -m "Created branch b1"
> Adding branches
> Adding branches/b1
>
> Committed revision 1.
>
> [mergework]$ svn copy branches/b1 branches/b2
> A branches/b2
> [mergework]$ svn commit -m "Created branch b2"
> Adding branches/b2
>
> Committed revision 2.
>
>
> [b2]$ touch README
> [b2]$ svn add README
> A README
> [b2]$ svn commit -m "Added README"
> Adding b2/README
> Transmitting file data .
> Committed revision 3.
>
>
> [b1]$ svn merge -c 3 ^/branches/b2
> --- Merging r3 into '.':
> A README
> [b1]$ svn commit -m "Merged r3 into b1"
> Sending b1
> Adding b1/README
>
> Committed revision 4.
>

[b2]$ svn merge --dry-run ^/branches/b1
> --- Merging r2 through r4 into '.':
> C README
> Summary of conflicts:
> Tree conflicts: 1
>

After r3, you'll need to do a '--record-only' merge of r4 into the second
branch:

(untested) svn merge --record-only -c 4 ^/branches/b1

SVN doesn't seem to trace back through the commits to see that r3 was really
a merge from b2->b1. Like yourself, I initially though that it would be able
to deal with this, but it doesn't seem to (and there is probably a very good
reason why it can't).

Cheers,
Daniel B.
Received on 2010-04-29 09:48:15 CEST

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

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