D4868: revlog: move loading of index data into own method
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Wed Oct 3 18:13:47 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This will allow us to "reload" a revlog instance from a rewritten
index file, which will be used in a subsequent commit.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4868
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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()
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list