Patchwork [6,of,6,v2] histedit: log the time taken to read in the commands list

login
register
mail settings
Submitter Simon Farnsworth
Date Feb. 9, 2017, 9:52 p.m.
Message ID <f8b12c890147ebce0c06.1486677139@devvm022.lla2.facebook.com>
Download mbox | patch
Permalink /patch/18372/
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 1486676306 28800
#      Thu Feb 09 13:38:26 2017 -0800
# Node ID f8b12c890147ebce0c06663f478cd76b89f6beab
# Parent  acb1103ff1de3c9c40a4b1c6b19ca65161329d02
histedit: log the time taken to read in the commands list

If we're being fed an external command list (histedit --commands), then the
time spent reading that file is out of our control. Log it.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -991,11 +991,12 @@ 
     return goalnew
 
 def _readfile(ui, path):
-    if path == '-':
-        return ui.fin.read()
-    else:
-        with open(path, 'rb') as f:
-            return f.read()
+    with ui.timeblockedsection('histedit'):
+        if path == '-':
+            return ui.fin.read()
+        else:
+            with open(path, 'rb') as f:
+                return f.read()
 
 def _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs):
     # TODO only abort if we try to histedit mq patches, not just