def close_git_review_requests(payload, server_url):
    """Closes all review requests for the git repository.

    A git payload may contain multiple commits. If a commit's commit
    message does not contain a review request ID, it closes based on
    it's commit id.
    """
    review_id_to_commits_map = defaultdict(list)
    branch_name = payload.get('branch')

    if not branch_name:
        return review_id_to_commits_map

    commits = payload.get('commits', [])

    for commit in commits:
        commit_hash = commit.get('id')
        commit_message = commit.get('message')
        review_request_id = get_review_request_id(commit_message, server_url,
                                                  commit_hash)
        commit_entry = (branch_name, commit_hash[:7]) % '%s (%s)'
        review_id_to_commits_map[review_request_id].append(commit_entry)

    close_all_review_requests(review_id_to_commits_map)
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/beanstalk.py/close_git_review_requests/swapped operands of `%`