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

[PATCH][merge-tracking] XFail Testcase for 'avoid merge on subtree of a target if it has the same mergeinfo already'

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-11-28 19:16:31 CET

Hi All,
Find the attached patch and log.

With regards
Kamesh Jayachandran

[[[

If merge target's subtree has merge avoid repeated merge by taking in to
account what is already merged.

* subversion/tests/cmdline/merge_tests.py
  (create_deep_trees):
    New function with a code borrowed from
    'avoid_repeated_merge_using_inherited_merge_info' to reuse from the new
    Testcase.
  (avoid_repeated_merge_using_inherited_merge_info):
    Changes in effect of new 'create_deep_trees'.
  (avoid_repeated_merge_on_subtree_having_merge_info):
    New function for the Testcase mentioned in the summary.
  (test_list):
    Include 'avoid_repeated_merge_on_subtree_having_merge_info' as XFail.

Patch by: Kamesh Jayachandran <kamesh@collab.net>
]]]

Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 22468)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -3872,10 +3872,11 @@
                                        expected_backup_status,
                                        expected_backup_skip)
 
-def avoid_repeated_merge_using_inherited_merge_info(sbox):
- "use inherited merge info to avoid repeated merge"
+def create_deep_trees(sbox):
+ """Create A/B/F/E by moving A/B/E to A/B/F.
+ Copy A/B to A/copy_of_B.
+ Update the WC to r3"""
 
- sbox.build()
   wc_dir = sbox.wc_dir
 
   A_path = os.path.join(wc_dir, 'A')
@@ -3886,10 +3887,12 @@
   # Deepen the directory structure we're working with by moving E to
   # underneath F and committing, creating revision 2.
   svntest.main.run_svn(None, 'mv', A_B_E_path, A_B_F_path)
+
   expected_output = wc.State(wc_dir, {
     'A/B/E' : Item(verb='Deleting'),
     'A/B/F/E' : Item(verb='Adding')
     })
+
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
   expected_status.add({
@@ -3897,10 +3900,10 @@
     'A/B/F/E/alpha' : Item(status=' ', wc_rev=2),
     'A/B/F/E/beta' : Item(status=' ', wc_rev=2),
     })
+
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status, None,
                                         None, None, None, None, wc_dir)
-
   # Bring the entire WC up to date with rev 2.
   svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)
 
@@ -3911,6 +3914,7 @@
   expected_output = svntest.wc.State(wc_dir, {
     'A/copy-of-B' : Item(verb='Adding'),
     })
+
   expected_status.tweak(wc_rev=2)
   expected_status.add({
     'A/copy-of-B' : Item(status=' ', wc_rev=3),
@@ -3920,10 +3924,28 @@
     'A/copy-of-B/F/E/beta' : Item(status=' ', wc_rev=3),
     'A/copy-of-B/lambda' : Item(status=' ', wc_rev=3),
     })
+
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status, None,
                                         None, None, None, None, wc_dir)
+ # Bring the entire WC up to date with rev 3.
+ svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)
 
+def avoid_repeated_merge_using_inherited_merge_info(sbox):
+ "use inherited merge info to avoid repeated merge"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ A_B_path = os.path.join(A_path, 'B')
+ A_B_E_path = os.path.join(A_B_path, 'E')
+ A_B_F_path = os.path.join(A_B_path, 'F')
+ copy_of_B_path = os.path.join(A_path, 'copy-of-B')
+
+ create_deep_trees(sbox)
+ #Now WC is at r3.
+
   # Edit alpha and commit it, creating revision 4.
   alpha_path = os.path.join(A_B_F_path, 'E', 'alpha')
   new_content_for_alpha = 'new content to alpha\n'
@@ -3934,7 +3956,19 @@
   expected_output = svntest.wc.State(wc_dir, {
     'A/B/F/E/alpha' : Item(verb='Sending'),
     })
- expected_status.tweak('A/B/F/E/alpha', wc_rev=4)
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+ expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
+ expected_status.add({
+ 'A/B/F/E' : Item(status=' ', wc_rev=3),
+ 'A/B/F/E/alpha' : Item(status=' ', wc_rev=4),
+ 'A/B/F/E/beta' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E/alpha': Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E/beta' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/lambda' : Item(status=' ', wc_rev=3),
+ })
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status, None,
                                         None, None, None, None, wc_dir)
@@ -4034,6 +4068,171 @@
   finally:
     os.chdir(saved_cwd)
 
