[Updated] 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 21:55:12 UTC 2021


Closed by commit rHG165addb19772: index: use an explicit constant for INDEX_HEADER format and use it for docket (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10831?vs=28412&id=28426

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10831/new/

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210602/28f86150/attachment-0002.html>


More information about the Mercurial-patches mailing list