Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bump): manual version bump if prerelease offset is configured #1358

Conversation

ckagerer
Copy link
Contributor

@ckagerer ckagerer commented Feb 17, 2025

Description

If a prerelease offset is configured (I introduced this about 2 years ago with PR #614), no bump is possible with the manual version.
To do this, the configuration must first be changed and then reset after the bump.

For this reason, it makes more sense to remove the check that prevents the manual bump.

Checklist

  • Add test cases to all the changes you introduce
    • I'm not sure where best to cover this case. Please give me a hint in which existing test file I could extend this.
  • Run poetry all locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

Bumping a manual version works without changing the configuration file.

Steps to Test This Pull Request

  1. Use the follwoing Configuration
[tool.commitizen]
changelog_incremental = true
tag_format = "v$version"
update_changelog_on_bump = true
version = "1.2.0b13"
prerelease_offset = 1
  1. cz bump 9.8.7

Additional context

@ckagerer ckagerer force-pushed the fix/manual-version-with-prerelease-offset-in-config branch from 9377d32 to 89677ae Compare February 17, 2025 15:30
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.55%. Comparing base (120d514) to head (dfd2fdf).
Report is 562 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1358      +/-   ##
==========================================
+ Coverage   97.33%   97.55%   +0.21%     
==========================================
  Files          42       55      +13     
  Lines        2104     2620     +516     
==========================================
+ Hits         2048     2556     +508     
- Misses         56       64       +8     
Flag Coverage Δ
unittests 97.55% <ø> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ckagerer ckagerer marked this pull request as ready for review February 17, 2025 15:45
If you use the prerelase offset in the .cz.toml, as in the following
example, no bump with a manual version number is possible.

The error occurs when bumping with manual version number:
cz  bump 9.8.7
--prerelease-offset cannot be combined with MANUAL_VERSION

```toml
[tool.commitizen]
changelog_incremental = true
tag_format = "v$version"
update_changelog_on_bump = true
version = "1.2.0b13"
prerelease_offset = 1
```
@ckagerer ckagerer force-pushed the fix/manual-version-with-prerelease-offset-in-config branch from 89677ae to dfd2fdf Compare February 18, 2025 09:08
Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ckagerer !

@woile @noirbizarre This PR looks good to me. I'm going to merge it this days if there's no objection

@Lee-W Lee-W added the pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check label Feb 18, 2025
@woile
Copy link
Member

woile commented Feb 18, 2025 via email

Copy link
Member

@noirbizarre noirbizarre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !

@Lee-W Lee-W merged commit d831c99 into commitizen-tools:master Feb 18, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check pr-status: wait-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants