Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109574085
D34421.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
24 KB
Referenced Files
None
Subscribers
None
D34421.diff
View Options
Index: usr.bin/diff3/diff3.1
===================================================================
--- usr.bin/diff3/diff3.1
+++ usr.bin/diff3/diff3.1
@@ -30,7 +30,7 @@
.\" @(#)diff3.1 8.2 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd August 23, 2021
+.Dd March 2, 2022
.Dt DIFF3 1
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Nd 3-way differential file comparison
.Sh SYNOPSIS
.Nm diff3
-.Op Fl 3aEeiTXx
+.Op Fl 3aAEeimTXx
.Op Fl Fl diff-program Ar program
.Op Fl Fl strip-trailing-cr
.Op Fl L | Fl Fl label Ar label1
@@ -73,6 +73,8 @@
.Ar file3 .
.It Fl a , Fl Fl text
Treat all files as ASCII.
+.It Fl A Fl Fl show-all
+Output all changes, bracketing conflicts.
.It Fl E , Fl Fl show-overlap
.It Fl X
Similar to
@@ -115,6 +117,8 @@
.Ar file2
and
.Ar file3 .
+.It Fl m, Fl Fl merge
+Merge output instead of generating ed script (default .FL A)
.It Fl T, Fl Fl initial-tab
In the normal listing,
use a tab instead of two spaces
Index: usr.bin/diff3/diff3.c
===================================================================
--- usr.bin/diff3/diff3.c
+++ usr.bin/diff3/diff3.c
@@ -100,6 +100,12 @@
};
struct diff {
+#define DIFF_TYPE2 2
+#define DIFF_TYPE3 3
+ int type;
+ char *line; // REMOVE: helps with debugging
+
+ /* Ranges as lines */
struct range old;
struct range new;
};
@@ -110,10 +116,9 @@
static struct diff *d23;
/*
* "de" is used to gather editing scripts. These are later spewed out in
- * reverse order. Its first element must be all zero, the "new" component
- * of "de" contains line positions or byte positions depending on when you
- * look (!?). Array overlap indicates which sections in "de" correspond to
- * lines that are different in all three files.
+ * reverse order. Its first element must be all zero, the "old" and "new"
+ * components1 of "de" contain line positions. Array overlap indicates which
+ * sections in "de" correspond to lines that are different in all three files.
*/
static struct diff *de;
static char *overlap;
@@ -129,9 +134,12 @@
static int oflag; /* indicates whether to mark overlaps (-E or -X) */
static int strip_cr;
static char *f1mark, *f2mark, *f3mark;
+static const char *oldmark = "<<<<<<<";
+static const char *orgmark = "|||||||";
+static const char *newmark = ">>>>>>>";
static bool duplicate(struct range *, struct range *);
-static int edit(struct diff *, bool, int);
+static int edit(struct diff *, bool, int, int);
static char *getchange(FILE *);
static char *get_line(FILE *, size_t *);
static int readin(int fd, struct diff **);
@@ -139,11 +147,14 @@
static void change(int, struct range *, bool);
static void keep(int, struct range *);
static void merge(int, int);
-static void prange(struct range *);
+static void prange(struct range *, int);
static void repos(int);
static void edscript(int) __dead2;
+static void Ascript(int) __dead2;
+static void mergescript(int) __dead2;
static void increase(void);
static void usage(void) __dead2;
+static void printrange(FILE *, struct range *);
enum {
DIFFPROG_OPT,
@@ -187,6 +198,8 @@
if (f == NULL)
err(2, "fdopen");
for (i = 0; (p = getchange(f)); i++) {
+ (*dd)[i].line = strdup(p); //REMOVE helps with debugging
+
if (i >= szchanges - 1)
increase();
a = b = (int)strtoimax(p, &p, 10);
@@ -300,6 +313,7 @@
d1++;
continue;
}
+
/* second file is different from others */
if (!t1 || (t2 && d2->new.to < d1->new.from)) {
if (eflag == 0) {
@@ -307,6 +321,9 @@
keep(1, &d2->new);
change(3, &d2->new, false);
change(2, &d2->old, false);
+ } else if (Aflag || mflag) {
+ // TODO What does it mean for the second file to differ?
+ j = edit(d2, dup, j, DIFF_TYPE2);
}
d2++;
continue;
@@ -342,8 +359,10 @@
change(2, &d2->old, false);
d3 = d1->old.to > d1->old.from ? d1 : d2;
change(3, &d3->new, false);
- } else
- j = edit(d1, dup, j);
+ } else {
+ j = edit(d1, dup, j, DIFF_TYPE3);
+ }
+ dup = false;
d1++;
d2++;
continue;
@@ -367,7 +386,12 @@
d1->new.to = d2->new.to;
}
}
- if (eflag)
+
+ if (mflag)
+ mergescript(j);
+ else if (Aflag)
+ Ascript(j);
+ else if (eflag)
edscript(j);
}
@@ -382,7 +406,7 @@
printf("%d:", i);
last[i] = rold->to;
- prange(rold);
+ prange(rold, 0);
if (dup)
return;
i--;
@@ -395,7 +419,7 @@
* n1.
*/
static void
-prange(struct range *rold)
+prange(struct range *rold, int delete)
{
if (rold->to <= rold->from)
@@ -404,7 +428,10 @@
printf("%d", rold->from);
if (rold->to > rold->from + 1)
printf(",%d", rold->to - 1);
- printf("c\n");
+ if (delete)
+ printf("d\n");
+ else
+ printf("c\n");
}
}
@@ -432,7 +459,7 @@
static int
skip(int i, int from, const char *pr)
{
- size_t j, n;
+ size_t j = 0, n;
char *line;
for (n = 0; cline[i] < from - 1; n += j) {
@@ -493,68 +520,77 @@
* collect an editing script for later regurgitation
*/
static int
-edit(struct diff *diff, bool dup, int j)
+edit(struct diff *diff, bool dup, int j, int difftype)
{
-
if (((dup + 1) & eflag) == 0)
return (j);
j++;
overlap[j] = !dup;
if (!dup)
overlapcnt++;
+
+ de[j].type = difftype;
+ de[j].line = diff->line; // REMOVE
+
de[j].old.from = diff->old.from;
de[j].old.to = diff->old.to;
- de[j].new.from = de[j-1].new.to + skip(2, diff->new.from, NULL);
- de[j].new.to = de[j].new.from + skip(2, diff->new.to, NULL);
+ de[j].new.from = diff->new.from;
+ de[j].new.to = diff->new.to;
+
return (j);
}
+static void
+printrange(FILE *p, struct range *r)
+{
+ char *line = NULL;
+ size_t len = 0;
+ int i = 1;
+ ssize_t rlen = 0;
+
+ /* We haven't been asked to print anything */
+ if (r->from == r->to)
+ return;
+
+ if (r->from > r->to)
+ errx(EXIT_FAILURE, "invalid print range");
+
+ /*
+ * XXXTHHXXX: We are read through all of each file for each range
+ * printed which is less than optimal.
+ */
+ fseek(p, 0L, SEEK_SET);
+ while((rlen = getline(&line, &len, p)) > 0) {
+ if (i >= r->from)
+ printf("%s", line);
+ free(line);
+ line = NULL;
+ len = 0;
+ if (++i > r->to-1)
+ break;
+ }
+}
+
/* regurgitate */
static void
edscript(int n)
{
- int k;
- size_t j;
- char block[BUFSIZ];
-
for (; n > 0; n--) {
+ int delete = (de[n].new.from == de[n].new.to);
if (!oflag || !overlap[n]) {
- prange(&de[n].old);
+ prange(&de[n].old, delete);
} else {
printf("%da\n", de[n].old.to - 1);
- if (Aflag) {
- printf("%s\n", f2mark);
- fseek(fp[1], de[n].old.from, SEEK_SET);
- for (k = de[n].old.to - de[n].old.from; k > 0; k -= j) {
- j = k > BUFSIZ ? BUFSIZ : k;
- if (fread(block, 1, j, fp[1]) != j)
- errx(2, "logic error");
- fwrite(block, 1, j, stdout);
- }
- printf("\n");
- }
printf("=======\n");
}
- fseek(fp[2], (long)de[n].new.from, SEEK_SET);
- for (k = de[n].new.to - de[n].new.from; k > 0; k -= j) {
- size_t r;
-
- j = k > BUFSIZ ? BUFSIZ : k;
- r = fread(block, 1, j, fp[2]);
- if (r == 0) {
- if (feof(fp[2]))
- break;
- errx(2, "logic error");
- }
- if (r != j)
- j = r;
- (void)fwrite(block, 1, j, stdout);
- }
- if (!oflag || !overlap[n])
- printf(".\n");
- else {
- printf("%s\n.\n", f3mark);
- printf("%da\n%s\n.\n", de[n].old.from - 1, f1mark);
+ printrange(fp[2], &de[n].new);
+ if (!oflag || !overlap[n]) {
+ if (!delete)
+ printf(".\n");
+ } else {
+ printf("%s %s\n.\n", newmark, f3mark);
+ printf("%da\n%s %s\n.\n", de[n].old.from - 1,
+ oldmark, f1mark);
}
}
if (iflag)
@@ -563,6 +599,171 @@
exit(eflag == 0 ? overlapcnt : 0);
}
+/*
+ * Output an edit script to turn mine into yours, when there is a conflict
+ * between the 3 files bracket the changes. Regurgitate the diffs in reverse
+ * order to allow the ed script to track down where the lines are as changes
+ * are made.
+ */
+static void
+Ascript(int n)
+{
+ int deletenew = 0;
+ int deleteold = 0;
+ int startmark;
+
+ for (; n > 0; n--) {
+
+ deletenew = (de[n].new.from == de[n].new.to);
+ deleteold = (de[n].old.from == de[n].old.to);
+ startmark = de[n].old.from + (de[n].old.to - de[n].old.from) - 1;
+
+ if (de[n].type == DIFF_TYPE2) {
+ if (!oflag || !overlap[n]) {
+ prange(&de[n].old, deletenew);
+ printrange(fp[2], &de[n].new);
+ } else {
+ startmark = de[n].new.from +
+ (de[n].new.to - de[n].new.from);
+
+ if (!deletenew)
+ startmark--;
+
+ printf("%da\n", startmark);
+ printf("%s %s\n", newmark, f3mark);
+
+ printf(".\n");
+
+ printf("%da\n", startmark -
+ (de[n].new.to - de[n].new.from));
+ printf("%s %s\n", oldmark, f2mark);
+ if (!deleteold)
+ printrange(fp[1], &de[n].old);
+ printf("=======\n.\n");
+ }
+
+ } else if (de[n].type == DIFF_TYPE3) {
+ if (!oflag || !overlap[n]) {
+ prange(&de[n].old, deletenew);
+ printrange(fp[2], &de[n].new);
+ } else {
+ printf("%da\n", startmark);
+ printf("%s %s\n", orgmark, f2mark);
+
+ if (deleteold) {
+ struct range r;
+ r.from = de[n].old.from-1;
+ r.to = de[n].new.to;
+ printrange(fp[1], &r);
+ } else
+ printrange(fp[1], &de[n].old);
+
+ printf("=======\n");
+ printrange(fp[2], &de[n].new);
+ }
+
+ if (!oflag || !overlap[n]) {
+ if (!deletenew)
+ printf(".\n");
+ } else {
+ printf("%s %s\n.\n", newmark, f3mark);
+
+ /*
+ * Go to the start of the conflict in original
+ * file and append lines
+ */
+ printf("%da\n%s %s\n.\n",
+ startmark - (de[n].old.to - de[n].old.from),
+ oldmark, f1mark);
+ }
+ }
+ }
+ if (iflag)
+ printf("w\nq\n");
+
+ exit(overlapcnt > 0);
+}
+
+/*
+ * Output the merged file directly (don't generate an ed script). When
+ * regurgitating diffs we need to walk forward through the file and print any
+ * inbetween lines.
+ */
+static void
+mergescript(int i)
+{
+ struct range r;
+ int n;
+
+ r.from = 1;
+ r.to = 1;
+
+ for (n = 1; n < i+1; n++) {
+ /* print any lines leading up to here */
+ r.to = de[n].old.from;
+ printrange(fp[0], &r);
+
+ if (de[n].type == DIFF_TYPE2) {
+ printf("%s %s\n", oldmark, f2mark);
+ printrange(fp[1], &de[n].old);
+ printf("=======\n");
+ printrange(fp[2], &de[n].new);
+ printf("%s %s\n", newmark, f3mark);
+ } else if (de[n].type == DIFF_TYPE3) {
+ if (!oflag || !overlap[n]) {
+ printrange(fp[2], &de[n].new);
+ } else {
+
+ printf("%s %s\n", oldmark, f1mark);
+ printrange(fp[0], &de[n].old);
+
+ printf("%s %s\n", orgmark, f2mark);
+ if (de[n].old.from == de[n].old.to) {
+ struct range or;
+ or.from = de[n].old.from -1;
+ or.to = de[n].new.to;
+ printrange(fp[1], &or);
+ } else
+ printrange(fp[1], &de[n].old);
+
+ printf("=======\n");
+
+ printrange(fp[2], &de[n].new);
+ printf("%s %s\n", newmark, f3mark);
+ }
+ }
+
+ if (de[n].old.from == de[n].old.to)
+ r.from = de[n].new.to;
+ else
+ r.from = de[n].old.to;
+ }
+ /*
+ * Print from the final range to the end of 'myfile'. Any deletions or
+ * additions to this file should have been handled by now.
+ *
+ * If the ranges are the same we need to rewind a line.
+ * If the new range is 0 length (from == to), we need to use the old
+ * range.
+ */
+ if ((de[n-1].old.from == de[n-1].new.from) &&
+ (de[n-1].old.to == de[n-1].new.to))
+ r.from--;
+ else if (de[n-1].new.from == de[n-1].new.to)
+ r.from = de[n-1].old.from;
+
+ /*
+ * If the range is a 3 way merge then we need to skip a line in the
+ * trailing output.
+ */
+ if (de[n-1].type == DIFF_TYPE3)
+ r.from++;
+
+ r.to = INT_MAX;
+ printrange(fp[0], &r);
+ exit(overlapcnt > 0);
+}
+
static void
increase(void)
{
@@ -697,15 +898,15 @@
file3 = argv[2];
if (oflag) {
- asprintf(&f1mark, "<<<<<<< %s",
+ asprintf(&f1mark, "%s",
labels[0] != NULL ? labels[0] : file1);
if (f1mark == NULL)
err(2, "asprintf");
- asprintf(&f2mark, "||||||| %s",
+ asprintf(&f2mark, "%s",
labels[1] != NULL ? labels[1] : file2);
if (f2mark == NULL)
err(2, "asprintf");
- asprintf(&f3mark, ">>>>>>> %s",
+ asprintf(&f3mark, "%s",
labels[2] != NULL ? labels[2] : file3);
if (f3mark == NULL)
err(2, "asprintf");
Index: usr.bin/diff3/tests/Makefile
===================================================================
--- usr.bin/diff3/tests/Makefile
+++ usr.bin/diff3/tests/Makefile
@@ -9,6 +9,12 @@
1cr.txt \
2.txt \
3.txt \
+ lao.txt \
+ tzu.txt \
+ tao.txt \
+ long-m.txt \
+ long-o.txt \
+ long-y.txt \
1.out \
1t.out \
2.out \
@@ -18,6 +24,12 @@
6.out \
7.out \
8.out \
- 9.out
+ 9.out \
+ long-A.out \
+ long-ed.out \
+ long-merge.out \
+ tao-A.out \
+ tao-ed.out \
+ tao-merge.out
.include <bsd.test.mk>
Index: usr.bin/diff3/tests/diff3_test.sh
===================================================================
--- usr.bin/diff3/tests/diff3_test.sh
+++ usr.bin/diff3/tests/diff3_test.sh
@@ -2,6 +2,9 @@
atf_test_case diff3
atf_test_case diff3_lesssimple
+atf_test_case diff3_ed
+atf_test_case diff3_A
+atf_test_case diff3_merge
diff3_body()
{
@@ -31,12 +34,6 @@
atf_check -o file:$(atf_get_srcdir)/7.out \
diff3 -i $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
-
-# atf_check -o file:$(atf_get_srcdir)/8.out \
-# diff3 -A -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
-
-# atf_check -s exit:1 -o file:$(atf_get_srcdir)/9.out \
-# diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
}
diff3_lesssimple_body()
@@ -45,8 +42,43 @@
diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/4.txt $(atf_get_srcdir)/5.txt $(atf_get_srcdir)/6.txt
}
+diff3_ed_body()
+{
+
+ atf_check -s exit:0 -o file:$(atf_get_srcdir)/tao-ed.out \
+ diff3 -e $(atf_get_srcdir)/lao.txt $(atf_get_srcdir)/tzu.txt $(atf_get_srcdir)/tao.txt
+
+ atf_check -s exit:0 -o file:$(atf_get_srcdir)/long-ed.out \
+ diff3 -e $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
+}
+
+diff3_A_body()
+{
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/8.out \
+ diff3 -A -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
+
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/tao-A.out \
+ diff3 -A -L lao.txt -L tzu.txt -L tao.txt $(atf_get_srcdir)/lao.txt $(atf_get_srcdir)/tzu.txt $(atf_get_srcdir)/tao.txt
+
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-A.out \
+ diff3 -A -L long-m.txt -L long-o.txt -L long-y.txt $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
+}
+
+diff3_merge_body()
+{
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/9.out \
+ diff3 -m -L 1 -L 2 -L 3 $(atf_get_srcdir)/1.txt $(atf_get_srcdir)/2.txt $(atf_get_srcdir)/3.txt
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/tao-merge.out \
+ diff3 -m -L lao.txt -L tzu.txt -L tao.txt $(atf_get_srcdir)/lao.txt $(atf_get_srcdir)/tzu.txt $(atf_get_srcdir)/tao.txt
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/long-merge.out \
+ diff3 -m -L long-m.txt -L long-o.txt -L long-y.txt $(atf_get_srcdir)/long-m.txt $(atf_get_srcdir)/long-o.txt $(atf_get_srcdir)/long-y.txt
+}
+
atf_init_test_cases()
{
atf_add_test_case diff3
# atf_add_test_case diff3_lesssimple
+ atf_add_test_case diff3_ed
+ atf_add_test_case diff3_A
+ atf_add_test_case diff3_merge
}
Index: usr.bin/diff3/tests/lao.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/lao.txt
@@ -0,0 +1,11 @@
+The Way that can be told of is not the eternal Way;
+The name that can be named is not the eternal name.
+The Nameless is the origin of Heaven and Earth;
+The Named is the mother of all things.
+Therefore let there always be non-being,
+ so we may see their subtlety,
+And let there always be being,
+ so we may see their outcome.
+The two are the same,
+But after they are produced,
+ they have different names.
Index: usr.bin/diff3/tests/long-A.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-A.out
@@ -0,0 +1,22 @@
+24d
+16a
+||||||| long-o.txt
+This line is different in yours and mine, but the different in each
+=======
+This line is different in yours and mine, but the best in yours
+>>>>>>> long-y.txt
+.
+15a
+<<<<<<< long-m.txt
+.
+11a
+>>>>>>> long-y.txt
+.
+10a
+<<<<<<< long-o.txt
+This line is different in yours and mine, but the same
+=======
+.
+8c
+This line is different in yours, much butter
+.
Index: usr.bin/diff3/tests/long-ed.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-ed.out
@@ -0,0 +1,7 @@
+24d
+16c
+This line is different in yours and mine, but the best in yours
+.
+8c
+This line is different in yours, much butter
+.
Index: usr.bin/diff3/tests/long-m.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-m.txt
@@ -0,0 +1,26 @@
+This is a long file
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in mine, not better
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, the same is in both
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, best change in mine
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is deleted in yours
+These lines are the same in all three files
+These lines are the same in all three files
Index: usr.bin/diff3/tests/long-merge.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-merge.out
@@ -0,0 +1,35 @@
+This is a long file
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in mine, not better
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours, much butter
+These lines are the same in all three files
+These lines are the same in all three files
+<<<<<<< long-o.txt
+This line is different in yours and mine, but the same
+=======
+This line is different in yours and mine, the same is in both
+>>>>>>> long-y.txt
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+<<<<<<< long-m.txt
+This line is different in yours and mine, best change in mine
+||||||| long-o.txt
+This line is different in yours and mine, but the different in each
+=======
+This line is different in yours and mine, but the best in yours
+>>>>>>> long-y.txt
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
Index: usr.bin/diff3/tests/long-o.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-o.txt
@@ -0,0 +1,27 @@
+This is a long file
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in mine
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, but the same
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, but the different in each
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is deleted in mine
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is deleted in yours
+These lines are the same in all three files
+These lines are the same in all three files
Index: usr.bin/diff3/tests/long-y.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/long-y.txt
@@ -0,0 +1,26 @@
+This is a long file
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in mine
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours, much butter
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, the same is in both
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is different in yours and mine, but the best in yours
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+This line is deleted in mine
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
+These lines are the same in all three files
Index: usr.bin/diff3/tests/tao-A.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/tao-A.out
@@ -0,0 +1,23 @@
+11a
+||||||| tzu.txt
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
+=======
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+>>>>>>> tao.txt
+.
+11a
+<<<<<<< lao.txt
+.
+8c
+ so we may see their result.
+.
+2a
+>>>>>>> tao.txt
+.
+0a
+<<<<<<< tzu.txt
+=======
+.
Index: usr.bin/diff3/tests/tao-ed.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/tao-ed.out
@@ -0,0 +1,7 @@
+11a
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+.
+8c
+ so we may see their result.
+.
Index: usr.bin/diff3/tests/tao-merge.out
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/tao-merge.out
@@ -0,0 +1,23 @@
+<<<<<<< tzu.txt
+=======
+The Way that can be told of is not the eternal Way;
+The name that can be named is not the eternal name.
+>>>>>>> tao.txt
+The Nameless is the origin of Heaven and Earth;
+The Named is the mother of all things.
+Therefore let there always be non-being,
+ so we may see their subtlety,
+And let there always be being,
+ so we may see their result.
+The two are the same,
+But after they are produced,
+ they have different names.
+<<<<<<< lao.txt
+||||||| tzu.txt
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
+=======
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+>>>>>>> tao.txt
Index: usr.bin/diff3/tests/tao.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/tao.txt
@@ -0,0 +1,14 @@
+The Way that can be told of is not the eternal Way;
+The name that can be named is not the eternal name.
+The Nameless is the origin of Heaven and Earth;
+The named is the mother of all things.
+
+Therefore let there always be non-being,
+ so we may see their subtlety,
+And let there always be being,
+ so we may see their result.
+The two are the same,
+But after they are produced,
+ they have different names.
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
Index: usr.bin/diff3/tests/tzu.txt
===================================================================
--- /dev/null
+++ usr.bin/diff3/tests/tzu.txt
@@ -0,0 +1,13 @@
+The Nameless is the origin of Heaven and Earth;
+The named is the mother of all things.
+
+Therefore let there always be non-being,
+ so we may see their subtlety,
+And let there always be being,
+ so we may see their outcome.
+The two are the same,
+But after they are produced,
+ they have different names.
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 10:01 PM (6 h, 57 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16517242
Default Alt Text
D34421.diff (24 KB)
Attached To
Mode
D34421: diff3: Add support for -A and -m
Attached
Detach File
Event Timeline
Log In to Comment