You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/01/21 21:27:55 UTC

svn commit: r1436592 - in /subversion/trunk/subversion: svn/notify.c tests/cmdline/patch_tests.py

Author: rhuijben
Date: Mon Jan 21 20:27:55 2013
New Revision: 1436592

URL: http://svn.apache.org/viewvc?rev=1436592&view=rev
Log:
Update the expectations of the issue #3644 test, to assume the patch is applied
ok. Verify the final result.

* subversion/svn/notify.c
  (notify): Don't show an offset when patching the empty file.

* subversion/tests/cmdline/patch_tests.py
  (patch_empty_file): Remove XFail marker. Expect applied hunk. Verify disk.

Modified:
    subversion/trunk/subversion/svn/notify.c
    subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1436592&r1=1436591&r2=1436592&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Mon Jan 21 20:27:55 2013
@@ -348,6 +348,11 @@ notify(void *baton, const svn_wc_notify_
             {
               off = n->hunk_matched_line - n->hunk_original_start;
               minus = "";
+
+              /* If we are patching from the start of an empty file,
+                 it is nicer to show offset 0 */
+              if (n->hunk_original_start == 0 && n->hunk_matched_line == 1)
+                off = 0; /* No offset, just adding */
             }
           else
             {

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1436592&r1=1436591&r2=1436592&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Mon Jan 21 20:27:55 2013
@@ -4396,7 +4396,6 @@ def single_line_mismatch(sbox):
                                      'patch', patch_file_path, wc_dir)
 
 @Issue(3644)
-@XFail()
 def patch_empty_file(sbox):
   "apply a patch to an empty file"
 
@@ -4439,12 +4438,24 @@ def patch_empty_file(sbox):
     'U         %s\n' % sbox.ospath('lf.txt'),
     'A         %s\n' % sbox.ospath('new.txt'),
     'U         %s\n' % sbox.ospath('empty.txt'),
+    # Not sure if this line is necessary, but it doesn't hurt
+    '>         applied hunk @@ -0,0 +1,1 @@ with offset 0\n',
   ]
 
   # Current result: lf.txt patched ok, new created, empty succeeds with offset.
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'patch', patch_file_path, wc_dir)
 
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({
+    'lf.txt'            : Item(contents="\n"),
+    'new.txt'           : Item(contents="new file\n"),
+    'empty.txt'         : Item(contents="replacement\n"),
+  })
+
+  svntest.actions.verify_disk(wc_dir, expected_disk)
+
+
 
 ########################################################################
 #Run the tests