subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1451326 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Date Thu, 28 Feb 2013 20:16:08 GMT
Author: rhuijben
Date: Thu Feb 28 20:16:08 2013
New Revision: 1451326

URL: http://svn.apache.org/r1451326
Log:
Simplify some 'can we record a move' calculations, to avoid scheduling unneeded
db queries during delete processing.

* subversion/libsvn_wc/wc_db.c
  (delete_update_movedto): Assert that the query matches a row.

  (delete_node): Properly calculate when we can track moves and when not to
    avoid performing unneeded database queries.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1451326&r1=1451325&r2=1451326&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb 28 20:16:08 2013
@@ -7373,6 +7373,7 @@ delete_update_movedto(svn_wc__db_wcroot_
                       apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
+  int affected;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_UPDATE_MOVED_TO_RELPATH));
@@ -7382,7 +7383,8 @@ delete_update_movedto(svn_wc__db_wcroot_
                             child_moved_from_relpath,
                             op_depth,
                             new_moved_to_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+  SVN_ERR(svn_sqlite__update(&affected, stmt));
+  assert(affected == 1);
 
   return SVN_NO_ERROR;
 }
@@ -7498,7 +7500,6 @@ delete_node(void *baton,
   if (b->moved_to_relpath)
     {
       const char *moved_from_relpath = NULL;
-      const char *moved_from_op_root_relpath = NULL;
       struct moved_node_t *moved_node;
       int move_op_depth;
 
@@ -7511,33 +7512,37 @@ delete_node(void *baton,
       if (status == svn_wc__db_status_added)
         SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
                               &moved_from_relpath,
-                              &moved_from_op_root_relpath,
+                              NULL,
                               &move_op_depth,
                               wcroot, local_relpath,
                               scratch_pool, scratch_pool));
 
       moved_node = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
-      if (!moved_from_relpath
-          || status != svn_wc__db_status_moved_here
-          || strcmp(moved_from_op_root_relpath, moved_from_relpath))
+
+      if (op_root && moved_from_relpath)
         {
-          /* The node is becoming a move-root for the first time,
-           * possibly because of a nested move operation. */
-          moved_node = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
-          moved_node->local_relpath = local_relpath;
-          moved_node->op_depth = delete_depth;
+          /* Existing move-root is moved to another location */
+          moved_node->local_relpath = moved_from_relpath;
+          moved_node->op_depth = move_op_depth;
           moved_node->moved_to_relpath = b->moved_to_relpath;
 
           APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
         }
-      else
+      else if (!op_root && (status == svn_wc__db_status_normal
+                            || status == svn_wc__db_status_copied
+                            || status == svn_wc__db_status_moved_here))
         {
-          moved_node->local_relpath = moved_from_relpath;
-          moved_node->op_depth = move_op_depth;
+          /* The node is becoming a move-root for the first time,
+           * possibly because of a nested move operation. */
+          moved_node = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
+          moved_node->local_relpath = local_relpath;
+          moved_node->op_depth = delete_depth;
           moved_node->moved_to_relpath = b->moved_to_relpath;
 
           APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
         }
+      /* Else: We can't track history of local additions and/or of things we are
+               about to delete. */
 
       /* If a subtree is being moved-away from this subtree,
        * update moved-to information after the delete */



Mime
View raw message