[gnu.utils.bug] Need RCS variant of diff3

merrick@UUNET.UU.NET (01/10/90)

Hello

I am currently trying to get RCS running on a System V (2.X) machine, and
have run into the following roadblock:

	* The System V I am using does not have the diff and diff3 versions
	  required by RCS.

	* I have obtained the "gnudiff" package from uunet, but it seems
	  that the diff3 supplied is not the one RCS needs. The RCS merge
	  shell script calls diff3 with many arguments (including revision
	  numbers to be used as labels for the differences), far more than
	  the GNU diff3 is willing to entertain.

	* I cannot find source to the RCS variant of diff3 anywhere. 
	  To further my frustration, I have most recently been working on
	  a Pyramid, which has RCS - including the elusive diff3 - distributed
	  with OSx, but binary only.

	* The project we want to employ RCS on will need to make extensive
	  use of branching and merging.

I'd really appreciate information on where I'm likely to find RCS diff3.
FYI, both the RCS and GNUdiff sources were obtained from the /usr/spool/ftp/gnu
directory on uunet.

Thanks for any and all help,

	Phillip Merrick  {...!uunet!viar1!merrick}
	Viar and Company, Alexandria, VA.	

trinkle@CS.PURDUE.EDU (01/10/90)

     The GNU diff3 works for ci and co, but does not work for rcsmerge
(which uses the merge script).  I have included a different version of
merge for the GNU diff3 and a patch to GNU diff3 to make it return the
number of overlaps as it's exit status.  Please let me know if this
works for you.  If I get enough positive feedback on the GNU
diff/merge stuff, I will encourage GNU to modify diff3 or add an
option that will cause it to return the number of overlaps.

     The diff/diff3 source used to be distributed with RCS, but it was
discontinued because it was a violation of licenses.

Daniel Trinkle			trinkle@cs.purdue.edu
Dept. of Computer Sciences	{backbone}!purdue!trinkle
Purdue University		317-494-7844
West Lafayette, IN 47907

============================== merge.sh ==============================


PATH=/bin:/usr/bin
DIFF=/usr/new/bin/diff
DIFF3="/usr/new/bin/diff3 -C"
p=w
case $1 in
-p)
	p='1,$p'
	shift
esac

case $# in
0|1|2)
	echo >&2 "merge: usage: merge [-p] file1 file2 file3"
	exit 1
esac

case $p in
w)
	if test ! -w $1
	then
		echo >&2 "$1 not writeable"
		exit 1
	fi
esac

trap 's=$?; rm -f /tmp/d3a$$ /tmp/d3b$$; exit $s' 0
trap exit 1 2 3 13 15
umask 077

{
	$DIFF3 -E $1 $2 $3
	case $? in
	0) ;;
	1) echo >&2 merge: warning: 1 overlap during merge.;;
	*) echo >&2 merge: warning: $? overlaps during merge.
	esac
	echo 'g/^>>>>>>> '$3'$/s//>>>>>>> '$5'/'
	echo $p
} | ed - $1
============================== diff3.c.patch ==============================
*** diff3.c.old	Tue Dec 19 14:50:53 1989
--- diff3.c	Tue Dec 19 14:49:44 1989
***************
*** 192,198 ****
  struct diff_block *process_diff ();
  struct diff3_block *make_3way_diff ();
  void output_diff3 ();
! void output_diff3_edscript ();
  void usage ();
  
  struct diff3_block *using_to_diff3_block ();
--- 192,198 ----
  struct diff_block *process_diff ();
  struct diff3_block *make_3way_diff ();
  void output_diff3 ();
! int output_diff3_edscript ();
  void usage ();
  
  struct diff3_block *using_to_diff3_block ();
***************
*** 229,234 ****
--- 229,235 ----
    int mapping [3];
    int shiftmap;
    int incompat;
+   int overlap_count;
    struct diff_block *thread1, *thread2;
    struct diff3_block *diff;
  
***************
*** 308,319 ****
      }
    diff = make_3way_diff (thread1, thread2);
    if (edscript)
!     output_diff3_edscript (stdout, diff, mapping, argv[optind],
  			   argv[optind + 1], argv[optind + 2]);
    else
      output_diff3 (stdout, diff, mapping);
  
