History

all docs for git-commitgraph::file

Sebastian Thiel committed 5 years ago

Commit 8b262011 parent 23bba1c6 files · +54 −20Browse files

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

Unified · Split

git-commitgraph/src/file/access.rs+9−0
@@ -9,6 +9,7 @@ use std::{ · 8 unmodified lines
99
1010 /// Access
1111 impl File {
12+ /// The amount of base graphs that this file depends on.
1213 pub fn base_graph_count(&self) -> u8 {
1314 self.base_graph_count
1415 }
@@ -24,6 +25,9 @@ impl File { · 9 unmodified lines
2425 Commit::new(self, pos)
2526 }
2627
28+ /// The kind of hash used in this File.
29+ ///
30+ /// Note that it is always conforming to the hash used in the owning repository.
2731 pub fn hash_kind(&self) -> HashKind {
2832 HashKind::Sha1
2933 }
@@ -46,6 +50,7 @@ impl File { · 16 unmodified lines
4650 borrowed::Id::try_from(&self.data[start..start + SHA1_SIZE]).expect("20 bytes SHA1 to be alright")
4751 }
4852
53+ /// Return an iterator over all object hashes stored in the base graph.
4954 pub fn iter_base_graph_ids(&self) -> impl Iterator<Item = borrowed::Id<'_>> {
5055 let start = self.base_graphs_list_offset.unwrap_or(0);
5156 let base_graphs_list = &self.data[start..start + (SHA1_SIZE * usize::from(self.base_graph_count))];
@@ -54,14 +59,17 @@ impl File { · 2 unmodified lines
5459 .map(|bytes| borrowed::Id::try_from(bytes).expect("20 bytes SHA1 to be alright"))
5560 }
5661
62+ /// return an iterator over all commits in this file.
5763 pub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>> {
5864 (0..self.num_commits()).map(move |i| self.commit_at(file::Position(i)))
5965 }
6066
67+ /// Return an iterator over all object hashes stored in this file.
6168 pub fn iter_ids(&self) -> impl Iterator<Item = borrowed::Id<'_>> {
6269 (0..self.num_commits()).map(move |i| self.id_at(file::Position(i)))
6370 }
6471
72+ /// Translate the given object hash to its position within this file, if present.
6573 // copied from git-odb/src/pack/index/access.rs
6674 pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<file::Position> {
6775 let first_byte = usize::from(id.first_byte());
@@ -94,6 +102,7 @@ impl File { · 26 unmodified lines
94102 self.fan[255]
95103 }
96104
105+ /// Returns the path to this file.
97106 pub fn path(&self) -> &Path {
98107 &self.path
99108 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t