Open luckydonald opened 3 years ago
This bug is caused by bump2version's naive strategy of replacing. I think #71 is another symptom.
When replacing 5.0.0
with 5.0.0.1
, 5.0.0
is first serialized. This results in 5.0
.
That is what's being replaced with 5.0.0.1
; the .0
suffix remains in place.
bump2version should not replace the serialized version number, it should replace the version number which is present.
To work around this, you should use the shortest possible serialization format in your files. Write 5.0
, not 5.0.0
.
Another way to think about this:
One could argue that this is not a bug.
Your config says that "5.0" is a valid version string for all your files, and instructs bump2version
to replace it with new_version
in your file.
But it could -- at least -- warn the user that current_version = 5.0.0
is not the canonical (shortest possible) serialization.
bump2version should not replace the serialized version number, it should replace the version number which is present.
Yes, that would be the correct behaviour.
Your config says that "5.0" is a valid version string for all your files, and instructs bump2version to replace it with new_version in your file.
So the regex must be greedy to include the last .0
as well?
For reproduction the repo luckydonald/pytgbot can be can be checked out at commit
2b35b5901df9d0aa6335d65bfca3dccf3477e8c9
.The config is quite easy,
If I now run
I'll end up with diffs like
For some reason it adds an unneeded
.0
at the end, which it shouldn't.Funnily enough, the version in the commit message, the
.bumpversion
file and the tag is correctly5.0.0.1
.Why would a few of those do completely different things?
I see no reason how it can get that wrong: