mercurial/dispatch.py
changeset 25329 101e84121c13
parent 25277 0f2dcbccf9c9
child 25660 328739ea70c3
--- a/mercurial/dispatch.py	Thu May 28 16:42:04 2015 -0400
+++ b/mercurial/dispatch.py	Thu May 28 16:42:21 2015 -0400
@@ -11,6 +11,7 @@
 import util, commands, hg, fancyopts, extensions, hook, error
 import cmdutil, encoding
 import ui as uimod
+import demandimport
 
 class request(object):
     def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
@@ -137,10 +138,11 @@
                 # 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
+                with demandimport.deactivated():
+                    try:
+                        debugmod = __import__(debugger)
+                    except ImportError:
+                        pass # Leave debugmod = pdb
 
             debugtrace[debugger] = debugmod.set_trace
             debugmortem[debugger] = debugmod.post_mortem