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

Function record_deleted_file

atomic-core/src/record/workflow/record/mod.rs:297–327  ·  view source on GitHub ↗

Record a single deleted file. Creates a deletion graph_op for a file that no longer exists in the working copy. # Arguments `detected` - The detected file `options` - Recording options # Returns A `RecordedFile` with deletion hunks. # Example ```rust,ignore use atomic_core::record::workflow::record::{record_deleted_file, RecordingOptions}; let options = RecordingOptions::new(); let recorde

(
    detected: &DetectedFile,
    _options: &RecordingOptions,
)

Source from the content-addressed store, hash-verified

295/// let recorded = record_deleted_file(&detected_file, &options)?;
296/// ```
297pub fn record_deleted_file(
298 detected: &DetectedFile,
299 _options: &RecordingOptions,
300) -> Result<RecordedFile, String> {
301 let mut recorded = RecordedFile::new(&detected.path);
302 recorded.set_kind(DetectionKind::Deleted);
303
304 // Copy inode and position if available
305 if let Some(inode) = detected.inode {
306 recorded.set_inode(inode);
307 }
308 if let Some(position) = detected.position {
309 recorded.set_position(position);
310 }
311
312 // Create a deletion graph_op for the file.
313 // The actual line information would come from the pristine graph traversal
314 // when integrated with the full repository context. The deletion graph_op
315 // marks the file's content edges as deleted in the graph.
316 let local = Local::new(&detected.path, 1);
317 let encoding = detected.encoding;
318 let graph_op = BuiltHunk::new_delete(local, encoding, vec![0], 0);
319 recorded.add_hunk(graph_op);
320
321 // Generate CRDT operations for the deletion
322 let crdt_ops = crdt::build_crdt_ops_for_deleted_file(&detected.path);
323 recorded.set_crdt_ops(crdt_ops.0);
324 recorded.set_crdt_stats(crdt_ops.1);
325
326 Ok(recorded)
327}
328
329/// Record a single modified file.
330///

Callers 5

write_commitMethod · 0.85
test_record_deleted_fileFunction · 0.85
recordMethod · 0.85
process_deleted_fileFunction · 0.85

Calls 7

set_positionMethod · 0.80
set_crdt_opsMethod · 0.80
set_crdt_statsMethod · 0.80
set_kindMethod · 0.45
set_inodeMethod · 0.45
add_hunkMethod · 0.45

Tested by 2

test_record_deleted_fileFunction · 0.68