Struct jj_lib::repo::MutableRepo

source ·
pub struct MutableRepo { /* private fields */ }

Implementations§

source§

impl MutableRepo

source

pub fn new( base_repo: Arc<ReadonlyRepo>, index: &dyn ReadonlyIndex, view: &View, ) -> MutableRepo

source

pub fn base_repo(&self) -> &Arc<ReadonlyRepo>

source

pub fn mutable_index(&self) -> &dyn MutableIndex

source

pub fn has_changes(&self) -> bool

source

pub fn new_commit( &mut self, settings: &UserSettings, parents: Vec<CommitId>, tree_id: MergedTreeId, ) -> CommitBuilder<'_>

Returns a CommitBuilder to write new commit to the repo.

source

pub fn rewrite_commit( &mut self, settings: &UserSettings, predecessor: &Commit, ) -> CommitBuilder<'_>

Returns a CommitBuilder to rewrite an existing commit in the repo.

source

pub fn set_rewritten_commit(&mut self, old_id: CommitId, new_id: CommitId)

Record a commit as having been rewritten to another commit in this transaction.

This record is used by rebase_descendants to know which commits have children that need to be rebased, and where to rebase them to. See the docstring for record_rewritten_commit for details.

source

pub fn set_divergent_rewrite( &mut self, old_id: CommitId, new_ids: impl IntoIterator<Item = CommitId>, )

Record a commit as being rewritten into multiple other commits in this transaction.

A later call to rebase_descendants() will update branches pointing to old_id be conflicted and pointing to all pf new_ids. Working copies pointing to old_id will be updated to point to the first commit in new_ids``. Descendants of old_id` will be left alone.

source

pub fn record_abandoned_commit(&mut self, old_id: CommitId)

Record a commit as having been abandoned in this transaction.

This record is used by rebase_descendants to know which commits have children that need to be rebased, and where to rebase the children (as well as branches) to.

The rebase_descendants logic will rebase the descendants of old_id to become the descendants of parent(s) of old_id. Any branches at old_id would be moved to the parent(s) of old_id as well.

source

pub fn record_abandoned_commit_with_parents( &mut self, old_id: CommitId, new_parent_ids: impl IntoIterator<Item = CommitId>, )

Record a commit as having been abandoned in this transaction.

A later rebase_descendants() will rebase children of old_id onto new_parent_ids. A working copy pointing to old_id will point to a new commit on top of new_parent_ids.

source

pub fn has_rewrites(&self) -> bool

source

pub fn new_parents(&self, old_ids: Vec<CommitId>) -> Vec<CommitId>

Calculates new parents for a commit that’s currently based on the given parents. It does that by considering how previous commits have been rewritten and abandoned.

Panics if parent_mapping contains cycles

source

pub fn update_rewritten_references( &mut self, settings: &UserSettings, ) -> BackendResult<()>

Updates branches, working copies, and anonymous heads after rewriting and/or abandoning commits.

source

pub fn transform_descendants( &mut self, settings: &UserSettings, roots: Vec<CommitId>, callback: impl FnMut(CommitRewriter<'_>) -> BackendResult<()>, ) -> BackendResult<()>

Rewrite descendants of the given roots.

The callback will be called for each commit with the new parents prepopulated. The callback may change the parents and write the new commit, or it may abandon the commit, or it may leave the old commit unchanged.

The set of commits to visit is determined at the start. If the callback adds new descendants, then the callback will not be called for those. Similarly, if the callback rewrites unrelated commits, then the callback will not be called for descendants of those commits.

source

pub fn rebase_descendants_with_options( &mut self, settings: &UserSettings, options: RebaseOptions, ) -> BackendResult<usize>

source

pub fn rebase_descendants_with_options_return_map( &mut self, settings: &UserSettings, options: RebaseOptions, ) -> BackendResult<HashMap<CommitId, CommitId>>

This is similar to rebase_descendants_return_map, but the return value needs more explaining.

If the options.empty is the default, this function will only rebase commits, and the return value is what you’d expect it to be.

Otherwise, this function may rebase some commits and abandon others. The behavior is such that only commits with a single parent will ever be abandoned. In the returned map, an abandoned commit will look as a key-value pair where the key is the abandoned commit and the value is its parent. One can tell this case apart since the change ids of the key and the value will not match. The parent will inherit the descendants and the branches of the abandoned commit.

source

pub fn rebase_descendants( &mut self, settings: &UserSettings, ) -> BackendResult<usize>

source

pub fn rebase_descendants_return_map( &mut self, settings: &UserSettings, ) -> BackendResult<HashMap<CommitId, CommitId>>

source

pub fn set_wc_commit( &mut self, workspace_id: WorkspaceId, commit_id: CommitId, ) -> Result<(), RewriteRootCommit>

source

pub fn remove_wc_commit( &mut self, workspace_id: &WorkspaceId, ) -> Result<(), EditCommitError>

source

pub fn check_out( &mut self, workspace_id: WorkspaceId, settings: &UserSettings, commit: &Commit, ) -> Result<Commit, CheckOutCommitError>

source

pub fn edit( &mut self, workspace_id: WorkspaceId, commit: &Commit, ) -> Result<(), EditCommitError>

source

pub fn add_head(&mut self, head: &Commit) -> BackendResult<()>

Ensures that the given head and ancestor commits are reachable from the visible heads.

source

pub fn add_heads(&mut self, heads: &[Commit]) -> BackendResult<()>

Ensures that the given heads and ancestor commits are reachable from the visible heads.

The heads may contain redundant commits such as already visible ones and ancestors of the other heads. The heads and ancestor commits should exist in the store.

source

pub fn remove_head(&mut self, head: &CommitId)

source

pub fn get_local_branch(&self, name: &str) -> RefTarget

source

pub fn set_local_branch_target(&mut self, name: &str, target: RefTarget)

source

pub fn merge_local_branch( &mut self, name: &str, base_target: &RefTarget, other_target: &RefTarget, )

source

pub fn get_remote_branch(&self, name: &str, remote_name: &str) -> RemoteRef

source

pub fn set_remote_branch( &mut self, name: &str, remote_name: &str, remote_ref: RemoteRef, )

source

pub fn track_remote_branch(&mut self, name: &str, remote_name: &str)

Merges the specified remote branch in to local branch, and starts tracking it.

source

pub fn untrack_remote_branch(&mut self, name: &str, remote_name: &str)

Stops tracking the specified remote branch.

source

pub fn remove_remote(&mut self, remote_name: &str)

source

pub fn rename_remote(&mut self, old: &str, new: &str)

source

pub fn get_tag(&self, name: &str) -> RefTarget

source

pub fn set_tag_target(&mut self, name: &str, target: RefTarget)

source

pub fn merge_tag( &mut self, name: &str, base_target: &RefTarget, other_target: &RefTarget, )

source

pub fn get_git_ref(&self, name: &str) -> RefTarget

source

pub fn set_git_ref_target(&mut self, name: &str, target: RefTarget)

source

pub fn git_head(&self) -> RefTarget

source

pub fn set_git_head_target(&mut self, target: RefTarget)

source

pub fn set_view(&mut self, data: View)

source

pub fn merge(&mut self, base_repo: &ReadonlyRepo, other_repo: &ReadonlyRepo)

source

pub fn merge_index(&mut self, other_repo: &ReadonlyRepo)

Trait Implementations§

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

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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