Skip to content

Commit

Permalink
Add tools/backports.py to help with making patch releases
Browse files Browse the repository at this point in the history
The main purpose of this script is to automate the changelog transformations
involved in backports. Many cherry-picks lead to changelog conflicts, and
we need also to rearrange the changelog on the main branch.

To make the backport branch, first we query the set of PRs that are tagged with
'needs-backport'. Then we sort them in chronological order by date merged.
(This was annoying to do manually -- the github interface lets you sort PRs
by creation date or last modified date but not by merge date).

Then we cherry-pick each commit in order by merge date but also render the change log
automatically. If the cherry-pick succeeds, we write out the new change log and amend
the commit. If it fails, we write out the change log and add it. We also check if
pyodide-build is in conflict and if so I take the new `pyodide-build` commit that.
Then we try `git cherry-pick --continue`. If it still fails, we abort and ask the user
to resolve conflicts manually, run `git cherry-pick --continue` and then rerun the script.
For this to work, we need to set `rerere.enabled` and `rerere.autoupdate`.

I implement a parser for the changelog to perform the transformations needed. This
is the most complicated part, since we want to maintain the ordering and the structure
while moving entries from one section to another.

I also added utilities for adding or removing the "needs backport" label and for showing
which backport PRs are missing changelog entries.
  • Loading branch information
hoodmane committed Feb 25, 2025
1 parent 5dd6ced commit 3bf30ef
Show file tree
Hide file tree
Showing 2 changed files with 1,008 additions and 0 deletions.
Loading

0 comments on commit 3bf30ef

Please sign in to comment.