def format_commit_lines(web_url: str, repo: repo, base: int, tip: int) ->str:
    """
    Format the per-commit information for the message, including the one-line
    commit summary and a link to the diff if a web URL has been configured:
    """
    if web_url:
        rev_base_url = web_url.rstrip('/') + '/rev/'
    commit_summaries = []
    for rev in range(base, tip):
        rev_node = repo.changelog.node(rev)
        rev_ctx = repo[rev_node]
        one_liner = rev_ctx.description().split('\n')[0]
        if web_url:
            summary_url = rev_base_url + str(rev_ctx)
            summary = '* [{summary}]({url})'.format(summary=one_liner, url=
                summary_url)
        else:
            summary = '* {summary}'.format(summary=one_liner)
        commit_summaries.append(summary)
    return '\n'.join(summary for summary in commit_summaries)
