Patchwork [5,of,8,v3] ui: log time spent blocked on editor

login
register
mail settings
Submitter Simon Farnsworth
Date Feb. 10, 2017, 9:06 p.m.
Message ID <8e20c41fe4903745b668.1486760779@devvm022.lla2.facebook.com>
Download mbox | patch
Permalink /patch/18411/
State Changes Requested
Headers show

Comments

Simon Farnsworth - Feb. 10, 2017, 9:06 p.m.
# HG changeset patch
# User Simon Farnsworth <simonfar@fb.com>
# Date 1486760569 28800
#      Fri Feb 10 13:02:49 2017 -0800
# Node ID 8e20c41fe4903745b668ae3de58a0d3e9514a78e
# Parent  dbe4c89f86d75130fabcde8ac2f4ce18ef6d356e
ui: log time spent blocked on editor

The user's editor is outside our control. Log how long we spend blocked on
it.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1076,13 +1076,14 @@ 
 
             editor = self.geteditor()
 
-            self.system("%s \"%s\"" % (editor, name),
-                        environ=environ,
-                        onerr=error.Abort, errprefix=_("edit failed"))
+            with self.timeblockedsection('editor'):
+                self.system("%s \"%s\"" % (editor, name),
+                            environ=environ,
+                            onerr=error.Abort, errprefix=_("edit failed"))
 
-            f = open(name)
-            t = f.read()
-            f.close()
+                f = open(name)
+                t = f.read()
+                f.close()
         finally:
             os.unlink(name)