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

Re: Is merging branches reliable?

From: Ryan Schmidt <subversion-2006q2_at_ryandesign.com>
Date: 2006-05-07 14:22:11 CEST

Please keep your replies on the mailing list so others can benefit
from the discussion.

On May 7, 2006, at 09:14, Zsolt wrote:

> On May 6, 2006, Ryan Schmidt wrote:
>
>> In all the emails that have been exchanged in this thread so far, we
>> have yet to see the actual commands you executed to perform your
>> merge. But I think Baz is probably right: that you told Subversion to
>> merge the wrong things, and it happily did, and the result was not
>> what you wanted. Take a look at his examples to see how merging is
>> usually used.
>>
>> Here's an explanation I wrote before [1] about how merging works.
>> Perhaps this will help make it more clear how to use it correctly?
>>
>> On 2006-01-05 Ryan Schmidt wrote:
>>
>>> Understanding merging can be confusing at first, and once you do
>>> understand it, it can be hard to explain to someone else, which is
>>> why sometimes even reading the documentation doesn't help. But
>>> here's
>>> an explanation I've used before, which I've been told was helpful:
>>>
>>> Think of "svn merge" like this. It operates on three places, A, B
>>> and
>>> C. It makes a list of steps to transform A into B (or: transform
>>> "from" A "to" B, to match it up with TortoiseSVN's dialog), and then
>>> performs that list of steps on C. C is a working copy, and A and B
>>> are often different revisions of a URL in the repository, or two
>>> different URLs in the repository (two tag directories, for
>>> instance).
>>
>> On the command line, the C part is optional, and if omitted, the
>> current directory is used, which must be a working copy.
>>
>> [1] http://svn.haxx.se/users/archive-2006-01/0149.shtml
>
> I could reproduce exactly the same (wrong results) with "svn" (thus
> without
> subclipse).
>
> I executed svn merge "URL1" "URL2" in the working directory.
>
> I tried if "URL1" showed to "trunk" and also if "URL2" showed to
> the trunk
> and in both cases I got (different) wrong results.
>
> Is my problem a usage one? I could make the merge more or less
> correctly
> with:
> svn merge -r BRANCH-START-REVISION:HEAD BRANCH-URL
> (and I checked out) the trunk into a working directory.

Yes, it's a usage problem -- understanding how merge works. You
quoted the part of my message where I tried to explain how it works.
Did you have any specific questions about my explanation?

As you found, "svn merge -r BRANCH-START-REVISION:HEAD BRANCH-URL" in
a working copy of trunk is the correct way to do this particular merge.

> What does the command svn merge "URL1" "URL2" does?

As I explained yesterday, it does the following:

* Create a list of steps that transform "URL1" into "URL2"
* Perform that series of steps in the current working copy

So if, as we suspect, you said "svn merge TRUNK-URL BRANCH-URL" in a
working copy of trunk, what you've told Subversion to do is to create
a recipe that transforms the trunk into the branch -- that is, all
changes that had been done on the branch would be done on the trunk
(which is what you want), and all changes that had been done on the
trunk since the branch was created would be *undone* (which is not
what you wanted, so this was not the correct way to do this merge).

> How can I just merge a branch into a working directory?
>
> At http://svnbook.red-bean.com/nightly/en/index.html I found several
> examples however not the most important thing: how can I merge a
> branch back
> to the main trunk?

This exact scenario is explained in the book here:

http://svnbook.red-bean.com/nightly/en/
svn.branchmerge.commonuses.html#svn.branchmerge.commonuses.wholebr

And you already discovered above how to do it.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun May 7 14:24:14 2006

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.