revlog: move loading of index data into own method
This will allow us to "reload" a revlog instance from a rewritten
index file, which will be used in a subsequent commit.
Differential Revision: https://phab.mercurial-scm.org/D4868
--- a/mercurial/revlog.py Wed Oct 03 10:57:35 2018 -0700
+++ b/mercurial/revlog.py Tue Oct 02 17:28:54 2018 -0700
@@ -415,12 +415,15 @@
raise error.RevlogError(_('revlog chunk cache size %r is not a '
'power of 2') % self._chunkcachesize)
+ self._loadindex(v, mmapindexthreshold)
+
+ def _loadindex(self, v, mmapindexthreshold):
indexdata = ''
self._initempty = True
try:
with self._indexfp() as f:
if (mmapindexthreshold is not None and
- self.opener.fstat(f).st_size >= mmapindexthreshold):
+ self.opener.fstat(f).st_size >= mmapindexthreshold):
indexdata = util.buffer(util.mmapread(f))
else:
indexdata = f.read()