revlog: rename `versionflags` to header
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 03 May 2021 12:26:06 +0200
changeset 47170 6e0ee1810fbd
parent 47169 a13f72b9ccfb
child 47171 729668105901
revlog: rename `versionflags` to header The variable is named as such because it contains "version" information and "flags" information. However you mostly needs to know the code to understand the name which is not great. The fact that this is the very first four bytes in all revlog seems more relevant, so we rename the variable "header". Differential Revision: https://phab.mercurial-scm.org/D10596
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon May 03 12:25:56 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:26:06 2021 +0200
@@ -485,13 +485,13 @@
         self._initempty = True
         indexdata = self._get_data(self._indexfile, mmapindexthreshold)
         if len(indexdata) > 0:
-            versionflags = INDEX_HEADER.unpack(indexdata[:4])[0]
+            header = INDEX_HEADER.unpack(indexdata[:4])[0]
             self._initempty = False
         else:
-            versionflags = newversionflags
-
-        flags = self._format_flags = versionflags & ~0xFFFF
-        fmt = self._format_version = versionflags & 0xFFFF
+            header = newversionflags
+
+        flags = self._format_flags = header & ~0xFFFF
+        fmt = self._format_version = header & 0xFFFF
 
         if fmt == REVLOGV0:
             if flags:
@@ -510,8 +510,8 @@
                     % (flags >> 16, fmt, self.display_id)
                 )
 
-            self._inline = versionflags & FLAG_INLINE_DATA
-            self._generaldelta = versionflags & FLAG_GENERALDELTA
+            self._inline = header & FLAG_INLINE_DATA
+            self._generaldelta = header & FLAG_GENERALDELTA
 
         elif fmt == REVLOGV2:
             if flags & ~REVLOGV2_FLAGS: