Documentation
¶
Index ¶
- type Chain
- type Changeset
- type Client
- func (c *Client) ChainIsRebasedOnHEAD(chain *Chain) bool
- func (c *Client) ChangesetIsRebasedOnHEAD(changeset *Changeset) bool
- func (c *Client) FilterChains(filter func(s *Chain) bool) []*Chain
- func (c *Client) FindFirstChain(filter func(s *Chain) bool) *Chain
- func (c *Client) GetBaseURL() string
- func (c *Client) GetBranchName() string
- func (c *Client) GetChangesetURL(changeset *Changeset) string
- func (c *Client) GetHEAD() string
- func (c *Client) GetProjectName() string
- func (c *Client) RebaseChangeset(changeset *Changeset, ref string) (*Changeset, error)
- func (c *Client) Refresh() error
- func (c *Client) SubmitChangeset(changeset *Changeset) (*Changeset, error)
- type IClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
ChangeSets []*Changeset
}
Chain represents a list of successive changesets with an unbroken parent -> child relation, starting from the parent.
func AssembleChain ¶
AssembleChain consumes a list of changesets, and groups them together to chains.
Initially, every changeset is put in its own individual chain.
we maintain a lookup table, mapLeafToChain, which allows to lookup a chain by its leaf commit id We concat chains in a fixpoint approach because both appending and prepending is much more complex. Concatenation moves changesets of the later changeset in the previous one in a cleanup phase, we remove orphaned chains (those without any changesets inside) afterwards, we do an integrity check, just to be on the safe side.
func SortChains ¶
SortChains sorts a list of chains by the number of changesets in each chain, descending
func (*Chain) AllChangesets ¶
AllChangesets applies a filter function on all of the changesets in the chain. returns true if it returns true for all changesets, false otherwise
func (*Chain) GetLeafCommitID ¶
GetLeafCommitID returns the commit id of the last commit in ChangeSets
func (*Chain) GetParentCommitIDs ¶
GetParentCommitIDs returns the parent commit IDs
type Changeset ¶
type Changeset struct { ChangeID string Number int Verified int CodeReviewed int Autosubmit int Submittable bool CommitID string ParentCommitIDs []string OwnerName string Subject string // contains filtered or unexported fields }
Changeset represents a single changeset
func FilterChangesets ¶
FilterChangesets filters a list of Changeset by a given filter function
func MakeChangeset ¶
func MakeChangeset(changeInfo *goGerrit.ChangeInfo) *Changeset
MakeChangeset creates a new Changeset object out of a goGerrit.ChangeInfo object
func (*Changeset) IsAutosubmit ¶
IsAutosubmit returns true if the changeset is intended to be automatically submitted by gerrit-queue.
This is determined by the Change Owner setting +1 on the "Autosubmit" label.
func (*Changeset) IsCodeReviewed ¶
IsCodeReviewed returns true if the changeset passed code review, that's when somebody left the Recommended (+2) on the "Code-Review" label
func (*Changeset) IsVerified ¶
IsVerified returns true if the changeset passed CI, that's when somebody left the Approved (+1) on the "Verified" label
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides some ways to interact with a gerrit instance
func NewClient ¶
func NewClient(logger *log.Logger, URL, username, password, projectName, branchName string) (*Client, error)
NewClient initializes a new gerrit client
func (*Client) ChainIsRebasedOnHEAD ¶
ChainIsRebasedOnHEAD returns true if the whole chain is rebased on the current HEAD this is already the case if the first changeset in the chain is rebased on the current HEAD
func (*Client) ChangesetIsRebasedOnHEAD ¶
ChangesetIsRebasedOnHEAD returns true if the changeset is rebased on the current HEAD
func (*Client) FilterChains ¶
FilterChains returns a subset of all chains, passing the given filter function
func (*Client) FindFirstChain ¶
FindFirstChain returns the first chain that matches the filter, or nil if none was found
func (*Client) GetBaseURL ¶
GetBaseURL returns the gerrit base URL
func (*Client) GetBranchName ¶
GetBranchName returns the configured gerrit branch name
func (*Client) GetChangesetURL ¶
GetChangesetURL returns the URL to view a given changeset
func (*Client) GetProjectName ¶
GetProjectName returns the configured gerrit project name
func (*Client) RebaseChangeset ¶
RebaseChangeset rebases a given changeset on top of a given ref
type IClient ¶
type IClient interface { Refresh() error GetHEAD() string GetBaseURL() string GetChangesetURL(changeset *Changeset) string SubmitChangeset(changeset *Changeset) (*Changeset, error) RebaseChangeset(changeset *Changeset, ref string) (*Changeset, error) ChangesetIsRebasedOnHEAD(changeset *Changeset) bool ChainIsRebasedOnHEAD(chain *Chain) bool FilterChains(filter func(s *Chain) bool) []*Chain FindFirstChain(filter func(s *Chain) bool) *Chain }
IClient defines the gerrit.Client interface