You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2016/10/11 13:05:56 UTC

svn commit: r1764234 - /subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Author: kotkov
Date: Tue Oct 11 13:05:56 2016
New Revision: 1764234

URL: http://svn.apache.org/viewvc?rev=1764234&view=rev
Log:
Add a test for "incoming move vs local edit" tree conflict resolution upon
merge, where the file has been moved twice, and also it was deleted and
recreated between these moves (like, mv a \u2192 b, commit, replace b, commit,
mv b \u2192 c, commit).

The test works, and we expect that the "(m) move 'a' to 'c' and merge"
option is not available, as the file was actually deleted at some point,
thus the second move is a part of the different line of history.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_merge_incoming_file_move_new_line_of_history): New test.
  (test_funcs): Reference new test.

Modified:
    subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c

Modified: subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c?rev=1764234&r1=1764233&r2=1764234&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Tue Oct 11 13:05:56 2016
@@ -3455,6 +3455,95 @@ test_merge_incoming_move_dir_with_moved_
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_merge_incoming_file_move_new_line_of_history(const svn_test_opts_t *opts,
+                                                  apr_pool_t *pool)
+{
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+  svn_client_ctx_t *ctx;
+  svn_opt_revision_t opt_rev;
+  svn_client_conflict_t *conflict;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  svn_boolean_t tree_conflicted;
+
+  SVN_ERR(svn_test__sandbox_create(
+            b, "merge_incoming_file_move_new_line_of_history", opts, pool));
+
+  SVN_ERR(sbox_add_and_commit_greek_tree(b));
+  /* Create a copy of node "A". */
+  SVN_ERR(sbox_wc_copy(b, "A", "A1"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+  /* On "trunk", move the file. */
+  SVN_ERR(sbox_wc_move(b, "A/mu", "A/mu-moved"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+  /* On "trunk", change the line of history of the moved file by
+   * replacing it. */
+  SVN_ERR(sbox_wc_delete(b, "A/mu-moved"));
+  SVN_ERR(sbox_file_write(b, "A/mu-moved", "x"));
+  SVN_ERR(sbox_wc_add(b, "A/mu-moved"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+  /* On "trunk", move the replaced file. */
+  SVN_ERR(sbox_wc_move(b, "A/mu-moved", "A/mu-moved-again"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+  /* On "branch", edit the file. */
+  SVN_ERR(sbox_file_write(b, "A1/mu", "New branch content.\n"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, pool));
+
+  /* Merge "trunk" to "branch". */
+  SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+  opt_rev.kind = svn_opt_revision_head;
+  opt_rev.value.number = SVN_INVALID_REVNUM;
+  SVN_ERR(svn_client_merge_peg5(svn_path_url_add_component2(b->repos_url, "A",
+                                                            pool),
+                                NULL, &opt_rev, sbox_wc_path(b, "A1"),
+                                svn_depth_infinity,
+                                FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+                                NULL, ctx, pool));
+
+  /* We should have a tree conflict in the file "mu". */
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, "A1/mu"), ctx,
+                                  pool, pool));
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, pool, pool));
+  SVN_TEST_ASSERT(!text_conflicted);
+  SVN_TEST_INT_ASSERT(props_conflicted->nelts, 0);
+  SVN_TEST_ASSERT(tree_conflicted);
+
+  /* Check available tree conflict resolution options. */
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      svn_client_conflict_option_incoming_delete_ignore,
+      svn_client_conflict_option_incoming_delete_accept,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts, pool));
+  }
+
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, pool));
+
+  /* The svn_client_conflict_option_incoming_move_file_text_merge option
+   * should not be available, as the "mu" file was actually deleted at
+   * some point (and the remaining move is a part of the new line of
+   * history). */
+  {
+    svn_client_conflict_option_id_t expected_opts[] = {
+      svn_client_conflict_option_postpone,
+      svn_client_conflict_option_accept_current_wc_state,
+      -1 /* end of list */
+    };
+    SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts, pool));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ========================================================================== */
 
 
@@ -3519,6 +3608,8 @@ static struct svn_test_descriptor_t test
                         "merge incoming chained move vs local edit"),
     SVN_TEST_OPTS_XFAIL(test_merge_incoming_move_dir_with_moved_file,
                         "merge incoming moved dir with moved file"),
+    SVN_TEST_OPTS_PASS(test_merge_incoming_file_move_new_line_of_history,
+                       "merge incoming file move with new line of history"),
     SVN_TEST_NULL
   };