Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG05afb32e9380: remotefilelog: use progress helper when analyzing repos
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/__init__.py (8 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Dec 4 2018, 7:02 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 |
reposfile = open(repospath, 'r') | reposfile = open(repospath, 'r') | ||||
repos = set([r[:-1] for r in reposfile.readlines()]) | repos = set([r[:-1] for r in reposfile.readlines()]) | ||||
reposfile.close() | reposfile.close() | ||||
# build list of useful files | # build list of useful files | ||||
validrepos = [] | validrepos = [] | ||||
keepkeys = set() | keepkeys = set() | ||||
_analyzing = _("analyzing repositories") | |||||
sharedcache = None | sharedcache = None | ||||
filesrepacked = False | filesrepacked = False | ||||
count = 0 | count = 0 | ||||
progress = ui.makeprogress(_("analyzing repositories"), unit="repos", | |||||
total=len(repos)) | |||||
for path in repos: | for path in repos: | ||||
ui.progress(_analyzing, count, unit="repos", total=len(repos)) | progress.update(count) | ||||
count += 1 | count += 1 | ||||
try: | try: | ||||
path = ui.expandpath(os.path.normpath(path)) | path = ui.expandpath(os.path.normpath(path)) | ||||
except TypeError as e: | except TypeError as e: | ||||
ui.warn(_("warning: malformed path: %r:%s\n") % (path, e)) | ui.warn(_("warning: malformed path: %r:%s\n") % (path, e)) | ||||
traceback.print_exc() | traceback.print_exc() | ||||
continue | continue | ||||
try: | try: | ||||
if not sharedcache: | if not sharedcache: | ||||
sharedcache = repo.sharedstore | sharedcache = repo.sharedstore | ||||
# Compute a keepset which is not garbage collected | # Compute a keepset which is not garbage collected | ||||
def keyfn(fname, fnode): | def keyfn(fname, fnode): | ||||
return fileserverclient.getcachekey(reponame, fname, hex(fnode)) | return fileserverclient.getcachekey(reponame, fname, hex(fnode)) | ||||
keepkeys = repackmod.keepset(repo, keyfn=keyfn, lastkeepkeys=keepkeys) | keepkeys = repackmod.keepset(repo, keyfn=keyfn, lastkeepkeys=keepkeys) | ||||
ui.progress(_analyzing, None) | progress.complete() | ||||
# write list of valid repos back | # write list of valid repos back | ||||
oldumask = os.umask(0o002) | oldumask = os.umask(0o002) | ||||
try: | try: | ||||
reposfile = open(repospath, 'w') | reposfile = open(repospath, 'w') | ||||
reposfile.writelines([("%s\n" % r) for r in validrepos]) | reposfile.writelines([("%s\n" % r) for r in validrepos]) | ||||
reposfile.close() | reposfile.close() | ||||
finally: | finally: |