+def avoid_repeated_merge_on_subtree_having_merge_info(sbox):
+ "use subtree merge info to avoid repeated merge"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ A_B_path = os.path.join(A_path, 'B')
+ A_B_E_path = os.path.join(A_B_path, 'E')
+ A_B_F_path = os.path.join(A_B_path, 'F')
+ A_B_F_E_path = os.path.join(A_B_F_path, 'E')
+ copy_of_B_path = os.path.join(A_path, 'copy-of-B')
+
+ create_deep_trees(sbox)
+ #Now WC is at r3.
+
+ # Edit alpha and commit it, creating revision 4.
+ alpha_path = os.path.join(A_B_F_E_path, 'alpha')
+ new_content_for_alpha = 'new content to alpha\n'
+ fp = open(alpha_path, 'w')
+ fp.write(new_content_for_alpha)
+ fp.close()
+
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/B/F/E/alpha' : Item(verb='Sending'),
+ })
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+ expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
+ expected_status.add({
+ 'A/B/F/E' : Item(status=' ', wc_rev=3),
+ 'A/B/F/E/alpha' : Item(status=' ', wc_rev=4),
+ 'A/B/F/E/beta' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E/alpha': Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/F/E/beta' : Item(status=' ', wc_rev=3),
+ 'A/copy-of-B/lambda' : Item(status=' ', wc_rev=3),
+ })
+
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, wc_dir)
+
+ copy_of_B_F_E_path = os.path.join(copy_of_B_path, 'F', 'E')
+
+ # Search for the comment entitled "The Merge Kluge" elsewhere in
+ # this file, to understand why we shorten and chdir() below.
+ short_copy_of_B_F_E_path = shorten_path_kludge(copy_of_B_F_E_path)
+
+ # Merge changes to alpha from rev 4.
+ expected_output = wc.State(short_copy_of_B_F_E_path, {
+ 'alpha' : Item(status='U '),
+ })
+
+ expected_status = wc.State(short_copy_of_B_F_E_path, {
+ '' : Item(status=' M', wc_rev=3),
+ 'alpha' : Item(status='M ', wc_rev=3),
+ 'beta' : Item(status=' ', wc_rev=3),
+ })
+
+ expected_disk = wc.State('', {
+ '' : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F/E:4'}),
+ 'alpha' : Item(new_content_for_alpha),
+ 'beta' : Item("This is the file 'beta'.\n"),
+ })
+
+ expected_skip = wc.State(short_copy_of_B_F_E_path, { })
+ saved_cwd = os.getcwd()
+ try:
+ os.chdir(svntest.main.work_dir)
+ svntest.actions.run_and_verify_merge(short_copy_of_B_F_E_path, '3', '4',
+ sbox.repo_url + '/A/B/F/E',
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None,
+ None,
+ None,
+ None,
+ None, 1)
+ finally:
+ os.chdir(saved_cwd)
+
+ expected_output = svntest.wc.State(copy_of_B_F_E_path, {
+ '' : Item(verb='Sending'),
+ 'alpha' : Item(verb='Sending'),
+ })
+
+ # Commit the result of the merge, creating revision 5.
+ svntest.actions.run_and_verify_commit(short_copy_of_B_F_E_path,
+ expected_output, None, None,
+ None, None, None, None, wc_dir)
+
+ # Edit A/B/F/E/alpha and commit it, creating revision 6.
+ new_content_for_alpha = 'new content to alpha\none more line\n'
+ fp = open(alpha_path, 'w')
+ fp.write(new_content_for_alpha)
+ fp.close()
+
+ expected_output = svntest.wc.State(A_B_F_E_path, {
+ 'alpha' : Item(verb='Sending'),
+ })
+
+ expected_status = wc.State(A_B_F_E_path, {
+ '' : Item(status=' ', wc_rev=3),
+ 'alpha' : Item(status=' ', wc_rev=6),
+ 'beta' : Item(status=' ', wc_rev=3),
+ })
+
+ svntest.actions.run_and_verify_commit(A_B_F_E_path, expected_output,
+ expected_status, None,
+ None, None, None, None, wc_dir)
+
+ # Search for the comment entitled "The Merge Kluge" elsewhere in
+ # this file, to understand why we shorten and chdir() below.
+ short_copy_of_B_path = shorten_path_kludge(copy_of_B_path)
+
+ # Update the WC to bring /A/copy_of_B from rev 3 to rev 6.
+ # Without this update expected_status tree would be cumbersome to
+ # understand.
+ svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)
+
+ # Merge changes from rev 6 of B (to alpha) into copy_of_B.
+ expected_output = wc.State(short_copy_of_B_path, {})
+ expected_status = wc.State(short_copy_of_B_path, {
+ #When we do merge multiple subtargets we record mergeinfo
+ #on each such subtargets. In this particular case as we don't have
+ #a successful merge no change in the WC.
+ '' : Item(status=' ', wc_rev=6),
+ 'F/E' : Item(status=' ', wc_rev=6),
+ 'F/E/alpha' : Item(status=' ', wc_rev=6),
+ 'F/E/beta' : Item(status=' ', wc_rev=6),
+ 'lambda' : Item(status=' ', wc_rev=6),
+ 'F' : Item(status=' ', wc_rev=6),
+ })
+ expected_disk = wc.State('', {
+ '' : Item(),
+ 'F/E' : Item(props={SVN_PROP_MERGE_INFO : '/A/B:4-6'}),
+ 'F/E/alpha' : Item(new_content_for_alpha),
+ 'F/E/beta' : Item("This is the file 'beta'.\n"),
+ 'F' : Item(),
+ 'lambda' : Item("This is the file 'lambda'.\n")
+ })
+ expected_skip = wc.State(short_copy_of_B_path, { })
+ saved_cwd = os.getcwd()
+ try:
+ os.chdir(svntest.main.work_dir)
+ svntest.actions.run_and_verify_merge(short_copy_of_B_path, '3', '6',
+ sbox.repo_url + \
+ '/A/B',
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None,
+ None,
+ None,
+ None,
+ None, 1)
+ finally:
+ os.chdir(saved_cwd)
+
 ########################################################################
 # Run the tests
 
@@ -4079,6 +4278,7 @@
               merge_conflict_markers_matching_eol,
               XFail(merge_eolstyle_handling),
               avoid_repeated_merge_using_inherited_merge_info,
+ XFail(avoid_repeated_merge_on_subtree_having_merge_info),
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 28 19:17:03 2006

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