diff 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
line wrap: on
line diff
--- a/mercurial/dispatch.py	Fri Jun 09 12:36:07 2017 +0100
+++ b/mercurial/dispatch.py	Fri Jun 09 12:29:29 2017 +0100
@@ -764,7 +764,8 @@
         for ui_ in uis:
             ui_.setconfig('profiling', 'enabled', 'true', '--profile')
 
-    with profiling.maybeprofile(lui) as profiler:
+    profile = lui.configbool('profiling', 'enabled')
+    with profiling.profile(lui, enabled=profile) as profiler:
         # Configure extensions in phases: uisetup, extsetup, cmdtable, and
         # reposetup. Programs like TortoiseHg will call _dispatch several
         # times so we keep track of configured extensions in _loaded.