# HG changeset patch # User Gregory Szorc # Date 2014-05-05 04:33:14 # Node ID d2ce7a20fe8610ebc068acdbba25eb45d6931d75 # Parent da0eb497091391af9864a2054696fc7ea7993f7f share: declare commands using decorator diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -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 @@ def share(ui, source, dest=None, noupdat 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 @@ def unshare(ui, repo): # 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"