Patchwork [1,of,2] py3: byteify sys.argv in gendoc.py

login
register
mail settings
Submitter Matt Harbison
Date Dec. 21, 2018, 5:13 a.m.
Message ID <5323f3f275a8522e445e.1545369195@Envy>
Download mbox | patch
Permalink /patch/37289/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 21, 2018, 5:13 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1545347549 18000
#      Thu Dec 20 18:12:29 2018 -0500
# Node ID 5323f3f275a8522e445e8029acc5cac6b636f1c8
# Parent  6d49a573ba57caf690db1a82dc682a9cadb1f038
py3: byteify sys.argv in gendoc.py
Pulkit Goyal - Dec. 21, 2018, 12:06 p.m.
On Fri, Dec 21, 2018 at 8:14 AM Matt Harbison <mharbison72@gmail.com> wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1545347549 18000
> #      Thu Dec 20 18:12:29 2018 -0500
> # Node ID 5323f3f275a8522e445e8029acc5cac6b636f1c8
> # Parent  6d49a573ba57caf690db1a82dc682a9cadb1f038
> py3: byteify sys.argv in gendoc.py
>

Queued this series, many thanks!
Yuya Nishihara - Dec. 22, 2018, 2:41 a.m.
On Fri, 21 Dec 2018 00:13:15 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1545347549 18000
> #      Thu Dec 20 18:12:29 2018 -0500
> # Node ID 5323f3f275a8522e445e8029acc5cac6b636f1c8
> # Parent  6d49a573ba57caf690db1a82dc682a9cadb1f038
> py3: byteify sys.argv in gendoc.py

>  if __name__ == "__main__":
>      doc = b'hg.1.gendoc'
>      if len(sys.argv) > 1:
> -        doc = sys.argv[1]
> +        doc = encoding.strtolocal(sys.argv[1])

There's one more sys.argv[1] below.

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -29,6 +29,7 @@  from mercurial import util
 util.datapath
 from mercurial import (
     commands,
+    encoding,
     extensions,
     help,
     minirst,
@@ -230,7 +231,7 @@  def allextensionnames():
 if __name__ == "__main__":
     doc = b'hg.1.gendoc'
     if len(sys.argv) > 1:
-        doc = sys.argv[1]
+        doc = encoding.strtolocal(sys.argv[1])
 
     ui = uimod.ui.load()
     if doc == b'hg.1.gendoc':