# HG changeset patch # User Adrian Buehlmann # Date 2011-05-12 18:14:42 # Node ID c16ec14d44b6add94982727b541b218480a64cd0 # Parent 37e80214badf1d9965cc39653970c6d75b3afac6 purge: use cmdutil.command decorator diff --git a/hgext/purge.py b/hgext/purge.py --- a/hgext/purge.py +++ b/hgext/purge.py @@ -29,6 +29,17 @@ from mercurial import util, commands, cm 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 @@ def purge(ui, repo, *dirs, **opts): 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]...')) -}