...
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 git hash of the original commit that is being backported. When the Skara bots encounter a "backport pull request" then they will:
...
In certain cases, the original commit for a fix is not publicly available, but a "backport pull request" still needs to be created. For this case, there is an alternate format for the pull request title: "Backport <issueId>" (e.g. "Backport JDK-1234567"). This will initiate the pull request as a "backport pull request", but without any reference to the original commit. This means that the commit message will also not contain the Backport-of
trailer. The only real advantage of declaring a pull request in this way, compared to a normal pull request, is to avoid getting a warning about the issue not being open, and of course to clearly communicate to reviewers the intent of the change being a backport. Omitting the backport declaration for this kind of pull request will not affect the format of the commit message, nor how a backport issue is created in JBS.
Backport Commit/Pull Request Command
The /backport commit command and /backport pull request command can be used to quickly create a backport pull request for a given commit. Just navigate to the original commit or pull request in source code hosting provider's web UI and add a comment consisting of /backport <repo> [<branch>]
. If the commit does not apply clean on the target repository then a message will be shown for the files with conflicts.
...
The pull request will be created from a branch in a shared fork of the target repository. On GitHub, this repository is owned by the openjdk-bots organization. The first time you issue the /backport command for a specific target repository, you will receive an invitation to collaborate in the fork repository. This invitation needs to be accepted to be able to further update the backport pull request with more changes.
Creating backports
Web UI
Navigate the to commit indented intended to be backported in the source code hosting provider's web UI and issue the /backport commit command. If the commit applied cleanly onto the target repository then go to the pull request linked in the reply and issue the /integrate pull request command.
If the commit did not apply cleanly then the commit must be backport manually and backport pull request must be created manually. See the CLI section for an example of how to do this using the command-line.
CLI
Use the Skara CLI tool git-backport to try to automatically create a backport pull request for the given commit, for example:
...
The output from the final git push
will return a link that can be used to create the pull request.
Backporting from mercurial
If you want to backport a mercurcial changeset, note that you should be able to find the corresponting git commit by searching git's commit history. You can for example do `git log | grep <jbs-issue-id>`, or search for the `<jbs-issue-id>` in the source code hosting provider's web UI.
Changed paths and renamed files
Some file paths are significantly different between jdk8 and higher. This can make it hard for git to apply a backport patch, it might give errors connected to "rename detection". unshuffle_patch.sh is a script that changes file paths in a patch, to account for the layout changes between 8 and 11. The current state of this script is known to be incomplete to some extent, but it can still be valuable.