~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/patch_tests.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
103
103
  expected_status.tweak('A/mu', wc_rev=2)
104
104
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
105
 
                                        expected_status, None, wc_dir)
 
105
                                        expected_status)
106
106
 
107
107
  # Apply patch
108
108
 
377
377
  expected_status.tweak('A/mu', wc_rev=2)
378
378
  expected_status.tweak('iota', wc_rev=2)
379
379
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
380
 
                                        expected_status, None, wc_dir)
 
380
                                        expected_status)
381
381
 
382
382
  # Apply patch
383
383
 
546
546
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
547
547
  expected_status.tweak('A/mu', wc_rev=2)
548
548
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
549
 
                                        expected_status, None, wc_dir)
 
549
                                        expected_status)
550
550
 
551
551
  # Apply patch
552
552
 
716
716
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
717
717
  expected_status.tweak('A/mu', wc_rev=2)
718
718
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
719
 
                                        expected_status, None, wc_dir)
 
719
                                        expected_status)
720
720
 
721
721
  # Apply patch
722
722
 
869
869
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
870
870
  expected_status.tweak('A/D/gamma', wc_rev=2)
871
871
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
872
 
                                        expected_status, None, wc_dir)
 
872
                                        expected_status)
873
873
  unidiff_patch = [
874
874
    "--- A/D/gamma\t(revision 1)\n",
875
875
    "+++ A/D/gamma\t(working copy)\n",
1079
1079
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
1080
1080
 
1081
1081
  F_path = sbox.ospath('A/B/F')
1082
 
  svntest.actions.run_and_verify_svn("Deleting F failed", None, [],
 
1082
  svntest.actions.run_and_verify_svn(None, [],
1083
1083
                                     'rm', F_path)
1084
 
  svntest.actions.run_and_verify_svn("Update failed", None, [],
 
1084
  svntest.actions.run_and_verify_svn(None, [],
1085
1085
                                     'up', wc_dir)
1086
1086
 
1087
1087
  # We should be able to handle one path beeing missing.
1148
1148
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
1149
1149
  expected_status.tweak('A/D/gamma', wc_rev=2)
1150
1150
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
1151
 
                                        expected_status, None, wc_dir)
 
1151
                                        expected_status)
1152
1152
 
1153
1153
  patch_file_path = make_patch_path(sbox)
1154
1154
 
1219
1219
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
1220
1220
  expected_status.tweak('A/D/gamma', wc_rev=2)
1221
1221
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
1222
 
                                        expected_status, None, wc_dir)
 
1222
                                        expected_status)
1223
1223
 
1224
1224
  patch_file_path = make_patch_path(sbox)
1225
1225
 
1308
1308
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
1309
1309
  expected_status.tweak('A/mu', wc_rev=2)
1310
1310
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
1311
 
                                      expected_status, None, wc_dir)
 
1311
                                      expected_status)
1312
1312
 
1313
1313
  unidiff_patch = [
1314
1314
    "Index: mu\n",
1444
1444
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
1445
1445
  expected_status.tweak('A/mu', wc_rev=2)
1446
1446
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
1447
 
                                        expected_status, None, wc_dir)
 
1447
                                        expected_status)
1448
1448
 
1449
1449
  # Apply patch
1450
1450
 
1673
1673
                                           1) # dry-run
1674
1674
 
1675
1675
      expected_output = ["Reverted '" + mu_path + "'\n"]
1676
 
      svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert', '-R', wc_dir)
 
1676
      svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R', wc_dir)
1677
1677
 
1678
1678
def patch_with_svn_eol_style(sbox):
1679
1679
  "patch target with svn:eol-style"
1788
1788
                                           1) # dry-run
1789
1789
 
1790
1790
      expected_output = ["Reverted '" + mu_path + "'\n"]
1791
 
      svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert', '-R', wc_dir)
 
1791
      svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R', wc_dir)
1792
1792
 
1793
1793
def patch_with_svn_eol_style_uncommitted(sbox):
1794
1794
  "patch target with uncommitted svn:eol-style"
1897
1897
                                           1) # dry-run
1898
1898
 
1899
1899
      expected_output = ["Reverted '" + mu_path + "'\n"]
1900
 
      svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert', '-R', wc_dir)
 
1900
      svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R', wc_dir)
1901
1901
 
1902
1902
def patch_with_ignore_whitespace(sbox):
1903
1903
  "ignore whitespace when patching"
1943
1943
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
1944
1944
  expected_status.tweak('A/mu', wc_rev=2)
1945
1945
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
1946
 
                                        expected_status, None, wc_dir)
 
1946
                                        expected_status)
1947
1947
 
1948
1948
  # Apply patch with leading and trailing spaces removed and tabs transformed
1949
1949
  # to spaces. The patch should match and the hunks should be written to the
