72 |
72 |
73 ctx1 = parents[0] |
73 ctx1 = parents[0] |
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 |
94 |
87 |
95 def churn(ui, repo, *pats, **opts): |
88 def churn(ui, repo, *pats, **opts): |
186 _('strftime-compatible format for grouping by date')), |
179 _('strftime-compatible format for grouping by date')), |
187 ('c', 'changesets', False, _('count rate by number of changesets')), |
180 ('c', 'changesets', False, _('count rate by number of changesets')), |
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 } |