You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/12/19 13:28:07 UTC

svn commit: r1423840 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c tests/cmdline/revert_tests.py

Author: rhuijben
Date: Wed Dec 19 12:28:06 2012
New Revision: 1423840

URL: http://svn.apache.org/viewvc?rev=1423840&view=rev
Log:
Resolve issue #4168, by detecting working copy roots when handling the final
step of reverts.

* subversion/libsvn_wc/adm_ops.c
  (revert_restore): Add revert_root argument and detect obstructing working
    copies if not reverting explicit targets. Update recursion
  (revert_internal): Update caller.

* subversion/tests/cmdline/revert_tests.py
  (revert_obstructing_wc): Update expected result.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/tests/cmdline/revert_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1423840&r1=1423839&r2=1423840&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Wed Dec 19 12:28:06 2012
@@ -1578,12 +1578,17 @@ revert_restore_handle_copied_dirs(svn_bo
 /* Make the working tree under LOCAL_ABSPATH to depth DEPTH match the
    versioned tree.  This function is called after svn_wc__db_op_revert
    has done the database revert and created the revert list.  Notifies
-   for all paths equal to or below LOCAL_ABSPATH that are reverted. */
+   for all paths equal to or below LOCAL_ABSPATH that are reverted.
+
+   REVERT_ROOT is true for explicit revert targets and FALSE for targets
+   reached via recursion.
+ */
 static svn_error_t *
 revert_restore(svn_wc__db_t *db,
                const char *local_abspath,
                svn_depth_t depth,
                svn_boolean_t use_commit_times,
+               svn_boolean_t revert_root,
                svn_cancel_func_t cancel_func,
                void *cancel_baton,
                svn_wc_notify_func2_t notify_func,
@@ -1604,10 +1609,31 @@ revert_restore(svn_wc__db_t *db,
 #endif
   svn_boolean_t copied_here;
   svn_kind_t reverted_kind;
+  svn_boolean_t is_wcroot;
 
   if (cancel_func)
     SVN_ERR(cancel_func(cancel_baton));
 
+  SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath, scratch_pool));
+  if (is_wcroot && !revert_root)
+    {
+      /* Issue #4162: Obstructing working copy. We can't access the working
+         copy data from the parent working copy for this node by just using
+         local_abspath */
+
+      if (notify_func)
+        {
+          svn_wc_notify_t *notify = svn_wc_create_notify(
+                                        local_abspath,
+                                        svn_wc_notify_update_skip_obstruction,
+                                        scratch_pool);
+
+          notify_func(notify_baton, notify, scratch_pool);
+        }
+
+      return SVN_NO_ERROR; /* We don't revert obstructing working copies */
+    }
+
   SVN_ERR(svn_wc__db_revert_list_read(&notify_required,
                                       &conflict_files,
                                       &copied_here, &reverted_kind,
@@ -1920,7 +1946,7 @@ revert_restore(svn_wc__db_t *db,
                                           iterpool);
 
           SVN_ERR(revert_restore(db, child_abspath, depth,
-                                 use_commit_times,
+                                 use_commit_times, FALSE /* revcert root */,
                                  cancel_func, cancel_baton,
                                  notify_func, notify_baton,
                                  iterpool));
@@ -1974,7 +2000,7 @@ revert_internal(svn_wc__db_t *db,
 
   if (!err)
     err = revert_restore(db, local_abspath, depth,
-                         use_commit_times,
+                         use_commit_times, TRUE /* revert root */,
                          cancel_func, cancel_baton,
                          notify_func, notify_baton,
                          scratch_pool);

Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1423840&r1=1423839&r2=1423840&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Wed Dec 19 12:28:06 2012
@@ -1617,7 +1617,6 @@ def revert_nonexistent(sbox):
   svntest.actions.run_and_verify_svn(None, 'Skipped.*nonexistent', [],
                                      'revert', '-R', sbox.ospath('nonexistent'))
 
-@XFail()
 @Issue(4168)
 def revert_obstructing_wc(sbox):
   "revert with an obstructing working copy"
@@ -1657,8 +1656,11 @@ def revert_obstructing_wc(sbox):
                                         None, None, None,
                                         wc_dir, '--set-depth', 'infinity')
 
-  # Revert should do nothing (no local changes), but currently reports an error
-  svntest.actions.run_and_verify_revert([], '-R', wc_dir)
+  # Revert should do nothing (no local changes), and report the obstruction
+  # (reporting the obstruction is nice for debuging, but not really required
+  #  in this specific case, as the node was not modified)
+  svntest.actions.run_and_verify_svn(None, "Skipped '.*A' -- .*obstruct.*", [],
+                                     'revert', '-R', wc_dir)
 
 
 ########################################################################