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.
--- 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)