-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat: preserve prerelease linearity #800
feat: preserve prerelease linearity #800
Conversation
Codecov ReportAttention:
📢 Thoughts on this report? Let us know!. |
Step 4 might be confusing. The logic makes sense. But we might need to design it in another way. Adding a |
I'm not a big fan of this change, because things start getting confusing. I'd rather raise an error of the wrong value is used. But, I also struggle to see if it's worth to enforce it. Maybe behind a setting "enforce_prereleases" What's the motivation for this PR? |
This PR builds on top of PR #799, and came from our branching model at work: PR branches merge into “downstream” branches and release packages on each branch. So,
Each of these downstream merges automatically creates a bump commit on the target branch and a tag on the bump commit. However, to ensure a consistent history across branches, upstream branches always automatically rebase on top of downstream branches. I illustrated @eduardocardoso’s example above: On the right side of the image you have the growing Because we continuously rebase downstream branches, we quickly get into a place where the |
3b94be0
to
60aa9ad
Compare
I see 🤔 I'm fine with it as long as proper documentation is added, I can already foresee users complaining that doing I think we are taking an opinionated approach on how it should be done, and that's what I would like to see reflected in the docs. I'm not a big user of prereleases myself, so I trust you on this model. |
Agreed — and it probably makes sense to add a command-line switch that enables precedence bumping. For example if the current version is
We can either make the argument to Also note that this PR addresses the uncertainty of this test: commitizen/tests/test_version_scheme_pep440.py Lines 46 to 50 in af11332
Instead of expecting “graceful” handling of this case, we can now clearly define the expected behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a new section about pre-releases
inside the bump command explaining "prerelease linearity" 🙏🏻
Close as suggested |
Description
Forbid going back in prerelease level, after a
beta
orrc
prerelease is made the next prerelease without a version number bump will be the same type if a lower or equal level is provided.a -> b -> rc
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
After a prerelease it will only allow to keep or increase the prerelease level.
A bump from
b0
with--prerelease alpha
will generata ab1
release instead of going back toa0
.Steps to Test This Pull Request
Start at versions 0.1.0
git commit --allow-empty -m 'fix: bug'
cz bump --prerelease alpha
→ bumps to0.1.1a0
cz bump --prerelease beta
→ bumps to0.1.1b0
cz bump --prerelease alpha
→ bumps to0.1.1b1
cz bump --prerelease rc
→ bumps to0.1.1rc0
cz bump --prerelease alpha
→ bumps to0.1.1rc1
cz bump --prerelease beta
→ bumps to0.1.1rc2
Additional context