diff mercurial/templater.py @ 28346:542d200bd261

templater: fix shortest() to evaluate int argument and handle error
author Yuya Nishihara <yuya@tcha.org>
date Sun, 14 Feb 2016 13:09:17 +0900
parents d81437c91a26
children ccedb17a5657
line wrap: on
line diff
--- a/mercurial/templater.py	Sun Feb 14 13:05:09 2016 +0900
+++ b/mercurial/templater.py	Sun Feb 14 13:09:17 2016 +0900
@@ -621,7 +621,9 @@
 
     minlength = 4
     if len(args) > 1:
-        minlength = int(args[1][1])
+        minlength = evalinteger(context, mapping, args[1],
+                                # i18n: "shortest" is a keyword
+                                _("shortest() expects an integer minlength"))
 
     cl = mapping['ctx']._repo.changelog
     def isvalid(test):