# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1522548389 -32400
#      Sun Apr 01 11:06:29 2018 +0900
# Node ID 02079695afdd39020b13f238c69691dce14b932f
# Parent  2ed180117f7658d0cbf6a1ece20944465c55c947
templatefuncs: do not crash because of invalid value fed to mailmap()

diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py
--- a/mercurial/templatefuncs.py
+++ b/mercurial/templatefuncs.py
@@ -175,7 +175,7 @@ def mailmap(context, mapping, args):
     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')
diff --git a/tests/test-mailmap.t b/tests/test-mailmap.t
--- a/tests/test-mailmap.t
+++ b/tests/test-mailmap.t
@@ -65,3 +65,8 @@ A commit with improperly formatted user 
   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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to