Skip to content

fix(changelog): allow rev range lookups without a tag format #623

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
Nov 30, 2022

Conversation

gsalvatella
Copy link
Contributor

@gsalvatella gsalvatella commented Nov 27, 2022

The current default setting for tag_format is None. This is not a problem for the bump command, since the normalize_tag function defaults to $version when no tag_format is passed. However it is a problem for the changelog command, which seems to explicitly demand a tag_format in order to run a rev-range lookup. This creates issues like #622.

Either a sane default needs to be set for tag_format or the restriction in changelog has to be uplifted. In this commit the latter has been chosen. A test is also implemented to check that changelog will always compute a rev range with the default tag format.

Fixes #622

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 -> Not needed

Expected behavior

See #622

Steps to Test This Pull Request

See #622

@gsalvatella
Copy link
Contributor Author

While this fixes the issue, I think that the root of the problem here lies in not defining a proper default for tag_format. Mostly all parameters should have a sane default. Otherwise they come to bite you down the line, as it happens with #622

@gsalvatella
Copy link
Contributor Author

BTW the current failures in the tests haven't been introduced by this PR...

@woile
Copy link
Member

woile commented Nov 29, 2022

Thanks for the contribution 🎉 . Yes, we try to have defaults, but sometimes with many contributors and needs things slip through. The problems have been fixed, could you rebase and push again?

@gsalvatella
Copy link
Contributor Author

The pipelines have been cancelled?

@Lee-W
Copy link
Member

Lee-W commented Nov 29, 2022

It seems to be an error on testing. But I just retrigger it

The current default setting for `tag_format` is `None`. This is not a
problem for the `bump` command, since the `normalize_tag` function
defaults to `$version` when no `tag_format` is passed. However it is a
problem for the `changelog` command, which seems to explicitly demand a
`tag_format` in order to run a rev-range lookup. This creates issues
like commitizen-tools#622.

Either a sane default needs to be set for `tag_format` or the
restriction in `changelog` has to be uplifted. In this commit the latter
has been chosen. A test is also implemented to check that `changelog`
will always compute a rev range with the default tag format.

Fixes commitizen-tools#622
@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Base: 97.92% // Head: 97.92% // No change to project coverage 👍

Coverage data is based on head (d570be1) compared to base (db42a95).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #623   +/-   ##
=======================================
  Coverage   97.92%   97.92%           
=======================================
  Files          35       35           
  Lines        1252     1252           
=======================================
  Hits         1226     1226           
  Misses         26       26           
Flag Coverage Δ
unittests 97.92% <100.00%> (ø)

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

Impacted Files Coverage Δ
commitizen/commands/changelog.py 98.86% <100.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.

@gsalvatella
Copy link
Contributor Author

🎉

@woile woile merged commit 0801ee2 into commitizen-tools:master Nov 30, 2022
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.

cz ch <tag> prints the whole changelog if tag_format is not set
3 participants