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

Re: Symmetric Merge

From: Paul Burba <ptburba_at_gmail.com>
Date: Tue, 27 Mar 2012 19:59:06 -0400

On Thu, Mar 22, 2012 at 5:36 AM, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> If anyone wants to try the new symmetric merge code, it's basically in place.  It's not finished.  It's enabled with '--symmetric' command-line option.  I've just tried running it in place of 'reintegrate, using the following patch to the test suite, and this much seems to work...
>
> Index: subversion/tests/cmdline/svntest/actions.py
> ===================================================================
> --- subversion/tests/cmdline/svntest/actions.py    (revision 1303481)
> +++ subversion/tests/cmdline/svntest/actions.py    (working copy)
> @@ -1029,6 +1029,9 @@ def run_and_verify_merge(dir, rev1, rev2
>    the working copy, but still verify the entire working copy dir. """
>
>    merge_command = [ "merge" ]
> +  if '--reintegrate' in args:
> +    args += ('--symmetric',)
> +
>    if url2:
>      merge_command.extend((url1 + "@" + str(rev1), url2 + "@" + str(rev2)))
>    else:
>
>
> Now I'll try using it in place of 'sync' merges.  But the more interesting thing is it should be able to do repeated 'reintegrate' merges, and indeed arbitrary sequences of to-and-fro merges between a pair of branches, without any 'keep-alive dance'.
>
> Please tell me what you think or what you find!
>
> - Julian

Hi Julian,

I tweaked run_and_verify_svn2 in a manner similar to what you did to
run_and_verify_merge. This picks up a lot of other 'svn merge' uses
and several test failures. These failures fall into 4 basic
categories as detailed below. I'll be trying some ad hoc testing
tomorrow, but wanted to give you what I found thus far.

[[[
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py (revision 1305966)
+++ subversion/tests/cmdline/svntest/actions.py (working copy)
@@ -320,6 +320,30 @@
   elif expected_stderr != []:
     want_err = True

+ if 'merge' in varargs:
+ print "## run_and_verify_svn2(" + ' '.join(varargs) + ")"
+ if '--reintegrate' in varargs:
+ print '## Adding --symmetric option to reintegrate merge' + '
'.join(varargs)
+ varargs += ('--symmetric',)
+ elif not [arg for arg in varargs
+ if arg.startswith('-r') or arg.startswith('--revision')
+ or arg.startswith('-c') or arg.startswith('--change')]:
+ #if len([arg for arg in varargs if not arg.startswith('-')]) <= 3:
+ source_count = 0
+ # Is this a 2-URL merge?
+ for arg in varargs:
+ if (arg.startswith('file://')
+ or arg.startswith('svn://')
+ or arg.startswith('http://')
+ or (arg.find('@') > 1)):
+ print "##" + arg
+ source_count+=1
+ if source_count < 2:
+ print '## Adding --symmetric option to sync merge'
+ varargs += ('--symmetric',)
+
   exit_code, out, err = main.run_svn(want_err, *varargs)
   verify.verify_outputs(message, out, err, expected_stdout, expected_stderr)
   verify.verify_exit_code(message, exit_code, expected_exit)
]]]

######################################################
1) Merge from a file to itself asserts:

(Using our own Greek tree)

>svn merge ^^/iota iota --symmetric
..\..\..\subversion\libsvn_client\merge.c:3631: (apr_err=235000)
svn: E235000: In file '..\..\..\subversion\libsvn_client\merge.c' line
3631: assertion failed (SVN_IS_VALID_REVNUM(start) &&
SVN_IS_VALID_REVNUM(end) && (start
> end))

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

>svn merge iota --symmetric
..\..\..\subversion\libsvn_client\merge.c:3631: (apr_err=235000)
svn: E235000: In file '..\..\..\subversion\libsvn_client\merge.c' line
3631: assertion failed (SVN_IS_VALID_REVNUM(start) &&
SVN_IS_VALID_REVNUM(end) && (start
> end))

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

######################################################
2) Mergeinfo for shallow merges not recorded correctly.

Using the --symmetric option causes shallow merges to be recorded as
if they were infinite depth.

>svn st

>svn pg svn:mergeinfo

>svn mergeinfo --show-revs eligible ^^/A A_COPY
r4
r5
r6
r7
r8

>svn merge ^^/A A_COPY --depth empty --symmetric
DBG: merge.c:11195: base on source:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_1
DBG: merge.c:11197: base on target:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_1
DBG: merge.c:11310: yca
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_1
DBG: merge.c:11311: base
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_1
DBG: merge.c:11313: mid
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_8
DBG: merge.c:11314: right
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-55/A_at_8
--- Recording mergeinfo for merge between repository URLs into 'A_COPY':
 U A_COPY

>svn diff
Index: A_COPY
===================================================================
--- A_COPY (revision 8)
+++ A_COPY (working copy)

Property changes on: A_COPY
___________________________________________________________________
Added: svn:mergeinfo
   Merged /A:r2-8

^^^^
That's wrong, the mergeinfo should be non-inheritable, like below,
otherwise it appears we performed the merge at depth-infinity.

>svn revert -Rq .

>svn merge ^^/A A_COPY --depth empty
--- Recording mergeinfo for merge of r2 through r8 into 'A_COPY':
 U A_COPY

>svn diff
Index: A_COPY
===================================================================
--- A_COPY (revision 8)
+++ A_COPY (working copy)

Property changes on: A_COPY
___________________________________________________________________
Added: svn:mergeinfo
   Merged /A:r2-8*

######################################################
3) Subtree merge not properly considering pre-exiting mergeinfo.

As merge_tests.py 83 'subtree merge source might not exist'
demonstrates, merges are not properly considering existing mergeinfo
on the target and are repeating merges:

>svn pg svn:mergeinfo A_COPY\D\H\omega
/A/D/H/omega:6,8

>svn mergeinfo --show-revs eligible ^^/A/D/H/omega A_COPY\D\H\omega

r12

### Why is this merging *everything* again?

>svn merge ^^/A/D/H/omega A_COPY\D\H\omega --symmetric
DBG: merge.c:11195: base on source:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_1
DBG: merge.c:11197: base on target:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_1
DBG: merge.c:11310: yca
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_1
DBG: merge.c:11311: base
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_1
DBG: merge.c:11313: mid
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_12
DBG: merge.c:11314: right
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-83/A/D/H/omega_at_12
Conflict discovered in
'C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/working_copies/merge_tests-83/A_COPY/D/H/omega'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: p

### VVVVV This is the notification for a 2-URL merge, is this expected
now in some cases? VVVVVV

--- Merging differences between repository URLs into 'A_COPY\D\H\omega':
C A_COPY\D\H\omega
--- Recording mergeinfo for merge between repository URLs into
'A_COPY\D\H\omega':
 U A_COPY\D\H\omega
Summary of conflicts:
  Text conflicts: 1

>svn pg svn:mergeinfo A_COPY\D\H\omega
/A/D/H/omega:2-12

>svn revert -Rq .

### This is correct, the merge is broken up into three discreet
revision ranges, 2-5, 7 , and 9-12. The first two are flagged as
noops and no editor drive occurs, only the last operative block is
merged (though of course all three are recorded in the mergeinfo).

>svn merge ^^/A/D/H/omega A_COPY\D\H\omega
--- Merging r9 through r12 into 'A_COPY\D\H\omega':
U A_COPY\D\H\omega
--- Recording mergeinfo for merge of r2 through r12 into 'A_COPY\D\H\omega':
 U A_COPY\D\H\omega

There is a similar bug demonstrated by merge_tests.py 120 'reverse
merge adds subtree', but with a directory target.

Note: The following tests also demonstrate similar behavior:

merge_tests.py 71 'merge range predates history'
merge_tests.py 78 'dont merge revs into a subtree that predate it'
merge_tests.py 79 'merge fails with renamed subtrees with mergeinfo'
merge_tests.py 96 'merge prior to rename src existence still dels src'
merge_reintegrate_tests.py 10 'merge --reintegrate with subtree mergeinfo'
merge_reintegrate_tests.py 11 'multiple reintegrates create self-referential'
merge_authz_tests.py 3: reintegrate fails if no root access

######################################################
3) Symmetric merge code needs to error out sooner if WC is missing subtrees:

### Missing subtrees...
>svn st
! A_COPY\mu
! A_COPY\C
! A_COPY\D\G
! A_COPY\D\G\rho
! A_COPY\D\G\pi
! A_COPY\D\G\tau
! A_COPY\D\H\psi

### ...should be a no-op error:
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113>svn
merge ^^/A A_COPY
..\..\..\subversion\svn\util.c:913: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:10969: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:10933: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:9099: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:8573: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:5877: (apr_err=195016)
svn: E195016: Merge tracking not allowed with missing subtrees; try
restoring these items first:
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\D\H\psi
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\D\G
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\mu
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\C

### Not sure this is really a desirable outcome.
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113>svn
merge ^^/A A_COPY --symmetric
DBG: merge.c:11195: base on source:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_1
DBG: merge.c:11197: base on target:
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_1
DBG: merge.c:11310: yca
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_1
DBG: merge.c:11311: base
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_1
DBG: merge.c:11313: mid
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_6
DBG: merge.c:11314: right
file:///C:/SVN/src-trunk-3/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-113/A_at_6
--- Merging differences between repository URLs into 'A_COPY':
U A_COPY\B\E\beta
Skipped missing target: 'A_COPY\D\G'
U A_COPY\D\H\omega
Skipped missing target: 'A_COPY\D\H\psi'
--- Recording mergeinfo for merge between repository URLs into 'A_COPY':
Summary of conflicts:
  Skipped paths: 2
..\..\..\subversion\svn\util.c:913: (apr_err=195016)
..\..\..\subversion\svn\merge-cmd.c:132: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:11379: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:11351: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:9241: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:9099: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:8573: (apr_err=195016)
..\..\..\subversion\libsvn_client\merge.c:5877: (apr_err=195016)
svn: E195016: Merge tracking not allowed with missing subtrees; try
restoring these items first:
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\C
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\D\H\psi
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\D\G
C:\SVN\src-trunk-3\Debug\subversion\tests\cmdline\svn-test-work\working_copies\merge_tests-113\A_COPY\mu

Paul
Received on 2012-03-28 01:59:41 CEST

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