...
Table of Contents | ||||
---|---|---|---|---|
|
Making a change that also belongs on master (a “backport”)
For newer repositories, substitute main for master. However, the named release branch is still called open-release/XXX.master in every repository.
...
top-level repository, signified by the presence of a open-release/XXX.master named release branch; or a
library repository, which is installed into the release by pip or npm and thus doesn’t have a named release branch.
Backporting to a top-level repository
Info |
---|
This is the most common workflow. |
Ensure the change is already merged to master and deployed.
Find the commit hash(es) of the fix you need from master. They might be the same as in the fix pull request you are copying from, or they may be different if the pull request was closed with a squash. The best thing to do is to update your master branch, and get the hashes shown in your local git log:
$ git log
Check out the release branch:
$ git checkout open-release/XXX.master
$ git pull
Make a new branch from the release:
$ git switch -c <YOURNAME>/<BRANCHNAME>
Cherry-pick the commits onto your branch. Do this for all your commits:
$ git cherry-pick -x <COMMITHASH> ...
Push your branch:
$ git push -u origin HEAD
Make a pull request from your branch, using open-release/XXX.master as the base. In your pull request description, mention the original pull request on master that you are copying, if you can.
Tag people for review. The pull request will be handled and merged like any other.
Backporting to a library repository
Note |
---|
This can seem complicated the first time you do it. Reach out to #wg-build-test-release if you need help! |
Ensure the change is already merged to master and released to PyPI/NPM.
Identify the top-level repository(s) that install this library – searching the package name in GitHub search can help. We’ll call these the dependent repositories.
Determine whether you should upgrade the named release to the latest library version or cut a backports release. If you’re unsure, the latter is always safer.
Check whether the library already has a backports branch for this release:
git log XXX-backports
(where XXX is the release name). If so, you should use this branch. Jump directly to Cutting a backports release.For each dependent repository, identify the version of the library that is used on open-release/XXX.master – we’ll call that version
A
. If different versions of the library are used across top-level repositories, take the smallestA
.Identify the latest version of the library, which should have your change on it. Let’s call it
B
.Look at the changeset between
A
andB
. You can do this with GitHub:https://github.com/openedx/<library_repo>/compare/<A>...<B>
.Do you feel comfortable backporting that entire changeset to each dependent repository in the named release?
If so, jump to Upgrade the named release to the latest library version.
If not, continue on to Cut a backports release.
Upgrade the named release to the latest library version:
Open a PR in each dependent repository to upgrade the library to the latest version.
Tag people for review & merge your PR(s).
You’re all set!
Cut a backports release:
Does the library have a backports branch already?
If so, check it out and update it:
$ git switch XXX-backports && git pull
If not, check out a version of the library that is similar to what dependent repositories are using for this named release. From that version, create a named release branch:
$ git switch -c XXX-backports && git push -u origin XXX-backports
Create your own branch, based on the backports branch:
$ git switch -x <YOURNAME>/<BRANCHNAME>
Cherry-pick the commits onto your branch. Do this for all your commits:
$ git cherry-pick -x <COMMITHASH> ...
Update the version number to one that is similar to the current version on the backports branch, but not already taken by another release of the library. It should not exceed the latest library version number, because that would be confusing. Bumping the patch version is generally appropriate. Use your best judgement. We’ll call this the latest backports version.
Push your branch:
$ git push -u origin HEAD
Make a pull request from your branch, using XXX-backports as the base. In your pull request description, mention the original pull request on master that you are copying, if you can.
Tag people for review & merge your PR.
Open a PR in each dependent repository to upgrade the library to the latest backports version. Tag people for review & merge your PR(s).
You’re all set!
Making a change that is special to the named release
Sometimes a change is needed that doesn’t correspond to a change on master.
Changing a top-level repository
If your change should only be made on the named release branch of a top-level repository, there is nothing special to do. You make a change and create a pull request. The only difference is that the base of the pull request should be open-release/XXX.master instead of master. Explain in your pull request description why this should be a release-only change and doesn’t apply to master.
Changing a library repository
If your changes to a library should only be reflected in a named release, then refer to the Cutting a backports release step within the Backporting to a library repository process above. Instead of cherry-picking commits from master, though, just apply your special release-only changes and propose them in PR to the XXX-backports branch.
...