changeset 40846:e58cd7ede1c3

remotefilelog: use progress helper in fileserverclient Differential Revision: https://phab.mercurial-scm.org/D5381
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 05 Dec 2018 09:30:01 -0800
parents b6a6dc1a14bd
children b34b1b865ef9
files hgext/remotefilelog/fileserverclient.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/fileserverclient.py	Tue Dec 04 16:32:59 2018 -0800
+++ b/hgext/remotefilelog/fileserverclient.py	Wed Dec 05 09:30:01 2018 -0800
@@ -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)