subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1658362 [30/34] - in /subversion/branches/remove-log-addressing: ./ build/ build/generator/ build/generator/templates/ notes/ subversion/bindings/cxxhl/include/svncxxhl/ subversion/bindings/javahl/native/ subversion/bindings/javahl/native/...
Date Mon, 09 Feb 2015 11:23:43 GMT
Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/patch_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/patch_tests.py Mon Feb  9 11:23:39 2015
@@ -4689,6 +4689,757 @@ def patch_git_rename(sbox):
                                        expected_output, expected_disk,
                                        expected_status, expected_skip)
 
+@Issue(4533)
+def patch_hunk_avoid_reorder(sbox):
+  """avoid reordering hunks"""
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_append('A/mu',
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
+                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     'MM\n' 'NN\n' 'OO\n' 'PP\n' 'QQ\n' 'RR\n'
+                     'SS\n' 'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n'
+                     'YY\n' 'ZZ\n', truncate=True)
+  sbox.simple_commit()
+
+  # two hunks, first matches at offset +18, second matches at both -13
+  # and +18 but we want the second match as it is after the first
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 1)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -13,6 +13,7 @@\n",
+    " MM\n",
+    " NN\n",
+    " OO\n",
+    "+11111\n",
+    " PP\n",
+    " QQ\n",
+    " RR\n",
+    "@@ -20,6 +20,7 @@\n",
+    " TT\n",
+    " UU\n",
+    " VV\n",
+    "+22222\n",
+    " WW\n",
+    " XX\n",
+    " YY\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -13,6 +13,7 @@ with offset 18\n',
+    '>         applied hunk @@ -20,6 +20,7 @@ with offset 18\n'
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
+                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     'MM\n' 'NN\n' 'OO\n' '11111\n' 'PP\n' 'QQ\n' 'RR\n'
+                     'SS\n' 'TT\n' 'UU\n' 'VV\n' '22222\n' 'WW\n' 'XX\n'
+                     'YY\n' 'ZZ\n')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  sbox.simple_revert('A/mu')
+
+  # change patch so second hunk matches at both -14 and +17, we still
+  # want the second match
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 1)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -13,6 +13,7 @@\n",
+    " MM\n",
+    " NN\n",
+    " OO\n",
+    "+11111\n",
+    " PP\n",
+    " QQ\n",
+    " RR\n",
+    "@@ -21,6 +21,7 @@\n",
+    " TT\n",
+    " UU\n",
+    " VV\n",
+    "+22222\n",
+    " WW\n",
+    " XX\n",
+    " YY\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -13,6 +13,7 @@ with offset 18\n',
+    '>         applied hunk @@ -21,6 +21,7 @@ with offset 17\n'
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
+                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     'MM\n' 'NN\n' 'OO\n' '11111\n' 'PP\n' 'QQ\n' 'RR\n'
+                     'SS\n' 'TT\n' 'UU\n' 'VV\n' '22222\n' 'WW\n' 'XX\n'
+                     'YY\n' 'ZZ\n')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  sbox.simple_revert('A/mu')
+
+@Issue(4533)
+def patch_hunk_avoid_reorder2(sbox):
+  """avoid reordering hunks 2"""
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_append('A/mu',
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
+                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     'MM\n' 'NN\n' 'OO\n' 'PP\n' 'QQ\n' 'RR\n'
+                     'SS\n' 'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n'
+                     'YY\n' 'ZZ\n', truncate=True)
+  sbox.simple_commit()
+
+  # two hunks, first matches at offset +18, second matches at both -13
+  # change patch so second hunk matches at both -12 and +19, we still
+  # want the second match
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 1)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -13,6 +13,7 @@\n",
+    " MM\n",
+    " NN\n",
+    " OO\n",
+    "+11111\n",
+    " PP\n",
+    " QQ\n",
+    " RR\n",
+    "@@ -19,6 +19,7 @@\n",
+    " TT\n",
+    " UU\n",
+    " VV\n",
+    "+22222\n",
+    " WW\n",
+    " XX\n",
+    " YY\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -13,6 +13,7 @@ with offset 18\n',
+    '>         applied hunk @@ -19,6 +19,7 @@ with offset 19\n'
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
+                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     '33333\n' '33333\n' '33333\n'
+                     'MM\n' 'NN\n' 'OO\n' '11111\n' 'PP\n' 'QQ\n' 'RR\n'
+                     'SS\n' 'TT\n' 'UU\n' 'VV\n' '22222\n' 'WW\n' 'XX\n'
+                     'YY\n' 'ZZ\n')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+@Issue(4533)
+def patch_hunk_reorder(sbox):
+  """hunks that reorder"""
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_append('A/mu',
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n' 'GG\n'
+                     'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n' 'MM\n' 'NN\n',
+                     truncate=True)
+  sbox.simple_commit()
+
+  # Two hunks match in opposite order
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 1)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -2,6 +2,7 @@\n",
+    " II\n",
+    " JJ\n",
+    " KK\n",
+    "+11111\n",
+    " LL\n",
+    " MM\n",
+    " NN\n",
+    "@@ -9,6 +10,7 @@\n",
+    " BB\n",
+    " CC\n",
+    " DD\n",
+    "+22222\n",
+    " EE\n",
+    " FF\n",
+    " GG\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -9,6 +10,7 @@ with offset -7\n',
+    '>         applied hunk @@ -2,6 +2,7 @@ with offset 7\n',
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' '22222\n' 'EE\n' 'FF\n' 'GG\n'
+                     'HH\n' 'II\n' 'JJ\n' 'KK\n' '11111\n' 'LL\n' 'MM\n' 'NN\n')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # In the following case the reordered hunk2 is smaller offset
+  # magnitude than hunk2 at the end and the reorder is preferred.
+  sbox.simple_revert('A/mu')
+  sbox.simple_append('A/mu',
+                     'x\n' * 2  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 2  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10  +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 100  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n',
+                     truncate=True)
+  sbox.simple_commit()
+
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 2)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -28,7 +28,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk1\n",
+    "+hunk1-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    "@@ -44,7 +44,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk2\n",
+    "+hunk2-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -44,7 +44,7 @@ with offset -32\n',
+    '>         applied hunk @@ -28,7 +28,7 @@ with offset 1\n',
+    ]
+  expected_disk.tweak('A/mu', contents=
+                      'x\n' * 2  +
+                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 2  +
+                      '1\n' '2\n' '3\n' 'hunk2-mod\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 10  +
+                      '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 100  +
+                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n')
+
+  expected_status.tweak('A/mu', status='M ', wc_rev=3)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+  sbox.simple_revert('A/mu')
+
+  # In this case the reordered hunk2 is further than hunk2 at the end
+  # and the reordered is not preferred.
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 2)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -28,7 +28,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk1\n",
+    "+hunk1-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    "@@ -110,7 +110,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk2\n",
+    "+hunk2-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -28,7 +28,7 @@ with offset 1\n',
+    '>         applied hunk @@ -110,7 +110,7 @@ with offset 26\n',
+    ]
+  expected_disk.tweak('A/mu', contents=
+                      'x\n' * 2  +
+                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 2  +
+                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 10  +
+                      '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                      'x\n' * 100  +
+                      '1\n' '2\n' '3\n' 'hunk2-mod\n' '4\n' '5\n' '6\n')
+
+  expected_status.tweak('A/mu', status='M ', wc_rev=3)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+@XFail()
+def patch_hunk_overlap(sbox):
+  """hunks that overlap"""
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_append('A/mu',
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
+                     'GG\n' 'HH\n' 'II\n', truncate=True)
+  sbox.simple_commit()
+
+  # Two hunks that overlap when applied, GNU patch can apply both hunks.
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 1)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -2,6 +2,7 @@\n",
+    " BB\n",
+    " CC\n",
+    " DD\n",
+    "+11111\n",
+    " EE\n",
+    " FF\n",
+    " GG\n",
+    "@@ -9,6 +10,7 @@\n",
+    " DD\n",
+    " EE\n",
+    " FF\n",
+    "+22222\n",
+    " GG\n",
+    " HH\n",
+    " II\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+    'U         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -9,6 +10,7 @@ with offset -5\n',
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=
+                     'AA\n' 'BB\n' 'CC\n' 'DD\n' '11111\n' 'EE\n' 'FF\n'
+                     '22222\n' 'GG\n' 'HH\n' 'II\n')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+def patch_delete_modified(sbox):
+  """patch delete modified"""
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  # A patch that deletes beta.
+  unidiff_patch = [
+    "Index: A/B/E/beta\n",
+    "===================================================================\n",
+    "--- A/B/E/beta	(revision 1)\n",
+    "+++ A/B/E/beta	(working copy)\n",
+    "@@ -1 +0,0 @@\n",
+    "-This is the file 'beta'.\n",
+    ]
+
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  # First application deletes beta
+  expected_output = [
+    'D         %s\n' % sbox.ospath('A/B/E/beta'),
+    ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.remove('A/B/E/beta')
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/B/E/beta', status='D ')
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Second application skips
+  expected_output = [
+    'Skipped \'%s\'\n' % sbox.ospath('A/B/E/beta'),
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
+  expected_skip = wc.State('', {
+    sbox.ospath('A/B/E/beta') :  Item(verb='Skipped'),
+  })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Third application, with file present even though state is 'D', also skips
+  sbox.simple_append('A/B/E/beta', 'Modified', truncate=True)
+  expected_disk.add({'A/B/E/beta' : Item(contents='Modified')})
+  expected_output = [
+    'Skipped \'%s\'\n' % sbox.ospath('A/B/E/beta'),
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
+  expected_skip = wc.State('', {
+    sbox.ospath('A/B/E/beta') :  Item(verb='Skipped'),
+  })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Revert and modify beta, fourth application gives a text conflict.
+  sbox.simple_revert('A/B/E/beta')
+  sbox.simple_append('A/B/E/beta', 'Modified', truncate=True)
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/B/E/beta'),
+    '>         rejected hunk @@ -1,1 +0,0 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_skip = wc.State('', { })
+  reject_file_contents = [
+    "--- A/B/E/beta\n",
+    "+++ A/B/E/beta\n",
+    "@@ -1,1 +0,0 @@\n",
+    "-This is the file 'beta'.\n",
+  ]
+  expected_disk.add({'A/B/E/beta.svnpatch.rej'
+                     : Item(contents=''.join(reject_file_contents))
+                     })
+  expected_status.tweak('A/B/E/beta', status='M ')
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+def patch_closest(sbox):
+  "find closest hunk"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  unidiff_patch = [
+    "Index: A/mu\n"
+    "===================================================================\n",
+    "--- A/mu\t(revision 2)\n",
+    "+++ A/mu\t(working copy)\n",
+    "@@ -47,7 +47,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk1\n",
+    "+hunk1-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    "@@ -66,7 +66,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-rejected-hunk2-\n",
+    "+rejected-hunk2-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    "@@ -180,7 +180,7 @@\n",
+    " 1\n",
+    " 2\n",
+    " 3\n",
+    "-hunk3\n",
+    "+hunk3-mod\n",
+    " 4\n",
+    " 5\n",
+    " 6\n",
+    ]
+  patch_file_path = make_patch_path(sbox)
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
+  # of -19 and +18, prefer +18 gives final offset +22
+  sbox.simple_append('A/mu',
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 30  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10,
+                     truncate=True)
+  sbox.simple_commit()
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
+    '>         applied hunk @@ -180,7 +180,7 @@ with offset 22\n',
+    '>         rejected hunk @@ -66,7 +66,7 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'A/mu.svnpatch.rej' : Item(contents=
+    "--- A/mu\n" +
+    "+++ A/mu\n" +
+    "@@ -66,7 +66,7 @@\n" +
+    " 1\n" +
+    " 2\n" +
+    " 3\n" +
+    "-rejected-hunk2-\n" +
+    "+rejected-hunk2-mod\n" +
+    " 4\n" +
+    " 5\n" +
+    " 6\n")})
+  expected_disk.tweak('A/mu', contents=
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 30  +
+                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10)
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
+  # of -19 and +20, prefer -19 gives final offset -15
+  sbox.simple_append('A/mu',
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 32  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10,
+                     truncate=True)
+  sbox.simple_commit()
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
+    '>         applied hunk @@ -180,7 +180,7 @@ with offset -15\n',
+    '>         rejected hunk @@ -66,7 +66,7 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_disk.tweak('A/mu', contents=
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 32  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10)
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=3)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
+  # of -19 and +19, prefer -19 gives final offset -15
+  sbox.simple_append('A/mu',
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 31  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10,
+                     truncate=True)
+  sbox.simple_commit()
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
+    '>         applied hunk @@ -180,7 +180,7 @@ with offset -15\n',
+    '>         rejected hunk @@ -66,7 +66,7 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_disk.tweak('A/mu', contents=
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 31  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10)
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=4)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
+  # of +173 and -173, prefer +173 gives final offset +177
+  sbox.simple_append('A/mu',
+                     'x\n' * 10  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 33 +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 242  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10,
+                     truncate=True)
+  sbox.simple_commit()
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
+    '>         applied hunk @@ -180,7 +180,7 @@ with offset 177\n',
+    '>         rejected hunk @@ -66,7 +66,7 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_disk.tweak('A/mu', contents=
+                     'x\n' * 10  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 33  +
+                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 242  +
+                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10)
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=5)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
+  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
+  # of +174 and -173, prefer -173 gives final offset -169
+  sbox.simple_append('A/mu',
+                     'x\n' * 10  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 33 +
+                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 243  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10,
+                     truncate=True)
+  sbox.simple_commit()
+
+  expected_output = [
+    'C         %s\n' % sbox.ospath('A/mu'),
+    '>         applied hunk @@ -180,7 +180,7 @@ with offset -169\n',
+    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
+    '>         rejected hunk @@ -66,7 +66,7 @@\n',
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
+  expected_disk.tweak('A/mu', contents=
+                     'x\n' * 10  +
+                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 33  +
+                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 50  +
+                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 243  +
+                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
+                     'x\n' * 10)
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=6)
+  expected_skip = wc.State('', { })
+  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip)
+
 ########################################################################
 #Run the tests
 
