D9765: persistent-nodemap: enable the feature by default when using Rust
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu Jan 14 04:06:50 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
As discussed at the 5.6 sprint, we can make it enabled by default, but only for
Rust installation.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9765
AFFECTED FILES
mercurial/configitems.py
mercurial/helptext/config.txt
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
@@ -2,6 +2,9 @@
Test the persistent on-disk nodemap
===================================
+
+#if no-rust
+
$ cat << EOF >> $HGRCPATH
> [format]
> use-persistent-nodemap=yes
@@ -9,6 +12,8 @@
> persistent-nodemap=yes
> EOF
+#endif
+
$ hg init test-repo --config storage.revlog.persistent-nodemap.slow-path=allow
$ cd test-repo
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -912,7 +912,8 @@
Repository with this on-disk format require Mercurial version 5.4 or above.
- Disabled by default.
+ By default this format variant is disabled if fast implementation is not
+ available and enabled by default if the fast implementation is available.
``usestore``
Enable or disable the "store" repository format which improves
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1251,10 +1251,22 @@
b'usestore',
default=True,
)
+
+
+def _persistent_nodemap_default():
+ """compute `use-persistent-nodemap` default value
+
+ The feature is disabled unless a fast implementation is available.
+ """
+ from . import policy
+
+ return policy.importrust('revlog') is not None
+
+
coreconfigitem(
b'format',
b'use-persistent-nodemap',
- default=False,
+ default=_persistent_nodemap_default,
)
coreconfigitem(
b'format',
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list