Home | History | Annotate | Download | only in contrib
      1 Applying patches
      2 ================
      3 
      4 If you are a Skia committer and have been asked to commit an
      5 externally-submitted patch, this is how to do it.  (This technique is useful in
      6 other situations too, like if you just want to try out somebody else's patch
      7 locally.)
      8 
      9 Notes: 
     10   * For the examples below, we will assume that this is the change you want
     11     to patch into your local checkout: https://codereview.appspot.com/6201055/ 
     12   * These instructions should work on Mac or Linux; Windows is trickier, 
     13     because there is no standard Windows "patch" tool.  
     14 
     15 See also:
     16 http://dev.chromium.org/developers/contributing-code#TOC-Instructions-for-Reviewer:-Checking-in-the-patch-for-a-non-committer
     17 
     18 If you use git cl, then you should be able to use the shortcut:
     19 
     20 ~~~~ 
     21 git cl patch 6201055 
     22 ~~~~
     23 
     24 If you use gcl, or the above doesn't work, the following should always work.
     25 
     26 1. Prepare your local workspace to accept the patch.
     27 
     28     * cd into the root directory (usually trunk/) of the workspace where you
     29       want to apply the patch.  
     30     * Make sure that the workspace is up-to-date and clean (or "updated and 
     31       clean enough" for your purposes).  If the codereview patch was against 
     32       an old revision of the repo, you may need to sync your local workspace 
     33       to that same revision...
     34 
     35 2. Download the raw patch set.
     36 
     37     * Open the codereview web page and look for the "Download raw patch set"
     38       link near the upper right-hand corner.  Right-click on that link and copy
     39       it to the clipboard.  (In my case, the link is
     40       https://codereview.appspot.com/download/issue6201055_1.diff ) 
     41     * If you are on Linux or Mac and have "curl" or "wget" installed, you can 
     42       download the patch from the command line:
     43 
     44     ~~~~ 
     45     curl https://codereview.appspot.com/download/issue6201055_1.diff
     46     --output patch.txt
     47     # or...
     48     wget https://codereview.appspot.com/download/issue6201055_1.diff
     49     --output-document=patch.txt 
     50     ~~~~
     51 
     52     * Otherwise, figure out some other way to download this file and save it as
     53       'patch.txt'
     54 
     55 3. Apply this patch to your local checkout.
     56 
     57     * You should still be in the root directory of the workspace where you want
     58       to apply the patch.
     59 
     60     ~~~~ 
     61     patch -p1 <patch.txt 
     62     ~~~~
     63 
     64     * Then you can run diff and visually check the local changes.
     65 
     66 4. Complications: If the patch fails to apply, the following may be happening:
     67 
     68    Wrong revision.  Maybe your local workspace is not up to date?  Or maybe the
     69    patch was made against an old revision of the repository, and cannot be applied
     70    to the latest revision?  (In that case, revert any changes and sync your
     71    workspace to an older revision, then re-apply the patch.)
     72 
     73