Documentation ¶
Overview ¶
Package client implements a client that can handle multiple gerrit instances derived from https://github.com/andygrunwald/go-gerrit
Package client implements client that interacts with gerrit instances
Index ¶
- Constants
- func ChangedFilesProvider(changeInfo *ChangeInfo) config.ChangedFilesProvider
- type ChangeInfo
- type Client
- func (c *Client) Account(instance string) (*gerrit.AccountInfo, error)
- func (c *Client) ApplyGlobalConfig(orgRepoConfigGetter func() *config.GerritOrgRepoConfigs, ...)
- func (c *Client) Authenticate(cookiefilePath, tokenPath string)
- func (c *Client) ChangeExist(instance, id string) (bool, error)
- func (c *Client) GetBranchRevision(instance, project, branch string) (string, error)
- func (c *Client) GetChange(instance, id string, addtionalFields ...string) (*ChangeInfo, error)
- func (c *Client) GetMergeableInfo(instance, changeID, revisionID string) (*gerrit.MergeableInfo, error)
- func (c *Client) HasRelatedChanges(instance, id, revision string) (bool, error)
- func (c *Client) QueryChanges(lastState LastSyncState, rateLimit int) map[string][]ChangeInfo
- func (c *Client) QueryChangesForInstance(instance string, lastState LastSyncState, rateLimit int) []ChangeInfo
- func (c *Client) QueryChangesForProject(instance, project string, lastUpdate time.Time, rateLimit int, ...) ([]ChangeInfo, error)
- func (c *Client) SetReview(instance, id, revision, message string, labels map[string]string) error
- func (c *Client) SubmitChange(instance, id string, wait bool) (*ChangeInfo, error)
- func (c *Client) UpdateClients(instances map[string]map[string]*config.GerritQueryFilter) error
- type FileInfo
- type LastSyncState
- type RevisionInfo
- type SyncTime
Constants ¶
const ( // CodeReview is the default (soon to be removed) gerrit code review label CodeReview = "Code-Review" // Merged status indicates a Gerrit change has been merged Merged = "MERGED" // New status indicates a Gerrit change is new (ie pending) New = "NEW" // ReadyForReviewMessage are the messages for a Gerrit change if it's changed // from Draft to Active. // This message will be sent if users press the `MARK AS ACTIVE` button. ReadyForReviewMessageFixed = "Set Ready For Review" // This message will be sent if users press the `SEND AND START REVIEW` button. ReadyForReviewMessageCustomizable = "This change is ready for review." ResultError = "ERROR" ResultSuccess = "SUCCESS" )
Variables ¶
This section is empty.
Functions ¶
func ChangedFilesProvider ¶
func ChangedFilesProvider(changeInfo *ChangeInfo) config.ChangedFilesProvider
ChangedFilesProvider lists (in lexicographic order) the files changed as part of a Gerrit patchset. It includes the original paths of renamed files.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds a instance:handler map
func NewClient ¶
func NewClient(instances map[string]map[string]*config.GerritQueryFilter, maxQPS, maxBurst int) (*Client, error)
NewClient returns a new gerrit client
func (*Client) Account ¶
func (c *Client) Account(instance string) (*gerrit.AccountInfo, error)
Account returns gerrit account for the given instance
func (*Client) ApplyGlobalConfig ¶
func (c *Client) ApplyGlobalConfig(orgRepoConfigGetter func() *config.GerritOrgRepoConfigs, lastSyncTracker *SyncTime, cookiefilePath, tokenPathOverride string, additionalFunc func())
func (*Client) Authenticate ¶
Authenticate client calls using the specified file. Periodically re-reads the file to check for an updated value. cookiefilePath takes precedence over tokenPath if both are set.
func (*Client) GetBranchRevision ¶
GetBranchRevision returns SHA of HEAD of a branch
func (*Client) GetChange ¶
func (c *Client) GetChange(instance, id string, addtionalFields ...string) (*ChangeInfo, error)
func (*Client) GetMergeableInfo ¶
func (c *Client) GetMergeableInfo(instance, changeID, revisionID string) (*gerrit.MergeableInfo, error)
func (*Client) HasRelatedChanges ¶
HasRelatedChanges determines if the specified change is part of a chain. In other words, it determines if this change depends on any other changes or if any other changes depend on this change.
func (*Client) QueryChanges ¶
func (c *Client) QueryChanges(lastState LastSyncState, rateLimit int) map[string][]ChangeInfo
QueryChanges queries for all changes from all projects after lastUpdate time returns an instance:changes map
func (*Client) QueryChangesForInstance ¶
func (c *Client) QueryChangesForInstance(instance string, lastState LastSyncState, rateLimit int) []ChangeInfo
func (*Client) QueryChangesForProject ¶
func (c *Client) QueryChangesForProject(instance, project string, lastUpdate time.Time, rateLimit int, additionalFilters ...string) ([]ChangeInfo, error)
QueryChangesForProject queries change for a project.
Important: this method does not update LastSyncState as it is per instance based. It doesn't make sense to update the state as this method has no idea whether all other projects have been queries or not yet. So caller of this method is responsible for making sure that LastSyncState is up-to-date, if the lastUpdate time is used by caller.
func (*Client) SubmitChange ¶
func (c *Client) SubmitChange(instance, id string, wait bool) (*ChangeInfo, error)
func (*Client) UpdateClients ¶
UpdateClients update gerrit clients with new instances map
type LastSyncState ¶
Map from instance name to repos to lastsync time for that repo
func (LastSyncState) DeepCopy ¶
func (l LastSyncState) DeepCopy() LastSyncState