Patchwork py3: convert "usage" literal to bytes

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 13, 2018, 3:04 p.m.
Message ID <e0182e9af70995e3a08d.1539443079@mimosa>
Download mbox | patch
Permalink /patch/35938/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 13, 2018, 3:04 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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 _().
Pulkit Goyal - Oct. 13, 2018, 3:15 p.m.
On Sat, Oct 13, 2018 at 6:10 PM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@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 _().
>

Queued this patch, many thanks!

Patch

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 = []