Mercurial > hg
diff hgext/churn.py @ 21245:75c8720092ba
churn: declare command using decorator
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 21:46:24 -0700 |
parents | 9846b40d01e7 |
children | a57deb45c744 |
line wrap: on
line diff
--- a/hgext/churn.py Sun May 04 21:17:04 2014 -0700 +++ b/hgext/churn.py Sun May 04 21:46:24 2014 -0700 @@ -14,6 +14,8 @@ import os import time, datetime +cmdtable = {} +command = cmdutil.command(cmdtable) testedwith = 'internal' def maketemplater(ui, repo, tmpl): @@ -88,6 +90,21 @@ return rate +@command('churn', + [('r', 'rev', [], + _('count rate for the specified revision or range'), _('REV')), + ('d', 'date', '', + _('count rate for revisions matching date spec'), _('DATE')), + ('t', 'template', '{author|email}', + _('template to group changesets'), _('TEMPLATE')), + ('f', 'dateformat', '', + _('strftime-compatible format for grouping by date'), _('FORMAT')), + ('c', 'changesets', False, _('count rate by number of changesets')), + ('s', 'sort', False, _('sort by key (default: sort by count)')), + ('', 'diffstat', False, _('display added/removed lines separately')), + ('', 'aliases', '', _('file with email aliases'), _('FILE')), + ] + commands.walkopts, + _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")) def churn(ui, repo, *pats, **opts): '''histogram of changes to the repository @@ -181,25 +198,4 @@ for name, count in rate: ui.write(format(name, count)) - -cmdtable = { - "churn": - (churn, - [('r', 'rev', [], - _('count rate for the specified revision or range'), _('REV')), - ('d', 'date', '', - _('count rate for revisions matching date spec'), _('DATE')), - ('t', 'template', '{author|email}', - _('template to group changesets'), _('TEMPLATE')), - ('f', 'dateformat', '', - _('strftime-compatible format for grouping by date'), _('FORMAT')), - ('c', 'changesets', False, _('count rate by number of changesets')), - ('s', 'sort', False, _('sort by key (default: sort by count)')), - ('', 'diffstat', False, _('display added/removed lines separately')), - ('', 'aliases', '', - _('file with email aliases'), _('FILE')), - ] + commands.walkopts, - _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")), -} - commands.inferrepo += " churn"