Repository navigation
fix: resolve semantic commit range by ancestry (fixes #86) - #87
Conversation
get_new_commits() walked history in reverse commit-date order and stopped at the commit the previous tag pointed at. A branch that stays open across another release has commits older than the newer tag, so the date-ordered walk reached the tag first and never analysed them - silently dropping feat!:/BREAKING CHANGE: commits from the version calculation (issue #86). Resolve the range by ancestry via `git rev-list HEAD ^<reference_tag>` instead. To keep the hotfix model working, also exclude commits reachable from the current channel's own latest tag, so cherry-picked hotfixes that are already released on this channel are not counted again. Fixes #86 Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
Pull request overview
Fixes semantic version calculation by resolving unreleased commits through Git ancestry.
Changes:
- Replaces date-ordered history traversal with
git rev-list. - Excludes commits reachable from reference and channel tags.
- Adds a long-running branch regression test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
semantic.py |
Implements ancestry-based commit selection. |
test_long_running_branch.py |
Tests detection of older breaking commits. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| rev_list_args = [repo.head.commit.hexsha, *(f'^{sha}' for sha in exclude)] | ||
|
|
||
| try: | ||
| output = repo.git.rev_list(*rev_list_args) |
There was a problem hiding this comment.
Good catch — fixed in 16e72ec. Moved the repo.head.commit resolution inside the try so an empty repository (no HEAD commit) again logs and returns [] instead of raising.
| except (ValueError, git.GitCommandError) as exc: | ||
| logger.warning('No commits found: %s', exc) | ||
| return [] |
There was a problem hiding this comment.
Agreed — fixed in 16e72ec. Now only ValueError (missing HEAD) is caught; git.GitCommandError from git rev-list propagates so a real command failure isn't silently reported as no semantic changes.
…rev-list errors - Move `repo.head.commit` resolution inside the try so an empty repository (no HEAD commit) still logs and returns [] instead of raising. - Only catch ValueError (missing HEAD). Let git.GitCommandError from `git rev-list` propagate, so a genuine command failure is not silently reported as "no semantic changes". Co-authored-by: Copilot App <[email protected]>
Summary
get_new_commits()walked the history in reverse commit date order and stopped at the commit the previous tag pointed at. When a branch stays open across another release, its commits are older than the new tag, so the date-ordered walk reached the tag first and never analysed them — silently droppingfeat!:/BREAKING CHANGE:commits from the version calculation. This caused a breaking change to be released as a minor. Fixes #86.Change
git rev-list HEAD ^<reference_tag>instead of a date-ordered walk with manual paging. This is unaffected by commit dates and drops themax_commits/skiploop.Tests
tests/e2e/test_long_running_branch.py: regression test where afeat!:on a branch that stays open across another release must still bump the major version (v0.0.1→v1.0.0).mypy,flake8,pylintclean (pylint 10.00/10).