summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-10-31 13:48:01 -0700
committerVadim Bendebury <vbendeb@google.com>2018-11-05 14:01:05 -0800
commitbd8f658823059a4b5998bea283342f80ae94e4df (patch)
treeea6ce3a06b93903f7e2ba5d139bab2c3399f179a
parent713c5872fb54c8094c0f5fa1523388efd81517cc (diff)
downloadgit-repo-bd8f658823059a4b5998bea283342f80ae94e4df.tar.gz
Add option for git-repo to support 'silent' uploads
When --ne/--no-emails is added to 'repo upload' command line, gerrit server will not generate notification emails. project.py:Project.UploadForReview method is modified to accept a string recognizable by gerrit to indicate different sets of destination email addressees, but the upload command line allows only one option - disable sending emails completely. Default repo upload behavior is not being changed. TEST=tried in the Chrome OS repo, observed that patches uploaded with --ne or --no-emails indeed do not trigger any emails, while patches uploaded without these command line options still trigger email notifications. Change-Id: I0301edec984907aedac277d883bd0e6d3099aedc
-rwxr-xr-xproject.py5
-rw-r--r--subcmds/upload.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/project.py b/project.py
index 704680fd..b8147424 100755
--- a/project.py
+++ b/project.py
@@ -176,6 +176,7 @@ class ReviewableBranch(object):
176 auto_topic=False, 176 auto_topic=False,
177 draft=False, 177 draft=False,
178 private=False, 178 private=False,
179 notify=None,
179 wip=False, 180 wip=False,
180 dest_branch=None, 181 dest_branch=None,
181 validate_certs=True, 182 validate_certs=True,
@@ -185,6 +186,7 @@ class ReviewableBranch(object):
185 auto_topic=auto_topic, 186 auto_topic=auto_topic,
186 draft=draft, 187 draft=draft,
187 private=private, 188 private=private,
189 notify=notify,
188 wip=wip, 190 wip=wip,
189 dest_branch=dest_branch, 191 dest_branch=dest_branch,
190 validate_certs=validate_certs, 192 validate_certs=validate_certs,
@@ -1118,6 +1120,7 @@ class Project(object):
1118 auto_topic=False, 1120 auto_topic=False,
1119 draft=False, 1121 draft=False,
1120 private=False, 1122 private=False,
1123 notify=None,
1121 wip=False, 1124 wip=False,
1122 dest_branch=None, 1125 dest_branch=None,
1123 validate_certs=True, 1126 validate_certs=True,
@@ -1174,6 +1177,8 @@ class Project(object):
1174 1177
1175 opts = ['r=%s' % p for p in people[0]] 1178 opts = ['r=%s' % p for p in people[0]]
1176 opts += ['cc=%s' % p for p in people[1]] 1179 opts += ['cc=%s' % p for p in people[1]]
1180 if notify:
1181 opts += ['notify=' + notify]
1177 if private: 1182 if private:
1178 opts += ['private'] 1183 opts += ['private']
1179 if wip: 1184 if wip:
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 02b43b40..acb9d7f0 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -150,6 +150,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/
150 p.add_option('-d', '--draft', 150 p.add_option('-d', '--draft',
151 action='store_true', dest='draft', default=False, 151 action='store_true', dest='draft', default=False,
152 help='If specified, upload as a draft.') 152 help='If specified, upload as a draft.')
153 p.add_option('--ne', '--no-emails',
154 action='store_false', dest='notify', default=True,
155 help='If specified, do not send emails on upload.')
153 p.add_option('-p', '--private', 156 p.add_option('-p', '--private',
154 action='store_true', dest='private', default=False, 157 action='store_true', dest='private', default=False,
155 help='If specified, upload as a private change.') 158 help='If specified, upload as a private change.')
@@ -391,6 +394,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/
391 auto_topic=opt.auto_topic, 394 auto_topic=opt.auto_topic,
392 draft=opt.draft, 395 draft=opt.draft,
393 private=opt.private, 396 private=opt.private,
397 notify=None if opt.notify else 'NONE',
394 wip=opt.wip, 398 wip=opt.wip,
395 dest_branch=destination, 399 dest_branch=destination,
396 validate_certs=opt.validate_certs, 400 validate_certs=opt.validate_certs,