Mercurial > hg-stable
changeset 20119:1648e44edd8d
mq: prefer a loop to a double-for list comprehension
The [x for y in l for x in y] syntax is nigh-incomprehensible, and this
is a particularly easy case to expand into a loop since there's no 'if'
condition in the list comprehension.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sun, 24 Nov 2013 17:29:10 -0600 |
parents | 6ed9141151bf |
children | 872f81de2865 |
files | hgext/mq.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sat Nov 23 18:34:32 2013 +0100 +++ b/hgext/mq.py Sun Nov 24 17:29:10 2013 -0600 @@ -1204,7 +1204,9 @@ diffopts = self.diffopts() wlock = repo.wlock() try: - heads = [h for hs in repo.branchmap().itervalues() for h in hs] + heads = [] + for hs in repo.branchmap().itervalues(): + heads.extend(hs) if not heads: heads = [nullid] if repo.dirstate.p1() not in heads and not exact: