[PATCH V2] profiling: allow logging profile to the blackbox

Matt Mackall mpm at selenic.com
Wed Sep 9 13:04:24 CDT 2015


On Wed, 2015-09-09 at 16:18 +0000, Durham Goode wrote:
> >> +                if output == 'blackbox':
> >> +                    val = "Profile:\n%s" % fp.getvalue()
> >> +                    # ui.log treats the input as a format string,
> >> +                    # so we need to escape any % signs.
> >
> >Oh, I see. This is actually documented only in blackbox.py - should we
> >document that on ui.log itself as part of the API contract?
> >
> >(I'm happy to do that, it was just surprising.)
> 
> That sounds reasonable.  For some reason I thought this was the
> behavior for all of the ui.status/warn/note commands, but I guess I
> was wrong.  I think we did it this way because most users don't have
> the blackbox or any ui.log extensions enabled, so this avoids them
> having to do the string formatting.

Right, it's a tiny optimization.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list