revlog: make chainbase cache its result for the correct revision
authorPaul Morelle <paul.morelle@octobus.net>
Sat, 21 Apr 2018 17:27:57 +0200
changeset 38169 fc72beec2a1a
parent 38168 faa015417348
child 38170 dfb888aae17a
revlog: make chainbase cache its result for the correct revision Previously, as 'rev' was our iterator, we were always caching the chain base for the second revision of the chain, or for the base itself.
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Mar 07 11:10:22 2018 +0100
+++ b/mercurial/revlog.py	Sat Apr 21 17:27:57 2018 +0200
@@ -877,10 +877,11 @@
             return base
 
         index = self.index
-        base = index[rev][3]
-        while base != rev:
-            rev = base
-            base = index[rev][3]
+        iterrev = rev
+        base = index[iterrev][3]
+        while base != iterrev:
+            iterrev = base
+            base = index[iterrev][3]
 
         self._chainbasecache[rev] = base
         return base