Commit 828701bd authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

Gerrit: git cl set-commit -d: don't spam reviwers/owner.

R=sergiyb@chromium.org,machenbach@chromium.org
BUG=

Change-Id: Ia89e91479c22adeebc85a4432cd9f7b8d95a8fde
Reviewed-on: https://chromium-review.googlesource.com/418655Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
parent f01be229
......@@ -3023,8 +3023,11 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
_CQState.DRY_RUN: 1,
_CQState.COMMIT : 2,
}
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(),
labels={'Commit-Queue': vote_map[new_state]})
kwargs = {'labels': {'Commit-Queue': vote_map[new_state]}}
if new_state == _CQState.DRY_RUN:
# Don't spam everybody reviewer/owner.
kwargs['notify'] = 'NONE'
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), **kwargs)
def CannotTriggerTryJobReason(self):
try:
......
......@@ -2051,10 +2051,11 @@ class TestGitCl(TestCase):
]
self.assertEqual(0, git_cl.main(['set-commit']))
def _cmd_set_commit_gerrit_common(self, vote):
def _cmd_set_commit_gerrit_common(self, vote, notify=None):
self.mock(git_cl.gerrit_util, 'SetReview',
lambda h, i, labels: self._mocked_call(
['SetReview', h, i, labels]))
lambda h, i, labels, notify=None:
self._mocked_call(['SetReview', h, i, labels, notify]))
self.calls = [
((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
((['git', 'config', 'branch.feature.rietveldissue'],), CERR1),
......@@ -2062,7 +2063,7 @@ class TestGitCl(TestCase):
((['git', 'config', 'branch.feature.gerritserver'],),
'https://chromium-review.googlesource.com'),
((['SetReview', 'chromium-review.googlesource.com', 123,
{'Commit-Queue': vote}],), ''),
{'Commit-Queue': vote}, notify],), ''),
]
def test_cmd_set_commit_gerrit_clear(self):
......@@ -2070,7 +2071,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)
self._cmd_set_commit_gerrit_common(1, notify='NONE')
self.assertEqual(0, git_cl.main(['set-commit', '-d']))
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