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

Function collect_working_files

atomic-core/src/record/workflow/collect.rs:436–467  ·  view source on GitHub ↗

Collect files from the working copy. Scans the working copy to find all files present on disk. This is the complement to `collect_tracked_files` for detecting added/deleted files. # Arguments `working_copy` - Working copy interface `prefix` - Path prefix filter (empty = all files) # Returns A `CollectionResult ` containing all working copy files. # Behavior - Walks the working c

(
    working_copy: &W,
    prefix: &str,
)

Source from the content-addressed store, hash-verified

434/// }
435/// ```
436pub fn collect_working_files<W>(
437 working_copy: &W,
438 prefix: &str,
439) -> RecordResult<CollectionResult<WorkingFile>>
440where
441 W: WorkingCopyRead,
442{
443 let mut result = CollectionResult::new();
444
445 // Walk the working copy directory tree
446 let paths = working_copy
447 .walk_files(prefix)
448 .map_err(|e| RecordError::Io(std::io::Error::other(e.to_string())))?;
449
450 for path in paths {
451 let mut file = WorkingFile::new(&path);
452
453 // Check if it's a directory
454 if working_copy.is_directory(&path) {
455 file = file.as_directory();
456 }
457
458 // Try to get mtime
459 if let Ok(mtime) = working_copy.modified_time(&path) {
460 file = file.with_mtime(mtime);
461 }
462
463 result.add(file);
464 }
465
466 Ok(result)
467}
468
469/// Collect working copy state for a specific set of paths.
470///

Calls 6

walk_filesMethod · 0.45
is_directoryMethod · 0.45
as_directoryMethod · 0.45
modified_timeMethod · 0.45
with_mtimeMethod · 0.45
addMethod · 0.45