marmoute created this revision. Herald added a reviewer: indygreg. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY This logic is non-trivial and we will need to reuse it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10651 AFFECTED FILES mercurial/configitems.py mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -687,6 +687,20 @@ # revlog.target instead of using `self.radix` return self.radix + def _get_decompressor(self, t): + try: + compressor = self._decompressors[t] + except KeyError: + try: + engine = util.compengines.forrevlogheader(t) + compressor = engine.revlogcompressor(self._compengineopts) + self._decompressors[t] = compressor + except KeyError: + raise error.RevlogError( + _(b'unknown compression type %s') % binascii.hexlify(t) + ) + return compressor + @util.propertycache def _compressor(self): engine = util.compengines[self._compengine] @@ -2373,17 +2387,7 @@ elif t == b'u': return util.buffer(data, 1) - try: - compressor = self._decompressors[t] - except KeyError: - try: - engine = util.compengines.forrevlogheader(t) - compressor = engine.revlogcompressor(self._compengineopts) - self._decompressors[t] = compressor - except KeyError: - raise error.RevlogError( - _(b'unknown compression type %s') % binascii.hexlify(t) - ) + compressor = self._get_decompressor(t) return compressor.decompress(data) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1158,7 +1158,8 @@ # * sidedata compression # * introduce a proper solution to reduce the number of filelog related files. # * Improvement to consider -# - track compression mode in the index entris instead of the chunks +# - avoid compression header in chunk using the default compression? +# - forbid "inline" compression mode entirely? # - split the data offset and flag field (the 2 bytes save are mostly trouble) # - keep track of uncompressed -chunk- size (to preallocate memory better) # - keep track of chain base or size (probably not that useful anymore) To: marmoute, indygreg, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel