Commit 75e7872a authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

Convert notify parameter inside gerrit_util

Bug: skia:6744
Change-Id: I0f84bd685bfacf692190f8636208122cf88d0b82
Reviewed-on: https://chromium-review.googlesource.com/529016Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
parent 354e1d23
...@@ -732,7 +732,7 @@ def SetReview(host, change, msg=None, labels=None, notify=None): ...@@ -732,7 +732,7 @@ def SetReview(host, change, msg=None, labels=None, notify=None):
if labels: if labels:
body['labels'] = labels body['labels'] = labels
if notify: if notify:
body['notify'] = notify body['notify'] = 'ALL' if notify else 'NONE'
conn = CreateHttpConn(host, path, reqtype='POST', body=body) conn = CreateHttpConn(host, path, reqtype='POST', body=body)
response = ReadHttpJsonResponse(conn) response = ReadHttpJsonResponse(conn)
if labels: if labels:
......
...@@ -3105,8 +3105,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): ...@@ -3105,8 +3105,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
print('Adding self-LGTM (Code-Review +1) because of TBRs.') print('Adding self-LGTM (Code-Review +1) because of TBRs.')
gerrit_util.SetReview( gerrit_util.SetReview(
self._GetGerritHost(), self.GetIssue(), self._GetGerritHost(), self.GetIssue(),
labels={'Code-Review': 1}, labels={'Code-Review': 1}, notify=bool(options.send_mail))
notify='ALL' if options.send_mail else 'NONE')
return 0 return 0
...@@ -3194,7 +3193,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): ...@@ -3194,7 +3193,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
kwargs = {'labels': {'Commit-Queue': vote_map[new_state]}} kwargs = {'labels': {'Commit-Queue': vote_map[new_state]}}
if new_state == _CQState.DRY_RUN: if new_state == _CQState.DRY_RUN:
# Don't spam everybody reviewer/owner. # Don't spam everybody reviewer/owner.
kwargs['notify'] = 'NONE' kwargs['notify'] = False
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), **kwargs) gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), **kwargs)
def CannotTriggerTryJobReason(self): def CannotTriggerTryJobReason(self):
......
...@@ -1581,8 +1581,7 @@ class TestGitCl(TestCase): ...@@ -1581,8 +1581,7 @@ class TestGitCl(TestCase):
if tbr: if tbr:
calls += [ calls += [
(('SetReview', 'chromium-review.googlesource.com', (('SetReview', 'chromium-review.googlesource.com',
123456 if squash else None, {'Code-Review': 1}, 123456 if squash else None, {'Code-Review': 1}, notify), ''),
'ALL' if notify else 'NONE'), ''),
] ]
calls += cls._git_post_upload_calls() calls += cls._git_post_upload_calls()
return calls return calls
...@@ -2402,7 +2401,7 @@ class TestGitCl(TestCase): ...@@ -2402,7 +2401,7 @@ class TestGitCl(TestCase):
self.assertEqual(0, git_cl.main(['set-commit', '-c'])) self.assertEqual(0, git_cl.main(['set-commit', '-c']))
def test_cmd_set_commit_gerrit_dry(self): def test_cmd_set_commit_gerrit_dry(self):
self._cmd_set_commit_gerrit_common(1, notify='NONE') self._cmd_set_commit_gerrit_common(1, notify=False)
self.assertEqual(0, git_cl.main(['set-commit', '-d'])) self.assertEqual(0, git_cl.main(['set-commit', '-d']))
def test_cmd_set_commit_gerrit(self): def test_cmd_set_commit_gerrit(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment