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/25 16:26:44 UTC

svn commit: r1096490 - /subversion/trunk/subversion/libsvn_wc/props.c

Author: hwright
Date: Mon Apr 25 14:26:44 2011
New Revision: 1096490

URL: http://svn.apache.org/viewvc?rev=1096490&view=rev
Log:
Move the write check for propsets to before the node walker, rather than
for every node in the node walker.  Add an explanitory comment as to why this
is possible.

* subversion/libsvn_wc/props.c
  (do_propset): Remove write check.
  (svn_wc_prop_set4): Move the write check here, add comment.

Modified:
    subversion/trunk/subversion/libsvn_wc/props.c

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1096490&r1=1096489&r2=1096490&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Mon Apr 25 14:26:44 2011
@@ -2018,7 +2018,6 @@ do_propset(svn_wc__db_t *db,
   svn_wc_notify_action_t notify_action;
   svn_wc__db_kind_t kind;
   svn_wc__db_status_t status;
-  const char *dir_abspath;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -2034,13 +2033,6 @@ do_propset(svn_wc__db_t *db,
                                db, local_abspath,
                                scratch_pool, scratch_pool));
 
-  if (kind == svn_wc__db_kind_dir)
-    dir_abspath = local_abspath;
-  else
-    dir_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
-
-  SVN_ERR(svn_wc__write_check(db, dir_abspath, scratch_pool));
-
   if (prop_kind == svn_prop_wc_kind)
     return svn_error_return(wcprop_set(db, local_abspath, name, value,
                                        scratch_pool));
@@ -2257,12 +2249,29 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
 {
   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;
 
   /* we don't do entry properties here */
   if (prop_kind == svn_prop_entry_kind)
     return svn_error_createf(SVN_ERR_BAD_PROP_KIND, NULL,
                              _("Property '%s' is an entry property"), name);
 
+  /* We have to do this little DIR_ABSPATH dance for backwards compat.
+     But from 1.7 onwards, all locks are of infinite depth, and from 1.6
+     backward we never call this API with depth > empty, so we only need
+     to do the write check once per call, here (and not for every node in
+     the node walker). */
+  SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath, TRUE,
+                               scratch_pool));
+
+  if (kind == svn_wc__db_kind_dir)
+    dir_abspath = local_abspath;
+  else
+    dir_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+
+  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));