mercurial/profiling.py
changeset 32806 0ead06d54ffe
parent 32805 37ec8f24d912
child 32808 eede022fc142
--- 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