Skip to content

Commit ea403a4

Browse files
committedAug 27, 2024
adapt to changes in gix-revwalk
1 parent 87217cc commit ea403a4

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed
 

‎gix-negotiate/src/consecutive.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Algorithm {
2323
let mut is_common = false;
2424
let mut has_mark = false;
2525
if let Some(commit) = graph
26-
.try_lookup_or_insert_commit(id, |data| {
26+
.get_or_insert_commit(id, |data| {
2727
has_mark = data.flags.intersects(mark);
2828
data.flags |= mark;
2929
is_common = data.flags.contains(Flags::COMMON);
@@ -47,7 +47,7 @@ impl Algorithm {
4747
) -> Result<(), Error> {
4848
let mut is_common = false;
4949
if let Some(commit) = graph
50-
.try_lookup_or_insert_commit(id, |data| is_common = data.flags.contains(Flags::COMMON))?
50+
.get_or_insert_commit(id, |data| is_common = data.flags.contains(Flags::COMMON))?
5151
.filter(|_| !is_common)
5252
{
5353
let mut queue = gix_revwalk::PriorityQueue::from_iter(Some((commit.commit_time, (id, 0_usize))));
@@ -64,11 +64,11 @@ impl Algorithm {
6464
{
6565
self.add_to_queue(id, Flags::SEEN, graph)?;
6666
} else if matches!(ancestors, Ancestors::AllUnseen) || generation < 2 {
67-
if let Some(commit) = graph.try_lookup_or_insert_commit(id, |_| {})? {
67+
if let Some(commit) = graph.get_or_insert_commit(id, |_| {})? {
6868
for parent_id in commit.parents.clone() {
6969
let mut prev_flags = Flags::default();
7070
if let Some(parent) = graph
71-
.try_lookup_or_insert_commit(parent_id, |data| {
71+
.get_or_insert_commit(parent_id, |data| {
7272
prev_flags = data.flags;
7373
data.flags |= Flags::COMMON;
7474
})?

‎gix-negotiate/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,4 @@ pub trait Negotiator {
144144
}
145145

146146
/// An error that happened during any of the methods on a [`Negotiator`].
147-
pub type Error = gix_revwalk::graph::try_lookup_or_insert_default::Error;
147+
pub type Error = gix_revwalk::graph::get_or_insert_default::Error;

‎gix-negotiate/src/skipping.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Default for Algorithm {
2020
impl Algorithm {
2121
/// Add `id` to our priority queue and *add* `flags` to it.
2222
fn add_to_queue(&mut self, id: ObjectId, mark: Flags, graph: &mut crate::Graph<'_, '_>) -> Result<(), Error> {
23-
let commit = graph.try_lookup_or_insert_commit(id, |entry| {
23+
let commit = graph.get_or_insert_commit(id, |entry| {
2424
entry.flags |= mark | Flags::SEEN;
2525
})?;
2626
if let Some(timestamp) = commit.map(|c| c.commit_time) {
@@ -35,15 +35,15 @@ impl Algorithm {
3535
fn mark_common(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result<(), Error> {
3636
let mut is_common = false;
3737
if let Some(commit) = graph
38-
.try_lookup_or_insert_commit(id, |entry| {
38+
.get_or_insert_commit(id, |entry| {
3939
is_common = entry.flags.contains(Flags::COMMON);
4040
entry.flags |= Flags::COMMON;
4141
})?
4242
.filter(|_| !is_common)
4343
{
4444
let mut queue = gix_revwalk::PriorityQueue::from_iter(Some((commit.commit_time, id)));
4545
while let Some(id) = queue.pop_value() {
46-
if let Some(commit) = graph.try_lookup_or_insert_commit(id, |entry| {
46+
if let Some(commit) = graph.get_or_insert_commit(id, |entry| {
4747
if !entry.flags.contains(Flags::POPPED) {
4848
self.non_common_revs -= 1;
4949
}
@@ -56,7 +56,7 @@ impl Algorithm {
5656
}
5757
let mut was_unseen_or_common = false;
5858
if let Some(parent) = graph
59-
.try_lookup_or_insert_commit(parent_id, |entry| {
59+
.get_or_insert_commit(parent_id, |entry| {
6060
was_unseen_or_common =
6161
!entry.flags.contains(Flags::SEEN) || entry.flags.contains(Flags::COMMON);
6262
entry.flags |= Flags::COMMON;

‎gix/src/remote/connection/fetch/negotiate.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum Error {
1616
#[error("We were unable to figure out what objects the server should send after {rounds} round(s)")]
1717
NegotiationFailed { rounds: usize },
1818
#[error(transparent)]
19-
LookupCommitInGraph(#[from] gix_revwalk::graph::try_lookup_or_insert_default::Error),
19+
LookupCommitInGraph(#[from] gix_revwalk::graph::get_or_insert_default::Error),
2020
#[error(transparent)]
2121
InitRefsIterator(#[from] crate::reference::iter::init::Error),
2222
#[error(transparent)]
@@ -114,7 +114,7 @@ pub(crate) fn mark_complete_and_common_ref(
114114
}
115115

116116
if let Some(commit) = want_id
117-
.and_then(|id| graph.try_lookup_or_insert_commit(id.into(), |_| {}).transpose())
117+
.and_then(|id| graph.get_or_insert_commit(id.into(), |_| {}).transpose())
118118
.transpose()?
119119
{
120120
remote_ref_target_known[mapping_idx] = true;
@@ -271,7 +271,7 @@ fn mark_recent_complete_commits(
271271
for parent_id in commit.parents.clone() {
272272
let mut was_complete = false;
273273
if let Some(parent) = graph
274-
.try_lookup_or_insert_commit(parent_id, |md| {
274+
.get_or_insert_commit(parent_id, |md| {
275275
was_complete = md.flags.contains(Flags::COMPLETE);
276276
md.flags |= Flags::COMPLETE;
277277
})?
@@ -296,7 +296,7 @@ fn mark_all_refs_in_repo(
296296
let id = local_ref.id().detach();
297297
let mut is_complete = false;
298298
if let Some(commit) = graph
299-
.try_lookup_or_insert_commit(id, |md| {
299+
.get_or_insert_commit(id, |md| {
300300
is_complete = md.flags.contains(Flags::COMPLETE);
301301
md.flags |= mark;
302302
})?

0 commit comments

Comments
 (0)
Please sign in to comment.