Closed luckydonald closed 4 years ago
Encountered a similar problem when I tried to set up support for release candidates.
I came up with
[bumpversion]
current_version = 3.0
commit = True
tag = True
tag_name = {new_version}
parse = (?P<major>\d+)\.(?P<minor>\d+)(?P<rc>.*)
serialize =
{major}.{minor}{rc}
{major}.{minor}
[bumpversion:part:rc]
optional_value = final
values =
rc1
rc2
rc3
rc4
rc5
final
But it has troublesome usage. For bump 3.0 -> 3.1rc1
I need to bump minor
, and for bump 3.1rc5 -> 3.1
I need to bump rc
which is counterintuitive.
I'd like to bump rc
for 3.0 -> 3.1rc1
and bump minor
(or something like final
) for 3.1rc1 -> 3.1
.
@luckydonald I just ran into the same thing. You probably already figured it out by now, but note that your parsing only detects 4.0.1.
and not 4.0.1
. You should move the dot to be a part of the optional string...?(.(dev)?(?...
.
@c4urself it would be great if the repo had instructions or examples of how to write these "parsing regex" strings for serializers with multiple options, e.g.
{major}.{minor}.{patch}.dev{dev}
{major}.{minor}.{patch}
It's not that easy to figure out what the string should be without reading the code in detail.
@drastawi I did not so far 😅
You're right indeed.
However it still shouldn't bump from 4.0
to 4.0
...
@luckydonald, I think you are trying to bump to an "invalid" version, so the code just tries its best guess, and I think it's the right choice since there is no patch that the serializer could recognize.
After I moved the dot to dev/pre part of the serializer, bumping the patch worked very well for me.
What happens is, bump2version parses 4.0.1
using the regex and detects 4.0
due to a bug in the regex.
And 4.0
is a valid version since serialize
contains {major}.{minor}
. It thinks you ask for 4.0 and internally that becomes 4.0.0 with pre=final and dev=0.
We can't block bumping from 4.0.1 to 4.0.0 because bumping down is valid in some cases (e.g. move back from 4.0.0 to 3.9.9).
I am currently at version
4.0.1.dev2
, and want to proceed to non-dev4.0.1
. Instead I end up with4.0
.Reproduction
The command is
$ bump2version dev --new-version 4.0.1
, the code is luckydonald/pytgbot@85bf22.Other issues
This might probably be related to #30, and could benefit from #22.
Details
Here is the full output, fully how it at some point just changes the version number to be wrong.