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/02/22 00:11:37 UTC

svn commit: r1448846 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/op-depth-test.c

Author: rhuijben
Date: Thu Feb 21 23:11:36 2013
New Revision: 1448846

URL: http://svn.apache.org/r1448846
Log:
When handling working copy deletes, fix moved-to in all layers instead of
just in the top layer (as move sources can be replaced). Also remove
specifics on whether the top-layer is a directory as that kind of
checks doesn't work when we replace a directories with files.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_MOVED_PAIR2): Include node itself and look in all layers.

* subversion/libsvn_wc/wc_db.c
  (delete_node): Use updated STMT_SELECT_MOVED_PAIR2 for both not moved before
    and moved before cases. Fix the to be deleted layer even when moving.

* subversion/tests/libsvn_wc/op-depth-test.c
  (move_to_swap): Update expected result: the move is remembered, so the move
    back detection works properly now.
  (test_list): Remove XFail marker from delete_over_moved_away.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.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=1448846&r1=1448845&r2=1448846&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Feb 21 23:11:36 2013
@@ -1562,11 +1562,14 @@ WHERE wc_id = ?1
  * where the source of the move is within the subtree rooted at path ?2, and
  * the destination of the move is outside the subtree rooted at path ?2. */
 -- STMT_SELECT_MOVED_PAIR2
-SELECT local_relpath, moved_to FROM nodes_current
+SELECT local_relpath, moved_to, op_depth FROM nodes
 WHERE wc_id = ?1
-  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND moved_to IS NOT NULL
   AND NOT IS_STRICT_DESCENDANT_OF(moved_to, ?2)
+  AND op_depth >= (SELECT MAX(op_depth) FROM nodes o
+                    WHERE o.wc_id = ?1
+                      AND o.local_relpath = ?2)
 
 -- STMT_SELECT_MOVED_PAIR3
 SELECT local_relpath, moved_to, op_depth, kind 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=1448846&r1=1448845&r2=1448846&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb 21 23:11:36 2013
@@ -7600,7 +7600,6 @@ delete_node(void *baton,
   /* Find children that were moved out of the subtree rooted at this node.
    * We'll need to update their op-depth columns because their deletion
    * is now implied by the deletion of their parent (i.e. this node). */
-  if (kind == svn_kind_dir && !b->moved_to_relpath)
     {
       apr_pool_t *iterpool;
 
@@ -7613,19 +7612,35 @@ delete_node(void *baton,
       iterpool = svn_pool_create(scratch_pool);
       while (have_row)
         {
-          struct moved_node_t *moved_node
-            = apr_palloc(scratch_pool, sizeof(struct moved_node_t));
+          struct moved_node_t *mn;
+          const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+          svn_boolean_t fixup = FALSE;
 
-          moved_node->local_relpath
-            = svn_sqlite__column_text(stmt, 0, scratch_pool);
-          moved_node->moved_to_relpath
-            = svn_sqlite__column_text(stmt, 1, scratch_pool);
-          moved_node->op_depth = b->delete_depth;
-
-          if (!moved_nodes)
-            moved_nodes = apr_array_make(scratch_pool, 1,
-                                         sizeof(struct moved_node_t *));
-          APR_ARRAY_PUSH(moved_nodes, const struct moved_node_t *) = moved_node;
+          if (!b->moved_to_relpath)
+            {
+              fixup = TRUE;
+            }
+          else
+            {
+              int child_op_depth = svn_sqlite__column_int(stmt, 2);
+
+              fixup = (b->delete_depth == child_op_depth);
+            }
+
+          if (fixup)
+            {
+              mn = apr_pcalloc(scratch_pool, sizeof(struct moved_node_t));
+
+              mn->local_relpath = apr_pstrdup(scratch_pool, child_relpath);
+              mn->moved_to_relpath = svn_sqlite__column_text(stmt, 1,
+                                                             scratch_pool);
+              mn->op_depth = b->delete_depth;
+
+              if (!moved_nodes)
+                moved_nodes = apr_array_make(scratch_pool, 1,
+                                             sizeof(struct moved_node_t *));
+              APR_ARRAY_PUSH(moved_nodes, struct moved_node_t *) = mn;
+            }
 
           SVN_ERR(svn_sqlite__step(&have_row, stmt));
         }

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1448846&r1=1448845&r2=1448846&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Feb 21 23:11:36 2013
@@ -4109,15 +4109,6 @@ move_to_swap(const svn_test_opts_t *opts
       {0, "X",   "normal",       1, "X"},
       {0, "X/Y", "normal",       1, "X/Y"},
 
-      /* We shouldn't see this move, but somehow our move information
-         is lost in this move-back, so we can't find if it is copy-back
-         or a move-back */
-      {1, "A",   "normal",       1, "A"},
-      {1, "A/B", "normal",       1, "A/B", MOVED_HERE},
-
-      {1, "X",   "normal",       1, "X", FALSE, "A"},
-      {1, "X/Y", "normal",       1, "X/Y", MOVED_HERE},
-
       {0}
     };
 
@@ -7210,7 +7201,7 @@ struct svn_test_descriptor_t test_funcs[
                        "move_not_present_variants"),
     SVN_TEST_OPTS_PASS(update_child_under_add,
                        "update_child_under_add (issue 4111)"),
-    SVN_TEST_OPTS_XFAIL(delete_over_moved_away,
-                        "delete_over_moved_away"),
+    SVN_TEST_OPTS_PASS(delete_over_moved_away,
+                       "delete_over_moved_away"),
     SVN_TEST_NULL
   };