##// END OF EJS Templates
compression: introduce an official `zstd-revlog` requirement...
marmoute -
r42305:10a6725d default
parent child Browse files
Show More
@@ -645,6 +645,8 b' def gathersupportedrequirements(ui):'
645 645 engine = util.compengines[name]
646 646 if engine.available() and engine.revlogheader():
647 647 supported.add(b'exp-compression-%s' % name)
648 if engine.name() == 'zstd':
649 supported.add(b'revlog-compression-zstd')
648 650
649 651 return supported
650 652
@@ -794,8 +796,13 b' def resolverevlogstorevfsoptions(ui, req'
794 796 options[b'maxchainlen'] = maxchainlen
795 797
796 798 for r in requirements:
797 if r.startswith(b'exp-compression-'):
798 options[b'compengine'] = r[len(b'exp-compression-'):]
799 # we allow multiple compression engine requirement to co-exist because
800 # strickly speaking, revlog seems to support mixed compression style.
801 #
802 # The compression used for new entries will be "the last one"
803 prefix = r.startswith
804 if prefix('revlog-compression-') or prefix('exp-compression-'):
805 options[b'compengine'] = r.split('-', 2)[2]
799 806
800 807 options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level')
801 808 if options[b'zlib.level'] is not None:
@@ -2943,7 +2950,9 b' def newreporequirements(ui, createopts):'
2943 2950 'compression engines'))
2944 2951
2945 2952 # zlib is the historical default and doesn't need an explicit requirement.
2946 if compengine != 'zlib':
2953 elif compengine == 'zstd':
2954 requirements.add('revlog-compression-zstd')
2955 elif compengine != 'zlib':
2947 2956 requirements.add('exp-compression-%s' % compengine)
2948 2957
2949 2958 if scmutil.gdinitconfig(ui):
@@ -325,10 +325,16 b' class compressionengine(formatvariant):'
325 325
326 326 @classmethod
327 327 def fromrepo(cls, repo):
328 # we allow multiple compression engine requirement to co-exist because
329 # strickly speaking, revlog seems to support mixed compression style.
330 #
331 # The compression used for new entries will be "the last one"
332 compression = 'zlib'
328 333 for req in repo.requirements:
329 if req.startswith('exp-compression-'):
330 return req.split('-', 2)[2]
331 return 'zlib'
334 prefix = req.startswith
335 if prefix('revlog-compression-') or prefix('exp-compression-'):
336 compression = req.split('-', 2)[2]
337 return compression
332 338
333 339 @classmethod
334 340 def fromconfig(cls, repo):
@@ -44,9 +44,9 b' A requirement specifying an unknown comp'
44 44 $ cd zstd
45 45 $ cat .hg/requires
46 46 dotencode
47 exp-compression-zstd
48 47 fncache
49 48 generaldelta
49 revlog-compression-zstd
50 50 revlogv1
51 51 sparserevlog
52 52 store
General Comments 0
You need to be logged in to leave comments. Login now