##// END OF EJS Templates
ui: allow alternatives for config options
Matt Mackall -
r15035:cc669e4f default
parent child Browse files
Show More
@@ -155,7 +155,19 b' class ui(object):'
155 return self._data(untrusted).source(section, name) or 'none'
155 return self._data(untrusted).source(section, name) or 'none'
156
156
157 def config(self, section, name, default=None, untrusted=False):
157 def config(self, section, name, default=None, untrusted=False):
158 value = self._data(untrusted).get(section, name, default)
158 if isinstance(name, list):
159 alternates = name
160 else:
161 alternates = [name]
162
163 for n in alternates:
164 value = self._data(untrusted).get(section, name, None)
165 if value is not None:
166 name = n
167 break
168 else:
169 value = default
170
159 if self.debugflag and not untrusted and self._reportuntrusted:
171 if self.debugflag and not untrusted and self._reportuntrusted:
160 uvalue = self._ucfg.get(section, name)
172 uvalue = self._ucfg.get(section, name)
161 if uvalue is not None and uvalue != value:
173 if uvalue is not None and uvalue != value:
General Comments 0
You need to be logged in to leave comments. Login now