Mercurial > hg
diff mercurial/pure/parsers.py @ 46857:cc65cea90edb
revlog: move the details of revlog "v1" index inside revlog.utils.constants
The revlog module is quite large and this kind of format information would handy
for other module. So let us start to gather this information about the format in
a more appropriate place.
We update various reference to this information to use the new "source of truth"
in the process.
Differential Revision: https://phab.mercurial-scm.org/D10304
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 05 Apr 2021 12:21:01 +0200 |
parents | d4ba4d51f85f |
children | 85e3a630cad9 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Mon Apr 05 12:20:52 2021 +0200 +++ b/mercurial/pure/parsers.py Mon Apr 05 12:21:01 2021 +0200 @@ -17,6 +17,7 @@ ) from ..revlogutils import nodemap as nodemaputil +from ..revlogutils import constants as revlog_constants stringio = pycompat.bytesio @@ -43,13 +44,13 @@ class BaseIndexObject(object): # Format of an index entry according to Python's `struct` language - index_format = b">Qiiiiii20s12x" + index_format = revlog_constants.INDEX_ENTRY_V1.format # 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) + index_size = revlog_constants.INDEX_ENTRY_V1.size # An empty index entry, used as a default value to be overridden, or nullrev null_item = (0, 0, 0, -1, -1, -1, -1, nullid)