git cl comment: implement adding comment for Gerrit.

BUG=698236

Change-Id: Ia1a36af71c348be991d77083092c5043c2642c19
Reviewed-on: https://chromium-review.googlesource.com/455877
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index c3e564f..342d82c 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1654,6 +1654,9 @@
 
   # Forward methods to codereview specific implementation.
 
+  def AddComment(self, message):
+    return self._codereview_impl.AddComment(message)
+
   def CloseIssue(self):
     return self._codereview_impl.CloseIssue()
 
@@ -1752,6 +1755,10 @@
     """Update the description on codereview site."""
     raise NotImplementedError()
 
+  def AddComment(self, message):
+    """Posts a comment to the codereview site."""
+    raise NotImplementedError()
+
   def CloseIssue(self):
     """Closes the issue."""
     raise NotImplementedError()
@@ -2488,6 +2495,10 @@
     gerrit_util.SetCommitMessage(self._GetGerritHost(), self.GetIssue(),
                                  description, notify='NONE')
 
+  def AddComment(self, message):
+    gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(),
+                          msg=message)
+
   def CloseIssue(self):
     gerrit_util.AbandonChange(self._GetGerritHost(), self.GetIssue(), msg='')
 
@@ -4198,11 +4209,13 @@
   parser.add_option('-a', '--add-comment', dest='comment',
                     help='comment to add to an issue')
   parser.add_option('-i', dest='issue',
-                    help="review issue id (defaults to current issue)")
+                    help='review issue id (defaults to current issue)')
   parser.add_option('-j', '--json-file',
                     help='File to write JSON summary to')
   auth.add_auth_options(parser)
+  _add_codereview_select_options(parser)
   options, args = parser.parse_args(args)
+  _process_codereview_select_options(parser, options)
   auth_config = auth.extract_auth_config_from_options(options)
 
   issue = None
@@ -4212,7 +4225,10 @@
     except ValueError:
       DieWithError('A review issue id is expected to be a number')
 
-  cl = Changelist(issue=issue, codereview='rietveld', auth_config=auth_config)
+  cl = Changelist(issue=issue,
+                  # TODO(tandrii): remove 'rietveld' default.
+                  codereview=options.forced_codereview or 'rietveld',
+                  auth_config=auth_config)
 
   if options.comment:
     cl.AddComment(options.comment)