Patchwork [01,of,11,V3] dispatch: turn off custom debugger for HGPLAIN mode

login
register
mail settings
Submitter Sean Farley
Date Nov. 25, 2013, 5:42 p.m.
Message ID <45892c8fe1d557842ab6.1385401334@dyn-160-39-236-172.dyn.columbia.edu>
Download mbox | patch
Permalink /patch/3121/
State Superseded
Commit 8f4a226c840c38b905c5cba2596d8ffe3cd27bca
Headers show

Comments

Sean Farley - Nov. 25, 2013, 5:42 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 45892c8fe1d557842ab6b64ba91b26b04a56e5ac
# Parent  0f01d0692bc54551bc62c64f3dfd793708bd901b
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.

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: