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 changelog for prerelease without commits #681

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

eduardocardoso
Copy link
Contributor

Description

This changes lets the changelog be generated for version bumps from a prerelease version without new commits, which the bump command already allows.

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test 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

User should be able to bump a prerelease version and generate a changelog for the new version without adding new commits

Steps to Test This Pull Request

  1. Generate a prerelease version with bump command: cz bump --changelog --prerelease alpha
  2. Generate a new version with bump command without adding new commits: cz bump --changelog [--prerelease beta]

Current behavior:

Fails when attempting to generate the changelog with --changelog flag

$ cz bump --changelog --prerelease alpha --yes
bump: release 0.37.0 → 0.38.0a0

Automatically generated by Commitizen.

tag to create: v0.38.0a0
increment detected: MINOR

[main 013cdd0] bump: release 0.37.0 → 0.38.0a0
 4 files changed, 9 insertions(+), 3 deletions(-)

Done!
$ cz bump --changelog --prerelease rc --yes
bump: release 0.38.0a0 → 0.38.0rc0

Automatically generated by Commitizen.

tag to create: v0.38.0rc0

No commits found

Expected behavior:

Should bump version and generate changelog with empty change list

$ cz bump --changelog --prerelease alpha --yes
bump: release 0.37.0 → 0.38.0a0

Automatically generated by Commitizen.

tag to create: v0.38.0a0
increment detected: MINOR

[main 013cdd0] bump: release 0.37.0 → 0.38.0a0
 4 files changed, 9 insertions(+), 3 deletions(-)

Done!
$ cz bump --changelog --prerelease rc --yes
bump: release 0.38.0a0 → 0.38.0rc0

Automatically generated by Commitizen.

tag to create: v0.38.0rc0

[main b7c5999] bump: release 0.38.0a0 → 0.38.0rc0
 4 files changed, 5 insertions(+), 3 deletions(-)

Done!

Additional context

@woile
Copy link
Member

woile commented Mar 11, 2023

LGTM, could you also update the complexity to 13?
https://github.com/commitizen-tools/commitizen/blob/master/setup.cfg#L39
That will make the tests pass and I think it's safe to use 13.

Thank you so much 🎉

@eduardocardoso
Copy link
Contributor Author

@woile done, thanks!

@woile
Copy link
Member

woile commented Apr 23, 2023

Could you please rebase? Thanks!

generate changelog for a new version without new commits when the current version is a prerelease. This matches current behaviour for bump command
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1153908) 97.42% compared to head (ca725f2) 97.43%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #681   +/-   ##
=======================================
  Coverage   97.42%   97.43%           
=======================================
  Files          42       42           
  Lines        2022     2027    +5     
=======================================
+ Hits         1970     1975    +5     
  Misses         52       52           
Flag Coverage Δ
unittests 97.43% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
commitizen/__version__.py 100.00% <100.00%> (ø)
commitizen/changelog.py 100.00% <100.00%> (ø)
commitizen/commands/changelog.py 98.94% <100.00%> (+0.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@eduardocardoso
Copy link
Contributor Author

@woile rebased ✅

@jenstroeger
Copy link
Contributor

jenstroeger commented Apr 27, 2023

@woile any chance we can merge and release this soon, please?

@woile woile requested a review from Lee-W April 28, 2023 07:38
@woile woile merged commit a18a2e4 into commitizen-tools:master Apr 28, 2023
17 checks passed
@eduardocardoso eduardocardoso deleted the fix-changelog-rc-bump branch May 23, 2023 16:54
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.

None yet

3 participants