def AddMergeMessage(self, issue_number, message):
    """Adds a merge message to the code review issue.

    Where the merge is a commit to the main project git repository.

    Args:
      issue_number: an integer or string containing the codereview
                    issue number.
      message: a string containing the message to add to the code review issue.

    Returns:
      A boolean indicating the merge message was added to
      the code review issue.
    """
    codereview_access_token = self.GetAccessToken()
    xsrf_token = self.GetXSRFToken()
    if not codereview_access_token or not xsrf_token:
      return False

    codereview_url = b'https://codereview.appspot.com/{0!s}/publish'.format(
        issue_number)

    post_data = urllib_parse.urlencode({
        u'add_as_reviewer': u'False',
        u'message': message,
        u'message_only': u'True',
        u'no_redirect': 'True',
        u'send_mail': 'True',
        u'xsrf_token': xsrf_token})

    request = urllib_request.Request(codereview_url)

    # Add header: Authorization: OAuth <codereview access token>
    request.add_header(
        u'Authorization', u'OAuth {0:s}'.format(codereview_access_token))

    # This will change the request into a POST.
    request.add_data(post_data)

    try:
      url_object = urllib_request.urlopen(request)
    except urllib_error.HTTPError as exception:
      logging.error(
          u'Failed publish to codereview issue: {0!s} with error: {1:s}'.format(
              issue_number, exception))
      return False

    if url_object.code not in (200, 201):
      logging.error((
          u'Failed publish to codereview issue: {0!s} with status code: '
          u'{1:d}').format(issue_number, url_object.code))
      return False

    return True
dataset/ETHPy150Open log2timeline/dfvfs/utils/review.py/CodeReviewHelper.AddMergeMessage/original