From eef6a77aa402226aa628a7c499954d34080680b9 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 6 Apr 2023 21:39:12 +0900 Subject: [PATCH] revset: reuse reachable dag-range set to calculate roots This also removes the use of RevsetExpression::connected() API from the evaluation engine. --- lib/src/default_revset_engine.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/src/default_revset_engine.rs b/lib/src/default_revset_engine.rs index 2e9282bd7..bbacc0840 100644 --- a/lib/src/default_revset_engine.rs +++ b/lib/src/default_revset_engine.rs @@ -688,11 +688,9 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> { .revset_for_commit_ids(&self.composite_index.heads(&mut candidate_ids.iter()))) } RevsetExpression::Roots(candidates) => { - let connected_set = self.evaluate(&candidates.connected())?; - let filled: HashSet<_> = - connected_set.iter().map(|entry| entry.position()).collect(); - let mut index_entries = vec![]; let candidate_set = self.evaluate(candidates)?; + let (_, filled) = self.collect_dag_range(&*candidate_set, &*candidate_set); + let mut index_entries = vec![]; for candidate in candidate_set.iter() { if !candidate .parent_positions()