Reputation: 11
In my python project, I was asked to use commitizen. And then they asked me to generate and update the changelog. I did it the first time and it worked. But now I had a problem. When I'm trying to generate my version with commitizen. When I use the command
cz bump 1.4.5 -ch
to generate the changelog together, it returns an error.
$ cz bump 1.4.5 -ch
bump: version 1.4.3 → 1.4.5
tag to create: v.1.4.5
InvalidVersion GitTag('v.1.4.3', '3512322071378d56adf9a8a5f53', '2023-12-13')
InvalidVersion GitTag('v.1.4.1', 'e2fffe65272930fefd38aabbad5', '2023-11-13')
InvalidVersion GitTag('v.1.4.0', '211b6476cf7928b1ff8206a3305', '2023-11-13')
InvalidVersion GitTag('v.1.3.2', '8a26987fca341b0463b83d7181a', '2023-06-05')
InvalidVersion GitTag('v.1.3.0', '1e984e45a405501dd37b3cdb11f', '2023-05-26')
InvalidVersion GitTag('v.0.2.1', '66e7aa544fd88d3076ee192c872', '2023-03-01')
InvalidVersion GitTag('v.0.2.0', '81b36c82d3c624f18b5e202af09', '2023-02-28')
InvalidVersion GitTag('v.0.1.3', 'd734ac269f4cf287311595bb5e0', '2023-02-17')
InvalidVersion GitTag('v.0.1.2', '12856efa7d3d343859d7395e341', '2023-02-17')
InvalidVersion GitTag('v.0.1.0', '4ae0d11e08f1baea9aa5c56f865', '2023-02-17')
No tag found to do an incremental changelog
pyproject.toml file
[tool.commitizen]
name = "cz_conventional_commits"
version = "1.4.3"
tag_format = "v.$major.$minor.$patch$prerelease"
version_files = [
"__version__.py",
"pyproject.toml:version"
]
update_changelog_on_bump = true
changelog_incremental = true
pip freeze
argcomplete==3.1.6
asgiref==3.7.2
certifi==2023.11.17
cfgv==3.4.0
charset-normalizer==3.3.2
colorama==0.4.6
commitizen==3.13.0
decli==0.6.1
distlib==0.3.8
Django==5.0
django-auth-ldap==4.6.0
django-cors-headers==4.3.1
django-filter==23.5
django-ldap==0.0.8
django-simple-history==3.4.0
django-tables2==2.7.0
et-xmlfile==1.1.0
exceptiongroup==1.2.0
filelock==3.13.1
identify==2.5.33
idna==3.6
importlib-metadata==6.11.0
iniconfig==2.0.0
Jinja2==3.1.2
ldap3==2.9.1
MarkupSafe==2.1.3
nodeenv==1.8.0
openpyxl==3.1.2
packaging==23.2
platformdirs==4.1.0
pluggy==1.3.0
pre-commit==3.6.0
prompt-toolkit==3.0.36
psycopg2-binary==2.9.9
pyasn1==0.5.1
pyasn1-modules==0.3.0
pytest==7.4.3
python-dotenv==1.0.0
python-ldap==3.4.4
PyYAML==6.0.1
questionary==2.0.1
requests==2.31.0
sqlparse==0.4.4
tablib==3.5.0
termcolor==2.4.0
toml==0.10.2
tomli==2.0.1
tomlkit==0.12.3
typing_extensions==4.9.0
urllib3==2.1.0
virtualenv==20.25.0
wcwidth==0.2.12
zipp==3.17.0
There is already a generated changelog file. Should I keep deleting and generating again?
I would like to know how to fix the command to generate the version tag, update the changelog so that I can prepare and send it to production.
Upvotes: 1
Views: 2863
Reputation: 59
This error occurs when the old version tag is not available in the machine where cz bump
command is executed. In this case, you are trying to bump from v.1.4.3
to v.1.4.5
. So you need v.1.4.3
to be present locally and the current branch should have tagged with v.1.4.3
as the latest one.
Execute the following command to get all the tags
git fetch origin --tags
Once you get the tags execute the cz bump
.
Upvotes: 1
Reputation: 338
It is funny but I have the same issue right now :). I was trying to apply for commitizen to an already existing project. I didn't have any tags... So I created a tag in Azure DevOps (for example v1.1.2). Then I added this tag info the changelog file (##v1.1.2). After that my CI pipeline sucessully bumped the version from 1.1.2 to 1.1.3 (I did a fix change).
Upvotes: 1