comparison mercurial/ui.py @ 30618:201b44c8875c

ui: do not translate empty configsource() to 'none' (API) It should be processed when displaying data, so we can get "source": "" in JSON output.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 23 Oct 2016 17:47:00 +0900
parents bcb858396233
children 344e68882cd3
comparison
equal deleted inserted replaced
30617:32a07b8a9f77 30618:201b44c8875c
247 if ':' in n: 247 if ':' in n:
248 continue 248 continue
249 if not p: 249 if not p:
250 continue 250 continue
251 if '%%' in p: 251 if '%%' in p:
252 s = self.configsource('paths', n) or 'none'
252 self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") 253 self.warn(_("(deprecated '%%' in path %s=%s from %s)\n")
253 % (n, p, self.configsource('paths', n))) 254 % (n, p, s))
254 p = p.replace('%%', '%') 255 p = p.replace('%%', '%')
255 p = util.expandpath(p) 256 p = util.expandpath(p)
256 if not util.hasscheme(p) and not os.path.isabs(p): 257 if not util.hasscheme(p) and not os.path.isabs(p):
257 p = os.path.normpath(os.path.join(root, p)) 258 p = os.path.normpath(os.path.join(root, p))
258 c.set("paths", n, p) 259 c.set("paths", n, p)
289 290
290 def _data(self, untrusted): 291 def _data(self, untrusted):
291 return untrusted and self._ucfg or self._tcfg 292 return untrusted and self._ucfg or self._tcfg
292 293
293 def configsource(self, section, name, untrusted=False): 294 def configsource(self, section, name, untrusted=False):
294 return self._data(untrusted).source(section, name) or 'none' 295 return self._data(untrusted).source(section, name)
295 296
296 def config(self, section, name, default=None, untrusted=False): 297 def config(self, section, name, default=None, untrusted=False):
297 if isinstance(name, list): 298 if isinstance(name, list):
298 alternates = name 299 alternates = name
299 else: 300 else: