vcs

package
v0.0.0-...-9ce00e0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Git = "git"
	Hg  = "hg"

	Bitbucket = "bitbucket"
	GitHub    = "github"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	AuthenticateURL(url string) string
	AuthenticateHTTPRequest(header header)
	AuthenticateWithToken() *http.Client
}

type GitRepo

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

func NewGit

func NewGit(auth Authentication, source string, to string, basePath string) (GitRepo, error)

func (GitRepo) ActiveBranches

func (gitRepo GitRepo) ActiveBranches() ([]string, error)

ActiveBranches returns all currently active branches without origin/ prefix

func (GitRepo) Branch

func (gitRepo GitRepo) Branch(branchname string) (string, error)

func (GitRepo) Clone

func (gitRepo GitRepo) Clone() error

func (GitRepo) CloseBranch

func (gitRepo GitRepo) CloseBranch(branch string) error

CloseBranch deletes the branch for the remote repository

func (GitRepo) Cmd

func (gitRepo GitRepo) Cmd(args ...string) (string, error)

func (GitRepo) Commit

func (gitRepo GitRepo) Commit(message string) (string, error)

func (GitRepo) CommitsBetween

func (gitRepo GitRepo) CommitsBetween(baseRev string, secondRev string) ([]string, error)

func (GitRepo) GetName

func (gitRepo GitRepo) GetName() string

func (GitRepo) LocalPath

func (gitRepo GitRepo) LocalPath() string

func (GitRepo) Push

func (gitRepo GitRepo) Push() (string, error)

func (GitRepo) RemotePath

func (gitRepo GitRepo) RemotePath() string

func (GitRepo) SanitizeBranchName

func (gitRepo GitRepo) SanitizeBranchName(branchName string) string

func (GitRepo) SoftBranch

func (gitRepo GitRepo) SoftBranch(branchname string) (string, error)

func (GitRepo) Update

func (gitRepo GitRepo) Update(rev string) (string, error)

func (GitRepo) WorkingPath

func (gitRepo GitRepo) WorkingPath() string

type HgRepo

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

func NewHg

func NewHg(auth Authentication, source string, to string, defaultBranch string, trashBranch string, basePath string) (HgRepo, error)

func (HgRepo) ActiveBranches

func (hgRepo HgRepo) ActiveBranches() ([]string, error)

ActiveBranches returns all currently active branches

func (HgRepo) Branch

func (hgRepo HgRepo) Branch(branchname string) (string, error)

func (HgRepo) Clone

func (hgRepo HgRepo) Clone() error

func (HgRepo) CloseBranch

func (hgRepo HgRepo) CloseBranch(branch string) error

CloseBranch closes the branch then it merges it to a trash branch so no heads are left

func (HgRepo) Cmd

func (hgRepo HgRepo) Cmd(args ...string) (string, error)

func (HgRepo) Commit

func (hgRepo HgRepo) Commit(message string) (string, error)

func (HgRepo) CommitsBetween

func (hgRepo HgRepo) CommitsBetween(baseRev string, secondRev string) ([]string, error)

func (HgRepo) GetName

func (hgRepo HgRepo) GetName() string

func (HgRepo) LocalPath

func (hgRepo HgRepo) LocalPath() string

func (HgRepo) Merge

func (hgRepo HgRepo) Merge(branch string) (string, error)

func (HgRepo) Push

func (hgRepo HgRepo) Push() (string, error)

func (HgRepo) PushDefault

func (hgRepo HgRepo) PushDefault() (string, error)

func (HgRepo) RemotePath

func (hgRepo HgRepo) RemotePath() string

func (HgRepo) SanitizeBranchName

func (hgRepo HgRepo) SanitizeBranchName(branchName string) string

func (HgRepo) SetUserPas

func (hgRepo HgRepo) SetUserPas(user string, pass string) error

func (HgRepo) SoftBranch

func (hgRepo HgRepo) SoftBranch(branchname string) (string, error)

func (HgRepo) Update

func (hgRepo HgRepo) Update(rev string) (string, error)

func (HgRepo) WorkingPath

func (hgRepo HgRepo) WorkingPath() string

type SourceControl

type SourceControl interface {
	WorkingPath() string
	LocalPath() string
	RemotePath() string

	Cmd(args ...string) (string, error)
	Update(rev string) (string, error)
	Branch(branchname string) (string, error)
	SoftBranch(branchname string) (string, error)
	Commit(message string) (string, error)
	Push() (string, error)
	ActiveBranches() ([]string, error)
	CloseBranch(branch string) error
	Clone() error
	SanitizeBranchName(branchName string) string

	CommitsBetween(baseRev string, secondRev string) ([]string, error)

	GetName() string
}

type TokenAuth

type TokenAuth struct {
	User  string // The user to use when cloning (x-token-auth for Bitbucket, x-access-token for GitHub
	Token string
}

func (TokenAuth) AuthenticateHTTPRequest

func (auth TokenAuth) AuthenticateHTTPRequest(header header)

func (TokenAuth) AuthenticateURL

func (auth TokenAuth) AuthenticateURL(url string) string

func (TokenAuth) AuthenticateWithToken

func (auth TokenAuth) AuthenticateWithToken() *http.Client

type UserPassAuth

type UserPassAuth struct {
	Username string
	Password string
}

func (UserPassAuth) AuthenticateHTTPRequest

func (auth UserPassAuth) AuthenticateHTTPRequest(header header)

func (UserPassAuth) AuthenticateURL

func (auth UserPassAuth) AuthenticateURL(url string) string

func (UserPassAuth) AuthenticateWithToken

func (auth UserPassAuth) AuthenticateWithToken() *http.Client

Jump to

Keyboard shortcuts

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