comparison mercurial/revlog.py @ 38169:fc72beec2a1a

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.
author Paul Morelle <paul.morelle@octobus.net>
date Sat, 21 Apr 2018 17:27:57 +0200
parents faa015417348
children 7fa3408f83ef
comparison
equal deleted inserted replaced
38168:faa015417348 38169:fc72beec2a1a
875 base = self._chainbasecache.get(rev) 875 base = self._chainbasecache.get(rev)
876 if base is not None: 876 if base is not None:
877 return base 877 return base
878 878
879 index = self.index 879 index = self.index
880 base = index[rev][3] 880 iterrev = rev
881 while base != rev: 881 base = index[iterrev][3]
882 rev = base 882 while base != iterrev:
883 base = index[rev][3] 883 iterrev = base
884 base = index[iterrev][3]
884 885
885 self._chainbasecache[rev] = base 886 self._chainbasecache[rev] = base
886 return base 887 return base
887 888
888 def linkrev(self, rev): 889 def linkrev(self, rev):