You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/01/08 17:47:43 UTC
svn commit: r1430376 - in /subversion/trunk/subversion/tests/libsvn_wc:
op-depth-test.c utils.c utils.h
Author: rhuijben
Date: Tue Jan 8 16:47:42 2013
New Revision: 1430376
URL: http://svn.apache.org/viewvc?rev=1430376&view=rev
Log:
Add a new op-depth test, verifying move behavior before and after an
op_root only commit.
* subversion/tests/libsvn_wc/op-depth-test.c
(nested_move_commit): New test.
(test_list): Add test as XFail.
* subversion/tests/libsvn_wc/utils.c
(sbox_wc_commit_ex): New function, allowing multiple targets and
an explicit depth.
(sbox_wc_commit): Implement on top of sbox_wc_commit_ex.
* subversion/tests/libsvn_wc/utils.h
(sbox_wc_commit_ex): New function.
Modified:
subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
subversion/trunk/subversion/tests/libsvn_wc/utils.c
subversion/trunk/subversion/tests/libsvn_wc/utils.h
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=1430376&r1=1430375&r2=1430376&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Tue Jan 8 16:47:42 2013
@@ -5226,6 +5226,174 @@ nested_move_update(const svn_test_opts_t
return SVN_NO_ERROR;
}
+static svn_error_t *
+nested_move_commit(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+ svn_test__sandbox_t b;
+
+ SVN_ERR(svn_test__sandbox_create(&b, "nested_move_update", opts, pool));
+
+ /* r1: Create file 'f' */
+ SVN_ERR(sbox_wc_mkdir(&b, "A"));
+ SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
+ SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
+ sbox_file_write(&b, "A/B/C/f", "r1 content\n");
+ SVN_ERR(sbox_wc_add(&b, "A/B/C/f"));
+ SVN_ERR(sbox_wc_commit(&b, ""));
+ SVN_ERR(sbox_wc_update(&b, "", 1));
+
+ SVN_ERR(sbox_wc_move(&b, "A/B/C", "C2"));
+
+ {
+ const char *moved_to;
+ const char *expected_to;
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL, &moved_to,
+ b.wc_ctx->db, sbox_wc_path(&b, "A/B/C"),
+ pool, pool));
+
+ expected_to = sbox_wc_path(&b, "C2");
+
+ if (strcmp(moved_to, expected_to) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved to %s, but was %s",
+ expected_to, moved_to);
+ }
+ {
+ const char *moved_from;
+ const char *expected_from;
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &moved_from, NULL,
+ b.wc_ctx->db, sbox_wc_path(&b, "C2"),
+ pool, pool));
+
+ expected_from = sbox_wc_path(&b, "A/B/C");
+
+ if (strcmp(moved_from, expected_from) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved from %s, but was %s",
+ expected_from, moved_from);
+ }
+
+ SVN_ERR(sbox_wc_move(&b, "A", "A2"));
+ {
+ nodes_row_t nodes[] = {
+ {0, "", "normal", 1, ""},
+ {0, "A", "normal", 1, "A"},
+ {0, "A/B", "normal", 1, "A/B"},
+ {0, "A/B/C", "normal", 1, "A/B/C"},
+ {0, "A/B/C/f", "normal", 1, "A/B/C/f"},
+ {1, "A", "base-deleted", NO_COPY_FROM, "A2"},
+ {1, "A/B", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/C", "base-deleted", NO_COPY_FROM},
+ {1, "A/B/C/f", "base-deleted", NO_COPY_FROM},
+ {1, "A2", "normal", 1, "A", MOVED_HERE},
+ {1, "A2/B", "normal", 1, "A/B", MOVED_HERE},
+ {1, "A2/B/C", "normal", 1, "A/B/C", MOVED_HERE},
+ {1, "A2/B/C/f", "normal", 1, "A/B/C/f", MOVED_HERE},
+ {3, "A2/B/C", "base-deleted", NO_COPY_FROM, "C2"},
+ {3, "A2/B/C/f", "base-deleted", NO_COPY_FROM},
+ {1, "C2", "normal", 1, "A/B/C", MOVED_HERE},
+ {1, "C2/f", "normal", 1, "A/B/C/f", MOVED_HERE},
+ {0}
+ };
+ SVN_ERR(check_db_rows(&b, "", nodes));
+ }
+
+ {
+ const char *moved_to;
+ const char *expected_to;
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL, &moved_to,
+ b.wc_ctx->db, sbox_wc_path(&b, "A/B/C"),
+ pool, pool));
+
+ expected_to = sbox_wc_path(&b, "A2" /* ### I would have expected "C2" */);
+
+ if (strcmp(moved_to, expected_to) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved to %s, but was %s",
+ expected_to, moved_to);
+ }
+ {
+ const char *moved_from;
+ const char *expected_from;
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &moved_from, NULL,
+ b.wc_ctx->db, sbox_wc_path(&b, "C2"),
+ pool, pool));
+
+ expected_from = sbox_wc_path(&b, "A2/B/C"
+ /* ### I would have expected "A/B/C" */);
+
+ if (strcmp(moved_from, expected_from) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved from %s, but was %s",
+ expected_from, moved_from);
+ }
+
+ {
+ apr_array_header_t *targets = apr_array_make(pool, 2, sizeof(const char *));
+
+ APR_ARRAY_PUSH(targets, const char *) = sbox_wc_path(&b, "A");
+ APR_ARRAY_PUSH(targets, const char *) = sbox_wc_path(&b, "A2");
+
+ SVN_ERR(sbox_wc_commit_ex(&b, targets, svn_depth_empty));
+ }
+
+ {
+ nodes_row_t nodes[] = {
+ {0, "", "normal", 1, ""},
+ {0, "A", "not-present", 2, "A"},
+ {0, "A2", "normal", 2, "A2"},
+ {0, "A2/B", "normal", 2, "A2/B"},
+ {0, "A2/B/C", "normal", 2, "A2/B/C"},
+ {0, "A2/B/C/f", "normal", 2, "A2/B/C/f"},
+ {3, "A2/B/C", "base-deleted", NO_COPY_FROM, "C2"},
+ {3, "A2/B/C/f", "base-deleted", NO_COPY_FROM},
+
+ /* Currently these are recorded as a move but still
+ have the copy history from ^/A/B/C@1 */
+ {1, "C2", "normal", 2, "A2/B/C", MOVED_HERE},
+ {1, "C2/f", "normal", 2, "A2/B/C/f", MOVED_HERE},
+ {0}
+ };
+ SVN_ERR(check_db_rows(&b, "", nodes));
+ }
+
+ {
+ const char *moved_to;
+ const char *expected_to;
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL, &moved_to,
+ b.wc_ctx->db, sbox_wc_path(&b, "A2/B/C"),
+ pool, pool));
+
+ expected_to = sbox_wc_path(&b, "C2");
+
+ if (strcmp(moved_to, expected_to) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved to %s, but was %s",
+ expected_to, moved_to);
+ }
+
+ {
+ const char *moved_from;
+ const char *expected_from;
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &moved_from, NULL,
+ b.wc_ctx->db, sbox_wc_path(&b, "C2"),
+ pool, pool));
+
+ expected_from = sbox_wc_path(&b, "A2/B/C");
+
+ if (strcmp(moved_from, expected_from) != 0)
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+ "Expected moved from %s, but was %s",
+ expected_from, moved_from);
+ }
+
+
+ return SVN_NO_ERROR;
+}
+
/* ---------------------------------------------------------------------- */
/* The list of test functions */
@@ -5327,5 +5495,7 @@ struct svn_test_descriptor_t test_funcs[
"update_prop_mod_into_moved"),
SVN_TEST_OPTS_PASS(nested_move_update,
"nested_move_update"),
+ SVN_TEST_OPTS_XFAIL(nested_move_commit,
+ "nested_move_commit"),
SVN_TEST_NULL
};
Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.c?rev=1430376&r1=1430375&r2=1430376&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Tue Jan 8 16:47:42 2013
@@ -287,16 +287,14 @@ sbox_wc_exclude(svn_test__sandbox_t *b,
}
svn_error_t *
-sbox_wc_commit(svn_test__sandbox_t *b, const char *path)
+sbox_wc_commit_ex(svn_test__sandbox_t *b,
+ apr_array_header_t *targets,
+ svn_depth_t depth)
{
svn_client_ctx_t *ctx;
- apr_array_header_t *targets = apr_array_make(b->pool, 1,
- sizeof(const char *));
-
- APR_ARRAY_PUSH(targets, const char *) = sbox_wc_path(b, path);
SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
ctx->wc_ctx = b->wc_ctx;
- return svn_client_commit6(targets, svn_depth_infinity,
+ return svn_client_commit6(targets, depth,
FALSE /* keep_locks */,
FALSE /* keep_changelist */,
TRUE /* commit_as_operations */,
@@ -306,6 +304,16 @@ sbox_wc_commit(svn_test__sandbox_t *b, c
}
svn_error_t *
+sbox_wc_commit(svn_test__sandbox_t *b, const char *path)
+{
+ apr_array_header_t *targets = apr_array_make(b->pool, 1,
+ sizeof(const char *));
+
+ APR_ARRAY_PUSH(targets, const char *) = sbox_wc_path(b, path);
+ return sbox_wc_commit_ex(b, targets, svn_depth_infinity);
+}
+
+svn_error_t *
sbox_wc_update(svn_test__sandbox_t *b, const char *path, svn_revnum_t revnum)
{
svn_client_ctx_t *ctx;
Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.h?rev=1430376&r1=1430375&r2=1430376&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.h (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.h Tue Jan 8 16:47:42 2013
@@ -122,6 +122,12 @@ sbox_wc_commit(svn_test__sandbox_t *b, c
/* */
svn_error_t *
+sbox_wc_commit_ex(svn_test__sandbox_t *b,
+ apr_array_header_t *targets,
+ svn_depth_t depth);
+
+/* */
+svn_error_t *
sbox_wc_update(svn_test__sandbox_t *b, const char *path, svn_revnum_t revnum);
/* */