vcs

package
v0.0.0-...-1806480 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The dir which the repo clone to.
	CLONE_DIR = "/root/code"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
}

Manager manages all version control operations, like clone, cherry-pick. Based on the operations, some are handled asychronously and some are not. Asynchronous operations are time consuming and usually involve stream output to clients, like clone, fetch, etc; synchronous operations are not time consuming and usually don't have to send output, like checkout a tag, etc. The above constants define all async operations; all other operations are synchronous. Manager is also responsible for managing repository status; it knows whether a repository is healthy or not, and set repository status accordingly. synchronous.

func NewManager

func NewManager() *Manager

NewManager creates a new Manager.

func (*Manager) CheckRepoValid

func (vm *Manager) CheckRepoValid(event *api.Event) error

CheckRepoValid check whether the repo is a valid repo

func (*Manager) CheckoutTag

func (vm *Manager) CheckoutTag(service *api.Service, version *api.Version) error

CheckoutTag checkout to given tag in version.

func (*Manager) CloneVersionRepository

func (vm *Manager) CloneVersionRepository(event *api.Event) error

CloneVersionRepository clones a version's repo

func (*Manager) GetCloneDir

func (vm *Manager) GetCloneDir(service *api.Service, version *api.Version) string

GetCloneDir returns the directory where a repository should be cloned to.

func (*Manager) GetTagCommit

func (vm *Manager) GetTagCommit(service *api.Service, version *api.Version) (string, error)

GetTagCommit finds commit/revision hash of a given tag.

func (*Manager) NewTagFromLatest

func (vm *Manager) NewTagFromLatest(event *api.Event) error

NewTagFromLatest creates a new tag from latest source for a service.

type VCS

type VCS interface {

	// Ping checks if the url is a valid repository, like ping cmd on linux
	Ping(url, destPath string, event *api.Event) error

	// Clone pulls repository from url into destination path. Code base lives
	// directly under 'destPath', do not nest the code base. E.g.
	//   Clone("https://github.com/caicloud/cyclone", /tmp/xxx/yyy")
	// should clone cyclone directly under /tmp/xxx/yyy, not /tmp/xxx/yyy/cyclone/
	// You can always assume 'destPath' doesn't exist, but its parent direcotry
	// exists.
	Clone(url, destPath string, event *api.Event) error

	// NewTagFromLatest creates a new tag from latest source for a service.
	NewTagFromLatest(repoPath string, event *api.Event) error

	// CheckoutTag checkout to given tag.
	CheckoutTag(repoPath string, tag string) error

	// GetTagCommit finds commit/revision hash of a given tag.
	GetTagCommit(repoPath string, tag string) (string, error)

	// CheckOutByCommitID checks out code in repo by special commit id.
	CheckOutByCommitID(commitID string, repoPath string, event *api.Event) error
}

VCS is the interface of all operations needed for managing repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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