D5228: perf: fix perfrevlogrevisions --reverse
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Tue Nov 6 08:33:29 UTC 2018
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Currently, 'endrev' equals `len(revlog)`, a revision that does not exist.
When asking for the reverse order, the arguments passed to xrange are
`xrange(len(revlog), startrev)` which then crash.
We need to offset 'endrev' by one so we don't crash anymore. Also, we offset
'startrev' to ensure we get the same number of revisions with and without the
`--reverse` option.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5228
AFFECTED FILES
contrib/perf.py
CHANGE DETAILS
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1553,7 +1553,7 @@
dist = opts[b'dist']
if reverse:
- beginrev, endrev = endrev, beginrev
+ beginrev, endrev = endrev - 1, beginrev - 1
dist = -1 * dist
for x in _xrange(beginrev, endrev, dist):
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list