Patchwork [03,of,10] hgperf: update to conform with import style checks

login
register
mail settings
Submitter Augie Fackler
Date Aug. 23, 2017, 2:55 p.m.
Message ID <297638dbead3ae064c05.1503500102@imladris.local>
Download mbox | patch
Permalink /patch/23230/
State Accepted
Headers show

Comments

Augie Fackler - Aug. 23, 2017, 2:55 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1503425523 14400
#      Tue Aug 22 14:12:03 2017 -0400
# Node ID 297638dbead3ae064c05c4bdc6fe9af0b8f4479b
# Parent  ec39438cd9f338b3d43075bc4eb388b20142385d
hgperf: update to conform with import style checks

Patch

diff --git a/contrib/hgperf b/contrib/hgperf
--- a/contrib/hgperf
+++ b/contrib/hgperf
@@ -52,18 +52,20 @@  except ImportError:
     sys.stderr.write("(check your install and PYTHONPATH)\n")
     sys.exit(-1)
 
-import mercurial.util
-import mercurial.dispatch
+from mercurial import (
+    dispatch,
+    util,
+)
 
 def timer(func, title=None):
     results = []
-    begin = mercurial.util.timer()
+    begin = util.timer()
     count = 0
     while True:
         ostart = os.times()
-        cstart = mercurial.util.timer()
+        cstart = util.timer()
         r = func()
-        cstop = mercurial.util.timer()
+        cstop = util.timer()
         ostop = os.times()
         count += 1
         a, b = ostart, ostop
@@ -80,7 +82,7 @@  def timer(func, title=None):
     sys.stderr.write("! wall %f comb %f user %f sys %f (best of %d)\n"
                      % (m[0], m[1] + m[2], m[1], m[2], count))
 
-orgruncommand = mercurial.dispatch.runcommand
+orgruncommand = dispatch.runcommand
 
 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
     ui.pushbuffer()
@@ -90,9 +92,9 @@  def runcommand(lui, repo, cmd, fullargs,
     ui.popbuffer()
     lui.popbuffer()
 
-mercurial.dispatch.runcommand = runcommand
+dispatch.runcommand = runcommand
 
 for fp in (sys.stdin, sys.stdout, sys.stderr):
-    mercurial.util.setbinary(fp)
+    util.setbinary(fp)
 
-mercurial.dispatch.run()
+dispatch.run()