Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.py @ 52695:b7afc38468bd
branching: merge stable into default
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Thu, 16 Jan 2025 17:18:16 +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 Thu Jan 16 17:18:16 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