diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2112,13 +2112,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog - data = nodemap.persisted_data(cl) - ui.write(data) + nm_data = nodemap.persisted_data(cl) + if nm_data is not None: + docket, data = nm_data + ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog - data = nodemap.persisted_data(cl) - return nodemap.check_data(ui, cl.index, data) + nm_data = nodemap.persisted_data(cl) + if nm_data is not None: + docket, data = nm_data + return nodemap.check_data(ui, cl.index, data) @command( diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None + self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: + nodemap_data = nodemaputil.persisted_data(self) + if nodemap_data is not None: + self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: - index.update_nodemap_data(nodemap_data) + index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) - return revlog.opener.tryread(filename) + return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) + revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one.