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/05 12:20:41 UTC

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

Author: rhuijben
Date: Mon Oct  5 10:20:41 2015
New Revision: 1706783

URL: http://svn.apache.org/viewvc?rev=1706783&view=rev
Log:
Make the filter function of 'svn patch' actually provide the rejection file
and patched files that it promises in the documentation. Before this patch
the patched path and the rejection file were always empty, because nothing
of the patch was applied to the actual targets at this stage.

* subversion/libsvn_client/patch.c
  (patch_target_t): Remove boolean.
  (apply_one_patch): Remove patch_func handling.
  (apply_patches): Apply filtering here after the patch was applied to a
    temporary file, but before the result is installed

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=1706783&r1=1706782&r2=1706783&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Oct  5 10:20:41 2015
@@ -216,9 +216,6 @@ typedef struct patch_target_t {
   /* True if the reason for skipping is a local obstruction */
   svn_boolean_t obstructed;
 
-  /* True if the target has been filtered by the patch callback. */
-  svn_boolean_t filtered;
-
   /* True if at least one hunk was rejected. */
   svn_boolean_t had_rejects;
 
@@ -2436,8 +2433,6 @@ apply_one_patch(patch_target_t **patch_t
                 svn_boolean_t ignore_whitespace,
                 svn_boolean_t remove_tempfiles,
                 const apr_array_header_t *targets_info,
-                svn_client_patch_func_t patch_func,
-                void *patch_baton,
                 svn_cancel_func_t cancel_func,
                 void *cancel_baton,
                 apr_pool_t *result_pool, apr_pool_t *scratch_pool)
@@ -2459,19 +2454,6 @@ apply_one_patch(patch_target_t **patch_t
       return SVN_NO_ERROR;
     }
 
-  if (patch_func)
-    {
-      SVN_ERR(patch_func(patch_baton, &target->filtered,
-                         target->canon_path_from_patchfile,
-                         target->patched_path, target->reject_path,
-                         scratch_pool));
-      if (target->filtered)
-        {
-          *patch_target = target;
-          return SVN_NO_ERROR;
-        }
-    }
-
   iterpool = svn_pool_create(scratch_pool);
 
   if (patch->hunks && patch->hunks->nelts)
@@ -3557,15 +3539,24 @@ apply_patches(/* The path to the patch f
       if (patch)
         {
           patch_target_t *target;
+          svn_boolean_t filtered = FALSE;
 
           SVN_ERR(apply_one_patch(&target, patch, root_abspath,
                                   ctx->wc_ctx, strip_count,
                                   ignore_whitespace, remove_tempfiles,
                                   targets_info,
-                                  patch_func, patch_baton,
                                   ctx->cancel_func, ctx->cancel_baton,
                                   iterpool, iterpool));
-          if (! target->filtered)
+
+          if (!target->skipped && patch_func)
+            {
+              SVN_ERR(patch_func(patch_baton, &filtered,
+                                 target->canon_path_from_patchfile,
+                                 target->patched_path, target->reject_path,
+                                 iterpool));
+            }
+
+          if (! filtered)
             {
               /* Save info we'll still need when we're done patching. */
               patch_target_info_t *target_info =