changeset 821:72d9bd4841f3

Ensure that dirstate.walk only yields names once. Its predecessor code used to do this, and now it does, too.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 31 Jul 2005 17:54:00 -0800
parents 89985a1b3427
children b678e6d4f92d
files mercurial/hg.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Sun Jul 31 17:42:46 2005 -0800
+++ b/mercurial/hg.py	Sun Jul 31 17:54:00 2005 -0800
@@ -440,6 +440,10 @@
         dc = self.map.copy()
         # walk all files by default
         if not files: files = [self.root]
+        known = {'.hg': 1}
+        def seen(fn):
+            if fn in known: return True
+            known[fn] = 1
         def traverse():
             for f in util.unique(files):
                 f = os.path.join(self.root, f)
@@ -447,7 +451,7 @@
                     for dir, subdirs, fl in os.walk(f):
                         d = dir[len(self.root) + 1:]
                         nd = os.path.normpath(d)
-                        if nd == '.hg':
+                        if seen(nd):
                             subdirs[:] = []
                             continue
                         for sd in subdirs:
@@ -468,6 +472,7 @@
 
         for src, fn in util.unique(traverse()):
             fn = os.path.normpath(fn)
+            if seen(fn): continue
             if fn in dc:
                 del dc[fn]
             elif self.ignore(fn):