summaryrefslogtreecommitdiff
path: root/subversion/tests/libsvn_client/conflicts-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/tests/libsvn_client/conflicts-test.c')
-rw-r--r--subversion/tests/libsvn_client/conflicts-test.c1510
1 files changed, 1505 insertions, 5 deletions
diff --git a/subversion/tests/libsvn_client/conflicts-test.c b/subversion/tests/libsvn_client/conflicts-test.c
index 9a511b6..54e0181 100644
--- a/subversion/tests/libsvn_client/conflicts-test.c
+++ b/subversion/tests/libsvn_client/conflicts-test.c
@@ -546,7 +546,7 @@ create_wc_with_dir_add_vs_dir_add_merge_conflict(
/* Now move the new directory to the colliding path. */
new_dir_path = svn_relpath_join(trunk_path, new_dir_name, b->pool);
SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
- sbox_wc_move(b, move_src_path, new_dir_path);
+ SVN_ERR(sbox_wc_move(b, move_src_path, new_dir_path));
SVN_ERR(sbox_wc_commit(b, ""));
}
new_dir_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
@@ -2626,6 +2626,7 @@ test_merge_incoming_delete_vs_local_delete(const svn_test_opts_t *opts,
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 */
};
@@ -2639,6 +2640,7 @@ test_merge_incoming_delete_vs_local_delete(const svn_test_opts_t *opts,
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 */
};
@@ -2909,10 +2911,13 @@ test_merge_incoming_edit_file_moved_away(const svn_test_opts_t *opts,
svn_client_ctx_t *ctx;
svn_opt_revision_t opt_rev;
svn_client_conflict_t *conflict;
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
svn_boolean_t text_conflicted;
apr_array_header_t *props_conflicted;
svn_boolean_t tree_conflicted;
svn_stringbuf_t *buf;
+ apr_array_header_t *possible_moved_to_abspaths;
SVN_ERR(svn_test__sandbox_create(
b, "merge_incoming_edit_file_moved_away", opts, pool));
@@ -2974,6 +2979,19 @@ test_merge_incoming_edit_file_moved_away(const svn_test_opts_t *opts,
SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts, pool));
}
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_local_move_file_text_merge);
+ SVN_TEST_ASSERT(option != NULL);
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 1);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A1/mu-moved"));
+
/* Resolve the tree conflict by applying the incoming edit to the local
* move destination "mu-moved". */
SVN_ERR(svn_client_conflict_tree_resolve_by_id(
@@ -4987,7 +5005,7 @@ test_cherry_pick_post_move_edit(const svn_test_opts_t *opts,
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_local_move_file_text_merge,
+ svn_client_conflict_option_sibling_move_file_text_merge,
-1 /* end of list */
};
SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
@@ -4997,7 +5015,7 @@ test_cherry_pick_post_move_edit(const svn_test_opts_t *opts,
/* Try to resolve the conflict. */
SVN_ERR(svn_client_conflict_tree_resolve_by_id(
conflict,
- svn_client_conflict_option_local_move_file_text_merge,
+ svn_client_conflict_option_sibling_move_file_text_merge,
ctx, b->pool));
/* The node "A1/mu-moved" should no longer exist. */
@@ -5008,7 +5026,14 @@ test_cherry_pick_post_move_edit(const svn_test_opts_t *opts,
/* And "A1/mu" should have expected contents. */
SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A1/mu"), pool));
- SVN_TEST_STRING_ASSERT(buf->data, "More modified content." APR_EOL_STR);
+ SVN_TEST_STRING_ASSERT(buf->data,
+ "<<<<<<< .working" "\n"
+ "This is the file 'mu'." "\n"
+ "||||||| .old" "\n"
+ "Modified content." APR_EOL_STR
+ "=======" "\n"
+ "More modified content." APR_EOL_STR
+ ">>>>>>> .new" "\n");
return SVN_NO_ERROR;
}
@@ -5587,6 +5612,591 @@ test_merge_incoming_delete_file_unrelated_move(const svn_test_opts_t *opts,
}
static svn_error_t *
+test_cherry_pick_post_move_edit_dir(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+ const char *trunk_url;
+ svn_opt_revision_t peg_rev;
+ apr_array_header_t *ranges_to_merge;
+ svn_opt_revision_range_t merge_range;
+ svn_client_ctx_t *ctx;
+ svn_client_conflict_t *conflict;
+ svn_boolean_t tree_conflicted;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b,
+ "test_cherry_pick_post_move_edit_dir",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+ /* Create a copy of node "A". */
+ SVN_ERR(sbox_wc_copy(b, "A", "A1"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+ /* On "trunk", move the directory B. */
+ SVN_ERR(sbox_wc_move(b, "A/B", "A/B-moved"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+ /* On "trunk", edit B-moved/lambda. This will be r4. */
+ SVN_ERR(sbox_file_write(b, "A/B-moved/lambda", "Modified content."
+ APR_EOL_STR));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r4 */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ /* Perform a cherry-pick merge of r4 from A to A1. */
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ trunk_url = apr_pstrcat(b->pool, b->repos_url, "/A", SVN_VA_NULL);
+ peg_rev.kind = svn_opt_revision_number;
+ peg_rev.value.number = 4;
+ merge_range.start.kind = svn_opt_revision_number;
+ merge_range.start.value.number = 3;
+ merge_range.end.kind = svn_opt_revision_number;
+ merge_range.end.value.number = 4;
+ ranges_to_merge = apr_array_make(b->pool, 1,
+ sizeof(svn_opt_revision_range_t *));
+ APR_ARRAY_PUSH(ranges_to_merge, svn_opt_revision_range_t *) = &merge_range;
+ /* This should raise a "local missing vs incoming edit" conflict. */
+ SVN_ERR(svn_client_merge_peg5(trunk_url, ranges_to_merge, &peg_rev,
+ sbox_wc_path(b, "A1"), svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, b->pool));
+
+ SVN_ERR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A1/B-moved"),
+ ctx, b->pool, b->pool));
+ SVN_ERR(svn_client_conflict_get_conflicted(NULL, NULL, &tree_conflicted,
+ conflict, b->pool, b->pool));
+ SVN_TEST_ASSERT(tree_conflicted);
+ {
+ 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,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+ {
+ 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_sibling_move_dir_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ /* Try to resolve the conflict. */
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_sibling_move_dir_merge,
+ ctx, b->pool));
+
+ /* The node "B-moved" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A1/B-moved"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* And "A1/B/lambda" should have expected contents. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A1/B/lambda"), pool));
+ SVN_TEST_STRING_ASSERT(buf->data, "Modified content." APR_EOL_STR);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_local_missing_abiguous_moves(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+ svn_opt_revision_t opt_rev;
+ svn_client_ctx_t *ctx;
+ svn_client_conflict_t *conflict;
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
+ apr_array_header_t *possible_moved_to_repos_relpaths;
+ apr_array_header_t *possible_moved_to_abspaths;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b, "local_missing_ambiguous_moves", opts,
+ pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ /* Create a copy of node "A" (the "trunk") to "A1" (the "branch"). */
+ SVN_ERR(sbox_wc_copy(b, "A", "A1"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+ /* Copy a file across branch boundaries (gives ambiguous WC targets later). */
+ SVN_ERR(sbox_wc_copy(b, "A/mu", "A1/mu-copied-from-A"));
+ /* Create an ambiguous move with the "trunk". */
+ SVN_ERR(sbox_wc_copy(b, "A/mu", "A/mu-copied"));
+ SVN_ERR(sbox_wc_move(b, "A/mu", "A/mu-moved"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+
+ /* Modify the moved file on the "branch". */
+ SVN_ERR(sbox_file_write(b, "A1/mu", "Modified content." APR_EOL_STR));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r4 */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ /* Merge "A1" ("branch") into "A" ("trunk"). */
+ opt_rev.kind = svn_opt_revision_head;
+ opt_rev.value.number = SVN_INVALID_REVNUM;
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, pool));
+ SVN_ERR(svn_client_merge_peg5(svn_path_url_add_component2(b->repos_url, "A1",
+ pool),
+ NULL, &opt_rev, sbox_wc_path(b, "A"),
+ svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, pool));
+
+ SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, "A/mu"),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+ {
+ 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_local_move_file_text_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_local_move_file_text_merge);
+ SVN_TEST_ASSERT(option != NULL);
+
+ /*
+ * Possible repository destinations for moved-away 'A/mu' are:
+ * (1): '^/A/mu-copied'
+ * (2): '^/A/mu-moved'
+ * (3): '^/A1/mu-copied-from-A'
+ */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_repos_relpath_candidates(
+ &possible_moved_to_repos_relpaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_repos_relpaths->nelts, 3);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 0, const char *),
+ "A/mu-copied");
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 1, const char *),
+ "A/mu-moved");
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 2, const char *),
+ "A1/mu-copied-from-A");
+
+ /* Move target for "A/mu-copied" (selected by default) is not ambiguous. */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 1);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/mu-copied"));
+
+ /* Move target for "A/mu-moved" is not ambiguous. */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 1,
+ ctx, b->pool));
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 1);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/mu-moved"));
+
+ /* Select move target "A1/mu-copied-from-A". */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 2,
+ ctx, b->pool));
+
+ /*
+ * Possible working copy destinations for moved-away 'A/mu' are:
+ * (1): 'A/mu-copied-from-A'
+ * (2): 'A1/mu-copied-from-A'
+ */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 2);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/mu-copied-from-A"));
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 1, const char *),
+ sbox_wc_path(b, "A1/mu-copied-from-A"));
+
+ /* Select move target "A/mu-moved". */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 1,
+ ctx, b->pool));
+
+ /* Resolve the tree conflict. */
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_local_move_file_text_merge, ctx,
+ b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/mu"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* And it should have expected contents. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/mu-moved"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, "Modified content." APR_EOL_STR);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_local_missing_abiguous_moves_dir(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+ svn_opt_revision_t opt_rev;
+ svn_client_ctx_t *ctx;
+ svn_client_conflict_t *conflict;
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
+ apr_array_header_t *possible_moved_to_repos_relpaths;
+ apr_array_header_t *possible_moved_to_abspaths;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b, "local_missing_ambiguous_moves_dir",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ /* Create a copy of node "A" (the "trunk") to "A1" (the "branch"). */
+ SVN_ERR(sbox_wc_copy(b, "A", "A1"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+ /* Copy a dir across branch boundaries (gives ambiguous WC targets later). */
+ SVN_ERR(sbox_wc_copy(b, "A/B", "A1/B-copied-from-A"));
+ /* Create an ambiguous move with the "trunk". */
+ SVN_ERR(sbox_wc_copy(b, "A/B", "A/B-copied"));
+ SVN_ERR(sbox_wc_move(b, "A/B", "A/B-moved"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+
+ /* Modify a file in the moved directory on the "branch". */
+ SVN_ERR(sbox_file_write(b, "A1/B/lambda", "Modified content." APR_EOL_STR));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r4 */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ /* Merge "A1" ("branch") into "A" ("trunk"). */
+ opt_rev.kind = svn_opt_revision_head;
+ opt_rev.value.number = SVN_INVALID_REVNUM;
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, pool));
+ SVN_ERR(svn_client_merge_peg5(svn_path_url_add_component2(b->repos_url, "A1",
+ pool),
+ NULL, &opt_rev, sbox_wc_path(b, "A"),
+ svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, pool));
+
+ SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, "A/B"),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+ {
+ 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_local_move_dir_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_local_move_dir_merge);
+ SVN_TEST_ASSERT(option != NULL);
+
+ /*
+ * Possible repository destinations for moved-away 'A/B' are:
+ * (1): '^/A/B-copied'
+ * (2): '^/A/B-moved'
+ * (3): '^/A1/B-copied-from-A'
+ */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_repos_relpath_candidates(
+ &possible_moved_to_repos_relpaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_repos_relpaths->nelts, 3);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 0, const char *),
+ "A/B-copied");
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 1, const char *),
+ "A/B-moved");
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_repos_relpaths, 2, const char *),
+ "A1/B-copied-from-A");
+
+ /* Move target for "A/B-copied" (selected by default) is not ambiguous. */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 1);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/B-copied"));
+
+ /* Move target for "A/B-moved" is not ambiguous. */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 1,
+ ctx, b->pool));
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 1);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/B-moved"));
+
+ /* Select move target "A1/mu-copied-from-A". */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 2,
+ ctx, b->pool));
+
+ /*
+ * Possible working copy destinations for moved-away 'A/B-copied-from-A' are:
+ * (1): 'A/B-copied-from-A'
+ * (2): 'A1/B-copied-from-A'
+ */
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 2);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/B-copied-from-A"));
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 1, const char *),
+ sbox_wc_path(b, "A1/B-copied-from-A"));
+
+ /* Select move target "A/B-moved". */
+ SVN_ERR(svn_client_conflict_option_set_moved_to_repos_relpath(option, 1,
+ ctx, b->pool));
+
+ /* Resolve the tree conflict. */
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_local_move_dir_merge, ctx,
+ b->pool));
+
+ /* The node "A/B" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/B"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/B-moved/lambda"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* And it should have expected contents. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/B-moved/lambda"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, "Modified content." APR_EOL_STR);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_file_vs_dir_move_merge_assertion_failure(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+ svn_opt_revision_t opt_rev, peg_rev;
+ svn_client_ctx_t *ctx;
+ svn_client_conflict_t *conflict;
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
+ const char *wc_path;
+
+ SVN_ERR(svn_test__sandbox_create(b,
+ "file_vs_dir_move_merge_assertion_failure",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ /* Create a copy of node "A" (the "trunk") to "A1" (the "branch"). */
+ SVN_ERR(sbox_wc_copy(b, "A", "A1"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+ /* Move and modify file on the "branch" */
+ SVN_ERR(sbox_wc_move(b, "A1/B/lambda", "A1/B/lambda-moved"));
+ SVN_ERR(sbox_file_write(b, "A1/B/lambda-moved",
+ "Modified content." APR_EOL_STR));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+
+ /* Move a directory and modify a file inside of it on the "trunk". */
+ SVN_ERR(sbox_wc_move(b, "A/B", "A/B-moved"));
+ SVN_ERR(sbox_file_write(b, "A/B-moved/lambda",
+ "Modified content." APR_EOL_STR));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r4 */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ /* Create a fresh working copy for "A1" ("branch"). */
+ wc_path = svn_test_data_path("file_vs_dir_move_merge_assertion_failure2",
+ pool);
+ SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool));
+ SVN_ERR(svn_io_make_dir_recursively(wc_path, pool));
+ svn_test_add_dir_cleanup(wc_path);
+
+ /* Merge "A" ("trunk") into a fresh working copy of "A1" ("branch"). */
+ opt_rev.kind = svn_opt_revision_head;
+ opt_rev.value.number = SVN_INVALID_REVNUM;
+ peg_rev.kind = svn_opt_revision_unspecified;
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, pool));
+ SVN_ERR(svn_client_checkout3(NULL, svn_path_url_add_component2(b->repos_url,
+ "A1", pool),
+ wc_path, &peg_rev, &opt_rev, svn_depth_infinity,
+ TRUE, FALSE, ctx, pool));
+
+ SVN_ERR(svn_client_merge_peg5(svn_path_url_add_component2(b->repos_url, "A",
+ pool),
+ NULL, &opt_rev, wc_path, svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, pool));
+
+ SVN_ERR(svn_client_conflict_get(&conflict,
+ svn_dirent_join(wc_path, "B", b->pool),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+ {
+ 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_move_dir_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_incoming_move_dir_merge);
+ SVN_TEST_ASSERT(option != NULL);
+
+ /* Resolve this conflict. Another one will be raised. */
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_incoming_move_dir_merge, ctx,
+ b->pool));
+
+ SVN_ERR(svn_client_conflict_get(&conflict,
+ svn_dirent_join_many(b->pool,
+ wc_path, "B-moved", "lambda", NULL),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+
+ /* This used to trigger an assertion failure:
+ * svn_tests: E235000: In file 'subversion/libsvn_client/conflicts.c' \
+ * line 2242: assertion failed (start_rev > end_rev) */
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, ctx, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+
+ /* Subversion is not yet smart enough to resolve this tree conflict. */
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
test_update_file_add_vs_unversiond_file(const svn_test_opts_t *opts,
apr_pool_t *pool)
{
@@ -5983,6 +6593,872 @@ test_switch_dir_add_vs_unversioned_dir(const svn_test_opts_t *opts,
return SVN_NO_ERROR;
}
+
+static svn_error_t *
+create_file_move_vs_file_move_merge_conflict(svn_client_conflict_t **conflict,
+ svn_boolean_t edit_file,
+ svn_test__sandbox_t *b,
+ svn_client_ctx_t *ctx)
+{
+ svn_opt_revision_t opt_rev;
+ const char *branch_url;
+
+ /* Create a branch of node "A". */
+ SVN_ERR(sbox_wc_copy(b, "A", "A2"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+
+ /* Move a file on trunk. */
+ SVN_ERR(sbox_wc_move(b, "A/mu", "A/mu-moved"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+
+ /* Move the same file to a different location on the branch. */
+ SVN_ERR(sbox_wc_move(b, "A2/mu", "A2/mu-also-moved"));
+ SVN_ERR(sbox_wc_commit(b, ""));
+ if (edit_file)
+ {
+ /* Edit moved a file on the branch. */
+ SVN_ERR(sbox_file_write(b, "A2/mu-also-moved", modified_file_content));
+ SVN_ERR(sbox_wc_commit(b, ""));
+ }
+
+ /* Merge branch to trunk. */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+ branch_url = apr_pstrcat(b->pool, b->repos_url, "/A2", SVN_VA_NULL);
+ opt_rev.kind = svn_opt_revision_head;
+ opt_rev.value.number = SVN_INVALID_REVNUM;
+ SVN_ERR(svn_client_merge_peg5(branch_url, NULL, &opt_rev,
+ sbox_wc_path(b, "A"),
+ svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, b->pool));
+
+ SVN_ERR(svn_client_conflict_get(conflict, sbox_wc_path(b, "A/mu"),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_details(*conflict, ctx, b->pool));
+ {
+ 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_both_moved_file_merge,
+ svn_client_conflict_option_both_moved_file_move_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(*conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_file_move_vs_file_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+
+ SVN_ERR(svn_test__sandbox_create(b, "merge_file_move_vs_file_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_merge_conflict(&conflict,
+ FALSE, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu"), ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-also-moved" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu-also-moved"), ctx,
+ pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_file_move_vs_file_move_accept_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+
+ SVN_ERR(svn_test__sandbox_create(b,
+ "merge_file_move_vs_file_move_accept_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_merge_conflict(&conflict,
+ FALSE, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_move_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/mu"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-moved" should be moved to "A/mu-also-moved". */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_deleted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_STRING_ASSERT(status->moved_to_abspath,
+ sbox_wc_path(b, "A/mu-also-moved"));
+
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-also-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_added);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_STRING_ASSERT(status->moved_from_abspath,
+ sbox_wc_path(b, "A/mu-moved"));
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_file_edit_move_vs_file_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b, "merge_file_edit_move_vs_file_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_merge_conflict(&conflict,
+ TRUE, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu"), ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-also-moved" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu-also-moved"), ctx,
+ pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Make sure the file has the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/mu-moved"), pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_file_edit_move_vs_file_move_accept_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(
+ b, "merge_file_edit_move_vs_file_move_accept_move", opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_merge_conflict(&conflict,
+ TRUE, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_move_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/mu"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-moved" should be moved to "A/mu-also-moved". */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_deleted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_STRING_ASSERT(status->moved_to_abspath,
+ sbox_wc_path(b, "A/mu-also-moved"));
+
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-also-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_added);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_STRING_ASSERT(status->moved_from_abspath,
+ sbox_wc_path(b, "A/mu-moved"));
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Make sure the file has the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/mu-also-moved"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+create_dir_move_vs_dir_move_merge_conflict(svn_client_conflict_t **conflict,
+ svn_test__sandbox_t *b,
+ svn_client_ctx_t *ctx)
+{
+ svn_opt_revision_t opt_rev;
+ const char *branch_url;
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
+ apr_array_header_t *possible_moved_to_abspaths;
+
+ /* Create a branch of node "A". */
+ SVN_ERR(sbox_wc_copy(b, "A", "A2"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r2 */
+
+ /* Move a directory on trunk. */
+ SVN_ERR(sbox_wc_move(b, "A/B", "A/B-moved"));
+ SVN_ERR(sbox_wc_commit(b, "")); /* r3 */
+
+ /* Edit a file in the moved directory on trunk. */
+ SVN_ERR(sbox_file_write(b, "A/B-moved/E/alpha",
+ modified_file_content));
+ SVN_ERR(sbox_wc_commit(b, ""));
+
+ /* Move the same direcotry to a different location on the branch. */
+ SVN_ERR(sbox_wc_move(b, "A2/B", "A2/B-also-moved"));
+ SVN_ERR(sbox_wc_commit(b, ""));
+
+ /* Edit a file in the moved directory on the branch. */
+ SVN_ERR(sbox_file_write(b, "A2/B-also-moved/lambda",
+ modified_file_content));
+ SVN_ERR(sbox_wc_commit(b, ""));
+
+ /* Merge branch to trunk. */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+ branch_url = apr_pstrcat(b->pool, b->repos_url, "/A2", SVN_VA_NULL);
+ opt_rev.kind = svn_opt_revision_head;
+ opt_rev.value.number = SVN_INVALID_REVNUM;
+ SVN_ERR(svn_client_merge_peg5(branch_url, NULL, &opt_rev,
+ sbox_wc_path(b, "A"),
+ svn_depth_infinity,
+ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, ctx, b->pool));
+
+ SVN_ERR(svn_client_conflict_get(conflict, sbox_wc_path(b, "A/B"),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_details(*conflict, ctx, b->pool));
+ {
+ 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_both_moved_dir_merge,
+ svn_client_conflict_option_both_moved_dir_move_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(*conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, *conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_both_moved_dir_merge);
+ SVN_TEST_ASSERT(option != NULL);
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+
+ /* The resolver finds two possible move destinations because both
+ * branches are checked out into the same working copy.
+ *
+ * Possible working copy destinations for moved-away 'A/B' are:
+ * (1): 'A/B-also-moved
+ * (2): 'A2/B-also-moved
+ * Only one destination can be a move; the others are copies.
+ */
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 2);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/B-also-moved"));
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 1, const char *),
+ sbox_wc_path(b, "A2/B-also-moved"));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_dir_move_vs_dir_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b, "merge_dir_move_vs_dir_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_dir_move_vs_dir_move_merge_conflict(&conflict, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_dir_merge,
+ ctx, b->pool));
+
+ /* The node "A/B" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/B"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/B-also-moved" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict,
+ sbox_wc_path(b, "A/B-also-moved"), ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged directory has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/B-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_dir);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Make sure the edited files have the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/B-moved/lambda"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/B-moved/E/alpha"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_merge_dir_move_vs_dir_move_accept_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+
+ SVN_ERR(svn_test__sandbox_create(b, "merge_dir_move_vs_dir_move_accept_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_dir_move_vs_dir_move_merge_conflict(&conflict, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_dir_move_merge,
+ ctx, b->pool));
+
+ /* The node "A/B" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(&conflict,
+ sbox_wc_path(b, "A/B"),
+ ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/B-moved" should be moved to A/B-also-moved. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/B-moved"),
+ &opt_rev, svn_depth_empty, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_dir);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_deleted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_STRING_ASSERT(status->moved_to_abspath,
+ sbox_wc_path(b, "A/B-also-moved"));
+
+ /* Ensure that the merged directory has the expected status. */
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/B-also-moved"),
+ &opt_rev, svn_depth_empty, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_dir);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_added);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_STRING_ASSERT(status->moved_from_abspath,
+ sbox_wc_path(b, "A/B-moved"));
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Make sure the edited files have the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf,
+ sbox_wc_path(b, "A/B-also-moved/lambda"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+ SVN_ERR(svn_stringbuf_from_file2(&buf,
+ sbox_wc_path(b, "A/B-also-moved/E/alpha"),
+ pool));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_content);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+create_file_move_vs_file_move_update_conflict(svn_client_conflict_t **conflict,
+ svn_test__sandbox_t *b,
+ svn_client_ctx_t *ctx)
+{
+ apr_array_header_t *options;
+ svn_client_conflict_option_t *option;
+ apr_array_header_t *possible_moved_to_abspaths;
+
+ /* Move a file. */
+ SVN_ERR(sbox_wc_move(b, "A/mu", "A/mu-moved"));
+
+ /* Edit moved file. */
+ SVN_ERR(sbox_file_write(b, "A/mu-moved", modified_file_content));
+ SVN_ERR(sbox_wc_commit(b, ""));
+
+ /* Update back to r1, */
+ SVN_ERR(sbox_wc_update(b, "", 1)); /* r2 */
+
+ /* Copy the file to test handling of ambiguous moves. */
+ SVN_ERR(sbox_wc_copy(b, "A/mu", "A/mu-copied"));
+
+ /* Move the same file to a different location. */
+ SVN_ERR(sbox_wc_move(b, "A/mu", "A/mu-also-moved"));
+
+ /* Edit moved file. */
+ SVN_ERR(sbox_file_write(b, "A/mu-also-moved",
+ modified_file_in_working_copy_content));
+
+ /* Update to r2. */
+ /* This should raise an "incoming delete vs local delete" tree conflict. */
+ SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ SVN_ERR(svn_client_conflict_get(conflict, sbox_wc_path(b, "A/mu"),
+ ctx, b->pool, b->pool));
+ {
+ 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,
+ b->pool));
+ }
+
+ SVN_ERR(svn_client_conflict_tree_get_details(*conflict, ctx, b->pool));
+ {
+ 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_both_moved_file_merge,
+ svn_client_conflict_option_both_moved_file_move_merge,
+ -1 /* end of list */
+ };
+ SVN_ERR(assert_tree_conflict_options(*conflict, ctx, expected_opts,
+ b->pool));
+ }
+
+ /* Check possible move destinations for the file. */
+ SVN_ERR(svn_client_conflict_tree_get_resolution_options(&options, *conflict,
+ ctx, b->pool,
+ b->pool));
+ option = svn_client_conflict_option_find_by_id(
+ options, svn_client_conflict_option_both_moved_file_merge);
+ SVN_TEST_ASSERT(option != NULL);
+
+ SVN_ERR(svn_client_conflict_option_get_moved_to_abspath_candidates(
+ &possible_moved_to_abspaths, option, b->pool, b->pool));
+
+ /* The resolver finds two possible destinations for the moved file:
+ *
+ * Possible working copy destinations for moved-away 'A/mu' are:
+ * (1): 'A/mu-also-moved'
+ * (2): 'A/mu-copied'
+ * Only one destination can be a move; the others are copies.
+ */
+ SVN_TEST_INT_ASSERT(possible_moved_to_abspaths->nelts, 2);
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 0, const char *),
+ sbox_wc_path(b, "A/mu-also-moved"));
+ SVN_TEST_STRING_ASSERT(
+ APR_ARRAY_IDX(possible_moved_to_abspaths, 1, const char *),
+ sbox_wc_path(b, "A/mu-copied"));
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_update_file_move_vs_file_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+ svn_node_kind_t kind;
+ char *conflicted_content;
+
+ SVN_ERR(svn_test__sandbox_create(b, "update_file_move_vs_file_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_update_conflict(&conflict, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu"), ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-moved" should now have moved to "A/mu-also-moved. */
+ SVN_ERR(svn_io_check_path(sbox_wc_path(b, "A/mu"), &kind, b->pool));
+ SVN_TEST_ASSERT(kind == svn_node_none);
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(!status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_deleted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_STRING_ASSERT(status->moved_to_abspath,
+ sbox_wc_path(b, "A/mu-also-moved"));
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-also-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_conflicted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_conflicted);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_STRING_ASSERT(status->moved_from_abspath,
+ sbox_wc_path(b, "A/mu-moved"));
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Ensure that the moved+merged file has the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/mu-also-moved"),
+ b->pool));
+ conflicted_content = apr_psprintf(b->pool,
+ "<<<<<<< .working\n"
+ "%s"
+ "||||||| .old\n"
+ "This is the file 'mu'.\n"
+ "=======\n"
+ "%s"
+ ">>>>>>> .new\n",
+ modified_file_in_working_copy_content,
+ modified_file_content);
+ SVN_TEST_STRING_ASSERT(buf->data, conflicted_content);
+
+ return SVN_NO_ERROR;
+}
+
+/* Same test case as above, but accept the incoming move. */
+static svn_error_t *
+test_update_file_move_vs_file_move_accept_move(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_client_conflict_t *conflict;
+ svn_opt_revision_t opt_rev;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+ char *conflicted_content;
+
+ SVN_ERR(svn_test__sandbox_create(b,
+ "update_file_move_vs_file_move_accept_move",
+ opts, pool));
+
+ SVN_ERR(sbox_add_and_commit_greek_tree(b)); /* r1 */
+
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(create_file_move_vs_file_move_update_conflict(&conflict, b, ctx));
+
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict,
+ svn_client_conflict_option_both_moved_file_move_merge,
+ ctx, b->pool));
+
+ /* The node "A/mu" should no longer exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu"), ctx, pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* The node "A/mu-also-moved" should not exist. */
+ SVN_TEST_ASSERT_ERROR(svn_client_conflict_get(
+ &conflict, sbox_wc_path(b, "A/mu-also-moved"), ctx,
+ pool, pool),
+ SVN_ERR_WC_PATH_NOT_FOUND);
+
+ /* Ensure that the merged file has the expected status. */
+ opt_rev.kind = svn_opt_revision_working;
+ sb.result_pool = b->pool;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, "A/mu-moved"),
+ &opt_rev, svn_depth_unknown, TRUE, TRUE,
+ TRUE, TRUE, FALSE, TRUE, NULL,
+ status_func, &sb, b->pool));
+ status = sb.status;
+ SVN_TEST_ASSERT(status->kind == svn_node_file);
+ SVN_TEST_ASSERT(status->versioned);
+ SVN_TEST_ASSERT(status->conflicted);
+ SVN_TEST_ASSERT(status->node_status == svn_wc_status_conflicted);
+ SVN_TEST_ASSERT(status->text_status == svn_wc_status_conflicted);
+ SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+ SVN_TEST_ASSERT(!status->copied);
+ SVN_TEST_ASSERT(!status->switched);
+ SVN_TEST_ASSERT(!status->file_external);
+ SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Ensure that the moved+merged file has the expected content. */
+ SVN_ERR(svn_stringbuf_from_file2(&buf, sbox_wc_path(b, "A/mu-moved"),
+ b->pool));
+ conflicted_content = apr_psprintf(b->pool,
+ "<<<<<<< .working\n" /* ### labels need fixing */
+ "%s"
+ "||||||| .old\n"
+ "This is the file 'mu'.\n"
+ "=======\n"
+ "%s"
+ ">>>>>>> .new\n",
+ modified_file_content,
+ modified_file_in_working_copy_content);
+ SVN_TEST_STRING_ASSERT(buf->data, conflicted_content);
+
+ return SVN_NO_ERROR;
+}
+
+
/* ========================================================================== */
@@ -6069,7 +7545,7 @@ static struct svn_test_descriptor_t test_funcs[] =
"merge incoming move file merge with CRLF eols"),
SVN_TEST_OPTS_PASS(test_merge_incoming_move_file_text_merge_native_eol,
"merge incoming move file merge with native eols"),
- SVN_TEST_OPTS_XFAIL(test_cherry_pick_post_move_edit,
+ SVN_TEST_OPTS_PASS(test_cherry_pick_post_move_edit,
"cherry-pick edit from moved file"),
SVN_TEST_OPTS_PASS(test_merge_incoming_move_dir_across_branches,
"merge incoming dir move across branches"),
@@ -6079,6 +7555,14 @@ static struct svn_test_descriptor_t test_funcs[] =
"merge two added dirs assertion failure (#4744)"),
SVN_TEST_OPTS_PASS(test_merge_incoming_delete_file_unrelated_move,
"do not suggest unrelated move targets (#4766)"),
+ SVN_TEST_OPTS_PASS(test_cherry_pick_post_move_edit_dir,
+ "cherry-pick edit from moved directory"),
+ SVN_TEST_OPTS_PASS(test_local_missing_abiguous_moves,
+ "local missing conflict with ambiguous moves"),
+ SVN_TEST_OPTS_PASS(test_local_missing_abiguous_moves_dir,
+ "local missing conflict with ambiguous dir moves"),
+ SVN_TEST_OPTS_PASS(test_file_vs_dir_move_merge_assertion_failure,
+ "file v dir move merge assertion failure"),
SVN_TEST_OPTS_PASS(test_update_file_add_vs_unversiond_file,
"file add vs unversioned file during update"),
SVN_TEST_OPTS_PASS(test_switch_file_add_vs_unversiond_file,
@@ -6087,6 +7571,22 @@ static struct svn_test_descriptor_t test_funcs[] =
"dir add vs unversioned dir during update"),
SVN_TEST_OPTS_PASS(test_switch_dir_add_vs_unversioned_dir,
"dir add vs unversioned dir during switch"),
+ SVN_TEST_OPTS_PASS(test_merge_file_move_vs_file_move,
+ "file move vs file move during merge"),
+ SVN_TEST_OPTS_PASS(test_merge_file_move_vs_file_move_accept_move,
+ "file move vs file move during merge accept move"),
+ SVN_TEST_OPTS_PASS(test_merge_file_edit_move_vs_file_move,
+ "file move vs file edit-move during merge"),
+ SVN_TEST_OPTS_PASS(test_merge_file_edit_move_vs_file_move_accept_move,
+ "file edit-move vs file move merge accept move"),
+ SVN_TEST_OPTS_PASS(test_merge_dir_move_vs_dir_move,
+ "dir move vs dir move during merge"),
+ SVN_TEST_OPTS_PASS(test_merge_dir_move_vs_dir_move_accept_move,
+ "dir move vs dir move during merge accept move"),
+ SVN_TEST_OPTS_PASS(test_update_file_move_vs_file_move,
+ "file move vs file move during update"),
+ SVN_TEST_OPTS_PASS(test_update_file_move_vs_file_move_accept_move,
+ "file move vs file move during update accept move"),
SVN_TEST_NULL
};