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.
This commit is contained in:
Gregory Szorc 2016-08-14 16:35:58 -07:00
parent bdb3786ca0
commit 1aca3f1e38

View File

@ -819,6 +819,10 @@ def _dispatch(req):
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 @@ def _runcommand(ui, options, cmd, cmdfunc):
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()