aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/mail.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-07-01 00:02:42 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2018-07-02 20:29:14 +0000
commit03b299b5f05180b4bd12d1de83501746dde90cc0 (patch)
tree10d78b847fa28e372ef200e38d84fc12b9090a2f /git-codereview/mail.go
parent3faf27076323fb8383c9b24e875f37a630b2f213 (diff)
downloadgo-x-review-03b299b5f05180b4bd12d1de83501746dde90cc0.tar.xz
git-codereview: add -hashtag flag to the mail command
It is now possible to mail a CL with any number of hashtags. Fixes golang/go#26149 Change-Id: I231826f95ec357bd448de12a9a5aa30e581c3bb3 Reviewed-on: https://go-review.googlesource.com/121798 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'git-codereview/mail.go')
-rw-r--r--git-codereview/mail.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/git-codereview/mail.go b/git-codereview/mail.go
index 3bea462..c96caff 100644
--- a/git-codereview/mail.go
+++ b/git-codereview/mail.go
@@ -16,18 +16,20 @@ import (
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")
- trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs")
- rList = new(stringList) // installed below
- ccList = new(stringList) // installed below
+ 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")
+ trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs")
+ rList = new(stringList) // installed below
+ ccList = new(stringList) // installed below
+ tagList = new(stringList) // installed below
)
flags.Var(rList, "r", "comma-separated list of reviewers")
flags.Var(ccList, "cc", "comma-separated list of people to CC:")
+ 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,...] [-topic topic] [-trybot] [commit]\n", os.Args[0], globalFlags)
+ fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...] [-topic topic] [-trybot] [-hashtag tag,...] [commit]\n", os.Args[0], globalFlags)
}
flags.Parse(args)
if len(flags.Args()) > 1 {
@@ -110,6 +112,15 @@ func cmdMail(args []string) {
refSpec += mailList(start, "cc", string(*ccList))
start = ","
}
+ if *tagList != "" {
+ for _, tag := range strings.Split(string(*tagList), ",") {
+ if tag == "" {
+ dief("hashtag may not contain empty tags")
+ }
+ refSpec += start + "hashtag=" + tag
+ start = ","
+ }
+ }
if *topic != "" {
// There's no way to escape the topic, but the only
// ambiguous character is ',' (though other characters