Patchwork D1099: dagutil: use a listcomp instead of a map()

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2017, 1:30 a.m.
Message ID <differential-rev-PHID-DREV-4gcsrs3aafwim6t2yvry-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24958/
State Superseded
Headers show

Comments

phabricator - Oct. 16, 2017, 1:30 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In Python 3, the map() returns a generator object instead of a list,
  and some parts of hg depend on this being consumable more than once or
  sortable in place.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dagutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 16, 2017, 9:15 a.m.
ryanmce accepted this revision.
ryanmce added a comment.
This revision is now accepted and ready to land.


  queued

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel
phabricator - Oct. 17, 2017, 2:35 p.m.
yuja added a comment.


  I have no preference, but pycompat.maplist() could be used.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, ryanmce
Cc: yuja, ryanmce, mercurial-devel
phabricator - Oct. 17, 2017, 2:49 p.m.
durin42 added a comment.


  Oh, I always forget maplist() exists. Probably doesn't matter for this case.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, ryanmce
Cc: yuja, ryanmce, mercurial-devel

Patch

diff --git a/mercurial/dagutil.py b/mercurial/dagutil.py
--- a/mercurial/dagutil.py
+++ b/mercurial/dagutil.py
@@ -148,7 +148,7 @@ 
                     if (r is not None
                         and r != nullrev
                         and r not in rl.filteredrevs)]
-        return map(self._internalize, ids)
+        return [self._internalize(i) for i in ids]
 
 
 class revlogdag(revlogbaseddag):