Mercurial > hg
changeset 15035:cc669e4fec95
ui: allow alternatives for config options
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 11 Aug 2011 14:34:03 -0500 |
parents | 72f312f41a4a |
children | bb96e12a3242 |
files | mercurial/ui.py |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: