summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/diff
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-08-10 09:43:22 +0000
committerpeter <peter@FreeBSD.org>2001-08-10 09:43:22 +0000
commita037ef8f32200b26968e77344bcfb963251fa8b9 (patch)
tree2b4dc24b830b514680009ead3884ecb1c40974c7 /contrib/cvs/diff
parent590c411955d6975551ffeaf41d7faf4b26f836d1 (diff)
downloadFreeBSD-src-a037ef8f32200b26968e77344bcfb963251fa8b9.zip
FreeBSD-src-a037ef8f32200b26968e77344bcfb963251fa8b9.tar.gz
Import cvs-1.11.1p1 onto vendor branch
Diffstat (limited to 'contrib/cvs/diff')
-rw-r--r--contrib/cvs/diff/ChangeLog67
-rw-r--r--contrib/cvs/diff/Makefile.am24
-rw-r--r--contrib/cvs/diff/Makefile.in369
-rw-r--r--contrib/cvs/diff/analyze.c39
-rw-r--r--contrib/cvs/diff/diff.c2
-rw-r--r--contrib/cvs/diff/diff3.c67
-rw-r--r--contrib/cvs/diff/dir.c10
-rw-r--r--contrib/cvs/diff/system.h13
8 files changed, 469 insertions, 122 deletions
diff --git a/contrib/cvs/diff/ChangeLog b/contrib/cvs/diff/ChangeLog
index e3272e8..565bdb7 100644
--- a/contrib/cvs/diff/ChangeLog
+++ b/contrib/cvs/diff/ChangeLog
@@ -1,3 +1,70 @@
+2001-04-25 Derek Price <dprice@collab.net>
+
+ * Makefile.in: Regenerated using AM 1.4e as of today at 18:10 -0400.
+
+2001-03-24 Noel Cragg <noel@shave.red-bean.com>
+
+ * diff.c: fix typo in usage string.
+
+2001-03-20 Derek Price <derek.price@openavenue.com>
+ for Karl Tomlinson <k.tomlinson@auckland.ac.nz>
+
+ * diff3.c (main): changed the common file of the two diffs to
+ OLDFILE for merges and edscripts so that the diffs are more likely
+ to contain the intended changes. Not changing the horizon-lines
+ arg for the second diff. If the two diffs have the same parameters
+ equal changes in each diff are more likely to appear the same.
+
+ * analyze.c (shift_boundaries): undid Paul Eggert's patch to fix
+ the diff3 merge bug described in ccvs/doc/DIFFUTILS-2.7-BUG. The
+ patch is no longer necessary now that diff3 does its differences
+ differently. I think the hunk merges provide a better indication
+ of the area modified by the user now that the diffs are actually
+ done between the appropriate revisions.
+
+2001-03-15 Derek Price <derek.price@openavenue.com>
+
+ * Makefile.am (INCLUDES): Add -I$(top_srcdir)/lib for platforms which
+ need the regex library there.
+
+ * Makefile.in: Regenerated.
+
+2001-03-14 Derek Price <derek.price@openavenue.com>
+
+ * .cvsignore: Added '.deps'.
+
+ Pavel Roskin <proski@gnu.org>
+
+ * Makefile.am: New file.
+ * Makefile.in: Regenerated.
+
+2001-02-22 Derek Price <derek.price@openavenue.com>
+ Pavel Roskin <proski@gnu.org>
+
+ * Makefile.in: Don't define PR_PROGRAM - it's defined by configure.
+ Remove separate rule for util.c.
+
+2001-02-06 Derek Price <derek.price@openavenue.com>
+ Rex Jolliff <Rex_Jolliff@notes.ymp.gov>
+ Shawn Smith <Shawn_Smith@notes.ymp.gov>
+
+ * dir.c: Replace opendir, closedir, & readdir calls with CVS_OPENDIR,
+ CVS_CLOSEDIR, & CVS_READDIR in support of changes to handle VMS DEC C
+ 5.7 {open,read,close}dir problems. Check today's entry in the vms
+ subdir for more.
+ * system.h: definitions of CVS_*DIR provided here.
+
+2000-12-21 Derek Price <derek.price@openavenue.com>
+
+ * Makefile.in: Some changes to support Automake targets
+
+2000-10-26 Larry Jones <larry.jones@sdrc.com>
+
+ * Makefile.in: Get PR_PROGRAM from autoconf instead of hard coding.
+ (Patch submitted by Urs Thuermann <urs@isnogud.escape.de>.)
+ Also add a dependency for util.o on Makefile since PR_PROGRAM gets
+ compiled in.
+
2000-08-03 Larry Jones <larry.jones@sdrc.com>
* diff3.c (read_diff): Use cvs_temp_name () instead of tmpnam () so
diff --git a/contrib/cvs/diff/Makefile.am b/contrib/cvs/diff/Makefile.am
new file mode 100644
index 0000000..38ed80e
--- /dev/null
+++ b/contrib/cvs/diff/Makefile.am
@@ -0,0 +1,24 @@
+## Makefile.am for GNU DIFF
+## Copyright (C) 2001 Free Software Foundation, Inc.
+##
+## This file is part of GNU DIFF.
+##
+## GNU DIFF is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## GNU DIFF is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+INCLUDES = -I$(top_srcdir)/lib
+
+noinst_LIBRARIES = libdiff.a
+
+libdiff_a_SOURCES = diff.c diff3.c analyze.c cmpbuf.c cmpbuf.h io.c \
+ context.c ed.c normal.c ifdef.c util.c dir.c version.c diff.h \
+ side.c system.h diffrun.h
+
+EXTRA_DIST = ChangeLog build_diff.com diagmeet.note libdiff.dsp
diff --git a/contrib/cvs/diff/Makefile.in b/contrib/cvs/diff/Makefile.in
index 31f4910..d9d1703 100644
--- a/contrib/cvs/diff/Makefile.in
+++ b/contrib/cvs/diff/Makefile.in
@@ -1,102 +1,327 @@
-# Makefile for GNU DIFF
-# Copyright (C) 1988,1989,1991,1992,1993,1994,1997,1998 Free Software Foundation, Inc.
-#
-# This file is part of GNU DIFF.
-#
-# GNU DIFF is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU DIFF is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-#### Start of system configuration section. ####
-
-srcdir = @srcdir@
+# Makefile.in generated automatically by automake 1.4e from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-subdir = diff
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+AMTAR = @AMTAR@
+AWK = @AWK@
CC = @CC@
+CSH = @CSH@
+DEPDIR = @DEPDIR@
+ETAGS = @ETAGS@
+ETAGS_INCLUDE_OPTION = @ETAGS_INCLUDE_OPTION@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@
+KRB4 = @KRB4@
+LN_S = @LN_S@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PERL = @PERL@
+PR = @PR@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+ROFF = @ROFF@
+STRIP = @STRIP@
+TEXI2DVI = @TEXI2DVI@
+VERSION = @VERSION@
+YACC = @YACC@
+_am_include = @_am_include@
+_am_quote = @_am_quote@
+includeopt = @includeopt@
+install_sh = @install_sh@
+
+INCLUDES = -I$(top_srcdir)/lib
+
+noinst_LIBRARIES = libdiff.a
+
+libdiff_a_SOURCES = diff.c diff3.c analyze.c cmpbuf.c cmpbuf.h io.c \
+ context.c ed.c normal.c ifdef.c util.c dir.c version.c diff.h \
+ side.c system.h diffrun.h
+
+
+EXTRA_DIST = ChangeLog build_diff.com diagmeet.note libdiff.dsp
+EXEEXT =
+OBJEXT = o
+subdir = diff
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/src/options.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+libdiff_a_AR = $(AR) cru
+libdiff_a_LIBADD =
+am_libdiff_a_OBJECTS = diff.$(OBJEXT) diff3.$(OBJEXT) analyze.$(OBJEXT) \
+ cmpbuf.$(OBJEXT) io.$(OBJEXT) context.$(OBJEXT) ed.$(OBJEXT) \
+ normal.$(OBJEXT) ifdef.$(OBJEXT) util.$(OBJEXT) dir.$(OBJEXT) \
+ version.$(OBJEXT) side.$(OBJEXT)
+libdiff_a_OBJECTS = $(am_libdiff_a_OBJECTS)
AR = ar
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CFLAGS = @CFLAGS@
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CPPFLAGS = @CPPFLAGS@
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/src
DEFS = @DEFS@
-RANLIB = @RANLIB@
-CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+DIST_SOURCES = $(libdiff_a_SOURCES)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/analyze.Po $(DEPDIR)/cmpbuf.Po \
+@AMDEP_TRUE@ $(DEPDIR)/context.Po $(DEPDIR)/diff.Po \
+@AMDEP_TRUE@ $(DEPDIR)/diff3.Po $(DEPDIR)/dir.Po $(DEPDIR)/ed.Po \
+@AMDEP_TRUE@ $(DEPDIR)/ifdef.Po $(DEPDIR)/io.Po \
+@AMDEP_TRUE@ $(DEPDIR)/normal.Po $(DEPDIR)/side.Po \
+@AMDEP_TRUE@ $(DEPDIR)/util.Po $(DEPDIR)/version.Po
+DIST_COMMON = ChangeLog Makefile.am Makefile.in
+SOURCES = $(libdiff_a_SOURCES)
+OBJECTS = $(am_libdiff_a_OBJECTS)
-prefix = @prefix@
-exec_prefix = @exec_prefix@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu diff/Makefile
-PR_PROGRAM = /bin/pr
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && \
+ CONFIG_HEADERS= CONFIG_LINKS= \
+ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
-#### End of system configuration section. ####
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-SHELL = /bin/sh
+libdiff.a: $(libdiff_a_OBJECTS) $(libdiff_a_DEPENDENCIES)
+ -rm -f libdiff.a
+ $(libdiff_a_AR) libdiff.a $(libdiff_a_OBJECTS) $(libdiff_a_LIBADD)
+ $(RANLIB) libdiff.a
-# The source files for all of the programs.
-SOURCES = diff.c diff3.c analyze.c cmpbuf.c cmpbuf.h io.c context.c ed.c \
- normal.c ifdef.c util.c dir.c version.c diff.h side.c system.h \
- diffrun.h
-OBJECTS = diff.o diff3.o analyze.o cmpbuf.o dir.o io.o util.o \
- context.o ed.o ifdef.o normal.o side.o version.o
-DISTFILES = $(SOURCES) ChangeLog build_diff.com Makefile.in diagmeet.note \
- libdiff.dsp .cvsignore
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
-all: libdiff.a
+distclean-compile:
+ -rm -f *.tab.c
-# $(top_srcdir)/lib is so we don't get the system-supplied headers for
-# functions that we supply ourselves in lib. $(srcdir) is perhaps not
-# necessary if we assume the unix compiler behavior whereby "" looks
-# in the directory containing the .c file first.
-# -I. is probably unnecessary (I don't think we generate any .h files).
-# -I.. is for config.h.
-COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) \
- -I. -I.. -I$(srcdir) -I$(top_srcdir)/lib $(CFLAGS)
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list @CONFIG@; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || $(ETAGS) $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+GTAGS:
+ here=`CDPATH=: && cd $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $$here
+
+distclean-tags:
+ -rm -f TAGS ID
+
+@_am_include@ @_am_quote@$(DEPDIR)/analyze.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/cmpbuf.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/context.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/diff.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/diff3.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/dir.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/ed.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/ifdef.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/io.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/normal.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/side.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/util.Po@_am_quote@
+@_am_include@ @_am_quote@$(DEPDIR)/version.Po@_am_quote@
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+CCDEPMODE = @CCDEPMODE@
.c.o:
- $(COMPILE) $<
+ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
-libdiff libdiff.a: $(OBJECTS)
- $(AR) cr libdiff.a $(OBJECTS)
- -$(RANLIB) libdiff.a
+.c.obj:
+ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c -o $@ `cygpath -w $<`
-$(OBJECTS): diff.h diffrun.h system.h
-analyze.o cmpbuf.o: cmpbuf.h
-util.o: util.c
- $(COMPILE) -DPR_PROGRAM=\"$(PR_PROGRAM)\" $<
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-install: all
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
installdirs:
- @: nothing to do for installdirs
-.PHONY: installdirs
-TAGS: $(SOURCES)
- etags $(SOURCES)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
-clean:
- rm -f *.o *.a core
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-mostlyclean: clean
+installcheck: installcheck-am
-distclean: clean
- rm -f TAGS tags Makefile
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install
-realclean: distclean
+mostlyclean-generic:
-Makefile: Makefile.in ../config.status
- cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f Makefile.in
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-tags
+
+dvi:
+
+dvi-am:
+
+info:
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info:
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+.PHONY: all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES distclean distclean-compile \
+ distclean-depend distclean-generic distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic tags \
+ uninstall uninstall-am
-dist-dir:
- mkdir ${DISTDIR}
- for i in ${DISTFILES}; do \
- ln $(srcdir)/$${i} ${DISTDIR}; \
- done
-# Prevent GNU make v3 from overflowing arg limit on SysV.
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/contrib/cvs/diff/analyze.c b/contrib/cvs/diff/analyze.c
index f292594..3262444 100644
--- a/contrib/cvs/diff/analyze.c
+++ b/contrib/cvs/diff/analyze.c
@@ -621,7 +621,9 @@ shift_boundaries (filevec)
struct file_data filevec[];
{
int f;
- int inhibit_hunk_merge = horizon_lines != context;
+
+ if (inhibit)
+ return;
for (f = 0; f < 2; f++)
{
@@ -664,21 +666,18 @@ shift_boundaries (filevec)
we can later determine whether the run has grown. */
runlength = i - start;
- if (! inhibit_hunk_merge)
- {
- /* Move the changed region back, so long as the
- previous unchanged line matches the last changed one.
- This merges with previous changed regions. */
+ /* Move the changed region back, so long as the
+ previous unchanged line matches the last changed one.
+ This merges with previous changed regions. */
- while (start && equivs[start - 1] == equivs[i - 1])
- {
- changed[--start] = 1;
- changed[--i] = 0;
- while (changed[start - 1])
- start--;
- while (other_changed[--j])
- continue;
- }
+ while (start && equivs[start - 1] == equivs[i - 1])
+ {
+ changed[--start] = 1;
+ changed[--i] = 0;
+ while (changed[start - 1])
+ start--;
+ while (other_changed[--j])
+ continue;
}
/* Set CORRESPONDING to the end of the changed run, at the last
@@ -686,15 +685,13 @@ shift_boundaries (filevec)
CORRESPONDING == I_END means no such point has been found. */
corresponding = other_changed[j - 1] ? i : i_end;
- /* Shift the changed region forward, so long as the
- first changed line matches the following unchanged one,
- but if INHIBIT_HUNK_MERGE is 1 do not shift if
- this would merge with another changed region.
+ /* Move the changed region forward, so long as the
+ first changed line matches the following unchanged one.
+ This merges with following changed regions.
Do this second, so that if there are no merges,
the changed region is moved forward as far as possible. */
- while (i != i_end && equivs[start] == equivs[i]
- && ! (inhibit_hunk_merge & other_changed[j + 1]))
+ while (i != i_end && equivs[start] == equivs[i])
{
changed[start++] = 0;
changed[i++] = 1;
diff --git a/contrib/cvs/diff/diff.c b/contrib/cvs/diff/diff.c
index aa91913..ebd78ae 100644
--- a/contrib/cvs/diff/diff.c
+++ b/contrib/cvs/diff/diff.c
@@ -775,7 +775,7 @@ static char const * const option_help[] = {
"-e --ed Output an ed script.",
"-n --rcs Output an RCS format diff.",
"-y --side-by-side Output in two columns.",
-" -w NUM --width=NUM Output at most NUM (default 130) characters per line.",
+" -W NUM --width=NUM Output at most NUM (default 130) characters per line.",
" --left-column Output only the left column of common lines.",
" --suppress-common-lines Do not output common lines.",
"-DNAME --ifdef=NAME Output merged file to show `#ifdef NAME' diffs.",
diff --git a/contrib/cvs/diff/diff3.c b/contrib/cvs/diff/diff3.c
index 2f05d16..4a6fba6 100644
--- a/contrib/cvs/diff/diff3.c
+++ b/contrib/cvs/diff/diff3.c
@@ -171,7 +171,7 @@ static int edscript;
static int flagging;
/* Number of lines to keep in identical prefix and suffix. */
-static int horizon_lines = 10;
+static int const horizon_lines = 10;
/* Use a tab to align output lines (-T). */
static int tab_align_flag;
@@ -370,28 +370,44 @@ diff3_run (argc, argv, out, callbacks_arg)
file0-file1 diffs didn't line up with the file0-file2 diffs
(which is entirely possible since we don't use diff's -n option),
diff3 might report phantom changes from file1 to file2. */
+ /* Also try to compare file0 to file1 because this is the where
+ changes are expected to come from. Diffing between these pairs
+ of files is is most likely to return the intended changes. There
+ can also be the same problem with phantom changes from file0 to
+ file1. */
+ /* Historically, the default common file was file2. Ediff for emacs
+ and possibly other applications, have therefore made file2 the
+ ancestor. So, for compatibility, if this is simply a three
+ way diff (not a merge or edscript) then use the old way with
+ file2 as the common file. */
+
+ {
+ int common;
+ if (edscript || merge )
+ {
+ common = 1;
+ }
+ else
+ {
+ common = 2;
+ }
+ if (strcmp (file[common], "-") == 0)
+ {
+ /* Sigh. We've got standard input as the arg corresponding to
+ the desired common file. We can't call diff twice on
+ stdin. Use another arg as the common file instead. */
+ common = 3 - common;
+ if (strcmp (file[0], "-") == 0 || strcmp (file[common], "-") == 0)
+ {
+ diff_error ("%s", "`-' specified for more than one input file", 0);
+ return 2;
+ }
+ }
- if (strcmp (file[2], "-") == 0)
- {
- /* Sigh. We've got standard input as the last arg. We can't
- call diff twice on stdin. Use the middle arg as the common
- file instead. */
- if (strcmp (file[0], "-") == 0 || strcmp (file[1], "-") == 0)
- {
- diff_error ("%s", "`-' specified for more than one input file", 0);
- return 2;
- }
- mapping[0] = 0;
- mapping[1] = 2;
- mapping[2] = 1;
- }
- else
- {
- /* Normal, what you'd expect */
- mapping[0] = 0;
- mapping[1] = 1;
- mapping[2] = 2;
- }
+ mapping[0] = 0;
+ mapping[1] = 3 - common;
+ mapping[2] = common;
+ }
for (i = 0; i < 3; i++)
rev_mapping[mapping[i]] = i;
@@ -444,12 +460,18 @@ diff3_run (argc, argv, out, callbacks_arg)
commonname = file[rev_mapping[FILEC]];
thread1 = process_diff (file[rev_mapping[FILE1]], commonname, &last_block,
&content1);
+ /* What is the intention behind determining horizon_lines from first
+ diff? I think it is better to use the same parameters for each
+ diff so that equal differences in each diff will appear the
+ same. */
+ /*
if (thread1)
for (i = 0; i < 2; i++)
{
horizon_lines = max (horizon_lines, D_NUMLINES (thread1, i));
horizon_lines = max (horizon_lines, D_NUMLINES (last_block, i));
}
+ */
thread0 = process_diff (file[rev_mapping[FILE0]], commonname, &last_block,
&content0);
diff3 = make_3way_diff (thread0, thread1);
@@ -1855,7 +1877,6 @@ initialize_main (argcp, argvp)
always_text = 0;
edscript = 0;
flagging = 0;
- horizon_lines = 10;
tab_align_flag = 0;
simple_only = 0;
overlap_only = 0;
diff --git a/contrib/cvs/diff/dir.c b/contrib/cvs/diff/dir.c
index fae74e8..da497dc 100644
--- a/contrib/cvs/diff/dir.c
+++ b/contrib/cvs/diff/dir.c
@@ -61,7 +61,7 @@ dir_sort (dir, dirdata)
if (dir->desc != -1)
{
/* Open the directory and check for errors. */
- register DIR *reading = opendir (dir->name);
+ register DIR *reading = CVS_OPENDIR (dir->name);
if (!reading)
return -1;
@@ -74,7 +74,7 @@ dir_sort (dir, dirdata)
/* Read the directory entries, and insert the subfiles
into the `data' table. */
- while ((errno = 0, (next = readdir (reading)) != 0))
+ while ((errno = 0, (next = CVS_READDIR (reading)) != 0))
{
char *d_name = next->d_name;
size_t d_size = NAMLEN (next) + 1;
@@ -96,14 +96,14 @@ dir_sort (dir, dirdata)
if (errno)
{
int e = errno;
- closedir (reading);
+ CVS_CLOSEDIR (reading);
errno = e;
return -1;
}
#if CLOSEDIR_VOID
- closedir (reading);
+ CVS_CLOSEDIR (reading);
#else
- if (closedir (reading) != 0)
+ if (CVS_CLOSEDIR (reading) != 0)
return -1;
#endif
}
diff --git a/contrib/cvs/diff/system.h b/contrib/cvs/diff/system.h
index 76bc163..f5037ec 100644
--- a/contrib/cvs/diff/system.h
+++ b/contrib/cvs/diff/system.h
@@ -269,3 +269,16 @@ extern int errno;
*(q)++ = '\''; \
}
#endif
+
+/* these come from CVS's lib/system.h, but I wasn't sure how to include that
+ * properly or even if I really should
+ */
+#ifndef CVS_OPENDIR
+#define CVS_OPENDIR opendir
+#endif
+#ifndef CVS_READDIR
+#define CVS_READDIR readdir
+#endif
+#ifndef CVS_CLOSEDIR
+#define CVS_CLOSEDIR closedir
+#endif
OpenPOWER on IntegriCloud