Improvements, a lot

[?]
Apr 10, 2021, 9:46 PM
RE4EKNSLYGCITZZEOPIRJAWTKIONGP7IY6S77BQO7JQL2CK27RZAC

Dependencies

  • [2] OMZXJL6Q Ready for pijul push! First nightly build will be released shortly!
  • [3] 2N67RQZC Add auto installation support and cache content of ContentRevision
  • [4] 5AUENX2Y Add support to view files affected by a revision
  • [5] FNNW5IEA Added more plugin files to Pijul
  • [6] QXUEMZ3B Initial CahngeProvider
  • [7] ZCRW57C5 Improved support for revisions
  • [8] FRFFQV7V Basic show history support.
  • [9] 6CR2EFUN First ChangeProvider implementation!!! Wheehooo
  • [10] Q7FXTHVU First record support, YEAAAH, RECOOORD
  • [11] Q35OTML2 Remove 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).
  • [12] ISO7J5ZH More 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.
  • [13] 37OJKSWJ Improved caching code a lot
  • [14] A7IL6I3V More files to support .ignore
  • [15] NTRPUMVQ Improved README and added roadmap.
  • [16] GGYFPXND Initial plugin
  • [17] OPFG6CZ2 File status tracking supported.
  • [18] 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.
  • [19] MTPTFTHG Initial plugin 2

