[PATCH] mq: refactor usage of repo.branchmap().iteritems() with itervalues()
Kevin Bullock
kbullock+mercurial at ringworld.org
Wed Sep 25 21:49:00 UTC 2013
On 25 Sep 2013, at 4:38 PM, Brodie Rao wrote:
> # HG changeset patch
> # User Brodie Rao <brodie at sf.io>
> # Date 1364871676 25200
> # Mon Apr 01 20:01:16 2013 -0700
> # Node ID 5ddfc6e253794f76691b27f805b1275d54708298
> # Parent 50d721553198cea51c30f53b76d41dc919280097
> mq: refactor usage of repo.branchmap().iteritems() with itervalues()
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -1222,9 +1222,7 @@ class queue(object):
> diffopts = self.diffopts()
> wlock = repo.wlock()
> try:
> - heads = []
> - for b, ls in repo.branchmap().iteritems():
> - heads += ls
> + heads = [h for hs in repo.branchmap().itervalues() for h in hs]
The double-`for` is really confusing to me here.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list