profile: make the contextmanager object available to the callers
This will allow calling methods on the object in the code using the context
manager.
--- 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