Mercurial > hg
comparison mercurial/formatter.py @ 36983:036e4483d3a1
templater: process mapping dict by resource callables
A resource item is a callable, so let's make it look up a resource object
by itself.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 11 Mar 2018 21:12:02 +0900 |
parents | 255f635c3204 |
children | 939e0983c1d9 |
comparison
equal
deleted
inserted
replaced
36982:255f635c3204 | 36983:036e4483d3a1 |
---|---|
506 'repo': repo, | 506 'repo': repo, |
507 'ui': ui, | 507 'ui': ui, |
508 } | 508 } |
509 | 509 |
510 def getsome(context, mapping, key): | 510 def getsome(context, mapping, key): |
511 v = mapping.get(key) | |
512 if v is not None: | |
513 return v | |
511 return resmap.get(key) | 514 return resmap.get(key) |
512 | 515 |
513 return { | 516 return { |
514 'cache': getsome, | 517 'cache': getsome, |
515 'ctx': getsome, | 518 'ctx': getsome, |