mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-28 15:26:25 +00:00
cli: make jj abandon
explicitly rebase descendant commits
This change makes it so `jj abandon` uses `DescendantRebaser` for rebasing descendants of the abandoned commits. That makes it not depend on evolution for it.
This commit is contained in:
parent
d4004fcb6f
commit
4b9282ed40
1 changed files with 14 additions and 0 deletions
|
@ -2169,11 +2169,25 @@ fn cmd_abandon(
|
|||
)
|
||||
};
|
||||
let mut tx = repo_command.start_transaction(&transaction_description);
|
||||
let abandoned = predecessors
|
||||
.iter()
|
||||
.map(|commit| commit.id().clone())
|
||||
.collect();
|
||||
for predecessor in predecessors {
|
||||
CommitBuilder::for_rewrite_from(ui.settings(), repo.store(), &predecessor)
|
||||
.set_pruned(true)
|
||||
.write_to_repo(tx.mut_repo());
|
||||
}
|
||||
let mut rebaser = DescendantRebaser::new(ui.settings(), tx.mut_repo(), hashmap! {}, abandoned);
|
||||
rebaser.rebase_all();
|
||||
let num_rebased = rebaser.rebased().len();
|
||||
if num_rebased > 0 && num_rebased != 0 {
|
||||
writeln!(
|
||||
ui,
|
||||
"Rebased {} descendant commits onto parents of abandoned commits",
|
||||
num_rebased
|
||||
)?;
|
||||
}
|
||||
repo_command.finish_transaction(ui, tx)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue