Mercurial > public > mercurial-scm > hg
diff mercurial/dirstateutils/docket.py @ 48221:a32a96079e2d
dirstate-v2: initial Python parser
The dirstate-v2 file format should be supported even if Rust extensions are
not enabled. This changeset adds parsing code that is not used yet.
Differential Revision: https://phab.mercurial-scm.org/D11518
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Sun, 03 Oct 2021 13:18:03 +0200 |
parents | d467e44f71d7 |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/mercurial/dirstateutils/docket.py Fri Oct 08 13:15:22 2021 +0200 +++ b/mercurial/dirstateutils/docket.py Sun Oct 03 13:18:03 2021 +0200 @@ -10,14 +10,10 @@ import struct from ..revlogutils import docket as docket_mod - +from . import v2 V2_FORMAT_MARKER = b"dirstate-v2\n" -# Must match the constant of the same name in -# `rust/hg-core/src/dirstate_tree/on_disk.rs` -TREE_METADATA_SIZE = 44 - # * 12 bytes: format marker # * 32 bytes: node ID of the working directory's first parent # * 32 bytes: node ID of the working directory's second parent @@ -29,7 +25,7 @@ # Node IDs are null-padded if shorter than 32 bytes. # A data file shorter than the specified used size is corrupted (truncated) HEADER = struct.Struct( - ">{}s32s32s{}sLB".format(len(V2_FORMAT_MARKER), TREE_METADATA_SIZE) + ">{}s32s32s{}sLB".format(len(V2_FORMAT_MARKER), v2.TREE_METADATA_SIZE) )