[PATCH 06 of 10 v5] ui: time calls to ui.system
Simon Farnsworth
simonfar at fb.com
Wed Feb 15 17:06:56 EST 2017
# HG changeset patch
# User Simon Farnsworth <simonfar at fb.com>
# Date 1487194152 28800
# Wed Feb 15 13:29:12 2017 -0800
# Node ID 1ae8bc5565b680008d82e93bee9455432b6ba0b2
# Parent 1487dd34f44315371738b13519cc4af1c81a7b07
ui: time calls to ui.system
We want to know when we're blocked on ui.system, and why. Allow the user to
supply a tag - otherwise we record on an unspecific tag derived from cmd.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -35,6 +35,9 @@
urlreq = util.urlreq
+# for use with str.translate(None, _keepalnum), to keep just alphanumerics
+_keepalnum = ''.join(c for c in map(chr, range(256)) if not c.isalnum())
+
samplehgrcs = {
'user':
"""# example user config (see 'hg help config' for more info)
@@ -1146,15 +1149,19 @@
return t
- def system(self, cmd, environ=None, cwd=None, onerr=None, errprefix=None):
+ def system(self, cmd, environ=None, cwd=None, onerr=None, errprefix=None,
+ blockedtag=None):
'''execute shell command with appropriate output stream. command
output will be redirected if fout is not stdout.
'''
+ if blockedtag is None:
+ blockedtag = 'unknown_system_' + cmd.translate(None, _keepalnum)
out = self.fout
if any(s[1] for s in self._bufferstates):
out = self
- return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
- errprefix=errprefix, out=out)
+ with self.timeblockedsection(blockedtag):
+ return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
+ errprefix=errprefix, out=out)
def traceback(self, exc=None, force=False):
'''print exception traceback if traceback printing enabled or forced.
More information about the Mercurial-devel
mailing list