merge: fix another bug in isolate_conflicts.
[wiggle/upstream.git] / ReadMe.c
blob255acd8c34ab6fc95ff8f2ebe4702804cc4bd7d5
1 /*
2 * wiggle - apply rejected patches
4 * Copyright (C) 2003 Neil Brown <neilb@cse.unsw.edu.au>
5 * Copyright (C) 2010 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; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Author: Neil Brown
23 * Email: <neilb@suse.de>
27 * Options and help text for wiggle
30 #include "wiggle.h"
32 #ifndef VERSION
33 #define VERSION "0.9"
34 #endif
35 #ifndef VERS_DATE
36 #define VERS_DATE "2012-05-14"
37 #endif
39 char Version[] = "wiggle " VERSION " " VERS_DATE " GPL-2+ http://neil.brown.name/wiggle/\n";
41 char short_options[] = "xdmwlrhiW123p::VRvqBb";
43 struct option long_options[] = {
44 {"browse", 0, 0, 'B'},
45 {"extract", 0, 0, 'x'},
46 {"diff", 0, 0, 'd'},
47 {"merge", 0, 0, 'm'},
48 {"words", 0, 0, 'w'},
49 {"lines", 0, 0, 'l'},
50 {"patch", 0, 0, 'p'},
51 {"replace", 0, 0, 'r'},
52 {"help", 0, 0, 'h'},
53 {"version", 0, 0, 'V'},
54 {"reverse", 0, 0, 'R'},
55 {"verbose", 0, 0, 'v'},
56 {"quiet", 0, 0, 'q'},
57 {"strip", 1, 0, 'p'},
58 {"no-ignore", 0, 0, 'i'},
59 {"show-wiggle", 0, 0, 'W'},
60 {"ignore-blanks",0,0, 'b'},
61 {"self-test", 0, 0, SELF_TEST},
62 {0, 0, 0, 0}
65 char Usage[] =
66 "Usage: wiggle --diff|--extract|--merge|--browse --lines|--words [--replace] files...\n";
68 char Help[] = "\n"
69 "Wiggle - apply patches that 'patch' rejects.\n"
70 "\n"
71 "Wiggle provides four distinct but related functions:\n"
72 "merge, diff, extract, and browse.\n"
73 "To get more detailed help on a function, select the function\n"
74 "before requesting help. e.g.\n"
75 " wiggle --diff --help\n"
76 "\n"
77 "Options:\n"
78 " --extract -x : select 'extract' function.\n"
79 " --diff -d : select 'diff' function.\n"
80 " --merge -m : select 'merge' function (default).\n"
81 " --browse -B : select 'browse' function.\n"
82 "\n"
83 " --words -w : word-wise diff and merge.\n"
84 " --lines -l : line-wise diff and merge.\n"
85 "\n"
86 " --patch -p : treat last file as a patch file.\n"
87 " -1 -2 -3 : select which component of patch or merge to use.\n"
88 " --reverse -R : swap 'before' and 'after' for diff function.\n"
89 " --no-ignore -i : Don't ignore already-applied changes.\n"
90 " --show-wiggle -W : Report wiggles like conflicts with an extra stanza.\n"
91 "\n"
92 " --help -h : get help.\n"
93 " --version -V : get version of wiggle.\n"
94 " --verbose -v : (potentially) be more verbose.\n"
95 " --quiet -q : don't print un-necessary messages.\n"
96 "\n"
97 " --replace -r : replace first file with result of merger.\n"
98 "\n"
99 " --strip= -p : number of path components to strip from file names.\n"
100 "\n"
101 "Wiggle needs to be given 1, 2, or 3 files. Any one of these can\n"
102 "be given as '-' to signify standard input.\n"
103 "\n";
105 char HelpExtract[] = "\n"
106 "wiggle --extract -[123] [--patch] merge-or-patch\n"
107 "\n"
108 "The extract function allows one branch of a patch or merge file\n"
109 "to be extracted. A 'patch' is the output of 'diff -c' or 'diff -u'.\n"
110 "Either the before (-1) or after (-2) branch can be extracted.\n"
111 "\n"
112 "A 'merge' is the output of 'diff3 -m' or 'merge -A'. Either the\n"
113 "first, second, or third branch can be extracted.\n"
114 "\n"
115 "A 'merge' file is assumed unless --patch is given.\n"
116 "\n";
118 char HelpDiff[] = "\n"
119 "wiggle --diff [-wl] [-p12] [-R] file-or-patch [file-or-patch]\n"
120 "\n"
121 "The diff function will report the differencs and similarities between\n"
122 "two files in a format similar to 'diff -u'. With --word mode\n"
123 "(the default) word-wise differences are displayed on lines starting\n"
124 "with a '|'. With --line mode, only whole lines are considered\n"
125 "much like normal diff.\n"
126 "\n"
127 "If one file is given is it assumed to be a patch, and the two\n"
128 "branches of the patch are extracted and compared. If two files\n"
129 "are given they are normally assumed to be whole files and are compared.\n"
130 "However if the --patch option is given with two files, then the\n"
131 "second is treated as a patch and the first or (with -2) second branch\n"
132 "is extracted and compared against the first file.\n"
133 "\n"
134 "--reverse (-R) with cause diff to swap the two files before comparing\n"
135 "them.\n"
136 "\n";
138 char HelpMerge[] = "\n"
139 "wiggle --merge [-wl] [--replace] file-or-merge [file-or-patch [file]]\n"
140 "\n"
141 "The merge function is the primary function of wiggle and is assumed\n"
142 "if no function is explicitly chosen.\n"
143 "\n"
144 "Normally wiggle will compare three files on a word-by-word basis and\n"
145 "output unresolvable conflicts in the resulting merge by showing\n"
146 "whole-line differences.\n"
147 "With the --lines option, the files are compared line-wise much\n"
148 "like 'merge'. With the (default) --words option, files are compared\n"
149 "word-wise and unresolvable conflicts are reported word-wise.\n"
150 "\n"
151 "If --merge is given one file, it is treated as a merge (merge -A\n"
152 "output) and the three needed streams are extracted from it.\n"
153 "If --merge is given one file and -p, it is a patch which identifies\n"
154 "the files that should be patched.\n"
155 "If --merge is given two files, the second is treated as a patch\n"
156 "file and the first is the original file.\n"
157 "If --merge is given three files, they are each treated as whole files\n"
158 "and differences between the second and third are merged into the first.\n"
159 "This usage is much like 'merge'.\n"
160 "\n";
162 char HelpBrowse[] = "\n"
163 "wiggle --browse [-R] [--strip=n] [-p] [files]\n"
164 "\n"
165 "The 'browse' function provides an interactive mode for browsing a\n"
166 "patch or set of patches. It allows the application of a patch to each\n"
167 "file to be inspected and will eventually allow limited editing to correct\n"
168 "mis-application of patches where wiggling was required, and where conflicts\n"
169 "occurred.\n"
170 "If no files are given, a patch file is read from stdin\n"
171 "If one file is given with -p, it is treated as a patch file\n"
172 "If one file is given with a name ending .rej, it is treated as a reject for\n"
173 " a file with matching basename\n"
174 "Otherwise a single file is assumed to be a merge output with conflicts.\n"
175 "If two files are given, the second is a patch to apply to the first.\n"
176 "If three files are given then the difference between 2nd and 3rd is applied\n"
177 " to the first\n"
178 "\n";