# HG changeset patch # User Gregory Szorc # Date 1399264394 25200 # Node ID d2ce7a20fe8610ebc068acdbba25eb45d6931d75 # Parent da0eb497091391af9864a2054696fc7ea7993f7f share: declare commands using decorator diff -r da0eb4970913 -r d2ce7a20fe86 hgext/share.py --- a/hgext/share.py Sun May 04 21:52:25 2014 -0700 +++ b/hgext/share.py Sun May 04 21:33:14 2014 -0700 @@ -6,10 +6,15 @@ '''share a common history between several working directories''' from mercurial.i18n import _ -from mercurial import hg, commands, util +from mercurial import cmdutil, hg, commands, util +cmdtable = {} +command = cmdutil.command(cmdtable) testedwith = 'internal' +@command('share', + [('U', 'noupdate', None, _('do not create a working copy'))], + _('[-U] SOURCE [DEST]')) def share(ui, source, dest=None, noupdate=False): """create a new shared repository @@ -30,6 +35,7 @@ return hg.share(ui, source, dest, not noupdate) +@command('unshare', [], '') def unshare(ui, repo): """convert a shared repository to a normal one @@ -61,15 +67,4 @@ # update store, spath, sopener and sjoin of repo repo.unfiltered().__init__(repo.baseui, repo.root) -cmdtable = { - "share": - (share, - [('U', 'noupdate', None, _('do not create a working copy'))], - _('[-U] SOURCE [DEST]')), - "unshare": - (unshare, - [], - ''), -} - commands.norepo += " share"