git

package
v0.0.0-...-9340bfe Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSHANotLongEnough is the error returned from various functions in this package when a
	// given SHA is not long enough for use
	ErrSHANotLongEnough = errors.New("SHA not long enough")
)

Functions

func ComponentNames

func ComponentNames() []string

ComponentNames returns a slice of known component names

func CreateTags

func CreateTags(client *github.Client, repos []RepoAndSha, tag string) error

CreateTags tags each repository at the corresponding SHA with the tag supplied

func DownloadContents

func DownloadContents(
	ghClient *github.Client,
	org,
	repo,
	filepath string,
	opt *github.RepositoryContentGetOptions) (io.ReadCloser, error)

DownloadContents downloads filepath from org/repo on Github. If error is non-nil, the returned io.ReadCloser will contain the full contents of the file

func GetLastTag

func GetLastTag(ghClient *github.Client, repos []string) (map[string]*github.RepositoryTag, error)

GetLastTag returns the latest tag for each of the repos in repos. It is not yet implemented

func MoveMilestone

func MoveMilestone(
	ghClient *github.Client,
	repo string,
	oldMilestoneName string,
	newMilestoneName string,
	includeClosed bool,
) error

func NoTransform

func NoTransform(s string) string

NoTransform returns a git sha without any transformation on it. This function exists as a pair with ShortShaTransform. It's purposefully the identity function

func RepoNames

func RepoNames() []string

RepoNames returns a slice of known repository names

func RepoToComponentNames

func RepoToComponentNames() map[string][]string

RepoToComponentNames returns a mapping from each repository name to its known component names

func ShortSHATransform

func ShortSHATransform(s string) (string, error)

ShortSHATransform returns the shortened version of the given SHA given in s. If the given string is not long enough, returns the empty string and ErrSHANotLongEnough

func ShortSHATransformNoErr

func ShortSHATransformNoErr(s string) string

ShortSHATransformNoErr calls ShortSHATransform. If that call returns an error, return s. Otherwise return its string return value

Types

type File

type File struct {
	ReadCloser io.ReadCloser
	Name       string
}

File is the representation of a downloaded file on github

type RepoAndSha

type RepoAndSha struct {
	Name string
	SHA  string
}

RepoAndSha is the representation of a Git repo and a SHA in that repo

func CreateBranches

func CreateBranches(ghClient *github.Client, branchName string, reposAndSHAs []RepoAndSha) ([]RepoAndSha, error)

CreateBranches creates branches called branchName in all of the repos listed in reposAndSHAs, each from the given SHA in that element. Returns a slice of RepoAndSha, each with the repo name and sha given. The returned slice will not necessarily be in the same order as reposAndSHAs. Finally, this func returns a nil slice and a non-nil error if any create branch operation failed

func GetSHAs

func GetSHAs(ghClient *github.Client, repos []string, transform func(string) string, ref string) ([]RepoAndSha, error)

GetSHAs returns a slice of the latest RepoAndSha for each repository, using ghClient. It transforms each SHA that it finds using the transform function. It uses the ref parameter to determine the SHA or branch from which to list commits

func GetShasFromFilepath

func GetShasFromFilepath(path string) ([]RepoAndSha, error)

GetShasFromFilepath opens the file at path and reads all the git repos and SHAs in the file. Returns a slice of all the RepoAndShas that correspond to each entry in the file, or an empty slice and non-nil error if there was any error

func (RepoAndSha) ShortSHA

func (r RepoAndSha) ShortSHA() string

ShortSHA returns the shortened SHA of r. If the SHA is already short, then returns just r.SHA

func (RepoAndSha) String

func (r RepoAndSha) String() string

String is the fmt.Stringer interface implementation

type RepoAndShaList

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

RepoAndShaList is a sortable list of RepoAndSha structs, sortable on the repo name

func NewEmptyRepoAndShaList

func NewEmptyRepoAndShaList() *RepoAndShaList

NewEmptyRepoAndShaList creates a new RepoAndShaList with no items in it

func NewRepoAndShaListFromSlice

func NewRepoAndShaListFromSlice(rasl []RepoAndSha) *RepoAndShaList

NewRepoAndShaListFromSlice returns a new RepoAndShaList with all items in rasl added (in order)

func (*RepoAndShaList) Add

func (r *RepoAndShaList) Add(ras RepoAndSha)

Add adds a new RepoAndSha to the internal list

func (*RepoAndShaList) Slice

func (r *RepoAndShaList) Slice() []RepoAndSha

Slice returns a slice of the RepoAndShas that are stored internally, in the same order

func (*RepoAndShaList) Sort

func (r *RepoAndShaList) Sort()

Sort sorts the internal repo list by name

func (RepoAndShaList) String

func (r RepoAndShaList) String() string

String is the fmt.Stringer interface implementation

Jump to

Keyboard shortcuts

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