@@ -4741,7 +5492,13 @@ test_list = [ None,
               patch_apply_no_fuz,
               patch_lacking_trailing_eol_on_context,
               patch_with_custom_keywords,
-              patch_git_rename
+              patch_git_rename,
+              patch_hunk_avoid_reorder,
+              patch_hunk_avoid_reorder2,
+              patch_hunk_reorder,
+              patch_hunk_overlap,
+              patch_delete_modified,
+              patch_closest,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/prop_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/prop_tests.py Mon Feb  9 11:23:39 2015
@@ -2619,7 +2619,6 @@ def peg_rev_base_working(sbox):
                                      sbox.ospath('iota') + '@BASE')
 
 @Issue(4415)
-@XFail(svntest.main.is_ra_type_dav)
 def xml_unsafe_author(sbox):
   "svn:author with XML unsafe chars"
 
@@ -2646,22 +2645,70 @@ def xml_unsafe_author(sbox):
 
   # mod_dav_svn sends svn:author (via PROPFIND for DAV)
   # Since r1553367 this works correctly on ra_serf, since we now request
-  # a single property value which somehow triggers different behavior
+  # a single property value which skips creating the creator-displayname property
   svntest.actions.run_and_verify_svn(None, ['foo\bbar'], [],
                                      'propget', '--revprop', '-r', '1',
                                      'svn:author', '--strict', wc_dir)
 
+  # Ensure a stable date
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'propset', '--revprop', '-r', '1',
+                                     'svn:date', '2015-01-01T00:00:00.0Z', wc_dir)
+
   # But a proplist of this property value still fails via DAV.
