# HG changeset patch # User Adrian Buehlmann # Date 1305224082 -7200 # Node ID c16ec14d44b6add94982727b541b218480a64cd0 # Parent 37e80214badf1d9965cc39653970c6d75b3afac6 purge: use cmdutil.command decorator diff -r 37e80214badf -r c16ec14d44b6 hgext/purge.py --- 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]...')) -}