Documentation
¶
Overview ¶
Package gerrit provides library functions for interacting with the gerrit code review system.
Index ¶
- func ParseRefString(ref string) (int, int, error)
- func PresubmitTestTypes() []string
- func Push(seq runutil.Sequence, clOpts CLOpts) error
- func Reference(opts CLOpts) string
- func WriteLog(logFilePath string, cls CLList) (e error)
- type CLList
- type CLOpts
- type CLRefMap
- type Change
- func GenCL(clNumber, patchset int, project string) Change
- func GenCLWithMoreData(clNumber, patchset int, project string, presubmit PresubmitTestType, ...) Change
- func GenMultiPartCL(clNumber, patchset int, project, topic string, index, total int) Change
- func GenMultiPartCLWithMoreData(clNumber, patchset int, project, topic string, index, total int, ...) Change
- type ChangeError
- type Comment
- type Commit
- type Fetch
- type Files
- type Gerrit
- func (g *Gerrit) GetChange(changeNumber int) (*Change, error)
- func (g *Gerrit) PostReview(ref string, message string, labels map[string]string) (e error)
- func (g *Gerrit) Query(query string) (_ CLList, e error)
- func (g *Gerrit) SetTopic(cl string, opts CLOpts) (e error)
- func (g *Gerrit) Submit(changeID string) (e error)
- type Http
- type MultiPartCLInfo
- type MultiPartCLSet
- type Owner
- type PresubmitTestType
- type Review
- type Revision
- type Revisions
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRefString ¶
ParseRefString parses the cl and patchset number from the given ref string.
func PresubmitTestTypes ¶
func PresubmitTestTypes() []string
Types ¶
type CLList ¶
type CLList []Change
The following types reflect the schema Gerrit uses to represent CLs.
func NewOpenCLs ¶
NewOpenCLs returns a slice of CLLists that are "newer" relative to the previous query. A CLList is newer if one of the following condition holds: - If a CLList has only one cl, then it is newer if:
Its ref string cannot be found among the CLs from the previous query.
For example: from the previous query, we got cl 1000/1 (cl number 1000 and patchset 1). Then CLLists 1000/2 and 2000/1 are both newer.
- If a CLList has multiple CLs, then it is newer if:
It forms a "consistent" (its CLs have the same topic) and "complete" (it contains all the parts) multi-part CL set.
At least one of their ref strings cannot be found in the CLs from the previous query.
For example: from the previous query, we got cl 3001/1 which is the first part of a multi part cl set with topic "T1". Suppose the current query returns cl 3002/1 which is the second part of the same set. In this case, a CLList [3001/1 3002/1] will be returned. Then suppose in the next query, we got cl 3002/2 which is newer then 3002/1. In this case, a CLList [3001/1 3002/2] will be returned.
type CLOpts ¶
type CLOpts struct { // Autosubmit determines if the CL should be auto-submitted when it // meets the submission rules. Autosubmit bool // Branch identifies the local branch that contains the CL. Branch string // Ccs records a list of email addresses to cc on the CL. Ccs []string // Draft determines if this CL is a draft. Draft bool // Edit determines if the user should be prompted to edit the commit // message when the CL is exported to Gerrit. Edit bool // Remote identifies the Gerrit remote that this CL will be pushed to Remote string // Host identifies the Gerrit host. Host *url.URL // Presubmit determines what presubmit tests to run. Presubmit PresubmitTestType // RemoteBranch identifies the remote branch the CL pertains to. RemoteBranch string // Reviewers records a list of email addresses of CL reviewers. Reviewers []string // Topic records the CL topic. Topic string // Verify controls whether git pre-push hooks should be run before uploading. Verify bool }
CLOpts records the review options.
type Change ¶
type Change struct { // CL data. Change_id string Current_revision string Project string Topic string Revisions Revisions Owner Owner Labels map[string]map[string]interface{} // Custom labels. AutoSubmit bool MultiPart *MultiPartCLInfo PresubmitTest PresubmitTestType }
func GenCLWithMoreData ¶
func GenCLWithMoreData(clNumber, patchset int, project string, presubmit PresubmitTestType, ownerEmail string) Change
func GenMultiPartCL ¶
func (Change) OwnerEmail ¶
type ChangeError ¶
func NewChangeError ¶
func NewChangeError(cl Change, err error) *ChangeError
func (*ChangeError) Error ¶
func (ce *ChangeError) Error() string
type Gerrit ¶
type Gerrit struct {
// contains filtered or unexported fields
}
Gerrit records a hostname of a Gerrit instance.
func (*Gerrit) PostReview ¶
PostReview posts a review to the given Gerrit reference.
func (*Gerrit) Query ¶
Query returns a list of QueryResult entries matched by the given Gerrit query string from the given Gerrit instance. The result is sorted by the last update time, most recently updated to oldest updated.
See the following links for more details about Gerrit search syntax: - https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes - https://gerrit-review.googlesource.com/Documentation/user-search.html
type MultiPartCLInfo ¶
MultiPartCLInfo contains data used to process multiple cls across different projects.
type MultiPartCLSet ¶
type MultiPartCLSet struct {
// contains filtered or unexported fields
}
MultiPartCLSet represents a set of CLs that spans multiple projects.
func NewMultiPartCLSet ¶
func NewMultiPartCLSet() *MultiPartCLSet
NewMultiPartCLSet creates a new instance of MultiPartCLSet.
func (*MultiPartCLSet) AddCL ¶
func (s *MultiPartCLSet) AddCL(cl Change) error
AddCL adds a CL to the set after it passes a series of checks.
func (*MultiPartCLSet) CLs ¶
func (s *MultiPartCLSet) CLs() CLList
CLs returns a list of CLs in this set sorted by their part number.
func (*MultiPartCLSet) Complete ¶
func (s *MultiPartCLSet) Complete() bool
Complete returns whether the current set has all the cl parts it needs.
type PresubmitTestType ¶
type PresubmitTestType string
const ( PresubmitTestTypeNone PresubmitTestType = "none" PresubmitTestTypeAll PresubmitTestType = "all" )
type Review ¶
type Review struct { Message string `json:"message,omitempty"` Labels map[string]string `json:"labels,omitempty"` Comments map[string][]Comment `json:"comments,omitempty"` }
Review represents a Gerrit review. For more details, see: http://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input