Introduce --send-email flag as an alias to --send-mail for `git cl upload`
Vanilla git has a git-send-email(1) subcommand. `git cl upload` should
follow suit by using the same flag name to be consistent and avoid
confusion.
[1]: https://git-scm.com/docs/git-send-email
Bug: none
Change-Id: I47ff8e03bd11915e99804fe1695046d874efc4e0
Tested: `git cl upload --send-email` to upload this very own CL
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3854330
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 6725f4a..05714ef 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2508,8 +2508,8 @@
refspec_opts = []
# By default, new changes are started in WIP mode, and subsequent patchsets
- # don't send email. At any time, passing --send-mail will mark the change
- # ready and send email for that particular patch.
+ # don't send email. At any time, passing --send-mail or --send-email will
+ # mark the change ready and send email for that particular patch.
if options.send_mail:
refspec_opts.append('ready')
refspec_opts.append('notify=ALL')
@@ -2518,8 +2518,9 @@
else:
refspec_opts.append('notify=NONE')
- # TODO(tandrii): options.message should be posted as a comment
- # if --send-mail is set on non-initial upload as Rietveld used to do it.
+ # TODO(tandrii): options.message should be posted as a comment if
+ # --send-mail or --send-email is set on non-initial upload as Rietveld used
+ # to do it.
# Set options.title in case user was prompted in _GetTitleForUpload and
# _CMDUploadChange needs to be called again.
@@ -2609,11 +2610,11 @@
if self.GetIssue() and (reviewers or cc):
# GetIssue() is not set in case of non-squash uploads according to tests.
# TODO(crbug.com/751901): non-squash uploads in git cl should be removed.
- gerrit_util.AddReviewers(
- self.GetGerritHost(),
- self._GerritChangeIdentifier(),
- reviewers, cc,
- notify=bool(options.send_mail))
+ gerrit_util.AddReviewers(self.GetGerritHost(),
+ self._GerritChangeIdentifier(),
+ reviewers,
+ cc,
+ notify=bool(options.send_mail))
return 0
@@ -4313,7 +4314,11 @@
action='append', default=[],
help=('Gerrit hashtag for new CL; '
'can be applied multiple times'))
- parser.add_option('-s', '--send-mail', action='store_true',
+ parser.add_option('-s',
+ '--send-mail',
+ '--send-email',
+ dest='send_mail',
+ action='store_true',
help='send email to reviewer(s) and cc(s) immediately')
parser.add_option('--target_branch',
'--target-branch',
@@ -4330,10 +4335,12 @@
const='TBR', help='add a set of OWNERS to TBR')
parser.add_option('--r-owners', dest='add_owners_to', action='store_const',
const='R', help='add a set of OWNERS to R')
- parser.add_option('-c', '--use-commit-queue', action='store_true',
+ parser.add_option('-c',
+ '--use-commit-queue',
+ action='store_true',
default=False,
help='tell the CQ to commit this patchset; '
- 'implies --send-mail')
+ 'implies --send-mail')
parser.add_option('-d', '--cq-dry-run',
action='store_true', default=False,
help='Send the patchset to do a CQ dry run right after '