pub struct ModelRepository { /* private fields */ }Expand description
Model version control repository
Implementations§
Source§impl ModelRepository
impl ModelRepository
Sourcepub fn init(
&mut self,
initial_commit: ModelCommit,
) -> Result<(), VersionControlError>
pub fn init( &mut self, initial_commit: ModelCommit, ) -> Result<(), VersionControlError>
Initialize repository with an initial commit
Sourcepub fn commit(
&mut self,
model: Cid,
message: String,
author: String,
) -> Result<ModelCommit, VersionControlError>
pub fn commit( &mut self, model: Cid, message: String, author: String, ) -> Result<ModelCommit, VersionControlError>
Create a commit
Sourcepub fn checkout(&mut self, target: &str) -> Result<(), VersionControlError>
pub fn checkout(&mut self, target: &str) -> Result<(), VersionControlError>
Checkout to a specific commit or branch
Sourcepub fn create_branch(
&mut self,
name: String,
start_point: Option<Cid>,
) -> Result<(), VersionControlError>
pub fn create_branch( &mut self, name: String, start_point: Option<Cid>, ) -> Result<(), VersionControlError>
Create a new branch
Sourcepub fn delete_branch(&mut self, name: &str) -> Result<(), VersionControlError>
pub fn delete_branch(&mut self, name: &str) -> Result<(), VersionControlError>
Delete a branch
Sourcepub fn list_branches(&self) -> Vec<&Branch>
pub fn list_branches(&self) -> Vec<&Branch>
List all branches
Sourcepub fn current_branch(&self) -> Option<&str>
pub fn current_branch(&self) -> Option<&str>
Get current branch name
Sourcepub fn head_commit(&self) -> Option<&ModelCommit>
pub fn head_commit(&self) -> Option<&ModelCommit>
Get current HEAD commit
Sourcepub fn get_commit(&self, commit_id: &str) -> Option<&ModelCommit>
pub fn get_commit(&self, commit_id: &str) -> Option<&ModelCommit>
Get a commit by ID
Sourcepub fn get_history(
&self,
start: &Cid,
max_count: Option<usize>,
) -> Vec<&ModelCommit>
pub fn get_history( &self, start: &Cid, max_count: Option<usize>, ) -> Vec<&ModelCommit>
Get commit history from a starting commit
Sourcepub fn merge_fast_forward(
&mut self,
branch: &str,
) -> Result<(), VersionControlError>
pub fn merge_fast_forward( &mut self, branch: &str, ) -> Result<(), VersionControlError>
Perform a fast-forward merge
Sourcepub fn can_fast_forward(
&self,
branch: &str,
) -> Result<bool, VersionControlError>
pub fn can_fast_forward( &self, branch: &str, ) -> Result<bool, VersionControlError>
Check if fast-forward merge is possible
Trait Implementations§
Source§impl Clone for ModelRepository
impl Clone for ModelRepository
Source§fn clone(&self) -> ModelRepository
fn clone(&self) -> ModelRepository
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelRepository
impl Debug for ModelRepository
Auto Trait Implementations§
impl Freeze for ModelRepository
impl RefUnwindSafe for ModelRepository
impl Send for ModelRepository
impl Sync for ModelRepository
impl Unpin for ModelRepository
impl UnwindSafe for ModelRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more