diff --git a/tests/test-purge.out b/tests/test-purge.out deleted file mode 100644 --- a/tests/test-purge.out +++ /dev/null @@ -1,78 +0,0 @@ -% init -% setup -% delete an empty directory -empty_dir -Removing directory empty_dir -directory -r1 -% delete an untracked directory -untracked_dir/untracked_file1 -untracked_dir/untracked_file2 -Removing file untracked_dir/untracked_file1 -Removing file untracked_dir/untracked_file2 -Removing directory untracked_dir -directory -r1 -% delete an untracked file -untracked_file -untracked_file_readonly -Removing file untracked_file -Removing file untracked_file_readonly -directory -r1 -% delete an untracked file in a tracked directory -directory/untracked_file -Removing file directory/untracked_file -directory -r1 -% delete nested directories -untracked_directory/nested_directory -Removing directory untracked_directory/nested_directory -Removing directory untracked_directory -directory -r1 -% delete nested directories from a subdir -untracked_directory/nested_directory -Removing directory untracked_directory/nested_directory -Removing directory untracked_directory -directory -r1 -% delete only part of the tree -untracked_directory/nested_directory -Removing directory untracked_directory/nested_directory -Removing directory untracked_directory -directory -r1 -directory/untracked_file -% skip ignored files if --all not specified -directory -ignored -r1 -ignored -Removing file ignored -directory -r1 -% abort with missing files until we support name mangling filesystems -untracked_file -! r1 -? untracked_file -untracked_file -Removing file untracked_file -! r1 -% tracked file in ignored directory (issue621) -untracked_file -Removing file untracked_file -% skip excluded files -directory -excluded_file -r1 -% skip files in excluded dirs -directory -excluded_dir -r1 -file -% skip excluded empty dirs -directory -excluded_dir -r1 -% skip patterns diff --git a/tests/test-purge b/tests/test-purge.t old mode 100755 new mode 100644 rename from tests/test-purge rename to tests/test-purge.t --- a/tests/test-purge +++ b/tests/test-purge.t @@ -1,138 +1,216 @@ -#!/bin/sh + $ cat <> $HGRCPATH + > [extensions] + > purge = + > EOF + +init + + $ hg init t + $ cd t -cat <> $HGRCPATH -[extensions] -purge = -EOF +setup -echo % init -hg init t -cd t + $ echo r1 > r1 + $ hg ci -qAmr1 -d'0 0' + $ mkdir directory + $ echo r2 > directory/r2 + $ hg ci -qAmr2 -d'1 0' + $ echo 'ignored' > .hgignore + $ hg ci -qAmr3 -d'2 0' + +delete an empty directory -echo % setup -echo r1 > r1 -hg ci -qAmr1 -d'0 0' -mkdir directory -echo r2 > directory/r2 -hg ci -qAmr2 -d'1 0' -echo 'ignored' > .hgignore -hg ci -qAmr3 -d'2 0' + $ mkdir empty_dir + $ hg purge -p + empty_dir + $ hg purge -v + Removing directory empty_dir + $ ls + directory + r1 + +delete an untracked directory -echo % delete an empty directory -mkdir empty_dir -hg purge -p -hg purge -v -ls + $ mkdir untracked_dir + $ touch untracked_dir/untracked_file1 + $ touch untracked_dir/untracked_file2 + $ hg purge -p + untracked_dir/untracked_file1 + untracked_dir/untracked_file2 + $ hg purge -v + Removing file untracked_dir/untracked_file1 + Removing file untracked_dir/untracked_file2 + Removing directory untracked_dir + $ ls + directory + r1 + +delete an untracked file -echo % delete an untracked directory -mkdir untracked_dir -touch untracked_dir/untracked_file1 -touch untracked_dir/untracked_file2 -hg purge -p -hg purge -v -ls + $ touch untracked_file + $ touch untracked_file_readonly + $ python < import os, stat + > f= 'untracked_file_readonly' + > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) + > EOF + $ hg purge -p + untracked_file + untracked_file_readonly + $ hg purge -v + Removing file untracked_file + Removing file untracked_file_readonly + $ ls + directory + r1 -echo % delete an untracked file -touch untracked_file -touch untracked_file_readonly -python < /dev/null -hg st + $ touch untracked_file + $ rm r1 + +hide error messages to avoid changing the output when the text changes -hg purge -p -hg purge -v 2> /dev/null -hg st + $ hg purge -p 2> /dev/null + untracked_file + $ hg st + ! r1 + ? untracked_file -hg purge -v -hg revert --all --quiet -hg st -a + $ hg purge -p + untracked_file + $ hg purge -v 2> /dev/null + Removing file untracked_file + $ hg st + ! r1 -echo '% tracked file in ignored directory (issue621)' -echo directory >> .hgignore -hg ci -m 'ignore directory' -touch untracked_file -hg purge -p -hg purge -v + $ hg purge -v + $ hg revert --all --quiet + $ hg st -a + +tracked file in ignored directory (issue621) -echo % skip excluded files -touch excluded_file -hg purge -p -X excluded_file -hg purge -v -X excluded_file -ls -rm excluded_file + $ echo directory >> .hgignore + $ hg ci -m 'ignore directory' + $ touch untracked_file + $ hg purge -p + untracked_file + $ hg purge -v + Removing file untracked_file + +skip excluded files + + $ touch excluded_file + $ hg purge -p -X excluded_file + $ hg purge -v -X excluded_file + $ ls + directory + excluded_file + r1 + $ rm excluded_file + +skip files in excluded dirs -echo % skip files in excluded dirs -mkdir excluded_dir -touch excluded_dir/file -hg purge -p -X excluded_dir -hg purge -v -X excluded_dir -ls -ls excluded_dir -rm -R excluded_dir + $ mkdir excluded_dir + $ touch excluded_dir/file + $ hg purge -p -X excluded_dir + $ hg purge -v -X excluded_dir + $ ls + directory + excluded_dir + r1 + $ ls excluded_dir + file + $ rm -R excluded_dir + +skip excluded empty dirs -echo % skip excluded empty dirs -mkdir excluded_dir -hg purge -p -X excluded_dir -hg purge -v -X excluded_dir -ls -rmdir excluded_dir + $ mkdir excluded_dir + $ hg purge -p -X excluded_dir + $ hg purge -v -X excluded_dir + $ ls + directory + excluded_dir + r1 + $ rmdir excluded_dir -echo % skip patterns -mkdir .svn -touch .svn/foo -mkdir directory/.svn -touch directory/.svn/foo -hg purge -p -X .svn -X '*/.svn' -hg purge -p -X re:.*.svn +skip patterns + + $ mkdir .svn + $ touch .svn/foo + $ mkdir directory/.svn + $ touch directory/.svn/foo + $ hg purge -p -X .svn -X '*/.svn' + $ hg purge -p -X re:.*.svn