diff options
Diffstat (limited to 'www')
-rw-r--r-- | www/docs/patch.t | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/www/docs/patch.t b/www/docs/patch.t new file mode 100644 index 0000000000..8c601b0b14 --- /dev/null +++ b/www/docs/patch.t | |||
@@ -0,0 +1,58 @@ | |||
1 | #define _PAGE_ How To Work With Patches | ||
2 | #include "head.t" | ||
3 | |||
4 | <h2>Tools Of The Trade</h2> | ||
5 | <p> | ||
6 | Use the tools 'diff' and 'patch'. Preferably the GNU versions. They're readily | ||
7 | available for all imaginable platforms. | ||
8 | <p> | ||
9 | [Add favourite diff/patch links here] | ||
10 | |||
11 | <h2>Creating A Patch</h2> | ||
12 | <p> | ||
13 | We generate diffs (often called patches) using 'diff' in a manner similar to | ||
14 | this: | ||
15 | <pre> | ||
16 | diff -u oldfile newfile > patch | ||
17 | </pre> | ||
18 | <p> | ||
19 | People who have checked out code with CVS can do diffs using cvs like this: | ||
20 | <pre> | ||
21 | cvs diff -u file > patch | ||
22 | </pre> | ||
23 | <p> | ||
24 | 'diff' can also be used on a whole directory etc to generate one file with | ||
25 | changes done to multiple: | ||
26 | <pre> | ||
27 | diff -u olddir newdir > patch | ||
28 | </pre> | ||
29 | <p> | ||
30 | The -u option means the output is using the 'unified diff' format. Older | ||
31 | diff programs don't have that, and then -c (for 'context diff') is OK. | ||
32 | |||
33 | <h2>Applying A Patch</h2> | ||
34 | <p> | ||
35 | Applying a 'patch' (output from diff -u) is done with the 'patch' tool: | ||
36 | <pre> | ||
37 | patch < patchfile | ||
38 | </pre> | ||
39 | <p> | ||
40 | patch knows that the patchfile is a set of changes on one or more files, and | ||
41 | will do those to your local files. If your files have changed too much for the | ||
42 | patch to work, it will save the sections of the patch that aren't possible to | ||
43 | apply in a file called "filename.rej" (filename being the name of the file for | ||
44 | which the failing section was intended for). Then you must take care of them | ||
45 | manually. | ||
46 | |||
47 | <p> | ||
48 | If there is path information in the patchfile that you want to cut off | ||
49 | from the left, tell patch how many directory levels to cut off to find the | ||
50 | names in your file system: | ||
51 | <pre> | ||
52 | patch -p0 < patchfile | ||
53 | patch -p1 < patchfile | ||
54 | patch -p2 < patchfile | ||
55 | </pre> | ||
56 | ... each example line removes one extra level of dir info from the left. | ||
57 | |||
58 | #include "foot.t" | ||