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', 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/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