2077
2077
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2078
2078
  expected_status.tweak('A/mu', wc_rev=2)
2079
2079
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2080
 
                                        expected_status, None, wc_dir)
 
2080
                                        expected_status)
2081
2081
 
2082
2082
  # Locally delete mu
2083
2083
  svntest.main.run_svn(None, 'rm', mu_path)
2143
2143
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2144
2144
  expected_status.tweak('iota', wc_rev=2)
2145
2145
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2146
 
                                        expected_status, None, wc_dir)
 
2146
                                        expected_status)
2147
2147
  unidiff_patch = [
2148
2148
    "--- iota\t(revision 1)\n",
2149
2149
    "+++ iota\t(working copy)\n",
2213
2213
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2214
2214
  expected_status.tweak('iota', wc_rev=2)
2215
2215
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2216
 
                                        expected_status, None, wc_dir)
 
2216
                                        expected_status)
2217
2217
  # Apply patch
2218
2218
 
2219
2219
  unidiff_patch = [
2306
2306
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2307
2307
  expected_status.tweak('A/mu', wc_rev=2)
2308
2308
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2309
 
                                        expected_status, None, wc_dir)
 
2309
                                        expected_status)
2310
2310
 
2311
2311
  # Apply patch
2312
2312
 
2491
2491
  expected_status.tweak('', wc_rev=2)
2492
2492
  expected_status.tweak('A/B', wc_rev=2)
2493
2493
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2494
 
                                        expected_status, None, wc_dir)
 
2494
                                        expected_status)
2495
2495
  # Apply patch
2496
2496
 
2497
2497
  unidiff_patch = [
2713
2713
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2714
2714
  expected_status.tweak('iota', wc_rev=2)
2715
2715
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2716
 
                                        expected_status, None, wc_dir)
 
2716
                                        expected_status)
2717
2717
 
2718
2718
  # Apply patch
2719
2719
 
2888
2888
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
2889
2889
  expected_status.tweak('A/mu', wc_rev=2)
2890
2890
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
2891
 
                                      expected_status, None, wc_dir)
 
2891
                                      expected_status)
2892
2892
 
2893
2893
  unidiff_patch = [
2894
2894
    "Index: mu\n",
3072
3072
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
3073
3073
  expected_status.tweak('A/mu', wc_rev=2)
3074
3074
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
3075
 
                                        expected_status, None, wc_dir)
 
3075
                                        expected_status)
3076
3076
 
3077
3077
  # Apply patch
3078
3078
 
3198
3198
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
3199
3199
  expected_status.tweak('A/mu', wc_rev=2)
3200
3200
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
3201
 
                                        expected_status, None, wc_dir)
 
3201
                                        expected_status)
3202
3202
 
3203
3203
  # Apply patch
3204
3204
 
3520
3520
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
3521
3521
  expected_status.tweak('A/mu', wc_rev=2)
3522
3522
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
3523
 
                                        expected_status, None, wc_dir)
 
3523
                                        expected_status)
3524
3524
 
3525
3525
  # Move mu away
3526
3526
  sbox.simple_move("A/mu", "A/mu2")
3681
3681
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
3682
3682
  expected_status.tweak('iota', wc_rev=2)
3683
3683
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
3684
 
                                        expected_status, None, wc_dir)
 
3684
                                        expected_status)
3685
3685
 
3686
3686
  # Apply patch
3687
3687
  unidiff_patch = [
3828
3828
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
3829
3829
  expected_status.add({'newfile' : Item(wc_rev=2, status='  ')})
3830
3830
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
3831
 
                                        expected_status, None, wc_dir)
 
3831
                                        expected_status)
3832
3832
 
3833
3833
  # Now, we'll try to reverse-apply the very diff we just created.  We
3834
3834
  # expect the original state of the working copy in r1 plus 'newfile'
4019
4019
  expected_status.tweak('iota', wc_rev=2)
4020
4020
  expected_status.tweak('A/mu', wc_rev=2)
4021
4021
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
4022
 
                                        expected_status, None, wc_dir)
 
4022
                                        expected_status)
4023
4023
  unidiff_patch = [
4024
4024
    "Index: A/mu\n",
4025
4025
    "===================================================================\n",
4222
4222
  expected_output = svntest.wc.State(wc_dir, {
4223
4223
    'link'       : Item(verb='Adding'),
4224
4224
  })
4225
 
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
4226
 
                                        None, None, wc_dir)
 
4225
  svntest.actions.run_and_verify_commit(wc_dir, expected_output, None)
4227
4226
 
4228
4227
  patch_output = [
4229
4228
    'U         %s\n' % sbox.ospath('link'),
4230
4229
  ]
4231
4230
 
