Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/mergeinfo_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/mergeinfo_tests.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/cmdline/mergeinfo_tests.py (original) +++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/mergeinfo_tests.py Tue Jan 5 17:31:58 2010 @@ -383,7 +383,7 @@ 'ci', wc_dir, '-m', 'Merge r5') - # Ask for merged revisions to A_COPY pegged at various values. + # Ask for merged and eligible revisions to A_COPY pegged at various values. # Prior to issue #3180 fix the peg revision was ignored. # # A_COPY pegged to non-existent revision @@ -399,7 +399,7 @@ # a_c...@head svntest.actions.run_and_verify_mergeinfo( adjust_error_for_server_version(''), - ['3','5','6'], A_path, A_COPY_path + '@BASE', '--show-revs', 'merged') + ['3','5','6'], A_path, A_COPY_path + '@HEAD', '--show-revs', 'merged') # a_c...@4 (Prior to any merges) svntest.actions.run_and_verify_mergeinfo( @@ -417,6 +417,32 @@ adjust_error_for_server_version(''), ['3', '6'], A_path, A_COPY_path + '@PREV', '--show-revs', 'merged') + # a_c...@base + svntest.actions.run_and_verify_mergeinfo( + adjust_error_for_server_version(''), + ['4'], A_path, A_COPY_path + '@BASE', '--show-revs', 'eligible') + + # a_c...@head + svntest.actions.run_and_verify_mergeinfo( + adjust_error_for_server_version(''), + ['4'], A_path, A_COPY_path + '@HEAD', '--show-revs', 'eligible') + + # a_c...@4 (Prior to any merges) + svntest.actions.run_and_verify_mergeinfo( + adjust_error_for_server_version(''), + ['3', '4', '5', '6'], A_path, A_COPY_path + '@4', '--show-revs', 'eligible') + + # a_c...@committed (r8) + svntest.actions.run_and_verify_mergeinfo( + adjust_error_for_server_version(''), + ['4'], A_path, A_COPY_path + '@COMMITTED', '--show-revs', + 'eligible') + + # a_c...@prev (r7) + svntest.actions.run_and_verify_mergeinfo( + adjust_error_for_server_version(''), + ['4', '5'], A_path, A_COPY_path + '@PREV', '--show-revs', 'eligible') + ######################################################################## # Run the tests
Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/obliterate_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/obliterate_tests.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/cmdline/obliterate_tests.py (original) +++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/obliterate_tests.py Tue Jan 5 17:31:58 2010 @@ -42,29 +42,32 @@ # Test utilities # +obliteration_dirs = ['f-mod', 'f-add', 'f-del', 'f-rpl', 'f-mov'] + def create_dd1_scenarios(wc): """Create, in the initially empty repository of the SvnWC WC, the obliteration test scenarios depicted in each "Example 1" in <notes/obliterate/fspec-dd1/dd1-file-ops.svg>.""" # r1: base directories - for dir in ['f-mod', 'f-add', 'f-del', 'f-rpl', 'f-mov']: + for dir in obliteration_dirs: wc.svn_mkdir(dir) - wc.svn_commit() + rev = wc.svn_commit() - # r2 to r48 inclusive - for r in range(2, 9): - wc.svn_set_props('', { 'this-is-rev': str(r) }) - wc.svn_commit() + # r2 to r8 inclusive, just so that the obliteration rev is a round and + # consistent number (10), no matter what complexity of history we have. + while rev < 8: + wc.svn_set_props('', { 'this-is-rev': str(rev + 1) }) + rev = wc.svn_commit() - # r49: add the files used in the scenarios + # r9: add the files used in the scenarios wc.svn_file_create_add('f-mod/F', "Pear\n") wc.svn_file_create_add('f-del/F', "Pear\n") wc.svn_file_create_add('f-rpl/F', "Pear\n") wc.svn_file_create_add('f-mov/E', "Pear\n") # 'E' will be moved to 'F' wc.svn_commit() - # r50: the rev to be obliterated + # r10: the rev in which files named 'F' are to be obliterated wc.file_modify('f-mod/F', 'Apple\n') wc.svn_file_create_add('f-add/F', 'Apple\n') wc.svn_delete('f-del/F') @@ -74,10 +77,11 @@ wc.file_modify('f-mov/F', 'Apple\n') rev = wc.svn_commit(log='Rev to be obliterated') - # r51 - for dir in ['f-mod', 'f-add', 'f-rpl', 'f-mov']: - wc.file_modify(dir + '/F', 'Orange\n') - wc.svn_commit() + # r11: some more recent history that refers to the revision we changed + # (We are not ready to test this yet.) + #for dir in ['f-mod', 'f-add', 'f-rpl', 'f-mov']: + # wc.file_modify(dir + '/F', 'Orange\n') + #wc.svn_commit() return rev @@ -113,8 +117,9 @@ except: pass - # Obliterate d/f...@{content=apple} - repo.obliterate_node_rev('/d/foo', apple_rev) + # Obliterate a file in the revision where the file content was 'Apple' + for dir in obliteration_dirs: + repo.obliterate_node_rev(dir + '/F', apple_rev) # Dump the repository state, if possible, for debugging try: Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/prop_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/prop_tests.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/cmdline/prop_tests.py (original) +++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/prop_tests.py Tue Jan 5 17:31:58 2010 @@ -716,6 +716,13 @@ 'propset', SVN_PROP_MERGEINFO, '/trunk:', path) + # ...contain non-inheritable ranges when the target is a file. + svntest.actions.run_and_verify_svn('empty ranges', None, + "svn: Cannot set non-inheritable " + "mergeinfo on a non-directory*", + 'propset', SVN_PROP_MERGEINFO, + '/A/D/H/psi:1*', iota_path) + #---------------------------------------------------------------------- # Issue #976. When copying a file, do not determine svn:executable @@ -1703,6 +1710,30 @@ 'propdel', 'yellow', os.path.join(wc_dir, 'A', 'D', 'G')) +#---------------------------------------------------------------------- +def post_revprop_change_hook(sbox): + "post-revprop-change hook" + + sbox.build() + wc_dir = sbox.wc_dir + repo_dir = sbox.repo_dir + + # Include a non-XML-safe message to regression-test issue #3553. + error_msg = 'Text with <angle brackets> & ampersand' + + svntest.actions.enable_revprop_changes(repo_dir) + svntest.actions.create_failing_hook(repo_dir, 'post-revprop-change', + error_msg) + + expected_error = svntest.verify.ExpectedOutput([ + "svn: " + svntest.actions.hook_failure_message('post-revprop-change'), + error_msg + "\n", + ], match_all = False) + + svntest.actions.run_and_verify_svn(None, [], expected_error, + 'ps', '--revprop', '-r0', 'p', 'v', + wc_dir) + ######################################################################## # Run the tests @@ -1743,6 +1774,7 @@ same_replacement_props, added_moved_file, delete_nonexistent_property, + XFail(post_revprop_change_hook, svntest.main.is_ra_type_dav), ] if __name__ == '__main__': Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/actions.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/actions.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/actions.py (original) +++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/actions.py Tue Jan 5 17:31:58 2010 @@ -1573,26 +1573,50 @@ "Return the BASE revision of the working copy at WC_DIR." return run_and_parse_info(wc_dir)[0]['Revision'] +def hook_failure_message(hook_name): + """Return the error message that the client prints for failure of the + specified hook HOOK_NAME. The wording changed with Subversion 1.5.""" + if svntest.main.server_minor_version < 5: + return "'%s' hook failed with error output:\n" % hook_name + else: + if hook_name in ["start-commit", "pre-commit"]: + action = "Commit" + elif hook_name == "pre-revprop-change": + action = "Revprop change" + elif hook_name == "pre-lock": + action = "Lock" + elif hook_name == "pre-unlock": + action = "Unlock" + else: + action = None + if action is None: + message = "%s hook failed (exit code 1)" % (hook_name,) + else: + message = "%s blocked by %s hook (exit code 1)" % (action, hook_name) + return message + " with output:\n" + def create_failing_hook(repo_dir, hook_name, text): - """Create a HOOK_NAME hook in REPO_DIR that prints TEXT to stderr and exits - with an error.""" + """Create a HOOK_NAME hook in the repository at REPO_DIR that prints + TEXT to stderr and exits with an error.""" hook_path = os.path.join(repo_dir, 'hooks', hook_name) + # Embed the text carefully: it might include characters like "%" and "'". main.create_python_hook_script(hook_path, 'import sys\n' - 'sys.stderr.write("""%%s hook failed: %%s""" %% (%s, %s))\n' - 'sys.exit(1)\n' % (repr(hook_name), repr(text))) + 'sys.stderr.write(' + repr(text) + ')\n' + 'sys.exit(1)\n') def enable_revprop_changes(repo_dir): - """Enable revprop changes in a repository REPOS_DIR by creating a -pre-revprop-change hook script and (if appropriate) making it executable.""" + """Enable revprop changes in the repository at REPO_DIR by creating a + pre-revprop-change hook script and (if appropriate) making it executable.""" hook_path = main.get_pre_revprop_change_hook_path(repo_dir) main.create_python_hook_script(hook_path, 'import sys; sys.exit(0)') def disable_revprop_changes(repo_dir): - """Disable revprop changes in a repository REPO_DIR by creating a -pre-revprop-change hook script like enable_revprop_changes, except that -the hook prints "pre-revprop-change" followed by sys.argv""" + """Disable revprop changes in the repository at REPO_DIR by creating a + pre-revprop-change hook script that prints "pre-revprop-change" followed + by its arguments, and returns an error.""" + hook_path = main.get_pre_revprop_change_hook_path(repo_dir) main.create_python_hook_script(hook_path, 'import sys\n' @@ -1600,8 +1624,8 @@ 'sys.exit(1)\n') def create_failing_post_commit_hook(repo_dir): - """Disable commits in a repository REPOS_DIR by creating a post-commit hook -script which always reports errors.""" + """Create a post-commit hook script in the repository at REPO_DIR that always + reports an error.""" hook_path = main.get_post_commit_hook_path(repo_dir) main.create_python_hook_script(hook_path, 'import sys\n' Modified: subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/objects.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/objects.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/objects.py (original) +++ subversion/branches/issue-3242-dev/subversion/tests/cmdline/svntest/objects.py Tue Jan 5 17:31:58 2010 @@ -118,8 +118,6 @@ 'locks', 'lock-tokens', 'miscellaneous', 'uuids']: file.write(table + ":\n") for line in db_dump(db_dump_name, repo_path, table): - if line == " next-key\n": - break file.write(crude_bdb_parse(line)) file.write("\n") file.close() @@ -160,7 +158,6 @@ print "## SvnRepository::dump(rep_dir=" + self.repo_absdir + ")" """Run a BDB dump on the repository""" - #subprocess.call(["/home/julianfoad/bin/svn-dump-bdb", self.repo_absdir, ldir]) if self.db_dump_name != 'none': dump_bdb(self.db_dump_name, self.repo_absdir, ldir) Modified: subversion/branches/issue-3242-dev/subversion/tests/libsvn_diff/parse-diff-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/libsvn_diff/parse-diff-test.c?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/libsvn_diff/parse-diff-test.c (original) +++ subversion/branches/issue-3242-dev/subversion/tests/libsvn_diff/parse-diff-test.c Tue Jan 5 17:31:58 2010 @@ -89,7 +89,7 @@ /* We have two patches with one hunk each. * Parse the first patch. */ - SVN_ERR(svn_diff__parse_next_patch(&patch, patch_file, NL, pool, pool)); + SVN_ERR(svn_diff__parse_next_patch(&patch, patch_file, pool, pool)); SVN_ERR_ASSERT(patch); SVN_ERR_ASSERT(! strcmp(patch->old_filename, "A/C/gamma")); SVN_ERR_ASSERT(! strcmp(patch->new_filename, "A/C/gamma")); @@ -118,7 +118,7 @@ SVN_ERR_ASSERT(buf->len == 0); /* Parse the second patch. */ - SVN_ERR(svn_diff__parse_next_patch(&patch, patch_file, NL, pool, pool)); + SVN_ERR(svn_diff__parse_next_patch(&patch, patch_file, pool, pool)); SVN_ERR_ASSERT(patch); SVN_ERR_ASSERT(! strcmp(patch->old_filename, "A/D/gamma.orig")); SVN_ERR_ASSERT(! strcmp(patch->new_filename, "A/D/gamma")); Propchange: subversion/branches/issue-3242-dev/subversion/tests/libsvn_fs_fs/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Jan 5 17:31:58 2010 @@ -3,6 +3,7 @@ .libs test-repo-* fs-pack-test +test-get-set-revprop-packed-fs *.o *.lo *~ Modified: subversion/branches/issue-3242-dev/subversion/tests/libsvn_subr/stream-test.c URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/subversion/tests/libsvn_subr/stream-test.c?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/subversion/tests/libsvn_subr/stream-test.c (original) +++ subversion/branches/issue-3242-dev/subversion/tests/libsvn_subr/stream-test.c Tue Jan 5 17:31:58 2010 @@ -464,7 +464,96 @@ return SVN_NO_ERROR; } +static svn_error_t * +test_stream_seek_file(apr_pool_t *pool) +{ + static const char *file_data[2] = {"One", "Two"}; + svn_stream_t *stream; + svn_stringbuf_t *line; + svn_boolean_t eof; + apr_file_t *f; + static const char *fname = "test_stream_seek.txt"; + int j; + apr_status_t status; + static const char *NL = APR_EOL_STR; + svn_stream_mark_t *mark; + status = apr_file_open(&f, fname, (APR_READ | APR_WRITE | APR_CREATE | + APR_TRUNCATE | APR_DELONCLOSE), APR_OS_DEFAULT, pool); + if (status != APR_SUCCESS) + return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, "Cannot open '%s'", + fname); + + /* Create the file. */ + for (j = 0; j < 2; j++) + { + apr_size_t len; + + len = strlen(file_data[j]); + status = apr_file_write(f, file_data[j], &len); + if (status || len != strlen(file_data[j])) + return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, + "Cannot write to '%s'", fname); + len = strlen(NL); + status = apr_file_write(f, NL, &len); + if (status || len != strlen(NL)) + return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, + "Cannot write to '%s'", fname); + } + + /* Create a stream to read from the file. */ + stream = svn_stream_from_aprfile2(f, FALSE, pool); + SVN_ERR(svn_stream_reset(stream)); + SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool)); + SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[0]) == 0); + /* Set a mark at the beginning of the second line of the file. */ + SVN_ERR(svn_stream_mark(stream, &mark, pool)); + /* Read the second line and then seek back to the mark. */ + SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool)); + SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0); + SVN_ERR(svn_stream_seek(stream, mark)); + /* The next read should return the second line again. */ + SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool)); + SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0); + /* The next read should return EOF. */ + SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool)); + SVN_ERR_ASSERT(eof); + + SVN_ERR(svn_stream_close(stream)); + + return SVN_NO_ERROR; +} + +static svn_error_t * +test_stream_seek_stringbuf(apr_pool_t *pool) +{ + svn_stream_t *stream; + svn_stringbuf_t *stringbuf; + char buf[4]; + apr_size_t len; + svn_stream_mark_t *mark; + + stringbuf = svn_stringbuf_create("OneTwo", pool); + stream = svn_stream_from_stringbuf(stringbuf, pool); + len = 3; + SVN_ERR(svn_stream_read(stream, buf, &len)); + buf[3] = '\0'; + SVN_ERR_ASSERT(strcmp(buf, "One") == 0); + SVN_ERR(svn_stream_mark(stream, &mark, pool)); + len = 3; + SVN_ERR(svn_stream_read(stream, buf, &len)); + buf[3] = '\0'; + SVN_ERR_ASSERT(strcmp(buf, "Two") == 0); + SVN_ERR(svn_stream_seek(stream, mark)); + len = 3; + SVN_ERR(svn_stream_read(stream, buf, &len)); + buf[3] = '\0'; + SVN_ERR_ASSERT(strcmp(buf, "Two") == 0); + + SVN_ERR(svn_stream_close(stream)); + + return SVN_NO_ERROR; +} /* The test table. */ @@ -486,5 +575,9 @@ "test stream line filtering and transforming"), SVN_TEST_PASS2(test_stream_tee, "test 'tee' streams"), + SVN_TEST_PASS2(test_stream_seek_file, + "test stream seeking for files"), + SVN_TEST_PASS2(test_stream_seek_stringbuf, + "test stream seeking for stringbufs"), SVN_TEST_NULL }; Modified: subversion/branches/issue-3242-dev/tools/dev/gen_junit_report.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/tools/dev/gen_junit_report.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/tools/dev/gen_junit_report.py (original) +++ subversion/branches/issue-3242-dev/tools/dev/gen_junit_report.py Tue Jan 5 17:31:58 2010 @@ -1,3 +1,4 @@ +#!/bin/env python # # # Licensed to the Apache Software Foundation (ASF) under one @@ -18,7 +19,6 @@ # under the License. # # -#!/bin/env python # $Id$ """ Modified: subversion/branches/issue-3242-dev/tools/dev/wc-ng/gather-data.sh URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/tools/dev/wc-ng/gather-data.sh?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/tools/dev/wc-ng/gather-data.sh (original) +++ subversion/branches/issue-3242-dev/tools/dev/wc-ng/gather-data.sh Tue Jan 5 17:31:58 2010 @@ -1,3 +1,4 @@ +#/usr/bin/env sh # # # Licensed to the Apache Software Foundation (ASF) under one @@ -18,7 +19,6 @@ # under the License. # # -#/usr/bin/env sh # Trap Ctrl-C trap 'exit 1' 2 Modified: subversion/branches/issue-3242-dev/tools/hook-scripts/mailer/mailer.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/tools/hook-scripts/mailer/mailer.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/tools/hook-scripts/mailer/mailer.py (original) +++ subversion/branches/issue-3242-dev/tools/hook-scripts/mailer/mailer.py Tue Jan 5 17:31:58 2010 @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # # # Licensed to the Apache Software Foundation (ASF) under one @@ -19,8 +20,6 @@ # under the License. # # -# -*- coding: utf-8 -*- -# # mailer.py: send email describing a commit # # $HeadURL$ Modified: subversion/branches/issue-3242-dev/tools/hook-scripts/svnperms.py URL: http://svn.apache.org/viewvc/subversion/branches/issue-3242-dev/tools/hook-scripts/svnperms.py?rev=896142&r1=896141&r2=896142&view=diff ============================================================================== --- subversion/branches/issue-3242-dev/tools/hook-scripts/svnperms.py (original) +++ subversion/branches/issue-3242-dev/tools/hook-scripts/svnperms.py Tue Jan 5 17:31:58 2010 @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # # # Licensed to the Apache Software Foundation (ASF) under one @@ -19,7 +20,6 @@ # under the License. # # -# -*- coding: utf-8 -*- # $HeadURL$ # $LastChangedDate$
