debugshell: declare command using decorator
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 04 May 2014 21:19:31 -0700
changeset 21243 8b5c039f2b4f
parent 21242 4c94229c51fb
child 21244 f0dbafceeb9a
debugshell: declare command using decorator
contrib/debugshell.py
--- a/contrib/debugshell.py	Sun May 04 21:09:06 2014 -0700
+++ b/contrib/debugshell.py	Sun May 04 21:19:31 2014 -0700
@@ -4,6 +4,10 @@
 import sys
 import mercurial
 import code
+from mercurial import cmdutil
+
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 
 def pdb(ui, repo, msg, **opts):
     objects = {
@@ -24,6 +28,7 @@
 
     IPython.embed()
 
+@command('debugshell|dbsh', [])
 def debugshell(ui, repo, **opts):
     bannermsg = "loaded repo : %s\n" \
                 "using source: %s" % (repo.root,
@@ -47,7 +52,3 @@
         debugger = 'pdb'
 
     getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)
-
-cmdtable = {
-    "debugshell|dbsh": (debugshell, [])
-}