From f725e548db17281037d794f18aab3320d2580865 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 14 Mar 2020 17:39:03 -0400 Subject: upload: add config setting for upload notifications This allows people to set default e-mail notifications via gitconfig. Bug: https://crbug.com/gerrit/12451 Change-Id: Ic04ea3b7df0c5603c491961112c5be8cabb9dddd Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259014 Tested-by: Mike Frysinger Reviewed-by: David Pursehouse --- subcmds/upload.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'subcmds/upload.py') diff --git a/subcmds/upload.py b/subcmds/upload.py index 9c4337dc..cf3c8a9f 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -142,6 +142,11 @@ To add labels whenever uploading a commit, you can set a per-project or global Git option to do so. The value of review.URL.uploadlabels will be used as comma delimited labels like the --label option. +review.URL.uploadnotify: + +Control e-mail notifications when uploading. +https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify + # References Gerrit Code Review: https://www.gerritcodereview.com/ @@ -445,6 +450,13 @@ Gerrit Code Review: https://www.gerritcodereview.com/ 'like CodeReview+1 or Verified-1' % (label,), file=sys.stderr) sys.exit(1) + # Handle e-mail notifications. + if opt.notify is False: + notify = 'NONE' + else: + key = 'review.%s.uploadnotify' % branch.project.remote.review + notify = branch.project.config.GetString(key) + destination = opt.dest_branch or branch.project.dest_branch # Make sure our local branch is not setup to track a different remote branch @@ -466,7 +478,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ hashtags=hashtags, labels=labels, private=opt.private, - notify=None if opt.notify else 'NONE', + notify=notify, wip=opt.wip, dest_branch=destination, validate_certs=opt.validate_certs, -- cgit v1.2.3-54-g00ecf