|
| 1 | +Stylo |
| 2 | +===== |
| 3 | + |
| 4 | +This repo contains Servo’s downstream fork of [Stylo](https://searchfox.org/mozilla-central/source/servo). |
| 5 | + |
| 6 | +The branches are as follows: |
| 7 | + |
| 8 | +- [`upstream`](https://github.com/servo/style/tree/upstream) has upstream mozilla-central filtered to the paths we care about ([style.paths](style.paths)), but is otherwise unmodified |
| 9 | +- [`main`](https://github.com/servo/style/tree/ci) has our downstream patches, plus the scripts and workflows for syncing with mozilla-central, to be rebased onto `upstream` |
| 10 | + |
| 11 | +## Building Servo against your local Stylo |
| 12 | + |
| 13 | +Assuming your local `servo` and `stylo` directories are siblings, you can build `servo` against `stylo` by adding the following to `servo/Cargo.toml`: |
| 14 | + |
| 15 | +```toml |
| 16 | +[patch."https://github.com/servo/stylo.git"] |
| 17 | +derive_common = { path = "../stylo/derive_common" } |
| 18 | +malloc_size_of = { path = "../stylo/malloc_size_of" } |
| 19 | +selectors = { path = "../stylo/selectors" } |
| 20 | +servo_arc = { path = "../stylo/servo_arc" } |
| 21 | +servo_atoms = { path = "../stylo/atoms" } |
| 22 | +size_of_test = { path = "../stylo/size_of_test" } |
| 23 | +static_prefs = { path = "../stylo/style_static_prefs" } |
| 24 | +style_config = { path = "../stylo/style_config" } |
| 25 | +style_derive = { path = "../stylo/style_derive" } |
| 26 | +style = { path = "../stylo/style" } |
| 27 | +style_traits = { path = "../stylo/style_traits" } |
| 28 | +``` |
| 29 | + |
| 30 | +## Syncing `upstream` with mozilla-central |
| 31 | + |
| 32 | +Start by generating a filtered copy of mozilla-central. This will cache the raw mozilla-central in `_cache/upstream`, storing the result in `_filtered`: |
| 33 | + |
| 34 | +```sh |
| 35 | +$ ./sync.sh _filtered |
| 36 | +``` |
| 37 | + |
| 38 | +If `_filtered` already exists, you will need to delete it and try again: |
| 39 | + |
| 40 | +```sh |
| 41 | +$ rm -Rf _filtered |
| 42 | +``` |
| 43 | + |
| 44 | +Now overwrite our `upstream` with those commits and push: |
| 45 | + |
| 46 | +```sh |
| 47 | +$ git fetch -f --progress ./_filtered master:upstream |
| 48 | +$ git push -fu --progress origin upstream |
| 49 | +``` |
| 50 | + |
| 51 | +## Rebasing `main` onto `upstream` |
| 52 | + |
| 53 | +Start by fetching `upstream` into your local repo: |
| 54 | + |
| 55 | +```sh |
| 56 | +$ git fetch -f origin upstream:upstream |
| 57 | +``` |
| 58 | + |
| 59 | +In general, the filtering process is deterministic, yielding the same commit hashes each time, so we can rebase normally: |
| 60 | + |
| 61 | +```sh |
| 62 | +$ git rebase upstream |
| 63 | +``` |
| 64 | + |
| 65 | +But if the filtering config changes or Mozilla moves to GitHub, the commit hashes on `upstream` may change. In this case, we need to tell git where the old upstream ends and our own commits start (notice the `~`): |
| 66 | + |
| 67 | +```sh |
| 68 | +$ git log --pretty=\%H --grep='Servo initial downstream commit' |
| 69 | +e62d7f0090941496e392e1dc91df103a38e3f488 |
| 70 | + |
| 71 | +$ git rebase --onto upstream e62d7f0090941496e392e1dc91df103a38e3f488~ |
| 72 | +Successfully rebased and updated refs/heads/main. |
| 73 | +``` |
| 74 | + |
| 75 | +`start-rebase.sh` takes care of this automatically, but you should still use `git rebase` for subsequent steps like `--continue` and `--abort`: |
| 76 | + |
| 77 | +```sh |
| 78 | +$ ./start-rebase.sh upstream |
| 79 | +$ ./start-rebase.sh upstream -i # interactive |
| 80 | +$ git rebase --continue # not ./start-rebase.sh --continue |
| 81 | +$ git rebase --abort # not ./start-rebase.sh --abort |
| 82 | +``` |
| 83 | + |
| 84 | +Or if we aren’t ready to rebase onto the tip of upstream: |
| 85 | + |
| 86 | +```sh |
| 87 | +$ ./start-rebase.sh upstream~10 -i |
| 88 | +``` |
0 commit comments