changeset 44789:6b01799e9db0

nodemap: add a new mode value, "strict" When "strict" is set, operation will refuse to use the slow path and abort if they would. This is useful for testing, benchmarking and server operation. Differential Revision: https://phab.mercurial-scm.org/D8415
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 14 Apr 2020 03:01:52 +0200
parents 6493f0a567c2
children 261e71752d1f
files mercurial/revlogutils/nodemap.py tests/test-persistent-nodemap.t
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py	Tue Apr 14 02:45:05 2020 +0200
+++ b/mercurial/revlogutils/nodemap.py	Tue Apr 14 03:01:52 2020 +0200
@@ -148,6 +148,8 @@
         msg = _(b"persistent nodemap in strict mode without efficient method")
         if mode == b'warn':
             tr._report(b"%s\n" % msg)
+        elif mode == b'strict':
+            raise error.Abort(msg)
 
     data = None
     # first attemp an incremental update of the data
--- a/tests/test-persistent-nodemap.t	Tue Apr 14 02:45:05 2020 +0200
+++ b/tests/test-persistent-nodemap.t	Tue Apr 14 03:01:52 2020 +0200
@@ -96,6 +96,17 @@
   5001 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo foo > foo
   $ hg add foo
+
+#if no-pure no-rust
+
+  $ hg ci -m 'foo' --config "experimental.exp-persistent-nodemap.mode=strict"
+  transaction abort!
+  rollback completed
+  abort: persistent nodemap in strict mode without efficient method
+  [255]
+
+#endif
+
   $ hg ci -m 'foo'
 
 #if no-pure no-rust