changegroup: use progress helper
authorMartin von Zweigbergk <martinvonz@google.com>
Sun, 17 Jun 2018 23:06:20 -0700
changeset 38382 daa08d45740f
parent 38381 1a2ff11e8a88
child 38383 23dc901cdf13
changegroup: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3783
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Sun Jun 17 23:00:59 2018 -0700
+++ b/mercurial/changegroup.py	Sun Jun 17 23:06:20 2018 -0700
@@ -975,12 +975,13 @@
 def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
     revisions = 0
     files = 0
+    progress = repo.ui.makeprogress(_('files'), unit=_('files'),
+                                    total=expectedfiles)
     for chunkdata in iter(source.filelogheader, {}):
         files += 1
         f = chunkdata["filename"]
         repo.ui.debug("adding %s revisions\n" % f)
-        repo.ui.progress(_('files'), files, unit=_('files'),
-                         total=expectedfiles)
+        progress.increment()
         fl = repo.file(f)
         o = len(fl)
         try:
@@ -1001,7 +1002,7 @@
                         _("received spurious file revlog entry"))
             if not needs:
                 del needfiles[f]
-    repo.ui.progress(_('files'), None)
+    progress.complete()
 
     for f, needs in needfiles.iteritems():
         fl = repo.file(f)