Mercurial > hg-stable
diff mercurial/formatter.py @ 25512:8463433c2689
formatter: add a method to build a full templater from a -T option
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 10 Jun 2015 14:30:18 -0500 |
parents | c2a4dfe2a336 |
children | 0c6f98398f8a |
line wrap: on
line diff
--- a/mercurial/formatter.py Wed Jun 10 14:29:13 2015 -0500 +++ b/mercurial/formatter.py Wed Jun 10 14:30:18 2015 -0500 @@ -171,6 +171,13 @@ # constant string? return tmpl, None +def gettemplater(ui, topic, spec): + tmpl, mapfile = lookuptemplate(ui, topic, spec) + t = templater.templater(mapfile, {}) + if tmpl: + t.cache[topic] = tmpl + return t + def formatter(ui, topic, opts): template = opts.get("template", "") if template == "json":