##// END OF EJS Templates
revlog-compression: update the config to be a list...
marmoute -
r44866:f0027a3d default
parent child Browse files
Show More
@@ -759,7 +759,7 b' coreconfigitem('
759 coreconfigitem(
759 coreconfigitem(
760 b'format',
760 b'format',
761 b'revlog-compression',
761 b'revlog-compression',
762 default=b'zlib',
762 default=lambda: [b'zlib'],
763 alias=[(b'experimental', b'format.compression')],
763 alias=[(b'experimental', b'format.compression')],
764 )
764 )
765 coreconfigitem(
765 coreconfigitem(
@@ -888,7 +888,8 b' https://www.mercurial-scm.org/wiki/Missi'
888 Compression algorithm used by revlog. Supported values are `zlib` and
888 Compression algorithm used by revlog. Supported values are `zlib` and
889 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
889 `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is
890 a newer format that is usually a net win over `zlib`, operating faster at
890 a newer format that is usually a net win over `zlib`, operating faster at
891 better compression rates. Use `zstd` to reduce CPU usage.
891 better compression rates. Use `zstd` to reduce CPU usage. Multiple values
892 can be specified, the first available one will be used.
892
893
893 On some systems, the Mercurial installation may lack `zstd` support.
894 On some systems, the Mercurial installation may lack `zstd` support.
894
895
@@ -3578,14 +3578,17 b' def newreporequirements(ui, createopts):'
3578 if ui.configbool(b'format', b'dotencode'):
3578 if ui.configbool(b'format', b'dotencode'):
3579 requirements.add(b'dotencode')
3579 requirements.add(b'dotencode')
3580
3580
3581 compengine = ui.config(b'format', b'revlog-compression')
3581 compengines = ui.configlist(b'format', b'revlog-compression')
3582 if compengine not in util.compengines:
3582 for compengine in compengines:
3583 if compengine in util.compengines:
3584 break
3585 else:
3583 raise error.Abort(
3586 raise error.Abort(
3584 _(
3587 _(
3585 b'compression engine %s defined by '
3588 b'compression engines %s defined by '
3586 b'format.revlog-compression not available'
3589 b'format.revlog-compression not available'
3587 )
3590 )
3588 % compengine,
3591 % b', '.join(b'"%s"' % e for e in compengines),
3589 hint=_(
3592 hint=_(
3590 b'run "hg debuginstall" to list available '
3593 b'run "hg debuginstall" to list available '
3591 b'compression engines'
3594 b'compression engines'
@@ -3593,7 +3596,7 b' def newreporequirements(ui, createopts):'
3593 )
3596 )
3594
3597
3595 # zlib is the historical default and doesn't need an explicit requirement.
3598 # zlib is the historical default and doesn't need an explicit requirement.
3596 elif compengine == b'zstd':
3599 if compengine == b'zstd':
3597 requirements.add(b'revlog-compression-zstd')
3600 requirements.add(b'revlog-compression-zstd')
3598 elif compengine != b'zlib':
3601 elif compengine != b'zlib':
3599 requirements.add(b'exp-compression-%s' % compengine)
3602 requirements.add(b'exp-compression-%s' % compengine)
@@ -449,7 +449,14 b' class compressionengine(formatvariant):'
449
449
450 @classmethod
450 @classmethod
451 def fromconfig(cls, repo):
451 def fromconfig(cls, repo):
452 return repo.ui.config(b'format', b'revlog-compression')
452 compengines = repo.ui.configlist(b'format', b'revlog-compression')
453 # return the first valid value as the selection code would do
454 for comp in compengines:
455 if comp in util.compengines:
456 return comp
457
458 # no valide compression found lets display it all for clarity
459 return b','.join(compengines)
453
460
454
461
455 @registerformatvariant
462 @registerformatvariant
@@ -22,10 +22,15 b' A new repository uses zlib storage, whic'
22 Unknown compression engine to format.compression aborts
22 Unknown compression engine to format.compression aborts
23
23
24 $ hg --config format.revlog-compression=unknown init unknown
24 $ hg --config format.revlog-compression=unknown init unknown
25 abort: compression engine unknown defined by format.revlog-compression not available
25 abort: compression engines "unknown" defined by format.revlog-compression not available
26 (run "hg debuginstall" to list available compression engines)
26 (run "hg debuginstall" to list available compression engines)
27 [255]
27 [255]
28
28
29 unknown compression engine in a list with known one works fine
30
31 $ hg --config format.revlog-compression=zlib,unknown init zlib-before-unknow
32 $ hg --config format.revlog-compression=unknown,zlib init unknown-before-zlib
33
29 A requirement specifying an unknown compression engine results in bail
34 A requirement specifying an unknown compression engine results in bail
30
35
31 $ hg init unknownrequirement
36 $ hg init unknownrequirement
General Comments 0
You need to be logged in to leave comments. Login now