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 2010/11/02 12:19:35 UTC

svn commit: r1030003 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c

Author: philip
Date: Tue Nov  2 11:19:34 2010
New Revision: 1030003

URL: http://svn.apache.org/viewvc?rev=1030003&view=rev
Log:
Make the "delete working node" query only act on a single op_depth.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_WORKING_NODES): Rename to...
  (STMT_DELETE_WORKING_NODE): ...this, select max(op_depth).
  (STMT_DELETE_ALL_WORKING_NODES): New.
  (STMT_DELETE_OP_DEPTH_NODES): Remove.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_temp_op_remove_working,
   db_working_actual_remove, make_copy_txn): Use STMT_DELETE_WORKING_NODE.
  (commit_node): Use STMT_DELETE_ALL_WORKING_NODES.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.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=1030003&r1=1030002&r2=1030003&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Nov  2 11:19:34 2010
@@ -291,13 +291,15 @@ WHERE wc_id = ?1 AND local_relpath = ?2
 DELETE FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
 
--- STMT_DELETE_WORKING_NODES
+-- STMT_DELETE_WORKING_NODE
 DELETE FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0;
+WHERE wc_id = ?1 AND local_relpath = ?2
+  AND op_depth = (SELECT MAX(op_depth) FROM nodes
+                  WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0);
 
--- STMT_DELETE_OP_DEPTH_NODES
+-- STMT_DELETE_ALL_WORKING_NODES
 DELETE FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3;
+WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0;
 
 -- STMT_DELETE_NODES
 DELETE FROM nodes

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1030003&r1=1030002&r2=1030003&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Nov  2 11:19:34 2010
@@ -4456,7 +4456,7 @@ svn_wc__db_temp_op_remove_working(svn_wc
   SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                    STMT_DELETE_WORKING_NODES));
+                                    STMT_DELETE_WORKING_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
@@ -4590,16 +4590,10 @@ db_working_actual_remove(svn_wc__db_pdh_
                          apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
-#ifdef SVN_WC__OP_DEPTH
-  apr_int64_t op_depth = relpath_depth(local_relpath);
-#else
-  apr_int64_t op_depth = 2;  /* ### temporary op_depth */
-#endif
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                                    STMT_DELETE_OP_DEPTH_NODES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "isi", pdh->wcroot->wc_id,
-                            local_relpath, op_depth));
+                                    STMT_DELETE_WORKING_NODE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
@@ -6023,8 +6017,10 @@ commit_node(void *baton, svn_sqlite__db_
 
   if (have_work)
     {
+      /* This removes all op_depth > 0 and so does both layers of a
+         two-layer replace. */
       SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
-                                        STMT_DELETE_WORKING_NODES));
+                                        STMT_DELETE_ALL_WORKING_NODES));
       SVN_ERR(svn_sqlite__bindf(stmt, "is",
                                 cb->pdh->wcroot->wc_id, cb->local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
@@ -8767,7 +8763,7 @@ make_copy_txn(void *baton,
   if (remove_working)
     {
       SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
-                                        STMT_DELETE_WORKING_NODES));
+                                        STMT_DELETE_WORKING_NODE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is",
                                 mcb->pdh->wcroot->wc_id,
                                 mcb->local_relpath));