changeset 38401:5c0f06a8b497

churn: use progess helper Differential Revision: https://phab.mercurial-scm.org/D3802
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 18 Jun 2018 14:29:08 -0700
parents 2f5c622fcb73
children 457fa4056286
files hgext/churn.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/churn.py	Sun Jun 17 23:54:58 2018 -0700
+++ b/hgext/churn.py	Mon Jun 18 14:29:08 2018 -0700
@@ -61,7 +61,8 @@
             tmpl.show(ctx)
             return ui.popbuffer()
 
-    state = {'count': 0}
+    progress = ui.makeprogress(_('analyzing'), unit=_('revisions'),
+                               total=len(repo))
     rate = {}
     df = False
     if opts.get('date'):
@@ -87,14 +88,12 @@
             lines = changedlines(ui, repo, ctx1, ctx, fns)
             rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
 
-        state['count'] += 1
-        ui.progress(_('analyzing'), state['count'], total=len(repo),
-                    unit=_('revisions'))
+        progress.increment()
 
     for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
         continue
 
-    ui.progress(_('analyzing'), None)
+    progress.complete()
 
     return rate