@@ -7,89 +7,89 @@ Clippy is released together with stable Rust releases. The dates for these
77releases can be found at the [ Rust Forge] . This document explains the necessary
88steps to create a Clippy release.
99
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 )
1817
1918[ Rust Forge ] : https://forge.rust-lang.org/
2019
21- ## Remerge the ` beta ` branch
22-
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.
20+ ## Defining Remotes
2721
28- To find out if this step is necessary run
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.
2925
3026``` 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
27+ $ git remote add upstream git@github.com:rust-lang/rust-clippy
3428```
3529
36- If this command outputs ` master ` , this step is ** not ** necessary.
30+ ## Bump Version
3731
38- ``` 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
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:
35+
36+ ```
37+ $ cargo dev release bump_version
4438```
4539
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.
40+ This will increase the version number of each relevant ` Cargo.toml ` file. After
41+ that, just commit the updated files with:
4942
50- ## Update the ` beta ` branch
43+ ``` bash
44+ # XX should be exchanged with the corresponding version
45+ $ git commit -m " Bump Clippy version -> 0.1.XX" ** /* Cargo.toml
46+ ```
47+
48+ ## Find the Clippy commit
5149
52- This step must be done ** after** the PR of the previous step was merged.
50+ For both, updating the ` beta ` and the ` stable ` branch, the first step is to find
51+ the Clippy commit of the last Clippy sync done in the respective Rust branch.
5352
54- First, the Clippy commit of the ` beta ` branch of the Rust repository has to be
55- determined.
53+ Running the following command will get the commit for the specified branch:
5654
5755``` 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" )
56+ $ SHA=$( cargo dev release commit /path/to/rust < branch> )
6257```
6358
64- After finding the Clippy commit, the ` beta ` branch in the Clippy repository can
65- be updated.
59+ Where the ` /path/to/rust ` is a relative path to a Rust clone and the ` <branch> `
60+ is one of ` stable ` , ` beta ` , or ` master ` .
61+
62+ ## Update the ` beta ` branch
63+
64+ After getting the commit of the ` beta ` branch, the ` beta ` branch in the Clippy
65+ repository can be updated.
6666
6767``` bash
68- # Assuming the current directory corresponds to the Clippy repository
6968$ git checkout beta
70- $ git reset --hard $BETA_SHA
69+ $ git reset --hard $SHA
7170$ git push upstream beta
7271```
7372
74- ## Find the Clippy commit
73+ ## Update the ` stable ` branch
7574
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 .
75+ After getting the commit of the ` stable ` branch, the ` stable ` branch in the
76+ Clippy repository can be updated .
7877
7978``` 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" )
79+ $ git checkout stable
80+ $ git reset --hard $SHA
81+ $ git push upstream stable
8482```
8583
86- ## Tag the stable commit
84+ ## Tag the ` stable ` commit
8785
88- After finding the Clippy commit, it can be tagged with the release number.
86+ After updating the ` stable ` branch, tag the HEAD commit and push it to the
87+ Clippy repo.
88+
89+ > Note: Only push the tag, once the Deploy GitHub action of the ` beta ` branch is
90+ > finished. Otherwise the deploy for the tag might fail.
8991
9092``` bash
91- # Assuming the current directory corresponds to the Clippy repository
92- $ git checkout $SHA
9393$ git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
9494$ git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
9595```
@@ -98,22 +98,6 @@ After this, the release should be available on the Clippy [release page].
9898
9999[ release page ] : https://github.com/rust-lang/rust-clippy/releases
100100
101- ## Update the ` stable ` branch
102-
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:
105-
106- ``` 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
110- ```
111-
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.
116-
117101## Update ` CHANGELOG.md `
118102
119103For this see the document on [ how to update the changelog] .
0 commit comments