Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 47064: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 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Fri Apr 16 18:56:26 2021 -0700 +++ b/mercurial/dispatch.py Fri Apr 16 15:31:05 2021 -0700 @@ -1064,6 +1064,16 @@ if req.earlyoptions[b'profile']: for ui_ in uis: ui_.setconfig(b'profiling', b'enabled', b'true', b'--profile') + elif req.earlyoptions[b'profile'] is False: + # Check for it being set already, so that we don't pollute the config + # with this when using chg in the very common case that it's not + # enabled. + if lui.configbool(b'profiling', b'enabled'): + # Only do this on lui so that `chg foo` with a user config setting + # profiling.enabled=1 still shows profiling information (chg will + # specify `--no-profile` when `hg serve` is starting up, we don't + # want that to propagate to every later invocation). + lui.setconfig(b'profiling', b'enabled', b'false', b'--no-profile') profile = lui.configbool(b'profiling', b'enabled') with profiling.profile(lui, enabled=profile) as profiler: