fun up()

in src/main/kotlin/com/jetbrains/interactiveRebase/listeners/BranchNavigationListener.kt [64:88]


    fun up() {
        project.takeAction {
            val branch = modelService.getSelectedBranch()
            if (branch.selectedCommits.size == 0) {
                val commit = branch.currentCommits.last()
                modelService.selectSingleCommit(commit, branch)
                return@takeAction
            }

            var commit = modelService.getLastSelectedCommit()

            val index = branch.currentCommits.indexOf(commit)
            if (index == 0) {
                commit = branch.currentCommits[index]
                modelService.selectSingleCommit(commit, branch)
                return@takeAction
            }

            commit = branch.currentCommits[index - 1]
            if (commit.isCollapsed) {
                commit = branch.currentCommits[index - 2]
            }
            modelService.selectSingleCommit(commit, branch)
        }
    }