Patchwork D2317: manifest: use list(dict) instead of dict.keys() to get a list of keys

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 6 a.m.
Message ID <differential-rev-PHID-DREV-lj7rlhw7otfm5bur2unx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28057/
State Superseded
Headers show

Comments

phabricator - Feb. 18, 2018, 6 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 18, 2018, 4:30 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  This one feels sub-optimal because of the amount of intermediary variables. But I think it should be OK.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit, indygreg
Cc: indygreg, mercurial-devel
phabricator - Feb. 18, 2018, 5:35 p.m.
durin42 added a comment.


  In https://phab.mercurial-scm.org/D2317#38442, @indygreg wrote:
  
  > This one feels sub-optimal because of the amount of intermediary variables. But I think it should be OK.
  
  
  Agreed, though it's equivalent to what's already happening with .keys().
  
  So far treemanifest code hasn't been prominent in profiles at Google, so it's not high on my optimization list.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1019,7 +1019,7 @@ 
 
         # yield this dir's files and walk its submanifests
         self._load()
-        for p in sorted(self._dirs.keys() + self._files.keys()):
+        for p in sorted(list(self._dirs) + list(self._files)):
             if p in self._files:
                 fullp = self._subpath(p)
                 if match(fullp):