Author: hwright
Date: Mon Apr 18 15:12:43 2011
New Revision: 1094612
URL: http://svn.apache.org/viewvc?rev=1094612&view=rev
Log:
Add a depth parameter to the wc-public changelist setting API, and move the
node walker inside libsvn_wc.
* subversion/include/svn_wc.h
(svn_wc_set_changelist2): Add depth parameter, and document.
* subversion/libsvn_wc/deprecated.c
(svn_wc_set_changelist): Update wrapper with svn_depth_empty.
* subversion/libsvn_wc/adm_ops.c
(changelist_walker_baton, changelist_walker): New.
(svn_wc_set_changelist2): Add depth, and use it to walk the tree.
* subversion/libsvn_client/changelist.c
(set_cl_fn_baton, set_node_changelist): Remove.
(svn_client_add_to_changelist, svn_client_remove_from_changelists):
Just call the WC function on the relevant paths.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/changelist.c
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1094612&r1=1094611&r2=1094612&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon Apr 18 15:12:43 2011
@@ -7398,7 +7398,7 @@ svn_wc_revision_status(svn_wc_revision_s
* Set @a local_abspath's 'changelist' attribute to @a changelist iff
* @a changelist is not @c NULL; otherwise, remove any current
* changelist assignment from @a local_abspath. @a changelist may not
- * be the empty string.
+ * be the empty string. Recurse to @a depth.
*
* @a changelists is an array of <tt>const char *</tt> changelist
* names, used as a restrictive filter on items whose changelist
@@ -7430,6 +7430,7 @@ svn_error_t *
svn_wc_set_changelist2(svn_wc_context_t *wc_ctx,
const char *local_abspath,
const char *changelist,
+ svn_depth_t depth,
const apr_array_header_t *changelists,
svn_cancel_func_t cancel_func,
void *cancel_baton,
Modified: subversion/trunk/subversion/libsvn_client/changelist.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/changelist.c?rev=1094612&r1=1094611&r2=1094612&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/changelist.c (original)
+++ subversion/trunk/subversion/libsvn_client/changelist.c Mon Apr 18 15:12:43
2011
@@ -39,52 +39,6 @@
#include "svn_private_config.h"
-/* Entry-walker callback for svn_client_add_to_changelist() and
- svn_client_remove_from_changelist() below. */
-struct set_cl_fn_baton
-{
- const char *changelist; /* NULL if removing changelists */
- const apr_array_header_t *changelists;
- svn_client_ctx_t *ctx;
- apr_pool_t *pool;
-};
-
-
-/* This function -- which implements svn_wc__node_found_func_t -- associates
- LOCAL_ABSPATH with a new changelist (passed along in BATON->changelist),
- so long as LOCAL_ABSPATH is deemed a valid target of that association.
- */
-static svn_error_t *
-set_node_changelist(const char *local_abspath,
- svn_node_kind_t kind,
- void *baton,
- apr_pool_t *pool)
-{
- struct set_cl_fn_baton *b = (struct set_cl_fn_baton *)baton;
-
- /* We only care about files right now. */
- if (kind != svn_node_file)
- {
- /* Notify that we're skipping this directory (to which the
- changelist concept doesn't currently apply) unless we're
- removing changelist associations (so as not to spam during
- 'svn cl --remove -R'.) */
- if (b->ctx->notify_func2
- && ! (b->changelist == NULL && kind == svn_node_dir))
- b->ctx->notify_func2(b->ctx->notify_baton2,
- svn_wc_create_notify(local_abspath,
- svn_wc_notify_skip,
- pool),
- pool);
- return SVN_NO_ERROR;
- }
-
- return svn_wc_set_changelist2(b->ctx->wc_ctx, local_abspath, b->changelist,
- b->changelists,
- b->ctx->cancel_func, b->ctx->cancel_baton,
- b->ctx->notify_func2, b->ctx->notify_baton2,
- pool);
-}
svn_error_t *
@@ -113,22 +67,17 @@ svn_client_add_to_changelist(const apr_a
for (i = 0; i < paths->nelts; i++)
{
- struct set_cl_fn_baton snb;
const char *path = APR_ARRAY_IDX(paths, i, const char *);
const char *local_abspath;
svn_pool_clear(iterpool);
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
- snb.changelist = changelist;
- snb.changelists = changelists;
- snb.ctx = ctx;
- snb.pool = iterpool;
- SVN_ERR(svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE,
- set_node_changelist, &snb,
- depth,
- ctx->cancel_func, ctx->cancel_baton,
- iterpool));
+ SVN_ERR(svn_wc_set_changelist2(ctx->wc_ctx, local_abspath, changelist,
+ depth, changelists,
+ ctx->cancel_func, ctx->cancel_baton,
+ ctx->notify_func2, ctx->notify_baton2,
+ iterpool));
}
svn_pool_destroy(iterpool);
@@ -157,22 +106,17 @@ svn_client_remove_from_changelists(const
for (i = 0; i < paths->nelts; i++)
{
- struct set_cl_fn_baton snb;
const char *path = APR_ARRAY_IDX(paths, i, const char *);
const char *local_abspath;
svn_pool_clear(iterpool);
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
- snb.changelist = NULL;
- snb.changelists = changelists;
- snb.ctx = ctx;
- snb.pool = iterpool;
- SVN_ERR(svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE,
- set_node_changelist, &snb,
- depth,
- ctx->cancel_func, ctx->cancel_baton,
- iterpool));
+ SVN_ERR(svn_wc_set_changelist2(ctx->wc_ctx, local_abspath, NULL,
+ depth, changelists,
+ ctx->cancel_func, ctx->cancel_baton,
+ ctx->notify_func2, ctx->notify_baton2,
+ iterpool));
}
svn_pool_destroy(iterpool);
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1094612&r1=1094611&r2=1094612&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Apr 18 15:12:43 2011
@@ -2122,10 +2122,57 @@ svn_wc_remove_lock2(svn_wc_context_t *wc
return SVN_NO_ERROR;
}
+struct changelist_walker_baton
+{
+ const char *changelist;
+ const apr_array_header_t *changelists;
+
+ svn_wc__db_t *db;
+ svn_wc_notify_func2_t notify_func;
+ void *notify_baton;
+};
+
+static svn_error_t *
+changelist_walker(const char *local_abspath,
+ svn_node_kind_t kind,
+ void *baton,
+ apr_pool_t *scratch_pool)
+{
+ struct changelist_walker_baton *cwb = baton;
+
+ /* We can't add directories to changelists. */
+ if (kind == svn_node_dir && cwb->changelist)
+ {
+ if (cwb->notify_func)
+ cwb->notify_func(cwb->notify_baton,
+ svn_wc_create_notify(local_abspath,
+ svn_wc_notify_skip,
+ scratch_pool),
+ scratch_pool);
+
+ return SVN_NO_ERROR;
+ }
+
+ /* Set the changelist. */
+ SVN_ERR(svn_wc__db_op_set_changelist(cwb->db, local_abspath, cwb->changelist,
+ cwb->changelists, svn_depth_empty,
+ scratch_pool));
+
+ /* And tell someone what we've done. */
+ if (cwb->notify_func)
+ SVN_ERR(svn_wc__db_changelist_list_notify(cwb->notify_func,
+ cwb->notify_baton,
+ cwb->db, local_abspath,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc_set_changelist2(svn_wc_context_t *wc_ctx,
const char *local_abspath,
const char *changelist,
+ svn_depth_t depth,
const apr_array_header_t *changelists,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -2133,32 +2180,18 @@ svn_wc_set_changelist2(svn_wc_context_t
void *notify_baton,
apr_pool_t *scratch_pool)
{
- svn_wc__db_kind_t kind;
+ struct changelist_walker_baton cwb = { changelist, changelists, wc_ctx->db,
+ notify_func, notify_baton };
/* Assert that we aren't being asked to set an empty changelist. */
SVN_ERR_ASSERT(! (changelist && changelist[0] == '\0'));
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath, TRUE,
- scratch_pool));
-
- /* We can't add directories to changelists. */
- if (kind == svn_wc__db_kind_dir && changelist)
- return svn_error_createf(SVN_ERR_CLIENT_IS_DIRECTORY, NULL,
- _("'%s' is a directory, and thus cannot"
- " be a member of a changelist"), local_abspath);
-
- /* Set the changelist. */
- SVN_ERR(svn_wc__db_op_set_changelist(wc_ctx->db, local_abspath, changelist,
- changelists, svn_depth_empty,
- scratch_pool));
-
- /* And tell someone what we've done. */
- if (notify_func)
- SVN_ERR(svn_wc__db_changelist_list_notify(notify_func, notify_baton,
- wc_ctx->db, local_abspath,
- scratch_pool));
+ SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
+ changelist_walker, &cwb,
+ depth, cancel_func, cancel_baton,
+ scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1094612&r1=1094611&r2=1094612&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Mon Apr 18 15:12:43 2011
@@ -1201,7 +1201,8 @@ svn_wc_set_changelist(const char *path,
svn_wc__adm_get_db(adm_access),
pool));
- SVN_ERR(svn_wc_set_changelist2(wc_ctx, local_abspath, changelist, NULL,
+ SVN_ERR(svn_wc_set_changelist2(wc_ctx, local_abspath, changelist,
+ svn_depth_empty, NULL,
cancel_func, cancel_baton, notify_func,
notify_baton, pool));