callowayproject / bump-my-version

A small command line tool to simplify releasing software by updating all version strings in your source code by the correct increment and optionally commit and tag the changes.
https://callowayproject.github.io/bump-my-version/
MIT License
349 stars 21 forks source link

Zero-padded version parts are not working #179

Closed coordt closed 6 months ago

coordt commented 6 months ago
          It seems that this fix was removed with some refactoring happened in #112. Tried with version 0.20.1 and the following config parameters:
current_version = "5.06.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor:02}.{patch}"]
search = "{current_version}"
replace = "{new_version}"

Increasing minor would result in version 5.70.0 which is obviously wrong. Any chances we get this functionality back? Or is there any other possibility to have fixed length version numbers?

Originally posted by @reindlt in https://github.com/callowayproject/bump-my-version/issues/26#issuecomment-2071756686

reindlt commented 6 months ago

Thanks @coordt for opening the issue.

I guess it's related to the same problem as mentioned in https://github.com/callowayproject/bump-my-version/pull/26#issue-1772530821 that the version parts are handled as strings. A possible solution has been described here https://github.com/c4urself/bump2version/pull/141#issue-615092830. Does this sound reasonable?

coordt commented 6 months ago

It looks reasonable. I'll look at it today.