rust/hg-core/src/dirstate_tree/dirstate_map.rs
branchstable
changeset 49337 6cd249556e20
parent 49145 dd2503a63d33
child 49365 79b2c98ab7b4
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Tue Jun 14 04:04:08 2022 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Wed Jun 08 19:15:58 2022 +0200
@@ -31,6 +31,13 @@
 /// anymore) is less than this fraction of the total amount of existing data.
 const ACCEPTABLE_UNREACHABLE_BYTES_RATIO: f32 = 0.5;
 
+#[derive(Debug, PartialEq, Eq)]
+/// Version of the on-disk format
+pub enum DirstateVersion {
+    V1,
+    V2,
+}
+
 pub struct DirstateMap<'on_disk> {
     /// Contents of the `.hg/dirstate` file
     pub(super) on_disk: &'on_disk [u8],
@@ -53,6 +60,8 @@
     /// Size of the data used to first load this `DirstateMap`. Used in case
     /// we need to write some new metadata, but no new data on disk.
     pub(super) old_data_size: usize,
+
+    pub(super) dirstate_version: DirstateVersion,
 }
 
 /// Using a plain `HgPathBuf` of the full path from the repository root as a
@@ -434,6 +443,7 @@
             ignore_patterns_hash: [0; on_disk::IGNORE_PATTERNS_HASH_LEN],
             unreachable_bytes: 0,
             old_data_size: 0,
+            dirstate_version: DirstateVersion::V1,
         }
     }