Patchwork D10596: revlog: rename `versionflags` to header

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-dtecnunvsnvms7r65b62-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48914/
State Superseded
Headers show

Comments

phabricator - May 3, 2021, 12:07 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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".

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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: