Patchwork [8,of,8] merge: simplify mergestate iter

login
register
mail settings
Submitter Mads Kiilerich
Date May 1, 2014, 11:42 p.m.
Message ID <c87a958142be7cb4f6e1.1398987776@mk-desktop>
Download mbox | patch
Permalink /patch/4473/
State Accepted
Commit a0b8a912ec81f8f7605bf16473fd2e95b5c6d306
Headers show

Comments

Mads Kiilerich - May 1, 2014, 11:42 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1336923908 -7200
#      Sun May 13 17:45:08 2012 +0200
# Branch stable
# Node ID c87a958142be7cb4f6e16b46f1795051996f010b
# Parent  9f41180aced9c82a5bf73680fb2adebe6dcdbd8f
merge: simplify mergestate iter
Pierre-Yves David - May 8, 2014, 8:01 p.m.
On 05/01/2014 04:42 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads@kiilerich.com>
> # Date 1336923908 -7200
> #      Sun May 13 17:45:08 2012 +0200
> # Branch stable
> # Node ID c87a958142be7cb4f6e16b46f1795051996f010b
> # Parent  9f41180aced9c82a5bf73680fb2adebe6dcdbd8f
> merge: simplify mergestate iter

I do not see how this patch is related all the others big changes you 
claimed leading to it</joke>

>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -232,10 +232,7 @@ class mergestate(object):
>           return self._state[dfile][0]
>
>       def __iter__(self):
> -        l = self._state.keys()
> -        l.sort()
> -        for f in l:
> -            yield f
> +        return iter(sorted(self._state))
>
>       def files(self):
>           return self._state.keys()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Pierre-Yves David - May 9, 2014, 2:19 a.m.
On 05/01/2014 04:42 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads@kiilerich.com>
> # Date 1336923908 -7200
> #      Sun May 13 17:45:08 2012 +0200
> # Branch stable
> # Node ID c87a958142be7cb4f6e16b46f1795051996f010b
> # Parent  9f41180aced9c82a5bf73680fb2adebe6dcdbd8f
> merge: simplify mergestate iter

This infamous patch #8 have been queued to the clown copter.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -232,10 +232,7 @@  class mergestate(object):
         return self._state[dfile][0]
 
     def __iter__(self):
-        l = self._state.keys()
-        l.sort()
-        for f in l:
-            yield f
+        return iter(sorted(self._state))
 
     def files(self):
         return self._state.keys()