git-codereview: hide +0 scores and +0 labels except Code-Review

Otherwise the list of reviewers is repeated for every label.
This is happening now that we have trybot labels.

Change-Id: Ie1fe0369d5944319c67fc9182ff3afbfd366687c
Reviewed-on: https://go-review.googlesource.com/4570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/git-codereview/pending.go b/git-codereview/pending.go
index deda834..94b395c 100644
--- a/git-codereview/pending.go
+++ b/git-codereview/pending.go
@@ -292,10 +292,15 @@
 						maxValue = x.Value
 					}
 				}
+				// Unless there are scores to report, do not show labels other than Code-Review.
+				// This hides Run-TryBot and TryBot-Result.
+				if minValue >= 0 && maxValue <= 0 && name != "Code-Review" {
+					continue
+				}
 				fmt.Fprintf(&buf, "\t%s:\n", name)
 				for score := maxValue; score >= minValue; score-- {
 					who := byScore[score]
-					if len(who) == 0 {
+					if len(who) == 0 || score == 0 && name != "Code-Review" {
 						continue
 					}
 					sort.Strings(who)
diff --git a/git-codereview/pending_test.go b/git-codereview/pending_test.go
index a52cdb8..f43dd36 100644
--- a/git-codereview/pending_test.go
+++ b/git-codereview/pending_test.go
@@ -426,9 +426,23 @@
 					}
 				]
 			},
+			"Trybot-Spam": {
+				"all": [
+					{
+						"_account_id": 42,
+						"name": "The Owner",
+						"value": 0
+					}
+				]
+			},
 			"Other-Label": {
 				"all": [
 					{
+						"_id": 43,
+						"name": "George Opher",
+						"value": 0
+					},
+					{
 						"_account_id": 42,
 						"name": "The Owner",
 						"value": 2