← 输入框|github.com|刷新
Skip to content

fix: base forced level bumps on current branch history tags - #1514

Draft
jay23606 wants to merge 1 commit into
python-semantic-release:masterfrom
jay23606:pr-go-simple/1392
Draft

jay23606 wants to merge 1 commit into
python-semantic-release:masterfrom
jay23606:pr-go-simple/1392

Conversation

@jay23606

Copy link
Copy Markdown

Forced bumps (--patch, --minor, --major) called version_from_forced_level, which used every tag in the repository. An unforced version run only considers tags reachable from HEAD (via next_version). So on a hotfix branch, --patch could bump a tag from an unrelated branch (e.g. v1.4.0 from main) instead of the hotfix line (v1.2.1).

Change: version_from_forced_level now collects the commit hashes reachable from HEAD and only considers tags that point into that set, matching the unforced behavior. Tags that fail to resolve to a commit are skipped, as in next_version.

Tests: added test_version_from_forced_level_only_considers_head_history in tests/unit/semantic_release/cli/test_version.py. It builds a temp repo with a hotfix tag v1.2.1 on HEAD and a higher v1.4.0 on an unreachable side commit, and asserts a forced patch yields 1.2.2. Not run locally: dependencies were not installed and tests were not executed in this environment; CI should confirm.

Tests not run here: tests/unit/semantic_release/cli/test_version.py (pytest): blocked, GitPython (module 'git') not installed in this environment and dependencies must not be installed, tests/e2e/cmd_version/test_version_bump.py -k force_level: blocked by the same missing GitPython dependency

Fixes #1392

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forcing the next version to be a (patch|minor|major) release always uses the highest existing tag

1 participant