rust/hg-core/src/dirstate_tree/dirstate_map.rs
branchstable
changeset 49145 dd2503a63d33
parent 49003 ce919b1a1063
child 49147 10b9f11daf15
child 49337 6cd249556e20
equal deleted inserted replaced
49068:90e564882f07 49145:dd2503a63d33
    47     /// See on_disk::Header
    47     /// See on_disk::Header
    48     pub(super) ignore_patterns_hash: on_disk::IgnorePatternsHash,
    48     pub(super) ignore_patterns_hash: on_disk::IgnorePatternsHash,
    49 
    49 
    50     /// How many bytes of `on_disk` are not used anymore
    50     /// How many bytes of `on_disk` are not used anymore
    51     pub(super) unreachable_bytes: u32,
    51     pub(super) unreachable_bytes: u32,
       
    52 
       
    53     /// Size of the data used to first load this `DirstateMap`. Used in case
       
    54     /// we need to write some new metadata, but no new data on disk.
       
    55     pub(super) old_data_size: usize,
    52 }
    56 }
    53 
    57 
    54 /// Using a plain `HgPathBuf` of the full path from the repository root as a
    58 /// Using a plain `HgPathBuf` of the full path from the repository root as a
    55 /// map key would also work: all paths in a given map have the same parent
    59 /// map key would also work: all paths in a given map have the same parent
    56 /// path, so comparing full paths gives the same result as comparing base
    60 /// path, so comparing full paths gives the same result as comparing base
   427             root: ChildNodes::default(),
   431             root: ChildNodes::default(),
   428             nodes_with_entry_count: 0,
   432             nodes_with_entry_count: 0,
   429             nodes_with_copy_source_count: 0,
   433             nodes_with_copy_source_count: 0,
   430             ignore_patterns_hash: [0; on_disk::IGNORE_PATTERNS_HASH_LEN],
   434             ignore_patterns_hash: [0; on_disk::IGNORE_PATTERNS_HASH_LEN],
   431             unreachable_bytes: 0,
   435             unreachable_bytes: 0,
       
   436             old_data_size: 0,
   432         }
   437         }
   433     }
   438     }
   434 
   439 
   435     #[timed]
   440     #[timed]
   436     pub fn new_v2(
   441     pub fn new_v2(
   987     }
   992     }
   988 
   993 
   989     /// Returns new data and metadata together with whether that data should be
   994     /// Returns new data and metadata together with whether that data should be
   990     /// appended to the existing data file whose content is at
   995     /// appended to the existing data file whose content is at
   991     /// `map.on_disk` (true), instead of written to a new data file
   996     /// `map.on_disk` (true), instead of written to a new data file
   992     /// (false).
   997     /// (false), and the previous size of data on disk.
   993     #[timed]
   998     #[timed]
   994     pub fn pack_v2(
   999     pub fn pack_v2(
   995         &self,
  1000         &self,
   996         can_append: bool,
  1001         can_append: bool,
   997     ) -> Result<(Vec<u8>, on_disk::TreeMetadata, bool), DirstateError> {
  1002     ) -> Result<(Vec<u8>, on_disk::TreeMetadata, bool, usize), DirstateError>
       
  1003     {
   998         let map = self.get_map();
  1004         let map = self.get_map();
   999         on_disk::write(map, can_append)
  1005         on_disk::write(map, can_append)
  1000     }
  1006     }
  1001 
  1007 
  1002     /// `callback` allows the caller to process and do something with the
  1008     /// `callback` allows the caller to process and do something with the