Fix concurrent pijul execution locking each other
[?]
May 2, 2021, 6:15 PM
4TGL4RKF224WKKGJO5RLL2XOZRKE3F6OKZRFEKM6UJWORSBP2ZSACDependencies
- [2]
POQV6EZEOptions screen - [3]
6CR2EFUNFirst ChangeProvider implementation!!! Wheehooo - [4]
37OJKSWJImproved caching code a lot - [5]
OMZXJL6QReady for pijul push! First nightly build will be released shortly! - [6]
5AUENX2YAdd support to view files affected by a revision - [7]
Q7FXTHVUFirst record support, YEAAAH, RECOOORD - [8]
A7IL6I3VMore files to support .ignore - [9]
ZCRW57C5Improved support for revisions - [10]
B43WNBLF- Add Show History to Pijul menu - Always ignore .idea and .pijul in tracking. - Make findPijul a generic function to allow to find editor-server. - Only show one revision for directories. - Add `Hunk::resolvePath(Path)` to resolve the affected file to a Java NIO Path. - Fix StringOutOfBounds in Change Parsering Algorithm - Use editor-server instead of copie for interfacing with `pijul record` file. - Fix FileStatus provider not returning correctly for untracked files. - Add CommittedChangesProvider for Pijul. - [11]
RE4EKNSLImprovements, a lot - [12]
GGYFPXNDInitial plugin - [13]
FRFFQV7VBasic show history support. - [14]
OPFG6CZ2File status tracking supported. - [15]
DLDMHQY6Add experimental build 3 and options - [16]
FNNW5IEAAdded more plugin files to Pijul - [17]
7L5LODGZParse changes from `pijul change` - [18]
ISO7J5ZHMore caches, better and generic cache code. Now Dracon listen to file changes to drop cached data. Implemented caches: - File contents in specific revision (never dropped) - Pijul ls and Pijul diff results - File Revision and File changes by patch - some others.. Dracon is incredible fast now, but still will take some time for bigger repos. - [19]
Q35OTML2Remove use of coroutines, which was blocking IntelliJ UI in larger repositories Improvements for bigger repositories, now Dracon caches the changes that happened in a revision in a file, so everytime Dracon needs to query the changes of a revision, it loads directly from memory instead of doing a full-scan in Pijul repository. For tiny projects it is not a problem, but for medium ones it takes more than five minutes to scan the entire repository (and it was tested with a repo of only 700 records, however there was changes that had more than 60.000 lines). The cache file is saved in IntelliJ Data Path (project specific) and is compressed with gzip, so it will not use so much disk space (the cost worths the gains). - [20]
QXUEMZ3BInitial CahngeProvider - [*]
2N67RQZCAdd auto installation support and cache content of ContentRevision
Change contents
- edit in src/main/resources/messages/DraconBundle.properties at line 40
push.terminal.text=Push - edit in src/main/resources/messages/DraconBundle.properties at line 54[22.171][22.171]
editor-server.timeout.title=Timeouteditor-server.timeout.text=Timeout to connect to Editor Server. Please try again! - edit in src/main/resources/META-INF/plugin.xml at line 18
<depends>org.jetbrains.plugins.terminal</depends> - file addition: ThreadFactory.kt[3.1784]
/*** 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.utilimport java.util.concurrent.ThreadFactoryimport java.util.concurrent.atomic.AtomicIntegerclass NamedThreadFactory(val name: String) : ThreadFactory {private val group: ThreadGroupprivate val threadNumber = AtomicInteger(1)private val namePostfix: Stringoverride fun newThread(r: Runnable): Thread {val t = Thread(group, r,this.name + this.namePostfix + threadNumber.getAndIncrement(),0)if (t.isDaemon) t.isDaemon = falseif (t.priority != Thread.NORM_PRIORITY) t.priority = Thread.NORM_PRIORITYreturn t}companion object {private val poolNumber = AtomicInteger(1)}init {val s = System.getSecurityManager()group = if (s != null) s.threadGroup else Thread.currentThread().threadGroupnamePostfix = "-namedPool-" +poolNumber.getAndIncrement() +"-thread-"}} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 559
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {return if (dir != path) FileVisitResult.CONTINUEelse FileVisitResult.SKIP_SUBTREE}if (Files.exists(path)) {Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {return if (dir != path) FileVisitResult.CONTINUEelse FileVisitResult.SKIP_SUBTREE} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 566
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {Files.delete(file)return FileVisitResult.CONTINUE}})override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {Files.delete(file)return FileVisitResult.CONTINUE}})} - edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/PijulRevisionNumber.kt at line 11
val NOT_COMMITTED_HASH = BlobIndexUtil.NOT_COMMITTED_HASH - edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/PijulRevisionNumber.kt at line 28
val NOT_COMMITTED_HASH = BlobIndexUtil.NOT_COMMITTED_HASHfun notCommitted() = PijulRevisionNumber(NOT_COMMITTED_HASH, ZonedDateTime.now()) - edit in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulPusher.kt at line 19
import kotlinx.coroutines.runBlocking - replacement in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulPusher.kt at line 43
it.connectAndRetrieveContent()if (!it.connectAndRetrieveContent()) {Notifications.Bus.notify(Notification(PUSH_GROUP,DraconBundle.message("editor-server.timeout.title"),DraconBundle.message("editor-server.timeout.text"),NotificationType.ERROR,),project)} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulPusher.kt at line 68
NotificationType.ERROR,NotificationType.INFORMATION, - replacement in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulPusher.kt at line 79
NotificationType.INFORMATION,NotificationType.ERROR, - edit in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulOutgoingChangesProvider.kt at line 13
import com.intellij.notification.Notificationimport com.intellij.notification.NotificationTypeimport com.intellij.notification.Notifications - replacement in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulOutgoingChangesProvider.kt at line 38
it.connectAndRetrieveContent()if (!it.connectAndRetrieveContent()) {errors.add(VcsError(DraconBundle.message("editor-server.timeout.text")))} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/provider/PijulChangeProvider.kt at line 58
}.result ?: continue}.result ?: PijulRevisionNumber.notCommitted() - replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 124
if (this.rootPath.endsWith("/")) this.rootPath + this.pathelse this.rootPath + "/" + this.pathwhen {this.rootPath == "/" -> this.paththis.rootPath.endsWith("/") -> this.rootPath + this.paththis.rootPath.isEmpty() -> this.pathelse -> this.rootPath + "/" + this.path} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/editor/EditorServer.kt at line 18
fun connectAndRetrieveContent() {fun connectAndRetrieveContent(): Boolean { - replacement in src/main/kotlin/com/github/jonathanxd/dracon/editor/EditorServer.kt at line 21
if (Duration.between(start, Instant.now()).seconds > 10) {throw IllegalStateException("Could not connect to editor server! Timeout after 10 seconds.")if (Duration.between(start, Instant.now()).seconds > 20) {return false - edit in src/main/kotlin/com/github/jonathanxd/dracon/editor/EditorServer.kt at line 46
return this.connected - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 27
import com.github.jonathanxd.dracon.i18n.DraconBundle - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 53
import kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.delayimport kotlinx.coroutines.* - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 60
import org.jetbrains.plugins.terminal.LocalTerminalDirectRunnerimport org.jetbrains.plugins.terminal.TerminalViewimport java.util.concurrent.Executorsimport java.util.concurrent.locks.ReentrantLock - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 72
val pijulProcessContext = Executors.newSingleThreadExecutor(NamedThreadFactory("Pijul")).asCoroutineDispatcher() - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 76
private val lock = ReentrantLock() - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 378
arguments.add("-a") - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 978[3.4704]→[3.14458:14497](∅→∅),[3.13660]→[3.14458:14497](∅→∅),[3.21172]→[3.14458:14497](∅→∅),[3.48736]→[3.14458:14497](∅→∅),[3.14458]→[3.14458:14497](∅→∅),[3.14497]→[2.4505:4554](∅→∅),[2.4554]→[3.14551:14610](∅→∅),[3.14551]→[3.14551:14610](∅→∅)
val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start()val process = runBlocking {withContext(pijulProcessContext) {val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start()process}} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1035[3.48883]→[3.10273:10312](∅→∅),[3.10273]→[3.10273:10312](∅→∅),[3.10312]→[2.4555:4604](∅→∅),[2.4604]→[3.10366:10424](∅→∅),[3.10366]→[3.10366:10424](∅→∅)
val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start()val process = runBlocking {withContext(pijulProcessContext) {val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start() - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1042
process}} - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1074
- replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1096[3.49065]→[3.6134:6216](∅→∅),[3.6134]→[3.6134:6216](∅→∅),[3.6216]→[2.4605:4658](∅→∅),[2.4658]→[3.6274:6340](∅→∅),[3.6274]→[3.6274:6340](∅→∅)
return this.cache.cache(key) {val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start()return runBlocking {withContext(pijulProcessContext) {cache.cache(key) {val process = ProcessBuilder().command(listOf(findPijul()) + args).directory(dir.toFile()).start() - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1104
val input = String(process.inputStream.readAllBytes(), Charsets.UTF_8)val error = String(process.errorStream.readAllBytes(), Charsets.UTF_8)val input = String(process.inputStream.readAllBytes(), Charsets.UTF_8)val error = String(process.errorStream.readAllBytes(), Charsets.UTF_8) - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1107[3.6508]→[3.6508:6548](∅→∅),[3.6548]→[3.10578:10653](∅→∅),[3.10578]→[3.10578:10653](∅→∅),[3.10653]→[3.6549:6563](∅→∅)
input.split("\n").forEach {draconConsoleWriter(project).logCommand("pijul", args, it)}input.split("\n").forEach {draconConsoleWriter(project).logCommand("pijul", args, it)} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1111[3.6564]→[3.6564:6604](∅→∅),[3.6604]→[3.10709:10789](∅→∅),[3.10709]→[3.10709:10789](∅→∅),[3.10789]→[3.6605:6619](∅→∅)
error.split("\n").forEach {draconConsoleWriter(project).logCommandError("pijul", args, it)}error.split("\n").forEach {draconConsoleWriter(project).logCommandError("pijul", args, it)}val exit = process.waitFor()if (exit == 0) {draconConsoleWriter(project).logCommand("pijul", args, "<Exit status> $exit")} else {draconConsoleWriter(project).logCommandError("pijul", args, "<Exit status> $exit")} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1122
val exit = process.waitFor()if (exit == 0) {draconConsoleWriter(project).logCommand("pijul", args, "<Exit status> $exit")} else {draconConsoleWriter(project).logCommandError("pijul", args, "<Exit status> $exit")PijulExecution(input,error,exit)} - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1129
PijulExecution(input,error,exit) - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1152[3.12502]→[3.22206:22245](∅→∅),[3.49276]→[3.22206:22245](∅→∅),[3.22206]→[3.22206:22245](∅→∅),[3.22245]→[3.12503:12524](∅→∅),[3.12524]→[3.49277:49312](∅→∅),[3.49312]→[3.12558:12784](∅→∅),[3.12558]→[3.12558:12784](∅→∅)
val process = ProcessBuilder().apply {when (copieMode) {CopieMode.FROM -> environment()["COPIE_FROM"] = copiePath.toAbsolutePath().toString()CopieMode.TO -> environment()["COPIE_TO"] = copiePath.toAbsolutePath().toString()}val process = runBlocking {withContext(pijulProcessContext) {val process = ProcessBuilder().apply {when (copieMode) {CopieMode.FROM -> environment()["COPIE_FROM"] = copiePath.toAbsolutePath().toString()CopieMode.TO -> environment()["COPIE_TO"] = copiePath.toAbsolutePath().toString()} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1161
environment()["VISUAL"] = "copie"environment()["EDITOR"] = "copie"environment()["VISUAL"] = "copie"environment()["EDITOR"] = "copie"}.command(listOf(findPijul()) + args).directory(dir.toFile()).start()process - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1169
.command(listOf(findPijul()) + args).directory(dir.toFile()).start()} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1217
val process = ProcessBuilder().apply {environment()["EDITOR_SERVER_PORT"] = freePort.toString()environment()["VISUAL"] = editorServerPath()environment()["EDITOR"] = editorServerPath()val process = runBlocking {withContext(pijulProcessContext) {val process = ProcessBuilder().apply {environment()["EDITOR_SERVER_PORT"] = freePort.toString()environment()["VISUAL"] = editorServerPath()environment()["EDITOR"] = editorServerPath()}.command(listOf(findPijul()) + args).directory(dir.toFile()).start()process - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1231
.command(listOf(findPijul()) + args).directory(dir.toFile()).start()} - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1282
val cmd = listOf(findPijul()) + argsval terminalCmd = terminalCommand("command.execute.text", cmd.joinToString(" ")) - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1283
val process = ProcessBuilder().apply {environment()["EDITOR_SERVER_PORT"] = freePort.toString()environment()["VISUAL"] = editorServerPath()environment()["EDITOR"] = editorServerPath()val process = runBlocking {withContext(pijulProcessContext) {val cmd = listOf(findPijul()) + argsval terminalCmd = terminalCommand("command.execute.text", cmd.joinToString(" "))val process = ProcessBuilder().apply {environment()["EDITOR_SERVER_PORT"] = freePort.toString()environment()["VISUAL"] = editorServerPath()environment()["EDITOR"] = editorServerPath()}.command(terminalCmd).directory(dir.toFile()).start()process - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 1300
.command(terminalCmd).directory(dir.toFile()).start()} - edit in src/main/kotlin/com/github/jonathanxd/dracon/checkin/PijulCheckingEnvironment.kt at line 3
import com.github.jonathanxd.dracon.cache.FileStatusCache - edit in src/main/kotlin/com/github/jonathanxd/dracon/checkin/PijulCheckingEnvironment.kt at line 50
import com.intellij.vcsUtil.VcsUtilimport java.nio.file.Paths - edit in src/main/kotlin/com/github/jonathanxd/dracon/checkin/PijulCheckingEnvironment.kt at line 111
changes.mapNotNull { it.virtualFile }.forEach {val path = Paths.get(VcsUtil.getFilePath(it).path)this.project.service<FileStatusCache>().unload(path)} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/PijulLogRevisionCache.kt at line 27
{ it.statusCode is SuccessStatusCode },{it.result!!},{ it.statusCode is SuccessStatusCode && it.result != null },{ it.result!! }, - edit in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulPushRecord.kt at line 13
import com.intellij.openapi.application.ApplicationManager - replacement in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulPushRecord.kt at line 27
it.connectAndRetrieveContent()if(!it.connectAndRetrieveContent()) {Notifications.Bus.notify(Notification(PUSH_GROUP,DraconBundle.message("editor-server.timeout.title"),DraconBundle.message("editor-server.timeout.text"),NotificationType.ERROR,),project)} - replacement in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulPushRecord.kt at line 52
NotificationType.ERROR,NotificationType.INFORMATION, - replacement in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulPushRecord.kt at line 63
NotificationType.INFORMATION,NotificationType.ERROR, - edit in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulExpertRecord.kt at line 13
import com.intellij.openapi.application.ApplicationManager - replacement in src/main/kotlin/com/github/jonathanxd/dracon/actions/PijulExpertRecord.kt at line 27
it.connectAndRetrieveContent()if (!it.connectAndRetrieveContent()) {Notifications.Bus.notify(Notification(EXPERT_MODE_GROUP,DraconBundle.message("editor-server.timeout.title"),DraconBundle.message("editor-server.timeout.text"),NotificationType.ERROR,),project)} - replacement in build.gradle.kts at line 63
setPlugins(*properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray())setPlugins("org.toml.lang:0.2.144.3766-211")setPlugins(*properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray(),"org.toml.lang:0.2.144.3766-211","terminal")