changeset 14521:d27f669bad7c

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.
author Sune Foldager <cryo@cyanite.org>
date Fri, 03 Jun 2011 20:15:06 +0200
parents 9d8d2fecb72e
children 5ca61ef6ff00
files mercurial/localrepo.py
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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: