mercurial/pure/parsers.py
changeset 38851 781b2720d2ac
parent 38850 6104b203bec8
child 39047 a1f934573c0b
--- a/mercurial/pure/parsers.py	Wed Aug 01 10:57:14 2018 -0700
+++ b/mercurial/pure/parsers.py	Fri Jul 20 08:10:32 2018 -0700
@@ -39,7 +39,7 @@
 
 class BaseIndexObject(object):
     def __len__(self):
-        return self._lgt + len(self._extra) + 1
+        return self._lgt + len(self._extra)
 
     def append(self, tup):
         self._extra.append(tup)
@@ -47,12 +47,12 @@
     def _fix_index(self, i):
         if not isinstance(i, int):
             raise TypeError("expecting int indexes")
-        if i < 0 or i >= len(self):
+        if i < 0 or i >= len(self) + 1:
             raise IndexError
         return i
 
     def __getitem__(self, i):
-        if i == -1 or i == len(self) - 1:
+        if i == -1 or i == len(self):
             return (0, 0, 0, -1, -1, -1, -1, nullid)
         i = self._fix_index(i)
         if i >= self._lgt: