remotefilelog: use progress helper in remotefilelogserver
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 04 Dec 2018 16:23:00 -0800
changeset 53607 fbd053af2eda078a0f53aea5af86db1b438da375
parent 53606 ad21fbcb1ba5c819925b1c17c9137ec2ad725381
child 53608 b80915b524768563caac2516a5576723208c4c6e
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
remotefilelog: use progress helper in remotefilelogserver Differential Revision: https://phab.mercurial-scm.org/D5377
hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -383,24 +383,22 @@ def gcserver(ui, repo):
         for filename, filenode in mf.iteritems():
             filecachepath = os.path.join(cachepath, filename, hex(filenode))
             neededfiles.add(filecachepath)
 
     # delete unneeded older files
     days = repo.ui.configint("remotefilelog", "serverexpiration")
     expiration = time.time() - (days * 24 * 60 * 60)
 
-    _removing = _("removing old server cache")
-    count = 0
-    ui.progress(_removing, count, unit="files")
+    progress = ui.makeprogress(_("removing old server cache"), unit="files")
+    progress.update(0)
     for root, dirs, files in os.walk(cachepath):
         for file in files:
             filepath = os.path.join(root, file)
-            count += 1
-            ui.progress(_removing, count, unit="files")
+            progress.increment()
             if filepath in neededfiles:
                 continue
 
             stat = os.stat(filepath)
             if stat.st_mtime < expiration:
                 os.remove(filepath)
 
-    ui.progress(_removing, None)
+    progress.complete()