You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/04/04 12:36:14 UTC

svn commit: r1088547 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/entries-compat.c

Author: philip
Date: Mon Apr  4 10:36:13 2011
New Revision: 1088547

URL: http://svn.apache.org/viewvc?rev=1088547&view=rev
Log:
Make the new revert code remove access baton locks for nodes that
get removed.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_WC_LOCK_ORPHAN, STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE): New.

* subversion/libsvn_wc/wc_db.c
  (op_revert_txn, op_revert_recursive_txn): Delete wc locks.

* subversion/tests/libsvn_wc/entries-compat.c
  (test_access_baton_like_locking): Check parent lock still exists after
   revert, check delete removes locks.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1088547&r1=1088546&r2=1088547&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon Apr  4 10:36:13 2011
@@ -582,6 +582,21 @@ WHERE wc_id = ?1 AND local_dir_relpath =
 SELECT local_dir_relpath FROM wc_lock
 WHERE wc_id = ?1 AND local_dir_relpath LIKE ?2 ESCAPE '#'
 
+-- STMT_DELETE_WC_LOCK_ORPHAN
+DELETE FROM wc_lock
+WHERE wc_id = ?1 AND local_dir_relpath = ?2
+AND NOT EXISTS (SELECT 1 FROM nodes
+                 WHERE nodes.wc_id = ?1 AND nodes.wc_id = wc_lock.wc_id
+                   AND nodes.local_relpath = wc_lock.local_dir_relpath)
+
+-- STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE
+DELETE FROM wc_lock
+WHERE wc_id = ?1
+AND (local_dir_relpath = ?2 OR local_dir_relpath LIKE ?3 ESCAPE '#')
+AND NOT EXISTS (SELECT 1 FROM nodes
+                 WHERE nodes.wc_id = ?1 AND nodes.wc_id = wc_lock.wc_id
+                   AND nodes.local_relpath = wc_lock.local_dir_relpath)
+
 -- STMT_APPLY_CHANGES_TO_BASE_NODE
 /* translated_size and last_mod_time are not mentioned here because they will
    be tweaked after the working-file is installed.

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1088547&r1=1088546&r2=1088547&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Apr  4 10:36:13 2011
@@ -3589,6 +3589,11 @@ op_revert_txn(void *baton,
                                         STMT_DELETE_WORKING_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
+
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_DELETE_WC_LOCK_ORPHAN));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
     }
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -3679,6 +3684,12 @@ op_revert_recursive_txn(void *baton,
                             local_relpath, like_arg));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_DELETE_WC_LOCK_ORPHAN_RECURSIVE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
+                            local_relpath, like_arg));
+  SVN_ERR(svn_sqlite__step_done(stmt));
+
   return SVN_NO_ERROR;
 }
 
@@ -3730,6 +3741,10 @@ svn_wc__db_op_revert(svn_wc__db_t *db,
                                  svn_sqlite__exec_statements(wcroot->sdb,
                                                STMT_DROP_REVERT_LIST_TRIGGERS));
 
+  err = svn_error_compose_create(err,
+                                 flush_entries(wcroot, local_abspath,
+                                               scratch_pool));
+
   return err;
 }
 

Modified: subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c?rev=1088547&r1=1088546&r2=1088547&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c Mon Apr  4 10:36:13 2011
@@ -540,18 +540,29 @@ test_access_baton_like_locking(apr_pool_
   SVN_ERR(svn_wc_adm_retrieve(&subdir_access, adm_access, D2, pool));
   SVN_ERR(svn_wc_add3(D3, subdir_access, svn_depth_infinity, NULL,
                       SVN_INVALID_REVNUM, NULL, NULL, NULL, NULL, pool));
+  SVN_ERR(svn_wc_add3(D4, subdir_access, svn_depth_infinity, NULL,
+                      SVN_INVALID_REVNUM, NULL, NULL, NULL, NULL, pool));
   SVN_ERR(svn_wc_locked(&locked, D3, pool));
   SVN_TEST_ASSERT(locked);
+  SVN_ERR(svn_wc_locked(&locked, D4, pool));
+  SVN_TEST_ASSERT(locked);
+  SVN_ERR(svn_wc_delete3(D4, subdir_access, NULL, NULL, NULL, NULL, FALSE,
+                         pool));
+  SVN_ERR(svn_wc_locked(&locked, D4, pool));
+  SVN_TEST_ASSERT(!locked);
   SVN_ERR(svn_wc_revert3(D, adm_access, svn_depth_infinity, FALSE,
                          NULL, NULL, NULL, NULL, NULL, pool));
   SVN_ERR(svn_wc_locked(&locked, D3, pool));
   SVN_TEST_ASSERT(!locked);
+  SVN_ERR(svn_wc_locked(&locked, local_abspath, pool));
+  SVN_TEST_ASSERT(locked);
   SVN_ERR(svn_wc_adm_close2(adm_access, pool));
 
   SVN_ERR(svn_wc_context_create(&wc_ctx, NULL, pool, pool));
 
   /* Obtain a lock for the root, which is extended on each level */
   SVN_ERR(svn_wc__db_wclock_obtain(wc_ctx->db, local_abspath, 0, FALSE, pool));
+  SVN_ERR(svn_io_make_dir_recursively(D4, pool));
   SVN_ERR(svn_wc_add4(wc_ctx, D, svn_depth_infinity, NULL, SVN_INVALID_REVNUM,
                       NULL, NULL, NULL, NULL, pool));
   SVN_ERR(svn_wc_add4(wc_ctx, D1, svn_depth_infinity, NULL, SVN_INVALID_REVNUM,