Patchwork D10773: revlogv2: simplify and clarify the processing of each entry

login
register
mail settings
Submitter phabricator
Date May 27, 2021, 7:05 a.m.
Message ID <differential-rev-PHID-DREV-jwmorenfcgpp4wc6ixmq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49092/
State Superseded
Headers show

Comments

phabricator - May 27, 2021, 7:05 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As we add more entries and some of them has non trivial processing it seems
  useful to make the processing leaner and clearly separated to simplify futures
  patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlogutils/docket.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py
--- a/mercurial/revlogutils/docket.py
+++ b/mercurial/revlogutils/docket.py
@@ -238,18 +238,29 @@ 
     """given some docket data return a docket object for the given revlog"""
     header = S_HEADER.unpack(data[: S_HEADER.size])
     offset = S_HEADER.size
-    version_header = header[0]
-    index_uuid_size = header[1]
+
+    iheader = iter(header)
+
+    version_header = next(iheader)
+
+    index_uuid_size = next(iheader)
     index_uuid = data[offset : offset + index_uuid_size]
     offset += index_uuid_size
-    data_uuid_size = header[2]
+
+    data_uuid_size = next(iheader)
     data_uuid = data[offset : offset + data_uuid_size]
     offset += data_uuid_size
-    index_size = header[3]
-    pending_index_size = header[4]
-    data_size = header[5]
-    pending_data_size = header[6]
-    default_compression_header = header[7]
+
+    index_size = next(iheader)
+
+    pending_index_size = next(iheader)
+
+    data_size = next(iheader)
+
+    pending_data_size = next(iheader)
+
+    default_compression_header = next(iheader)
+
     docket = RevlogDocket(
         revlog,
         use_pending=use_pending,