Mercurial > public > mercurial-scm > hg-stable
annotate contrib/debugshell.py @ 19771:3bc675361206
debugshell: abstract out pdb code.interact
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 14 Jul 2013 12:10:52 -0500 |
parents | 6b7b99867ada |
children | 6ccec36a1fd9 |
rev | line source |
---|---|
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 |
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
17 def debugshell(ui, repo, **opts): |
11633 | 18 bannermsg = "loaded repo : %s\n" \ |
19 "using source: %s" % (repo.root, | |
20 mercurial.__path__[0]) | |
19771
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
21 |
3bc675361206
debugshell: abstract out pdb code.interact
Sean Farley <sean.michael.farley@gmail.com>
parents:
11633
diff
changeset
|
22 pdb(ui, repo, bannermsg, **opts) |
11633 | 23 |
24 cmdtable = { | |
25 "debugshell|dbsh": (debugshell, []) | |
26 } |