jj_lib::rewrite

Function duplicate_commits

Source
pub fn duplicate_commits(
    settings: &UserSettings,
    mut_repo: &mut MutableRepo,
    target_commits: &[CommitId],
    parent_commit_ids: &[CommitId],
    children_commit_ids: &[CommitId],
) -> BackendResult<DuplicateCommitsStats>
Expand description

Duplicates the given target_commits onto a new location in the graph.

The roots of target_commits are duplicated on top of the new parent_commit_ids, whilst other commits in target_commits are duplicated on top of the newly duplicated commits in the target set. If children_commit_ids is not empty, the children_commit_ids will be rebased onto the heads of the duplicated target commits.

This assumes that commits in children_commit_ids can be rewritten. There should also be no cycles in the resulting graph, i.e. children_commit_ids should not be ancestors of parent_commit_ids. Commits in target_commits should be in reverse topological order (children before parents).