commit - 0136c7f3483e8e3c7bd5dcc9f78978b00e7e192b
commit + 8128d7171e1abbe938af4d31a39eda58a14b2b02
blob - 358dae35996c95b4d204e975b6f21afe773eb24b
blob + 1b85568799abb3fcbf7961aefcb27025bd1c4fc0
--- src/main/kotlin/dev/nezzontli/gotvcs/GotVcs.kt
+++ src/main/kotlin/dev/nezzontli/gotvcs/GotVcs.kt
import com.intellij.openapi.vcs.AbstractVcs
import com.intellij.openapi.vcs.VcsKey
import com.intellij.openapi.vcs.changes.ChangeProvider
+import com.intellij.openapi.vcs.changes.CommitExecutor
import com.intellij.openapi.vcs.checkin.CheckinEnvironment
import com.intellij.openapi.vcs.diff.DiffProvider
import com.intellij.openapi.vcs.history.VcsHistoryProvider
import com.intellij.openapi.vcs.rollback.RollbackEnvironment
import com.intellij.openapi.vcs.update.UpdateEnvironment
+import com.intellij.openapi.vcs.VcsType
import dev.nezzontli.gotvcs.checkin.GotCheckinEnvironment
+import dev.nezzontli.gotvcs.checkin.GotCommitAndSendExecutor
import dev.nezzontli.gotvcs.checkin.GotRollbackEnvironment
import dev.nezzontli.gotvcs.changes.GotChangeProvider
import dev.nezzontli.gotvcs.changes.GotDiffProvider
private val rollbackEnvironment = GotRollbackEnvironment(project, commandLine)
private val historyProvider = GotVcsHistoryProvider(project, commandLine)
private val updateEnvironment = GotUpdateEnvironment(commandLine)
+ private val commitAndSendExecutor = GotCommitAndSendExecutor(project, checkinEnvironment)
override fun getDisplayName(): String = NAME
+ // got is a distributed VCS (local commits, explicit `got send`), same
+ // shape as Git. The platform only enables its non-modal Commit tool
+ // window when every active VCS reports VcsType.distributed here --
+ // AbstractVcs.getType() defaults to centralized, which silently forces
+ // the old modal commit dialog and greys out the Commit tool window
+ // entirely (verified via CommitModeManager.canSetNonModal() bytecode).
+ override fun getType(): VcsType = VcsType.distributed
+
override fun getChangeProvider(): ChangeProvider = changeProvider
override fun getDiffProvider(): DiffProvider = diffProvider
override fun getUpdateEnvironment(): UpdateEnvironment = updateEnvironment
+ override fun getCommitExecutors(): List<CommitExecutor> = listOf(commitAndSendExecutor)
+
companion object {
const val NAME = "got"
blob - c414081a7f02630f421091f93a84a3deec66fc6e
blob + 12aeb4cf7ba167f98d6b05be62bad269d4bca3c7
--- src/main/kotlin/dev/nezzontli/gotvcs/history/GotFileRevision.kt
+++ src/main/kotlin/dev/nezzontli/gotvcs/history/GotFileRevision.kt
override fun getChangedRepositoryPath(): RepositoryLocation? = null
@Throws(VcsException::class)
- override fun loadContent(): ByteArray = getContent()
+ override fun loadContent(): ByteArray = commandLine.catAt(workDir, entry.commitId, relativePath).toByteArray()
+ // VcsFileContent.getContent() has no default body despite being deprecated
+ // in favor of loadContent() -- it must still be implemented.
+ @Suppress("OVERRIDE_DEPRECATION")
@Throws(VcsException::class)
- override fun getContent(): ByteArray = commandLine.catAt(workDir, entry.commitId, relativePath).toByteArray()
+ override fun getContent(): ByteArray = loadContent()
}
blob - fe82f9165a7f72564bdb819e25bdbbf0b46072d4
blob + 6f772d20ab23f52059f60a2893b079859d96c2db
--- src/main/kotlin/dev/nezzontli/gotvcs/push/GotOutgoingCommitsProvider.kt
+++ src/main/kotlin/dev/nezzontli/gotvcs/push/GotOutgoingCommitsProvider.kt
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.vcs.VcsException
import dev.nezzontli.gotvcs.cli.GotCommandLineWrapper
+import dev.nezzontli.gotvcs.log.GotFullCommitDetails
import dev.nezzontli.gotvcs.repo.GotRepository
import java.io.File
): OutgoingResult {
val workDir = File(repository.root.path)
val target = pushSpec.target
- logger.warn("got outgoing commits: workDir=$workDir remote=${target.remoteName} branch=${target.branch}")
return try {
val remoteHash = commandLine.remoteBranchHash(workDir, target.remoteName, target.branch)
- logger.warn("got outgoing commits: remoteHash=$remoteHash")
val ids = commandLine.outgoingCommitIds(workDir, remoteHash)
- logger.warn("got outgoing commits: ids=$ids")
val commits = ids.map { id -> GotFullCommitDetails(commandLine.catCommit(workDir, id), repository.root) }
OutgoingResult(commits, emptyList())
} catch (e: VcsException) {
- logger.warn("got outgoing commits failed", e)
OutgoingResult(emptyList(), listOf(VcsError(e.message)))
} catch (e: Exception) {
logger.error("got outgoing commits failed unexpectedly", e)
blob - b974d16779def762c4a4d1815d1e6b8aae07b979
blob + 3c7dcf56b45ee99c4ea9fc2f8f27e69ca5c8a491
--- src/main/kotlin/dev/nezzontli/gotvcs/push/GotPusher.kt
+++ src/main/kotlin/dev/nezzontli/gotvcs/push/GotPusher.kt
Pusher<GotRepository, GotPushSource, GotPushTarget>() {
override fun push(
- pushSpecs: MutableMap<GotRepository, PushSpec<GotPushSource, GotPushTarget>>,
+ pushSpecs: Map<GotRepository, PushSpec<GotPushSource, GotPushTarget>>,
forcePushOptionValue: VcsPushOptionValue?,
force: Boolean,
) {
blob - 10b7ba43876f4f2897f39aa65ff5c2488054c3e1
blob + f5080061a1987c081204acc125599fc285fc261a
--- src/main/resources/META-INF/plugin.xml
+++ src/main/resources/META-INF/plugin.xml
implementation="dev.nezzontli.gotvcs.repo.GotBranchWidget$Factory"
order="after CodeStyleStatusBarWidget"/>
<pushSupport implementation="dev.nezzontli.gotvcs.push.GotPushSupport"/>
+ <logProvider implementation="dev.nezzontli.gotvcs.log.GotVcsLogProvider"/>
</extensions>
+
+ <actions>
+ <action id="Got.Commit.And.Send.Executor"
+ class="dev.nezzontli.gotvcs.checkin.GotCommitAndSendExecutorAction">
+ <add-to-group group-id="Vcs.Commit.PrimaryCommitActions"/>
+ </action>
+ </actions>
</idea-plugin>