4232
 
  svntest.actions.run_and_verify_svn(None, patch_output, [],
 
4231
  svntest.actions.run_and_verify_svn(patch_output, [],
4233
4232
                                     'patch', patch_file_path, wc_dir)
4234
4233
 
4235
4234
  # r3 - Store result
4236
4235
  expected_output = svntest.wc.State(wc_dir, {
4237
4236
    'link'       : Item(verb='Sending'),
4238
4237
  })
4239
 
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
4240
 
                                        None, None, wc_dir)
 
4238
  svntest.actions.run_and_verify_commit(wc_dir, expected_output, None)
4241
4239
 
4242
4240
  # r4 - Now as symlink
4243
4241
  sbox.simple_rm('link')
4245
4243
  expected_output = svntest.wc.State(wc_dir, {
4246
4244
    'link'       : Item(verb='Replacing'),
4247
4245
  })
4248
 
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
4249
 
                                        None, None, wc_dir)
 
4246
  svntest.actions.run_and_verify_commit(wc_dir, expected_output, None)
4250
4247
 
4251
 
  svntest.actions.run_and_verify_svn(None, patch_output, [],
 
4248
  svntest.actions.run_and_verify_svn(patch_output, [],
4252
4249
                                     'patch', patch_file_path, wc_dir)
4253
4250
 
4254
4251
  # TODO: when it passes, verify that the on-disk 'link' is correct ---
4357
4354
    'A         %s\n' % sbox.ospath('iota'),
4358
4355
  ]
4359
4356
 
4360
 
  svntest.actions.run_and_verify_svn(None, expected_output, [],
 
4357
  svntest.actions.run_and_verify_svn(expected_output, [],
4361
4358
                                     'patch', patch_file_path, sbox.wc_dir)
4362
4359
 
4363
4360
@Issue(4297)
4391
4388
    '>         rejected hunk @@ -1,1 +1,1 @@\n',
4392
4389
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
4393
4390
 
4394
 
  svntest.actions.run_and_verify_svn(None, expected_output, [],
 
4391
  svntest.actions.run_and_verify_svn(expected_output, [],
4395
4392
                                     'patch', patch_file_path, wc_dir)
4396
4393
 
4397
4394
@Issue(3644)
4442
4439
  ]
4443
4440
 
4444
4441
  # Current result: lf.txt patched ok, new created, empty succeeds with offset.
4445
 
  svntest.actions.run_and_verify_svn(None, expected_output, [],
 
4442
  svntest.actions.run_and_verify_svn(expected_output, [],
4446
4443
                                     'patch', patch_file_path, wc_dir)
4447
4444
 
4448
4445
  expected_disk = svntest.main.greek_state.copy()
4556
4553
  ]
4557
4554
 
4558
4555
  # Current result: lf.txt patched ok, new created, empty succeeds with offset.
4559
 
  svntest.actions.run_and_verify_svn(None, expected_output, [],
 
4556
  svntest.actions.run_and_verify_svn(expected_output, [],
4560
4557
                                     'patch', patch_path, wc_dir)
4561
4558
 
4562
4559
  if not filecmp.cmp(sbox.ospath('test.txt'), sbox.ospath('test_v2.txt')):
4657
4654
                                       expected_output, expected_disk,
4658
4655
                                       expected_status, expected_skip)
4659
4656
 
4660
 
 
4661
 
@XFail()
 
4657
def patch_git_rename(sbox):
 
4658
  """--git patch with rename header"""
 
4659
 
 
4660
  sbox.build()
 
4661
  wc_dir = sbox.wc_dir
 
4662
 
 
4663
  # a simple --git rename patch
 
4664
  unidiff_patch = [
 
4665
    "diff --git a/iota b/iota2\n",
 
4666
    "similarity index 100%\n",
 
4667
    "rename from iota\n",
 
4668
    "rename to iota2\n",
 
4669
  ]
 
4670
 
 
4671
  patch_file_path = make_patch_path(sbox)
 
4672
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
4673
 
 
4674
  expected_output = [ 'A         %s\n' % sbox.ospath('iota2'),
 
4675
                      'D         %s\n' % sbox.ospath('iota')]
 
4676
  expected_disk = svntest.main.greek_state.copy()
 
4677
  expected_disk.remove('iota')
 
4678
  expected_disk.add({'iota2' : Item(contents="This is the file 'iota'.\n")})
 
4679
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
4680
  expected_status.add({
 
4681
    'iota2' : Item(status='A ', copied='+', wc_rev='-', moved_from='iota'),
 
4682
  })
 
4683
  expected_status.tweak('iota', status='D ', wc_rev=1, moved_to='iota2')
 
4684
  expected_skip = wc.State('', { })
 
4685
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
4686
                                       expected_output, expected_disk,
 
4687
                                       expected_status, expected_skip)
 
4688
 
