##// END OF EJS Templates
churn: use ui.progress instead of --progress
Eric Eisner -
r10647:4ba41eeb default
parent child Browse files
Show More
@@ -48,7 +48,7 b' def countrate(ui, repo, amap, *pats, **o'
48 48 tmpl.show(ctx)
49 49 return ui.popbuffer()
50 50
51 state = {'count': 0, 'pct': 0}
51 state = {'count': 0}
52 52 rate = {}
53 53 df = False
54 54 if opts.get('date'):
@@ -74,20 +74,13 b' def countrate(ui, repo, amap, *pats, **o'
74 74 lines = changedlines(ui, repo, ctx1, ctx, fns)
75 75 rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
76 76
77 if opts.get('progress'):
78 state['count'] += 1
79 newpct = int(100.0 * state['count'] / max(len(repo), 1))
80 if state['pct'] < newpct:
81 state['pct'] = newpct
82 ui.write("\r" + _("generating stats: %d%%") % state['pct'])
83 sys.stdout.flush()
77 state['count'] += 1
78 ui.progress(_('churning changes'), state['count'], total=len(repo))
84 79
85 80 for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
86 81 continue
87 82
88 if opts.get('progress'):
89 ui.write("\r")
90 sys.stdout.flush()
83 ui.progress(_('churning changes'), None)
91 84
92 85 return rate
93 86
@@ -188,6 +181,6 b' cmdtable = {'
188 181 ('s', 'sort', False, _('sort by key (default: sort by count)')),
189 182 ('', 'diffstat', False, _('display added/removed lines separately')),
190 183 ('', 'aliases', '', _('file with email aliases')),
191 ('', 'progress', None, _('show progress'))],
192 _("hg churn [-d DATE] [-r REV] [--aliases FILE] [--progress] [FILE]")),
184 ],
185 _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")),
193 186 }
General Comments 0
You need to be logged in to leave comments. Login now