Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
44308:5962fd0d1045 | 44309:6c07480d6659 |
---|---|
18 | 18 |
19 | 19 |
20 class NodeMap(dict): | 20 class NodeMap(dict): |
21 def __missing__(self, x): | 21 def __missing__(self, x): |
22 raise error.RevlogError(b'unknown node: %s' % x) | 22 raise error.RevlogError(b'unknown node: %s' % x) |
23 | |
24 | |
25 def persisted_data(revlog): | |
26 """read the nodemap for a revlog from disk""" | |
27 if revlog.nodemap_file is None: | |
28 return None | |
29 return revlog.opener.tryread(revlog.nodemap_file) | |
23 | 30 |
24 | 31 |
25 def setup_persistent_nodemap(tr, revlog): | 32 def setup_persistent_nodemap(tr, revlog): |
26 """Install whatever is needed transaction side to persist a nodemap on disk | 33 """Install whatever is needed transaction side to persist a nodemap on disk |
27 | 34 |