c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 135 forks source link

Only the serialize part of a version is being stored in the updated files #252

Open stmlange opened 2 years ago

stmlange commented 2 years ago

Hello, thank you for this nice project! I haven't found an issue that describes that problem I have encountered. Essentially it seems that when I run bump2version with a specific version let's say bump2version --verbose --new-version 1.0.0-rc.4 patch the version will get updated properly in .bumpversion.cfg, however the version in relevant configured files (e.g. gradle.properties) will just end up to be the part that I would describe as "parsable" or "serializable" by the config.

From my perspective this is not what I would have expected. Either bumpversion refuses to operate with the --new-version specified (since it's not parsable), or spits out a warning that the --new-version specified is not parsable, but ultimately will set the version in gradle.properties to what has been specified by the command-line arguments.

Example content of .bumpversion.cfg:

[bumpversion]
current_version = 0.9.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}
commit = True
message = Update release version from {current_version} to {new_version}

[bumpversion:file:gradle.properties]

and gradle.properties:

version=0.9.1

With bump2version --verbose --new-version 1.0.0-rc.4 patch the .bumpversion.cfg would have current_version = 1.0.0-rc.4 patch and the gradle.properties would indicate version=1.0.0

The easy workaround of course would be to use a parse-thing that accepts all various different versions listed on https://semver.org.