fun cherryPick()

in bunch-cli/src/main/kotlin/org/jetbrains/bunches/patch-cherry-pick.kt [66:83]


fun cherryPick(settings: Settings) {
    uncommittedChanges(settings.gitPath).checkAndExitIfNeeded {
        exitWithError("Can not create new commit in cp with uncommitted changes.")
    }

    with(settings) {
        val commits = readCommits(
            repositoryPath = gitPath,
            sinceRevString = sinceHash,
            untilRevString = untilHash
        )

        for (commit in commits.reversed()) {
            println("Apply: ${commit.hash} ${commit.title}")
            reCommitChanges(gitPath, commit.fileActions, commit, suffix)
        }
    }
}