##// END OF EJS Templates
dirstate-v2: Reserve a few bytes of space for future extensions...
Simon Sapin -
r48484:852262e2 default
parent child Browse files
Show More
@@ -16,7 +16,7 b' V2_FORMAT_MARKER = b"dirstate-v2\\n"'
16
16
17 # Must match the constant of the same name in
17 # Must match the constant of the same name in
18 # `rust/hg-core/src/dirstate_tree/on_disk.rs`
18 # `rust/hg-core/src/dirstate_tree/on_disk.rs`
19 TREE_METADATA_SIZE = 40
19 TREE_METADATA_SIZE = 44
20
20
21 # * 12 bytes: format marker
21 # * 12 bytes: format marker
22 # * 32 bytes: node ID of the working directory's first parent
22 # * 32 bytes: node ID of the working directory's first parent
@@ -49,13 +49,13 b' pub(super) type IgnorePatternsHash = [u8'
49
49
50 /// Must match the constant of the same name in
50 /// Must match the constant of the same name in
51 /// `mercurial/dirstateutils/docket.py`
51 /// `mercurial/dirstateutils/docket.py`
52 const TREE_METADATA_SIZE: usize = 40;
52 const TREE_METADATA_SIZE: usize = 44;
53
53
54 /// Make sure that size-affecting changes are made knowingly
54 /// Make sure that size-affecting changes are made knowingly
55 #[allow(unused)]
55 #[allow(unused)]
56 fn static_assert_size_of() {
56 fn static_assert_size_of() {
57 let _ = std::mem::transmute::<DocketHeader, [u8; 121]>;
58 let _ = std::mem::transmute::<TreeMetadata, [u8; TREE_METADATA_SIZE]>;
57 let _ = std::mem::transmute::<TreeMetadata, [u8; TREE_METADATA_SIZE]>;
58 let _ = std::mem::transmute::<DocketHeader, [u8; TREE_METADATA_SIZE + 81]>;
59 let _ = std::mem::transmute::<Node, [u8; 43]>;
59 let _ = std::mem::transmute::<Node, [u8; 43]>;
60 }
60 }
61
61
@@ -90,6 +90,12 b' struct TreeMetadata {'
90 /// How many bytes of this data file are not used anymore
90 /// How many bytes of this data file are not used anymore
91 unreachable_bytes: Size,
91 unreachable_bytes: Size,
92
92
93 /// Current version always sets these bytes to zero when creating or
94 /// updating a dirstate. Future versions could assign some bits to signal
95 /// for example "the version that last wrote/updated this dirstate did so
96 /// in such and such way that can be relied on by versions that know to."
97 unused: [u8; 4],
98
93 /// If non-zero, a hash of ignore files that were used for some previous
99 /// If non-zero, a hash of ignore files that were used for some previous
94 /// run of the `status` algorithm.
100 /// run of the `status` algorithm.
95 ///
101 ///
@@ -579,6 +585,7 b' pub(super) fn write('
579 .nodes_with_copy_source_count
585 .nodes_with_copy_source_count
580 .into(),
586 .into(),
581 unreachable_bytes: dirstate_map.unreachable_bytes.into(),
587 unreachable_bytes: dirstate_map.unreachable_bytes.into(),
588 unused: [0; 4],
582 ignore_patterns_hash: dirstate_map.ignore_patterns_hash,
589 ignore_patterns_hash: dirstate_map.ignore_patterns_hash,
583 };
590 };
584 Ok((writer.out, meta.as_bytes().to_vec(), append))
591 Ok((writer.out, meta.as_bytes().to_vec(), append))
General Comments 0
You need to be logged in to leave comments. Login now