Skip to content

Allow topo::Builder::with_tips and with_ends for non-default pred #1720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions gix-traverse/src/commit/topo/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,6 @@ where
}
}

/// Add commits to start reading from.
///
/// The behavior is similar to specifying additional `ends` in `git rev-list --topo-order ^ends tips`.
pub fn with_tips(mut self, tips: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
self.tips.extend(tips.into_iter().map(Into::into));
self
}

/// Add commits ending the traversal.
///
/// These commits themselves will not be read, i.e. the behavior is similar to specifying additional
/// `ends` in `git rev-list --topo-order ^ends tips`.
pub fn with_ends(mut self, ends: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
self.ends.extend(ends.into_iter().map(Into::into));
self
}

/// Set a `predicate` to filter out revisions from the walk. Can be used to
/// implement e.g. filtering on paths or time. This does *not* exclude the
/// parent(s) of a revision that is excluded. Specify a revision as an 'end'
Expand All @@ -87,6 +70,23 @@ where
Find: gix_object::Find,
Predicate: FnMut(&oid) -> bool,
{
/// Add commits to start reading from.
///
/// The behavior is similar to specifying additional `ends` in `git rev-list --topo-order ^ends tips`.
pub fn with_tips(mut self, tips: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
self.tips.extend(tips.into_iter().map(Into::into));
self
}

/// Add commits ending the traversal.
///
/// These commits themselves will not be read, i.e. the behavior is similar to specifying additional
/// `ends` in `git rev-list --topo-order ^ends tips`.
pub fn with_ends(mut self, ends: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
self.ends.extend(ends.into_iter().map(Into::into));
self
}

/// Set the `sorting` to use for the topological walk.
pub fn sorting(mut self, sorting: Sorting) -> Self {
self.sorting = sorting;
Expand Down
Loading