You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/08/10 22:56:05 UTC

svn commit: r984206 [32/35] - in /subversion/branches/ignore-mergeinfo: ./ build/ build/generator/ build/generator/templates/ build/hudson/ build/hudson/jobs/subversion-1.6.x-solaris/ build/hudson/jobs/subversion-1.6.x-ubuntu/ build/hudson/jobs/subvers...

Modified: subversion/branches/ignore-mergeinfo/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/tests/cmdline/merge_tests.py?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/branches/ignore-mergeinfo/subversion/tests/cmdline/merge_tests.py Tue Aug 10 20:55:56 2010
@@ -108,9 +108,7 @@ def check_mergeinfo_recursively(root_pat
 #
 #   Each test must return on success or raise on failure.
 
-
 #----------------------------------------------------------------------
-
 def textual_merges_galore(sbox):
   "performing a merge, with mixed results"
 
@@ -334,7 +332,7 @@ def textual_merges_galore(sbox):
   other_rho_text = ""
   for x in range(1,10):
     other_rho_text = other_rho_text + 'Unobtrusive line ' + repr(x) + ' in rho\n'
-  current_other_rho_text = svntest.main.file_read(other_rho_path)
+  current_other_rho_text = open(other_rho_path).read()
   svntest.main.file_write(other_rho_path,
                           other_rho_text + current_other_rho_text)
 
@@ -400,9 +398,7 @@ def textual_merges_galore(sbox):
 
 
 #----------------------------------------------------------------------
-
 # Merge should copy-with-history when adding files or directories
-
 def add_with_history(sbox):
   "merge and add new files/dirs with history"
 
@@ -528,121 +524,6 @@ def add_with_history(sbox):
                                         wc_dir)
 
 #----------------------------------------------------------------------
