##// END OF EJS Templates
revlog: add a `_get_decompressor` method...
marmoute -
r48028:eac3591a default
parent child Browse files
Show More
@@ -1163,7 +1163,8 coreconfigitem(
1163 1163 # * sidedata compression
1164 1164 # * introduce a proper solution to reduce the number of filelog related files.
1165 1165 # * Improvement to consider
1166 # - track compression mode in the index entris instead of the chunks
1166 # - avoid compression header in chunk using the default compression?
1167 # - forbid "inline" compression mode entirely?
1167 1168 # - split the data offset and flag field (the 2 bytes save are mostly trouble)
1168 1169 # - keep track of uncompressed -chunk- size (to preallocate memory better)
1169 1170 # - keep track of chain base or size (probably not that useful anymore)
@@ -689,6 +689,20 class revlog(object):
689 689 # revlog.target instead of using `self.radix`
690 690 return self.radix
691 691
692 def _get_decompressor(self, t):
693 try:
694 compressor = self._decompressors[t]
695 except KeyError:
696 try:
697 engine = util.compengines.forrevlogheader(t)
698 compressor = engine.revlogcompressor(self._compengineopts)
699 self._decompressors[t] = compressor
700 except KeyError:
701 raise error.RevlogError(
702 _(b'unknown compression type %s') % binascii.hexlify(t)
703 )
704 return compressor
705
692 706 @util.propertycache
693 707 def _compressor(self):
694 708 engine = util.compengines[self._compengine]
@@ -2375,17 +2389,7 class revlog(object):
2375 2389 elif t == b'u':
2376 2390 return util.buffer(data, 1)
2377 2391
2378 try:
2379 compressor = self._decompressors[t]
2380 except KeyError:
2381 try:
2382 engine = util.compengines.forrevlogheader(t)
2383 compressor = engine.revlogcompressor(self._compengineopts)
2384 self._decompressors[t] = compressor
2385 except KeyError:
2386 raise error.RevlogError(
2387 _(b'unknown compression type %s') % binascii.hexlify(t)
2388 )
2392 compressor = self._get_decompressor(t)
2389 2393
2390 2394 return compressor.decompress(data)
2391 2395
General Comments 0
You need to be logged in to leave comments. Login now