Skip to content

Commit c7dec04

Browse files
committed
Update book for backport, release and sync
Those were outdated anyway. Now with switching to Josh, the documentation should also be updated, as a lot of things got simplified. This updates the documentation on how to do syncs with josh, how to do releases and how to do backports.
1 parent 604b7b0 commit c7dec04

File tree

2 files changed

+69
-80
lines changed

2 files changed

+69
-80
lines changed

book/src/development/infrastructure/release.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ git commit -m "Bump Clippy version -> 0.1.XY" **/*Cargo.toml
5151
For both updating the `beta` and the `stable` branch, the first step is to find
5252
the Clippy commit of the last Clippy sync done in the respective Rust branch.
5353

54-
Running the following commands _in the Rust repo_ will get the commit for the
55-
specified `<branch>`:
54+
Running the following command will get the commit for the specified branch:
5655

5756
```bash
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")
57+
$ SHA=$(cargo dev release commit /path/to/rust <branch>)
6058
```
6159

62-
Where `<branch>` is one of `stable`, `beta`, or `master`.
60+
Where the `/path/to/rust` is a relative path to a Rust clone and the `<branch>`
61+
is one of `stable`, `beta`, or `master`.
6362

6463
## Update the `beta` branch
6564

@@ -88,9 +87,12 @@ git push upstream stable
8887
After updating the `stable` branch, tag the HEAD commit and push it to the
8988
Clippy repo.
9089

90+
> Note: Only push the tag, once the Deploy GitHub action of the `beta` branch is
91+
> finished. Otherwise the deploy for the tag might fail.
92+
9193
```bash
92-
git tag rust-1.XX.0 # XX should be exchanged with the corresponding version
93-
git push upstream rust-1.XX.0 # `upstream` is the `rust-lang/rust-clippy` remote
94+
git tag rust-1.XY.0 # XY should be exchanged with the corresponding version
95+
git push upstream rust-1.XY.0 # `upstream` is the `rust-lang/rust-clippy` remote
9496
```
9597

9698
After this, the release should be available on the Clippy [tags page].

book/src/development/infrastructure/sync.md

Lines changed: 60 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Clippy currently gets built with a pinned nightly version.
44

55
In the `rust-lang/rust` repository, where rustc resides, there's a copy of
6-
Clippy that compiler hackers modify from time to time to adapt to changes in the
6+
Clippy that compiler devs modify from time to time to adapt to changes in the
77
unstable API of the compiler.
88

99
We need to sync these changes back to this repository periodically, and the
@@ -15,94 +15,81 @@ done in a bi-weekly basis if there's no urgent changes. This is done starting on
1515
the day of the Rust stable release and then every other week. That way we
1616
guarantee that we keep this repo up to date with the latest compiler API, and
1717
every feature in Clippy is available for 2 weeks in nightly, before it can get
18-
to beta. For reference, the first sync following this cadence was performed the
18+
to beta. For reference, the first sync following this cadence was performed on
1919
2020-08-27.
2020

21-
This process is described in detail in the following sections. For general
22-
information about `subtree`s in the Rust repository see [the rustc-dev-guide][subtree].
21+
This process is described in detail in the following sections.
2322

24-
[subtree]: https://rustc-dev-guide.rust-lang.org/external-repos.html#external-dependencies-subtree
23+
## Installing `josh-proxy`
2524

26-
## Patching git-subtree to work with big repos
25+
The sync is done with [JOSH] and fully scripted with `cargo dev sync`. The only
26+
requirement is to install the `josh-proxy` binary from GitHub
2727

28-
Currently, there's a bug in `git-subtree` that prevents it from working properly
29-
with the [`rust-lang/rust`] repo. There's an open PR to fix that, but it's
30-
stale. Before continuing with the following steps, we need to manually apply
31-
that fix to our local copy of `git-subtree`.
28+
<!-- FIXME: Change to a release version once >r23.12.04 is released -->
3229

33-
You can get the patched version of `git-subtree` from [here][gitgitgadget-pr].
34-
Put this file under `/usr/lib/git-core` (making a backup of the previous file)
35-
and make sure it has the proper permissions:
36-
37-
```bash
38-
sudo cp --backup /path/to/patched/git-subtree.sh /usr/lib/git-core/git-subtree
39-
sudo chmod --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
40-
sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
30+
```sh
31+
$ RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh
4132
```
4233

43-
> _Note:_ The first time running `git subtree push` a cache has to be built.
44-
> This involves going through the complete Clippy history once. For this you
45-
> have to increase the stack limit though, which you can do with `ulimit -s
46-
> 60000`. Make sure to run the `ulimit` command from the same session you call
47-
> git subtree.
34+
[JOSH]: https://josh-project.github.io/josh/
35+
36+
## Performing the sync from [`rust-lang/rust`] to Clippy
4837

49-
> _Note:_ If you are a Debian user, `dash` is the shell used by default for
50-
> scripts instead of `sh`. This shell has a hardcoded recursion limit set to
51-
> 1,000. In order to make this process work, you need to force the script to run
52-
> `bash` instead. You can do this by editing the first line of the `git-subtree`
53-
> script and changing `sh` to `bash`.
38+
Doing the sync now is just running
5439

55-
> Note: The following sections assume that you have set up remotes following the
56-
> instructions in [defining remotes].
40+
```
41+
$ cargo dev sync pull
42+
```
5743

58-
[gitgitgadget-pr]: https://github.com/gitgitgadget/git/pull/493
59-
[defining remotes]: release.md#defining-remotes
44+
This command will update the nightly toolchain in the `rust-toolchain` file and
45+
will pull the changes from the Rust repository.
6046

61-
## Performing the sync from [`rust-lang/rust`] to Clippy
47+
If there should be merge conflicts, resolve them now and commit with the message
48+
`Merge from rustc`.[^1]
6249

63-
Here is a TL;DR version of the sync process (all the following commands have
64-
to be run inside the `rust` directory):
65-
66-
1. Clone the [`rust-lang/rust`] repository or make sure it is up-to-date.
67-
2. Checkout the commit from the latest available nightly. You can get it using
68-
`rustup check`.
69-
3. Sync the changes to the rust-copy of Clippy to your Clippy fork:
70-
```bash
71-
# Be sure to either use a net-new branch, e.g. `rustup`, or delete the branch beforehand
72-
# because changes cannot be fast forwarded and you have to run this command again.
73-
git subtree push -P src/tools/clippy clippy-local rustup
74-
```
75-
76-
> _Note:_ Most of the time you have to create a merge commit in the
77-
> `rust-clippy` repo (this has to be done in the Clippy repo, not in the
78-
> rust-copy of Clippy):
79-
```bash
80-
git fetch upstream # assuming upstream is the rust-lang/rust remote
81-
git switch rustup
82-
git merge upstream/master --no-ff
83-
```
84-
> Note: This is one of the few instances where a merge commit is allowed in
85-
> a PR.
86-
4. Bump the nightly version in the Clippy repository by running these commands:
87-
```bash
88-
cargo dev sync update_nightly
89-
git commit -m "Bump nightly version -> YYYY-MM-DD" rust-toolchain.toml clippy_utils/README.md
90-
```
91-
5. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
92-
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
93-
ask them in the [Zulip] stream.)
50+
> Note: If the version tests fail, refer to [bump version] in the release
51+
> documentation.
9452
53+
Open a PR to `rust-lang/rust-clippy` and if you are a Clippy maintainer, you can
54+
`r+` the PR yourself. If not, change `r? @ghost` to `r? clippy` and a Clippy
55+
maintainer will get assigned. To accelerate the process ping the Clippy team on
56+
[Zulip].
57+
58+
59+
[bump version]: release.md#bump-version
9560
[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/clippy
96-
[`rust-lang/rust`]: https://github.com/rust-lang/rust
61+
62+
[^1]: The message is not really important, but consistency is nice.
9763

9864
## Performing the sync from Clippy to [`rust-lang/rust`]
9965

100-
All the following commands have to be run inside the `rust` directory.
66+
The other direction is done by running
67+
68+
```
69+
$ cargo dev sync push /path/to/rust --user <GitHub-name>
70+
```
71+
72+
Where the `/path/to/rust` is a relative path to a Rust clone and the
73+
`<GitHub-name>` is your GitHub user name. This is required for pushing the sync
74+
to GitHub and opening a PR.
75+
76+
If everything went right, there will be a GitHub link that has to be used to
77+
open the sync PR in the Rust repository. The PR description must look like this:
78+
79+
```
80+
Clippy subtree update
81+
82+
r? @ghost
10183
102-
1. Make sure you have checked out the latest `master` of `rust-lang/rust`.
103-
2. Sync the `rust-lang/rust-clippy` master to the rust-copy of Clippy:
104-
```bash
105-
git switch -c clippy-subtree-update
106-
git subtree pull -P src/tools/clippy clippy-upstream master
107-
```
108-
3. Open a PR to [`rust-lang/rust`]
84+
Sync from Clippy commit: rust-lang/rust-clippy@<sha1>
85+
```
86+
87+
The title must be kept as is, to [tell triagebot] that this is a sync PR.
88+
89+
The second line must be kept as is, to [find the Clippy commit] during a
90+
release.
91+
92+
[find the Clippy commit]: release.md#find-the-clippy-commit
93+
[tell triagebot]: https://github.com/rust-lang/rust/pull/114157
94+
95+
[`rust-lang/rust`]: https://github.com/rust-lang/rust

0 commit comments

Comments
 (0)