# HG changeset patch # User Sean Farley # Date 2012-12-23 03:46:26 # Node ID 9bfb53106328743a2c5879b0f399d6fd7cfe59b6 # Parent 0d5a22f73a1f8d7b871c51bc8426264e8c629ce4 templater: add no-op template function 'label' diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -265,6 +265,15 @@ def ifeq(context, mapping, args): t = stringify(args[3][0](context, mapping, args[3][1])) yield runtemplate(context, mapping, compiletemplate(t, context)) +def label(context, mapping, args): + if len(args) != 2: + # i18n: "label" is a keyword + raise error.ParseError(_("label expects two arguments")) + + # ignore args[0] (the label string) since this is supposed to be a a no-op + t = stringify(args[1][0](context, mapping, args[1][1])) + yield runtemplate(context, mapping, compiletemplate(t, context)) + methods = { "string": lambda e, c: (runstring, e[1]), "symbol": lambda e, c: (runsymbol, e[1]), @@ -280,6 +289,7 @@ funcs = { "ifeq": ifeq, "join": join, "sub": sub, + "label": label, } # template engine