##// 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 tmpl.show(ctx)
48 tmpl.show(ctx)
49 return ui.popbuffer()
49 return ui.popbuffer()
50
50
51 state = {'count': 0, 'pct': 0}
51 state = {'count': 0}
52 rate = {}
52 rate = {}
53 df = False
53 df = False
54 if opts.get('date'):
54 if opts.get('date'):
@@ -74,20 +74,13 b' def countrate(ui, repo, amap, *pats, **o'
74 lines = changedlines(ui, repo, ctx1, ctx, fns)
74 lines = changedlines(ui, repo, ctx1, ctx, fns)
75 rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
75 rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
76
76
77 if opts.get('progress'):
77 state['count'] += 1
78 state['count'] += 1
78 ui.progress(_('churning changes'), state['count'], total=len(repo))
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()
84
79
85 for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
80 for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
86 continue
81 continue
87
82
88 if opts.get('progress'):
83 ui.progress(_('churning changes'), None)
89 ui.write("\r")
90 sys.stdout.flush()
91
84
92 return rate
85 return rate
93
86
@@ -188,6 +181,6 b' cmdtable = {'
188 ('s', 'sort', False, _('sort by key (default: sort by count)')),
181 ('s', 'sort', False, _('sort by key (default: sort by count)')),
189 ('', 'diffstat', False, _('display added/removed lines separately')),
182 ('', 'diffstat', False, _('display added/removed lines separately')),
190 ('', 'aliases', '', _('file with email aliases')),
183 ('', 'aliases', '', _('file with email aliases')),
191 ('', 'progress', None, _('show progress'))],
184 ],
192 _("hg churn [-d DATE] [-r REV] [--aliases FILE] [--progress] [FILE]")),
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