subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1751664 - /subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c
Date Wed, 06 Jul 2016 11:58:34 GMT
Author: stsp
Date: Wed Jul  6 11:58:34 2016
New Revision: 1751664

URL: http://svn.apache.org/viewvc?rev=1751664&view=rev
Log:
Add another regression test for the conflict resolver.

This tests the 'R' option in the file add vs file add upon update case.

* subversion/tests/libsvn_client/conflicts-test.c
  (test_update_incoming_added_file_replace, test_funcs): 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=1751664&r1=1751663&r2=1751664&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/conflicts-test.c Wed Jul  6 11:58:34 2016
@@ -629,6 +629,78 @@ test_update_incoming_added_file_ignore(c
 }
 
 static svn_error_t *
+test_update_incoming_added_file_replace(const svn_test_opts_t *opts,
+                                       apr_pool_t *pool)
+{
+  svn_client_ctx_t *ctx;
+  svn_client_conflict_t *conflict;
+  const char *new_file_path;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  svn_boolean_t tree_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+  const svn_string_t *propval;
+
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+
+  SVN_ERR(svn_test__sandbox_create(b, "update_incoming_added_file_replace",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_file_add_vs_file_add_update_conflict(b));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  new_file_path = svn_relpath_join(trunk_path, new_file_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_file_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict, svn_client_conflict_option_incoming_added_file_replace,
+            b->pool));
+
+  /* Ensure that the file has the expected status. */
+  opt_rev.kind = svn_opt_revision_head;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, new_file_path),
+                             &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_normal);
+  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);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_file_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The file should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  /* Verify the merged property value. */
+  SVN_ERR(svn_wc_prop_get2(&propval, ctx->wc_ctx,
+                           sbox_wc_path(b, new_file_path),
+                           "prop", b->pool, b->pool));
+  SVN_TEST_STRING_ASSERT(propval->data, propval_trunk);
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 test_switch_incoming_added_file_ignore(const svn_test_opts_t *opts,
                                        apr_pool_t *pool)
 {
@@ -1939,6 +2011,8 @@ static struct svn_test_descriptor_t test
                        "merge incoming add file replace and merge"),
     SVN_TEST_OPTS_PASS(test_update_incoming_added_file_ignore,
                        "update incoming add file ignore"),
+    SVN_TEST_OPTS_PASS(test_update_incoming_added_file_replace,
+                       "update incoming add file replace"),
     SVN_TEST_OPTS_PASS(test_switch_incoming_added_file_ignore,
                        "switch incoming add file ignore"),
     SVN_TEST_OPTS_PASS(test_merge_incoming_added_dir_ignore,



Mime
View raw message