[PATCH 2 of 2] discovery: prefer loop to double-for list comprehension in changegroupsubset

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Jan 6 23:36:37 CST 2014


On 27 Nov 2013, at 8:57 AM, Augie Fackler <raf at durin42.com> wrote:

> On Sun, Nov 24, 2013 at 05:38:04PM -0600, Kevin Bullock wrote:
>> # HG changeset patch
>> # User Kevin Bullock <kbullock at ringworld.org>
>> # Date 1385336019 21600
>> #      Sun Nov 24 17:33:39 2013 -0600
>> # Node ID 40ef143ef1d9749ebf42d3c71170cf2f10f20235
>> # Parent  4f8e4f2eb8fdfd521d4883d48d9ab6685f64d0a4
>> 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.
>> 
>> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
>> --- a/mercurial/localrepo.py
>> +++ b/mercurial/localrepo.py
>> @@ -2008,8 +2008,11 @@ class localrepository(object):
>>             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)
>> +        #bases = [p for n in bs for p in cl.parents(n) if p != nullid]
> 
> Patches look righteous, but would you like to remove this
> commented-out line before pushing?

Derp. Just circled back to this, fixed up and crewed it.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list