changeset 37494:1ce7a55b09d1

revlog: reset _nodepos after strip When using the pure revlog parser, _nodepos is used to keep track of the position during index scanning in the non-cached cache. If it is out of bounds, BaseIndexObject._fix_index will assert. Since strip can actually remove the position scanned last, make sure to reset it. Add an assertion in the place where the invariance is clearer. Differential Revision: https://phab.mercurial-scm.org/D3188
author Joerg Sonnenberger <joerg@bec.de>
date Sun, 08 Apr 2018 01:08:43 +0200
parents f1413e4a54a6
children b1fb341d8a61
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Apr 04 13:14:48 2018 +0800
+++ b/mercurial/revlog.py	Sun Apr 08 01:08:43 2018 +0200
@@ -818,6 +818,8 @@
             p = self._nodepos
             if p is None:
                 p = len(i) - 2
+            else:
+                assert p < len(i)
             for r in xrange(p, -1, -1):
                 v = i[r][7]
                 n[v] = r
@@ -2421,6 +2423,7 @@
             del self.nodemap[self.node(x)]
 
         del self.index[rev:-1]
+        self._nodepos = None
 
     def checksize(self):
         expected = 0