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.
--- a/mercurial/help.py Thu Jun 01 23:08:23 2017 +0900
+++ b/mercurial/help.py Sun May 28 15:49:29 2017 -0400
@@ -84,7 +84,11 @@
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