purge: use status
authorMatt Mackall <mpm@selenic.com>
Thu, 26 Jun 2008 14:35:50 -0500
changeset 6754 0b700faaef32
parent 6753 ed5ffb2c12f3
child 6755 f8299c84b5b6
purge: use status
hgext/purge.py
--- 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)):