diff mercurial/commands.py @ 28912:867d6ba2353d

templater: add parsing and expansion rules to process "templatealias" section The debugtemplate command is updated to show expanded tree, but still the template engine doesn't support alias expansion. That's why the test says "parse error" for now.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 27 Mar 2016 20:31:56 +0900
parents eb017d52899d
children f97a0bcfd7a1
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Mar 27 20:29:03 2016 +0900
+++ b/mercurial/commands.py	Sun Mar 27 20:31:56 2016 +0900
@@ -3671,8 +3671,12 @@
             raise error.Abort(_('malformed keyword definition: %s') % d)
 
     if ui.verbose:
+        aliases = ui.configitems('templatealias')
         tree = templater.parse(tmpl)
         ui.note(templater.prettyformat(tree), '\n')
+        newtree = templater.expandaliases(tree, aliases)
+        if newtree != tree:
+            ui.note("* expanded:\n", templater.prettyformat(newtree), '\n')
 
     mapfile = None
     if revs is None: