[PATCH 4 of 4] templater: make date() use helper function to evaluate argument

Yuya Nishihara yuya at tcha.org
Wed Mar 2 10:35:04 EST 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1455424610 -32400
#      Sun Feb 14 13:36:50 2016 +0900
# Node ID df8d4064c60de72b2204c714917f835ac0266270
# Parent  93252935f1b4490e6061865c45245173855bfb02
templater: make date() use helper function to evaluate argument

A date argument should never be a generator, but using evalfuncarg() should
be good for consistency.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -329,7 +329,7 @@ def date(context, mapping, args):
         # i18n: "date" is a keyword
         raise error.ParseError(_("date expects one or two arguments"))
 
-    date = args[0][0](context, mapping, args[0][1])
+    date = evalfuncarg(context, mapping, args[0])
     fmt = None
     if len(args) == 2:
         fmt = stringify(args[1][0](context, mapping, args[1][1]))


More information about the Mercurial-devel mailing list