Documentation
¶
Index ¶
- Constants
- Variables
- type BranchName
- type CloneOps
- type CommandBuilder
- func (cb *CommandBuilder) Arg(args ...string) *CommandBuilder
- func (cb *CommandBuilder) ArgIf(cond bool, args ...string) *CommandBuilder
- func (cb *CommandBuilder) Run() error
- func (cb *CommandBuilder) RunWithExitCode() int
- func (cb *CommandBuilder) RunWithOutput() (string, error)
- func (cb *CommandBuilder) SetRepo(r Repo) *CommandBuilder
- func (cb *CommandBuilder) String() string
- type Git
- type GitCLI
- func (gc GitCLI) Clone(ops CloneOps) error
- func (gc GitCLI) CreateLightweightTag(repo Repo, tag string, branch BranchName) error
- func (gc GitCLI) CurrentBranch(repo Repo) (BranchName, error)
- func (gc GitCLI) DiffersFromRemote(repo Repo) (bool, error)
- func (gc GitCLI) Fetch(repo Repo) error
- func (gc GitCLI) HasChanges(repo Repo) (bool, error)
- func (gc GitCLI) ListBranches(repo Repo) ([]BranchName, error)
- func (gc GitCLI) ListRemotes(repo Repo) ([]Remote, error)
- func (gc GitCLI) Pull(repo Repo, rebase bool) error
- func (gc GitCLI) PullBranch(repo Repo, branch BranchName, rebase bool) error
- func (gc GitCLI) PushTag(repo Repo, tag Tag, remote Remote) error
- func (gc GitCLI) Status(repo Repo) (StatusRes, error)
- func (gc GitCLI) Switch(repo Repo, br BranchName, force bool) error
- type Remote
- type RemoteGitUrl
- type Repo
- type StatusRes
- type Tag
Constants ¶
View Source
const RemoteGitUrlRegex = "((git|ssh|http(s)?)|(git@[\\w\\.]+))(:(//)?)([\\w\\.@\\:/\\-~]+)(\\.git)(/)?"
Variables ¶
View Source
var ErrInvalidGitUrl = errors.New("invalid git remote repository url")
View Source
var ErrInvalidReference = errors.New("invalid remote reference")
Functions ¶
This section is empty.
Types ¶
type BranchName ¶
type BranchName string
type CloneOps ¶
type CloneOps struct {
Remote RemoteGitUrl
Path string
Refs BranchName
}
type CommandBuilder ¶
type CommandBuilder struct {
// contains filtered or unexported fields
}
func NewCommandBuilder ¶
func NewCommandBuilder() *CommandBuilder
func (*CommandBuilder) Arg ¶
func (cb *CommandBuilder) Arg(args ...string) *CommandBuilder
func (*CommandBuilder) ArgIf ¶
func (cb *CommandBuilder) ArgIf(cond bool, args ...string) *CommandBuilder
func (*CommandBuilder) Run ¶
func (cb *CommandBuilder) Run() error
func (*CommandBuilder) RunWithExitCode ¶
func (cb *CommandBuilder) RunWithExitCode() int
func (*CommandBuilder) RunWithOutput ¶
func (cb *CommandBuilder) RunWithOutput() (string, error)
func (*CommandBuilder) SetRepo ¶
func (cb *CommandBuilder) SetRepo(r Repo) *CommandBuilder
func (*CommandBuilder) String ¶
func (cb *CommandBuilder) String() string
type Git ¶
type Git interface {
Clone(ops CloneOps) error
ListRemotes(repo Repo) ([]Remote, error)
Fetch(repo Repo) error
Status(repo Repo) (StatusRes, error)
CurrentBranch(repo Repo) (BranchName, error)
HasChanges(repo Repo) (bool, error)
DiffersFromRemote(repo Repo) (bool, error)
Switch(repo Repo, branch BranchName, force bool) error
Pull(repo Repo, rebase bool) error
PullBranch(repo Repo, branch BranchName, rebase bool) error
ListBranches(repo Repo) ([]BranchName, error)
CreateLightweightTag(repo Repo, tag string, branch BranchName) error
PushTag(repo Repo, tag Tag, remote Remote) error
}
type GitCLI ¶
type GitCLI struct {
// contains filtered or unexported fields
}
func (GitCLI) CreateLightweightTag ¶
func (gc GitCLI) CreateLightweightTag(repo Repo, tag string, branch BranchName) error
func (GitCLI) CurrentBranch ¶
func (gc GitCLI) CurrentBranch(repo Repo) (BranchName, error)
func (GitCLI) ListBranches ¶
func (gc GitCLI) ListBranches(repo Repo) ([]BranchName, error)
func (GitCLI) PullBranch ¶
func (gc GitCLI) PullBranch(repo Repo, branch BranchName, rebase bool) error
type RemoteGitUrl ¶
type RemoteGitUrl string
func NewRemoteGitUrl ¶
func NewRemoteGitUrl(raw string) (RemoteGitUrl, error)
type Repo ¶
type Repo struct {
Remote RemoteGitUrl `yaml:"remote" json:"remote,omitempty"`
Path string `yaml:"rel_path" json:"rel_path,omitempty"`
Refs BranchName `yaml:"main_stream" json:"main_stream,omitempty"`
}
type StatusRes ¶
type StatusRes struct {
Change bool
Branch BranchName
}
Click to show internal directories.
Click to hide internal directories.