!   exit (0);
  }
        
  /*
--- 309,323 ----
      }
    diff = make_3way_diff (thread1, thread2);
    if (edscript)
!     overlap_count = output_diff3_edscript (stdout, diff, mapping, argv[optind],
  			   argv[optind + 1], argv[optind + 2]);
    else
      output_diff3 (stdout, diff, mapping);
  
!   if (edscript)
!     exit(overlap_count);
!   else
!     exit (0);
  }
        
  /*
***************
*** 1287,1296 ****
   * on which it works.  Thus file0, file1, and file2 are the filenames
   * passed on the command line.
   *
   * See options.h for documentation on the global variables which this
   * routine pays attention to.
   */
! void
  output_diff3_edscript (outputfile, diff, mapping, file0, file1, file2)
       FILE *outputfile;
       struct diff3_block *diff;
--- 1291,1302 ----
   * on which it works.  Thus file0, file1, and file2 are the filenames
   * passed on the command line.
   *
+  * Returns the number of overlaps.
+  *
   * See options.h for documentation on the global variables which this
   * routine pays attention to.
   */
! int
  output_diff3_edscript (outputfile, diff, mapping, file0, file1, file2)
       FILE *outputfile;
       struct diff3_block *diff;
***************
*** 1300,1309 ****
--- 1306,1317 ----
    int rev_mapping[3];
    int i;
    int leading_dot;
+   int overlap_count;
    struct diff3_block *newblock, *thisblock;
    char *cp;
  
    leading_dot = 0;
+   overlap_count = 0;
  
    for (i = 0; i < 3; i++)
      rev_mapping [mapping [i]] = i;
***************
*** 1348,1353 ****
--- 1356,1362 ----
  	      putc ('\n', outputfile);
  	    }
  	  fprintf (outputfile, ">>>>>>> %s\n.\n", file2);
+ 	  overlap_count++;
  
  	  /* Add in code to take care of leading dots, if necessary. */
  	  if (leading_dot)
***************
*** 1421,1426 ****
--- 1430,1436 ----
  	}
      }
    if (finalwrite) fprintf (outputfile, "w\nq\n");
+   return(overlap_count);
  }
  
  /*
======================================================================

dkelly@npiatl.UUCP (Dwight Kelly) (01/11/90)

viar1!merrick@UUNET.UU.NET writes:

>I am currently trying to get RCS running on a System V (2.X) machine, and
>have run into the following roadblock:

>	* The System V I am using does not have the diff and diff3 versions
>	  required by RCS.

Get an earlier version of RCS, like 1.3.  It included diff and diff3 source.
I can provide it if you will email me.

Dwight Kelly
Network Publications, Inc.
Lawrenceville, GA

tower@ai.mit.edu (Leonard H. Tower Jr.) (01/12/90)

   Date: 10 Jan 90 16:41:26 GMT
   From: swrinde!emory!stiatl!rsiatl!kd4nc!npiatl!dkelly@cs.utexas.edu  (Dwight Kelly)
   Organization: Network Publications, Inc.  Atlanta, GA
   Sender: bug-gnu-utils-request@prep.ai.mit.edu

   viar1!merrick@UUNET.UU.NET writes:

   >I am currently trying to get RCS running on a System V (2.X) machine, and
   >have run into the following roadblock:

   >	* The System V I am using does not have the diff and diff3 versions
   >	  required by RCS.

   Get an earlier version of RCS, like 1.3.  It included diff and diff3 source.
   I can provide it if you will email me.

   Dwight Kelly
   Network Publications, Inc.
   Lawrenceville, GA

Or pick up the GNU diff from prep.ai.mit.edu or one of the other fpt
or uucp archives.  gnu@prep.ai.mit.edu can send you a list.

enjoy -len 

fineman@ptolemy.arc.nasa.gov (Charles Fineman) (01/12/90)

Leonard H. Tower Jr. writes:
> 
>    viar1!merrick@UUNET.UU.NET writes:
> 
>    >	* The System V I am using does not have the diff and diff3 versions
>    >	  required by RCS.
> 
>    Get an earlier version of RCS, like 1.3.  It included diff and diff3 source.
>    I can provide it if you will email me.
> 
> Or pick up the GNU diff from prep.ai.mit.edu or one of the other fpt
> or uucp archives.  gnu@prep.ai.mit.edu can send you a list.
> 
> enjoy -len 

Well, the GNU diff program won't work without modification. The diff3
that RCS wants to use is the one in /lib (or it is /usr/lib). The
point being that RCS passes the version numbers of the respective
input files so one can see which conflicting change belongs to which
version. I modified my private version but I'll post the diffs if you
folks are interested (I may do it anyways, but there's a better chance
if someone prods me!)

	~Chuck Fineman