mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 18:27:38 +00:00
rewrite: remove unneeded Result from CommitRewriter::reparent()
reparent() just configures new CommitBuilder instance, which should never fail.
This commit is contained in:
parent
d0f0e8dcff
commit
f7fd523dd8
5 changed files with 7 additions and 8 deletions
|
@ -287,7 +287,7 @@ pub(crate) fn cmd_fix(
|
|||
if changes > 0 {
|
||||
num_fixed_commits += 1;
|
||||
let new_tree = tree_builder.write_tree(rewriter.mut_repo().store())?;
|
||||
let builder = rewriter.reparent(command.settings())?;
|
||||
let builder = rewriter.reparent(command.settings());
|
||||
builder.set_tree_id(new_tree).write()?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -90,7 +90,7 @@ pub(crate) fn cmd_simplify_parents(
|
|||
let num_new_heads = rewriter.new_parents().len();
|
||||
|
||||
if rewriter.parents_changed() {
|
||||
rewriter.reparent(command.settings())?.write()?;
|
||||
rewriter.reparent(command.settings()).write()?;
|
||||
|
||||
if num_new_heads < num_old_heads {
|
||||
simplified_commits += 1;
|
||||
|
|
|
@ -279,7 +279,7 @@ pub fn absorb_hunks(
|
|||
// Remove selected hunks from the source commit by reparent()
|
||||
if rewriter.old_commit().id() == source.commit.id() {
|
||||
// TODO: should we abandon the source if it's discardable?
|
||||
rewriter.reparent(settings)?.write()?;
|
||||
rewriter.reparent(settings).write()?;
|
||||
num_rebased += 1;
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
@ -1354,7 +1354,7 @@ impl MutableRepo {
|
|||
let mut num_reparented = 0;
|
||||
self.transform_descendants(settings, roots, |rewriter| {
|
||||
if rewriter.parents_changed() {
|
||||
let builder = rewriter.reparent(settings)?;
|
||||
let builder = rewriter.reparent(settings);
|
||||
builder.write()?;
|
||||
num_reparented += 1;
|
||||
}
|
||||
|
|
|
@ -295,11 +295,10 @@ impl<'repo> CommitRewriter<'repo> {
|
|||
|
||||
/// Rewrite the old commit onto the new parents without changing its
|
||||
/// contents. Returns a `CommitBuilder` for the new commit.
|
||||
pub fn reparent(self, settings: &UserSettings) -> BackendResult<CommitBuilder<'repo>> {
|
||||
Ok(self
|
||||
.mut_repo
|
||||
pub fn reparent(self, settings: &UserSettings) -> CommitBuilder<'repo> {
|
||||
self.mut_repo
|
||||
.rewrite_commit(settings, &self.old_commit)
|
||||
.set_parents(self.new_parents))
|
||||
.set_parents(self.new_parents)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue