-
-
Notifications
You must be signed in to change notification settings - Fork 267
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(bump): functionality to add build-metadata to version string #949
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #949 +/- ##
==========================================
+ Coverage 97.33% 97.40% +0.06%
==========================================
Files 42 55 +13
Lines 2104 2388 +284
==========================================
+ Hits 2048 2326 +278
- Misses 56 62 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I tried to not "disturb" anything already implemented with "local version" already, but I had to wrap some changelog version logic inside a |
Looks good! I'll wait a bit more for reviews, probably next year I'll get to merge it |
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.
Sorry for taking so long. This looks great! Let's merge it
@xeor I just noticed there's some conflict. Could you please help us rebase it and resolve the conflict? Once it's done, I think we're good to merge it. |
Tried to rebase, but there are some changes upstream that the formatter doesnt like and pre-commit hook changes. diff --git a/commitizen/cz/base.py b/commitizen/cz/base.py
index 14d9e5a..d9bf5ea 100644
--- a/commitizen/cz/base.py
+++ b/commitizen/cz/base.py
@@ -37,9 +37,9 @@ class BaseCommitizen(metaclass=ABCMeta):
change_type_order: list[str] | None = None
# Executed per message parsed by the commitizen
- changelog_message_builder_hook: None | (Callable[[dict, git.GitCommit], dict]) = (
- None
- )
+ changelog_message_builder_hook: None | (
+ Callable[[dict, git.GitCommit], dict]
+ ) = None
# Executed only at the end of the changelog generation
changelog_hook: Callable[[str, str | None], str] | None = None
diff --git a/commitizen/cz/exceptions.py b/commitizen/cz/exceptions.py
index d74f39a..2597b68 100644
--- a/commitizen/cz/exceptions.py
+++ b/commitizen/cz/exceptions.py
@@ -1,4 +1,6 @@
-class CzException(Exception): ...
+class CzException(Exception):
+ ...
-class AnswerRequiredError(CzException): ...
+class AnswerRequiredError(CzException):
+ ...
diff --git a/tests/test_changelog.py b/tests/test_changelog.py
index 879443f..8aef10a 100644
--- a/tests/test_changelog.py
+++ b/tests/test_changelog.py
@@ -1298,9 +1298,9 @@ def test_render_changelog_with_changelog_message_builder_hook(
gitcommits, tags, any_changelog_format: ChangelogFormat
):
def changelog_message_builder_hook(message: dict, commit: git.GitCommit) -> dict:
- message["message"] = (
- f"{message['message']} [link](github.com/232323232) {commit.author} {commit.author_email}"
- )
+ message[
+ "message"
+ ] = f"{message['message']} [link](github.com/232323232) {commit.author} {commit.author_email}"
return message
parser = ConventionalCommitsCz.commit_parser
diff --git a/tests/test_cz_customize.py b/tests/test_cz_customize.py
index 20a17b3..9f3556f 100644
--- a/tests/test_cz_customize.py
+++ b/tests/test_cz_customize.py
@@ -498,8 +498,7 @@ def test_answer_unicode(config_with_unicode):
}
message = cz.message(answers)
assert (
- message
- == "✨ feature: this feature enables customization through a config file"
+ message == "✨ feature: this feature enables customization through a config file"
)
cz = CustomizeCommitsCz(config_with_unicode)
@@ -575,8 +574,7 @@ def test_commit_parser(config):
def test_commit_parser_unicode(config_with_unicode):
cz = CustomizeCommitsCz(config_with_unicode)
assert (
- cz.commit_parser
- == "^(?P<change_type>✨ feature|🐛 bug fix):\\s(?P<message>.*)?"
+ cz.commit_parser == "^(?P<change_type>✨ feature|🐛 bug fix):\\s(?P<message>.*)?"
) shall I ignore them or wait for you guys to fix the formatting upstream? |
hmmm... just ignore the formating issue and let me resolve it 😄 |
I think it is ready now @Lee-W . There are 3 pr-status labels, but I guess it's back in the queue? :) |
@xeor It seems there's a conflict between this branch and the main branch. We might need your help on that. You can do it with the following commands. git remote add upstream https://github.com/commitizen-tools/commitizen
git checkout master
git pull upstream master
git checkout issue-945
git rebase -i master |
Thanks @Lee-W , I think it is finally mergable 👍 |
Awesome work! Let's merge it! |
Description
A way to add build-metadata from the cli using parameters, including being able to change them at as you want without disturbing the other version-logic in commitizen.
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
Should add additional functionality without disturbing anything.
Steps to Test This Pull Request
Additional context
Closes: #945