Documentation ¶
Index ¶
- func ResolveChangeUrl(changeUrl *url.URL) (host string, changeId int64, err error)
- type Client
- func (c *Client) AbandonChange(ctx context.Context, changeNum int64) error
- func (c *Client) CheckPresubmitCompletion(ctx context.Context, changeNum int64, verifiedGerritLabel string) error
- func (c *Client) CreateChange(ctx context.Context, subject, baseCommit, ref string) (*gerritpb.ChangeInfo, error)
- func (c *Client) EditFile(ctx context.Context, changeNum int64, filepath, content string) error
- func (c *Client) GetChange(ctx context.Context, changeNum int64, opts ...gerritpb.QueryOption) (*gerritpb.ChangeInfo, error)
- func (c *Client) PresubmitPassed(ctx context.Context, changeNum int64, gerritLabel string) (bool, error)
- func (c *Client) PublishEdits(ctx context.Context, changeNum int64) error
- func (c *Client) SetLabels(ctx context.Context, changeNum int64, dryRun bool, labels map[string]int32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveChangeUrl ¶
ResolveChangeUrl resolves common change URLs for fuchsia hosts, returning a canonical gerrit host and change ID.
Note: only supports numeric change IDs, and does not support deprecated change IDs. See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id In practice however, deprecated change IDs are very unlikely to be used as inputs.
Examples:
fxr/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
tqr/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
go/fxr/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
go/tqr/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
http://go/fxr/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
fxrev.dev/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
https://fxrev.dev/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
http://go/tqr/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
https://fuchsia-review.googlesource.com/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
https://fuchsia-review.googlesource.com/<change_id>/
-> fuchsia-review.googlesource.com, <change_id>
https://turquoise-internal-review.googlesource.com/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
https://fuchsia-review.googlesource.com/c/<project>/+/<change_id>
-> fuchsia-review.googlesource.com, <change_id>
https://turquoise-internal-review.googlesource.com/c/<project>/+/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
https://turquoise-internal-review.git.corp.google.com/c/<project>/+/<change_id>
-> turquoise-internal-review.googlesource.com, <change_id>
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides utilities for interacting with a Gerrit project.
func (*Client) AbandonChange ¶
AbandonChange abandons a Gerrit change.
It succeeds if the change is already abandoned.
func (*Client) CheckPresubmitCompletion ¶
func (c *Client) CheckPresubmitCompletion(ctx context.Context, changeNum int64, verifiedGerritLabel string) error
CheckPresubmitCompletion checks if a Gerrit change's CQ label is unset or if the given Gerrit label is set to a value.
func (*Client) CreateChange ¶
func (c *Client) CreateChange(ctx context.Context, subject, baseCommit, ref string) (*gerritpb.ChangeInfo, error)
CreateChange creates an empty Gerrit change.
func (*Client) GetChange ¶
func (c *Client) GetChange(ctx context.Context, changeNum int64, opts ...gerritpb.QueryOption) (*gerritpb.ChangeInfo, error)
GetChange gets info for a Gerrit change.
func (*Client) PresubmitPassed ¶
func (c *Client) PresubmitPassed(ctx context.Context, changeNum int64, gerritLabel string) (bool, error)
PresubmitPassed returns true iff a Gerrit change's dry run was successful. Assumes that CQ has already finished.
func (*Client) PublishEdits ¶
PublishEdits publishes all pending edits on a Gerrit change.