children: declare command using decorator
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 04 May 2014 21:46:49 -0700
changeset 21248 48e859e30cbf
parent 21247 b1e64c6720d8
child 21249 2b8697e20978
children: declare command using decorator
hgext/children.py
--- a/hgext/children.py	Sun May 04 21:48:41 2014 -0700
+++ b/hgext/children.py	Sun May 04 21:46:49 2014 -0700
@@ -18,8 +18,15 @@
 from mercurial.commands import templateopts
 from mercurial.i18n import _
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
+@command('children',
+    [('r', 'rev', '',
+     _('show children of the specified revision'), _('REV')),
+    ] + templateopts,
+    _('hg children [-r REV] [FILE]'))
 def children(ui, repo, file_=None, **opts):
     """show the children of the given or working directory revision
 
@@ -40,13 +47,4 @@
         displayer.show(cctx)
     displayer.close()
 
-cmdtable = {
-    "children":
-        (children,
-         [('r', 'rev', '',
-           _('show children of the specified revision'), _('REV')),
-         ] + templateopts,
-         _('hg children [-r REV] [FILE]')),
-}
-
 commands.inferrepo += " children"