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

Method delete_line

atomic-core/src/record/workflow/crdt/builder/branch.rs:277–296  ·  view source on GitHub ↗

Marks a line for deletion. Note: This creates a delete without content. For deletes with content (for diff display), use the `LineOps::delete()` constructor directly.

(&mut self, branch_id: BranchId)

Source from the content-addressed store, hash-verified

275 /// Note: This creates a delete without content. For deletes with content
276 /// (for diff display), use the `LineOps::delete()` constructor directly.
277 pub fn delete_line(&mut self, branch_id: BranchId) {
278 let line_op = LineOps::delete_empty(branch_id);
279
280 // Find which file this branch belongs to
281 if let Some(&(file_idx, _)) = self.branch_index.get(&branch_id) {
282 self.file_ops[file_idx].add_line_op(line_op);
283 } else {
284 // Branch not in index - create a placeholder file op
285 use super::trunk::FileOps;
286 use crate::crdt::TrunkId;
287 use crate::types::NodeId;
288
289 let file_op = FileOps::new(TrunkId::new(NodeId::new(0), 0), String::new(), None);
290 let mut file_op = file_op;
291 file_op.add_line_op(line_op);
292 self.file_ops.push(file_op);
293 }
294
295 self.stats.lines_deleted += 1;
296 }
297
298 /// Applies a line change from the analyzer.
299 ///

Callers 2

apply_line_changeMethod · 0.80
test_builder_delete_lineFunction · 0.80

Calls 3

getMethod · 0.65
add_line_opMethod · 0.45
pushMethod · 0.45

Tested by 1

test_builder_delete_lineFunction · 0.64