Mercurial > hg-stable
changeset 21253:d2ce7a20fe86
share: declare commands using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 21:33:14 -0700 |
parents | da0eb4970913 |
children | 51e5c793a9f4 |
files | hgext/share.py |
diffstat | 1 files changed, 7 insertions(+), 12 deletions(-) [+] |
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"