Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG5c0f06a8b497: churn: use progess helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/churn.py (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 18 2018, 5:29 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | D3806 lfs: use progess helper | |
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
else: | else: | ||||
tmpl = opts.get('oldtemplate') or opts.get('template') | tmpl = opts.get('oldtemplate') or opts.get('template') | ||||
tmpl = logcmdutil.maketemplater(ui, repo, tmpl) | tmpl = logcmdutil.maketemplater(ui, repo, tmpl) | ||||
def getkey(ctx): | def getkey(ctx): | ||||
ui.pushbuffer() | ui.pushbuffer() | ||||
tmpl.show(ctx) | tmpl.show(ctx) | ||||
return ui.popbuffer() | return ui.popbuffer() | ||||
state = {'count': 0} | progress = ui.makeprogress(_('analyzing'), unit=_('revisions'), | ||||
total=len(repo)) | |||||
rate = {} | rate = {} | ||||
df = False | df = False | ||||
if opts.get('date'): | if opts.get('date'): | ||||
df = dateutil.matchdate(opts['date']) | df = dateutil.matchdate(opts['date']) | ||||
m = scmutil.match(repo[None], pats, opts) | m = scmutil.match(repo[None], pats, opts) | ||||
def prep(ctx, fns): | def prep(ctx, fns): | ||||
rev = ctx.rev() | rev = ctx.rev() | ||||
if len(parents) > 1: | if len(parents) > 1: | ||||
ui.note(_('revision %d is a merge, ignoring...\n') % (rev,)) | ui.note(_('revision %d is a merge, ignoring...\n') % (rev,)) | ||||
return | return | ||||
ctx1 = parents[0] | ctx1 = parents[0] | ||||
lines = changedlines(ui, repo, ctx1, ctx, fns) | lines = changedlines(ui, repo, ctx1, ctx, fns) | ||||
rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)] | rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)] | ||||
state['count'] += 1 | progress.increment() | ||||
ui.progress(_('analyzing'), state['count'], total=len(repo), | |||||
unit=_('revisions')) | |||||
for ctx in cmdutil.walkchangerevs(repo, m, opts, prep): | for ctx in cmdutil.walkchangerevs(repo, m, opts, prep): | ||||
continue | continue | ||||
ui.progress(_('analyzing'), None) | progress.complete() | ||||
return rate | return rate | ||||
@command('churn', | @command('churn', | ||||
[('r', 'rev', [], | [('r', 'rev', [], | ||||
_('count rate for the specified revision or revset'), _('REV')), | _('count rate for the specified revision or revset'), _('REV')), | ||||
('d', 'date', '', | ('d', 'date', '', |