Patchwork D4015: revlog: don't include trailing nullrev in revlog.revs(stop=len(revlog))

login
register
mail settings
Submitter phabricator
Date Aug. 1, 2018, 7:29 p.m.
Message ID <cbf3745ef7790e67967ec1ca3e309bf3@localhost.localdomain>
Download mbox | patch
Permalink /patch/33044/
State Not Applicable
Headers show

Comments

phabricator - Aug. 1, 2018, 7:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG83a505b5cf85: revlog: don&#039;t include trailing nullrev in revlog.revs(stop=len(revlog)) (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4015?vs=9715&id=9730

REVISION DETAIL
  https://phab.mercurial-scm.org/D4015

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: martinvonz, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

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