You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/22 22:22:20 UTC

svn commit: r1096020 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/add.c libsvn_client/mergeinfo.c libsvn_client/patch.c libsvn_client/prop_commands.c libsvn_client/ra.c libsvn_wc/deprecated.c libsvn_wc/props.c

Author: hwright
Date: Fri Apr 22 20:22:20 2011
New Revision: 1096020

URL: http://svn.apache.org/viewvc?rev=1096020&view=rev
Log:
Move changelist filtering on propset down to libsvn_wc from libsvn_client.

* subversion/include/svn_wc.h
  (svn_wc_prop_set4): Add changelists arg, and update docs.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_prop_set3): Update caller.

* subversion/libsvn_wc/props.c
  (svn_wc_prop_set4): Add changelist filtering.

* subversion/libsvn_client/patch.c
  (install_patched_prop_targets): Update caller.
 
* subversion/libsvn_client/prop_commands.c
  (propset_walk_baton, set_props_baton): Change changelists param from hash
    to array.
  (propset_walk_cb, set_props_cb): Drop changelist filtering in favor of
    libsvn_wc.
  (svn_client_propset_local): Don't bother computing the changelist hash.

* subversion/libsvn_client/ra.c
  (set_wc_prop): Update caller.
 
* subversion/libsvn_client/mergeinfo.c
  (svn_client__record_wc_mergeinfo, elide_mergeinfo): Same.

* subversion/libsvn_client/add.c
  (add_file): Same.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/add.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/props.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Fri Apr 22 20:22:20 2011
@@ -5744,6 +5744,12 @@ svn_wc_prop_get(const svn_string_t **val
  * entry property, return the error #SVN_ERR_BAD_PROP_KIND, even if
  * @a skip_checks is TRUE.
  *
+ * @a changelists is an array of <tt>const char *</tt> changelist
+ * names, used as a restrictive filter on items whose properties are
+ * set; that is, don't set properties on any item unless it's a member
+ * of one of those changelists.  If @a changelists is empty (or
+ * altogether @c NULL), no changelist filtering occurs.
+ *
  * For each file or directory operated on, @a notify_func will be called
  * with its path and the @a notify_baton.  @a notify_func may be @c NULL
  * if you are not interested in this information.
@@ -5759,6 +5765,7 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
                  const svn_string_t *value,
                  svn_depth_t depth,
                  svn_boolean_t skip_checks,
+                 const apr_array_header_t *changelists,
                  svn_wc_notify_func2_t notify_func,
                  void *notify_baton,
                  apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/add.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/add.c (original)
+++ subversion/trunk/subversion/libsvn_client/add.c Fri Apr 22 20:22:20 2011
@@ -307,7 +307,7 @@ add_file(const char *local_abspath,
     /* This must be a special file. */
     SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath, SVN_PROP_SPECIAL,
                              svn_string_create(SVN_PROP_BOOLEAN_TRUE, pool),
-                             svn_depth_empty, FALSE, NULL, NULL, pool));
+                             svn_depth_empty, FALSE, NULL, NULL, NULL, pool));
   else if (properties)
     {
       /* loop through the hashtable and add the properties */
@@ -322,7 +322,8 @@ add_file(const char *local_abspath,
              the autoprops say to set some weird combination,
              we just error and let the user sort it out. */
           err = svn_wc_prop_set4(ctx->wc_ctx, local_abspath, pname, pval,
-                                 svn_depth_empty, FALSE, NULL, NULL, pool);
+                                 svn_depth_empty, FALSE, NULL, NULL, NULL,
+                                 pool);
           if (err)
             {
               /* Don't leave the job half-done. If we fail to set a property,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Fri Apr 22 20:22:20 2011
@@ -114,7 +114,7 @@ svn_client__record_wc_mergeinfo(const ch
      ### svn_client__get_prop_from_wc(). */
   SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath, SVN_PROP_MERGEINFO,
                            mergeinfo_str, svn_depth_empty,
-                           TRUE /* skip checks */, NULL, NULL,
+                           TRUE /* skip checks */, NULL, NULL, NULL,
                            scratch_pool));
 
   if (do_notification && ctx->notify_func2)
@@ -788,7 +788,7 @@ elide_mergeinfo(svn_mergeinfo_t parent_m
   if (elides)
     {
       SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, local_abspath, SVN_PROP_MERGEINFO,
-                               NULL, svn_depth_empty, TRUE, NULL, NULL,
+                               NULL, svn_depth_empty, TRUE, NULL, NULL, NULL,
                                scratch_pool));
 
       if (ctx->notify_func2)

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Apr 22 20:22:20 2011
@@ -2223,6 +2223,7 @@ install_patched_prop_targets(patch_targe
             SVN_ERR(svn_wc_prop_set4(ctx->wc_ctx, target->local_abspath,
                                      prop_target->name, NULL, svn_depth_empty,
                                      TRUE /* skip_checks */,
+                                     NULL, /* no changelist filtering */
                                      NULL, NULL, /* suppress notification */
                                      iterpool));
           continue;
@@ -2299,7 +2300,7 @@ install_patched_prop_targets(patch_targe
           err = (svn_wc_prop_set4(ctx->wc_ctx, target->local_abspath,
                                   prop_target->name, prop_val, svn_depth_empty,
                                   TRUE, /* ### Skipping checks */
-                                  NULL, NULL,
+                                  NULL, NULL, NULL,
                                   iterpool));
         }
 

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Fri Apr 22 20:22:20 2011
@@ -93,7 +93,7 @@ struct propset_walk_baton
   const svn_string_t *propval;  /* The value to set. */
   svn_wc_context_t *wc_ctx;  /* Context for the tree being walked. */
   svn_boolean_t force;  /* True iff force was passed. */
-  apr_hash_t *changelist_hash;  /* Keys are changelists to filter on. */
+  const apr_array_header_t *changelists;  /* Changelists to filter on. */
   svn_wc_notify_func2_t notify_func;
   void *notify_baton;
 };
