vcs

package
v0.0.0-...-964918b Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) CheckoutTag

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

CheckoutTag checkout to given tag in version.

func (*Manager) CloneServiceRepository

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

CloneServiceRepository clones a service's repo and records service status accordingly.

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. It honors flag 'cloneDir' which is primarily used for testing/debugging. We use the combination of cloneDir, userID, serviceID, and versionID as repository path. As repositories come and go, we don't have to have a persistent directory structure; therefore, if version is not nil, use cloneDir/userID/versionID; otherwise, use cloneDir/userID/serviceID.

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 {
	// CloneRepo pulls repository from url into destination path. Code base lives
	// directly under 'destPath', do not nest the code base. E.g.
	//   CloneRepo("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.
	CloneRepo(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