aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/mail.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-02-19 13:44:07 -0500
committerAustin Clements <austin@google.com>2015-02-20 16:38:41 +0000
commite3f1567550df648e711580c5adbe419db9610c5c (patch)
tree922eadb62fb2057a8c6efed5d9bb2c9ae8887109 /git-codereview/mail.go
parent252b9e1cb3400a0b48bc38048848732752c6dfb1 (diff)
downloadgo-x-review-e3f1567550df648e711580c5adbe419db9610c5c.tar.xz
git-codereview: add mail -topic support
This adds a "-topic" flag to the mail subcommand that sets the Gerrit topic for the pushed changes. Gerrit topics make it easier to group related changes such as in a multi-change review. Note that, like reviewers, the topic is sticky, so it is only necessary to use mail -topic once for a given change. Change-Id: I30cf9a88092cc9270b4643d432dec7e5f967b922 Reviewed-on: https://go-review.googlesource.com/5301 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'git-codereview/mail.go')
-rw-r--r--git-codereview/mail.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/git-codereview/mail.go b/git-codereview/mail.go
index 3eabd47..3e63203 100644
--- a/git-codereview/mail.go
+++ b/git-codereview/mail.go
@@ -16,6 +16,7 @@ func cmdMail(args []string) {
var (
diff = flags.Bool("diff", false, "show change commit diff and don't upload or mail")
force = flags.Bool("f", false, "mail even if there are staged changes")
+ topic = flags.String("topic", "", "set Gerrit topic")
rList = new(stringList) // installed below
ccList = new(stringList) // installed below
)
@@ -23,7 +24,7 @@ func cmdMail(args []string) {
flags.Var(ccList, "cc", "comma-separated list of people to CC:")
flags.Usage = func() {
- fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [commit-hash]\n", os.Args[0], globalFlags)
+ fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-topic topic] [commit-hash]\n", os.Args[0], globalFlags)
}
flags.Parse(args)
if len(flags.Args()) > 1 {
@@ -61,6 +62,16 @@ func cmdMail(args []string) {
}
if *ccList != "" {
refSpec += mailList(start, "cc", string(*ccList))
+ start = ","
+ }
+ if *topic != "" {
+ // There's no way to escape the topic, but the only
+ // ambiguous character is ',' (though other characters
+ // like ' ' will be rejected outright by git).
+ if strings.Contains(*topic, ",") {
+ dief("topic may not contain a comma")
+ }
+ refSpec += start + "topic=" + *topic
}
run("git", "push", "-q", "origin", refSpec)