diff 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
line wrap: on
line diff
--- a/mercurial/ui.py	Mon Feb 13 18:11:48 2023 +0100
+++ b/mercurial/ui.py	Wed Jul 05 23:59:22 2023 +0200
@@ -47,6 +47,7 @@
     configitems,
     encoding,
     error,
+    extensions,
     formatter,
     loggingutil,
     progress,
@@ -659,6 +660,12 @@
         item = self._knownconfig.get(section, {}).get(name)
         alternates = [(section, name)]
 
+        if item is not None and item.in_core_extension is not None:
+            # Only return the default for an in-core extension item if said
+            # extension is enabled
+            if item.in_core_extension in extensions.extensions(self):
+                item = None
+
         if item is not None:
             alternates.extend(item.alias)
             if callable(item.default):