File:  [CSRG BSD Unix] / 43BSDReno / usr.bin / diff / diff3 / diff3.1
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement:  ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of the University nor the names of its contributors may
.\" be used to endorse or promote products derived from this software without
.\" specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\"     @(#)diff3.1	6.4 (Berkeley) 7/24/90
.\"
.Dd July 24, 1990
.Dt DIFF3 1
.Os BSD 4.3+Reno
.Sh NAME
.Nm diff3
.Nd 3-way differential file comparison
.Sh SYNOPSIS
.Nm diff3
.Op Fl exEX3
.Ar file1 file2 file3
.Sh DESCRIPTION
The
.Nm diff3
utility compares the contents of three different versions of a file,
.Ar file1 ,
.Ar file2
and
.Ar file3 ,
writing the result to the standard output.
The options describe different methods of merging and
purging
the separate versions into a new file.
.Nm Diff3
is used by
.Xr RCS 1
to merge specific versions or create
new versions.
.Pp
Options are:
.Tp Fl e
Produces output in a form suitable as an input script for the
.Xr ed 1
utility.  The script may then be used to merge differences common
between all three files and differences specific to file1 and file3.
In other words, the
.Fl e
option ignores differences specific to file1 and file2, and those
specific to file2 and file3.  It is useful for backing out changes
specific to file2 only.
.Tp Fl x
Produces an output script suitable for
.Xr ed 1
with changes
specific only to all three versions.
.Tp Fl 3
Produces an output script suitable for
.Xr ed 1
with changes
specific only to file3.
.Tp Fl E , X
Similar to
.Fl e
and
.Fl x  ,
respectively, but treat overlapping changes (i.e., changes that would
be noted with ==== in the normal listing) differently.  The overlapping
lines from both files will be inserted by the edit script, bracketed
by "<<<<<<" and ">>>>>>" lines.
.Tp
.Pp
The
.Fl E
option is used by RCS
.Xr merge  1
to insure that overlapping changes in the merged files are preserved
and brought to someone's attention.
.Pp
For example, suppose lines 7-8 are changed in both file1 and file2.
Applying the edit script generated by the command
.Pp
.Dl diff3 -E file1 file2 file3
.Pp
to file1 results in the file:
.Ds I
lines 1-6
of file1
<<<<<<< file1
lines 7-8
of file1
=======
lines 7-8
of file3
>>>>>>> file3
rest of file1
.De
.Pp
The default output of
.Nm diff3
makes notation of the differences between all files, and those differences
specific to each pair of files. The
changes are described by
the commands neccessary for
.Xr ed 1 
to create the desired target from the different versions.
See
.Xr diff 1
for a description of the commands.
.Tw Fl
.Tp Li \&====
The lines beneath this notation are ranges of lines which are different
between all files.
.Tc Li \&====
.Va n
.Cx
The lines beneath this notation are ranges of lines which are exclusively
different in file
.Va n .
.Tp
.\" .Sh EXAMPLES
.\" .Pp
.\" If three files were to contain:
.\" .Ds I
.\" .Cw  mooxthree mooxthree mooxthree
.\" .Cl file1	file2	file3
.\" .Cl moo	moo	moo
.\" .Cl moo too	moon	moon
.\" .Cl moo three	moo moo	moo moo
.\" .Cl tangent	beam	milk
.\" .Cl moo moo	sun	butter
.\" .Cl \tcloud	beam
.\" .Cl \tmoo moo
.\" .Cl \tmoo moo
.\" .Cw
.\" .De
.\" .Pp
.\" The command line
.\" .Pp
.\" .Dl diff3 -e file1 file2 file3
.\" .Pp
.\" produces the following ed script:
.\" .Pp
.\" .Ds C
.\" ====1
.\" 1:2,4c
.\"   moo two
.\"   moo three
.\"   tangent
.\" 2:2c
.\" 3:2c
.\"   moon
.\" ====
.\" 1:5a
.\" 2:4,8c
.\"   beam
.\"   sun
.\"   cloud
.\"   moo moo
.\"   moo moo
.\" 3:4,6c
.\"   milk
.\"   butter
.\"   beam
.\" .De
.Sh FILES
.Dw /usr/bin/diff3
.Di L
.Dp Pa /tmp/d3?????
temporary files.
.Dp Pa /usr/bin/diff3
the executable.
.Dp
.Sh SEE ALSO
.Xr diff 1
.Xr ed 1
.Xr rcs 1
.Sh HISTORY
.Nm Diff3
appeared in Version 7 AT&T Unix.
.Sh BUGS
The
.Fl e
option
cannot catch and change
lines which have
.Sq Li \&.
as the first ans only character on the line.
The resulting script will fail on that line
as the
.Sq Li \&.
is an
.Xr ed 1
editing command.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.