summaryrefslogtreecommitdiffstats
path: root/subcmds/upload.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-03-14 17:39:03 -0400
committerDavid Pursehouse <dpursehouse@collab.net>2020-03-15 08:31:35 +0000
commitf725e548db17281037d794f18aab3320d2580865 (patch)
tree5669eedc913551e8e53c5d11bd39ee90e972e12c /subcmds/upload.py
parent4847e0574303f90438335a7c6c7c009145deb8ef (diff)
downloadgit-repo-f725e548db17281037d794f18aab3320d2580865.tar.gz
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 <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r--subcmds/upload.py14
1 files changed, 13 insertions, 1 deletions
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
142or global Git option to do so. The value of review.URL.uploadlabels 142or global Git option to do so. The value of review.URL.uploadlabels
143will be used as comma delimited labels like the --label option. 143will be used as comma delimited labels like the --label option.
144 144
145review.URL.uploadnotify:
146
147Control e-mail notifications when uploading.
148https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify
149
145# References 150# References
146 151
147Gerrit Code Review: https://www.gerritcodereview.com/ 152Gerrit Code Review: https://www.gerritcodereview.com/
@@ -445,6 +450,13 @@ Gerrit Code Review: https://www.gerritcodereview.com/
445 'like CodeReview+1 or Verified-1' % (label,), file=sys.stderr) 450 'like CodeReview+1 or Verified-1' % (label,), file=sys.stderr)
446 sys.exit(1) 451 sys.exit(1)
447 452
453 # Handle e-mail notifications.
454 if opt.notify is False:
455 notify = 'NONE'
456 else:
457 key = 'review.%s.uploadnotify' % branch.project.remote.review
458 notify = branch.project.config.GetString(key)
459
448 destination = opt.dest_branch or branch.project.dest_branch 460 destination = opt.dest_branch or branch.project.dest_branch
449 461
450 # Make sure our local branch is not setup to track a different remote branch 462 # 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/
466 hashtags=hashtags, 478 hashtags=hashtags,
467 labels=labels, 479 labels=labels,
468 private=opt.private, 480 private=opt.private,
469 notify=None if opt.notify else 'NONE', 481 notify=notify,
470 wip=opt.wip, 482 wip=opt.wip,
471 dest_branch=destination, 483 dest_branch=destination,
472 validate_certs=opt.validate_certs, 484 validate_certs=opt.validate_certs,