git

package
v0.0.0-...-62845a6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Changelog

type Changelog struct {
	Version       string
	RepositoryURL string
	Items         []*ChangelogItem
}

Changelog represents the changelog

type ChangelogItem

type ChangelogItem struct {
	Author     string
	AuthorURL  string
	Hash       string
	Text       string
	IssueID    string
	IssueURL   string
	ChangeType string
}

ChangelogItem represents an item in the changelog

type FilterKind

type FilterKind int

FilterKind describes which kind of filter should be applied on the issue's release notes

const (
	FilterNone FilterKind = iota
	FilterReleaseNotes
	FilterReleaseNotesNone
)

type Git

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

Git holds information about the local repository

func New

func New(path string) *Git

New returns a new local git client

func (*Git) GetCommitsBetween

func (g *Git) GetCommitsBetween(from *plumbing.Reference, to *plumbing.Reference) ([]*ChangelogItem, error)

GetCommitsBetween return a list of ChangelogItems between two given references

func (*Git) GetCommitsSince

func (g *Git) GetCommitsSince(to *plumbing.Reference) ([]*ChangelogItem, error)

GetCommitsSince return a list of ChangelogItems since a given reference

func (*Git) GetReference

func (g *Git) GetReference(name string) (*plumbing.Reference, error)

GetReference returns a reference for a given name (e.g. tag name, branch name, hash value or hash prefix (first 7 digits))

func (*Git) GetRemoteCredentials

func (g *Git) GetRemoteCredentials(c *cli.Context) (string, string, string, error)

GetRemoteCredentials returns user/org name, repository and token parsed from the `--remote` flag When `--remote` is not set, the current repositories origin url is parsed

type GithubAPI

type GithubAPI struct {
	User       string
	Repository string
	Filter     FilterKind
	Client     *gh.Client
}

GithubAPI is used to request the github api

func NewAPIClient

func NewAPIClient(user string, repo string, token string, filter FilterKind) *GithubAPI

NewAPIClient returns a new client for interacting with the GitHub API

func (*GithubAPI) CompareRemote

func (api *GithubAPI) CompareRemote(items []*ChangelogItem) ([]*ChangelogItem, error)

CompareRemote matches a list of ChangelogItems with the GitHub API. It will use the ChangelogItems IssueID to query the pull request. If the issue is a pull request, the values from the github response will be used to create a new ChangelogItem.

Jump to

Keyboard shortcuts

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