D5379: remotefilelog: use progress helper in shallowbundle

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Dec 5 17:39:56 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/D5379

AFFECTED FILES
  hgext/remotefilelog/shallowbundle.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowbundle.py b/hgext/remotefilelog/shallowbundle.py
--- a/hgext/remotefilelog/shallowbundle.py
+++ b/hgext/remotefilelog/shallowbundle.py
@@ -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



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


More information about the Mercurial-devel mailing list