# HG changeset patch # User Gregory Szorc # Date 1547079480 28800 # Node ID e3cfe0702eac7264ee136770fadeb4c91f6d0734 # Parent d0de4fdd87aad15e958b3b8f29f47fed3c6fa331 revlog: inline opener options logic into _loadindex() We always call _loadindex() during __init__. But we also call _loadindex() as part of censorrevision(). Before, when reloading the index during censorrevision(), we would lose the configured mmapindexthreshold setting from the opener. By inlining the logic in _loadindex(), we ensure that opener options are always respected when loading the index. Differential Revision: https://phab.mercurial-scm.org/D5563 diff -r d0de4fdd87aa -r e3cfe0702eac mercurial/revlog.py --- a/mercurial/revlog.py Wed Jan 09 16:14:09 2019 -0800 +++ b/mercurial/revlog.py Wed Jan 09 16:18:00 2019 -0800 @@ -384,8 +384,11 @@ # 2-tuple of file handles being used for active writing. self._writinghandles = None + self._loadindex() + + def _loadindex(self): mmapindexthreshold = None - opts = getattr(opener, 'options', {}) or {} + opts = getattr(self.opener, 'options', {}) or {} if 'revlogv2' in opts: versionflags = REVLOGV2 | FLAG_INLINE_DATA @@ -431,9 +434,6 @@ raise error.RevlogError(_('revlog chunk cache size %r is not a ' 'power of 2') % self._chunkcachesize) - self._loadindex(versionflags, mmapindexthreshold) - - def _loadindex(self, versionflags, mmapindexthreshold): indexdata = '' self._initempty = True try: @@ -2499,7 +2499,7 @@ self.opener.rename(newrl.datafile, self.datafile) self.clearcaches() - self._loadindex(self.version, None) + self._loadindex() def verifyintegrity(self, state): """Verifies the integrity of the revlog.