|
| 1 | +# Release a new Clippy Version |
| 2 | + |
| 3 | +_NOTE: This document is probably only relevant to you, if you're a member of the |
| 4 | +Clippy team._ |
| 5 | + |
| 6 | +Clippy is released together with stable Rust releases. The dates for these |
| 7 | +releases can be found at the [Rust Forge]. This document explains the necessary |
| 8 | +steps to create a Clippy release. |
| 9 | + |
| 10 | +1. [Find the Clippy commit](#find-the-clippy-commit) |
| 11 | +2. [Tag the stable commit](#tag-the-stable-commit) |
| 12 | +3. [Update `CHANGELOG.md`](#update-changelogmd) |
| 13 | +4. [Remerge the `beta` branch](#remerge-the-beta-branch) |
| 14 | +5. [Update the `beta` branch](#update-the-beta-branch) |
| 15 | + |
| 16 | +_NOTE: This document is for stable Rust releases, not for point releases. For |
| 17 | +point releases, step 1. and 2. should be enough._ |
| 18 | + |
| 19 | +[Rust Forge]: https://forge.rust-lang.org/ |
| 20 | + |
| 21 | + |
| 22 | +## Find the Clippy commit |
| 23 | + |
| 24 | +The first step is to tag the Clippy commit, that is included in the stable Rust |
| 25 | +release. This commit can be found in the Rust repository. |
| 26 | + |
| 27 | +```bash |
| 28 | +# Assuming the current directory corresponds to the Rust repository |
| 29 | +$ git fetch upstream # `upstream` is the `rust-lang/rust` remote |
| 30 | +$ git checkout 1.XX.0 # XX should be exchanged with the corresponding version |
| 31 | +$ git submodule update |
| 32 | +$ SHA=$(git submodule status src/tools/clippy | awk '{print $1}') |
| 33 | +``` |
| 34 | + |
| 35 | + |
| 36 | +## Tag the stable commit |
| 37 | + |
| 38 | +After finding the Clippy commit, it can be tagged with the release number. |
| 39 | + |
| 40 | +```bash |
| 41 | +# Assuming the current directory corresponds to the Clippy repository |
| 42 | +$ git checkout $SHA |
| 43 | +$ git tag rust-1.XX.0 # XX should be exchanged with the corresponding version |
| 44 | +$ git push upstream master --tags # `upstream` is the `rust-lang/rust-clippy` remote |
| 45 | +``` |
| 46 | + |
| 47 | +After this, the release should be available on the Clippy [release page]. |
| 48 | + |
| 49 | +[release page]: https://github.com/rust-lang/rust-clippy/releases |
| 50 | + |
| 51 | + |
| 52 | +## Update `CHANGELOG.md` |
| 53 | + |
| 54 | +For this see the document on [how to update the changelog]. |
| 55 | + |
| 56 | +[how to update the changelog]: https://github.com/rust-lang/rust-clippy/blob/master/doc/changelog_update.md |
| 57 | + |
| 58 | + |
| 59 | +## Remerge the `beta` branch |
| 60 | + |
| 61 | +This step is only necessary, if since the last release something was backported |
| 62 | +to the beta Rust release. The remerge is then necessary, to make sure that the |
| 63 | +Clippy commit, that was used by the now stable Rust release, persists in the |
| 64 | +tree of the Clippy repository. |
| 65 | + |
| 66 | +```bash |
| 67 | +# Assuming `HEAD` is the current `master` branch of rust-lang/rust-clippy |
| 68 | +$ git checkout -b backport_remerge |
| 69 | +$ git merge beta |
| 70 | +$ git diff # This diff has to be empty, otherwise something with the remerge failed |
| 71 | +$ git push origin backport_remerge # This can be pushed to your fork |
| 72 | +``` |
| 73 | + |
| 74 | +After this, open a PR to the master branch. In this PR, the commit hash of the |
| 75 | +`HEAD` of the `beta` branch must exists. In addition to that, no files should |
| 76 | +be changed by this PR. |
| 77 | + |
| 78 | + |
| 79 | +## Update the `beta` branch |
| 80 | + |
| 81 | +This step must be done **after** the PR of the previous step was merged. |
| 82 | + |
| 83 | +First, the Clippy commit of the `beta` branch of the Rust repository has to be |
| 84 | +determined. |
| 85 | + |
| 86 | +```bash |
| 87 | +# Assuming the current directory corresponds to the Rust repository |
| 88 | +$ git checkout beta |
| 89 | +$ git submodule update |
| 90 | +$ BETA_SHA=$(git submodule status src/tools/clippy | awk '{print $1}') |
| 91 | +``` |
| 92 | + |
| 93 | +After finding the Clippy commit, the `beta` branch in the Clippy repository can |
| 94 | +be updated. |
| 95 | + |
| 96 | +```bash |
| 97 | +# Assuming the current directory corresponds to the Clippy repository |
| 98 | +$ git checkout beta |
| 99 | +$ git rebase $BETA_SHA |
| 100 | +$ git push upstream beta [-f] # This requires a force push, if a remerge was done |
| 101 | +``` |
0 commit comments