4662
4689
@Issue(4533)
4663
4690
def patch_hunk_avoid_reorder(sbox):
4664
4691
  """avoid reordering hunks"""
4787
4814
 
4788
4815
  sbox.simple_revert('A/mu')
4789
4816
 
 
4817
@Issue(4533)
 
4818
def patch_hunk_avoid_reorder2(sbox):
 
4819
  """avoid reordering hunks 2"""
 
4820
 
 
4821
  sbox.build()
 
4822
  wc_dir = sbox.wc_dir
 
4823
 
 
4824
  sbox.simple_append('A/mu',
 
4825
                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
 
4826
                     'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n' 'YY\n'
 
4827
                     'GG\n' 'HH\n' 'II\n' 'JJ\n' 'KK\n' 'LL\n'
 
4828
                     '33333\n' '33333\n' '33333\n'
 
4829
                     '33333\n' '33333\n' '33333\n'
 
4830
                     '33333\n' '33333\n' '33333\n'
 
4831
                     '33333\n' '33333\n' '33333\n'
 
4832
                     'MM\n' 'NN\n' 'OO\n' 'PP\n' 'QQ\n' 'RR\n'
 
4833
                     'SS\n' 'TT\n' 'UU\n' 'VV\n' 'WW\n' 'XX\n'
 
4834
                     'YY\n' 'ZZ\n', truncate=True)
 
4835
  sbox.simple_commit()
 
4836
 
 
4837
  # two hunks, first matches at offset +18, second matches at both -13
4790
4838
  # change patch so second hunk matches at both -12 and +19, we still
4791
4839
  # want the second match
4792
4840
  unidiff_patch = [
4895
4943
                                       expected_output, expected_disk,
4896
4944
                                       expected_status, expected_skip)
4897
4945
 
 
4946
  # In the following case the reordered hunk2 is smaller offset
 
4947
  # magnitude than hunk2 at the end and the reorder is preferred.
 
4948
  sbox.simple_revert('A/mu')
 
4949
  sbox.simple_append('A/mu',
 
4950
                     'x\n' * 2  +
 
4951
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
4952
                     'x\n' * 2  +
 
4953
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
4954
                     'x\n' * 10  +
 
4955
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
4956
                     'x\n' * 100  +
 
4957
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n',
 
4958
                     truncate=True)
 
4959
  sbox.simple_commit()
 
4960
 
 
4961
  unidiff_patch = [
 
4962
    "Index: A/mu\n"
 
4963
    "===================================================================\n",
 
4964
    "--- A/mu\t(revision 2)\n",
 
4965
    "+++ A/mu\t(working copy)\n",
 
4966
    "@@ -28,7 +28,7 @@\n",
 
4967
    " 1\n",
 
4968
    " 2\n",
 
4969
    " 3\n",
 
4970
    "-hunk1\n",
 
4971
    "+hunk1-mod\n",
 
4972
    " 4\n",
 
4973
    " 5\n",
 
4974
    " 6\n",
 
4975
    "@@ -44,7 +44,7 @@\n",
 
4976
    " 1\n",
 
4977
    " 2\n",
 
4978
    " 3\n",
 
4979
    "-hunk2\n",
 
4980
    "+hunk2-mod\n",
 
4981
    " 4\n",
 
4982
    " 5\n",
 
4983
    " 6\n",
 
4984
    ]
 
4985
 
 
4986
  patch_file_path = make_patch_path(sbox)
 
4987
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
4988
 
 
4989
  expected_output = [
 
4990
    'U         %s\n' % sbox.ospath('A/mu'),
 
4991
    '>         applied hunk @@ -44,7 +44,7 @@ with offset -32\n',
 
4992
    '>         applied hunk @@ -28,7 +28,7 @@ with offset 1\n',
 
4993
    ]
 
4994
  expected_disk.tweak('A/mu', contents=
 
4995
                      'x\n' * 2  +
 
4996
                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
4997
                      'x\n' * 2  +
 
4998
                      '1\n' '2\n' '3\n' 'hunk2-mod\n' '4\n' '5\n' '6\n' +
 
4999
                      'x\n' * 10  +
 
5000
                      '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5001
                      'x\n' * 100  +
 
5002
                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n')
 
5003
 
 
5004
  expected_status.tweak('A/mu', status='M ', wc_rev=3)
 
5005
  expected_skip = wc.State('', { })
 
5006
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5007
                                       expected_output, expected_disk,
 
5008
                                       expected_status, expected_skip)
 
5009
  sbox.simple_revert('A/mu')
 
5010
 
 
5011
  # In this case the reordered hunk2 is further than hunk2 at the end
 
5012
  # and the reordered is not preferred.
 
