# HG changeset patch # User Nicolas Dumazet # Date 1238655690 -32400 # Node ID fd9debb3ea1b27a43f6129a4add09f8bad1ee4e5 # Parent 4f3fdfaa38740ce3188f95e012888fcca9b16fa5 profiling: Adding a profiling.format config variable Allows defining other output formats for profiling. If an invalid format is given, output a warning and ignore it. For now, only the standard 'text' value is supported. diff -r 4f3fdfaa3874 -r fd9debb3ea1b doc/hgrc.5.txt --- a/doc/hgrc.5.txt Wed Apr 08 14:19:41 2009 +0200 +++ b/doc/hgrc.5.txt Thu Apr 02 16:01:30 2009 +0900 @@ -545,6 +545,13 @@ collected during profiling, while 'profiling report' stands for a statistical text report generated from the profiling data. The profiling is done using lsprof. + format;; + Profiling format. + Default: text. + text;; + Generate a profiling report. + When saving to a file, it should be noted that only the report is saved, + and the profiling data is not kept. output;; File path where profiling data or report should be saved. If the file exists, it is replaced. diff -r 4f3fdfaa3874 -r fd9debb3ea1b mercurial/dispatch.py --- a/mercurial/dispatch.py Wed Apr 08 14:19:41 2009 +0200 +++ b/mercurial/dispatch.py Thu Apr 02 16:01:30 2009 +0900 @@ -379,6 +379,13 @@ raise error.ParseError(cmd, _("invalid arguments")) if options['profile']: + format = ui.config('profiling', 'format', default='text') + + if not format in ['text']: + ui.warn(_("unrecognized profiling format '%s'" + " - Ignored\n") % format) + format = 'text' + output = ui.config('profiling', 'output') if output: diff -r 4f3fdfaa3874 -r fd9debb3ea1b tests/test-profile --- a/tests/test-profile Wed Apr 08 14:19:41 2009 +0200 +++ b/tests/test-profile Thu Apr 02 16:01:30 2009 +0900 @@ -15,4 +15,7 @@ || echo --profile + output to file failed grep CallCount < ../out > /dev/null \ || echo wrong --profile output when saving to a file + + hg --profile --config profiling.format=text st 2>&1 \ + | grep CallCount > /dev/null || echo --profile format=text failed fi