Skip to content

Commit 1cfeb11

Browse files
committed
adapt to changes in gix-traverse
1 parent 2a9c178 commit 1cfeb11

File tree

11 files changed

+22
-31
lines changed

11 files changed

+22
-31
lines changed

examples/log.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use clap::Parser;
88
use gix::{
99
bstr::{BString, ByteSlice},
1010
date::time::format,
11-
traverse::commit::Sorting,
11+
traverse::commit::simple::Sorting,
1212
};
1313

1414
fn main() {

gitoxide-core/src/repository/commitgraph/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub(crate) mod function {
22
use std::{borrow::Cow, ffi::OsString};
33

44
use anyhow::{bail, Context};
5-
use gix::{prelude::ObjectIdExt, traverse::commit::Sorting};
5+
use gix::{prelude::ObjectIdExt, traverse::commit::simple::Sorting};
66

77
use crate::OutputFormat;
88

gitoxide-core/src/repository/revision/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 0..=2;
1717

1818
pub(crate) mod function {
1919
use anyhow::{bail, Context};
20-
use gix::{hashtable::HashMap, traverse::commit::Sorting, Progress};
20+
use gix::{hashtable::HashMap, traverse::commit::simple::Sorting, Progress};
2121
use layout::{
2222
backends::svg::SVGWriter,
2323
core::{base::Orientation, geometry::Point, style::StyleAttr},

gix-diff/tests/tree/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,10 @@ mod changes {
129129
}
130130

131131
fn all_commits(db: &gix_odb::Handle) -> HashMap<String, ObjectId> {
132-
use gix_traverse::commit;
133132
let mut buf = Vec::new();
134133

135134
let head = head_of(db);
136-
commit::Simple::new(Some(head), &db)
135+
gix_traverse::commit::Simple::new(Some(head), &db)
137136
.collect::<Result<Vec<_>, _>>()
138137
.expect("valid iteration")
139138
.into_iter()

gix-pack/tests/pack/data/output/count_and_entries.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use gix_pack::data::{
99
output,
1010
output::{count, entry},
1111
};
12-
use gix_traverse::commit;
1312

1413
use crate::pack::{
1514
data::output::{db, DbKind},
@@ -241,7 +240,7 @@ fn traversals() -> crate::Result {
241240
.copied()
242241
{
243242
let head = hex_to_id("dfcb5e39ac6eb30179808bbab721e8a28ce1b52e");
244-
let mut commits = commit::Simple::new(Some(head), db.clone())
243+
let mut commits = gix_traverse::commit::Simple::new(Some(head), db.clone())
245244
.map(Result::unwrap)
246245
.map(|c| c.id)
247246
.collect::<Vec<_>>();

gix/src/ext/object_id.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use gix_hash::ObjectId;
2-
use gix_traverse::commit::Simple;
32

43
pub trait Sealed {}
54

6-
pub type AncestorsIter<Find> = Simple<Find, fn(&gix_hash::oid) -> bool>;
5+
pub type AncestorsIter<Find> = gix_traverse::commit::Simple<Find, fn(&gix_hash::oid) -> bool>;
76

87
/// An extension trait to add functionality to [`ObjectId`]s.
98
pub trait ObjectIdExt: Sealed {
@@ -23,7 +22,7 @@ impl ObjectIdExt for ObjectId {
2322
where
2423
Find: gix_object::Find,
2524
{
26-
Simple::new(Some(self), find)
25+
gix_traverse::commit::Simple::new(Some(self), find)
2726
}
2827

2928
fn attach(self, repo: &crate::Repository) -> crate::Id<'_> {

gix/src/remote/connection/fetch/update_refs/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub(crate) fn update(
162162
.to_owned()
163163
.ancestors(&repo.objects)
164164
.sorting(
165-
gix_traverse::commit::Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
165+
gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
166166
seconds: local_commit_time
167167
},
168168
)

gix/src/revision/spec/parse/delegate/navigate.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use gix_revision::spec::parse::{
66
delegate,
77
delegate::{PeelTo, Traversal},
88
};
9-
use gix_traverse::commit::Sorting;
109

1110
use crate::{
1211
bstr::{BStr, ByteSlice},
@@ -193,7 +192,7 @@ impl<'repo> delegate::Navigate for Delegate<'repo> {
193192
match oid
194193
.attach(repo)
195194
.ancestors()
196-
.sorting(Sorting::ByCommitTimeNewestFirst)
195+
.sorting(gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirst)
197196
.all()
198197
{
199198
Ok(iter) => {
@@ -242,15 +241,10 @@ impl<'repo> delegate::Navigate for Delegate<'repo> {
242241
references
243242
.peeled()
244243
.filter_map(Result::ok)
245-
.filter(|r| {
246-
r.id()
247-
.object()
248-
.ok()
249-
.map_or(false, |obj| obj.kind == gix_object::Kind::Commit)
250-
})
244+
.filter(|r| r.id().header().ok().map_or(false, |obj| obj.kind().is_commit()))
251245
.filter_map(|r| r.detach().peeled),
252246
)
253-
.sorting(Sorting::ByCommitTimeNewestFirst)
247+
.sorting(gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirst)
254248
.all()
255249
{
256250
Ok(iter) => {

gix/src/revision/walk.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{ext::ObjectIdExt, revision, Repository};
88
#[allow(missing_docs)]
99
pub enum Error {
1010
#[error(transparent)]
11-
AncestorIter(#[from] gix_traverse::commit::simple::Error),
11+
SimpleTraversal(#[from] gix_traverse::commit::simple::Error),
1212
#[error(transparent)]
1313
ShallowCommits(#[from] crate::shallow::open::Error),
1414
#[error(transparent)]
@@ -22,8 +22,8 @@ pub struct Info<'repo> {
2222
pub id: gix_hash::ObjectId,
2323
/// All parent ids we have encountered. Note that these will be at most one if [`Parents::First`][gix_traverse::commit::Parents::First] is enabled.
2424
pub parent_ids: gix_traverse::commit::ParentIds,
25-
/// The time at which the commit was created. It's only `Some(_)` if sorting is not [`Sorting::BreadthFirst`][gix_traverse::commit::Sorting::BreadthFirst],
26-
/// as the walk needs to require the commit-date.
25+
/// The time at which the commit was created. It will only be `Some(_)` if the chosen traversal was
26+
/// taking dates into consideration.
2727
pub commit_time: Option<gix_date::SecondsSinceUnixEpoch>,
2828

2929
repo: &'repo Repository,
@@ -91,7 +91,7 @@ impl<'repo> Info<'repo> {
9191
pub struct Platform<'repo> {
9292
pub(crate) repo: &'repo Repository,
9393
pub(crate) tips: Vec<ObjectId>,
94-
pub(crate) sorting: gix_traverse::commit::Sorting,
94+
pub(crate) sorting: gix_traverse::commit::simple::Sorting,
9595
pub(crate) parents: gix_traverse::commit::Parents,
9696
pub(crate) use_commit_graph: Option<bool>,
9797
pub(crate) commit_graph: Option<gix_commitgraph::Graph>,
@@ -113,7 +113,7 @@ impl<'repo> Platform<'repo> {
113113
/// Create-time builder methods
114114
impl<'repo> Platform<'repo> {
115115
/// Set the sort mode for commits to the given value. The default is to order topologically breadth-first.
116-
pub fn sorting(mut self, sorting: gix_traverse::commit::Sorting) -> Self {
116+
pub fn sorting(mut self, sorting: gix_traverse::commit::simple::Sorting) -> Self {
117117
self.sorting = sorting;
118118
self
119119
}

gix/tests/id/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mod ancestors {
8787
let commits_by_commit_date = head
8888
.ancestors()
8989
.use_commit_graph(!use_commit_graph)
90-
.sorting(commit::Sorting::ByCommitTimeNewestFirst)
90+
.sorting(commit::simple::Sorting::ByCommitTimeNewestFirst)
9191
.all()?
9292
.map(|c| c.map(gix::revision::walk::Info::detach))
9393
.collect::<Result<Vec<_>, _>>()?;
@@ -121,7 +121,7 @@ mod ancestors {
121121
let head = repo.head()?.into_peeled_id()?;
122122
let commits = head
123123
.ancestors()
124-
.sorting(commit::Sorting::ByCommitTimeNewestFirst) // assure we have time set
124+
.sorting(commit::simple::Sorting::ByCommitTimeNewestFirst) // assure we have time set
125125
.use_commit_graph(use_commit_graph)
126126
.all()?
127127
.collect::<Result<Vec<_>, _>>()?;
@@ -141,9 +141,9 @@ mod ancestors {
141141

142142
for use_commit_graph in [false, true] {
143143
for sorting in [
144-
commit::Sorting::BreadthFirst,
145-
commit::Sorting::ByCommitTimeNewestFirst,
146-
commit::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 },
144+
commit::simple::Sorting::BreadthFirst,
145+
commit::simple::Sorting::ByCommitTimeNewestFirst,
146+
commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 },
147147
] {
148148
let commits_graph_order = head
149149
.ancestors()

gix/tests/repository/shallow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn yes() -> crate::Result {
4444
}
4545

4646
mod traverse {
47-
use gix_traverse::commit::Sorting;
47+
use gix_traverse::commit::simple::Sorting;
4848
use serial_test::parallel;
4949

5050
use crate::util::{hex_to_id, named_subrepo_opts};

0 commit comments

Comments
 (0)