2N67RQZCVGL6GYJJLM2US4YVCEIUK25AHCLD66C7HR4PPTNUOCWAC ISO7J5ZH5UB7NFZKTKKJQHQHCP4DWQ3F7SM2NDMVYJAGGIKDLX4QC ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC MTPTFTHGAOKQGRUDXC55AM6XJHZZZ5EF6FPVXKFVCUYVXJNEANYQC GGYFPXND4VBCROZZXTKAP7Y4JOP2OOYQAFVLMUE7SLFM225EUSIAC B43WNBLFFR2UQIH3C6KIZAQTAEQOQM3J3IYLGQMVGJHYOME73OKQC FNNW5IEAXQ43WKB6QSQB7DFLG3Y3T5FYPXIUX7KQ2URR2GU3QLTAC 6CR2EFUN7JXFHCBTNX3WWOOP4WFOCFO6KSPEBN6V6J5HFZO2LHNQC FRFFQV7VNYKGCA7ZAOSRPC2HHYTAIZ6AGGR7A5QEV6QPAQGFDYGAC Q7FXTHVUPVAFMNY277C3NFJO3VXLZU5G6C6UYSD5QPURHSG3A7OQC Q35OTML226J2HZLHOCPV5OY6ZUM2XU4RZBE5E3GDWVHVFASHFEJAC expert.mode.notification.failure=Failed to record changes with exit code <bold>{0}</bold> and message: <tt>{1}</tt>.
expert.mode.notification.failure=Failed to record changes with exit code <bold>{0}</bold> and message: <tt>{1}</tt>.cache.invalidate.text=Invalidating caches...cache.invalidate.current.text=Invalidating <em>{0}</em>...cache.invalidate.finish.text=Invalidated cachesinstall.pijul.title=Install pijulinstall.pijul.title2=Install Pijulinstall.pijul.text=Cannot find pijul binaries.\n\Do you want to install pijul using rust cargo?install.editor.server.title=Install editor-serverinstall.editor.server.title2=Install Editor Serverinstall.editor.server.text=Cannot find editor-server binaries.\n\Dracon depends on editor-server for interfacing with Pijul.\n\Do you want to install editor-server using rust cargo?install.cargo.title=Install Rustup and Cargoinstall.cargo.text=In order to install <tt>{0}</tt> you need to have cargo installed.\n\However we cannot find cargo installed in this machine.\n\Do you want to install rustup with cargo?\n\If you agree, we will download rustup and launch the installer, you take from there.install.pijul.warning.text=You won't be able to use Dracon plugin since some dependencies could not be installed.install.cargo.running.text=Running cargo install...
constructor(root: Path,filePath: FilePath,revision: PijulRevisionNumber,project: Project): this(root, Paths.get(filePath.path), revision, project)override fun getContent(): String {return loadStateInRevision(this.revision.hash, this.project, root, this.filePath)}
constructor(root: Path,filePath: FilePath,revision: PijulRevisionNumber,project: Project) : this(root, Paths.get(filePath.path), revision, project)private val content = this.project.service<FileRevisionCache>().loadAsync(this)override fun getContent(): String = String(this.content.get(), Charsets.UTF_8)
fun loadAsync(rev: PijulContentRevision): CompletableFuture<ByteArray> {val root = project.service<PijulVcsContext>().rootval fileRev = FileRevisionRef(rev.filePath.toAbsolutePath().toString(), rev.revision.hash)return this.cache.queryOrLoadAsync(fileRev) {loadStateInRevision(rev.revision.hash,this.project,root,rev.filePath).toByteArray(Charsets.UTF_8)}}fun invalidate() {this.cache.invalidate()}
package com.github.jonathanxd.dracon.activityimport com.github.jonathanxd.dracon.i18n.BUNDLEimport com.github.jonathanxd.dracon.i18n.DraconBundleimport com.github.jonathanxd.dracon.pijul.NonZeroExitStatusCodeimport com.github.jonathanxd.dracon.pijul.Pijulimport com.github.jonathanxd.dracon.pijul.pijulimport com.github.jonathanxd.dracon.util.escapeXmlimport com.github.jonathanxd.dracon.util.findBinaryimport com.github.jonathanxd.dracon.util.findBinaryOrNullimport com.github.jonathanxd.dracon.util.wrapInHmlimport com.github.jonathanxd.dracon.vcs.DraconVcsUtilimport com.github.jonathanxd.dracon.vcs.NotificationIdsimport com.intellij.execution.configurations.GeneralCommandLineimport com.intellij.execution.util.ExecUtilimport com.intellij.openapi.progress.ProgressIndicatorimport com.intellij.openapi.progress.Taskimport com.intellij.openapi.project.Projectimport com.intellij.openapi.startup.StartupActivityimport com.intellij.openapi.ui.Messagesimport com.intellij.openapi.util.SystemInfoimport com.intellij.openapi.vcs.VcsNotifierimport com.intellij.util.download.DownloadableFileServiceimport com.intellij.util.download.FileDownloaderimport com.intellij.util.io.IdeUtilIoBundleimport com.intellij.vcsUtil.VcsUtilimport org.jetbrains.annotations.PropertyKeyimport java.nio.file.Pathsimport java.util.concurrent.CompletableFutureclass PijulPostStartupActivity : StartupActivity {override fun runActivity(project: Project) {val path = project.basePath?.let { Paths.get(it) } ?: returnif (Pijul.isUnderPijul(path)) {val hasPijul = findBinaryOrNull("pijul") != nullval hasEditorServer = findBinaryOrNull("editor-server") != nullif (!hasPijul) {val hasCargo = findBinaryOrNull("cargo") != nullif (!hasCargo) {this.askForCargoInstallation(project, "pijul").handle { t, u ->if (t != null && checkForCargo(project)) {cargoInstallPijul(project)}if (u != null) {warnDraconWillNotWork(project)u.printStackTrace()}}} else {cargoInstallPijul(project)}}if (!hasEditorServer) {val hasCargo = findBinaryOrNull("cargo") != nullif (!hasCargo) {this.askForCargoInstallation(project, "editor-server").handle { t, u ->if (t != null && checkForCargo(project)) {cargoInstallEditor(project)}if (u != null) {warnDraconWillNotWork(project)u.printStackTrace()}}} else {cargoInstallEditor(project)}}}}fun cargoInstallPijul(project: Project) {val dialog = Messages.showYesNoDialog(project,DraconBundle.message("install.pijul.text").wrapInHml(),DraconBundle.message("install.pijul.title2"),Messages.getWarningIcon())if (dialog == Messages.YES) {object : Task.Backgroundable(project, DraconBundle.message("install.pijul.title")) {override fun run(indicator: ProgressIndicator) {indicator.isIndeterminate = trueindicator.text = DraconBundle.message("install.pijul.title")indicator.text2 = DraconBundle.message("install.cargo.running.text")execInTerminal("install.pijul.title", "cargo install pijul --version '~1.0.0-alpha'")}}.queue()} else {warnDraconWillNotWork(project)}}fun cargoInstallEditor(project: Project) {val dialog = Messages.showYesNoDialog(project,DraconBundle.message("install.editor.server.text").wrapInHml(),DraconBundle.message("install.editor.server.title2"),Messages.getWarningIcon())if (dialog == Messages.YES) {object : Task.Backgroundable(project, DraconBundle.message("install.editor.server.title")) {override fun run(indicator: ProgressIndicator) {indicator.isIndeterminate = trueindicator.text = DraconBundle.message("install.editor.server.title")indicator.text2 = DraconBundle.message("install.cargo.running.text")execInTerminal("install.editor.server.title", "cargo install editor-server")}}.queue()} else {warnDraconWillNotWork(project)}}fun checkForCargo(project: Project): Boolean {if (findBinaryOrNull("cargo") == null) {warnDraconWillNotWork(project)return false}return true}fun warnDraconWillNotWork(project: Project) {Messages.showWarningDialog(project,DraconBundle.message("install.pijul.warning.text").wrapInHml(),DraconBundle.message("install.pijul.title"))}fun askForCargoInstallation(project: Project, sub: String): CompletableFuture<Unit> {val dialog = Messages.showYesNoDialog(project,DraconBundle.message("install.cargo.text", sub.escapeXml()).wrapInHml(),DraconBundle.message("install.cargo.title"),Messages.getWarningIcon())if (dialog == Messages.YES) {val download = if (SystemInfo.isWindows) {DownloadableFileService.getInstance().createDownloader(listOf(DownloadableFileService.getInstance().createFileDescription("https://win.rustup.rs/x86_64","rustup-init.exe")), "Rustup")} else {DownloadableFileService.getInstance().createDownloader(listOf(DownloadableFileService.getInstance().createFileDescription("https://sh.rustup.rs","rustup-init.sh")), "Rustup")}return download.downloadWithBackgroundProgress(null, project).handle { t, u ->if (t != null && t.isNotEmpty()) {val file = Paths.get(VcsUtil.getFilePath(t.single().first).path).toAbsolutePath()if (SystemInfo.isWindows) {this.execInTerminal("install.cargo.title", file.toString())} else {this.execInTerminal("install.cargo.title", "sh $file")}}u?.printStackTrace()}} else {return CompletableFuture.failedFuture(IllegalStateException("User not accepted cargo installation."))}}fun execInTerminal(@PropertyKey(resourceBundle = BUNDLE) name: String,command: String) {ExecUtil.execAndGetOutput(GeneralCommandLine(ExecUtil.getTerminalCommand(DraconBundle.message(name), command)))}}
/*** Dracon - An IntelliJ-Pijul integration.* Copyright 2021 JonathanxD <jhrldev@gmail.com>** Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:** The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/package com.github.jonathanxd.dracon.actionsimport com.github.jonathanxd.dracon.cache.FileRevisionCacheimport com.github.jonathanxd.dracon.cache.FileStatusCacheimport com.github.jonathanxd.dracon.cache.PijulLogEntryCacheimport com.github.jonathanxd.dracon.cache.PijulLogEntryChangeCacheimport com.github.jonathanxd.dracon.i18n.DraconBundleimport com.github.jonathanxd.dracon.pijul.NonZeroExitStatusCodeimport com.github.jonathanxd.dracon.pijul.Pijulimport com.github.jonathanxd.dracon.pijul.pijulimport com.github.jonathanxd.dracon.util.wrapInHmlimport com.github.jonathanxd.dracon.vcs.DraconVcsUtilimport com.github.jonathanxd.dracon.vcs.NotificationIdsimport com.github.jonathanxd.dracon.vfs.DraconVfsUtilimport com.intellij.openapi.actionSystem.AnActionEventimport com.intellij.openapi.actionSystem.CommonDataKeysimport com.intellij.openapi.components.serviceimport com.intellij.openapi.fileChooser.FileChooserimport com.intellij.openapi.fileChooser.FileChooserDescriptorFactoryimport com.intellij.openapi.progress.ProgressIndicatorimport com.intellij.openapi.progress.Taskimport com.intellij.openapi.project.DumbAwareActionimport com.intellij.openapi.project.ProjectManagerimport com.intellij.openapi.ui.Messagesimport com.intellij.openapi.vcs.ProjectLevelVcsManagerimport com.intellij.openapi.vcs.VcsNotifierimport com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerimport com.intellij.vcsUtil.VcsUtilclass PijulInvalidateCaches: DumbAwareAction() {override fun actionPerformed(e: AnActionEvent) {val project = e.getData(CommonDataKeys.PROJECT) ?: ProjectManager.getInstance().defaultProjectobject : Task.Backgroundable(project, DraconBundle.Dracon.refreshing) {override fun run(indicator: ProgressIndicator) {indicator.isIndeterminate = falseindicator.text = DraconBundle.message("cache.invalidate.text")indicator.fraction = 0.0val fileRevisionCache = project.service<FileRevisionCache>()indicator.text2 = DraconBundle.message("cache.invalidate.current.text", "file revision cache")fileRevisionCache.invalidate()indicator.fraction = 0.25val fileStatusCache = project.service<FileStatusCache>()indicator.text2 = DraconBundle.message("cache.invalidate.current.text", "file status cache")fileStatusCache.invalidate()indicator.fraction = 0.50val logEntryCache = project.service<PijulLogEntryCache>()indicator.text2 = DraconBundle.message("cache.invalidate.current.text", "pijul log entry cache")logEntryCache.invalidate()indicator.fraction = 0.75val logEntryChangeCache = project.service<PijulLogEntryChangeCache>()indicator.text2 = DraconBundle.message("cache.invalidate.current.text", "pijul log entry changes cache")logEntryChangeCache.invalidate()indicator.fraction = 1.0indicator.text2 = DraconBundle.message("cache.invalidate.finish.text")}}.queue()}}