[PATCH 2 of 9 py3] phases: explicitly evaluate list returned by map
Augie Fackler
raf at durin42.com
Sun Mar 12 13:22:11 EDT 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489283600 18000
# Sat Mar 11 20:53:20 2017 -0500
# Node ID 3366d024d1d7284d49609f6ce4e3e8a329fc8808
# Parent 66618e51771e519582cbe0fe7cd5e116d9cd87ad
phases: explicitly evaluate list returned by map
On Python 3 map() returns a generator, which bool()s to true even if
it had an empty input set. Work around this by using list() on the
map() result.
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -213,7 +213,7 @@ class phasecache(object):
self._phaserevs = revs
self._populatephaseroots(repo)
for phase in trackedphases:
- roots = map(repo.changelog.rev, self.phaseroots[phase])
+ roots = list(map(repo.changelog.rev, self.phaseroots[phase]))
if roots:
for rev in roots:
revs[rev] = phase
More information about the Mercurial-devel
mailing list