# HG changeset patch # User Raphaël Gomès # Date 1614707478 -3600 # Node ID e83327af26f158c21ceac95324dd4cb0e0bdfa96 # Parent ad30b29bc23de9533cc7367b5cdc6a925c96898d pure-parsers: document index class constants This also adds the big endian prefix `>` to make the constants truly platform-independent, even if no issue with this has been reported in the wild. Differential Revision: https://phab.mercurial-scm.org/D10104 diff -r ad30b29bc23d -r e83327af26f1 mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py Thu Mar 04 16:06:55 2021 -0800 +++ b/mercurial/pure/parsers.py Tue Mar 02 18:51:18 2021 +0100 @@ -42,10 +42,15 @@ class BaseIndexObject(object): + # Format of an index entry according to Python's `struct` language index_format = b">Qiiiiii20s12x" - big_int_size = struct.calcsize(b'Q') - int_size = struct.calcsize(b'i') + # Size of a C unsigned long long int, platform independent + big_int_size = struct.calcsize(b'>Q') + # Size of a C long int, platform independent + int_size = struct.calcsize(b'>i') + # Size of the entire index format index_size = struct.calcsize(index_format) + # An empty index entry, used as a default value to be overridden, or nullrev null_item = (0, 0, 0, -1, -1, -1, -1, nullid) @property