changeset 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 53581e220ba3
files mercurial/pure/parsers.py mercurial/revlog.py
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Sat Nov 02 15:46:47 2019 +0100
+++ b/mercurial/pure/parsers.py	Sun Nov 03 00:15:12 2019 +0100
@@ -62,6 +62,8 @@
         return self._lgt + len(self._extra)
 
     def append(self, tup):
+        if 'nodemap' in vars(self):
+            self.nodemap[tup[7]] = len(self)
         self._extra.append(tup)
 
     def _check_index(self, i):
--- a/mercurial/revlog.py	Sat Nov 02 15:46:47 2019 +0100
+++ b/mercurial/revlog.py	Sun Nov 03 00:15:12 2019 +0100
@@ -213,6 +213,10 @@
             nodemap[n] = r
         return nodemap
 
+    def append(self, tup):
+        self.nodemap[tup[7]] = len(self)
+        super(revlogoldindex, self).append(tup)
+
     def clearcaches(self):
         self.__dict__.pop('nodemap', None)
 
@@ -2189,7 +2193,6 @@
             node,
         )
         self.index.append(e)
-        self.nodemap[node] = curr
 
         # Reset the pure node cache start lookup offset to account for new
         # revision.