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

Re: Question on branching the right way

From: Jody Shumaker <jody.shumaker_at_gmail.com>
Date: 2006-04-07 05:42:10 CEST

Ok, I read through this and realized you made one fatal flaw in your
understanding of merging. You don't understand correctly what the
"merge" in subversion is doing, and thus you're doing the wrong
operation. Subversion is just happily doing exactly what you told it
to do. Comments below:

On 4/6/06, Sascha Herpers <herpers@wiso.uni-koeln.de> wrote:
> Hello,
>
> yes, all of what you wrote is clear to me. But I still have the problem
> (no matter what direction the merge goes), that parts of the directory
> get overwritten, that shouldn't be overwritten.
>
> I guess the main problem is, that I can't explain it good enough. Let's
> try it with an example.
>
> In a fresh repository I created a file "text.txt" with one line:
> string myVersion;
> I commited it to the trunk and (afterwards) branched it. I added the
> following line to the trunk version and committed it again:
> myVersion = "trunk";
> Then I switched to the branch and applied and commit a similar change to
> the file:
> myVersion = "branch";
>

Up to this point you've done everything perfectly.

> Now comes the problem part. I decided to have another variable in both
> versions. Since I don't want to make the same change twice, I want to
> make it to the trunk and "somehow sync" the branch version.
>
> So I switched to the trunk and added a new line inbetween the two
> existing lines:
> int someInt;
>

Correct

> Now I call the merge command from tsvn. I specify to merge from branch
> to trunk. The unified diff shows the following:
> +int someInt;
>
> -myVersion = "custom";
> \ No newline at end of file
> +myVersion = "trunk";
> \ No newline at end of file
>

Wrong. Subversion just did exactly what you told it to do. The merge
command takes the difference between 2 specified points in the
repository, and applies that diff to your working copy. Or optionally
it just outputs the diff. It does NOT apply it to either of the
arguments of the merge command. In reality what you should have done
at this point is commit your change to trunk. Now switch to your
branch. Now call the merge command, specify your start point as the
revision just before the change you want to merge on trunk, and the
end point as the revision of the last change you want to merge. Now
run this merge using the merge button, not the unified diff button.
At this point, the merge has been applied to your working copy, you
can compile it, test it, resolve any conflicts etc. After that commit
it. At this point you have merged the changes from the trunk to the
branch.

I'd still highly suggest using some form of product build
configuration instead of branches for your currentsituation. Still,
you should know how merge actually works.

- Jody

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Fri Apr 7 05:42:25 2006

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

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