-  expected_output = [
+  expected_output = svntest.verify.UnorderedOutput([
     'Unversioned properties on revision 1:\n',
     '  svn:author\n',
+    '    foo\bbar\n',
     '  svn:date\n',
-    '  svn:log\n'
-  ]
+    '    2015-01-01T00:00:00.0Z\n',
+    '  svn:log\n',
+    '    Log message for revision 1.\n'
+  ])
   svntest.actions.run_and_verify_svn(None, expected_output, [],
-                                     'proplist', '--revprop', '-r', '1',
+                                     'proplist', '--revprop', '-r', '1', '-v',
                                      wc_dir)
 
+@Issue(4415)
+def xml_unsafe_author2(sbox):
+  "svn:author with XML unsafe chars 2"
+
+  sbox.build(create_wc = False)
+  repo_url = sbox.repo_url
+
+  svntest.actions.enable_revprop_changes(sbox.repo_dir)
+
+  # client sends svn:author (via PROPPATCH for DAV)
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'propset', '--revprop', '-r', '1',
+                                     'svn:author', 'foo\bbar', repo_url)
+
+  # Ensure a stable date
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'propset', '--revprop', '-r', '1',
+                                     'svn:date', '2000-01-01T12:00:00.0Z',
+                                     repo_url)
+
+  if svntest.main.is_ra_type_dav():
+    # This receives the filtered author (but that is better than an Xml fail)
+    expected_author = 'foobar'
+  else:
+    expected_author = 'foo\bbar'
+
+  expected_output = svntest.verify.UnorderedOutput([
+    '      1 %-8s              Jan 01  2000 ./\n' % expected_author,
+    '      1 %-8s              Jan 01  2000 A/\n' % expected_author,
+    '      1 %-8s           25 Jan 01  2000 iota\n' % expected_author
+  ])
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                     'ls', '-v', repo_url)
+
+  expected_info = [{
+      'Repository Root' : sbox.repo_url,
+      'Last Changed Author' : expected_author,
+  }]
+  svntest.actions.run_and_verify_info(expected_info, repo_url)
+
 def dir_prop_conflict_details(sbox):
   "verify dir property conflict details"
 
@@ -2814,6 +2861,7 @@ test_list = [ None,
               almost_known_prop_names,
               peg_rev_base_working,
               xml_unsafe_author,
+              xml_unsafe_author2,
               dir_prop_conflict_details,
               iprops_list_abspath,
               wc_propop_on_url,

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/redirect_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/redirect_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/redirect_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/redirect_tests.py Mon Feb  9 11:23:39 2015
@@ -178,6 +178,69 @@ def redirected_nonroot_update(sbox):
   verify_url(wc_dir, checkout_url)
 
 #----------------------------------------------------------------------
+@SkipUnless(svntest.main.is_ra_type_dav)
+def redirected_externals(sbox):
+  "redirected externals"
+
+  sbox.build()
+
+  sbox.simple_propset('svn:externals',
+                      '^/A/B/E/alpha fileX\n'
+                      '^/A/B/F dirX',
+                      'A/C')
+  sbox.simple_commit()
+  sbox.simple_update()
+
+  wc_dir = sbox.add_wc_path("my")
+  co_url = sbox.redirected_root_url()
+  exit_code, out, err = svntest.main.run_svn(None, 'co', co_url, wc_dir)
+  if err:
+    raise svntest.Failure
+  if not redirect_regex.match(out[0]):
+    raise svntest.Failure
+
+  verify_url(wc_dir, sbox.repo_url)
+  verify_url(sbox.ospath('A/C/fileX'), sbox.repo_url + '/A/B/E/alpha',
+             wc_path_is_file=True)
+  verify_url(sbox.ospath('A/C/dirX'), sbox.repo_url + '/A/B/F')
+
+#----------------------------------------------------------------------
+@SkipUnless(svntest.main.is_ra_type_dav)
+def redirected_copy(sbox):
+  "redirected copy"
+
+  sbox.build(create_wc=False)
+
+  # E170011 = SVN_ERR_RA_SESSION_URL_MISMATCH
+  expected_error = "svn: E170011: Repository moved permanently"
+
+  # This tests the actual copy handling
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'cp', '-m', 'failed copy',
+                                     sbox.redirected_root_url() + '/A',
+                                     sbox.redirected_root_url() + '/A_copied')
+
+  # This tests the cmdline handling of '^/copy-of-A'
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'cp', '-m', 'failed copy',
+                                     sbox.redirected_root_url() + '/A',
+                                     '^/copy-of-A')
+
+  # E170011 = SVN_ERR_RA_SESSION_URL_MISMATCH
+  expected_error = "svn: E170011: Repository moved temporarily"
+
+  # This tests the actual copy handling
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'cp', '-m', 'failed copy',
+                                     sbox.redirected_root_url(temporary=True) + '/A',
+                                     sbox.redirected_root_url(temporary=True) + '/A_copied')
+
+  # This tests the cmdline handling of '^/copy-of-A'
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'cp', '-m', 'failed copy',
+                                     sbox.redirected_root_url(temporary=True) + '/A',
+                                     '^/copy-of-A')
+#----------------------------------------------------------------------
 
 ########################################################################
 # Run the tests
