vcs

package
v0.0.0-...-5d42abc Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package vcs provides helper functions for working with various repositories (e.g. git).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeCommit

func CanonicalizeCommit(title string) string

CanonicalizeCommit returns commit title that can be used when checking if a particular commit is present in a git tree. Some trees add prefixes to commit titles during backporting, so we want e.g. commit "foo bar" match "BACKPORT: foo bar".

func CheckBranch

func CheckBranch(branch string) bool

CheckBranch does a best-effort approximate check of a git branch name.

func CheckCommitHash

func CheckCommitHash(hash string) bool

func CheckRepoAddress

func CheckRepoAddress(repo string) bool

CheckRepoAddress does a best-effort approximate check of a git repo address.

func Patch

func Patch(dir string, patch []byte) error

Types

type BisectResult

type BisectResult int
const (
	BisectBad BisectResult = iota
	BisectGood
	BisectSkip
)

type Commit

type Commit struct {
	Hash   string
	Title  string
	Author string
	CC     []string
	Date   time.Time
}

type FixCommit

type FixCommit struct {
	Tag   string
	Title string
}

type Repo

type Repo interface {
	// Poll checkouts the specified repository/branch.
	// This involves fetching/resetting/cloning as necessary to recover from all possible problems.
	// Returns hash of the HEAD commit in the specified branch.
	Poll(repo, branch string) (*Commit, error)

	// CheckoutBranch checkouts the specified repository/branch.
	CheckoutBranch(repo, branch string) (*Commit, error)

	// CheckoutCommit checkouts the specified repository on the specified commit.
	CheckoutCommit(repo, commit string) (*Commit, error)

	// SwitchCommit checkouts the specified commit without fetching.
	SwitchCommit(commit string) (*Commit, error)

	// HeadCommit returns info about the HEAD commit of the current branch of git repository.
	HeadCommit() (*Commit, error)

	// ListRecentCommits returns list of recent commit titles starting from baseCommit.
	ListRecentCommits(baseCommit string) ([]string, error)

	// ExtractFixTagsFromCommits extracts fixing tags for bugs from git log.
	// Given email = "user@domain.com", it searches for tags of the form "user+tag@domain.com"
	// and return pairs {tag, commit title}.
	ExtractFixTagsFromCommits(baseCommit, email string) ([]FixCommit, error)

	// PreviousReleaseTags returns list of preceding release tags that are reachable from the given commit.
	PreviousReleaseTags(commit string) ([]string, error)

	// Bisect bisects good..bad commit range against the provided predicate (wrapper around git bisect).
	// The predicate should return an error only if there is no way to proceed
	// (it will abort the process), if possible it should prefer to return BisectSkip.
	// Progress of the process is streamed to the provided trace.
	// Returns the first commit on which the predicate returns BisectBad.
	Bisect(bad, good string, trace io.Writer, pred func() (BisectResult, error)) (*Commit, error)
}

func NewRepo

func NewRepo(os, vm, dir string) (Repo, error)

func NewSyzkallerRepo

func NewSyzkallerRepo(dir string) Repo

Jump to

Keyboard shortcuts

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