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

Method effective_changes

atomic-objects/src/view_snapshot.rs:147–161  ·  view source on GitHub ↗

Compose the **effective** change set (own ∪ ancestors) from an ordered chain of snapshots: `chain[0]` is this view, each subsequent element its parent, up to the root. Order-preserving and deduplicated (root-first, then descendants), so callers get a stable membership list without touching the graph. The caller resolves the chain by walking `parent_view` (each name → its ref → its snapshot); this

(chain: &[&ViewSnapshot])

Source from the content-addressed store, hash-verified

145 /// The caller resolves the chain by walking `parent_view` (each name → its
146 /// ref → its snapshot); this function is the pure composition step.
147 pub fn effective_changes(chain: &[&ViewSnapshot]) -> Vec<String> {
148 use std::collections::HashSet;
149 let mut seen: HashSet<&str> = HashSet::new();
150 let mut out: Vec<String> = Vec::new();
151 // Root-first so inherited history precedes a draft's own additions,
152 // matching the order redb's filter chain yields.
153 for snap in chain.iter().rev() {
154 for h in &snap.own_changes {
155 if seen.insert(h.as_str()) {
156 out.push(h.clone());
157 }
158 }
159 }
160 out
161 }
162
163 /// The size of the effective change set for a resolved ancestor chain
164 /// (`chain[0]` = this view). Deduplicates across the chain.

Callers

nothing calls this directly

Calls 5

iterMethod · 0.45
insertMethod · 0.45
as_strMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected