changeset 25637:5eccebe23942 stable

templater: evaluate "query" argument passed to revset() revset() had the same issue as 9452112c8eb0. It crashed by passing non-string expression.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 20 Jun 2015 23:13:34 +0900
parents bfe9ed85f27c
children 6047b60cdd09
files mercurial/templater.py tests/test-command-template.t
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Sat Jun 20 19:59:26 2015 -0400
+++ b/mercurial/templater.py	Sat Jun 20 23:13:34 2015 +0900
@@ -417,7 +417,7 @@
         # i18n: "revset" is a keyword
         raise error.ParseError(_("revset expects one or more arguments"))
 
-    raw = args[0][1]
+    raw = stringify(args[0][0](context, mapping, args[0][1]))
     ctx = mapping['ctx']
     repo = ctx.repo()
 
--- a/tests/test-command-template.t	Sat Jun 20 19:59:26 2015 -0400
+++ b/tests/test-command-template.t	Sat Jun 20 23:13:34 2015 +0900
@@ -2527,6 +2527,9 @@
   Rev: 0
   Ancestor: 0
   
+  $ hg log --template '{revset("TIP"|lower)}\n' -l1
+  2
+
 Test current bookmark templating
 
   $ hg book foo