changeset 26104:0f1bc7faa50d

templater: inline getfilter() to buildfilter() This prepares for the unified filter syntax that will be introduced by the next patch.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 04 Jul 2015 15:59:03 +0900
parents 30be3aeb5344
children d67341f55429
files mercurial/templater.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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