Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGfbd053af2eda: remotefilelog: use progress helper in remotefilelogserver
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/remotefilelog/remotefilelogserver.py (10 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Dec 4 2018, 7:23 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| for filename, filenode in mf.iteritems(): | for filename, filenode in mf.iteritems(): | ||||
| filecachepath = os.path.join(cachepath, filename, hex(filenode)) | filecachepath = os.path.join(cachepath, filename, hex(filenode)) | ||||
| neededfiles.add(filecachepath) | neededfiles.add(filecachepath) | ||||
| # delete unneeded older files | # delete unneeded older files | ||||
| days = repo.ui.configint("remotefilelog", "serverexpiration") | days = repo.ui.configint("remotefilelog", "serverexpiration") | ||||
| expiration = time.time() - (days * 24 * 60 * 60) | expiration = time.time() - (days * 24 * 60 * 60) | ||||
| _removing = _("removing old server cache") | progress = ui.makeprogress(_("removing old server cache"), unit="files") | ||||
| count = 0 | progress.update(0) | ||||
| ui.progress(_removing, count, unit="files") | |||||
| for root, dirs, files in os.walk(cachepath): | for root, dirs, files in os.walk(cachepath): | ||||
| for file in files: | for file in files: | ||||
| filepath = os.path.join(root, file) | filepath = os.path.join(root, file) | ||||
| count += 1 | progress.increment() | ||||
| ui.progress(_removing, count, unit="files") | |||||
| if filepath in neededfiles: | if filepath in neededfiles: | ||||
| continue | continue | ||||
| stat = os.stat(filepath) | stat = os.stat(filepath) | ||||
| if stat.st_mtime < expiration: | if stat.st_mtime < expiration: | ||||
| os.remove(filepath) | os.remove(filepath) | ||||
| ui.progress(_removing, None) | progress.complete() | ||||