This page describes the support in Skara for both creating and reviewing backports.
Terminology
A backport commit (often abbreviated to just backport) is a replica of an existing commit applied to a different repository. In most cases the backport commit will be applied to a repository representing an older release, for example creating a backport commit of a commit in the jdk repository for the jdk11u-dev repository.
A backport commit is considered clean if the changes in the original commit are identical to the changes in the backport commit. Note that only the changes has to be identical, not the changed lines.
Commit Message
All backport commits features an additional commit message trailer (a line in the last paragraph of the commit message) - Backport-of
. The Backport-of
trailer describes which commit the backport commit was created from. The following commit message shows an example:
8123456: This is a bug This commit fixes a tricky bug. Reviewed-by: ehelin Backport-of: 5a526c1c5716f6d9a7fc94741bcdb2f424d342df
In the example above it can be seen that the backport commit fixes the bug "JDK-8123456", has the summary "This commit fixes a tricky bug" and that the backport commit was reviewed by "ehelin". The Backport-of
trailer shows that the backport commit is a replica of the commit with hash 5a526c1c5716f6d9a7fc94741bcdb2f424d342df
.
Note that author metadata recorded in the backport commit is the author of the backport commit, not the author of the original commit. Likewise the reviewers recorded in the commit message are the reviewers of the backport commit, not the reviewers of the original commit. If the author of the backport isn't Author in the project that the backport commit is created for, then the backport commit can be sponsored. In the case of a backport being sponsored, then the author will recorded as the author of the commit and the sponsor as the committer of the commit (just as for regular commits).
Backport Pull Requests
Skara features a way to declare a pull request to be a "backport pull request" in order to ease the creation of backport commits. A "backport pull request" is a pull request which title is of the form "Backport [0-9a-z]{40}", for example "Backport 5a526c1c5716f6d9a7fc94741bcdb2f424d342df". The hash represents the hash of the original commit that is being backported. When the Skara bots encounter a "backport pull request" then they will:
- Find the original commit with the given hash
- Mark the pull request as solving same issues that was solved by the original commit
- Set the summary of the resulting commit of pull request to the summary of the original commit
- Append the correct
Backport-of
trailer to resulting commit when the pull request is integrated
Continuing with the example from the Commit Message section, a "backport pull request" with the title "Backport 5a526c1c5716f6d9a7fc94741bcdb2f424d342df" would result in bots marking the pull request as solving issue "JDK-8123456" and the final commit message to have the summary "This commit fixes a tricky bug". When the pull request is integrated the bots would also append "Backport-of: 5a526c1c5716f6d9a7fc94741bcdb2f424d342df" to the final commit message.