##// END OF EJS Templates
debugshell: check ui.debugger for which debugger to use
Sean Farley -
r19773:51799a96 default
parent child Browse files
Show More
@@ -1,6 +1,7 b''
1 # debugshell extension
1 # debugshell extension
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 mercurial
5 import mercurial
5 import code
6 import code
6
7
@@ -27,7 +28,24 b' def debugshell(ui, repo, **opts):'
27 "using source: %s" % (repo.root,
28 "using source: %s" % (repo.root,
28 mercurial.__path__[0])
29 mercurial.__path__[0])
29
30
30 pdb(ui, repo, bannermsg, **opts)
31 pdbmap = {
32 'pdb' : 'code',
33 'ipdb' : 'IPython'
34 }
35
36 debugger = ui.config("ui", "debugger")
37 if not debugger:
38 debugger = 'pdb'
39
40 # if IPython doesn't exist, fallback to code.interact
41 try:
42 __import__(pdbmap[debugger])
43 except ImportError:
44 ui.warn("%s debugger specified but %s module was not found\n"
45 % (debugger, pdbmap[debugger]))
46 debugger = 'pdb'
47
48 getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)
31
49
32 cmdtable = {
50 cmdtable = {
33 "debugshell|dbsh": (debugshell, [])
51 "debugshell|dbsh": (debugshell, [])
General Comments 0
You need to be logged in to leave comments. Login now