Mercurial > hg
comparison mercurial/templater.py @ 25003:5e584edbb211
templater: update error message of invalid number passed to word() function
"word(3, desc)" is valid now.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 02 May 2015 15:49:38 +0900 |
parents | 829faf8ab605 |
children | 081b08e4ea13 |
comparison
equal
deleted
inserted
replaced
25002:829faf8ab605 | 25003:5e584edbb211 |
---|---|
567 | 567 |
568 try: | 568 try: |
569 num = int(stringify(args[0][0](context, mapping, args[0][1]))) | 569 num = int(stringify(args[0][0](context, mapping, args[0][1]))) |
570 except ValueError: | 570 except ValueError: |
571 # i18n: "word" is a keyword | 571 # i18n: "word" is a keyword |
572 raise error.ParseError( | 572 raise error.ParseError(_("word expects an integer index")) |
573 _("Use strings like '3' for numbers passed to word function")) | |
574 text = stringify(args[1][0](context, mapping, args[1][1])) | 573 text = stringify(args[1][0](context, mapping, args[1][1])) |
575 if len(args) == 3: | 574 if len(args) == 3: |
576 splitter = stringify(args[2][0](context, mapping, args[2][1])) | 575 splitter = stringify(args[2][0](context, mapping, args[2][1])) |
577 else: | 576 else: |
578 splitter = None | 577 splitter = None |