equal
deleted
inserted
replaced
907 } |
907 } |
908 } |
908 } |
909 |
909 |
910 #[timed] |
910 #[timed] |
911 pub fn pack_v1( |
911 pub fn pack_v1( |
912 &mut self, |
912 &self, |
913 parents: DirstateParents, |
913 parents: DirstateParents, |
914 ) -> Result<Vec<u8>, DirstateError> { |
914 ) -> Result<Vec<u8>, DirstateError> { |
915 let map = self.get_map_mut(); |
915 let map = self.get_map(); |
916 // Optizimation (to be measured?): pre-compute size to avoid `Vec` |
916 // Optizimation (to be measured?): pre-compute size to avoid `Vec` |
917 // reallocations |
917 // reallocations |
918 let mut size = parents.as_bytes().len(); |
918 let mut size = parents.as_bytes().len(); |
919 for node in map.iter_nodes() { |
919 for node in map.iter_nodes() { |
920 let node = node?; |
920 let node = node?; |
947 /// appended to the existing data file whose content is at |
947 /// appended to the existing data file whose content is at |
948 /// `map.on_disk` (true), instead of written to a new data file |
948 /// `map.on_disk` (true), instead of written to a new data file |
949 /// (false). |
949 /// (false). |
950 #[timed] |
950 #[timed] |
951 pub fn pack_v2( |
951 pub fn pack_v2( |
952 &mut self, |
952 &self, |
953 can_append: bool, |
953 can_append: bool, |
954 ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError> { |
954 ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError> { |
955 let map = self.get_map_mut(); |
955 let map = self.get_map(); |
956 on_disk::write(map, can_append) |
956 on_disk::write(map, can_append) |
957 } |
957 } |
958 |
958 |
959 pub fn status<'a>( |
959 pub fn status<'a>( |
960 &'a mut self, |
960 &'a mut self, |