def build_commit_list_content(commits, branch, compare_url, pusher):
    if compare_url is not None:
        push_text = '[pushed](%s)' % (compare_url,)
    else:
        push_text = 'pushed'
    content = ('%s %s to branch %s\n\n'
               % (pusher,
                  push_text,
                  branch))
    num_commits = len(commits)
    truncated_commits = commits[:COMMITS_IN_LIST_LIMIT]
    for commit in truncated_commits:
        short_id = commit['id'][:7]
        (short_commit_msg, _, _) = commit['message'].partition('\n')
        content += '* [%s](%s): %s\n' % (short_id, commit['url'],
                                         short_commit_msg)
    if num_commits > COMMITS_IN_LIST_LIMIT:
        content += ('\n[and %d more commits]'
                    % (num_commits - COMMITS_IN_LIST_LIMIT,))

    return content
dataset/ETHPy150Open zulip/zulip/zerver/views/webhooks/github.py/build_commit_list_content/original