All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.serpro69.semverkt.release.repo.Repository.kt Maven / Gradle / Ivy

There is a newer version: 0.13.0
Show newest version
package io.github.serpro69.semverkt.release.repo

import io.github.serpro69.semverkt.release.configuration.Configuration
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Ref
import org.eclipse.jgit.revwalk.RevCommit

/**
 * An interface representation of a repository
 *
 * @property config [Configuration] for this repository.
 */
interface Repository : AutoCloseable {

    val config: Configuration

    /**
     * Returns the `HEAD` of this repository.
     */
    val head: () -> ObjectId

    /**
     * Returns a list of tag [Ref]s from this repository.
     */
    val tags: () -> List

    /**
     * Returns the latest tag from this repository.
     *
     * The implementor should decide (and document) what the "LATEST" means and how it is calculated.
     */
    val latestVersionTag: () -> Ref?

    /**
     * Returns a list of [Commit]s in this repository,
     * with an optional [predicate] to filter the commits.
     *
     * If both [start] and [end] are provided, uses the range `since..until` for the git log.
     *
     * @param start the commit to start git log graph traversal from
     * @param end same as `--not start` or `start^`
     */
    fun log(
        start: ObjectId? = null,
        end: ObjectId? = null,
        predicate: (RevCommit) -> Boolean = { true }
    ): List

    /**
     * Returns a list of [Commit]s in this repository,
     * with an optional [predicate] to filter the commits.
     */
    fun log(
        untilTag: Ref?,
        predicate: (RevCommit) -> Boolean = { true }
    ): List
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy