changeset 47333:f286d715f9ab

revlogv2: simplify and clarify the processing of each entry 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. Differential Revision: https://phab.mercurial-scm.org/D10773
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 20 May 2021 21:48:53 +0200
parents 0a3fa41fa719
children 53ab13d6a5db
files mercurial/revlogutils/docket.py
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/docket.py	Wed May 19 16:55:36 2021 +0200
+++ b/mercurial/revlogutils/docket.py	Thu May 20 21:48:53 2021 +0200
@@ -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,