Struct jj_lib::repo::MutableRepo
source · pub struct MutableRepo { /* private fields */ }
Implementations§
source§impl MutableRepo
impl MutableRepo
pub fn new( base_repo: Arc<ReadonlyRepo>, index: &dyn ReadonlyIndex, view: &View ) -> MutableRepo
pub fn base_repo(&self) -> &Arc<ReadonlyRepo>
pub fn mutable_index(&self) -> &dyn MutableIndex
pub fn has_changes(&self) -> bool
pub fn consume(self) -> (Box<dyn MutableIndex>, View)
pub fn new_commit( &mut self, settings: &UserSettings, parents: Vec<CommitId>, tree_id: MergedTreeId ) -> CommitBuilder<'_>
pub fn rewrite_commit( &mut self, settings: &UserSettings, predecessor: &Commit ) -> CommitBuilder<'_>
pub fn write_commit( &mut self, commit: Commit, sign_with: Option<&mut SigningFn<'_>> ) -> BackendResult<Commit>
sourcepub fn set_rewritten_commit(
&mut self,
old_id: CommitId,
new_ids: impl IntoIterator<Item = CommitId>
)
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.
sourcepub fn record_rewritten_commit(&mut self, old_id: CommitId, new_id: CommitId)
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 atold_id
are also moved tonew_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.
sourcepub fn record_abandoned_commit(&mut self, old_id: CommitId)
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.
pub fn has_rewrites(&self) -> bool
pub fn rebase_descendants_with_options( &mut self, settings: &UserSettings, options: RebaseOptions ) -> Result<usize, TreeMergeError>
sourcepub fn rebase_descendants_with_options_return_map(
&mut self,
settings: &UserSettings,
options: RebaseOptions
) -> Result<HashMap<CommitId, CommitId>, TreeMergeError>
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.
pub fn rebase_descendants( &mut self, settings: &UserSettings ) -> Result<usize, TreeMergeError>
pub fn rebase_descendants_return_map( &mut self, settings: &UserSettings ) -> Result<HashMap<CommitId, CommitId>, TreeMergeError>
pub fn set_wc_commit( &mut self, workspace_id: WorkspaceId, commit_id: CommitId ) -> Result<(), RewriteRootCommit>
pub fn remove_wc_commit(&mut self, workspace_id: &WorkspaceId)
pub fn check_out( &mut self, workspace_id: WorkspaceId, settings: &UserSettings, commit: &Commit ) -> Result<Commit, CheckOutCommitError>
pub fn edit( &mut self, workspace_id: WorkspaceId, commit: &Commit ) -> Result<(), EditCommitError>
sourcepub fn add_head(&mut self, head: &Commit) -> BackendResult<()>
pub fn add_head(&mut self, head: &Commit) -> BackendResult<()>
Ensures that the given head
and ancestor commits are reachable from
the visible heads.
sourcepub fn add_heads(&mut self, heads: &[Commit]) -> BackendResult<()>
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.
pub fn remove_head(&mut self, head: &CommitId)
sourcepub fn has_branch(&self, name: &str) -> bool
pub fn has_branch(&self, name: &str) -> bool
Returns true if any local or remote branch of the given name
exists.
pub fn remove_branch(&mut self, name: &str)
pub fn get_local_branch(&self, name: &str) -> RefTarget
pub fn set_local_branch_target(&mut self, name: &str, target: RefTarget)
pub fn merge_local_branch( &mut self, name: &str, base_target: &RefTarget, other_target: &RefTarget )
pub fn get_remote_branch(&self, name: &str, remote_name: &str) -> RemoteRef
pub fn set_remote_branch( &mut self, name: &str, remote_name: &str, remote_ref: RemoteRef )
sourcepub fn track_remote_branch(&mut self, name: &str, remote_name: &str)
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.
sourcepub fn untrack_remote_branch(&mut self, name: &str, remote_name: &str)
pub fn untrack_remote_branch(&mut self, name: &str, remote_name: &str)
Stops tracking the specified remote branch.