gits

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ConventionalCommitTitles textual descriptions for
	// Conventional Commit types: https://conventionalcommits.org/
	ConventionalCommitTitles = map[string]*CommitGroup{
		"break":    createCommitGroup("BREAKING CHANGES"),
		"feat":     createCommitGroup("New Features"),
		"fix":      createCommitGroup("Bug Fixes"),
		"perf":     createCommitGroup("Performance Improvements"),
		"refactor": createCommitGroup("Code Refactoring"),
		"docs":     createCommitGroup("Documentation"),
		"test":     createCommitGroup("Tests"),
		"revert":   createCommitGroup("Reverts"),
		"style":    createCommitGroup("Styles"),
		"chore":    createCommitGroup("Chores"),
		"":         createCommitGroup("Other Changes"),
	}

	ConventionalCommitRegexp = regexp.MustCompile(`^([0-9A-Za-z-]+)(?:\(([0-9A-Za-z-]+)\))?(!)?: (.+)((?s:.*))`)
	BreakingChangeRegexp     = regexp.MustCompile(`(?m)^BREAKING CHANGE: (.*)`)
)

Functions

func FilterTags

func FilterTags(g gitclient.Interface, dir, filter string) ([]string, error)

FilterTags returns all tags from the repository at the given directory that match the filter

func GenerateMarkdown

func GenerateMarkdown(releaseSpec *v1.ReleaseSpec, gitInfo *giturl.GitRepository, changelogSeparator string, prchangelog, includeprs bool) (string, error)

GenerateMarkdown generates the markdown document for the commits

func GetCommitPointedToByLatestTag

func GetCommitPointedToByLatestTag(g gitclient.Interface, dir, prefix string) (string, string, error)

GetCommitPointedToByLatestTag return the SHA of the commit pointed to by the latest git tag as well as the tag name for the git repo in dir

func GetCommitPointedToByPreviousTag

func GetCommitPointedToByPreviousTag(g gitclient.Interface, dir, prefix string) (string, string, error)

GetCommitPointedToByPreviousTag return the SHA of the commit pointed to by the latest-but-1 git tag as well as the tag name for the git repo in dir

func GetFirstCommitSha

func GetFirstCommitSha(g gitclient.Interface, dir string) (string, error)

GetFirstCommitSha returns the sha of the first commit

func GetRevisionBeforeDateText

func GetRevisionBeforeDateText(g gitclient.Interface, dir, dateText string) (string, error)

GetRevisionBeforeDateText returns the revision before the given date in format "MonthName dayNumber year"

func NthTag

func NthTag(g gitclient.Interface, dir string, n int, prefix string) (string, string, error)

NthTag return the SHA and tag name of nth tag in reverse chronological order from the repository at the given directory. If the nth tag does not exist empty strings without an error are returned.

func ParseCommit

func ParseCommit(message string) (*CommitInfo, *CommitInfo)

ParseCommit parses a conventional commit see: https://conventionalcommits.org/

Types

type CommitGroup

type CommitGroup struct {
	Title string
	Order int
}

type CommitInfo

type CommitInfo struct {
	Type        string
	Scope       string
	Description string
	// contains filtered or unexported fields
}

func (*CommitInfo) Group

func (c *CommitInfo) Group() *CommitGroup

func (*CommitInfo) Order

func (c *CommitInfo) Order() int

func (*CommitInfo) Title

func (c *CommitInfo) Title() string

type GroupAndCommitInfos

type GroupAndCommitInfos struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL