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

Re: improving the "svn help merge" text....

From: Hari Kodungallur <hkodungallur_at_gmail.com>
Date: Fri, 4 Apr 2008 10:44:34 -0700

On Fri, Apr 4, 2008 at 9:54 AM, Nathan Nobbe <quickshiftin_at_gmail.com> wrote:
> On Thu, Apr 3, 2008 at 6:18 PM, Hari Kodungallur <hkodungallur_at_gmail.com>
> wrote:
>
> > I agree as well that the direction should be made explicit in the help.
I
> never noticed it till now :-)
> >
> >
> >
> > Nathan, I tend to look at it this way:
> >
> > svn merge [from] [to] [dest]
> > - difference from [from] to [to] and merge it to the [dest] which is
the
> working copy
> >
> > If you meant [src] and [dest] in terms of the diff direction, I think
you
> have it backwards. Or may be I am confused!!
>
> hmm; well i think it has the same semantics as svn diff; heres a snippet
> from the output of
>
> svn help diff
>
> 3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
>
> i believe svn merge behaves the same way, right? like, the first thing it
> does is, svn diff, then it applies those differences to the working copy
> thats been specified.
>
> so for example if you had a branch, branchB, and a trunk say; and you did
> something like
>
> svn merge branchB trunk wc
>
> that would be treating the branch as 'older', which could make sense if
you
> merged onto trunk from branchA and then wanted to merge down to branchB.

Not sure what you meant. But the merge command does not necessarily require
you to have a source URL that is an ancestor of the branch/trunk that you
are merging into.

> but if you branched, branchB, off of trunk, did a bunch of work there and
> wanted to get those changes back into trunk; it would be something like
>
> svn merge trunk branchB wc

Right; but only if you did not make any changes to the trunk. If you want to
merge all the changes to the branchB and only those changes, you should
rather use the -r option to specify two revisions of branchB (see below).

>
> where wc would be a working copy of the trunk. not accounting for the
> branch point of branchB, which i would do by using
>
> svn log --stop-on-copy branchB
>
> to determine the branch revision and then incorporate it into the above
> merge command via the -r argument.
>

Note that you can either give two source urls (from and to) or you can give
one source url with from and two revisions. Not both.

-- svn merge trunk branchB <wc-of-trunk>

will actually take the difference from trunk to branchB (so, the diff will
also be affected by the changes that you have made to the trunk, if any) and
then merge that to the working copy.

-- svn merge -rN:M branchB <wc-of-trunk>

Will take the diff of branchB from rev N to rev M and merge it to wc of
trunk. Lets say N is when you created the branch (what you found using
--stop-on-copy) and M is the HEAD. Then it will merge all changes in branchB
to trunk working copy.

Other than that, what you said is right. I was just confused by your [dest]
and [src] notations in the URL. Different people obviously visualize it in
different ways. So as long as what you are doing is right, it should work
for you :-)

Regards,
-Hari
Received on 2008-04-04 19:45:02 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.