PY-78389: Introduce VcsDisableConfirmationPopupCommand

GitOrigin-RevId: 5be662a704db38ed14dc47eb18d0f43bfceabd3c
This commit is contained in:
Ilia Zakoulov
2025-04-14 13:52:11 +00:00
committed by intellij-monorepo-bot
parent e78808cc18
commit 2a3d54088f
3 changed files with 36 additions and 1 deletions
@@ -20,7 +20,8 @@ public final class GitCommandProvider implements CommandProvider {
Map.entry(CheckGitLogIndexedCommand.PREFIX, CheckGitLogIndexedCommand::new),
Map.entry(WaitVcsLogIndexingCommand.PREFIX, WaitVcsLogIndexingCommand::new),
Map.entry(WaitForVcsLogUpdateCommand.PREFIX, WaitForVcsLogUpdateCommand::new),
Map.entry(GitRollbackCommand.PREFIX, GitRollbackCommand::new)
Map.entry(GitRollbackCommand.PREFIX, GitRollbackCommand::new),
Map.entry(VcsDisableConfirmationPopupCommand.PREFIX, VcsDisableConfirmationPopupCommand::new)
);
}
}
@@ -0,0 +1,30 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.performanceTesting
import com.intellij.openapi.ui.playback.PlaybackContext
import com.intellij.openapi.vcs.ProjectLevelVcsManager
import com.intellij.openapi.vcs.VcsConfiguration
import com.intellij.openapi.vcs.VcsShowConfirmationOption
import com.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter
internal class VcsDisableConfirmationPopupCommand(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) {
companion object {
const val NAME = "vcsDisableConfirmationPopup"
const val PREFIX = "$CMD_PREFIX$NAME"
}
override suspend fun doExecute(context: PlaybackContext) {
val vcsManager = ProjectLevelVcsManager.getInstance(context.project)
val vcss = vcsManager.getAllSupportedVcss()
vcss.forEach { vcs ->
VcsConfiguration.StandardConfirmation.entries.forEach { confirmationType ->
val option = vcsManager.getStandardConfirmation(confirmationType, vcs)
option.setValue(VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY)
}
}
}
override fun getName(): String {
return NAME
}
}
@@ -1116,6 +1116,10 @@ fun <T : CommandChain> T.gitRollbackFile(pathToFile: String): T = apply {
addCommand("${CMD_PREFIX}gitRollbackFile ${pathToFile}")
}
fun <T: CommandChain> T.vcsDisableConfirmationPopup(): T = apply {
addCommand("${CMD_PREFIX}vcsDisableConfirmationPopup")
}
fun <T : CommandChain> T.replaceText(startOffset: Int? = null, endOffset: Int? = null, newText: String? = null): T = apply {
val options = StringBuilder()
if (startOffset != null) {