subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1659445 - in /subversion/trunk/subversion: libsvn_wc/wc_db_update_move.c tests/libsvn_wc/op-depth-test.c
Date Fri, 13 Feb 2015 00:24:02 GMT
Author: rhuijben
Date: Fri Feb 13 00:24:02 2015
New Revision: 1659445

URL: http://svn.apache.org/r1659445
Log:
Resolve an error when we try to record a tree conflict because we are not
allowed to update the entire working copy. In this case we tried to read
directly from BASE while the data could already be moved.

* subversion/libsvn_wc/wc_db_update_move.c
  (bump_mark_tree_conflict): Add op-depth argument and use it to read from
    the right layer.
  (bump_moved_layer): Update caller. Avoid reimplementing svn_relpath_limit
    less efficient.
  (svn_wc__db_bump_moved_away): Update caller.

* subversion/tests/libsvn_wc/op-depth-test.c
  (move_deep_bump): New test.
  (test_list): Add move_deep_bump.

Modified:
    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_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1659445&r1=1659444&r2=1659445&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Fri Feb 13 00:24:02 2015
@@ -1942,6 +1942,7 @@ depth_sufficient_to_bump(svn_boolean_t *
 static svn_error_t *
 bump_mark_tree_conflict(svn_wc__db_wcroot_t *wcroot,
                         const char *move_src_root_relpath,
+                        int src_op_depth,
                         const char *move_src_op_root_relpath,
                         const char *move_dst_op_root_relpath,
                         svn_wc__db_t *db,
@@ -1964,12 +1965,12 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
   SVN_ERR(verify_write_lock(wcroot, move_src_root_relpath, scratch_pool));
 
   /* Read new (post-update) information from the new move source BASE node. */
-  SVN_ERR(svn_wc__db_base_get_info_internal(NULL, &new_kind, &new_rev,
-                                            &new_repos_relpath, &repos_id,
-                                            NULL, NULL, NULL, NULL, NULL,
-                                            NULL, NULL, NULL, NULL, NULL,
-                                            wcroot, move_src_op_root_relpath,
-                                            scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_depth_get_info(NULL, &new_kind, &new_rev,
+                                    &new_repos_relpath, &repos_id,
+                                    NULL, NULL, NULL, NULL, NULL,
+                                    NULL, NULL, NULL,
+                                    wcroot, move_src_op_root_relpath,
+                                    src_op_depth, scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
                                       wcroot, repos_id, scratch_pool));
 
@@ -2105,6 +2106,7 @@ bump_moved_layer(svn_boolean_t *recurse,
   svn_boolean_t have_row;
   svn_skel_t *conflict;
   svn_boolean_t can_bump;
+  const char *src_root_relpath;
 
   SVN_ERR(verify_write_lock(wcroot, local_relpath, scratch_pool));
 
@@ -2143,24 +2145,21 @@ bump_moved_layer(svn_boolean_t *recurse,
         can_bump = FALSE;
     }
 
-  {
-    const char *src_root_relpath = src_relpath;
-    while (relpath_depth(src_root_relpath) > src_del_depth)
-      src_root_relpath = svn_relpath_dirname(src_root_relpath, scratch_pool);
-
-    if (!can_bump)
-      {
-        SVN_ERR(bump_mark_tree_conflict(wcroot, src_relpath,
-                                        src_root_relpath, dst_relpath,
-                                        db, scratch_pool));
-
-        return SVN_NO_ERROR;
-      }
-
-    SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, wcroot,
-                                              src_root_relpath,
-                                              scratch_pool, scratch_pool));
-  }
+  src_root_relpath = svn_relpath_limit(src_relpath, src_del_depth,
+                                       scratch_pool);
+
+  if (!can_bump)
+    {
+      SVN_ERR(bump_mark_tree_conflict(wcroot, src_relpath, op_depth,
+                                      src_root_relpath, dst_relpath,
+                                      db, scratch_pool));
+
+      return SVN_NO_ERROR;
+    }
+
+  SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, wcroot,
+                                            src_root_relpath,
+                                            scratch_pool, scratch_pool));
 
   /* ### TODO: check this is the right sort of tree-conflict? */
   if (!conflict)
