contrib/debugshell.py
changeset 27721 e4b512bb6386
parent 21243 8b5c039f2b4f
child 28476 e28dc6de38e7
equal deleted inserted replaced
27720:89f49813526c 27721:e4b512bb6386
     2 """a python shell with repo, changelog & manifest objects"""
     2 """a python shell with repo, changelog & manifest objects"""
     3 
     3 
     4 import sys
     4 import sys
     5 import mercurial
     5 import mercurial
     6 import code
     6 import code
     7 from mercurial import cmdutil
     7 from mercurial import (
       
     8     cmdutil,
       
     9     demandimport,
       
    10 )
     8 
    11 
     9 cmdtable = {}
    12 cmdtable = {}
    10 command = cmdutil.command(cmdtable)
    13 command = cmdutil.command(cmdtable)
    11 
    14 
    12 def pdb(ui, repo, msg, **opts):
    15 def pdb(ui, repo, msg, **opts):
    43     if not debugger:
    46     if not debugger:
    44         debugger = 'pdb'
    47         debugger = 'pdb'
    45 
    48 
    46     # if IPython doesn't exist, fallback to code.interact
    49     # if IPython doesn't exist, fallback to code.interact
    47     try:
    50     try:
    48         __import__(pdbmap[debugger])
    51         with demandimport.deactivated():
       
    52             __import__(pdbmap[debugger])
    49     except ImportError:
    53     except ImportError:
    50         ui.warn("%s debugger specified but %s module was not found\n"
    54         ui.warn("%s debugger specified but %s module was not found\n"
    51                 % (debugger, pdbmap[debugger]))
    55                 % (debugger, pdbmap[debugger]))
    52         debugger = 'pdb'
    56         debugger = 'pdb'
    53 
    57