changeset 20216:01bdccfeb9d9

discovery: prefer loop to double-for list comprehension in changegroupsubset The double-for form of list comprehensions gets particularly unreadable when you throw in an 'if' condition. This expands the only remaining instance of the double-for syntax in our codebase into a loop.
author Kevin Bullock <kbullock@ringworld.org>
date Sun, 24 Nov 2013 17:33:39 -0600
parents 082b2930fe2c
children 33394f2e331e
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jan 02 16:32:51 2014 -0600
+++ b/mercurial/localrepo.py	Sun Nov 24 17:33:39 2013 -0600
@@ -1993,8 +1993,10 @@
             bases = [nullid]
         # TODO: remove call to nodesbetween.
         csets, bases, heads = cl.nodesbetween(bases, heads)
-        bases = [p for n in bases for p in cl.parents(n) if p != nullid]
-        outgoing = discovery.outgoing(cl, bases, heads)
+        discbases = []
+        for n in bases:
+            discbases.extend([p for p in cl.parents(n) if p != nullid])
+        outgoing = discovery.outgoing(cl, discbases, heads)
         bundler = changegroup.bundle10(self)
         return self._changegroupsubset(outgoing, bundler, source)