Skip to content

fix(commands/changelog): Fixed issue #561 cz bump could not find the latest version tag with custom tag_format #566

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

Merged
merged 1 commit into from
Sep 10, 2022

Conversation

ssiuhk
Copy link
Contributor

@ssiuhk ssiuhk commented Aug 22, 2022

Description

fix(command_changelog): Fixed issue #561 cz bump could not find the latest version tag with custom tag_format

  • Updated args to _find_incremental_rev to use latest_tag_version instead of latest_version
  • Updated test case for test_changelog_command.py from .next to .rc as python packaging lib doesn't take 'next' as a valid version

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

The changelog command will now use the tag_format_$version to lookup the git tags instead of just $version, which may fail if git tag has a long length which significally reduce the similarity

Steps to Test This Pull Request

Configuration

$ cat .cz.toml | grep tag_format
tag_format = "SOME_TAG_PREFIX_$version"

Commits

$ git tag
SOME_TAG_PREFIX_1.0.0

$ git log
commit 11ba99fd2907be046e814662e3057c4bdd9f3db0 (HEAD -> master)
Author: Sam SIU <[email protected]>
Date:   Fri Aug 19 19:35:08 2022 +0000

    feat(Testing): Testing something

commit db20a16f6ed45ef1470b131f65c9006b094c4a58 (tag: SOME_TAG_PREFIX_1.0.0)
Author: Sam SIU <[email protected]>
Date:   Fri Aug 19 18:54:18 2022 +0000

    First release

Command run

$ cz bump --dry-run --changelog
bump: version 1.0.0 → 1.1.0
tag to create: SOME_TAG_PREFIX_1.1.0
increment detected: MINOR

## SOME_TAG_PREFIX_1.1.0 (2022-08-19)

### Feat

- **Testing**: Testing something

Additional context

…d not find the latest version tag with custom tag_format

- Updated args to _find_incremental_rev to use latest_tag_version instead of latest_version
- Updated test case for test_changelog_command.py from .next to .rc as python packaging lib doesn't take 'next' as a valid version
@codecov
Copy link

codecov bot commented Aug 22, 2022

Codecov Report

Base: 98.37% // Head: 98.44% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (178cc99) compared to base (42e3dca).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #566      +/-   ##
==========================================
+ Coverage   98.37%   98.44%   +0.06%     
==========================================
  Files          39       39              
  Lines        1603     1604       +1     
==========================================
+ Hits         1577     1579       +2     
+ Misses         26       25       -1     
Flag Coverage Δ
unittests 98.44% <100.00%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
commitizen/commands/changelog.py 98.86% <100.00%> (+0.01%) ⬆️
commitizen/changelog.py 100.00% <0.00%> (+0.56%) ⬆️

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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ssiuhk ssiuhk changed the title fix(command_changelog): Fixed issue #561 cz bump could not find the latest version tag with custom tag_format fix(commands/changelog): Fixed issue #561 cz bump could not find the latest version tag with custom tag_format Aug 22, 2022
@woile woile requested a review from Lee-W September 7, 2022 07:52
@woile
Copy link
Member

woile commented Sep 7, 2022

LGTM

@Lee-W Lee-W merged commit a09c1b0 into commitizen-tools:master Sep 10, 2022
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.

3 participants