Mercurial > hg
changeset 3046:2a4d4aecb2b4
Merge with Brendan Cully
author | Josef "Jeff" Sipek <jeff@josefsipek.net> |
---|---|
date | Sat, 19 Aug 2006 15:20:54 -0400 |
parents | c0be8990e819 (diff) a10adb6a9c9c (current diff) |
children | fcadf7a32425 |
files | hgext/churn.py |
diffstat | 1 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/churn.py Sat Aug 19 14:47:31 2006 -0400 +++ b/hgext/churn.py Sat Aug 19 15:20:54 2006 -0400 @@ -12,6 +12,7 @@ # <alias email> <actual email> from mercurial.demandload import * +from mercurial.i18n import gettext as _ demandload(globals(), 'time sys signal os') demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util,templater') @@ -69,12 +70,15 @@ return (who, lines) -def gather_stats(ui, repo, amap): +def gather_stats(ui, repo, amap, revs=None): stats = {} cl = repo.changelog - for rev in range(0,cl.count()): + if not revs: + revs = range(0, cl.count()) + + for rev in revs: node2 = cl.node(rev) node1 = cl.parents(node2)[0] @@ -93,7 +97,7 @@ return stats -def churn(ui, repo, aliases): +def churn(ui, repo, **opts): "Graphs the number of lines changed" def pad(s, l): @@ -117,6 +121,7 @@ return aliases amap = {} + aliases = opts.get('aliases') if aliases: try: f = open(aliases,"r") @@ -126,8 +131,10 @@ amap = get_aliases(f) f.close() - - stats = gather_stats(ui, repo, amap) + + revs = [int(r) for r in commands.revrange(ui, repo, opts['rev'])] + revs.sort() + stats = gather_stats(ui, repo, amap, revs) # make a list of tuples (name, lines) and sort it in descending order ordered = stats.items() @@ -147,10 +154,7 @@ cmdtable = { "churn": (churn, - [('', 'aliases', '', 'file with email aliases')], - 'hg churn [-a file]'), + [('r', 'rev', [], _('limit statistics to the specified revisions')), + ('', 'aliases', '', _('file with email aliases'))], + 'hg churn [-r revision range] [-a file]'), } - -def reposetup(ui, repo): - pass -