@@ -113,14 +113,9 @@ propset_walk_cb(const char *local_abspat
   struct propset_walk_baton *wb = walk_baton;
   svn_error_t *err;
 
-  /* If our entry doesn't pass changelist filtering, get outta here. */
-  if (! svn_wc__changelist_match(wb->wc_ctx, local_abspath,
-                                 wb->changelist_hash, pool))
-    return SVN_NO_ERROR;
-
   err = svn_wc_prop_set4(wb->wc_ctx, local_abspath, wb->propname, wb->propval,
-                         svn_depth_empty, wb->force, wb->notify_func,
-                         wb->notify_baton, pool);
+                         svn_depth_empty, wb->force, wb->changelists,
+                         wb->notify_func, wb->notify_baton, pool);
   if (err && (err->apr_err == SVN_ERR_ILLEGAL_TARGET
               || err->apr_err == SVN_ERR_WC_INVALID_SCHEDULE))
     {
@@ -304,7 +299,7 @@ struct set_props_baton
   const char *propname;
   const svn_string_t *propval;
   svn_boolean_t skip_checks;
-  apr_hash_t *changelist_hash;
+  const apr_array_header_t *changelists;
 };
 
 /* Working copy lock callback for svn_client_propset4 */
@@ -323,7 +318,7 @@ set_props_cb(void *baton,
       wb.propname = bt->propname;
       wb.propval = bt->propval;
       wb.force = bt->skip_checks;
-      wb.changelist_hash = bt->changelist_hash;
+      wb.changelists = bt->changelists;
       wb.notify_func = bt->ctx->notify_func2;
       wb.notify_baton = bt->ctx->notify_baton2;
       SVN_ERR(svn_wc__node_walk_children(bt->ctx->wc_ctx, bt->local_abspath,
@@ -331,12 +326,11 @@ set_props_cb(void *baton,
                                          bt->depth, bt->ctx->cancel_func,
                                          bt->ctx->cancel_baton, scratch_pool));
     }
-  else if (svn_wc__changelist_match(bt->ctx->wc_ctx, bt->local_abspath,
-                                    bt->changelist_hash, scratch_pool))
+  else
     {
       SVN_ERR(svn_wc_prop_set4(bt->ctx->wc_ctx, bt->local_abspath,
                                bt->propname, bt->propval, svn_depth_empty,
-                               bt->skip_checks,
+                               bt->skip_checks, bt->changelists,
                                bt->ctx->notify_func2, bt->ctx->notify_baton2,
                                scratch_pool));
     }
@@ -384,7 +378,6 @@ svn_client_propset_local(const char *pro
                          svn_client_ctx_t *ctx,
                          apr_pool_t *scratch_pool)
 {
-  apr_hash_t *changelist_hash = NULL;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
   svn_boolean_t targets_are_urls;
   int i;
@@ -402,10 +395,6 @@ svn_client_propset_local(const char *pro
 
   SVN_ERR(check_prop_name(propname, propval));
 
-  if (changelists && changelists->nelts)
-    SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash,
-                                       changelists, scratch_pool));
-
   for (i = 0; i < targets->nelts; i++)
     {
       svn_node_kind_t kind;
@@ -450,7 +439,7 @@ svn_client_propset_local(const char *pro
       baton.propname = propname;
       baton.propval = propval;
       baton.skip_checks = skip_checks;
-      baton.changelist_hash = changelist_hash;
+      baton.changelists = changelists;
 
       SVN_ERR(svn_wc__call_with_write_lock(set_props_cb, &baton,
                                            ctx->wc_ctx, target_abspath,

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Fri Apr 22 20:22:20 2011
@@ -198,7 +198,7 @@ set_wc_prop(void *baton,
      here, so we just set the property and hope for the best. */
   return svn_error_return(svn_wc_prop_set4(cb->ctx->wc_ctx, local_abspath, name,
                                            value, svn_depth_empty, TRUE, NULL,
-                                           NULL, pool));
+                                           NULL, NULL, pool));
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Fri Apr 22 20:22:20 2011
@@ -2191,7 +2191,7 @@ svn_wc_prop_set3(const char *name,
                                          svn_wc__adm_get_db(adm_access), pool));
 
   err = svn_wc_prop_set4(wc_ctx, local_abspath, name, value, svn_depth_empty,
-                         skip_checks, notify_func, notify_baton, pool);
+                         skip_checks, NULL, notify_func, notify_baton, pool);
 
   if (err && err->apr_err == SVN_ERR_WC_INVALID_SCHEDULE)
     svn_error_clear(err);

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1096020&r1=1096019&r2=1096020&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Apr 22 20:22:20 2011
@@ -2213,10 +2213,23 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
                  const svn_string_t *value,
                  svn_depth_t depth,
                  svn_boolean_t skip_checks,
+                 const apr_array_header_t *changelists,
                  svn_wc_notify_func2_t notify_func,
                  void *notify_baton,
                  apr_pool_t *scratch_pool)
 {
+  if (changelists && changelists->nelts)
+    {
+      apr_hash_t *changelist_hash = NULL;
+
+      SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists,
+                                         scratch_pool));
+
+      if (!svn_wc__changelist_match(wc_ctx, local_abspath, changelist_hash,
+                                    scratch_pool))
+        return SVN_NO_ERROR;
+    }
+
   return svn_error_return(do_propset(wc_ctx->db, local_abspath, name, value,
                                      depth, skip_checks, notify_func,
                                      notify_baton, scratch_pool));