diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/tests/libsvn_wc/wc-test.c | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/tests/libsvn_wc/wc-test.c')
-rw-r--r-- | subversion/tests/libsvn_wc/wc-test.c | 143 |
1 files changed, 140 insertions, 3 deletions
diff --git a/subversion/tests/libsvn_wc/wc-test.c b/subversion/tests/libsvn_wc/wc-test.c index 30eb18a..8910cb0 100644 --- a/subversion/tests/libsvn_wc/wc-test.c +++ b/subversion/tests/libsvn_wc/wc-test.c @@ -23,6 +23,9 @@ #include <apr_pools.h> #include <apr_general.h> +#include <apr_md5.h> + +#define SVN_DEPRECATED #include "svn_types.h" #include "svn_io.h" @@ -71,7 +74,7 @@ struct base_origin_t }; /* Data for testing node_get_base and node_get_origin. */ -struct base_origin_t base_origin_subtests[] = +static struct base_origin_t base_origin_subtests[] = { /* file copied onto nothing */ { "A/C/copy1", -1, "iota", {"iota", 1} }, @@ -138,7 +141,6 @@ test_node_get_base(const svn_test_opts_t *opts, apr_pool_t *pool) NULL, b->wc_ctx, local_abspath, TRUE /* ignore_enoent */, - FALSE /* show_hidden */, b->pool, b->pool)); SVN_TEST_ASSERT(revision == subtest->base_rev); if (SVN_IS_VALID_REVNUM(subtest->base_rev)) @@ -181,6 +183,7 @@ test_node_get_origin(const svn_test_opts_t *opts, apr_pool_t *pool) SVN_ERR(svn_wc__node_get_origin(NULL, &revision, &repos_relpath, &repos_root_url, &repos_uuid, NULL, + NULL, b->wc_ctx, local_abspath, FALSE, b->pool, b->pool)); SVN_TEST_ASSERT(revision == subtest->origin.rev); @@ -304,11 +307,139 @@ test_externals_parse_erratic(apr_pool_t *pool) return SVN_NO_ERROR; } +static svn_error_t * +test_legacy_commit1(const svn_test_opts_t *opts, apr_pool_t *pool) +{ + svn_test__sandbox_t b; + svn_wc_adm_access_t *adm_access; + const char *lambda; + + SVN_ERR(svn_test__sandbox_create(&b, "legacy_commit1", opts, pool)); + SVN_ERR(sbox_add_and_commit_greek_tree(&b)); + + SVN_ERR(sbox_wc_copy(&b, "A", "A_copied")); + + lambda = sbox_wc_path(&b, "A_copied/B/lambda"); + + + SVN_ERR(svn_io_remove_file2(lambda, FALSE, pool)); + SVN_ERR(svn_io_copy_file(sbox_wc_path(&b, "iota"), lambda, FALSE, pool)); + SVN_ERR(svn_wc_adm_open3(&adm_access, NULL, b.wc_abspath, TRUE, -1, + NULL, NULL, pool)); + + { + svn_wc_status2_t *status; + + SVN_ERR(svn_wc_status2(&status, lambda, adm_access, pool)); + + SVN_TEST_ASSERT(status != NULL); + SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified); + SVN_TEST_ASSERT(status->copied == TRUE); + } + + /* Simulate a very old style svn ci . -m "QQQ" on the WC root */ + SVN_ERR(svn_wc_process_committed4(sbox_wc_path(&b, "A_copied"), adm_access, + TRUE, 12, "2014-10-01T19:00:50.966679Z", + "me", NULL, TRUE, TRUE, + NULL, pool)); + + { + unsigned char digest[APR_MD5_DIGESTSIZE]; + + /* Use the fact that iota has the same checksum to ease committing */ + + SVN_ERR(svn_io_file_checksum (digest, lambda, pool)); + + SVN_ERR(svn_wc_process_committed4(lambda, adm_access, + TRUE, 12, "2014-10-01T19:00:50.966679Z", + "me", NULL, TRUE, TRUE, + digest, pool)); + } + + { + svn_wc_status2_t *status; + + SVN_ERR(svn_wc_status2(&status, lambda, adm_access, pool)); + + /* Node is still modified, as we didn't change the text base! */ + SVN_TEST_ASSERT(status != NULL); + SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal); + SVN_TEST_ASSERT(status->copied == FALSE); + } + + return SVN_NO_ERROR; +} + +static svn_error_t * +test_legacy_commit2(const svn_test_opts_t *opts, apr_pool_t *pool) +{ + svn_test__sandbox_t b; + svn_wc_adm_access_t *adm_access; + const char *lambda; + svn_wc_committed_queue_t *queue; + + SVN_ERR(svn_test__sandbox_create(&b, "legacy_commit2", opts, pool)); + SVN_ERR(sbox_add_and_commit_greek_tree(&b)); + + SVN_ERR(sbox_wc_copy(&b, "A", "A_copied")); + + lambda = sbox_wc_path(&b, "A_copied/B/lambda"); + + SVN_ERR(svn_io_remove_file2(lambda, FALSE, pool)); + SVN_ERR(svn_io_copy_file(sbox_wc_path(&b, "iota"), lambda, FALSE, pool)); + + SVN_ERR(svn_wc_adm_open3(&adm_access, NULL, b.wc_abspath, TRUE, -1, + NULL, NULL, pool)); + + { + svn_wc_status2_t *status; + + SVN_ERR(svn_wc_status2(&status, lambda, adm_access, pool)); + + SVN_TEST_ASSERT(status != NULL); + SVN_TEST_ASSERT(status->text_status == svn_wc_status_modified); + SVN_TEST_ASSERT(status->copied == TRUE); + } + + /* Simulate an old style svn ci . -m "QQQ" on the WC root */ + queue = svn_wc_committed_queue_create(pool); + SVN_ERR(svn_wc_queue_committed(&queue, sbox_wc_path(&b, "A_copied"), adm_access, + TRUE, NULL, FALSE, FALSE, NULL, pool)); + { + unsigned char digest[APR_MD5_DIGESTSIZE]; + + /* Use the fact that iota has the same checksum to ease committing */ + + SVN_ERR(svn_io_file_checksum(digest, lambda, pool)); + + SVN_ERR(svn_wc_queue_committed(&queue, lambda, adm_access, FALSE, NULL, + FALSE, FALSE, digest, pool)); + } + + SVN_ERR(svn_wc_process_committed_queue(queue, adm_access, + 12, "2014-10-01T19:00:50.966679Z", + "me", pool)); + + { + svn_wc_status2_t *status; + + SVN_ERR(svn_wc_status2(&status, lambda, adm_access, pool)); + + /* Node is still modified, as we didn't change the text base! */ + SVN_TEST_ASSERT(status != NULL); + SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal); + SVN_TEST_ASSERT(status->copied == FALSE); + } + + return SVN_NO_ERROR; +} /* ---------------------------------------------------------------------- */ /* The list of test functions */ -struct svn_test_descriptor_t test_funcs[] = +static int max_threads = 2; + +static struct svn_test_descriptor_t test_funcs[] = { SVN_TEST_NULL, SVN_TEST_OPTS_PASS(test_node_get_base, @@ -319,5 +450,11 @@ struct svn_test_descriptor_t test_funcs[] = "test svn_wc_parse_externals_description3"), SVN_TEST_PASS2(test_externals_parse_erratic, "parse erratic externals definition"), + SVN_TEST_OPTS_PASS(test_legacy_commit1, + "test legacy commit1"), + SVN_TEST_OPTS_PASS(test_legacy_commit2, + "test legacy commit2"), SVN_TEST_NULL }; + +SVN_TEST_MAIN |