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

Function print_trace

atomic-cli/src/commands/provenance/command.rs:269–290  ·  view source on GitHub ↗

Print the human-readable flywheel chain: change -> activity -> generated -> agent -> person -> turnParent -> ... (walking `previous`).

(
    repo: &Repository,
    graphs: &[(Hash, ProvenanceGraph)],
    change_hash: &Hash,
    person_did: &str,
)

Source from the content-addressed store, hash-verified

267/// Print the human-readable flywheel chain: change -> activity -> generated ->
268/// agent -> person -> turnParent -> ... (walking `previous`).
269fn print_trace(
270 repo: &Repository,
271 graphs: &[(Hash, ProvenanceGraph)],
272 change_hash: &Hash,
273 person_did: &str,
274) {
275 println!(
276 "{} {}",
277 emphasis("Provenance for change"),
278 info(&change_hash.to_base32())
279 );
280 for (i, (_, graph)) in graphs.iter().enumerate() {
281 if graphs.len() > 1 {
282 println!(
283 "{}",
284 hint(&format!(" [graph {} of {}]", i + 1, graphs.len()))
285 );
286 }
287 let input = map_graph_to_input(repo, graph, change_hash, person_did);
288 print_activity_chain(repo, &input, graph);
289 }
290}
291
292/// Print one activity and walk its `turnParent` chain via `previous`.
293fn print_activity_chain(repo: &Repository, input: &ProvActivityInput, graph: &ProvenanceGraph) {

Callers 1

runMethod · 0.85

Calls 4

map_graph_to_inputFunction · 0.85
print_activity_chainFunction · 0.85
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected