OLD | NEW |
---|---|
(Empty) | |
1 How to apply a patch from a codereview issue | |
jcgregorio
2015/01/20 17:59:00
Shorted title to "Applying patches"
| |
2 ============================================ | |
3 | |
4 If you are a Skia committer and have been asked to commit an externally-submitte d patch, this is how to do it. | |
5 (This technique is useful in other situations too, like if you just want to try out somebody else's patch locally.) | |
6 | |
7 Notes: | |
8 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/ | |
9 These instructions should work on Mac or Linux; Windows is trickier, because the re is no standard Windows "patch" tool. | |
10 See also: | |
11 http://dev.chromium.org/developers/contributing-code#TOC-Instructions-for-Review er:-Checking-in-the-patch-for-a-non-committer | |
12 | |
13 If you use git cl, then you should be able to use the shortcut: | |
14 | |
15 ~~~~ | |
16 git cl patch 6201055 | |
17 ~~~~ | |
18 | |
19 If you use gcl, or the above doesn't work, the following should always work. | |
20 | |
21 1. Prepare your local workspace to accept the patch. | |
22 | |
23 * cd into the root directory (usually trunk/) of the workspace where you wan t to apply the patch. | |
24 * Make sure that the workspace is up-to-date and clean (or "updated and clea n enough" for your purposes). If the codereview patch was against an old revisi on of the repo, you may need to sync your local workspace to that same revision. .. | |
25 | |
26 2. Download the raw patch set. | |
27 | |
28 * Open the codereview web page and look for the "Download raw patch set" lin k 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/is sue6201055_1.diff ) | |
29 * If you are on Linux or Mac and have "curl" or "wget" installed, you can do wnload the patch from the command line: | |
30 | |
31 ~~~~ | |
32 curl https://codereview.appspot.com/download/issue6201055_1.diff --output pa tch.txt | |
33 # or... | |
34 wget https://codereview.appspot.com/download/issue6201055_1.diff --output-do cument=patch.txt | |
35 ~~~~ | |
36 | |
37 * Otherwise, figure out some other way to download this file and save it as patch.txt | |
38 | |
39 3. Apply this patch to your local checkout. | |
40 | |
41 * You should still be in the root directory of the workspace where you want to apply the patch. | |
42 | |
43 ~~~~ | |
44 patch -p1 <patch.txt | |
45 ~~~~ | |
46 | |
47 * Then you can run diff and visually check the local changes. | |
48 | |
49 4. Complications: If the patch fails to apply, the following may be happening: | |
50 | |
51 Wrong revision. Maybe your local workspace is not up to date? Or maybe the pat ch 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.) | |
52 | |
OLD | NEW |