D8415: nodemap: add a new mode value, "strict"

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Apr 14 15:49:02 UTC 2020


marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlogutils/nodemap.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
@@ -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
diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -148,6 +148,8 @@
         msg = _("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



To: marmoute, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list