merge

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchAndMergeSHAs

func FetchAndMergeSHAs(gitter gitclient.Interface, SHAs []string, baseBranch string, baseSha string, remote string, dir string) error

FetchAndMergeSHAs merges any SHAs into the baseBranch which has a tip of baseSha, fetching the commits from remote for the git repo in dir. It will try to fetch individual commits ( if the remote repo supports it - see https://github. com/git/git/commit/68ee628932c2196742b77d2961c5e16360734a62) otherwise it uses git remote update to pull down the whole repo.

func LocalBranches

func LocalBranches(g gitclient.Interface, dir string) ([]string, error)

LocalBranches will list all local branches

func ToRegexOrNil

func ToRegexOrNil(text string) (*regexp.Regexp, error)

ToRegexOrNil returns a regex for non-blank strings or returns an error if it cannot be parsed

Types

type MergePair

type MergePair struct {
	Key string
	SHA string
}

type Options

type Options struct {
	UserName             string
	UserEmail            string
	SHAs                 []string
	Remote               string
	Dir                  string
	BaseBranch           string
	BaseSHA              string
	PullRefs             string
	PullNumber           string
	IncludeCommitComment string
	ExcludeCommitComment string
	DisableInClusterTest bool

	CommandRunner cmdrunner.CommandRunner
	GitClient     gitclient.Interface
}

Options the options for the command

func NewCmdGitMerge

func NewCmdGitMerge() (*cobra.Command, *Options)

NewCmdGitMerge creates a command object for the command

func (*Options) FindCommitsToMerge

func (o *Options) FindCommitsToMerge() ([]string, error)

func (*Options) Run

func (o *Options) Run() error

Run implements the command

func (*Options) Validate

func (o *Options) Validate() error

Validate validates the inputs are valid

type PullRefs

type PullRefs struct {
	BaseBranch string
	BaseSha    string
	ToMerge    []MergePair
}

PullRefs is the result of parsing the Prow PULL_REFS

func ParsePullRefs

func ParsePullRefs(pullRefs string) (*PullRefs, error)

ParsePullRefs parses the Prow PULL_REFS env var formatted string and converts to a map of branch:sha

func (*PullRefs) String

func (pr *PullRefs) String() string

Jump to

Keyboard shortcuts

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