ui: allow alternatives for config options
authorMatt Mackall <mpm@selenic.com>
Thu, 11 Aug 2011 14:34:03 -0500
changeset 15035 cc669e4fec95
parent 15034 72f312f41a4a
child 15036 bb96e12a3242
ui: allow alternatives for config options
mercurial/ui.py
--- a/mercurial/ui.py	Wed Aug 10 13:52:52 2011 -0500
+++ b/mercurial/ui.py	Thu Aug 11 14:34:03 2011 -0500
@@ -155,7 +155,19 @@
         return self._data(untrusted).source(section, name) or 'none'
 
     def config(self, section, name, default=None, untrusted=False):
-        value = self._data(untrusted).get(section, name, default)
+        if isinstance(name, list):
+            alternates = name
+        else:
+            alternates = [name]
+
+        for n in alternates:
+            value = self._data(untrusted).get(section, name, None)
+            if value is not None:
+                name = n
+                break
+        else:
+            value = default
+
         if self.debugflag and not untrusted and self._reportuntrusted:
             uvalue = self._ucfg.get(section, name)
             if uvalue is not None and uvalue != value: