util

package
v0.0.0-...-2cdd923 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpstreamSummaryPattern = regexp.MustCompile(`^UPSTREAM: (revert: )?(([\w\.-]+\/[\w-\.-]+)?: )?(\d+:|<carry>:|<drop>:)`)
	BumpSummaryPattern     = regexp.MustCompile(`^bump[\(\w].*`)

	// patchRegexps holds regexps for paths inside vendor dir that are allowed to be patched directly.
	// It must corresponds to published repositories.
	PatchRegexps = []*regexp.Regexp{
		regexp.MustCompile("^k8s.io/kubernetes/.*"),
	}

	// supportedHosts maps source hosts to the number of path segments that
	// represent the account/repo for that host. This is necessary because we
	// can't tell just by looking at an import path whether the repo is identified
	// by the first 2 or 3 path segments.
	//
	// If dependencies are introduced from new hosts, they'll need to be added
	// here.
	SupportedHosts = map[string]int{
		"bitbucket.org":     3,
		"cloud.google.com":  2,
		"code.google.com":   3,
		"github.com":        3,
		"golang.org":        3,
		"google.golang.org": 2,
		"gopkg.in":          2,
		"k8s.io":            2,
		"speter.net":        2,
	}
)
View Source
var ErrNotCommit = fmt.Errorf("one or both of the provided commits was not a valid commit")

Functions

func Checkout

func Checkout(commit, repoDir string) error

func CommitDate

func CommitDate(commit, repoDir string) (string, error)

func CurrentRev

func CurrentRev(repoDir string) (string, error)

func FetchRepo

func FetchRepo(repoDir string) error

func IsAncestor

func IsAncestor(commit1, commit2, repoDir string) (bool, error)

func IsCommit

func IsCommit(a string) bool

func RegexpsToStrings

func RegexpsToStrings(a []*regexp.Regexp) []string

Types

type Commit

type Commit struct {
	Sha         string
	Summary     string
	Description []string
	Files       []File
	Email       string
}

func CommitsBetween

func CommitsBetween(a, b string) ([]Commit, error)

func NewCommitFromOnelineLog

func NewCommitFromOnelineLog(log string) (Commit, error)

func (Commit) DeclaredUpstreamRepo

func (c Commit) DeclaredUpstreamRepo() (string, error)

func (Commit) HasBumpedFiles

func (c Commit) HasBumpedFiles() bool

func (Commit) HasNonVendoredCodeChanges

func (c Commit) HasNonVendoredCodeChanges() bool

func (Commit) HasPatches

func (c Commit) HasPatches() bool

func (Commit) HasVendoredCodeChanges

func (c Commit) HasVendoredCodeChanges() bool

func (Commit) MatchesBumpSummaryPattern

func (c Commit) MatchesBumpSummaryPattern() bool

func (Commit) MatchesUpstreamSummaryPattern

func (c Commit) MatchesUpstreamSummaryPattern() bool

func (Commit) PatchedRepos

func (c Commit) PatchedRepos() ([]string, error)

type File

type File string

func (File) HasVendoredCodeChanges

func (f File) HasVendoredCodeChanges() bool

func (File) IsPatch

func (f File) IsPatch() bool

func (File) VendorRepo

func (f File) VendorRepo() (string, error)

Jump to

Keyboard shortcuts

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