--- a/mercurial/dispatch.py Fri Sep 04 11:30:38 2015 -0400
+++ b/mercurial/dispatch.py Tue Sep 08 11:39:52 2015 -0700
@@ -1023,7 +1023,10 @@
output = ui.config('profiling', 'output')
- if output:
+ if output == 'blackbox':
+ import StringIO
+ fp = StringIO.StringIO()
+ elif output:
path = ui.expandpath(output)
fp = open(path, 'wb')
else:
@@ -1038,6 +1041,12 @@
return statprofile(ui, checkargs, fp)
finally:
if output:
+ 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.
+ val = val.replace('%', '%%')
+ ui.log('profile', val)
fp.close()
else:
return checkargs()