@@ -188,6 +251,8 @@ test_list = [ None,
               redirected_checkout,
               redirected_update,
               redirected_nonroot_update,
+              redirected_externals,
+              redirected_copy,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/schedule_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/schedule_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/schedule_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/schedule_tests.py Mon Feb  9 11:23:39 2015
@@ -569,10 +569,9 @@ def status_add_deleted_directory(sbox):
 def add_recursive_already_versioned(sbox):
   "'svn add' should traverse already-versioned dirs"
 
+  sbox.build()
   wc_dir = sbox.wc_dir
 
-  svntest.actions.make_repo_and_wc(sbox)
-
   # Create some files, then schedule them for addition
   delta_path = sbox.ospath('delta')
   zeta_path = sbox.ospath('A/B/zeta')

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnadmin_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnadmin_tests.py Mon Feb  9 11:23:39 2015
@@ -50,6 +50,7 @@ XFail = svntest.testcase.XFail_deco
 Issues = svntest.testcase.Issues_deco
 Issue = svntest.testcase.Issue_deco
 Wimp = svntest.testcase.Wimp_deco
+SkipDumpLoadCrossCheck = svntest.testcase.SkipDumpLoadCrossCheck_deco
 Item = svntest.wc.StateItem
 
 def check_hotcopy_bdb(src, dst):
@@ -325,37 +326,6 @@ def set_changed_path_list(sbox, revision
 
 #----------------------------------------------------------------------
 
-def test_create(sbox, minor_version=None):
-  "'svnadmin create'"
-
-
-  repo_dir = sbox.repo_dir
-  wc_dir = sbox.wc_dir
-
-  svntest.main.safe_rmtree(repo_dir, 1)
-  svntest.main.safe_rmtree(wc_dir)
-
-  svntest.main.create_repos(repo_dir, minor_version)
-
-  svntest.actions.run_and_verify_svn("Creating rev 0 checkout",
-                                     ["Checked out revision 0.\n"], [],
-                                     "checkout",
-                                     sbox.repo_url, wc_dir)
-
-
-  svntest.actions.run_and_verify_svn(
-    "Running status",
-    [], [],
-    "status", wc_dir)
-
-  svntest.actions.run_and_verify_svn(
-    "Running verbose status",
-    ["                 0        0  ?           %s\n" % wc_dir], [],
-    "status", "--verbose", wc_dir)
-
-  # success
-
-
 # dump stream tests need a dump file
 
 def clean_dumpfile():
@@ -387,7 +357,7 @@ dumpfile_revisions = \
 def extra_headers(sbox):
   "loading of dumpstream with extra headers"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile = clean_dumpfile()
 
@@ -402,7 +372,7 @@ def extra_headers(sbox):
 def extra_blockcontent(sbox):
   "load success on oversized Content-length"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile = clean_dumpfile()
 
@@ -420,7 +390,7 @@ def extra_blockcontent(sbox):
 def inconsistent_headers(sbox):
   "load failure on undersized Content-length"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile = clean_dumpfile()
 
@@ -436,7 +406,7 @@ def inconsistent_headers(sbox):
 def empty_date(sbox):
   "preserve date-less revisions in load"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile = clean_dumpfile()
 
@@ -941,7 +911,7 @@ def load_with_parent_dir(sbox):
   "'svnadmin load --parent-dir' reparents mergeinfo"
 
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2983. ##
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svnadmin_tests_data',
@@ -1039,7 +1009,7 @@ def reflect_dropped_renumbered_revs(sbox
 
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=3020. ##
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
@@ -1139,6 +1109,10 @@ def fsfs_recover_handle_missing_revs_or_
     ".*Revision 3 has a non-file where its revprops file should be.*"):
     raise svntest.Failure
 
+  # Restore the r3 revprops file, thus repairing the repository.
+  os.rmdir(revprop_3)
+  os.rename(revprop_was_3, revprop_3)
+
 
 #----------------------------------------------------------------------
 
@@ -1146,14 +1120,8 @@ def fsfs_recover_handle_missing_revs_or_
 def create_in_repo_subdir(sbox):
   "'svnadmin create /path/to/repo/subdir'"
 
+  sbox.build(create_wc=False, empty=True)
   repo_dir = sbox.repo_dir
-  wc_dir = sbox.wc_dir
-
-  svntest.main.safe_rmtree(repo_dir, 1)
-  svntest.main.safe_rmtree(wc_dir)
-
-  # This should succeed
-  svntest.main.create_repos(repo_dir)
 
   success = False
   try:
@@ -1181,16 +1149,13 @@ def create_in_repo_subdir(sbox):
 
 
 @SkipUnless(svntest.main.is_fs_type_fsfs)
+@SkipDumpLoadCrossCheck()
 def verify_with_invalid_revprops(sbox):
   "svnadmin verify detects invalid revprops file"
 
+  sbox.build(create_wc=False, empty=True)
   repo_dir = sbox.repo_dir
 
-  svntest.main.safe_rmtree(repo_dir, 1)
-
-  # This should succeed
-  svntest.main.create_repos(repo_dir)
-
   # Run a test verify
   exit_code, output, errput = svntest.main.run_svnadmin("verify",
                                                         sbox.repo_dir)
@@ -1240,7 +1205,7 @@ def dont_drop_valid_mergeinfo_during_inc
   "don't filter mergeinfo revs from incremental dump"
 
   # Create an empty repos.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # PART 1: Load a full dump to an empty repository.
   #
@@ -1329,7 +1294,7 @@ def dont_drop_valid_mergeinfo_during_inc
   dump_fp.close()
 
   # Blow away the current repos and create an empty one in its place.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Load the three incremental dump files in sequence.
   load_dumpstream(sbox, open(dump_file_r1_10).read(), '--ignore-uuid')
@@ -1349,7 +1314,7 @@ def dont_drop_valid_mergeinfo_during_inc
   # PART 3: Load a full dump to an non-empty repository.
   #
   # Reset our sandbox.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Load this skeleton repos into the empty target:
   #
@@ -1400,7 +1365,7 @@ def dont_drop_valid_mergeinfo_during_inc
   # PART 4: Load a a series of incremental dumps to an non-empty repository.
   #
   # Reset our sandbox.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Load this skeleton repos into the empty target:
   load_dumpstream(sbox, dumpfile_skeleton, '--ignore-uuid')
@@ -1428,14 +1393,12 @@ def hotcopy_symlink(sbox):
 
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2591. ##
 
+  # Create a repository.
+  sbox.build(create_wc=False, empty=True)
   original_repo = sbox.repo_dir
 
   hotcopy_repo, hotcopy_url = sbox.add_repo_path('hotcopy')
 
-  # Create a repository.
-  svntest.main.safe_rmtree(original_repo, 1)
-  svntest.main.create_repos(original_repo)
-
   # Create a file, a dir and a missing path outside the repoitory.
   svntest.main.safe_rmtree(sbox.wc_dir, 1)
   os.mkdir(sbox.wc_dir)
@@ -1531,7 +1494,7 @@ text
 
 
 """
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Try to load the dumpstream, expecting a failure (because of mixed EOLs).
   load_and_verify_dumpstream(sbox, [], svntest.verify.AnyOutput,
@@ -1556,8 +1519,8 @@ def verify_non_utf8_paths(sbox):
 
   # Corruption only possible in physically addressed revisions created
   # with pre-1.6 servers.
-  test_create(sbox,
-              minor_version = min(svntest.main.options.server_minor_version,8))
+  sbox.build(empty=True,
+             minor_version=min(svntest.main.options.server_minor_version,8))
 
   # Load the dumpstream
   load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, False,
@@ -1699,7 +1662,7 @@ def load_ranges(sbox):
   "'svnadmin load --revision X:Y'"
 
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=3734. ##
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svnadmin_tests_data',
@@ -1975,8 +1938,7 @@ def mergeinfo_race(sbox):
 @Skip(svntest.main.is_fs_type_fsx)
 def recover_old_empty(sbox):
   "recover empty --compatible-version=1.3"
-  svntest.main.safe_rmtree(sbox.repo_dir, 1)
-  svntest.main.create_repos(sbox.repo_dir, minor_version=3)
+  sbox.build(create_wc=False, empty=True, minor_version=3)
   svntest.actions.run_and_verify_svnadmin(None, None, [],
                                           "recover", sbox.repo_dir)
 
@@ -2049,6 +2011,9 @@ def verify_keep_going(sbox):
                                    None, errput, None, "svnadmin: E165011:.*"):
     raise svntest.Failure
 
+  # Don't leave a corrupt repository
+  svntest.main.safe_rmtree(sbox.repo_dir, True)
+
 @SkipUnless(svntest.main.is_fs_type_fsfs)
 def verify_invalid_path_changes(sbox):
   "detect invalid changed path list entries"
@@ -2188,13 +2153,14 @@ def verify_invalid_path_changes(sbox):
                                    None, errput, None, "svnadmin: E165011:.*"):
     raise svntest.Failure
 
+  # Don't leave a corrupt repository
+  svntest.main.safe_rmtree(sbox.repo_dir, True)
+
 
 def verify_denormalized_names(sbox):
   "detect denormalized names and name collisions"
 
-  sbox.build(create_wc = False)
-  svntest.main.safe_rmtree(sbox.repo_dir, True)
-  svntest.main.create_repos(sbox.repo_dir)
+  sbox.build(create_wc=False, empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svnadmin_tests_data',
@@ -2270,10 +2236,8 @@ def load_ignore_dates(sbox):
   # All revisions in the loaded repository should come after this time.
   start_time = time.localtime()
   time.sleep(1)
-  
-  sbox.build(create_wc=False)
-  svntest.main.safe_rmtree(sbox.repo_dir, True)
-  svntest.main.create_repos(sbox.repo_dir)
+
+  sbox.build(create_wc=False, empty=True)
 
   dumpfile_skeleton = open(os.path.join(os.path.dirname(sys.argv[0]),
                                         'svnadmin_tests_data',
@@ -2567,6 +2531,9 @@ def verify_quickly(sbox):
                                    output, errput, exp_out, exp_err):
     raise svntest.Failure
 
+  # Don't leave a corrupt repository
+  svntest.main.safe_rmtree(sbox.repo_dir, True)
+
 
 @SkipUnless(svntest.main.is_fs_type_fsfs)
 @SkipUnless(svntest.main.fs_has_pack)
@@ -2580,9 +2547,7 @@ def fsfs_hotcopy_progress(sbox):
     raise svntest.Skip
 
   # Create an empty repository, configure three files per shard.
-  sbox.build(create_wc=False)
-  svntest.main.safe_rmtree(sbox.repo_dir, True)
-  svntest.main.create_repos(sbox.repo_dir)
+  sbox.build(create_wc=False, empty=True)
   patch_format(sbox.repo_dir, shard_size=3)
 
   inc_backup_dir, inc_backup_url = sbox.add_repo_path('incremental-backup')
@@ -2696,9 +2661,7 @@ def fsfs_hotcopy_progress_with_revprop_c
     raise svntest.Skip
 
   # Create an empty repository, commit several revisions and hotcopy it.
-  sbox.build(create_wc=False)
-  svntest.main.safe_rmtree(sbox.repo_dir, True)
-  svntest.main.create_repos(sbox.repo_dir)
+  sbox.build(create_wc=False, empty=True)
 
   for i in range(6):
     svntest.actions.run_and_verify_svn(None, None, [], 'mkdir',
@@ -2743,9 +2706,7 @@ def fsfs_hotcopy_progress_with_revprop_c
 def fsfs_hotcopy_progress_old(sbox):
   "hotcopy --compatible-version=1.3 progress"
 
-  sbox.build(create_wc=False)
-  svntest.main.safe_rmtree(sbox.repo_dir, True)
-  svntest.main.create_repos(sbox.repo_dir, minor_version=3)
+  sbox.build(create_wc=False, empty=True, minor_version=3)
 
   inc_backup_dir, inc_backup_url = sbox.add_repo_path('incremental-backup')
 
@@ -2840,7 +2801,7 @@ def upgrade(sbox):
 def load_txdelta(sbox):
   "exercising svn_txdelta_target on BDB"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # This dumpfile produced a BDB repository that generated cheksum
   # mismatches on read caused by the improper handling of

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/svndumpfilter_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/svndumpfilter_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/svndumpfilter_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/svndumpfilter_tests.py Mon Feb  9 11:23:39 2015
@@ -34,8 +34,7 @@ import svntest
 from svntest.verify import SVNExpectedStdout, SVNExpectedStderr
 
 # Get some helper routines
-from svnadmin_tests import (load_and_verify_dumpstream, load_dumpstream,
-                            test_create)
+from svnadmin_tests import load_and_verify_dumpstream, load_dumpstream
 from svntest.main import run_svn, run_svnadmin
 
 # (abbreviation)
@@ -60,15 +59,10 @@ def filter_and_return_output(dump, bufsi
     dump = [ dump ]
 
   # Does the caller want the stderr?
-  try:
-      varargs.index('-q')
+  if '-q' in varargs or '--quiet' in varargs:
       expected_errput = None # Stderr with -q or --quiet is a real error!
-  except:
-      try:
-          varargs.index('--quiet')
-          expected_errput = None
-      except:
-          expected_errput = svntest.verify.AnyOutput
+  else:
+      expected_errput = svntest.verify.AnyOutput
   ## TODO: Should we handle exit_code?
   exit_code, output, errput = svntest.main.run_command_stdin(
     svntest.main.svndumpfilter_binary, expected_errput, bufsize, True,
@@ -92,7 +86,7 @@ def reflect_dropped_renumbered_revs(sbox
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2982. ##
 
   # Test svndumpfilter with include option
-  test_create(sbox)
+  sbox.build(empty=True)
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
                                    'with_merges.dump')
@@ -118,7 +112,7 @@ def reflect_dropped_renumbered_revs(sbox
 
 
   # Test svndumpfilter with exclude option
-  test_create(sbox)
+  sbox.build(empty=True)
   filtered_out, filtered_err = filter_and_return_output(
       dumpfile, 0, "exclude", "branch1",
       "--skip-missing-merge-sources",
@@ -142,7 +136,7 @@ def svndumpfilter_loses_mergeinfo(sbox):
 
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=3181. ##
 
-  test_create(sbox)
+  sbox.build(empty=True)
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
                                    'with_merges.dump')
@@ -225,7 +219,7 @@ def dumpfilter_with_targets(sbox):
   "svndumpfilter --targets blah"
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2697. ##
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
@@ -248,7 +242,7 @@ def dumpfilter_with_targets(sbox):
 def dumpfilter_with_patterns(sbox):
   "svndumpfilter --pattern PATH_PREFIX"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
@@ -268,7 +262,7 @@ def dumpfilter_with_patterns(sbox):
 def filter_mergeinfo_revs_outside_of_dump_stream(sbox):
   "filter mergeinfo revs outside of dump stream"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Load a partial dump into an existing repository.
   #
@@ -323,9 +317,9 @@ def filter_mergeinfo_revs_outside_of_dum
   # --skip-missing-merge-soruces which should strip out any revisions < 6.
   # Then we'll load the filtered result into an empty repository.  This
   # should offset the incoming mergeinfo by -5.  In addition, any mergeinfo
-  # revisions that are adjusted to r1 should be removed because that implies
-  # a merge of -r0:1, which is impossible.  The resulting mergeinfo should
-  # look like this:
+  # referring to the initial revision in the dump file (r6) should be
+  # removed because the change it refers to (r5:6) is not wholly within the
+  # dumpfile.  The resulting mergeinfo should look like this:
   #
   #   Properties on 'branches/B1':
   #     svn:mergeinfo
@@ -371,7 +365,7 @@ def filter_mergeinfo_revs_outside_of_dum
   #     Project-Z     (Added r5)
   #     docs/         (Added r6)
   #       README      (Added r6).
-  test_create(sbox)
+  sbox.build(empty=True)
   skeleton_dumpfile = open(os.path.join(os.path.dirname(sys.argv[0]),
                                         'svnadmin_tests_data',
                                         'skeleton_repos.dump')).read()
@@ -500,7 +494,7 @@ def filter_mergeinfo_revs_outside_of_dum
 def dropped_but_not_renumbered_empty_revs(sbox):
   "mergeinfo maps correctly when dropping revs"
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # The dump file mergeinfo_included_full.dump represents this repository:
   #
@@ -616,7 +610,7 @@ def match_empty_prefix(sbox):
       raise verify.UnexpectedStderr(filtered_err)
 
     # Load the filtered dump into a repo and check the result
-    test_create(sbox)
+    sbox.build(empty=True)
     load_dumpstream(sbox, filtered_output, '--ignore-uuid')
     svntest.actions.run_and_verify_update(sbox.wc_dir,
                                           expected_output,
@@ -650,7 +644,7 @@ def accepts_deltas(sbox):
   "accepts deltas in the input"
   # Accept format v3 (as created by 'svnadmin --deltas' or svnrdump).
 
-  test_create(sbox)
+  sbox.build(empty=True)
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',
                                    'simple_v3.dump')
@@ -684,7 +678,7 @@ def dumpfilter_targets_expect_leading_sl
   "dumpfilter targets expect leading '/' in prefixes"
   ## See http://subversion.tigris.org/issues/show_bug.cgi?id=4234. ##
 
-  test_create(sbox)
+  sbox.build(empty=True)
 
   dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svndumpfilter_tests_data',

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnrdump_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnrdump_tests.py Mon Feb  9 11:23:39 2015
@@ -34,7 +34,6 @@ from svntest.verify import SVNUnexpected
 from svntest.verify import SVNExpectedStderr
 from svntest.main import write_restrictive_svnserve_conf
 from svntest.main import server_has_partial_replay
-from svnadmin_tests import test_create
 
 # (abbreviation)
 Skip = svntest.testcase.Skip_deco
@@ -61,36 +60,27 @@ mismatched_headers_re = re.compile(
 ######################################################################
 # Helper routines
 
-def build_repos(sbox):
-  """Build an empty sandbox repository"""
-
-  # Cleanup after the last run by removing any left-over repository.
-  svntest.main.safe_rmtree(sbox.repo_dir)
-
-  # Create an empty repository.
-  svntest.main.create_repos(sbox.repo_dir)
-
-def compare_repos_dumps(svnrdump_sbox, svnadmin_dumpfile):
-  """Compare two dumpfiles, one created from SVNRDUMP_SBOX, and other given
-  by SVNADMIN_DUMPFILE.  The dumpfiles do not need to match linewise, as the
-  SVNADMIN_DUMPFILE contents will first be loaded into a repository and then
+def compare_repos_dumps(sbox, other_dumpfile,
+                        bypass_prop_validation=False):
+  """Compare two dumpfiles, one created from SBOX, and other given
+  by OTHER_DUMPFILE.  The dumpfiles do not need to match linewise, as the
+  OTHER_DUMPFILE contents will first be loaded into a repository and then
   re-dumped to do the match, which should generate the same dumpfile as
-  dumping SVNRDUMP_SBOX."""
+  dumping SBOX."""
 
-  svnrdump_contents = svntest.actions.run_and_verify_dump(
-                                                    svnrdump_sbox.repo_dir)
 
-  svnadmin_sbox = svnrdump_sbox.clone_dependent()
-  svntest.main.safe_rmtree(svnadmin_sbox.repo_dir)
-  svntest.main.create_repos(svnadmin_sbox.repo_dir)
+  sbox_dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir)
 
-  svntest.actions.run_and_verify_load(svnadmin_sbox.repo_dir, svnadmin_dumpfile)
-
-  svnadmin_contents = svntest.actions.run_and_verify_dump(
-                                                    svnadmin_sbox.repo_dir)
+  # Load and dump the other dumpfile (using svnadmin)
+  other_sbox = sbox.clone_dependent()
+  other_sbox.build(create_wc=False, empty=True)
+  svntest.actions.run_and_verify_load(other_sbox.repo_dir, other_dumpfile,
+                                      bypass_prop_validation)
+  other_dumpfile = svntest.actions.run_and_verify_dump(other_sbox.repo_dir)
 
+  ### This call kind-of assumes EXPECTED is first and ACTUAL is second.
   svntest.verify.compare_dump_files(
-    "Dump files", "DUMP", svnadmin_contents, svnrdump_contents)
+    "Dump files", "DUMP", other_dumpfile, sbox_dumpfile)
 
 def run_dump_test(sbox, dumpfile_name, expected_dumpfile_name = None,
                   subdir = None, bypass_prop_validation = False,
@@ -103,7 +93,7 @@ def run_dump_test(sbox, dumpfile_name, e
   array of optional additional options to pass to 'svnrdump dump'."""
 
   # Create an empty sandbox repository
-  build_repos(sbox)
+  sbox.build(create_wc=False, empty=True)
 
   # This directory contains all the dump files
   svnrdump_tests_dir = os.path.join(os.path.dirname(sys.argv[0]),
@@ -111,11 +101,10 @@ def run_dump_test(sbox, dumpfile_name, e
 
   # Load the specified dump file into the sbox repository using
   # svnadmin load
-  svnadmin_dumpfile = open(os.path.join(svnrdump_tests_dir,
+  original_dumpfile = open(os.path.join(svnrdump_tests_dir,
                                         dumpfile_name),
                            'rb').readlines()
-
-  svntest.actions.run_and_verify_load(sbox.repo_dir, svnadmin_dumpfile,
+  svntest.actions.run_and_verify_load(sbox.repo_dir, original_dumpfile,
                                       bypass_prop_validation)
 
   repo_url = sbox.repo_url
@@ -129,28 +118,29 @@ def run_dump_test(sbox, dumpfile_name, e
                                               [], 0, *opts)
 
   if expected_dumpfile_name:
-    svnadmin_dumpfile = open(os.path.join(svnrdump_tests_dir,
+    expected_dumpfile = open(os.path.join(svnrdump_tests_dir,
                                           expected_dumpfile_name),
                              'rb').readlines()
     # Compare the output from stdout
     if ignore_base_checksums:
-      svnadmin_dumpfile = [l for l in svnadmin_dumpfile
+      expected_dumpfile = [l for l in expected_dumpfile
                                     if not l.startswith('Text-delta-base-md5')]
       svnrdump_dumpfile = [l for l in svnrdump_dumpfile
                                     if not l.startswith('Text-delta-base-md5')]
-    svnadmin_dumpfile = [l for l in svnadmin_dumpfile
+    expected_dumpfile = [l for l in expected_dumpfile
                                   if not mismatched_headers_re.match(l)]
     svnrdump_dumpfile = [l for l in svnrdump_dumpfile
                                   if not mismatched_headers_re.match(l)]
 
-    svnadmin_dumpfile = svntest.verify.UnorderedOutput(svnadmin_dumpfile)
+    expected_dumpfile = svntest.verify.UnorderedOutput(expected_dumpfile)
 
     svntest.verify.compare_and_display_lines(
-      "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile,
+      "Dump files", "DUMP", expected_dumpfile, svnrdump_dumpfile,
       None)
 
   else:
-    compare_repos_dumps(sbox, svnadmin_dumpfile)
+    # The expected dumpfile is the result of dumping SBOX.
+    compare_repos_dumps(sbox, svnrdump_dumpfile, bypass_prop_validation)
 
 def run_load_test(sbox, dumpfile_name, expected_dumpfile_name = None,
                   expect_deltas = True):
@@ -158,7 +148,7 @@ def run_load_test(sbox, dumpfile_name, e
   dump' and check that the same dumpfile is produced"""
 
   # Create an empty sandbox repository
-  build_repos(sbox)
+  sbox.build(create_wc=False, empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -169,36 +159,37 @@ def run_load_test(sbox, dumpfile_name, e
 
   # Load the specified dump file into the sbox repository using
   # svnrdump load
-  svnrdump_dumpfile = open(os.path.join(svnrdump_tests_dir,
+  original_dumpfile = open(os.path.join(svnrdump_tests_dir,
                                         dumpfile_name),
                            'rb').readlines()
 
   # Set the UUID of the sbox repository to the UUID specified in the
   # dumpfile ### RA layer doesn't have a set_uuid functionality
-  uuid = svnrdump_dumpfile[2].split(' ')[1][:-1]
+  uuid = original_dumpfile[2].split(' ')[1][:-1]
   svntest.actions.run_and_verify_svnadmin2("Setting UUID", None, None, 0,
                                            'setuuid', sbox.repo_dir,
                                            uuid)
 
-  svntest.actions.run_and_verify_svnrdump(svnrdump_dumpfile,
+  svntest.actions.run_and_verify_svnrdump(original_dumpfile,
                                           svntest.verify.AnyOutput,
                                           [], 0, 'load', sbox.repo_url)
 
-  # Create a dump file using svnadmin dump
-  svnadmin_dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir,
+  # Re-dump the rdump-loaded repo using svnadmin dump
+  resulted_dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir,
                                                           expect_deltas)
 
   if expected_dumpfile_name:
-    svnrdump_dumpfile = open(os.path.join(svnrdump_tests_dir,
+    expected_dumpfile = open(os.path.join(svnrdump_tests_dir,
                                           expected_dumpfile_name),
                              'rb').readlines()
 
     # Compare the output from stdout
     svntest.verify.compare_and_display_lines(
-      "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+      "Dump files", "DUMP", expected_dumpfile, resulted_dumpfile)
 
   else:
-    compare_repos_dumps(sbox, svnrdump_dumpfile)
+    expected_dumpfile = original_dumpfile
+    compare_repos_dumps(sbox, expected_dumpfile)
 
 ######################################################################
 # Tests
@@ -410,7 +401,7 @@ def reflect_dropped_renumbered_revs(sbox
   "svnrdump renumbers dropped revs in mergeinfo"
 
   # Create an empty sandbox repository
-  build_repos(sbox)
+  sbox.build(create_wc=False, empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -474,7 +465,7 @@ def dont_drop_valid_mergeinfo_during_inc
   "don't drop mergeinfo revs in incremental svnrdump"
 
   # Create an empty repos.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -580,7 +571,7 @@ def dont_drop_valid_mergeinfo_during_inc
   dump_fp.close()
 
   # Blow away the current repos and create an empty one in its place.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -615,7 +606,7 @@ def dont_drop_valid_mergeinfo_during_inc
   # PART 3: Load a full dump to an non-empty repository.
   #
   # Reset our sandbox.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -676,7 +667,7 @@ def dont_drop_valid_mergeinfo_during_inc
   # PART 4: Load a a series of incremental dumps to an non-empty repository.
   #
   # Reset our sandbox.
-  test_create(sbox)
+  sbox.build(empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -721,7 +712,7 @@ def svnrdump_load_partial_incremental_du
   "svnrdump load partial incremental dump"
 
   # Create an empty sandbox repository
-  build_repos(sbox)
+  sbox.build(create_wc=False, empty=True)
 
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
@@ -793,12 +784,200 @@ def load_prop_change_in_non_deltas_dump(
   dump = svntest.actions.run_and_verify_dump(sbox.repo_dir, deltas=False)
 
   # Try to load that dump.
-  build_repos(sbox)
+  sbox.build(create_wc=False, empty=True)
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
   svntest.actions.run_and_verify_svnrdump(dump,
                                           [], [], 0,
                                           '-q', 'load', sbox.repo_url)
 
+#----------------------------------------------------------------------
+
+@Issue(4476)
+def dump_mergeinfo_contains_r0(sbox):
+  "dump: mergeinfo that contains r0"
+  ### We pass the original dump file name as 'expected_dumpfile_name' because
+  ### run_dump_test is currently broken when we don't.
+  run_dump_test(sbox, "mergeinfo-contains-r0.dump",
+                bypass_prop_validation=True)
+
+#----------------------------------------------------------------------
+
+@XFail()
+@Issue(4476)
+def load_mergeinfo_contains_r0(sbox):
+  "load: mergeinfo that contains r0"
+  run_load_test(sbox, "mergeinfo-contains-r0.dump",
+                expected_dumpfile_name="mergeinfo-contains-r0.expected.dump")
+
+#----------------------------------------------------------------------
+
+# Regression test for issue 4551 "svnrdump load commits wrong properties,
+# or fails, on a non-deltas dumpfile". In this test, the copy source does
+# not exist and the failure mode is to error out.
+@Issue(4551)
+def load_non_deltas_copy_with_props(sbox):
+  "load non-deltas copy with props"
+  sbox.build()
+
+  # Case (1): Copies that do not replace anything: the copy target path
+  # at (new rev - 1) does not exist
+
+  # Set properties on each node to be copied
+  sbox.simple_propset('p', 'v', 'A/mu', 'A/B', 'A/B/E')
+  sbox.simple_propset('q', 'v', 'A/mu', 'A/B', 'A/B/E')
+  sbox.simple_commit()
+  sbox.simple_update()  # avoid mixed-rev
+
+  # Do the copies
+  sbox.simple_copy('A/mu@2', 'A/mu_COPY')
+  sbox.simple_copy('A/B@2', 'A/B_COPY')
+  # Also add new nodes inside the copied dir, to test more code paths
+  sbox.simple_copy('A/B/E@2', 'A/B_COPY/copied')
+  sbox.simple_mkdir('A/B_COPY/added')
+  sbox.simple_copy('A/B/E@2', 'A/B_COPY/added/copied')
+  # On each copied node, delete a prop
+  sbox.simple_propdel('p', 'A/mu_COPY', 'A/B_COPY', 'A/B_COPY/E',
+                           'A/B_COPY/copied', 'A/B_COPY/added/copied')
+
+  sbox.simple_commit()
+
+  # Dump with 'svnadmin' (non-deltas mode)
+  dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir, deltas=False)
+
+  # Load with 'svnrdump'. This used to throw an error:
+  # svnrdump: E160013: File not found: revision 2, path '/A/B_COPY'
+  new_repo_dir, new_repo_url = sbox.add_repo_path('new_repo')
+  svntest.main.create_repos(new_repo_dir)
+  svntest.actions.enable_revprop_changes(new_repo_dir)
+  svntest.actions.run_and_verify_svnrdump(dumpfile,
+                                          svntest.verify.AnyOutput,
+                                          [], 0, 'load', new_repo_url)
+
+  # Check that property 'p' really was deleted on each copied node
+  for tgt_path in ['A/mu_COPY', 'A/B_COPY', 'A/B_COPY/E',
+                   'A/B_COPY/copied', 'A/B_COPY/added/copied']:
+    tgt_url = new_repo_url + '/' + tgt_path
+    _, out, _ = svntest.main.run_svn(None, 'proplist', tgt_url)
+    expected = ["Properties on '%s':" % (tgt_url,),
+                'q']
+    actual = map(str.strip, out)
+    svntest.verify.compare_and_display_lines(None, 'PROPS', expected, actual)
+
+# Regression test for issue 4551 "svnrdump load commits wrong properties,
+# or fails, on a non-deltas dumpfile". In this test, the copy source does
+# exist and the failure mode is to fail to delete a property.
+@Issue(4551)
+def load_non_deltas_replace_copy_with_props(sbox):
+  "load non-deltas replace&copy with props"
+  sbox.build()
+
+  # Case (2): Copies that replace something: the copy target path
+  # at (new rev - 1) exists and has no property named 'p'
+
+  # Set props on the copy source nodes (a file, a dir, a child of the dir)
+  sbox.simple_propset('p', 'v', 'A/mu', 'A/B', 'A/B/E')
+  sbox.simple_propset('q', 'v', 'A/mu', 'A/B', 'A/B/E')
+  sbox.simple_commit()
+  sbox.simple_update()  # avoid mixed-rev
+
+  # Do the copies, replacing something
+  sbox.simple_rm('A/D/gamma', 'A/C')
+  sbox.simple_copy('A/mu@2', 'A/D/gamma')
+  sbox.simple_copy('A/B@2', 'A/C')
+  # On the copy, delete a prop that wasn't present on the node that it replaced
+  sbox.simple_propdel('p', 'A/D/gamma', 'A/C', 'A/C/E')
+
+  sbox.simple_commit()
+
+  # Dump with 'svnadmin' (non-deltas mode)
+  dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir, deltas=False)
+
+  # Load with 'svnrdump'
+  new_repo_dir, new_repo_url = sbox.add_repo_path('new_repo')
+  svntest.main.create_repos(new_repo_dir)
+  svntest.actions.enable_revprop_changes(new_repo_dir)
+  svntest.actions.run_and_verify_svnrdump(dumpfile,
+                                          svntest.verify.AnyOutput,
+                                          [], 0, 'load', new_repo_url)
+
+  # Check that property 'p' really was deleted on each copied node
+  # This used to fail, finding that property 'p' was still present
+  for tgt_path in ['A/D/gamma', 'A/C', 'A/C/E']:
+    tgt_url = new_repo_url + '/' + tgt_path
+    _, out, _ = svntest.main.run_svn(None, 'proplist', tgt_url)
+    expected = ["Properties on '%s':" % (tgt_url,),
+                'q']
+    actual = map(str.strip, out)
+    svntest.verify.compare_and_display_lines(None, 'PROPS', expected, actual)
+
+# Regression test for issue #4552 "svnrdump writes duplicate headers for a
+# replace-with-copy". 'svnrdump dump' wrote the Node-path and Node-kind
+# headers twice for the 'delete' record of a replace-with-copy.
+@Issue(4552)
+def dump_replace_with_copy(sbox):
+  "dump replace with copy"
+  sbox.build()
+
+  # Copy file/dir, replacing something
+  sbox.simple_rm('A/D/gamma', 'A/C')
+  sbox.simple_copy('A/mu@1', 'A/D/gamma')
+  sbox.simple_copy('A/B@1', 'A/C')
+  sbox.simple_commit()
+
+  # Dump with 'svnrdump'
+  dumpfile = svntest.actions.run_and_verify_svnrdump(
+                               None, svntest.verify.AnyOutput, [], 0,
+                               'dump', '--quiet', '--incremental', '-r2',
+                               sbox.repo_url)
+
+  # Check the 'delete' record headers: expect this parse to fail if headers
+  # are duplicated
+  svntest.verify.DumpParser(dumpfile).parse()
+
+# Regression test for issue 4551 "svnrdump load commits wrong properties,
+# or fails, on a non-deltas dumpfile". In this test, a node's props are
+# modified, and the failure mode is that RA-serf would end up deleting
+# properties that should remain on the node.
+@Issue(4551)
+def load_non_deltas_with_props(sbox):
+  "load non-deltas with props"
+  sbox.build()
+
+  # Case (3): A node's props are modified, and at least one of its previous
+  # props remains after the modification. svnrdump made two prop mod method
+  # calls for the same property (delete, then set). RA-serf's commit editor
+  # didn't expect this and performed the deletes after the non-deletes, and
+  # so ended up deleting a property that should not be deleted.
+
+  # Set properties on each node to be modified
+  sbox.simple_propset('p', 'v', 'A/mu')
+  sbox.simple_propset('q', 'v', 'A/mu', 'A/B')
+  sbox.simple_commit()
+
+  # Do the modifications: a different kind of mod on each node
+  sbox.simple_propdel('p', 'A/mu')
+  sbox.simple_propset('q', 'v2', 'A/B')
+  sbox.simple_commit()
+
+  # Dump with 'svnadmin' (non-deltas mode)
+  dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir, deltas=False)
+
+  # Load with 'svnrdump'
+  new_repo_dir, new_repo_url = sbox.add_repo_path('new_repo')
+  svntest.main.create_repos(new_repo_dir)
+  svntest.actions.enable_revprop_changes(new_repo_dir)
+  svntest.actions.run_and_verify_svnrdump(dumpfile,
+                                          svntest.verify.AnyOutput,
+                                          [], 0, 'load', new_repo_url)
+
+  # Check that property 'q' remains on each modified node
+  for tgt_path in ['A/mu', 'A/B']:
+    tgt_url = new_repo_url + '/' + tgt_path
+    _, out, _ = svntest.main.run_svn(None, 'proplist', tgt_url)
+    expected = ["Properties on '%s':" % (tgt_url,),
+                'q']
+    actual = map(str.strip, out)
+    svntest.verify.compare_and_display_lines(None, 'PROPS', expected, actual)
 
 ########################################################################
 # Run the tests
@@ -855,6 +1034,12 @@ test_list = [ None,
               only_trunk_range_dump,
               only_trunk_A_range_dump,
               load_prop_change_in_non_deltas_dump,
+              dump_mergeinfo_contains_r0,
+              load_mergeinfo_contains_r0,
+              load_non_deltas_copy_with_props,
+              load_non_deltas_replace_copy_with_props,
+              dump_replace_with_copy,
+              load_non_deltas_with_props,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnsync_authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnsync_authz_tests.py?rev=1658362&r1=1658361&r2=1658362&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnsync_authz_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/svnsync_authz_tests.py Mon Feb  9 11:23:39 2015
@@ -37,10 +37,11 @@ import svntest
 from svntest.verify import SVNUnexpectedStdout, SVNUnexpectedStderr
 from svntest.verify import SVNExpectedStderr
 from svntest.main import write_restrictive_svnserve_conf
+from svntest.main import write_authz_file
 from svntest.main import server_has_partial_replay
 
 # Shared helpers
-from svnsync_tests import build_repos, run_init, run_sync, run_test
+from svnsync_tests import run_init, run_sync, run_test
 
 # (abbreviation)
 Skip = svntest.testcase.Skip_deco
@@ -61,22 +62,20 @@ def basic_authz(sbox):
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
-  args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
-  svntest.main.file_write(sbox.authz_file,
-                          "[%s:/]\n"
-                          "* = r\n"
-                          "\n"
-                          "[%s:/A/B]\n"
-                          "* = \n"
-                          "\n"
-                          "[%s:/]\n"
-                          "* = rw\n" % args)
+  src_authz = sbox.authz_name()
+  dst_authz = dest_sbox.authz_name()
+  write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':    '* = r',
+                       src_authz + ':/A/B': '* =',
+                       dst_authz + ':/':    '* = rw',
+                       })
 
   run_sync(dest_sbox.repo_url)
 
@@ -141,21 +140,18 @@ def copy_from_unreadable_dir(sbox):
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
-  open(sbox.authz_file, 'w').write(
-             "[%s:/]\n"
-             "* = r\n"
-             "\n"
-             "[%s:/A/B]\n"
-             "* = \n"
-             "\n"
-             "[%s:/]\n"
-             "* = rw"
-             % args)
+  src_authz = sbox.authz_name()
+  dst_authz = dest_sbox.authz_name()
+  write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':    '* = r',
+                       src_authz + ':/A/B': '* =',
+                       dst_authz + ':/':    '* = rw',
+                       })
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -255,21 +251,18 @@ def copy_with_mod_from_unreadable_dir(sb
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
-  open(sbox.authz_file, 'w').write(
-             "[%s:/]\n"
-             "* = r\n"
-             "\n"
-             "[%s:/A/B]\n"
-             "* = \n"
-             "\n"
-             "[%s:/]\n"
-             "* = rw"
-             % args)
+  src_authz = sbox.authz_name()
+  dst_authz = dest_sbox.authz_name()
+  write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':    '* = r',
+                       src_authz + ':/A/B': '* =',
+                       dst_authz + ':/':    '* = rw',
+                       })
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -347,21 +340,18 @@ def copy_with_mod_from_unreadable_dir_an
   write_restrictive_svnserve_conf(sbox.repo_dir)
 
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
-  args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
-  open(sbox.authz_file, 'w').write(
-             "[%s:/]\n"
-             "* = r\n"
-             "\n"
-             "[%s:/A/B]\n"
-             "* = \n"
-             "\n"
-             "[%s:/]\n"
-             "* = rw"
-             % args)
+  src_authz = sbox.authz_name()
+  dst_authz = dest_sbox.authz_name()
+  write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':    '* = r',
+                       src_authz + ':/A/B': '* =',
+                       dst_authz + ':/':    '* = rw',
+                       })
 
   run_init(dest_sbox.repo_url, sbox.repo_url)
 
@@ -426,7 +416,7 @@ def specific_deny_authz(sbox):
   sbox.build()
 
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
 
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
@@ -443,31 +433,24 @@ def specific_deny_authz(sbox):
   # For mod_dav_svn's parent path setup we need per-repos permissions in
   # the authz file...
   if sbox.repo_url.startswith('http'):
-    args = tuple(s.authz_name() for s in [sbox, sbox, sbox, dest_sbox])
-    svntest.main.file_write(sbox.authz_file,
-                            "[%s:/]\n"
-                            "* = r\n"
-                            "\n"
-                            "[%s:/A]\n"
-                            "* = \n"
-                            "\n"
-                            "[%s:/A_COPY/B/lambda]\n"
-                            "* = \n"
-                            "\n"
-                            "[%s:/]\n"
-                            "* = rw\n" % args)
+    src_authz = sbox.authz_name()
+    dst_authz = dest_sbox.authz_name()
+    write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':                '* = r',
+                       src_authz + ':/A':               '* =',
+                       src_authz + ':/A_COPY/B/lambda': '* =',
+                       dst_authz + ':/':                '* = rw',
+                       })
   # Otherwise we can just go with the permissions needed for the source
   # repository.
   else:
-    svntest.main.file_write(sbox.authz_file,
-                            "[/]\n"
-                            "* = r\n"
-                            "\n"
-                            "[/A]\n"
-                            "* = \n"
-                            "\n"
-                            "[/A_COPY/B/lambda]\n"
-                            "* = \n")
+    write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       '/':                '* = r',
+                       '/A':               '* =',
+                       '/A_COPY/B/lambda': '* =',
+                       })
 
   run_sync(dest_sbox.repo_url)
 
@@ -494,18 +477,17 @@ def copy_delete_unreadable_child(sbox):
 
   # Create the destination.
   dest_sbox = sbox.clone_dependent()
-  build_repos(dest_sbox)
+  dest_sbox.build(create_wc=False, empty=True)
   svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
 
   # Lock down the source.
-  authz = sbox.authz_name()
   write_restrictive_svnserve_conf(sbox.repo_dir, anon_access='read')
-  svntest.main.file_write(sbox.authz_file,
-      "[%s:/]\n"
-      "* = r\n"
-      "[%s:/A]\n"
-      "* =  \n"
-      % (authz, authz))
+  src_authz = sbox.authz_name()
+  write_authz_file(sbox, None,
+                   prefixed_rules = {
+                       src_authz + ':/':  '* = r',
+                       src_authz + ':/A': '* =',
+                       })
 
   dest_url = svntest.main.file_scheme_prefix \
                     + urllib.pathname2url(os.path.abspath(dest_sbox.repo_dir))



Mime
View raw message