You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/05/23 20:11:19 UTC

svn commit: r947457 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/patch.c svn/cl.h svn/main.c svn/patch-cmd.c tests/cmdline/patch_tests.py tests/libsvn_client/client-test.c

Author: stsp
Date: Sun May 23 18:11:18 2010
New Revision: 947457

URL: http://svn.apache.org/viewvc?rev=947457&view=rev
Log:
Change the way patch targets can be excluded from patching.
Instead of having callers of svn_client_patch() pass include/exclude
patterns, allow the patch_func callback to filter targets.

Remove the corresponding --include-patterns and --exclude-pattern options
from the CLI client.

* subversion/include/svn_client.h
  (svn_client_patch_func_t): Add a FILTERED output parameter. Update docstring.
  (svn_client_patch): Remove the INCLUDE_PATTERNS and EXCLUDE_PATTERNS
   parameters. Improve documentation of the REMOVE_TEMPFILES parameter
   while here.

* subversion/libsvn_client/patch.c
  (patch_target_t): Tweak documentation of FILTERED member.
  (init_patch_target, apply_one_patch, svn_client_patch): Remove
   INCLUDE_PATTERNS and EXCLUDE_PATTERNS patermeters, and allow the
   patch_func callback to filter patch targets instead.
  (apply_patches_baton_t): Remove INCLUDE_PATTERNS and EXCLUDE_PATTERNS
   members.
  (apply_patches): Track above change.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): Remove INCLUDE_PATTERNS and EXCLUDE_PATTERNS members.

* subversion/svn/main.c
  (svn_cl__longopt_t): Remove OPT_INCLUDE_PATTERN and OPT_EXCLUDE_PATTERN.
  (svn_cl__options, svn_cl__cmd_table, main): Remove --include-patterns and
   --exclude-patterns options.

* subversion/svn/patch-cmd.c
  (svn_cl__patch): Track removed svn_client_patch() parameters.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_include_patterns, patch_with_exclude_patterns,
   patch_with_include_exclude_patterns): Remove.
  (test_list): Track removed tests.

* subversion/tests/libsvn_client/client-test.c
  (patch_collection_func): Add FILTERED output paramter, and always set
   it to FALSE.
  (test_patch): Track removed svn_client_patch() parameters.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/main.c
    subversion/trunk/subversion/svn/patch-cmd.c
    subversion/trunk/subversion/tests/cmdline/patch_tests.py
    subversion/trunk/subversion/tests/libsvn_client/client-test.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Sun May 23 18:11:18 2010
