vcsapi

package
v0.0.0-...-3a364f3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 3 Imported by: 2

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)

	// FindLatestRelease finds the latest release starting from the current repo HEAD
	FindLatestRelease(stable bool) (VCSRelease, 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 CommitAuthor struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

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 CommitFile struct {
	Name string `json:"name"`
	Size int64  `json:"size"`
	Hash string `json:"hash"`
}

type VCSRef

type VCSRef struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Hash  string `json:"hash,omitempty"`
}

func NewVCSRefFromString

func NewVCSRefFromString(input string) (*VCSRef, error)

NewVCSRefFromString parses the input string and returns a VCSRef

type VCSRelease

type VCSRelease struct {
	Type    string `json:"type"`
	Value   string `json:"value"`
	Version string `json:"version"`
	Hash    string `json:"hash,omitempty"`
}

Jump to

Keyboard shortcuts

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