def get_remote_info(current_branch=None):
    """Gets the remote, branch and commit for a review.

    Args:
        current_branch: String; containing the name of a branch. Defaults to
            None and is ignored if not set.

    Returns:
        Dictionary with the remote, remote branch and hash as strings.

    Raises:
        GitRvException: If current_branch isn't None and the commit hash of the
            remote is not in the current branch.
    """
    remote = get_remote()
    remote_branch, commit_hash = get_remote_branch(remote)
    url = get_remote_url(remote)
    if current_branch is not None:
        containing_output = capture_command('git', 'branch', '--contains',
                                            commit_hash, single_line=False)
        branches_containing = [branch[2:]
                               for branch in containing_output.split('\n')]
        if current_branch not in branches_containing:
            error_message = BAD_REMOTE_ERROR_TEMPLATE % {
                REMOTE: remote,
                REMOTE_BRANCH: remote_branch,
                COMMIT_HASH: commit_hash,
                BRANCH: current_branch,
            }
            raise GitRvException(error_message)

    return RemoteInfo(remote=remote, branch=remote_branch,
                      commit_hash=commit_hash, last_synced=commit_hash, url=url)
dataset/ETHPy150Open googlearchive/git-rv/utils.py/get_remote_info/original