-
-
Notifications
You must be signed in to change notification settings - Fork 204
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(changelog): support generating changelog for different branches #808
Conversation
although the result of the test commit first tags v0.1.0 and v0.2.0, then it checks out v0.1 and creates a new v0.1.1 tag. in my opinion the expected full changelog should contain v0.1.0 and v0.1.1 instead of v0.2.0 only see #750 @chrissi-p |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #808 +/- ##
==========================================
- Coverage 40.13% 40.02% -0.10%
==========================================
Files 20 20
Lines 1645 1657 +12
==========================================
+ Hits 660 663 +3
- Misses 985 994 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thanks for the PR! The issue is more clear to me now and I'm considering to switch to this new behavior. However, I need some explanations about how this is supposed to work :)
Also, any idea why the topo order fixture is failing? I'm trying to understand the change of behavior and its relation to the topo order 🤔 |
Because the tags chosen for the changelog are different now. |
@orhun i've updated the description and the test cases. can you take a look at it plz? |
Well, I'm not fully convinced to go ahead with this. It breaks the topo order argument in a way that I don't understand.
Maybe you can expand this a bit? |
Maybe there is a way of supporting both cases if the commits are on other branches? I'm not really sure if this fix is worth breaking the topo order argument. |
those features are independent from each other. My change only affects "what" commits are chosen, while leaving "how" they are sorted untouched. See the chart below if it helps: When one project has both v1 and v2 branches. It is typical that v1 branch change log does not include the changes from v2 since the code never exists in v1. And vice versa. The red dash areas are the tags considered for change log depending on at which commit the dev executes git-cliff |
hi @orhun is the explanation good enough or you are still looking into more details? |
Okay I see now. And thanks for the diagram 🙂 How about we do something like this to support both cases? self.should_include_tag(&head_commit, &commit)? || topo_order |
@orhun maybe i don't fully understand the purpose of topo_order, it seems when not specified, it uses whatever order it would be useful for any chosen set of the tags. with the suggested change, in order to use topo_order one must include all the tags in the changelog. maybe you mean some configuration like |
Yeah, the tags are sorted by date as default.
That's correct, we simply disable this new
Do you mean adding a new configuration option? |
yes. i would suggest adding another option to toggle the tag filtering explicitly. because in the case when the tags are filtered, it is also desired to use the topo order but not the chronicle order. i still think filtering the tags and sorting the tags are independent from each other. with the suggested change, we will find two cases not available in the function matrix.
|
@orhun by separating the sort and filter option. it should be easier to add new sorting method like sort by semver version number etc. wdyt? |
yeah, I think that's the most sensible thing to do for supporting both use cases at this point.
Do you mean something like: sort_tags = "topo"
sort_tags = "date" # or chronically
sort_tags = "semver" |
407a6c4
to
4adeb7b
Compare
@orhun ok i added a new flag to opt-in.
yes, if in the future there are more options added to sorting, the change should not be breaking the tag filtering. |
hi @orhun what do you think of the latest changes? |
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, thanks for the contribution & bearing with me :)
Applied some nitpicks and approved!
Description
close #750
Motivation and Context
When a project needs to maintain diverged branches and create changelog for each branch this change is necessary.
for example a project's v3 is a complete rewrite and the changes onward have nothing to do which v2 branch. While v2 is in maintenance mode that the fixes are not relevant to v3 anymore.
when creating changelog for v3, it is necessary not to include the changes in the v2 which are not even included in the current branch
How Has This Been Tested?
Screenshots / Logs (if applicable)
Types of Changes
Checklist: