Author: pburba
Date: Tue Oct 5 16:12:29 2010
New Revision: 1004694
URL: http://svn.apache.org/viewvc?rev=1004694&view=rev
Log:
Expand test for issue #3324 to cover reverse merge scenario.
* subversion/tests/cmdline/merge_tests.py
(merge_range_prior_to_rename_source_existence): Make a second branch on
which to demonstrate issue #3324 but during a reverse merge. Any fix
for this issue needs to work for both!
Modified:
subversion/trunk/subversion/tests/cmdline/merge_tests.py
Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1004694&r1=1004693&r2=1004694&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue Oct 5
16:12:29 2010
@@ -13846,7 +13846,9 @@ def merge_range_prior_to_rename_source_e
nu_moved_path = os.path.join(wc_dir, "A", "D", "H", "nu_moved")
A_path = os.path.join(wc_dir, "A")
A_COPY_path = os.path.join(wc_dir, "A_COPY")
+ A_COPY_2_path = os.path.join(wc_dir, "A_COPY_2")
B_COPY_path = os.path.join(wc_dir, "A_COPY", "B")
+ B_COPY_2_path = os.path.join(wc_dir, "A_COPY_2", "B")
beta_COPY_path = os.path.join(wc_dir, "A_COPY", "B", "E", "beta")
gamma_COPY_path = os.path.join(wc_dir, "A_COPY", "D", "gamma")
rho_COPY_path = os.path.join(wc_dir, "A_COPY", "D", "G", "rho")
@@ -13856,27 +13858,28 @@ def merge_range_prior_to_rename_source_e
# Setup our basic 'trunk' and 'branch':
# r2 - Copy A to A_COPY
- # r3 - Text change to A/D/H/psi
- # r4 - Text change to A/D/G/rho
- # r5 - Text change to A/B/E/beta
- # r6 - Text change to A/D/H/omega
- wc_disk, wc_status = set_up_branch(sbox, False, 1)
+ # r3 - Copy A to A_COPY_2
+ # r4 - Text change to A/D/H/psi
+ # r5 - Text change to A/D/G/rho
+ # r6 - Text change to A/B/E/beta
+ # r7 - Text change to A/D/H/omega
+ wc_disk, wc_status = set_up_branch(sbox, False, 2)
- # r7 - Add the file A/D/H/nu
+ # r8 - Add the file A/D/H/nu
svntest.main.file_write(nu_path, "This is the file 'nu'.\n")
svntest.actions.run_and_verify_svn(None, None, [], 'add', nu_path)
expected_output = wc.State(wc_dir, {'A/D/H/nu' : Item(verb='Adding')})
- wc_status.add({'A/D/H/nu' : Item(status=' ', wc_rev=7)})
+ wc_status.add({'A/D/H/nu' : Item(status=' ', wc_rev=8)})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
wc_status, None, wc_dir)
- # r8 - Merge all available revisions (i.e. -r1:7) from A to A_COPY.
- svntest.actions.run_and_verify_svn(None, ["At revision 7.\n"], [], 'up',
+ # r9 - Merge all available revisions (i.e. -r1:8) from A to A_COPY.
+ svntest.actions.run_and_verify_svn(None, ["At revision 8.\n"], [], 'up',
wc_dir)
- wc_status.tweak(wc_rev=7)
+ wc_status.tweak(wc_rev=8)
svntest.actions.run_and_verify_svn(
None,
- expected_merge_output([[2,7]],
+ expected_merge_output([[2,8]],
['A ' + nu_COPY_path + '\n',
'U ' + beta_COPY_path + '\n',
'U ' + rho_COPY_path + '\n',
@@ -13896,45 +13899,45 @@ def merge_range_prior_to_rename_source_e
'A_COPY/D/G/rho',
'A_COPY/D/H/omega',
'A_COPY/D/H/psi',
- wc_rev=8)
- wc_status.add({'A_COPY/D/H/nu' : Item(status=' ', wc_rev=8)})
+ wc_rev=9)
+ wc_status.add({'A_COPY/D/H/nu' : Item(status=' ', wc_rev=9)})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
wc_status, None, wc_dir)
- # r9 - Reverse merge -r7:1 from A/B to A_COPY/B
- svntest.actions.run_and_verify_svn(None, ["At revision 8.\n"], [], 'up',
+ # r10 - Reverse merge -r8:1 from A/B to A_COPY/B
+ svntest.actions.run_and_verify_svn(None, ["At revision 9.\n"], [], 'up',
wc_dir)
- wc_status.tweak(wc_rev=8)
+ wc_status.tweak(wc_rev=9)
svntest.actions.run_and_verify_svn(
None,
- expected_merge_output([[7,2]], ['U ' + beta_COPY_path + '\n',
+ expected_merge_output([[8,2]], ['U ' + beta_COPY_path + '\n',
' G ' + B_COPY_path + '\n',]),
- [], 'merge', sbox.repo_url + '/A/B', B_COPY_path, '-r7:1')
+ [], 'merge', sbox.repo_url + '/A/B', B_COPY_path, '-r8:1')
expected_output = wc.State(wc_dir,
{'A_COPY/B' : Item(verb='Sending'),
'A_COPY/B/E/beta' : Item(verb='Sending')})
wc_status.tweak('A_COPY/B',
'A_COPY/B/E/beta',
- wc_rev=9)
+ wc_rev=10)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
wc_status, None, wc_dir)
- # r10 - Move A/D/H/nu to A/D/H/nu_moved
+ # r11 - Move A/D/H/nu to A/D/H/nu_moved
svntest.actions.run_and_verify_svn(None, ["\n",
- "Committed revision 10.\n"], [],
+ "Committed revision 11.\n"], [],
'move', sbox.repo_url + '/A/D/H/nu',
sbox.repo_url + '/A/D/H/nu_moved',
'-m', 'Move nu to nu_moved')
svntest.actions.run_and_verify_svn(None,
["D " + nu_path + "\n",
"A " + nu_moved_path + "\n",
- "Updated to revision 10.\n"],
+ "Updated to revision 11.\n"],
[], 'up', wc_dir)
- # Now merge -r5:10 from A to A_COPY.
- # A_COPY needs only -r7:10, which amounts only to the rename of nu.
- # The subtree A_COPY/B needs the entire range -r5:10 because of
- # the reverse merge we performed in r9; but none of these revisions
+ # Now merge -r6:11 from A to A_COPY.
+ # A_COPY needs only -r8:11, which amounts only to the rename of nu.
+ # The subtree A_COPY/B needs the entire range -r6:11 because of
+ # the reverse merge we performed in r10; but none of these revisions
# is operative in A/B so there are no changes to A_COPY/B.
#
# This merge currently fails because the delete half of the A_COPY/D/H/nu
@@ -13950,30 +13953,30 @@ def merge_range_prior_to_rename_source_e
expected_elision_output = wc.State(A_COPY_path, {
})
expected_status = wc.State(A_COPY_path, {
- '' : Item(status=' M', wc_rev=10),
- 'B' : Item(status=' ', wc_rev=10),
- 'mu' : Item(status=' ', wc_rev=10),
- 'B/E' : Item(status=' ', wc_rev=10),
- 'B/E/alpha' : Item(status=' ', wc_rev=10),
- 'B/E/beta' : Item(status=' ', wc_rev=10),
- 'B/lambda' : Item(status=' ', wc_rev=10),
- 'B/F' : Item(status=' ', wc_rev=10),
- 'C' : Item(status=' ', wc_rev=10),
- 'D' : Item(status=' ', wc_rev=10),
- 'D/G' : Item(status=' ', wc_rev=10),
- 'D/G/pi' : Item(status=' ', wc_rev=10),
- 'D/G/rho' : Item(status=' ', wc_rev=10),
- 'D/G/tau' : Item(status=' ', wc_rev=10),
- 'D/gamma' : Item(status=' ', wc_rev=10),
- 'D/H' : Item(status=' ', wc_rev=10),
- 'D/H/nu' : Item(status='D ', wc_rev='10'),
+ '' : Item(status=' M', wc_rev=11),
+ 'B' : Item(status=' ', wc_rev=11),
+ 'mu' : Item(status=' ', wc_rev=11),
+ 'B/E' : Item(status=' ', wc_rev=11),
+ 'B/E/alpha' : Item(status=' ', wc_rev=11),
+ 'B/E/beta' : Item(status=' ', wc_rev=11),
+ 'B/lambda' : Item(status=' ', wc_rev=11),
+ 'B/F' : Item(status=' ', wc_rev=11),
+ 'C' : Item(status=' ', wc_rev=11),
+ 'D' : Item(status=' ', wc_rev=11),
+ 'D/G' : Item(status=' ', wc_rev=11),
+ 'D/G/pi' : Item(status=' ', wc_rev=11),
+ 'D/G/rho' : Item(status=' ', wc_rev=11),
+ 'D/G/tau' : Item(status=' ', wc_rev=11),
+ 'D/gamma' : Item(status=' ', wc_rev=11),
+ 'D/H' : Item(status=' ', wc_rev=11),
+ 'D/H/nu' : Item(status='D ', wc_rev=11),
'D/H/nu_moved' : Item(status='A ', wc_rev='-', copied='+'),
- 'D/H/chi' : Item(status=' ', wc_rev=10),
- 'D/H/psi' : Item(status=' ', wc_rev=10),
- 'D/H/omega' : Item(status=' ', wc_rev=10),
+ 'D/H/chi' : Item(status=' ', wc_rev=11),
+ 'D/H/psi' : Item(status=' ', wc_rev=11),
+ 'D/H/omega' : Item(status=' ', wc_rev=11),
})
expected_disk = wc.State('', {
- '' : Item(props={SVN_PROP_MERGEINFO : '/A:2-10'}),
+ '' : Item(props={SVN_PROP_MERGEINFO : '/A:2-11'}),
'mu' : Item("This is the file 'mu'.\n"),
# A_COPY/B wasn't touched by the merge so keeps its existing mergeinfo.
'B' : Item(props={SVN_PROP_MERGEINFO : ''}),
@@ -13996,7 +13999,130 @@ def merge_range_prior_to_rename_source_e
'D/H/omega' : Item("New content"),
})
expected_skip = wc.State(A_COPY_path, {})
- svntest.actions.run_and_verify_merge(A_COPY_path, 5, 10,
+ svntest.actions.run_and_verify_merge(A_COPY_path, 6, 11,
+ sbox.repo_url + '/A', None,
+ expected_output,
+ expected_mergeinfo_output,
+ expected_elision_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, None, None, None,
+ None, 1, 1)
+ svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
+ 'Merge -r6:11 from A to A_COPY', wc_dir)
+
+ # Now run a similar scenario as above on the second branch, but with
+ # a reverse merge this time.
+ #
+ # r13 - Merge all available revisions from A/B to A_COPY_B and then merge
+ # -r2:8 from A to A_COPY_2. Among other things, this adds A_COPY_2/D/H/nu
+ # and leaves us with mergeinfo on the A_COPY_2 branch of:
+ #
+ # Properties on 'A_COPY_2':
+ # svn:mergeinfo
+ # /A:3-8
+ # Properties on 'A_COPY_2\B':
+ # svn:mergeinfo
+ # /A/B:3-12
+ svntest.actions.run_and_verify_svn(None, ["At revision 12.\n"], [], 'up',
+ wc_dir)
+ svntest.actions.run_and_verify_svn(None,
+ None, # Don't check stdout, we test this
+ # type of merge to death elsewhere.
+ [], 'merge', sbox.repo_url + '/A/B',
+ B_COPY_2_path)
+ svntest.actions.run_and_verify_svn(None, None,[], 'merge', '-r', '2:8',
+ sbox.repo_url + '/A', A_COPY_2_path)
+ svntest.actions.run_and_verify_svn(
+ None, None, [], 'ci', '-m',
+ 'Merge all from A/B to A_COPY_2/B\nMerge -r2:8 from A to A_COPY_2',
+ wc_dir)
+ svntest.actions.run_and_verify_svn(None, ["At revision 13.\n"], [], 'up',
+ wc_dir)
+
+ # Now reverse merge -r12:7 from A to A_COPY_2.
+ #
+ # Recall:
+ #
+ # >svn log -r8:12 ^/A -v
+ # ------------------------------------------------------------------------
+ # r8 | jrandom | 2010-10-05 11:52:17 -0400 (Tue, 05 Oct 2010) | 1 line
+ # Changed paths:
+ # A /A/D/H/nu
+ #
+ # log msg
+ # ------------------------------------------------------------------------
+ # r11 | jrandom | 2010-10-05 11:52:19 -0400 (Tue, 05 Oct 2010) | 1 line
+ # Changed paths:
+ # D /A/D/H/nu
+ # A /A/D/H/nu_moved (from /A/D/H/nu:10)
+ #
+ # Move nu to nu_moved
+ # ------------------------------------------------------------------------
+ #
+ # None of those revisions touch A/B, so A_COPY_2/B will remain unchanged by
+ # the merge. Since we can only reverse merge changes from the explicit
+ # mergeinfo or natural history of a target, the only eligible revision to
+ # affect the remainder of the tree rooted at A_COPY_2 is r8, the addition
+ # of A/D/H/nu. So A_COPY/D/H/nu should deleted. However, like the forward
+ # merge performed earlier, A_COPY/D/H/nu is reported as deleted, but still
+ # remains in the WC.
+ expected_output = wc.State(A_COPY_2_path, {
+ 'D/H/nu' : Item(status='D '),
+ })
+ expected_mergeinfo_output = wc.State(A_COPY_2_path, {
+ '' : Item(status=' U'),
+ })
+ expected_elision_output = wc.State(A_COPY_2_path, {
+ })
+ expected_status = wc.State(A_COPY_2_path, {
+ '' : Item(status=' M'),
+ 'B' : Item(status=' '),
+ 'mu' : Item(status=' '),
+ 'B/E' : Item(status=' '),
+ 'B/E/alpha' : Item(status=' '),
+ 'B/E/beta' : Item(status=' '),
+ 'B/lambda' : Item(status=' '),
+ 'B/F' : Item(status=' '),
+ 'C' : Item(status=' '),
+ 'D' : Item(status=' '),
+ 'D/G' : Item(status=' '),
+ 'D/G/pi' : Item(status=' '),
+ 'D/G/rho' : Item(status=' '),
+ 'D/G/tau' : Item(status=' '),
+ 'D/gamma' : Item(status=' '),
+ 'D/H' : Item(status=' '),
+ 'D/H/nu' : Item(status='D '),
+ 'D/H/chi' : Item(status=' '),
+ 'D/H/psi' : Item(status=' '),
+ 'D/H/omega' : Item(status=' '),
+ })
+ expected_status.tweak(wc_rev=13)
+ expected_disk = wc.State('', {
+ '' : Item(props={SVN_PROP_MERGEINFO : '/A:3-7'}),
+ 'mu' : Item("This is the file 'mu'.\n"),
+ # A_COPY_2/B wasn't touched by the merge so keeps its existing mergeinfo.
+ 'B' : Item(props={SVN_PROP_MERGEINFO : '/A/B:3-12'}),
+ 'B/E' : Item(),
+ 'B/E/alpha' : Item("This is the file 'alpha'.\n"),
+ 'B/E/beta' : Item("New content"),
+ 'B/lambda' : Item("This is the file 'lambda'.\n"),
+ 'B/F' : Item(),
+ 'C' : Item(),
+ 'D' : Item(),
+ 'D/G' : Item(),
+ 'D/G/pi' : Item("This is the file 'pi'.\n"),
+ 'D/G/rho' : Item("New content"),
+ 'D/G/tau' : Item("This is the file 'tau'.\n"),
+ 'D/gamma' : Item("This is the file 'gamma'.\n"),
+ 'D/H' : Item(),
+ 'D/H/chi' : Item("This is the file 'chi'.\n"),
+ 'D/H/psi' : Item("New content"),
+ 'D/H/omega' : Item("New content"),
+ })
+ expected_skip = wc.State(A_COPY_path, {})
+ svntest.actions.run_and_verify_merge(A_COPY_2_path, 12, 7,
sbox.repo_url + '/A', None,
expected_output,
expected_mergeinfo_output,