diff --git a/gerrit_util.py b/gerrit_util.py index 6045de767..f2020bedd 100755 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -732,7 +732,7 @@ def SetReview(host, change, msg=None, labels=None, notify=None): if labels: body['labels'] = labels if notify: - body['notify'] = notify + body['notify'] = 'ALL' if notify else 'NONE' conn = CreateHttpConn(host, path, reqtype='POST', body=body) response = ReadHttpJsonResponse(conn) if labels: diff --git a/git_cl.py b/git_cl.py index 8e8775bc2..6fbaa152d 100755 --- a/git_cl.py +++ b/git_cl.py @@ -3105,8 +3105,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): print('Adding self-LGTM (Code-Review +1) because of TBRs.') gerrit_util.SetReview( self._GetGerritHost(), self.GetIssue(), - labels={'Code-Review': 1}, - notify='ALL' if options.send_mail else 'NONE') + labels={'Code-Review': 1}, notify=bool(options.send_mail)) return 0 @@ -3194,7 +3193,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): kwargs = {'labels': {'Commit-Queue': vote_map[new_state]}} if new_state == _CQState.DRY_RUN: # Don't spam everybody reviewer/owner. - kwargs['notify'] = 'NONE' + kwargs['notify'] = False gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), **kwargs) def CannotTriggerTryJobReason(self): diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index edbdd520a..4ae5f17a5 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -1581,8 +1581,7 @@ class TestGitCl(TestCase): if tbr: calls += [ (('SetReview', 'chromium-review.googlesource.com', - 123456 if squash else None, {'Code-Review': 1}, - 'ALL' if notify else 'NONE'), ''), + 123456 if squash else None, {'Code-Review': 1}, notify), ''), ] calls += cls._git_post_upload_calls() return calls @@ -2402,7 +2401,7 @@ class TestGitCl(TestCase): self.assertEqual(0, git_cl.main(['set-commit', '-c'])) 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'])) def test_cmd_set_commit_gerrit(self):