# HG changeset patch # User Matt Mackall # Date 2011-08-11 19:34:03 # Node ID cc669e4fec958524e3a1acc2e8d8025f6d8ebb26 # Parent 72f312f41a4a71ecc373e0fdb653b634f2e9bc00 ui: allow alternatives for config options diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -155,7 +155,19 @@ class ui(object): 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: