(
_working_copy: WorkingCopyId,
txn: &atomic_core::pristine::ReadTxn,
cached: &CachedGraphTxn<'_>,
store: &ChangeStore,
visibility: &GraphVisibilityClosure,
entries: &[FileStat
| 4668 | |
| 4669 | #[allow(clippy::too_many_arguments)] |
| 4670 | fn plan_file_moves( |
| 4671 | _working_copy: WorkingCopyId, |
| 4672 | txn: &atomic_core::pristine::ReadTxn, |
| 4673 | cached: &CachedGraphTxn<'_>, |
| 4674 | store: &ChangeStore, |
| 4675 | visibility: &GraphVisibilityClosure, |
| 4676 | entries: &[FileStatusEntry], |
| 4677 | present: &std::collections::HashMap<String, super::name_resolution::ProjectedPathClaim>, |
| 4678 | absent: &std::collections::HashMap<String, super::deferred_tree::ProjectedAbsent>, |
| 4679 | root: &Path, |
| 4680 | content_filter: &dyn crate::content_filter::ContentFilter, |
| 4681 | detect_heuristic_moves: bool, |
| 4682 | ) -> Result<FileMovePlanning, RecordError> { |
| 4683 | use crate::record::{ |
| 4684 | AuthoritativeMove, LossNote, MoveAuthority, MoveBasis, ProbableMove, RenameCandidate, |
| 4685 | PROBABLE_MOVE_THRESHOLD_BPS, |
| 4686 | }; |
| 4687 | |
| 4688 | #[derive(Debug, Clone)] |
| 4689 | struct Candidate { |
| 4690 | old_path: String, |
| 4691 | new_path: String, |
| 4692 | inode: Inode, |
| 4693 | score: u16, |
| 4694 | basis: MoveBasis, |
| 4695 | } |
| 4696 | |
| 4697 | // One span context serves every deleted candidate in this planning pass. |
| 4698 | let spans = super::content::SharedSpanContext::new(cached, store, visibility); |
| 4699 | let load_old_content = |
| 4700 | |inode: Inode, position: Position<NodeId>| -> Result<Vec<u8>, RecordError> { |
| 4701 | if let Some(bytes) = spans |
| 4702 | .render_if_present(inode) |
| 4703 | .map_err(RecordError::Repository)? |
| 4704 | { |
| 4705 | return Ok(bytes); |
| 4706 | } |
| 4707 | super::content::retrieve_content_with_filter_fast_with_fork_info( |
| 4708 | cached, |
| 4709 | store, |
| 4710 | inode, |
| 4711 | position, |
| 4712 | atomic_core::output::alive::RetrieveOptions::new() |
| 4713 | .with_graph_visibility(visibility.clone()), |
| 4714 | ) |
| 4715 | .map(|(content, _)| content) |
| 4716 | .map_err(|error| RecordError::Database(error.to_string())) |
| 4717 | }; |
| 4718 | let make_plan = |old_path: &str, |
| 4719 | new_path: &str, |
| 4720 | inode: Inode| |
| 4721 | -> Result<FileMovePlan, RecordError> { |
| 4722 | let source = present.get(old_path).ok_or_else(|| { |
| 4723 | RecordError::Database(format!( |
| 4724 | "FileMove source '{}' is not one uncontested visible path claim", |
| 4725 | old_path |
| 4726 | )) |
| 4727 | })?; |
no test coverage detected