package org.iwakura.larcjb import com.intellij.openapi.options.Configurable import com.intellij.openapi.project.Project import com.intellij.openapi.vcs.AbstractVcs import com.intellij.openapi.vcs.VcsKey import com.intellij.openapi.vcs.changes.ChangeProvider import com.intellij.openapi.vcs.checkin.CheckinEnvironment import com.intellij.openapi.vcs.rollback.RollbackEnvironment import com.intellij.openapi.vfs.VirtualFile import org.iwakura.larcjb.changes.LarcChangeProvider import org.iwakura.larcjb.checkin.LarcCheckinEnvironment import org.iwakura.larcjb.rollback.LarcRollbackEnvironment class LarcVcs(project: Project) : AbstractVcs(project, NAME) { private val executable = LarcExecutable(project) private val larcChangeProvider = LarcChangeProvider(project, executable) private val larcCheckinEnvironment = LarcCheckinEnvironment(project, executable) private val larcRollbackEnvironment = LarcRollbackEnvironment(project, executable) override fun getDisplayName(): String = DISPLAY_NAME override fun getChangeProvider(): ChangeProvider = larcChangeProvider override fun getCheckinEnvironment(): CheckinEnvironment = larcCheckinEnvironment override fun getRollbackEnvironment(): RollbackEnvironment = larcRollbackEnvironment override fun getConfigurable(): Configurable = LarcVcsConfigurable(project) override fun isVersionedDirectory(dir: VirtualFile): Boolean { return dir.findChild(LARC_DIR) != null } fun getExecutable(): LarcExecutable = executable /** * Public accessor for VcsKey - delegates to AbstractVcs.getKeyInstanceMethod() */ fun getVcsKey(): VcsKey = keyInstanceMethod companion object { const val NAME = "Larc" const val DISPLAY_NAME = "Larc" const val LARC_DIR = ".larc" @JvmStatic fun getInstance(project: Project): LarcVcs { return project.getService(LarcVcs::class.java) ?: throw IllegalStateException("LarcVcs service not found") } } }