Patchwork D10025: revlogv2: don't assume that the sidedata of the last rev is right after data

login
register
mail settings
Submitter phabricator
Date Feb. 19, 2021, 11:16 a.m.
Message ID <differential-rev-PHID-DREV-qatrzxt23z7mqkqyk4qo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48340/
State Superseded
Headers show

Comments

phabricator - Feb. 19, 2021, 11:16 a.m.
Alphare created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We are going to be rewriting sidedata soon, it's going to be appended to the
  revlog data file, meaning that the data and the sidedata might not be
  contiguous.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: Alphare, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2337,7 +2337,15 @@ 
 
         curr = len(self)
         prev = curr - 1
-        offset = self.end(prev)
+        if self.version & 0xFFFF == REVLOGV2:
+            prev_node = self.index[prev]
+            sidedata_offset = prev_node[10]
+            if sidedata_offset == 0:
+                offset = self.end(prev)
+            else:
+                offset = sidedata_offset + prev_node[11]
+        else:
+            offset = self.end(prev)
         p1r, p2r = self.rev(p1), self.rev(p2)
 
         # full versions are inserted when the needed deltas