pub trait VcsBackend: Send + Sync {
Show 18 methods
// Required methods
fn init(&self, path: &Path) -> Result<(), NapError>;
fn commit(
&self,
path: &Path,
message: &str,
author: &str,
) -> Result<String, NapError>;
fn read_file_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: Option<&str>,
) -> Result<String, NapError>;
fn log(
&self,
path: &Path,
file: Option<&str>,
limit: usize,
) -> Result<Vec<CommitInfo>, NapError>;
fn create_branch(&self, path: &Path, name: &str) -> Result<(), NapError>;
fn switch_branch(&self, path: &Path, name: &str) -> Result<(), NapError>;
fn create_tag(&self, path: &Path, name: &str) -> Result<(), NapError>;
fn current_branch(&self, path: &Path) -> Result<String, NapError>;
fn head_hash(&self, path: &Path) -> Result<String, NapError>;
fn list_branches(&self, path: &Path) -> Result<Vec<String>, NapError>;
fn list_tags(&self, path: &Path) -> Result<Vec<String>, NapError>;
fn add_remote(
&self,
path: &Path,
name: &str,
url: &str,
) -> Result<(), NapError>;
fn remove_remote(&self, path: &Path, name: &str) -> Result<(), NapError>;
fn list_remotes(
&self,
path: &Path,
) -> Result<Vec<(String, String)>, NapError>;
fn push(
&self,
path: &Path,
remote: Option<&str>,
branch: Option<&str>,
) -> Result<(), NapError>;
fn pull(
&self,
path: &Path,
remote: Option<&str>,
branch: Option<&str>,
) -> Result<(), NapError>;
// Provided methods
fn revert(
&self,
_path: &Path,
_commit_hash: &str,
) -> Result<String, NapError> { ... }
fn resolve_branch_head(
&self,
path: &Path,
branch: &str,
) -> Result<String, NapError> { ... }
}Expand description
Low-level abstraction over a version control system.
Implementors: GitBackend (deprecated),
LoreBackend (production).
Most consumer code should use [RepoService] instead — it adds
permissions, context-document management, autopublish, and a
workspace-lifecycle API on top of this trait.
Required Methods§
Sourcefn init(&self, path: &Path) -> Result<(), NapError>
fn init(&self, path: &Path) -> Result<(), NapError>
Initialize a new repository at the given path.
Sourcefn commit(
&self,
path: &Path,
message: &str,
author: &str,
) -> Result<String, NapError>
fn commit( &self, path: &Path, message: &str, author: &str, ) -> Result<String, NapError>
Stage all files and create a commit.
Sourcefn read_file_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: Option<&str>,
) -> Result<String, NapError>
fn read_file_at_ref( &self, repo_path: &Path, file_path: &str, reference: Option<&str>, ) -> Result<String, NapError>
Read a file’s content at a specific ref (branch, tag, or commit hash).
If reference is None, reads from the current working tree.
Sourcefn log(
&self,
path: &Path,
file: Option<&str>,
limit: usize,
) -> Result<Vec<CommitInfo>, NapError>
fn log( &self, path: &Path, file: Option<&str>, limit: usize, ) -> Result<Vec<CommitInfo>, NapError>
Get the commit log for the repository, optionally filtered to a specific file.
Sourcefn create_tag(&self, path: &Path, name: &str) -> Result<(), NapError>
fn create_tag(&self, path: &Path, name: &str) -> Result<(), NapError>
Create a tag at the current HEAD.
List all tags.
Sourcefn list_remotes(&self, path: &Path) -> Result<Vec<(String, String)>, NapError>
fn list_remotes(&self, path: &Path) -> Result<Vec<(String, String)>, NapError>
List remotes as (name, url) pairs.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".