mercurial/templater.py
branchstable
changeset 24886 10a13da8840d
parent 24601 d80819f67d59
child 24903 09124cce913f
equal deleted inserted replaced
24885:eea3977e6fca 24886:10a13da8840d
   537     if not (2 <= len(args) <= 3):
   537     if not (2 <= len(args) <= 3):
   538         # i18n: "word" is a keyword
   538         # i18n: "word" is a keyword
   539         raise error.ParseError(_("word expects two or three arguments, got %d")
   539         raise error.ParseError(_("word expects two or three arguments, got %d")
   540                                % len(args))
   540                                % len(args))
   541 
   541 
   542     num = int(stringify(args[0][0](context, mapping, args[0][1])))
   542     try:
       
   543         num = int(stringify(args[0][0](context, mapping, args[0][1])))
       
   544     except ValueError:
       
   545         # i18n: "word" is a keyword
       
   546         raise error.ParseError(
       
   547                 _("Use strings like '3' for numbers passed to word function"))
   543     text = stringify(args[1][0](context, mapping, args[1][1]))
   548     text = stringify(args[1][0](context, mapping, args[1][1]))
   544     if len(args) == 3:
   549     if len(args) == 3:
   545         splitter = stringify(args[2][0](context, mapping, args[2][1]))
   550         splitter = stringify(args[2][0](context, mapping, args[2][1]))
   546     else:
   551     else:
   547         splitter = None
   552         splitter = None