Patchwork D10640: revlog: use `rev` instead of `i` in replace_sidedata_info

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

Comments

phabricator - May 4, 2021, 2:16 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is clearer.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -279,25 +279,25 @@ 
     index_format = revlog_constants.INDEX_ENTRY_V2
 
     def replace_sidedata_info(
-        self, i, sidedata_offset, sidedata_length, offset_flags
+        self, rev, sidedata_offset, sidedata_length, offset_flags
     ):
         """
         Replace an existing index entry's sidedata offset and length with new
         ones.
         This cannot be used outside of the context of sidedata rewriting,
-        inside the transaction that creates the revision `i`.
+        inside the transaction that creates the revision `rev`.
         """
-        if i < 0:
+        if rev < 0:
             raise KeyError
-        self._check_index(i)
+        self._check_index(rev)
         sidedata_format = b">Qi"
         packed_size = struct.calcsize(sidedata_format)
-        if i >= self._lgt:
+        if rev >= self._lgt:
             packed = _pack(sidedata_format, sidedata_offset, sidedata_length)
-            old = self._extra[i - self._lgt]
+            old = self._extra[rev - self._lgt]
             offset_flags = struct.pack(b">Q", offset_flags)
             new = offset_flags + old[8:64] + packed + old[64 + packed_size :]
-            self._extra[i - self._lgt] = new
+            self._extra[rev - self._lgt] = new
         else:
             msg = b"cannot rewrite entries outside of this transaction"
             raise KeyError(msg)