diff --git a/lib/src/default_revset_engine.rs b/lib/src/default_revset_engine.rs index 0f117f77d..a3b0b1bc6 100644 --- a/lib/src/default_revset_engine.rs +++ b/lib/src/default_revset_engine.rs @@ -74,7 +74,7 @@ impl<'index> Revset<'index> for RevsetImpl<'index> { } fn iter_graph(&self) -> Box)> + '_> { - Box::new(RevsetGraphIterator::new(self)) + Box::new(RevsetGraphIterator::new(self.inner.iter())) } fn change_id_index(&self) -> Box { diff --git a/lib/src/default_revset_graph_iterator.rs b/lib/src/default_revset_graph_iterator.rs index ebebec40d..5139d10ae 100644 --- a/lib/src/default_revset_graph_iterator.rs +++ b/lib/src/default_revset_graph_iterator.rs @@ -18,7 +18,7 @@ use std::collections::{BTreeMap, HashSet}; use crate::backend::CommitId; use crate::default_index_store::{IndexEntry, IndexPosition}; use crate::nightly_shims::BTreeMapExt; -use crate::revset::{Revset, RevsetGraphEdge, RevsetGraphEdgeType}; +use crate::revset::{RevsetGraphEdge, RevsetGraphEdgeType}; // Given an iterator over some set of revisions, yields the same revisions with // associated edge types. @@ -101,9 +101,11 @@ pub struct RevsetGraphIterator<'revset, 'index> { } impl<'revset, 'index> RevsetGraphIterator<'revset, 'index> { - pub fn new(revset: &'revset dyn Revset<'index>) -> RevsetGraphIterator<'revset, 'index> { + pub fn new( + input_set_iter: Box> + 'revset>, + ) -> RevsetGraphIterator<'revset, 'index> { RevsetGraphIterator { - input_set_iter: revset.iter(), + input_set_iter, look_ahead: Default::default(), min_position: IndexPosition::MAX, edges: Default::default(), diff --git a/lib/tests/test_default_revset_graph_iterator.rs b/lib/tests/test_default_revset_graph_iterator.rs index 26a545471..f55721920 100644 --- a/lib/tests/test_default_revset_graph_iterator.rs +++ b/lib/tests/test_default_revset_graph_iterator.rs @@ -66,7 +66,7 @@ fn test_graph_iterator_linearized(skip_transitive_edges: bool) { let root_commit = repo.store().root_commit(); let revset = revset_for_commits(repo.as_ref(), &[&commit_a, &commit_d]); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 2); @@ -105,7 +105,7 @@ fn test_graph_iterator_virtual_octopus(skip_transitive_edges: bool) { let root_commit = repo.store().root_commit(); let revset = revset_for_commits(repo.as_ref(), &[&commit_a, &commit_b, &commit_c, &commit_f]); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 4); @@ -155,7 +155,7 @@ fn test_graph_iterator_simple_fork(skip_transitive_edges: bool) { let root_commit = repo.store().root_commit(); let revset = revset_for_commits(repo.as_ref(), &[&commit_a, &commit_c, &commit_e]); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 3); @@ -195,7 +195,7 @@ fn test_graph_iterator_multiple_missing(skip_transitive_edges: bool) { let root_commit = repo.store().root_commit(); let revset = revset_for_commits(repo.as_ref(), &[&commit_b, &commit_f]); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 2); @@ -238,7 +238,7 @@ fn test_graph_iterator_edge_to_ancestor(skip_transitive_edges: bool) { let repo = tx.commit(); let revset = revset_for_commits(repo.as_ref(), &[&commit_c, &commit_d, &commit_f]); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 3); @@ -296,7 +296,7 @@ fn test_graph_iterator_edge_escapes_from_(skip_transitive_edges: bool) { repo.as_ref(), &[&commit_a, &commit_d, &commit_g, &commit_h, &commit_j], ); - let commits = RevsetGraphIterator::new(revset.as_ref()) + let commits = RevsetGraphIterator::new(revset.iter()) .set_skip_transitive_edges(skip_transitive_edges) .collect_vec(); assert_eq!(commits.len(), 5);