[Commented On] D9760: persistent-node: check the value of the slow-path config

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Fri Jan 15 12:01:52 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 24892.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9760?vs=24840&id=24892

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9760/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D9760

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-persistent-nodemap.t

CHANGE DETAILS

diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t
--- a/tests/test-persistent-nodemap.t
+++ b/tests/test-persistent-nodemap.t
@@ -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"
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1017,6 +1017,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



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210115/5e1b9d2d/attachment-0002.html>


More information about the Mercurial-patches mailing list