643 # Add derived requirements from registered compression engines. |
643 # Add derived requirements from registered compression engines. |
644 for name in util.compengines: |
644 for name in util.compengines: |
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 |
651 def ensurerequirementsrecognized(requirements, supported): |
653 def ensurerequirementsrecognized(requirements, supported): |
652 """Validate that a set of local requirements is recognized. |
654 """Validate that a set of local requirements is recognized. |
792 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen) |
794 maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen) |
793 if maxchainlen is not None: |
795 if maxchainlen is not None: |
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: |
802 if not (0 <= options[b'zlib.level'] <= 9): |
809 if not (0 <= options[b'zlib.level'] <= 9): |
803 msg = _('invalid value for `storage.revlog.zlib.level` config: %d') |
810 msg = _('invalid value for `storage.revlog.zlib.level` config: %d') |
2941 compengine, |
2948 compengine, |
2942 hint=_('run "hg debuginstall" to list available ' |
2949 hint=_('run "hg debuginstall" to list available ' |
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): |
2950 requirements.add('generaldelta') |
2959 requirements.add('generaldelta') |
2951 if ui.configbool('format', 'sparse-revlog'): |
2960 if ui.configbool('format', 'sparse-revlog'): |