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 23:56:16 UTC
svn commit: r1096060 - in /subversion/trunk/subversion:
libsvn_client/prop_commands.c libsvn_wc/props.c
Author: hwright
Date: Fri Apr 22 21:56:16 2011
New Revision: 1096060
URL: http://svn.apache.org/viewvc?rev=1096060&view=rev
Log:
Properly handle depth in the libsvn_wc prop_set API.
* subversion/libsvn_wc/props.c
(do_propset): Drop depth param in favor of the changelist filter, and do
changelist filtering here.
(propset_walk_baton, propset_walk_cb): New.
(svn_wc_prop_set4): If we get a depth > empty, use the internal node walker
to crawl the tree to apply property changes.
* subversion/libsvn_client/prop_commands.c
(propset_walk_baton, propset_walk_cb): Remove.
(set_props_cb): Just call the libsvn_wc, rather than doing the node walk
for depth here.
Modified:
subversion/trunk/subversion/libsvn_client/prop_commands.c
subversion/trunk/subversion/libsvn_wc/props.c
Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1096060&r1=1096059&r2=1096060&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Fri Apr 22 21:56:16 2011
@@ -86,47 +86,6 @@ error_if_wcprop_name(const char *name)
}
-/* A baton for propset_walk_cb. */
-struct propset_walk_baton
-{
- const char *propname; /* The name of the property to set. */
- 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. */
- const apr_array_header_t *changelists; /* Changelists to filter on. */
- svn_wc_notify_func2_t notify_func;
- void *notify_baton;
-};
-
-/* An node-walk callback for svn_client_propset4.
- *
- * For LOCAL_ABSPATH, set the property named wb->PROPNAME to the value
- * wb->PROPVAL, where "wb" is the WALK_BATON of type "struct
- * propset_walk_baton *".
- */
-static svn_error_t *
-propset_walk_cb(const char *local_abspath,
- svn_node_kind_t kind,
- void *walk_baton,
- apr_pool_t *pool)
-{
- struct propset_walk_baton *wb = walk_baton;
- svn_error_t *err;
-
- err = svn_wc_prop_set4(wb->wc_ctx, local_abspath, wb->propname, wb->propval,
- 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))
- {
- svn_error_clear(err);
- err = SVN_NO_ERROR;
- }
-
- return svn_error_return(err);
-}
-
-
struct getter_baton
{
svn_ra_session_t *ra_session;
@@ -310,30 +269,11 @@ set_props_cb(void *baton,
{
struct set_props_baton *bt = baton;
- if (bt->depth >= svn_depth_files && bt->kind == svn_node_dir)
- {
- struct propset_walk_baton wb;
+ SVN_ERR(svn_wc_prop_set4(bt->ctx->wc_ctx, bt->local_abspath, bt->propname,
+ bt->propval, bt->depth, bt->skip_checks,
+ bt->changelists, bt->ctx->notify_func2,
+ bt->ctx->notify_baton2, scratch_pool));
- wb.wc_ctx = bt->ctx->wc_ctx;
- wb.propname = bt->propname;
- wb.propval = bt->propval;
- wb.force = bt->skip_checks;
- 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,
- FALSE, propset_walk_cb, &wb,
- bt->depth, bt->ctx->cancel_func,
- bt->ctx->cancel_baton, 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->changelists,
- bt->ctx->notify_func2, bt->ctx->notify_baton2,
- scratch_pool));
- }
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1096060&r1=1096059&r2=1096060&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Apr 22 21:56:16 2011
@@ -2007,8 +2007,8 @@ do_propset(svn_wc__db_t *db,
const char *local_abspath,
const char *name,
const svn_string_t *value,
- svn_depth_t depth,
svn_boolean_t skip_checks,
+ const apr_hash_t *changelists,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
apr_pool_t *scratch_pool)
@@ -2021,8 +2021,10 @@ do_propset(svn_wc__db_t *db,
const char *dir_abspath;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- /* ### For the time being, only support depth = empty */
- SVN_ERR_ASSERT(depth == svn_depth_empty);
+
+ if (!svn_wc__internal_changelist_match(db, local_abspath,
+ changelists, scratch_pool))
+ return SVN_NO_ERROR;
/* Get the node kind for this path. */
SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
@@ -2206,6 +2208,46 @@ do_propset(svn_wc__db_t *db,
return SVN_NO_ERROR;
}
+/* A baton for propset_walk_cb. */
+struct propset_walk_baton
+{
+ const char *propname; /* The name of the property to set. */
+ const svn_string_t *propval; /* The value to set. */
+ svn_wc__db_t *db; /* Database for the tree being walked. */
+ svn_boolean_t force; /* True iff force was passed. */
+ const apr_hash_t *changelists; /* Changelists to filter on. */
+ svn_wc_notify_func2_t notify_func;
+ void *notify_baton;
+};
+
+/* An node-walk callback for svn_wc_prop_set4().
+ *
+ * For LOCAL_ABSPATH, set the property named wb->PROPNAME to the value
+ * wb->PROPVAL, where "wb" is the WALK_BATON of type "struct
+ * propset_walk_baton *".
+ */
+static svn_error_t *
+propset_walk_cb(const char *local_abspath,
+ svn_node_kind_t kind,
+ void *walk_baton,
+ apr_pool_t *scratch_pool)
+{
+ struct propset_walk_baton *wb = walk_baton;
+ svn_error_t *err;
+
+ err = do_propset(wb->db, local_abspath, wb->propname, wb->propval,
+ wb->force, wb->changelists, wb->notify_func,
+ wb->notify_baton, scratch_pool);
+ if (err && (err->apr_err == SVN_ERR_ILLEGAL_TARGET
+ || err->apr_err == SVN_ERR_WC_INVALID_SCHEDULE))
+ {
+ svn_error_clear(err);
+ err = SVN_NO_ERROR;
+ }
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc_prop_set4(svn_wc_context_t *wc_ctx,
const char *local_abspath,
@@ -2218,21 +2260,36 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
void *notify_baton,
apr_pool_t *scratch_pool)
{
- if (changelists && changelists->nelts)
- {
- apr_hash_t *changelist_hash = NULL;
+ apr_hash_t *changelist_hash = NULL;
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists,
- scratch_pool));
+ if (changelists && changelists->nelts)
+ 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))
+ if (depth == svn_depth_empty)
+ {
+ if (!svn_wc__internal_changelist_match(wc_ctx->db, local_abspath,
+ changelist_hash, scratch_pool))
return SVN_NO_ERROR;
+
+ SVN_ERR(do_propset(wc_ctx->db, local_abspath, name, value, skip_checks,
+ changelist_hash, notify_func, notify_baton,
+ scratch_pool));
+ }
+ else
+ {
+ struct propset_walk_baton wb = { name, value, wc_ctx->db, skip_checks,
+ changelist_hash, notify_func,
+ notify_baton };
+
+ SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
+ propset_walk_cb, &wb,
+ depth,
+ NULL, NULL, /* cancellation */
+ scratch_pool));
}
- return svn_error_return(do_propset(wc_ctx->db, local_abspath, name, value,
- depth, skip_checks, notify_func,
- notify_baton, scratch_pool));
+ return SVN_NO_ERROR;
}