templatefuncs: do not crash because of invalid value fed to mailmap()
authorYuya Nishihara <yuya@tcha.org>
Sun, 01 Apr 2018 11:06:29 +0900
changeset 37260 8e57c3b0dce4
parent 37259 d29f6fbd1181
child 37261 3809eafedf2c
templatefuncs: do not crash because of invalid value fed to mailmap()
mercurial/templatefuncs.py
tests/test-mailmap.t
--- a/mercurial/templatefuncs.py	Sat Mar 31 23:34:15 2018 -0700
+++ b/mercurial/templatefuncs.py	Sun Apr 01 11:06:29 2018 +0900
@@ -175,7 +175,7 @@
     if len(args) != 1:
         raise error.ParseError(_("mailmap expects one argument"))
 
-    author = evalfuncarg(context, mapping, args[0])
+    author = evalstring(context, mapping, args[0])
 
     cache = context.resource(mapping, 'cache')
     repo = context.resource(mapping, 'repo')
--- a/tests/test-mailmap.t	Sat Mar 31 23:34:15 2018 -0700
+++ b/tests/test-mailmap.t	Sun Apr 01 11:06:29 2018 +0900
@@ -65,3 +65,8 @@
   Proper Name 4 <proper@m.c>
   Testuser <newmmentry@m.c>
   Improper user
+
+No TypeError beacause of invalid input
+
+  $ hg log -T '{mailmap(termwidth)}\n' -r0
+  80