Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build result in 0.0.0-01 instead of 0.0.0-dev1 #134

Open
RonZhang724 opened this issue Mar 9, 2020 · 3 comments · May be fixed by #186
Open

Build result in 0.0.0-01 instead of 0.0.0-dev1 #134

RonZhang724 opened this issue Mar 9, 2020 · 3 comments · May be fixed by #186

Comments

@RonZhang724
Copy link

I have the following .bumpversion.cfg: whenever I run bump2version build, the new_version becomes 0.0.0-01 Is there a way for the first build to become 0.0.0-dev1?

[bumpversion]
current_version = 0.0.0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
    {major}.{minor}.{patch}-{release}{build}
    {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = prod
first_value = dev
values =
    dev
    prod

[bumpversion:part:build]
@mtusseau
Copy link

mtusseau commented Jul 10, 2020

Hi, same problem here. I tried to setup a release-candidate workflow:

[bumpversion]
current_version = 2.0.0-rc1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>rc)(?P<rc>\d+))?
serialize = 
	{major}.{minor}.{patch}-{release}{rc}
        {major}.{minor}.{patch}-rc{rc}
	{major}.{minor}.{patch}
[bumpversion:part:release]
optional_value = release
first_value = rc
values = 
	rc
	release

Your build part is my rc part. Seems it works since:

bump2version rc --list --dry-run --current-version 2.0.0 --allow-dirty
   new_version = 2.0.0-rc1
bump2version rc --list --dry-run --current-version 2.0.0-rc1 --allow-dirty
   new_version = 2.0.0-rc2
bump2version release --list --dry-run --current-version 2.0.0-rc1 --allow-dirty
   new_version = 2.0.0
bump2version release --list --dry-run --current-version 2.0.0 --allow-dirty
   ValueError: The part has already the maximum value among ['rc', 'release'] and cannot be bumped.

Hope this will help.

@andersonbrands
Copy link

Hi, @RonZhang724 , I guess 0.0.0 translates to 0.0.0-prod0 which is greater than 0.0.0-dev1, hence "going up" here wouldn't make sense.

I believe bump2version build over 0.0.0-prod0 would produce 0.0.0-prod1, not sure why you got this leading zero in 0.0.0-01, maybe it has to do with prod being optional.

Hi, @mtusseau, in your case 2.0.0 would translate to 2.0.0-release0 so when you try to bump2version release over 2.0.0-release0 the word release is already the max value for the release part, so that you are not able to bump it. You can only bump2version release over a "cr release".

@florisla
Copy link
Collaborator

@RonZhang724 It's true that you can't go from 0.0.0 (with release being prod) to 0.0.0-dev1.

It's definitely a bug that 0.0.0-prod1 shows up as 0.0.0-01.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants