[PATCH 8 of 8 v3] histedit: log the time taken to read in the commands list

Simon Farnsworth simonfar at fb.com
Fri Feb 10 16:06:22 EST 2017


# HG changeset patch
# User Simon Farnsworth <simonfar at fb.com>
# Date 1486760569 28800
#      Fri Feb 10 13:02:49 2017 -0800
# Node ID e7ad7aed071a2efe659dc1da6e6643548148237e
# Parent  fff5635e512c056195f2c91d976736fff690b46d
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