[Updated] D10664: revlog: pass around the `rev` we deal with when packing/unpacking entry

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon May 17 21:58:57 UTC 2021


Closed by commit rHG55d280bc59fa: revlog: pass around the `rev` we deal with when packing/unpacking entry (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10664?vs=27903&id=28057

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10664/new/

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -118,10 +118,10 @@
     def append(self, tup):
         if '_nodemap' in vars(self):
             self._nodemap[tup[7]] = len(self)
-        data = self._pack_entry(tup)
+        data = self._pack_entry(len(self), tup)
         self._extra.append(data)
 
-    def _pack_entry(self, entry):
+    def _pack_entry(self, rev, entry):
         assert entry[8] == 0
         assert entry[9] == 0
         return self.index_format.pack(*entry[:8])
@@ -141,12 +141,12 @@
         else:
             index = self._calculate_index(i)
             data = self._data[index : index + self.entry_size]
-        r = self._unpack_entry(data)
+        r = self._unpack_entry(i, data)
         if self._lgt and i == 0:
             r = (offset_type(0, gettype(r[0])),) + r[1:]
         return r
 
-    def _unpack_entry(self, data):
+    def _unpack_entry(self, rev, data):
         r = self.index_format.unpack(data)
         r = r + (
             0,
@@ -323,17 +323,17 @@
             entry[9] = sidedata_length
             entry[11] = compression_mode
             entry = tuple(entry)
-            new = self._pack_entry(entry)
+            new = self._pack_entry(rev, entry)
             self._extra[rev - self._lgt] = new
 
-    def _unpack_entry(self, data):
+    def _unpack_entry(self, rev, data):
         data = self.index_format.unpack(data)
         entry = data[:10]
         data_comp = data[10] & 3
         sidedata_comp = (data[10] & (3 << 2)) >> 2
         return entry + (data_comp, sidedata_comp)
 
-    def _pack_entry(self, entry):
+    def _pack_entry(self, rev, entry):
         data = entry[:10]
         data_comp = entry[10] & 3
         sidedata_comp = (entry[11] & 3) << 2
@@ -344,7 +344,7 @@
     def entry_binary(self, rev):
         """return the raw binary string representing a revision"""
         entry = self[rev]
-        return self._pack_entry(entry)
+        return self._pack_entry(rev, entry)
 
     def pack_header(self, header):
         """pack header information as binary"""



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210517/ec58f0f2/attachment-0002.html>


More information about the Mercurial-patches mailing list