# HG changeset patch # User Yuya Nishihara # Date 1519940544 18000 # Node ID a16fceb686a7d867c11c8a3f93f20b618296e5d7 # Parent 3e458c583d2c644c129a51d4eb56e0dcdd471742 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. diff -r 3e458c583d2c -r a16fceb686a7 mercurial/templater.py --- 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"))