# HG changeset patch # User Augie Fackler # Date 2017-05-28 19:49:29 # Node ID d110fb58424c206f38deea4e944121c87cf60d9e # Parent d3e1c5b4986c3c7306bf3a22bad0653721f052ee help: convert flag default to bytes portably We were relying on %s using repr on (for example) integer values. Work around that for Python 3 while preserving all the prior magic. diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -84,7 +84,11 @@ def optrst(header, options, verbose): so = '-' + shortopt lo = '--' + longopt if default: - desc += _(" (default: %s)") % default + # default is of unknown type, and in Python 2 we abused + # the %s-shows-repr property to handle integers etc. To + # match that behavior on Python 3, we do str(default) and + # then convert it to bytes. + desc += _(" (default: %s)") % pycompat.bytestr(default) if isinstance(default, list): lo += " %s [+]" % optlabel