gerrit

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound return true if the error is the 404 Status Not Found.

Types

type Commit

type Commit struct {
	Commit string `json:"commit"`
	Author struct {
		Name  string  `json:"name"`
		Email string  `json:"email"`
		Time  GitTime `json:"time"`
	}
	Committer struct {
		Name  string  `json:"name"`
		Email string  `json:"email"`
		Time  GitTime `json:"time"`
	}
	Message string `json:"message"`
}

Commit represents a single entry in the log returned by Gitiles REST API.

type Gerrit

type Gerrit struct {
	Host *url.URL
}

Gerrit exposes the Gerrit REST API.

func NewGerrit

func NewGerrit(host *url.URL) *Gerrit

NewGerrit returns the new Gerrit instance for the given URL.

func (*Gerrit) GetLog

func (g *Gerrit) GetLog(c context.Context, ref, since string) (Log, error)

GetLog returns log for a given ref since a given commit.

func (*Gerrit) GetRefs

func (g *Gerrit) GetRefs(c context.Context, refs []string) (map[string]string, error)

GetRefs returns HEAD revision for each ref specified in refs.

func (*Gerrit) Request

func (g *Gerrit) Request(c context.Context, method, route, query string) ([]byte, error)

Request can be used to make a Gerrit REST API request.

type GitTime

type GitTime time.Time

GitTime is a date and time representation used by git log.

func (GitTime) UnmarshalJSON

func (gt GitTime) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a date and time from the input buffer.

type Log

type Log []Commit

Log is therepresentation of Git log as a sequence of commits.

func (Log) Len

func (l Log) Len() int

Len returns the length of the Git log.

func (Log) Less

func (l Log) Less(i, j int) bool

Less reutnr true if the element i is smaller than j.

func (Log) Swap

func (l Log) Swap(i, j int)

Swap swaps the two elements.

type StatusError

type StatusError struct {
	Code int
}

StatusError represents an HTTP status error.

func (StatusError) Error

func (e StatusError) Error() string

Error returns the string representation of the HTTP status error.

Jump to

Keyboard shortcuts

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