[Request] [+ ] D10831: index: use an explicit constant for INDEX_HEADER format and use it for docket
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Jun 2 08:15:01 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This avoid leaking python-3.6 compatibility details too much.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10831
AFFECTED FILES
mercurial/revlogutils/constants.py
mercurial/revlogutils/docket.py
CHANGE DETAILS
diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py
--- a/mercurial/revlogutils/docket.py
+++ b/mercurial/revlogutils/docket.py
@@ -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):
diff --git a/mercurial/revlogutils/constants.py b/mercurial/revlogutils/constants.py
--- a/mercurial/revlogutils/constants.py
+++ b/mercurial/revlogutils/constants.py
@@ -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
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210602/cee4c86a/attachment.html>
More information about the Mercurial-patches
mailing list