Mercurial > hg-stable
changeset 14310:c16ec14d44b6
purge: use cmdutil.command decorator
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Thu, 12 May 2011 20:14:42 +0200 |
parents | 37e80214badf |
children | 9bbac962f4dd |
files | hgext/purge.py |
diffstat | 1 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/purge.py Thu May 12 18:27:05 2011 +0200 +++ b/hgext/purge.py Thu May 12 20:14:42 2011 +0200 @@ -29,6 +29,17 @@ from mercurial.i18n import _ import os, stat +cmdtable = {} +command = cmdutil.command(cmdtable) + +@command('purge|clean', + [('a', 'abort-on-err', None, _('abort if an error occurs')), + ('', 'all', None, _('purge ignored files too')), + ('p', 'print', None, _('print filenames instead of deleting them')), + ('0', 'print0', None, _('end filenames with NUL, for use with xargs' + ' (implies -p/--print)')), + ] + commands.walkopts, + _('hg purge [OPTION]... [DIR]...')) def purge(ui, repo, *dirs, **opts): '''removes files not tracked by Mercurial @@ -97,15 +108,3 @@ if match(f) and not os.listdir(repo.wjoin(f)): ui.note(_('Removing directory %s\n') % f) remove(os.rmdir, f) - -cmdtable = { - 'purge|clean': - (purge, - [('a', 'abort-on-err', None, _('abort if an error occurs')), - ('', 'all', None, _('purge ignored files too')), - ('p', 'print', None, _('print filenames instead of deleting them')), - ('0', 'print0', None, _('end filenames with NUL, for use with xargs' - ' (implies -p/--print)')), - ] + commands.walkopts, - _('hg purge [OPTION]... [DIR]...')) -}