diff options
| author | Mike Frysinger <vapier@google.com> | 2020-03-14 17:39:03 -0400 |
|---|---|---|
| committer | David Pursehouse <dpursehouse@collab.net> | 2020-03-15 08:31:35 +0000 |
| commit | f725e548db17281037d794f18aab3320d2580865 (patch) | |
| tree | 5669eedc913551e8e53c5d11bd39ee90e972e12c | |
| parent | 4847e0574303f90438335a7c6c7c009145deb8ef (diff) | |
| download | git-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>
| -rw-r--r-- | docs/internal-fs-layout.md | 2 | ||||
| -rw-r--r-- | subcmds/upload.py | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/docs/internal-fs-layout.md b/docs/internal-fs-layout.md index 530252b1..b06e898f 100644 --- a/docs/internal-fs-layout.md +++ b/docs/internal-fs-layout.md | |||
| @@ -195,6 +195,7 @@ The `[branch]` settings are updated by `repo start` and `git branch`. | |||
| 195 | | review.\<url\>.autoupload | upload | Automatically answer "yes" or "no" to all prompts | | 195 | | review.\<url\>.autoupload | upload | Automatically answer "yes" or "no" to all prompts | |
| 196 | | review.\<url\>.uploadhashtags | upload | Automatically add to `--hashtag=<value>` | | 196 | | review.\<url\>.uploadhashtags | upload | Automatically add to `--hashtag=<value>` | |
| 197 | | review.\<url\>.uploadlabels | upload | Automatically add to `--label=<value>` | | 197 | | review.\<url\>.uploadlabels | upload | Automatically add to `--label=<value>` | |
| 198 | | review.\<url\>.uploadnotify | upload | [Notify setting][upload-notify] to use | | ||
| 198 | | review.\<url\>.uploadtopic | upload | Default [topic] to use | | 199 | | review.\<url\>.uploadtopic | upload | Default [topic] to use | |
| 199 | | review.\<url\>.username | upload | Override username with `ssh://` review URIs | | 200 | | review.\<url\>.username | upload | Override username with `ssh://` review URIs | |
| 200 | | remote.\<remote\>.fetch | sync | Set of refs to fetch | | 201 | | remote.\<remote\>.fetch | sync | Set of refs to fetch | |
| @@ -227,3 +228,4 @@ Repo will create & maintain a few files in the user's home directory. | |||
| 227 | [manifest-format.md]: ./manifest-format.md | 228 | [manifest-format.md]: ./manifest-format.md |
| 228 | [local manifests]: ./manifest-format.md#Local-Manifests | 229 | [local manifests]: ./manifest-format.md#Local-Manifests |
| 229 | [topic]: https://gerrit-review.googlesource.com/Documentation/intro-user.html#topics | 230 | [topic]: https://gerrit-review.googlesource.com/Documentation/intro-user.html#topics |
| 231 | [upload-notify]: https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify | ||
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 | |||
| 142 | or global Git option to do so. The value of review.URL.uploadlabels | 142 | or global Git option to do so. The value of review.URL.uploadlabels |
| 143 | will be used as comma delimited labels like the --label option. | 143 | will be used as comma delimited labels like the --label option. |
| 144 | 144 | ||
| 145 | review.URL.uploadnotify: | ||
| 146 | |||
| 147 | Control e-mail notifications when uploading. | ||
| 148 | https://gerrit-review.googlesource.com/Documentation/user-upload.html#notify | ||
| 149 | |||
| 145 | # References | 150 | # References |
| 146 | 151 | ||
| 147 | Gerrit Code Review: https://www.gerritcodereview.com/ | 152 | Gerrit 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, |
