diff mercurial/dispatch.py @ 20829:9a09a625bc93

merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 25 Mar 2014 16:17:16 -0500
parents 131f7fe06e9e dd2e25e49862
children 5e13507a3b4e
line wrap: on
line diff
--- a/mercurial/dispatch.py	Mon Mar 24 20:00:18 2014 -0700
+++ b/mercurial/dispatch.py	Tue Mar 25 16:17:16 2014 -0500
@@ -108,13 +108,17 @@
 
             # if we are in HGPLAIN mode, then disable custom debugging
             debugger = ui.config("ui", "debugger")
+            debugmod = pdb
             if not debugger or ui.plain():
                 debugger = 'pdb'
-
-            try:
-                debugmod = __import__(debugger)
-            except ImportError:
-                debugmod = pdb
+            elif '--debugger' in req.args:
+                # This import can be slow for fancy debuggers, so only
+                # do it when absolutely necessary, i.e. when actual
+                # debugging has been requested
+                try:
+                    debugmod = __import__(debugger)
+                except ImportError:
+                    pass # Leave debugmod = pdb
 
             debugtrace[debugger] = debugmod.set_trace
             debugmortem[debugger] = debugmod.post_mortem