5013
  unidiff_patch = [
 
5014
    "Index: A/mu\n"
 
5015
    "===================================================================\n",
 
5016
    "--- A/mu\t(revision 2)\n",
 
5017
    "+++ A/mu\t(working copy)\n",
 
5018
    "@@ -28,7 +28,7 @@\n",
 
5019
    " 1\n",
 
5020
    " 2\n",
 
5021
    " 3\n",
 
5022
    "-hunk1\n",
 
5023
    "+hunk1-mod\n",
 
5024
    " 4\n",
 
5025
    " 5\n",
 
5026
    " 6\n",
 
5027
    "@@ -110,7 +110,7 @@\n",
 
5028
    " 1\n",
 
5029
    " 2\n",
 
5030
    " 3\n",
 
5031
    "-hunk2\n",
 
5032
    "+hunk2-mod\n",
 
5033
    " 4\n",
 
5034
    " 5\n",
 
5035
    " 6\n",
 
5036
    ]
 
5037
 
 
5038
  patch_file_path = make_patch_path(sbox)
 
5039
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
5040
 
 
5041
  expected_output = [
 
5042
    'U         %s\n' % sbox.ospath('A/mu'),
 
5043
    '>         applied hunk @@ -28,7 +28,7 @@ with offset 1\n',
 
5044
    '>         applied hunk @@ -110,7 +110,7 @@ with offset 26\n',
 
5045
    ]
 
5046
  expected_disk.tweak('A/mu', contents=
 
5047
                      'x\n' * 2  +
 
5048
                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5049
                      'x\n' * 2  +
 
5050
                      '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5051
                      'x\n' * 10  +
 
5052
                      '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5053
                      'x\n' * 100  +
 
5054
                      '1\n' '2\n' '3\n' 'hunk2-mod\n' '4\n' '5\n' '6\n')
 
5055
 
 
5056
  expected_status.tweak('A/mu', status='M ', wc_rev=3)
 
5057
  expected_skip = wc.State('', { })
 
5058
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5059
                                       expected_output, expected_disk,
 
5060
                                       expected_status, expected_skip)
 
5061
 
 
5062
@XFail()
 
5063
def patch_hunk_overlap(sbox):
 
5064
  """hunks that overlap"""
 
5065
 
 
5066
  sbox.build()
 
5067
  wc_dir = sbox.wc_dir
 
5068
 
 
5069
  sbox.simple_append('A/mu',
 
5070
                     'AA\n' 'BB\n' 'CC\n' 'DD\n' 'EE\n' 'FF\n'
 
5071
                     'GG\n' 'HH\n' 'II\n', truncate=True)
 
5072
  sbox.simple_commit()
 
5073
 
 
5074
  # Two hunks that overlap when applied, GNU patch can apply both hunks.
 
5075
  unidiff_patch = [
 
5076
    "Index: A/mu\n"
 
5077
    "===================================================================\n",
 
5078
    "--- A/mu\t(revision 1)\n",
 
5079
    "+++ A/mu\t(working copy)\n",
 
5080
    "@@ -2,6 +2,7 @@\n",
 
5081
    " BB\n",
 
5082
    " CC\n",
 
5083
    " DD\n",
 
5084
    "+11111\n",
 
5085
    " EE\n",
 
5086
    " FF\n",
 
5087
    " GG\n",
 
5088
    "@@ -9,6 +10,7 @@\n",
 
5089
    " DD\n",
 
5090
    " EE\n",
 
5091
    " FF\n",
 
5092
    "+22222\n",
 
5093
    " GG\n",
 
5094
    " HH\n",
 
5095
    " II\n",
 
5096
    ]
 
5097
 
 
5098
  patch_file_path = make_patch_path(sbox)
 
5099
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
5100
 
 
5101
  expected_output = [
 
5102
    'U         %s\n' % sbox.ospath('A/mu'),
 
5103
    '>         applied hunk @@ -9,6 +10,7 @@ with offset -5\n',
 
5104
    ]
 
5105
  expected_disk = svntest.main.greek_state.copy()
 
5106
  expected_disk.tweak('A/mu', contents=
 
5107
                     'AA\n' 'BB\n' 'CC\n' 'DD\n' '11111\n' 'EE\n' 'FF\n'
 
5108
                     '22222\n' 'GG\n' 'HH\n' 'II\n')
 
5109
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5110
  expected_status.tweak('A/mu', status='M ', wc_rev=2)
 
5111
  expected_skip = wc.State('', { })
 
5112
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5113
                                       expected_output, expected_disk,
 
5114
                                       expected_status, expected_skip)
 
5115
 
 
5116
def patch_delete_modified(sbox):
 
5117
  """patch delete modified"""
 
5118
 
 
5119
  sbox.build()
 
5120
  wc_dir = sbox.wc_dir
 
5121
 
 
5122
  # A patch that deletes beta.
 
