Show More
@@ -305,14 +305,31 b' impl Repo {' | |||||
305 | } |
|
305 | } | |
306 |
|
306 | |||
307 | fn new_dirstate_map(&self) -> Result<OwningDirstateMap, DirstateError> { |
|
307 | fn new_dirstate_map(&self) -> Result<OwningDirstateMap, DirstateError> { | |
|
308 | if self.has_dirstate_v2() { | |||
|
309 | self.read_docket_and_data_file() | |||
|
310 | } else { | |||
308 | let dirstate_file_contents = self.dirstate_file_contents()?; |
|
311 | let dirstate_file_contents = self.dirstate_file_contents()?; | |
309 | if dirstate_file_contents.is_empty() { |
|
312 | if dirstate_file_contents.is_empty() { | |
310 | self.dirstate_parents.set(DirstateParents::NULL); |
|
313 | self.dirstate_parents.set(DirstateParents::NULL); | |
311 | if self.has_dirstate_v2() { |
|
314 | Ok(OwningDirstateMap::new_empty(Vec::new())) | |
312 | self.dirstate_data_file_uuid.set(None); |
|
315 | } else { | |
|
316 | let (map, parents) = | |||
|
317 | OwningDirstateMap::new_v1(dirstate_file_contents)?; | |||
|
318 | self.dirstate_parents.set(parents); | |||
|
319 | Ok(map) | |||
|
320 | } | |||
|
321 | } | |||
313 | } |
|
322 | } | |
314 | Ok(OwningDirstateMap::new_empty(Vec::new())) |
|
323 | ||
315 | } else if self.has_dirstate_v2() { |
|
324 | fn read_docket_and_data_file( | |
|
325 | &self, | |||
|
326 | ) -> Result<OwningDirstateMap, DirstateError> { | |||
|
327 | let dirstate_file_contents = self.dirstate_file_contents()?; | |||
|
328 | if dirstate_file_contents.is_empty() { | |||
|
329 | self.dirstate_parents.set(DirstateParents::NULL); | |||
|
330 | self.dirstate_data_file_uuid.set(None); | |||
|
331 | return Ok(OwningDirstateMap::new_empty(Vec::new())); | |||
|
332 | } | |||
316 |
|
|
333 | let docket = crate::dirstate_tree::on_disk::read_docket( | |
317 |
|
|
334 | &dirstate_file_contents, | |
318 |
|
|
335 | )?; | |
@@ -321,8 +338,7 b' impl Repo {' | |||||
321 |
|
|
338 | .set(Some(docket.uuid.to_owned())); | |
322 |
|
|
339 | let data_size = docket.data_size(); | |
323 |
|
|
340 | let metadata = docket.tree_metadata(); | |
324 | let mut map = |
|
341 | let mut map = if crate::vfs::is_on_nfs_mount(docket.data_filename()) { | |
325 | if crate::vfs::is_on_nfs_mount(docket.data_filename()) { |
|
|||
326 |
|
|
342 | // Don't mmap on NFS to prevent `SIGBUS` error on deletion | |
327 |
|
|
343 | OwningDirstateMap::new_v2( | |
328 |
|
|
344 | self.hg_vfs().read(docket.data_filename())?, | |
@@ -354,12 +370,6 b' impl Repo {' | |||||
354 |
|
|
370 | map.with_dmap_mut(|m| m.set_write_mode(write_mode)); | |
355 |
|
371 | |||
356 |
|
|
372 | Ok(map) | |
357 | } else { |
|
|||
358 | let (map, parents) = |
|
|||
359 | OwningDirstateMap::new_v1(dirstate_file_contents)?; |
|
|||
360 | self.dirstate_parents.set(parents); |
|
|||
361 | Ok(map) |
|
|||
362 | } |
|
|||
363 | } |
|
373 | } | |
364 |
|
374 | |||
365 | pub fn dirstate_map( |
|
375 | pub fn dirstate_map( |
General Comments 0
You need to be logged in to leave comments.
Login now