Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG901f6ef670ca: debugbuildannotatecache: use progress helper
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/fastannotate/commands.py (6 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Dec 4 2018, 6:57 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 |
| paths = list(ctx.walk(m)) | paths = list(ctx.walk(m)) | ||||
| if util.safehasattr(repo, 'prefetchfastannotate'): | if util.safehasattr(repo, 'prefetchfastannotate'): | ||||
| # client | # client | ||||
| if opts.get('REV'): | if opts.get('REV'): | ||||
| raise error.Abort(_('--rev cannot be used for client')) | raise error.Abort(_('--rev cannot be used for client')) | ||||
| repo.prefetchfastannotate(paths) | repo.prefetchfastannotate(paths) | ||||
| else: | else: | ||||
| # server, or full repo | # server, or full repo | ||||
| progress = ui.makeprogress(_('building'), total=len(paths)) | |||||
| for i, path in enumerate(paths): | for i, path in enumerate(paths): | ||||
| ui.progress(_('building'), i, total=len(paths)) | progress.update(i) | ||||
| with facontext.annotatecontext(repo, path) as actx: | with facontext.annotatecontext(repo, path) as actx: | ||||
| try: | try: | ||||
| if actx.isuptodate(rev): | if actx.isuptodate(rev): | ||||
| continue | continue | ||||
| actx.annotate(rev, rev) | actx.annotate(rev, rev) | ||||
| except (faerror.CannotReuseError, faerror.CorruptedFileError): | except (faerror.CannotReuseError, faerror.CorruptedFileError): | ||||
| # the cache is broken (could happen with renaming so the | # the cache is broken (could happen with renaming so the | ||||
| # file history gets invalidated). rebuild and try again. | # file history gets invalidated). rebuild and try again. | ||||
| ui.debug('fastannotate: %s: rebuilding broken cache\n' | ui.debug('fastannotate: %s: rebuilding broken cache\n' | ||||
| % path) | % path) | ||||
| actx.rebuild() | actx.rebuild() | ||||
| try: | try: | ||||
| actx.annotate(rev, rev) | actx.annotate(rev, rev) | ||||
| except Exception as ex: | except Exception as ex: | ||||
| # possibly a bug, but should not stop us from building | # possibly a bug, but should not stop us from building | ||||
| # cache for other files. | # cache for other files. | ||||
| ui.warn(_('fastannotate: %s: failed to ' | ui.warn(_('fastannotate: %s: failed to ' | ||||
| 'build cache: %r\n') % (path, ex)) | 'build cache: %r\n') % (path, ex)) | ||||
| # clear the progress bar | progress.complete() | ||||
| ui.write() | |||||