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

build number gets reset after 9, 19, 29, etc. #250

Closed ma-sadeghi closed 2 years ago

ma-sadeghi commented 2 years ago

Here's my setup.cfg:

[bumpversion]
current_version = 2.8.2.dev110
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.(?P<release>.*)(?P<build>\d+)
serialize = {major}.{minor}.{patch}.{release}{build}

[bumpversion:part:release]
values = dev

When the version number is 2.8.2.dev19, bump2version build bumps it to 2.8.2.dev110 instead of 2.8.2.dev20. It's very likely that my setup.cfg is buggy, would greatly appreciate it if you could take a look at it.

ma-sadeghi commented 2 years ago

Just figured it out, posting the solution just in case: the problem is .* in (?P<release>.*), which matches anything including digits, but I only wanted it to match dev. So, I replaced it with \D+ which only matches characters, and it just works.

[bumpversion]
current_version = 2.8.2.dev20
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.(?P<release>\D+)(?P<build>\d+)
serialize = {major}.{minor}.{patch}.{release}{build}

[bumpversion:part:release]
values = dev