@@ -2316,7 +2315,7 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
               if (locked)
                 {
                   SVN_ERR(bump_mark_tree_conflict(wcroot,
-                                                  move_src_root_relpath,
+                                                  move_src_root_relpath, 0,
                                                   delete_relpath,
                                                   move_dst_op_root_relpath,
                                                   db, scratch_pool));

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=1659445&r1=1659444&r2=1659445&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Fri Feb 13 00:24:02 2015
@@ -10912,6 +10912,75 @@ move_edit_obstruction(const svn_test_opt
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+move_deep_bump(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "move_deep_bump", opts, pool));
+
+  SVN_ERR(sbox_wc_mkdir(&b, "B"));
+  SVN_ERR(sbox_wc_mkdir(&b, "B/B"));
+  SVN_ERR(sbox_wc_mkdir(&b, "B/B/A"));
+  SVN_ERR(sbox_wc_mkdir(&b, "B/B/A/A"));
+  SVN_ERR(sbox_wc_mkdir(&b, "B/B/A/A/A"));
+  SVN_ERR(sbox_wc_mkdir(&b, "C"));
+  SVN_ERR(sbox_wc_mkdir(&b, "C/C"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+  SVN_ERR(sbox_wc_mkdir(&b, "Z"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+  SVN_ERR(sbox_wc_mkdir(&b, "B/B/A/A/A/A"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+
+  SVN_ERR(sbox_wc_move(&b, "B/B/A", "B/B/B"));
+  SVN_ERR(sbox_wc_move(&b, "B/B/B/A", "C/C/A"));
+
+  /* This can't bump C/C/A as that is outside the lock range
+     so we expect a tree conflict.
+
+     This used to cause a node not found during bumping
+     because B/B/B/A doesn't have a BASE node */
+  SVN_ERR(sbox_wc_update(&b, "B/B", 2));
+
+  {
+    nodes_row_t nodes[] = {
+      {0, "",                 "normal",       1, ""},
+      {0, "B",                "normal",       1, "B"},
+      {0, "B/B",              "normal",       2, "B/B"},
+      {0, "B/B/A",            "normal",       2, "B/B/A"},
+      {0, "B/B/A/A",          "normal",       2, "B/B/A/A"},
+      {0, "B/B/A/A/A",        "normal",       2, "B/B/A/A/A"},
+      {0, "C",                "normal",       1, "C"},
+      {0, "C/C",              "normal",       1, "C/C"},
+      {3, "B/B/A",            "base-deleted", NO_COPY_FROM, "B/B/B"},
+      {3, "B/B/A/A",          "base-deleted", NO_COPY_FROM},
+      {3, "B/B/A/A/A",        "base-deleted", NO_COPY_FROM},
+      {3, "B/B/B",            "normal",       2, "B/B/A", MOVED_HERE},
+      {3, "B/B/B/A",          "normal",       2, "B/B/A/A", MOVED_HERE},
+      {3, "B/B/B/A/A",        "normal",       2, "B/B/A/A/A", MOVED_HERE},
+      {3, "C/C/A",            "normal",       1, "B/B/A/A", MOVED_HERE},
+      {3, "C/C/A/A",          "normal",       1, "B/B/A/A/A", MOVED_HERE},
+      {4, "B/B/B/A",          "base-deleted", NO_COPY_FROM, "C/C/A"},
+      {4, "B/B/B/A/A",        "base-deleted", NO_COPY_FROM},
+      {0}
+    };
+    conflict_info_t conflicts[] = {
+      {"B/B/B/A", FALSE, FALSE, {svn_wc_conflict_action_edit, 
+                                 svn_wc_conflict_reason_moved_away, "B/B/B/A"}},
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+  SVN_ERR(sbox_wc_resolve(&b, "B/B/B/A", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
+  SVN_ERR(check_db_conflicts(&b, "", NULL));
+
+  return SVN_NO_ERROR;
+}
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -11119,6 +11188,8 @@ static struct svn_test_descriptor_t test
                         "move within mixed move"),
     SVN_TEST_OPTS_PASS(move_edit_obstruction,
                        "move edit obstruction"),
+    SVN_TEST_OPTS_PASS(move_deep_bump,
+                       "move deep bump"),
     SVN_TEST_NULL
   };
 



Mime
View raw message