You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2014/12/11 12:40:47 UTC

svn commit: r1644605 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

Author: philip
Date: Thu Dec 11 11:40:47 2014
New Revision: 1644605

URL: http://svn.apache.org/r1644605
Log:
Add an XFail test where Subversion patch is less capable than GNU patch.

Modified:
    subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1644605&r1=1644604&r2=1644605&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Thu Dec 11 11:40:47 2014
@@ -4926,6 +4926,60 @@ def patch_hunk_reorder(sbox):
                                        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 patches.
+  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)
+
 ########################################################################
 #Run the tests
 
@@ -4981,6 +5035,7 @@ test_list = [ None,
               patch_git_rename,
               patch_hunk_avoid_reorder,
               patch_hunk_reorder,
+              patch_hunk_overlap,
             ]
 
 if __name__ == '__main__':