From 8d81cdcef787bb389028034e4da39e6a6ee5a5d3 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 17 Aug 2022 12:09:01 +0200 Subject: [PATCH] IDEA-300069 vcs: remove 'Create changelist on failed commit' option GitOrigin-RevId: 770e7e3404c57d57741400313b388a9b66819f83 --- .../openapi/vcs/VcsConfiguration.java | 2 - .../resources/messages/VcsBundle.properties | 5 -- .../configurable/CommitDialogConfigurable.kt | 10 ---- .../statistics/VcsOptionsUsagesCollector.kt | 2 - .../commit/SingleChangeListCommitWorkflow.kt | 9 ---- .../vcs/commit/SingleChangeListCommitter.kt | 52 ------------------- 6 files changed, 80 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index 1ff698ac0fb5..e71ab7cb020a 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -43,8 +43,6 @@ public final class VcsConfiguration implements PersistentStateComponent() @@ -56,13 +54,6 @@ open class SingleChangeListCommitWorkflow( internal lateinit var commitState: ChangeListCommitState - override fun processExecuteChecksResult(sessionInfo: CommitSessionInfo, result: CommitChecksResult) { - if (result.shouldCloseWindow) { - moveToFailedList(project, commitState, message("commit.dialog.rejected.commit.template", commitState.changeList.name)) - } - super.processExecuteChecksResult(sessionInfo, result) - } - override fun performCommit(sessionInfo: CommitSessionInfo) { if (sessionInfo.isVcsCommit) { DefaultNameChangeListCleaner(project, commitState).use { doCommit(commitState) } diff --git a/platform/vcs-impl/src/com/intellij/vcs/commit/SingleChangeListCommitter.kt b/platform/vcs-impl/src/com/intellij/vcs/commit/SingleChangeListCommitter.kt index 3ec46aa44318..108e9d34c911 100644 --- a/platform/vcs-impl/src/com/intellij/vcs/commit/SingleChangeListCommitter.kt +++ b/platform/vcs-impl/src/com/intellij/vcs/commit/SingleChangeListCommitter.kt @@ -1,16 +1,8 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.commit -import com.intellij.openapi.application.ApplicationManager.getApplication -import com.intellij.openapi.application.ModalityState import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.Messages.getQuestionIcon -import com.intellij.openapi.vcs.VcsBundle.message -import com.intellij.openapi.vcs.VcsConfiguration -import com.intellij.openapi.vcs.VcsShowConfirmationOption import com.intellij.openapi.vcs.changes.* -import com.intellij.util.concurrency.annotations.RequiresEdt -import com.intellij.util.ui.ConfirmationDialog.requestForConfirmation import org.jetbrains.annotations.Nls class ChangeListCommitState(val changeList: LocalChangeList, val changes: List, val commitMessage: String) { @@ -34,13 +26,6 @@ open class SingleChangeListCommitter( private val changeList get() = commitState.changeList - override fun onFailure() { - getApplication().invokeLater(Runnable { - val failedCommitState = ChangeListCommitState(changeList, failedToCommitChanges, commitMessage) - moveToFailedList(project, failedCommitState, message("commit.dialog.failed.commit.template", changeList.name)) - }, ModalityState.defaultModalityState(), project.disposed) - } - override fun afterRefreshChanges() { if (isSuccess) { updateChangeListAfterRefresh() @@ -60,41 +45,4 @@ open class SingleChangeListCommitter( changeListManager.scheduleAutomaticEmptyChangeListDeletion(localList) } } - - companion object { - @JvmStatic - @RequiresEdt - fun moveToFailedList(project: Project, commitState: ChangeListCommitState, newChangeListName: String) { - // No need to move since we'll get exactly the same changelist. - val failedChanges = commitState.changes - if (failedChanges.containsAll(commitState.changeList.changes)) return - - val configuration = VcsConfiguration.getInstance(project) - if (configuration.MOVE_TO_FAILED_COMMIT_CHANGELIST != VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) { - val option = object : VcsShowConfirmationOption { - override fun getValue(): VcsShowConfirmationOption.Value = configuration.MOVE_TO_FAILED_COMMIT_CHANGELIST - - override fun setValue(value: VcsShowConfirmationOption.Value) { - configuration.MOVE_TO_FAILED_COMMIT_CHANGELIST = value - } - - override fun isPersistent(): Boolean = true - } - val result = requestForConfirmation(option, project, message("commit.failed.confirm.prompt"), - message("commit.failed.confirm.title"), getQuestionIcon()) - if (!result) return - } - - val changeListManager = ChangeListManager.getInstance(project) - var index = 1 - var failedListName = newChangeListName - while (changeListManager.findChangeList(failedListName) != null) { - index++ - failedListName = "$newChangeListName ($index)" - } - - val failedList = changeListManager.addChangeList(failedListName, commitState.commitMessage) - changeListManager.moveChangesTo(failedList, *failedChanges.toTypedArray()) - } - } } \ No newline at end of file