mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-25 05:29:39 +00:00
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| {
|
||||
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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue