def get_changelog(repo_path, from_commit=None):
repo = dulwich.repo.Repo(repo_path)<EOL>tags = get_tags(repo)<EOL>refs = get_refs(repo)<EOL>changelog = []<EOL>maj_version = <NUM_LIT:0><EOL>feat_version = <NUM_LIT:0><EOL>fix_version = <NUM_LIT:0><EOL>start_including = False<EOL>cur_line = '<STR_LIT>'<EOL>if from_commit is None:<EOL><INDENT>start_including = True<EOL><DEDENT>prev_version = (maj_version, feat_version, fix_version)<EOL>for commit_sha, children in reversed(<EOL>get_children_per_first_parent(repo_path).items()<EOL>):<EOL><INDENT>commit = get_repo_object(repo, commit_sha)<EOL>maj_version, feat_version, fix_version = get_version(<EOL>commit=commit,<EOL>tags=tags,<EOL>maj_version=maj_version,<EOL>feat_version=feat_version,<EOL>fix_version=fix_version,<EOL>children=children,<EOL>)<EOL>version = (maj_version, feat_version, fix_version)<EOL>version_str = '<STR_LIT>' % version<EOL>if (<EOL>start_including or commit_sha.startswith(from_commit) or<EOL>fuzzy_matches_refs(from_commit, refs.get(commit_sha, []))<EOL>):<EOL><INDENT>commit_type = get_commit_type(<EOL>commit=commit,<EOL>children=children,<EOL>tags=tags,<EOL>prev_version=prev_version,<EOL>)<EOL>cur_line = pretty_commit(commit, version_str, commit_type)<EOL>for child in children:<EOL><INDENT>commit_type = get_commit_type(<EOL>commit=commit,<EOL>tags=tags,<EOL>prev_version=prev_version,<EOL>)<EOL>cur_line += pretty_commit(<EOL>commit=child,<EOL>version=None,<EOL>commit_type=commit_type<EOL>)<EOL><DEDENT>start_including = True<EOL>changelog.append(cur_line)<EOL><DEDENT>prev_version = version<EOL><DEDENT>return '<STR_LIT:\n>'.join(reversed(changelog))<EOL>
Given a repo path and an option commit/tag/refspec to start from, will
get the rpm compatible changelog

Args:
    repo_path (str): path to the git repo
    from_commit (str): refspec (partial commit hash, tag, branch, full
        refspec, partial refspec) to start the changelog from

Returns:
    str: Rpm compatible changelog