vcs

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonVCS

type CommonVCS struct {
	CurrentBranch string
	CurrentCommit string
}

CommonVCS contains functions shared by all VCSs

func (CommonVCS) Branch

func (v CommonVCS) Branch() string

Branch returns the current branch

func (CommonVCS) Commit

func (v CommonVCS) Commit() string

Commit returns the current commit

type VCS

type VCS interface {
	// Identify returns true if it is the expected VCS type (based on information found in dir)
	Identify(dir string) bool
	// Name returns the name of the VCS
	Name() string
	// Branch returns the current branch
	Branch() string
	// Commit returns the current commit
	Commit() string
}

VCS represent the VersionControlSystem used

func Identify

func Identify(dir string) VCS

Identify tries to identify the actual VCS

func NewMockVcs

func NewMockVcs() VCS

NewMockVcs returns a mockVcs with default commit and branch name

func NewMockVcsWithBranch

func NewMockVcsWithBranch(branch string) VCS

NewMockVcsWithBranch returns a mockVcs with a specific branch name

Jump to

Keyboard shortcuts

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