D4241: pure: don't allow index[len(index)] to mean nullid

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Aug 10 03:50:06 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This should have been part of https://phab.mercurial-scm.org/rHGa3dacabd476b6bed04932b08962d7aa2fd2fad41 (index: don't allow
  index[len(index)] to mean nullid, 2018-07-20). Thanks to Augie for
  making me run the pure version of test-parseindex2.py. Interestingly,
  I think I ran that test on the parent commit (and that's why I updated
  the pure version in that commit), but then I seem to quickly have
  forgotten about the pure code :(

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -52,7 +52,7 @@
         return i
 
     def __getitem__(self, i):
-        if i == -1 or i == len(self):
+        if i == -1:
             return (0, 0, 0, -1, -1, -1, -1, nullid)
         i = self._fix_index(i)
         if i >= self._lgt:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list