def close_git_review_requests(payload, server_url):
 review_id_to_commits_map = defaultdict(list)
 branch_name = payload.get(u'branch')
 if (not branch_name):
  return review_id_to_commits_map
 commits = payload.get(u'commits', [])
 for commit in commits:
  commit_hash = commit.get(u'id')
  commit_message = commit.get(u'message')
  review_request_id = get_review_request_id(commit_message, server_url, commit_hash)
  commit_entry = (u'%s (%s)' % (branch_name, commit_hash[:7]))
  review_id_to_commits_map[review_request_id].append(commit_entry)
 close_all_review_requests(review_id_to_commits_map)

def close_git_review_requests ( payload , server_url ) : review_id_to_commits_map = defaultdict ( list ) branch_name = payload . get ( u'branch' ) if ( not branch_name ) : return review_id_to_commits_map commits = payload . get ( u'commits' , [ ] ) for commit in commits : commit_hash = commit . get ( u'id' ) commit_message = commit . get ( u'message' ) review_request_id = get_review_request_id ( commit_message , server_url , commit_hash ) commit_entry = ( u'%s (%s)' % ( branch_name , commit_hash [ : 7 ] ) ) review_id_to_commits_map [ review_request_id ] . append ( commit_entry ) close_all_review_requests ( review_id_to_commits_map )
closes all review requests for the git repository .