persistent-node: check the value of the slow-path config
We should probably provide some standard for this in config item, but this is a
quest for another adventure.
Differential Revision: https://phab.mercurial-scm.org/D9760
--- a/mercurial/localrepo.py Thu Jan 14 01:25:06 2021 +0100
+++ b/mercurial/localrepo.py Wed Jan 13 18:33:48 2021 +0100
@@ -1044,6 +1044,21 @@
if ui.configbool(b'experimental', b'rust.index'):
options[b'rust.index'] = True
if requirementsmod.NODEMAP_REQUIREMENT in requirements:
+ slow_path = ui.config(
+ b'storage', b'revlog.persistent-nodemap.slow-path'
+ )
+ if slow_path not in (b'allow'):
+ default = ui.config_default(
+ b'storage', b'revlog.persistent-nodemap.slow-path'
+ )
+ msg = _(
+ b'unknown value for config '
+ b'"storage.revlog.persistent-nodemap.slow-path": "%s"\n'
+ )
+ ui.warn(msg % slow_path)
+ if not ui.quiet:
+ ui.warn(_(b'falling back to default value: %s\n') % default)
+ slow_path = default
options[b'persistent-nodemap'] = True
if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
options[b'persistent-nodemap.mmap'] = True
--- a/tests/test-persistent-nodemap.t Thu Jan 14 01:25:06 2021 +0100
+++ b/tests/test-persistent-nodemap.t Wed Jan 13 18:33:48 2021 +0100
@@ -110,6 +110,15 @@
$ echo foo > foo
$ hg add foo
+
+Check slow-path config value handling
+-------------------------------------
+
+ $ hg id --config "storage.revlog.persistent-nodemap.slow-path=invalid-value"
+ unknown value for config "storage.revlog.persistent-nodemap.slow-path": "invalid-value"
+ falling back to default value: allow
+ 6b02b8c7b966+ tip
+
#if no-pure no-rust
$ hg ci -m 'foo' --config "storage.revlog.nodemap.mode=strict"