Change contents

  • edit in src/main/resources/messages/DraconBundle.properties at line 81
    [3.8989]
    [3.8989]
    index.check.text=Checking revisions...
    index.load.rev.for.text=Loading revision <tt>{0}</tt> for file <tt>{1}</tt>
    index.check.rev.text=Checking revision <tt>{0}</tt>...
  • edit in src/main/resources/messages/DraconBundle.properties at line 88
    [3.9182]
    [3.9182]
    index.copy.text=Copying files...
  • edit in src/main/resources/META-INF/plugin.xml at line 52
    [3.10566]
    [3.10566]
    <projectCloseHandler implementation="com.github.jonathanxd.dracon.handler.DraconCloseHandler" />
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 11
    [3.789]
    [3.833]
    import org.apache.commons.codec.digest.DigestUtils
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 16
    [3.954]
    [3.11412]
    import java.security.MessageDigest
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 19
    [3.1024]
    [3.1024]
    import kotlin.io.path.exists
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 98
    [3.11985][3.11985:12100]()
    val tempDir = FileUtilRt.createTempDirectory("dracon_diffs-all-", revisionHash + UUID.randomUUID().toString())
    [3.11985]
    [3.12100]
    val sha1 = DigestUtils.sha1Hex(revisionHash)
    val tempDir = FileUtilRt.createTempDirectory("dracon_diffs-all-", sha1)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 103
    [3.12200]
    [3.12200]
    if (Files.exists(tmpTarget.resolve(".pijul"))) {
    val ls = pijul(project).trackedFiles(project, tmpTarget)
    if (ls.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revision $revisionHash during reset. $ls")
    }
    i.fraction += 0.0001
    val trackedFiles = ls.result!!
    trackedFiles.forEachWithProgress(i) { it, indic ->
    indic.text2 = DraconBundle.message("index.item.description.text", it.toString())
    if (Files.isRegularFile(it)) {
    pathToRevisionState[it] = Files.readAllBytes(it)
    }
    }
    return pathToRevisionState
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 155
    [3.13334][3.13334:13458]()
    throw IllegalStateException("Failed to load state of all files in revision $revisionHash during reset. $revisions")
    [3.13334]
    [3.13458]
    throw IllegalStateException("Failed to load state of all files in revision $revisionHash during reset. $ls")
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 175
    [3.13924][3.13924:13959]()
    FileUtilRt.delete(tempDir)
    [3.13924]
    [3.13959]
    //FileUtilRt.delete(tempDir)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 180
    [3.14003]
    [3.14003]
    fun loadStateInRevisionForAllFilesForFile(revisionHash: String,
    project: Project,
    root: Path,
    file: Path): ByteArray {
    val sha1 = DigestUtils.sha1Hex(revisionHash)
    val tempDir = FileUtilRt.createTempDirectory("dracon_diffs-all-", sha1)
    val tmpTarget = tempDir.toPath()
    if (Files.exists(tmpTarget.resolve(".pijul"))) {
    val relativeToRoot = file.relativeTo(root)
    val relativeToTmpTarget = tmpTarget.resolve(relativeToRoot)
    if (Files.exists(relativeToTmpTarget)) {
    return Files.readAllBytes(relativeToTmpTarget)
    }
    }
    copyFolder(root, tmpTarget, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING)
    val revisions = pijul(project).latestRevisionNumber(project, tmpTarget).result
    val reset = pijul(project).reset(project, tmpTarget)
    if (reset.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revision $revisionHash during reset. $revisions")
    }
    if (revisions == null || revisions.hash != revisionHash) {
    val rollbackOp = pijul(project).rollbackTo(revisionHash, project, tmpTarget)
    if (rollbackOp.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revision $revisionHash during unrecord. $rollbackOp")
    }
    }
    try {
    val relativeToRoot = file.relativeTo(root)
    val relativeToTmpTarget = tmpTarget.resolve(relativeToRoot)
    return if (Files.exists(relativeToTmpTarget)) {
    Files.readAllBytes(relativeToTmpTarget)
    } else {
    ByteArray(0)
    }
    } finally {
    //FileUtilRt.delete(tempDir)
    }
    }
    @OptIn(ExperimentalPathApi::class)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 238
    [3.14415][3.14415:14540]()
    val tempDir = FileUtilRt.createTempDirectory("dracon_diffs-all-","${allRevisions.size}-" + UUID.randomUUID().toString())
    [3.14415]
    [3.14540]
    val sha1 = DigestUtils.sha1Hex(allRevisions.toString())
    val tempDir = FileUtilRt.createTempDirectory("dracon_diffs-all-", sha1)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 241
    [3.14577]
    [3.14577]
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 258
    [3.15337][3.15337:15416]()
    if (indexOfFirstRevision + allRevisions.size >= pijulRevisions.size) {
    [3.15337]
    [3.15416]
    if (indexOfFirstRevision + allRevisions.size > pijulRevisions.size) {
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 274
    [3.16187][3.16187:16310]()
    throw IllegalStateException("Failed to load state of all files in revisions '$allRevisions' during reset. $reset")
    [3.16187]
    [3.16310]
    IllegalStateException("Failed to load state of all files in revisions '$allRevisions' during reset. $reset").printStackTrace()
    return revisionToPathToState
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 323
    [3.1979][3.1979:2014]()
    FileUtilRt.delete(tempDir)
    [3.1979]
    [3.2014]
    //FileUtilRt.delete(tempDir)
    }
    }
    @OptIn(ExperimentalPathApi::class)
    fun loadFileStateInRevision(
    revision: String,
    project: Project,
    root: Path,
    cachePath: Path,
    file: Path,
    i: ProgressIndicator,
    cacheAllRevisions: Boolean = true
    ): FileStateInCache {
    val dir = resolveDirForRevision(cachePath, revision, createIfNotExists = false)
    val fileRelativeToRoot = file.relativeTo(root)
    if (!Files.exists(dir)) {
    val allRevisions = pijul(project).allRevisions(project, root).result!!.map { it.hash }
    val revisions = if (allRevisions[0] == revision) {
    listOf(revision)
    } else {
    allRevisions.subList(0, allRevisions.indexOf(revision) + 1)
    }
    val cacheMap = createCacheForRevisionFromTo(
    revisions,
    project,
    root,
    cachePath,
    i,
    cacheAllRevisions
    )
    if (!cacheMap.containsKey(revision)) {
    throw IllegalStateException("Failed to load state of all files in revision $revision")
    }
    }
    val fileInCache = dir.resolve(fileRelativeToRoot)
    return if (Files.exists(fileInCache) && Files.isRegularFile(fileInCache)) {
    FileStateInCache(file, fileInCache, false, Files.readAllBytes(fileInCache))
    } else {
    FileStateInCache(file, fileInCache, true, ByteArray(0))
    }
    }
    data class FileStateInCache(
    val originalPath: Path,
    val pathInCache: Path,
    val deleted: Boolean,
    val content: ByteArray
    ) {
    override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (javaClass != other?.javaClass) return false
    other as FileStateInCache
    if (originalPath != other.originalPath) return false
    if (pathInCache != other.pathInCache) return false
    if (deleted != other.deleted) return false
    if (!content.contentEquals(other.content)) return false
    return true
    }
    override fun hashCode(): Int {
    var result = originalPath.hashCode()
    result = 31 * result + pathInCache.hashCode()
    result = 31 * result + deleted.hashCode()
    result = 31 * result + content.contentHashCode()
    return result
    }
    }
    fun resolveDirForRevision(cachePath: Path, revision: String, createIfNotExists: Boolean = true): Path {
    val path = cachePath.resolve(revision)
    if (createIfNotExists)
    Files.createDirectories(path)
    return path
    }
    @OptIn(ExperimentalPathApi::class)
    fun createCacheForRevisionFromTo(allRevisions: List<String>,
    project: Project,
    root: Path,
    cachePath: Path,
    i: ProgressIndicator,
    cacheAllRevisions: Boolean = true): Map<String, Path> {
    if (allRevisions.isEmpty()) {
    throw IllegalArgumentException("Provided 'allRevisions' argument must not be empty.")
    }
    val revisionsToCache = allRevisions.toMutableList()
    i.text2 = DraconBundle.message("index.check.text")
    val revisionToPath = mutableMapOf<String, Path>()
    var lastFoundCachedRevisionPath: Path? = null
    var lastFoundCachedRevision: String? = null
    for (rev in allRevisions) {
    i.text2 = DraconBundle.message("index.check.rev.text", rev)
    val path = resolveDirForRevision(cachePath, rev, createIfNotExists = false)
    if (path.exists()) {
    revisionsToCache.remove(rev)
    lastFoundCachedRevisionPath = path
    lastFoundCachedRevision = rev
    revisionToPath["rev"] = path
    }
    }
    i.text2 = DraconBundle.message("index.item.description.finish.text")
    if (revisionsToCache.isEmpty()) {
    return revisionToPath
    }
    if (!cacheAllRevisions) {
    val last = revisionsToCache.last()
    revisionsToCache.clear()
    revisionsToCache.add(last)
    }
    val temporaryWorkingDirectory = cachePath.resolve(".tmp-work-dir-" + UUID.randomUUID().toString())
    Files.createDirectories(temporaryWorkingDirectory)
    if (lastFoundCachedRevision != null && lastFoundCachedRevisionPath != null) {
    // Copies last found revision into temporaryWorkingDirectory
    // This prevents from rolling back from revisions that are already cached.
    copyFolder(lastFoundCachedRevisionPath, temporaryWorkingDirectory)
    } else {
    // Copy current .pijul working dir into temporaryWorkingDirectory
    copyFolder(root, temporaryWorkingDirectory)
    }
    val revisions = pijul(project).allRevisions(project, temporaryWorkingDirectory)
    if (revisions.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revisions '$revisionsToCache' during all revisions hash retrieval. $revisions")
    }
    val pijulRevisions = revisions.result!!.map { it.hash }
    val indexOfFirstRevision = pijulRevisions.indexOf(revisionsToCache[0])
    if (indexOfFirstRevision == -1) {
    throw IllegalArgumentException("Could not find revision ${revisionsToCache[0]} in Pijul repository!")
    } else {
    if (indexOfFirstRevision + revisionsToCache.size > pijulRevisions.size) {
    throw IllegalArgumentException("There are more revisions to unrecord than the amount of recorded changes in Pijul Repository.")
    } else {
    val revisionSubList = pijulRevisions.subList(indexOfFirstRevision, indexOfFirstRevision + revisionsToCache.size)
    if (revisionsToCache != revisionSubList) {
    throw IllegalArgumentException("Revisions to load must sequentially match a sub sequence of revisions in Pijul repository. " +
    "Changes found in pijul: $revisionSubList. Changes to unrecord: $revisionsToCache")
    }
    }
    }
    i.text2 = DraconBundle.message("index.reset.text")
    val reset = pijul(project).reset(project, temporaryWorkingDirectory)
    if (reset.statusCode !is SuccessStatusCode) {
    IllegalStateException("Failed to load state of all files in revisions '$revisionsToCache' during reset. $reset").printStackTrace()
    return revisionToPath
    }
    i.fraction += 0.0001
    revisionsToCache.withIndex().toList().forEachWithProgress(i) { (index, rev), indicator ->
    indicator.text2 = DraconBundle.message("index.revision.description.text", rev)
    val resolvedPathForRevision = resolveDirForRevision(cachePath, rev, createIfNotExists = false)
    if (Files.exists(resolvedPathForRevision)) {
    deleteFilesInsideDirectory(temporaryWorkingDirectory)
    copyFolder(resolvedPathForRevision, temporaryWorkingDirectory)
    } else {
    val rollback = pijul(project).rollbackTo(rev, project, temporaryWorkingDirectory)
    if (rollback.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revision '$rev' during rollback. $rollback")
    }
    /*if (index == 0) {
    } else {
    val unrecord = pijul(project).unrecord(project, temporaryWorkingDirectory, revisionsToCache[index - 1])
    if (unrecord.statusCode !is SuccessStatusCode) {
    throw IllegalStateException("Failed to load state of all files in revision '$rev' during unrecord. $unrecord")
    }
    }*/
    indicator.text2 = DraconBundle.message("index.copy.text")
    copyFolder(temporaryWorkingDirectory, resolvedPathForRevision)
    }
    revisionToPath[rev] = resolvedPathForRevision
    }
    i.text2 = DraconBundle.message("index.item.description.finish.text")
    try {
    return revisionToPath
    } finally {
    FileUtilRt.delete(temporaryWorkingDirectory.toFile())
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 539
    [3.2352]
    [3.2352]
    val copyOptions = arrayOf(*options, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/RevisionContentResolver.kt at line 552
    [3.2938][3.2938:3018]()
    Files.copy(file, target.resolve(source.relativize(file)), *options)
    [3.2938]
    [3.3018]
    Files.copy(file, target.resolve(source.relativize(file)), *copyOptions)
    return FileVisitResult.CONTINUE
    }
    })
    }
    fun deleteFilesInsideDirectory(path: Path) {
    Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
    override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
    return if (dir != path) FileVisitResult.CONTINUE
    else FileVisitResult.SKIP_SUBTREE
    }
    override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
    Files.delete(file)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/revision/PijulVcsFileRevision.kt at line 39
    [3.3319][3.3319:3403]()
    private val content = this.project.service<FileRevisionCache>().loadAsync(this)
    [3.3319]
    [3.3825]
    private val content by lazy {
    this.project.service<FileRevisionCache>().loadAsync(this)
    }
  • file move: push (----------)push (d--r------)
    [3.107]
    [2.10965]
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/push/PijulOutgoingChangesProvider.kt at line 58
    [2.28924][2.28924:29000]()
    pijul(project).changes(project, ctx.root, it, -1, {
    [2.28924]
    [2.29000]
    pijul(project).changes(project, ctx.root, it, 1, {
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/provider/PijulHistoryProvider.kt at line 30
    [3.18209]
    [3.18209]
    import kotlin.io.path.isDirectory
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/provider/PijulHistoryProvider.kt at line 141
    [3.3778][3.3778:3821]()
    }.forEach { path, hunks ->
    [3.3778]
    [3.3821]
    }.filter { pathToView.isDirectory() || it.key == pathToView }.forEach { path, hunks ->
  • file deletion: PijulHash.kt (----------)
    [3.6847][2.34710:34724](),[2.34724][2.34725:34725]()
    package com.github.jonathanxd.dracon.log
    import com.intellij.vcs.log.Hash
    class PijulHash(val hash: String) : Hash {
    override fun asString(): String = this.hash
    override fun toShortString(): String = this.hash.substring(0, 10)
    }
  • file addition: PijulHash.kt (----------)
    [3.6847]
    package com.github.jonathanxd.dracon.log
    import com.intellij.vcs.log.Hash
    class PijulHash(val hash: String) : Hash {
    override fun asString(): String = this.hash
    override fun toShortString(): String = this.hash.substring(0, 10)
    }
  • file addition: handler (----------)
    [3.107]
  • file addition: DraconCloseHandler.kt (----------)
    [0.12858]
    package com.github.jonathanxd.dracon.handler
    import com.github.jonathanxd.dracon.cache.FileRevisionCache
    import com.intellij.openapi.components.serviceIfCreated
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.project.ProjectCloseHandler
    class DraconCloseHandler: ProjectCloseHandler {
    override fun canClose(project: Project): Boolean {
    val fileRevisionCache = project.serviceIfCreated<FileRevisionCache>()
    fileRevisionCache?.invalidate()
    return true
    }
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/content/PijulContentRevision.kt at line 31
    [3.2032][3.2032:2116]()
    private val content = this.project.service<FileRevisionCache>().loadAsync(this)
    [3.2032]
    [3.2116]
    private val content by lazy {
    this.project.service<FileRevisionCache>().loadAsync(this)
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/config/PijulSettings.kt at line 21
    [3.6169]
    [3.6169]
    fun isToCacheAllRevisions(): Boolean =
    this.state.cacheAllRevisions
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/config/PijulSettings.kt at line 41
    [3.6634]
    [3.6634]
    @get:OptionTag("CACHE_ALL_REVISIONS")
    var cacheAllRevisions by property(defaultValue = true)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 123
    [3.3198][3.6933:7040]()
    val execution = this.createPainlessExecPijulOperation(project, rootPath, listOf("diff", "--json"))
    [3.3198]
    [3.13603]
    val execution = this.createPainlessExecPijulOperation(project, rootPath, listOf("diff", "--json"), logOutput = false)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 172
    [3.9735][3.9735:9838]()
    val execution = this.createPainlessExecPijulOperation(project, root, listOf("diff", "--json"))
    [3.9735]
    [3.9838]
    val execution = this.createPainlessExecPijulOperation(project, root, listOf("diff", "--json"), logOutput = false)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 245
    [3.11498][3.11498:11601]()
    val execution = this.createPainlessExecPijulOperation(project, root, listOf("diff", "--json"))
    [3.11498]
    [3.11601]
    val execution = this.createPainlessExecPijulOperation(project, root, listOf("diff", "--json"), logOutput = false)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 706
    [2.45256][2.45256:45282]()
    }?.map { entry ->
    [2.45256]
    [2.45282]
    }?.asSequence()?.map { entry ->
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 980
    [2.48832][2.48832:48859]()
    args: List<String>
    [2.48832]
    [2.48859]
    args: List<String>,
    logOutput: Boolean = true,
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 991
    [3.4369][3.4369:4476]()
    input.split("\n").forEach {
    draconConsoleWriter(project).logCommand("pijul", args, it)
    [3.4369]
    [3.4476]
    if (logOutput) {
    if (input.trim().isNotEmpty()) {
    input.split("\n").forEach {
    draconConsoleWriter(project).logCommand("pijul", args, it)
    }
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 999
    [3.4487][3.4487:4599]()
    error.split("\n").forEach {
    draconConsoleWriter(project).logCommandError("pijul", args, it)
    [3.4487]
    [3.4599]
    if (error.trim().isNotEmpty()) {
    error.split("\n").forEach {
    draconConsoleWriter(project).logCommandError("pijul", args, it)
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 3
    [3.20201]
    [3.2789]
    import com.github.jonathanxd.dracon.config.PijulSettings
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 9
    [3.30087]
    [3.20392]
    import com.github.jonathanxd.iutils.`object`.Lazy
    import com.intellij.execution.Executor
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 13
    [3.20486][2.49988:50048](),[2.50048][3.30088:30249](),[3.20486][3.30088:30249]()
    import com.intellij.openapi.progress.EmptyProgressIndicator
    import com.intellij.openapi.progress.ProgressIndicator
    import com.intellij.openapi.progress.forEachWithProgress
    import com.intellij.openapi.progress.withPushPop
    [3.20486]
    [3.20486]
    import com.intellij.openapi.progress.*
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 15
    [3.20530]
    [3.20530]
    import com.intellij.openapi.project.getProjectDataPath
    import com.intellij.openapi.util.ThrowableComputable
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 18
    [3.20558]
    [3.30250]
    import java.nio.file.Files
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 23
    [3.20700][3.30277:30462]()
    class FileRevisionCache(val project: Project) : CacheService<FileRevisionRef, ByteArray> {
    override val cache = DataCache<FileRevisionRef, ByteArray>(this.project, "file_revision")
    [3.20700]
    [3.30462]
    class FileRevisionCache(val project: Project) {
    //override val cache = DataCache<String, Map<String, ByteArray>>(this.project, "path_revision")
    fun cachePath(): Path =
    this.project.getProjectDataPath("com.github.jonathanxd.dracon").resolve("revision-cache")
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 37
    [3.20978][3.30810:30883]()
    val fileRev = FileRevisionRef(file.filePathAsString(), rev.hash)
    [3.20978]
    [3.21077]
    val cache = this.cachePath()
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 39
    [3.21078][2.50049:50235](),[2.50235][3.21230:21252](),[3.21230][3.21230:21252](),[3.21252][2.50236:50291]()
    return this.cache.queryOrLoadAsyncExpanded(fileRev) {
    val revisions = loadStateInEveryRevisionForAllFiles(
    listOf(rev.hash),
    project,
    root,
    EmptyProgressIndicator()
    )
    [3.21078]
    [2.50291]
    Files.createDirectories(cache)
    val completableFuture = CompletableFuture<ByteArray>()
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 43
    [2.50292][2.50292:50542]()
    val revisionsForHash = revisions[rev.hash]!!
    val stringKeys = revisionsForHash.mapKeys { (k, _) -> k.filePathAsString() }
    stringKeys[it.filePath]!! to stringKeys.map { (k, v) -> FileRevisionRef(k, rev.hash) to v }
    [2.50292]
    [3.21323]
    ProgressManager.getInstance().run(object : Task.Backgroundable(
    project,
    DraconBundle.message("index.load.rev.for.text", rev.hash.substring(0, 10), file.fileName.toString()),
    true
    ) {
    override fun run(indicator: ProgressIndicator) {
    indicator.isIndeterminate = false
    try {
    val revision = loadFileStateInRevision(
    rev.hash,
    project,
    root,
    cache,
    file,
    indicator,
    project.service<PijulSettings>().isToCacheAllRevisions()
    )
    completableFuture.complete(revision.content)
    } catch (t: Throwable) {
    t.printStackTrace()
    completableFuture.completeExceptionally(t)
    }
    }
    })
    return completableFuture.handle { t, u ->
    u?.printStackTrace()
    t ?: ByteArray(0)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 76
    [3.31010][3.31010:31080]()
    fun loadAndPrecacheRevisions(amount: Int, i: ProgressIndicator) {
    [3.31010]
    [3.31080]
    fun invalidate() {
    deleteFilesInsideDirectory(this.cachePath())
    }
    /*fun loadAndPrecacheRevisions(amount: Int, i: ProgressIndicator) {
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 100
    [3.31725][3.31725:31726]()
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 103
    [3.31911][3.31911:32360]()
    stateMap.entries.forEachWithProgress(indic) { (path, bytes), indicator2 ->
    indicator2.text2 =
    DraconBundle.message("index.revision.file.description.text", path.toString(), rev)
    val revRef = FileRevisionRef(path.filePathAsString(), rev)
    this.cache.updateCache(revRef) {
    bytes
    }
    [3.31911]
    [3.32360]
    this.cache.updateCache(rev) {
    stateMap.mapKeys { (k, _) -> k.filePathAsString() }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 106
    [3.32382][3.32382:32383]()
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 109
    [3.32416][3.3091:3092](),[3.3091][3.3091:3092]()
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/FileRevisionCache.kt at line 114
    [3.3409][3.3409:3415](),[3.3415][3.21339:21421](),[3.21339][3.21339:21421](),[3.21421][3.32580:32596]()
    }
    }
    data class FileRevisionRef(
    val filePath: String,
    val revision: String
    ) : Serializable
    [3.3347]
    }*/
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cache/DataCache.kt at line 32
    [3.22376][2.50543:50610]()
    private val updateExecutor = Executors.newWorkStealingPool(16)
    [3.22376]
    [3.22441]
    private val updateExecutor = Executors.newSingleThreadExecutor()
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/activity/PijulIndexActivity.kt at line 18
    [3.41997][3.41997:42094]()
    fileRevisionCache.loadAndPrecacheRevisions(PRE_INDEX_REVISION_AMOUNT, indicator)
    [3.41997]
    [3.42094]
    //fileRevisionCache.loadAndPrecacheRevisions(PRE_INDEX_REVISION_AMOUNT, indicator)
  • replacement in gradle.properties at line 14
    [3.12944][3.2395:2433]()
    platformVersion = LATEST-EAP-SNAPSHOT
    [3.12944]
    [3.12971]
    platformVersion = 211.6693.111
  • replacement in build.gradle.kts at line 120
    [3.16561][3.16561:16622]()
    File("./README.md").readText().lines().run {
    [3.16561]
    [3.16622]
    projectDir.resolve("README.md").readText().lines().run {