comparison mercurial/revset.py @ 28893:ee11167fe1da

parser: extract helper that creates a dict of aliases This will be common between revset and templater. The local variable 'alias' is renamed to 'a' to avoid shadowing the global 'alias' class.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 29 Feb 2016 19:24:15 +0900
parents 0c135f37c6f8
children 0f59674dc9ff
comparison
equal deleted inserted replaced
28892:0c135f37c6f8 28893:ee11167fe1da
2318 result = tuple(_expandaliases(aliases, t, expanding, cache) 2318 result = tuple(_expandaliases(aliases, t, expanding, cache)
2319 for t in tree) 2319 for t in tree)
2320 return result 2320 return result
2321 2321
2322 def findaliases(ui, tree, showwarning=None): 2322 def findaliases(ui, tree, showwarning=None):
2323 aliases = {} 2323 aliases = _aliasrules.buildmap(ui.configitems('revsetalias'))
2324 for k, v in ui.configitems('revsetalias'):
2325 alias = _aliasrules.build(k, v)
2326 aliases[alias.name] = alias
2327 tree = _expandaliases(aliases, tree, [], {}) 2324 tree = _expandaliases(aliases, tree, [], {})
2328 if showwarning: 2325 if showwarning:
2329 # warn about problematic (but not referred) aliases 2326 # warn about problematic (but not referred) aliases
2330 for name, alias in sorted(aliases.iteritems()): 2327 for name, alias in sorted(aliases.iteritems()):
2331 if alias.error and not alias.warned: 2328 if alias.error and not alias.warned: