nodemap: refresh the persistent data on nodemap creation
The logic to read the data and validate the docket are still in python, so we
need to "help" whatever compiled code live in the index to refresh it.
Otherwise clearing the cache could lead to an expensive full recomputation and
disk update even when the persisted data are still valid.
Differential Revision: https://phab.mercurial-scm.org/D8174
--- a/mercurial/revlog.py Wed Mar 11 05:41:02 2020 +0100
+++ b/mercurial/revlog.py Tue Feb 18 19:11:14 2020 +0100
@@ -760,7 +760,20 @@
self._chainbasecache.clear()
self._chunkcache = (0, b'')
self._pcache = {}
+ self._nodemap_docket = None
self.index.clearcaches()
+ # The python code is the one responsible for validating the docket, we
+ # end up having to refresh it here.
+ use_nodemap = (
+ not self._inline
+ and self.nodemap_file is not None
+ and util.safehasattr(self.index, 'update_nodemap_data')
+ )
+ if use_nodemap:
+ nodemap_data = nodemaputil.persisted_data(self)
+ if nodemap_data is not None:
+ self._nodemap_docket = nodemap_data[0]
+ self.index.update_nodemap_data(*nodemap_data)
def rev(self, node):
try: