Mercurial > hg-stable
changeset 50798:f0ae403bf704
configitems: use standard "dynamicdefault" approach in edge case
This makes for fewer edge cases, which will help a future patch.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 23 Jan 2023 17:21:14 +0100 |
parents | 5d092194ac37 |
children | b584dae08774 |
files | mercurial/configitems.py mercurial/localrepo.py |
diffstat | 2 files changed, 7 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/configitems.py Tue Jan 17 14:53:18 2023 +0100 +++ b/mercurial/configitems.py Mon Jan 23 17:21:14 2023 +0100 @@ -1473,22 +1473,10 @@ 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=_persistent_nodemap_default, + default=dynamicdefault, ) coreconfigitem( b'format',
--- a/mercurial/localrepo.py Tue Jan 17 14:53:18 2023 +0100 +++ b/mercurial/localrepo.py Mon Jan 23 17:21:14 2023 +0100 @@ -58,6 +58,7 @@ obsolete, pathutil, phases, + policy, pushkey, pycompat, rcutil, @@ -3763,7 +3764,11 @@ if ui.configbool(b'format', b'bookmarks-in-store'): requirements.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT) - if ui.configbool(b'format', b'use-persistent-nodemap'): + # The feature is disabled unless a fast implementation is available. + persistent_nodemap_default = policy.importrust('revlog') is not None + if ui.configbool( + b'format', b'use-persistent-nodemap', persistent_nodemap_default + ): requirements.add(requirementsmod.NODEMAP_REQUIREMENT) # if share-safe is enabled, let's create the new repository with the new