# HG changeset patch # User Matt Mackall # Date 1433964618 18000 # Node ID 8463433c268976d9aacf079b606a6aed6b14840d # Parent c2a4dfe2a336e704703239d68ace8e1aab449206 formatter: add a method to build a full templater from a -T option diff -r c2a4dfe2a336 -r 8463433c2689 mercurial/formatter.py --- 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":