Patchwork [2,of,7] py3: make sure opts are passed and used correctly in help command

login
register
mail settings
Submitter Pulkit Goyal
Date May 4, 2017, 3:16 a.m.
Message ID <e63c8efd338521249863.1493867804@pulkit-goyal>
Download mbox | patch
Permalink /patch/20415/
State Accepted
Headers show

Comments

Pulkit Goyal - May 4, 2017, 3:16 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1493320770 -19800
#      Fri Apr 28 00:49:30 2017 +0530
# Node ID e63c8efd338521249863af0942e4c8166dd90fc5
# Parent  f15cb31ed5bd3d059401731b06930e0c344e0b4d
py3: make sure opts are passed and used correctly in help command

opts are converted back to bytes in help.help_() where they are used.
Before that it's ensured that we have a bytes value for keep variable.
Yuya Nishihara - May 4, 2017, 4:27 a.m.
On Thu, 04 May 2017 08:46:44 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1493320770 -19800
> #      Fri Apr 28 00:49:30 2017 +0530
> # Node ID e63c8efd338521249863af0942e4c8166dd90fc5
> # Parent  f15cb31ed5bd3d059401731b06930e0c344e0b4d
> py3: make sure opts are passed and used correctly in help command

> --- a/mercurial/help.py	Wed May 03 15:25:06 2017 +0530
> +++ b/mercurial/help.py	Fri Apr 28 00:49:30 2017 +0530
> @@ -304,6 +305,7 @@
>      '''
>  
>      from . import commands # avoid cycle
> +    opts = pycompat.byteskwargs(opts)

We'll need a workaround for helplist(..., **opts). Perhaps we can stop
using **opts expansion there.

  rst.extend(helplist(None, **opts))

Patch

diff -r f15cb31ed5bd -r e63c8efd3385 mercurial/commands.py
--- a/mercurial/commands.py	Wed May 03 15:25:06 2017 +0530
+++ b/mercurial/commands.py	Fri Apr 28 00:49:30 2017 +0530
@@ -2764,7 +2764,7 @@ 
     Returns 0 if successful.
     """
 
-    keep = opts.get('system') or []
+    keep = opts.get(r'system') or []
     if len(keep) == 0:
         if pycompat.sysplatform.startswith('win'):
             keep.append('windows')
diff -r f15cb31ed5bd -r e63c8efd3385 mercurial/help.py
--- a/mercurial/help.py	Wed May 03 15:25:06 2017 +0530
+++ b/mercurial/help.py	Fri Apr 28 00:49:30 2017 +0530
@@ -23,6 +23,7 @@ 
     filemerge,
     fileset,
     minirst,
+    pycompat,
     revset,
     templatefilters,
     templatekw,
@@ -304,6 +305,7 @@ 
     '''
 
     from . import commands # avoid cycle
+    opts = pycompat.byteskwargs(opts)
 
     def helpcmd(name, subtopic=None):
         try: