hgext/purge.py
changeset 4691 ca4971347e0a
parent 4516 96d8a56d4ef9
child 4695 c3da7b6cc975
--- a/hgext/purge.py	Wed Jun 13 18:18:06 2007 +0900
+++ b/hgext/purge.py	Wed Jun 06 22:17:35 2007 +0200
@@ -31,7 +31,8 @@
 from mercurial.i18n import _
 import os
 
-def dopurge(ui, repo, dirs=None, act=True, abort_on_err=False, eol='\n',
+def dopurge(ui, repo, dirs=None, act=True, ignored=False, 
+            abort_on_err=False, eol='\n',
             force=False, include=None, exclude=None):
     def error(msg):
         if abort_on_err:
@@ -54,7 +55,7 @@
     roots, match, anypats = util.cmdmatcher(repo.root, repo.getcwd(), dirs,
                                             include, exclude)
     for src, f, st in repo.dirstate.statwalk(files=roots, match=match,
-                                             ignored=True, directories=True):
+                                             ignored=ignored, directories=True):
         if src == 'd':
             directories.append(f)
         elif src == 'm':
@@ -139,6 +140,7 @@
     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':
@@ -147,13 +149,15 @@
     force = bool(opts['force'])
     include = opts['include']
     exclude = opts['exclude']
-    dopurge(ui, repo, dirs, act, abort_on_err, eol, force, include, exclude)
+    dopurge(ui, repo, dirs, act, ignored, abort_on_err,
+            eol, force, include, exclude)
 
 
 cmdtable = {
     'purge':
         (purge,
          [('a', 'abort-on-err', None, _('abort if an error occurs')),
+          ('',  'all', None, _('purge ignored files too')),
           ('f', 'force', None, _('purge even when missing files are detected')),
           ('p', 'print', None, _('print the file names instead of deleting them')),
           ('0', 'print0', None, _('end filenames with NUL, for use with xargs'