diff hgext/blackbox.py @ 34283: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
line wrap: on
line diff
--- a/hgext/blackbox.py	Wed Sep 06 21:23:38 2017 -0700
+++ b/hgext/blackbox.py	Mon Sep 18 16:01:03 2017 -0700
@@ -192,6 +192,13 @@
 
     if util.safehasattr(ui, 'setrepo'):
         ui.setrepo(repo)
+
+        # Set lastui even if ui.log is not called. This gives blackbox a
+        # fallback place to log.
+        global lastui
+        if lastui is None:
+            lastui = ui
+
     repo._wlockfreeprefix.add('blackbox.log')
 
 @command('^blackbox',