Skip to content

Commit 9c1750d

Browse files
committed
Document synces using josh-sync
1 parent ceaa037 commit 9c1750d

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

docs/book/src/contributing/README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,8 @@ Release steps:
252252
4. Commit & push the changelog.
253253
5. Run `cargo xtask publish-release-notes <CHANGELOG>` -- this will convert the changelog entry in AsciiDoc to Markdown and update the body of GitHub Releases entry.
254254
6. Tweet.
255-
7. Make a new branch and run `cargo xtask rustc-pull`, open a PR, and merge it.
256-
This will pull any changes from `rust-lang/rust` into `rust-analyzer`.
257-
8. Switch to `master`, pull, then run `cargo xtask rustc-push --rust-path ../rust-rust-analyzer --rust-fork matklad/rust`.
258-
Replace `matklad/rust` with your own fork of `rust-lang/rust`.
259-
You can use the token to authenticate when you get prompted for a password, since `josh` will push over HTTPS, not SSH.
260-
This will push the `rust-analyzer` changes to your fork.
261-
You can then open a PR against `rust-lang/rust`.
262-
263-
Note: besides the `rust-rust-analyzer` clone, the Josh cache (stored under `~/.cache/rust-analyzer-josh`) will contain a bare clone of `rust-lang/rust`.
264-
This currently takes about 3.5 GB.
265-
266-
This [HackMD](https://hackmd.io/7pOuxnkdQDaL1Y1FQr65xg) has details about how `josh` syncs work.
255+
7. Perform a subtree [pull](#performing-a-pull).
256+
8. Perform a subtree [push](#performing-a-push).
267257
268258
If the GitHub Actions release fails because of a transient problem like a timeout, you can re-run the job from the Actions console.
269259
If it fails because of something that needs to be fixed, remove the release tag (if needed), fix the problem, then start over.
@@ -288,3 +278,42 @@ There are two sets of people with extra permissions:
288278
If you don't feel like reviewing for whatever reason, someone else will pick the review up (but please speak up if you don't feel like it)!
289279
* The [rust-lang](https://github.com/rust-lang) team [t-rust-analyzer-contributors]([https://github.com/orgs/rust-analyzer/teams/triage](https://github.com/rust-lang/team/blob/master/teams/rust-analyzer-contributors.toml)).
290280
This team has general triaging permissions allowing to label, close and re-open issues.
281+
282+
## Synchronizing subtree changes
283+
`rust-analyzer` is a [josh](https://josh-project.github.io/josh/intro.html) subtree of the [rust-lang/rust](https://github.com/rust-lang/rust)
284+
repository. We use the [rustc-josh-sync](https://github.com/rust-lang/josh-sync) tool to perform synchronization between these two
285+
repositories. You can find documentation of the tool [here](https://github.com/rust-lang/josh-sync?tab=readme-ov-file#performing-pull).
286+
287+
You can install the synchronization tool using the following commands:
288+
```
289+
cargo install --locked --git https://github.com/rust-lang/josh-sync
290+
```
291+
292+
Both pulls (synchronize changes from rust-lang/rust into rust-analyzer) and pushes (synchronize
293+
changes from rust-analyzer to rust-lang/rust) are performed from this repository.
294+
295+
Usually we first perform a pull, wait for it to be merged, and then perform a push.
296+
297+
### Performing a pull
298+
1) Checkout a new branch that will be used to create a PR into rust-analyzer
299+
2) Run the pull command
300+
```
301+
rustc-josh-sync pull
302+
```
303+
3) Push the branch to your fork of `rust-analyzer` and create a PR
304+
- If you have `gh` CLI installed, `rustc-josh-sync` can create the PR for you.
305+
306+
### Performing a push
307+
308+
Wait for the previous pull to be merged.
309+
310+
1) Switch to `master` and pull
311+
2) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
312+
```
313+
rustc-josh-sync push <branch-name> <gh-username>
314+
```
315+
- The push will ask you to download a checkout of the `rust-lang/rust` repository.
316+
- If you get prompted for a password, see [this](https://github.com/rust-lang/josh-sync?tab=readme-ov-file#git-peculiarities).
317+
3) Create a PR from `<branch-name>` into `rust-lang/rust`
318+
319+
> Besides the `rust` checkout, the Josh cache (stored under `~/.cache/rustc-josh`) will contain a bare clone of `rust-lang/rust`. This currently takes several GBs.

0 commit comments

Comments
 (0)