gerrit

package
v0.0.0-...-a3dce2c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2015 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package gerrit contains code to interact with Gerrit servers.

Index

Constants

This section is empty.

Variables

View Source
var NoAuth = noAuth{}

NoAuth makes requests unauthenticated.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	NumericID int64  `json:"_account_id"`
	Name      string `json:"name,omitempty"`
	Email     string `json:"email,omitempty"`
	Username  string `json:"username,omitempty"`
}

func (*AccountInfo) Equal

func (ai *AccountInfo) Equal(v *AccountInfo) bool

type ApprovalInfo

type ApprovalInfo struct {
	AccountInfo
	Value int       `json:"value"`
	Date  TimeStamp `json:"date"`
}

type Auth

type Auth interface {
	// contains filtered or unexported methods
}

Auth is a Gerrit authentication mode. The most common ones are NoAuth or BasicAuth.

func BasicAuth

func BasicAuth(username, password string) Auth

BasicAuth sends a username and password.

type ChangeInfo

type ChangeInfo struct {
	// ID is the ID of the change in the format
	// "'<project>~<branch>~<Change-Id>'", where 'project',
	// 'branch' and 'Change-Id' are URL encoded. For 'branch' the
	// refs/heads/ prefix is omitted.
	ID           string `json:"id"`
	ChangeNumber int    `json:"_number"`

	Project string `json:"project"`

	// Branch is the name of the target branch.
	// The refs/heads/ prefix is omitted.
	Branch string `json:"branch"`

	ChangeID string `json:"change_id"`

	Subject string `json:"subject"`

	// Status is the status of the change (NEW, SUBMITTED, MERGED,
	// ABANDONED, DRAFT).
	Status string `json:"status"`

	Created  TimeStamp `json:"created"`
	Updated  TimeStamp `json:"updated"`
	Mergable bool      `json:"mergable"`

	// CurrentRevision is the commit ID of the current patch set
	// of this change.  This is only set if the current revision
	// is requested or if all revisions are requested (fields
	// "CURRENT_REVISION" or "ALL_REVISIONS").
	CurrentRevision string `json:"current_revision"`

	// Revisions maps a commit ID of the patch set to a
	// RevisionInfo entity.
	//
	// Only set if the current revision is requested (in which
	// case it will only contain a key for the current revision)
	// or if all revisions are requested.
	Revisions map[string]RevisionInfo `json:"revisions"`

	// Owner is the author of the change.
	// The details are only filled in if field "DETAILED_ACCOUNTS" is requested.
	Owner *AccountInfo `json:"owner"`

	// Messages are included if field "MESSAGES" is requested.
	Messages []ChangeMessageInfo `json:"messages"`

	Labels map[string]LabelInfo `json:"labels"`

	// MoreChanges is set on the last change from QueryChanges if
	// the result set is truncated by an 'n' parameter.
	MoreChanges bool `json:"_more_changes"`
}

ChangeInfo is a Gerrit data structure. See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info

type ChangeMessageInfo

type ChangeMessageInfo struct {
	ID             string       `json:"id"`
	Author         *AccountInfo `json:"author"`
	Time           TimeStamp    `json:"date"`
	Message        string       `json:"message"`
	RevisionNumber int          `json:"_revision_number"`
}

type Client

type Client struct {

	// HTTPClient optionally specifies an HTTP client to use
	// instead of http.DefaultClient.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is a Gerrit client.

func NewClient

func NewClient(url string, auth Auth) *Client

NewClient returns a new Gerrit client with the given URL prefix and authentication mode. The url should be just the scheme and hostname. If auth is nil, a default is used, or requests are made unauthenticated.

func (*Client) QueryChanges

func (c *Client) QueryChanges(q string, opts ...QueryChangesOpt) ([]*ChangeInfo, error)

QueryChanges queries changes. The q parameter is a Gerrit search query. For the API call, see https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes For the query syntax, see https://gerrit-review.googlesource.com/Documentation/user-search.html#_search_operators

type CommitInfo

type CommitInfo struct {
	Author    GitPersonInfo `json:"author"`
	Committer GitPersonInfo `json:"committer"`
	CommitID  string        `json:"commit"`
	Subject   string        `json:"subject"`
	Message   string        `json:"message"`
}

type GitPersonInfo

type GitPersonInfo struct {
	Name     string    `json:"name"`
	Email    string    `json:"Email"`
	Date     TimeStamp `json:"date"`
	TZOffset int       `json:"tz"`
}

type LabelInfo

type LabelInfo struct {
	// Optional means the label may be set, but it’s neither
	// necessary for submission nor does it block submission if
	// set.
	Optional bool `json:"optional"`

	All []ApprovalInfo `json:"all"`
}

The LabelInfo entity contains information about a label on a change, always corresponding to the current patch set.

There are two options that control the contents of LabelInfo: LABELS and DETAILED_LABELS.

For a quick summary of the state of labels, use LABELS.

For detailed information about labels, including exact numeric votes for all users and the allowed range of votes for the current user, use DETAILED_LABELS.

type QueryChangesOpt

type QueryChangesOpt struct {
	// N is the number of results to return.
	// If 0, the 'n' parameter is not sent to Gerrit.
	N int

	// Fields are optional fields to also return.
	// Example strings include "ALL_REVISIONS", "LABELS", "MESSAGES".
	// For a complete list, see:
	// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info
	Fields []string
}

QueryChangesOpt are options for QueryChanges.

type ReviewInput

type ReviewInput struct {
	Message string         `json:"message,omitempty"`
	Labels  map[string]int `json:"labels,omitempty"`
}

type RevisionInfo

type RevisionInfo struct {
	Commit *CommitInfo `json:"commit"`
}

The RevisionInfo entity contains information about a patch set. Not all fields are returned by default. Additional fields can be obtained by adding o parameters as described at: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

type TimeStamp

type TimeStamp time.Time

func (TimeStamp) Time

func (ts TimeStamp) Time() time.Time

func (*TimeStamp) UnmarshalJSON

func (ts *TimeStamp) UnmarshalJSON(p []byte) error

Jump to

Keyboard shortcuts

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