comparison mercurial/revlog.py @ 43531:dcf9826c8d8c

revlog: move nodemap update within the index code Since the nodemap data now live in the index, it should be the index responsibility to ensure the data are up to date. This work is part of a refactoring to unify the revlog index and the nodemap. This unification prepare the use of a persistent nodemap. Differential Revision: https://phab.mercurial-scm.org/D7319
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 03 Nov 2019 00:15:12 +0100
parents 6e3e3e5446ba
children 642433629e20
comparison
equal deleted inserted replaced
43530:6e3e3e5446ba 43531:dcf9826c8d8c
210 nodemap = revlogutils.NodeMap({nullid: nullrev}) 210 nodemap = revlogutils.NodeMap({nullid: nullrev})
211 for r in range(0, len(self)): 211 for r in range(0, len(self)):
212 n = self[r][7] 212 n = self[r][7]
213 nodemap[n] = r 213 nodemap[n] = r
214 return nodemap 214 return nodemap
215
216 def append(self, tup):
217 self.nodemap[tup[7]] = len(self)
218 super(revlogoldindex, self).append(tup)
215 219
216 def clearcaches(self): 220 def clearcaches(self):
217 self.__dict__.pop('nodemap', None) 221 self.__dict__.pop('nodemap', None)
218 222
219 def __getitem__(self, i): 223 def __getitem__(self, i):
2187 p1r, 2191 p1r,
2188 p2r, 2192 p2r,
2189 node, 2193 node,
2190 ) 2194 )
2191 self.index.append(e) 2195 self.index.append(e)
2192 self.nodemap[node] = curr
2193 2196
2194 # Reset the pure node cache start lookup offset to account for new 2197 # Reset the pure node cache start lookup offset to account for new
2195 # revision. 2198 # revision.
2196 if self._nodepos is not None: 2199 if self._nodepos is not None:
2197 self._nodepos = curr 2200 self._nodepos = curr