comparison 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
comparison
equal deleted inserted replaced
28345:d81437c91a26 28346:542d200bd261
619 619
620 node = stringify(args[0][0](context, mapping, args[0][1])) 620 node = stringify(args[0][0](context, mapping, args[0][1]))
621 621
622 minlength = 4 622 minlength = 4
623 if len(args) > 1: 623 if len(args) > 1:
624 minlength = int(args[1][1]) 624 minlength = evalinteger(context, mapping, args[1],
625 # i18n: "shortest" is a keyword
626 _("shortest() expects an integer minlength"))
625 627
626 cl = mapping['ctx']._repo.changelog 628 cl = mapping['ctx']._repo.changelog
627 def isvalid(test): 629 def isvalid(test):
628 try: 630 try:
629 try: 631 try: