D3795: repair: use progress helper

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 18 17:15:16 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3795

AFFECTED FILES
  mercurial/repair.py

CHANGE DETAILS

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -355,10 +355,10 @@
         newentries = set()
         seenfiles = set()
 
-        repolen = len(repo)
+        progress = ui.makeprogress(_('rebuilding'), unit=_('changesets'),
+                                   total=len(repo))
         for rev in repo:
-            ui.progress(_('rebuilding'), rev, total=repolen,
-                        unit=_('changesets'))
+            progress.update(rev)
 
             ctx = repo[rev]
             for f in ctx.files():
@@ -375,7 +375,7 @@
                 if repo.store._exists(d):
                     newentries.add(d)
 
-        ui.progress(_('rebuilding'), None)
+        progress.complete()
 
         if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
             for dir in util.dirs(seenfiles):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list