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

Re: [PATCH] Merge source and target must be related but different branches, v1

From: Paul Burba <ptburba_at_gmail.com>
Date: Wed, 14 Dec 2011 14:46:55 -0500

On Wed, Dec 14, 2011 at 8:18 AM, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> Here's a patch to reject silly merge attempts, which up to now give silly results.
>
> This does not apply to all merges (general 2-URL and cherry-pick merges), but the commonly used 'sync' and 'reintegrate' forms of merge only make sense when the source and target 'branches' are related (have a common ancestor) and are not the same.
>
> This patch applies such checks to the 'reintegrate' merge, simple 'sync' merge, and the 'svn mergeinfo' command.

Hi Julian,

This premise of this patch seems reasonable to me. I don't see that
it thwarts any legitimate use cases. We'll longer be able to do
things like update a WC target to a rev N<HEAD then 'sync' all the
changes from N+1:HEAD, e.g.:

C:\SVN\src-trunk-4>svn up
Updating '.':
At revision 1214356.

C:\SVN\src-trunk-4>svn log -q -l1
------------------------------------------------------------------------
r1214216 | stsp | 2011-12-14 07:38:48 -0500 (Wed, 14 Dec 2011)
------------------------------------------------------------------------

C:\SVN\src-trunk-4>svn up -r1214215
Updating '.':
U subversion\libsvn_repos\load-fs-vtable.c
Updated to revision 1214215.

C:\SVN\src-trunk-4>svn merge ^^/subversion/trunk .
DBG: util.c:1462: ancestor:
https://svn.apache.org/repos/asf/subversion/trunk@1214215
DBG: util.c:1470: url1:
https://svn.apache.org/repos/asf/subversion/trunk@1214358
DBG: util.c:1471: url2:
https://svn.apache.org/repos/asf/subversion/trunk@1214215
..\..\..\subversion\svn\main.c:2684: (apr_err=205000)
svn: E205000: Try 'svn help' for more info
..\..\..\subversion\svn\merge-cmd.c:370: (apr_err=205000)
..\..\..\subversion\svn\util.c:1487: (apr_err=205000)
svn: E205000: This merge requires two different but related branches
..\..\..\subversion\svn\util.c:1473: (apr_err=205000)
svn: E205000: Source and target are the same branch:
'https://svn.apache.org/repos/asf/subversion/trunk@1214358' and
https://svn.apache.org/repos/asf/subversion/trunk@1214215'

But was this ever useful? I don't see how. We can still do this *if*
we specify an actual revision/revision range.

> A few tests currently fail with this patch -- tests that use the special "svn merge FILE[@REV]" syntax.  I'm currently investigating this and learning what it's supposed to be doing.

I assume you mean these two merge tests?

  6 merging a file w/no explicit target path or revs [#785]
  12 merge one file without explicit revisions

Those fail because of the new limitation I described above. Again, I
don't think this is necessarily a bad thing.

> Comments?

A bit bikesheddy, bit I wonder if it might make for a cleaner error
messages if we use the repo root shorthand notation: For example,
this:

svn: E205000: Source and target are the same branch:
'^/subversion/trunk_at_1145992' and '^/subversion/branches/1.7.x_at_1213741'

Rather than this:

svn: E205000: Source and target are the same branch:
'https://svn.apache.org/repos/asf/subversion/trunk@1145992' and
'https://svn.apache.org/repos/asf/subversion/branches/1.7.x@1213741'

Paul
Received on 2011-12-14 20:47:30 CET

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