mercurial/ui.py
changeset 46623 b91a695b3b08
parent 46622 a3dced4b7b04
child 46720 66fb04552122
--- a/mercurial/ui.py	Fri Jan 29 11:21:49 2021 +0100
+++ b/mercurial/ui.py	Fri Jan 29 12:17:11 2021 +0100
@@ -662,11 +662,18 @@
             msg %= (section, name, pycompat.bytestr(default))
             self.develwarn(msg, 2, b'warn-config-default')
 
+        candidates = []
+        config = self._data(untrusted)
         for s, n in alternates:
-            candidate = self._data(untrusted).get(s, n, None)
+            candidate = config.get(s, n, None)
             if candidate is not None:
-                value = candidate
-                break
+                candidates.append((s, n, candidate))
+        if candidates:
+
+            def level(x):
+                return config.level(x[0], x[1])
+
+            value = max(candidates, key=level)[2]
 
         if self.debugflag and not untrusted and self._reportuntrusted:
             for s, n in alternates: