Skip to content

Commit 6851554

Browse files
committed
Document rustc-josh-sync
1 parent 2045165 commit 6851554

File tree

2 files changed

+52
-30
lines changed

2 files changed

+52
-30
lines changed

README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,4 @@ including the `<!-- toc -->` marker at the place where you want the TOC.
7474

7575
This repository is linked to `rust-lang/rust` as a [josh](https://josh-project.github.io/josh/intro.html) subtree. You can use the [rustc-josh-sync](https://github.com/rust-lang/josh-sync) tool to perform synchronization.
7676

77-
You can install the tool using `cargo install --locked --git https://github.com/rust-lang/josh-sync`.
78-
79-
### Pull changes from `rust-lang/rust` into this repository
80-
81-
1) Checkout a new branch that will be used to create a PR into `rust-lang/rustc-dev-guide`
82-
2) Run the pull command
83-
```
84-
rustc-josh-sync pull
85-
```
86-
3) Push the branch to your fork and create a PR into `rustc-dev-guide`
87-
- If you have `gh` CLI installed, `rustc-josh-sync` can create the PR for you.
88-
89-
### Push changes from this repository into `rust-lang/rust`
90-
91-
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
92-
```
93-
rustc-josh-sync push <branch-name> <gh-username>
94-
```
95-
2) Create a PR from `<branch-name>` into `rust-lang/rust`
77+
You can find a guide on how to perform the synchronization [here](./src/external-repos.md#synchronizing-a-josh-subtree).

src/external-repos.md

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ There are three main ways we use dependencies:
99
As a general rule:
1010
- Use crates.io for libraries that could be useful for others in the ecosystem
1111
- Use subtrees for tools that depend on compiler internals and need to be updated if there are breaking
12-
changes
12+
changes
1313
- Use submodules for tools that are independent of the compiler
1414

1515
## External Dependencies (subtrees)
@@ -23,6 +23,8 @@ The following external projects are managed using some form of a `subtree`:
2323
* [rust-analyzer](https://github.com/rust-lang/rust-analyzer)
2424
* [rustc_codegen_cranelift](https://github.com/rust-lang/rustc_codegen_cranelift)
2525
* [rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide)
26+
* [compiler-builtins](https://github.com/rust-lang/compiler-builtins)
27+
* [stdarch](https://github.com/rust-lang/stdarch)
2628

2729
In contrast to `submodule` dependencies
2830
(see below for those), the `subtree` dependencies are just regular files and directories which can
@@ -34,20 +36,57 @@ implement a new tool feature or test, that should happen in one collective rustc
3436
`subtree` dependencies are currently managed by two distinct approaches:
3537

3638
* Using `git subtree`
37-
* `clippy` ([sync guide](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy))
38-
* `portable-simd` ([sync script](https://github.com/rust-lang/portable-simd/blob/master/subtree-sync.sh))
39-
* `rustfmt`
40-
* `rustc_codegen_cranelift` ([sync script](https://github.com/rust-lang/rustc_codegen_cranelift/blob/113af154d459e41b3dc2c5d7d878e3d3a8f33c69/scripts/rustup.sh#L7))
39+
* `clippy` ([sync guide](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy))
40+
* `portable-simd` ([sync script](https://github.com/rust-lang/portable-simd/blob/master/subtree-sync.sh))
41+
* `rustfmt`
42+
* `rustc_codegen_cranelift` ([sync script](https://github.com/rust-lang/rustc_codegen_cranelift/blob/113af154d459e41b3dc2c5d7d878e3d3a8f33c69/scripts/rustup.sh#L7))
4143
* Using the [josh] tool
42-
* `miri` ([sync guide](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#advanced-topic-syncing-with-the-rustc-repo))
43-
* `rust-analyzer` ([sync script](https://github.com/rust-lang/rust-analyzer/blob/2e13684be123eca7181aa48e043e185d8044a84a/xtask/src/release.rs#L147))
44-
* `rustc-dev-guide` ([sync guide](https://github.com/rust-lang/rustc-dev-guide#synchronizing-josh-subtree-with-rustc))
44+
* `miri` ([sync guide](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#advanced-topic-syncing-with-the-rustc-repo))
45+
* `rust-analyzer` ([sync script](https://github.com/rust-lang/rust-analyzer/blob/2e13684be123eca7181aa48e043e185d8044a84a/xtask/src/release.rs#L147))
46+
* `rustc-dev-guide`
47+
* `compiler-builtins`
48+
* `stdarch`
4549

46-
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh, you can check out the `miri` or `rust-analyzer` scripts linked above for inspiration. If you want to migrate a repository dependency from `git subtree` or `git submodule` to josh, you can check out [this guide](https://hackmd.io/7pOuxnkdQDaL1Y1FQr65xg).
50+
### Josh subtrees
4751

48-
Below you can find a guide on how to perform push and pull synchronization with the main rustc repo using `git subtree`, although these instructions might differ repo from repo.
52+
The [josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh, you can check out the `miri` or `rust-analyzer` scripts linked above for inspiration. We provide a helper [`rustc-josh-sync`][josh-sync] tool to help with the synchronization, it is described [below](#synchronizing-a-josh-subtree).
4953

50-
### Synchronizing a subtree
54+
### Synchronizing a Josh subtree
55+
56+
We use a dedicated tool called [`rustc-josh-sync`][josh-sync] for performing Josh subtree updates.
57+
Currently, we are migrating Josh repositories to it. So far, it is used in:
58+
59+
- rustc-dev-guide
60+
61+
To use the tool, first install it with `cargo install --locked --git https://github.
62+
com/rust-lang/josh-sync`.
63+
64+
Both pulls (synchronize changes from rust-lang/rust into the subtree) and pushes (synchronize
65+
changes from the subtree to rust-lang/rust) are performed from the subtree repository (so first
66+
switch to its repository checkout directory in your terminal).
67+
68+
#### Performing pull
69+
1) Checkout a new branch that will be used to create a PR into the subtree
70+
2) Run the pull command
71+
```
72+
rustc-josh-sync pull
73+
```
74+
3) Push the branch to your fork and create a PR into the subtree repository
75+
- If you have `gh` CLI installed, `rustc-josh-sync` can create the PR for you.
76+
77+
#### Performing push
78+
79+
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
80+
```
81+
rustc-josh-sync push <branch-name> <gh-username>
82+
```
83+
2) Create a PR from `<branch-name>` into `rust-lang/rust`
84+
85+
### Creating a new Josh subtree dependency
86+
87+
If you want to migrate a repository dependency from `git subtree` or `git submodule` to josh, you can check out [this guide](https://hackmd.io/7pOuxnkdQDaL1Y1FQr65xg).
88+
89+
### Synchronizing a git subtree
5190
5291
Periodically the changes made to subtree based dependencies need to be synchronized between this
5392
repository and the upstream tool repositories.
@@ -129,3 +168,4 @@ the week leading up to the beta cut.
129168
[toolstate website]: https://rust-lang-nursery.github.io/rust-toolstate/
130169
[Toolstate chapter]: https://forge.rust-lang.org/infra/toolstate.html
131170
[josh]: https://josh-project.github.io/josh/intro.html
171+
[josh-sync]: https://github.com/rust-lang/josh-sync

0 commit comments

Comments
 (0)