equal
deleted
inserted
replaced
48 /// See on_disk::Header |
48 /// See on_disk::Header |
49 pub(super) ignore_patterns_hash: on_disk::IgnorePatternsHash, |
49 pub(super) ignore_patterns_hash: on_disk::IgnorePatternsHash, |
50 |
50 |
51 /// How many bytes of `on_disk` are not used anymore |
51 /// How many bytes of `on_disk` are not used anymore |
52 pub(super) unreachable_bytes: u32, |
52 pub(super) unreachable_bytes: u32, |
|
53 |
|
54 /// Size of the data used to first load this `DirstateMap`. Used in case |
|
55 /// we need to write some new metadata, but no new data on disk. |
|
56 pub(super) old_data_size: usize, |
53 } |
57 } |
54 |
58 |
55 /// Using a plain `HgPathBuf` of the full path from the repository root as a |
59 /// Using a plain `HgPathBuf` of the full path from the repository root as a |
56 /// map key would also work: all paths in a given map have the same parent |
60 /// map key would also work: all paths in a given map have the same parent |
57 /// path, so comparing full paths gives the same result as comparing base |
61 /// path, so comparing full paths gives the same result as comparing base |
434 root: ChildNodes::default(), |
438 root: ChildNodes::default(), |
435 nodes_with_entry_count: 0, |
439 nodes_with_entry_count: 0, |
436 nodes_with_copy_source_count: 0, |
440 nodes_with_copy_source_count: 0, |
437 ignore_patterns_hash: [0; on_disk::IGNORE_PATTERNS_HASH_LEN], |
441 ignore_patterns_hash: [0; on_disk::IGNORE_PATTERNS_HASH_LEN], |
438 unreachable_bytes: 0, |
442 unreachable_bytes: 0, |
|
443 old_data_size: 0, |
439 } |
444 } |
440 } |
445 } |
441 |
446 |
442 #[timed] |
447 #[timed] |
443 pub fn new_v2( |
448 pub fn new_v2( |
1230 } |
1235 } |
1231 |
1236 |
1232 /// Returns new data and metadata together with whether that data should be |
1237 /// Returns new data and metadata together with whether that data should be |
1233 /// appended to the existing data file whose content is at |
1238 /// appended to the existing data file whose content is at |
1234 /// `map.on_disk` (true), instead of written to a new data file |
1239 /// `map.on_disk` (true), instead of written to a new data file |
1235 /// (false). |
1240 /// (false), and the previous size of data on disk. |
1236 #[timed] |
1241 #[timed] |
1237 pub fn pack_v2( |
1242 pub fn pack_v2( |
1238 &self, |
1243 &self, |
1239 can_append: bool, |
1244 can_append: bool, |
1240 ) -> Result<(Vec<u8>, on_disk::TreeMetadata, bool), DirstateError> { |
1245 ) -> Result<(Vec<u8>, on_disk::TreeMetadata, bool, usize), DirstateError> |
|
1246 { |
1241 let map = self.get_map(); |
1247 let map = self.get_map(); |
1242 on_disk::write(map, can_append) |
1248 on_disk::write(map, can_append) |
1243 } |
1249 } |
1244 |
1250 |
1245 /// `callback` allows the caller to process and do something with the |
1251 /// `callback` allows the caller to process and do something with the |
1793 false, |
1799 false, |
1794 false, |
1800 false, |
1795 None, |
1801 None, |
1796 )?; |
1802 )?; |
1797 |
1803 |
1798 let (packed, metadata, _should_append) = map.pack_v2(false)?; |
1804 let (packed, metadata, _should_append, _old_data_size) = |
|
1805 map.pack_v2(false)?; |
1799 let packed_len = packed.len(); |
1806 let packed_len = packed.len(); |
1800 assert!(packed_len > 0); |
1807 assert!(packed_len > 0); |
1801 |
1808 |
1802 // Recreate "from disk" |
1809 // Recreate "from disk" |
1803 let mut map = OwningDirstateMap::new_v2( |
1810 let mut map = OwningDirstateMap::new_v2( |