When you get a conflict in a merge on update it is useful to know what the
original version was that the 2 new versions shown in the file were based
on. The patch provided makes cvs put the third version in as well.

example from sanity-sh branches-15:

A conflict marked like this

<<<<<<< file1
1:ancest
=======
1:brbr
>>>>>>> 1.1.2.1.2.1

becomes marked like this

<<<<<<< file1
1:ancest
||||||| 1.1.2.1
1:br1
=======
1:brbr
>>>>>>> 1.1.2.1.2.1

I could not see a simple way to make this a configurable option, so
unfortunately my patch means this behaviour is fixed.

Enjoy,
Simon

-----------------------------------------------------------------------
| Simon Liddington                 | Tel (home): +44 23 8023 7935     |
| [EMAIL PROTECTED]                   | Tel (work): +44 23 8068 3521     |
-----------------------------------------------------------------------
--- cvs-1.10.6/diff/diff3.c.orig        Tue Mar 28 11:14:02 2000
+++ cvs-1.10.6/diff/diff3.c     Tue Mar 28 12:01:07 2000
@@ -183,6 +183,9 @@
 /* If nonzero, show information for DIFF_2ND diffs.  */
 static int show_2nd;
 
+/* If nonzero, show 2ND file in conflicts.  */
+static int bracket_all;
+
 /* If nonzero, include `:wq' at the end of the script
    to write out the file being edited.   */
 static int finalwrite;
@@ -231,6 +234,7 @@
 {
   {"text", 0, 0, 'a'},
   {"show-all", 0, 0, 'A'},
+  {"bracket-all", 0, 0, 'B'},
   {"ed", 0, 0, 'e'},
   {"show-overlap", 0, 0, 'E'},
   {"label", 1, 0, 'L'},
@@ -277,10 +281,13 @@
 
   optind_old = optind;
   optind = 0;
-  while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != EOF)
+  while ((c = getopt_long (argc, argv, "aeimvx3ABEL:TX", longopts, 0)) != EOF)
     {
       switch (c)
        {
+       case 'B':
+         bracket_all = 1;
+         break;
        case 'a':
          always_text = 1;
          break;
@@ -522,6 +529,7 @@
       (*callbacks->write_stdout) ("\
   -e  --ed  Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\
   -E  --show-overlap  Output unmerged changes, bracketing conflicts.\n\
+  -B  --bracket-all  Show all 3 versions in bracketed conflicts
   -A  --show-all  Output all changes, bracketing conflicts.\n\
   -x  --overlap-only  Output overlapping changes.\n\
   -X  Output overlapping changes, bracketing them.\n\
@@ -544,6 +552,7 @@
       printf ("%s", "\
   -e  --ed  Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\
   -E  --show-overlap  Output unmerged changes, bracketing conflicts.\n\
+  -B  --bracket-all  Show all 3 versions in bracketed conflicts
   -A  --show-all  Output all changes, bracketing conflicts.\n\
   -x  --overlap-only  Output overlapping changes.\n\
   -X  Output overlapping changes, bracketing them.\n\
@@ -1599,7 +1608,7 @@
          leading_dot = 0;
          if (type == DIFF_ALL)
            {
-             if (show_2nd)
+             if (show_2nd || bracket_all)
                {
                  /* Append lines from FILE1.  */
                  printf_output ("||||||| %s\n", file1);
@@ -1750,7 +1759,7 @@
                              D_RELLEN (b, mapping[FILE0], i));
            }
 
-         if (show_2nd)
+         if (show_2nd || bracket_all)
            {
              /* Put in lines from FILE1 with bracket.  */
              printf_output (format_2nd, file1);
@@ -1850,6 +1859,7 @@
     int *argcp;
     char ***argvp;
 {
+  bracket_all = 0;
   always_text = 0;
   edscript = 0;
   flagging = 0;

--- cvs-1.10.6/src/rcscmds.c.orig       Tue Mar 28 12:31:44 2000
+++ cvs-1.10.6/src/rcscmds.c    Tue Mar 28 12:32:25 2000
@@ -298,7 +298,7 @@
        only for diagnostic messages -- CVS no longer forks to run diff3. */
     diffout = cvs_temp_name();
     call_diff_setup ("diff3");
-    call_diff_arg ("-E");
+    call_diff_arg ("-EB");
     call_diff_arg ("-am");
 
     call_diff_arg ("-L");

--- cvs-1.11.1p1/src/sanity.sh.orig     Mon Jun 18 11:02:41 2001
+++ cvs-1.11.1p1/src/sanity.sh  Mon Jun 18 11:02:42 2001
@@ -5347,6 +5347,8 @@
 rcsmerge: warning: conflicts during merge"
          dotest branches-16 "cat file1" '<<<<<<< file1
 1:ancest
+[|]|||||| 1\.1\.2\.1
+1:br1
 [=]======
 1:brbr
 [>]>>>>>> 1\.1\.2\.1\.2\.1'
@@ -5780,6 +5782,8 @@
 "<<<<<<< file1
 brmod
 moremod
+[|]|||||| 1\.1\.2\.1
+brmod
 [=]======
 [>]>>>>>> 1\.1"
          echo resolve >file1
@@ -5997,6 +6001,10 @@
 1\.1\.2\.1
 2
 three
+[|]|||||| 1\.1
+1.1
+2
+3
 [=]======
 1\.2
 two
@@ -6360,6 +6368,8 @@
 [<]<<<<<< imported-f2
 import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' 
Exp \$
 local-change
+[|]|||||| 1\.1\.1\.1
+import should not expand \$''Id: imported-f2,v 1\.1\.1\.1 [0-9/]* [0-9:]* 
+'"${username}"' Exp \$
 [=]======
 import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* 
'"${username}"' Exp \$
 rev 2 of file 2
@@ -7360,6 +7370,7 @@
 "initial contents of file1
 [<]<<<<<< file1
 br1:line1
+[|]|||||| 1\.1
 [=]======
 trunk:line1
 [>]>>>>>> 1\.2"
@@ -7392,6 +7403,7 @@
 "initial contents of file1
 [<]<<<<<< file1
 br1:line1
+[|]|||||| 1\.1
 [=]======
 trunk:line1
 br2:line1
@@ -18067,11 +18079,13 @@
 diff -r1\.2 file1
 0a1
 > <<<<<<< file1
-1a3,5
+1a3,7
+> ||||||| 1\.1
+> \\\$""Revision: 1\.1 \\\$
 > =======
 > \\\$""Revision: 1\.1\.2\.1 \\\$
 > >>>>>>> 1\.1\.2\.1
-14a19
+14a21
 > what else do we have${QUESTION}"
 
          # Here's the problem... shouldn't -kk a binary file...

Reply via email to