Patchwork [1,of,5] perf: don't clobber startrev variable

login
register
mail settings
Submitter Gregory Szorc
Date May 6, 2017, 6:21 p.m.
Message ID <7db6c2fc82c17780d28f.1494094917@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/20486/
State Accepted
Headers show

Comments

Gregory Szorc - May 6, 2017, 6:21 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1494093578 25200
#      Sat May 06 10:59:38 2017 -0700
# Node ID 7db6c2fc82c17780d28faeee73a8d776063fbb64
# Parent  31f42e683321f225eb9c306f8d4b3a9e8d82a1da
perf: don't clobber startrev variable

Previously, the "startrev" argument would be ignored due to
"startrev = 0" in the benchmark function. This meant that
`hg perfrevlog` always started at revision 0.

Rename the local variable to "endrev" so the variable does the
right thing.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -857,15 +857,15 @@  def perfrevlog(ui, repo, file_=None, sta
     def d():
         r = cmdutil.openrevlog(repo, 'perfrevlog', file_, opts)
 
-        startrev = 0
+        beginrev = startrev
         endrev = _len(r)
         dist = opts['dist']
 
         if reverse:
-            startrev, endrev = endrev, startrev
+            beginrev, endrev = endrev, beginrev
             dist = -1 * dist
 
-        for x in xrange(startrev, endrev, dist):
+        for x in xrange(beginrev, endrev, dist):
             r.revision(r.node(x))
 
     timer(d)