Mercurial > hg
changeset 21242:4c94229c51fb
largefiles: declare commands using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 21:09:06 -0700 |
parents | 244b177a152e |
children | 8b5c039f2b4f |
files | hgext/largefiles/lfcommands.py |
diffstat | 1 files changed, 16 insertions(+), 21 deletions(-) [+] |
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"