Patchwork D10713: revlog: fix the the computation of indexes on revlog split

login
register
mail settings
Submitter phabricator
Date May 16, 2021, 7:32 p.m.
Message ID <differential-rev-PHID-DREV-z4q5msldkfx5hl4zpkik-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49034/
State Superseded
Headers show

Comments

phabricator - May 16, 2021, 7:32 p.m.
valentin.gatienbaron created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It probably got broken in 63edc384d3b7 <https://phab.mercurial-scm.org/rHG63edc384d3b7f497fba4c1797bab86eede583dca>, since there was no test about
  this scenario until the previous commit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py
  tests/test-transaction-rollback-on-revlog-split.t

CHANGE DETAILS




To: valentin.gatienbaron, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-transaction-rollback-on-revlog-split.t b/tests/test-transaction-rollback-on-revlog-split.t
--- a/tests/test-transaction-rollback-on-revlog-split.t
+++ b/tests/test-transaction-rollback-on-revlog-split.t
@@ -31,7 +31,7 @@ 
   $ cat .hg/store/journal | tr -s '\000' ' '
   data/file.i 1065
   data/file.d 0
-  data/file.i 0
+  data/file.i 64
   00manifest.i 111
   00changelog.i 122
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1985,7 +1985,7 @@ 
         with self._indexfp(b'r') as ifh, self._datafp(b'w') as dfh:
             for r in self:
                 dfh.write(self._getsegmentforrevs(r, r, df=ifh)[1])
-                if troffset <= self.start(r):
+                if troffset <= self.start(r) + r * self.index.entry_size:
                     trindex = r
 
         with self._indexfp(b'w') as fp: