Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 53023:b12a4b9d09ce
branching: correct merge of stable into default
For unclear reason, b7afc38468bd dropped all the change to
"contrib/heptapod-ci.yml". This is the same merge as b7afc38468bd, but merging
heptapod-ci.yml change from stable too.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 28 Feb 2025 23:18:22 +0100 |
parents | b3e68fd7864b 1fef0d25dcde |
children | e52dc683bf6b |
line wrap: on
line diff
--- a/mercurial/scmutil.py Mon Dec 09 06:23:34 2024 +0100 +++ b/mercurial/scmutil.py Fri Feb 28 23:18:22 2025 +0100 @@ -2498,10 +2498,8 @@ RESOURCE_HIGH: int = 3 RESOURCE_MEDIUM: int = 2 RESOURCE_LOW: int = 1 -RESOURCE_DEFAULT: int = 0 RESOURCE_MAPPING: Dict[bytes, int] = { - b'default': RESOURCE_DEFAULT, b'low': RESOURCE_LOW, b'medium': RESOURCE_MEDIUM, b'high': RESOURCE_HIGH, @@ -2516,13 +2514,16 @@ """return the resource profile for a dimension If no dimension is specified, the generic value is returned""" - generic_name = ui.config(b'usage', b'resources') - value = RESOURCE_MAPPING.get(generic_name, RESOURCE_DEFAULT) - if value == RESOURCE_DEFAULT: - value = DEFAULT_RESOURCE + + def config(section, name): + value_name = ui.config(section, name, default=b'default') + return RESOURCE_MAPPING.get(value_name) + if dimension is not None: - sub_name = ui.config(b'usage', b'resources.%s' % dimension) - sub_value = RESOURCE_MAPPING.get(sub_name, RESOURCE_DEFAULT) - if sub_value != RESOURCE_DEFAULT: - value = sub_value - return value + value = config(b'usage', b'resources.%s' % dimension) + if value is not None: + return value + value = config(b'usage', b'resources') + if value is not None: + return value + return DEFAULT_RESOURCE