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

login
register
mail settings
Submitter Boris Feld
Date Nov. 16, 2018, 6:22 p.m.
Message ID <c8543772d7cf2e9c731c.1542392521@localhost.localdomain>
Download mbox | patch
Permalink /patch/36628/
State Accepted
Headers show

Comments

Boris Feld - Nov. 16, 2018, 6:22 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.
Yuya Nishihara - Nov. 17, 2018, 4:18 a.m.
On Fri, 16 Nov 2018 19:22:01 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@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

Queued this, thanks.

Patch

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