Patchwork [4,of,8] pref: support negative indexing in perfrevlogrevisions

login
register
mail settings
Submitter Boris Feld
Date Oct. 11, 2018, 8:01 a.m.
Message ID <532b680ff96db665fd5a.1539244907@localhost.localdomain>
Download mbox | patch
Permalink /patch/35627/
State Accepted
Headers show

Comments

Boris Feld - Oct. 11, 2018, 8:01 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538407434 -7200
#      Mon Oct 01 17:23:54 2018 +0200
# Node ID 532b680ff96db665fd5aa1559f487221cba92c20
# Parent  41fc0a8723b7d9876e13866ecccc9ade1c246ec7
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 532b680ff96d
pref: support negative indexing in perfrevlogrevisions

This is useful to check for a consistent final slice in multiple different repositories.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1523,6 +1523,9 @@  def perfrevlogrevisions(ui, repo, file_=
     rl = cmdutil.openrevlog(repo, b'perfrevlogrevisions', file_, opts)
     rllen = getlen(ui)(rl)
 
+    if startrev < 0:
+        startrev = rllen + startrev
+
     def d():
         rl.clearcaches()