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:
Evan Mesterhazy 2024-04-21 10:33:36 -04:00 committed by Evan Mesterhazy
parent 2b0aa84c9d
commit f9a3021a7a
2 changed files with 4 additions and 6 deletions

View file

@ -181,10 +181,8 @@ the operation will be aborted.
|mut rewriter| {
num_rebased += 1;
if args.siblings {
rewriter.replace_parent(
second_commit.id(),
&[first_commit.id().clone(), second_commit.id().clone()],
);
rewriter
.replace_parent(second_commit.id(), [first_commit.id(), second_commit.id()]);
}
// We don't need to do anything special for the non-siblings case
// since we already marked the original commit as rewritten.

View file

@ -48,7 +48,7 @@ fn test_transform_descendants_sync() {
let mut rebased = HashMap::new();
tx.mut_repo()
.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 {
let old_id = rewriter.old_commit().id().clone();
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();
tx.mut_repo()
.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 new_commit = rewriter.rebase(&settings)?.write()?;
rebased.insert(old_commit_id, new_commit);