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/11 22:43:50 UTC
svn commit: r1091198 - in /subversion/trunk/subversion: include/svn_wc.h
libsvn_client/changelist.c libsvn_wc/adm_ops.c libsvn_wc/deprecated.c
Author: hwright
Date: Mon Apr 11 20:43:50 2011
New Revision: 1091198
URL: http://svn.apache.org/viewvc?rev=1091198&view=rev
Log:
Push changelist filtering for the setting of changelists down to libsvn_wc.
Although this may cause a slight decrease in performance, it's a step toward
doing out changelist filtering in the DB (which should increase performance).
Also, the setting of changelists isn't really that common of an event, *but*
by working out these details here, I hope to be able to apply changelist
filtering on other commands with greater ease.
* subversion/include/svn_wc.h
(svn_wc_set_changelist2): Add arg and tweak docstring.
* subversion/libsvn_wc/deprecated.c
(svn_wc_set_changelist): Update wrapper.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_set_changelist2): Do changelist filtering here.
* subversion/libsvn_client/changelist.c
(set_cl_fn_baton): Use a changelist array instead of a hash.
(set_node_changelist): Don't filter based on changelist, instead let the
wc do that.
(svn_client_add_to_changelist, svn_client_remove_from_changelist):
Don't convert the changelist to a hash, just provide it to the filter baton.
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=1091198&r1=1091197&r2=1091198&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon Apr 11 20:43:50 2011
@@ -7400,6 +7400,13 @@ svn_wc_revision_status(svn_wc_revision_s
* changelist assignment from @a local_abspath. @a changelist may not
* be the empty string.
*
+ * @a changelists is an array of <tt>const char *</tt> changelist
+ * names, used as a restrictive filter on items whose changelist
+ * assignments are adjusted; that is, don't tweak the changeset of any
+ * item unless it's currently a member of one of those changelists.
+ * If @a changelists is empty (or altogether @c NULL), no changelist
+ * filtering occurs.
+ *
* If @a cancel_func is not @c NULL, call it with @a cancel_baton to
* determine if the client has canceled the operation.
*
@@ -7423,6 +7430,7 @@ svn_error_t *
svn_wc_set_changelist2(svn_wc_context_t *wc_ctx,
const char *local_abspath,
const char *changelist,
+ const apr_array_header_t *changelists,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
Modified: subversion/trunk/subversion/libsvn_client/changelist.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/changelist.c?rev=1091198&r1=1091197&r2=1091198&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/changelist.c (original)
+++ subversion/trunk/subversion/libsvn_client/changelist.c Mon Apr 11 20:43:50 2011
@@ -44,7 +44,7 @@
struct set_cl_fn_baton
{
const char *changelist; /* NULL if removing changelists */
- apr_hash_t *changelist_hash;
+ const apr_array_header_t *changelists;
svn_client_ctx_t *ctx;
apr_pool_t *pool;
};
@@ -62,11 +62,6 @@ set_node_changelist(const char *local_ab
{
struct set_cl_fn_baton *b = (struct set_cl_fn_baton *)baton;
- /* See if this entry passes our changelist filtering. */
- if (! svn_wc__changelist_match(b->ctx->wc_ctx, local_abspath,
- b->changelist_hash, pool))
- return SVN_NO_ERROR;
-
/* We only care about files right now. */
if (kind != svn_node_file)
{
@@ -85,6 +80,7 @@ set_node_changelist(const char *local_ab
}
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);
@@ -99,11 +95,7 @@ svn_client_add_to_changelist(const apr_a
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- /* ### Someday this routine might use a different underlying API to
- ### to make the associations in a centralized database. */
-
apr_pool_t *iterpool = svn_pool_create(pool);
- apr_hash_t *changelist_hash = NULL;
int i;
if (changelist[0] == '\0')
@@ -119,9 +111,6 @@ svn_client_add_to_changelist(const apr_a
_("'%s' is not a local path"), path);
}
- if (changelists && changelists->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));
-
for (i = 0; i < paths->nelts; i++)
{
struct set_cl_fn_baton snb;
@@ -132,7 +121,7 @@ svn_client_add_to_changelist(const apr_a
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
snb.changelist = changelist;
- snb.changelist_hash = changelist_hash;
+ snb.changelists = changelists;
snb.ctx = ctx;
snb.pool = iterpool;
SVN_ERR(svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE,
@@ -154,11 +143,7 @@ svn_client_remove_from_changelists(const
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- /* ### Someday this routine might use a different underlying API to
- ### to make the associations in a centralized database. */
-
apr_pool_t *iterpool = svn_pool_create(pool);
- apr_hash_t *changelist_hash = NULL;
int i;
for (i = 0; i < paths->nelts; i++)
@@ -170,9 +155,6 @@ svn_client_remove_from_changelists(const
_("'%s' is not a local path"), path);
}
- if (changelists && changelists->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));
-
for (i = 0; i < paths->nelts; i++)
{
struct set_cl_fn_baton snb;
@@ -183,7 +165,7 @@ svn_client_remove_from_changelists(const
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, iterpool));
snb.changelist = NULL;
- snb.changelist_hash = changelist_hash;
+ snb.changelists = changelists;
snb.ctx = ctx;
snb.pool = iterpool;
SVN_ERR(svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE,
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1091198&r1=1091197&r2=1091198&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Apr 11 20:43:50 2011
@@ -2146,6 +2146,7 @@ svn_error_t *
svn_wc_set_changelist2(svn_wc_context_t *wc_ctx,
const char *local_abspath,
const char *changelist,
+ const apr_array_header_t *changelists,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -2160,6 +2161,17 @@ svn_wc_set_changelist2(svn_wc_context_t
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ if (changelists && changelists->nelts)
+ {
+ apr_hash_t *changelist_hash;
+
+ 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;
+ }
+
SVN_ERR(svn_wc__db_read_info(NULL, &kind, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&existing_changelist,
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1091198&r1=1091197&r2=1091198&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Mon Apr 11 20:43:50 2011
@@ -1164,7 +1164,7 @@ 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,
+ SVN_ERR(svn_wc_set_changelist2(wc_ctx, local_abspath, changelist, NULL,
cancel_func, cancel_baton, notify_func,
notify_baton, pool));