def get_current_version(repo_path):
repo = dulwich.repo.Repo(repo_path)<EOL>tags = get_tags(repo)<EOL>maj_version = <NUM_LIT:0><EOL>feat_version = <NUM_LIT:0><EOL>fix_version = <NUM_LIT:0><EOL>for commit_sha in reversed(get_first_parents(repo_path)):<EOL><INDENT>commit = repo.get_object(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>)<EOL><DEDENT>return '<STR_LIT>' % (maj_version, feat_version, fix_version)<EOL>
Given a repo will return the version string, according to semantic
versioning, counting as non-backwards compatible commit any one with a
message header that matches (case insensitive)::

    sem-ver: .*break.*

And as features any commit with a header matching::

    sem-ver: feature

And counting any other as a bugfix