svnsync_tests.py
字号:
dest_sbox = sbox.clone_dependent() build_repos(dest_sbox) svntest.actions.enable_revprop_changes(svntest.main.current_repo_dir) fp = open(sbox.authz_file, 'w') # For mod_dav_svn's parent path setup we need per-repos permissions in # the authz file... if sbox.repo_url.startswith('http'): fp.write("[svnsync-copy-from-unreadable-dir:/]\n" + "* = r\n" + "\n" + "[svnsync-copy-from-unreadable-dir:/A/B]\n" + "* = \n" + "\n" + "[svnsync-copy-from-unreadable-dir-1:/]\n" + "* = rw") # Otherwise we can just go with the permissions needed for the source # repository. else: fp.write("[/]\n" + "* = r\n" + "\n" + "[/A/B]\n" + "* =\n") fp.close() run_init(dest_sbox.repo_url, sbox.repo_url) run_sync(dest_sbox.repo_url) lambda_url = dest_sbox.repo_url + '/A/B/lambda' expected_out = [ 'Changed paths:\n', ' A /A/P\n', ' A /A/P/E\n', ' A /A/P/E/alpha\n', ' A /A/P/E/beta\n', ' A /A/P/F\n', ' A /A/P/lambda\n', '\n', '\n', # log message is stripped ] out, err = svntest.main.run_svn(None, 'log', '--username', svntest.main.wc_author, '--password', svntest.main.wc_passwd, '-r', '3', '-v', dest_sbox.repo_url) if err: raise svntest.actions.SVNUnexpectedStderr(err) svntest.actions.compare_and_display_lines(None, 'LOG', expected_out, out[2:11]) svntest.actions.run_and_verify_svn(None, ['bar\n'], [], 'pget', 'foo', dest_sbox.repo_url + '/A/P/lambda') svntest.actions.run_and_verify_svn(None, ['zot\n'], [], 'pget', 'baz', dest_sbox.repo_url + '/A/P')# Issue 2705.def copy_with_mod_from_unreadable_dir(sbox): "verify copies with mods from unreadable dirs" skip_test_when_no_authz_available() sbox.build("svnsync-copy-with-mod-from-unreadable-dir") # Make a copy of the B directory. svntest.actions.run_and_verify_svn(None, None, [], 'cp', sbox.wc_dir + '/A/B', sbox.wc_dir + '/A/P') # Set a property inside the copied directory. svntest.actions.run_and_verify_svn(None, None, [], 'pset', 'foo', 'bar', sbox.wc_dir + '/A/P/lambda') # Add a new directory and file inside the copied directory. svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', sbox.wc_dir + '/A/P/NEW-DIR') svntest.main.file_append(sbox.wc_dir + '/A/P/E/new-file', "bla bla") svntest.main.run_svn(None, 'add', sbox.wc_dir + '/A/P/E/new-file') # Delete a file inside the copied directory. svntest.actions.run_and_verify_svn(None, None, [], 'rm', sbox.wc_dir + '/A/P/E/beta') # Commit the copy-with-modification. svntest.actions.run_and_verify_svn(None, None, [], 'ci', sbox.wc_dir, '-m', 'log_msg') # Lock down the source repository. write_restrictive_svnserve_conf(sbox.repo_dir) dest_sbox = sbox.clone_dependent() build_repos(dest_sbox) svntest.actions.enable_revprop_changes(dest_sbox.repo_dir) fp = open(sbox.authz_file, 'w') # For mod_dav_svn's parent path setup we need per-repos permissions in # the authz file... if sbox.repo_url.startswith('http'): fp.write("[svnsync-copy-with-mod-from-unreadable-dir:/]\n" + "* = r\n" + "\n" + "[svnsync-copy-with-mod-from-unreadable-dir:/A/B]\n" + "* = \n" + "\n" + "[svnsync-copy-with-mod-from-unreadable-dir-1:/]\n" + "* = rw") # Otherwise we can just go with the permissions needed for the source # repository. else: fp.write("[/]\n" + "* = r\n" + "\n" + "[/A/B]\n" + "* =\n") fp.close() run_init(dest_sbox.repo_url, sbox.repo_url) run_sync(dest_sbox.repo_url) expected_out = [ 'Changed paths:\n', ' A /A/P\n', ' A /A/P/E\n', ' A /A/P/E/alpha\n', ' A /A/P/E/new-file\n', ' A /A/P/F\n', ' A /A/P/NEW-DIR\n', ' A /A/P/lambda\n', '\n', '\n', # log message is stripped ] out, err = svntest.main.run_svn(None, 'log', '--username', svntest.main.wc_author, '--password', svntest.main.wc_passwd, '-r', '2', '-v', dest_sbox.repo_url) if err: raise svntest.actions.SVNUnexpectedStderr(err) svntest.actions.compare_and_display_lines(None, 'LOG', expected_out, out[2:12]) svntest.actions.run_and_verify_svn(None, ['bar\n'], [], 'pget', 'foo', dest_sbox.repo_url + '/A/P/lambda')# Issue 2705.def copy_with_mod_from_unreadable_dir_and_copy(sbox): "verify copies with mods from unreadable dirs +copy" skip_test_when_no_authz_available() sbox.build("svnsync-copy-with-mod-from-unreadable-dir-and-copy") # Make a copy of the B directory. svntest.actions.run_and_verify_svn(None, None, [], 'cp', sbox.wc_dir + '/A/B', sbox.wc_dir + '/A/P') # Copy a (readable) file into the copied directory. svntest.actions.run_and_verify_svn(None, None, [], 'cp', sbox.wc_dir + '/A/D/gamma', sbox.wc_dir + '/A/P/E') # Commit the copy-with-modification. svntest.actions.run_and_verify_svn(None, None, [], 'ci', sbox.wc_dir, '-m', 'log_msg') # Lock down the source repository. write_restrictive_svnserve_conf(sbox.repo_dir) dest_sbox = sbox.clone_dependent() build_repos(dest_sbox) svntest.actions.enable_revprop_changes(dest_sbox.repo_dir) fp = open(sbox.authz_file, 'w') # For mod_dav_svn's parent path setup we need per-repos permissions in # the authz file... if sbox.repo_url.startswith('http'): fp.write("[svnsync-copy-with-mod-from-unreadable-dir-and-copy:/]\n" + "* = r\n" + "\n" + "[svnsync-copy-with-mod-from-unreadable-dir-and-copy:/A/B]\n" + "* = \n" + "\n" + "[svnsync-copy-with-mod-from-unreadable-dir-and-copy-1:/]\n" + "* = rw") # Otherwise we can just go with the permissions needed for the source # repository. else: fp.write("[/]\n" + "* = r\n" + "\n" + "[/A/B]\n" + "* =\n") fp.close() run_init(dest_sbox.repo_url, sbox.repo_url) run_sync(dest_sbox.repo_url) expected_out = [ 'Changed paths:\n', ' A /A/P\n', ' A /A/P/E\n', ' A /A/P/E/alpha\n', ' A /A/P/E/beta\n', ' A /A/P/E/gamma (from /A/D/gamma:1)\n', ' A /A/P/F\n', ' A /A/P/lambda\n', '\n', '\n', # log message is stripped ] out, err = svntest.main.run_svn(None, 'log', '--username', svntest.main.wc_author, '--password', svntest.main.wc_passwd, '-r', '2', '-v', dest_sbox.repo_url) if err: raise svntest.actions.SVNUnexpectedStderr(err) svntest.actions.compare_and_display_lines(None, 'LOG', expected_out, out[2:12])def url_encoding(sbox): "test url encoding issues" run_test(sbox, "url-encoding-bug.dump")# A test for copying revisions that lack a property that already exists# on the destination rev as part of the commit (i.e. svn:author in this# case, but svn:date would also work).def no_author(sbox): "test copying revs with no svn:author revprops" run_test(sbox, "no-author.dump")######################################################################### Run the tests# list all tests here, starting with None:test_list = [ None, copy_and_modify, copy_from_previous_version_and_modify, copy_from_previous_version, modified_in_place, tag_empty_trunk, tag_trunk_with_dir, tag_trunk_with_file2, tag_trunk_with_file, tag_with_modified_file, dir_prop_change, file_dir_file, copy_parent_modify_prop, detect_meddling, basic_authz, copy_from_unreadable_dir, copy_with_mod_from_unreadable_dir, copy_with_mod_from_unreadable_dir_and_copy, url_encoding, no_author, ]if __name__ == '__main__': svntest.main.run_tests(test_list) # NOTREACHED### End of file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -