Skip to content

feat(bump): support prereleases with a start offset #614

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

Merged
merged 1 commit into from
Feb 11, 2023
Merged

feat(bump): support prereleases with a start offset #614

merged 1 commit into from
Feb 11, 2023

Conversation

ckagerer
Copy link
Contributor

@ckagerer ckagerer commented Oct 20, 2022

This PR solves #613

For special cases it may be necessary that prereleases cannot start with a 0, because the single characters are encoded in bytes. Here, consistent with the location for bugfixes, a 0 in the byte is interpreted as a release version. Therefore this commit introduces a generic option to change the start of the prerelease and also adapt it to such circumstances.

EXAMPLES

Previously:
0.3.0 -> PATCH beta-> 0.3.1b0

Now (with offset 0 == default):
0.3.0 -> PATCH beta-> 0.3.1b0

Now (with offset 1):
0.3.0 -> PATCH beta-> 0.3.1b1

Description

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

Steps to Test This Pull Request

Additional context

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ckagerer , thanks for your contribution and sorry for taking so long. The code looks good to me 🙌 But we might need your help to add some documentation and rebase the latest changes from the master branch.

@ckagerer
Copy link
Contributor Author

Hi @Lee-W,
Thanks for your feedback and initial review.

I have rebased the latest master branch to my feature branch.

Where do you expect the documentation to be?
More in the code or is there more documentation?

Best regards
Christian

@Lee-W
Copy link
Member

Lee-W commented Jan 26, 2023

Hi @ckagerer thanks for the prompt update. I think we'll need to add the usage in https://github.com/commitizen-tools/commitizen/blob/master/docs/bump.md so that users know how to use

@ckagerer
Copy link
Contributor Author

@Lee-W
Sure, I will be happy if my PR is integrated :)

I have already extended the documentation in config.md.

Should I also include a command line argument, or is it enough just to use the configuration?

@Lee-W
Copy link
Member

Lee-W commented Jan 26, 2023

@ckagerer It would be better if you could add the command line argument. Also, I notice we'll have to update the output of cz bump --help in https://github.com/commitizen-tools/commitizen/blob/master/docs/bump.md

@ckagerer
Copy link
Contributor Author

@Lee-W
Command line argument has been added and I have extended the documentation.
What do you think?

@Lee-W
Copy link
Member

Lee-W commented Jan 26, 2023

Hi @ckagerer it looks great! I think our last step is to taking care of the CI failure.

@ckagerer
Copy link
Contributor Author

Hey @Lee-W

Oh yes, I have ignored this so far because one of the unit tests fails locally on the master.

It seems to go wrong when installing with pip. Any experience with this?

I can try a poetry update to see if that helps.

@ckagerer
Copy link
Contributor Author

No, there are no updates at all.
It fails with the "poetry install" but I have no idea why.

@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Base: 97.92% // Head: 98.03% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (c6fd959) compared to base (619e2d2).
Patch coverage: 87.87% of modified lines in pull request are covered.

❗ Current head c6fd959 differs from pull request most recent head dd2e075. Consider uploading reports for the commit dd2e075 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #614      +/-   ##
==========================================
+ Coverage   97.92%   98.03%   +0.11%     
==========================================
  Files          35       39       +4     
  Lines        1252     1682     +430     
==========================================
+ Hits         1226     1649     +423     
- Misses         26       33       +7     
Flag Coverage Δ
unittests 98.03% <87.87%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commitizen/commands/init.py 87.93% <84.00%> (-3.74%) ⬇️
commitizen/__version__.py 100.00% <100.00%> (ø)
commitizen/commands/check.py 100.00% <100.00%> (ø)
commitizen/config/yaml_config.py 100.00% <100.00%> (ø)
commitizen/exceptions.py 100.00% <100.00%> (ø)
commitizen/changelog.py 99.43% <0.00%> (ø)
commitizen/__init__.py 100.00% <0.00%> (ø)
commitizen/bump.py 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Lee-W
Copy link
Member

Lee-W commented Jan 26, 2023

Do you have the error message?

@ckagerer
Copy link
Contributor Author

@Lee-W

I think I read the message completely wrong :)

I ran the format script again and it was one line short. Now it should fit :)

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ckagerer for your contribution!

@woile I plan to merge this one by the end of this week. Let me know if you want to take a look.

In special cases, it may be necessary for prereleases not to start with a 0, because the individual characters are encoded in bytes. Here, a 0 in the byte is interpreted as a release version, consistent with the location of bugfixes. Therefore, this commit introduces a generic option to change the start of the prerelease to accommodate such circumstances.

EXAMPLES

Before:
0.3.0 -> PATCH beta-> 0.3.1b0

Now (with offset 0 == default)
0.3.0 -> PATCH beta-> 0.3.1b0

Now (with offset 1)
0.3.0 -> PATCH beta-> 0.3.1b1
@Lee-W Lee-W merged commit 583c7dd into commitizen-tools:master Feb 11, 2023
@ckagerer ckagerer deleted the feature/prerelease_offset branch February 11, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants