2015-01-21 20:05:47 +00:00
|
|
|
Applying patches
|
|
|
|
================
|
|
|
|
|
|
|
|
If you are a Skia committer and have been asked to commit an
|
|
|
|
externally-submitted patch, this is how to do it. (This technique is useful in
|
|
|
|
other situations too, like if you just want to try out somebody else's patch
|
|
|
|
locally.)
|
|
|
|
|
|
|
|
Notes:
|
2018-01-10 14:55:05 +00:00
|
|
|
|
2015-01-21 20:05:47 +00:00
|
|
|
* For the examples below, we will assume that this is the change you want
|
|
|
|
to patch into your local checkout: https://codereview.appspot.com/6201055/
|
|
|
|
* These instructions should work on Mac or Linux; Windows is trickier,
|
|
|
|
because there is no standard Windows "patch" tool.
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
See also [Contributing Code for The Chromium Projects]
|
|
|
|
(http://dev.chromium.org/developers/contributing-code#TOC-Instructions-for-Reviewer:-Checking-in-the-patch-for-a-non-committer).
|
2015-01-21 20:05:47 +00:00
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
If you use `git cl`, then you should be able to use the shortcut:
|
2015-01-21 20:05:47 +00:00
|
|
|
|
|
|
|
~~~~
|
|
|
|
git cl patch 6201055
|
|
|
|
~~~~
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
If you use `gcl`, or the above doesn't work, the following should always work.
|
2015-01-21 20:05:47 +00:00
|
|
|
|
|
|
|
1. Prepare your local workspace to accept the patch.
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
* cd into the root directory (usually `trunk/`) of the workspace where you
|
2015-01-21 20:05:47 +00:00
|
|
|
want to apply the patch.
|
|
|
|
* Make sure that the workspace is up-to-date and clean (or "updated and
|
|
|
|
clean enough" for your purposes). If the codereview patch was against
|
|
|
|
an old revision of the repo, you may need to sync your local workspace
|
2018-01-10 14:55:05 +00:00
|
|
|
to that same revision.
|
2015-01-21 20:05:47 +00:00
|
|
|
|
|
|
|
2. Download the raw patch set.
|
|
|
|
|
|
|
|
* Open the codereview web page and look for the "Download raw patch set"
|
|
|
|
link near the upper right-hand corner. Right-click on that link and copy
|
|
|
|
it to the clipboard. (In my case, the link is
|
|
|
|
https://codereview.appspot.com/download/issue6201055_1.diff )
|
|
|
|
* If you are on Linux or Mac and have "curl" or "wget" installed, you can
|
|
|
|
download the patch from the command line:
|
|
|
|
|
|
|
|
~~~~
|
|
|
|
curl https://codereview.appspot.com/download/issue6201055_1.diff
|
|
|
|
--output patch.txt
|
|
|
|
# or...
|
|
|
|
wget https://codereview.appspot.com/download/issue6201055_1.diff
|
|
|
|
--output-document=patch.txt
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
* Otherwise, figure out some other way to download this file and save it as
|
2018-01-10 14:55:05 +00:00
|
|
|
`patch.txt`
|
2015-01-21 20:05:47 +00:00
|
|
|
|
|
|
|
3. Apply this patch to your local checkout.
|
|
|
|
|
|
|
|
* You should still be in the root directory of the workspace where you want
|
|
|
|
to apply the patch.
|
|
|
|
|
|
|
|
~~~~
|
|
|
|
patch -p1 <patch.txt
|
|
|
|
~~~~
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
* Then you can run `diff` and visually check the local changes.
|
2015-01-21 20:05:47 +00:00
|
|
|
|
|
|
|
4. Complications: If the patch fails to apply, the following may be happening:
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
* Wrong revision. Maybe your local workspace is not up to date? Or maybe the
|
|
|
|
patch was made against an old revision of the repository, and cannot be applied
|
|
|
|
to the latest revision? (In that case, revert any changes and sync your
|
|
|
|
workspace to an older revision, then re-apply the patch.)
|
2015-01-21 20:05:47 +00:00
|
|
|
|