relink: declare command using decorator
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 04 May 2014 21:52:25 -0700
changeset 21252 da0eb4970913
parent 21251 a836fa58b512
child 21253 d2ce7a20fe86
relink: declare command using decorator
hgext/relink.py
--- a/hgext/relink.py	Sun May 04 22:35:37 2014 -0700
+++ b/hgext/relink.py	Sun May 04 21:52:25 2014 -0700
@@ -7,12 +7,15 @@
 
 """recreates hardlinks between repository clones"""
 
-from mercurial import hg, util
+from mercurial import cmdutil, hg, util
 from mercurial.i18n import _
 import os, stat
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
+@command('relink', [], _('[ORIGIN]'))
 def relink(ui, repo, origin=None, **opts):
     """recreate hardlinks between two repositories
 
@@ -178,11 +181,3 @@
 
     ui.status(_('relinked %d files (%s reclaimed)\n') %
               (relinked, util.bytecount(savedbytes)))
-
-cmdtable = {
-    'relink': (
-        relink,
-        [],
-        _('[ORIGIN]')
-    )
-}