Patchwork D3188: revlog: reset _nodepos after strip

login
register
mail settings
Submitter phabricator
Date April 7, 2018, 11:10 p.m.
Message ID <differential-rev-PHID-DREV-5hpfjhvcly6wxebfqba6-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30549/
State Superseded
Headers show

Comments

phabricator - April 7, 2018, 11:10 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: joerg.sonnenberger, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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