[PATCH 2 of 4] debugshell: abstract out pdb code.interact

Sean Farley sean.michael.farley at gmail.com
Fri Sep 20 15:28:31 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1373821852 18000
#      Sun Jul 14 12:10:52 2013 -0500
# Node ID aa9ff65add03b8e535c115c67d5c12c64231b019
# Parent  a005dc16a698e26612f87771548aa65843c40160
debugshell: abstract out pdb code.interact

diff --git a/contrib/debugshell.py b/contrib/debugshell.py
--- a/contrib/debugshell.py
+++ b/contrib/debugshell.py
@@ -2,20 +2,25 @@
 """a python shell with repo, changelog & manifest objects"""
 
 import mercurial
 import code
 
-def debugshell(ui, repo, **opts):
+def pdb(ui, repo, msg, **opts):
     objects = {
         'mercurial': mercurial,
         'repo': repo,
         'cl': repo.changelog,
         'mf': repo.manifest,
     }
+
+    code.interact(msg, local=objects)
+
+def debugshell(ui, repo, **opts):
     bannermsg = "loaded repo : %s\n" \
                 "using source: %s" % (repo.root,
                                       mercurial.__path__[0])
-    code.interact(bannermsg, local=objects)
+
+    pdb(ui, repo, bannermsg, **opts)
 
 cmdtable = {
     "debugshell|dbsh|db": (debugshell, [])
 }


More information about the Mercurial-devel mailing list