Author: rhuijben
Date: Sat Feb 21 13:57:19 2015
New Revision: 1661363

URL: http://svn.apache.org/r1661363
Log:
Following up on r1660781 and r1661335 make committing a shadowing operation
properly clean up locks stored in the working copy.

Of course all conditional on no-unlock.

This resolves an XFail issue tested for in lock_tests.py

* subversion/libsvn_client/commit.c
  (post_process_commit_item): When committing an explicit ADD or DELETE,
     assume that we should (try to) remove the locks

* subversion/libsvn_wc/wc_db.c
  (db_base_remove): Just call internal function.
  (commit_node): When committing an op_root (of a shadowing operation),
     clear local locks recursively.

* subversion/tests/cmdline/lock_tests.py
  (break_delete_add): Remove XFail marker.

Modified:
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/cmdline/lock_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1661363&r1=1661362&r2=1661363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Sat Feb 21 13:57:19 2015
@@ -240,7 +240,9 @@ post_process_commit_item(svn_wc_committe
     loop_recurse = TRUE;
 
   remove_lock = (! keep_locks && (item->state_flags
-                                       & SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN));
+                                       & (SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN
+                                          | SVN_CLIENT_COMMIT_ITEM_ADD
+                                          | SVN_CLIENT_COMMIT_ITEM_DELETE)));
 
   /* When the node was deleted (or replaced), we need to always remove the
      locks, as they're invalidated on the server. We cannot honor the

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1661363&r1=1661362&r2=1661363&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat Feb 21 13:57:19 2015
@@ -2142,12 +2142,9 @@ db_base_remove(svn_wc__db_wcroot_t *wcro
   if (status == svn_wc__db_status_normal
       && keep_as_working)
     {
-      SVN_ERR(svn_wc__db_op_make_copy(db,
-                                      svn_dirent_join(wcroot->abspath,
-                                                      local_relpath,
-                                                      scratch_pool),
-                                      NULL, NULL,
-                                      scratch_pool));
+      SVN_ERR(svn_wc__db_op_make_copy_internal(wcroot, local_relpath,
+                                               NULL, NULL,
+                                               scratch_pool));
       keep_working = TRUE;
     }
   else
@@ -11778,9 +11775,18 @@ commit_node(svn_wc__db_wcroot_t *wcroot,
   if (!no_unlock)
     {
       svn_sqlite__stmt_t *lock_stmt;
+      svn_boolean_t op_root = (op_depth > 0
+                               && (relpath_depth(local_relpath) == op_depth));
 
+      /* If we are committing an add of a delete, we can assume we own
+         all locks at or below REPOS_RELPATH (or the server would have
+         denied the commit). As we must have passed these to the server
+         we can now safely remove them.
+       */
       SVN_ERR(svn_sqlite__get_statement(&lock_stmt, wcroot->sdb,
-                                        STMT_DELETE_LOCK));
+                                        op_root
+                                          ? STMT_DELETE_LOCK_RECURSIVELY
+                                          : STMT_DELETE_LOCK));
       SVN_ERR(svn_sqlite__bindf(lock_stmt, "is", repos_id, repos_relpath));
       SVN_ERR(svn_sqlite__step_done(lock_stmt));
     }

Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1661363&r1=1661362&r2=1661363&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Sat Feb 21 13:57:19 
2015
@@ -1997,7 +1997,6 @@ def failing_post_hooks(sbox):
                                      'unlock', pi_path)
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
-@XFail()
 def break_delete_add(sbox):
   "break a lock, delete and add the file"
 


Reply via email to