index: use an explicit constant for INDEX_HEADER format and use it for docket
This avoid leaking python-3.6 compatibility details too much.
Differential Revision: https://phab.mercurial-scm.org/D10831
--- a/mercurial/revlogutils/constants.py Tue Jun 01 09:18:27 2021 +0200
+++ b/mercurial/revlogutils/constants.py Thu Jun 03 16:12:03 2021 +0200
@@ -29,7 +29,9 @@
### main revlog header
-INDEX_HEADER = struct.Struct(b">I")
+# We cannot rely on Struct.format is inconsistent for python <=3.6 versus above
+INDEX_HEADER_FMT = b">I"
+INDEX_HEADER = struct.Struct(INDEX_HEADER_FMT)
## revlog version
REVLOGV0 = 0
--- a/mercurial/revlogutils/docket.py Tue Jun 01 09:18:27 2021 +0200
+++ b/mercurial/revlogutils/docket.py Thu Jun 03 16:12:03 2021 +0200
@@ -95,9 +95,7 @@
# * 8 bytes: size of data
# * 8 bytes: pending size of data
# * 1 bytes: default compression header
-S_HEADER = struct.Struct(
- pycompat.sysstr(constants.INDEX_HEADER.format) + 'BBLLLLc'
-)
+S_HEADER = struct.Struct(constants.INDEX_HEADER_FMT + b'BBLLLLc')
class RevlogDocket(object):