Documentation ¶
Overview ¶
Package gerrit contains logic for interacting with Gerrit
Index ¶
- func AuthorEmail(ctx context.Context, change *gerritpb.ChangeInfo) (string, error)
- func CommitMessage(ctx context.Context, change *gerritpb.ChangeInfo) (string, error)
- func GetHost(ctx context.Context, rawReviewURL string) (string, error)
- func HasAutoRevertOffFlagSet(ctx context.Context, change *gerritpb.ChangeInfo) (bool, error)
- func HasLUCIBisectionComment(ctx context.Context, change *gerritpb.ChangeInfo) (bool, error)
- func IsOwnedByLUCIBisection(ctx context.Context, change *gerritpb.ChangeInfo) (bool, error)
- func IsRecentSubmit(ctx context.Context, change *gerritpb.ChangeInfo, maxAge time.Duration) bool
- func ServiceAccountEmail(ctx context.Context) (string, error)
- type Client
- func (c *Client) AddComment(ctx context.Context, change *gerritpb.ChangeInfo, message string) (*gerritpb.ReviewResult, error)
- func (c *Client) CommitRevert(ctx context.Context, change *gerritpb.ChangeInfo, message string, ...) (*gerritpb.ReviewResult, error)
- func (c *Client) CreateRevert(ctx context.Context, change *gerritpb.ChangeInfo, message string) (*gerritpb.ChangeInfo, error)
- func (c *Client) GetChange(ctx context.Context, project string, commitID string) (*gerritpb.ChangeInfo, error)
- func (c *Client) GetReverts(ctx context.Context, change *gerritpb.ChangeInfo) ([]*gerritpb.ChangeInfo, error)
- func (c *Client) HasDependency(ctx context.Context, change *gerritpb.ChangeInfo) (bool, error)
- func (c *Client) Host(ctx context.Context) string
- func (c *Client) RefetchChange(ctx context.Context, change *gerritpb.ChangeInfo) (*gerritpb.ChangeInfo, error)
- func (c *Client) SendForReview(ctx context.Context, change *gerritpb.ChangeInfo, message string, ...) (*gerritpb.ReviewResult, error)
- type MockedClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorEmail ¶
AuthorEmail returns the email of the author of the change's current commit.
func CommitMessage ¶
CommitMessage returns the commit message of the change
func HasAutoRevertOffFlagSet ¶
HasAutoRevertOffFlagSet returns whether the change has the flag set to true to prevent auto-revert.
func HasLUCIBisectionComment ¶
HasLUCIBisectionComment returns whether LUCI Bisection has previously commented on the change
func IsOwnedByLUCIBisection ¶
IsOwnedByLUCIBisection returns whether the change is owned by LUCI Bisection
func IsRecentSubmit ¶
IsRecentSubmit returns whether the change was submitted recently, as defined by the maximum age duration given relative to now.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client to communicate with Gerrit It wraps a gerritpb.GerritClient
func (*Client) AddComment ¶
func (c *Client) AddComment(ctx context.Context, change *gerritpb.ChangeInfo, message string) (*gerritpb.ReviewResult, error)
AddComment adds the given message as a review comment on a change
func (*Client) CommitRevert ¶
func (c *Client) CommitRevert(ctx context.Context, change *gerritpb.ChangeInfo, message string, ccEmails []string) (*gerritpb.ReviewResult, error)
CommitRevert bot-commits the revert change. The change must be a pure revert; if not, this function does not attempt to commit the change and returns an error.
func (*Client) CreateRevert ¶
func (c *Client) CreateRevert(ctx context.Context, change *gerritpb.ChangeInfo, message string) (*gerritpb.ChangeInfo, error)
CreateRevert creates a revert change in Gerrit for the specified change.
func (*Client) GetChange ¶
func (c *Client) GetChange(ctx context.Context, project string, commitID string) (*gerritpb.ChangeInfo, error)
GetChange gets the corresponding change info given the commit ID. This function returns an error if none or more than 1 changes are returned by Gerrit.
func (*Client) GetReverts ¶
func (c *Client) GetReverts(ctx context.Context, change *gerritpb.ChangeInfo) ([]*gerritpb.ChangeInfo, error)
GetReverts gets the corresponding revert(s) for the given change.
func (*Client) HasDependency ¶
HasDependency returns whether the change has another merged change depending on it
func (*Client) RefetchChange ¶
func (c *Client) RefetchChange(ctx context.Context, change *gerritpb.ChangeInfo) (*gerritpb.ChangeInfo, error)
RefetchChange queries Gerrit for the given change, and returns the latest state of the change
func (*Client) SendForReview ¶
func (c *Client) SendForReview(ctx context.Context, change *gerritpb.ChangeInfo, message string, reviewerEmails []string, ccEmails []string) (*gerritpb.ReviewResult, error)
SendForReview adds the emails as reviewers for the change, and sets the change to be ready for review
type MockedClient ¶
type MockedClient struct { Client *gerritpb.MockGerritClient Ctx context.Context }
MockedClient is a mocked Gerrit client for testing. It wraps a gerritpb.MockGerritClient and a context with the mocked client
func NewMockedClient ¶
func NewMockedClient(ctx context.Context, ctl *gomock.Controller) *MockedClient