5123
  unidiff_patch = [
 
5124
    "Index: A/B/E/beta\n",
 
5125
    "===================================================================\n",
 
5126
    "--- A/B/E/beta     (revision 1)\n",
 
5127
    "+++ A/B/E/beta     (working copy)\n",
 
5128
    "@@ -1 +0,0 @@\n",
 
5129
    "-This is the file 'beta'.\n",
 
5130
    ]
 
5131
 
 
5132
  patch_file_path = make_patch_path(sbox)
 
5133
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
5134
 
 
5135
  # First application deletes beta
 
5136
  expected_output = [
 
5137
    'D         %s\n' % sbox.ospath('A/B/E/beta'),
 
5138
    ]
 
5139
  expected_disk = svntest.main.greek_state.copy()
 
5140
  expected_disk.remove('A/B/E/beta')
 
5141
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5142
  expected_status.tweak('A/B/E/beta', status='D ')
 
5143
  expected_skip = wc.State('', { })
 
5144
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5145
                                       expected_output, expected_disk,
 
5146
                                       expected_status, expected_skip)
 
5147
 
 
5148
  # Second application skips
 
5149
  expected_output = [
 
5150
    'Skipped \'%s\'\n' % sbox.ospath('A/B/E/beta'),
 
5151
  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
 
5152
  expected_skip = wc.State('', {
 
5153
    sbox.ospath('A/B/E/beta') :  Item(verb='Skipped'),
 
5154
  })
 
5155
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5156
                                       expected_output, expected_disk,
 
5157
                                       expected_status, expected_skip)
 
5158
 
 
5159
  # Third application, with file present even though state is 'D', also skips
 
5160
  sbox.simple_append('A/B/E/beta', 'Modified', truncate=True)
 
5161
  expected_disk.add({'A/B/E/beta' : Item(contents='Modified')})
 
5162
  expected_output = [
 
5163
    'Skipped \'%s\'\n' % sbox.ospath('A/B/E/beta'),
 
5164
  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
 
5165
  expected_skip = wc.State('', {
 
5166
    sbox.ospath('A/B/E/beta') :  Item(verb='Skipped'),
 
5167
  })
 
5168
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5169
                                       expected_output, expected_disk,
 
5170
                                       expected_status, expected_skip)
 
5171
 
 
5172
  # Revert and modify beta, fourth application gives a text conflict.
 
5173
  sbox.simple_revert('A/B/E/beta')
 
5174
  sbox.simple_append('A/B/E/beta', 'Modified', truncate=True)
 
5175
 
 
5176
  expected_output = [
 
5177
    'C         %s\n' % sbox.ospath('A/B/E/beta'),
 
5178
    '>         rejected hunk @@ -1,1 +0,0 @@\n',
 
5179
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5180
  expected_skip = wc.State('', { })
 
5181
  reject_file_contents = [
 
5182
    "--- A/B/E/beta\n",
 
5183
    "+++ A/B/E/beta\n",
 
5184
    "@@ -1,1 +0,0 @@\n",
 
5185
    "-This is the file 'beta'.\n",
 
5186
  ]
 
5187
  expected_disk.add({'A/B/E/beta.svnpatch.rej'
 
5188
                     : Item(contents=''.join(reject_file_contents))
 
5189
                     })
 
5190
  expected_status.tweak('A/B/E/beta', status='M ')
 
5191
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5192
                                       expected_output, expected_disk,
 
5193
                                       expected_status, expected_skip)
 
5194
 
 
5195
def patch_closest(sbox):
 
5196
  "find closest hunk"
 
5197
 
 
5198
  sbox.build()
 
5199
  wc_dir = sbox.wc_dir
 
5200
 
 
5201
  unidiff_patch = [
 
5202
    "Index: A/mu\n"
 
5203
    "===================================================================\n",
 
5204
    "--- A/mu\t(revision 2)\n",
 
5205
    "+++ A/mu\t(working copy)\n",
 
5206
    "@@ -47,7 +47,7 @@\n",
 
5207
    " 1\n",
 
5208
    " 2\n",
 
5209
    " 3\n",
 
5210
    "-hunk1\n",
 
5211
    "+hunk1-mod\n",
 
5212
    " 4\n",
 
5213
    " 5\n",
 
5214
    " 6\n",
 
5215
    "@@ -66,7 +66,7 @@\n",
 
5216
    " 1\n",
 
5217
    " 2\n",
 
5218
    " 3\n",
 
5219
    "-rejected-hunk2-\n",
 
5220
    "+rejected-hunk2-mod\n",
 
5221
    " 4\n",
 
5222
    " 5\n",
 
5223
    " 6\n",
 
5224
    "@@ -180,7 +180,7 @@\n",
 
5225
    " 1\n",
 
5226
    " 2\n",
 
5227
    " 3\n",
 
5228
    "-hunk3\n",
 
5229
    "+hunk3-mod\n",
 
5230
    " 4\n",
 
5231
    " 5\n",
 
5232
    " 6\n",
 
5233
    ]
 
