changeset 38382:daa08d45740f

changegroup: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3783
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 23:06:20 -0700
parents 1a2ff11e8a88
children 23dc901cdf13
files mercurial/changegroup.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)