dispatch: set profiling.enabled when profiling is enabled
We do this for other global command arguments. We don't for --profile
for reasons that are unknown to me. Probably because nobody has needed
it.
An upcoming patch will introduce a new consumer of the profiling
code. It doesn't have access to command line arguments. So let's
set the config option during argument processing.
We also remove a check for "options['profile']" because it is now
redundant.
--- a/mercurial/dispatch.py Sun Aug 14 16:30:44 2016 -0700
+++ b/mercurial/dispatch.py Sun Aug 14 16:35:58 2016 -0700
@@ -819,6 +819,10 @@
for ui_ in uis:
ui_.setconfig('ui', opt, val, '--' + opt)
+ if options['profile']:
+ for ui_ in uis:
+ ui_.setconfig('profiling', 'enabled', 'true', '--profile')
+
if options['traceback']:
for ui_ in uis:
ui_.setconfig('ui', 'traceback', 'on', '--traceback')
@@ -904,7 +908,7 @@
except error.SignatureError:
raise error.CommandError(cmd, _("invalid arguments"))
- if options['profile'] or ui.configbool('profiling', 'enabled'):
+ if ui.configbool('profiling', 'enabled'):
return profiling.profile(ui, checkargs)
else:
return checkargs()