subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1094672 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c
Date Mon, 18 Apr 2011 17:43:25 GMT
Author: rhuijben
Date: Mon Apr 18 17:43:24 2011
New Revision: 1094672

URL: http://svn.apache.org/viewvc?rev=1094672&view=rev
Log:
Only use the expensive STMT_DELETE_SHADOWED_RECURSIVE query when we know that
we have to remove lower layers.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_ALL_LAYERS): New query.

* subversion/libsvn_wc/wc_db.c
  (commit_node): When STMT_DELETE_ALL_LAYERS affects more then 1 row, we have
    a shadowing operation. Only then use STMT_DELETE_ALL_LAYERS.

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=1094672&r1=1094671&r2=1094672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon Apr 18 17:43:24 2011
@@ -453,6 +453,10 @@ 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_ALL_LAYERS
+DELETE FROM nodes
+WHERE wc_id = ?1 AND local_relpath = ?2
+
 -- STMT_DELETE_NODES
 DELETE FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1094672&r1=1094671&r2=1094672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Apr 18 17:43:24 2011
@@ -6884,31 +6884,41 @@ commit_node(void *baton,
 
   if (op_depth > 0)
     {
-      /* Do we commit a shadowing operation? 
+      int affected_rows;
+
+      /* This removes all layers of this node and at the same time determines
+         if we need to remove shadowed layers below our descendants. */
+
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_DELETE_ALL_LAYERS));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+      if (affected_rows > 1)
+        {
+          /* We commit a shadowing operation
 
-         If yes then:
            1) Remove all shadowed nodes
            2) And remove all nodes that have a base-deleted as lowest layer,
               because 1) removed that layer
 
-         Possible followup:
-           3) ### Collapse descendants of the current op_depth in layer 0, 
-                  to commit a remote copy in one step (but don't touch/use
-                  ACTUAL!!)
-       */
-
-      svn_sqlite__stmt_t *delete_stmt;
+           Possible followup:
+             3) ### Collapse descendants of the current op_depth in layer 0,
+                    to commit a remote copy in one step (but don't touch/use
+                    ACTUAL!!)
+          */
 
-      SVN_ERR(svn_sqlite__get_statement(&delete_stmt, wcroot->sdb,
-                                        STMT_DELETE_SHADOWED_RECURSIVE));
+          SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                            STMT_DELETE_SHADOWED_RECURSIVE));
 
-      SVN_ERR(svn_sqlite__bindf(delete_stmt,
-                                "isi",
-                                wcroot->wc_id,
-                                local_relpath,
-                                op_depth));
+          SVN_ERR(svn_sqlite__bindf(stmt,
+                                    "isi",
+                                    wcroot->wc_id,
+                                    local_relpath,
+                                    op_depth));
 
-      SVN_ERR(svn_sqlite__step_done(delete_stmt));
+          SVN_ERR(svn_sqlite__step_done(stmt));
+        }
     }
 
   /* Update or add the BASE_NODE row with all the new information.  */
@@ -6945,17 +6955,6 @@ commit_node(void *baton,
 
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-  if (op_depth > 0)
-    {
-      /* This removes all op_depth  0 and so does both layers of a
-         two-layer replace. */
-
-      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                        STMT_DELETE_ALL_WORKING_NODES));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-      SVN_ERR(svn_sqlite__step_done(stmt));
-    }
-
   if (have_act)
     {
       if (cb->keep_changelist && changelist != NULL)



Mime
View raw message