changeset 40842:fbd053af2eda

remotefilelog: use progress helper in remotefilelogserver Differential Revision: https://phab.mercurial-scm.org/D5377
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 04 Dec 2018 16:23:00 -0800
parents ad21fbcb1ba5
children b80915b52476
files hgext/remotefilelog/remotefilelogserver.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/remotefilelogserver.py	Tue Dec 04 16:09:20 2018 -0800
+++ b/hgext/remotefilelog/remotefilelogserver.py	Tue Dec 04 16:23:00 2018 -0800
@@ -388,14 +388,12 @@
     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
 
@@ -403,4 +401,4 @@
             if stat.st_mtime < expiration:
                 os.remove(filepath)
 
-    ui.progress(_removing, None)
+    progress.complete()