index: hide walk_revs() and related types

They are now implementation details of the default index backend.
This commit is contained in:
Yuya Nishihara 2024-03-07 20:40:34 +09:00
parent f5eb172769
commit 8451453f3a
3 changed files with 9 additions and 8 deletions

View file

@ -330,7 +330,11 @@ impl<'a> CompositeIndex<'a> {
self.heads_pos(result)
}
pub fn walk_revs(&self, wanted: &[IndexPosition], unwanted: &[IndexPosition]) -> RevWalk<'a> {
pub(super) fn walk_revs(
&self,
wanted: &[IndexPosition],
unwanted: &[IndexPosition],
) -> RevWalk<'a> {
let mut rev_walk = RevWalk::new(*self);
rev_walk.extend_wanted(wanted.iter().copied());
rev_walk.extend_unwanted(unwanted.iter().copied());

View file

@ -27,9 +27,6 @@ pub use self::composite::{AsCompositeIndex, CompositeIndex, IndexLevelStats, Ind
pub use self::entry::{IndexEntry, IndexPosition};
pub use self::mutable::DefaultMutableIndex;
pub use self::readonly::{DefaultReadonlyIndex, ReadonlyIndexLoadError};
pub use self::rev_walk::{
RevWalk, RevWalkDescendants, RevWalkDescendantsGenerationRange, RevWalkGenerationRange,
};
pub use self::store::{DefaultIndexStore, DefaultIndexStoreError, DefaultIndexStoreInitError};
#[cfg(test)]

View file

@ -200,7 +200,7 @@ impl<P: Ord, T: Ord> RevWalkQueue<P, T> {
}
#[derive(Clone)]
pub struct RevWalk<'a>(RevWalkImpl<'a, CompositeIndex<'a>>);
pub(super) struct RevWalk<'a>(RevWalkImpl<'a, CompositeIndex<'a>>);
impl<'a> RevWalk<'a> {
pub(super) fn new(index: CompositeIndex<'a>) -> Self {
@ -326,7 +326,7 @@ impl<'a, I: RevWalkIndex<'a>> RevWalkImpl<'a, I> {
}
#[derive(Clone)]
pub struct RevWalkGenerationRange<'a>(RevWalkGenerationRangeImpl<'a, CompositeIndex<'a>>);
pub(super) struct RevWalkGenerationRange<'a>(RevWalkGenerationRangeImpl<'a, CompositeIndex<'a>>);
impl<'a> Iterator for RevWalkGenerationRange<'a> {
type Item = IndexEntry<'a>;
@ -337,7 +337,7 @@ impl<'a> Iterator for RevWalkGenerationRange<'a> {
}
#[derive(Clone)]
pub struct RevWalkDescendantsGenerationRange<'a>(
pub(super) struct RevWalkDescendantsGenerationRange<'a>(
RevWalkGenerationRangeImpl<'a, RevWalkDescendantsIndex<'a>>,
);
@ -465,7 +465,7 @@ impl RevWalkItemGenerationRange {
/// Walks descendants from the roots, in order of ascending index position.
#[derive(Clone)]
pub struct RevWalkDescendants<'a> {
pub(super) struct RevWalkDescendants<'a> {
candidate_entries: Vec<IndexEntry<'a>>,
root_positions: HashSet<IndexPosition>,
reachable_positions: HashSet<IndexPosition>,