From a897dc9c03c577746ba0a4033dc61f3e5983f3e2 Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Fri, 16 Sep 2022 11:17:40 -0400 Subject: [PATCH] git-codereview: add -autosubmit Add a flag to set the Auto-Submit label. For golang/go#48021. Change-Id: If704e8b5e9e0e2521eed78fe28af10d3c31ec3a0 Reviewed-on: https://go-review.googlesource.com/c/review/+/431375 Auto-Submit: Heschi Kreinick TryBot-Result: Gopher Robot Reviewed-by: Russ Cox Run-TryBot: Heschi Kreinick --- git-codereview/doc.go | 6 ++++-- git-codereview/mail.go | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/git-codereview/doc.go b/git-codereview/doc.go index 0f091ee..4be0c0d 100644 --- a/git-codereview/doc.go +++ b/git-codereview/doc.go @@ -218,8 +218,8 @@ It is run by the shell scripts installed by the “git codereview hooks” comma The mail command starts the code review process for the pending change. git codereview mail [-r email,...] [-cc email,...] - [-diff] [-f] [-hashtag tag,...] [-nokeycheck] - [-topic topic] [-trybot] [-wip] + [-autosubmit] [-diff] [-f] [-hashtag tag,...] + [-nokeycheck] [-topic topic] [-trybot] [-wip] [revision] It pushes the pending change commit in the current branch to the Gerrit code @@ -257,6 +257,8 @@ is needed is when checking in test cases for cryptography libraries.) The -trybot flag sets a Run-TryBot+1 vote on any uploaded changes. The Go project uses this vote to start running integration tests on the CL. +The -autosubmit flag sets a Auto-Submit+1 vote on any uploaded changes. + The -wip flag marks any uploaded changes as work-in-progress. The mail command updates the tag .mailed to refer to the diff --git a/git-codereview/mail.go b/git-codereview/mail.go index f8e6485..c9bb567 100644 --- a/git-codereview/mail.go +++ b/git-codereview/mail.go @@ -27,6 +27,7 @@ func cmdMail(args []string) { trybot = flags.Bool("trybot", false, "run trybots on the uploaded CLs") wip = flags.Bool("wip", false, "set the status of a change to Work-in-Progress") noverify = flags.Bool("no-verify", false, "disable presubmits") + autoSubmit = flags.Bool("autosubmit", false, "set autosubmit on the uploaded CLs") ) flags.Var(rList, "r", "comma-separated list of reviewers") flags.Var(ccList, "cc", "comma-separated list of people to CC:") @@ -35,8 +36,9 @@ func cmdMail(args []string) { flags.Usage = func() { fmt.Fprintf(stderr(), "Usage: %s mail %s [-r reviewer,...] [-cc mail,...]\n"+ - "\t[-f] [-diff] [-hashtag tag,...] [-nokeycheck] [-topic topic]\n"+ - "\t[-trybot] [-wip] [commit]\n", progName, globalFlags) + "\t[-autosubmit] [-f] [-diff] [-hashtag tag,...]\n"+ + "\t[-nokeycheck] [-topic topic] [-trybot] [-wip]\n"+ + "\t[commit]\n", progName, globalFlags) exit(2) } flags.Parse(args) @@ -147,6 +149,9 @@ func cmdMail(args []string) { refSpec += start + "wip" start = "," } + if *autoSubmit { + refSpec += start + "l=Auto-Submit" + } args = []string{"push", "-q"} if *noKeyCheck { args = append(args, "-o", "nokeycheck")