Let Changelist().AddComment() mark changes as Ready
In Rietveld, adding a comment to a change automatically
published it no matter what. In Gerrit, we need to explicitly
mark the change as Ready for Review. This CL adds a new
parameter to the wrapper methods around the SetReview
API so that they can mark changes as Ready.
Bug: 740950
Change-Id: Icb2ad7c5beb03a4760657a761841745f0d75514e
Reviewed-on: https://chromium-review.googlesource.com/572031
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index cea2758..17edd8f 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -3389,19 +3389,20 @@
def test_git_cl_comment_add_rietveld(self):
self.mock(git_cl._RietveldChangelistImpl, 'AddComment',
- lambda _, message: self._mocked_call('AddComment', message))
+ lambda _, message, publish: self._mocked_call(
+ 'AddComment', message, publish))
self.calls = [
((['git', 'config', 'rietveld.autoupdate'],), CERR1),
((['git', 'config', 'rietveld.server'],), 'codereview.chromium.org'),
- (('AddComment', 'msg'), ''),
+ (('AddComment', 'msg', None), ''),
]
self.assertEqual(0, git_cl.main(['comment', '--rietveld',
'-i', '10', '-a', 'msg']))
def test_git_cl_comment_add_gerrit(self):
self.mock(git_cl.gerrit_util, 'SetReview',
- lambda host, change, msg:
- self._mocked_call('SetReview', host, change, msg))
+ lambda host, change, msg, ready:
+ self._mocked_call('SetReview', host, change, msg, ready))
self.calls = [
((['git', 'symbolic-ref', 'HEAD'],), CERR1),
((['git', 'symbolic-ref', 'HEAD'],), CERR1),
@@ -3410,7 +3411,8 @@
'origin/master'),
((['git', 'config', 'remote.origin.url'],),
'https://chromium.googlesource.com/infra/infra'),
- (('SetReview', 'chromium-review.googlesource.com', 10, 'msg'), None),
+ (('SetReview', 'chromium-review.googlesource.com', 10, 'msg', None),
+ None),
]
self.assertEqual(0, git_cl.main(['comment', '--gerrit', '-i', '10',
'-a', 'msg']))