mercurial/dirstate.py
changeset 6201 305d4450036a
parent 6138 09847b90beae
child 6211 f89fd07fc51d
--- a/mercurial/dirstate.py	Sat Mar 01 22:30:03 2008 +0100
+++ b/mercurial/dirstate.py	Sun Mar 02 13:52:34 2008 +0100
@@ -383,8 +383,8 @@
         for src, f, st in self.statwalk(files, match, badmatch=badmatch):
             yield src, f
 
-    def statwalk(self, files=None, match=util.always, ignored=False,
-                 badmatch=None, directories=False):
+    def statwalk(self, files=None, match=util.always, unknown=True,
+                 ignored=False, badmatch=None, directories=False):
         '''
         walk recursively through the directory tree, finding all files
         matched by the match function
@@ -412,6 +412,7 @@
                 return False
             return match(file_)
 
+        # TODO: don't walk unknown directories if unknown and ignored are False
         ignore = self._ignore
         dirignore = self._dirignore
         if ignored:
@@ -527,7 +528,7 @@
             if imatch(k):
                 yield 'm', k, None
 
-    def status(self, files, match, list_ignored, list_clean):
+    def status(self, files, match, list_ignored, list_clean, list_unknown=True):
         lookup, modified, added, unknown, ignored = [], [], [], [], []
         removed, deleted, clean = [], [], []
 
@@ -545,14 +546,15 @@
         dadd = deleted.append
         cadd = clean.append
 
-        for src, fn, st in self.statwalk(files, match, ignored=list_ignored):
+        for src, fn, st in self.statwalk(files, match, unknown=list_unknown,
+                                         ignored=list_ignored):
             if fn in dmap:
                 type_, mode, size, time, foo = dmap[fn]
             else:
                 if (list_ignored or fn in files) and self._dirignore(fn):
                     if list_ignored:
                         iadd(fn)
-                else:
+                elif list_unknown:
                     uadd(fn)
                 continue
             if src == 'm':