Submitter | Pulkit Goyal |
---|---|
Date | March 16, 2017, 7:53 a.m. |
Message ID | <8d85d7ca9fd3eea90a2f.1489650805@pulkit-goyal> |
Download | mbox | patch |
Permalink | /patch/19383/ |
State | Accepted |
Headers | show |
Comments
On Thu, 16 Mar 2017 13:23:25 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pulkit@gmail.com> > # Date 1489639281 -19800 > # Thu Mar 16 10:11:21 2017 +0530 > # Node ID 8d85d7ca9fd3eea90a2f09c7d471fc3f3c78d430 > # Parent de18c43f8ce17d52542e6df233e809b6a6ee0a07 > context: explicitly evaluate list returned by map > > On python 3, map returns an iterator so we need to convert it to list before > finding the len or subscripting it. > > After this `hg status --all` works on Python 3. > > diff -r de18c43f8ce1 -r 8d85d7ca9fd3 mercurial/context.py > --- a/mercurial/context.py Thu Mar 16 10:10:00 2017 +0530 > +++ b/mercurial/context.py Thu Mar 16 10:11:21 2017 +0530 > @@ -622,7 +622,7 @@ > n2 = c2._node > if n2 is None: > n2 = c2._parents[0]._node > - cahs = self._repo.changelog.commonancestorsheads(self._node, n2) > + cahs = list(self._repo.changelog.commonancestorsheads(self._node, n2)) Perhaps we should make commonancestorsheads() return a list so we'll never have another iterator-vs-list bug.
Patch
diff -r de18c43f8ce1 -r 8d85d7ca9fd3 mercurial/context.py --- a/mercurial/context.py Thu Mar 16 10:10:00 2017 +0530 +++ b/mercurial/context.py Thu Mar 16 10:11:21 2017 +0530 @@ -622,7 +622,7 @@ n2 = c2._node if n2 is None: n2 = c2._parents[0]._node - cahs = self._repo.changelog.commonancestorsheads(self._node, n2) + cahs = list(self._repo.changelog.commonancestorsheads(self._node, n2)) if not cahs: anc = nullid elif len(cahs) == 1: diff -r de18c43f8ce1 -r 8d85d7ca9fd3 mercurial/util.py --- a/mercurial/util.py Thu Mar 16 10:10:00 2017 +0530 +++ b/mercurial/util.py Thu Mar 16 10:11:21 2017 +0530 @@ -2920,7 +2920,7 @@ del dirs[base] def __iter__(self): - return self._dirs.iterkeys() + return iter(self._dirs) def __contains__(self, d): return d in self._dirs