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/09/30 18:45:54 UTC

svn commit: r1706078 - /subversion/trunk/subversion/libsvn_client/patch.c

Author: rhuijben
Date: Wed Sep 30 16:45:53 2015
New Revision: 1706078

URL: http://svn.apache.org/viewvc?rev=1706078&view=rev
Log:
In the 'svn patch' processing only add 'svn:executable' patch hunks if there
weren't any in the original patch.

This fixes duplicated notifications when patches that contain both mode
changes and property changes are applied for a second time.

* subversion/libsvn_client/patch.c
  (apply_one_patch): Don't add svn:executable property patches if there are
    already patches for it. We already detected mismatches, so this just
    avoids duplicated work.

Modified:
    subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1706078&r1=1706077&r2=1706078&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Sep 30 16:45:53 2015
@@ -2619,36 +2619,29 @@ apply_one_patch(patch_target_t **patch_t
 
   /* Match implied property hunks. */
   if (patch->new_executable_p != svn_tristate_unknown
-      && svn_hash_gets(target->prop_targets, SVN_PROP_EXECUTABLE))
+      && patch->new_executable_p != patch->old_executable_p
+      && svn_hash_gets(target->prop_targets, SVN_PROP_EXECUTABLE)
+      && !svn_hash_gets(patch->prop_patches, SVN_PROP_EXECUTABLE))
     {
       hunk_info_t *hi;
       svn_diff_hunk_t *hunk;
       prop_patch_target_t *prop_target = svn_hash_gets(target->prop_targets,
                                                        SVN_PROP_EXECUTABLE);
-      const char *const value = SVN_PROP_EXECUTABLE_VALUE;
 
-      switch (prop_target->operation)
-        {
-          case svn_diff_op_added:
-            SVN_ERR(svn_diff_hunk__create_adds_single_line(&hunk, value, patch,
-                                                           result_pool,
-                                                           iterpool));
-            break;
-
-          case svn_diff_op_deleted:
-            SVN_ERR(svn_diff_hunk__create_deletes_single_line(&hunk, value,
-                                                              patch,
-                                                              result_pool,
-                                                              iterpool));
-            break;
-
-          case svn_diff_op_unchanged:
-            /* ### What to do? */
-            break;
-
-          default:
-            SVN_ERR_MALFUNCTION();
-        }
+      if (patch->new_executable_p == svn_tristate_true)
+        SVN_ERR(svn_diff_hunk__create_adds_single_line(
+                                            &hunk,
+                                            SVN_PROP_EXECUTABLE_VALUE,
+                                            patch,
+                                            result_pool,
+                                            iterpool));
+      else
+        SVN_ERR(svn_diff_hunk__create_deletes_single_line(
+                                            &hunk,
+                                            SVN_PROP_EXECUTABLE_VALUE,
+                                            patch,
+                                            result_pool,
+                                            iterpool));
 
       /* Derive a hunk_info from hunk. */
       SVN_ERR(get_hunk_info(&hi, target, prop_target->content,