##// 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 engine = util.compengines[name]
645 engine = util.compengines[name]
646 if engine.available() and engine.revlogheader():
646 if engine.available() and engine.revlogheader():
647 supported.add(b'exp-compression-%s' % name)
647 supported.add(b'exp-compression-%s' % name)
648 if engine.name() == 'zstd':
649 supported.add(b'revlog-compression-zstd')
648
650
649 return supported
651 return supported
650
652
@@ -794,8 +796,13 b' def resolverevlogstorevfsoptions(ui, req'
794 options[b'maxchainlen'] = maxchainlen
796 options[b'maxchainlen'] = maxchainlen
795
797
796 for r in requirements:
798 for r in requirements:
797 if r.startswith(b'exp-compression-'):
799 # we allow multiple compression engine requirement to co-exist because
798 options[b'compengine'] = r[len(b'exp-compression-'):]
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 options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level')
807 options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level')
801 if options[b'zlib.level'] is not None:
808 if options[b'zlib.level'] is not None:
@@ -2943,7 +2950,9 b' def newreporequirements(ui, createopts):'
2943 'compression engines'))
2950 'compression engines'))
2944
2951
2945 # zlib is the historical default and doesn't need an explicit requirement.
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 requirements.add('exp-compression-%s' % compengine)
2956 requirements.add('exp-compression-%s' % compengine)
2948
2957
2949 if scmutil.gdinitconfig(ui):
2958 if scmutil.gdinitconfig(ui):
@@ -325,10 +325,16 b' class compressionengine(formatvariant):'
325
325
326 @classmethod
326 @classmethod
327 def fromrepo(cls, repo):
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 for req in repo.requirements:
333 for req in repo.requirements:
329 if req.startswith('exp-compression-'):
334 prefix = req.startswith
330 return req.split('-', 2)[2]
335 if prefix('revlog-compression-') or prefix('exp-compression-'):
331 return 'zlib'
336 compression = req.split('-', 2)[2]
337 return compression
332
338
333 @classmethod
339 @classmethod
334 def fromconfig(cls, repo):
340 def fromconfig(cls, repo):
@@ -44,9 +44,9 b' A requirement specifying an unknown comp'
44 $ cd zstd
44 $ cd zstd
45 $ cat .hg/requires
45 $ cat .hg/requires
46 dotencode
46 dotencode
47 exp-compression-zstd
48 fncache
47 fncache
49 generaldelta
48 generaldelta
49 revlog-compression-zstd
50 revlogv1
50 revlogv1
51 sparserevlog
51 sparserevlog
52 store
52 store
General Comments 0
You need to be logged in to leave comments. Login now