diff -r 545f69cd6042 -r eede022fc142 mercurial/dispatch.py --- 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.