Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 50804:7f8f6fe13fa9
configitems: move blackbox's config items to the new configitems.toml
In order for the Rust code to gain access to default values of in-core
extensions that have a Rust implementation, we need to centralize them
alongside the core items declarations.
This is the first and so far only one of the extensions that have gained
Rust support, I don't think it's worth the churn to move the rest of the
extension's configitems yet.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Wed, 05 Jul 2023 23:59:22 +0200 |
parents | 7f0f3b274d1e |
children | 29ce50726ce0 |
comparison
equal
deleted
inserted
replaced
50803:8ff187fbbfea | 50804:7f8f6fe13fa9 |
---|---|
45 color, | 45 color, |
46 config, | 46 config, |
47 configitems, | 47 configitems, |
48 encoding, | 48 encoding, |
49 error, | 49 error, |
50 extensions, | |
50 formatter, | 51 formatter, |
51 loggingutil, | 52 loggingutil, |
52 progress, | 53 progress, |
53 pycompat, | 54 pycompat, |
54 rcutil, | 55 rcutil, |
656 | 657 |
657 def _config(self, section, name, default=_unset, untrusted=False): | 658 def _config(self, section, name, default=_unset, untrusted=False): |
658 value = itemdefault = default | 659 value = itemdefault = default |
659 item = self._knownconfig.get(section, {}).get(name) | 660 item = self._knownconfig.get(section, {}).get(name) |
660 alternates = [(section, name)] | 661 alternates = [(section, name)] |
662 | |
663 if item is not None and item.in_core_extension is not None: | |
664 # Only return the default for an in-core extension item if said | |
665 # extension is enabled | |
666 if item.in_core_extension in extensions.extensions(self): | |
667 item = None | |
661 | 668 |
662 if item is not None: | 669 if item is not None: |
663 alternates.extend(item.alias) | 670 alternates.extend(item.alias) |
664 if callable(item.default): | 671 if callable(item.default): |
665 itemdefault = item.default() | 672 itemdefault = item.default() |