changeset 40844:4e08bbfc6d51

remotefilelog: use progress helper in shallowbundle Differential Revision: https://phab.mercurial-scm.org/D5379
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 04 Dec 2018 16:31:04 -0800
parents b80915b52476
children b6a6dc1a14bd
files hgext/remotefilelog/shallowbundle.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/shallowbundle.py	Tue Dec 04 16:29:05 2018 -0800
+++ b/hgext/remotefilelog/shallowbundle.py	Tue Dec 04 16:31:04 2018 -0800
@@ -171,7 +171,6 @@
     if not shallowutil.isenabled(repo):
         return orig(repo, source, revmap, trp, expectedfiles, *args)
 
-    files = 0
     newfiles = 0
     visited = set()
     revisiondatas = {}
@@ -184,14 +183,14 @@
     # files in topological order.
 
     # read all the file chunks but don't add them
+    progress = repo.ui.makeprogress(_('files'), total=expectedfiles)
     while True:
         chunkdata = source.filelogheader()
         if not chunkdata:
             break
-        files += 1
         f = chunkdata["filename"]
         repo.ui.debug("adding %s revisions\n" % f)
-        repo.ui.progress(_('files'), files, total=expectedfiles)
+        progress.increment()
 
         if not repo.shallowmatch(f):
             fl = repo.file(f)
@@ -289,6 +288,6 @@
         processed.add((f, node))
         skipcount = 0
 
-    repo.ui.progress(_('files'), None)
+    progress.complete()
 
     return len(revisiondatas), newfiles