comparison mercurial/localrepo.py @ 46311:014ac7a32048

persistent-nodemap: add a "abort" option to the slow-path config We make it the default, and document the behavior in the help for the main config option. Differential Revision: https://phab.mercurial-scm.org/D9762
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 13 Jan 2021 23:41:37 +0100
parents fc2d5c0aed7f
children 28899b6f4480
comparison
equal deleted inserted replaced
46310:fc2d5c0aed7f 46311:014ac7a32048
1046 options[b'rust.index'] = True 1046 options[b'rust.index'] = True
1047 if requirementsmod.NODEMAP_REQUIREMENT in requirements: 1047 if requirementsmod.NODEMAP_REQUIREMENT in requirements:
1048 slow_path = ui.config( 1048 slow_path = ui.config(
1049 b'storage', b'revlog.persistent-nodemap.slow-path' 1049 b'storage', b'revlog.persistent-nodemap.slow-path'
1050 ) 1050 )
1051 if slow_path not in (b'allow', b'warn'): 1051 if slow_path not in (b'allow', b'warn', b'abort'):
1052 default = ui.config_default( 1052 default = ui.config_default(
1053 b'storage', b'revlog.persistent-nodemap.slow-path' 1053 b'storage', b'revlog.persistent-nodemap.slow-path'
1054 ) 1054 )
1055 msg = _( 1055 msg = _(
1056 b'unknown value for config ' 1056 b'unknown value for config '
1067 ) 1067 )
1068 hint = _( 1068 hint = _(
1069 b"check `hg help config.format.use-persistent-nodemap` " 1069 b"check `hg help config.format.use-persistent-nodemap` "
1070 b"for details" 1070 b"for details"
1071 ) 1071 )
1072 if slow_path == b'warn' and not revlog.HAS_FAST_PERSISTENT_NODEMAP: 1072 if not revlog.HAS_FAST_PERSISTENT_NODEMAP:
1073 msg = b"warning: " + msg + b'\n' 1073 if slow_path == b'warn':
1074 ui.warn(msg) 1074 msg = b"warning: " + msg + b'\n'
1075 if not ui.quiet: 1075 ui.warn(msg)
1076 hint = b'(' + hint + b')\n' 1076 if not ui.quiet:
1077 ui.warn(hint) 1077 hint = b'(' + hint + b')\n'
1078 ui.warn(hint)
1079 if slow_path == b'abort':
1080 raise error.Abort(msg, hint=hint)
1078 options[b'persistent-nodemap'] = True 1081 options[b'persistent-nodemap'] = True
1079 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'): 1082 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1080 options[b'persistent-nodemap.mmap'] = True 1083 options[b'persistent-nodemap.mmap'] = True
1081 epnm = ui.config(b'storage', b'revlog.nodemap.mode') 1084 epnm = ui.config(b'storage', b'revlog.nodemap.mode')
1082 options[b'persistent-nodemap.mode'] = epnm 1085 options[b'persistent-nodemap.mode'] = epnm