[PATCH 2 of 6 RFC] templater: wrap each parsed element with a label filter

Sean Farley sean.michael.farley at gmail.com
Mon Dec 24 01:03:09 CST 2012


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1356234924 21600
# Node ID 75ef781d20973d036f003bba00a873bf1c5d5598
# Parent  54276c120146e14cc4ab931b799c94bd671ee524
templater: wrap each parsed element with a label filter

By default, this will be a no-op call. If the color extension is enabled then it will be passed an empty label for each element for which it can do something fancy with.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -95,10 +95,12 @@
 
         pd = [tmpl, n + 1, stop]
         parseres, pos = p.parse(pd)
         parsed.append(parseres)
 
+    parsed = [('func', ('symbol', 'label'), e) for e in parsed]
+
     return [compileexp(e, context) for e in parsed]
 
 def compileexp(exp, context):
     t = exp[0]
     if t in methods:


More information about the Mercurial-devel mailing list