srcmanager

package
v0.0.0-...-b155fd7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: NCSA Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongVCS is returned when an action is tried on the wrong VCS.
	ErrWrongVCS = errors.New("Wrong VCS detected")

	// ErrCannotDetectVCS is returned when VCS cannot be detected from URI string.
	ErrCannotDetectVCS = errors.New("Cannot detect VCS")

	// ErrWrongRemote occurs when the passed in remote does not match the VCS
	// configured endpoint.
	ErrWrongRemote = errors.New("The Remote does not match the VCS endpoint")

	// ErrRevisionUnavailable happens when commit revision information is
	// unavailable.
	ErrRevisionUnavailable = errors.New("Revision unavailable")
)
View Source
var Logger *log.Logger

Logger is where you can provide a logger, implementing the log.Logger interface, where verbose output from each VCS will be written. The default logger does not log data. To log data supply your own logger or change the output location of the provided logger.

View Source
var (
	Verbose = false
)

Functions

func BumpVersion

func BumpVersion(isPublic bool) error

func Commit

func Commit(isPublic bool, message string) error

func Dirty

func Dirty(isPublic bool) error

func GoGet

func GoGet(isPublic bool) error

func NewLocalError

func NewLocalError(msg string, err error, out string) error

NewLocalError constructs a LocalError

func NewRemoteError

func NewRemoteError(msg string, err error, out string) error

NewRemoteError constructs a RemoteError

func RepositoryURLs

func RepositoryURLs(isPublic bool) ([]string, error)

func Update

func Update(isPublic bool) error

Types

type GitRepo

type GitRepo struct {
	RemoteLocation string
	Logger         *log.Logger
	// contains filtered or unexported fields
}

func NewGitRepo

func NewGitRepo(remote, local string) (*GitRepo, error)

NewGitRepo creates a new instance of GitRepo. The remote and local directories need to be passed in.

func (*GitRepo) CheckLocal

func (s *GitRepo) CheckLocal() bool

CheckLocal verifies the local location is a Git repo.

func (*GitRepo) Clone

func (s *GitRepo) Clone() error

Get is used to perform an initial clone of a repository.

func (*GitRepo) Commit

func (s *GitRepo) Commit(message string) error

Commit performs an Git commit.

func (*GitRepo) Date

func (s *GitRepo) Date() (time.Time, error)

Date retrieves the date on the latest commit.

func (*GitRepo) Init

func (s *GitRepo) Init() error

Init initializes a git repository at local location.

func (*GitRepo) IsDirty

func (s *GitRepo) IsDirty() bool

IsDirty returns if the checkout has been modified from the checked out reference.

func (*GitRepo) LocalPath

func (g *GitRepo) LocalPath() string

LocalPath retrieves the local file system location for a repo.

func (*GitRepo) Remote

func (g *GitRepo) Remote() string

Remote retrieves the remote location for a repo.

func (*GitRepo) RunFromDir

func (g *GitRepo) RunFromDir(cmd string, args ...string) ([]byte, error)

func (*GitRepo) Update

func (s *GitRepo) Update() error

Update performs an Git fetch and pull to an existing checkout.

type LocalError

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

LocalError is returned when a local operation has an error

func (*LocalError) Error

func (e *LocalError) Error() string

Error implements the Error interface

func (*LocalError) Original

func (e *LocalError) Original() error

Original retrieves the underlying implementation specific error.

func (*LocalError) Out

func (e *LocalError) Out() string

Out retrieves the output of the original command that was run.

type RemoteError

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

RemoteError is returned when an operation fails against a remote repo

func (*RemoteError) Error

func (e *RemoteError) Error() string

Error implements the Error interface

func (*RemoteError) Original

func (e *RemoteError) Original() error

Original retrieves the underlying implementation specific error.

func (*RemoteError) Out

func (e *RemoteError) Out() string

Out retrieves the output of the original command that was run.

Jump to

Keyboard shortcuts

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