[PATCH resend] churn: use ui.progress instead of --progress
Eric Eisner
ede at MIT.EDU
Thu Mar 11 08:22:03 CST 2010
# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1268316661 18000
# Node ID 4ba41eebb3a8560ee088cb4a171a5ff8e500a6d2
# Parent 63948e7d37f7b1381c5f683efd55e99408bb51a4
churn: use ui.progress instead of --progress
diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -48,7 +48,7 @@ def countrate(ui, repo, amap, *pats, **o
tmpl.show(ctx)
return ui.popbuffer()
- state = {'count': 0, 'pct': 0}
+ state = {'count': 0}
rate = {}
df = False
if opts.get('date'):
@@ -74,20 +74,13 @@ def countrate(ui, repo, amap, *pats, **o
lines = changedlines(ui, repo, ctx1, ctx, fns)
rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
- if opts.get('progress'):
- state['count'] += 1
- newpct = int(100.0 * state['count'] / max(len(repo), 1))
- if state['pct'] < newpct:
- state['pct'] = newpct
- ui.write("\r" + _("generating stats: %d%%") % state['pct'])
- sys.stdout.flush()
+ state['count'] += 1
+ ui.progress(_('churning changes'), state['count'], total=len(repo))
for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
continue
- if opts.get('progress'):
- ui.write("\r")
- sys.stdout.flush()
+ ui.progress(_('churning changes'), None)
return rate
@@ -188,6 +181,6 @@ cmdtable = {
('s', 'sort', False, _('sort by key (default: sort by count)')),
('', 'diffstat', False, _('display added/removed lines separately')),
('', 'aliases', '', _('file with email aliases')),
- ('', 'progress', None, _('show progress'))],
- _("hg churn [-d DATE] [-r REV] [--aliases FILE] [--progress] [FILE]")),
+ ],
+ _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")),
}
More information about the Mercurial-devel
mailing list