diff mercurial/dirstate.py @ 2022:a59da8cc35e4

New option -i/--ignored for 'hg status' to show ignored files. localrepo.changes() now returns an additional list of ignored files if it is called with show_ignored=True.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 29 Mar 2006 22:58:34 +0200
parents 11ffa1267185
children a514c7509fa9 5987c1eac2ce
line wrap: on
line diff
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -294,7 +294,7 @@ class dirstate(object):
                 kind))
         return False
 
-    def statwalk(self, files=None, match=util.always, dc=None):
+    def statwalk(self, files=None, match=util.always, dc=None, ignored=False):
         self.lazyread()
 
         # walk all files by default
@@ -307,7 +307,7 @@ class dirstate(object):
 
         def statmatch(file_, stat):
             file_ = util.pconvert(file_)
-            if file_ not in dc and self.ignore(file_):
+            if not ignored and file_ not in dc and self.ignore(file_):
                 return False
             return match(file_)
 
@@ -409,15 +409,18 @@ class dirstate(object):
             if not seen(k) and (statmatch(k, None)):
                 yield 'm', k, None
 
-    def changes(self, files=None, match=util.always):
-        lookup, modified, added, unknown = [], [], [], []
+    def changes(self, files=None, match=util.always, show_ignored=None):
+        lookup, modified, added, unknown, ignored = [], [], [], [], []
         removed, deleted = [], []
 
-        for src, fn, st in self.statwalk(files, match):
+        for src, fn, st in self.statwalk(files, match, ignored=show_ignored):
             try:
                 type_, mode, size, time = self[fn]
             except KeyError:
-                unknown.append(fn)
+                if show_ignored and self.ignore(fn):
+                    ignored.append(fn)
+                else:
+                    unknown.append(fn)
                 continue
             if src == 'm':
                 nonexistent = True
@@ -453,4 +456,4 @@ class dirstate(object):
             elif type_ == 'r':
                 removed.append(fn)
 
-        return (lookup, modified, added, removed, deleted, unknown)
+        return (lookup, modified, added, removed, deleted, unknown, ignored)