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