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/git_cl.py b/git_cl.py
index 0c09f2d..d239680 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1717,8 +1717,8 @@
# Forward methods to codereview specific implementation.
- def AddComment(self, message):
- return self._codereview_impl.AddComment(message)
+ def AddComment(self, message, publish=None):
+ return self._codereview_impl.AddComment(message, publish=publish)
def GetCommentsSummary(self, readable=True):
"""Returns list of _CommentSummary for each comment.
@@ -1823,7 +1823,7 @@
"""Update the description on codereview site."""
raise NotImplementedError()
- def AddComment(self, message):
+ def AddComment(self, message, publish=None):
"""Posts a comment to the codereview site."""
raise NotImplementedError()
@@ -2001,7 +2001,7 @@
def GetIssueOwner(self):
return (self.GetIssueProperties() or {}).get('owner_email')
- def AddComment(self, message):
+ def AddComment(self, message, publish=None):
return self.RpcServer().add_comment(self.GetIssue(), message)
def GetCommentsSummary(self, _readable=True):
@@ -2593,9 +2593,9 @@
gerrit_util.SetCommitMessage(self._GetGerritHost(), self.GetIssue(),
description, notify='NONE')
- def AddComment(self, message):
+ def AddComment(self, message, publish=None):
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(),
- msg=message)
+ msg=message, ready=publish)
def GetCommentsSummary(self, readable=True):
# DETAILED_ACCOUNTS is to get emails in accounts.