Patchwork perf: always pass node to revlog.revision()

login
register
mail settings
Submitter Gregory Szorc
Date May 16, 2017, 2:37 a.m.
Message ID <4215b67716ae4a9f40c4.1494902279@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/20637/
State Accepted
Headers show

Comments

Gregory Szorc - May 16, 2017, 2:37 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1494902231 25200
#      Mon May 15 19:37:11 2017 -0700
# Node ID 4215b67716ae4a9f40c42ffbbfe9db2c7c1333f1
# Parent  49621512d133723fcf54d9c5cd865a40a81446e9
perf: always pass node to revlog.revision()

I removed this in 73c3e226d2fc thinking it wasn't necessary. In fact,
we need to always pass a node so the code is compatible with revisions
before d7d64b89a65c.

The new code uses a variable to avoid check-style complaining
about "r.revision(r.node(" patterns.
Jun Wu - May 16, 2017, 2:45 a.m.
Loos good to me.

Excerpts from Gregory Szorc's message of 2017-05-15 19:37:59 -0700:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1494902231 25200
> #      Mon May 15 19:37:11 2017 -0700
> # Node ID 4215b67716ae4a9f40c42ffbbfe9db2c7c1333f1
> # Parent  49621512d133723fcf54d9c5cd865a40a81446e9
> perf: always pass node to revlog.revision()
> 
> I removed this in 73c3e226d2fc thinking it wasn't necessary. In fact,
> we need to always pass a node so the code is compatible with revisions
> before d7d64b89a65c.
> 
> The new code uses a variable to avoid check-style complaining
> about "r.revision(r.node(" patterns.
> 
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -865,7 +865,9 @@ def perfrevlog(ui, repo, file_=None, sta
>              dist = -1 * dist
>  
>          for x in xrange(beginrev, endrev, dist):
> -            rl.revision(x)
> +            # Old revisions don't support passing int.
> +            n = rl.node(x)
> +            rl.revision(n)
>  
>      timer, fm = gettimer(ui, opts)
>      timer(d)
Augie Fackler - May 16, 2017, 3:01 a.m.
> On May 15, 2017, at 22:37, Gregory Szorc <gregory.szorc@gmail.com> wrote:
> 
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1494902231 25200
> #      Mon May 15 19:37:11 2017 -0700
> # Node ID 4215b67716ae4a9f40c42ffbbfe9db2c7c1333f1
> # Parent  49621512d133723fcf54d9c5cd865a40a81446e9
> perf: always pass node to revlog.revision()

queued thanks

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -865,7 +865,9 @@  def perfrevlog(ui, repo, file_=None, sta
             dist = -1 * dist
 
         for x in xrange(beginrev, endrev, dist):
-            rl.revision(x)
+            # Old revisions don't support passing int.
+            n = rl.node(x)
+            rl.revision(n)
 
     timer, fm = gettimer(ui, opts)
     timer(d)