git-codereview: add mail -trust to set Trust+1 vote
The expectation is that approvers will change their .gitconfig
to define mail as codereview mail -trust.
For golang/go#40699.
Change-Id: I2a1040bf3f1c7248e9c361e1f2a83c17870b1df5
Reviewed-on: https://go-review.googlesource.com/c/review/+/254421
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/git-codereview/mail.go b/git-codereview/mail.go
index 52ef44a..1fe35e5 100644
--- a/git-codereview/mail.go
+++ b/git-codereview/mail.go
@@ -21,6 +21,7 @@
wip = flags.Bool("wip", false, "set the status of a change to Work-in-Progress")
topic = flags.String("topic", "", "set Gerrit topic")
trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs")
+ trust = flags.Bool("trust", false, "add a Trust+1 vote to the CL")
rList = new(stringList) // installed below
ccList = new(stringList) // installed below
tagList = new(stringList) // installed below
@@ -31,7 +32,7 @@
flags.Var(tagList, "hashtag", "comma-separated list of tags to set")
flags.Usage = func() {
- fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-nokeycheck] [-topic topic] [-trybot] [-wip] [commit]\n", os.Args[0], globalFlags)
+ fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-f] [-diff] [-hashtag tag,...] [-nokeycheck] [-topic topic] [-trust] [-trybot] [-wip] [commit]\n", os.Args[0], globalFlags)
}
flags.Parse(args)
if len(flags.Args()) > 1 {
@@ -45,7 +46,7 @@
if len(flags.Args()) == 1 {
c = b.CommitByRev("mail", flags.Arg(0))
} else {
- c = b.DefaultCommit("mail", "must specify commit on command line or use mail HEAD for everything")
+ c = b.DefaultCommit("mail", "must specify commit on command line; use HEAD to mail all pending changes")
}
if *diff {
@@ -133,6 +134,10 @@
refSpec += start + "topic=" + *topic
start = ","
}
+ if *trust {
+ refSpec += start + "l=Trust"
+ start = ","
+ }
if *trybot {
refSpec += start + "l=Run-TryBot"
start = ","
diff --git a/git-codereview/submit.go b/git-codereview/submit.go
index bff713d..1f6f25f 100644
--- a/git-codereview/submit.go
+++ b/git-codereview/submit.go
@@ -99,7 +99,7 @@
if c.Hash != g.CurrentRevision {
run("git", "push", "-q", "origin", b.PushSpec(c))
- // Refetch change information, especially mergeable.
+ // Refetch change information.
g, err = b.GerritChange(c, "LABELS", "CURRENT_REVISION")
if err != nil {
dief("%v", err)