Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templater.py @ 28384:3356bf61fa25
formatter: make labels work with templated output
To describe the bug this fix is addressing, one can do
``$ hg status -T "{label('red', path)}\n" --color=debug``
and observe that the label is not applied before my fix and applied with it.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Tue, 08 Mar 2016 04:08:33 -0800 |
parents | af3bd9d1dbc1 |
children | d2e154dddb6e |
line wrap: on
line diff
--- a/mercurial/templater.py Tue Mar 08 14:32:03 2016 +0000 +++ b/mercurial/templater.py Tue Mar 08 04:08:33 2016 -0800 @@ -549,16 +549,15 @@ thing = evalstring(context, mapping, args[1]) - # apparently, repo could be a string that is the favicon? - repo = mapping.get('repo', '') - if isinstance(repo, str): + ui = mapping.get('ui', '') + if isinstance(ui, str): return thing # preserve unknown symbol as literal so effects like 'red', 'bold', # etc. don't need to be quoted label = evalstringliteral(context, mapping, args[0]) - return repo.ui.label(thing, label) + return ui.label(thing, label) def latesttag(context, mapping, args): """:latesttag([pattern]): The global tags matching the given pattern on the