refactor(bump): use VersionIncrement ordering for bump detection - #2097
bearomorphism wants to merge 4 commits into
Conversation
🔍 Commitizen bump previewMerging this PR will produce the following bump: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2097 +/- ##
==========================================
+ Coverage 98.27% 98.28% +0.01%
==========================================
Files 61 61
Lines 2836 2862 +26
==========================================
+ Hits 2787 2813 +26
Misses 49 49 ☔ View full report in Codecov by Harness. |
3a7ff2c to
6585f2c
Compare
|
Previous PR: #1518 This is smaller and the goal is to remove |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The documented None mapping conflicts with the public bump-map type annotations.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Centralizes bump detection around ordered VersionIncrement values while preserving existing CLI behavior.
Changes:
- Replaces
find_incrementwith shared increment helpers. - Updates bump/version commands and regression coverage.
- Documents no-bump custom mappings.
| File | Description |
|---|---|
commitizen/version_increment.py |
Adds ordered increment extraction helpers. |
commitizen/bump.py |
Removes legacy increment detection. |
commitizen/commands/bump.py |
Uses shared increment selection. |
commitizen/commands/version.py |
Reuses selection for commit-derived versions. |
tests/test_version_increment.py |
Adds helper and compatibility tests. |
tests/test_bump_find_increment.py |
Removes obsolete tests. |
tests/commands/test_bump_command.py |
Tests invalid custom mappings. |
docs/customization/python_class.md |
Documents None mappings. |
docs/customization/config_file.md |
Documents JSON/YAML null mappings. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Santiago Fraire Willemoes <santiwilly@gmail.com>

Description
This PR extracts the
find_incrementremoval from the larger BumpRule redesign by replacing it with comparableVersionIncrementhelpers and shared max-based increment selection.It keeps the current
bump_pattern/bump_mapbehavior intact, including:major_version_zeroChecklist
Was generative AI tooling used to co-author this PR?
Generated-by: Pi / no-mistakes following http://commitizen-tools.github.io/commitizen/contributing/pull_request/#ai-assisted-contributions
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
cz bumpandcz version --project --next USE_GIT_COMMITSshould keep their existing bump-selection behavior aftercommitizen.bump.find_incrementis removed, while internal increment selection now uses comparableVersionIncrementvalues.A documented
None/nullbump_mapvalue should also match the public typed plugin/config contract, while the string"NONE"remains invalid.Steps to Test This Pull Request
cz bumpandcz version --project --next USE_GIT_COMMITSin isolated repos covering invalid custom bump maps, multiline MAJOR handling, filtered commits,major_version_zero, and actualNonebump-map values.Additional Context
Nonebump-map contract.ruff check,ruff format --check,mypy, and targeted bump/version pytest coverage (223 passed).