On Mon, 29 May 2017 10:32:23 -0400, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler <r...@durin42.com> > # Date 1496000969 14400 > # Sun May 28 15:49:29 2017 -0400 > # Node ID 75e176c753d2c2c7eb5b5c0791bc993160fcb7b1 > # Parent aa333c1982abfe12a3940811d07468a286de93db > 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.sysbytes(str(default))
pycompat.bytestr() can be used instead (as long as default isn't a unicode containing non-ASCII characters.) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel