def update_rietveld_metadata_from_issue(current_branch=None,
                                        rietveld_info=None):
    """Updates the Rietveld metadata for a branch from the issue metadata.

    Args:
        current_branch: String; containing the name of a branch. Defaults to
            None, in which case Rietveld.from_branch uses get_current_branch.
        rietveld_info: RietveldInfo object containing metadata associated with
            the current branch. Defaults to None and here will be replaced by
            info for current branch.

    Returns:
        A tuple containing a boolean indicating success or failure of the update
            and the RietveldInfo object associated with the current branch.
    """
    rietveld_info = rietveld_info or RietveldInfo.from_branch(
            branch_name=current_branch)
    if rietveld_info is None:
        return (False, None)

    server = rietveld_info.server
    review_info = rietveld_info.review_info
    if server is None or review_info is None:
        return (False, rietveld_info)

    issue = review_info.issue
    issue_metadata = get_issue_metadata(issue=issue, server=server)

    success = False
    if (REVIEWERS in issue_metadata and CC in issue_metadata and
        SUBJECT in issue_metadata):
        rietveld_info.reviewers = issue_metadata[REVIEWERS]
        rietveld_info.cc = issue_metadata[CC]
        review_info.subject = issue_metadata[SUBJECT]
        if ISSUE_DESCRIPTION in issue_metadata:
            if issue_metadata[ISSUE_DESCRIPTION] != review_info.subject:
                review_info.description = issue_metadata[ISSUE_DESCRIPTION]
            else:
                review_info.description = ''
        rietveld_info.save()
        success = True

    return (success, rietveld_info)
dataset/ETHPy150Open googlearchive/git-rv/utils.py/update_rietveld_metadata_from_issue/original