diff 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
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Jan 13 23:07:41 2021 +0100
+++ b/mercurial/localrepo.py	Wed Jan 13 23:41:37 2021 +0100
@@ -1048,7 +1048,7 @@
         slow_path = ui.config(
             b'storage', b'revlog.persistent-nodemap.slow-path'
         )
-        if slow_path not in (b'allow', b'warn'):
+        if slow_path not in (b'allow', b'warn', b'abort'):
             default = ui.config_default(
                 b'storage', b'revlog.persistent-nodemap.slow-path'
             )
@@ -1069,12 +1069,15 @@
             b"check `hg help config.format.use-persistent-nodemap` "
             b"for details"
         )
-        if slow_path == b'warn' and not revlog.HAS_FAST_PERSISTENT_NODEMAP:
-            msg = b"warning: " + msg + b'\n'
-            ui.warn(msg)
-            if not ui.quiet:
-                hint = b'(' + hint + b')\n'
-                ui.warn(hint)
+        if not revlog.HAS_FAST_PERSISTENT_NODEMAP:
+            if slow_path == b'warn':
+                msg = b"warning: " + msg + b'\n'
+                ui.warn(msg)
+                if not ui.quiet:
+                    hint = b'(' + hint + b')\n'
+                    ui.warn(hint)
+            if slow_path == b'abort':
+                raise error.Abort(msg, hint=hint)
         options[b'persistent-nodemap'] = True
     if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
         options[b'persistent-nodemap.mmap'] = True