Unified · Split
| @@ -23,7 +23,7 @@ impl Algorithm { · 22 unmodified lines | ||
| 23 | 23 | let mut is_common = false; |
| 24 | 24 | let mut has_mark = false; |
| 25 | 25 | if let Some(commit) = graph |
| 26 | − .try_lookup_or_insert_commit(id, |data| { | |
| 26 | + .get_or_insert_commit(id, |data| { | |
| 27 | 27 | has_mark = data.flags.intersects(mark); |
| 28 | 28 | data.flags |= mark; |
| 29 | 29 | is_common = data.flags.contains(Flags::COMMON); |
| @@ -47,7 +47,7 @@ impl Algorithm { · 17 unmodified lines | ||
| 47 | 47 | ) -> Result<(), Error> { |
| 48 | 48 | let mut is_common = false; |
| 49 | 49 | 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))? | |
| 51 | 51 | .filter(|_| !is_common) |
| 52 | 52 | { |
| 53 | 53 | let mut queue = gix_revwalk::PriorityQueue::from_iter(Some((commit.commit_time, (id, 0_usize)))); |
| @@ -64,11 +64,11 @@ impl Algorithm { · 10 unmodified lines | ||
| 64 | 64 | { |
| 65 | 65 | self.add_to_queue(id, Flags::SEEN, graph)?; |
| 66 | 66 | } 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, |_| {})? { | |
| 68 | 68 | for parent_id in commit.parents.clone() { |
| 69 | 69 | let mut prev_flags = Flags::default(); |
| 70 | 70 | if let Some(parent) = graph |
| 71 | − .try_lookup_or_insert_commit(parent_id, |data| { | |
| 71 | + .get_or_insert_commit(parent_id, |data| { | |
| 72 | 72 | prev_flags = data.flags; |
| 73 | 73 | data.flags |= Flags::COMMON; |
| 74 | 74 | })? |
| @@ -144,4 +144,4 @@ pub trait Negotiator { · 143 unmodified lines | ||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /// 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; | |
| @@ -20,7 +20,7 @@ impl Default for Algorithm { · 19 unmodified lines | ||
| 20 | 20 | impl Algorithm { |
| 21 | 21 | /// Add `id` to our priority queue and *add* `flags` to it. |
| 22 | 22 | 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| { | |
| 24 | 24 | entry.flags |= mark | Flags::SEEN; |
| 25 | 25 | })?; |
| 26 | 26 | if let Some(timestamp) = commit.map(|c| c.commit_time) { |
| @@ -35,7 +35,7 @@ impl Algorithm { · 8 unmodified lines | ||
| 35 | 35 | fn mark_common(&mut self, id: ObjectId, graph: &mut crate::Graph<'_, '_>) -> Result<(), Error> { |
| 36 | 36 | let mut is_common = false; |
| 37 | 37 | if let Some(commit) = graph |
| 38 | − .try_lookup_or_insert_commit(id, |entry| { | |
| 38 | + .get_or_insert_commit(id, |entry| { | |
| 39 | 39 | is_common = entry.flags.contains(Flags::COMMON); |
| 40 | 40 | entry.flags |= Flags::COMMON; |
| 41 | 41 | })? |
| @@ -43,7 +43,7 @@ impl Algorithm { · 1 unmodified line | ||
| 43 | 43 | { |
| 44 | 44 | let mut queue = gix_revwalk::PriorityQueue::from_iter(Some((commit.commit_time, id))); |
| 45 | 45 | 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| { | |
| 47 | 47 | if !entry.flags.contains(Flags::POPPED) { |
| 48 | 48 | self.non_common_revs -= 1; |
| 49 | 49 | } |
| @@ -56,7 +56,7 @@ impl Algorithm { · 6 unmodified lines | ||
| 56 | 56 | } |
| 57 | 57 | let mut was_unseen_or_common = false; |
| 58 | 58 | if let Some(parent) = graph |
| 59 | − .try_lookup_or_insert_commit(parent_id, |entry| { | |
| 59 | + .get_or_insert_commit(parent_id, |entry| { | |
| 60 | 60 | was_unseen_or_common = |
| 61 | 61 | !entry.flags.contains(Flags::SEEN) || entry.flags.contains(Flags::COMMON); |
| 62 | 62 | entry.flags |= Flags::COMMON; |
| @@ -16,7 +16,7 @@ pub enum Error { · 15 unmodified lines | ||
| 16 | 16 | #[error("We were unable to figure out what objects the server should send after {rounds} round(s)")] |
| 17 | 17 | NegotiationFailed { rounds: usize }, |
| 18 | 18 | #[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), | |
| 20 | 20 | #[error(transparent)] |
| 21 | 21 | InitRefsIterator(#[from] crate::reference::iter::init::Error), |
| 22 | 22 | #[error(transparent)] |
| @@ -114,7 +114,7 @@ pub(crate) fn mark_complete_and_common_ref( · 91 unmodified lines | ||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | 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()) | |
| 118 | 118 | .transpose()? |
| 119 | 119 | { |
| 120 | 120 | remote_ref_target_known[mapping_idx] = true; |
| @@ -271,7 +271,7 @@ fn mark_recent_complete_commits( · 150 unmodified lines | ||
| 271 | 271 | for parent_id in commit.parents.clone() { |
| 272 | 272 | let mut was_complete = false; |
| 273 | 273 | if let Some(parent) = graph |
| 274 | − .try_lookup_or_insert_commit(parent_id, |md| { | |
| 274 | + .get_or_insert_commit(parent_id, |md| { | |
| 275 | 275 | was_complete = md.flags.contains(Flags::COMPLETE); |
| 276 | 276 | md.flags |= Flags::COMPLETE; |
| 277 | 277 | })? |
| @@ -296,7 +296,7 @@ fn mark_all_refs_in_repo( · 18 unmodified lines | ||
| 296 | 296 | let id = local_ref.id().detach(); |
| 297 | 297 | let mut is_complete = false; |
| 298 | 298 | if let Some(commit) = graph |
| 299 | − .try_lookup_or_insert_commit(id, |md| { | |
| 299 | + .get_or_insert_commit(id, |md| { | |
| 300 | 300 | is_complete = md.flags.contains(Flags::COMPLETE); |
| 301 | 301 | md.flags |= mark; |
| 302 | 302 | })? |