diff -r 37ec8f24d912 -r 0ead06d54ffe mercurial/profiling.py --- a/mercurial/profiling.py Fri Jun 09 11:41:47 2017 +0100 +++ b/mercurial/profiling.py Fri Jun 09 11:42:45 2017 +0100 @@ -160,6 +160,7 @@ self._entered = True if self._enabled: self.start() + return self def start(self): """Start profiling. @@ -230,5 +231,5 @@ just use a single code path for calling into code you may want to profile and this function determines whether to start profiling. """ - with profile(ui, enabled=ui.configbool('profiling', 'enabled')): - yield + with profile(ui, enabled=ui.configbool('profiling', 'enabled')) as p: + yield p