You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/07/25 14:45:08 UTC
svn commit: r1754024 -
/subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
Author: stsp
Date: Mon Jul 25 14:45:07 2016
New Revision: 1754024
URL: http://svn.apache.org/viewvc?rev=1754024&view=rev
Log:
Add an XFAIL test for the 'incoming move dir merge' resolver option.
* subversion/tests/libsvn_client/conflicts-test.c
(modified_file_in_working_copy_content): New constant.
(create_wc_with_incoming_delete_dir_conflict): Add 'local_mod' paramter
which triggers a merge into a working copy with local modifications.
(test_merge_incoming_move_dir): Pass FALSE for new 'local_mod' parameter.
(test_merge_incoming_move_dir2): New XFAIL test. Tests the same situation as
test_merge_incoming_move_dir, but with a local mod in the working copy.
(test_funcs): Add 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=1754024&r1=1754023&r2=1754024&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Mon Jul 25 14:45:07 2016
@@ -73,6 +73,8 @@ static const char *propval_branch = "Thi
/* File content. */
static const char *modified_file_on_branch_content =
"This is a modified file on the branch\n";
+static const char *modified_file_in_working_copy_content =
+ "This is a modified file in the working copy\n";
/* A helper function which prepares a working copy for the tests below. */
static svn_error_t *
@@ -1999,7 +2001,8 @@ test_switch_incoming_move_file_text_merg
static svn_error_t *
create_wc_with_incoming_delete_dir_conflict(svn_test__sandbox_t *b,
svn_boolean_t move,
- svn_boolean_t do_switch)
+ svn_boolean_t do_switch,
+ svn_boolean_t local_mod)
{
svn_client_ctx_t *ctx;
static const char *trunk_url;
@@ -2061,6 +2064,14 @@ create_wc_with_incoming_delete_dir_confl
/* Commit modifcation and run a merge from the trunk to the branch. */
SVN_ERR(sbox_wc_commit(b, ""));
SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+
+ if (local_mod)
+ {
+ /* Modify the file in the working copy. */
+ SVN_ERR(sbox_file_write(b, deleted_child_path,
+ modified_file_in_working_copy_content));
+ }
+
/* This should raise an "incoming delete vs local edit" tree conflict. */
SVN_ERR(svn_client_merge_peg5(trunk_url, NULL, &opt_rev,
sbox_wc_path(b, branch_path),
@@ -2090,7 +2101,7 @@ test_merge_incoming_move_dir(const svn_t
SVN_ERR(svn_test__sandbox_create(b, "merge_incoming_move_dir", opts, pool));
- SVN_ERR(create_wc_with_incoming_delete_dir_conflict(b, TRUE, FALSE));
+ SVN_ERR(create_wc_with_incoming_delete_dir_conflict(b, TRUE, FALSE, FALSE));
deleted_path = svn_relpath_join(branch_path, deleted_dir_name, b->pool);
moved_to_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
@@ -2161,6 +2172,95 @@ test_merge_incoming_move_dir(const svn_t
return SVN_NO_ERROR;
}
+/* Test 'incoming move dir merge' resolution option with local mods. */
+static svn_error_t *
+test_merge_incoming_move_dir2(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;
+ const char *deleted_path;
+ const char *moved_to_path;
+ const char *child_path;
+ svn_client_conflict_t *conflict;
+ struct status_baton sb;
+ struct svn_client_status_t *status;
+ svn_stringbuf_t *buf;
+ svn_stream_t *stream;
+ svn_opt_revision_t opt_rev;
+
+ SVN_ERR(svn_test__sandbox_create(b, "merge_incoming_move_dir2", opts, pool));
+
+ SVN_ERR(create_wc_with_incoming_delete_dir_conflict(b, TRUE, FALSE, TRUE));
+
+ deleted_path = svn_relpath_join(branch_path, deleted_dir_name, b->pool);
+ moved_to_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
+
+ /* Resolve the tree conflict. */
+ SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
+ ctx, b->pool, b->pool));
+ SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+ SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+ conflict, svn_client_conflict_option_incoming_move_dir_merge,
+ b->pool));
+
+ /* Ensure that the moved-away directory has the expected status. */
+ sb.result_pool = b->pool;
+ opt_rev.kind = svn_opt_revision_working;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, deleted_path),
+ &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, moved_to_path));
+
+ /* Ensure that the moved-here directory has the expected status. */
+ sb.result_pool = b->pool;
+ opt_rev.kind = svn_opt_revision_working;
+ SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, moved_to_path),
+ &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_modified);
+ 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, deleted_path));
+ SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+ /* Ensure that the edited file has the expected content. */
+ child_path = svn_relpath_join(branch_path,
+ svn_relpath_join(deleted_dir_name,
+ deleted_dir_child,
+ b->pool),
+ b->pool);
+ SVN_ERR(svn_stream_open_readonly(&stream, sbox_wc_path(b, child_path),
+ b->pool, b->pool));
+ SVN_ERR(svn_stringbuf_from_stream(&buf, stream, 0, b->pool));
+ SVN_ERR(svn_stream_close(stream));
+ SVN_TEST_STRING_ASSERT(buf->data, modified_file_in_working_copy_content);
+
+ return SVN_NO_ERROR;
+}
+
/* ========================================================================== */
@@ -2208,6 +2308,8 @@ static struct svn_test_descriptor_t test
SVN_TEST_OPTS_PASS(test_switch_incoming_move_file_text_merge,
"switch incoming move file text merge"),
SVN_TEST_OPTS_PASS(test_merge_incoming_move_dir, "merge incoming move dir"),
+ SVN_TEST_OPTS_XFAIL(test_merge_incoming_move_dir2,
+ "merge incoming move dir with local mods"),
SVN_TEST_NULL
};