]> git.lizzy.rs Git - rust.git/blob - doc/release.md
Fix test comment for `while_let_on_iterator`
[rust.git] / doc / release.md
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. [Remerge the `beta` branch](#remerge-the-beta-branch)
11 2. [Update the `beta` branch](#update-the-beta-branch)
12 3. [Find the Clippy commit](#find-the-clippy-commit)
13 4. [Tag the stable commit](#tag-the-stable-commit)
14 5. [Update `CHANGELOG.md`](#update-changelogmd)
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 ## Remerge the `beta` branch
23
24 This step is only necessary, if since the last release something was backported
25 to the beta Rust release. The remerge is then necessary, to make sure that the
26 Clippy commit, that was used by the now stable Rust release, persists in the
27 tree of the Clippy repository.
28
29 To find out if this step is necessary run
30
31 ```bash
32 # Assumes that the local master branch is up-to-date
33 $ git fetch upstream
34 $ git branch master --contains upstream/beta
35 ```
36
37 If this command outputs `master`, this step is **not** necessary.
38
39 ```bash
40 # Assuming `HEAD` is the current `master` branch of rust-lang/rust-clippy
41 $ git checkout -b backport_remerge
42 $ git merge upstream/beta
43 $ git diff  # This diff has to be empty, otherwise something with the remerge failed
44 $ git push origin backport_remerge  # This can be pushed to your fork
45 ```
46
47 After this, open a PR to the master branch. In this PR, the commit hash of the
48 `HEAD` of the `beta` branch must exists. In addition to that, no files should
49 be changed by this PR.
50
51
52 ## Update the `beta` branch
53
54 This step must be done **after** the PR of the previous step was merged.
55
56 First, the Clippy commit of the `beta` branch of the Rust repository has to be
57 determined.
58
59 ```bash
60 # Assuming the current directory corresponds to the Rust repository
61 $ git checkout beta
62 $ BETA_SHA=$(git log --oneline -- src/tools/clippy/ | grep -o "Merge commit '[a-f0-9]*' into .*" | head -1 | sed -e "s/Merge commit '\([a-f0-9]*\)' into .*/\1/g")
63 ```
64
65 After finding the Clippy commit, the `beta` branch in the Clippy repository can
66 be updated.
67
68 ```bash
69 # Assuming the current directory corresponds to the Clippy repository
70 $ git checkout beta
71 $ git reset --hard $BETA_SHA
72 $ git push upstream beta
73 ```
74
75
76 ## Find the Clippy commit
77
78 The first step is to tag the Clippy commit, that is included in the stable Rust
79 release. This commit can be found in the Rust repository.
80
81 ```bash
82 # Assuming the current directory corresponds to the Rust repository
83 $ git fetch upstream    # `upstream` is the `rust-lang/rust` remote
84 $ git checkout 1.XX.0   # XX should be exchanged with the corresponding version
85 $ SHA=$(git log --oneline -- src/tools/clippy/ | grep -o "Merge commit '[a-f0-9]*' into .*" | head -1 | sed -e "s/Merge commit '\([a-f0-9]*\)' into .*/\1/g")
86 ```
87
88
89 ## Tag the stable commit
90
91 After finding the Clippy commit, it can be tagged with the release number.
92
93 ```bash
94 # Assuming the current directory corresponds to the Clippy repository
95 $ git checkout $SHA
96 $ git tag rust-1.XX.0               # XX should be exchanged with the corresponding version
97 $ git push upstream master --tags   # `upstream` is the `rust-lang/rust-clippy` remote
98 ```
99
100 After this, the release should be available on the Clippy [release page].
101
102 [release page]: https://github.com/rust-lang/rust-clippy/releases
103
104
105 ## Update `CHANGELOG.md`
106
107 For this see the document on [how to update the changelog].
108
109 [how to update the changelog]: https://github.com/rust-lang/rust-clippy/blob/master/doc/changelog_update.md