@@ -7,112 +7,114 @@ Clippy is released together with stable Rust releases. The dates for these
7
7
releases can be found at the [ Rust Forge] . This document explains the necessary
8
8
steps to create a Clippy release.
9
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.
10
+ 1 . [ Defining Remotes] ( #defining-remotes )
11
+ 1 . [ Bump Version] ( #bump-version )
12
+ 1 . [ Find the Clippy commit] ( #find-the-clippy-commit )
13
+ 1 . [ Update the ` beta ` branch] ( #update-the-beta-branch )
14
+ 1 . [ Update the ` stable ` branch] ( #update-the-stable-branch )
15
+ 1 . [ Tag the stable commit] ( #tag-the-stable-commit )
16
+ 1 . [ Update ` CHANGELOG.md ` ] ( #update-changelogmd )
18
17
19
18
[ Rust Forge ] : https://forge.rust-lang.org/
20
19
21
- ## Remerge the ` beta ` branch
20
+ ## Defining Remotes
21
+
22
+ You may want to define the ` upstream ` remote of the Clippy project to simplify
23
+ the following steps. However, this is optional and you can replace ` upstream `
24
+ with the full URL instead.
25
+
26
+ ``` bash
27
+ git remote add upstream
[email protected] :rust-lang/rust-clippy
28
+ ```
22
29
23
- This step is only necessary, if since the last release something was backported
24
- to the beta Rust release. The remerge is then necessary, to make sure that the
25
- Clippy commit, that was used by the now stable Rust release, persists in the
26
- tree of the Clippy repository.
30
+ ## Bump Version
27
31
28
- To find out if this step is necessary run
32
+ When a release needs to be done, ` cargo test ` will fail, if the versions in the
33
+ ` Cargo.toml ` are not correct. During that sync, the versions need to be bumped.
34
+ This is done by running:
29
35
30
36
``` bash
31
- # Assumes that the local master branch of rust-lang/rust-clippy is up-to-date
32
- $ git fetch upstream
33
- $ git branch master --contains upstream/beta
37
+ cargo dev release bump_version
34
38
```
35
39
36
- If this command outputs ` master ` , this step is ** not** necessary.
40
+ This will increase the version number of each relevant ` Cargo.toml ` file. After
41
+ that, just commit the updated files with:
37
42
38
43
``` bash
39
- # Assuming `HEAD` is the current `master` branch of rust-lang/rust-clippy
40
- $ git checkout -b backport_remerge
41
- $ git merge upstream/beta
42
- $ git diff # This diff has to be empty, otherwise something with the remerge failed
43
- $ git push origin backport_remerge # This can be pushed to your fork
44
+ git commit -m " Bump Clippy version -> 0.1.XY" ** /* Cargo.toml
44
45
```
45
46
46
- After this, open a PR to the master branch. In this PR, the commit hash of the
47
- ` HEAD ` of the ` beta ` branch must exist. In addition to that, no files should be
48
- changed by this PR.
47
+ ` XY ` should be exchanged with the corresponding version
49
48
50
- ## Update the ` beta ` branch
49
+ ## Find the Clippy commit
51
50
52
- This step must be done ** after** the PR of the previous step was merged.
51
+ For both updating the ` beta ` and the ` stable ` branch, the first step is to find
52
+ the Clippy commit of the last Clippy sync done in the respective Rust branch.
53
53
54
- First, the Clippy commit of the ` beta ` branch of the Rust repository has to be
55
- determined.
54
+ Running the following commands _ in the Rust repo _ will get the commit for the
55
+ specified ` <branch> ` :
56
56
57
57
``` bash
58
- # Assuming the current directory corresponds to the Rust repository
59
- $ git fetch upstream
60
- $ git checkout upstream/beta
61
- $ 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" )
58
+ git switch < branch>
59
+ 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" )
62
60
```
63
61
64
- After finding the Clippy commit, the ` beta ` branch in the Clippy repository can
65
- be updated.
62
+ Where ` <branch> ` is one of ` stable ` , ` beta ` , or ` master ` .
63
+
64
+ ## Update the ` beta ` branch
65
+
66
+ After getting the commit of the ` beta ` branch, the ` beta ` branch in the Clippy
67
+ repository can be updated.
66
68
67
69
``` bash
68
- # Assuming the current directory corresponds to the Clippy repository
69
- $ git checkout beta
70
- $ git reset --hard $BETA_SHA
71
- $ git push upstream beta
70
+ git checkout beta
71
+ git reset --hard $SHA
72
+ git push upstream beta
72
73
```
73
74
74
- ## Find the Clippy commit
75
+ ## Update the ` stable ` branch
75
76
76
- The first step is to tag the Clippy commit, that is included in the stable Rust
77
- release. This commit can be found in the Rust repository .
77
+ After getting the commit of the ` stable ` branch, the ` stable ` branch in the
78
+ Clippy repository can be updated .
78
79
79
80
``` bash
80
- # Assuming the current directory corresponds to the Rust repository
81
- $ git fetch upstream # `upstream` is the `rust-lang/rust` remote
82
- $ git checkout 1.XX.0 # XX should be exchanged with the corresponding version
83
- $ 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" )
81
+ git checkout stable
82
+ git reset --hard $SHA
83
+ git push upstream stable
84
84
```
85
85
86
- ## Tag the stable commit
86
+ ## Tag the ` stable ` commit
87
87
88
- After finding the Clippy commit, it can be tagged with the release number.
88
+ After updating the ` stable ` branch, tag the HEAD commit and push it to the
89
+ Clippy repo.
90
+
91
+ > Note: Only push the tag once the Deploy GitHub action of the ` beta ` branch is
92
+ > finished. Otherwise the deploy for the tag might fail.
89
93
90
94
``` bash
91
- # Assuming the current directory corresponds to the Clippy repository
92
- $ git checkout $SHA
93
- $ git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
94
- $ git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
95
+ git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
96
+ git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
95
97
```
96
98
97
99
After this, the release should be available on the Clippy [ release page] .
98
100
99
101
[ release page ] : https://github.com/rust-lang/rust-clippy/releases
100
102
101
- ## Update the ` stable ` branch
103
+ ## Publish ` clippy_utils `
104
+
105
+ The ` clippy_utils ` crate is published to ` crates.io ` without any stability
106
+ guarantees. To do this, after the [ sync] and the release is done, switch back to
107
+ the ` upstream/master ` branch and publish ` clippy_utils ` :
102
108
103
- At this step you should have already checked out the commit of the ` rust-1.XX.0 `
104
- tag. Updating the stable branch from here is as easy as:
109
+ > Note: The Rustup PR bumping the nightly and Clippy version ** must ** be merged
110
+ > before doing this.
105
111
106
112
``` bash
107
- # Assuming the current directory corresponds to the Clippy repository and the
108
- # commit of the just created rust-1.XX.0 tag is checked out.
109
- $ git push upstream rust-1.XX.0:stable # `upstream` is the `rust-lang/rust-clippy` remote
113
+ git switch master && git pull upstream master
114
+ cargo publish --manifest-path clippy_utils/Cargo.toml
110
115
```
111
116
112
- > _ NOTE:_ Usually there are no stable backports for Clippy, so this update
113
- > should be possible without force pushing or anything like this. If there
114
- > should have happened a stable backport, make sure to re-merge those changes
115
- > just as with the ` beta ` branch.
117
+ [ sync ] : sync.md
116
118
117
119
## Update ` CHANGELOG.md `
118
120
0 commit comments