Mercurial > public > mercurial-scm > hg
diff hgext/churn.py @ 9662:f3d60543924f
walkchangerevs: move 'add' to callback
Now walkchangerevs is a simple iterator over contexts
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 29 Oct 2009 17:07:51 -0500 |
parents | 6d7d3f849062 |
children | 1de5ebfa5585 |
line wrap: on
line diff
--- a/hgext/churn.py Wed Oct 28 23:59:18 2009 +0900 +++ b/hgext/churn.py Thu Oct 29 17:07:51 2009 -0500 @@ -54,13 +54,10 @@ df = util.matchdate(opts['date']) m = cmdutil.match(repo, pats, opts) - for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, m, opts): - if not st == 'add': - continue - + def prep(ctx, fns): rev = ctx.rev() if df and not df(ctx.date()[0]): # doesn't match date format - continue + return key = getkey(ctx) key = amap.get(key, key) # alias remap @@ -70,7 +67,7 @@ parents = ctx.parents() if len(parents) > 1: ui.note(_('Revision %d is a merge, ignoring...\n') % (rev,)) - continue + return ctx1 = parents[0] lines = changedlines(ui, repo, ctx1, ctx, fns) @@ -84,6 +81,9 @@ ui.write("\r" + _("generating stats: %d%%") % pct) sys.stdout.flush() + for ctx in cmdutil.walkchangerevs(ui, repo, m, opts, prep): + continue + if opts.get('progress'): ui.write("\r") sys.stdout.flush()