[dvcs] IJPL-184367 Revert modal commit for Mercurial

(cherry picked from commit 84b7ddf6b1c1a6b8192d605d6912a43994d4026f)

IJ-MR-160787

GitOrigin-RevId: f65baac94099f647fb0aea2fad1891af65d20d11
This commit is contained in:
Ilia.Shulgin
2025-04-17 14:05:59 +02:00
committed by intellij-monorepo-bot
parent 5c6eaa97cf
commit 7ceb9d9b92
12 changed files with 38 additions and 44 deletions

View File

@@ -36,6 +36,10 @@
<extensionPoint name="customPushOptionsPanelFactory"
interface="com.intellij.dvcs.push.CustomPushOptionsPanelFactory"
dynamic="true"/>
<extensionPoint name="commitModeProvider"
interface="com.intellij.dvcs.commit.DvcsCommitModeProvider"
dynamic="true"/>
</extensionPoints>
<actions>
<action id="Vcs.CherryPick" class="com.intellij.dvcs.cherrypick.VcsCherryPickAction" icon="DvcsImplIcons.CherryPick"/>

View File

@@ -1,16 +1,19 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.commit
package com.intellij.dvcs.commit
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.vcs.commit.CommitMode
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
interface GitCommitModeProvider {
interface DvcsCommitModeProvider {
fun getCommitMode(): CommitMode?
companion object {
@JvmField
val EP_NAME: ExtensionPointName<GitCommitModeProvider> = ExtensionPointName("Git4Idea.gitCommitModeProvider")
val EP_NAME: ExtensionPointName<DvcsCommitModeProvider> = ExtensionPointName("com.intellij.commitModeProvider")
@JvmStatic
fun compute(): CommitMode? = EP_NAME.computeSafeIfAny { it.getCommitMode() }
}
}

View File

@@ -9,7 +9,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.vcs.git" />
<orderEntry type="module" module-name="intellij.platform.vcs" />
<orderEntry type="module" module-name="intellij.platform.editor.ui" />
<orderEntry type="module" module-name="intellij.platform.core" />
@@ -17,5 +16,6 @@
<orderEntry type="module" module-name="intellij.platform.vcs.impl" />
<orderEntry type="module" module-name="intellij.platform.ide.core" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.vcs.dvcs.impl" />
</component>
</module>

View File

@@ -1,10 +1,10 @@
<idea-plugin package="com.intellij.vcs.git.commit.modal">
<name>Git Modal Commit Interface</name>
<idea-plugin>
<name>Modal Commit Interface</name>
<id>intellij.git.commit.modal</id>
<category>Version Controls</category>
<vendor>JetBrains</vendor>
<description><![CDATA[
This plugin restores the modal commit option for JetBrains IDEs,
This plugin restores the modal commit option for Git and Mercurial in JetBrains IDEs,
which was the default before the introduction of the non-modal commit window.
<br/>
If you prefer the traditional commit workflow, this plugin brings that functionality back
@@ -12,22 +12,19 @@
]]></description>
<dependencies>
<plugin id="Git4Idea"/>
<module name="intellij.platform.vcs.dvcs.impl"/>
</dependencies>
<resource-bundle>messages.GitModalCommitBundle</resource-bundle>
<extensions defaultExtensionNs="Git4Idea">
<gitCommitModeProvider implementation="com.intellij.vcs.git.commit.modal.GitModalCommitModeProvider"/>
</extensions>
<resource-bundle>messages.ModalCommitBundle</resource-bundle>
<extensions defaultExtensionNs="com.intellij">
<advancedSetting id="git.non.modal.commit" default="false" groupKey="advanced.settings.git"/>
<vcsStartupActivity implementation="com.intellij.vcs.git.commit.modal.GitModalCommitToggler"/>
<advancedSetting id="git.non.modal.commit" default="false" groupKey="advanced.settings.vcs"/>
<vcsStartupActivity implementation="com.intellij.vcs.git.commit.modal.ModalCommitToggler"/>
<commitModeProvider implementation="com.intellij.vcs.git.commit.modal.ModalCommitModeProvider"/>
</extensions>
<applicationListeners>
<listener class="com.intellij.vcs.git.commit.modal.GitModalCommitSettingsListener"
<listener class="com.intellij.vcs.git.commit.modal.ModalCommitSettingsListener"
topic="com.intellij.openapi.options.advanced.AdvancedSettingsChangeListener"/>
</applicationListeners>
</idea-plugin>

View File

@@ -1,2 +1,2 @@
advanced.settings.git=Version Control. Git
advanced.setting.git.non.modal.commit=Use modal commit interface
advanced.settings.vcs=Version Control
advanced.setting.git.non.modal.commit=Use modal commit interface for Git and Mercurial

View File

@@ -1,11 +1,11 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.vcs.git.commit.modal
import com.intellij.dvcs.commit.DvcsCommitModeProvider
import com.intellij.openapi.options.advanced.AdvancedSettings
import com.intellij.vcs.commit.CommitMode
import git4idea.commit.GitCommitModeProvider
internal class GitModalCommitModeProvider : GitCommitModeProvider {
internal class ModalCommitModeProvider : DvcsCommitModeProvider {
override fun getCommitMode(): CommitMode? {
return if (AdvancedSettings.getBoolean(SETTING_ID)) CommitMode.ModalCommitMode else null
}

View File

@@ -6,9 +6,9 @@ import com.intellij.openapi.application.runInEdt
import com.intellij.openapi.options.advanced.AdvancedSettingsChangeListener
import com.intellij.vcs.commit.CommitModeManager
internal class GitModalCommitSettingsListener() : AdvancedSettingsChangeListener {
internal class ModalCommitSettingsListener() : AdvancedSettingsChangeListener {
override fun advancedSettingChanged(id: String, oldValue: Any, newValue: Any) {
if (id == GitModalCommitModeProvider.SETTING_ID && oldValue != newValue) {
if (id == ModalCommitModeProvider.SETTING_ID && oldValue != newValue) {
runInEdt {
ApplicationManager.getApplication().messageBus.syncPublisher(CommitModeManager.SETTINGS).settingsChanged()
}

View File

@@ -8,10 +8,10 @@ import com.intellij.openapi.vcs.VcsApplicationSettings
import com.intellij.openapi.vcs.impl.VcsInitObject
import com.intellij.openapi.vcs.impl.VcsStartupActivity
internal class GitModalCommitToggler : VcsStartupActivity {
internal class ModalCommitToggler : VcsStartupActivity {
override suspend fun execute(project: Project) {
runOnceForApp("git.modal.commit.toggle") {
AdvancedSettings.setBoolean(GitModalCommitModeProvider.SETTING_ID,
AdvancedSettings.setBoolean(ModalCommitModeProvider.SETTING_ID,
!VcsApplicationSettings.getInstance().COMMIT_FROM_LOCAL_CHANGES)
}
}

View File

@@ -871,7 +871,6 @@
<extensions defaultExtensionNs="Git4Idea">
<gitRawAnnotationProvider implementation="git4idea.annotate.GitAnnotationProvider$DefaultGitAnnotationProvider"/>
<gitCommitModeProvider implementation="git4idea.commit.GitStagingAreaCommitModeProvider" order="first"/>
</extensions>
<extensionPoints>
@@ -892,9 +891,6 @@
qualifiedName="Git4Idea.gitPushNotificationCustomizer"
dynamic="true"
area="IDEA_PROJECT"/>
<extensionPoint interface="git4idea.commit.GitCommitModeProvider"
qualifiedName="Git4Idea.gitCommitModeProvider"
dynamic="true"/>
</extensionPoints>
<projectListeners>

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea;
import com.intellij.dvcs.commit.DvcsCommitModeProvider;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -33,7 +34,6 @@ import git4idea.changes.GitOutgoingChangesProvider;
import git4idea.checkin.GitCheckinEnvironment;
import git4idea.checkin.GitCommitAndPushExecutor;
import git4idea.checkout.GitCheckoutProvider;
import git4idea.commit.GitCommitModeProvider;
import git4idea.commit.GitStagingAreaCommitMode;
import git4idea.config.*;
import git4idea.diff.GitDiffProvider;
@@ -359,13 +359,7 @@ public final class GitVcs extends AbstractVcs {
if (GitVcsApplicationSettings.getInstance().isStagingAreaEnabled()) {
return GitStagingAreaCommitMode.INSTANCE;
}
CommitMode commitModeFromExtension = GitCommitModeProvider.EP_NAME.computeSafeIfAny(GitCommitModeProvider::getCommitMode);
if (commitModeFromExtension != null) {
return commitModeFromExtension;
}
else {
return null;
}
return DvcsCommitModeProvider.compute();
}
@Override

View File

@@ -2,13 +2,6 @@
package git4idea.commit
import com.intellij.vcs.commit.CommitMode
import git4idea.config.GitVcsApplicationSettings
class GitStagingAreaCommitModeProvider : GitCommitModeProvider {
override fun getCommitMode(): CommitMode? {
return if (GitVcsApplicationSettings.getInstance().isStagingAreaEnabled) GitStagingAreaCommitMode else null
}
}
data object GitStagingAreaCommitMode : CommitMode {
override fun useCommitToolWindow(): Boolean = true

View File

@@ -12,6 +12,7 @@
// limitations under the License.
package org.zmlx.hg4idea;
import com.intellij.dvcs.commit.DvcsCommitModeProvider;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.ide.BrowserUtil;
import com.intellij.notification.Notification;
@@ -39,6 +40,7 @@ import com.intellij.openapi.vcs.update.UpdateEnvironment;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.concurrency.annotations.RequiresEdt;
import com.intellij.util.messages.Topic;
import com.intellij.vcs.commit.CommitMode;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
@@ -330,6 +332,11 @@ public final class HgVcs extends AbstractVcs {
return VcsType.distributed;
}
@Override
public @Nullable CommitMode getForcedCommitMode() {
return DvcsCommitModeProvider.compute();
}
@Override
@RequiresEdt
public void enableIntegration(@Nullable VirtualFile targetDirectory) {