remotefilelog: use progress helper in shallowrepo
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 04 Dec 2018 16:32:59 -0800
changeset 40845 b6a6dc1a14bd
parent 40844 4e08bbfc6d51
child 40846 e58cd7ede1c3
remotefilelog: use progress helper in shallowrepo Differential Revision: https://phab.mercurial-scm.org/D5380
hgext/remotefilelog/shallowrepo.py
--- a/hgext/remotefilelog/shallowrepo.py	Tue Dec 04 16:31:04 2018 -0800
+++ b/hgext/remotefilelog/shallowrepo.py	Tue Dec 04 16:32:59 2018 -0800
@@ -40,8 +40,6 @@
     from mercurial.utils import procutil
     _hgexecutable = procutil.hgexecutable
 
-_prefetching = _('prefetching')
-
 # These make*stores functions are global so that other extensions can replace
 # them.
 def makelocalstores(repo):
@@ -233,9 +231,9 @@
             serverfiles = skip.copy()
             visited = set()
             visited.add(nullrev)
-            revnum = 0
             revcount = len(revs)
-            self.ui.progress(_prefetching, revnum, total=revcount)
+            progress = self.ui.makeprogress(_('prefetching'), total=revcount)
+            progress.update(0)
             for rev in sorted(revs):
                 ctx = repo[rev]
                 if pats:
@@ -264,12 +262,11 @@
                     files.update(diff)
 
                 visited.add(mfrev)
-                revnum += 1
-                self.ui.progress(_prefetching, revnum, total=revcount)
+                progress.increment()
 
             files.difference_update(skip)
             serverfiles.difference_update(skip)
-            self.ui.progress(_prefetching, None)
+            progress.complete()
 
             # Fetch files known to be on the server
             if serverfiles: