Fix dirstate.changes for ignored directories.
authorBryan O'Sullivan <bos@serpentine.com>
Sun, 18 Sep 2005 15:03:07 -0700
changeset 1276 25e5b1086624
parent 1275 a1a84dd489ff
child 1277 0bf11906df28
Fix dirstate.changes for ignored directories. Do a second walking pass to examine any leftover files in the dirstate map that are in the .hgignore file but match our search criteria. This fixes the case of entire directories never being examined due to their presence in the .hgignore file, and should hopefully not add any significant overhead.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Sun Sep 18 14:07:02 2005 -0700
+++ b/mercurial/dirstate.py	Sun Sep 18 15:03:07 2005 -0700
@@ -399,8 +399,19 @@
         for src, fn in self.walkhelper(files, statmatch, dc):
             pass
 
+        # there may be patterns in the .hgignore file that prevent us
+        # from examining entire directories in the dirstate map, so we
+        # go back and explicitly examine any matching files we've
+        # ignored
+        unexamined = [fn for fn in dc.iterkeys()
+                      if self.ignore(fn) and match(fn)]
+
+        for src, fn in self.walkhelper(unexamined, statmatch, dc):
+            pass
+
         # anything left in dc didn't exist in the filesystem
-        for fn, c in [(fn, c) for fn, c in dc.items() if match(fn)]:
+        for fn, c in dc.iteritems():
+            if not match(fn): continue
             if c[0] == 'r':
                 removed.append(fn)
             else: