Mercurial > hg
comparison rust/hg-core/src/dirstate_tree/on_disk.rs @ 50222:ecd28d89c29e stable
dirstate-v2: add devel config option to control write behavior
This will help us to write predictable tests checking behavior in each case.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 28 Feb 2023 15:49:53 +0100 |
parents | 1891086f6c7f |
children | 6cce0afc1454 |
comparison
equal
deleted
inserted
replaced
50221:1891086f6c7f | 50222:ecd28d89c29e |
---|---|
311 nodes_with_copy_source_count: meta.nodes_with_copy_source_count.get(), | 311 nodes_with_copy_source_count: meta.nodes_with_copy_source_count.get(), |
312 ignore_patterns_hash: meta.ignore_patterns_hash, | 312 ignore_patterns_hash: meta.ignore_patterns_hash, |
313 unreachable_bytes: meta.unreachable_bytes.get(), | 313 unreachable_bytes: meta.unreachable_bytes.get(), |
314 old_data_size: on_disk.len(), | 314 old_data_size: on_disk.len(), |
315 dirstate_version: DirstateVersion::V2, | 315 dirstate_version: DirstateVersion::V2, |
316 write_mode: DirstateMapWriteMode::Auto, | |
316 }; | 317 }; |
317 Ok(dirstate_map) | 318 Ok(dirstate_map) |
318 } | 319 } |
319 | 320 |
320 impl Node { | 321 impl Node { |
639 write_mode: DirstateMapWriteMode, | 640 write_mode: DirstateMapWriteMode, |
640 ) -> Result<(Vec<u8>, TreeMetadata, bool, usize), DirstateError> { | 641 ) -> Result<(Vec<u8>, TreeMetadata, bool, usize), DirstateError> { |
641 let append = match write_mode { | 642 let append = match write_mode { |
642 DirstateMapWriteMode::Auto => dirstate_map.write_should_append(), | 643 DirstateMapWriteMode::Auto => dirstate_map.write_should_append(), |
643 DirstateMapWriteMode::ForceNewDataFile => false, | 644 DirstateMapWriteMode::ForceNewDataFile => false, |
645 DirstateMapWriteMode::ForceAppend => true, | |
644 }; | 646 }; |
645 if append { | 647 if append { |
646 log::trace!("appending to the dirstate data file"); | 648 log::trace!("appending to the dirstate data file"); |
647 } else { | 649 } else { |
648 log::trace!("creating new dirstate data file"); | 650 log::trace!("creating new dirstate data file"); |