MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / collect

Method collect

atomic-cli/src/commands/git/parallel.rs:9226–9256  ·  view source on GitHub ↗
(files: &[ParsedFile])

Source from the content-addressed store, hash-verified

9224
9225impl RenameCollisions {
9226 fn collect(files: &[ParsedFile]) -> Self {
9227 let added: HashSet<&str> = files
9228 .iter()
9229 .filter(|file| file.operation == FileOperation::Added)
9230 .map(|file| file.path.as_str())
9231 .collect();
9232 let deleted: HashSet<&str> = files
9233 .iter()
9234 .filter(|file| file.operation == FileOperation::Deleted)
9235 .map(|file| file.path.as_str())
9236 .collect();
9237 let renames = files
9238 .iter()
9239 .filter(|file| file.operation == FileOperation::Renamed)
9240 .filter_map(|file| file.old_path.as_deref().map(|old_path| (file, old_path)));
9241 let onto_deleted: HashMap<String, (Option<Vec<u8>>, Option<u32>)> = renames
9242 .clone()
9243 .filter(|(file, _)| deleted.contains(file.path.as_str()))
9244 .map(|(file, _)| (file.path.clone(), (file.new_content.clone(), file.new_mode)))
9245 .collect();
9246 let reoccupied = renames
9247 .filter(|(file, old_path)| {
9248 !onto_deleted.contains_key(&file.path) && added.contains(old_path)
9249 })
9250 .map(|(file, old_path)| (old_path.to_string(), file.old_content.clone()))
9251 .collect();
9252 Self {
9253 onto_deleted,
9254 reoccupied,
9255 }
9256 }
9257
9258 fn is_empty(&self) -> bool {
9259 self.onto_deleted.is_empty() && self.reoccupied.is_empty()

Callers 15

apply_agent_helpFunction · 0.45
mainFunction · 0.45
ctx_listFunction · 0.45
verbsFunction · 0.45
render_forFunction · 0.45
changesMethod · 0.45
runMethod · 0.45
git_status_jsonFunction · 0.45
complete_view_namesFunction · 0.45
complete_change_hashesFunction · 0.45
runMethod · 0.45

Calls 5

contains_keyMethod · 0.80
iterMethod · 0.45
as_strMethod · 0.45
cloneMethod · 0.45
containsMethod · 0.45