Showing the changes to git-commitgraph/src/graph (1 of 6 files). Show all
Unified · Split
| @@ -15,7 +15,7 @@ impl Graph { · 14 unmodified lines | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | /// Returns the commit matching the given `id`. | 17 | /// Returns the commit matching the given `id`. |
| 18 | pub fn commit_by_id(&self, id: git_hash::borrowed::Id<'_>) -> Option<Commit<'_>> { | 18 | pub fn commit_by_id(&self, id: &git_hash::oid) -> Option<Commit<'_>> { |
| 19 | let r = self.lookup_by_id(id)?; | 19 | let r = self.lookup_by_id(id)?; |
| 20 | Some(r.file.commit_at(r.file_pos)) | 20 | Some(r.file.commit_at(r.file_pos)) |
| 21 | } | 21 | } |
| @@ -24,7 +24,7 @@ impl Graph { · 2 unmodified lines | |||
| 24 | /// | 24 | /// |
| 25 | /// # Panics | 25 | /// # Panics |
| 26 | /// If `pos` is greater or equal to [`num_commits()`][Graph::num_commits()]. | 26 | /// If `pos` is greater or equal to [`num_commits()`][Graph::num_commits()]. |
| 27 | pub fn id_at(&self, pos: graph::Position) -> git_hash::borrowed::Id<'_> { | 27 | pub fn id_at(&self, pos: graph::Position) -> &git_hash::oid { |
| 28 | let r = self.lookup_by_pos(pos); | 28 | let r = self.lookup_by_pos(pos); |
| 29 | r.file.id_at(r.pos) | 29 | r.file.id_at(r.pos) |
| 30 | } | 30 | } |
| @@ -35,12 +35,12 @@ impl Graph { · 4 unmodified lines | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /// Iterate over commit IDs in unsorted order. | 37 | /// Iterate over commit IDs in unsorted order. |
| 38 | pub fn iter_ids(&self) -> impl Iterator<Item = git_hash::borrowed::Id<'_>> { | 38 | pub fn iter_ids(&self) -> impl Iterator<Item = &git_hash::oid> { |
| 39 | self.files.iter().flat_map(|file| file.iter_ids()) | 39 | self.files.iter().flat_map(|file| file.iter_ids()) |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /// Translate the given `id` to its position in the file. | 42 | /// Translate the given `id` to its position in the file. |
| 43 | pub fn lookup(&self, id: git_hash::borrowed::Id<'_>) -> Option<graph::Position> { | 43 | pub fn lookup(&self, id: &git_hash::oid) -> Option<graph::Position> { |
| 44 | Some(self.lookup_by_id(id)?.graph_pos) | 44 | Some(self.lookup_by_id(id)?.graph_pos) |
| 45 | } | 45 | } |
| 46 | 46 | ||
| @@ -52,7 +52,7 @@ impl Graph { · 5 unmodified lines | |||
| 52 | 52 | ||
| 53 | /// Access fundamentals | 53 | /// Access fundamentals |
| 54 | impl Graph { | 54 | impl Graph { |
| 55 | pub(crate) fn lookup_by_id(&self, id: git_hash::borrowed::Id<'_>) -> Option<LookupByIdResult<'_>> { | 55 | pub(crate) fn lookup_by_id(&self, id: &git_hash::oid) -> Option<LookupByIdResult<'_>> { |
| 56 | let mut current_file_start = 0; | 56 | let mut current_file_start = 0; |
| 57 | for file in &self.files { | 57 | for file in &self.files { |
| 58 | if let Some(lex_pos) = file.lookup(id) { | 58 | if let Some(lex_pos) = file.lookup(id) { |