Skip to content
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ dependencies {
// Calculator
includeImplementation(libs.keval)

// Repo mgmt
includeImplementation(libs.jgit)

detektPlugins(libs.detektrules.neu)
detektPlugins(project(":detekt"))
detektPlugins(libs.detektrules.ktlint)
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gson = "2.13.1"
guava = "33.2.1-jre"
changelog-builder = "1.1.3"
methanol = "1.8.3"
jgit = "7.6.0.202603022253-r"

shadow = "9.3.1"
loom = "1.15-SNAPSHOT"
Expand Down Expand Up @@ -42,6 +43,7 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "
changelog-builder = { module = "com.github.SkyHanniStudios:SkyHanniChangelogBuilder", version.ref = "changelog-builder" }
methanol = { module = "com.github.mizosoft.methanol:methanol", version.ref = "methanol" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" }

devauth = { module = "me.djtheredstoner:DevAuth-fabric", version.ref = "devauth" }
junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ object SkyHanniMod : CompatCoroutineManager by SkyHanniCoroutineManager(

lateinit var configManager: ConfigManager
val logger: Logger = LogManager.getLogger("SkyHanni")
fun getLogger(name: String): Logger {
return LogManager.getLogger("SkyHanni.$name")
}

val modules: MutableList<Any> = ArrayList()

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/data/git/commit/Commit.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package at.hannibal2.skyhanni.data.git.commit

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class Commit(
@Expose val author: ShortCommitAuthor,
@Expose val committer: ShortCommitAuthor,
@Expose val message: String,
@Expose val tree: CommitTree,
@Expose val url: String,
@Expose @field:SerializedName("comment_count") val commentCount: Int,
@Expose val verification: CommitVerification,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package at.hannibal2.skyhanni.data.git.commit

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class CommitAuthor(
@Expose val login: String,
@Expose val id: Int,
@Expose @field:SerializedName("node_id") val nodeId: String,
@Expose @field:SerializedName("avatar_url") val avatarUrl: String,
@Expose @field:SerializedName("gravatar_id") val gravatarId: String,
@Expose val url: String,
@Expose @field:SerializedName("html_url") val htmlUrl: String,
@Expose @field:SerializedName("followers_url") val followersUrl: String,
@Expose @field:SerializedName("following_url") val followingUrl: String,
@Expose @field:SerializedName("gists_url") val gistsUrl: String,
@Expose @field:SerializedName("starred_url") val starredUrl: String,
@Expose @field:SerializedName("subscriptions_url") val subscriptionsUrl: String,
@Expose @field:SerializedName("organizations_url") val organizationsUrl: String,
@Expose @field:SerializedName("repos_url") val reposUrl: String,
@Expose @field:SerializedName("events_url") val eventsUrl: String,
@Expose @field:SerializedName("received_events_url") val receivedEventsUrl: String,
@Expose val type: String,
@Expose @field:SerializedName("user_view_type") val userViewType: String,
@Expose @field:SerializedName("site_admin") val siteAdmin: Boolean,
)
17 changes: 17 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/data/git/commit/CommitFile.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package at.hannibal2.skyhanni.data.git.commit

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class CommitFile(
@Expose val sha: String,
@Expose val filename: String,
@Expose val status: String,
@Expose val additions: Int,
@Expose val deletions: Int,
@Expose val changes: Int,
@Expose @field:SerializedName("blob_url") val blobUrl: String,
@Expose @field:SerializedName("raw_url") val rawUrl: String,
@Expose @field:SerializedName("contents_url") val contentsUrl: String,
@Expose @field:SerializedName("patch") val patch: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package at.hannibal2.skyhanni.data.git.commit

import com.google.gson.annotations.Expose

data class CommitStats(
@Expose val total: Long,
@Expose val additions: Long,
@Expose val deletions: Long,
)
10 changes: 10 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/data/git/commit/CommitTree.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package at.hannibal2.skyhanni.data.git.commit

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class CommitTree(
@Expose val sha: String,
@Expose val url: String,
@Expose @field:SerializedName("html_url") val htmlUrl: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package at.hannibal2.skyhanni.data.git.commit

import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.time.Instant

data class CommitVerification(
@Expose val verified: Boolean,
@Expose val reason: String,
@Expose val signature: String? = null,
@Expose val payload: String? = null,
@Expose @field:SerializedName("verified_at") private val verifiedAtString: String? = null,
) {
val verifiedAt: SimpleTimeMark? get() = verifiedAtString?.let {
Instant.parse(it).toEpochMilli().asTimeMark()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package at.hannibal2.skyhanni.data.git.commit

import at.hannibal2.skyhanni.utils.KSerializable
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

@KSerializable
data class CommitsApiResponse(
@Expose val sha: String,
@Expose @field:SerializedName("node_id") val nodeId: String,
@Expose val commit: Commit,
@Expose val url: String,
@Expose @field:SerializedName("html_url") val htmlUrl: String,
@Expose @field:SerializedName("comments_url") val commentsUrl: String,
@Expose val author: CommitAuthor,
@Expose val committer: CommitAuthor,
@Expose val parents: List<CommitTree>,
@Expose val stats: CommitStats,
@Expose val files: List<CommitFile>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package at.hannibal2.skyhanni.data.git.commit

import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.time.Instant

data class ShortCommitAuthor(
@Expose val name: String,
@Expose val email: String,
@Expose @field:SerializedName("date") private val dateString: String,
) {
val date: SimpleTimeMark get() = Instant.parse(dateString).toEpochMilli().asTimeMark()
}
Loading
Loading