From 5acc403e28c8aeaef7583995c1e7cd6332111973 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 3 Dec 2019 10:16:32 +0100 Subject: [PATCH] changeset: fetch SUBMITTABLE and add field to struct --- gerrit/changeset.go | 5 ++++- gerrit/client.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gerrit/changeset.go b/gerrit/changeset.go index 71310a712..0a0a607cd 100644 --- a/gerrit/changeset.go +++ b/gerrit/changeset.go @@ -16,6 +16,7 @@ type Changeset struct { Number int Verified int CodeReviewed int + Submittable bool HashTags []string CommitID string ParentCommitIDs []string @@ -31,6 +32,7 @@ func MakeChangeset(changeInfo *goGerrit.ChangeInfo) *Changeset { Number: changeInfo.Number, Verified: labelInfoToInt(changeInfo.Labels["Verified"]), CodeReviewed: labelInfoToInt(changeInfo.Labels["Code-Review"]), + Submittable: changeInfo.Submittable, HashTags: changeInfo.Hashtags, CommitID: changeInfo.CurrentRevision, // yes, this IS the commit ID. ParentCommitIDs: getParentCommitIDs(changeInfo), @@ -65,7 +67,8 @@ func (c *Changeset) IsCodeReviewed() bool { func (c *Changeset) String() string { var b bytes.Buffer b.WriteString("Changeset") - b.WriteString(fmt.Sprintf("(commitID: %.7s, author: %s, subject: %s)", c.CommitID, c.OwnerName, c.Subject)) + b.WriteString(fmt.Sprintf("(commitID: %.7s, author: %s, subject: %s, submittable: %v)", + c.CommitID, c.OwnerName, c.Subject, c.Submittable)) return b.String() } diff --git a/gerrit/client.go b/gerrit/client.go index 6197b0338..ab114471d 100644 --- a/gerrit/client.go +++ b/gerrit/client.go @@ -15,6 +15,7 @@ var additionalFields = []string{ "CURRENT_REVISION", "CURRENT_COMMIT", "DETAILED_ACCOUNTS", + "SUBMITTABLE", } // IClient defines the gerrit.Client interface