git

package
v0.0.0-...-edc17b4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePRURL

func CreatePRURL(repo, branch string) string

Types

type Repository

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

Repository holds the state of a Git repository.

func Prepare

func Prepare(ctx context.Context, name, dir, baseBranch string) (*Repository, error)

Prepare prepares the repo for use and returns a Repository instance. If the repo does not exist, it will be cloned to dir. Otherwise, any uncommitted changes will be discarded and the base branch will be updated.

func (*Repository) CommitChanges

func (repo *Repository) CommitChanges(ctx context.Context, msg string) error

CommitChanges will stage all changes and commit them.

func (*Repository) CreateBranch

func (repo *Repository) CreateBranch(branch string) error

CreateBranch creates a new branch and switches to it.

func (*Repository) CreatePR

func (repo *Repository) CreatePR(ctx context.Context, branch, desc string) (string, error)

func (*Repository) Name

func (repo *Repository) Name() string

Name returns the name of the repository.

func (*Repository) Path

func (repo *Repository) Path() string

Path returns the path of the cloned repository on the OS filesystem.

func (*Repository) Push

func (repo *Repository) Push(ctx context.Context) error

Jump to

Keyboard shortcuts

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