(
txn: &T,
change: NodeId,
)
| 273 | } |
| 274 | |
| 275 | fn causal_ancestors<T: GraphTxnT + ?Sized>( |
| 276 | txn: &T, |
| 277 | change: NodeId, |
| 278 | ) -> PristineResult<BTreeSet<NodeId>> { |
| 279 | let mut result = BTreeSet::new(); |
| 280 | let mut pending = vec![change]; |
| 281 | while let Some(current) = pending.pop() { |
| 282 | for hash in txn.get_indexed_change_deps(current)? { |
| 283 | let dependency = |
| 284 | txn.get_internal(&hash)? |
| 285 | .ok_or(PristineError::MissingRegisteredDependency { |
| 286 | change_id: current.get(), |
| 287 | dependency: hash.to_string(), |
| 288 | })?; |
| 289 | if result.insert(dependency) { |
| 290 | pending.push(dependency); |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | Ok(result) |
| 295 | } |
| 296 | |
| 297 | #[cfg(test)] |
| 298 | mod tests { |
no test coverage detected