[PATCH 2 of 2 FOLLOW-UP] sparse-revlog: align endrevidx usages in the _slicechunktosize

Boris Feld boris.feld at octobus.net
Fri Nov 16 13:22:01 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542290246 -3600
#      Thu Nov 15 14:57:26 2018 +0100
# Node ID c8543772d7cf2e9c731cc94141b70e7f47edd232
# Parent  7f510ce447f6e16ba1970606615fcb78946d7146
# EXP-Topic follow-up-revlog
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c8543772d7cf
sparse-revlog: align endrevidx usages in the _slicechunktosize

All "startrevidx..endrevidx" ranges in this function are now half-open.

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -234,7 +234,7 @@ def _slicechunktosize(revlog, revs, targ
         return
 
     startrevidx = 0
-    endrevidx = 0
+    endrevidx = 1
     iterrevs = enumerate(revs)
     next(iterrevs) # skip first rev.
     # first step: get snapshots out of the way
@@ -242,14 +242,14 @@ def _slicechunktosize(revlog, revs, targ
         span = revlog.end(r) - startdata
         snapshot = revlog.issnapshot(r)
         if span <= targetsize and snapshot:
-            endrevidx = idx
+            endrevidx = idx + 1
         else:
-            chunk = _trimchunk(revlog, revs, startrevidx, endrevidx + 1)
+            chunk = _trimchunk(revlog, revs, startrevidx, endrevidx)
             if chunk:
                 yield chunk
             startrevidx = idx
             startdata = revlog.start(r)
-            endrevidx = idx
+            endrevidx = idx + 1
         if not snapshot:
             break
 


More information about the Mercurial-devel mailing list