diff options
| author | Russ Cox <rsc@golang.org> | 2021-02-17 10:23:46 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2021-02-23 10:45:24 +0000 |
| commit | 2465c8e799238385f42c2e82d9f37a301cb066d0 (patch) | |
| tree | f52beb0e04f63ba404daa44f7577dc501ff0423c /git-codereview/api.go | |
| parent | 19899311a872616f0eb00d6eadccc1109d9047d3 (diff) | |
| download | go-x-review-2465c8e799238385f42c2e82d9f37a301cb066d0.tar.xz | |
git-codereview: pending: show unresolved comment count
Also fix a potential crash parsing a commit with no parents.
Change-Id: I1c289dde45230a3362f54037ea18023278b05ffd
Reviewed-on: https://go-review.googlesource.com/c/review/+/294129
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'git-codereview/api.go')
| -rw-r--r-- | git-codereview/api.go | 83 |
1 files changed, 65 insertions, 18 deletions
diff --git a/git-codereview/api.go b/git-codereview/api.go index afd421f..2adbcce 100644 --- a/git-codereview/api.go +++ b/git-codereview/api.go @@ -372,24 +372,26 @@ func readGerritChangesBatch(query string, n int, ch chan gerritChangeResult) { ch <- gerritChangeResult{c, err} } -// GerritChange is the JSON struct returned by a Gerrit CL query. +// GerritChange is the JSON struct for a Gerrit ChangeInfo, returned by a Gerrit CL query. type GerritChange struct { - ID string - Project string - Branch string - ChangeId string `json:"change_id"` - Subject string - Status string - Created string - Updated string - Insertions int - Deletions int - Number int `json:"_number"` - Owner *GerritAccount - Labels map[string]*GerritLabel - CurrentRevision string `json:"current_revision"` - Revisions map[string]*GerritRevision - Messages []*GerritMessage + ID string + Project string + Branch string + ChangeId string `json:"change_id"` + Subject string + Status string + Created string + Updated string + Insertions int + Deletions int + Number int `json:"_number"` + Owner *GerritAccount + Labels map[string]*GerritLabel + CurrentRevision string `json:"current_revision"` + Revisions map[string]*GerritRevision + Messages []*GerritMessage + TotalCommentCount int `json:"total_comment_count"` + UnresolvedCommentCount int `json:"unresolved_comment_count"` } // LabelNames returns the label names for the change, in lexicographic order. @@ -441,8 +443,53 @@ type GerritRevision struct { Fetch map[string]*GerritFetch } -// GerritFetch is the JSON struct for a Gerrit FetchInfo +// GerritFetch is the JSON struct for a Gerrit FetchInfo. type GerritFetch struct { URL string Ref string } + +// GerritComment is the JSON struct for a Gerrit CommentInfo. +type GerritComment struct { + PatchSet string `json:"patch_set"` + ID string + Path string + Side string + Parent string + Line string + Range *GerritCommentRange + InReplyTo string + Message string + Updated string + Author *GerritAccount + Tag string + Unresolved bool + ChangeMessageID string `json:"change_message_id"` + CommitID string `json:"commit_id"` // SHA1 hex +} + +// GerritCommentRange is the JSON struct for a Gerrit CommentRange. +type GerritCommentRange struct { + StartLine int `json:"start_line"` // 1-based + StartCharacter int `json:"start_character"` // 0-based + EndLine int `json:"end_line"` // 1-based + EndCharacter int `json:"end_character"` // 0-based +} + +// GerritContextLine is the JSON struct for a Gerrit ContextLine. +type GerritContextLine struct { + LineNumber int `json:"line_number"` // 1-based + ContextLine string `json:"context_line"` +} + +// GerritCommentInput is the JSON struct for a Gerrit CommentInput. +type GerritCommentInput struct { + ID string `json:"id,omitempty"` // ID of a draft comment to update + Path string `json:"path,omitempty"` // file to attach comment to + Side string `json:"side,omitempty"` // REVISION (default) or PARENT + Line int `json:"line,omitempty"` // 0 to use range (or else file comment) + Range *GerritCommentRange `json:"range,omitempty"` + InReplyTo string `json:"in_reply_to,omitempty"` // ID of comment being replied to + Message string `json:"message,omitempty"` + Unresolved *bool `json:"unresolved,omitempty"` // defaults to parent setting or else false +} |
