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 2015/10/01 14:30:01 UTC

svn commit: r1706221 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

Author: rhuijben
Date: Thu Oct  1 12:30:01 2015
New Revision: 1706221

URL: http://svn.apache.org/viewvc?rev=1706221&view=rev
Log:
Properly handle rejections in patches that describe an explicit file delete.

* subversion/libsvn_client/patch.c
  (apply_one_patch): When a delete doesn't match, don't handle it as a delete.

* subversion/tests/cmdline/patch_tests.py
  (patch_git_symlink): Enable repeat run. Expect reject file.

Modified:
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1706221&r1=1706220&r2=1706221&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Oct  1 12:30:01 2015
@@ -2783,6 +2783,13 @@ apply_one_patch(patch_target_t **patch_t
       else
         working_file.size = 0;
 
+      if (patch->operation == svn_diff_op_deleted
+          && target->had_rejects)
+        {
+          /* No match -> No delete! */
+          target->deleted = FALSE;
+        }
+
       if (patched_file.size == 0 && working_file.size > 0)
         {
           /* If a unidiff or a binary patch removes all lines from a file,
@@ -3504,7 +3511,7 @@ apply_patches(/* The path to the patch f
           patch_target_t *target;
 
           SVN_ERR(apply_one_patch(&target, patch, root_abspath,
-                                  ctx->wc_ctx, strip_count,
+                                  ctx->wc_ctx, strip_count, dry_run,
                                   ignore_whitespace, remove_tempfiles,
                                   targets_info,
                                   patch_func, patch_baton,

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1706221&r1=1706220&r2=1706221&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Thu Oct  1 12:30:01 2015
@@ -6837,11 +6837,20 @@ def patch_git_symlink(sbox):
                                        expected_status, expected_skip,
                                        [], True, True)
 
-  # And again
-  # svntest.actions.run_and_verify_patch(wc_dir, to_file_patch,
-  #                                      expected_output, expected_disk,
-  #                                      expected_status, expected_skip,
-  #                                      [], True, True)
+  # And again - Delete can't be applied
+  expected_output.tweak('link-to-iota', status='G ', prev_status='C ')
+  expected_disk.add({
+    'link-to-iota.svnpatch.rej': Item(
+                     contents='--- link-to-iota\n'
+                              '+++ link-to-iota\n'
+                              '@@ -1,1 +0,0 @@\n'
+                              '-A/mu\n'
+                              '\\ No newline at end of file\n'),
+  })
+  svntest.actions.run_and_verify_patch(wc_dir, to_file_patch,
+                                       expected_output, expected_disk,
+                                       expected_status, expected_skip,
+                                       [], True, True)
 
 ########################################################################
 #Run the tests