comparison mercurial/dispatch.py @ 47023:a2bf93ab3014

profiling: add --no-profile to disable profiling enabled via config Differential Revision: https://phab.mercurial-scm.org/D10469
author Kyle Lippincott <spectral@google.com>
date Fri, 16 Apr 2021 15:31:05 -0700
parents e7d082e4ace6
children 8fae2cc6ee86
comparison
equal deleted inserted replaced
47022:ec081d7f0009 47023:a2bf93ab3014
1062 ui_.setconfig(b'ui', opt, val, b'--' + opt) 1062 ui_.setconfig(b'ui', opt, val, b'--' + opt)
1063 1063
1064 if req.earlyoptions[b'profile']: 1064 if req.earlyoptions[b'profile']:
1065 for ui_ in uis: 1065 for ui_ in uis:
1066 ui_.setconfig(b'profiling', b'enabled', b'true', b'--profile') 1066 ui_.setconfig(b'profiling', b'enabled', b'true', b'--profile')
1067 elif req.earlyoptions[b'profile'] is False:
1068 # Check for it being set already, so that we don't pollute the config
1069 # with this when using chg in the very common case that it's not
1070 # enabled.
1071 if lui.configbool(b'profiling', b'enabled'):
1072 # Only do this on lui so that `chg foo` with a user config setting
1073 # profiling.enabled=1 still shows profiling information (chg will
1074 # specify `--no-profile` when `hg serve` is starting up, we don't
1075 # want that to propagate to every later invocation).
1076 lui.setconfig(b'profiling', b'enabled', b'false', b'--no-profile')
1067 1077
1068 profile = lui.configbool(b'profiling', b'enabled') 1078 profile = lui.configbool(b'profiling', b'enabled')
1069 with profiling.profile(lui, enabled=profile) as profiler: 1079 with profiling.profile(lui, enabled=profile) as profiler:
1070 # Configure extensions in phases: uisetup, extsetup, cmdtable, and 1080 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
1071 # reposetup 1081 # reposetup