author | Sean Farley <sean.michael.farley@gmail.com> |
Sun, 14 Jul 2013 12:02:36 -0500 | |
changeset 19772 | 6ccec36a1fd9 |
parent 19771 | 3bc675361206 |
child 19773 | 51799a965446 |
permissions | -rw-r--r-- |
11633 | 1 |
# debugshell extension |
2 |
"""a python shell with repo, changelog & manifest objects""" |
|
3 |
||
4 |
import mercurial |
|
5 |
import code |
|
6 |
||
19771
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
7 |
def pdb(ui, repo, msg, **opts): |
11633 | 8 |
objects = { |
9 |
'mercurial': mercurial, |
|
10 |
'repo': repo, |
|
11 |
'cl': repo.changelog, |
|
12 |
'mf': repo.manifest, |
|
13 |
} |
|
19771
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
14 |
|
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
15 |
code.interact(msg, local=objects) |
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
16 |
|
19772
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
17 |
def ipdb(ui, repo, msg, **opts): |
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
18 |
import IPython |
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
19 |
|
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
20 |
cl = repo.changelog |
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
21 |
mf = repo.manifest |
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
22 |
|
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
23 |
IPython.embed() |
6ccec36a1fd9
debugshell: add function to embed ipython
Sean Farley <sean.michael.farley@gmail.com>
parents:
19771
diff
changeset
|
24 |
|
19771
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
25 |
def debugshell(ui, repo, **opts): |
11633 | 26 |
bannermsg = "loaded repo : %s\n" \ |
27 |
"using source: %s" % (repo.root, |
|
28 |
mercurial.__path__[0]) |
|
19771
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
29 |
|
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
30 |
pdb(ui, repo, bannermsg, **opts) |
11633 | 31 |
|
32 |
cmdtable = { |
|
33 |
"debugshell|dbsh": (debugshell, []) |
|
34 |
} |