D4015: revlog: don't include trailing nullrev in revlog.revs(stop=len(revlog))
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Aug 1 18:48:31 UTC 2018
martinvonz created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This was an odd side effect of the nullid entry that's in the
index. The existing callers (mostly repair.py) seem to have handled it
fine. It doesn't seem intentional, and it's pretty surprising, so
let's remove that surprise.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4015
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1070,12 +1070,15 @@
def revs(self, start=0, stop=None):
"""iterate over all rev in this revlog (from start to stop)"""
step = 1
+ length = len(self)
if stop is not None:
if start > stop:
step = -1
stop += step
+ if stop > length:
+ stop = length
else:
- stop = len(self)
+ stop = length
return xrange(start, stop, step)
@util.propertycache
To: martinvonz, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list