Struct GitBackend

Source
pub struct GitBackend { /* private fields */ }

Implementations§

Source§

impl GitBackend

Source

pub fn name() -> &'static str

Source

pub fn init_internal( settings: &UserSettings, store_path: &Path, ) -> Result<Self, Box<GitBackendInitError>>

Source

pub fn init_colocated( settings: &UserSettings, store_path: &Path, workspace_root: &Path, ) -> Result<Self, Box<GitBackendInitError>>

Initializes backend by creating a new Git repo at the specified workspace path. The workspace directory must exist.

Source

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.

Source

pub fn load( settings: &UserSettings, store_path: &Path, ) -> Result<Self, Box<GitBackendLoadError>>

Source

pub fn git_repo(&self) -> Repository

Returns new thread-local instance to access to the underlying Git repo.

Source

pub fn git_repo_path(&self) -> &Path

Path to the .git directory or the repository itself if it’s bare.

Source

pub fn git_workdir(&self) -> Option<&Path>

Path to the working directory if the repository isn’t bare.

Source

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.

Trait Implementations§

Source§

impl Backend for GitBackend

Source§

fn as_any(&self) -> &dyn Any

Source§

fn name(&self) -> &str

A unique name that identifies this backend. Written to .jj/repo/store/backend when the repo is created.
Source§

fn commit_id_length(&self) -> usize

The length of commit IDs in bytes.
Source§

fn change_id_length(&self) -> usize

The length of change IDs in bytes.
Source§

fn root_commit_id(&self) -> &CommitId

Source§

fn root_change_id(&self) -> &ChangeId

Source§

fn empty_tree_id(&self) -> &TreeId

Source§

fn concurrency(&self) -> usize

An estimate of how many concurrent requests this backend handles well. A local backend like the Git backend (at until it supports partial clones) may want to set this to 1. A cloud-backed backend may want to set it to 100 or so. Read more
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 + '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,

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,

Read the specified CopyHistory object. Read more
Source§

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,

Write the CopyHistory object and return its ID. Read more
Find all copy histories that are related to the specified one. This is defined as those that are ancestors of the given specified one, plus their descendants. Children must be returned before parents. Read more
Source§

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,

Source§

fn read_conflict( &self, _path: &RepoPath, id: &ConflictId, ) -> BackendResult<Conflict>

Source§

fn write_conflict( &self, _path: &RepoPath, conflict: &Conflict, ) -> BackendResult<ConflictId>

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,

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,

Writes a commit and returns its ID and the commit itself. The commit should contain the data that was actually written, which may differ from the data passed in. For example, the backend may change the committer name to an authenticated user’s name, or the backend’s timestamps may have less precision than the millisecond precision in Commit. Read more
Source§

fn get_copy_records( &self, paths: Option<&[RepoPathBuf]>, root_id: &CommitId, head_id: &CommitId, ) -> BackendResult<BoxStream<'_, BackendResult<CopyRecord>>>

Get copy records for the dag range root..head. If paths is None include all paths, otherwise restrict to only paths. Read more
Source§

fn gc(&self, index: &dyn Index, keep_newer: SystemTime) -> BackendResult<()>

Perform garbage collection. Read more
Source§

impl Debug for GitBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,