[PATCH 3 of 6] blackbox: optionally log event source

timeless timeless at mozdev.org
Tue Mar 1 06:51:45 EST 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1455219506 0
#      Thu Feb 11 19:38:26 2016 +0000
# Node ID c30da8f7af8b18641911c972197e69a2a2aa46d8
# Parent  e19277557090548ed21a72c7984e24e5c25e4669
blackbox: optionally log event source

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -18,6 +18,8 @@
   # dirty is *EXPENSIVE* (slow);
   # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
   dirty = True
+  # record the source of log messages
+  logsource = True
 
   [blackbox]
   track = command, commandfinish, commandexception, exthook, pythonhook
@@ -174,9 +176,13 @@
                         any(ctx.sub(s).dirty() for s in ctx.substate)
                     )):
                         changed = '+'
+                if ui.configbool('blackbox', 'logsource', False):
+                    src = ' [%s]' % event
+                else:
+                    src = ''
                 try:
-                    ui._bbwrite('%s %s @%s%s (%s)> %s',
-                        date, user, rev, changed, pid, formattedmsg)
+                    ui._bbwrite('%s %s @%s%s (%s)%s> %s',
+                        date, user, rev, changed, pid, src, formattedmsg)
                 except IOError as err:
                     self.debug('warning: cannot write to blackbox.log: %s\n' %
                                err.strerror)


More information about the Mercurial-devel mailing list