5234
  patch_file_path = make_patch_path(sbox)
 
5235
  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
5236
 
 
5237
  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
 
5238
  # of -19 and +18, prefer +18 gives final offset +22
 
5239
  sbox.simple_append('A/mu',
 
5240
                     'x\n' * 50  +
 
5241
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
5242
                     'x\n' * 50  +
 
5243
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5244
                     'x\n' * 50  +
 
5245
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5246
                     'x\n' * 30  +
 
5247
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5248
                     'x\n' * 10,
 
5249
                     truncate=True)
 
5250
  sbox.simple_commit()
 
5251
 
 
5252
  expected_output = [
 
5253
    'C         %s\n' % sbox.ospath('A/mu'),
 
5254
    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
 
5255
    '>         applied hunk @@ -180,7 +180,7 @@ with offset 22\n',
 
5256
    '>         rejected hunk @@ -66,7 +66,7 @@\n',
 
5257
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5258
  expected_disk = svntest.main.greek_state.copy()
 
5259
  expected_disk.add({'A/mu.svnpatch.rej' : Item(contents=
 
5260
    "--- A/mu\n" +
 
5261
    "+++ A/mu\n" +
 
5262
    "@@ -66,7 +66,7 @@\n" +
 
5263
    " 1\n" +
 
5264
    " 2\n" +
 
5265
    " 3\n" +
 
5266
    "-rejected-hunk2-\n" +
 
5267
    "+rejected-hunk2-mod\n" +
 
5268
    " 4\n" +
 
5269
    " 5\n" +
 
5270
    " 6\n")})
 
5271
  expected_disk.tweak('A/mu', contents=
 
5272
                     'x\n' * 50  +
 
5273
                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5274
                     'x\n' * 50  +
 
5275
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5276
                     'x\n' * 50  +
 
5277
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5278
                     'x\n' * 30  +
 
5279
                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
 
5280
                     'x\n' * 10)
 
5281
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5282
  expected_status.tweak('A/mu', status='M ', wc_rev=2)
 
5283
  expected_skip = wc.State('', { })
 
5284
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5285
                                       expected_output, expected_disk,
 
5286
                                       expected_status, expected_skip)
 
5287
 
 
5288
  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
 
5289
  # of -19 and +20, prefer -19 gives final offset -15
 
5290
  sbox.simple_append('A/mu',
 
5291
                     'x\n' * 50  +
 
5292
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
5293
                     'x\n' * 50  +
 
5294
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5295
                     'x\n' * 50  +
 
5296
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5297
                     'x\n' * 32  +
 
5298
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5299
                     'x\n' * 10,
 
5300
                     truncate=True)
 
5301
  sbox.simple_commit()
 
5302
 
 
5303
  expected_output = [
 
5304
    'C         %s\n' % sbox.ospath('A/mu'),
 
5305
    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
 
5306
    '>         applied hunk @@ -180,7 +180,7 @@ with offset -15\n',
 
5307
    '>         rejected hunk @@ -66,7 +66,7 @@\n',
 
5308
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5309
  expected_disk.tweak('A/mu', contents=
 
5310
                     'x\n' * 50  +
 
5311
                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5312
                     'x\n' * 50  +
 
5313
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5314
                     'x\n' * 50  +
 
5315
                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
 
5316
                     'x\n' * 32  +
 
5317
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5318
                     'x\n' * 10)
 
5319
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5320
  expected_status.tweak('A/mu', status='M ', wc_rev=3)
 
5321
  expected_skip = wc.State('', { })
 
5322
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5323
                                       expected_output, expected_disk,
 
5324
                                       expected_status, expected_skip)
 
5325
 
 
5326
  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
 
5327
  # of -19 and +19, prefer -19 gives final offset -15
 
5328
  sbox.simple_append('A/mu',
 
5329
                     'x\n' * 50  +
 
5330
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
5331
                     'x\n' * 50  +
 
5332
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5333
                     'x\n' * 50  +
 
5334
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5335
                     'x\n' * 31  +
 
5336
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5337
                     'x\n' * 10,
 
5338
                     truncate=True)
 
5339
  sbox.simple_commit()
 
