[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Re: Non-modal merge
From: |
Ralf S. Engelschall |
Subject: |
Re: [Monotone-devel] Re: Non-modal merge |
Date: |
Mon, 24 Sep 2007 21:44:22 +0200 |
User-agent: |
Mutt/1.5.16 OpenPKG/CURRENT (2007-06-09) |
On Mon, Sep 24, 2007, Stefan Monnier wrote:
> [...]
> > I've not found an option combination for diff3(1)
> > which shows the ancestors but not the non-overlapping parts. I've tried
> > many combinations of --merge, -A, -E, -x and -X but have not found a
> > solution.
>
> Indeed AFAIK there's no such solution. It's easy to change diff3 to provide
> this feature, and I proposed such a change to diff3's maintainer about 10
> years ago, but I didn't have a clean patch back then and never got around to
> write one.
Ok, as I really want the most useful workspace-based merging for
Monotone myself, I've investigated on this issue for us and crafted such
a patch against GNU diffutils 2.8.7 -- I've now even already applied it
to our official OpenPKG "diffutils" package, so I've it available in the
OpenPKG world ;-) I append you the patch here, too...
Ralf S. Engelschall
address@hidden
www.engelschall.com
Add option "-O" to diff3(1) in order to allow one to display information
about the 2nd file (the ancestor/older one) not just under option "-A",
but also under "-E" and "-X". This way one especially can get the
consise output of "-E" (where only "unmerged" conflicts and overlaps are
shown), but still get the verbose information (introduced with "|||||||
<older-name>") about the ancestor/older file in the flagged/marked
output. This way "diff3 -m -E -O" gives one the best resolution chances
on a 3-way merge without having to deal with the useless (already
"merged") information one would get under "diff3 -m -A". --rse 20070924
Index: man/diff3.1
--- man/diff3.1.orig 2004-04-13 09:07:28 +0200
+++ man/diff3.1 2007-09-24 21:42:43 +0200
@@ -38,6 +38,9 @@
\fB\-a\fR \fB\-\-text\fR
Treat all files as text.
.TP
+\fB\-O\fR
+Always show content of OLDFILE in bracketing output of unmerged changes.
+.TP
\fB\-\-strip\-trailing\-cr\fR
Strip trailing carriage return on input.
.TP
Index: src/diff3.c
--- src/diff3.c.orig 2004-04-12 09:44:35 +0200
+++ src/diff3.c 2007-09-24 21:21:38 +0200
@@ -153,6 +153,9 @@
/* If nonzero, show information for DIFF_2ND diffs. */
static bool show_2nd;
+/* If nonzero, show information for DIFF_2ND on overlaps, too. */
+static bool show_2nd_on_overlap;
+
/* If nonzero, include `:wq' at the end of the script
to write out the file being edited. */
static bool finalwrite;
@@ -234,7 +237,7 @@
textdomain (PACKAGE);
c_stack_action (0);
- while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != -1)
+ while ((c = getopt_long (argc, argv, "aeimvx3AEL:TXO", longopts, 0)) != -1)
{
switch (c)
{
@@ -269,6 +272,9 @@
case 'e':
incompat++;
break;
+ case 'O':
+ show_2nd_on_overlap = true;
+ break;
case 'T':
initial_tab = true;
break;
@@ -1527,7 +1533,7 @@
leading_dot = false;
if (type == DIFF_ALL)
{
- if (show_2nd)
+ if (show_2nd || show_2nd_on_overlap)
{
/* Append lines from FILE1. */
fprintf (outputfile, "||||||| %s\n", file1);
@@ -1665,7 +1671,7 @@
D_RELLEN (b, mapping[FILE0], i), outputfile);
}
- if (show_2nd)
+ if (show_2nd || show_2nd_on_overlap)
{
/* Put in lines from FILE1 with bracket. */
fprintf (outputfile, format_2nd, file1);
- [Monotone-devel] Non-modal merge, Stefan Monnier, 2007/09/21
- Re: [Monotone-devel] Non-modal merge, Stephen Leake, 2007/09/22
- Re: [Monotone-devel] Non-modal merge, Ralf S. Engelschall, 2007/09/23
- Re: [Monotone-devel] Non-modal merge, Stephen Leake, 2007/09/23
- Re: [Monotone-devel] Non-modal merge, Ralf S. Engelschall, 2007/09/23
- [Monotone-devel] Re: Non-modal merge, Stefan Monnier, 2007/09/24
- Re: [Monotone-devel] Re: Non-modal merge,
Ralf S. Engelschall <=
- Re: [Monotone-devel] Re: Non-modal merge, Ralf S. Engelschall, 2007/09/24
- Re: [Monotone-devel] Re: Non-modal merge, Nathaniel Smith, 2007/09/24
- Re: [Monotone-devel] Non-modal merge, Stephen Leake, 2007/09/24
- Re: [Monotone-devel] Non-modal merge, Ralf S. Engelschall, 2007/09/24
- Re: [Monotone-devel] Non-modal merge, Nathaniel Smith, 2007/09/24