Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG8da20fc9fc07: fastannotate: move some global state mutation to extsetup()
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| indygreg |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/fastannotate/__init__.py (4 lines) | |||
| M | hgext/fastannotate/protocol.py (2 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Augie Fackler | Aug 9 2018, 3:08 PM |
| # | # | ||||
| # * replace the fastannotate `modes` configuration with a collection | # * replace the fastannotate `modes` configuration with a collection | ||||
| # of booleans. | # of booleans. | ||||
| # | # | ||||
| # * Use the templater instead of bespoke formatting | # * Use the templater instead of bespoke formatting | ||||
| # | # | ||||
| # * rename the config knob for updating the local cache from a remote server | # * rename the config knob for updating the local cache from a remote server | ||||
| # | # | ||||
| # * move various global-setup bits to extsetup() or reposetup() | |||||
| # | |||||
| # * move `flock` based locking to a common area | # * move `flock` based locking to a common area | ||||
| # | # | ||||
| # * revise wireprotocol for sharing annotate files | # * revise wireprotocol for sharing annotate files | ||||
| # | # | ||||
| # * figure out a sensible default for `mainbranch` (with the caveat | # * figure out a sensible default for `mainbranch` (with the caveat | ||||
| # that we probably also want to figure out a better term than | # that we probably also want to figure out a better term than | ||||
| # `branch`, see above) | # `branch`, see above) | ||||
| # | # | ||||
| raise hgerror.Abort(_('fastannotate: invalid mode: %s') % name) | raise hgerror.Abort(_('fastannotate: invalid mode: %s') % name) | ||||
| if ui.configbool('fastannotate', 'server'): | if ui.configbool('fastannotate', 'server'): | ||||
| protocol.serveruisetup(ui) | protocol.serveruisetup(ui) | ||||
| if ui.configbool('fastannotate', 'useflock', _flockavailable()): | if ui.configbool('fastannotate', 'useflock', _flockavailable()): | ||||
| context.pathhelper.lock = context.pathhelper._lockflock | context.pathhelper.lock = context.pathhelper._lockflock | ||||
| def extsetup(ui): | |||||
| # fastannotate has its own locking, without depending on repo lock | # fastannotate has its own locking, without depending on repo lock | ||||
| # TODO: avoid mutating this unless the specific repo has it enabled | |||||
| localrepo.localrepository._wlockfreeprefix.add('fastannotate/') | localrepo.localrepository._wlockfreeprefix.add('fastannotate/') | ||||
| def reposetup(ui, repo): | def reposetup(ui, repo): | ||||
| if ui.configbool('fastannotate', 'client'): | if ui.configbool('fastannotate', 'client'): | ||||
| protocol.clientreposetup(ui, repo) | protocol.clientreposetup(ui, repo) | ||||
| # could be directory not writable or so, not fatal | # could be directory not writable or so, not fatal | ||||
| self.ui.debug('fastannotate: prefetch failed: %r\n' % ex) | self.ui.debug('fastannotate: prefetch failed: %r\n' % ex) | ||||
| repo.__class__ = fastannotaterepo | repo.__class__ = fastannotaterepo | ||||
| def clientreposetup(ui, repo): | def clientreposetup(ui, repo): | ||||
| _registerwireprotocommand() | _registerwireprotocommand() | ||||
| if isinstance(repo, localrepo.localrepository): | if isinstance(repo, localrepo.localrepository): | ||||
| localreposetup(ui, repo) | localreposetup(ui, repo) | ||||
| # TODO: this mutates global state, but only if at least one repo | |||||
| # has the extension enabled. This is probably bad for hgweb. | |||||
| if peersetup not in hg.wirepeersetupfuncs: | if peersetup not in hg.wirepeersetupfuncs: | ||||
| hg.wirepeersetupfuncs.append(peersetup) | hg.wirepeersetupfuncs.append(peersetup) | ||||