Initial CahngeProvider
[?]
Mar 29, 2021, 1:50 AM
QXUEMZ3B2FUHFUC7ZZHJMH5FVWLEMEYXUMFA6JNXTJKIVZNMRIOACDependencies
- [2]
PGNTR2EPImproved README and ider roadmap - [3]
NTRPUMVQImproved README and added roadmap. - [*]
FNNW5IEAAdded more plugin files to Pijul - [*]
OPFG6CZ2File status tracking supported. - [*]
GGYFPXNDInitial plugin
Change contents
- file addition: revision[5.107]
- file addition: PijulRevisionNumber.kt[0.11]
package com.github.jonathanxd.dracon.revisionimport com.intellij.openapi.vcs.changes.patch.BlobIndexUtilimport com.intellij.openapi.vcs.history.ShortVcsRevisionNumberimport com.intellij.openapi.vcs.history.VcsRevisionNumberimport java.time.LocalDateTimeimport java.time.ZonedDateTimeclass PijulRevisionNumber(val hash: String, val timestamp: ZonedDateTime) : ShortVcsRevisionNumber {val NOT_COMMITTED_HASH = BlobIndexUtil.NOT_COMMITTED_HASHoverride fun compareTo(other: VcsRevisionNumber): Int {if (this === other) return 0if (other is PijulRevisionNumber) {return this.timestamp.compareTo(other.timestamp)}return -1}override fun asString(): String = this.hashoverride fun toShortString(): String = this.asString()} - file addition: provider[5.107]
- file addition: PijulChangeProvider.kt[0.854]
package com.github.jonathanxd.dracon.providerimport com.intellij.openapi.progress.ProgressIndicatorimport com.intellij.openapi.project.Projectimport com.intellij.openapi.vcs.VcsKeyimport com.intellij.openapi.vcs.changes.*class PijulChangeProvider(val project: Project, val key: VcsKey) : ChangeProvider {override fun getChanges(dirtyScope: VcsDirtyScope,builder: ChangelistBuilder,progress: ProgressIndicator,addGate: ChangeListManagerGate) {if (project.isDisposed) returnval dirtDirs = dirtyScope.recursivelyDirtyDirectoriesprintln(dirtDirs)}override fun isModifiedDocumentTrackingRequired(): Boolean = true} - edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 13
import com.github.jonathanxd.dracon.log.PijulLogimport com.github.jonathanxd.dracon.revision.PijulRevisionNumber - edit in src/main/kotlin/com/github/jonathanxd/dracon/pijul/Pijul.kt at line 82
@RequiresBackgroundThreadfun latestRevisionNumber(project: Project, root: VirtualFile): PijulOperationResult<PijulRevisionNumber>@RequiresBackgroundThreadfun log(project: Project, root: VirtualFile): PijulOperationResult<PijulLog> - file addition: PijulLog.kt[5.6847]
package com.github.jonathanxd.dracon.logimport java.time.LocalDateTimeimport java.time.ZonedDateTimeimport java.time.format.DateTimeFormatterimport java.time.format.ResolverStyleclass Author(val name: String?, val fullName: String?, val email: String?)class PijulLog(val entries: List<PijulLogEntry>)class PijulLogEntry(val changeHash: String,val message: String,val date: ZonedDateTime,val authors: List<Author>)val MESSAGE_PATTERN = Regex("message = '(.*)'\\n")val TIME_PATTERN = Regex("timestamp = '(.*)'\\n")val AUTHORS_SECTION_PATTERN = Regex("\\[\\[authors\\]\\]\n")val AUTHOR_PATTERN = Regex("name = '(.*)'\\n")fun String.parseChange(hash: String): PijulLogEntry {val message = MESSAGE_PATTERN.find(this)?.groupValues?.get(1)!!val timestamp = TIME_PATTERN.find(this)?.groupValues?.get(1)!!val authorsSection = AUTHORS_SECTION_PATTERN.find(this)?.range?.endInclusiveval authors = mutableListOf<Author>()if (authorsSection != null) {var lastFound: Int? = authorsSectionwhile (lastFound != null) {val foundAuthor = AUTHOR_PATTERN.find(this, lastFound)val foundAuthorGroup = foundAuthor?.groupValues?.get(1)if (foundAuthorGroup != null) {authors += Author(foundAuthorGroup, null, null)lastFound = if (foundAuthor.range.last + 1 < this.length && this[foundAuthor.range.last + 1] == '\n') {null} else {foundAuthor.range.last}} else {lastFound = null}}}return PijulLogEntry(hash, message, timestamp.parseAsLocalDateTime(), authors)}val RFC3339_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[.SSSSSSSSS]XXX").withResolverStyle(ResolverStyle.LENIENT)fun String.parseAsLocalDateTime(): ZonedDateTime {return ZonedDateTime.parse(this, RFC3339_FORMATTER)} - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 13
import com.github.jonathanxd.dracon.log.PijulLogimport com.github.jonathanxd.dracon.log.PijulLogEntry - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 16
import com.github.jonathanxd.dracon.log.parseChange - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 20
import com.github.jonathanxd.dracon.revision.PijulRevisionNumber - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 106
override fun log(project: Project, root: VirtualFile): PijulOperationResult<PijulLog> {val rootPath = Paths.get(VcsUtil.getFilePath(root).path)val logHashExecution = this.execPijul(project, rootPath, listOf("log", "--hash-only"), delay = 10L) - edit in src/main/kotlin/com/github/jonathanxd/dracon/cmd/PijulCmd.kt at line 112
val hashes = this.doExecutionWithMapper("log--hash-only", logHashExecution) {it.lines()}if (hashes.statusCode !is SuccessStatusCode) {return hashes as PijulOperationResult<PijulLog>} else {val entries = mutableListOf<PijulLogEntry>()for (hash in hashes.result!!) {val change = this.doExecutionWithMapper("change-$hash", this.execPijul(project, rootPath, listOf("change", hash), delay = 10L)) {it.parseChange(hash)}if (change.statusCode !is SuccessStatusCode) {return change as PijulOperationResult<PijulLog>}}return PijulOperationResult(hashes.operation, hashes.statusCode, PijulLog(entries))}}override fun latestRevisionNumber(project: Project, root: VirtualFile): PijulOperationResult<PijulRevisionNumber> {/*val root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file)?: return PijulOperationResult("file_status", SuccessStatusCode, FileStatus.UNKNOWN)*/val rootPath = Paths.get(VcsUtil.getFilePath(root).path)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/PijulVcs.kt at line 14
import com.github.jonathanxd.dracon.provider.PijulChangeProvider - edit in src/main/kotlin/com/github/jonathanxd/dracon/PijulVcs.kt at line 20
import com.intellij.openapi.vcs.changes.ChangeProvider - edit in src/main/kotlin/com/github/jonathanxd/dracon/PijulVcs.kt at line 46
override fun getChangeProvider(): ChangeProvider =PijulChangeProvider(this.project, KEY) - file addition: dada.toml[1.0]
- edit in build.gradle.kts at line 33[7.14803][7.14803]
maven(url = "https://jitpack.io") - edit in build.gradle.kts at line 36[7.14820][7.14820]
implementation("org.tomlj:tomlj:1.0.0")implementation("com.github.JonathanxD.JwIUtils:JwIUtils:4.17.0") {exclude(group = "org.jetbrains")} - replacement in README.md at line 21
- [ ] ...[2.59651]- [ ] ...# FAQ## Why Dracon and not Pijul for IDEA (or something like that)?Because Dracon is not an official plugin, and I want to make sure that it is clear to anyone who uses this plugin. Dracon is an individual project being developed by [Jonathan H. R. Lopes](https://github.com/JonathanxD) which does not have any relation with Pijul creator. Also, Dracon uses MIT license, allowing to anyone, and that includes the Pijul creator, to contribute and create your own version of Dracon, if wish to.## Why Dracon is developed against IntelliJ EAP instead of a stable releases?Dracon is being developed based in actual [HG4Idea](https://github.com/JetBrains/intellij-community/tree/master/plugins/hg4idea) and [Git4Idea](https://github.com/JetBrains/intellij-community/tree/master/plugins/git4idea) plugins, as well based in current code of [IntelliJ IDEA Community](https://github.com/JetBrains/intellij-community/), and is planned to be released by the end of first semester of 2021, when release time comes, the IntelliJ EAP will be already released as stable, also I don't want to support older releases of IntelliJ IDEA because this involves basing on deprecated code, and this is my first IDEA plugin, so the more I focus the present than the past, more I deliver in terms of better and stable features.## Could I contribute to Dracon development?I'm currently focused on learning how IDEA Plugin platform works and how DVCS is implemented in IDEA, so until Dracon is officially released, I will not be accepting contributions, but Dracon is licensed under MIT, you are free to create your own version of Dracon and developing it on your own.## When Dracon will be official released?I will be periodically releasing Dragon experimental builds, but Dracon stable release is planned by the end of first semester of 2021.