templater: inline getfilter() to buildfilter()
authorYuya Nishihara <yuya@tcha.org>
Sat, 04 Jul 2015 15:59:03 +0900
changeset 26104 0f1bc7faa50d
parent 26103 30be3aeb5344
child 26105 d67341f55429
templater: inline getfilter() to buildfilter() This prepares for the unified filter syntax that will be introduced by the next patch.
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