localrepo: use list comprehension instead of generators
authorSune Foldager <cryo@cyanite.org>
Fri, 03 Jun 2011 20:15:06 +0200
changeset 14521 d27f669bad7c
parent 14520 9d8d2fecb72e
child 14522 5ca61ef6ff00
localrepo: use list comprehension instead of generators The lists in question are iterated and kept in memory further down the code path anyway, and this simplifies things.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Jun 03 20:12:37 2011 +0200
+++ b/mercurial/localrepo.py	Fri Jun 03 20:15:06 2011 +0200
@@ -1511,9 +1511,8 @@
 
         # filter any nodes that claim to be part of the known set
         def prune(revlog, missing):
-            for n in missing:
-                if revlog.linkrev(revlog.rev(n)) not in commonrevs:
-                    yield n
+            return [n for n in missing
+                    if revlog.linkrev(revlog.rev(n)) not in commonrevs]
 
         def lookup(revlog, x):
             if revlog == cl:
@@ -1618,9 +1617,7 @@
         revset = set([cl.rev(n) for n in nodes])
 
         def gennodelst(log):
-            for r in log:
-                if log.linkrev(r) in revset:
-                    yield log.node(r)
+            return [log.node(r) for r in log if log.linkrev(r) in revset]
 
         def lookup(revlog, x):
             if revlog == cl: