Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 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 | 4274eda143cb |
children | 2888a412f0b0 |
comparison
equal
deleted
inserted
replaced
20215:082b2930fe2c | 20216:01bdccfeb9d9 |
---|---|
1991 cl = self.changelog | 1991 cl = self.changelog |
1992 if not bases: | 1992 if not bases: |
1993 bases = [nullid] | 1993 bases = [nullid] |
1994 # TODO: remove call to nodesbetween. | 1994 # TODO: remove call to nodesbetween. |
1995 csets, bases, heads = cl.nodesbetween(bases, heads) | 1995 csets, bases, heads = cl.nodesbetween(bases, heads) |
1996 bases = [p for n in bases for p in cl.parents(n) if p != nullid] | 1996 discbases = [] |
1997 outgoing = discovery.outgoing(cl, bases, heads) | 1997 for n in bases: |
1998 discbases.extend([p for p in cl.parents(n) if p != nullid]) | |
1999 outgoing = discovery.outgoing(cl, discbases, heads) | |
1998 bundler = changegroup.bundle10(self) | 2000 bundler = changegroup.bundle10(self) |
1999 return self._changegroupsubset(outgoing, bundler, source) | 2001 return self._changegroupsubset(outgoing, bundler, source) |
2000 | 2002 |
2001 def getlocalbundle(self, source, outgoing, bundlecaps=None): | 2003 def getlocalbundle(self, source, outgoing, bundlecaps=None): |
2002 """Like getbundle, but taking a discovery.outgoing as an argument. | 2004 """Like getbundle, but taking a discovery.outgoing as an argument. |