diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/tests/cmdline/wc_tests.py | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/tests/cmdline/wc_tests.py')
-rwxr-xr-x | subversion/tests/cmdline/wc_tests.py | 159 |
1 files changed, 150 insertions, 9 deletions
diff --git a/subversion/tests/cmdline/wc_tests.py b/subversion/tests/cmdline/wc_tests.py index 75f6743..185acad 100755 --- a/subversion/tests/cmdline/wc_tests.py +++ b/subversion/tests/cmdline/wc_tests.py @@ -42,6 +42,7 @@ Issues = svntest.testcase.Issues_deco Issue = svntest.testcase.Issue_deco Wimp = svntest.testcase.Wimp_deco Item = wc.StateItem +UnorderedOutput = svntest.verify.UnorderedOutput ###################################################################### # Tests @@ -131,7 +132,7 @@ def status_with_inaccessible_wc_db(sbox): sbox.build(read_only = True) os.chmod(sbox.ospath(".svn/wc.db"), 0) svntest.actions.run_and_verify_svn( - "Status when wc.db is not accessible", None, + None, r"[^ ]+ E155016: The working copy database at '.*' is corrupt", "st", sbox.wc_dir) @@ -143,7 +144,7 @@ def status_with_corrupt_wc_db(sbox): with open(sbox.ospath(".svn/wc.db"), 'wb') as fd: fd.write('\0' * 17) svntest.actions.run_and_verify_svn( - "Status when wc.db is corrupt", None, + None, r"[^ ]+ E155016: The working copy database at '.*' is corrupt", "st", sbox.wc_dir) @@ -154,7 +155,7 @@ def status_with_zero_length_wc_db(sbox): sbox.build(read_only = True) os.close(os.open(sbox.ospath(".svn/wc.db"), os.O_RDWR | os.O_TRUNC)) svntest.actions.run_and_verify_svn( - "Status when wc.db has zero length", None, + None, r"[^ ]+ E200030:", # SVN_ERR_SQLITE_ERROR "st", sbox.wc_dir) @@ -165,7 +166,7 @@ def status_without_wc_db(sbox): sbox.build(read_only = True) os.remove(sbox.ospath(".svn/wc.db")) svntest.actions.run_and_verify_svn( - "Status when wc.db is missing", None, + None, r"[^ ]+ E155016: The working copy database at '.*' is missing", "st", sbox.wc_dir) @@ -178,7 +179,7 @@ def status_without_wc_db_and_entries(sbox): os.remove(sbox.ospath(".svn/wc.db")) os.remove(sbox.ospath(".svn/entries")) svntest.actions.run_and_verify_svn2( - "Status when wc.db and entries are missing", None, + None, r"[^ ]+ warning: W155007: '.*' is not a working copy", 0, "st", sbox.wc_dir) @@ -191,7 +192,7 @@ def status_with_missing_wc_db_and_maybe_valid_entries(sbox): fd.write('something\n') os.remove(sbox.ospath(".svn/wc.db")) svntest.actions.run_and_verify_svn( - "Status when wc.db is missing and .svn/entries might be valid", None, + None, r"[^ ]+ E155036:", # SVN_ERR_WC_UPGRADE_REQUIRED "st", sbox.wc_dir) @@ -202,7 +203,7 @@ def cleanup_below_wc_root(sbox): sbox.build(read_only = True) svntest.actions.lock_admin_dir(sbox.ospath(""), True) - svntest.actions.run_and_verify_svn("Cleanup below wc root", None, [], + svntest.actions.run_and_verify_svn(None, [], "cleanup", sbox.ospath("A")) @SkipUnless(svntest.main.is_posix_os) @@ -221,8 +222,144 @@ def update_through_unversioned_symlink(sbox): # Subversion 1.8.0 crashes when updating a working copy through a symlink svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, - None, None, None, None, None, 1, - symlink) + [], True, symlink) + +@Issue(3549) +def cleanup_unversioned_items(sbox): + """cleanup --remove-unversioned / --remove-ignored""" + + sbox.build(read_only = True) + wc_dir = sbox.wc_dir + + # create some unversioned items + os.mkdir(sbox.ospath('dir1')) + os.mkdir(sbox.ospath('dir2')) + contents = "This is an unversioned file\n." + svntest.main.file_write(sbox.ospath('dir1/dir1_child1'), contents) + svntest.main.file_write(sbox.ospath('dir2/dir2_child1'), contents) + os.mkdir(sbox.ospath('dir2/foo_child2')) + svntest.main.file_write(sbox.ospath('file_foo'), contents), + os.mkdir(sbox.ospath('dir_foo')) + svntest.main.file_write(sbox.ospath('dir_foo/foo_child1'), contents) + os.mkdir(sbox.ospath('dir_foo/foo_child2')) + # a file that matches a default ignore pattern + svntest.main.file_write(sbox.ospath('foo.o'), contents) + + # ignore some of the unversioned items + sbox.simple_propset('svn:ignore', '*_foo', '.') + + os.chdir(wc_dir) + + expected_output = [ + ' M .\n', + '? dir1\n', + '? dir2\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'status') + expected_output += [ + 'I dir_foo\n', + 'I file_foo\n', + 'I foo.o\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'status', '--no-ignore') + + expected_output = [ + 'D dir1\n', + 'D dir2\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'cleanup', '--remove-unversioned') + expected_output = [ + ' M .\n', + 'I dir_foo\n', + 'I file_foo\n', + 'I foo.o\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'status', '--no-ignore') + + # remove ignored items, with an empty global-ignores list + expected_output = [ + 'D dir_foo\n', + 'D file_foo\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'cleanup', '--remove-ignored', + '--config-option', + 'config:miscellany:global-ignores=') + + # the file matching global-ignores should still be present + expected_output = [ + ' M .\n', + 'I foo.o\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'status', '--no-ignore') + + # un-ignore the file matching global ignores, making it unversioned, + # and remove it with --remove-unversioned + expected_output = [ + 'D foo.o\n', + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], 'cleanup', '--remove-unversioned', + '--config-option', + 'config:miscellany:global-ignores=') + expected_output = [ + ' M .\n', + ] + svntest.actions.run_and_verify_svn(expected_output, + [], 'status', '--no-ignore') + +def cleanup_unversioned_items_in_locked_wc(sbox): + """cleanup unversioned items in locked WC should fail""" + + sbox.build(read_only = True) + + contents = "This is an unversioned file\n." + svntest.main.file_write(sbox.ospath('unversioned_file'), contents) + + svntest.actions.lock_admin_dir(sbox.ospath(""), True) + for option in ['--remove-unversioned', '--remove-ignored']: + svntest.actions.run_and_verify_svn(None, + "svn: E155004: Working copy locked;.*", + "cleanup", option, + sbox.ospath("")) + +def cleanup_dir_external(sbox): + """cleanup --include-externals""" + + sbox.build(read_only = True) + + # configure a directory external + sbox.simple_propset("svn:externals", "^/A A_ext", ".") + sbox.simple_update() + + svntest.actions.lock_admin_dir(sbox.ospath("A_ext"), True) + svntest.actions.run_and_verify_svn(["Performing cleanup on external " + + "item at '%s'.\n" % sbox.ospath("A_ext")], + [], "cleanup", '--include-externals', + sbox.ospath("")) + +@Issue(4390) +def checkout_within_locked_wc(sbox): + """checkout within a locked working copy""" + + sbox.build(read_only = True) + + # lock working copy and create outstanding work queue items + svntest.actions.lock_admin_dir(sbox.ospath(""), True, True) + expected_output = [ + "A %s\n" % sbox.ospath("nested-wc/alpha"), + "A %s\n" % sbox.ospath("nested-wc/beta"), + "Checked out revision 1.\n" + ] + svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output), + [], "checkout", sbox.repo_url + '/A/B/E', + sbox.ospath("nested-wc")) + ######################################################################## # Run the tests @@ -243,6 +380,10 @@ test_list = [ None, status_with_missing_wc_db_and_maybe_valid_entries, cleanup_below_wc_root, update_through_unversioned_symlink, + cleanup_unversioned_items, + cleanup_unversioned_items_in_locked_wc, + cleanup_dir_external, + checkout_within_locked_wc, ] if __name__ == '__main__': |