use sley_notes::{
Note, NotesCommitIdentity, NotesIter, NotesRef, iter_notes, list_notes, notes_ref_expected,
read_note_bytes, read_note_for, resolve_notes_ref, write_notes,
};
use crate::{ObjectId, Repository, Result};
impl Repository {
pub fn notes_ref(&self, override_ref: Option<&str>) -> Result<NotesRef> {
resolve_notes_ref(self.git_dir(), override_ref)
}
pub fn list_notes(&self, notes_ref: &NotesRef) -> Result<Vec<Note>> {
list_notes(
self.git_dir(),
self.object_format(),
&self.references(),
notes_ref,
)
}
pub fn iter_notes(&self, notes_ref: &NotesRef) -> Result<NotesIter> {
iter_notes(
self.git_dir(),
self.object_format(),
&self.references(),
notes_ref,
)
}
pub fn read_note_for(
&self,
notes_ref: &NotesRef,
annotated: &ObjectId,
) -> Result<Option<ObjectId>> {
read_note_for(
self.git_dir(),
self.object_format(),
&self.references(),
notes_ref,
annotated,
)
}
pub fn read_note(
&self,
notes_ref: &NotesRef,
annotated: &ObjectId,
) -> Result<Option<ObjectId>> {
self.read_note_for(notes_ref, annotated)
}
pub fn read_note_bytes(
&self,
notes_ref: &NotesRef,
annotated: &ObjectId,
) -> Result<Option<Vec<u8>>> {
read_note_bytes(
self.git_dir(),
self.object_format(),
&self.references(),
notes_ref,
annotated,
)
}
pub fn write_notes(
&self,
notes_ref: &NotesRef,
notes: &[Note],
message: &str,
identity: &NotesCommitIdentity,
) -> Result<()> {
write_notes(
self.git_dir(),
self.object_format(),
&self.references(),
notes_ref,
notes,
message,
identity,
notes_ref_expected(&self.references(), notes_ref)?,
)
}
}