twisted / towncrier

Manage the release notes for your project.
https://towncrier.readthedocs.io
MIT License
755 stars 107 forks source link

"merge" command to help bringing release notes from release branches back to the default branch #534

Open mdellweg opened 11 months ago

mdellweg commented 11 months ago

It would be tremendously helpful if towncrier hat a merge command, where you could specify a second changes file (presumably a diverged version of the same on a different branch) and it would add all the missing versions release notes to the main changes file. Even more convenient, if you could just specify the other branch to get the changes from. This would help in a scenario where you release the software only on release branches and still want all the bugfix releases of old branches to show up in the main branches changelog. (Due to the nature of the context around the latest z on a branch, cherry-picks usually won't apply cleanly. Also this should not affect any changelog snippets.)

adiroiban commented 11 months ago

Hi, Thanks for the report.

It is not clear how this merge command will work.

Can you provide the documentation for how this feature could work?

Feel free to send a PR with a proof of concept for this command.

Regards

mdellweg commented 11 months ago

Let me try to explain by example. There is CHANGES.txt on the default branch containing entries for versions 2.0.0, 1.0.0 and now you need to release 1.0.1, which you do on a release branch (release-1.0). You cherry-pick some changes with their snippets and now call towncrier on that branch generating an entry for version 1.0.1. There are now charges for 1.0.1, 1.0.0 . Now I would want to switch back to the main branch and call ’towncrier merge --branch release-1.0’. I expect it to find the entry for 1.0.1 (and all other ones missing in the default branch) and fold it into the default branches CHANGES.txt, now containing 2.0.0, 1.0.1, 1.0.0 .

adiroiban commented 11 months ago

I guess that you need to get some sort of support for maintenance releases.

An exact example with an exact list of fragments in each branch and the expected content for each branch would help.

I am still not sure I understand what is needed here and what is your expected result :)

But I think is best to try write the documentation for this feature.

It can server as the specification for any future change and can be of great help once someone want to implement this functionality.

Cheers

mdellweg commented 11 months ago

@adiroiban I took a shot at the proof of concept, and hope some of it could be recycled into towncrier. The thing I implemented is a bit more specific and collects from all suspicious branches, but I think it could be turned into a loop over towncrier merge --branch ${BRANCHNAME} or git show ${BRANCHNAME}:docs/CHANGES.md | towncrier merge --file - if you don't want to involve git.

https://github.com/mdellweg/pulp-cli/blob/release_workflow/.ci/scripts/collect_changes.py

adiroiban commented 11 months ago

I get 404 on that page.

Feel free to send a PR.

As long as the functionality is well documented and tested it can be merged.


I am just helping maintain the package. For me, towncrier does what I need since 2017 ... so I don't see much use in any other new feature :)

This is why I don't want to add my subjective opinion on whether something is needed or not.

Regards

mdellweg commented 10 months ago

Right. This is what we use these days:

https://github.com/pulp/pulp-cli/blob/main/.ci/scripts/collect_changes.py

I hope, I will find the time soon to move it into a pr.