Skip to content

Commit c4bd5b4

Browse files
committed
Sync only to the upstream branch and do not cherry-pick
Upstream sometimes uses merge commits which make it very difficult to maintain a cherry-pick based sync workflow. This change modifies the way syncing works so that it simply does a hard reset of the branch to the filtered repository. This should be more foolproof, with the downside that `main` is no longer up to date with upstream. Instead a new `upstream` branch is always up-to-date. Fixes #4861.
1 parent bd7704a commit c4bd5b4

File tree

4 files changed

+27
-41
lines changed

4 files changed

+27
-41
lines changed

.github/sync/UPSTREAM_COMMIT

-1
This file was deleted.

.github/sync/sync.sh

+10-27
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,17 @@
1212
# repository with the filtered contents into a directory specified by the
1313
# argument passed to this script. The filtered contents are determined
1414
# by the configuration in `.github/sync/webrender.paths`.
15-
# 3. Cherry-pick the new commits into the repository in the current working
16-
# directory. The commits applied from the filtered repository are determined
17-
# by choosing every commit after the hash found in the file
18-
# `.github/sync/UPSTREAM_COMMIT`
15+
# 3. Reset the `upstream` branch in the target repository to the new filtered
16+
# version.
1917
#
2018
# Note that this script relies on the idea that filtering `gecko-dev` the same
21-
# way more than once will result in the same commit hashes.
22-
#
23-
# If at some point, `webrender.paths` is modified and the commit hashes change,
24-
# then a single manual filter will have to happen in order to translate the
25-
# hash in the original filtered repository to the new one. The procedure for this
26-
# is roughly:
27-
#
28-
# 1. Run `git-filter-repo` locally and note the new hash of the latest
29-
# commit included from upstream.
30-
# 2. Replace the contents `UPSTREAM_COMMIT` with that hash and commit
31-
# it together with your changes to `webrender.paths`.
19+
# way more than once will result in the same commit hashes, otherwise multiple
20+
# copies of the version control history will be included in the repository.
3221
#
3322
# [1]: <https://github.com/mozilla/gecko-dev/> mirrored from
3423
# <https://hg.mozilla.org/mozilla-central>
3524
# [2]: <https://github.com/mozilla/gecko-dev/>
36-
set -eu
25+
set -eux
3726

3827
root_dir=$(pwd)
3928
cache_dir=$root_dir/_cache
@@ -89,15 +78,9 @@ cd "$root_dir"
8978
git remote add filtered-upstream "$filtered"
9079
git fetch filtered-upstream
9180

92-
hash_file=".github/sync/UPSTREAM_COMMIT"
93-
hash=`cat $hash_file`
94-
number_of_commits=`git log $hash..filtered-upstream/master --pretty=oneline | wc -l`
81+
step "Resetting 'upstream' branch to filtered repository HEAD"
82+
git switch -c upstream
83+
git reset --hard filtered-upstream/master
9584

96-
if [ $number_of_commits != '0' ]; then
97-
step "Applying $number_of_commits new commits"
98-
git -c user.email="$git_email" -c user.name="$git_name" cherry-pick $hash..filtered-upstream/master
99-
git rev-parse filtered-upstream/master > "$hash_file"
100-
git -c user.email="$git_email" -c user.name="$git_name" commit "$hash_file" -m "Syncing to upstream (`cat $hash_file`)"
101-
else
102-
step "No new commits. Doing nothing."
103-
fi
85+
step Pushing new 'upstream'
86+
git push -f origin upstream

.github/workflows/sync-upstream.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,4 @@ jobs:
1919
path: _cache/upstream
2020
key: upstream
2121
- name: Run synchronization script
22-
run: ./.github/sync/sync.sh _filtered
23-
- name: Pushing new `main`
24-
run: git push origin main
22+
run: ./.github/sync/sync.sh _filtered

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22

33
[![Version](https://img.shields.io/crates/v/webrender.svg)](https://crates.io/crates/webrender)
44

5-
WebRender is a GPU-based 2D rendering engine written in [Rust](https://www.rust-lang.org/). [Firefox](https://www.mozilla.org/firefox), the research web browser [Servo](https://github.com/servo/servo), and other GUI frameworks draw with it. It currently uses the OpenGL API internally.
6-
7-
Note that the canonical home for this code is in gfx/wr folder of the
8-
mozilla-central repository at https://hg.mozilla.org/mozilla-central. The
9-
Github repository at https://github.com/servo/webrender should be considered
5+
WebRender is a GPU-based 2D rendering engine written in
6+
[Rust](https://www.rust-lang.org/). [Firefox](https://www.mozilla.org/firefox),
7+
the research web browser [Servo](https://github.com/servo/servo), and other GUI
8+
frameworks draw with it. It currently uses the OpenGL API internally.
9+
10+
**Note that the upstream home for this code is in gfx/wr folder of the
11+
mozilla-central repository at https://hg.mozilla.org/mozilla-central.** The
12+
GitHub repository at https://github.com/servo/webrender should be considered
1013
a downstream mirror, although it contains additional metadata (such as Github
11-
wiki pages) that do not exist in mozilla-central. Pull requests against the
12-
Github repository are still being accepted, although once reviewed, they will
13-
be landed on mozilla-central first and then mirrored back. If you are familiar
14-
with the mozilla-central contribution workflow, filing bugs in
15-
[Bugzilla](https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=Graphics%3A%20WebRender)
14+
wiki pages) that do not exist in mozilla-central.
15+
16+
Generally speaking, improvements to WebRender should be submitted upstream
17+
in Gecko, but those relevant to the Servo project or those unsuitable for
18+
upstream may be accepted here.
19+
20+
If you are familiar with the mozilla-central contribution workflow, filing bugs
21+
in [Bugzilla](https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=Graphics%3A%20WebRender)
1622
and submitting patches there would be preferred.
1723

1824
## Update as a Dependency

0 commit comments

Comments
 (0)