pub struct GitBackend { /* private fields */ }Implementations§
Source§impl GitBackend
impl GitBackend
pub const NAME: &str = "git"
pub fn init_internal( settings: &UserSettings, store_path: &Path, object_hash: Kind, ) -> Result<Self, Box<GitBackendInitError>>
Sourcepub fn init_colocated(
settings: &UserSettings,
store_path: &Path,
workspace_root: &Path,
object_hash: Kind,
) -> Result<Self, Box<GitBackendInitError>>
pub fn init_colocated( settings: &UserSettings, store_path: &Path, workspace_root: &Path, object_hash: Kind, ) -> Result<Self, Box<GitBackendInitError>>
Initializes backend by creating a new Git repo at the specified workspace path. The workspace directory must exist.
Sourcepub fn init_external(
settings: &UserSettings,
store_path: &Path,
git_repo_path: &Path,
) -> Result<Self, Box<GitBackendInitError>>
pub fn init_external( settings: &UserSettings, store_path: &Path, git_repo_path: &Path, ) -> Result<Self, Box<GitBackendInitError>>
Initializes backend with an existing Git repo at the specified path.
pub fn load( settings: &UserSettings, store_path: &Path, ) -> Result<Self, Box<GitBackendLoadError>>
Sourcepub fn git_repo(&self) -> Repository
pub fn git_repo(&self) -> Repository
Returns a new thread-local handle for the underlying Git repository.
Use Self::open_git_repo_at_workdir() for worktree operations.
Sourcepub fn open_git_repo_at_workdir(
&self,
path: &Path,
) -> Result<Repository, GitRepoAtWorkdirError>
pub fn open_git_repo_at_workdir( &self, path: &Path, ) -> Result<Repository, GitRepoAtWorkdirError>
Reopens the repository at the given workspace path. Returns a new thread-local handle.
Sourcepub fn git_repo_path(&self) -> &Path
pub fn git_repo_path(&self) -> &Path
Path to the .git directory or the repository itself if it’s bare.
Sourcepub fn import_head_commits<'a>(
&self,
head_ids: impl IntoIterator<Item = &'a CommitId>,
) -> BackendResult<()>
pub fn import_head_commits<'a>( &self, head_ids: impl IntoIterator<Item = &'a CommitId>, ) -> BackendResult<()>
Imports the given commits and ancestors from the backing Git repo.
The head_ids may contain commits that have already been imported, but
the caller should filter them out to eliminate redundant I/O processing.
Source§impl GitBackend
impl GitBackend
Sourcepub fn gc(&self, index: &dyn Index, keep_newer: SystemTime) -> BackendResult<()>
pub fn gc(&self, index: &dyn Index, keep_newer: SystemTime) -> BackendResult<()>
Perform garbage collection.
All commits found in the index won’t be removed. In addition to that,
objects created after keep_newer will be preserved. This mitigates a
risk of deleting new commits created concurrently by another process.
Trait Implementations§
Source§impl Backend for GitBackend
impl Backend for GitBackend
Source§fn name(&self) -> &str
fn name(&self) -> &str
.jj/repo/store/type when the repo is created.Source§fn commit_id_length(&self) -> usize
fn commit_id_length(&self) -> usize
Source§fn change_id_length(&self) -> usize
fn change_id_length(&self) -> usize
Source§fn root_commit_id(&self) -> &CommitId
fn root_commit_id(&self) -> &CommitId
Source§fn root_change_id(&self) -> &ChangeId
fn root_change_id(&self) -> &ChangeId
Source§fn empty_tree_id(&self) -> &TreeId
fn empty_tree_id(&self) -> &TreeId
Source§fn concurrency(&self) -> usize
fn concurrency(&self) -> usize
Source§fn read_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 FileId,
) -> Pin<Box<dyn Future<Output = BackendResult<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn read_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 FileId,
) -> Pin<Box<dyn Future<Output = BackendResult<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
contents: &'life2 mut (dyn AsyncRead + Send + Unpin),
) -> Pin<Box<dyn Future<Output = BackendResult<FileId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
contents: &'life2 mut (dyn AsyncRead + Send + Unpin),
) -> Pin<Box<dyn Future<Output = BackendResult<FileId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn read_symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 SymlinkId,
) -> Pin<Box<dyn Future<Output = BackendResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn read_symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 SymlinkId,
) -> Pin<Box<dyn Future<Output = BackendResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RepoPath because it doesn’t necessarily point within the
repository.Source§fn write_symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
target: &'life2 str,
) -> Pin<Box<dyn Future<Output = BackendResult<SymlinkId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_symlink<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
target: &'life2 str,
) -> Pin<Box<dyn Future<Output = BackendResult<SymlinkId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn read_copy<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 CopyId,
) -> Pin<Box<dyn Future<Output = BackendResult<CopyHistory>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_copy<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 CopyId,
) -> Pin<Box<dyn Future<Output = BackendResult<CopyHistory>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
CopyHistory object. Read moreSource§fn write_copy<'life0, 'life1, 'async_trait>(
&'life0 self,
_contents: &'life1 CopyHistory,
) -> Pin<Box<dyn Future<Output = BackendResult<CopyId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_copy<'life0, 'life1, 'async_trait>(
&'life0 self,
_contents: &'life1 CopyHistory,
) -> Pin<Box<dyn Future<Output = BackendResult<CopyId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
CopyHistory object and return its ID. Read moreSource§fn read_tree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 TreeId,
) -> Pin<Box<dyn Future<Output = BackendResult<Tree>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn read_tree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
id: &'life2 TreeId,
) -> Pin<Box<dyn Future<Output = BackendResult<Tree>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn write_tree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
contents: &'life2 Tree,
) -> Pin<Box<dyn Future<Output = BackendResult<TreeId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_tree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 RepoPath,
contents: &'life2 Tree,
) -> Pin<Box<dyn Future<Output = BackendResult<TreeId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn read_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = BackendResult<Commit>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = BackendResult<Commit>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn write_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
contents: Commit,
sign_with: Option<&'life1 mut SigningFn<'_>>,
) -> Pin<Box<dyn Future<Output = BackendResult<(CommitId, Commit)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
contents: Commit,
sign_with: Option<&'life1 mut SigningFn<'_>>,
) -> Pin<Box<dyn Future<Output = BackendResult<(CommitId, Commit)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Commit. Read moreSource§fn get_copy_records(
&self,
paths: Option<&[RepoPathBuf]>,
root_id: &CommitId,
head_id: &CommitId,
) -> BackendResult<BoxStream<'_, BackendResult<CopyRecord>>>
fn get_copy_records( &self, paths: Option<&[RepoPathBuf]>, root_id: &CommitId, head_id: &CommitId, ) -> BackendResult<BoxStream<'_, BackendResult<CopyRecord>>>
root..head. If paths is None
include all paths, otherwise restrict to only paths. Read moreAuto Trait Implementations§
impl !Freeze for GitBackend
impl !RefUnwindSafe for GitBackend
impl !UnwindSafe for GitBackend
impl Send for GitBackend
impl Sync for GitBackend
impl Unpin for GitBackend
impl UnsafeUnpin for GitBackend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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