[PATCH] py3: convert "usage" literal to bytes

Yuya Nishihara yuya at tcha.org
Sat Oct 13 15:04:39 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1539442648 -7200
#      Sat Oct 13 16:57:28 2018 +0200
# Node ID e0182e9af70995e3a08d5c04f3384a275f9d8092
# Parent  c8f1640612121c04c8971a8357a5b978bfbde0f9
py3: convert "usage" literal to bytes

Here _() is practically an identity function, but we shouldn't pass in
unicode to _().

diff --git a/contrib/simplemerge b/contrib/simplemerge
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -28,7 +28,7 @@ options = [(b'L', b'label', [], _(b'labe
            (b'h', b'help', None, _(b'display help and exit')),
            (b'q', b'quiet', None, _(b'suppress output'))]
 
-usage = _('''simplemerge [OPTS] LOCAL BASE OTHER
+usage = _(b'''simplemerge [OPTS] LOCAL BASE OTHER
 
     Simple three-way file merge utility with a minimal feature set.
 
@@ -41,7 +41,7 @@ class ParseError(Exception):
     """Exception raised on errors in parsing the command line."""
 
 def showhelp():
-    pycompat.stdout.write(usage.encode('utf8'))
+    pycompat.stdout.write(usage)
     pycompat.stdout.write(b'\noptions:\n')
 
     out_opts = []


More information about the Mercurial-devel mailing list