Author: cmpilato
Date: Wed May 18 20:10:18 2011
New Revision: 1124404

URL: http://svn.apache.org/viewvc?rev=1124404&view=rev
Log:
With rhuijben, fix issue #3886 ("'svn revert' of switched tree lock
acquisition regression").

* subversion/libsvn_wc/update_editor.c
  (svn_wc__strictly_is_wc_root): Rework in terms of svn_wc__db_is_wcroot().

* subversion/libsvn_client/revert.c
  (svn_client_revert2): Lock the parent directory of the switch
    target, unless it happens to be a true working copy root.

Modified:
    subversion/trunk/subversion/libsvn_client/revert.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c

Modified: subversion/trunk/subversion/libsvn_client/revert.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/revert.c?rev=1124404&r1=1124403&r2=1124404&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/revert.c (original)
+++ subversion/trunk/subversion/libsvn_client/revert.c Wed May 18 20:10:18 2011
@@ -147,7 +147,8 @@ svn_client_revert2(const apr_array_heade
   for (i = 0; i < paths->nelts; i++)
     {
       const char *path = APR_ARRAY_IDX(paths, i, const char *);
-      const char *local_abspath;
+      const char *local_abspath, *lock_target;
+      svn_boolean_t wc_root;
 
       svn_pool_clear(subpool);
 
@@ -163,8 +164,13 @@ svn_client_revert2(const apr_array_heade
       baton.use_commit_times = use_commit_times;
       baton.changelists = changelists;
       baton.ctx = ctx;
+
+      SVN_ERR(svn_wc__strictly_is_wc_root(&wc_root, ctx->wc_ctx,
+                                          local_abspath, pool));
+      lock_target = wc_root ? local_abspath
+                            : svn_dirent_dirname(local_abspath, pool);
       err = svn_wc__call_with_write_lock(revert, &baton, ctx->wc_ctx,
-                                         local_abspath, TRUE, pool, pool);
+                                         lock_target, FALSE, pool, pool);
       if (err)
         goto errorful;
     }

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1124404&r1=1124403&r2=1124404&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Wed May 18 20:10:18 
2011
@@ -5027,10 +5027,10 @@ svn_wc__strictly_is_wc_root(svn_boolean_
                             const char *local_abspath,
                             apr_pool_t *scratch_pool)
 {
-  return svn_error_return(
-             svn_wc__check_wc_root(wc_root, NULL, NULL,
-                                   wc_ctx->db, local_abspath,
-                                   scratch_pool));
+  return svn_error_return(svn_wc__db_is_wcroot(wc_root,
+                                               wc_ctx->db,
+                                               local_abspath,
+                                               scratch_pool));
 }
 
 


Reply via email to