# HG changeset patch # User Yuya Nishihara # Date 1435993143 -32400 # Node ID 0f1bc7faa50d2c38a415f0ab8e7ff271bd4d10c9 # Parent 30be3aeb5344140ca107eb5cfe0908b75d2a55f0 templater: inline getfilter() to buildfilter() This prepares for the unified filter syntax that will be introduced by the next patch. diff -r 30be3aeb5344 -r 0f1bc7faa50d mercurial/templater.py --- a/mercurial/templater.py Sun Aug 30 11:47:43 2015 +0200 +++ b/mercurial/templater.py Sat Jul 04 15:59:03 2015 +0900 @@ -205,12 +205,6 @@ return getlist(x[1]) + [x[2]] return [x] -def getfilter(exp, context): - f = getsymbol(exp) - if f not in context._filters: - raise error.ParseError(_("unknown function '%s'") % f) - return context._filters[f] - def gettemplate(exp, context): if exp[0] == 'template': return [compileexp(e, context, methods) for e in exp[1]] @@ -254,8 +248,11 @@ def buildfilter(exp, context): func, data = compileexp(exp[1], context, methods) - filt = getfilter(exp[2], context) - return (runfilter, (func, data, filt)) + n = getsymbol(exp[2]) + if n in context._filters: + filt = context._filters[n] + return (runfilter, (func, data, filt)) + raise error.ParseError(_("unknown function '%s'") % n) def runfilter(context, mapping, data): func, data, filt = data