forked from mirrors/jj
Simplify calls to CommitRewriter::replace_parents()
Now that it takes `IntoIterator` the caller doesn't need to clone the input `CommitIds`.
This commit is contained in:
parent
2b0aa84c9d
commit
f9a3021a7a
2 changed files with 4 additions and 6 deletions
|
@ -181,10 +181,8 @@ the operation will be aborted.
|
||||||
|mut rewriter| {
|
|mut rewriter| {
|
||||||
num_rebased += 1;
|
num_rebased += 1;
|
||||||
if args.siblings {
|
if args.siblings {
|
||||||
rewriter.replace_parent(
|
rewriter
|
||||||
second_commit.id(),
|
.replace_parent(second_commit.id(), [first_commit.id(), second_commit.id()]);
|
||||||
&[first_commit.id().clone(), second_commit.id().clone()],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// We don't need to do anything special for the non-siblings case
|
// We don't need to do anything special for the non-siblings case
|
||||||
// since we already marked the original commit as rewritten.
|
// since we already marked the original commit as rewritten.
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn test_transform_descendants_sync() {
|
||||||
let mut rebased = HashMap::new();
|
let mut rebased = HashMap::new();
|
||||||
tx.mut_repo()
|
tx.mut_repo()
|
||||||
.transform_descendants(&settings, vec![commit_b.id().clone()], |mut rewriter| {
|
.transform_descendants(&settings, vec![commit_b.id().clone()], |mut rewriter| {
|
||||||
rewriter.replace_parent(commit_a.id(), &[commit_g.id().clone()]);
|
rewriter.replace_parent(commit_a.id(), [commit_g.id()]);
|
||||||
if *rewriter.old_commit() == commit_c {
|
if *rewriter.old_commit() == commit_c {
|
||||||
let old_id = rewriter.old_commit().id().clone();
|
let old_id = rewriter.old_commit().id().clone();
|
||||||
let new_parent_ids = rewriter.new_parents().to_vec();
|
let new_parent_ids = rewriter.new_parents().to_vec();
|
||||||
|
@ -106,7 +106,7 @@ fn test_transform_descendants_sync_linearize_merge() {
|
||||||
let mut rebased = HashMap::new();
|
let mut rebased = HashMap::new();
|
||||||
tx.mut_repo()
|
tx.mut_repo()
|
||||||
.transform_descendants(&settings, vec![commit_c.id().clone()], |mut rewriter| {
|
.transform_descendants(&settings, vec![commit_c.id().clone()], |mut rewriter| {
|
||||||
rewriter.replace_parent(commit_a.id(), &[commit_b.id().clone()]);
|
rewriter.replace_parent(commit_a.id(), [commit_b.id()]);
|
||||||
let old_commit_id = rewriter.old_commit().id().clone();
|
let old_commit_id = rewriter.old_commit().id().clone();
|
||||||
let new_commit = rewriter.rebase(&settings)?.write()?;
|
let new_commit = rewriter.rebase(&settings)?.write()?;
|
||||||
rebased.insert(old_commit_id, new_commit);
|
rebased.insert(old_commit_id, new_commit);
|
||||||
|
|
Loading…
Reference in a new issue