Patchwork [1,of,9,py3] ui: check for --debugger in sys.argv using r-string to avoid bytes on py3

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 5:22 p.m.
Message ID <66618e51771e519582cb.1489339330@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19171/
State Superseded
Headers show

Comments

Augie Fackler - March 12, 2017, 5:22 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489283469 18000
#      Sat Mar 11 20:51:09 2017 -0500
# Node ID 66618e51771e519582cbe0fe7cd5e116d9cd87ad
# Parent  1c3352d7eaf24533ad52d4b8a024211e9189fb0b
ui: check for --debugger in sys.argv using r-string to avoid bytes on py3

Our source loader was errantly turning this --debugger into a bytes,
which was then causing me to still get a pager when I was using the
debugger on py3. That made life hard.
Yuya Nishihara - March 12, 2017, 5:45 p.m.
On Sun, 12 Mar 2017 13:22:10 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1489283469 18000
> #      Sat Mar 11 20:51:09 2017 -0500
> # Node ID 66618e51771e519582cbe0fe7cd5e116d9cd87ad
> # Parent  1c3352d7eaf24533ad52d4b8a024211e9189fb0b
> ui: check for --debugger in sys.argv using r-string to avoid bytes on py3
> 
> Our source loader was errantly turning this --debugger into a bytes,
> which was then causing me to still get a pager when I was using the
> debugger on py3. That made life hard.
> 
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -901,7 +901,7 @@ class ui(object):
>              or not self.formatted()
>              or self.plain()
>              # TODO: expose debugger-enabled on the UI object
> -            or '--debugger' in sys.argv):
> +            or r'--debugger' in sys.argv):

Nit: we can use pycompat.sysargv.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -901,7 +901,7 @@  class ui(object):
             or not self.formatted()
             or self.plain()
             # TODO: expose debugger-enabled on the UI object
-            or '--debugger' in sys.argv):
+            or r'--debugger' in sys.argv):
             # We only want to paginate if the ui appears to be
             # interactive, the user didn't say HGPLAIN or
             # HGPLAINEXCEPT=pager, and the user didn't specify --debug.