5340
 
 
5341
  expected_output = [
 
5342
    'C         %s\n' % sbox.ospath('A/mu'),
 
5343
    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
 
5344
    '>         applied hunk @@ -180,7 +180,7 @@ with offset -15\n',
 
5345
    '>         rejected hunk @@ -66,7 +66,7 @@\n',
 
5346
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5347
  expected_disk.tweak('A/mu', contents=
 
5348
                     'x\n' * 50  +
 
5349
                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5350
                     'x\n' * 50  +
 
5351
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5352
                     'x\n' * 50  +
 
5353
                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
 
5354
                     'x\n' * 31  +
 
5355
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5356
                     'x\n' * 10)
 
5357
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5358
  expected_status.tweak('A/mu', status='M ', wc_rev=4)
 
5359
  expected_skip = wc.State('', { })
 
5360
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5361
                                       expected_output, expected_disk,
 
5362
                                       expected_status, expected_skip)
 
5363
 
 
5364
  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
 
5365
  # of +173 and -173, prefer +173 gives final offset +177
 
5366
  sbox.simple_append('A/mu',
 
5367
                     'x\n' * 10  +
 
5368
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5369
                     'x\n' * 33 +
 
5370
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
5371
                     'x\n' * 50  +
 
5372
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5373
                     'x\n' * 242  +
 
5374
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5375
                     'x\n' * 10,
 
5376
                     truncate=True)
 
5377
  sbox.simple_commit()
 
5378
 
 
5379
  expected_output = [
 
5380
    'C         %s\n' % sbox.ospath('A/mu'),
 
5381
    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
 
5382
    '>         applied hunk @@ -180,7 +180,7 @@ with offset 177\n',
 
5383
    '>         rejected hunk @@ -66,7 +66,7 @@\n',
 
5384
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5385
  expected_disk.tweak('A/mu', contents=
 
5386
                     'x\n' * 10  +
 
5387
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5388
                     'x\n' * 33  +
 
5389
                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5390
                     'x\n' * 50  +
 
5391
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5392
                     'x\n' * 242  +
 
5393
                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
 
5394
                     'x\n' * 10)
 
5395
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5396
  expected_status.tweak('A/mu', status='M ', wc_rev=5)
 
5397
  expected_skip = wc.State('', { })
 
5398
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5399
                                       expected_output, expected_disk,
 
5400
                                       expected_status, expected_skip)
 
5401
 
 
5402
  # Previous offset for hunk3 is +4, hunk3 matches at relative offsets
 
5403
  # of +174 and -173, prefer -173 gives final offset -169
 
5404
  sbox.simple_append('A/mu',
 
5405
                     'x\n' * 10  +
 
5406
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5407
                     'x\n' * 33 +
 
5408
                     '1\n' '2\n' '3\n' 'hunk1\n' '4\n' '5\n' '6\n' +
 
5409
                     'x\n' * 50  +
 
5410
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5411
                     'x\n' * 243  +
 
5412
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5413
                     'x\n' * 10,
 
5414
                     truncate=True)
 
5415
  sbox.simple_commit()
 
5416
 
 
5417
  expected_output = [
 
5418
    'C         %s\n' % sbox.ospath('A/mu'),
 
5419
    '>         applied hunk @@ -180,7 +180,7 @@ with offset -169\n',
 
5420
    '>         applied hunk @@ -47,7 +47,7 @@ with offset 4\n',
 
5421
    '>         rejected hunk @@ -66,7 +66,7 @@\n',
 
5422
  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
5423
  expected_disk.tweak('A/mu', contents=
 
5424
                     'x\n' * 10  +
 
5425
                     '1\n' '2\n' '3\n' 'hunk3-mod\n' '4\n' '5\n' '6\n' +
 
5426
                     'x\n' * 33  +
 
5427
                     '1\n' '2\n' '3\n' 'hunk1-mod\n' '4\n' '5\n' '6\n' +
 
5428
                     'x\n' * 50  +
 
5429
                     '1\n' '2\n' '3\n' 'hunk2\n' '4\n' '5\n' '6\n' +
 
5430
                     'x\n' * 243  +
 
5431
                     '1\n' '2\n' '3\n' 'hunk3\n' '4\n' '5\n' '6\n' +
 
5432
                     'x\n' * 10)
 
5433
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
 
5434
  expected_status.tweak('A/mu', status='M ', wc_rev=6)
 
5435
  expected_skip = wc.State('', { })
 
5436
  svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
 
5437
                                       expected_output, expected_disk,
 
5438
                                       expected_status, expected_skip)
 
5439
 
4898
5440
########################################################################
4899
5441
#Run the tests
4900
5442
 
4947
5489
              patch_apply_no_fuz,
4948
5490
              patch_lacking_trailing_eol_on_context,
4949
5491
              patch_with_custom_keywords,
 
5492
              patch_git_rename,
4950
5493
              patch_hunk_avoid_reorder,
 
5494
              patch_hunk_avoid_reorder2,
4951
5495
              patch_hunk_reorder,
 
5496
              patch_hunk_overlap,
 
5497
              patch_delete_modified,
 
5498
              patch_closest,
4952
5499
            ]
4953
5500
 
4954
5501
if __name__ == '__main__':