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

Simon Farnsworth simonfar at fb.com
Thu Feb 9 16:52:19 EST 2017


# HG changeset patch
# User Simon Farnsworth <simonfar at 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.

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


More information about the Mercurial-devel mailing list