Patchwork [01,of,15,V5] dispatch: turn off custom debugger for HGPLAIN mode

login
register
mail settings
Submitter Sean Farley
Date Nov. 26, 2013, 7:54 p.m.
Message ID <fefe68a50a27e505b9f3.1385499280@laptop.local>
Download mbox | patch
Permalink /patch/3155/
State Accepted
Commit 8f4a226c840c38b905c5cba2596d8ffe3cd27bca
Headers show

Comments

Sean Farley - Nov. 26, 2013, 7:54 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1385400039 18000
#      Mon Nov 25 12:20:39 2013 -0500
# Node ID fefe68a50a27e505b9f35a89da4eda432a302843
# Parent  af12f58e2aa081ce512cc4a8b87dd354a45123e5
dispatch: turn off custom debugger for HGPLAIN mode

Some debuggers, such as ipdb, load escape codes and color codes even when later
turned off. This will affect scripts that do simple parsing and can't handle
escape codes. Therefore, we only load a custom debugger if ui.plain() is false.
Augie Fackler - Nov. 27, 2013, 2:50 p.m.
On Tue, Nov 26, 2013 at 02:54:40PM -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1385400039 18000
> #      Mon Nov 25 12:20:39 2013 -0500
> # Node ID fefe68a50a27e505b9f35a89da4eda432a302843
> # Parent  af12f58e2aa081ce512cc4a8b87dd354a45123e5
> dispatch: turn off custom debugger for HGPLAIN mode

series looks reasonable, if baffling in places. Queued.

>
> Some debuggers, such as ipdb, load escape codes and color codes even when later
> turned off. This will affect scripts that do simple parsing and can't handle
> escape codes. Therefore, we only load a custom debugger if ui.plain() is false.
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -104,12 +104,13 @@
>                  # copy configs that were passed on the cmdline (--config) to
>                  # the repo ui
>                  for cfg in cfgs:
>                      req.repo.ui.setconfig(*cfg)
>
> +            # if we are in HGPLAIN mode, then disable custom debugging
>              debugger = ui.config("ui", "debugger")
> -            if not debugger:
> +            if not debugger or ui.plain():
>                  debugger = 'pdb'
>
>              try:
>                  debugmod = __import__(debugger)
>              except ImportError:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -104,12 +104,13 @@ 
                 # copy configs that were passed on the cmdline (--config) to
                 # the repo ui
                 for cfg in cfgs:
                     req.repo.ui.setconfig(*cfg)
 
+            # if we are in HGPLAIN mode, then disable custom debugging
             debugger = ui.config("ui", "debugger")
-            if not debugger:
+            if not debugger or ui.plain():
                 debugger = 'pdb'
 
             try:
                 debugmod = __import__(debugger)
             except ImportError: