Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/externals_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/externals_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/externals_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/externals_tests.py Tue Nov 27 22:13:24 2012 @@ -2131,7 +2131,7 @@ def copy_file_externals(sbox): actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, True, wc_dir) -def include_externals(sbox): +def commit_include_externals(sbox): "commit --include-externals" # svntest.factory.make(sbox, """ # mkdir Z @@ -2939,6 +2939,59 @@ def duplicate_targets(sbox): actions.run_and_verify_svn2('OUTPUT', expected_stdout, [], 0, 'pg', 'svn:externals', wc_dir) +@Issue(4225) +def list_include_externals(sbox): + "list with --include-externals" + + externals_test_setup(sbox) + + wc_dir = sbox.wc_dir + repo_url = sbox.repo_url + + svntest.actions.run_and_verify_svn(None, None, [], + 'checkout', + repo_url, wc_dir) + + B_path = sbox.ospath("A/B") + C_path = sbox.ospath("A/C") + + B_url = repo_url + "/A/B" + C_url = repo_url + "/A/C" + + def list_external_string(path, url): + string = "Listing external" + " '" + path + "' " + "defined on" + " '" + \ + url + "'" + ":" + return string + + expected_stdout = verify.UnorderedOutput([ + "E/" + "\n", + "F/" + "\n", + "lambda" + "\n", + list_external_string("gamma", B_url ) + "\n", + "gamma" + "\n"]) + + exit_code, stdout, stderr = svntest.actions.run_and_verify_svn2( + "OUTPUT", expected_stdout, [], 0, 'ls', '--include-externals', B_path) + + exit_code, stdout, stderr = svntest.actions.run_and_verify_svn2( + "OUTPUT", expected_stdout, [], 0, 'ls', '--include-externals', B_url) + + expected_stdout = verify.UnorderedOutput([ + list_external_string("exdir_G", C_url)+ "\n", + "pi" + "\n", + "rho" + "\n", + "tau" + "\n", + list_external_string("exdir_H", C_url) + "\n", + "chi" + "\n", + "omega" + "\n", + "psi" + "\n"]) + + exit_code, stdout, stderr = svntest.actions.run_and_verify_svn2( + "OUTPUT", expected_stdout, [], 0, 'ls', '--include-externals', C_path) + + exit_code, stdout, stderr = svntest.actions.run_and_verify_svn2( + "OUTPUT", expected_stdout, [], 0, 'ls', '--include-externals', C_url) + ######################################################################## @@ -2982,13 +3035,14 @@ test_list = [ None, file_externals_different_url, file_external_in_unversioned, copy_file_externals, - include_externals, + commit_include_externals, include_immediate_dir_externals, shadowing, remap_file_external_with_prop_del, dir_external_with_dash_r_only, url_to_wc_copy_of_externals, duplicate_targets, + list_include_externals, ] if __name__ == '__main__':
Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/getopt_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/getopt_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/getopt_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/getopt_tests.py Tue Nov 27 22:13:24 2012 @@ -167,33 +167,11 @@ def run_one_test(sbox, basename, *vararg actual_stdout = process_lines(actual_stdout) actual_stderr = process_lines(actual_stderr) - if exp_stdout != actual_stdout: - logger.warn("Standard output does not match.") - logger.warn("Expected standard output:") - logger.warn("=====") - for x in exp_stdout: - logger.warn(x) - logger.warn("=====") - logger.warn("Actual standard output:") - logger.warn("=====") - for x in actual_stdout: - logger.warn(x) - logger.warn("=====") - raise svntest.Failure - - if exp_stderr != actual_stderr: - logger.warn("Standard error does not match.") - logger.warn("Expected standard error:") - logger.warn("=====") - for x in exp_stderr: - logger.warn(x) - logger.warn("=====") - logger.warn("Actual standard error:") - logger.warn("=====") - for x in actual_stderr: - logger.warn(x) - logger.warn("=====") - raise svntest.Failure + svntest.verify.compare_and_display_lines("Standard output does not match.", + "STDOUT", exp_stdout, actual_stdout) + + svntest.verify.compare_and_display_lines("Standard error does not match.", + "STDERR", exp_stderr, actual_stderr) def getopt_no_args(sbox): "run svn with no arguments" Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/iprop_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/iprop_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/iprop_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/iprop_tests.py Tue Nov 27 22:13:24 2012 @@ -1635,6 +1635,40 @@ def iprops_with_file_externals(sbox): sbox.ospath('A/B/E/file-external'), expected_iprops, expected_explicit_props) +def iprops_survive_commit(sbox): + "verify that iprops survive a commit" + + sbox.build() + sbox.simple_propset('key', 'D', 'A/B',) + sbox.simple_commit() + + svntest.main.run_svn(None, 'switch', sbox.repo_url + '/A/B/E', + sbox.ospath('A/D'), '--ignore-ancestry') + svntest.main.run_svn(None, 'switch', sbox.repo_url + '/A/B/F', + sbox.ospath('iota'), '--ignore-ancestry') + expected_iprops = { + sbox.repo_url + '/A/B' : {'key' : 'D'}, + } + + expected_explicit_props = {} + svntest.actions.run_and_verify_inherited_prop_xml(sbox.ospath('A/D'), + expected_iprops, + expected_explicit_props) + svntest.actions.run_and_verify_inherited_prop_xml(sbox.ospath('iota'), + expected_iprops, + expected_explicit_props) + + sbox.simple_propset('new', 'V', 'A/D', 'iota') + sbox.simple_commit() + + expected_explicit_props = {'new': 'V'} + svntest.actions.run_and_verify_inherited_prop_xml(sbox.ospath('A/D'), + expected_iprops, + expected_explicit_props) + svntest.actions.run_and_verify_inherited_prop_xml(sbox.ospath('iota'), + expected_iprops, + expected_explicit_props) + ######################################################################## # Run the tests @@ -1648,6 +1682,7 @@ test_list = [ None, iprops_shallow_operative_depths, iprops_with_directory_externals, iprops_with_file_externals, + iprops_survive_commit, ] if __name__ == '__main__': Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/prop_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/prop_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/prop_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/prop_tests.py Tue Nov 27 22:13:24 2012 @@ -900,9 +900,9 @@ def prop_value_conversions(sbox): "svn: warning: W125005.*use 'svn propdel'") # Anything else should be untouched - svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path) - svntest.actions.set_prop('svn:some-prop', ' bar baz', mu_path) - svntest.actions.set_prop('svn:some-prop', 'bar\n', iota_path) + svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path, force=True) + svntest.actions.set_prop('svn:some-prop', ' bar baz', mu_path, force=True) + svntest.actions.set_prop('svn:some-prop', 'bar\n', iota_path, force=True) svntest.actions.set_prop('some-prop', 'bar', lambda_path) svntest.actions.set_prop('some-prop', ' bar baz', mu_path) svntest.actions.set_prop('some-prop', 'bar\n', iota_path) @@ -2670,6 +2670,37 @@ def inheritable_ignores(sbox): [], 'add', '.', '--force','--no-ignore', '--config-dir', config_dir) +def almost_known_prop_names(sbox): + "propset with svn: prefix but unknown name" + + sbox.build() + wc_dir = sbox.wc_dir + iota_path = sbox.ospath('iota') + + # Same prefix, different prop name + svntest.actions.set_prop('svn:exemutable', 'x', iota_path, + "svn: E195011: 'svn:exemutable' " + "is not a valid svn: property name") + svntest.actions.set_prop('svn:exemutable', 'x', iota_path, force=True) + + # Similar prefix, different prop name + svntest.actions.set_prop('svm:exemutable', 'x', iota_path) + + # Similar prefix, same prop name + svntest.actions.set_prop('svm:executable', 'x', iota_path, + "svn: E195011: 'svm:executable' " + "is not a valid svn: property name") + svntest.actions.set_prop('svm:executable', 'x', iota_path, force=True) + + # Different prefix, same prop name + svntest.actions.set_prop('tsvn:executable', 'x', iota_path) + + # Property name is too different to matter + svntest.actions.set_prop('svn:foobar', 'x', iota_path, + "svn: E195011: 'svn:foobar'" + " is not a valid svn: property name;" + " re-run with '--force' to set it") + ######################################################################## # Run the tests @@ -2713,6 +2744,7 @@ test_list = [ None, file_matching_dir_prop_reject, pristine_props_listed, inheritable_ignores, + almost_known_prop_names, ] if __name__ == '__main__': Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/stat_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/stat_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/stat_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/stat_tests.py Tue Nov 27 22:13:24 2012 @@ -1441,8 +1441,8 @@ def status_depth_local(sbox): # make some changes to the greek tree change_files(wc_dir, ['A/mu', 'A/D/gamma']) - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path) - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path) # for all the possible types of depth, check the status @@ -1501,8 +1501,8 @@ def status_depth_update(sbox): # add some files, change directory properties change_files_and_commit(wc_dir, ['A/mu', 'A/D/gamma']) svntest.main.run_svn(None, 'up', wc_dir) - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path) - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path) svntest.main.run_svn(None, 'ci', '-m', 'log message', wc_dir) # update to r1 @@ -1572,8 +1572,8 @@ def status_depth_update_local_modificati mu_path = os.path.join(A_path, 'mu') gamma_path = os.path.join(D_path, 'gamma') - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', A_path) - svntest.main.run_svn(None, 'propset', 'svn:test', 'value', D_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', A_path) + svntest.main.run_svn(None, 'propset', '--force', 'svn:test', 'value', D_path) svntest.main.file_append(mu_path, 'modified') svntest.main.file_append(gamma_path, 'modified') Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/svntest/actions.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/svntest/actions.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/svntest/actions.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/svntest/actions.py Tue Nov 27 22:13:24 2012 @@ -1985,8 +1985,12 @@ def create_failing_post_commit_hook(repo # set_prop can be used for properties with NULL characters which are not # handled correctly when passed to subprocess.Popen() and values like "*" # which are not handled correctly on Windows. -def set_prop(name, value, path, expected_re_string=None): +def set_prop(name, value, path, expected_re_string=None, force=None): """Set a property with specified value""" + if not force: + propset = ('propset',) + else: + propset = ('propset', '--force') if value and (value[0] == '-' or '\x00' in value or sys.platform == 'win32'): from tempfile import mkstemp (fd, value_file_path) = mkstemp() @@ -1995,12 +1999,12 @@ def set_prop(name, value, path, expected value_file.write(value) value_file.flush() value_file.close() - exit_code, out, err = main.run_svn(expected_re_string, 'propset', - '-F', value_file_path, name, path) + propset += ('-F', value_file_path, name, path) + exit_code, out, err = main.run_svn(expected_re_string, *propset) os.remove(value_file_path) else: - exit_code, out, err = main.run_svn(expected_re_string, 'propset', - name, value, path) + propset += (name, value, path) + exit_code, out, err = main.run_svn(expected_re_string, *propset) if expected_re_string: if not expected_re_string.startswith(".*"): expected_re_string = ".*(" + expected_re_string + ")" Modified: subversion/branches/issue-4194-dev/subversion/tests/cmdline/update_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/cmdline/update_tests.py?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/cmdline/update_tests.py (original) +++ subversion/branches/issue-4194-dev/subversion/tests/cmdline/update_tests.py Tue Nov 27 22:13:24 2012 @@ -5523,6 +5523,16 @@ def update_to_HEAD_plus_1(sbox): None, None, None, None, None, wc_dir, '-r', '2') + other_wc = sbox.add_wc_path('other') + other_url = sbox.repo_url + '/A' + svntest.actions.run_and_verify_svn("subtree checkout", None, [], + 'co', other_url, other_wc) + svntest.actions.run_and_verify_update(other_wc, + None, None, None, + "E160006.*No such.*revision", + None, None, + None, None, None, other_wc, '-r', '2') + @XFail() def update_moved_dir_leaf_del(sbox): "update locally moved dir with leaf del" Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_fs/fs-test.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_fs/fs-test.c Tue Nov 27 22:13:24 2012 @@ -3533,8 +3533,8 @@ static int my_rand(apr_uint64_t scalar, { static const apr_uint32_t TEST_RAND_MAX = 0xffffffffUL; /* Assumes TEST_RAND_MAX+1 can be exactly represented in a double */ - apr_uint32_t rand = svn_test_rand(seed); - return (int)(((double)rand + apr_uint32_t r = svn_test_rand(seed); + return (int)(((double)r / ((double)TEST_RAND_MAX+1.0)) * (double)scalar); } @@ -4901,18 +4901,28 @@ static svn_error_t * delete_fs(const svn_test_opts_t *opts, apr_pool_t *pool) { - svn_fs_t *fs; const char *path; svn_node_kind_t kind; - SVN_ERR(svn_test__create_fs(&fs, "test-delete-fs", opts, pool)); - path = svn_fs_path(fs, pool); + /* We have to use a subpool to close the svn_fs_t before calling + svn_fs_delete_fs. See issue 4264. */ + { + svn_fs_t *fs; + apr_pool_t *subpool = svn_pool_create(pool); + SVN_ERR(svn_test__create_fs(&fs, "test-repo-delete-fs", opts, subpool)); + path = svn_fs_path(fs, pool); + svn_pool_destroy(subpool); + } + SVN_ERR(svn_io_check_path(path, &kind, pool)); SVN_TEST_ASSERT(kind != svn_node_none); SVN_ERR(svn_fs_delete_fs(path, pool)); SVN_ERR(svn_io_check_path(path, &kind, pool)); SVN_TEST_ASSERT(kind == svn_node_none); + /* Recreate dir so that test cleanup doesn't fail. */ + SVN_ERR(svn_io_dir_make(path, APR_OS_DEFAULT, pool)); + return SVN_NO_ERROR; } Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_repos/repos-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_repos/repos-test.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_repos/repos-test.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_repos/repos-test.c Tue Nov 27 22:13:24 2012 @@ -49,6 +49,20 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #endif +/* Compare strings, like strcmp but either or both may be NULL which + * compares equal to NULL and not equal to any non-NULL string. */ +static int +strcmp_null(const char *s1, const char *s2) +{ + if (s1 && s2) + return strcmp(s1, s2); + else if (s1 || s2) + return 1; + else + return 0; +} + + static svn_error_t * dir_deltas(const svn_test_opts_t *opts, @@ -1739,7 +1753,9 @@ nls_receiver(svn_location_segment_t *seg "Got unexpected location segment: %s", format_segment(segment, pool)); - if (expected_segment->range_start != segment->range_start) + if (expected_segment->range_start != segment->range_start + || expected_segment->range_end != segment->range_end + || strcmp_null(expected_segment->path, segment->path) != 0) return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, "Location segments differ\n" " Expected location segment: %s\n" @@ -1950,7 +1966,7 @@ node_location_segments(const svn_test_op { 6, 6, "A/D2/G" }, { 5, 5, NULL }, { 3, 4, "A/D2/G" }, - { 1, 2, "A/D2/G" }, + { 1, 2, "A/D/G" }, { 0 } }; SVN_ERR(check_location_segments(repos, "A/D/G", @@ -1965,7 +1981,7 @@ node_location_segments(const svn_test_op svn_location_segment_t expected_segments[] = { { 3, 3, "A/D2/G" }, - { 2, 2, "A/D2/G" }, + { 2, 2, "A/D/G" }, { 0 } }; SVN_ERR(check_location_segments(repos, "A/D/G", Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/spillbuf-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/spillbuf-test.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/spillbuf-test.c Tue Nov 27 22:13:24 2012 @@ -28,9 +28,9 @@ #include "../svn_test.h" -static const char basic_data[] = ("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789"); +static const char basic_data[] = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789"; /* Validate that BUF is STARTING_SIZE in length. Then read some data from Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/string-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/string-test.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/string-test.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_subr/string-test.c Tue Nov 27 22:13:24 2012 @@ -612,6 +612,105 @@ test_stringbuf_replace(apr_pool_t *pool) return expect_stringbuf_equal(a, "test hello, world!!!", pool); } +static svn_error_t * +test_string_similarity(apr_pool_t *pool) +{ + const struct sim_score_test_t + { + const char *stra; + const char *strb; + apr_size_t lcs; + int score; + } tests[] = + { +#define SCORE(lcs, len) ((2000 * (lcs) + (len)/2) / (len)) + + /* Equality */ + {"", "", 0, 1000}, + {"quoth", "quoth", 5, SCORE(5, 5+5)}, + + /* Deletion at start */ + {"quoth", "uoth", 4, SCORE(4, 5+4)}, + {"uoth", "quoth", 4, SCORE(4, 4+5)}, + + /* Deletion at end */ + {"quoth", "quot", 4, SCORE(4, 5+4)}, + {"quot", "quoth", 4, SCORE(4, 4+5)}, + + /* Insertion at start */ + {"quoth", "Xquoth", 5, SCORE(5, 5+6)}, + {"Xquoth", "quoth", 5, SCORE(5, 6+5)}, + + /* Insertion at end */ + {"quoth", "quothX", 5, SCORE(5, 5+6)}, + {"quothX", "quoth", 5, SCORE(5, 6+5)}, + + /* Insertion in middle */ + {"quoth", "quoXth", 5, SCORE(5, 5+6)}, + {"quoXth", "quoth", 5, SCORE(5, 6+5)}, + + /* Transposition at start */ + {"quoth", "uqoth", 4, SCORE(4, 5+5)}, + {"uqoth", "quoth", 4, SCORE(4, 5+5)}, + + /* Transposition at end */ + {"quoth", "quoht", 4, SCORE(4, 5+5)}, + {"quoht", "quoth", 4, SCORE(4, 5+5)}, + + /* Transposition in middle */ + {"quoth", "qutoh", 4, SCORE(4, 5+5)}, + {"qutoh", "quoth", 4, SCORE(4, 5+5)}, + + /* Difference */ + {"quoth", "raven", 0, SCORE(0, 5+5)}, + {"raven", "quoth", 0, SCORE(0, 5+5)}, + {"x", "", 0, SCORE(0, 1+0)}, + {"", "x", 0, SCORE(0, 0+1)}, + {"", "quoth", 0, SCORE(0, 0+5)}, + {"quoth", "", 0, SCORE(0, 5+0)}, + {"quoth", "the raven", 2, SCORE(2, 5+9)}, + {"the raven", "quoth", 2, SCORE(2, 5+9)}, + {NULL, NULL} + }; + + const struct sim_score_test_t *t; + svn_membuf_t buffer; + + svn_membuf__create(&buffer, 0, pool); + for (t = tests; t->stra; ++t) + { + apr_size_t lcs; + const unsigned int 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); + */ + if (score != t->score) + return fail(pool, "%s ~ %s score %.3f <> expected %.3f", + t->stra, t->strb, score/1000.0, t->score/1000.0); + + if (lcs != t->lcs) + return fail(pool, + "%s ~ %s lcs %"APR_SIZE_T_FMT + " <> expected %"APR_SIZE_T_FMT, + t->stra, t->strb, lcs, t->lcs); + } + + /* Test partial similarity */ + { + 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)) + return fail(pool, "'%s'[:4] ~ '%s'[:4] found different", + foo.data, bar.data); + } + + return SVN_NO_ERROR; +} + /* ==================================================================== If you add a new test to this file, update this array. @@ -677,5 +776,7 @@ struct svn_test_descriptor_t test_funcs[ "check deletion from svn_stringbuf_t"), SVN_TEST_PASS2(test_stringbuf_replace, "check replacement in svn_stringbuf_t"), + SVN_TEST_PASS2(test_string_similarity, + "test string similarity scores"), SVN_TEST_NULL }; Propchange: subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Nov 27 22:13:24 2012 @@ -11,3 +11,4 @@ tree-conflict-data-test wc-incomplete-tester wc-lock-tester wc-queries-test +wc-test Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/db-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/db-test.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/db-test.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/db-test.c Tue Nov 27 22:13:24 2012 @@ -664,7 +664,7 @@ test_inserting_nodes(apr_pool_t *pool) props, 1, TIME_1a, AUTHOR_1, checksum, - NULL, FALSE, FALSE, NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, NULL, FALSE, FALSE, NULL, NULL, pool)); @@ -677,7 +677,7 @@ test_inserting_nodes(apr_pool_t *pool) props, 1, TIME_1a, AUTHOR_1, "O-target", - NULL, FALSE, FALSE, NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, NULL, FALSE, FALSE, NULL, NULL, pool)); Modified: subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/utils.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/utils.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/utils.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/libsvn_wc/utils.c Tue Nov 27 22:13:24 2012 @@ -293,7 +293,7 @@ sbox_wc_commit(svn_test__sandbox_t *b, c sizeof(const char *)); APR_ARRAY_PUSH(targets, const char *) = sbox_wc_path(b, path); - SVN_ERR(svn_client_create_context(&ctx, b->pool)); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); return svn_client_commit5(targets, svn_depth_infinity, FALSE, FALSE, TRUE, /* keep locks/cl's/use_ops*/ NULL, NULL, NULL, NULL, ctx, b->pool); @@ -312,7 +312,7 @@ sbox_wc_update(svn_test__sandbox_t *b, c revision.value.number = revnum; APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, path); - SVN_ERR(svn_client_create_context(&ctx, b->pool)); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); return svn_client_update4(&result_revs, paths, &revision, svn_depth_infinity, TRUE, FALSE, FALSE, FALSE, FALSE, ctx, b->pool); @@ -323,8 +323,9 @@ sbox_wc_resolved(svn_test__sandbox_t *b, { svn_client_ctx_t *ctx; - SVN_ERR(svn_client_create_context(&ctx, b->pool)); - return svn_client_resolved(sbox_wc_path(b, path), TRUE, ctx, b->pool); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); + return svn_client_resolve(sbox_wc_path(b, path), svn_depth_infinity, + svn_wc_conflict_choose_merged, ctx, b->pool); } svn_error_t * @@ -332,7 +333,7 @@ sbox_wc_resolve(svn_test__sandbox_t *b, { svn_client_ctx_t *ctx; - SVN_ERR(svn_client_create_context(&ctx, b->pool)); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); return svn_client_resolve(sbox_wc_path(b, path), svn_depth_infinity, svn_wc_conflict_choose_mine_conflict, ctx, b->pool); @@ -345,7 +346,7 @@ sbox_wc_move(svn_test__sandbox_t *b, con apr_array_header_t *paths = apr_array_make(b->pool, 1, sizeof(const char *)); - SVN_ERR(svn_client_create_context(&ctx, b->pool)); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, src); return svn_client_move6(paths, sbox_wc_path(b, dst), FALSE, FALSE, NULL, NULL, NULL, ctx, b->pool); @@ -361,7 +362,7 @@ sbox_wc_propset(svn_test__sandbox_t *b, apr_array_header_t *paths = apr_array_make(b->pool, 1, sizeof(const char *)); - SVN_ERR(svn_client_create_context(&ctx, b->pool)); + SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool)); APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, path); return svn_client_propset_local(name, svn_string_create(value, b->pool), paths, svn_depth_empty, TRUE, NULL, ctx, Modified: subversion/branches/issue-4194-dev/subversion/tests/svn_test_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/subversion/tests/svn_test_fs.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/subversion/tests/svn_test_fs.c (original) +++ subversion/branches/issue-4194-dev/subversion/tests/svn_test_fs.c Tue Nov 27 22:13:24 2012 @@ -115,7 +115,7 @@ create_fs(svn_fs_t **fs_p, if (apr_stat(&finfo, name, APR_FINFO_TYPE, pool) == APR_SUCCESS) { if (finfo.filetype == APR_DIR) - SVN_ERR_W(svn_fs_delete_fs(name, pool), + SVN_ERR_W(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool), apr_psprintf(pool, "cannot create fs '%s' there is already " "a directory of that name", name)); Modified: subversion/branches/issue-4194-dev/tools/client-side/svn-bench/main.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/tools/client-side/svn-bench/main.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/tools/client-side/svn-bench/main.c (original) +++ subversion/branches/issue-4194-dev/tools/client-side/svn-bench/main.c Tue Nov 27 22:13:24 2012 @@ -66,7 +66,7 @@ typedef enum svn_cl__longopt_t { opt_with_revprop, opt_with_all_revprops, opt_with_no_revprops, - opt_trust_server_cert, + opt_trust_server_cert } svn_cl__longopt_t; Modified: subversion/branches/issue-4194-dev/tools/client-side/svn-bench/null-log-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/tools/client-side/svn-bench/null-log-cmd.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/tools/client-side/svn-bench/null-log-cmd.c (original) +++ subversion/branches/issue-4194-dev/tools/client-side/svn-bench/null-log-cmd.c Tue Nov 27 22:13:24 2012 @@ -134,7 +134,7 @@ svn_cl__null_log(apr_getopt_t *os, svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; apr_array_header_t *targets; - struct log_receiver_baton lb = { ctx }; + struct log_receiver_baton lb; const char *target; int i; apr_array_header_t *revprops; @@ -194,6 +194,7 @@ svn_cl__null_log(apr_getopt_t *os, } } + lb.ctx = ctx; lb.quiet = opt_state->quiet; revprops = apr_array_make(pool, 3, sizeof(char *)); Propchange: subversion/branches/issue-4194-dev/tools/server-side/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Nov 27 22:13:24 2012 @@ -3,3 +3,4 @@ svn-populate-node-origins-index svnauthz-validate svn-rep-sharing-stats fsfs-reorg +fsfs-stats Modified: subversion/branches/issue-4194-dev/tools/server-side/fsfs-reorg.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/tools/server-side/fsfs-reorg.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/tools/server-side/fsfs-reorg.c (original) +++ subversion/branches/issue-4194-dev/tools/server-side/fsfs-reorg.c Tue Nov 27 22:13:24 2012 @@ -828,7 +828,7 @@ read_revision_header(apr_size_t *changes { char buf[64]; const char *line; - const char *space; + char *space; apr_uint64_t val; apr_size_t len; @@ -857,7 +857,7 @@ read_revision_header(apr_size_t *changes return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, _("Final line in revision file missing space")); - *(char *)space = 0; + *space = 0; SVN_ERR(svn_cstring_strtoui64(&val, line+1, 0, APR_SIZE_MAX, 10)); *root_noderev = (apr_size_t)val; @@ -998,8 +998,8 @@ key_matches(svn_string_t *string, const static int compare_noderev_offsets(const void *data, const void *key) { - apr_ssize_t diff = (*(const noderev_t **)data)->original.offset - - *(const apr_size_t *)key; + apr_ssize_t diff = (*(const noderev_t *const *)data)->original.offset + - *(const apr_size_t *)key; /* sizeof(int) may be < sizeof(ssize_t) */ if (diff < 0) @@ -1050,14 +1050,14 @@ find_noderev(noderev_t **result, compare_noderev_offsets); if ((idx < 0) || (idx >= revision_info->node_revs->nelts)) return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL, - _("No noderev found at offset %" APR_OFF_T_FMT), - offset); + _("No noderev found at offset %ld"), + (long)offset); *result = APR_ARRAY_IDX(revision_info->node_revs, idx, noderev_t *); if ((*result)->original.offset != offset) return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL, - _("No noderev found at offset %" APR_OFF_T_FMT), - offset); + _("No noderev found at offset %ld"), + (long)offset); return SVN_NO_ERROR; } @@ -1079,8 +1079,8 @@ parse_pred(noderev_t **result, static int compare_representation_offsets(const void *data, const void *key) { - apr_ssize_t diff = (*(const representation_t **)data)->original.offset - - *(const apr_size_t *)key; + apr_ssize_t diff = (*(const representation_t *const *)data)->original.offset + - *(const apr_size_t *)key; /* sizeof(int) may be < sizeof(ssize_t) */ if (diff < 0) @@ -2290,7 +2290,7 @@ write_revisions(fs_fs_t *fs, revision_info_t *info = APR_ARRAY_IDX(pack->info, i, revision_info_t *); SVN_ERR(svn_stream_printf(stream, itempool, - "%" APR_UINT64_T_FMT "\n", + "%" APR_SIZE_T_FMT "\n", info->target.offset)); svn_pool_clear(itempool); } @@ -2469,10 +2469,9 @@ update_text(svn_stringbuf_t *node_rev, if (representation->dir) { char *newline_pos = strchr(val_pos, '\n'); - svn_checksum_t checksum = {representation->dir->target_md5, - svn_checksum_md5}; - const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_UINT64_T_FMT " %" - APR_UINT64_T_FMT" %" APR_SIZE_T_FMT " %s", + svn_checksum_t checksum; + const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_SIZE_T_FMT " %" + APR_SIZE_T_FMT" %" APR_SIZE_T_FMT " %s", representation->revision->revision, representation->target.offset - representation->revision->target.offset, representation->target.size, @@ -2480,6 +2479,8 @@ update_text(svn_stringbuf_t *node_rev, svn_checksum_to_cstring(&checksum, scratch_pool)); + checksum.digest = representation->dir->target_md5; + checksum.kind = svn_checksum_md5; svn_stringbuf_replace(node_rev, val_pos - node_rev->data, newline_pos - val_pos, temp, strlen(temp)); @@ -2491,7 +2492,7 @@ update_text(svn_stringbuf_t *node_rev, val_pos = end_pos + 1; end_pos = strchr(strchr(val_pos, ' ') + 1, ' '); - temp = apr_psprintf(scratch_pool, "%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT, + temp = apr_psprintf(scratch_pool, "%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT, representation->target.offset - representation->revision->target.offset, representation->target.size); @@ -2520,7 +2521,7 @@ get_fragment_content(svn_string_t **cont case header_fragment: info = fragment->data; *content = svn_string_createf(pool, - "\n%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n", + "\n%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n", info->root_noderev->target.offset - info->target.offset, info->target.changes); return SVN_NO_ERROR; @@ -2557,7 +2558,7 @@ get_fragment_content(svn_string_t **cont header = svn_stringbuf_create("DELTA\n", pool); else header = svn_stringbuf_createf(pool, - "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n", + "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n", representation->delta_base->revision->revision, representation->delta_base->target.offset - representation->delta_base->revision->target.offset, @@ -2600,7 +2601,7 @@ get_fragment_content(svn_string_t **cont { representation_t *base_rep = representation->delta_base; header = svn_stringbuf_createf(pool, - "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n", + "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n", base_rep->revision->revision, base_rep->target.offset - base_rep->revision->target.offset, base_rep->target.size); Modified: subversion/branches/issue-4194-dev/tools/server-side/fsfs-stats.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-4194-dev/tools/server-side/fsfs-stats.c?rev=1414433&r1=1414432&r2=1414433&view=diff ============================================================================== --- subversion/branches/issue-4194-dev/tools/server-side/fsfs-stats.c (original) +++ subversion/branches/issue-4194-dev/tools/server-side/fsfs-stats.c Tue Nov 27 22:13:24 2012 @@ -81,7 +81,7 @@ typedef struct representation_t /* revision that contains this representation * (may be referenced by other revisions, though) */ - apr_uint32_t revision; + svn_revnum_t revision; apr_uint32_t ref_count; /* length of the PLAIN / DELTA line in the source file in bytes */ @@ -418,7 +418,7 @@ read_revision_header(apr_size_t *changes { char buf[64]; const char *line; - const char *space; + char *space; apr_uint64_t val; apr_size_t len; @@ -447,7 +447,7 @@ read_revision_header(apr_size_t *changes return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, _("Final line in revision file missing space")); - *(char *)space = 0; + *space = 0; SVN_ERR(svn_cstring_strtoui64(&val, line+1, 0, APR_SIZE_MAX, 10)); *root_noderev = (apr_size_t)val; @@ -588,8 +588,8 @@ key_matches(svn_string_t *string, const static int compare_representation_offsets(const void *data, const void *key) { - apr_ssize_t diff = (*(const representation_t **)data)->offset - - *(const apr_size_t *)key; + apr_ssize_t diff = (*(const representation_t *const *)data)->offset + - *(const apr_size_t *)key; /* sizeof(int) may be < sizeof(ssize_t) */ if (diff < 0) @@ -601,7 +601,7 @@ static representation_t * find_representation(int *idx, fs_fs_t *fs, revision_info_t **revision_info, - int revision, + svn_revnum_t revision, apr_size_t offset) { revision_info_t *info; @@ -645,7 +645,8 @@ read_rep_base(representation_t **represe apr_pool_t *scratch_pool) { char *str, *last_str; - int idx, revision; + int idx; + svn_revnum_t revision; apr_uint64_t temp; const char *buffer = file_content->data + offset; @@ -673,7 +674,7 @@ read_rep_base(representation_t **represe /* We hopefully have a DELTA vs. a non-empty base revision. */ str = svn_cstring_tokenize(" ", &last_str); str = svn_cstring_tokenize(" ", &last_str); - SVN_ERR(svn_cstring_atoi(&revision, str)); + SVN_ERR(svn_revnum_parse(&revision, str, NULL)); str = svn_cstring_tokenize(" ", &last_str); SVN_ERR(svn_cstring_strtoui64(&temp, str, 0, APR_SIZE_MAX, 10)); @@ -692,7 +693,7 @@ parse_representation(representation_t ** apr_pool_t *scratch_pool) { representation_t *result; - int revision; + svn_revnum_t revision; apr_uint64_t offset; apr_uint64_t size; @@ -700,7 +701,7 @@ parse_representation(representation_t ** int idx; char *c = (char *)value->data; - SVN_ERR(svn_cstring_atoi(&revision, svn_cstring_tokenize(" ", &c))); + SVN_ERR(svn_revnum_parse(&revision, svn_cstring_tokenize(" ", &c), NULL)); SVN_ERR(svn_cstring_strtoui64(&offset, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10)); SVN_ERR(svn_cstring_strtoui64(&size, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10)); SVN_ERR(svn_cstring_strtoui64(&expanded_size, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10)); @@ -907,7 +908,7 @@ parse_dir(fs_fs_t *fs, text_pool)); current = text->data; - revision_key = apr_psprintf(text_pool, "r%d/", representation->revision); + revision_key = apr_psprintf(text_pool, "r%ld/", representation->revision); key_len = strlen(revision_key); /* Translate the string dir entries into real entries. */ @@ -923,9 +924,9 @@ parse_dir(fs_fs_t *fs, next = current ? strchr(++current, '\n') : NULL; if (next == NULL) return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, - _("Corrupt directory representation in rev %d at offset %ld"), + _("Corrupt directory representation in rev %ld at offset %ld"), representation->revision, - representation->offset); + (long)representation->offset); *next = 0; current = strstr(current, revision_key);
