diff mercurial/configitems.py @ 46884:cc3ad5c3af3b

persistent-nodemap: enable the feature by default when using Rust As discussed at the 5.6 sprint, we can make it enabled by default, but only for Rust installation. Differential Revision: https://phab.mercurial-scm.org/D9765
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 14 Jan 2021 04:58:20 +0100
parents 84a93fa7ecfd
children 08e26ef4ad35
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Apr 09 03:36:24 2021 +0200
+++ b/mercurial/configitems.py	Thu Jan 14 04:58:20 2021 +0100
@@ -1325,10 +1325,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,
 )
 # TODO needs to grow a docket file to at least store the last offset of the data
 # file when rewriting sidedata.