rust/hg-core/src/repo.rs
branchstable
changeset 50221 1891086f6c7f
parent 50211 f5e4248e5bce
child 50222 ecd28d89c29e
equal deleted inserted replaced
50220:35ea3c139104 50221:1891086f6c7f
     1 use crate::changelog::Changelog;
     1 use crate::changelog::Changelog;
     2 use crate::config::{Config, ConfigError, ConfigParseError};
     2 use crate::config::{Config, ConfigError, ConfigParseError};
     3 use crate::dirstate::DirstateParents;
     3 use crate::dirstate::DirstateParents;
       
     4 use crate::dirstate_tree::dirstate_map::DirstateMapWriteMode;
     4 use crate::dirstate_tree::on_disk::Docket as DirstateDocket;
     5 use crate::dirstate_tree::on_disk::Docket as DirstateDocket;
     5 use crate::dirstate_tree::owning::OwningDirstateMap;
     6 use crate::dirstate_tree::owning::OwningDirstateMap;
     6 use crate::errors::HgResultExt;
     7 use crate::errors::HgResultExt;
     7 use crate::errors::{HgError, IoResultExt};
     8 use crate::errors::{HgError, IoResultExt};
     8 use crate::lock::{try_with_lock_no_wait, LockError};
     9 use crate::lock::{try_with_lock_no_wait, LockError};
   434         let (packed_dirstate, old_uuid_to_remove) = if self.has_dirstate_v2() {
   435         let (packed_dirstate, old_uuid_to_remove) = if self.has_dirstate_v2() {
   435             let uuid_opt = self
   436             let uuid_opt = self
   436                 .dirstate_data_file_uuid
   437                 .dirstate_data_file_uuid
   437                 .get_or_init(|| self.read_dirstate_data_file_uuid())?;
   438                 .get_or_init(|| self.read_dirstate_data_file_uuid())?;
   438             let uuid_opt = uuid_opt.as_ref();
   439             let uuid_opt = uuid_opt.as_ref();
   439             let can_append = uuid_opt.is_some();
   440             let write_mode = if uuid_opt.is_some() {
       
   441                 DirstateMapWriteMode::Auto
       
   442             } else {
       
   443                 DirstateMapWriteMode::ForceNewDataFile
       
   444             };
   440             let (data, tree_metadata, append, old_data_size) =
   445             let (data, tree_metadata, append, old_data_size) =
   441                 map.pack_v2(can_append)?;
   446                 map.pack_v2(write_mode)?;
   442 
   447 
   443             // Reuse the uuid, or generate a new one, keeping the old for
   448             // Reuse the uuid, or generate a new one, keeping the old for
   444             // deletion.
   449             // deletion.
   445             let (uuid, old_uuid) = match uuid_opt {
   450             let (uuid, old_uuid) = match uuid_opt {
   446                 Some(uuid) => {
   451                 Some(uuid) => {