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 17:22:24 UTC

svn commit: r1443590 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db_private.h libsvn_wc/wc_db_update_move.c tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Thu Feb  7 16:22:23 2013
New Revision: 1443590

URL: http://svn.apache.org/viewvc?rev=1443590&view=rev
Log:
Make revert on a move source clear moved-here from the destination.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_NODE_INFO): Add moved_to.

* subversion/libsvn_wc/wc_db.c
  (op_revert_txn): Clear moved-here, outline code to raise move-edit
   conflicts.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_resolve_break_moved_away_internal): New.

* subversion/libsvn_wc/wc_db_update_move.c
  (resolve_break_moved_away): Rename to ...
  (svn_wc__db_resolve_break_moved_away_internal): ... this.
  (svn_wc__db_resolve_break_moved_away): Call renamed function.

* 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/libsvn_wc/wc_db_private.h
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.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=1443590&r1=1443589&r2=1443590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Feb  7 16:22:23 2013
@@ -29,7 +29,8 @@
 -- STMT_SELECT_NODE_INFO
 SELECT op_depth, repos_id, repos_path, presence, kind, revision, checksum,
   translated_size, changed_revision, changed_date, changed_author, depth,
-  symlink_target, last_mod_time, properties, moved_here, inherited_props
+  symlink_target, last_mod_time, properties, moved_here, inherited_props,
+  moved_to
 FROM nodes
 WHERE wc_id = ?1 AND local_relpath = ?2
 ORDER BY op_depth DESC

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1443590&r1=1443589&r2=1443590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Feb  7 16:22:23 2013
@@ -6024,6 +6024,7 @@ op_revert_txn(void *baton,
   int op_depth;
   svn_boolean_t moved_here;
   int affected_rows;
+  const char *moved_to;
 
   /* ### Similar structure to op_revert_recursive_txn, should they be
          combined? */
@@ -6069,8 +6070,51 @@ op_revert_txn(void *baton,
 
   op_depth = svn_sqlite__column_int(stmt, 0);
   moved_here = svn_sqlite__column_boolean(stmt, 15);
+  moved_to = svn_sqlite__column_text(stmt, 17, scratch_pool);
   SVN_ERR(svn_sqlite__reset(stmt));
 
+  if (moved_to)
+    {
+      SVN_ERR(svn_wc__db_resolve_break_moved_away_internal(wcroot,
+                                                           local_relpath,
+                                                           scratch_pool));
+    }
+  else
+    {
+      svn_skel_t *conflict;
+
+      SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, wcroot,
+                                                local_relpath,
+                                                scratch_pool, scratch_pool));
+      if (conflict)
+        {
+          svn_wc_operation_t operation;
+          svn_boolean_t tree_conflicted;
+
+          SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL,
+                                             &tree_conflicted, NULL, NULL,
+                                             conflict,
+                                             scratch_pool, scratch_pool));
+          if (tree_conflicted
+              && (operation == svn_wc_operation_update
+                  || operation == svn_wc_operation_switch))
+            {
+              svn_wc_conflict_reason_t reason;
+              svn_wc_conflict_action_t action;
+
+              SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, &action,
+                                                          NULL, NULL, NULL,
+                                                          conflict,
+                                                          scratch_pool,
+                                                          scratch_pool));
+
+              if (reason == svn_wc_conflict_reason_deleted)
+                ;
+              /* svn_wc__db_resolve_delete_raise_moved */
+            }
+        }
+    }
+
   if (op_depth > 0 && op_depth == relpath_depth(local_relpath))
     {
       /* Can't do non-recursive revert if children exist */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1443590&r1=1443589&r2=1443590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Thu Feb  7 16:22:23 2013
@@ -430,4 +430,9 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
                            svn_depth_t depth,
                            apr_pool_t *scratch_pool);
 
+svn_error_t *
+svn_wc__db_resolve_break_moved_away_internal(svn_wc__db_wcroot_t *wcroot,
+                                             const char *local_relpath,
+                                             apr_pool_t *scratch_pool);
+
 #endif /* WC_DB_PRIVATE_H */

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=1443590&r1=1443589&r2=1443590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Thu Feb  7 16:22:23 2013
@@ -2108,10 +2108,10 @@ svn_wc__db_resolve_delete_raise_moved_aw
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-resolve_break_moved_away(svn_wc__db_wcroot_t *wcroot,
-                         const char *local_relpath,
-                         apr_pool_t *scratch_pool)
+svn_error_t *
+svn_wc__db_resolve_break_moved_away_internal(svn_wc__db_wcroot_t *wcroot,
+                                             const char *local_relpath,
+                                             apr_pool_t *scratch_pool)
 {
   const char *dummy, *moved_to_op_root_relpath;
   const char *moved_away_root_relpath, *op_root_relpath;
@@ -2156,9 +2156,10 @@ svn_wc__db_resolve_break_moved_away(svn_
                                                 scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_WC__DB_WITH_TXN(resolve_break_moved_away(wcroot, local_relpath,
-                                               scratch_pool),
-                      wcroot);
+  SVN_WC__DB_WITH_TXN(
+    svn_wc__db_resolve_break_moved_away_internal(wcroot, local_relpath,
+                                                 scratch_pool),
+    wcroot);
 
   return SVN_NO_ERROR;
 }

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=1443590&r1=1443589&r2=1443590&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 16:22:23 2013
@@ -4139,6 +4139,24 @@ revert_nested_move(const svn_test_opts_t
     {3, "A2/B2/C2", "normal",       1, "A/B/C", MOVED_HERE},
     {0}
   };
+  nodes_row_t nodes_AB_moved_C_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/B",     "base-deleted", NO_COPY_FROM, "A2/B2"},
+    {2, "A2/B/C",   "base-deleted", NO_COPY_FROM},
+    {2, "A2/B2",    "normal",       1, "A/B",   MOVED_HERE},
+    {2, "A2/B2/C",  "normal",       1, "A/B/C", MOVED_HERE},
+    {3, "A2/B2/C2", "normal",       1, "A/B/C"},
+    {0}
+  };
 
   SVN_ERR(svn_test__sandbox_create(&b, "revert_nested_move", opts, pool));
 
@@ -4165,6 +4183,14 @@ revert_nested_move(const svn_test_opts_t
   SVN_ERR(sbox_wc_move(&b, "A2/B2/C", "A2/B2/C2"));
   SVN_ERR(check_db_rows(&b, "", nodes_ABC_moved));
 
+  SVN_ERR(sbox_wc_revert(&b, "A2/B2/C", svn_depth_empty));
+  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));
+
+  SVN_ERR(sbox_wc_move(&b, "A2/B2/C", "A2/B2/C2"));
+  SVN_ERR(check_db_rows(&b, "", nodes_ABC_moved));
+
   SVN_ERR(sbox_wc_revert(&b, "A2/B2/C", svn_depth_infinity));
   SVN_ERR(sbox_wc_revert(&b, "A2/B2/C2", svn_depth_infinity));
   SVN_ERR(check_db_rows(&b, "", nodes_AB_moved));