repository

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GitBin = "git"
)
View Source
var (

	// ManagedReposFileName is the base file name where managed git repositories config is searched.
	ManagedReposFileName = "managed_repos.yml"
)

Functions

This section is empty.

Types

type ManagedGitRepo

type ManagedGitRepo struct {
	Name string
}

ManagedGitRepo is the representation of the managed git repos in the config file.

type Service

type Service struct {
	Config *cfg.GitConfig
	// contains filtered or unexported fields
}

Service represents a git repository that comes with utility methods

func NewServicesFromFile

func NewServicesFromFile(config *cfg.Configuration) []*Service

NewServicesFromFile parses a config file with managed git repositories and provides a Service for each.

func (*Service) CheckoutBranch

func (s *Service) CheckoutBranch() pipeline.ActionFunc

CheckoutBranch invokes git to checkout the configured commit branch.

func (*Service) CloneGitRepository

func (s *Service) CloneGitRepository() pipeline.ActionFunc

CloneGitRepository invokes git to clone the repository.

func (*Service) Commit

func (s *Service) Commit() pipeline.ActionFunc

Commit invokes git to stage all files and commit to the current branch.

func (*Service) CreateOrUpdatePr

func (s *Service) CreateOrUpdatePr(config *cfg.PullRequestConfig) pipeline.ActionFunc

CreateOrUpdatePr creates a PR if it doesn't exist or updates if the remote branch exists already.

func (*Service) Diff

func (s *Service) Diff() pipeline.ActionFunc

Diff invokes git to show the changes between HEAD and previous commit.

func (*Service) DirExists

func (s *Service) DirExists(path string) bool

DirExists returns true if the given path exists and is a directory.

func (*Service) EnabledCheckout

func (s *Service) EnabledCheckout() pipeline.Predicate

EnabledCheckout returns true if the git branch should be checked out.

func (*Service) EnabledCommit

func (s *Service) EnabledCommit() pipeline.Predicate

EnabledCommit returns true if commits are enabled.

func (*Service) EnabledPr

func (s *Service) EnabledPr() pipeline.Predicate

EnabledPr returns true if a PR should be created or updated.

func (*Service) EnabledPush

func (s *Service) EnabledPush() pipeline.Predicate

EnabledPush returns true if git pushes are enabled.

func (*Service) EnabledReset

func (s *Service) EnabledReset() pipeline.Predicate

EnabledReset returns true if git reset is enabled.

func (*Service) Fetch

func (s *Service) Fetch() pipeline.ActionFunc

Fetch invokes git to fetch remote references.

func (*Service) GetDefaultBranch

func (s *Service) GetDefaultBranch() pipeline.ActionFunc

GetDefaultBranch invokes git and parses the output to determine the default branch in origin.

func (*Service) Pull

func (s *Service) Pull() pipeline.ActionFunc

Pull invokes git to pull the latest commits from origin.

func (*Service) PushToRemote

func (s *Service) PushToRemote() pipeline.ActionFunc

PushToRemote invokes git to push the commits to origin.

func (*Service) ResetRepository

func (s *Service) ResetRepository() pipeline.ActionFunc

ResetRepository invokes git to reset the git repository to discard local changes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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