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

Augie Fackler raf at durin42.com
Tue Mar 1 13:40:14 EST 2016


On Tue, Mar 01, 2016 at 05:51:45AM -0600, timeless wrote:
> # 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

I've taken the first three patches, but I'm not entirely sure the last
three feel right. I'll let someone else look at those.

>
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list