diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-09-28 22:45:44 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-09-28 22:45:44 +0000 |
commit | ba1dc3b9e4f3402b435edad6e14f34a79f4748fa (patch) | |
tree | 8e10de858a180b8b10c3a0774229ddc53ac99b00 /gnu/usr.bin/cvs/diff | |
parent | 79da6d2ec924cfdf612531607a5ae97264df2270 (diff) |
Latest from Cyclic Software
Diffstat (limited to 'gnu/usr.bin/cvs/diff')
-rw-r--r-- | gnu/usr.bin/cvs/diff/ChangeLog | 67 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/Makefile.am | 24 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/analyze.c | 39 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/diff.c | 2 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/diff3.c | 67 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/dir.c | 10 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/diff/system.h | 13 |
7 files changed, 172 insertions, 50 deletions
diff --git a/gnu/usr.bin/cvs/diff/ChangeLog b/gnu/usr.bin/cvs/diff/ChangeLog index e3272e84c2d..565bdb78178 100644 --- a/gnu/usr.bin/cvs/diff/ChangeLog +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/Makefile.am b/gnu/usr.bin/cvs/diff/Makefile.am new file mode 100644 index 00000000000..38ed80ed88b --- /dev/null +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/analyze.c b/gnu/usr.bin/cvs/diff/analyze.c index f2925946e38..3262444e6b1 100644 --- a/gnu/usr.bin/cvs/diff/analyze.c +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/diff.c b/gnu/usr.bin/cvs/diff/diff.c index aa91913fe61..ebd78aebfd1 100644 --- a/gnu/usr.bin/cvs/diff/diff.c +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/diff3.c b/gnu/usr.bin/cvs/diff/diff3.c index 2f05d165fc9..4a6fba618c2 100644 --- a/gnu/usr.bin/cvs/diff/diff3.c +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/dir.c b/gnu/usr.bin/cvs/diff/dir.c index fae74e82c65..da497dc4a6b 100644 --- a/gnu/usr.bin/cvs/diff/dir.c +++ b/gnu/usr.bin/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/gnu/usr.bin/cvs/diff/system.h b/gnu/usr.bin/cvs/diff/system.h index 76bc1631fee..f5037ecf70a 100644 --- a/gnu/usr.bin/cvs/diff/system.h +++ b/gnu/usr.bin/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 |