Patchwork D10600: revlog: directly use self._format_flags when loading index

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-u4viiqhb7zb54cjuoaeh-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48919/
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 shorthand variable does not bring much, so we drop it to simplify the code.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -490,31 +490,34 @@ 
         else:
             header = new_header
 
-        flags = self._format_flags = header & ~0xFFFF
+        self._format_flags = header & ~0xFFFF
         self._format_version = header & 0xFFFF
 
         if self._format_version == REVLOGV0:
-            if flags:
+            if self._format_flags:
                 msg = _(b'unknown flags (%#04x) in version %d revlog %s')
-                msg %= (flags >> 16, self._format_version, self.display_id)
+                display_flag = self._format_flags >> 16
+                msg %= (display_flag, self._format_version, self.display_id)
                 raise error.RevlogError(msg)
 
             self._inline = False
             self._generaldelta = False
 
         elif self._format_version == REVLOGV1:
-            if flags & ~REVLOGV1_FLAGS:
+            if self._format_flags & ~REVLOGV1_FLAGS:
                 msg = _(b'unknown flags (%#04x) in version %d revlog %s')
-                msg %= (flags >> 16, self._format_version, self.display_id)
+                display_flag = self._format_flags >> 16
+                msg %= (display_flag, self._format_version, self.display_id)
                 raise error.RevlogError(msg)
 
             self._inline = self._format_flags & FLAG_INLINE_DATA
             self._generaldelta = self._format_flags & FLAG_GENERALDELTA
 
         elif self._format_version == REVLOGV2:
-            if flags & ~REVLOGV2_FLAGS:
+            if self._format_flags & ~REVLOGV2_FLAGS:
                 msg = _(b'unknown flags (%#04x) in version %d revlog %s')
-                msg %= (flags >> 16, self._format_version, self.display_id)
+                display_flag = self._format_flags >> 16
+                msg %= (display_flag, self._format_version, self.display_id)
                 raise error.RevlogError(msg)
 
             # There is a bug in the transaction handling when going from an