Basic show history support.

[?]
Mar 29, 2021, 1:33 PM
FRFFQV7VNYKGCA7ZAOSRPC2HHYTAIZ6AGGR7A5QEV6QPAQGFDYGAC

Dependencies

  • [2] 7L5LODGZ Parse changes from `pijul change`
  • [3] 6CR2EFUN First ChangeProvider implementation!!! Wheehooo
  • [4] OPFG6CZ2 File status tracking supported.
  • [5] NTRPUMVQ Improved README and added roadmap.
  • [6] QXUEMZ3B Initial CahngeProvider
  • [7] FNNW5IEA Added more plugin files to Pijul

Change contents

  • edit in src/main/kotlin/com/github/jonathanxd/dracon/util/Path.kt at line 13
    [4.1839]
    [4.1839]
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.vcs.FilePath
    import com.intellij.openapi.vcs.ProjectLevelVcsManager
    import com.intellij.openapi.vfs.VirtualFile
    import com.intellij.vcsUtil.VcsUtil
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/util/Path.kt at line 20
    [4.1892]
    [4.1892]
    import java.nio.file.Paths
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/util/Path.kt at line 36
    [4.2238][4.2238:2251]()
    else null
    [4.2238]
    else null
    fun VirtualFile.path(): Path =
    this.toNioPath()
    fun VirtualFile.vcsRoot(project: Project): Path? =
    ProjectLevelVcsManager.getInstance(project).getVcsRootFor(this)?.toNioPath()
    fun FilePath.vcsRoot(project: Project): Path? =
    ProjectLevelVcsManager.getInstance(project).getVcsRootFor(this)?.toNioPath()
  • file addition: RevisionContentResolver.kt (----------)
    [4.11]
    package com.github.jonathanxd.dracon.revision
    import com.github.jonathanxd.dracon.pijul.pijul
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.vcs.FilePath
    import com.intellij.openapi.vfs.VirtualFile
    import java.io.File
    import java.io.IOException
    import java.nio.file.*
    import java.nio.file.attribute.BasicFileAttributes
    import java.util.Comparator
    import kotlin.io.path.ExperimentalPathApi
    import kotlin.io.path.relativeTo
    @OptIn(ExperimentalPathApi::class)
    fun loadStateInRevision(revisionHash: String,
    project: Project,
    root: Path,
    fileToResolve: FilePath): String {
    val tmpTarget = Paths.get(project.baseDir.path, ".idea", "dracon_diffs", revisionHash)
    if (Files.exists(tmpTarget)) {
    Files.walk(tmpTarget).use { walk ->
    walk.sorted(Comparator.reverseOrder())
    .map(Path::toFile)
    .forEach(File::delete)
    }
    }
    Files.createDirectories(tmpTarget)
    copyFolder(root, tmpTarget, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING)
    val revisions = pijul(project).latestRevisionNumber(project, tmpTarget).result
    if (revisions != null && revisions.hash == revisionHash) {
    val rollbackOp = pijul(project).reset(project, tmpTarget)
    } else {
    val resetOp = pijul(project).reset(project, tmpTarget)
    val rollbackOp = pijul(project).rollbackTo(revisionHash, project, tmpTarget)
    }
    val relative = Paths.get(fileToResolve.path).relativeTo(root).toString()
    return Files.readString(tmpTarget.resolve(relative))
    }
    @Throws(IOException::class)
    fun copyFolder(source: Path, target: Path, vararg options: CopyOption) {
    Files.walkFileTree(source, object : SimpleFileVisitor<Path>() {
    @Throws(IOException::class)
    override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
    if (dir.fileName.toString().equals(".idea", ignoreCase = true))
    return FileVisitResult.SKIP_SUBTREE
    Files.createDirectories(target.resolve(source.relativize(dir)))
    return FileVisitResult.CONTINUE
    }
    @Throws(IOException::class)
    override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
    Files.copy(file, target.resolve(source.relativize(file)), *options)
    return FileVisitResult.CONTINUE
    }
    })
    }
  • file addition: PijulVcsFileRevision.kt (----------)
    [4.11]
    package com.github.jonathanxd.dracon.revision
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.vcs.FilePath
    import com.intellij.openapi.vcs.RepositoryLocation
    import com.intellij.openapi.vcs.history.VcsFileRevision
    import com.intellij.openapi.vcs.history.VcsRevisionNumber
    import java.nio.file.Path
    import java.util.*
    class PijulVcsFileRevision(val project: Project,
    val vcsRoot: Path,
    val filePath: FilePath,
    val revision: PijulRevisionNumber,
    val author_: String?,
    val message: String?,
    val branch: String?) : VcsFileRevision {
    override fun loadContent(): ByteArray =
    loadStateInRevision(this.revision.hash, this.project, vcsRoot, this.filePath).toByteArray(Charsets.UTF_8)
    override fun getContent(): ByteArray = this.loadContent()
    override fun getRevisionNumber(): VcsRevisionNumber = this.revision
    override fun getRevisionDate(): Date = Date.from(this.revision.timestamp.toInstant())
    override fun getAuthor(): String? = this.author_
    override fun getCommitMessage(): String? = this.message
    override fun getBranchName(): String? = this.branch
    override fun getChangedRepositoryPath(): RepositoryLocation? = null
    }
  • file addition: PijulHistoryProvider.kt (----------)
    [4.854]
    package com.github.jonathanxd.dracon.provider
    import com.github.jonathanxd.dracon.log.draconConsoleWriter
    import com.github.jonathanxd.dracon.pijul.diff.PijulDiffFromHistoryHandler
    import com.github.jonathanxd.dracon.pijul.pijul
    import com.github.jonathanxd.dracon.revision.PijulRevisionNumber
    import com.github.jonathanxd.dracon.revision.PijulVcsFileRevision
    import com.intellij.openapi.actionSystem.AnAction
    import com.intellij.openapi.components.Service
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.vcs.FilePath
    import com.intellij.openapi.vcs.ProjectLevelVcsManager
    import com.intellij.openapi.vcs.VcsException
    import com.intellij.openapi.vcs.history.*
    import com.intellij.openapi.vfs.VirtualFile
    import com.intellij.util.ui.ColumnInfo
    import javax.swing.JComponent
    @Service
    class PijulHistoryProvider(val project: Project) : VcsHistoryProvider {
    override fun getUICustomization(
    session: VcsHistorySession?,
    forShortcutRegistration: JComponent?
    ): VcsDependentHistoryComponents {
    return VcsDependentHistoryComponents(ColumnInfo.EMPTY_ARRAY, null, null)
    }
    override fun getAdditionalActions(refresher: Runnable?): Array<AnAction> {
    return emptyArray()
    }
    override fun isDateOmittable(): Boolean =
    false
    override fun getHelpId(): String? = null
    override fun createSessionFor(filePath: FilePath): VcsHistorySession? {
    // TODO: Support multiple-channels
    val root = ProjectLevelVcsManager.getInstance(this.project).getVcsRootFor(filePath)!!
    val channels = pijul(this.project).channel(this.project, root)
    val currentChannel = channels.result?.channels?.firstOrNull { it.current }?.name
    val history = pijul(this.project).log(this.project, root).map {
    it.entries.map {
    PijulVcsFileRevision(
    this.project,
    root.toNioPath(),
    filePath,
    PijulRevisionNumber(it.changeHash, it.date),
    it.authors.map { it.name }.firstOrNull(),
    it.message,
    currentChannel
    )
    }
    }
    return if (history.result != null) {
    PijulHistorySession(filePath, history.result.firstOrNull()?.revision, history.result)
    } else {
    draconConsoleWriter(this.project).logError("Failed to build history session")
    null
    }
    }
    override fun reportAppendableHistory(path: FilePath, partner: VcsAppendableHistorySessionPartner) {
    val root = ProjectLevelVcsManager.getInstance(this.project).getVcsRootFor(path)!!
    val emptySession = createSession(path, emptyList(), null)
    partner.reportCreatedEmptySession(emptySession)
    val channels = pijul(this.project).channel(this.project, root)
    val currentChannel = channels.result?.channels?.firstOrNull { it.current }?.name
    pijul(this.project).fileHistory(
    this.project,
    root,
    path,
    {
    partner.acceptRevision(
    PijulVcsFileRevision(
    this.project,
    root.toNioPath(),
    path,
    PijulRevisionNumber(it.changeHash, it.date),
    it.authors.map { it.name }.firstOrNull(),
    it.message,
    currentChannel
    )
    )
    },
    { partner.reportException(VcsException(it.toString())) }
    )
    }
    override fun supportsHistoryForDirectories(): Boolean = true
    override fun getHistoryDiffHandler(): DiffFromHistoryHandler =
    PijulDiffFromHistoryHandler(this.project)
    override fun canShowHistoryFor(file: VirtualFile): Boolean {
    return true// TODO?
    }
    private fun createSession(
    filePath: FilePath, revisions: List<VcsFileRevision>,
    number: VcsRevisionNumber?
    ): VcsAbstractHistorySession {
    return PijulHistorySession(filePath, number, revisions)
    }
    inner class PijulHistorySession(
    val filePath: FilePath,
    number: VcsRevisionNumber?,
    revisions: List<VcsFileRevision>
    ) :
    VcsAbstractHistorySession(revisions, number) {
    override fun calcCurrentRevisionNumber(): VcsRevisionNumber? {
    return try {
    val root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(filePath)!!
    val rev = pijul(project).latestRevisionNumber(project, root)
    return rev.result
    } catch (e: Throwable) {
    draconConsoleWriter(project).logError(e.stackTraceToString())
    null
    }
    }
    override fun getHistoryAsTreeProvider(): HistoryAsTreeProvider? {
    return null
    }
    override fun copy(): VcsHistorySession {
    return createSession(filePath, revisionList, currentRevisionNumber)
    }
    }
    /*override fun createFromCachedData(
    cacheable: Boolean?,
    revisions: MutableList<out VcsFileRevision>,
    filePath: FilePath,
    currentRevision: VcsRevisionNumber?
    ): VcsAbstractHistorySession {
    TODO("Not yet implemented")
    }
    override fun getBaseVersionContent(
    filePath: FilePath?,
    processor: Processor<in String>?,
    beforeVersionId: String?
    ): Boolean {
    TODO("Not yet implemented")
    }*/
    }
  • file addition: PijulDiffFromHistoryHandler.kt (----------)
    [4.364]
    package com.github.jonathanxd.dracon.pijul.diff
    import com.github.jonathanxd.dracon.content.PijulContentRevision
    import com.github.jonathanxd.dracon.revision.PijulVcsFileRevision
    import com.github.jonathanxd.dracon.util.vcsRoot
    import com.intellij.openapi.actionSystem.AnActionEvent
    import com.intellij.openapi.project.Project
    import com.intellij.openapi.vcs.FilePath
    import com.intellij.openapi.vcs.FileStatus
    import com.intellij.openapi.vcs.changes.Change
    import com.intellij.openapi.vcs.changes.CurrentContentRevision
    import com.intellij.openapi.vcs.history.BaseDiffFromHistoryHandler
    import com.intellij.openapi.vcs.history.DiffFromHistoryHandler
    import com.intellij.openapi.vcs.history.VcsFileRevision
    class PijulDiffFromHistoryHandler(val project: Project) : BaseDiffFromHistoryHandler<PijulVcsFileRevision>(project) {
    override fun getChangesBetweenRevisions(
    path: FilePath,
    rev1: PijulVcsFileRevision,
    rev2: PijulVcsFileRevision?
    ): MutableList<Change> {
    val root = path.vcsRoot(project)!!
    return if (rev2 == null) {
    mutableListOf(
    Change(
    PijulContentRevision(
    root,
    path,
    rev1.revision,
    this.project
    ),
    CurrentContentRevision.create(path),
    FileStatus.MODIFIED
    )
    )
    } else {
    mutableListOf(
    Change(
    PijulContentRevision(
    root,
    path,
    rev1.revision,
    this.project
    ),
    PijulContentRevision(
    root,
    path,
    rev2.revision,
    this.project
    ),
    FileStatus.MODIFIED
    )
    )
    }
    }
    override fun getAffectedChanges(path: FilePath, rev: PijulVcsFileRevision): MutableList<Change> {
    val root = path.vcsRoot(project)!!
    return mutableListOf(
    Change(
    PijulContentRevision(
    root,
    path,
    rev.revision,
    this.project
    ),
    CurrentContentRevision.create(path),
    FileStatus.MODIFIED
    )
    )
    }
    override fun getPresentableName(revision: PijulVcsFileRevision): String =
    revision.revision.hash
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/pijul/PijulOperationResult.kt at line 19
    [4.3972][4.3972:4022]()
    val result: R?)
    [4.3972]
    val result: R?) {
    fun <Y> map(f: (R) -> Y): PijulOperationResult<Y> =
    if (this.result != null) {
    PijulOperationResult(operation, statusCode, f(this.result))
    } else {
    this as PijulOperationResult<Y>
    }
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 13
    [4.4473]
    [4.1584]
    import com.github.jonathanxd.dracon.channel.ChannelInfo
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 19
    [4.4586][4.4586:4645]()
    import com.intellij.openapi.application.ApplicationManager
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 27
    [4.5022][4.5022:5049]()
    import java.nio.file.Files
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 29
    [4.5102][4.5102:5121]()
    import java.util.*
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 83
    [4.1838]
    [3.4515]
    @RequiresBackgroundThread
    fun latestRevisionNumber(project: Project, root: Path): PijulOperationResult<PijulRevisionNumber>
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 94
    [3.4755]
    [3.4755]
    * Retrieves info about pijul channels.
    */
    @RequiresBackgroundThread
    fun channel(project: Project, root: VirtualFile): PijulOperationResult<ChannelInfo>
    /**
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 106
    [3.4805]
    [3.4805]
    * Retrieves change history
    */
    @RequiresBackgroundThread
    fun log(project: Project, root: Path): PijulOperationResult<PijulLog>
    /**
    * Retrieves change history
    */
    @RequiresBackgroundThread
    fun fileHistory(project: Project,
    root: VirtualFile,
    file: FilePath,
    consumer: (PijulLogEntry) -> Unit,
    errorConsumer: (PijulOperationResult<Unit>) -> Unit): PijulOperationResult<Unit>
    /**
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 72
    [2.62495]
    [2.62495]
    }
    interface HunkWithPath {
    val resolvedPath: String
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 87
    [2.62810][2.62810:62820]()
    ): Hunk()
    [2.62810]
    [2.62820]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() =
    if (this.rootPath.endsWith("/")) this.rootPath + this.path
    else this.rootPath + "/" + this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 103
    [2.63117][2.63117:63127]()
    ): Hunk()
    [2.63117]
    [2.63127]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 118
    [2.63430][2.63430:63440]()
    ): Hunk()
    [2.63430]
    [2.63440]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 131
    [2.63695][2.63695:63705]()
    ): Hunk()
    [2.63695]
    [4.2281]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.new
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 146
    [2.64019][2.64019:64029]()
    ): Hunk()
    [2.64019]
    [2.64029]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 161
    [2.64352][2.64352:64362]()
    ): Hunk()
    [2.64352]
    [2.64362]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 175
    [2.64642][2.64642:64652]()
    ): Hunk()
    [2.64642]
    [2.64652]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 190
    [2.64957][2.64957:64967]()
    ): Hunk()
    [2.64957]
    [2.64967]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/log/PijulLog.kt at line 205
    [2.65294][2.65294:65304]()
    ): Hunk()
    [2.65294]
    [2.65304]
    ): Hunk(), HunkWithPath {
    override val resolvedPath: String
    get() = this.path
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/content/PijulContentRevision.kt at line 5
    [3.5195]
    [3.5195]
    import com.github.jonathanxd.dracon.revision.loadStateInRevision
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/content/PijulContentRevision.kt at line 29
    [3.5904][3.5904:5941]()
    return loadStateInRevision()
    [3.5904]
    [3.5941]
    return loadStateInRevision(this.revision.hash, this.project, root, this.filePath)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/content/PijulContentRevision.kt at line 37
    [3.6090][3.6090:7808]()
    @OptIn(ExperimentalPathApi::class)
    private fun loadStateInRevision(): String {
    val tmpTarget = Paths.get(this.project.baseDir.path, ".idea", "dracon_diffs", this.revision.hash)
    if (Files.exists(tmpTarget)) {
    Files.walk(tmpTarget).use { walk ->
    walk.sorted(Comparator.reverseOrder())
    .map(Path::toFile)
    .forEach(File::delete)
    }
    }
    Files.createDirectories(tmpTarget)
    copyFolder(this.root, tmpTarget, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING)
    val rollbackOp = pijul(project).reset(this.project, tmpTarget)
    val relative = Paths.get(filePath.path).relativeTo(this.root).toString()
    return Files.readString(tmpTarget.resolve(relative))
    }
    @Throws(IOException::class)
    fun copyFolder(source: Path, target: Path, vararg options: CopyOption) {
    Files.walkFileTree(source, object : SimpleFileVisitor<Path>() {
    @Throws(IOException::class)
    override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
    if (dir.fileName.toString().equals(".idea", ignoreCase = true))
    return FileVisitResult.SKIP_SUBTREE
    Files.createDirectories(target.resolve(source.relativize(dir)))
    return FileVisitResult.CONTINUE
    }
    @Throws(IOException::class)
    override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
    Files.copy(file, target.resolve(source.relativize(file)), *options)
    return FileVisitResult.CONTINUE
    }
    })
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 13
    [4.11015][4.4000:4103](),[4.4103][4.11015:11075](),[4.11015][4.11015:11075](),[4.11075][4.4104:4156]()
    import com.github.jonathanxd.dracon.log.PijulLog
    import com.github.jonathanxd.dracon.log.PijulLogEntry
    import com.github.jonathanxd.dracon.log.draconConsoleWriter
    import com.github.jonathanxd.dracon.log.parseChange
    [4.11015]
    [4.11075]
    import com.github.jonathanxd.dracon.channel.ChannelInfo
    import com.github.jonathanxd.dracon.channel.PijulChannel
    import com.github.jonathanxd.dracon.log.*
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 36
    [4.11819]
    [4.11819]
    import kotlinx.coroutines.future.asDeferred
    import kotlinx.coroutines.future.await
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 58
    [4.12405][4.12405:12492]()
    val execution = this.execPijul(project, path, listOf("init", path.toString()))
    [4.12405]
    [4.12492]
    val execution = this.createExecPijulOperation(project, path, listOf("init", path.toString()))
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 70
    [4.12852][4.12852:12943]()
    val execution = this.execPijul(project, path, listOf("add", "-r") + root.path)
    [4.12852]
    [4.12943]
    val execution = this.createExecPijulOperation(project, path, listOf("add", "-r") + root.path)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 74
    [4.13085][4.13085:13179]()
    val execution = this.execPijul(project, path, listOf("add", "-r") + pathList)
    [4.13085]
    [4.13179]
    val execution = this.createExecPijulOperation(project, path, listOf("add", "-r") + pathList)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 94
    [4.3198][4.3198:3295]()
    val execution = this.execPijul(project, rootPath, listOf("diff", "--json"), delay = 10L)
    [4.3198]
    [4.13603]
    val execution = this.createExecPijulOperation(project, rootPath, listOf("diff", "--json"), delay = 10L)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 113
    [3.8497][3.8497:8650]()
    val fileStatusBasedInPijulLs = this.doExecutionWithMapper("file_status_from_ls", this.execPijul(project, rootPath, listOf("ls"), delay = 10L)) {
    [3.8497]
    [3.8650]
    val fileStatusBasedInPijulLs = this.doExecutionWithMapper("file_status_from_ls", this.createExecPijulOperation(project, rootPath, listOf("ls"), delay = 10L)) {
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 134
    [3.9259][3.9259:9363]()
    val logHashExecution = this.execPijul(project, root, listOf("log", "--hash-only"), delay = 10L)
    [3.9259]
    [3.9363]
    val logHashExecution = this.createPainlessExecPijulOperation(project, root, listOf("log", "--hash-only"))
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 153
    [3.10190]
    [3.10190]
    if (rollbackHash == hash)
    break;
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 158
    [3.10301][3.10301:10406]()
    this.execPijul(project, root, listOf("unrecord", rollbackHash), delay = 10L)
    [3.10301]
    [3.10406]
    this.createPainlessExecPijulOperation(project, root, listOf("unrecord", "--reset", rollbackHash))
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 172
    [3.10848][3.10848:10937]()
    val resetExecution = this.execPijul(project, root, listOf("reset"), delay = 10L)
    [3.10848]
    [3.10937]
    val resetExecution = this.createExecPijulOperation(project, root, listOf("reset"), delay = 10L)
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 182
    [4.4382][4.4382:4490]()
    val logHashExecution = this.execPijul(project, rootPath, listOf("log", "--hash-only"), delay = 10L)
    [4.4382]
    [4.13610]
    return this.log(project, rootPath)
    }
    override fun log(project: Project, root: Path): PijulOperationResult<PijulLog> {
    val logHashExecution = this.createPainlessExecPijulOperation(project, root, listOf("log", "--hash-only"))
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 201
    [3.11107][4.4844:4990](),[4.4844][4.4844:4990]()
    val change = this.doExecutionWithMapper("change-$hash", this.execPijul(project, rootPath, listOf("change", hash), delay = 10L)) {
    [3.11107]
    [4.4990]
    val change = this.doExecutionWithMapper("change-$hash", this.createPainlessExecPijulOperation(project, root, listOf("change", hash))) {
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 215
    [3.11222]
    [3.11222]
    @OptIn(ExperimentalPathApi::class)
    override fun fileHistory(
    project: Project,
    root: VirtualFile,
    file: FilePath,
    consumer: (PijulLogEntry) -> Unit,
    errorConsumer: (PijulOperationResult<Unit>) -> Unit
    ): PijulOperationResult<Unit> {
    val rootPath = Paths.get(VcsUtil.getFilePath(root).path)
    val filePath = Paths.get(file.path).relativeTo(rootPath)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 227
    [3.11223]
    [3.11223]
    val logHashExecution = this.createExecPijulOperation(project, rootPath, listOf("log", "--hash-only"), delay = 10L)
    val hashes = this.doExecutionWithMapper("log--hash-only", logHashExecution) {
    it.lines()
    }
    if (hashes.statusCode !is SuccessStatusCode) {
    errorConsumer(hashes as PijulOperationResult<Unit>)
    return hashes as PijulOperationResult<Unit>
    } else {
    val hashList = hashes.result!!
    for (hash in hashList) {
    if (hash.isEmpty()) {
    break
    }
    val change = this.doExecutionWithMapper("change-$hash", this.createPainlessExecPijulOperation(project, rootPath, listOf("change", hash))) {
    it.parseChange(hash)
    }
    if (change.statusCode !is SuccessStatusCode) {
    errorConsumer(change as PijulOperationResult<Unit>)
    } else if (change.result != null) {
    var shouldConsume = false
    var isAdd = false
    for (hunk in change.result.hunks) {
    if (hunk is HunkWithPath) {
    if (filePath.toString().equals(hunk.resolvedPath, ignoreCase = true)) {
    if (hunk is FileAddHunk) {
    isAdd = true
    }
    shouldConsume = true
    }
    }
    }
    if (shouldConsume) {
    consumer(change.result)
    }
    if (isAdd) {
    break
    }
    }
    }
    }
    return hashes as PijulOperationResult<Unit>
    }
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 282
    [3.11387][3.11387:11509]()
    val change = this.doExecutionWithMapper("diff", this.execPijul(project, rootPath, listOf("diff"), delay = 10L)) {
    [3.11387]
    [3.11509]
    val change = this.doExecutionWithMapper("diff", this.createExecPijulOperation(project, rootPath, listOf("diff"), delay = 10L)) {
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 294
    [4.5696]
    [4.5696]
    val log = this.log(project, root)
    return PijulOperationResult(log.operation, log.statusCode,
    log.result?.entries?.firstOrNull()?.let {
    PijulRevisionNumber(it.changeHash, it.date)
    }
    )
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 304
    [4.5697]
    [4.5697]
    override fun latestRevisionNumber(project: Project, root: Path): PijulOperationResult<PijulRevisionNumber> {
    /*val root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file)
    ?: return PijulOperationResult("file_status", SuccessStatusCode, FileStatus.UNKNOWN)*/
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 315
    [4.5951]
    [4.5951]
    override fun channel(project: Project, root: VirtualFile): PijulOperationResult<ChannelInfo> {
    val rootPath = root.toNioPath()
    val channelOperation = this.createPainlessExecPijulOperation(project, rootPath, listOf("channel"))
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 320
    [4.5952]
    [4.13611]
    return this.doExecutionWithMapper("channel list", channelOperation) {
    val channels = it.split("\n")
    if (channels.isEmpty()) null
    else ChannelInfo(channels.map { PijulChannel(it[0] == '*', it.substring(1)) })
    }
    }
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 365
    [4.14158]
    [4.14158]
    * Creates a [PijulExecution] operation that could be executed at any time. This operation uses Kotlin Coroutines
    * and can be executed immediately through [doExecution] or through [doExecutionWithMapper].
    *
    * As this implementation depends on System Processes, a [delay] should be provided as the interval between
    * [Process.isAlive] check before trying to retrieve [Process.onExit]. Bigger values yields less resource
    * intensive operation, smaller values yields less input lag and better feed back but in cost of intensive
    * scheduling.
    *
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 377
    [4.14283]
    [4.14283]
    @Deprecated(message = "Deprecated in favor of createPainlessExecPijulOperation, which does not require a delay parameter to be provided!")
  • replacement in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 379
    [4.14313][4.14313:14394](),[4.14394][4.4593:4704]()
    private fun execPijul(project: Project,
    dir: Path,
    args: List<String>,
    delay: Long = 1000L): PijulExecution {
    [4.14313]
    [4.14458]
    private fun createExecPijulOperation(project: Project,
    dir: Path,
    args: List<String>,
    delay: Long = 1000L): PijulExecution {
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 413
    [4.15487]
    [4.15487]
    /**
    * Creates a [PijulExecution] operation that could be executed at any time. This operation uses Kotlin Coroutines
    * and can be executed immediately through [doExecution] or through [doExecutionWithMapper].
    *
    * This implementation does not requires a delay value to be provided, like [createExecPijulOperation] does, instead
    * it uses the kotlin conversion from `CompletionStage` to `Coroutines` and awaits the process through [Process.onExit].
    *
    * [doExecution] and [doExecutionWithMapper] does execution by scheduling task to [Dispatchers.IO], instead of Main Thread,
    * offloading the Process execution handling to a different scheduler. However, mapping operation of [doExecutionWithMapper]
    * is not offloaded from the caller context.
    *
    */
    @RequiresBackgroundThread
    private fun createPainlessExecPijulOperation(project: Project,
    dir: Path,
    args: List<String>): PijulExecution {
    val process = ProcessBuilder()
    .command(listOf(this.findPijul()) + args)
    .directory(dir.toFile())
    .start()
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 435
    [4.15488]
    [4.15488]
    val input = process.inputStream
    val error = process.errorStream
    return PijulExecution(
    input.linesToFlow().onEach {
    draconConsoleWriter(project).logCommand("pijul", args, it)
    },
    error.linesToFlow().onEach {
    draconConsoleWriter(project).logCommandError("pijul", args, it)
    },
    flow {
    process.onExit().await()
    val exit = process.exitValue()
    if (exit == 0) {
    draconConsoleWriter(project).logCommand("pijul", args, "<Exit status> $exit")
    } else {
    draconConsoleWriter(project).logCommandError("pijul", args, "<Exit status> $exit")
    }
    emit(exit)
    }.flowOn(Dispatchers.IO)
    )
    }
  • file addition: channel (d--r------)
    [4.107]
  • file addition: PijulChannel.kt (----------)
    [0.23216]
    package com.github.jonathanxd.dracon.channel
    data class PijulChannel(val current: Boolean, val name: String)
  • file addition: ChannelInfo.kt (----------)
    [0.23216]
    package com.github.jonathanxd.dracon.channel
    data class ChannelInfo(val channels: List<PijulChannel>)
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/PijulVcs.kt at line 15
    [4.6018]
    [4.24239]
    import com.github.jonathanxd.dracon.provider.PijulHistoryProvider
    import com.intellij.openapi.components.service
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/PijulVcs.kt at line 23
    [4.6074]
    [4.24475]
    import com.intellij.openapi.vcs.history.VcsHistoryProvider
  • edit in src/main/kotlin/com/github/jonathanxd/dracon/PijulVcs.kt at line 52
    [4.6178]
    [4.25153]
    override fun getVcsHistoryProvider(): VcsHistoryProvider =
    project.service<PijulHistoryProvider>()
    override fun getVcsBlockHistoryProvider(): VcsHistoryProvider =
    this.vcsHistoryProvider