Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Check will verify that the repository type is supported by this implementation
Check() bool
// VCSType returns the version control system type (git, ...)
VCSType() string
// VCSRemote returns the primary remote (server)
VCSRemote() string
// VCSHostServer returns the host of the primary remote
VCSHostServer(remote string) string
// VCSHostType returns the type of the host
VCSHostType(server string) string
// VCSRefToInternalRef converts the reference to the internal notation used by the VCS
VCSRefToInternalRef(ref VCSRef) string
// VCSHead returns the current head of the repository (refType and refName)
VCSHead() (ref VCSRef, err error)
// GetTags returns all tags
GetTags() (tags []VCSRef)
// GetTagsByHash returns all tags of the given commit hash
GetTagsByHash(hash string) []VCSRef
// FindCommitByHash will query a commit by hash, additionally includes changes made by the commit
FindCommitByHash(hash string, includeChanges bool) (Commit, error)
// FindCommitsBetween finds all commits between two references (might need to use GetReference to get the proper ref name)
FindCommitsBetween(from *VCSRef, to *VCSRef, includeChanges bool, limit int) ([]Commit, error)
// Diff returns the diff between two references (might need to use GetReference to get the proper ref name)
Diff(from *VCSRef, to *VCSRef) ([]VCSDiff, error)
// FindLatestRelease finds the latest release starting from the current repo HEAD
FindLatestRelease(stable bool) (VCSRelease, error)
// CreateBranch creates a new local branch from the current head and checks it out
CreateBranch(branch string) error
// IsClean returns true if the repository is clean (no uncommitted changes)
IsClean() (bool, error)
// UncommittedChanges returns a list of all files with uncommitted changes
UncommittedChanges() ([]string, error)
}
Client is the common interface for all vcs repo implementations
type Commit ¶
type Commit struct {
ShortHash string `json:"hash_short"`
Hash string `json:"hash"`
Message string `json:"message"`
Description string `json:"description"`
Author CommitAuthor `json:"author"`
Committer CommitAuthor `json:"committer"`
Changes []CommitChange `json:"changes,omitempty"`
Tags []VCSRef `json:"tags"`
AuthoredAt time.Time `json:"authored_at"`
CommittedAt time.Time `json:"committed_at"`
Context map[string]string `json:"context,omitempty"`
}
type CommitAuthor ¶
type CommitChange ¶
type CommitChange struct {
Type string `json:"type"`
FileFrom CommitFile `json:"file_from"`
FileTo CommitFile `json:"file_to"`
Patch string `json:"patch"`
}
type CommitFile ¶
type VCSDiff ¶
type VCSDiff struct {
FileFrom CommitFile `json:"file_from"`
FileTo CommitFile `json:"file_to"`
Lines []VCSDiffLine `json:"lines,omitempty"`
}
type VCSDiffLine ¶
func Diff ¶
func Diff(srcContent string, dstContent string) []VCSDiffLine
Click to show internal directories.
Click to hide internal directories.