History

[commitgraph] Rename LexPosition to 'file::Position'

That way it's in line with 'graph::Position'

Sebastian Thiel committed 6 years ago

Commit 6f90bee1 parent d2eec1d6 files · +72 −55Browse files

Showing the changes to git-commitgraph/src/graph (1 of 6 files). Show all

Unified · Split

git-commitgraph/src/graph/access.rs+12−12
@@ -1,12 +1,12 @@
11 use crate::{
2− file::{Commit, File, LexPosition},
3− graph::{Graph, Position},
2+ file::{self, Commit, File},
3+ graph::{self, Graph},
44 };
55 use git_object::borrowed;
66
7−/// Access convenience
7+/// Access
88 impl Graph {
9− pub fn commit_at(&self, pos: Position) -> Commit<'_> {
9+ pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> {
1010 let r = self.lookup_by_pos(pos);
1111 r.file.commit_at(r.lex_pos)
1212 }
@@ -16,7 +16,7 @@ impl Graph { · 3 unmodified lines
1616 Some(r.file.commit_at(r.lex_pos))
1717 }
1818
19− pub fn id_at(&self, pos: Position) -> borrowed::Id<'_> {
19+ pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> {
2020 let r = self.lookup_by_pos(pos);
2121 r.file.id_at(r.lex_pos)
2222 }
@@ -31,7 +31,7 @@ impl Graph { · 8 unmodified lines
3131 self.files.iter().flat_map(|file| file.iter_ids())
3232 }
3333
34− pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<Position> {
34+ pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<graph::Position> {
3535 Some(self.lookup_by_id(id)?.graph_pos)
3636 }
3737
@@ -49,7 +49,7 @@ impl Graph { · 11 unmodified lines
4949 return Some(LookupByIdResult {
5050 file,
5151 lex_pos,
52− graph_pos: Position(current_file_start + lex_pos.0),
52+ graph_pos: graph::Position(current_file_start + lex_pos.0),
5353 });
5454 }
5555 current_file_start += file.num_commits();
@@ -57,7 +57,7 @@ impl Graph { · 1 unmodified line
5757 None
5858 }
5959
60− fn lookup_by_pos(&self, pos: Position) -> LookupByPositionResult<'_> {
60+ fn lookup_by_pos(&self, pos: graph::Position) -> LookupByPositionResult<'_> {
6161 let mut remaining = pos.0;
6262 for file in &self.files {
6363 match remaining.checked_sub(file.num_commits()) {
@@ -65,7 +65,7 @@ impl Graph { · 1 unmodified line
6565 None => {
6666 return LookupByPositionResult {
6767 file,
68− lex_pos: LexPosition(remaining),
68+ lex_pos: file::Position(remaining),
6969 }
7070 }
7171 }
@@ -77,12 +77,12 @@ impl Graph { · 5 unmodified lines
7777 #[derive(Clone)]
7878 struct LookupByIdResult<'a> {
7979 pub file: &'a File,
80− pub graph_pos: Position,
81− pub lex_pos: LexPosition,
80+ pub graph_pos: graph::Position,
81+ pub lex_pos: file::Position,
8282 }
8383
8484 #[derive(Clone)]
8585 struct LookupByPositionResult<'a> {
8686 pub file: &'a File,
87− pub lex_pos: LexPosition,
87+ pub lex_pos: file::Position,
8888 }