[PATCH 01 of 11 V4] dispatch: turn off custom debugger for HGPLAIN mode

Sean Farley sean.michael.farley at gmail.com
Mon Nov 25 19:37:07 CST 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at 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.

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:


More information about the Mercurial-devel mailing list