-
-# This test involves tree conflicts.
-def delete_file_and_dir(sbox):
-  "merge that deletes items"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  # Rev 2 copy B to B2
-  B_path = os.path.join(wc_dir, 'A', 'B')
-  B2_path = os.path.join(wc_dir, 'A', 'B2')
-  B_url = sbox.repo_url + '/A/B'
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'copy', B_path, B2_path)
-
-  expected_output = wc.State(wc_dir, {
-    'A/B2'       : Item(verb='Adding'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({
-    'A/B2'         : Item(status='  ', wc_rev=2),
-    'A/B2/E'       : Item(status='  ', wc_rev=2),
-    'A/B2/E/alpha' : Item(status='  ', wc_rev=2),
-    'A/B2/E/beta'  : Item(status='  ', wc_rev=2),
-    'A/B2/F'       : Item(status='  ', wc_rev=2),
-    'A/B2/lambda'  : Item(status='  ', wc_rev=2),
-    })
-  svntest.actions.run_and_verify_commit(wc_dir,
-                                        expected_output,
-                                        expected_status,
-                                        None,
-                                        wc_dir)
-
-  # Rev 3 delete E and lambda from B
-  E_path = os.path.join(B_path, 'E')
-  lambda_path = os.path.join(B_path, 'lambda')
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'delete', E_path, lambda_path)
-
-  expected_output = wc.State(wc_dir, {
-    'A/B/E'       : Item(verb='Deleting'),
-    'A/B/lambda'       : Item(verb='Deleting'),
-    })
-  expected_status.remove('A/B/E',
-                         'A/B/E/alpha',
-                         'A/B/E/beta',
-                         'A/B/lambda')
-  svntest.actions.run_and_verify_commit(wc_dir,
-                                        expected_output,
-                                        expected_status,
-                                        None,
-                                        wc_dir)
-
-  def modify_B2():
-    # Local mods in B2
-    B2_E_path = os.path.join(B2_path, 'E')
-    B2_lambda_path = os.path.join(B2_path, 'lambda')
-    svntest.actions.run_and_verify_svn(None, None, [],
-                                       'propset', 'foo', 'foo_val',
-                                       B2_E_path, B2_lambda_path)
-    expected_status.tweak(
-      'A/B2/E', 'A/B2/lambda',  status=' M'
-      )
-    svntest.actions.run_and_verify_status(wc_dir, expected_status)
-
-  modify_B2()
-
-  # Merge rev 3 into B2
-
-  # The local mods to the paths modified in r3 cause the paths to be
-  # tree-conflicted upon deletion, resulting in only the mergeinfo change
-  # to the target of the merge 'B2'.
-  expected_output = wc.State(B2_path, {
-    ''        : Item(),
-    'lambda'  : Item(status='  ', treeconflict='C'),
-    'E'       : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State(B2_path, {
-    ''         : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(B2_path, {
-    })
-  expected_disk = wc.State('', {
-    ''        : Item(props={SVN_PROP_MERGEINFO : '/A/B:3'}),
-    'E'       : Item(props={'foo' : 'foo_val'}),
-    'E/alpha' : Item("This is the file 'alpha'.\n"),
-    'E/beta'  : Item("This is the file 'beta'.\n"),
-    'F'       : Item(),
-    'lambda'  : Item("This is the file 'lambda'.\n",
-                     props={'foo' : 'foo_val'}),
-    })
-  expected_status2 = wc.State(B2_path, {
-    ''        : Item(status=' M'),
-    'E'       : Item(status=' M', treeconflict='C'),
-    'E/alpha' : Item(status='  '),
-    'E/beta'  : Item(status='  '),
-    'F'       : Item(status='  '),
-    'lambda'  : Item(status=' M', treeconflict='C'),
-    })
-  expected_status2.tweak(wc_rev=2)
-  expected_skip = wc.State('', { })
-  svntest.actions.run_and_verify_merge(B2_path, '2', '3', B_url, None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status2,
-                                       expected_skip,
-                                       None, None, None, None, None,
-                                       True)
-
-
-#----------------------------------------------------------------------
-
 # Issue 953
 def simple_property_merges(sbox):
   "some simple property merges"
@@ -858,250 +739,8 @@ def simple_property_merges(sbox):
   if not saw_foo or not saw_bar:
     raise svntest.Failure("Expected properties not found")
 
-
-#----------------------------------------------------------------------
-# This is a regression for issue #1176.
-
-# This test involves tree conflicts.
-def merge_catches_nonexistent_target(sbox):
-  "merge should not die if a target file is absent"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  # Copy G to a new directory, Q.  Create Q/newfile.  Commit a change
-  # to Q/newfile.  Now merge that change... into G.  Merge should not
-  # error, rather, it should report the tree conflict and continue.
-
-  G_path = os.path.join(wc_dir, 'A', 'D', 'G')
-  Q_path = os.path.join(wc_dir, 'A', 'D', 'Q')
-  newfile_path = os.path.join(Q_path, 'newfile')
-  Q_url = sbox.repo_url + '/A/D/Q'
-
-  # Copy dir A/D/G to A/D/Q
-  svntest.actions.run_and_verify_svn(None, None, [], 'cp', G_path, Q_path)
-
-  svntest.main.file_append(newfile_path, 'This is newfile.\n')
-  svntest.actions.run_and_verify_svn(None, None, [], 'add', newfile_path)
-
-  # Add newfile to dir G, creating r2.
-  expected_output = wc.State(wc_dir, {
-    'A/D/Q'          : Item(verb='Adding'),
-    'A/D/Q/newfile'  : Item(verb='Adding'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({
-    'A/D/Q'         : Item(status='  ', wc_rev=2),
-    'A/D/Q/pi'      : Item(status='  ', wc_rev=2),
-    'A/D/Q/rho'     : Item(status='  ', wc_rev=2),
-    'A/D/Q/tau'     : Item(status='  ', wc_rev=2),
-    'A/D/Q/newfile' : Item(status='  ', wc_rev=2),
-    })
-  svntest.actions.run_and_verify_commit(wc_dir,
-                                        expected_output,
-                                        expected_status,
-                                        None, wc_dir)
-
-  # Change newfile, creating r3.
-  svntest.main.file_append(newfile_path, 'A change to newfile.\n')
-  expected_output = wc.State(wc_dir, {
-    'A/D/Q/newfile'  : Item(verb='Sending'),
-    })
-  expected_status.tweak('A/D/Q/newfile', wc_rev=3)
-  svntest.actions.run_and_verify_commit(wc_dir,
-                                        expected_output,
-                                        expected_status,
-                                        None, wc_dir)
-
-  # Merge the change to newfile (from r3) into G, where newfile
-  # doesn't exist. This is a tree conflict (use case 4, see
-  # notes/tree-conflicts/detection.txt).
-  os.chdir(G_path)
-  expected_output = wc.State('', {
-    'newfile'         : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State('', {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State('', {
-    })
-  expected_status = wc.State('', {
-    ''     : Item(status=' M' ),
-    'pi'   : Item(status='  ' ),
-    'rho'  : Item(status='  ' ),
-    'tau'  : Item(status='  ' ),
-    })
-  expected_status.tweak(wc_rev=1)
-
-  expected_status.add({
-    'newfile': Item(status='! ', treeconflict='C' )
-    })
-
-  expected_status.tweak('', status=' M')
-
-  expected_disk = wc.State('', {
-    ''     : Item(props={SVN_PROP_MERGEINFO : '/A/D/Q:3'}),
-    'pi'   : Item("This is the file 'pi'.\n"),
-    'rho'  : Item("This is the file 'rho'.\n"),
-    'tau'  : Item("This is the file 'tau'.\n"),
-    })
-  expected_skip = wc.State('', {
-    })
-  svntest.actions.run_and_verify_merge('', '2', '3', Q_url, None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status,
-                                       expected_skip,
-                                       None, None, None, None, None, True)
-
-  expected_status.add({
-    'newfile' : Item(status='! ', treeconflict='C'),
-    })
-  svntest.actions.run_and_verify_unquiet_status('', expected_status)
-
-
-#----------------------------------------------------------------------
-
-# This test involves tree conflicts.
-def merge_tree_deleted_in_target(sbox):
-  "merge on deleted directory in target"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  # Copy B to a new directory, I. Modify B/E/alpha, Remove I/E. Now
-  # merge that change... into I.  Merge should report a tree conflict.
-
-  B_path = os.path.join(wc_dir, 'A', 'B')
-  I_path = os.path.join(wc_dir, 'A', 'I')
-  alpha_path = os.path.join(B_path, 'E', 'alpha')
-  B_url = sbox.repo_url + '/A/B'
-  I_url = sbox.repo_url + '/A/I'
-
-
-  # Copy B to I, creating r1.
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'cp', B_url, I_url, '-m', 'rev 2')
-
-  # Change some files, creating r2.
-  svntest.main.file_append(alpha_path, 'A change to alpha.\n')
-  svntest.main.file_append(os.path.join(B_path, 'lambda'), 'change lambda.\n')
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'ci', '-m', 'rev 3', B_path)
-
-  # Remove E, creating r3.
-  E_url = sbox.repo_url + '/A/I/E'
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'rm', E_url, '-m', 'rev 4')
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'up', os.path.join(wc_dir,'A'))
-
-  expected_output = wc.State(I_path, {
-    'lambda'  : Item(status='U '),
-    'E'       : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State(I_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(I_path, {
-    })
-  expected_disk = wc.State('', {
-    ''        : Item(props={SVN_PROP_MERGEINFO : '/A/B:3'}),
-    'F'       : Item(),
-    'lambda'  : Item("This is the file 'lambda'.\nchange lambda.\n"),
-    })
-  expected_status = wc.State(I_path, {
-    ''        : Item(status=' M'),
-    'F'       : Item(status='  '),
-    'lambda'  : Item(status='M '),
-    })
-  expected_status.tweak(wc_rev=4)
-  expected_status.add({
-    'E'       : Item(status='! ', treeconflict='C' )
-    })
-  expected_skip = wc.State(I_path, {
-    })
-  svntest.actions.run_and_verify_merge(I_path, '2', '3', B_url, None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status,
-                                       expected_skip,
-                                       None, None, None, None, None,
-                                       1, 0)
-  expected_status.add({
-    'E' : Item(status='! ', treeconflict='C'),
-    })
-  svntest.actions.run_and_verify_unquiet_status(I_path, expected_status)
-
-#----------------------------------------------------------------------
-# Issue #2515
-
-# This test involves tree conflicts.
-def merge_added_dir_to_deleted_in_target(sbox):
-  "merge an added dir on a deleted dir in target"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  # copy B to a new directory, I.
-  # delete F in I.
-  # add J to B/F.
-  # merge add to I.
-
-  B_url = sbox.repo_url + '/A/B'
-  I_url = sbox.repo_url + '/A/I'
-  F_url = sbox.repo_url + '/A/I/F'
-  J_url = sbox.repo_url + '/A/B/F/J'
-  I_path = os.path.join(wc_dir, 'A', 'I')
-
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'cp', B_url, I_url, '-m', 'rev 2')
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'rm', F_url, '-m', 'rev 3')
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'mkdir', '-m', 'rev 4', J_url)
-
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                      'up', os.path.join(wc_dir,'A'))
-
-  expected_output = wc.State(I_path, {
-    'F'       : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State(I_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(I_path, {
-    })
-  expected_disk = wc.State('', {
-    'E'       : Item(),
-    'E/alpha' : Item("This is the file 'alpha'.\n"),
-    'E/beta'  : Item("This is the file 'beta'.\n"),
-    'lambda'  : Item("This is the file 'lambda'.\n"),
-    })
-  expected_skip = wc.State(I_path, {
-    })
-
-  svntest.actions.run_and_verify_merge(I_path, '2', '4', B_url, None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       None,
-                                       expected_skip,
-                                       None, None, None, None, None,
-                                       0, 0)
-
 #----------------------------------------------------------------------
 # This is a regression for issue #1176.
-
 def merge_similar_unrelated_trees(sbox):
   "merging similar trees ancestrally unrelated"
 
@@ -1289,25 +928,28 @@ def merge_one_file_helper(sbox, arg_flav
   expected_status.tweak('A/D/G/rho', status=rho_expected_status)
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+#----------------------------------------------------------------------
 def merge_one_file_using_r(sbox):
   "merge one file (issue #1150) using the -r option"
   merge_one_file_helper(sbox, 'r')
 
+#----------------------------------------------------------------------
 def merge_one_file_using_c(sbox):
   "merge one file (issue #1150) using the -c option"
   merge_one_file_helper(sbox, 'c')
 
+#----------------------------------------------------------------------
 def merge_one_file_using_implicit_revs(sbox):
   "merge one file without explicit revisions"
   merge_one_file_helper(sbox, '*')
 
+#----------------------------------------------------------------------
 def merge_record_only(sbox):
   "mark a revision range as merged"
   merge_one_file_helper(sbox, 'r', 1)
 
 #----------------------------------------------------------------------
 # This is a regression for the enhancement added in issue #785.
-
 def merge_with_implicit_target_helper(sbox, arg_flav):
   "ARG_FLAV is one of 'r' (revision range) or 'c' (single change)."
 
@@ -1423,23 +1065,22 @@ def merge_with_implicit_target_helper(sb
     raise svntest.Failure("Unexpected text '%s' in 'mu', expected '%s'" %
                           (svntest.tree.get_text('mu'), orig_mu_text))
 
-
-
+#----------------------------------------------------------------------
 def merge_with_implicit_target_using_r(sbox):
   "merging a file w/no explicit target path using -r"
   merge_with_implicit_target_helper(sbox, 'r')
 
+#----------------------------------------------------------------------
 def merge_with_implicit_target_using_c(sbox):
   "merging a file w/no explicit target path using -c"
   merge_with_implicit_target_helper(sbox, 'c')
 
+#----------------------------------------------------------------------
 def merge_with_implicit_target_and_revs(sbox):
   "merging a file w/no explicit target path or revs"
   merge_with_implicit_target_helper(sbox, '*')
 
-
 #----------------------------------------------------------------------
-
 def merge_with_prev(sbox):
   "merge operations using PREV revision"
 
@@ -1539,7 +1180,6 @@ def merge_with_prev(sbox):
 # Regression test for issue #1319: 'svn merge' should *not* 'C' when
 # merging a change into a binary file, unless it has local mods, or has
 # different contents from the left side of the merge.
-
 def merge_binary_file(sbox):
   "merge change into unchanged binary file"
 
@@ -1547,8 +1187,7 @@ def merge_binary_file(sbox):
   wc_dir = sbox.wc_dir
 
   # Add a binary file to the project
-  theta_contents = svntest.main.file_read(
-    os.path.join(sys.path[0], "theta.bin"), 'rb')
+  theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
   # Write PNG file data into 'A/theta'.
   theta_path = os.path.join(wc_dir, 'A', 'theta')
   svntest.main.file_write(theta_path, theta_contents, 'wb')
@@ -1620,114 +1259,26 @@ def merge_binary_file(sbox):
                                        1)
 
 #----------------------------------------------------------------------
-# Regression test for issue #2403: Incorrect 3-way merge of "added"
-# binary file which already exists (unmodified) in the WC
-
-# This test involves tree conflicts.
-def three_way_merge_add_of_existing_binary_file(sbox):
-  "3-way merge of 'file add' into existing binary"
+# Regression test for Issue #1297:
+# A merge that creates a new file followed by an immediate diff
+# The diff should succeed.
+def merge_in_new_file_and_diff(sbox):
+  "diff after merge that creates a new file"
 
   sbox.build()
   wc_dir = sbox.wc_dir
 
-  # Create a branch of A, creating revision 2.
-  A_url = sbox.repo_url + "/A"
-  branch_A_url = sbox.repo_url + "/copy-of-A"
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     "cp",
-                                     A_url, branch_A_url,
-                                     "-m", "Creating copy-of-A")
+  trunk_url = sbox.repo_url + '/A/B/E'
 
-  # Add a binary file to the WC.
-  theta_contents = svntest.main.file_read(
-    os.path.join(sys.path[0], "theta.bin"), 'rb')
-  # Write PNG file data into 'A/theta'.
-  A_path = os.path.join(wc_dir, 'A')
-  theta_path = os.path.join(wc_dir, 'A', 'theta')
-  svntest.main.file_write(theta_path, theta_contents, 'wb')
+  # Create a branch
+  svntest.actions.run_and_verify_svn(None, None, [], 'cp',
+                                     trunk_url,
+                                     sbox.repo_url + '/branch',
+                                     '-m', "Creating the Branch")
 
-  svntest.main.run_svn(None, "add", theta_path)
-
-  # Commit the new binary file to the repos, creating revision 3.
-  expected_output = svntest.wc.State(wc_dir, {
-    "A/theta" : Item(verb="Adding  (bin)"),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({
-    "A/theta" : Item(status="  ", wc_rev=3),
-    })
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None,
-                                        wc_dir)
-
-  # In the working copy, attempt to 'svn merge branch_A_url@2 A_url@3 A'.
-  # We should *not* see a conflict during the merge, but an 'A'.
-  # And after the merge, the status should not report any differences.
-
-  expected_output = wc.State(wc_dir, {
-    "A/theta" : Item(status="  ", treeconflict='C'),
-    })
-  expected_elision_output = wc.State(wc_dir, {
-    })
-
-  # As greek_state is rooted at / instead of /A (our merge target), we
-  # need a sub-tree of it rather than straight copy.
-  expected_disk = svntest.main.greek_state.subtree("A")
-  expected_disk.add({
-    "" : Item(props={SVN_PROP_MERGEINFO : '/A:2-3'}),
-    "theta" : Item(theta_contents,
-                   props={"svn:mime-type" : "application/octet-stream"}),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({
-    "A/theta" : Item(status="  ", wc_rev=3, treeconflict='C'),
-    })
-  expected_status.tweak("A", status=" M")
-  expected_status.remove("")  # top-level of the WC
-  expected_status.remove("iota")
-  expected_skip = wc.State("", { })
-
-  # If we merge into wc_dir alone, theta appears at the WC root,
-  # which is in the wrong location -- append "/A" to stay on target.
-  #
-  # Note we don't bother checking expected mergeinfo output because
-  # three-way merges record mergeinfo multiple times on the same
-  # path, 'A' in this case.  The first recording is reported as ' U'
-  # but the second is reported as ' G'.  Our expected tree structures
-  # can't handle checking for multiple values for the same key.
-  svntest.actions.run_and_verify_merge(A_path, "2", "3",
-                                       branch_A_url, A_url,
-                                       expected_output,
-                                       None, # expected_mergeinfo_output
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status,
-                                       expected_skip,
-                                       None, None, None, None, None,
-                                       1)
-
-#----------------------------------------------------------------------
-# Regression test for Issue #1297:
-# A merge that creates a new file followed by an immediate diff
-# The diff should succeed.
-
-def merge_in_new_file_and_diff(sbox):
-  "diff after merge that creates a new file"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  trunk_url = sbox.repo_url + '/A/B/E'
-
-  # Create a branch
-  svntest.actions.run_and_verify_svn(None, None, [], 'cp',
-                                     trunk_url,
-                                     sbox.repo_url + '/branch',
-                                     '-m', "Creating the Branch")
-
-  # Update to revision 2.
-  svntest.actions.run_and_verify_svn(None, None, [],
-                                     'update', wc_dir)
+  # Update to revision 2.
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'update', wc_dir)
 
   new_file_path = os.path.join(wc_dir, 'A', 'B', 'E', 'newfile')
   svntest.main.file_write(new_file_path, "newfile\n")
@@ -1790,10 +1341,9 @@ def merge_in_new_file_and_diff(sbox):
 
 
 #----------------------------------------------------------------------
-
 # Issue #1425:  'svn merge' should skip over any unversioned obstructions.
-
-# This test involves tree conflicts. - but attempting to test for pre-tree-conflict behaviour
+# This test involves tree conflicts. - but attempting to test for
+# pre-tree-conflict behaviour
 def merge_skips_obstructions(sbox):
   "merge should skip over unversioned obstructions"
 
@@ -2160,7 +1710,7 @@ def merge_into_missing(sbox):
   expected_status = wc.State(F_path, {
     ''      : Item(status='  ', wc_rev=1),
     'foo'   : Item(status='! ', wc_rev=2),
-    'Q'     : Item(status='! ', wc_rev='?'),
+    'Q'     : Item(status='! ', wc_rev='2', entry_rev='?'),
     })
   expected_skip = wc.State(F_path, {
     'Q'   : Item(),
@@ -2182,7 +1732,7 @@ def merge_into_missing(sbox):
   expected_status = wc.State(F_path, {
     ''      : Item(status=' M', wc_rev=1),
     'foo'   : Item(status='!M', wc_rev=2),
-    'Q'     : Item(status='! ', wc_rev='?'),
+    'Q'     : Item(status='! ', wc_rev='2', entry_rev='?'),
     })
   expected_mergeinfo_output = wc.State(F_path, {
     ''    : Item(status=' U'),
@@ -2213,13 +1763,12 @@ def merge_into_missing(sbox):
   expected_status.add({
     'A/B/F'     : Item(status=' M', wc_rev=1),
     'A/B/F/foo' : Item(status='!M', wc_rev=2),
-    'A/B/F/Q'   : Item(status='! ', wc_rev='?'),
+    'A/B/F/Q'   : Item(status='! ', wc_rev='2', entry_rev='?'),
     })
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 # A test for issue 1738
-
 def dry_run_adds_file_with_prop(sbox):
   "merge --dry-run adding a new file with props"
 
@@ -2277,10 +1826,8 @@ def dry_run_adds_file_with_prop(sbox):
                                        1) # and do a dry-run also)
 
 #----------------------------------------------------------------------
-
 # Regression test for issue #1673
 # Merge a binary file from two URL with a common ancestry
-
 def merge_binary_with_common_ancestry(sbox):
   "merge binary files with common ancestry"
 
@@ -2292,8 +1839,7 @@ def merge_binary_with_common_ancestry(sb
   svntest.main.run_svn(None, 'mkdir', I_path)
 
   # Add a binary file to the common ancestry path
-  theta_contents = svntest.main.file_read(
-    os.path.join(sys.path[0], "theta.bin"), 'rb')
+  theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
   theta_I_path = os.path.join(I_path, 'theta')
   svntest.main.file_write(theta_I_path, theta_contents)
   svntest.main.run_svn(None, 'add', theta_I_path)
@@ -2566,7 +2112,6 @@ def merge_funny_chars_on_path(sbox):
 
 #-----------------------------------------------------------------------
 # Regression test for issue #2064
-
 def merge_keyword_expansions(sbox):
   "merge changes to keyword expansion property"
 
@@ -2689,7 +2234,7 @@ def merge_prop_change_to_deleted_target(
                                      svntest.verify.AnyOutput, [], 'merge',
                                      '-r1:2', '--ignore-ancestry', '.')
 
-
+#----------------------------------------------------------------------
 def set_up_dir_replace(sbox):
   """Set up the working copy for directory replace tests, creating
   directory 'A/B/F/foo' with files 'new file' and 'new file2' within
@@ -2804,7 +2349,6 @@ def set_up_dir_replace(sbox):
 #----------------------------------------------------------------------
 # A merge that replaces a directory
 # Tests for Issue #2144 and Issue #2607
-
 def merge_dir_replace(sbox):
   "merge a replacement of a directory"
 
@@ -2921,7 +2465,6 @@ def merge_dir_replace(sbox):
 #----------------------------------------------------------------------
 # A merge that replaces a directory and one of its children
 # Tests for Issue #2690
-
 def merge_dir_and_file_replace(sbox):
   "replace both dir and one of its children"
 
@@ -3009,7 +2552,6 @@ def merge_dir_and_file_replace(sbox):
   expected_output = svntest.wc.State(wc_dir, {
     'A/C'                    : Item(verb='Sending'),
     'A/C/foo'                : Item(verb='Replacing'),
-    'A/C/foo/bar'            : Item(verb='Adding'),
     })
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
@@ -3029,6 +2571,16 @@ def merge_dir_and_file_replace(sbox):
                                         expected_status,
                                         None, wc_dir)
 
+  # Confirm the files are present in the repository.
+  new_file_2_url = sbox.repo_url + '/A/C/foo/new file 2'
+  svntest.actions.run_and_verify_svn(None, ["New text in new file 2.\n"],
+                                     [], 'cat',
+                                     new_file_2_url)
+  new_file_3_url = sbox.repo_url + '/A/C/foo/bar/new file 3'
+  svntest.actions.run_and_verify_svn(None, ["Initial text in new file 3.\n"],
+                                     [], 'cat',
+                                     new_file_3_url)
+
 #----------------------------------------------------------------------
 def merge_file_with_space_in_its_name(sbox):
   "merge a file whose name contains a space"
@@ -3062,7 +2614,6 @@ def merge_file_with_space_in_its_name(sb
 # A merge between two branches using no revision number with the dir being
 # created already existing as an unversioned directory.
 # Tests for Issue #2222
-
 def merge_dir_branches(sbox):
   "merge between branches (Issue #2222)"
 
@@ -3117,7 +2668,6 @@ def merge_dir_branches(sbox):
 
 
 #----------------------------------------------------------------------
-
 def safe_property_merge(sbox):
   "property merges don't overwrite existing prop-mods"
 
@@ -3245,10 +2795,8 @@ def safe_property_merge(sbox):
                                        0) # dry_run
 
 #----------------------------------------------------------------------
-
 # Test for issue 2035, whereby 'svn merge' wouldn't always mark
 # property conflicts when it should.
-
 def property_merge_from_branch(sbox):
   "property merge conflict even without local mods"
 
@@ -3375,10 +2923,8 @@ def property_merge_from_branch(sbox):
                                        0) # dry_run
 
 #----------------------------------------------------------------------
-
 # Another test for issue 2035, whereby sometimes 'svn merge' marked
 # property conflicts when it shouldn't!
-
 def property_merge_undo_redo(sbox):
   "undo, then redo a property merge"
 
@@ -3575,8 +3121,7 @@ def cherry_pick_text_conflict(sbox):
                                        0, # don't check props
                                        0) # not a dry_run
 
-
-
+#----------------------------------------------------------------------
 # Test for issue 2135
 def merge_file_replace(sbox):
   "merge a replacement of a file"
@@ -3665,6 +3210,8 @@ def merge_file_replace(sbox):
                                         expected_status,
                                         None,
                                         wc_dir)
+  
+#----------------------------------------------------------------------
 # Test for issue 2522
 # Same as merge_file_replace, but without update before merge.
 def merge_file_replace_to_mixed_rev_wc(sbox):
@@ -3726,7 +3273,6 @@ def merge_file_replace_to_mixed_rev_wc(s
                                         expected_status,
                                         None, wc_dir)
 
-
   # merge changes from r3:1...
   #
   # ...but first:
@@ -3778,6 +3324,7 @@ def merge_file_replace_to_mixed_rev_wc(s
                                         None,
                                         wc_dir)
 
+#----------------------------------------------------------------------
 # use -x -w option for ignoring whitespace during merge
 def merge_ignore_whitespace(sbox):
   "ignore whitespace when merging"
@@ -3818,7 +3365,7 @@ def merge_ignore_whitespace(sbox):
   # with the remote whitespace changes as both will be ignored.
   svntest.main.file_write(file_path, "    Aa\nB b\nC c\n")
 
-  # Lines changed only by whitespaces - both in local or remote -
+  # Lines changed only by whitespace - both in local or remote -
   # should be ignored
   expected_output = wc.State(sbox.wc_dir, { file_name : Item(status='G ') })
   expected_mergeinfo_output = wc.State(sbox.wc_dir, {
@@ -3849,6 +3396,7 @@ def merge_ignore_whitespace(sbox):
                                        0, 0,
                                        '-x', '-w')
 
+#----------------------------------------------------------------------
 # use -x --ignore-eol-style option for ignoring eolstyle during merge
 def merge_ignore_eolstyle(sbox):
   "ignore eolstyle when merging"
@@ -3931,65 +3479,6 @@ def merge_ignore_eolstyle(sbox):
                                        '-x', '--ignore-eol-style')
 
 #----------------------------------------------------------------------
-# Issue 2584
-# This test involves tree conflicts.
-def merge_add_over_versioned_file_conflicts(sbox):
-  "conflict from merge of add over versioned file"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  E_path = os.path.join(wc_dir, 'A', 'B', 'E')
-  alpha_path = os.path.join(E_path, 'alpha')
-  new_alpha_path = os.path.join(wc_dir, 'A', 'C', 'alpha')
-
-  # Create a new "alpha" file, with enough differences to cause a conflict.
-  svntest.main.file_write(new_alpha_path, 'new alpha content\n')
-
-  # Add and commit the new "alpha" file, creating revision 2.
-  svntest.main.run_svn(None, "add", new_alpha_path)
-
-  expected_output = svntest.wc.State(wc_dir, {
-    'A/C/alpha' : Item(verb='Adding'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.add({
-    'A/C/alpha' : Item(status='  ', wc_rev=2),
-    })
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None,
-                                        wc_dir)
-
-  # Merge r1:2 from A/C to A/B/E.  This will attempt to add A/C/alpha,
-  # but since A/B/E/alpha already exists we get a tree conflict.
-  expected_output = wc.State(E_path, {
-    'alpha'   : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State(E_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(E_path, {
-    })
-  expected_disk = wc.State('', {
-    'alpha'   : Item("This is the file 'alpha'.\n"),
-    'beta'    : Item("This is the file 'beta'.\n"),
-    })
-  expected_status = wc.State(E_path, {
-    ''       : Item(status=' M', wc_rev=1),
-    'alpha'  : Item(status='  ', wc_rev=1, treeconflict='C'),
-    'beta'   : Item(status='  ', wc_rev=1),
-    })
-  expected_skip = wc.State(E_path, { })
-  svntest.actions.run_and_verify_merge(E_path, '1', '2',
-                                       sbox.repo_url + '/A/C', None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status,
-                                       expected_skip)
-
-#----------------------------------------------------------------------
 # eol-style handling during merge with conflicts, scenario 1:
 # when a merge creates a conflict on a file, make sure the file and files
 # r<left>, r<right> and .mine are in the eol-style defined for that file.
@@ -4127,6 +3616,7 @@ def merge_conflict_markers_matching_eol(
     svntest.main.run_svn(None, 'revert', '-R', wc_backup)
     svntest.main.run_svn(None, 'update', wc_dir)
 
+#----------------------------------------------------------------------
 # eol-style handling during merge, scenario 2:
 # if part of that merge is a propchange (add, change, delete) of
 # svn:eol-style, make sure the correct eol-style is applied before
@@ -4243,6 +3733,7 @@ def merge_eolstyle_handling(sbox):
                                        expected_backup_status,
                                        expected_backup_skip)
 
+#----------------------------------------------------------------------
 def create_deep_trees(wc_dir):
   """Create A/B/F/E by moving A/B/E to A/B/F/E.
      Copy A/B/F/E to A/B/F/E1.
@@ -4345,6 +3836,7 @@ def create_deep_trees(wc_dir):
   expected_disk.tweak('A/copy-of-B/F/E', 'A/copy-of-B/F/E1', status=' M')
   return expected_status
 
+#----------------------------------------------------------------------
 def avoid_repeated_merge_using_inherited_merge_info(sbox):
   "use inherited mergeinfo to avoid repeated merge"
 
@@ -4457,6 +3949,7 @@ def avoid_repeated_merge_using_inherited
   svntest.actions.run_and_verify_status(copy_of_B_F_E_path,
                                         expected_status)
 
+#----------------------------------------------------------------------
 def avoid_repeated_merge_on_subtree_with_merge_info(sbox):
   "use subtree's mergeinfo to avoid repeated merge"
   # Create deep trees A/B/F/E and A/B/F/E1 and copy A/B to A/copy-of-B
@@ -4670,6 +4163,7 @@ def avoid_repeated_merge_on_subtree_with
                                        None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def tweak_src_then_merge_to_dest(sbox, src_path, dst_path,
                                  canon_src_path, contents, cur_rev):
   """Edit src and commit it. This results in new_rev.
@@ -4713,6 +4207,7 @@ def tweak_src_then_merge_to_dest(sbox, s
 
   return new_rev
 
+#----------------------------------------------------------------------
 def obey_reporter_api_semantics_while_doing_subtree_merges(sbox):
   "drive reporter api in depth first order"
 
@@ -4847,6 +4342,7 @@ def obey_reporter_api_semantics_while_do
                                        None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def set_up_branch(sbox, branch_only = False, nbr_of_branches = 1):
   '''Starting with standard greek tree, copy 'A' NBR_OF_BRANCHES times
   to A_COPY, A_COPY_2, A_COPY_3, and so on.  Then make four modifications
@@ -4987,7 +4483,7 @@ def set_up_branch(sbox, branch_only = Fa
 
   return expected_disk, expected_status
 
-
+#----------------------------------------------------------------------
 def mergeinfo_inheritance(sbox):
   "target inherits mergeinfo from nearest ancestor"
 
@@ -5326,6 +4822,7 @@ def mergeinfo_inheritance(sbox):
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def mergeinfo_elision(sbox):
   "mergeinfo elides to ancestor with identical info"
 
@@ -5573,6 +5070,7 @@ def mergeinfo_elision(sbox):
                                      'propget', SVN_PROP_MERGEINFO,
                                      beta_COPY_path)
 
+#----------------------------------------------------------------------
 def mergeinfo_inheritance_and_discontinuous_ranges(sbox):
   "discontinuous merges produce correct mergeinfo"
 
@@ -5689,6 +5187,7 @@ def mergeinfo_inheritance_and_discontinu
   svntest.actions.run_and_verify_svn(None, ['\n'], [], 'propget',
                                      SVN_PROP_MERGEINFO, mu_copy_path)
 
+#----------------------------------------------------------------------
 def merge_to_target_with_copied_children(sbox):
   "merge works when target has copied children"
 
@@ -5770,6 +5269,7 @@ def merge_to_target_with_copied_children
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def merge_to_switched_path(sbox):
   "merge to switched path does not inherit or elide"
 
@@ -5931,6 +5431,7 @@ def merge_to_switched_path(sbox):
   check_mergeinfo_recursively(A_COPY_D_path,
                               { A_COPY_D_path : '/A/D:4' })
 
+#----------------------------------------------------------------------
 # Test for issues
 #
 #   2823: Account for mergeinfo differences for switched
@@ -6458,6 +5959,7 @@ def merge_to_path_with_switched_children
                                        expected_status, expected_skip,
                                        None, None, None, None, None, 1)
 
+#----------------------------------------------------------------------
 # Test for issue 2047: Merge from parent dir fails while it succeeds from
 # the direct dir
 def merge_with_implicit_target_file(sbox):
@@ -6492,6 +5994,7 @@ def merge_with_implicit_target_file(sbox
   svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-r', '2:1',
                                      'A/mu')
 
+#----------------------------------------------------------------------
 # Test practical application of issue #2769 fix, empty rev range elision,
 # and elision to the repos.
 def empty_mergeinfo(sbox):
@@ -6643,6 +6146,7 @@ def empty_mergeinfo(sbox):
   svntest.actions.run_and_verify_svn(None, [], [], 'pg', 'svn:mergeinfo',
                                      A_COPY_path)
 
+#----------------------------------------------------------------------
 def prop_add_to_child_with_mergeinfo(sbox):
   "merge adding prop to child of merge target works"
 
@@ -6724,6 +6228,7 @@ def prop_add_to_child_with_mergeinfo(sbo
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def foreign_repos_does_not_update_mergeinfo(sbox):
   "set no mergeinfo when merging from foreign repos"
 
@@ -6831,6 +6336,7 @@ def foreign_repos_does_not_update_mergei
                                      SVN_PROP_MERGEINFO, '-vR',
                                      wc_dir)
 
+#----------------------------------------------------------------------
 # This test involves tree conflicts.
 def avoid_reflected_revs(sbox):
   "avoid repeated merges for cyclic merging"
@@ -7083,7 +6589,7 @@ def avoid_reflected_revs(sbox):
                                        expected_skip,
                                        None, None, None, None, None, 1)
 
-
+#----------------------------------------------------------------------
 def update_loses_mergeinfo(sbox):
   "update does not merge mergeinfo"
 
@@ -7200,6 +6706,7 @@ def update_loses_mergeinfo(sbox):
                                         expected_status,
                                         check_props=1)
 
+#----------------------------------------------------------------------
 # Tests part of issue# 2829.
 def merge_loses_mergeinfo(sbox):
   "merge should merge mergeinfo"
@@ -7311,6 +6818,7 @@ def merge_loses_mergeinfo(sbox):
                                        expected_skip,
                                        check_props=1)
 
+#----------------------------------------------------------------------
 def single_file_replace_style_merge_capability(sbox):
   "replace-style merge capability for a single file"
 
@@ -7349,6 +6857,7 @@ def single_file_replace_style_merge_capa
                                      mu_path + '@1',
                                      mu_path)
 
+#----------------------------------------------------------------------
 # Test for issue 2786 fix.
 def merge_to_out_of_date_target(sbox):
   "merge to ood path can lead to inaccurate mergeinfo"
@@ -7463,6 +6972,7 @@ def merge_to_out_of_date_target(sbox):
                                         other_status,
                                         check_props=1)
 
+#----------------------------------------------------------------------
 def merge_with_depth_files(sbox):
   "merge test for --depth files"
 
@@ -7577,7 +7087,7 @@ def merge_with_depth_files(sbox):
                                        None, None, None, None, None, 1, 1,
                                        '--depth', 'files')
 
-
+#----------------------------------------------------------------------
 # Test for issue #2976 Subtrees can lose non-inheritable ranges.
 #
 # Also test for a bug with paths added as the immediate child of the
@@ -8016,8 +7526,9 @@ def merge_away_subtrees_noninheritable_r
                                      [], 'pg', SVN_PROP_MERGEINFO,
                                      '-R', A_COPY_path)
 
-  # Test for issue #2827
-  # Handle merge info for sparsely-populated directories
+#----------------------------------------------------------------------
+# Test for issue #2827
+# Handle merge info for sparsely-populated directories
 def merge_to_sparse_directories(sbox):
   "merge to sparse directories"
 
@@ -8102,14 +7613,11 @@ def merge_to_sparse_directories(sbox):
   # 'C', and 'D' are checked out at depth empty; the two of these affected
   # by the merge, 'B' and 'D', get non-inheritable mergeinfo for r4:9.
   # The root and 'D' do should also get the changes
-  # that affect them directly (the prop adds from r8 and r9).  Changes
-  # deeper than the immediate children raise tree conflicts.
+  # that affect them directly (the prop adds from r8 and r9).
   expected_output = wc.State(immediates_dir, {
     'D'   : Item(status=' U'),
-    'D/H' : Item(status='  ', treeconflict='C'),
     'mu'  : Item(status='U '),
     ''    : Item(status=' U'),
-    'B/E' : Item(status='  ', treeconflict='C'),
     })
   expected_mergeinfo_output = wc.State(immediates_dir, {
     ''  : Item(status=' U'),
@@ -8121,11 +7629,9 @@ def merge_to_sparse_directories(sbox):
   expected_status = wc.State(immediates_dir, {
     ''          : Item(status=' M', wc_rev=9),
     'B'         : Item(status=' M', wc_rev=9),
-    'B/E'       : Item(status='! ', treeconflict='C'),
     'mu'        : Item(status='M ', wc_rev=9),
     'C'         : Item(status='  ', wc_rev=9),
     'D'         : Item(status=' M', wc_rev=9),
-    'D/H'       : Item(status='! ', treeconflict='C'),
     })
   expected_disk = wc.State('', {
     ''          : Item(props={SVN_PROP_MERGEINFO : '/A:5-9',
@@ -8136,7 +7642,10 @@ def merge_to_sparse_directories(sbox):
     'D'         : Item(props={SVN_PROP_MERGEINFO : '/A/D:5-9*',
                               "prop:name" : "propval"}),
     })
-  expected_skip = wc.State(immediates_dir, {})
+  expected_skip = svntest.wc.State(immediates_dir, {
+    'D/H'               : Item(),
+    'B/E'               : Item(),
+    })
   svntest.actions.run_and_verify_merge(immediates_dir, '4', '9',
                                        sbox.repo_url + '/A', None,
                                        expected_output,
@@ -8166,12 +7675,10 @@ def merge_to_sparse_directories(sbox):
   # The root of the files WC should get non-inheritable r4:9 and its one
   # present child 'mu' should get the same but inheritable.  The root
   # should also get the change that affects it directly (the prop add
-  # from r9).  Changes into shallow subtrees should raise tree conflicts.
+  # from r9).
   expected_output = wc.State(files_dir, {
     'mu' : Item(status='U '),
     ''   : Item(status=' U'),
-    'B'  : Item(status='  ', treeconflict='C'),
-    'D'  : Item(status='  ', treeconflict='C'),
     })
   expected_mergeinfo_output = wc.State(files_dir, {
     ''   : Item(status=' U'),
@@ -8182,8 +7689,6 @@ def merge_to_sparse_directories(sbox):
   expected_status = wc.State(files_dir, {
     ''          : Item(status=' M', wc_rev=9),
     'mu'        : Item(status='MM', wc_rev=9),
-    'B'         : Item(status='! ', treeconflict='C'),
-    'D'         : Item(status='! ', treeconflict='C'),
     })
   expected_disk = wc.State('', {
     ''          : Item(props={SVN_PROP_MERGEINFO : '/A:5-9*',
@@ -8191,7 +7696,10 @@ def merge_to_sparse_directories(sbox):
     'mu'        : Item("New content",
                        props={SVN_PROP_MERGEINFO : '/A/mu:5-9'}),
     })
-  expected_skip = wc.State(files_dir, {})
+  expected_skip = svntest.wc.State(files_dir, {
+    'D'               : Item(),
+    'B'               : Item(),
+    })
   svntest.actions.run_and_verify_merge(files_dir, '4', '9',
                                        sbox.repo_url + '/A', None,
                                        expected_output,
@@ -8216,12 +7724,8 @@ def merge_to_sparse_directories(sbox):
   # Merge r4:9 into the empty WC.
   # The root of the files WC should get non-inheritable r4:9 and also get
   # the one change that affects it directly (the prop add from r9).
-  # Changes into the missing subtrees should raise tree conflicts.
   expected_output = wc.State(empty_dir, {
     ''   : Item(status=' U'),
-    'mu' : Item(status='  ', treeconflict='C'),
-    'B'  : Item(status='  ', treeconflict='C'),
-    'D'  : Item(status='  ', treeconflict='C'),
     })
   expected_mergeinfo_output = wc.State(empty_dir, {
     '' : Item(status=' U'),
@@ -8230,15 +7734,16 @@ def merge_to_sparse_directories(sbox):
     })
   expected_status = wc.State(empty_dir, {
     ''          : Item(status=' M', wc_rev=9),
-    'mu'        : Item(status='! ', treeconflict='C'),
-    'B'         : Item(status='! ', treeconflict='C'),
-    'D'         : Item(status='! ', treeconflict='C'),
     })
   expected_disk = wc.State('', {
     ''          : Item(props={SVN_PROP_MERGEINFO : '/A:5-9*',
                               "prop:name" : "propval"}),
     })
-  expected_skip = wc.State(empty_dir, {})
+  expected_skip = svntest.wc.State(empty_dir, {
+    'mu'               : Item(),
+    'D'               : Item(),
+    'B'               : Item(),
+    })
   svntest.actions.run_and_verify_merge(empty_dir, '4', '9',
                                        sbox.repo_url + '/A', None,
                                        expected_output,
@@ -8314,6 +7819,7 @@ def merge_to_sparse_directories(sbox):
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def merge_old_and_new_revs_from_renamed_dir(sbox):
   "merge -rold(before rename):head renamed dir"
 
@@ -8468,6 +7974,7 @@ def merge_old_and_new_revs_from_renamed_
                                        None, None, None, None, None,
                                        True, False)
 
+#----------------------------------------------------------------------
 def merge_with_child_having_different_rev_ranges_to_merge(sbox):
   "child having different rev ranges to merge"
   #Modify A/mu to 30 lines with a content 'line1'...'line30' commit it at r2.
@@ -8725,6 +8232,7 @@ def merge_with_child_having_different_re
                                        expected_skip,
                                        None, None, None, None, None, 1)
 
+#----------------------------------------------------------------------
 def merge_old_and_new_revs_from_renamed_file(sbox):
   "merge -rold(before rename):head renamed file"
 
@@ -8792,7 +8300,7 @@ def merge_old_and_new_revs_from_renamed_
                                      [], 'propget', SVN_PROP_MERGEINFO,
                                      mu_COPY_path)
 
-
+#----------------------------------------------------------------------
 def merge_with_auto_rev_range_detection(sbox):
   "merge with auto detection of revision ranges"
 
@@ -8918,106 +8426,7 @@ def merge_with_auto_rev_range_detection(
                                        None, None, None, None, None,
                                        1, 1)
 
-# This test involves tree conflicts.
-def mergeinfo_recording_in_skipped_merge(sbox):
-  "mergeinfo recording in skipped merge"
-
-  ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2829. ##
-
-  # Create a WC with a single branch
-  sbox.build()
-  wc_dir = sbox.wc_dir
-  wc_disk, wc_status = set_up_branch(sbox, True, 1)
-
-  # Some paths we'll care about
-  A_url = sbox.repo_url + '/A'
-  A_COPY_path = os.path.join(wc_dir, 'A_COPY')
-  mu_path = os.path.join(wc_dir, 'A', 'mu')
-  alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
-  A_COPY_B_E_path = os.path.join(wc_dir, 'A_COPY', 'B', 'E')
-  A_COPY_alpha_path = os.path.join(wc_dir, 'A_COPY', 'B', 'E', 'alpha')
-  A_COPY_beta_path = os.path.join(wc_dir, 'A_COPY', 'B', 'E', 'beta')
-
-  # Make a modification to A/mu
-  svntest.main.file_write(mu_path, "This is the file 'mu' modified.\n")
-  expected_output = wc.State(wc_dir, {'A/mu' : Item(verb='Sending')})
-  wc_status.add({'A/mu'     : Item(status='  ', wc_rev=3)})
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        wc_status, None, wc_dir)
-
-  # Make a modification to A/B/E/alpha
-  svntest.main.file_write(alpha_path, "This is the file 'alpha' modified.\n")
-  expected_output = wc.State(wc_dir, {'A/B/E/alpha' : Item(verb='Sending')})
-  wc_status.add({'A/B/E/alpha'     : Item(status='  ', wc_rev=4)})
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        wc_status, None, wc_dir)
-
-  # Delete A_COPY/B/E
-  svntest.actions.run_and_verify_svn(None, None, [], 'rm',
-                                     A_COPY_B_E_path)
-
-  # Merge /A to /A_COPY ie., r1 to r4
-  expected_output = wc.State(A_COPY_path, {
-    'mu'  : Item(status='U '),
-    'B/E' : Item(status='  ', treeconflict='C'),
-    })
-  expected_mergeinfo_output = wc.State(A_COPY_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(A_COPY_path, {
-    })
-  expected_status = wc.State(A_COPY_path, {
-    ''         : Item(status=' M', wc_rev=2),
-    'mu'       : Item(status='M ', wc_rev=2),
-    'B'        : Item(status='  ', wc_rev=2),
-    'B/lambda' : Item(status='  ', wc_rev=2),
-    'B/F'      : Item(status='  ', wc_rev=2),
-    'B/E'      : Item(status='D ', wc_rev=2, treeconflict='C'),
-    'B/E/alpha': Item(status='D ', wc_rev=2),
-    'B/E/beta' : Item(status='D ', wc_rev=2),
-    'C'        : Item(status='  ', wc_rev=2),
-    'D'        : Item(status='  ', wc_rev=2),
-    'D/gamma'  : Item(status='  ', wc_rev=2),
-    'D/G'      : Item(status='  ', wc_rev=2),
-    'D/G/pi'   : Item(status='  ', wc_rev=2),
-    'D/G/rho'  : Item(status='  ', wc_rev=2),
-    'D/G/tau'  : Item(status='  ', wc_rev=2),
-    'D/H'      : Item(status='  ', wc_rev=2),
-    'D/H/chi'  : Item(status='  ', wc_rev=2),
-    'D/H/omega': Item(status='  ', wc_rev=2),
-    'D/H/psi'  : Item(status='  ', wc_rev=2),
-    })
-  expected_disk = wc.State('', {
-    ''         : Item(props={SVN_PROP_MERGEINFO : '/A:2-4'}),
-    'mu'       : Item("This is the file 'mu' modified.\n"),
-    'C'        : Item(),
-    'D'        : Item(),
-    'B'        : Item(),
-    'B/lambda' : Item(contents="This is the file 'lambda'.\n"),
-    'B/F'      : Item(),
-    'B/E'      : Item(),
-    'D/gamma'  : Item("This is the file 'gamma'.\n"),
-    'D/G'      : Item(),
-    'D/G/pi'   : Item("This is the file 'pi'.\n"),
-    'D/G/rho'  : Item("This is the file 'rho'.\n"),
-    'D/G/tau'  : Item("This is the file 'tau'.\n"),
-    'D/H'      : Item(),
-    'D/H/chi'  : Item("This is the file 'chi'.\n"),
-    'D/H/omega': Item("This is the file 'omega'.\n"),
-    'D/H/psi'  : Item("This is the file 'psi'.\n"),
-    })
-  expected_skip = wc.State(A_COPY_path, {})
-  svntest.actions.run_and_verify_merge(A_COPY_path, None, None,
-                                       A_url, None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       expected_disk,
-                                       expected_status,
-                                       expected_skip,
-                                       None, None, None, None, None,
-                                       1, 1)
-
+#----------------------------------------------------------------------
 # Test for issue 2818: Provide a 'merge' API which allows for merging of
 # arbitrary revision ranges (e.g. '-c 3,5,7')
 def cherry_picking(sbox):
@@ -9199,6 +8608,7 @@ def cherry_picking(sbox):
                                      'propget', '-R', SVN_PROP_MERGEINFO,
                                      D_COPY_path)
 
+#----------------------------------------------------------------------
 def propchange_of_subdir_raises_conflict(sbox):
   "merge of propchange on subdir raises conflict"
 
@@ -9311,6 +8721,7 @@ def propchange_of_subdir_raises_conflict
                                        None, None, None, None, None,
                                        1, 1)
 
+#----------------------------------------------------------------------
 # Test for issue #2971: Reverse merge of prop add segfaults if
 # merging to parent of first merge
 def reverse_merge_prop_add_on_child(sbox):
@@ -9418,6 +8829,7 @@ def reverse_merge_prop_add_on_child(sbox
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 def merge_target_with_non_inheritable_mergeinfo(sbox):
   "merge target with non inheritable mergeinfo"
 
@@ -9453,15 +8865,21 @@ def merge_target_with_non_inheritable_me
   expected_output = wc.State(A_COPY_B_path, {
     'lambda' : Item(status='U '),
     })
+  # Issue #3642 http://subversion.tigris.org/issues/show_bug.cgi?id=3642
+  #
+  # We don't expect A_COPY/B/F to have mergeinfo recorded on it because
+  # not only is it unaffected by the merge at depth immediates, it could
+  # never be affected by the merge, regardless of depth.
   expected_mergeinfo_output = wc.State(A_COPY_B_path, {
-    ''  : Item(status=' U'),
+    ''   : Item(status=' U'),
+    'E'  : Item(status=' U'),
     })
   expected_elision_output = wc.State(A_COPY_B_path, {
     })
   expected_disk = wc.State('', {
     ''        : Item(props={SVN_PROP_MERGEINFO : '/A/B:2-3'}),
     'lambda'  : Item(contents="This is the file 'lambda' modified.\n"),
-    'F'       : Item(props={SVN_PROP_MERGEINFO : '/A/B/F:2-3*'}),
+    'F'       : Item(), # No mergeinfo!
     'E'       : Item(props={SVN_PROP_MERGEINFO : '/A/B/E:2-3*'}),
     'E/alpha' : Item(contents="This is the file 'alpha'.\n"),
     'E/beta'  : Item(contents="This is the file 'beta'.\n"),
@@ -9469,7 +8887,7 @@ def merge_target_with_non_inheritable_me
   expected_status = wc.State(A_COPY_B_path, {
     ''         : Item(status=' M', wc_rev=2),
     'lambda'   : Item(status='M ', wc_rev=2),
-    'F'        : Item(status=' M', wc_rev=2),
+    'F'        : Item(status='  ', wc_rev=2),
     'E'        : Item(status=' M', wc_rev=2),
     'E/alpha'  : Item(status='  ', wc_rev=2),
     'E/beta'   : Item(status='  ', wc_rev=2),
@@ -9526,6 +8944,7 @@ def merge_target_with_non_inheritable_me
                                        None, None, None, None, None,
                                        1, 1)
 
+#----------------------------------------------------------------------
 def self_reverse_merge(sbox):
   "revert a commit on a target"
 
@@ -9580,8 +8999,8 @@ def self_reverse_merge(sbox):
 
   # record dummy self mergeinfo to test the fact that self-reversal should work
   # irrespective of mergeinfo.
-  svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-c', '1',
-                                     '--record-only', sbox.repo_url, wc_dir)
+  svntest.actions.run_and_verify_svn(None, None, [], 'ps', SVN_PROP_MERGEINFO,
+                                     '/:1', wc_dir)
 
   # Bad svntest.main.greek_state does not have '', so adding it explicitly.
   expected_disk.add({'' : Item(props={SVN_PROP_MERGEINFO : '/:1'})})
@@ -9601,6 +9020,7 @@ def self_reverse_merge(sbox):
                                        expected_status, expected_skip,
                                        None, None, None, None, None, 1, 1)
 
+#----------------------------------------------------------------------
 def ignore_ancestry_and_mergeinfo(sbox):
   "--ignore-ancestry also ignores mergeinfo"
 
@@ -9706,6 +9126,7 @@ def ignore_ancestry_and_mergeinfo(sbox):
                                        None, None, None, None, None, 1, 1,
                                        '--ignore-ancestry')
 
+#----------------------------------------------------------------------
 def merge_from_renamed_branch_fails_while_avoiding_repeat_merge(sbox):
   "merge from renamed branch"
   #Copy A/C to A/COPY_C results in r2.
@@ -9806,6 +9227,7 @@ def merge_from_renamed_branch_fails_whil
                                        expected_skip,
                                        None, None, None, None, None, 1, 1)
 
+#----------------------------------------------------------------------
 # Test for part of issue #2877: 'do subtree merge only if subtree has
 # explicit mergeinfo set and exists in the merge source'
 def merge_source_normalization_and_subtree_merges(sbox):
@@ -9957,6 +9379,7 @@ def merge_source_normalization_and_subtr
                                        None, None, None, None,
                                        None, 1)
 
+#----------------------------------------------------------------------
 # Tests for issue #3067: 'subtrees with intersecting mergeinfo, that don't
 # exist at the start of a merge range shouldn't break the merge'
 def new_subtrees_should_not_break_merge(sbox):
@@ -10387,891 +9810,471 @@ def new_subtrees_should_not_break_merge(
                                        None, None, None, None,
                                        None, 1)
 
-def basic_reintegrate(sbox):
-  "basic merge --reintegrate support"
+#----------------------------------------------------------------------
+def dont_add_mergeinfo_from_own_history(sbox):
+  "cyclic merges don't add mergeinfo from own history"
 
-  # Make A_COPY branch in r2, and do a few more commits to A in r3-6.
   sbox.build()
   wc_dir = sbox.wc_dir
-  expected_disk, expected_status = set_up_branch(sbox)
-
-  # Make a change on the branch, to A/mu.  Commit in r7.
-  svntest.main.file_write(os.path.join(wc_dir, "A_COPY", "mu"),
-                          "Changed on the branch.")
-  expected_output = wc.State(wc_dir, {'A_COPY/mu' : Item(verb='Sending')})
-  expected_status.tweak('A_COPY/mu', wc_rev=7)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-  expected_disk.tweak('A_COPY/mu', contents='Changed on the branch.')
+  wc_disk, wc_status = set_up_branch(sbox)
 
-  # Update the wcs.
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='7')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
+  # Some paths we'll care about
+  A_path        = os.path.join(wc_dir, "A")
+  A_MOVED_path  = os.path.join(wc_dir, "A_MOVED")
+  mu_path       = os.path.join(wc_dir, "A", "mu")
+  mu_MOVED_path = os.path.join(wc_dir, "A_MOVED", "mu")
+  A_COPY_path   = os.path.join(wc_dir, "A_COPY")
+  mu_COPY_path  = os.path.join(wc_dir, "A_COPY", "mu")
 
-  # Merge from trunk to branch (ie, r3-6), using normal cherry-harvest.
-  A_COPY_path = os.path.join(wc_dir, "A_COPY")
+  # Merge r3 from 'A' to 'A_COPY', make a text mod to 'A_COPY/mu' and
+  # commit both as r7.  This results in mergeinfo of '/A:3' on 'A_COPY'.
+  # Then merge r7 from 'A_COPY' to 'A'.  This attempts to add the mergeinfo
+  # '/A:3' to 'A', but that is self-referrential and should be filtered out,
+  # leaving only the mergeinfo '/A_COPY:7' on 'A'.
   expected_output = wc.State(A_COPY_path, {
-    'D/H/psi'   : Item(status='U '),
-    'D/G/rho'   : Item(status='U '),
-    'B/E/beta'  : Item(status='U '),
-    'D/H/omega' : Item(status='U '),
+    'D/H/psi' : Item(status='U '),
     })
   expected_mergeinfo_output = wc.State(A_COPY_path, {
     '' : Item(status=' U'),
     })
   expected_elision_output = wc.State(A_COPY_path, {
     })
-  k_expected_status = wc.State(A_COPY_path, {
-    "B"         : Item(status='  ', wc_rev=7),
-    "B/lambda"  : Item(status='  ', wc_rev=7),
-    "B/E"       : Item(status='  ', wc_rev=7),
-    "B/E/alpha" : Item(status='  ', wc_rev=7),
-    "B/E/beta"  : Item(status='M ', wc_rev=7),
-    "B/F"       : Item(status='  ', wc_rev=7),
-    "mu"        : Item(status='  ', wc_rev=7),
-    "C"         : Item(status='  ', wc_rev=7),
-    "D"         : Item(status='  ', wc_rev=7),
-    "D/gamma"   : Item(status='  ', wc_rev=7),
-    "D/G"       : Item(status='  ', wc_rev=7),
-    "D/G/pi"    : Item(status='  ', wc_rev=7),
-    "D/G/rho"   : Item(status='M ', wc_rev=7),
-    "D/G/tau"   : Item(status='  ', wc_rev=7),
-    "D/H"       : Item(status='  ', wc_rev=7),
-    "D/H/chi"   : Item(status='  ', wc_rev=7),
-    "D/H/omega" : Item(status='M ', wc_rev=7),
-    "D/H/psi"   : Item(status='M ', wc_rev=7),
-    ""          : Item(status=' M', wc_rev=7),
-  })
-  k_expected_disk = wc.State('', {
-    ''          : Item(props={SVN_PROP_MERGEINFO : '/A:2-7'}),
+  expected_A_COPY_status = wc.State(A_COPY_path, {
+    ''          : Item(status=' M', wc_rev=2),
+    'B'         : Item(status='  ', wc_rev=2),
+    'mu'        : Item(status='  ', wc_rev=2),
+    'B/E'       : Item(status='  ', wc_rev=2),
+    'B/E/alpha' : Item(status='  ', wc_rev=2),
+    'B/E/beta'  : Item(status='  ', wc_rev=2),
+    'B/lambda'  : Item(status='  ', wc_rev=2),
+    'B/F'       : Item(status='  ', wc_rev=2),
+    'C'         : Item(status='  ', wc_rev=2),
+    'D'         : Item(status='  ', wc_rev=2),
+    'D/G'       : Item(status='  ', wc_rev=2),
+    'D/G/pi'    : Item(status='  ', wc_rev=2),
+    'D/G/rho'   : Item(status='  ', wc_rev=2),
+    'D/G/tau'   : Item(status='  ', wc_rev=2),
+    'D/gamma'   : Item(status='  ', wc_rev=2),
+    'D/H'       : Item(status='  ', wc_rev=2),
+    'D/H/chi'   : Item(status='  ', wc_rev=2),
+    'D/H/psi'   : Item(status='M ', wc_rev=2),
+    'D/H/omega' : Item(status='  ', wc_rev=2),
+    })
+  expected_A_COPY_disk = wc.State('', {
+    ''          : Item(props={SVN_PROP_MERGEINFO : '/A:3'}),
     'B'         : Item(),
-    'B/lambda'  : Item("This is the file 'lambda'.\n"),
+    'mu'        : Item("This is the file 'mu'.\n"),
     'B/E'       : Item(),
     'B/E/alpha' : Item("This is the file 'alpha'.\n"),
-    'B/E/beta'  : Item("New content"),
+    'B/E/beta'  : Item("This is the file 'beta'.\n"),
+    'B/lambda'  : Item("This is the file 'lambda'.\n"),
     'B/F'       : Item(),
-    'mu'        : Item("Changed on the branch."),
     'C'         : Item(),
     'D'         : Item(),
-    'D/gamma'   : Item("This is the file 'gamma'.\n"),
     'D/G'       : Item(),
     'D/G/pi'    : Item("This is the file 'pi'.\n"),
-    'D/G/rho'   : Item("New content"),
+    'D/G/rho'   : Item("This is the file 'rho'.\n"),
     '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/omega' : Item("New content"),
     'D/H/psi'   : Item("New content"),
-  })
-  expected_skip = wc.State(A_COPY_path, {})
-  svntest.actions.run_and_verify_merge(A_COPY_path, None, None,
+    'D/H/omega' : Item("This is the file 'omega'.\n"),
+    })
+  expected_A_COPY_skip = wc.State(A_COPY_path, { })
+  svntest.actions.run_and_verify_merge(A_COPY_path, '2', '3',
                                        sbox.repo_url + '/A', None,
                                        expected_output,
                                        expected_mergeinfo_output,
                                        expected_elision_output,
-                                       k_expected_disk,
-                                       k_expected_status,
-                                       expected_skip,
+                                       expected_A_COPY_disk,
+                                       expected_A_COPY_status,
+                                       expected_A_COPY_skip,
                                        None, None, None, None,
-                                       None, True)
-  expected_disk.tweak('A_COPY', props={SVN_PROP_MERGEINFO: '/A:2-7'})
-  expected_disk.tweak('A_COPY/B/E/beta', contents="New content")
-  expected_disk.tweak('A_COPY/D/G/rho', contents="New content")
-  expected_disk.tweak('A_COPY/D/H/omega', contents="New content")
-  expected_disk.tweak('A_COPY/D/H/psi', contents="New content")
+                                       None, 1)
+
+  # Change 'A_COPY/mu'
+  svntest.main.file_write(mu_COPY_path, "New content")
 
-  # Commit the merge to branch (r8).
+  # Commit r7
   expected_output = wc.State(wc_dir, {
-    'A_COPY/D/H/psi'   : Item(verb='Sending'),
-    'A_COPY/D/G/rho'   : Item(verb='Sending'),
-    'A_COPY/B/E/beta'  : Item(verb='Sending'),
-    'A_COPY/D/H/omega' : Item(verb='Sending'),
-    'A_COPY'           : Item(verb='Sending'),
+    'A_COPY'         : Item(verb='Sending'),
+    'A_COPY/D/H/psi' : Item(verb='Sending'),
+    'A_COPY/mu'      : Item(verb='Sending'),
     })
-  expected_status.tweak('A_COPY', 'A_COPY/D/H/psi', 'A_COPY/D/G/rho',
-                        'A_COPY/B/E/beta', 'A_COPY/D/H/omega', wc_rev=8)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-  # Update the wcs again.
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='8')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
-
+  wc_status.tweak('A_COPY', 'A_COPY/D/H/psi', 'A_COPY/mu', wc_rev=7)
+  svntest.actions.run_and_verify_commit(wc_dir,
+                                        expected_output,
+                                        wc_status,
+                                        None,
+                                        wc_dir)
 
-  # *finally*, actually run merge --reintegrate in trunk with the
-  # branch URL.  This should bring in the mu change and the tauprime
-  # change.
-  A_path = os.path.join(wc_dir, "A")
+  # Merge r7 back to the 'A'
   expected_output = wc.State(A_path, {
-    'mu'           : Item(status='U '),
+    'mu' : Item(status='U '),
     })
   expected_mergeinfo_output = wc.State(A_path, {
-    '' : Item(status=' G'),
+    '' : Item(status=' U'),
     })
   expected_elision_output = wc.State(A_path, {
     })
-  k_expected_status = wc.State(A_path, {
-    "B"            : Item(status='  ', wc_rev=8),
-    "B/lambda"     : Item(status='  ', wc_rev=8),
-    "B/E"          : Item(status='  ', wc_rev=8),
-    "B/E/alpha"    : Item(status='  ', wc_rev=8),
-    "B/E/beta"     : Item(status='  ', wc_rev=8),
-    "B/F"          : Item(status='  ', wc_rev=8),
-    "mu"           : Item(status='M ', wc_rev=8),
-    "C"            : Item(status='  ', wc_rev=8),
-    "D"            : Item(status='  ', wc_rev=8),
-    "D/gamma"      : Item(status='  ', wc_rev=8),
-    "D/G"          : Item(status='  ', wc_rev=8),
-    "D/G/pi"       : Item(status='  ', wc_rev=8),
-    "D/G/rho"      : Item(status='  ', wc_rev=8),
-    "D/G/tau"      : Item(status='  ', wc_rev=8),
-    "D/H"          : Item(status='  ', wc_rev=8),
-    "D/H/chi"      : Item(status='  ', wc_rev=8),
-    "D/H/omega"    : Item(status='  ', wc_rev=8),
-    "D/H/psi"      : Item(status='  ', wc_rev=8),
-    ""             : Item(status=' M', wc_rev=8),
-  })
-  k_expected_disk.tweak('', props={SVN_PROP_MERGEINFO : '/A_COPY:2-8'})
-  expected_skip = wc.State(A_path, {})
-  svntest.actions.run_and_verify_merge(A_path, None, None,
-                                       sbox.repo_url + '/A_COPY', None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       k_expected_disk,
-                                       k_expected_status,
-                                       expected_skip,
-                                       None, None, None, None,
-                                       None, True, True,
-                                       '--reintegrate')
-
-  # Finally, commit the result of the merge (r9).
-  expected_output = wc.State(wc_dir, {
-    'A/mu'           : Item(verb='Sending'),
-    'A'              : Item(verb='Sending'),
-    })
-  expected_status.tweak('A', 'A/mu', wc_rev=9)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-def reintegrate_with_rename(sbox):
-  "merge --reintegrate with renamed file on branch"
-
-  # Make A_COPY branch in r2, and do a few more commits to A in r3-6.
-  sbox.build()
-  wc_dir = sbox.wc_dir
-  expected_disk, expected_status = set_up_branch(sbox)
-
-  # Make a change on the branch, to A/mu.  Commit in r7.
-  svntest.main.file_write(os.path.join(wc_dir, "A_COPY", "mu"),
-                          "Changed on the branch.")
-  expected_output = wc.State(wc_dir, {'A_COPY/mu' : Item(verb='Sending')})
-  expected_status.tweak('A_COPY/mu', wc_rev=7)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-  expected_disk.tweak('A_COPY/mu', contents='Changed on the branch.')
-
-  # Update the wcs.
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='7')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
-
-  # Merge from trunk to branch (ie, r3-6), using normal cherry-harvest.
-  A_COPY_path = os.path.join(wc_dir, "A_COPY")
-  expected_output = wc.State(A_COPY_path, {
-    'D/H/psi'   : Item(status='U '),
-    'D/G/rho'   : Item(status='U '),
-    'B/E/beta'  : Item(status='U '),
-    'D/H/omega' : Item(status='U '),
-    })
-  expected_mergeinfo_output = wc.State(A_COPY_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(A_COPY_path, {
+  expected_A_status = wc.State(A_path, {
+    ''          : Item(status=' M', wc_rev=1),
+    'B'         : Item(status='  ', wc_rev=1),
+    'mu'        : Item(status='M ', wc_rev=1),
+    'B/E'       : Item(status='  ', wc_rev=1),
+    'B/E/alpha' : Item(status='  ', wc_rev=1),
+    'B/E/beta'  : Item(status='  ', wc_rev=5),
+    'B/lambda'  : Item(status='  ', wc_rev=1),
+    'B/F'       : Item(status='  ', wc_rev=1),
+    'C'         : Item(status='  ', wc_rev=1),
+    'D'         : Item(status='  ', wc_rev=1),
+    'D/G'       : Item(status='  ', wc_rev=1),
+    'D/G/pi'    : Item(status='  ', wc_rev=1),
+    'D/G/rho'   : Item(status='  ', wc_rev=4),
+    'D/G/tau'   : Item(status='  ', wc_rev=1),
+    'D/gamma'   : Item(status='  ', wc_rev=1),
+    'D/H'       : Item(status='  ', wc_rev=1),
+    'D/H/chi'   : Item(status='  ', wc_rev=1),
+    'D/H/psi'   : Item(status='  ', wc_rev=3),
+    'D/H/omega' : Item(status='  ', wc_rev=6),
     })
-  k_expected_status = wc.State(A_COPY_path, {
-    "B"         : Item(status='  ', wc_rev=7),
-    "B/lambda"  : Item(status='  ', wc_rev=7),
-    "B/E"       : Item(status='  ', wc_rev=7),
-    "B/E/alpha" : Item(status='  ', wc_rev=7),
-    "B/E/beta"  : Item(status='M ', wc_rev=7),
-    "B/F"       : Item(status='  ', wc_rev=7),
-    "mu"        : Item(status='  ', wc_rev=7),
-    "C"         : Item(status='  ', wc_rev=7),
-    "D"         : Item(status='  ', wc_rev=7),
-    "D/gamma"   : Item(status='  ', wc_rev=7),
-    "D/G"       : Item(status='  ', wc_rev=7),
-    "D/G/pi"    : Item(status='  ', wc_rev=7),
-    "D/G/rho"   : Item(status='M ', wc_rev=7),
-    "D/G/tau"   : Item(status='  ', wc_rev=7),
-    "D/H"       : Item(status='  ', wc_rev=7),
-    "D/H/chi"   : Item(status='  ', wc_rev=7),
-    "D/H/omega" : Item(status='M ', wc_rev=7),
-    "D/H/psi"   : Item(status='M ', wc_rev=7),
-    ""          : Item(status=' M', wc_rev=7),
-  })
-  k_expected_disk = wc.State('', {
-    ''          : Item(props={SVN_PROP_MERGEINFO : '/A:2-7'}),
+  expected_A_disk = wc.State('', {
+    ''          : Item(props={SVN_PROP_MERGEINFO : '/A_COPY:7'}),
     'B'         : Item(),
-    'B/lambda'  : Item("This is the file 'lambda'.\n"),
+    'mu'        : Item("New content"),
     '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(),
-    'mu'        : Item("Changed on the branch."),
     'C'         : Item(),
     'D'         : Item(),
-    'D/gamma'   : Item("This is the file 'gamma'.\n"),
     '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/omega' : Item("New content"),
     'D/H/psi'   : Item("New content"),
-  })
-  expected_skip = wc.State(A_COPY_path, {})
-  svntest.actions.run_and_verify_merge(A_COPY_path, None, None,
-                                       sbox.repo_url + '/A', None,
-                                       expected_output,
-                                       expected_mergeinfo_output,
-                                       expected_elision_output,
-                                       k_expected_disk,
-                                       k_expected_status,
-                                       expected_skip,
-                                       None, None, None, None,
-                                       None, True)
-  expected_disk.tweak('A_COPY', props={SVN_PROP_MERGEINFO: '/A:2-7'})
-  expected_disk.tweak('A_COPY/B/E/beta', contents="New content")
-  expected_disk.tweak('A_COPY/D/G/rho', contents="New content")
-  expected_disk.tweak('A_COPY/D/H/omega', contents="New content")
-  expected_disk.tweak('A_COPY/D/H/psi', contents="New content")
-
-  # Commit the merge to branch (r8).
-  expected_output = wc.State(wc_dir, {
-    'A_COPY/D/H/psi'   : Item(verb='Sending'),
-    'A_COPY/D/G/rho'   : Item(verb='Sending'),
-    'A_COPY/B/E/beta'  : Item(verb='Sending'),
-    'A_COPY/D/H/omega' : Item(verb='Sending'),
-    'A_COPY'           : Item(verb='Sending'),
-    })
-  expected_status.tweak('A_COPY', 'A_COPY/D/H/psi', 'A_COPY/D/G/rho',
-                        'A_COPY/B/E/beta', 'A_COPY/D/H/omega', wc_rev=8)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-
-  # Update the wcs again.
-  #
-  # Note: this update had to be added because of r28942 (which was
-  # merged into the reintegrate branch in r28947).  Without this
-  # update, the mergeinfo will not be inherited properly as part of
-  # the 'svn cp tau tauprime' step, and later (during the post-commit
-  # update, with the new expected_disk) we'll get an error like this:
-  #
-  #   =============================================================
-  #   Expected 'tauprime' and actual 'tauprime' in disk tree are different!
-  #   =============================================================
-  #   EXPECTED NODE TO BE:
-  #   =============================================================
-  #    * Node name:   tauprime
-  #       Path:       A_COPY/D/G/tauprime
-  #       Contents:   This is the file 'tau'.
-  #
-  #       Properties: {'svn:mergeinfo': '/A/D/G/tau:2-7'}
-  #       Attributes: {}
-  #       Children:   N/A (node is a file)
-  #   =============================================================
-  #   ACTUAL NODE FOUND:
-  #   =============================================================
-  #    * Node name:   tauprime
-  #       Path:       G/tauprime
-  #       Contents:   This is the file 'tau'.
-  #
-  #       Properties: {'svn:mergeinfo': ''}
-  #       Attributes: {}
-  #       Children:   N/A (node is a file)
-  #
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='8')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
-
-  # Make another change on the branch: copy tau to tauprime.  Commit
-  # in r9.
-  svntest.actions.run_and_verify_svn(None, None, [], 'cp',
-                                     sbox.repo_url + '/A_COPY/D/G/tau',
-                                     sbox.repo_url + '/A_COPY/D/G/tauprime',
-                                     '-m',
-                                     'Repos to repos copy of tau to tauprime')
-
-  # Update the trunk (well, the whole wc) to get the copy above and since
-  # reintegrate really wants a clean wc.
-  expected_output = wc.State(wc_dir, {
-    'A_COPY/D/G/tauprime' : Item(verb='Adding')
-    })
-  expected_output = wc.State(A_COPY_path, {
-    'D/G/tauprime' : Item(status='A '),
-    })
-  expected_status.add({'A_COPY/D/G/tauprime': Item(status='  ', wc_rev=9)})
-  expected_disk.add({
-    'A_COPY/D/G/tauprime' : Item(props={SVN_PROP_MERGEINFO: '/A/D/G/tau:2-7'},
-                                 contents="This is the file 'tau'.\n")
-    })
-  expected_status.tweak(wc_rev='9')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
-
-  # *finally*, actually run merge --reintegrate in trunk with the
-  # branch URL.  This should bring in the mu change and the tauprime
-  # change.
-  A_path = os.path.join(wc_dir, "A")
-  expected_output = wc.State(A_path, {
-    'mu'           : Item(status='U '),
-    'D/G/tauprime' : Item(status='A '),
-    })
-  expected_mergeinfo_output = wc.State(A_path, {
-    ''             : Item(status=' G'),
-    'D/G/tauprime' : Item(status=' G'),
-    })
-  expected_elision_output = wc.State(A_path, {
-    })
-  k_expected_status = wc.State(A_path, {
-    "B"            : Item(status='  ', wc_rev=9),
-    "B/lambda"     : Item(status='  ', wc_rev=9),
-    "B/E"          : Item(status='  ', wc_rev=9),
-    "B/E/alpha"    : Item(status='  ', wc_rev=9),
-    "B/E/beta"     : Item(status='  ', wc_rev=9),
-    "B/F"          : Item(status='  ', wc_rev=9),
-    "mu"           : Item(status='M ', wc_rev=9),
-    "C"            : Item(status='  ', wc_rev=9),
-    "D"            : Item(status='  ', wc_rev=9),
-    "D/gamma"      : Item(status='  ', wc_rev=9),
-    "D/G"          : Item(status='  ', wc_rev=9),
-    "D/G/pi"       : Item(status='  ', wc_rev=9),
-    "D/G/rho"      : Item(status='  ', wc_rev=9),
-    "D/G/tau"      : Item(status='  ', wc_rev=9),
-    "D/G/tauprime" : Item(status='A ', wc_rev='-', copied='+'),
-    "D/H"          : Item(status='  ', wc_rev=9),
-    "D/H/chi"      : Item(status='  ', wc_rev=9),
-    "D/H/omega"    : Item(status='  ', wc_rev=9),
-    "D/H/psi"      : Item(status='  ', wc_rev=9),
-    ""             : Item(status=' M', wc_rev=9),
-  })
-  k_expected_disk.tweak('', props={SVN_PROP_MERGEINFO : '/A_COPY:2-9'})
-
-  # Why do we expect mergeinfo of '/A_COPY/D/G/tauprime:2-9' on
-  # A/D/G/tauprime?  Because this --reintegrate merge is effectively a
-  # two URL merge of %URL%/A@9 %URL%/A_COPY@9 to 'A'.  Since %URL%/A@9 and
-  # %URL%/A_COPY@9 have a common ancestor in %URL%/A@1 we expect this 2-URL
-  # merge to record mergeinfo and a component of that mergeinfo describes
-  # the merge of %URL%/A_COPY@2 to %URL%/A_COPY@9.  We see that above on
-  # A.  But we also get it on A's subtrees with explicit mergeinfo, namely
-  # A/D/G/tauprime.  Now I know what you are thinking, "'A_COPY/D/G/tauprime'
-  # doesn't even exist until r9!", and you are quite right.  But this
-  # inheritance of bogus mergeinfo is a known problem, see
-  # http://subversion.tigris.org/issues/show_bug.cgi?id=3157#desc8,
-  # and is not what this test is about, so we won't fail because of it.
-  k_expected_disk.add({
-    'D/G/tauprime' : Item(props={SVN_PROP_MERGEINFO :
-                                 '/A/D/G/tau:2-7\n/A_COPY/D/G/tauprime:2-9'},
-                          contents="This is the file 'tau'.\n")
+    'D/H/omega' : Item("New content"),
     })
-  expected_skip = wc.State(A_path, {})
-  svntest.actions.run_and_verify_merge(A_path, None, None,
+  expected_A_skip = wc.State(A_path, {})
+  svntest.actions.run_and_verify_merge(A_path, '6', '7',
                                        sbox.repo_url + '/A_COPY', None,
                                        expected_output,
                                        expected_mergeinfo_output,
                                        expected_elision_output,
-                                       k_expected_disk,
-                                       k_expected_status,
-                                       expected_skip,
+                                       expected_A_disk,
+                                       expected_A_status,
+                                       expected_A_skip,
                                        None, None, None, None,
-                                       None, True, True,
-                                       '--reintegrate')
-
-  # Finally, commit the result of the merge (r10).
-  expected_output = wc.State(wc_dir, {
-    'A/D/G/tauprime' : Item(verb='Adding'),
-    'A/mu'           : Item(verb='Sending'),
-    'A'              : Item(verb='Sending'),
-    })
-  expected_status.add({
-    'A/D/G/tauprime' : Item(status='  ', wc_rev=10),
-    })
-  expected_status.tweak('A', 'A/mu', wc_rev=10)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-def reintegrate_branch_never_merged_to(sbox):
-  "merge --reintegrate on a never-updated branch"
-
-  # Make A_COPY branch in r2, and do a few more commits to A in r3-6.
-  sbox.build()
-  wc_dir = sbox.wc_dir
-  expected_disk, expected_status = set_up_branch(sbox)
-
-  # Make a change on the branch, to A_COPY/mu.  Commit in r7.
-  svntest.main.file_write(os.path.join(wc_dir, "A_COPY", "mu"),
-                          "Changed on the branch.")
-  expected_output = wc.State(wc_dir, {'A_COPY/mu' : Item(verb='Sending')})
-  expected_status.tweak('A_COPY/mu', wc_rev=7)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-  expected_disk.tweak('A_COPY/mu', contents='Changed on the branch.')
-
-  # Update the wcs.
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='7')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
-
-  # Make another change on the branch: copy tau to tauprime.  Commit
-  # in r8.
-  svntest.actions.run_and_verify_svn(None, None, [], 'cp',
-                                     os.path.join(wc_dir, 'A_COPY', 'D', 'G',
-                                                  'tau'),
-                                     os.path.join(wc_dir, 'A_COPY', 'D', 'G',
-                                                  'tauprime'))
-  expected_output = wc.State(wc_dir, {
-    'A_COPY/D/G/tauprime' : Item(verb='Adding')
-    })
-  expected_status.add({'A_COPY/D/G/tauprime': Item(status='  ', wc_rev=8)})
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-  expected_disk.add({
-    'A_COPY/D/G/tauprime' : Item(contents="This is the file 'tau'.\n")
-    })
+                                       None, 1)
 
-  # Update the trunk (well, the whole wc) (since reintegrate really
-  # wants a clean wc).
-  expected_output = wc.State(wc_dir, {})
-  expected_status.tweak(wc_rev='8')
-  svntest.actions.run_and_verify_update(wc_dir, expected_output,
-                                        expected_disk, expected_status,
-                                        None, None, None, None, None, True)
+  # Revert all local mods
+  svntest.actions.run_and_verify_svn(None,
+                                     ["Reverted '" + A_path + "'\n",
+                                      "Reverted '" + mu_path + "'\n"],
+                                     [], 'revert', '-R', wc_dir)
 
-  # *finally*, actually run merge --reintegrate in trunk with the
-  # branch URL.  This should bring in the mu change and the tauprime
-  # change.
-  A_path = os.path.join(wc_dir, "A")
-  expected_output = wc.State(A_path, {
-    'mu'           : Item(status='U '),
-    'D/G/tauprime' : Item(status='A '),
-    })
-  expected_mergeinfo_output = wc.State(A_path, {
-    '' : Item(status=' U'),
-    })
-  expected_elision_output = wc.State(A_path, {
-    })
-  k_expected_status = wc.State(A_path, {
-    "B"            : Item(status='  ', wc_rev=8),
-    "B/lambda"     : Item(status='  ', wc_rev=8),
-    "B/E"          : Item(status='  ', wc_rev=8),
-    "B/E/alpha"    : Item(status='  ', wc_rev=8),
-    "B/E/beta"     : Item(status='  ', wc_rev=8),
-    "B/F"          : Item(status='  ', wc_rev=8),
-    "mu"           : Item(status='M ', wc_rev=8),
-    "C"            : Item(status='  ', wc_rev=8),
-    "D"            : Item(status='  ', wc_rev=8),
-    "D/gamma"      : Item(status='  ', wc_rev=8),
-    "D/G"          : Item(status='  ', wc_rev=8),
-    "D/G/pi"       : Item(status='  ', wc_rev=8),
-    "D/G/rho"      : Item(status='  ', wc_rev=8),
-    "D/G/tau"      : Item(status='  ', wc_rev=8),

[... 10842 lines stripped ...]