Gerrit git cl upload: obey -s --send-mail option.
Previously, git cl upload would send email every time.
This CL changes that to send email only if -s or --send-mail is given.
R=andybons@chromium.org
BUG=612728
Review-Url: https://codereview.chromium.org/2007873002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300662 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index af8b0a8..35bd37e 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2468,6 +2468,13 @@
print('WARNING: underscores in title will be converted to spaces.')
refspec_opts.append('m=' + options.title.replace(' ', '_'))
+ if options.send_mail:
+ if not change_desc.get_reviewers():
+ DieWithError('Must specify reviewers to send email.')
+ refspec_opts.append('notify=ALL')
+ else:
+ refspec_opts.append('notify=NONE')
+
cc = self.GetCCList().split(',')
if options.cc:
cc.extend(options.cc)
@@ -2482,7 +2489,6 @@
refspec_opts.extend('r=' + email.strip()
for email in change_desc.get_reviewers())
-
refspec_suffix = ''
if refspec_opts:
refspec_suffix = '%' + ','.join(refspec_opts)