diff mercurial/revlogutils/nodemap.py @ 44309:6c07480d6659

nodemap: add a function to read the data from disk This changeset is small and mostly an excuse to introduce an API function reading the data from disk. Differential Revision: https://phab.mercurial-scm.org/D7836
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Jan 2020 15:47:31 +0100
parents 5962fd0d1045
children daad3aace942
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py	Wed Jan 15 15:47:21 2020 +0100
+++ b/mercurial/revlogutils/nodemap.py	Wed Jan 15 15:47:31 2020 +0100
@@ -22,6 +22,13 @@
         raise error.RevlogError(b'unknown node: %s' % x)
 
 
+def persisted_data(revlog):
+    """read the nodemap for a revlog from disk"""
+    if revlog.nodemap_file is None:
+        return None
+    return revlog.opener.tryread(revlog.nodemap_file)
+
+
 def setup_persistent_nodemap(tr, revlog):
     """Install whatever is needed transaction side to persist a nodemap on disk