Mercurial > hg-stable
diff hgext/largefiles/lfcommands.py @ 21242:4c94229c51fb
largefiles: declare commands using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 21:09:06 -0700 |
parents | e095626e8676 |
children | 503bb3af70fe |
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py Mon May 05 21:26:40 2014 +0900 +++ b/hgext/largefiles/lfcommands.py Sun May 04 21:09:06 2014 -0700 @@ -21,6 +21,18 @@ # -- Commands ---------------------------------------------------------- +cmdtable = {} +command = cmdutil.command(cmdtable) + +commands.inferrepo += " lfconvert" + +@command('lfconvert', + [('s', 'size', '', + _('minimum size (MB) for files to be converted as largefiles'), 'SIZE'), + ('', 'to-normal', False, + _('convert from a largefiles repo to a normal repo')), + ], + _('hg lfconvert SOURCE DEST [FILE ...]')) def lfconvert(ui, src, dest, *pats, **opts): '''convert a normal repository to a largefiles repository @@ -519,6 +531,10 @@ finally: wlock.release() +@command('lfpull', + [('r', 'rev', [], _('pull largefiles for these revisions')) + ] + commands.remoteopts, + _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]')) def lfpull(ui, repo, source="default", **opts): """pull largefiles for the specified revisions from the specified source @@ -553,24 +569,3 @@ (cached, missing) = cachelfiles(ui, repo, rev) numcached += len(cached) ui.status(_("%d largefiles cached\n") % numcached) - -# -- hg commands declarations ------------------------------------------------ - -cmdtable = { - 'lfconvert': (lfconvert, - [('s', 'size', '', - _('minimum size (MB) for files to be converted ' - 'as largefiles'), - 'SIZE'), - ('', 'to-normal', False, - _('convert from a largefiles repo to a normal repo')), - ], - _('hg lfconvert SOURCE DEST [FILE ...]')), - 'lfpull': (lfpull, - [('r', 'rev', [], _('pull largefiles for these revisions')) - ] + commands.remoteopts, - _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]') - ), - } - -commands.inferrepo += " lfconvert"