diff --git a/lib/src/default_index_store.rs b/lib/src/default_index_store.rs index 5502b41f5..acad29ea8 100644 --- a/lib/src/default_index_store.rs +++ b/lib/src/default_index_store.rs @@ -1055,7 +1055,7 @@ impl<'a> CompositeIndex<'a> { self.heads_pos(result) } - pub(crate) fn walk_revs(&self, wanted: &[CommitId], unwanted: &[CommitId]) -> RevWalk<'a> { + pub fn walk_revs(&self, wanted: &[CommitId], unwanted: &[CommitId]) -> RevWalk<'a> { let mut rev_walk = RevWalk::new(self.clone()); for pos in wanted.iter().map(|id| self.commit_id_to_pos(id).unwrap()) { rev_walk.add_wanted(pos); @@ -2759,6 +2759,7 @@ mod tests { let walk_commit_ids = |wanted: &[CommitId], unwanted: &[CommitId]| { index + .as_composite() .walk_revs(wanted, unwanted) .map(|entry| entry.commit_id()) .collect_vec() @@ -2848,6 +2849,7 @@ mod tests { let walk_commit_ids = |wanted: &[CommitId], unwanted: &[CommitId], range: Range| { index + .as_composite() .walk_revs(wanted, unwanted) .filter_by_generation(range) .map(|entry| entry.commit_id()) @@ -2924,6 +2926,7 @@ mod tests { let walk_commit_ids = |wanted: &[CommitId], range: Range| { index + .as_composite() .walk_revs(wanted, &[]) .filter_by_generation(range) .map(|entry| entry.commit_id()) @@ -2997,6 +3000,7 @@ mod tests { .map(|id| index.as_composite().commit_id_to_pos(id).unwrap()) .collect_vec(); index + .as_composite() .walk_revs(heads, &[]) .descendants_filtered_by_generation(&root_positions, range) .map(|entry| entry.commit_id()) diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index f34a70a96..3ce375273 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -195,18 +195,21 @@ fn test_index_commits_criss_cross(use_git: bool) { // RevWalk deduplicates chains by entry. assert_eq!( index + .as_composite() .walk_revs(&[left_commits[num_generations - 1].id().clone()], &[]) .count(), 2 * num_generations ); assert_eq!( index + .as_composite() .walk_revs(&[right_commits[num_generations - 1].id().clone()], &[]) .count(), 2 * num_generations ); assert_eq!( index + .as_composite() .walk_revs( &[left_commits[num_generations - 1].id().clone()], &[left_commits[num_generations - 2].id().clone()] @@ -216,6 +219,7 @@ fn test_index_commits_criss_cross(use_git: bool) { ); assert_eq!( index + .as_composite() .walk_revs( &[right_commits[num_generations - 1].id().clone()], &[right_commits[num_generations - 2].id().clone()] @@ -228,6 +232,7 @@ fn test_index_commits_criss_cross(use_git: bool) { // be more expensive than RevWalk, but should still finish in reasonable time. assert_eq!( index + .as_composite() .walk_revs(&[left_commits[num_generations - 1].id().clone()], &[]) .filter_by_generation(0..(num_generations + 1) as u32) .count(), @@ -235,6 +240,7 @@ fn test_index_commits_criss_cross(use_git: bool) { ); assert_eq!( index + .as_composite() .walk_revs(&[right_commits[num_generations - 1].id().clone()], &[]) .filter_by_generation(0..(num_generations + 1) as u32) .count(), @@ -242,6 +248,7 @@ fn test_index_commits_criss_cross(use_git: bool) { ); assert_eq!( index + .as_composite() .walk_revs( &[left_commits[num_generations - 1].id().clone()], &[left_commits[num_generations - 2].id().clone()] @@ -252,6 +259,7 @@ fn test_index_commits_criss_cross(use_git: bool) { ); assert_eq!( index + .as_composite() .walk_revs( &[right_commits[num_generations - 1].id().clone()], &[right_commits[num_generations - 2].id().clone()]