You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/08/14 22:51:18 UTC
svn commit: r1373083 - in /subversion/branches/inheritable-props/subversion:
libsvn_client/switch.c libsvn_wc/wc_db.c
Author: pburba
Date: Tue Aug 14 20:51:18 2012
New Revision: 1373083
URL: http://svn.apache.org/viewvc?rev=1373083&view=rev
Log:
On the inheritable-props branch: Don't continue to cache iprops for switched
nodes when they are unswitched.
* subversion/libsvn_client/switch.c
(switch_internal): If a switch is "unswitching" a previously switched node,
then don't keep caching inherited properties as if the node is a WC root.
* subversion/libsvn_wc/wc_db.c
(db_op_set_rev_repos_relpath_iprops): Support clearing as well as setting
the iprops cache.
Modified:
subversion/branches/inheritable-props/subversion/libsvn_client/switch.c
subversion/branches/inheritable-props/subversion/libsvn_wc/wc_db.c
Modified: subversion/branches/inheritable-props/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_client/switch.c?rev=1373083&r1=1373082&r2=1373083&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_client/switch.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_client/switch.c Tue Aug 14 20:51:18 2012
@@ -220,11 +220,52 @@ switch_internal(svn_revnum_t *result_rev
svn_dirent_dirname(local_abspath, pool));
}
- SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
- "", switch_loc->rev, pool));
wcroot_iprops = apr_hash_make(pool);
- apr_hash_set(wcroot_iprops, local_abspath, APR_HASH_KEY_STRING,
- inherited_props);
+
+ /* Will the base of LOCAL_ABSPATH require an iprop cache post-switch?
+ If we are switching LOCAL_ABSPATH to the root of the repository then
+ we don't need to cache inherited properties. In all other cases we
+ *might* need to cache iprops. */
+ if (strcmp(switch_loc->repos_root_url, switch_loc->url) != 0)
+ {
+ svn_boolean_t wc_root;
+ svn_boolean_t needs_iprop_cache = TRUE;
+
+ SVN_ERR(svn_wc__strictly_is_wc_root(&wc_root,
+ ctx->wc_ctx,
+ local_abspath,
+ pool));
+
+ /* Switching the WC root to anything but the repos root means
+ we need an iprop cache. */
+ if (!wc_root)
+ {
+ const char *switch_parent_url =
+ svn_uri_dirname(switch_loc->url, pool);
+ const char *target_parent_url;
+
+ SVN_ERR(svn_wc__node_get_url(&target_parent_url, ctx->wc_ctx,
+ svn_dirent_dirname(local_abspath,
+ pool),
+ pool, pool));
+
+
+ /* We know we are switching a subtree to something other than the
+ repos root, but if we are unswitching that subtree we don't
+ need an iprops cache. */
+ if (strcmp(switch_parent_url, target_parent_url) == 0)
+ needs_iprop_cache = FALSE;
+ }
+
+
+ if (needs_iprop_cache)
+ {
+ SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
+ "", switch_loc->rev, pool));
+ apr_hash_set(wcroot_iprops, local_abspath, APR_HASH_KEY_STRING,
+ inherited_props);
+ }
+ }
SVN_ERR(svn_ra_reparent(ra_session, anchor_url, pool));
Modified: subversion/branches/inheritable-props/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_wc/wc_db.c?rev=1373083&r1=1373082&r2=1373083&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_wc/wc_db.c Tue Aug 14 20:51:18 2012
@@ -10280,7 +10280,8 @@ svn_wc__db_global_update(svn_wc__db_t *d
propertis. If LOCAL_ABSPATH's rev (REV) is valid, set its revision. If
SET_REPOS_RELPATH is TRUE set its repository relative path to REPOS_RELPATH
(and make sure its REPOS_ID is still valid). If IPROPS is not NULL set its
- inherited properties to IPROPS.
+ inherited properties to IPROPS, it IPROPS is NULL then clear any the iprops
+ cache for the base node.
*/
static svn_error_t *
db_op_set_rev_repos_relpath_iprops(svn_wc__db_wcroot_t *wcroot,
@@ -10322,16 +10323,14 @@ db_op_set_rev_repos_relpath_iprops(svn_w
SVN_ERR(svn_sqlite__step_done(stmt));
}
- if (iprops)
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_UPDATE_IPROP));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- wcroot->wc_id,
- local_relpath));
- SVN_ERR(svn_sqlite__bind_iprops(stmt, 3, iprops, scratch_pool));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
+ /* Set or clear iprops. */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_UPDATE_IPROP));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is",
+ wcroot->wc_id,
+ local_relpath));
+ SVN_ERR(svn_sqlite__bind_iprops(stmt, 3, iprops, scratch_pool));
+ SVN_ERR(svn_sqlite__step_done(stmt));
return SVN_NO_ERROR;
}