@@ -4835,12 +4835,25 @@ svn_client_info(const char *path_or_url,
  */
 
 /**
- * The callback invoked by svn_client_patch().  Each invocation describes
- * a patch application for @a local_abspath, and provides the @a patch_abspath
- * to the temporary patch file and @a reject_abspath to the temporary reject
- * file.  Neither @a patch_abspath or @a reject_abspath are guaranteed to
- * exist (depending on the @a remove_tempfiles parameter for
- * svn_client_patch() ).
+ * The callback invoked by svn_client_patch() before attempting to patch
+ * the target file at @a canon_path_from_patchfile (the path as parsed from
+ * the patch file, but in canonicalized form). The callback can prevent
+ * the file from being patched by setting @a filtered to @c TRUE.
+ *
+ * The callback is also provided with @a patch_abspath, the path of a
+ * temporary file containing the patched result, and with @a reject_abspath,
+ * the path to a temporary file containing the diff text of any hunks
+ * which were rejected during patching.
+ *
+ * Because the callback is invoked before the patching attempt is made,
+ * there is no guarantee that the target file will actually be patched
+ * successfully. Client implementations must pay attention to notification
+ * feedback provided by svn_client_patch() to find out which paths were
+ * patched successfully.
+ *
+ * Note also that the files at @a patch_abspath and @a reject_abspath are
+ * guaranteed to remain on disk after patching only if the
+ * @a remove_tempfiles parameter for svn_client_patch() is @c FALSE.
  *
  * The const char * parameters may be allocated in @a scratch_pool which
  * will be cleared after each invocation.
@@ -4849,6 +4862,7 @@ svn_client_info(const char *path_or_url,
  */
 typedef svn_error_t *(*svn_client_patch_func_t)(
   void *baton,
+  svn_boolean_t *filtered,
   const char *local_abspath,
   const char *patch_abspath,
   const char *reject_abspath,
@@ -4876,25 +4890,13 @@ typedef svn_error_t *(*svn_client_patch_
  * This is useful when applying a unidiff which was created with the
  * original and modified files swapped due to human error.
  *
- * Excluding patch targets from the patching process is possible by passing
- * @a include_patterns and/or @a exclude_patterns arrays containing
- * elements of type const char *.
- * If @a include_patterns is not NULL, patch targets not matching any glob
- * pattern in @a include_patterns will not be patched.
- * If @a exclude_patterns is not NULL, patch targets matching any glob pattern
- * in @a exclude_patterns will not be patched
- * The match is performed on the target path as parsed from the patch file,
- * after canonicalization.
- * If both @a include_patterns and @a exclude_patterns are specified,
- * the @a include_patterns are applied first, i.e. the @a exclude_patterns
- * are applied to all targets which matched one of the @a include_patterns.
- *
  * If @a ignore_whitespace is TRUE, allow patches to be applied if they
  * only differ from the target by whitespace.
  *
- * If @a remove_tempfiles is TRUE, the temporary patch and reject file
- * lifetimes will be managed internally, otherwise, the caller should take
- * ownership of these files.
+ * If @a remove_tempfiles is TRUE, lifetimes of temporary files created
+ * during patching will be managed internally. Otherwise, the caller should
+ * take ownership of these files, the names of which can be obtained by
+ * passing a @a patch_func callback.
  *
  * If @a patch_func is non-NULL, invoke @a patch_func with @a patch_baton
  * for each patch target processed.
@@ -4915,8 +4917,6 @@ svn_client_patch(const char *patch_abspa
                  svn_boolean_t dry_run,
                  int strip_count,
                  svn_boolean_t reverse,
-                 const apr_array_header_t *include_patterns,
-                 const apr_array_header_t *exclude_patterns,
                  svn_boolean_t ignore_whitespace,
                  svn_boolean_t remove_tempfiles,
                  svn_client_patch_func_t patch_func,

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Sun May 23 18:11:18 2010
@@ -136,7 +136,7 @@ typedef struct {
   /* True if the target had to be skipped for some reason. */
   svn_boolean_t skipped;
 
-  /* True if the target matches a filter glob pattern. */
+  /* True if the target has been filtered by the patch callback. */
   svn_boolean_t filtered;
 
   /* True if at least one hunk was rejected. */
@@ -337,8 +337,6 @@ resolve_target_path(patch_target_t *targ
  * which should be stripped from target paths in the patch.
  * Upon success, allocate the patch target structure in RESULT_POOL.
  * Else, set *target to NULL.
- * If a target does not match a glob in INCLUDE_PATTERNS, mark it as filtered.
- * If a target matches a glob in EXCLUDE_PATTERNS, mark it as filtered.
  * REMOVE_TEMPFILES as in svn_client_patch().
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
@@ -346,8 +344,6 @@ init_patch_target(patch_target_t **patch
                   const svn_patch_t *patch,
                   const char *base_dir,
                   svn_wc_context_t *wc_ctx, int strip_count,
-                  const apr_array_header_t *include_patterns,
-                  const apr_array_header_t *exclude_patterns,
                   svn_boolean_t remove_tempfiles,
                   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
@@ -359,49 +355,6 @@ init_patch_target(patch_target_t **patch
                               base_dir, strip_count, wc_ctx,
                               result_pool, scratch_pool));
 
-  target->filtered = FALSE;
-  if (include_patterns)
-    {
-      int i;
-      const char *glob;
-      svn_boolean_t match;
-
-      match = FALSE;
-      for (i = 0; i < include_patterns->nelts; i++)
-        {
-          glob = APR_ARRAY_IDX(include_patterns, i, const char *);
-          match = (apr_fnmatch(glob, target->canon_path_from_patchfile,
-                               APR_FNM_CASE_BLIND) == APR_SUCCESS);
-          if (match)
-            break;
-        }
-
-      if (! match)
-        {
-          target->filtered = TRUE;
-          *patch_target = target;
-          return SVN_NO_ERROR;
-        }
-    }
-  if (exclude_patterns)
-    {
-      int i;
-      const char *glob;
-
-      for (i = 0; i < exclude_patterns->nelts; i++)
-        {
-          glob = APR_ARRAY_IDX(exclude_patterns, i, const char *);
-          target->filtered = (apr_fnmatch(glob,
-                                          target->canon_path_from_patchfile,
-                                          APR_FNM_CASE_BLIND) == APR_SUCCESS);
-          if (target->filtered)
-            {
-              *patch_target = target;
-              return SVN_NO_ERROR;
-            }
-        }
-    }
-
   target->local_mods = FALSE;
   target->executable = FALSE;
 
@@ -1138,8 +1091,6 @@ send_patch_notification(const patch_targ
  * in RESULT_POOL. Use WC_CTX as the working copy context.
  * STRIP_COUNT specifies the number of leading path components
  * which should be stripped from target paths in the patch.
- * If a target does not match a glob in INCLUDE_PATTERNS, mark it as filtered.
- * If a target matches a glob in EXCLUDE_PATTERNS, mark it as filtered.
  * REMOVE_TEMPFILES, PATCH_FUNC, and PATCH_BATON as in svn_client_patch().
  * IGNORE_WHITESPACE tells whether whitespace should be considered when
  * doing the matching.
@@ -1149,8 +1100,6 @@ static svn_error_t *
 apply_one_patch(patch_target_t **patch_target, svn_patch_t *patch,
                 const char *abs_wc_path, svn_wc_context_t *wc_ctx,
                 int strip_count,
-                const apr_array_header_t *include_patterns,
-                const apr_array_header_t *exclude_patterns,
                 svn_boolean_t ignore_whitespace,
                 svn_boolean_t remove_tempfiles,
                 svn_client_patch_func_t patch_func,
@@ -1165,15 +1114,27 @@ apply_one_patch(patch_target_t **patch_t
   static const int MAX_FUZZ = 2;
 
   SVN_ERR(init_patch_target(&target, patch, abs_wc_path, wc_ctx, strip_count,
-                            include_patterns, exclude_patterns,
                             remove_tempfiles, result_pool, scratch_pool));
-
-  if (target->skipped || target->filtered)
+  if (target->skipped)
     {
       *patch_target = target;
       return SVN_NO_ERROR;
     }
 
+  target->filtered = FALSE;
+  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);
   /* Match hunks. */
   for (i = 0; i < patch->hunks->nelts; i++)
@@ -1282,11 +1243,6 @@ apply_one_patch(patch_target_t **patch_t
 
   *patch_target = target;
 
-  if (patch_func)
-    SVN_ERR(patch_func(patch_baton, target->canon_path_from_patchfile,
-                       target->patched_path, target->reject_path,
-                       scratch_pool));
-
   return SVN_NO_ERROR;
 }
 
@@ -1766,12 +1722,6 @@ typedef struct {
   /* Whether to apply the patch in reverse. */
   svn_boolean_t reverse;
 
-  /* Files not matching any of these patterns won't be patched. */
-  const apr_array_header_t *include_patterns;
-
-  /* Files matching any of these patterns won't be patched. */
-  const apr_array_header_t *exclude_patterns;
-
   /* Indicates whether we should ignore whitespace when matching context
    * lines */
   svn_boolean_t ignore_whitespace;
@@ -1834,7 +1784,6 @@ apply_patches(void *baton,
 
           SVN_ERR(apply_one_patch(&target, patch, btn->abs_wc_path,
                                   btn->ctx->wc_ctx, btn->strip_count,
-                                  btn->include_patterns, btn->exclude_patterns,
                                   btn->ignore_whitespace,
                                   btn->remove_tempfiles,
                                   btn->patch_func, btn->patch_baton,
@@ -1880,8 +1829,6 @@ svn_client_patch(const char *patch_abspa
                  svn_boolean_t dry_run,
                  int strip_count,
                  svn_boolean_t reverse,
-                 const apr_array_header_t *include_patterns,
-                 const apr_array_header_t *exclude_patterns,
                  svn_boolean_t ignore_whitespace,
                  svn_boolean_t remove_tempfiles,
                  svn_client_patch_func_t patch_func,
@@ -1902,8 +1849,6 @@ svn_client_patch(const char *patch_abspa
   baton.ctx = ctx;
   baton.strip_count = strip_count;
   baton.reverse = reverse;
-  baton.include_patterns = include_patterns;
-  baton.exclude_patterns = exclude_patterns;
   baton.ignore_whitespace = ignore_whitespace;
   baton.remove_tempfiles = remove_tempfiles;
   baton.patch_func = patch_func;

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Sun May 23 18:11:18 2010
@@ -224,8 +224,6 @@ typedef struct svn_cl__opt_state_t
   int strip_count; /* number of leading path components to strip */
   svn_boolean_t ignore_keywords;  /* do not expand keywords */
   svn_boolean_t reverse_diff;     /* reverse a diff (e.g. when patching) */
-  apr_array_header_t *include_patterns; /* targets to include in operation */
-  apr_array_header_t *exclude_patterns; /* targets to exclude from operation */
   svn_boolean_t ignore_whitespace; /* don't account for whitespace when
                                       patching */
   svn_boolean_t show_diff;        /* produce diff output */

Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Sun May 23 18:11:18 2010
@@ -118,8 +118,6 @@ typedef enum {
   opt_show_copies_as_adds,
   opt_ignore_keywords,
   opt_reverse_diff,
-  opt_include_pattern,
-  opt_exclude_pattern,
   opt_ignore_whitespace,
   opt_show_diff,
 } svn_cl__longopt_t;
@@ -356,36 +354,6 @@ const apr_getopt_option_t svn_cl__option
                     N_("apply the unidiff in reverse\n"
                        "                             "
                        "[alias: --rd]")},
-  {"include-pattern", opt_include_pattern, 1,
-                    N_("operate only on targets matching ARG,\n"
-                       "                             "
-                       "which may be a glob pattern such as '*.txt'.\n"
-                       "                             "
-                       "If this option is specified multiple times,\n"
-                       "                             "
-                       "all patterns are matched in turn.\n"
-                       "                             "
-                       "If both --include-pattern and --exclude-pattern\n"
-                       "                             "
-                       "options are specified include patterns are applied\n"
-                       "                             "
-                       "first, i.e. exclude patterns are applied to all\n"
-                       "                             "
-                       "targets which match an include pattern.\n"
-                       "                             "
-                       "[alias: --ip]")},
-  {"exclude-pattern", opt_exclude_pattern, 1,
-                    N_("do not operate on targets matching ARG,\n"
-                       "                             "
-                       "which may be a glob pattern such as '*.txt'.\n"
-                       "                             "
-                       "If this option is specified multiple times,\n"
-                       "                             "
-                       "all patterns are matched in turn.\n"
-                       "                             "
-                       "See also the --include-pattern option.\n"
-                       "                             "
-                       "[alias: --ep]")},
   {"ignore-whitespace", opt_ignore_whitespace, 0,
                        N_("don't take whitespace into account when,\n"
                        "                             "
@@ -419,8 +387,6 @@ const apr_getopt_option_t svn_cl__option
   {"strip",         opt_strip_count, 1, NULL},
   {"sca",           opt_show_copies_as_adds, 0, NULL},
   {"ik",            opt_ignore_keywords, 0, NULL},
-  {"ip",            opt_include_pattern, 1, NULL},
-  {"ep",            opt_exclude_pattern, 1, NULL},
   {"diff",          opt_show_diff, 0, NULL},
 
   {0,               0, 0, 0},
@@ -864,8 +830,8 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  for addition. Use 'svn revert' to undo deletions and additions you\n"
      "  do not agree with.\n"
      ),
-    {'q', opt_dry_run, opt_strip_count, opt_reverse_diff, opt_include_pattern,
-     opt_exclude_pattern, opt_ignore_whitespace} },
+    {'q', opt_dry_run, opt_strip_count, opt_reverse_diff,
+     opt_ignore_whitespace} },
 
   { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_
     ("Remove a property from files, dirs, or revisions.\n"
@@ -1782,18 +1748,6 @@ main(int argc, const char *argv[])
       case opt_reverse_diff:
         opt_state.reverse_diff = TRUE;
         break;
-      case opt_include_pattern:
-        if (opt_state.include_patterns == NULL)
-          opt_state.include_patterns = apr_array_make(pool, 1,
-                                                      sizeof (const char *));
-        APR_ARRAY_PUSH(opt_state.include_patterns, const char *) = opt_arg;
-        break;
-      case opt_exclude_pattern:
-        if (opt_state.exclude_patterns == NULL)
-          opt_state.exclude_patterns = apr_array_make(pool, 1,
-                                                      sizeof (const char *));
-        APR_ARRAY_PUSH(opt_state.exclude_patterns, const char *) = opt_arg;
-        break;
       case opt_ignore_whitespace:
           opt_state.ignore_whitespace = TRUE;
           break;

Modified: subversion/trunk/subversion/svn/patch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/patch-cmd.c?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/patch-cmd.c (original)
+++ subversion/trunk/subversion/svn/patch-cmd.c Sun May 23 18:11:18 2010
@@ -79,8 +79,6 @@ svn_cl__patch(apr_getopt_t *os,
   SVN_ERR(svn_client_patch(abs_patch_path, abs_target_path,
                            opt_state->dry_run, opt_state->strip_count,
                            opt_state->reverse_diff,
-                           opt_state->include_patterns,
-                           opt_state->exclude_patterns,
                            opt_state->ignore_whitespace,
                            TRUE, NULL, NULL, ctx, pool, pool));
 

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Sun May 23 18:11:18 2010
@@ -1871,490 +1871,6 @@ def patch_with_svn_eol_style_uncommitted
       expected_output = ["Reverted '" + mu_path + "'\n"]
       svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert', '-R', wc_dir)
 
-def patch_with_include_patterns(sbox):
-  "patch with include-patterns"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  patch_file_path = make_patch_path(sbox)
-  mu_path = os.path.join(wc_dir, 'A', 'mu')
-
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 13th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-    "\n",
-    "Again, we wish to congratulate you over your email success in our\n"
-    "computer Balloting.\n"
-  ]
-
-  # Set mu contents
-  svntest.main.file_write(mu_path, ''.join(mu_contents))
-  expected_output = svntest.wc.State(wc_dir, {
-    'A/mu'       : Item(verb='Sending'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/mu', wc_rev=2)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-  # Apply patch
-
-  unidiff_patch = [
-    "Index: A/D/gamma\n",
-    "===================================================================\n",
-    "--- A/D/gamma\t(revision 1)\n",
-    "+++ A/D/gamma\t(working copy)\n",
-    "@@ -1 +1 @@\n",
-    "-This is the file 'gamma'.\n",
-    "+It is the file 'gamma'.\n",
-    "Index: iota\n",
-    "===================================================================\n",
-    "--- iota\t(revision 1)\n",
-    "+++ iota\t(working copy)\n",
-    "@@ -1 +1,2 @@\n",
-    " This is the file 'iota'.\n",
-    "+Some more bytes\n",
-    "\n",
-    "Index: new\n",
-    "===================================================================\n",
-    "--- new	(revision 0)\n",
-    "+++ new	(revision 0)\n",
-    "@@ -0,0 +1 @@\n",
-    "+new\n",
-    "\n",
-    "--- A/mu.orig	2009-06-24 15:23:55.000000000 +0100\n",
-    "+++ A/mu	2009-06-24 15:21:23.000000000 +0100\n",
-    "@@ -6,6 +6,9 @@\n",
-    " through a computer ballot system drawn from over 100,000 company\n",
-    " and 50,000,000 individual email addresses from all over the world.\n",
-    " \n",
-    "+It is a promotional program aimed at encouraging internet users;\n",
-    "+therefore you do not need to buy ticket to enter for it.\n",
-    "+\n",
-    " Your email address drew and have won the sum of  750,000 Euros\n",
-    " ( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    " file with\n",
-    "@@ -14,11 +17,8 @@\n",
-    "     BATCH NUMBERS :\n",
-    "     EULO/1007/444/606/08;\n",
-    "     SERIAL NUMBER: 45327\n",
-    "-and PROMOTION DATE: 13th June. 2009\n",
-    "+and PROMOTION DATE: 14th June. 2009\n",
-    " \n",
-    " To claim your winning prize, you are to contact the appointed\n",
-    " agent below as soon as possible for the immediate release of your\n",
-    " winnings with the below details.\n",
-    "-\n",
-    "-Again, we wish to congratulate you over your email success in our\n",
-    "-computer Balloting.\n",
-    "Index: A/B/E/beta\n",
-    "===================================================================\n",
-    "--- A/B/E/beta	(revision 1)\n",
-    "+++ A/B/E/beta	(working copy)\n",
-    "@@ -1 +0,0 @@\n",
-    "-This is the file 'beta'.\n",
-  ]
-
-  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
-
-  gamma_contents = "It is the file 'gamma'.\n"
-  iota_contents = "This is the file 'iota'.\nSome more bytes\n"
-  new_contents = "new\n"
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "It is a promotional program aimed at encouraging internet users;\n",
-    "therefore you do not need to buy ticket to enter for it.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 14th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-  ]
-
-  expected_output = [
-    'U         %s\n' % os.path.join(wc_dir, 'A', 'mu'),
-  ]
-
-  expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('A/mu', contents=''.join(mu_contents))
-
-  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,
-                                       None, # expected err
-                                       1, # check-props
-                                       1, # dry-run
-                                       "--include-pattern", "A/mu")
-
-def patch_with_exclude_patterns(sbox):
-  "patch with exclude-patterns"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  patch_file_path = make_patch_path(sbox)
-  mu_path = os.path.join(wc_dir, 'A', 'mu')
-
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 13th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-    "\n",
-    "Again, we wish to congratulate you over your email success in our\n"
-    "computer Balloting.\n"
-  ]
-
-  # Set mu contents
-  svntest.main.file_write(mu_path, ''.join(mu_contents))
-  expected_output = svntest.wc.State(wc_dir, {
-    'A/mu'       : Item(verb='Sending'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/mu', wc_rev=2)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-  # Apply patch
-
-  unidiff_patch = [
-    "Index: A/D/gamma\n",
-    "===================================================================\n",
-    "--- A/D/gamma\t(revision 1)\n",
-    "+++ A/D/gamma\t(working copy)\n",
-    "@@ -1 +1 @@\n",
-    "-This is the file 'gamma'.\n",
-    "+It is the file 'gamma'.\n",
-    "Index: iota\n",
-    "===================================================================\n",
-    "--- iota\t(revision 1)\n",
-    "+++ iota\t(working copy)\n",
-    "@@ -1 +1,2 @@\n",
-    " This is the file 'iota'.\n",
-    "+Some more bytes\n",
-    "\n",
-    "Index: new\n",
-    "===================================================================\n",
-    "--- new	(revision 0)\n",
-    "+++ new	(revision 0)\n",
-    "@@ -0,0 +1 @@\n",
-    "+new\n",
-    "\n",
-    "--- A/mu.orig	2009-06-24 15:23:55.000000000 +0100\n",
-    "+++ A/mu	2009-06-24 15:21:23.000000000 +0100\n",
-    "@@ -6,6 +6,9 @@\n",
-    " through a computer ballot system drawn from over 100,000 company\n",
-    " and 50,000,000 individual email addresses from all over the world.\n",
-    " \n",
-    "+It is a promotional program aimed at encouraging internet users;\n",
-    "+therefore you do not need to buy ticket to enter for it.\n",
-    "+\n",
-    " Your email address drew and have won the sum of  750,000 Euros\n",
-    " ( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    " file with\n",
-    "@@ -14,11 +17,8 @@\n",
-    "     BATCH NUMBERS :\n",
-    "     EULO/1007/444/606/08;\n",
-    "     SERIAL NUMBER: 45327\n",
-    "-and PROMOTION DATE: 13th June. 2009\n",
-    "+and PROMOTION DATE: 14th June. 2009\n",
-    " \n",
-    " To claim your winning prize, you are to contact the appointed\n",
-    " agent below as soon as possible for the immediate release of your\n",
-    " winnings with the below details.\n",
-    "-\n",
-    "-Again, we wish to congratulate you over your email success in our\n",
-    "-computer Balloting.\n",
-    "Index: A/B/E/beta\n",
-    "===================================================================\n",
-    "--- A/B/E/beta	(revision 1)\n",
-    "+++ A/B/E/beta	(working copy)\n",
-    "@@ -1 +0,0 @@\n",
-    "-This is the file 'beta'.\n",
-  ]
-
-  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
-
-  gamma_contents = "It is the file 'gamma'.\n"
-  iota_contents = "This is the file 'iota'.\nSome more bytes\n"
-  new_contents = "new\n"
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "It is a promotional program aimed at encouraging internet users;\n",
-    "therefore you do not need to buy ticket to enter for it.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 14th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-  ]
-
-  expected_output = [
-    'U         %s\n' % os.path.join(wc_dir, 'A', 'mu'),
-  ]
-
-  expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('A/mu', contents=''.join(mu_contents))
-
-  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,
-                                       None, # expected err
-                                       1, # check-props
-                                       1, # dry-run
-                                       "--exclude-pattern", "A/*/gamma",
-                                       "--exclude-pattern", "new",
-                                       "--exclude-pattern", "*a")
-
-def patch_with_include_exclude_patterns(sbox):
-  "patch with include-patterns and exclude-patterns"
-
-  sbox.build()
-  wc_dir = sbox.wc_dir
-
-  patch_file_path = make_patch_path(sbox)
-  mu_path = os.path.join(wc_dir, 'A', 'mu')
-
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 13th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-    "\n",
-    "Again, we wish to congratulate you over your email success in our\n"
-    "computer Balloting.\n"
-  ]
-
-  # Set mu contents
-  svntest.main.file_write(mu_path, ''.join(mu_contents))
-  expected_output = svntest.wc.State(wc_dir, {
-    'A/mu'       : Item(verb='Sending'),
-    })
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/mu', wc_rev=2)
-  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
-                                        expected_status, None, wc_dir)
-
-  # Apply patch
-
-  unidiff_patch = [
-    "Index: A/D/gamma\n",
-    "===================================================================\n",
-    "--- A/D/gamma\t(revision 1)\n",
-    "+++ A/D/gamma\t(working copy)\n",
-    "@@ -1 +1 @@\n",
-    "-This is the file 'gamma'.\n",
-    "+It is the file 'gamma'.\n",
-    "Index: iota\n",
-    "===================================================================\n",
-    "--- iota\t(revision 1)\n",
-    "+++ iota\t(working copy)\n",
-    "@@ -1 +1,2 @@\n",
-    " This is the file 'iota'.\n",
-    "+Some more bytes\n",
-    "\n",
-    "Index: new\n",
-    "===================================================================\n",
-    "--- new	(revision 0)\n",
-    "+++ new	(revision 0)\n",
-    "@@ -0,0 +1 @@\n",
-    "+new\n",
-    "\n",
-    "--- A/mu.orig	2009-06-24 15:23:55.000000000 +0100\n",
-    "+++ A/mu	2009-06-24 15:21:23.000000000 +0100\n",
-    "@@ -6,6 +6,9 @@\n",
-    " through a computer ballot system drawn from over 100,000 company\n",
-    " and 50,000,000 individual email addresses from all over the world.\n",
-    " \n",
-    "+It is a promotional program aimed at encouraging internet users;\n",
-    "+therefore you do not need to buy ticket to enter for it.\n",
-    "+\n",
-    " Your email address drew and have won the sum of  750,000 Euros\n",
-    " ( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    " file with\n",
-    "@@ -14,11 +17,8 @@\n",
-    "     BATCH NUMBERS :\n",
-    "     EULO/1007/444/606/08;\n",
-    "     SERIAL NUMBER: 45327\n",
-    "-and PROMOTION DATE: 13th June. 2009\n",
-    "+and PROMOTION DATE: 14th June. 2009\n",
-    " \n",
-    " To claim your winning prize, you are to contact the appointed\n",
-    " agent below as soon as possible for the immediate release of your\n",
-    " winnings with the below details.\n",
-    "-\n",
-    "-Again, we wish to congratulate you over your email success in our\n",
-    "-computer Balloting.\n",
-    "Index: A/B/E/beta\n",
-    "===================================================================\n",
-    "--- A/B/E/beta	(revision 1)\n",
-    "+++ A/B/E/beta	(working copy)\n",
-    "@@ -1 +0,0 @@\n",
-    "-This is the file 'beta'.\n",
-  ]
-
-  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
-
-  gamma_contents = "It is the file 'gamma'.\n"
-  iota_contents = "This is the file 'iota'.\nSome more bytes\n"
-  new_contents = "new\n"
-  mu_contents = [
-    "Dear internet user,\n",
-    "\n",
-    "We wish to congratulate you over your email success in our computer\n",
-    "Balloting. This is a Millennium Scientific Electronic Computer Draw\n",
-    "in which email addresses were used. All participants were selected\n",
-    "through a computer ballot system drawn from over 100,000 company\n",
-    "and 50,000,000 individual email addresses from all over the world.\n",
-    "\n",
-    "It is a promotional program aimed at encouraging internet users;\n",
-    "therefore you do not need to buy ticket to enter for it.\n",
-    "\n",
-    "Your email address drew and have won the sum of  750,000 Euros\n",
-    "( Seven Hundred and Fifty Thousand Euros) in cash credited to\n",
-    "file with\n",
-    "    REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n",
-    "    WINNING NUMBER : 14-17-24-34-37-45-16\n",
-    "    BATCH NUMBERS :\n",
-    "    EULO/1007/444/606/08;\n",
-    "    SERIAL NUMBER: 45327\n",
-    "and PROMOTION DATE: 14th June. 2009\n",
-    "\n",
-    "To claim your winning prize, you are to contact the appointed\n",
-    "agent below as soon as possible for the immediate release of your\n",
-    "winnings with the below details.\n",
-  ]
-
-  expected_output = [
-    'U         %s\n' % os.path.join(wc_dir, 'iota'),
-    'U         %s\n' % os.path.join(wc_dir, 'A', 'mu'),
-    'D         %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
-  ]
-
-  expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('A/mu', contents=''.join(mu_contents))
-  expected_disk.tweak('iota', contents=''.join(iota_contents))
-  expected_disk.remove('A/B/E/beta')
-
-  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A/mu', status='M ', wc_rev=2)
-  expected_status.tweak('iota', status='M ')
-  expected_status.tweak('A/B/E/beta', status='D ')
-
-  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,
-                                       None, # expected err
-                                       1, # check-props
-                                       1, # dry-run
-                                       "--include-pattern", "A/mu",
-                                       "--include-pattern", "*a",
-                                       "--exclude-pattern", "A/*/gamma")
-
 def patch_with_ignore_whitespace(sbox):
   "ignore whitespace when patching"
 
@@ -2509,9 +2025,6 @@ test_list = [ None,
               patch_no_svn_eol_style,
               patch_with_svn_eol_style,
               patch_with_svn_eol_style_uncommitted,
-              patch_with_include_patterns,
-              patch_with_exclude_patterns,
-              patch_with_include_exclude_patterns,
               patch_with_ignore_whitespace,
             ]
 

Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=947457&r1=947456&r2=947457&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Sun May 23 18:11:18 2010
@@ -257,6 +257,7 @@ struct patch_collection_baton
 /* Collect all the patch information we're interested in. */
 static svn_error_t *
 patch_collection_func(void *baton,
+                      svn_boolean_t *filtered,
                       const char *local_abspath,
                       const char *patch_abspath,
                       const char *reject_abspath,
@@ -276,6 +277,9 @@ patch_collection_func(void *baton,
                  APR_HASH_KEY_STRING,
                  apr_pstrdup(pcb->state_pool, reject_abspath));
 
+  if (filtered)
+    *filtered = FALSE;
+
   return SVN_NO_ERROR;
 }
 
@@ -384,8 +388,8 @@ test_patch(const svn_test_opts_t *opts,
   pcb.reject_tempfiles = apr_hash_make(pool);
   pcb.state_pool = pool;
   SVN_ERR(svn_client_patch(patch_file_path, wc_path, FALSE, 0, FALSE,
-                           NULL, NULL, FALSE, FALSE, patch_collection_func,
-                           &pcb, ctx, pool, pool));
+                           FALSE, FALSE, patch_collection_func, &pcb,
+                           ctx, pool, pool));
   SVN_ERR(svn_io_file_close(patch_file, pool));
 
   SVN_ERR_ASSERT(apr_hash_count(pcb.patched_tempfiles) == 1);