##// END OF EJS Templates
remotefilelog: use progress helper in basestore...
Martin von Zweigbergk -
r40876:ad21fbcb default
parent child Browse files
Show More
@@ -77,14 +77,15 b' class basestore(object):'
77 77 ui = self.ui
78 78 entries = ledger.sources.get(self, [])
79 79 count = 0
80 progress = ui.makeprogress(_("cleaning up"), unit="files",
81 total=len(entries))
80 82 for entry in entries:
81 83 if entry.gced or (entry.datarepacked and entry.historyrepacked):
82 ui.progress(_("cleaning up"), count, unit="files",
83 total=len(entries))
84 progress.update(count)
84 85 path = self._getfilepath(entry.filename, entry.node)
85 86 util.tryunlink(path)
86 87 count += 1
87 ui.progress(_("cleaning up"), None)
88 progress.complete()
88 89
89 90 # Clean up the repo cache directory.
90 91 self._cleanupdirectory(self._getrepocachepath())
@@ -302,8 +303,6 b' class basestore(object):'
302 303 def gc(self, keepkeys):
303 304 ui = self.ui
304 305 cachepath = self._path
305 _removing = _("removing unnecessary files")
306 _truncating = _("enforcing cache limit")
307 306
308 307 # prune cache
309 308 import Queue
@@ -316,7 +315,9 b' class basestore(object):'
316 315 # keep files newer than a day even if they aren't needed
317 316 limit = time.time() - (60 * 60 * 24)
318 317
319 ui.progress(_removing, count, unit="files")
318 progress = ui.makeprogress(_("removing unnecessary files"),
319 unit="files")
320 progress.update(0)
320 321 for root, dirs, files in os.walk(cachepath):
321 322 for file in files:
322 323 if file == 'repos':
@@ -326,7 +327,7 b' class basestore(object):'
326 327 if '/packs/' in root:
327 328 continue
328 329
329 ui.progress(_removing, count, unit="files")
330 progress.update(count)
330 331 path = os.path.join(root, file)
331 332 key = os.path.relpath(path, cachepath)
332 333 count += 1
@@ -357,16 +358,17 b' class basestore(object):'
357 358 ui.warn(msg % path)
358 359 continue
359 360 removed += 1
360 ui.progress(_removing, None)
361 progress.complete()
361 362
362 363 # remove oldest files until under limit
363 364 limit = ui.configbytes("remotefilelog", "cachelimit")
364 365 if size > limit:
365 366 excess = size - limit
367 progress = ui.makeprogress(_("enforcing cache limit"), unit="bytes",
368 total=excess)
366 369 removedexcess = 0
367 370 while queue and size > limit and size > 0:
368 ui.progress(_truncating, removedexcess, unit="bytes",
369 total=excess)
371 progress.update(removedexcess)
370 372 atime, oldpath, oldpathstat = queue.get()
371 373 try:
372 374 shallowutil.unlinkfile(oldpath)
@@ -379,7 +381,7 b' class basestore(object):'
379 381 size -= oldpathstat.st_size
380 382 removed += 1
381 383 removedexcess += oldpathstat.st_size
382 ui.progress(_truncating, None)
384 progress.complete()
383 385
384 386 ui.status(_("finished: removed %s of %s files (%0.2f GB to %0.2f GB)\n")
385 387 % (removed, count,
General Comments 0
You need to be logged in to leave comments. Login now