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

Method build_name_conflict

atomic-core/src/change/graph_op.rs:371–406  ·  view source on GitHub ↗
(
        path: impl Into<String>,
        surviving_claimant: Position<H>,
        losing_claims: impl IntoIterator<Item = (Position<H>, GraphNode<H>, H)>,
        inverse: bool,
    )

Source from the content-addressed store, hash-verified

369 }
370
371 fn build_name_conflict(
372 path: impl Into<String>,
373 surviving_claimant: Position<H>,
374 losing_claims: impl IntoIterator<Item = (Position<H>, GraphNode<H>, H)>,
375 inverse: bool,
376 ) -> Result<Self, String> {
377 let alive = EdgeFlags::FOLDER | EdgeFlags::BLOCK;
378 let deleted = alive | EdgeFlags::DELETED;
379 let edges = losing_claims
380 .into_iter()
381 .map(|(from, to, introduced_by)| NewEdge {
382 previous: if inverse { deleted } else { alive },
383 flag: if inverse { alive } else { deleted },
384 from,
385 to,
386 introduced_by,
387 })
388 .collect();
389 let name = EdgeUpdate {
390 edges,
391 inode: surviving_claimant,
392 };
393 let op = if inverse {
394 GraphOp::UnsolveNameConflict {
395 name,
396 path: path.into(),
397 }
398 } else {
399 GraphOp::SolveNameConflict {
400 name,
401 path: path.into(),
402 }
403 };
404 op.validate_name_conflict()?;
405 Ok(op)
406 }
407
408 /// Validate the exact edge-transition contract for a name-conflict operation.
409 ///

Callers

nothing calls this directly

Calls 3

collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected