git

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultGithubOrg  = "kubernetes"
	DefaultGithubRepo = "kubernetes"
	DefaultRemote     = "origin"
	DefaultMasterRef  = "HEAD"
	Master            = "master"
)

Variables

This section is empty.

Functions

func IsReleaseBranch

func IsReleaseBranch(branch string) bool

func Remotify

func Remotify(name string) string

Remotify returns the name prepended with the default remote

Types

type DiscoverResult added in v0.2.1

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

DiscoverResult is the result of a revision discovery

func (*DiscoverResult) EndRev added in v0.2.1

func (d *DiscoverResult) EndRev() string

EndRev returns the end revision for the DiscoverResult

func (*DiscoverResult) EndSHA added in v0.2.1

func (d *DiscoverResult) EndSHA() string

EndSHA returns the end SHA for the DiscoverResult

func (*DiscoverResult) StartRev added in v0.2.1

func (d *DiscoverResult) StartRev() string

StartRev returns the start revision for the DiscoverResult

func (*DiscoverResult) StartSHA added in v0.2.1

func (d *DiscoverResult) StartSHA() string

StartSHA returns the start SHA for the DiscoverResult

type Repo

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

Wrapper type for a Kubernetes repository instance

func CloneOrOpenDefaultGitHubRepoSSH

func CloneOrOpenDefaultGitHubRepoSSH(path, owner string) (*Repo, error)

CloneOrOpenDefaultGitHubRepoSSH clones the default Kubernets GitHub repository into the path or updates it.

func CloneOrOpenGitHubRepo

func CloneOrOpenGitHubRepo(path, owner, repo string, useSSH bool) (*Repo, error)

CloneOrOpenGitHubRepo creates a temp directory containing the provided GitHub repository via the owner and repo. If useSSH is true, then it will clone the repository using the defaultGithubAuthRoot.

func CloneOrOpenRepo

func CloneOrOpenRepo(repoPath, url string, useSSH bool) (*Repo, error)

CloneOrOpenRepo creates a temp directory containing the provided GitHub repository via the url.

If a repoPath is given, then the function tries to update the repository.

The function returns the repository if cloning or updating of the repository was successful, otherwise an error.

func (*Repo) CheckoutBranch

func (r *Repo) CheckoutBranch(name string) error

CheckoutBranch can be used to switch to another branch

func (*Repo) Cleanup

func (r *Repo) Cleanup() error

func (*Repo) DescribeTag

func (r *Repo) DescribeTag(rev string) (string, error)

DescribeTag can be used to retrieve the latest tag for a provided revision

func (*Repo) Dir

func (r *Repo) Dir() string

Dir returns the directory where the repository is stored on disk

func (*Repo) HasRemoteBranch

func (r *Repo) HasRemoteBranch(branch string) error

HasRemoteBranch takes a branch string and verifies that it exists on the default remote

func (*Repo) Head

func (r *Repo) Head() (string, error)

Head retrieves the current repository HEAD as a string

func (*Repo) LatestNonPatchFinalToLatest

func (r *Repo) LatestNonPatchFinalToLatest() (DiscoverResult, error)

LatestNonPatchFinalToLatest tries to discover the start (latest v1.xx.0) and end (release-1.xx or master) revision inside the repository

func (*Repo) LatestNonPatchFinalToMinor added in v0.2.1

func (r *Repo) LatestNonPatchFinalToMinor() (DiscoverResult, error)

func (*Repo) LatestPatchToPatch added in v0.2.1

func (r *Repo) LatestPatchToPatch(branch string) (DiscoverResult, error)

LatestPatchToPatch tries to discover the start (latest v1.x.[x-1]) and end (latest v1.x.x) revision inside the repository for the specified release branch.

func (*Repo) Merge

func (r *Repo) Merge(from string) error

Merge does a git merge into the current branch from the provided one

func (*Repo) MergeBase

func (r *Repo) MergeBase(from, to string) (string, error)

func (*Repo) Push

func (r *Repo) Push(remoteBranch string) error

Push does push the specified branch to the default remote, but only if the repository is not in dry run mode

func (*Repo) RevParse

func (r *Repo) RevParse(rev string) (string, error)

RevParse parses a git revision and returns a SHA1 on success, otherwise an error.

func (*Repo) RevParseShort

func (r *Repo) RevParseShort(rev string) (string, error)

RevParseShort parses a git revision and returns a SHA1 trimmed to the length 10 on success, otherwise an error.

func (*Repo) SetDry

func (r *Repo) SetDry()

Set the repo into dry run mode, which does not modify any remote locations at all.

Jump to

Keyboard shortcuts

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