The JDK 9 project is experimenting with the idea of submission forests. A submission forest allows committers to submit a change for automatic build, test and integration with an upstream forest. Initially we plan a
jdk9/hs-submit forest which will integrate to
jdk9/hs. This will allow non-Oracle committers to make changes to
jdk9/hs directly while still observing the Hotspot team's conventions for pre-integration build & test. Of course all the usual rules about who may make changes and how they are reviewed and approved will still apply.
A test version of the Hotspot submission forest exists today. The submission forest is jdk9/hs-demo-submit and its upstream forest is jdk9/hs-demo, a throw-away clone of jdk9/hs. Currently, push access to hs-demo-submit is restricted to a few beta testers.
Submission forests are modeled after the JDK9 sandbox forest. The default branch of the submission forest is automatically sync'd with its upstream forest. Committers do their work on named branches with one branch used per fix. When a branch is pushed to the submission forest, it is automatically run through a predefined set of builds and tests. If this succeeds, the changes on the branch are moved as a single changeset to the default branch of the upstream forest. If a branch fails to build, pass tests or merge successfully into the upstream forest, no changes are made upstream. At the end of the process a status email is sent to the committer.
A Simple Example
Say you need to make a simple fix to the hotspot README file in order to fix bug JDK-7000001. The following would do it:
A Note on the Examples
Many of the examples on this page use the
defpath.py Mercurial extensions. These extensions are available from the Code Tools project. These extensions are not necessary for using submission forests but they make handling multi-repo forests easier. Other methods for handling multiple repos, such as the
common/bin/hgforest.sh script, work as well.
- What should I call my branch?
- How should I create a branch?
- How do I supply a commit message for my change?
- How do I update my branch with the latest upstream changes?
- How should I push a branch?
- What happens when I push my changes?
- What if my submission fails?
- How are changes from upstream brought into the submission forest?
- Can I work on the default branch?
- Is jcheck turned on?
- How is my branch merged with the upstream forest?
- Should I close my branch?
- Can I reuse a branch for a different fix?
- How can I show all changes for my branch?
- How do I report problems?
What should I call my branch?
We recommend you name your branch with the bug id of your fix. Since Mercurial branch names can't begin with a number, use the full bug id, like "JDK-4040458"
How should I create a branch?
Create a branch in each repository that you need to change. For example, if your fix requires changes in both the jdk and hotspot repos, you could do this:
You can commit the empty branches immediately after they're created or wait until you have made code changes. Unlike the recommendation for the OpenJDK sandbox forest, you should not commit an empty branch in a repository that will not eventually have code changes. This will cause your fix to fail when it is merged with the upstream forest. This restriction will be removed in the future.
How do I supply a commit message for my change?
The commit message for the changeset at the head of your branch is used as the commit message for the changeset that is integrated to the default branch of the upstream forest.
How do I update my branch with the latest upstream changes?
Before you push a branch to the submission forest, you should merge in the latest upstream changes onto your branch.
There is something to be careful about in the previous example. If you merge just prior to pushing your branch to the submission forest, then the commit message for your changeset when it is integrated upstream will be taken from your merge changeset. As such, your merge changeset should describe your fix, your reviewers etc. and should not be just the simple string "Merge". This is different from standard OpenJDK practice and some may find it odd.
If you'd like to avoid this oddity, you may prefer to rebase your change like this:
Unfortunately the trees extension does not support a trebase command. Note that the rebase extension may need to be enabled in your
.hgrc file prior to using the rebase command.
How should I push a branch?
The first time you push a new branch to the submission forest, you need to use the "
--new-branch" option like this:
Subsequent pushes to your branch in the submission forest do not need the "
If your local forest has several fixes under development and you're ready to push only one, you can do that with the "
What happens when I push my changes?
When changes are pushed to a branch in a submission forest, a job is created on an internal Oracle system to build and test those changes. Jobs which integrate to the same upstream forest are run sequentially in order to manage merge issues so it is possible that your job will wait for some time to get started. Once running, a successful job should take about <60> minutes to complete. Unsuccessful jobs will usually complete more quickly. When your job is finished you will get an email describing what happened. If you are subscribed to the change alias for the upstream forest, you should also see an email if your change successfully integrates upstream.
What if my submission fails?
Your submission may fail to integrate with the upstream forest for several reasons:
- it may fail to build on one or more platforms
- it may fail tests on one or more platforms
- it may not merge cleanly with the default branch of the upstream forest
You will get an email describing which of these things happened; however, these emails are brief. At this time we are not able to provide build or test logs which fully describe the problem. If you are unable to diagnose the problem yourself, contact an Oracle engineer and provide her with the token in your email message. She will be able to access internal logs and help you resolve the problem.
Once the problem is found, you may make further commits to your branch and push again to the submission forest. Remember that the commit message from the head of your branch will be the one that is eventually used when your change is merged upstream.
How are changes from upstream brought into the submission forest?
Changes from the default branch of the upstream forest are pulled into the submission forest automatically.
Can I work on the default branch?
You can not make changes directly on the default branch of the submission forest. Your changes will appear on the default branch of the submission forest after they have been integrated upstream then automatically pulled down. Adding your changes directly to the default branch could require merges when the default branch is updated automatically and would likely break the automation. For this reason, changes to the default branch of the submission forest are disabled.
Is jcheck turned on?
jcheck Mercurial extension is not enabled for the submission forest; however, it generally is enabled for the upstream forest. If so, your change must pass
jcheck when it is merged with the upstream forest.
How is my branch merged with the upstream forest?
When a change to branch B is pushed to the submission forest, the difference between the head of B and the latest common ancestor of B and the default branch is computed as a single patch. This patch is then applied to the default branch in a child of the upstream forest. The commit message for the patch is taken from the commit message at the head of branch B. If the patch applies cleanly without jcheck errors and without needing manual merging, the child of the upstream forest is built & tested. If all builds and tests succeed, the child of the upstream forest is pushed into the upstream forest and the job is complete.
Should I close my branch?
Once your branch has been integrated upstream, it will be closed automatically. This is the common case. Occasionally though, there may be a branch that needs to be abandoned. This might happen when a branch has been pushed to the submission forest but failed to integrate upstream. Let's say you have branch "JDK-7000001" in the jdk repository that needs to be closed. You could do the following:
Note that for multi-repo fixes you need to close the branch in each repo where it exists and not in any repo where it doesn't. Solutions like the tree extension or the hgforest.sh script don't work well in this case. It may be easiest to close each branch individually by hand.
Can I reuse a branch for a different fix?
Branches are intended to be used for a single fix. They are automatically closed once the branch is integrated upstream and should not be reopened.
How can I show all changes for my branch?
To see all the changes for a branch named "JDK-4040458" you can do this:
How do I report problems?
If you have problems with submission forests, please send mail to email@example.com