Mercurial > hg-stable
changeset 36573:a16fceb686a7
py3: fix join(), min(), and max() template functions over string
It's silly to split a string into characters and concatenate them, but that
should work and test-command-template.t has one. min() and max() had the
same issue on Python 3, so fixed too.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 01 Mar 2018 16:42:24 -0500 |
parents | 3e458c583d2c |
children | ab7f86a748e6 |
files | mercurial/templater.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templater.py Thu Mar 01 16:32:45 2018 -0500 +++ b/mercurial/templater.py Thu Mar 01 16:42:24 2018 -0500 @@ -908,7 +908,7 @@ joiner = evalstring(context, mapping, args[1]) first = True - for x in joinset: + for x in pycompat.maybebytestr(joinset): if first: first = False else: @@ -991,7 +991,7 @@ iterable = evalfuncarg(context, mapping, args[0]) try: - x = max(iterable) + x = max(pycompat.maybebytestr(iterable)) except (TypeError, ValueError): # i18n: "max" is a keyword raise error.ParseError(_("max first argument should be an iterable")) @@ -1006,7 +1006,7 @@ iterable = evalfuncarg(context, mapping, args[0]) try: - x = min(iterable) + x = min(pycompat.maybebytestr(iterable)) except (TypeError, ValueError): # i18n: "min" is a keyword raise error.ParseError(_("min first argument should be an iterable"))