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

Help wanted: commitizen 3.x not supoort generate CHANGELOG with tag format like v1.0.0-release #950

Open
dhmemi opened this issue Dec 29, 2023 · 5 comments · May be fixed by #1081
Open
Labels
issue-status: wait-for-implementation maintainers agree on the bug / feature type: bug

Comments

@dhmemi
Copy link

dhmemi commented Dec 29, 2023

Description

Commitizen 3.x not supoort generate CHANGELOG with tag format like v1.0.0-release, but it works well with commitizen 2.x.

My repo tags could not be changed as it released. Any idea to solve this problem in order to generate the changelog correctly?

Steps to reproduce

PS E:\codes\aidi-sdk> cz ch                           
InvalidVersion GitTag('v0.7.1-release', '0689497d1cf9d036cb510cfed3a96135d9456419', '2023-12-08')
InvalidVersion GitTag('v0.7.0-release', 'c81dd1acd809ea2df66154bc5ecb64fb625a40e6', '2023-12-07')

Current behavior

no

Desired behavior

no

Screenshots

No response

Environment

cz version: 3.13.0

@rshmhrj
Copy link

rshmhrj commented Jan 17, 2024

This is also happening for maven type versions (using cz version 3.13.0):

cz init
Welcome to commitizen!

Answer the questions to configure your project.
For further configuration visit:

https://commitizen-tools.github.io/commitizen/config/

? Please choose a supported config file:  .cz.toml
? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits
? Choose the source of the version: commitizen: Fetch and set version in commitizen config (default)
? Is master_0.0.2-SNAPSHOT.74 the latest tag? No
? Please choose the latest tag:  v0.0.1-SNAPSHOT
? Choose version scheme:  semver
Traceback (most recent call last):
  File "/usr/local/bin/cz", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/Cellar/commitizen/3.13.0/libexec/lib/python3.12/site-packages/commitizen/cli.py", line 570, in main
    args.func(conf, arguments)()
  File "/usr/local/Cellar/commitizen/3.13.0/libexec/lib/python3.12/site-packages/commitizen/commands/init.py", line 100, in __call__
    version = get_version_scheme(self.config, version_scheme)(tag)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/opt/python-packaging/lib/python3.12/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'v0.0.1-SNAPSHOT'
image

@Lee-W
Copy link
Member

Lee-W commented Apr 23, 2024

Thanks for reporting. Just verified this is a valid issue.

@Lee-W
Copy link
Member

Lee-W commented Apr 23, 2024

The root cause is

class BaseVersion(_BaseVersion):
. The following is a simplified version of this error.

from packaging.version import Version as _BaseVersion

_BaseVersion("1.0.0-test")

I guess we'll need to overwrite https://github.com/pypa/packaging/blob/32deafe8668a2130a3366b98154914d188f3718e/src/packaging/version.py#L185 to something like https://github.com/pypa/packaging/blob/32deafe8668a2130a3366b98154914d188f3718e/src/packaging/version.py#L117 but with semver support?

@noirbizarre @woile WDYT?

@woile
Copy link
Member

woile commented Apr 23, 2024

Definitely a good idea, we should add tests for semver and semver2

@Lee-W Lee-W linked a pull request Apr 24, 2024 that will close this issue
4 tasks
@Lee-W
Copy link
Member

Lee-W commented Apr 24, 2024

Added tests first #1081

@Lee-W Lee-W mentioned this issue Apr 29, 2024
3 tasks
@Lee-W Lee-W added the issue-status: wait-for-implementation maintainers agree on the bug / feature label May 20, 2024
Younday added a commit to syntho-ai/deployment-tools that referenced this issue Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-status: wait-for-implementation maintainers agree on the bug / feature type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants