Documentation ¶
Overview ¶
Package chglog contains the public API for working with a changlog.yml file
Index ¶
- Variables
- func CommitsBetween(gitRepo *git.Repository, start, end plumbing.Hash) (commits []*object.Commit, err error)
- func DebTemplate() (*template.Template, error)
- func FormatChangelog(pkgLogs *PackageChangeLog, tpl *template.Template) (string, error)
- func GitHashFotTag(gitRepo *git.Repository, tagName string) (hash plumbing.Hash, err error)
- func GitRepo(gitPath string, detectDotGit bool) (*git.Repository, error)
- func LoadTemplateData(data string) (*template.Template, error)
- func RPMTemplate() (*template.Template, error)
- func ReleaseTemplate() (*template.Template, error)
- func RepoTemplate() (*template.Template, error)
- type ChangeLog
- type ChangeLogChange
- type ChangeLogChanges
- type ChangeLogEntries
- type ChangeLogNotes
- type ChangeLogOverridables
- type ChangelogDeb
- type PackageChangeLog
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrNoCommits = errors.New("no commits found for this entry")
ErrNoCommits happens when no commits are found for a given entry.
Functions ¶
func CommitsBetween ¶
func CommitsBetween(gitRepo *git.Repository, start, end plumbing.Hash) (commits []*object.Commit, err error)
CommitsBetween return the list of commits between two commits.
func DebTemplate ¶
DebTemplate load default debian template.
func FormatChangelog ¶
func FormatChangelog(pkgLogs *PackageChangeLog, tpl *template.Template) (string, error)
FormatChangelog format pkgLogs from a text/template.
func GitHashFotTag ¶
GitHashFotTag return the git sha for a particular tag.
func LoadTemplateData ¶
LoadTemplateData load a template from string with all of the sprig.TxtFuncMap loaded.
func RPMTemplate ¶
RPMTemplate load default RPM template.
func ReleaseTemplate ¶
ReleaseTemplate load default release template.
func RepoTemplate ¶
RepoTemplate load default repo template.
Types ¶
type ChangeLog ¶
type ChangeLog struct { ChangeLogOverridables `yaml:",inline"` Semver string `yaml:"semver"` Date time.Time `yaml:"date"` Packager string `yaml:"packager"` Notes *ChangeLogNotes `yaml:"notes,omitempty"` Changes ChangeLogChanges `yaml:"changes,omitempty"` }
ChangeLog a single changelog entry.
func CreateEntry ¶
func CreateEntry(date time.Time, version fmt.Stringer, owner string, notes *ChangeLogNotes, deb *ChangelogDeb, commits []*object.Commit, useConventionalCommits bool) (changelog *ChangeLog)
CreateEntry create a ChangeLog object.
type ChangeLogChange ¶
type ChangeLogChange struct { Commit string `yaml:"commit"` Note string `yaml:"note"` // Author is the original author of the commit. Author *User `yaml:"author,omitempty"` // Committer is the one performing the commit, might be different from // Author. Committer *User `yaml:"committer,omitempty"` ConventionalCommit *conventional_commit.ConventionalCommit `yaml:"conventional_commit,omitempty"` }
ChangeLogChange an individual change.
type ChangeLogChanges ¶
type ChangeLogChanges []*ChangeLogChange
ChangeLogChanges list of individual changes.
type ChangeLogEntries ¶
type ChangeLogEntries []*ChangeLog
ChangeLogEntries list of ChangeLog entries.
func AddEntry ¶
func AddEntry( gitRepo *git.Repository, version fmt.Stringer, owner string, notes *ChangeLogNotes, deb *ChangelogDeb, current ChangeLogEntries, useConventionalCommits bool, ) (cle ChangeLogEntries, err error)
AddEntry add a ChangeLog entry to an existing ChangeLogEntries that.
func InitChangelog ¶
func InitChangelog(gitRepo *git.Repository, owner string, notes *ChangeLogNotes, deb *ChangelogDeb, useConventionalCommits bool) (cle ChangeLogEntries, err error)
InitChangelog create a new ChangeLogEntries from a git repo.
func Parse ¶
func Parse(file string) (entries ChangeLogEntries, err error)
Parse parse a changelog.yml into ChangeLogEntries.
func (ChangeLogEntries) Len ¶
func (c ChangeLogEntries) Len() int
Len returns the length of a collection. The number of Version instances on the slice.
func (ChangeLogEntries) Less ¶
func (c ChangeLogEntries) Less(i, j int) bool
Less is needed for the sort interface to compare two Version objects on the slice. If checks if one is less than the other.
func (*ChangeLogEntries) Save ¶
func (c *ChangeLogEntries) Save(file string) (err error)
Save save ChangeLogEntries to a yml file.
func (ChangeLogEntries) Swap ¶
func (c ChangeLogEntries) Swap(i, j int)
Swap is needed for the sort interface to replace the Version objects at two different positions in the slice.
type ChangeLogNotes ¶
type ChangeLogNotes struct { Header *string `yaml:"header,omitempty"` }
ChangeLogNotes contains a potential header/footer string for output formatting.
type ChangeLogOverridables ¶
type ChangeLogOverridables struct {
Deb *ChangelogDeb `yaml:"deb,omitempty"`
}
ChangeLogOverridables contains potential format specific fields.
type ChangelogDeb ¶
type ChangelogDeb struct { Urgency string `yaml:"urgency"` Distributions []string `yaml:"distributions"` }
ChangelogDeb contains fields specific to the debian changelog format https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog
type PackageChangeLog ¶
type PackageChangeLog struct { Name string `yaml:"name"` Entries ChangeLogEntries `yaml:"entries"` }
PackageChangeLog used for the formatting API.