Mercurial > hg-stable
changeset 4155:4c714ed245d6
purge.py: fix invocation of statwalk
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 06 Mar 2007 17:45:50 -0300 |
parents | 15cd36db4230 |
children | d8515e374204 |
files | contrib/purge/purge.py tests/test-purge tests/test-purge.out |
diffstat | 3 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/purge/purge.py Tue Feb 27 09:05:36 2007 +0100 +++ b/contrib/purge/purge.py Tue Mar 06 17:45:50 2007 -0300 @@ -49,9 +49,10 @@ directories = [] files = [] - for src, f, st in repo.dirstate.statwalk(files=dirs, ignored=True, - directories=True): - if src == 'd': + roots, match, anypats = util.cmdmatcher(repo.root, repo.getcwd(), dirs) + for src, f, st in repo.dirstate.statwalk(files=roots, match=match, + ignored=True, directories=True): + if src == 'd': directories.append(f) elif src == 'f' and f not in repo.dirstate: files.append(f)
--- a/tests/test-purge Tue Feb 27 09:05:36 2007 +0100 +++ b/tests/test-purge Tue Mar 06 17:45:50 2007 -0300 @@ -50,6 +50,25 @@ hg purge -v ls +echo % delete nested directories from a subdir +mkdir -p untracked_directory/nested_directory +cd directory +hg purge -p +hg purge -v +cd .. +ls + +echo % delete only part of the tree +mkdir -p untracked_directory/nested_directory +touch directory/untracked_file +cd directory +hg purge -p ../untracked_directory +hg purge -v ../untracked_directory +cd .. +ls +ls directory/untracked_file +rm directory/untracked_file + echo % delete ignored files touch ignored hg purge -p
--- a/tests/test-purge.out Tue Feb 27 09:05:36 2007 +0100 +++ b/tests/test-purge.out Tue Mar 06 17:45:50 2007 -0300 @@ -29,6 +29,19 @@ 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 % delete ignored files ignored Removing file ignored