diff mercurial/templater.py @ 31519:3725986b151a

templater: reject bad fillchar argument passed to pad() Otherwise TypeError would be raised.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Mar 2017 20:38:44 +0900
parents 48a8b2e5fe31
children 6f150bb19317
line wrap: on
line diff
--- a/mercurial/templater.py	Sat Mar 18 20:11:15 2017 +0900
+++ b/mercurial/templater.py	Sat Mar 18 20:38:44 2017 +0900
@@ -575,6 +575,9 @@
     fillchar = ' '
     if len(args) > 2:
         fillchar = evalstring(context, mapping, args[2])
+        if len(fillchar) != 1:
+            # i18n: "pad" is a keyword
+            raise error.ParseError(_("pad() expects a single fill character"))
     if len(args) > 3:
         left = evalboolean(context, mapping, args[3])