Function duplicate_commits

Source
pub fn duplicate_commits(
    mut_repo: &mut MutableRepo,
    target_commit_ids: &[CommitId],
    target_descriptions: &HashMap<CommitId, String>,
    parent_commit_ids: &[CommitId],
    children_commit_ids: &[CommitId],
) -> BackendResult<DuplicateCommitsStats>
Expand description

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

The roots of target_commit_ids are duplicated on top of the new parent_commit_ids, whilst other commits in target_commit_ids 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.

If target_descriptions is not empty, it will be consulted to retrieve the new descriptions of the target commits, falling back to the original if the map does not contain an entry for a given commit.

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_commit_ids should be in reverse topological order (children before parents).