Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 32788:eede022fc142
profile: drop maybeprofile
It seems sufficiently simple to use "profile(enabled=X)" to not justify having
a dedicated context manager just to read the config.
(I do not have a too strong opinion about this).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 09 Jun 2017 12:29:29 +0100 |
parents | 545f69cd6042 |
children | 45b0e9d05ee9 |
comparison
equal
deleted
inserted
replaced
32787:545f69cd6042 | 32788:eede022fc142 |
---|---|
762 | 762 |
763 if '--profile' in args: | 763 if '--profile' in args: |
764 for ui_ in uis: | 764 for ui_ in uis: |
765 ui_.setconfig('profiling', 'enabled', 'true', '--profile') | 765 ui_.setconfig('profiling', 'enabled', 'true', '--profile') |
766 | 766 |
767 with profiling.maybeprofile(lui) as profiler: | 767 profile = lui.configbool('profiling', 'enabled') |
768 with profiling.profile(lui, enabled=profile) as profiler: | |
768 # Configure extensions in phases: uisetup, extsetup, cmdtable, and | 769 # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
769 # reposetup. Programs like TortoiseHg will call _dispatch several | 770 # reposetup. Programs like TortoiseHg will call _dispatch several |
770 # times so we keep track of configured extensions in _loaded. | 771 # times so we keep track of configured extensions in _loaded. |
771 extensions.loadall(lui) | 772 extensions.loadall(lui) |
772 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] | 773 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] |