git

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIGit

type CLIGit struct {
	CLIGitConfig
	Runner runner.Runner
}

CLIGit is a new command line based Git.

func NewCLIGit

func NewCLIGit(cfg CLIGitConfig, r runner.Runner) *CLIGit

NewCLIGit creates a new command line based Git.

func (*CLIGit) Add

func (g *CLIGit) Add(dir string) error

Add will add any changes to the generated file.

func (*CLIGit) Checkout added in v0.2.0

func (g *CLIGit) Checkout(branch string) error

Checkout the target branch

func (*CLIGit) Clone added in v0.0.3

func (g *CLIGit) Clone(repo, branch, location string) error

Clone will take a repo location and clone it into a given folder.

func (*CLIGit) Commit

func (g *CLIGit) Commit() error

Commit all changes.

func (*CLIGit) CreateBranch

func (g *CLIGit) CreateBranch(branch string) error

CreateBranch creates a branch if it differs from the base.

func (*CLIGit) GetDirectory added in v0.2.0

func (g *CLIGit) GetDirectory() string

func (*CLIGit) HasChanges

func (g *CLIGit) HasChanges() (bool, error)

HasChanges returns whether a location has uncommitted changes or not.

func (*CLIGit) Init added in v0.2.0

func (g *CLIGit) Init() error

Init will initalise the git repository

func (*CLIGit) IsRepository

func (g *CLIGit) IsRepository() error

IsRepository returns whether a location is a git repository or not.

func (*CLIGit) Merge added in v0.2.0

func (g *CLIGit) Merge(branch string) ([]string, error)

Merge will merge the branch into the currently checked out branch. returns (true, nil) when merge conflict occurs.

func (*CLIGit) Push

func (g *CLIGit) Push() error

Push will push to a remote.

func (*CLIGit) RemoveAll added in v0.2.0

func (g *CLIGit) RemoveAll() error

type CLIGitConfig

type CLIGitConfig struct {
	Directory string
	Branch    string
	Remote    string
	Message   string
	Base      string
	Quiet     bool
}

CLIGitConfig defines configuration options for CLIGit.

type Client

type Client struct {
	SCMConfig
}

Client defines a client which uses a real implementation to create pull requests.

func NewClient

func NewClient(cfg SCMConfig) (*Client, error)

NewClient returns a real client.

func (*Client) CreatePullRequest

func (r *Client) CreatePullRequest() error

CreatePullRequest will create a pull request.

type Git

type Git interface {
	// Add staged changes.
	Add(dir string) error
	// Commit changes.
	Commit() error
	// CreateBranch create a branch if it's needed.
	CreateBranch(string) error
	// IsRepository returns whether a location is a git repository or not.
	IsRepository() error
	// HasChanges returns whether a location has uncommitted changes or not.
	HasChanges() (bool, error)
	// Push will push to a remote.
	Push() error
	// Clone will take a repo location and clone it into a given folder.
	Clone(repo, branch, location string) error
	// Init will create a git repository
	Init() error
	// Merge will merge the branch into the currently checked out branch
	// return a list of files when a conflict occurs
	Merge(branch string) ([]string, error)
	// Checkout the target branch
	Checkout(branch string) error
	// GetDirectory returns the git directory
	GetDirectory() string
	// RemoveAll files from git repository
	RemoveAll() error
}

Git defines high level abilities for Git related operations.

type SCMClient

type SCMClient interface {
	CreatePullRequest() error
}

SCMClient defines the ability to create a pull request on a remote repository.

type SCMConfig

type SCMConfig struct {
	Branch string
	Base   string
	Repo   string
	Client *scm.Client
}

SCMConfig defines configuration for the SCM Client that is needed to create a pull request.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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