Mercurial > hg-stable
diff hgext/share.py @ 21253:d2ce7a20fe86
share: declare commands using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 21:33:14 -0700 |
parents | cbcd85fa75c0 |
children | 5a4d1a6c605f |
line wrap: on
line diff
--- 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"