[PATCH 1 of 5] context.walk: call util.all() a generator, not a list

Martin von Zweigbergk martinvonz at google.com
Wed Mar 18 20:27:40 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1426695986 25200
#      Wed Mar 18 09:26:26 2015 -0700
# Node ID 2ecdb84c187ea3044f61fec65ceaeb1193a72582
# Parent  b7f936f47f2b104a60840bae571e009742126afc
context.walk: call util.all() a generator, not a list

The file set can be large, so avoid going through the entire file set
when a file happens not to be in the context.

diff -r b7f936f47f2b -r 2ecdb84c187e mercurial/context.py
--- a/mercurial/context.py	Sun Mar 15 21:52:35 2015 -0400
+++ b/mercurial/context.py	Wed Mar 18 09:26:26 2015 -0700
@@ -594,7 +594,7 @@
 
         # 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]):
+            if util.all(fn in self for fn in fset):
                 for fn in sorted(fset):
                     if match(fn):
                         yield fn


More information about the Mercurial-devel mailing list