Mercurial > hg
comparison hgext/blackbox.py @ 34276:b90bd9a98c8b
blackbox: set lastui even if ui.log is not called (issue5518)
`lastui` decides where (where is the `.hg`) to use if the current `ui`
object does not have a `_bbrepo` associated. Previously it only gets set in
`ui.log`, which means unless a `ui` with repo associated calls `log` with
tracked event, blackbox does not know where to write its log. This patch
makes `reposetup` set `lastui` so it so we could log some more events (see
test changes).
Differential Revision: https://phab.mercurial-scm.org/D655
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 18 Sep 2017 16:01:03 -0700 |
parents | 86a5df995880 |
children | b1d4ac068961 |
comparison
equal
deleted
inserted
replaced
34275:86a5df995880 | 34276:b90bd9a98c8b |
---|---|
190 if not repo.local(): | 190 if not repo.local(): |
191 return | 191 return |
192 | 192 |
193 if util.safehasattr(ui, 'setrepo'): | 193 if util.safehasattr(ui, 'setrepo'): |
194 ui.setrepo(repo) | 194 ui.setrepo(repo) |
195 | |
196 # Set lastui even if ui.log is not called. This gives blackbox a | |
197 # fallback place to log. | |
198 global lastui | |
199 if lastui is None: | |
200 lastui = ui | |
201 | |
195 repo._wlockfreeprefix.add('blackbox.log') | 202 repo._wlockfreeprefix.add('blackbox.log') |
196 | 203 |
197 @command('^blackbox', | 204 @command('^blackbox', |
198 [('l', 'limit', 10, _('the number of events to show')), | 205 [('l', 'limit', 10, _('the number of events to show')), |
199 ], | 206 ], |