changeset 6754:0b700faaef32

purge: use status
author Matt Mackall <mpm@selenic.com>
date Thu, 26 Jun 2008 14:35:50 -0500
parents ed5ffb2c12f3
children f8299c84b5b6
files hgext/purge.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/purge.py	Thu Jun 26 14:35:50 2008 -0500
+++ b/hgext/purge.py	Thu Jun 26 14:35:50 2008 -0500
@@ -56,7 +56,6 @@
     files that this program would delete use the --print option.
     '''
     act = not opts['print']
-    ignored = bool(opts['all'])
     abort_on_err = bool(opts['abort_on_err'])
     eol = opts['print0'] and '\0' or '\n'
     if eol == '\0':
@@ -86,16 +85,14 @@
     files = []
     match = cmdutil.match(repo, dirs, opts)
     match.dir = directories.append
-    for src, f, st in repo.dirstate.statwalk(match, ignored=ignored):
-        if src == 'f' and f not in repo.dirstate:
-            files.append(f)
-
+    status = repo.status(match=match, ignored=opts['all'], unknown=True)
+    files = status[4] + status[5]
+    files.sort()
     directories.sort()
 
     for f in files:
-        if f not in repo.dirstate:
-            ui.note(_('Removing file %s\n') % f)
-            remove(os.remove, f)
+        ui.note(_('Removing file %s\n') % f)
+        remove(os.remove, f)
 
     for f in directories[::-1]:
         if match(f) and not os.listdir(repo.wjoin(f)):