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 consume(self) -> (Box<dyn MutableIndex>, View)

source

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

source

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

source

pub fn write_commit( &mut self, commit: Commit, sign_with: Option<&mut SigningFn<'_>> ) -> BackendResult<Commit>

source

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

Record a commit as having been rewritten to one or more ids 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 record_rewritten_commit(&mut self, old_id: CommitId, new_id: CommitId)

Record a commit as having been rewritten in this transaction. If it was already rewritten, mark it as divergent (unlike set_rewritten_commit)

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 treats these records as follows:

  • If a commit is recorded as rewritten to a single commit, its descendants would be rebased to become descendants of new_id. Any branches at old_id are also moved to new_id.
  • If a commit is recorded as rewritten to more than one commit, it is assumed to have become divergent. Its descendants are not rebased. However, the branches that were at old_id are moved to each of the new ids, and thus become conflicted.

In neither case would rebase_descendants modify the old_id commit itself.

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 has_rewrites(&self) -> bool

source

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

source

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

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 ) -> Result<usize, TreeMergeError>

source

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

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)

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 has_branch(&self, name: &str) -> bool

Returns true if any local or remote branch of the given name exists.

source

pub fn remove_branch(&mut self, name: &str)

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)

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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

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

§

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