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

RE: Difference between merge -c and merge -r

From: Scott Bloom <scott_at_towel42.com>
Date: Fri, 29 Sep 2017 16:02:04 +0000

That does clarify things. I would suggest something in the docs (tool help as well as the redbook), since the redbook uses both with no reason for either.

My coworker, read somewhere it was "cherry picking", I have always used -r when I need to do it, and yes -r 99:100 is "harder" than -c 100..

But we were getting some conflicts, and I wasn't sure of the cause.. when speaking with the coworker as to how he was merging, this came up.

Thanks for the detailed explanation.

Scott
-----Original Message-----
From: Stefan Sperling [mailto:stsp_at_apache.org]
Sent: Friday, September 29, 2017 08:57
To: Scott Bloom <scott_at_towel42.com>
Cc: Subversion <users_at_subversion.apache.org>
Subject: Re: Difference between merge -c and merge -r

On Fri, Sep 29, 2017 at 03:36:27PM +0000, Scott Bloom wrote:
> After reading the docs, I cant for the life of me, figure out what the difference is. Any pointer where I can learn what the difference in the two merge techniques is?
>
> Scott

Hi Scott,

The -c option is just syntactic sugar.

Before it was invented, merging a single revision, say r100, was always done like this: svn merge -r99:100 This asks svn to merge the difference between r99 and r100, i.e.
the changeset committed in r100.

With -c, we can write this in a shorter way: svn merge -c100 This is equivalent to svn merge -r99:100

The -r option also supports "reverse" merges, where the differences of the original changeset are reversed: svn merge -r100:99 effectively backs out changes from r100. To achieve this effect with -c, prepend a minus sign to the number: svn merge -c-100

To make copy-pasting revision numbers from the output of 'svn log' easier the -c option also accepts numbers with 'r' prepended:
  svn merge -cr100
is the same as
  svn merge -c100
and
  svn merge -c-r100
is the same as
  svn merge -c-100

To an untrained eye the -c-r100 case might look as if the -r option was used, but that is not the case. It's the -c option with a minus for a reverse-merge and an 'r' prepended to the revision number.

The -c option also accepts multiple revision numbers separated by commas:
  svn merge -c100,102,105,200
This merges changes from all the listed revisions in the given order.
The -r option can be specified multiple times for the same effect but this is much more verbose: svn merge -r99:100 -r101:102 -r104:105 -r199:200

I hope this clarifies the situation :)
Received on 2017-09-29 18:02:23 CEST

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