repo

package
v0.0.0-...-c9cfaf6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package repo provides access to git repository metadata.

Index

Constants

View Source
const GoURL = "https://go.googlesource.com/go"

GoURL is the URL for the canonical Go git repository.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitIterator

type CommitIterator interface {
	// Next returns the next commit, or io.EOF when done.
	Next() (*entity.Commit, error)
	Close()
}

CommitIterator provides iterative access to a sequence of commits.

func CommitsIterator

func CommitsIterator(commits []*entity.Commit) CommitIterator

CommitsIterator builds a commit iterator for a slice.

func FirstParent

func FirstParent(commits CommitIterator) CommitIterator

FirstParent filters the given commit sequence by only following the first parent at merge commits.

type Git

type Git struct {
	// contains filtered or unexported fields
}

Git is a cloned local git repository.

func Clone

func Clone(ctx context.Context, url string) (*Git, error)

Clone a repository to a temporary directory.

func (*Git) Close

func (g *Git) Close() error

Close deletes the cloned repository.

func (*Git) Log

func (g *Git) Log() (CommitIterator, error)

Log is equivalent to "git log".

type Repository

type Repository interface {
	Revisions
	Log(ctx context.Context, ref string) ([]*entity.Commit, error)
}

Repository provides access to git repository properties.

func Go

func Go(c *http.Client) Repository

Go builds a Repository implementation for the go git repository. API calls are made with the provided HTTP client.

func NewCompositeRepository

func NewCompositeRepository(rs ...Repository) Repository

NewCompositeRepository builds a Repository backed by one or more Repository implementations. Each method is implemented by calling each sub-Repository in turn and returning the first successful result. Panics if no Repositories are provided.

func NewGithub

func NewGithub(c *github.Client, owner, repo string) Repository

func NewGithubGo

func NewGithubGo(c *http.Client) Repository

NewGithubGo builds a Repository implementation for the github mirror of the Go git repository at https://github.com/golang/go.

func NewGitiles

func NewGitiles(c *gitiles.Client, repo string) Repository

func NewGitilesGo

func NewGitilesGo(c *http.Client) Repository

NewGitilesGo builds a Repository implementation for the canonical Go git repository at https://go.googlesource.com/go/.

type Revisions

type Revisions interface {
	Revision(ctx context.Context, ref string) (*entity.Commit, error)
}

Revisions provides query access to repository revisions.

func NewRevisionsCache

func NewRevisionsCache(r Revisions, maxentries int) Revisions

NewRevisionsCache provides an in-memory cache in front of another Revisions fetcher.

func NewRevisionsFromDatabase

func NewRevisionsFromDatabase(d *db.DB) Revisions

NewRevisionsFromDatabase looks up revision information from a database. Only supports full SHA git refs.

Jump to

Keyboard shortcuts

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