Release wiggle v1.0
[wiggle/upstream.git] / ReadMe.c
blob2fc6f45addd00077879d8f1e61f234e59361beb9
1 /*
2 * wiggle - apply rejected patches
4 * Copyright (C) 2003 Neil Brown <neilb@cse.unsw.edu.au>
5 * Copyright (C) 2010-2013 Neil Brown <neilb@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program.
21 * Author: Neil Brown
22 * Email: <neilb@suse.de>
26 * Options and help text for wiggle
29 #include "wiggle.h"
31 #ifndef VERSION
32 #define VERSION "1.0"
33 #endif
34 #ifndef VERS_DATE
35 #define VERS_DATE "2013-08-23"
36 #endif
38 char Version[] = "wiggle " VERSION " " VERS_DATE " GPL-2+ http://neil.brown.name/wiggle/\n";
40 char short_options[] = "xdmwlrho:iW123p::VRvqBb";
42 struct option long_options[] = {
43 {"browse", 0, 0, 'B'},
44 {"extract", 0, 0, 'x'},
45 {"diff", 0, 0, 'd'},
46 {"merge", 0, 0, 'm'},
47 {"words", 0, 0, 'w'},
48 {"lines", 0, 0, 'l'},
49 {"patch", 0, 0, 'p'},
50 {"replace", 0, 0, 'r'},
51 {"help", 0, 0, 'h'},
52 {"version", 0, 0, 'V'},
53 {"reverse", 0, 0, 'R'},
54 {"verbose", 0, 0, 'v'},
55 {"quiet", 0, 0, 'q'},
56 {"strip", 1, 0, 'p'},
57 {"output", 1, 0, 'o'},
58 {"no-ignore", 0, 0, 'i'},
59 {"show-wiggles",0, 0, 'W'},
60 {"ignore-blanks",0,0, 'b'},
61 {"self-test", 0, 0, SELF_TEST},
62 {"report-wiggles", 0, 0, REPORT_WIGGLES},
63 {0, 0, 0, 0}
66 char Usage[] =
67 "Usage: wiggle --diff|--extract|--merge|--browse --lines|--words [--replace] files...\n";
69 char Help[] = "\n"
70 "Wiggle - apply patches that 'patch' rejects.\n"
71 "\n"
72 "Wiggle provides four distinct but related functions:\n"
73 "merge, diff, extract, and browse.\n"
74 "To get more detailed help on a function, select the function\n"
75 "before requesting help. e.g.\n"
76 " wiggle --diff --help\n"
77 "\n"
78 "Options:\n"
79 " --extract -x : select 'extract' function.\n"
80 " --diff -d : select 'diff' function.\n"
81 " --merge -m : select 'merge' function (default).\n"
82 " --browse -B : select 'browse' function.\n"
83 "\n"
84 " --words -w : word-wise diff and merge.\n"
85 " --lines -l : line-wise diff and merge.\n"
86 "\n"
87 " --patch -p : treat last file as a patch file.\n"
88 " -1 -2 -3 : select which component of patch or merge to use.\n"
89 " --reverse -R : swap 'before' and 'after' for diff function.\n"
90 " --no-ignore -i : Don't ignore already-applied changes.\n"
91 " --show-wiggle -W : Report wiggles like conflicts with an extra stanza.\n"
92 "\n"
93 " --help -h : get help.\n"
94 " --version -V : get version of wiggle.\n"
95 " --verbose -v : (potentially) be more verbose.\n"
96 " --quiet -q : don't print un-necessary messages.\n"
97 "\n"
98 " --replace -r : replace first file with result of merger.\n"
99 "\n"
100 " --strip= -p : number of path components to strip from file names.\n"
101 "\n"
102 "Wiggle needs to be given 1, 2, or 3 files. Any one of these can\n"
103 "be given as '-' to signify standard input.\n"
104 "\n";
106 char HelpExtract[] = "\n"
107 "wiggle --extract -[123] [--patch] merge-or-patch\n"
108 "\n"
109 "The extract function allows one branch of a patch or merge file\n"
110 "to be extracted. A 'patch' is the output of 'diff -c' or 'diff -u'.\n"
111 "Either the before (-1) or after (-2) branch can be extracted.\n"
112 "\n"
113 "A 'merge' is the output of 'diff3 -m' or 'merge -A'. Either the\n"
114 "first, second, or third branch can be extracted.\n"
115 "\n"
116 "A 'merge' file is assumed unless --patch is given.\n"
117 "\n";
119 char HelpDiff[] = "\n"
120 "wiggle --diff [-wl] [-p12] [-R] file-or-patch [file-or-patch]\n"
121 "\n"
122 "The diff function will report the differencs and similarities between\n"
123 "two files in a format similar to 'diff -u'. With --word mode\n"
124 "(the default) word-wise differences are displayed on lines starting\n"
125 "with a '|'. With --line mode, only whole lines are considered\n"
126 "much like normal diff.\n"
127 "\n"
128 "If one file is given is it assumed to be a patch, and the two\n"
129 "branches of the patch are extracted and compared. If two files\n"
130 "are given they are normally assumed to be whole files and are compared.\n"
131 "However if the --patch option is given with two files, then the\n"
132 "second is treated as a patch and the first or (with -2) second branch\n"
133 "is extracted and compared against the first file.\n"
134 "\n"
135 "--reverse (-R) with cause diff to swap the two files before comparing\n"
136 "them.\n"
137 "\n";
139 char HelpMerge[] = "\n"
140 "wiggle --merge [-wl] [--replace] file-or-merge [file-or-patch [file]]\n"
141 "\n"
142 "The merge function is the primary function of wiggle and is assumed\n"
143 "if no function is explicitly chosen.\n"
144 "\n"
145 "Normally wiggle will compare three files on a word-by-word basis and\n"
146 "output unresolvable conflicts in the resulting merge by showing\n"
147 "whole-line differences.\n"
148 "With the --lines option, the files are compared line-wise much\n"
149 "like 'merge'. With the (default) --words option, files are compared\n"
150 "word-wise and unresolvable conflicts are reported word-wise.\n"
151 "\n"
152 "If --merge is given one file, it is treated as a merge (merge -A\n"
153 "output) and the three needed streams are extracted from it.\n"
154 "If --merge is given one file and -p, it is a patch which identifies\n"
155 "the files that should be patched.\n"
156 "If --merge is given two files, the second is treated as a patch\n"
157 "file and the first is the original file.\n"
158 "If --merge is given three files, they are each treated as whole files\n"
159 "and differences between the second and third are merged into the first.\n"
160 "This usage is much like 'merge'.\n"
161 "\n";
163 char HelpBrowse[] = "\n"
164 "wiggle --browse [-R] [--strip=n] [-p] [files]\n"
165 "\n"
166 "The 'browse' function provides an interactive mode for browsing a\n"
167 "patch or set of patches. It allows the application of a patch to each\n"
168 "file to be inspected and will eventually allow limited editing to correct\n"
169 "mis-application of patches where wiggling was required, and where conflicts\n"
170 "occurred.\n"
171 "If no files are given, a patch file is read from stdin\n"
172 "If one file is given with -p, it is treated as a patch file\n"
173 "If one file is given with a name ending .rej, it is treated as a reject for\n"
174 " a file with matching basename\n"
175 "Otherwise a single file is assumed to be a merge output with conflicts.\n"
176 "If two files are given, the second is a patch to apply to the first.\n"
177 "If three files are given then the difference between 2nd and 3rd is applied\n"
178 " to the first\n"
179 "\n";