equal
deleted
inserted
replaced
855 Err(e) => match e { |
855 Err(e) => match e { |
856 HgError::IoError { error, context } => { |
856 HgError::IoError { error, context } => { |
857 if error.kind() != ErrorKind::NotFound { |
857 if error.kind() != ErrorKind::NotFound { |
858 return Err(HgError::IoError { error, context }); |
858 return Err(HgError::IoError { error, context }); |
859 } |
859 } |
860 self.vfs.create(&self.data_file)? |
860 self.vfs.create(&self.data_file, true)? |
861 } |
861 } |
862 e => return Err(e), |
862 e => return Err(e), |
863 }, |
863 }, |
864 }; |
864 }; |
865 transaction.add(&self.data_file, data_size); |
865 transaction.add(&self.data_file, data_size); |
962 if let Some(handles) = &mut self.writing_handles { |
962 if let Some(handles) = &mut self.writing_handles { |
963 handles.index_handle.flush()?; |
963 handles.index_handle.flush()?; |
964 self.writing_handles.take(); |
964 self.writing_handles.take(); |
965 self.segment_file.writing_handle.take(); |
965 self.segment_file.writing_handle.take(); |
966 } |
966 } |
967 let mut new_data_file_handle = self.vfs.create(&self.data_file)?; |
967 let mut new_data_file_handle = |
|
968 self.vfs.create(&self.data_file, true)?; |
968 // Drop any potential data, possibly redundant with the VFS impl. |
969 // Drop any potential data, possibly redundant with the VFS impl. |
969 new_data_file_handle |
970 new_data_file_handle |
970 .set_len(0) |
971 .set_len(0) |
971 .when_writing_file(&self.data_file)?; |
972 .when_writing_file(&self.data_file)?; |
972 |
973 |
986 |
987 |
987 if let Some(index_path) = new_index_file_path { |
988 if let Some(index_path) = new_index_file_path { |
988 self.index_file = index_path |
989 self.index_file = index_path |
989 } |
990 } |
990 |
991 |
991 let mut new_index_handle = self.vfs.create(&self.index_file)?; |
992 let mut new_index_handle = self.vfs.create(&self.index_file, true)?; |
992 let mut new_data = Vec::with_capacity(self.len() * INDEX_ENTRY_SIZE); |
993 let mut new_data = Vec::with_capacity(self.len() * INDEX_ENTRY_SIZE); |
993 for r in 0..self.len() { |
994 for r in 0..self.len() { |
994 let rev = Revision(r as BaseRevision); |
995 let rev = Revision(r as BaseRevision); |
995 let entry = self.index.entry_binary(rev).unwrap_or_else(|| { |
996 let entry = self.index.entry_binary(rev).unwrap_or_else(|| { |
996 panic!( |
997 panic!( |