[PATCH 1 of 2 STABLE] templater: evaluate "query" argument passed to revset()

Yuya Nishihara yuya at tcha.org
Sun Jun 21 07:42:55 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1434809614 -32400
#      Sat Jun 20 23:13:34 2015 +0900
# Branch stable
# Node ID 2676242b76c64647b68701d927ff7d4288644a61
# Parent  9452112c8eb070aab43334807d2565634952fb4d
templater: evaluate "query" argument passed to revset()

revset() had the same issue as 9452112c8eb0. It crashed by passing non-string
expression.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -417,7 +417,7 @@ def revset(context, mapping, args):
         # 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()
 
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -2527,6 +2527,9 @@ Test revset function
   Rev: 0
   Ancestor: 0
   
+  $ hg log --template '{revset("TIP"|lower)}\n' -l1
+  2
+
 Test current bookmark templating
 
   $ hg book foo


More information about the Mercurial-devel mailing list