just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

index: unify HashSet and Vec of reachable head commits

The order of commits doesn't matter since they are visited in topological (and
chronological) order.

+3 -5
+3 -5
lib/src/default_index/store.rs
··· 16 17 use std::any::Any; 18 use std::collections::HashMap; 19 - use std::collections::HashSet; 20 use std::fs; 21 use std::io; 22 use std::io::Write as _; ··· 192 let operations_dir = self.operations_dir(); 193 let commit_id_length = store.commit_id_length(); 194 let change_id_length = store.change_id_length(); 195 - let mut visited_heads: HashSet<CommitId> = HashSet::new(); 196 - let mut historical_heads: Vec<(CommitId, OperationId)> = Vec::new(); 197 let ops_to_visit: Vec<_> = 198 op_walk::walk_ancestors(slice::from_ref(operation)).try_collect()?; 199 // Pick the latest existing ancestor operation as the parent segment. ··· 225 ops_count = ops_to_visit.len(), 226 "collecting head commits to index" 227 ); 228 for op in &ops_to_visit { 229 for commit_id in op.view()?.all_referenced_commit_ids() { 230 - if visited_heads.insert(commit_id.clone()) { 231 - historical_heads.push((commit_id.clone(), op.id().clone())); 232 } 233 } 234 }
··· 16 17 use std::any::Any; 18 use std::collections::HashMap; 19 use std::fs; 20 use std::io; 21 use std::io::Write as _; ··· 191 let operations_dir = self.operations_dir(); 192 let commit_id_length = store.commit_id_length(); 193 let change_id_length = store.change_id_length(); 194 let ops_to_visit: Vec<_> = 195 op_walk::walk_ancestors(slice::from_ref(operation)).try_collect()?; 196 // Pick the latest existing ancestor operation as the parent segment. ··· 222 ops_count = ops_to_visit.len(), 223 "collecting head commits to index" 224 ); 225 + let mut historical_heads: HashMap<CommitId, OperationId> = HashMap::new(); 226 for op in &ops_to_visit { 227 for commit_id in op.view()?.all_referenced_commit_ids() { 228 + if !historical_heads.contains_key(commit_id) { 229 + historical_heads.insert(commit_id.clone(), op.id().clone()); 230 } 231 } 232 }