gerrit

package
v0.0.0-...-453582f Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Number           int           `json:"_number"`
	AttentionSet     struct{}      `json:"attention_set"`
	Branch           string        `json:"branch"`
	ChangeID         string        `json:"change_id"`
	Created          string        `json:"created"`
	Deletions        int           `json:"deletions"`
	HasReviewStarted bool          `json:"has_review_started"`
	Hashtags         []interface{} `json:"hashtags"`
	ID               string        `json:"id"`
	Insertions       int           `json:"insertions"`
	Mergeable        bool          `json:"mergeable"`
	MetaRevID        string        `json:"meta_rev_id"`
	WorkInProgress   bool          `json:"work_in_progress"`
	Private          bool          `json:"is_private"`
	Owner            struct {
		AccountID int `json:"_account_id"`
	} `json:"owner"`
	Project      string        `json:"project"`
	Requirements []interface{} `json:"requirements"`
	Status       string        `json:"status"`
	Subject      string        `json:"subject"`
	Revisions    map[string]struct {
		Number  int    `json:"_number"`
		Created string `json:"created"`
		Fetch   struct {
			AnonymousHTTP struct {
				Ref string `json:"ref"`
				URL string `json:"url"`
			} `json:"anonymous http"`
		} `json:"fetch"`
		Kind     string `json:"kind"`
		Ref      string `json:"ref"`
		Uploader struct {
			AccountID int `json:"_account_id"`
		} `json:"uploader"`
	} `json:"revisions"`
	SubmitRecords []struct {
		Labels []struct {
			AppliedBy struct {
				AccountID int `json:"_account_id"`
			} `json:"applied_by,omitempty"`
			Label  string `json:"label"`
			Status string `json:"status"`
		} `json:"labels"`
		RuleName string `json:"rule_name"`
		Status   string `json:"status"`
	} `json:"submit_records"`
	SubmitType             string `json:"submit_type"`
	TotalCommentCount      int    `json:"total_comment_count"`
	UnresolvedCommentCount int    `json:"unresolved_comment_count"`
	Updated                string `json:"updated"`
	Labels                 map[string]struct {
		All []struct {
			AccountID string `json:"account_id"`
			Value     int    `json:"value"`
		} `json:"all"`
	} `json:"labels"`
	Messages        []Message `json:"messages"`
	CurrentRevision string    `json:"current_revision"`
}

Change is a descriptor for a gerrit patch.

func (Change) LabelCount

func (c Change) LabelCount(name string, value int) int

LabelCount counts the number of labels with specific value (eg. Verified=+1).

func (Change) LabelMax

func (c Change) LabelMax(name string) int

LabelMax finds the maximum value of a label (eg. what is the highest Verified label?)

func (Change) LabelMin

func (c Change) LabelMin(name string) int

LabelMin finds the minimum value of a label (eg. what is the lowest Code-Review feedback?)

type Changes

type Changes []Change

Changes a list of gerrit patches.

type Client

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

Client is a Gerrit Rest client.

func NewClient

func NewClient(log *zap.Logger, user, token string) Client

NewClient creates a new Gerrit REST client.

func (*Client) AddReview

func (g *Client) AddReview(ctx context.Context, changesetID string, revision string, comment string, tag string) error

AddReview adds a new review (comment + vote) to a change.

func (*Client) GetChange

func (g *Client) GetChange(ctx context.Context, change string) (Change, error)

GetChange returns with one change based on identifier.

func (*Client) GetCommit

func (g *Client) GetCommit(ctx context.Context, changesetID string, commit string) (Commit, error)

GetCommit retrieves the commit of a gerrit patch.

func (*Client) GetContent

func (g *Client) GetContent(ctx context.Context, project string, ref string, file string) (string, error)

GetContent returns with a specific version of a file.

func (*Client) QueryChanges

func (g *Client) QueryChanges(ctx context.Context, condition string) (Changes, error)

QueryChanges search for changes based on search expression.

type Commit

type Commit struct {
	Subject string `json:"subject"`
	Message string `json:"message"`
}

Commit represents a commit.

type Message

type Message struct {
	ID             string `json:"id"`
	Tag            string `json:"tag"`
	Message        string `json:"message"`
	RevisionNumber int    `json:"_revision_number"`
}

Message is a comment added to review (eg. build started...).

type ReviewInput

type ReviewInput struct {
	Message string `json:"message"`
	Tag     string `json:"tag"`
}

ReviewInput is a REST request for adding reviews.

Jump to

Keyboard shortcuts

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