[PATCH 1 of 5] templater: move runtemplate function out of buildmap/runmap pair

Yuya Nishihara yuya at tcha.org
Tue Jun 16 10:10:36 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1434122122 -32400
#      Sat Jun 13 00:15:22 2015 +0900
# Node ID fce3854318c2128aa8188678d26b2320ecba8972
# Parent  a69983942fb4dbfdf5ca8c7a123120ed09ead5db
templater: move runtemplate function out of buildmap/runmap pair

The next patch will introduce buildtemplate function that should be defined
near runtemplate. But I don't want to insert it between buildmap and runmap.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -174,6 +174,10 @@ def runsymbol(context, mapping, key):
         v = list(v)
     return v
 
+def runtemplate(context, mapping, template):
+    for func, data in template:
+        yield func(context, mapping, data)
+
 def buildfilter(exp, context):
     func, data = compileexp(exp[1], context, methods)
     filt = getfilter(exp[2], context)
@@ -201,10 +205,6 @@ def buildmap(exp, context):
     ctmpl = gettemplate(exp[2], context)
     return (runmap, (func, data, ctmpl))
 
-def runtemplate(context, mapping, template):
-    for func, data in template:
-        yield func(context, mapping, data)
-
 def runmap(context, mapping, data):
     func, data, ctmpl = data
     d = func(context, mapping, data)


More information about the Mercurial-devel mailing list