Struct jj_lib::rewrite::CommitRewriter
source · pub struct CommitRewriter<'repo> { /* private fields */ }
Expand description
Helps rewrite a commit.
Implementations§
source§impl<'repo> CommitRewriter<'repo>
impl<'repo> CommitRewriter<'repo>
sourcepub fn new(
mut_repo: &'repo mut MutableRepo,
old_commit: Commit,
new_parents: Vec<CommitId>,
) -> Self
pub fn new( mut_repo: &'repo mut MutableRepo, old_commit: Commit, new_parents: Vec<CommitId>, ) -> Self
Create a new instance.
sourcepub fn mut_repo(&mut self) -> &mut MutableRepo
pub fn mut_repo(&mut self) -> &mut MutableRepo
Returns the MutableRepo
.
sourcepub fn old_commit(&self) -> &Commit
pub fn old_commit(&self) -> &Commit
The commit we’re rewriting.
sourcepub fn new_parents(&self) -> &[CommitId]
pub fn new_parents(&self) -> &[CommitId]
Get the old commit’s intended new parents.
sourcepub fn set_new_parents(&mut self, new_parents: Vec<CommitId>)
pub fn set_new_parents(&mut self, new_parents: Vec<CommitId>)
Set the old commit’s intended new parents.
sourcepub fn set_new_rewritten_parents(&mut self, unrewritten_parents: &[CommitId])
pub fn set_new_rewritten_parents(&mut self, unrewritten_parents: &[CommitId])
Set the old commit’s intended new parents to be the rewritten versions of the given parents.
sourcepub fn replace_parent<'a>(
&mut self,
old_parent: &CommitId,
new_parents: impl IntoIterator<Item = &'a CommitId>,
)
pub fn replace_parent<'a>( &mut self, old_parent: &CommitId, new_parents: impl IntoIterator<Item = &'a CommitId>, )
Update the intended new parents by replacing any occurrence of
old_parent
by new_parents
.
sourcepub fn parents_changed(&self) -> bool
pub fn parents_changed(&self) -> bool
Checks if the intended new parents are different from the old commit’s parents.
sourcepub fn simplify_ancestor_merge(&mut self)
pub fn simplify_ancestor_merge(&mut self)
If a merge commit would end up with one parent being an ancestor of the other, then filter out the ancestor.
sourcepub fn rebase_with_empty_behavior(
self,
settings: &UserSettings,
empty: EmptyBehaviour,
) -> BackendResult<Option<CommitBuilder<'repo>>>
pub fn rebase_with_empty_behavior( self, settings: &UserSettings, empty: EmptyBehaviour, ) -> BackendResult<Option<CommitBuilder<'repo>>>
Rebase the old commit onto the new parents. Returns a CommitBuilder
for the new commit. Returns None
if the commit was abandoned.
sourcepub fn rebase(
self,
settings: &UserSettings,
) -> BackendResult<CommitBuilder<'repo>>
pub fn rebase( self, settings: &UserSettings, ) -> BackendResult<CommitBuilder<'repo>>
Rebase the old commit onto the new parents. Returns a CommitBuilder
for the new commit.
sourcepub fn reparent(
self,
settings: &UserSettings,
) -> BackendResult<CommitBuilder<'repo>>
pub fn reparent( self, settings: &UserSettings, ) -> BackendResult<CommitBuilder<'repo>>
Rewrite the old commit onto the new parents without changing its
contents. Returns a CommitBuilder
for the new commit.
Auto Trait Implementations§
impl<'repo> Freeze for CommitRewriter<'repo>
impl<'repo> !RefUnwindSafe for CommitRewriter<'repo>
impl<'repo> !Send for CommitRewriter<'repo>
impl<'repo> !Sync for CommitRewriter<'repo>
impl<'repo> Unpin for CommitRewriter<'repo>
impl<'repo> !UnwindSafe for CommitRewriter<'repo>
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
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