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 2013/02/07 18:25:54 UTC

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

Author: philip
Date: Thu Feb  7 17:25:53 2013
New Revision: 1443612

URL: http://svn.apache.org/viewvc?rev=1443612&view=rev
Log:
Make infinite revert clear moved-here from move destinations outside
the reverted tree.

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

* subversion/libsvn_wc/wc_db.c
  (op_revert_recursive_txn): Clear moved-here.

* subversion/tests/libsvn_wc/op-depth-test.c
  (revert_nested_move): Extend to test clearing of moved-here.

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=1443612&r1=1443611&r2=1443612&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Feb  7 17:25:53 2013
@@ -1516,6 +1516,14 @@ WHERE wc_id = ?1
   AND op_depth > ?3
   AND moved_to IS NOT NULL
 
+-- STMT_SELECT_MOVED_OUTSIDE
+SELECT local_relpath FROM nodes
+WHERE wc_id = ?1
+  AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND op_depth >= ?3
+  AND moved_to IS NOT NULL
+  AND NOT IS_STRICT_DESCENDANT_OF(moved_to, ?2)
+
 -- STMT_SELECT_OP_DEPTH_MOVED_PAIR
 SELECT n.local_relpath, n.moved_to,
        (SELECT o.repos_path FROM nodes AS o

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1443612&r1=1443611&r2=1443612&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb  7 17:25:53 2013
@@ -6229,6 +6229,27 @@ op_revert_recursive_txn(void *baton,
                                                     local_relpath,
                                                     scratch_pool));
 
+  /* Remove moved-here from move destinations outside the tree. */
+  SVN_ERR(svn_sqlite__get_statement(
+                    &stmt, wcroot->sdb, STMT_SELECT_MOVED_OUTSIDE));
+  SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
+                            op_depth));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+  while (have_row)
+    {
+      const char *move_src_relpath = svn_sqlite__column_text(stmt, 0, NULL);
+      svn_error_t *err;
+
+      err = svn_wc__db_resolve_break_moved_away_internal(wcroot,
+                                                         move_src_relpath,
+                                                         scratch_pool);
+      if (err)
+        return svn_error_compose_create(err, svn_sqlite__reset(stmt));
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+    }
+  SVN_ERR(svn_sqlite__reset(stmt));
+
   /* Don't delete BASE nodes */
   select_op_depth = op_depth ? op_depth : 1;
 

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=1443612&r1=1443611&r2=1443612&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  7 17:25:53 2013
@@ -4157,6 +4157,23 @@ revert_nested_move(const svn_test_opts_t
     {3, "A2/B2/C2", "normal",       1, "A/B/C"},
     {0}
   };
+  nodes_row_t nodes_AC_moved_B_copied[] = {
+    {0, "",         "normal",       1, ""},
+    {0, "A",        "normal",       1, "A"},
+    {0, "A/B",      "normal",       1, "A/B"},
+    {0, "A/B/C",    "normal",       1, "A/B/C"},
+    {1, "A",        "base-deleted", NO_COPY_FROM, "A2"},
+    {1, "A/B",      "base-deleted", NO_COPY_FROM},
+    {1, "A/B/C",    "base-deleted", NO_COPY_FROM},
+    {1, "A2",       "normal",       1, "A",     MOVED_HERE},
+    {1, "A2/B",     "normal",       1, "A/B",   MOVED_HERE},
+    {1, "A2/B/C",   "normal",       1, "A/B/C", MOVED_HERE},
+    {2, "A2/B2",    "normal",       1, "A/B"},
+    {2, "A2/B2/C",  "normal",       1, "A/B/C"},
+    {3, "A2/B2/C",  "base-deleted", NO_COPY_FROM, "A2/B2/C2"},
+    {3, "A2/B2/C2", "normal",       1, "A/B/C", MOVED_HERE},
+    {0}
+  };
 
   SVN_ERR(svn_test__sandbox_create(&b, "revert_nested_move", opts, pool));
 
@@ -4192,6 +4209,7 @@ revert_nested_move(const svn_test_opts_t
   SVN_ERR(check_db_rows(&b, "", nodes_ABC_moved));
 
   SVN_ERR(sbox_wc_revert(&b, "A2/B2/C", svn_depth_infinity));
+  SVN_ERR(check_db_rows(&b, "", nodes_AB_moved_C_copied));
   SVN_ERR(sbox_wc_revert(&b, "A2/B2/C2", svn_depth_infinity));
   SVN_ERR(check_db_rows(&b, "", nodes_AB_moved));
 
@@ -4206,6 +4224,9 @@ revert_nested_move(const svn_test_opts_t
   SVN_ERR(sbox_wc_move(&b, "A", "A2"));
   SVN_ERR(check_db_rows(&b, "", nodes_ABC_moved));
 
+  SVN_ERR(sbox_wc_revert(&b, "A2/B", svn_depth_infinity));
+  SVN_ERR(check_db_rows(&b, "", nodes_AC_moved_B_copied));
+
   return SVN_NO_ERROR;
 }