Don't bump a part if a parent part has its 'final' ('production') value
See original GitHub issuebump2version 0.5.11
Here’s my config:
[bumpversion]
current_version = 0.2.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<suffix>[a-z]+))?(\.(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{suffix}.{build}
{major}.{minor}.{patch}-{suffix}
{major}.{minor}.{patch}
[bumpversion:part:suffix]
optional_value = prod
values =
dev
prod
[bumpversion:file:VERSION]
If I try to run bumpversion build
it will result in 0.2.0-0.1
which it should not.
It should throw error similar to the suffix part (ValueError: The part has already the maximum value among...
)
bumpversion part | current_version | new_version | works correctly? |
---|---|---|---|
build | 0.1.0-dev | 0.1.0-dev.1 | ✅yes |
suffix | 0.1.0-dev.1 | 0.1.0 | ✅yes |
minor | 0.1.0 | 0.2.0-dev | ✅yes |
build | 0.2.0-dev | 0.2.0-dev.1 | ✅yes |
suffix | 0.2.0-dev.1 | 0.2.0 | ✅yes |
build | 0.2.0 | 0.2.0-0.1 | ❌ should throw error |
suffix | 0.2.0-0.1 | n/a | ❌throws ValueError: The part has already the maximum value among ['dev', 'prod'] and cannot be bumped. ,should throw regex mismatch error |
build | 0.2.0-0.1 | 0.2.0-0.1 | ❌ should throw regex mismatch error |
Also checked my regex, it works properly https://regexr.com/4rqaj
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Japanese gov't wants to give people an extra ¥80,000 to have ...
Currently, new parents in Japan receive a Childbirth and Childcare Lump-Sum Grant of 420,000 yen upon the birth of their child. Health, Labor ......
Read more >Netflix, Disney, NFL: Executives make media predictions for ...
CNBC asked 12 past and present media executives for one industry-shaking prediction for 2023 under the veil of anonymity.
Read more >Boomerang Children May Unknowingly Expose Their Parents ...
A parent of an adult child living at home who can be claimed as a dependent is liable for a non-exempt, uninsured dependent,...
Read more >When trends aren't a straight line of progress (part two): Productivity ...
In part two of this series on productivity, explore the factors that are driving the global slowdown in productivity growth.
Read more >Reverse Stock Split: What It Is, How It Works, Examples
A reverse stock split consolidates the number of existing shares of corporate stock into fewer, proportionally more valuable, shares.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I understand your use case now.
The behaviour you want could be implemented as an optional feature in a
[part:name]
section.Semver generally concerns releases, not commits, but I see your reasoning.
But this usually solved one way or another with develop/feature branches and/or CI/CD tools, for example, by adding branch name and commit hash to version string in compiled files, if commit doesn’t have a tag and/or not in the master branch.
Anyway, I think we went off topic on this.
Bumping build part on
prod
should either result in error,0.2.0-dev.1
or0.2.0-dev
to comply with the scheme.