Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Merging blink into chromium

Raphael Kubo da Costa edited this page Nov 20, 2015 · 2 revisions

This wiki page describes the steps we have taken to adapt to upstream's merging of the Blink repository into the main Chromium one. The intention is simply to have it documented somewhere out of historical interest and in case something similar needs to be done in the future.

Short background

For a long time after Google forked WebKit and created the Blink project, there had been discussions about whether to merge it into the main Chromium tree for a variety of reasons. The plan took a few years to materialize, and involved, among other things, first migrating Chromium's repository from SVN to git.

The big merge finally happened in September 2015. Since then, Chromium's master branch and all releases made after the merge include src/third_party/WebKit as part of the main Chromium git repository. This was done by preserving Blink's commit history all the way from the early 2000's and then doing one single merge commit connecting Chromium's and Blink's histories.

References

The steps described in this page are mainly based on the following two links:

Step-by-step guide

  1. Save Crosswalk's custom blink-crosswalk commits somewhere.

    cd src/third_party/WebKit
    git log  # Figure out latest upstream commit (e.g. 1234beef).
    git format-patch 1234beef..
    mv *.patch /safe/location
  2. Remove blink-crosswalk from the tree.

    rm -fr src/third_party/WebKit
  3. Note down the hash you are at in chromium-crosswalk (e.g. a49762acd2ab1f2803c7bb8898f50d9109f3cb12).

    cd src
    git rev-parse HEAD
    a49762acd2ab1f2803c7bb8898f50d9109f3cb12
  4. Fetch a new Chromium post-merge. In this example, we are moving from 45.0.2454.93 (pre-merge upstream) to 45.0.2454.101 (post-merge).

    cd src
    git fetch https://chromium.googlesource.com/chromium/src.git +refs/tags/45.0.2454.101:m45-vanilla

    This will likely take some time, as it fetches around 1.5GB of new commit data.

  5. Do the required git black magic, as described in the chromium-dev email linked above and in the Git Book.

    cd src
    # Assuming you are at a branch called master.
    git rebase -i --onto m45-vanilla `git merge-base master m45-vanilla` master
    # Skip the first commit ("Publish DEPS for [...]")

    As explained in the references, this translates to "take all the commits between the previous state of master before the merge (i.e. the output of merge-base cmd) and the head of master and replay them on top of the new m45-vanilla (post merge point)".

  6. Apply the blink-crosswalk commits saved in the first step.

    cd src
    # -i is for interactive, in case you want to retitle the patches.
    git am -i -3 --directory third_party/WebKit /safe/location/*.patch
  7. Follow the usual rebasing instructions.

  8. Make sure you gclient sync to sync everything.

Other things to watch out for

  • If you did not remove src/third_party/WebKit in the steps above, when gclient sync is called it will be moved to a different location (likely src/../old_src_third_party_WebKit.git). If you do not have any use for it, you should remove it to free up some disk space.

  • The update process can take a very long time on bots that have few resources, so be prepared (fetching the new data before a bot is triggered is a good idea).

  • If you use git caches, you can remove the git cache for blink-crosswalk (the same applies to the bots).

Clone this wiki locally