##// END OF EJS Templates
debugshell: add function to embed ipython
Sean Farley -
r19772:6ccec36a default
parent child Browse files
Show More
@@ -1,26 +1,34 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 mercurial
4 import mercurial
5 import code
5 import code
6
6
7 def pdb(ui, repo, msg, **opts):
7 def pdb(ui, repo, msg, **opts):
8 objects = {
8 objects = {
9 'mercurial': mercurial,
9 'mercurial': mercurial,
10 'repo': repo,
10 'repo': repo,
11 'cl': repo.changelog,
11 'cl': repo.changelog,
12 'mf': repo.manifest,
12 'mf': repo.manifest,
13 }
13 }
14
14
15 code.interact(msg, local=objects)
15 code.interact(msg, local=objects)
16
16
17 def ipdb(ui, repo, msg, **opts):
18 import IPython
19
20 cl = repo.changelog
21 mf = repo.manifest
22
23 IPython.embed()
24
17 def debugshell(ui, repo, **opts):
25 def debugshell(ui, repo, **opts):
18 bannermsg = "loaded repo : %s\n" \
26 bannermsg = "loaded repo : %s\n" \
19 "using source: %s" % (repo.root,
27 "using source: %s" % (repo.root,
20 mercurial.__path__[0])
28 mercurial.__path__[0])
21
29
22 pdb(ui, repo, bannermsg, **opts)
30 pdb(ui, repo, bannermsg, **opts)
23
31
24 cmdtable = {
32 cmdtable = {
25 "debugshell|dbsh": (debugshell, [])
33 "debugshell|dbsh": (debugshell, [])
26 }
34 }
General Comments 0
You need to be logged in to leave comments. Login now