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

RE: Problem understanding merging in SVN

From: Mats Nilsson <mats.nilsson_at_xware.se>
Date: 2003-04-23 15:57:22 CEST

Hi

You fall into a little trap with this use of "svn merge":

$ cd trunk
$ svn merge file:///repos/trunk file:///repos/branches/B .
This merges the changes from "current HEAD of trunk" to "current HEAD of
B" into the "HEAD of trunk", which is by definition exactly equivalent
to replacing trunk with B.

Remember, before this command "HEAD of trunk" now contains "changes made
to A", and "HEAD of B" contains "changes made to B". You need to specify
a earlier version as the left source.

Try either of these:

$ cd trunk
$ svn merge file:///repos/trunk_at_2 file:///repos/branches/B .
C filea

$ cd trunk
$ svn merge -r 2:4 file:///repos/branches/B .
C filea

This merges only the changes that happened on branch B (given that B was
born in revision 2)

Hope that helps.

Mats

> -----Original Message-----
> From: Francois Beausoleil [mailto:fbos@users.sourceforge.net]
> ...
> Let's say that I branch two times from one single revision.
> Let's call
> the
> branches A and B. So, the repository looks like this:
>
> /repos
> /trunk
> /filea
> /tags
> ...
> /branches
> /A
> /filea
> /B
> /filea
>
> Two developers work on each branch, concurrently. So, in the
> end, both
> branches need to be merged back in trunk. I can merge the
> first branch
> back
> in trunk without problem, but when I try to merge the second one, I
> do not get the expected result with the expected arguments.
> Here are the
> exact
> commands I used, and their results:
>
> # In this script, I made sure that the files would conflict
> by changing
> the
> # same line. The original file in trunk was empty, and I
> added a single
> line
> # to branches A and B.
>
> E:\wc>svn up
> At revision 4.
>
> E:\wc>cd trunk
>
> # In this next line, I believe I am asking SVN to
> # "Merge trunk with the changes that occured in A"
> E:\wc\trunk>svn merge file:///repos/trunk file:///repos/branches/A
> U filea
>
> E:\wc\trunk>cat filea
> changes made to A
>
>
> E:\wc\trunk>svn commit -m "Merged branch A back into trunk"
> Sending trunk/filea
> Transmitting file data .
> Committed revision 5.
>
> # In this next line, I expected SVN to give me a conflict - filea was
> updated
> # in both branches, and the changes should have conflicted.
> I certainly
> did
> # not expect SVN to replace the contents of filea with the changes in
> branch B
> E:\wc\trunk>svn merge file:///repos/trunk file:///repos/branches/B
> U filea
>
> E:\wc\trunk>cat filea
> Resolved issues with B branch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 23 15:58:10 2003

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.