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

Function print_trace

atomic-cli/src/commands/provenance/command.rs:266–287  ·  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

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