# HG changeset patch # User Bryan O'Sullivan # Date 2005-09-18 22:03:07 # Node ID 25e5b1086624bdb9dd8dd722d20b4059e0ae31c2 # Parent a1a84dd489ff99ceee34615899ae59c0ec44f030 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. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -399,8 +399,19 @@ class dirstate: 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: