vcsinfo

package
v0.0.0-...-dbdf344 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: BSD-3-Clause Imports: 2 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Minimum time (the epoch)
	MinTime = time.Unix(0, 0)

	// MaxTime is the maximum time we consider. It's the equivalent of approximately November 2286.
	// It is intended to be used as a value for range queries to get everything
	// after a specified start time.
	MaxTime = time.Unix(9999999999, 0)
)

Functions

This section is empty.

Types

type IndexCommit

type IndexCommit struct {
	Hash      string
	Index     int
	Timestamp time.Time
}

IndexCommit is information about a commit that includes the commit's index in the linear ancestry path obtained by following each commit's first parent backward in history. The first commit in a given branch has Index 0.

type IndexCommitSlice

type IndexCommitSlice []*IndexCommit

IndexCommitSlice represents a slice of IndexCommit objects used for sorting commits by index, then by timestamp, then by hash.

func (IndexCommitSlice) Len

func (s IndexCommitSlice) Len() int

func (IndexCommitSlice) Less

func (s IndexCommitSlice) Less(i, j int) bool

func (IndexCommitSlice) Swap

func (s IndexCommitSlice) Swap(i, j int)

type LongCommit

type LongCommit struct {
	*ShortCommit
	Parents   []string  `json:"parent"`
	Body      string    `json:"body"`
	Timestamp time.Time `json:"timestamp"`
	// Index is this Commit's index in the linear ancestry path obtained by
	// following each commit's first parent backward in history. The first
	// commit in a given branch has Index 0. This field is not set by
	// default.
	Index int `json:"-"`
	// Branches indicates which branches can reach this commit.
	Branches map[string]bool `json:"-"`
}

LongCommit gives more detailed information about a commit.

func NewLongCommit

func NewLongCommit() *LongCommit

func (*LongCommit) IndexCommit

func (c *LongCommit) IndexCommit() *IndexCommit

type LongCommitSlice

type LongCommitSlice []*LongCommit

LongCommitSlice represents a slice of LongCommit objects used for sorting commits by timestamp, most recent first.

func (LongCommitSlice) Len

func (s LongCommitSlice) Len() int

func (LongCommitSlice) Less

func (s LongCommitSlice) Less(i, j int) bool

func (LongCommitSlice) Swap

func (s LongCommitSlice) Swap(i, j int)

type ShortCommit

type ShortCommit struct {
	Hash    string `json:"hash"`
	Author  string `json:"author"`
	Subject string `json:"subject"`
}

ShortCommit stores the hash, author, and subject of a git commit.

type VCS

type VCS interface {
	// Update updates the local checkout of the repo.
	Update(ctx context.Context, pull, allBranches bool) error

	// From returns commit hashes for the time frame from 'start' to now.
	From(start time.Time) []string

	// Details returns the full commit information for the given hash.
	// If includeBranchInfo is true the Branches field of the returned
	// result will contain all branches that contain the given commit,
	// otherwise Branches will be empty.
	// Note: Retrieving the branch information can be expensive and should
	// only be used if the membership in branches is really needed.
	Details(ctx context.Context, hash string, includeBranchInfo bool) (*LongCommit, error)

	// DetailsMulti returns multiple details at once, which is a lot faster for some implementations,
	// e.g. the implementation based on BigTable where we can avoid multiple roundtrips to the database.
	DetailsMulti(ctx context.Context, hashes []string, includeBranchInfo bool) ([]*LongCommit, error)

	// LastNIndex returns the last N commits.
	LastNIndex(N int) []*IndexCommit

	// Range returns all commits from the half open interval ['begin', 'end'), i.e.
	// includes 'begin' and excludes 'end'.
	Range(begin, end time.Time) []*IndexCommit

	// IndexOf returns the index of the commit hash, where 0 is the index of the first commit.
	IndexOf(ctx context.Context, hash string) (int, error)

	// ByIndex returns a LongCommit describing the commit
	// at position N, as ordered in the current branch.
	ByIndex(ctx context.Context, N int) (*LongCommit, error)
}

VCS is a generic interface to the information contained in a version control system.

Directories

Path Synopsis
Package vcsinfo/testutils contains a set of tests to test vcsinfo.VCS implementations.
Package vcsinfo/testutils contains a set of tests to test vcsinfo.VCS implementations.

Jump to

Keyboard shortcuts

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