char Version[] = "wiggle - v0.7 - 24 March 2010\n";
-char short_options1[]="xdmwlrh123pVRvqB"; /* not mode B */
-char short_options2[]="xdmwlrh123p:VRvqB"; /* mode B */
+char short_options1[]="xdmwlrhi123pVRvqB"; /* not mode B */
+char short_options2[]="xdmwlrhi123p:VRvqB"; /* mode B */
struct option long_options[] = {
{"verbose", 0, 0, 'v'},
{"quiet", 0, 0, 'q'},
{"strip", 1, 0, 'p'},
+ {"no-ignore", 0, 0, 'i'},
{0, 0, 0, 0}
};
struct ci make_merger(struct file af, struct file bf, struct file cf,
- struct csl *csl1, struct csl *csl2, int words)
+ struct csl *csl1, struct csl *csl2, int words,
+ int ignore_already)
{
/* find the wiggles and conflicts between csl1 and csl2
*/
rv.merger[i].al = csl1[c1].a - a;
rv.merger[i].cl = csl2[c2].b - c;
rv.merger[i].bl = min(csl1[c1].b, csl2[c2].a) - b;
- if (check_alreadyapplied(af,cf,&rv.merger[i]))
+ if (ignore_already &&
+ check_alreadyapplied(af,cf,&rv.merger[i]))
rv.ignored ++;
}
a += rv.merger[i].al;
}
struct ci print_merge2(FILE *out, struct file *a, struct file *b, struct file *c,
- struct csl *c1, struct csl *c2,
- int words)
+ struct csl *c1, struct csl *c2,
+ int words, int ignore_already)
{
- struct ci rv = make_merger(*a, *b, *c, c1, c2, words);
+ struct ci rv = make_merger(*a, *b, *c, c1, c2,
+ words, ignore_already);
struct merge *m;
for (m=rv.merger; m->type != End ; m++) {
fp2 = split_stream(s2, ByWord, 0);
csl1 = pdiff(ff, fp1, pl->chunks);
csl2 = diff(fp1,fp2);
- ci = make_merger(ff, fp1, fp2, csl1, csl2, 0);
+ ci = make_merger(ff, fp1, fp2, csl1, csl2, 0, 1);
pl->wiggles = ci.wiggles;
pl->conflicts = ci.conflicts;
free(csl1);
cleanlist(fb, fa, csl2);
#endif
- ci = make_merger(fm, fb, fa, csl1, csl2, 0);
+ ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1);
row = 1;
pos.p.m = 0; /* merge node */
.I wiggle
attempts to revert changes rather than apply them.
+.TP
+.BR -i ", " \-\-no\-ignore
+Normally wiggle with ignore changes in the patch which appear to
+already have been applied in the original. With this flag those
+changes are reported as conflicts rather than being ignored.
+
.TP
.BR -h ", " \-\-help
Print a simple help message. If given after one of the function
applied, and the change is ignored. When this happens, a message
reflected the number of ignored changes is printed by
.IR wiggle .
+This optimisation can be suppressed with the
+.B \-i
+flag.
.IP 4
If a change is found that does not fit any of the above possibilities,
int strip = -1;
int chunks1=0, chunks2=0, chunks3=0;
int exit_status = 0;
+ int ignore = 1;
FILE *outfile = stdout;
char *helpmsg;
char *base0;
reverse = 1;
continue;
+ case 'i':
+ ignore = 0;
+ continue;
+
case '1':
case '2':
case '3':
struct ci ci;
ci = print_merge2(outfile, &fl[0], &fl[1], &fl[2],
- csl1, csl2, obj=='w');
+ csl1, csl2, obj=='w',
+ ignore);
if (!quiet && ci.conflicts)
fprintf(stderr, "%d unresolved conflict%s found\n", ci.conflicts, ci.conflicts==1?"":"s");
if (!quiet && ci.ignored)
struct csl *c1, struct csl *c2,
int words);
extern struct ci print_merge2(FILE *out, struct file *a, struct file *b, struct file *c,
- struct csl *c1, struct csl *c2,
- int words);
+ struct csl *c1, struct csl *c2,
+ int words, int ignore_already);
extern void printword(FILE *f, struct elmnt e);
extern struct ci make_merger(struct file a, struct file b, struct file c,
- struct csl *c1, struct csl *c2, int words);
+ struct csl *c1, struct csl *c2, int words,
+ int ignore_already);
extern void die(void);