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/26 20:08:31 UTC
svn commit: r1096830 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
node.c props.c wc.h
Author: hwright
Date: Tue Apr 26 18:08:31 2011
New Revision: 1096830
URL: http://svn.apache.org/viewvc?rev=1096830&view=rev
Log:
Allow the libsvn_wc-internal node walker to also filter on changelists. This
means we *don't* have to replicate the changelist filtering elsewhere.
Use this new functionality when setting props.
* subversion/libsvn_wc/props.c
(do_propset): Don't filter based on changelist.
(propset_walk_baton): Remove CHANGELISTS member.
(propset_walk_cb): Don't send the changelist list to do_propset().
(svn_wc_prop_set4): Only bother to calculate the changelist hash, except for
depth_empty. Let the node walker do changelist filtering.
* subversion/libsvn_wc/wc.h
(svn_wc__internal_walk_children): Add changelists param.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_set_changelist2): Don't (yet) use the node walker to filter based
on changelist.
* subversion/libsvn_wc/node.c
(walker_helper): Take a changelist filter, and use it.
(svn_wc__internal_walk_children): Add changelist filter param, and use it
to filter the children in the walker_helper().
(svn_wc__node_walk_children): Update caller to ignore the changelist filter.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/props.c
subversion/trunk/subversion/libsvn_wc/wc.h
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1096830&r1=1096829&r2=1096830&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Apr 26 18:08:31 2011
@@ -2261,7 +2261,7 @@ svn_wc_set_changelist2(svn_wc_context_t
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
- changelist_walker, &cwb,
+ NULL, changelist_walker, &cwb,
depth, cancel_func, cancel_baton,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1096830&r1=1096829&r2=1096830&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Apr 26 18:08:31 2011
@@ -639,6 +639,7 @@ static svn_error_t *
walker_helper(svn_wc__db_t *db,
const char *dir_abspath,
svn_boolean_t show_hidden,
+ const apr_hash_t *changelists,
svn_wc__node_found_func_t walk_callback,
void *walk_baton,
svn_depth_t depth,
@@ -690,8 +691,10 @@ walker_helper(svn_wc__db_t *db,
/* Return the child, if appropriate. (For a directory,
* this is the first visit: as a child.) */
- if (child_kind == svn_wc__db_kind_file
- || depth >= svn_depth_immediates)
+ if ( (child_kind == svn_wc__db_kind_file
+ || depth >= svn_depth_immediates)
+ && svn_wc__internal_changelist_match(db, child_abspath,
+ changelists, scratch_pool) )
{
svn_node_kind_t kind;
@@ -712,7 +715,7 @@ walker_helper(svn_wc__db_t *db,
if (depth == svn_depth_immediates)
depth_below_here = svn_depth_empty;
- SVN_ERR(walker_helper(db, child_abspath, show_hidden,
+ SVN_ERR(walker_helper(db, child_abspath, show_hidden, changelists,
walk_callback, walk_baton,
depth_below_here, cancel_func, cancel_baton,
iterpool));
@@ -729,6 +732,7 @@ svn_error_t *
svn_wc__internal_walk_children(svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t show_hidden,
+ const apr_array_header_t *changelists,
svn_wc__node_found_func_t walk_callback,
void *walk_baton,
svn_depth_t walk_depth,
@@ -739,10 +743,15 @@ svn_wc__internal_walk_children(svn_wc__d
svn_wc__db_kind_t db_kind;
svn_node_kind_t kind;
svn_wc__db_status_t status;
+ apr_hash_t *changelist_hash = NULL;
SVN_ERR_ASSERT(walk_depth >= svn_depth_empty
&& walk_depth <= svn_depth_infinity);
+ if (changelists && changelists->nelts)
+ SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists,
+ scratch_pool));
+
/* Check if the node exists before the first callback */
SVN_ERR(svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
@@ -751,7 +760,10 @@ svn_wc__internal_walk_children(svn_wc__d
db, local_abspath, scratch_pool, scratch_pool));
SVN_ERR(convert_db_kind_to_node_kind(&kind, db_kind, status, show_hidden));
- SVN_ERR(walk_callback(local_abspath, kind, walk_baton, scratch_pool));
+
+ if (svn_wc__internal_changelist_match(db, local_abspath,
+ changelist_hash, scratch_pool))
+ SVN_ERR(walk_callback(local_abspath, kind, walk_baton, scratch_pool));
if (db_kind == svn_wc__db_kind_file
|| status == svn_wc__db_status_not_present
@@ -762,7 +774,8 @@ svn_wc__internal_walk_children(svn_wc__d
if (db_kind == svn_wc__db_kind_dir)
{
return svn_error_return(
- walker_helper(db, local_abspath, show_hidden, walk_callback, walk_baton,
+ walker_helper(db, local_abspath, show_hidden, changelist_hash,
+ walk_callback, walk_baton,
walk_depth, cancel_func, cancel_baton, scratch_pool));
}
@@ -785,7 +798,7 @@ svn_wc__node_walk_children(svn_wc_contex
{
return svn_error_return(
svn_wc__internal_walk_children(wc_ctx->db, local_abspath, show_hidden,
- walk_callback, walk_baton, walk_depth,
+ NULL, walk_callback, walk_baton, walk_depth,
cancel_func, cancel_baton, scratch_pool));
}
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1096830&r1=1096829&r2=1096830&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 18:08:31 2011
@@ -2008,7 +2008,6 @@ do_propset(svn_wc__db_t *db,
const char *name,
const svn_string_t *value,
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,10 +2020,6 @@ do_propset(svn_wc__db_t *db,
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- 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,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -2186,7 +2181,6 @@ struct propset_walk_baton
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;
};
@@ -2207,8 +2201,7 @@ propset_walk_cb(const char *local_abspat
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);
+ wb->force, 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))
{
@@ -2232,7 +2225,6 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
apr_pool_t *scratch_pool)
{
enum svn_prop_kind prop_kind = svn_property_kind(NULL, name);
- apr_hash_t *changelist_hash = NULL;
svn_wc__db_kind_t kind;
const char *dir_abspath;
@@ -2264,27 +2256,28 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
SVN_ERR(svn_wc__write_check(wc_ctx->db, dir_abspath, scratch_pool));
- if (changelists && changelists->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists,
- scratch_pool));
-
if (depth == svn_depth_empty)
{
+ apr_hash_t *changelist_hash = NULL;
+
+ if (changelists && changelists->nelts)
+ SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists,
+ scratch_pool));
+
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));
+ 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 };
+ notify_func, notify_baton };
- SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
+ SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath,
+ FALSE, changelists,
propset_walk_cb, &wb,
depth,
NULL, NULL, /* cancellation */
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1096830&r1=1096829&r2=1096830&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Apr 26 18:08:31 2011
@@ -580,11 +580,13 @@ svn_wc__internal_walk_status(svn_wc__db_
void *cancel_baton,
apr_pool_t *scratch_pool);
-/* Library-internal version of svn_wc__node_walk_children(), which see. */
+/* Library-internal version of svn_wc__node_walk_children(), which see.
+ If CHANGELISTS is non-NULL and non-empty, filter thereon. */
svn_error_t *
svn_wc__internal_walk_children(svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t show_hidden,
+ const apr_array_header_t *changelists,
svn_wc__node_found_func_t walk_callback,
void *walk_baton,
svn_depth_t walk_depth,