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

Method build_name_conflict

atomic-core/src/change/graph_op.rs:376–411  ·  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

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

Callers

nothing calls this directly

Calls 3

collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected