Patchwork D269: dirstate: simplify and speed up dirstate's __iter__

login
register
mail settings
Submitter phabricator
Date Aug. 8, 2017, 6:53 p.m.
Message ID <differential-rev-PHID-DREV-36joh5eakv4vvi4iie5c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22760/
State Superseded
Headers show

Comments

phabricator - Aug. 8, 2017, 6:53 p.m.
alex_gaynor created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  simplify-iter (bookmark) on default (branch)

REVISION DETAIL
  https://phab.mercurial-scm.org/D269

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: alex_gaynor, durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -359,8 +359,7 @@ 
         return key in self._map
 
     def __iter__(self):
-        for x in sorted(self._map):
-            yield x
+        return iter(sorted(self._map))
 
     def items(self):
         return self._map.iteritems()