Patchwork [3,of,6,v2] ui: log time spent blocked on editor

login
register
mail settings
Submitter Simon Farnsworth
Date Feb. 9, 2017, 9:52 p.m.
Message ID <e21b9166fc2cdcda22a0.1486677136@devvm022.lla2.facebook.com>
Download mbox | patch
Permalink /patch/18368/
State Changes Requested
Headers show

Comments

Simon Farnsworth - Feb. 9, 2017, 9:52 p.m.
# HG changeset patch
# User Simon Farnsworth <simonfar@fb.com>
# Date 1486676443 28800
#      Thu Feb 09 13:40:43 2017 -0800
# Node ID e21b9166fc2cdcda22a071de30f97b44c5796da1
# Parent  be7dac985b12af413b43fa9685e29a90f80de4ef
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
@@ -1075,13 +1075,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)