changeset 53243:d9c7a3e4b95a

revlog: convert version features dict from bytes to str keys This is preparation for converting to `TypedDict`, so that each key has its own specific value type. That will unconfuse pytype when values are extracted from the map, and it doesn't have to assume the union of all value types.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 30 Apr 2025 11:23:27 -0400
parents 7d66805e0600
children 1b1d7cc9d30e
files mercurial/revlog.py mercurial/revlogutils/constants.py
diffstat 2 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue Apr 29 18:16:54 2025 -0400
+++ b/mercurial/revlog.py	Wed Apr 30 11:23:27 2025 -0400
@@ -1380,7 +1380,7 @@
         _format_version = header & 0xFFFF
 
         features = FEATURES_BY_VERSION[_format_version]
-        return features[b'inline'](_format_flags)
+        return features['inline'](_format_flags)
 
     _docket_file: Optional[bytes]
 
@@ -1720,14 +1720,14 @@
                 raise error.RevlogError(msg)
 
             features = FEATURES_BY_VERSION[self._format_version]
-            self._inline = features[b'inline'](self._format_flags)
-            self.delta_config.general_delta = features[b'generaldelta'](
+            self._inline = features['inline'](self._format_flags)
+            self.delta_config.general_delta = features['generaldelta'](
                 self._format_flags
             )
             self.data_config.generaldelta = self.delta_config.general_delta
-            self.feature_config.has_side_data = features[b'sidedata']
-
-            if not features[b'docket']:
+            self.feature_config.has_side_data = features['sidedata']
+
+            if not features['docket']:
                 self._indexfile = entry_point
                 index_data = entry_data
             else:
--- a/mercurial/revlogutils/constants.py	Tue Apr 29 18:16:54 2025 -0400
+++ b/mercurial/revlogutils/constants.py	Wed Apr 30 11:23:27 2025 -0400
@@ -280,32 +280,32 @@
 
 FEATURES_BY_VERSION = {
     REVLOGV0: {
-        b'inline': _no,
-        b'generaldelta': _no,
-        b'sidedata': False,
-        b'docket': False,
+        'inline': _no,
+        'generaldelta': _no,
+        'sidedata': False,
+        'docket': False,
     },
     REVLOGV1: {
-        b'inline': _from_flag(FLAG_INLINE_DATA),
-        b'generaldelta': _from_flag(FLAG_GENERALDELTA),
-        b'sidedata': False,
-        b'docket': False,
+        'inline': _from_flag(FLAG_INLINE_DATA),
+        'generaldelta': _from_flag(FLAG_GENERALDELTA),
+        'sidedata': False,
+        'docket': False,
     },
     REVLOGV2: {
         # The point of inline-revlog is to reduce the number of files used in
         # the store. Using a docket defeat this purpose. So we needs other
         # means to reduce the number of files for revlogv2.
-        b'inline': _no,
-        b'generaldelta': _yes,
-        b'sidedata': True,
-        b'docket': True,
+        'inline': _no,
+        'generaldelta': _yes,
+        'sidedata': True,
+        'docket': True,
     },
     CHANGELOGV2: {
-        b'inline': _no,
+        'inline': _no,
         # General delta is useless for changelog since we don't do any delta
-        b'generaldelta': _no,
-        b'sidedata': True,
-        b'docket': True,
+        'generaldelta': _no,
+        'sidedata': True,
+        'docket': True,
     },
 }