about summary refs log tree commit diff
path: root/gerrit
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit')
-rw-r--r--gerrit/changeset.go20
-rw-r--r--gerrit/client.go16
2 files changed, 9 insertions, 27 deletions
diff --git a/gerrit/changeset.go b/gerrit/changeset.go
index 0a0a607cd611..f71032a567cb 100644
--- a/gerrit/changeset.go
+++ b/gerrit/changeset.go
@@ -16,8 +16,8 @@ type Changeset struct {
 	Number          int
 	Verified        int
 	CodeReviewed    int
+	Autosubmit      int
 	Submittable     bool
-	HashTags        []string
 	CommitID        string
 	ParentCommitIDs []string
 	OwnerName       string
@@ -32,8 +32,8 @@ func MakeChangeset(changeInfo *goGerrit.ChangeInfo) *Changeset {
 		Number:          changeInfo.Number,
 		Verified:        labelInfoToInt(changeInfo.Labels["Verified"]),
 		CodeReviewed:    labelInfoToInt(changeInfo.Labels["Code-Review"]),
+		Autosubmit:      labelInfoToInt(changeInfo.Labels["Autosubmit"]),
 		Submittable:     changeInfo.Submittable,
-		HashTags:        changeInfo.Hashtags,
 		CommitID:        changeInfo.CurrentRevision, // yes, this IS the commit ID.
 		ParentCommitIDs: getParentCommitIDs(changeInfo),
 		OwnerName:       changeInfo.Owner.Name,
@@ -41,15 +41,13 @@ func MakeChangeset(changeInfo *goGerrit.ChangeInfo) *Changeset {
 	}
 }
 
-// HasTag returns true if a Changeset has the given tag.
-func (c *Changeset) HasTag(tag string) bool {
-	hashTags := c.HashTags
-	for _, hashTag := range hashTags {
-		if hashTag == tag {
-			return true
-		}
-	}
-	return false
+// 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 (c *Changeset) IsAutosubmit() bool {
+	return c.Autosubmit == 1
 }
 
 // IsVerified returns true if the changeset passed CI,
diff --git a/gerrit/client.go b/gerrit/client.go
index 415871d4761e..314f97281c7e 100644
--- a/gerrit/client.go
+++ b/gerrit/client.go
@@ -26,7 +26,6 @@ type IClient interface {
 	GetChangesetURL(changeset *Changeset) string
 	SubmitChangeset(changeset *Changeset) (*Changeset, error)
 	RebaseChangeset(changeset *Changeset, ref string) (*Changeset, error)
-	RemoveTag(changeset *Changeset, tag string) (*Changeset, error)
 	ChangesetIsRebasedOnHEAD(changeset *Changeset) bool
 	SerieIsRebasedOnHEAD(serie *Serie) bool
 	FilterSeries(filter func(s *Serie) bool) []*Serie
@@ -161,21 +160,6 @@ func (c *Client) RebaseChangeset(changeset *Changeset, ref string) (*Changeset,
 	return c.fetchChangeset(changeInfo.ChangeID)
 }
 
-// RemoveTag removes the submit queue tag from a changeset and updates gerrit
-// we never add, that's something users should do in the GUI.
-func (c *Client) RemoveTag(changeset *Changeset, tag string) (*Changeset, error) {
-	hashTags := changeset.HashTags
-	newHashTags := []string{}
-	for _, hashTag := range hashTags {
-		if hashTag != tag {
-			newHashTags = append(newHashTags, hashTag)
-		}
-	}
-	// TODO: implement setting hashtags api in go-gerrit and use here
-	// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-hashtags
-	return changeset, nil
-}
-
 // GetBaseURL returns the gerrit base URL
 func (c *Client) GetBaseURL() string {
 	return c.baseURL