D5381: remotefilelog: use progress helper in fileserverclient

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

AFFECTED FILES
  hgext/remotefilelog/fileserverclient.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py
--- a/hgext/remotefilelog/fileserverclient.py
+++ b/hgext/remotefilelog/fileserverclient.py
@@ -42,7 +42,6 @@
 fetchmisses = 0
 
 _lfsmod = None
-_downloading = _('downloading')
 
 def getcachekey(reponame, file, id):
     pathhash = node.hex(hashlib.sha1(file).digest())
@@ -332,7 +331,8 @@
         cache.request(request)
 
         total = count
-        self.ui.progress(_downloading, 0, total=count)
+        progress = self.ui.makeprogress(_('downloading'), total=count)
+        progress.update(0)
 
         missed = []
         count = 0
@@ -352,7 +352,7 @@
                 # receive progress reports
                 parts = missingid.split("_")
                 count += int(parts[2])
-                self.ui.progress(_downloading, count, total=total)
+                progress.update(count)
                 continue
 
             missed.append(missingid)
@@ -362,7 +362,7 @@
 
         count = [total - len(missed)]
         fromcache = count[0]
-        self.ui.progress(_downloading, count[0], total=total)
+        progress.update(count[0], total=total)
         self.ui.log("remotefilelog", "remote cache hit rate is %r of %r\n",
                     count[0], total, hit=count[0], total=total)
 
@@ -372,7 +372,7 @@
             if missed:
                 def progresstick():
                     count[0] += 1
-                    self.ui.progress(_downloading, count[0], total=total)
+                    progress.update(count[0])
                 # When verbose is true, sshpeer prints 'running ssh...'
                 # to stdout, which can interfere with some command
                 # outputs
@@ -427,7 +427,7 @@
                 request = "set\n%d\n%s\n" % (count[0], "\n".join(missed))
                 cache.request(request)
 
-            self.ui.progress(_downloading, None)
+            progress.complete()
 
             # mark ourselves as a user of this cache
             writedata.markrepo(self.repo.path)



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


More information about the Mercurial-devel mailing list