Modified: subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c Sat Feb 28 10:37:27 2015 @@ -5100,15 +5100,11 @@ filename_trailing_newline(const svn_test svn_fs_root_t *txn_root, *root; svn_revnum_t youngest_rev = 0; svn_error_t *err; - svn_boolean_t legacy_backend; - static const char contents[] = "foo\003bar"; - - /* The FS API wants \n to be permitted, but FSFS never implemented that, - * so for FSFS we expect errors rather than successes in some of the commits. - * Use a blacklist approach so that new FSes default to implementing the API - * as originally defined. */ - legacy_backend = (!strcmp(opts->fs_type, SVN_FS_TYPE_FSFS)); + /* The FS API wants \n to be permitted, but FSFS never implemented that. + * Moreover, formats like svn:mergeinfo and svn:externals don't support + * it either. So, we can't have newlines in file names in any FS. + */ SVN_ERR(svn_test__create_fs(&fs, "test-repo-filename-trailing-newline", opts, pool)); @@ -5120,64 +5116,20 @@ filename_trailing_newline(const svn_test SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev)); svn_pool_clear(subpool); - /* Attempt to copy /foo to "/bar\n". This should fail on FSFS. */ + /* Attempt to copy /foo to "/bar\n". This should fail. */ SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, subpool)); SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool)); SVN_ERR(svn_fs_revision_root(&root, fs, youngest_rev, subpool)); err = svn_fs_copy(root, "/foo", txn_root, "/bar\n", subpool); - if (!legacy_backend) - SVN_TEST_ASSERT(err == SVN_NO_ERROR); - else - SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); + SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); - /* Attempt to create a file /foo/baz\n. This should fail on FSFS. */ + /* Attempt to create a file /foo/baz\n. This should fail. */ err = svn_fs_make_file(txn_root, "/foo/baz\n", subpool); - if (!legacy_backend) - SVN_TEST_ASSERT(err == SVN_NO_ERROR); - else - SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); - - - /* Create another file, with contents. */ - if (!legacy_backend) - { - SVN_ERR(svn_fs_make_file(txn_root, "/bar\n/baz\n", subpool)); - SVN_ERR(svn_test__set_file_contents(txn_root, "bar\n/baz\n", - contents, pool)); - } - - if (!legacy_backend) - { - svn_revnum_t after_rev; - static svn_test__tree_entry_t expected_entries[] = { - { "foo", NULL }, - { "bar\n", NULL }, - { "foo/baz\n", "" }, - { "bar\n/baz\n", contents }, - { NULL, NULL } - }; - const char *expected_changed_paths[] = { - "/bar\n", - "/foo/baz\n", - "/bar\n/baz\n", - NULL - }; - apr_hash_t *expected_changes = apr_hash_make(pool); - int i; - - SVN_ERR(svn_fs_commit_txn(NULL, &after_rev, txn, subpool)); - SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(after_rev)); - - /* Validate the DAG. */ - SVN_ERR(svn_fs_revision_root(&root, fs, after_rev, pool)); - SVN_ERR(svn_test__validate_tree(root, expected_entries, 4, pool)); - - /* Validate changed-paths, where the problem originally occurred. */ - for (i = 0; expected_changed_paths[i]; i++) - svn_hash_sets(expected_changes, expected_changed_paths[i], - "undefined value"); - SVN_ERR(svn_test__validate_changes(root, expected_changes, pool)); - } + SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); + + /* Attempt to create a directory /foo/bang\n. This should fail. */ + err = svn_fs_make_dir(txn_root, "/foo/bang\n", subpool); + SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); return SVN_NO_ERROR; }
Modified: subversion/branches/1.9.x/subversion/tests/libsvn_subr/cache-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_subr/cache-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_subr/cache-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_subr/cache-test.c Sat Feb 28 10:37:27 2015 @@ -354,6 +354,74 @@ test_memcache_long_key(const svn_test_op return SVN_NO_ERROR; } +static svn_error_t * +test_membuffer_cache_clearing(apr_pool_t *pool) +{ + svn_cache__t *cache; + svn_membuffer_t *membuffer; + svn_boolean_t found; + svn_revnum_t *value; + svn_revnum_t valueA = 12345; + svn_revnum_t valueB = 67890; + + /* Create a simple cache for strings, keyed by strings. */ + SVN_ERR(svn_cache__membuffer_cache_create(&membuffer, 10*1024, 1, 0, + TRUE, TRUE, pool)); + SVN_ERR(svn_cache__create_membuffer_cache(&cache, + membuffer, + serialize_revnum, + deserialize_revnum, + APR_HASH_KEY_STRING, + "cache:", + SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, + FALSE, + pool, pool)); + + /* Initially, the cache is empty. */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* Add entries. */ + SVN_ERR(svn_cache__set(cache, "key A", &valueA, pool)); + SVN_ERR(svn_cache__set(cache, "key B", &valueB, pool)); + + /* Added entries should be cached (too small to get evicted already). */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(found); + SVN_TEST_ASSERT(*value == valueA); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(found); + SVN_TEST_ASSERT(*value == valueB); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* Clear the cache. */ + SVN_ERR(svn_cache__membuffer_clear(membuffer)); + + /* The cache is empty again. */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* But still functional: */ + SVN_ERR(svn_cache__set(cache, "key B", &valueB, pool)); + SVN_ERR(svn_cache__has_key(&found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__has_key(&found, cache, "key B", pool)); + SVN_TEST_ASSERT(found); + SVN_ERR(svn_cache__has_key(&found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + return SVN_NO_ERROR; +} + /* The test table. */ @@ -372,6 +440,8 @@ static struct svn_test_descriptor_t test "basic membuffer svn_cache test"), SVN_TEST_PASS2(test_membuffer_serializer_error_handling, "test for error handling in membuffer svn_cache"), + SVN_TEST_PASS2(test_membuffer_cache_clearing, + "test clearing a membuffer svn_cache"), SVN_TEST_NULL }; Modified: subversion/branches/1.9.x/subversion/tests/libsvn_subr/sqlite-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_subr/sqlite-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_subr/sqlite-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_subr/sqlite-test.c Sat Feb 28 10:37:27 2015 @@ -49,7 +49,7 @@ static svn_error_t * error_second(svn_sqlite__context_t *sctx, int argc, svn_sqlite__value_t *values[], - apr_pool_t *scratch_pool) + void *baton) { static int i = 0; Modified: subversion/branches/1.9.x/subversion/tests/libsvn_subr/string-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_subr/string-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_subr/string-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_subr/string-test.c Sat Feb 28 10:37:27 2015 @@ -686,10 +686,11 @@ test_string_similarity(apr_pool_t *pool) unsigned int score; } tests[] = { -#define SCORE(lcs, len) ((2000 * (lcs) + (len)/2) / (len)) +#define SCORE(lcs, len) \ + ((2 * SVN_STRING__SIM_RANGE_MAX * (lcs) + (len)/2) / (len)) /* Equality */ - {"", "", 0, 1000}, + {"", "", 0, SVN_STRING__SIM_RANGE_MAX}, {"quoth", "quoth", 5, SCORE(5, 5+5)}, /* Deletion at start */ @@ -743,17 +744,20 @@ test_string_similarity(apr_pool_t *pool) for (t = tests; t->stra; ++t) { apr_size_t lcs; - const unsigned int score = + const apr_size_t score = svn_cstring__similarity(t->stra, t->strb, &buffer, &lcs); /* fprintf(stderr, - "lcs %s ~ %s score %.3f (%"APR_SIZE_T_FMT - ") expected %.3f (%"APR_SIZE_T_FMT"))\n", - t->stra, t->strb, score/1000.0, lcs, t->score/1000.0, t->lcs); + "lcs %s ~ %s score %.6f (%"APR_SIZE_T_FMT + ") expected %.6f (%"APR_SIZE_T_FMT"))\n", + t->stra, t->strb, score/1.0/SVN_STRING__SIM_RANGE_MAX, + lcs, t->score/1.0/SVN_STRING__SIM_RANGE_MAX, t->lcs); */ if (score != t->score) - return fail(pool, "%s ~ %s score %.3f <> expected %.3f", - t->stra, t->strb, score/1000.0, t->score/1000.0); + return fail(pool, "%s ~ %s score %.6f <> expected %.6f", + t->stra, t->strb, + score/1.0/SVN_STRING__SIM_RANGE_MAX, + t->score/1.0/SVN_STRING__SIM_RANGE_MAX); if (lcs != t->lcs) return fail(pool, @@ -766,7 +770,8 @@ test_string_similarity(apr_pool_t *pool) { const svn_string_t foo = {"svn:foo", 4}; const svn_string_t bar = {"svn:bar", 4}; - if (1000 != svn_string__similarity(&foo, &bar, &buffer, NULL)) + if (SVN_STRING__SIM_RANGE_MAX + != svn_string__similarity(&foo, &bar, &buffer, NULL)) return fail(pool, "'%s'[:4] ~ '%s'[:4] found different", foo.data, bar.data); } Modified: subversion/branches/1.9.x/subversion/tests/libsvn_subr/subst_translate-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_subr/subst_translate-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_subr/subst_translate-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_subr/subst_translate-test.c Sat Feb 28 10:37:27 2015 @@ -115,7 +115,7 @@ test_svn_subst_translate_string2_null_en svn_string_t *new_value = NULL; svn_boolean_t translated_to_utf8 = FALSE; svn_boolean_t translated_line_endings = TRUE; - /* 'Æ', which is 0xc6 in both ISO-8859-1 and Windows-1252 */ + /* The 'AE' ligature, which is 0xc6 in both ISO-8859-1 and Windows-1252 */ svn_string_t *source_string = svn_string_create("\xc6", pool); SVN_ERR(svn_subst_translate_string2(&new_value, &translated_to_utf8, Modified: subversion/branches/1.9.x/subversion/tests/libsvn_wc/db-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_wc/db-test.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_wc/db-test.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_wc/db-test.c Sat Feb 28 10:37:27 2015 @@ -88,256 +88,205 @@ static const char * const TESTING_DATA = "insert into wcroot values (1, null); " "insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "'); " +); - /* ### The file_externals column in NODES is temporary, and will be - ### removed. However, to keep the tests passing, we need to add it - ### to the following insert statements. *Be sure to remove it*. */ +#define NOT_MOVED FALSE, NULL +#define NO_COPY_FROM 0, NULL, SVN_INVALID_REVNUM +static const svn_test__nodes_data_t nodes_init_data[] = { /* load the base nodes into the nodes table */ - "insert into nodes values (" - " 1, '', 0, null, 1, '', 1, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'A', 0, '', 1, 'A', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 10, null, null, null, null);" - "insert into nodes values (" - " 1, 'B', 0, '', 1, 'B', null, 'excluded'," - " null, null, 'symlink', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'C', 0, '', 1, 'C', null, 'server-excluded'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'D', 0, '', 1, 'D', null, 'not-present'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'E', 0, '', 1, 'E', null, 'incomplete'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'F', 0, '', 1, 'F', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'G', 0, '', 2, 'G-alt', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'H', 0, '', 1, 'H', 1, 'normal'," - " null, null, 'symlink', '()', null, null, 'H-target', 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'I', 0, '', 1, 'I', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J', 0, '', 1, 'J', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e', 0, 'J', 1, 'J/J-e', 1, 'normal'," - " null, 'other/place', 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-a', 0, 'J/J-e', 1, 'J/J-e/J-e-a', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b', 0, 'J/J-e', 1, 'J/J-e/J-e-b', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b/Jeba', 0, 'J/J-e/J-e-b', 1, 'J/J-e/J-e-b/Jeba', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f', 0, 'J', 1, 'J/J-f', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f/J-f-a', 0, 'J/J-f', 1, 'J/J-f/J-f-a', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K', 0, '', 1, 'K', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-a', 0, 'K', 1, 'K/K-a', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-b', 0, 'K', 1, 'K/K-b', 1, 'normal'," - " null, 'moved/away', 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "" - /* Load data into NODES table; - ### op_depths have not been calculated by me yet; - the value 1 is just 'good enough' to make the nodes WORKING nodes. */ - "insert into nodes values (" - " 1, 'I', 1, '', 2, 'some/dir', 2, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - - /* I'm not sure what the working J is supposed to represent. It - replaces the base J, but is it a copy or not? It has no - copyfrom, but nodes like J/J-e appear to be deleted which - implies they are children of a copied J. */ - "insert into nodes values (" - " 1, 'J', 1, '', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-a', 1, 'J', null, null, null, 'normal'," - " null, null, 'file', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b', 2, 'J', 2, 'some/dir', 2, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b/J-b-a', 3, 'J/J-b', 2, 'another/dir', 2, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b/J-b-b', 2, 'J/J-b', null, null, 2, 'normal'," - " null, null, 'file', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c', 1, 'J', null, null, null, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c/J-c-a', 1, 'J/J-c', null, null, null, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c', 2, 'J', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c/J-c-a', 2, 'J/J-c', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-d', 2, 'J', 2, 'moved/file', 2, 'normal'," - " 1, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " 10, null, null, null, null);" - "insert into nodes values (" - " 1, 'moved', 0, '', 2, 'moved', 2, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'moved/file', 0, 'moved', 2, 'moved/file', 2, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " 10, null, null, null, null);" - "insert into nodes values (" - " 1, 'moved/file', 2, 'moved', null, null, null, 'base-deleted'," - " null, 'J/J-d', 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e', 1, 'J', null, null, null, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-a', 1, 'J/J-e', null, null, null, 'normal'," - " null, null, 'file', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b', 1, 'J/J-e', null, null, null, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e', 2, 'J', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-a', 2, 'J/J-e', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b', 2, 'J/J-e', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b/Jeba', 1, 'J/J-e/J-e-b', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f', 1, 'J', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f/J-f-a', 1, 'J/J-f', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K', 1, '', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-a', 1, 'K', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-b', 1, 'K', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L', 1, '', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a', 1, 'L', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a/L-a-a', 1, 'L/L-a', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a', 2, 'L', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a/L-a-a', 2, 'L/L-a', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'other', 0, '', 2, 'other', 2, 'normal'," - " null, null, 'dir', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'other/place', 2, 'other', null, null, null, 'normal'," - " 1, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'other/place/J-e-a', 2, 'other/place', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'other/place/J-e-b', 2, 'other/place', null, null, null, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'other/place/J-e-b/Jeba', 0, 'other/place/J-e-b', null, null, null, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into actual_node values (" - " 1, 'A', '', null, null, null, null, null, 'changelist', null, " - " null, null, null, null, null);" - "insert into actual_node values (" - " 1, 'F', '', null, null, null, null, null, null, null, " - " '" F_TC_DATA "', null, null, null, null);" - "insert into actual_node values (" - " 1, 'G', '', null, null, null, null, null, null, null, " - " '" G_TC_DATA "', null, null, null, null);" - ); + { 0, "", "normal", 1, "", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + { 0, "A", "normal", 1, "A", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1, + FALSE, NULL, 10, 10 }, + + { 0, "B", "excluded", 1, "B", SVN_INVALID_REVNUM, NOT_MOVED, + svn_node_symlink}, + + { 0, "C", "server-excluded", 1, "C", 0, NOT_MOVED, + svn_node_unknown}, + + { 0, "D", "not-present", 1, "D", 0, NOT_MOVED, + svn_node_unknown}, + + { 0, "E", "incomplete", 1, "E", 1, NOT_MOVED, + svn_node_unknown}, + + { 0, "F", "normal", 1, "F", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2}, + + { 0, "G", "normal", 2, "G-alt", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 0, "H", "normal", 1, "H", 1, NOT_MOVED, + svn_node_symlink, "()", NULL, NULL, "H-target", 1, TIME_1a, AUTHOR_1 }, + + { 0, "I", "normal", 1, "I", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J", "normal", 1, "J", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-e", "normal", 1, "J/J-e", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-e/J-e-a", "normal", 1, "J/J-e/J-e-a", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-e/J-e-b", "normal", 1, "J/J-e/J-e-b", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-e/J-e-b/Jeba", "normal", 1, "J/J-e/J-e-b/Jeba", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-f", "normal", 1, "J/J-f", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J/J-f/J-f-a", "normal", 1, "J/J-f/J-f-a", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "J", "normal", 1, "J", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "K", "normal", 1, "K", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "K/K-a", "normal", 2, "K/K-a", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2, + FALSE, NULL, 15, 14}, + + { 0, "K/K-b", "normal", 2, "K/K-b", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2, + FALSE, NULL, 15, 14}, + + /* Load data into the working layers of NODES */ + + { 1, "I", "normal", 2, "some/dir", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + /* J was originally a local addition, but its descendants are replaced, + so let's turn J in a copy */ + { 1, "J", "normal", 2, "q", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-a", "normal", 2, "q/J-a", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-b", "normal", 2, "q/J-b", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 3, "J/J-b/J-b-a", "normal", 2, "another/dir", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-b/J-b-b", "normal", 2, "q/J-b/J-b-b", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-c", "normal", 2, "q/J-c", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-c/J-c-a", "normal", 2, "q/J-c/J-c-a", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "J/J-c", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 2, "J/J-c/J-c-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 2, "J/J-d", "normal", 2, "moved/file", 2, TRUE, NULL, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 0, "moved", "normal", 2, "moved", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1 }, + + { 0, "moved/file", "normal", 2, "moved/file", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "moved/file", "base-deleted", NO_COPY_FROM, FALSE, "J/J-d", + svn_node_file}, + + { 1, "J/J-e", "normal", 2, "q/J-e", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-e/J-e-a", "normal", 2, "q/J-e/J-e-a", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-e/J-e-b", "normal", 2, "q/J-e/J-e-b", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "J/J-e", "base-deleted", NO_COPY_FROM, FALSE, "other/place", + svn_node_dir}, + + { 2, "J/J-e/J-e-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 2, "J/J-e/J-e-b", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "J/J-e/J-e-b/Jeba", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 1, "J/J-f", "normal", 2, "q/J-f", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "J/J-f/J-f-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "K", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "K/K-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 1, "K/K-b", "base-deleted", NO_COPY_FROM, FALSE, "moved/away", + svn_node_file}, + + { 1, "L", "normal", 2, "from", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "L/L-a", "normal", 2, "from/L-a", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 1, "L/L-a/L-a-a", "normal", 2, "from/L-a/L-a-a", 2, NOT_MOVED, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "L/L-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 2, "L/L-a/L-a-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 0, "other", "normal", 2, "other", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "other/place", "normal", 2, "q/J-e", 2, TRUE, NULL, + svn_node_dir, "()", "immediates", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "other/place/J-e-a", "normal", 2, "q/J-e/J-e-a", 2, TRUE, NULL, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "other/place/J-e-b", "normal", 2, "q/J-e/J-e-b", 2, TRUE, NULL, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2 }, + + { 2, "other/place/J-e-b/Jeba", "normal", 2, "q/J-e/J-e-b/Jeba", 2, TRUE, NULL, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1 }, + + /*** NEW ****/ + { 2, "moved/away", "normal", 2, "K/K-b", 1, TRUE, NULL, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2, + FALSE, NULL, 15, 14}, + { 0 } +}; + +static const svn_test__actual_data_t actual_init_data[] = { + { "A", NULL, "changelist", NULL }, + { "F", NULL, NULL, F_TC_DATA }, + { "G", NULL, NULL, F_TC_DATA }, + + { 0 } +}; static svn_error_t * create_open(svn_wc__db_t **db, @@ -354,7 +303,8 @@ create_open(svn_wc__db_t **db, SVN_ERR(svn_io_remove_dir2(*local_abspath, TRUE, NULL, NULL, pool)); SVN_ERR(svn_wc__db_open(db, NULL, FALSE, TRUE, pool, pool)); - SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA, pool)); + SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA, + nodes_init_data, actual_init_data, pool)); svn_test_add_dir_cleanup(*local_abspath); @@ -374,18 +324,17 @@ set_prop(apr_hash_t *props, const char * } -static svn_boolean_t +static svn_error_t * validate_abspath(const char *wcroot_abspath, const char *expected_relpath, const char *actual_abspath, apr_pool_t *scratch_pool) { - if (actual_abspath == NULL) - return FALSE; - return strcmp(svn_dirent_join(wcroot_abspath, + SVN_TEST_STRING_ASSERT(actual_abspath, + svn_dirent_join(wcroot_abspath, expected_relpath, - scratch_pool), - actual_abspath) == 0; + scratch_pool)); + return SVN_NO_ERROR; } @@ -949,9 +898,16 @@ test_pdh(apr_pool_t *pool) NULL, NULL, pool)); + SVN_ERR(svn_wc__db_base_add_directory( + db, svn_dirent_join(local_abspath, "sub2", pool), + local_abspath, "sub2", ROOT_ONE, UUID_ONE, 1, + apr_hash_make(pool), 1, 1, "me", NULL, + svn_depth_infinity, NULL, FALSE, NULL, NULL, + NULL, NULL, pool)); + SVN_ERR(svn_wc__db_base_add_excluded_node( - db, svn_dirent_join(local_abspath, "sub/A", pool), - "sub/A", ROOT_ONE, UUID_ONE, 1, + db, svn_dirent_join(local_abspath, "sub2/A", pool), + "sub2/A", ROOT_ONE, UUID_ONE, 1, svn_node_file, svn_wc__db_status_server_excluded, NULL, NULL, pool)); @@ -989,17 +945,17 @@ test_scan_addition(apr_pool_t *pool) &original_revision, db, svn_dirent_join(local_abspath, "J", pool), pool, pool)); - SVN_TEST_ASSERT(status == svn_wc__db_status_added); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", op_root_abspath, pool)); + SVN_TEST_ASSERT(status == svn_wc__db_status_copied); + SVN_ERR(validate_abspath(local_abspath, "J", op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE); - SVN_TEST_ASSERT(original_repos_relpath == NULL); - SVN_TEST_ASSERT(original_root_url == NULL); - SVN_TEST_ASSERT(original_uuid == NULL); - SVN_TEST_ASSERT(original_revision == SVN_INVALID_REVNUM); + SVN_TEST_STRING_ASSERT(original_repos_relpath, "q"); + SVN_TEST_STRING_ASSERT(original_root_url, ROOT_TWO); + SVN_TEST_STRING_ASSERT(original_uuid, UUID_TWO); + SVN_TEST_ASSERT(original_revision == 2); - /* Simple addition of a file (affects how scan-up is started). */ + /* Simple copy (affects how scan-up is started). */ SVN_ERR(svn_wc__db_scan_addition( &status, &op_root_abspath, &repos_relpath, &repos_root_url, &repos_uuid, @@ -1007,15 +963,15 @@ test_scan_addition(apr_pool_t *pool) &original_revision, db, svn_dirent_join(local_abspath, "J/J-a", pool), pool, pool)); - SVN_TEST_ASSERT(status == svn_wc__db_status_added); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", op_root_abspath, pool)); + SVN_TEST_ASSERT(status == svn_wc__db_status_copied); + SVN_ERR(validate_abspath(local_abspath, "J", op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J/J-a"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE); - SVN_TEST_ASSERT(original_repos_relpath == NULL); - SVN_TEST_ASSERT(original_root_url == NULL); - SVN_TEST_ASSERT(original_uuid == NULL); - SVN_TEST_ASSERT(original_revision == SVN_INVALID_REVNUM); + SVN_TEST_STRING_ASSERT(original_repos_relpath, "q"); + SVN_TEST_STRING_ASSERT(original_root_url, ROOT_TWO); + SVN_TEST_STRING_ASSERT(original_uuid, UUID_TWO); + SVN_TEST_ASSERT(original_revision == 2); /* Node was moved here. */ SVN_ERR(svn_wc__db_scan_addition( @@ -1033,15 +989,15 @@ test_scan_addition(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-d", pool), pool, pool)); SVN_TEST_ASSERT(status == svn_wc__db_status_moved_here); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-d", + SVN_ERR(validate_abspath(local_abspath, "J/J-d", op_root_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/file", + SVN_ERR(validate_abspath(local_abspath, "moved/file", moved_from_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-d", + SVN_ERR(validate_abspath(local_abspath, "J/J-d", move_op_root_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/file", + SVN_ERR(validate_abspath(local_abspath, "moved/file", move_op_root_src, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/file", + SVN_ERR(validate_abspath(local_abspath, "moved/file", delete_op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J/J-d"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); @@ -1060,12 +1016,12 @@ test_scan_addition(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-b", pool), pool, pool)); SVN_TEST_ASSERT(status == svn_wc__db_status_copied); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-b", + SVN_ERR(validate_abspath(local_abspath, "J", op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J/J-b"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE); - SVN_TEST_STRING_ASSERT(original_repos_relpath, "some/dir"); + SVN_TEST_STRING_ASSERT(original_repos_relpath, "q"); SVN_TEST_STRING_ASSERT(original_root_url, ROOT_TWO); SVN_TEST_STRING_ASSERT(original_uuid, UUID_TWO); SVN_TEST_ASSERT(original_revision == 2); @@ -1079,7 +1035,7 @@ test_scan_addition(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-b/J-b-a", pool), pool, pool)); SVN_TEST_ASSERT(status == svn_wc__db_status_copied); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-b/J-b-a", + SVN_ERR(validate_abspath(local_abspath, "J/J-b/J-b-a", op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J/J-b/J-b-a"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); @@ -1098,12 +1054,12 @@ test_scan_addition(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-b/J-b-b", pool), pool, pool)); SVN_TEST_ASSERT(status == svn_wc__db_status_copied); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-b", + SVN_ERR(validate_abspath(local_abspath, "J", op_root_abspath, pool)); SVN_TEST_STRING_ASSERT(repos_relpath, "J/J-b/J-b-b"); SVN_TEST_STRING_ASSERT(repos_root_url, ROOT_ONE); SVN_TEST_STRING_ASSERT(repos_uuid, UUID_ONE); - SVN_TEST_STRING_ASSERT(original_repos_relpath, "some/dir"); + SVN_TEST_STRING_ASSERT(original_repos_relpath, "q"); SVN_TEST_STRING_ASSERT(original_root_url, ROOT_TWO); SVN_TEST_STRING_ASSERT(original_uuid, UUID_TWO); SVN_TEST_ASSERT(original_revision == 2); @@ -1132,13 +1088,13 @@ test_scan_deletion(apr_pool_t *pool) ©_op_root_abspath, db, svn_dirent_join(local_abspath, "J/J-e", pool), pool, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place", + SVN_ERR(validate_abspath(local_abspath, "other/place", moved_to_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e", + SVN_ERR(validate_abspath(local_abspath, "J/J-e", work_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place", + SVN_ERR(validate_abspath(local_abspath, "other/place", copy_op_root_abspath, pool)); /* Node was moved elsewhere (child of operation root). */ @@ -1149,13 +1105,13 @@ test_scan_deletion(apr_pool_t *pool) ©_op_root_abspath, db, svn_dirent_join(local_abspath, "J/J-e/J-e-a", pool), pool, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-a", + SVN_ERR(validate_abspath(local_abspath, "other/place/J-e-a", moved_to_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e", + SVN_ERR(validate_abspath(local_abspath, "J/J-e", work_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place", + SVN_ERR(validate_abspath(local_abspath, "other/place", copy_op_root_abspath, pool)); /* Root of delete. Parent is a WORKING node. */ @@ -1167,10 +1123,10 @@ test_scan_deletion(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-c", pool), pool, pool)); /* Implicit delete of "J" (via replacement). */ - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-c", + SVN_ERR(validate_abspath(local_abspath, "J/J-c", work_del_abspath, pool)); /* Child of a deleted root. */ @@ -1182,10 +1138,10 @@ test_scan_deletion(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-c/J-c-a", pool), pool, pool)); /* Implicit delete of "J" (via replacement). */ - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-c", + SVN_ERR(validate_abspath(local_abspath, "J/J-c", work_del_abspath, pool)); /* Base-deleted tree extending past deleted WORKING subtree. */ @@ -1199,11 +1155,11 @@ test_scan_deletion(apr_pool_t *pool) /* ### I don't understand this. "J/J-e/J-e-b/Jeba" is a deleted base node that is not overlayed by the replacement rooted at "J". Why does base_del_abspath refer to "J-e"? */ - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-b/Jeba", + SVN_ERR(validate_abspath(local_abspath, "other/place/J-e-b/Jeba", moved_to_abspath, pool)); - SVN_TEST_ASSERT(work_del_abspath == NULL); + SVN_TEST_STRING_ASSERT(work_del_abspath, NULL); /* Base-deleted tree extending past added WORKING tree. */ SVN_ERR(svn_wc__db_scan_deletion( @@ -1214,10 +1170,10 @@ test_scan_deletion(apr_pool_t *pool) db, svn_dirent_join(local_abspath, "J/J-f/J-f-a", pool), pool, pool)); /* Implicit delete of "J" (via replacement). */ - SVN_TEST_ASSERT(validate_abspath(local_abspath, "J", + SVN_ERR(validate_abspath(local_abspath, "J", base_del_abspath, pool)); - SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(work_del_abspath == NULL); + SVN_TEST_STRING_ASSERT(moved_to_abspath, NULL); + SVN_TEST_STRING_ASSERT(work_del_abspath, NULL); /* Root of delete. Parent is a BASE node. */ SVN_ERR(svn_wc__db_scan_deletion( @@ -1227,10 +1183,10 @@ test_scan_deletion(apr_pool_t *pool) NULL, db, svn_dirent_join(local_abspath, "K", pool), pool, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "K", + SVN_ERR(validate_abspath(local_abspath, "K", base_del_abspath, pool)); - SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(work_del_abspath == NULL); + SVN_TEST_STRING_ASSERT(moved_to_abspath, NULL); + SVN_TEST_STRING_ASSERT(work_del_abspath, NULL); /* Base-deleted tree. Start below root. */ SVN_ERR(svn_wc__db_scan_deletion( @@ -1240,10 +1196,10 @@ test_scan_deletion(apr_pool_t *pool) NULL, db, svn_dirent_join(local_abspath, "K/K-a", pool), pool, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "K", + SVN_ERR(validate_abspath(local_abspath, "K", base_del_abspath, pool)); - SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(work_del_abspath == NULL); + SVN_TEST_STRING_ASSERT(moved_to_abspath, NULL); + SVN_TEST_STRING_ASSERT(work_del_abspath, NULL); /* Base-deleted tree via move. */ SVN_ERR(svn_wc__db_scan_deletion( @@ -1253,13 +1209,13 @@ test_scan_deletion(apr_pool_t *pool) ©_op_root_abspath, db, svn_dirent_join(local_abspath, "K/K-b", pool), pool, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "K", + SVN_ERR(validate_abspath(local_abspath, "K", base_del_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/away", + SVN_ERR(validate_abspath(local_abspath, "moved/away", moved_to_abspath, pool)); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/away", + SVN_ERR(validate_abspath(local_abspath, "moved/away", copy_op_root_abspath, pool)); - SVN_TEST_ASSERT(work_del_abspath == NULL); + SVN_TEST_STRING_ASSERT(work_del_abspath, NULL); /* Subtree deletion of added tree. Start at child. */ SVN_ERR(svn_wc__db_scan_deletion( @@ -1269,9 +1225,9 @@ test_scan_deletion(apr_pool_t *pool) NULL, db, svn_dirent_join(local_abspath, "L/L-a/L-a-a", pool), pool, pool)); - SVN_TEST_ASSERT(base_del_abspath == NULL); - SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "L/L-a", + SVN_TEST_STRING_ASSERT(base_del_abspath, NULL); + SVN_TEST_STRING_ASSERT(moved_to_abspath, NULL); + SVN_ERR(validate_abspath(local_abspath, "L/L-a", work_del_abspath, pool)); /* Subtree deletion of added tree. Start at root. */ @@ -1282,9 +1238,9 @@ test_scan_deletion(apr_pool_t *pool) NULL, db, svn_dirent_join(local_abspath, "L/L-a", pool), pool, pool)); - SVN_TEST_ASSERT(base_del_abspath == NULL); - SVN_TEST_ASSERT(moved_to_abspath == NULL); - SVN_TEST_ASSERT(validate_abspath(local_abspath, "L/L-a", + SVN_TEST_STRING_ASSERT(base_del_abspath, NULL); + SVN_TEST_STRING_ASSERT(moved_to_abspath, NULL); + SVN_ERR(validate_abspath(local_abspath, "L/L-a", work_del_abspath, pool)); return SVN_NO_ERROR; Modified: subversion/branches/1.9.x/subversion/tests/libsvn_wc/entries-compat.c URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_wc/entries-compat.c?rev=1662916&r1=1662915&r2=1662916&view=diff ============================================================================== --- subversion/branches/1.9.x/subversion/tests/libsvn_wc/entries-compat.c (original) +++ subversion/branches/1.9.x/subversion/tests/libsvn_wc/entries-compat.c Sat Feb 28 10:37:27 2015 @@ -87,199 +87,186 @@ static const char * const TESTING_DATA = "insert into wcroot values (1, null); " "insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "'); " + ); - /* ### The file_externals column in NODES is temporary, and will be - ### removed. However, to keep the tests passing, we need to add it - ### to the following insert statements. *Be sure to remove it*. */ +#define NOT_MOVED FALSE, NULL +#define NO_COPY_FROM 0, NULL, SVN_INVALID_REVNUM +static const svn_test__nodes_data_t nodes[] = +{ /* load the base nodes into the nodes table */ - "insert into nodes values (" - " 1, '', 0, null, 1, '', 1, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'A', 0, '', 1, 'A', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 10, null, null, null, null);" - "insert into nodes values (" - " 1, 'B', 0, '', 1, 'B', null, 'excluded'," - " null, null, 'symlink', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'C', 0, '', 1, 'C', null, 'server-excluded'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'D', 0, '', 1, 'D', null, 'not-present'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'E', 0, '', 1, 'E', null, 'incomplete'," - " null, null, 'unknown', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'F', 0, '', 1, 'F', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'G', 0, '', 2, 'G-alt', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'H', 0, '', 1, 'H', 1, 'normal'," - " null, null, 'symlink', '()', null, null, 'H-target', 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'I', 0, '', 1, 'I', 1, 'normal'," - " null, null, 'file', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J', 0, '', 1, 'J', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e', 0, 'J', 1, 'J/J-e', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-a', 0, 'J/J-e', 1, 'J/J-e/J-e-a', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b', 0, 'J/J-e', 1, 'J/J-e/J-e-b', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b/Jeba', 0, 'J/J-e/J-e-b', 1, 'J/J-e/J-e-b/Jeba', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f', 0, 'J', 1, 'J/J-f', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f/J-f-a', 0, 'J/J-f', 1, 'J/J-f/J-f-a', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K', 0, '', 1, 'K', 1, 'normal'," - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-a', 0, 'K', 1, 'K/K-a', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-b', 0, 'K', 1, 'K/K-b', 1, 'normal'," - " null, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 1, " TIME_1s ", '" AUTHOR_1 "'," - " 15, null, null, null, null);" - "" + { 0, "", "normal", 1, "", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "A", "normal", 1, "A", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "B", "excluded", 1, "B", 1, NOT_MOVED, + svn_node_symlink}, + + { 0, "C", "server-excluded",1, "C", 0, NOT_MOVED, + svn_node_unknown}, + + { 0, "D", "not-present", 1, "D", 0, NOT_MOVED, + svn_node_unknown}, + + { 0, "E", "incomplete", 1, "E", SVN_INVALID_REVNUM, NOT_MOVED, + svn_node_unknown}, + + { 0, "F", "normal", 1, "G-alt", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "G", "normal", 1, "G-alt", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "H", "normal", 1, "I", 1, NOT_MOVED, + svn_node_symlink, NULL, NULL, NULL, "H-target", 1, TIME_1a, AUTHOR_1}, + + { 0, "I", "normal", 1, "I", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J", "normal", 1, "J", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-c", "normal", 1, "J/J-c", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-c/J-c-a", "not-present", 1, "J/J-c/J-c-a", 1, NOT_MOVED, + svn_node_dir}, + + { 0, "J/J-e", "normal", 1, "J/J-e", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-e/J-e-a", "normal", 1, "J/J-e/J-e-a", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-e/J-e-b", "normal", 1, "J/J-e/J-e-b", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-e/J-e-b/Jeba", "normal", 1, "J/J-e/J-e-b/Jeba", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-f", "normal", 1, "J/J-f", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "J/J-f/J-f-a", "normal", 1, "J/J-f/J-f-a", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "K", "normal", 1, "K", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "K/K-a", "normal", 1, "K/K-a", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "K/K-b", "normal", 1, "K/K-b", 1, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "L", "normal", 1, "switched", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "L/L-a", "normal", 1, "switched/L-a", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 0, "L/L-a/L-a-a", "normal", 1, "switched/L-a/L-a-a", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + /* Load data into NODES table; ### op_depths have not been calculated by me yet; the value 1 is just 'good enough' to make the nodes WORKING nodes. */ - "insert into nodes values (" - " 1, 'I', 1, '', 2, 'some/dir', 2, 'normal'," - " null, null, 'file', '()', 'immediates', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J', 1, '', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-a', 1, 'J', null, null, null, 'normal'," - " null, null, 'file', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b', 1, 'J', 2, 'some/dir', 2, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b/J-b-a', 1, 'J/J-b', 2, 'another/dir', 2, 'normal'," - " null, null, 'dir', '()', 'infinity', null, null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-b/J-b-b', 1, 'J/J-b', null, null, null, 'normal'," - " null, null, 'file', '()', null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c', 1, 'J', null, null, null, 'not-present'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-c/J-c-a', 1, 'J/J-c', null, null, null, 'not-present'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-d', 1, 'J', 2, 'moved/file', 2, 'normal'," - " 1, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "'," - " 10, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e', 1, 'J', null, null, null, 'not-present'," - " null, 'other/place', 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-a', 1, 'J/J-e', null, null, null, 'not-present'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b', 1, 'J/J-e', null, null, null, 'not-present'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-e/J-e-b/Jeba', 1, 'J/J-e/J-e-b', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f', 1, 'J', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'J/J-f/J-f-a', 1, 'J/J-f', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K', 1, '', null, null, null, 'base-deleted'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-a', 1, 'K', null, null, null, 'base-deleted'," - " null, null, 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'K/K-b', 1, 'K', null, null, null, 'base-deleted'," - " null, 'moved/away', 'file', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L', 1, '', null, null, null, 'normal'," - " null, null, 'dir', '()', 'immediates', null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a', 1, 'L', null, null, null, 'not-present'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'L/L-a/L-a-a', 1, 'L/L-a', null, null, null, 'not-present'," - " null, null, 'dir', null, null, null, null, null, null, null," - " null, null, null, null, null);" - "insert into actual_node values (" - " 1, 'I', '', null, null, null, null, null, 'changelist', null, " - " null, null, null, null, null);" - "insert into actual_node values (" - " 1, 'F', '', null, null, null, null, null, null, null, " - " '" F_TC_DATA "', null, null, null, null);" - "insert into actual_node values (" - " 1, 'G', '', null, null, null, null, null, null, null, " - " '" G_TC_DATA "', null, null, null, null);" - " " - "insert into nodes values (" - " 1, 'M', 0, '', 1, 'M', 1, 'normal', " - " null, null, 'dir', '()', null, null, null, 1, " TIME_1s ", '" AUTHOR_1 "', " - " null, null, null, null, null);" - "insert into nodes values (" - " 1, 'M/M-a', 0, 'M', 1, 'M/M-a', 1, 'not-present', " - " null, null, 'file', null, null, null, null, null, null, null, " - " null, null, null, null, null);" - ); + + { 1, "I", "normal", 2, "some/file", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2}, + + { 1, "J", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_dir, NULL, "immediates"}, + + { 2, "J/J-a", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 2, "J/J-b", "normal", 2, "some/dir", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2}, + + { 3, "J/J-b/J-b-a", "normal", 2, "another/dir", 2, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 2, TIME_2a, AUTHOR_2}, + + { 3, "J/J-b/J-b-b", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + /* This triggers a validation warning: bad delete */ + { 1, "J/J-c", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "J/J-d", "normal", 2, "moved/file", 2, NOT_MOVED, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 2, TIME_2a, AUTHOR_2}, + + { 1, "J/J-e", "base-deleted", NO_COPY_FROM, FALSE, "other/place", + svn_node_dir}, + + { 1, "J/J-e/J-e-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 1, "J/J-e/J-e-b", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "J/J-e/J-e-b/Jeba", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 1, "J/J-f", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 2, "J/J-f", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_dir, NULL, "immediates"}, + + { 1, "J/J-f/J-f-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "K", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "K/K-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_file}, + + { 1, "K/K-b", "base-deleted", NO_COPY_FROM, FALSE, "moved/away", + svn_node_file}, + + { 1, "L", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_dir, NULL, "immediates"}, + + { 1, "L/L-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "L/L-a/L-a-a", "base-deleted", NO_COPY_FROM, NOT_MOVED, + svn_node_dir}, + + { 1, "M", "normal", 1, "M", 1, NOT_MOVED, + svn_node_dir, "()", "infinity", NULL, NULL, 1, TIME_1a, AUTHOR_1}, + + { 1, "M/M-a", "not-present", 1, "M/M-a", 1, NOT_MOVED, + svn_node_file}, + + /**** Move target of K/K-b ****/ + { 1, "moved", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_dir, NULL, "infinity" }, + { 2, "moved/away", "normal", 1, "??", 1, TRUE, NULL, + svn_node_file, "()", NULL, "$sha1$" SHA1_1, NULL, 1, TIME_1a, AUTHOR_1}, + + /**** Move target of J/J-e ****/ + { 1, "other", "normal", NO_COPY_FROM, NOT_MOVED, + svn_node_dir, NULL, "empty"}, + + { 2, "other/place", "normal", 1, "??", 1, TRUE, NULL, + svn_node_dir, "()", "infinity"}, + + { 0 }, +}; + +static const svn_test__actual_data_t actuals[] = +{ + { "I", NULL, "changelist", NULL }, + { "F", NULL, NULL, NULL /* TC-DATA */ }, + { "G", NULL, NULL, NULL /* TC-DATA */ }, + { 0 }, +}; static const char * const M_TESTING_DATA = ( @@ -310,7 +297,8 @@ create_fake_wc(const char *subdir, apr_p SVN_ERR(svn_io_remove_dir2(root, TRUE, NULL, NULL, pool)); SVN_ERR(svn_dirent_get_absolute(&wc_abspath, root, pool)); - SVN_ERR(svn_test__create_fake_wc(wc_abspath, TESTING_DATA, pool)); + SVN_ERR(svn_test__create_fake_wc(wc_abspath, TESTING_DATA, nodes, actuals, + pool)); return SVN_NO_ERROR; } @@ -365,8 +353,8 @@ test_entries_alloc(apr_pool_t *pool) SVN_ERR(svn_wc_entries_read(&entries, adm_access, TRUE /* show_hidden */, pool)); - /* The wcroot has 12 BASE children + 1 WORKING child + "this dir". */ - SVN_TEST_ASSERT(apr_hash_count(entries) == 14); + /* The wcroot has 12 BASE children + 3 WORKING child + "this dir". */ + SVN_TEST_ASSERT(apr_hash_count(entries) == 16); /* The "D" entry in the entries hash should be what we get from the svn_wc_entry() entrypoint. */ @@ -406,7 +394,7 @@ test_stubs(apr_pool_t *pool) SVN_ERR(create_open(&db, &local_abspath, WC_NAME, pool)); M_dir = svn_dirent_join(local_abspath, "M", pool); - SVN_ERR(svn_test__create_fake_wc(M_dir, M_TESTING_DATA, pool)); + SVN_ERR(svn_test__create_fake_wc(M_dir, M_TESTING_DATA, NULL, NULL, pool)); /* The "M" entry is a subdir. Let's ensure we can reach its stub, and the actual contents. */ @@ -429,6 +417,8 @@ test_stubs(apr_pool_t *pool) subdir baton with ADM_ACCESS. */ SVN_ERR(svn_wc_entry(&stub_entry, local_relpath, adm_access, TRUE, pool)); SVN_TEST_STRING_ASSERT(stub_entry->name, "M"); + /* Schedule add in parent-wc. Schedule normal in obstructing working copy */ + SVN_TEST_ASSERT(stub_entry->schedule == svn_wc_schedule_add); SVN_ERR(svn_wc_adm_open3(&subdir_access, adm_access, @@ -442,6 +432,7 @@ test_stubs(apr_pool_t *pool) /* Ensure we get the real entry. */ SVN_ERR(svn_wc_entry(&entry, local_relpath, subdir_access, TRUE, pool)); SVN_TEST_STRING_ASSERT(entry->name, ""); + SVN_TEST_ASSERT(entry->schedule == svn_wc_schedule_normal); /* Ensure that we get the SAME entry, even using the parent baton. */ SVN_ERR(svn_wc_entry(&test_entry, local_relpath, adm_access, TRUE, pool));
