changeset 21248:48e859e30cbf

children: declare command using decorator
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 21:46:49 -0700
parents b1e64c6720d8
children 2b8697e20978
files hgext/children.py
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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"