You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/11/05 17:05:51 UTC

svn commit: r1539041 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db_update_move.c

Author: rhuijben
Date: Tue Nov  5 16:05:50 2013
New Revision: 1539041

URL: http://svn.apache.org/r1539041
Log:
When bumping an updated tree don't assume the origin is always BASE, as this
same function should also used for recursive move updates.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_HAS_NON_FILE_CHILDREN,
   STMT_SELECT_HAS_GRANDCHILDREN): Make op_depth an argument. Limit results to help Sqlite.

* subversion/libsvn_wc/wc_db_update_move.c
  (depth_sufficient_to_bump): Order arguments properly. Add op_depth argument.
  (bump_moved_away): Update documentation for this and expected followup.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.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=1539041&r1=1539040&r2=1539041&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Nov  5 16:05:50 2013
@@ -1631,14 +1631,16 @@ ORDER BY local_relpath
 
 -- STMT_SELECT_HAS_NON_FILE_CHILDREN
 SELECT 1 FROM nodes
-WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 AND kind != MAP_FILE
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = ?3 AND kind != MAP_FILE
+LIMIT 1
 
 -- STMT_SELECT_HAS_GRANDCHILDREN
 SELECT 1 FROM nodes
 WHERE wc_id = ?1
   AND IS_STRICT_DESCENDANT_OF(parent_relpath, ?2)
-  AND op_depth = 0
+  AND op_depth = ?3
   AND file_external IS NULL
+LIMIT 1
 
 /* ------------------------------------------------------------------------- */
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1539041&r1=1539040&r2=1539041&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Tue Nov  5 16:05:50 2013
@@ -2033,11 +2033,12 @@ svn_wc__db_update_moved_away_conflict_vi
 }
 
 /* Set *CAN_BUMP to TRUE if DEPTH is sufficient to cover the entire
-   BASE tree at LOCAL_RELPATH, to FALSE otherwise. */
+   tree  LOCAL_RELPATH at OP_DEPTH, to FALSE otherwise. */
 static svn_error_t *
 depth_sufficient_to_bump(svn_boolean_t *can_bump,
-                         const char *local_relpath,
                          svn_wc__db_wcroot_t *wcroot,
+                         const char *local_relpath,
+                         int op_depth,
                          svn_depth_t depth,
                          apr_pool_t *scratch_pool)
 {
@@ -2054,21 +2055,21 @@ depth_sufficient_to_bump(svn_boolean_t *
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_SELECT_OP_DEPTH_CHILDREN));
       SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
-                                local_relpath, 0));
+                                local_relpath, op_depth));
       break;
 
     case svn_depth_files:
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_SELECT_HAS_NON_FILE_CHILDREN));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
-                                local_relpath));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+                                local_relpath, op_depth));
       break;
 
     case svn_depth_immediates:
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_SELECT_HAS_GRANDCHILDREN));
-      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
-                                local_relpath));
+      SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+                                local_relpath, op_depth));
       break;
     default:
       SVN_ERR_MALFUNCTION();
@@ -2140,10 +2141,12 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
   return SVN_NO_ERROR;
 }
 
-/* Bump LOCAL_RELPATH, and all the children of LOCAL_RELPATH, that are
-   moved-to at op-depth greater than OP_DEPTH.  SRC_DONE is a hash
-   with keys that are 'const char *' relpaths that have already been
-   bumped.  Any bumped paths are added to SRC_DONE. */
+/* Bump moves of LOCAL_RELPATH and all its descendants that were
+   originally below LOCAL_RELPATH at op-depth OP_DEPTH.
+
+   SRC_DONE is a hash with keys that are 'const char *' relpaths
+   that have already been bumped.  Any bumped paths are added to
+   SRC_DONE. */
 static svn_error_t *
 bump_moved_away(svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
@@ -2169,7 +2172,7 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
     {
       svn_sqlite__stmt_t *stmt2;
       const char *src_relpath, *dst_relpath;
-      int src_op_depth = svn_sqlite__column_int(stmt, 2);
+      int src_op_depth;
       svn_error_t *err;
       svn_skel_t *conflict;
       svn_depth_t src_depth = depth;
@@ -2178,6 +2181,7 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
 
       src_relpath = svn_sqlite__column_text(stmt, 0, iterpool);
       dst_relpath = svn_sqlite__column_text(stmt, 1, iterpool);
+      src_op_depth = svn_sqlite__column_int(stmt, 2);
 
       if (depth != svn_depth_infinity)
         {
@@ -2232,8 +2236,8 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
           const char *src_root_relpath = src_relpath;
 
           if (op_depth == 0)
-            err = depth_sufficient_to_bump(&can_bump, src_relpath, wcroot,
-                                           src_depth, scratch_pool);
+            err = depth_sufficient_to_bump(&can_bump, wcroot, src_relpath,
+                                           op_depth, src_depth, scratch_pool);
           else
             /* Having chosen to bump an entire BASE tree move we
                always have sufficient depth to bump subtree moves. */