diff mercurial/context.py @ 24381:82b82168d045

context.walk: walk all files when file and '.' given When both '.' (the working copy root) and an explicit file (or files) are in match.files(), we only walk the explicitly listed files. This is because we remove the '.' from the set too early. Move later and add a test for it. Before this change, the last test would print only "3".
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 18 Mar 2015 11:42:09 -0700
parents dd3bccb4b820
children 1cfded2fa1a9
line wrap: on
line diff
--- a/mercurial/context.py	Wed Mar 18 09:26:26 2015 -0700
+++ b/mercurial/context.py	Wed Mar 18 11:42:09 2015 -0700
@@ -588,10 +588,6 @@
 
     def walk(self, match):
         fset = set(match.files())
-        # for dirstate.walk, files=['.'] means "walk the whole tree".
-        # follow that here, too
-        fset.discard('.')
-
         # avoid the entire walk if we're only looking for specific files
         if fset and not match.anypats():
             if util.all(fn in self for fn in fset):
@@ -606,6 +602,9 @@
                 fset.remove(fn)
             if match(fn):
                 yield fn
+        # for dirstate.walk, files=['.'] means "walk the whole tree".
+        # follow that here, too
+        fset.discard('.')
         for fn in sorted(fset):
             if not self.hasdir(fn):
                 match.bad(fn, _('no such file in rev %s') % self)