diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1998-02-22 08:23:05 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1998-02-22 08:23:05 +0000 |
commit | 8996000ce3abfb3bf3ba9371f93dbb36605526e6 (patch) | |
tree | 18978064e57450121f0e4877713ae12ee2980e3e /gnu/usr.bin | |
parent | 8b617ad77948342faf0917e268e4d001047fec35 (diff) |
Latest version from Cyclic
Diffstat (limited to 'gnu/usr.bin')
127 files changed, 34947 insertions, 4137 deletions
diff --git a/gnu/usr.bin/cvs/BUGS b/gnu/usr.bin/cvs/BUGS index 6f482b6a604..58be27c8c6a 100644 --- a/gnu/usr.bin/cvs/BUGS +++ b/gnu/usr.bin/cvs/BUGS @@ -1,12 +1,12 @@ -See the README file for information on how to report bugs (and what -will happen to your bug reports if you do). +See the Cederqvist manual (cvs.texinfo) for information on how to +report bugs (and what will happen to your bug reports if you do). The following is a list of some of the known bugs. It may or may not be comprehensive. We would dearly love for people to volunteer to help us keep it up to date (for starters, if you notice any -inaccuracies, please let bug-cvs know as described in README). There -are some other reported bugs in MINOR-BUGS; the difference, at least -in theory, is that those bugs are less serious. +inaccuracies, please let bug-cvs know as described in the Cederqvist +manual). There are some other reported bugs in MINOR-BUGS; the +difference, at least in theory, is that those bugs are less serious. * For platform-specific information (in some cases including known @@ -15,25 +15,45 @@ similar file for the unix-like operating systems (not yet, at least). This file also might contain some platform-specific bugs. -* Exporting binary files on non-unix clients with "cvs export" does -not work. The workaround is to use "cvs checkout" instead. If you -are thinking of fixing this, check out the comment "For cvs export, -assume it is a text file." in client.c. +* One cannot specify some files as binary in a "cvs import" using +CVSROOT/cvswrappers (for why, note that client_process_import_file has +no way of knowing about CVSROOT/cvswrappers which is off on the +server). -* Wrappers do not work client/server, and there are a variety of other +* I don't think that "cvs add" honors any of the -k wrappers, at least +not in client/server mode. I would think it should. Getting +CVSROOT/cvswrappers to work would presumably best be done by keeping a +copy of it in the CVS directory on the client, as has also been +discussed for CVS/Template, &c. Getting a client-side .cvswrappers to +work is a separate issue. + + +* Need more work on the procedure for fixing it if a binary file is +accidentally added in text mode (sanity.sh test cases, better +documentation, probably update and/or admin -kb should update +the -k setting in CVS/Entries). + + +* Wrappers (-t/-f) do not work client/server, and there are a variety of other bugs and annoyances with wrappers. -* Some people have reported seeing the message "dying gasps from %s -unexpected" (where %s is the name of your server) when using -client/server CVS. One person reported that this had to do with using -pserver and trying to run a program not in the PATH (which is set up -by inetd, I think) from one of the *info scripts. But noone has -carefully tracked this down (is it caused by something in the server -writing to stdout or stderr when it shouldn't? But then wouldn't the -"dying gasps" message be preceded by "warning: unrecognized response -`%s' from cvs server"?). +* If your login name contains a space or various other characters +(particularly an issue on Windows), CVS will have trouble (it will +write invalid RCS files, probably). The fix would be to have CVS +change such characters to underscores before writing them to the RCS +file. Furthermore, the LOGNAME or USER environment variables usually +won't override the system login name, so this can be hard to work +around. + + +* If you specify the -w global option to client/server CVS, it only +overrides a CVSREAD environment variable set on the client, not a +CVSREAD variable which was set on the server (for example, in .bashrc +when the server was run via rsh). The fix of course will be to +provide a "Option-read-write" request which sends -w, in addition to +"Global_option -r" which sends -r. * "make remotecheck" sometimes fails on test 187a3 with @@ -57,11 +77,6 @@ file's description. (and from the repository)? -* `cvs checkout -d nested/dir/path <module>' just doesn't work. The - simpler version -- `cvs checkout -d single-dir <module>' works, - however. - - * The following bug was reported against CVS 1.9: Create a module named test with a file named test in it. diff --git a/gnu/usr.bin/cvs/ChangeLog b/gnu/usr.bin/cvs/ChangeLog index af4807f67ce..6ff5bd11be3 100644 --- a/gnu/usr.bin/cvs/ChangeLog +++ b/gnu/usr.bin/cvs/ChangeLog @@ -1,3 +1,500 @@ +15 Jan 1998 W. L. Estes <wlestes@hamlet.uncg.edu> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.spec, Makefile.in: Fix some problems with the spec file + distributed with cvs. RPM chokes on a build root of slash, so + that is gone now. CVS is relocatable (as far as I know) so I + added a prefix tag. The source location was incorrect and in + fixing that I had to add a `g' flag to one of the sed commands in + the Makefile.in so the spec file gets generated correctly. + +13 Jan 1998 Jim Kingdon + + * cvsnt.mak: Add lib/fncase.c. Plus of course the usual + "because Visual C++ feels like it" changes. + +Tue Jan 13 16:49:38 1998 Ian Lance Taylor <ian@cygnus.com> + + * acconfig.h (USE_SETMODE_STDOUT): Add undef line. + (HAVE_SETMODE): Likewise. + * configure.in: If cygwin32, define USE_SETMODE_STDOUT and + HAVE_SETMODE. + * configure, config.h.in: Regenerate. + + * acconfig.h (UTIME_EXPECTS_WRITABLE): Add undef line. + * configure.in: If cygwin32, define UTIME_EXPECTS_WRITABLE. + * configure, config.h.in: Regenerate. + + * configure.in: Add test for cygwin32, and set LIBOBJS and LIBS + accordingly. + * configure: Regenerate. + +Sun Jan 11 11:43:55 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * HACKING: Add example of indentation for switch statement. I + always have to look this one up, and it seems worthwhile to + specify it here rather than be unsure which switch statement in + CVS to use as an example. + +Wed Jan 7 09:41:08 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Revise item 149 (concerning changing CVS/Root and such). + "This whole area is a rather bad pile of individual decisions which + accumulated over time, some of them probably bad decisions with + hindsight." + +Wed Dec 31 09:25:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. Features a change regarding + removing directories. + +Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.VMS, INSTALL, HACKING, BUGS, README: Change bug-cvs + address from prep.ai.mit.edu to gnu.org per email from Martin + Hamilton. When referring to bug-reporting procedure refer to + Cederqvist not README. + +Tue Dec 16 13:13:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. The content is the same, but + instead of being from Mosaic, it is from "lynx -dump -nolist". + This output is somewhat better (for example, it is formatted for + 80 columns or so, rather than Mosaic which is rather + inconsistent), and also lynx is free and still maintained whereas + NCSA Mosaic is proprietary and no longer maintained. + + * FAQ: Re-import from FAQ-O-Matic. Features an update to the + Sablime question. + + * NEWS: Add item about GSSAPI. + +Fri Dec 12 14:00:57 1997 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Add --with-gssapi option, and look for gssapi.h + and GSSAPI Kerberos v5 libraries. + * acconfig.h: Add HAVE_GSSAPI. + * configure, config.h.in: Regenerate. + +Thu Dec 11 15:58:06 1997 Eric Mumpower <nocturne@cygnus.com> + + * configure.in: Let --with-krb4 override the system Kerberos + header files and libraries, if any. + * configure: Regenerate. + +Thu Dec 4 20:01:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * configure.in (AC_CHECK_FUNCS): Remove mempcpy per change to + src/rcs.c. + * configure: Regenerated (never was regenerated after getwd change). + +1997-12-04 Jim Meyering <meyering@na-net.ornl.gov> + + * configure.in (AC_CHECK_FUNCS): Add mempcpy. + +Thu Dec 4 10:42:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Update for kfogel .cvswrappers fix. + +Tue Dec 2 22:14:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * MINOR-BUGS: Update per info-cvs mail from Steve Cameron. + +1997-11-29 Jim Kingdon + + * cvsnt.mak: Remove lib/getwd.c (see lib/ChangeLog for rationale). + + * cvsnt.mak: The usual "because Developer Studio feels like + it" changes. + +Sat Nov 29 22:10:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * configure.in (AC_REPLACE_FUNCS): Remove getwd (see lib/ChangeLog + for rationale). + +Mon Nov 24 10:36:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Update QNX information per email from Michael Hunter of + QNX. + +Wed Nov 19 17:44:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Add Sequent entry per bug-cvs report. + +1997-11-17 Karl Fogel <kfogel@floss.red-bean.com> + + * BUGS: Remove item about exporting binary files to non-unix + clients; this is fixed. + +Mon Nov 17 09:07:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Add yet another binary files problem. + +1997-11-14 Karl Fogel <kfogel@floss.red-bean.com> + + * cvsnt.mak: updated for diff/ subdir. + +Fri Nov 14 12:25:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Remove item about dying gasps message. At least one known + cause has been fixed. + +Wed Nov 12 20:24:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. Features a wording fix to + "What do I do first? How do I create a Repository?" and a + formatting fix (makes it clear which bullets are under what) + to "What is a module?" + + * NEWS: Add item about RCS library. Remove item about RCSBIN in + CVSROOT/config. + * INSTALL: Simplify instructions to reflect the fact that one need + not any longer install RCS and GNU diff. + * PROJECTS: Remove item about RCS library; it is done. + +Mon, 10 Nov 1997 Jim Kingdon + + * cvsnt.dsp: For diff/diff.c, also look for include files in + diff directory. This means we get diff/system.h not lib/system.h. + +Sun Nov 9 16:16:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO (#195): New item, about rsync and such issues. + +Thu Nov 6 14:29:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO (#194): New item, about separated metadata. + + * TODO (#186): Rewrite paragraph on CVSclusters to be clearer + about what this can do and why I think it is a cool idea. + +Sun Nov 2 19:34:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * DEVEL-CVS: Wording fix: want to specify that new developers are + granted checkin access and the ability to send to devel-cvs, not + specify whether this is implemented via an "account" (whatever + that is) (editorial change, not run by devel-cvs). + +Fri Oct 31 16:30:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * NEWS: Mention admin -o rev1::rev2. + +Wed Oct 29 08:40:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Add item 193, about alternatives to timestamps in CVS/Entries. + +Tue Oct 28 19:59:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO (190): "rcs failed" message is no longer affected by global + -q option. + +1997-10-28 Jim Kingdon + + * .cvsignore: Add Visual C++ files du jour, namely + {diff,vc50}.{pdb,idb,pch}. + + * cvsnt.dsp: Add files for diff library. The custom build + stuff for diff/version.c and diff/diff.c was to deal with + there also being a src/version.c and src/diff.c. There + might be an easier way. + +Mon Oct 27 11:21:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. Features an edit from Larry + Jones regarding CVS on Windows. + +Mon Oct 20 15:23:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Add item about spaces in login names. + +Mon Oct 20 10:25:42 1997 Hannes R. Boehm <hannes@boehm.org> + + * INSTALL (Tested platforms): Add Red Hat Linux 4.2. + +Wed Oct 15 10:55:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO (#192): Also mention issue with opening connections to new + servers if CVSROOT changes. + + * TODO (#191): Add thoughts on external difference programs. + +1997-10-11 Noel Cragg <noel@swish.red-bean.com> + + * BUGS: remove note about the `-d' flag bug that was just fixed. + + * TODO: new item 192. + +Thu Oct 9 12:59:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Revise item #182 to be clearer and to point to the + unofficial patch. + +Thu Sep 25 14:48:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * build.com: Also recurse into diff directory. + +Wed Sep 24 10:35:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * configure.in: Don't check for system-supplied regex matcher; see + comment for rationale. + * configure: Regenerated. + +Tue Sep 23 16:00:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Add item about cvs add and -k wrappers. + +Mon Sep 22 11:21:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Revise item #191 in response to xdelta 1.10 release and a + few other random thoughts. + +Sun Sep 21 17:56:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * configure.in: Instead of checking for memchr, just define + HAVE_MEMCHR and HAVE_STRCHR. + Add comment about AC_FUNC_VFORK and vfork in general. + * acconfig.h: Add HAVE_MEMCHR and HAVE_STRCHR. + * configure, config.h.in: Regenerated. + + * config.h.in: Regenerate using autoheader from autoconf 2.10. + +Sat Sep 20 01:17:10 1997 Tim Pierce <twp@twp.tezcat.com> + + [notes: (1) includes the patches to config.h.in which he sent + (presumably generated), (2) I have omitted a change, which was + sent without a ChangeLog entry, to change re_exec to + re_compile_pattern in configure.in, (3) Also adds diff/Makefile in + AC_OUTPUT -kingdon] + + * Makefile.in (USOURCE_SUBDIRS, check, remotecheck, installcheck): + Add diff. + + Note that AC_CHECK_FUNCS(vfork) + has been replaced by AC_FUNC_VFORK... libdiff wants the more + specific test, and it seems unlikely to break CVS. + + * configure.in: Add AC_FUNC_CLOSEDIR_VOID, AC_FUNC_VFORK, + AC_STRUCT_ST_BLKSIZE. + (AC_CHECK_HEADERS): Add limits.h and sys/file.h. + (AC_REPLACE_FUNCS): Add memchr. + (AC_CHECK_FUNCS): Remove vfork. + +Fri Sep 19 09:59:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Add item #191, concerning how to store binary files. + +Wed Sep 17 16:13:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TESTS: Add ideas about ability to pass spaces in arguments, and + stdin, to the program under test, as something to consider for the + different test frameworks. + +Tue Sep 16 00:14:55 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Add item about importing binary files. + + * TODO: Adjust item #150 to reflect the fact that the client is + not quite so mean about tossing the log message as it was. + +Fri Sep 12 13:04:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Update Windows entries per email from Greg Strockbine + <gstrock@dpc.com>. + +Thu Sep 11 15:03:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: New item #190, about meaning of -q and -Q global options. + +Wed Sep 10 18:48:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: A few more thoughts on "cvs message" (item 150). + +Tue Sep 9 22:20:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.VMS (Notes regarding compiling on VAX/VMS): Add item + about mode_t and pid_t. + +Sun Sep 7 17:34:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. The metavariables are back. + + * FAQ: Re-import from FAQ-O-Matic. Features comment from + julian@whistle about update -r branch:date. It also clobbered the + metavariables (confusion about "<" as data vs. HTML tag I would + guess), which I plan on fixing in a moment. + + * configure.in: Add comment about re_exec and regexp syntax. + + * configure.in (AC_REPLACE_FUNCS): Remove strdup; CVS was long + ago converted to use its own routine xstrdup. + * configure: Regenerated. + +Sat Sep 6 00:08:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Re-import from FAQ-O-Matic. In particular: GIC info + updated, binary files updated (e.g. -kb not -ko), rename database + and rCVS info updated (refer to TODO), tweaks to section on + contributing (HACKING, DEVEL-CVS, &c), Cyclic info updated + (e.g. remove Indiana address), usenet info updated + (e.g. comp.software.config-mgmt not gnu.*). + +Fri Sep 5 20:46:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * FAQ: Add another introductory paragraph which talks about out of + date material from 1995 FAQ. + + * FAQ: Re-import from FAQ-O-Matic. This was mainly as a proof of + concept that I could edit the Cygnus question and have the diffs + come out looking right (which worked), but I also discovered that + the previous checkin was truncated partway through. + + * FAQ: Replace file with an introductory paragraph plus a + downloaded copy of Molli's FAQ-O-Matic. I believe the content + closely matches the 1995 Grubbs FAQ but because everything is + re-ordered it would be painstaking work to verify this. + +Thu Sep 4 17:33:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Add item about -w global option and client/server. + +Wed Sep 3 23:03:34 1997 Noel Cragg <noel@harvey.cyclic.com> + + * TODO: Verbosify verbiage in item #189. + +Wed Sep 3 14:14:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Add item #189, concerning renames. + +Sat Aug 30 03:26:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Fix typo in Noel's change. + +Sat Aug 30 03:17:36 1997 Noel Cragg <noel@harvey.cyclic.com> + + * TODO: Add a header so emacs chooses the correct editing mode. + Made several entries more verbose (expanded some of the less + well-known acronyms and/or added pointers to further + documentation). + +Wed Aug 20 09:51:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Remove "SparcClassing" typo that has been there for + a while. + +Wed Aug 20 09:51:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + and Loren James Rittle <rittle@comm.mot.com> + + * INSTALL: Update information for SunOS4, Solaris, Digital Unix, + and HPUX. + +Fri Aug 15 16:42:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Remove the "CVS 1.6" crud; it really isn't needed. Add + paragraph about the meaning of the last three arguments to cvs + import. + +Thu Aug 14 14:42:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + and Loren James Rittle <rittle@comm.mot.com> + + * INSTALL: Update information for SunOS4 and Solaris. + +Mon Aug 4 00:02:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * BUGS: Be specific about wrappers not working client/server. + +Sat Aug 2 09:23:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: In step 4, be more generic (the CVS sources are just an + example, and people might not have them handy). + +Fri Jul 25 17:02:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Refer to cvs.texinfo as the Cederqvist manual; that + seems to be the description which best applies no matter how it + was obtained. Be a little more explicit about the "$" prompt + convention and setting environment variables. Use double quotes + because they work on both DOS and Unix. + +Thu Jul 24 12:22:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * NEWS: Also mention SystemAuth. + + * INSTALL (MIPS): Add more detailed report concerning Irix 6.2, + as reported by larry.jones@sdrc.com (Larry Jones). + +Tue Jul 22 17:35:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL (PowerPC): Add item for Lynx 2.5. + +21 Jul 1997 Jim Kingdon + + * Makefile.in (DISTFILES): Add cvsnt.dsp. + +Mon Jul 21 09:40:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * configure.in: Adjust comment regarding version of autoconf which + introduced --bindir. + +Fri Jul 18 09:47:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Remove item 161 (the comments in cvs.texinfo have a much + more complete discussion of date format issues). In item 30, + change "patch" to "rdiff" and expand discussion slightly. Remove + item 64 (the performance issues in initial checkout have probably + changed quite a bit since that was written and in any event it + isn't particularly useful without specifics of what is slow and + ideas for speeding it up). + + * INSTALL: Reorganize to separate out building/installing CVS + executables from what to do once you have them. Adjust Visual C++ + instructions to deal with Visual C++ 5.x. Add brief mentions of + platforms other than unix and Windows. + +Thu Jul 17 21:13:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: In item 39, talk about how PRCS 1.2 as a possible model. + +Sat Jul 12 15:43:01 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * HACKING: Rewrite paragraph on arbitrary limits to reflect the + fact that the known arbitrary limits are gone. + +8 Jul 1997 Jim Kingdon + + * cvsnt.dsp: Turn on browse information. + +Thu Jul 3 10:07:01 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * INSTALL: Sending exact suggested text is almost as good as a diff. + + * INSTALL (i386 family): Add lines about Watcom and EMX on OS/2. + + * TODO: Add notes about popt and option parsing in general. + +Wed Jul 2 13:11:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * TODO: Update item 149 to reflect CVS/Root. + + * TODO: Add item 187, about usage errors vs. help messages. + +Mon Jun 23 18:24:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * NEWS: Adjust mention of read-only access in the light of + changes to cvs.texinfo. + + * TODO: Add item 186, concerning multisite. + +Sun, 22 Jun 1997 Jim Kingdon + + * cvsnt.dsp: New file. This apparently is what Visual C++ 5.0 + uses in lieu of a .mak file (or so it seems). + * .cvsignore: Add cvsnt.opt cvsnt.dsw cvsnt.plg. These seem to + be the generated files du jour for Visual C++ 5.0. + +Thu Jun 19 17:16:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * NEWS: Add item about CVSROOT/config. + Wed Jun 18 00:00:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> * NEWS: Mention pserver --allow-root. diff --git a/gnu/usr.bin/cvs/DEVEL-CVS b/gnu/usr.bin/cvs/DEVEL-CVS index fe8a8632198..b91b9ba126c 100644 --- a/gnu/usr.bin/cvs/DEVEL-CVS +++ b/gnu/usr.bin/cvs/DEVEL-CVS @@ -50,7 +50,7 @@ interest), then one of the developers can ask the devel-cvs mailing list whether it is OK to make this person a developer (after first sending the prospective developer a copy of this file and then having the prospective developer say they want to be a developer). If there -are no objections, an account will be created. +are no objections, the person will be made a developer. ---------------------------------------------------------------------- Policy regarding checkout-only access: diff --git a/gnu/usr.bin/cvs/FAQ b/gnu/usr.bin/cvs/FAQ index c7fcdd78bec..20912ddb40e 100644 --- a/gnu/usr.bin/cvs/FAQ +++ b/gnu/usr.bin/cvs/FAQ @@ -1,11 +1,8585 @@ -This file formerly contained a CVS FAQ, maintained by David Grubbs. -However, it has been out of date for a long time, he officially gave up -maintaining it in the fall of 1995, and noone else has taken it over. -Most of the information which used to be in it can be found in the CVS -manual, doc/cvs.texinfo in this distribution. For information on -questions like "what is the latest version of CVS?" and "what about GUIs -for CVS?", see the CVS web site, -http://www.loria.fr/~molli/cvs-index.html. There are many web sites on -Configuration Management packages (of which CVS is an example); for -example see the "Configuration Management" category at http://www.yahoo.com/ -or see http://www.iac.honeywell.com/Pub/Tech/CM/index.html. +This file contains a CVS FAQ. Until 1995 it was maintained by David +Grubbs. It was out of date and not being maintained, but it had a +certain following and in 1997 Pascal Molli decided to start +maintaining it with the FAQ-O-Matic package which allows any +contributor with a web browser to help maintain it. The following +text is (mostly automatically) extracted from the FAQ-O-Matic. The +odds are good that the file that you are currently reading is out of +date with respect to the online FAQ-O-Matic, which is part of Pascal +Molli's CVS web site at http://www.loria.fr/~molli/cvs-index.html +(currently under "Documentation"). The online version is also +somewhat better in terms of things like tables of contents (at least +until someone can write some code to extract data from a FAQ-O-Matic +and insert things like tables of contents). + +The answers which are dated "6/13/1997" below are really from the 1995 +FAQ, for the most part. Many of them are out of date. If you have +some time, you are encouraged to double-check them against other +sources like the Cederqvist manual and update the FAQ. If you don't +have such time, take them with a grain of salt or a few. + + Category: /, all questions + + Category: / + + " [INLINE] " + + 1. About FAQ-O-Matic + +This is FAQ-O-Matic, a quick-and-dirty Perl hack (aren't they all?) by +Jon Howell. + +It seems like most FAQ maintainers make a valiant initial effort, then get +a life and don't have time to keep their FAQs up to date. Also, I often +find out a solution to a problem, and feel like I could write a single +FAQ answer on it in a few minutes, but where to post it? + +Thus the FAQ-O-Matic was born. FAQ-O-Matic is a couple sleazy Perl scripts +that allow people to submit FAQ answers to this database, so it can stay +current, with just a tiny bit of work on any one person's part. + +Yes, a bad guy could come along and wipe out all the FAQ entries. Please don't. +But to give the good guys some measure of comfort, each submission is stored +in an RCS file, so if someone does tamper, we can recover the database. + +Guidelines for submissions: + +1. Please _try to be fairly unbiased in matters of opinion._ Mailing lists are +the place to start flame wars (just kidding :v), but definitely not here. + +2. Please _use HTML only conservatively_ in your entries. Links are appropriate +, +but put the URL in the plaintext also so it's useable on printed versions of +the FAQ. Inline images pointing off this site are inappropriate, as is much +fancy formatting. This is meant to be bandwidth-light and dumb-browser-friendly +. + +3. If you feel there's a place for a _new category, or a reorganization of +existing questions_, don't hesitate to mail me (molli@loria.fr). +Category changes need to be done from my end. + +4. Please _leave an email address_ at the bottom of your submission so that oth +ers +can drop you a note. + +5. _If you only have a question_, not an answer, you should probably post +it to a mailing list, not here. If there are frequently asked questions to whic +h +the answer is not forthcoming on mailing lists (or perhaps there's no +useful answer yet other than "no one knows"), then it's appropriate to +post here, in hopes that someone will see it and know the answer. + +6. Please refrain from crude or inconsiderate language. Please don't use +this as a forum for advertising. However, mention of worthy commercial +products is certainly appropriate (even if you sell said product). Just +don't overdo it. :v) + + Last modified: _6/13/1997_ + + 2. Adding a new category ? + +just send me a mail at +molli@loria.fr + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/ + + " Advanced Topics " + + Category: /Advanced_Topics_/Branching_and_Mergin/ + + " + Branching and Merging" + + 1. What is a branch? + + Unfortunately, the word "branch" is an overloaded technical + term. It is used in too many different ways in three + categories. It might help to understand some of the issues by + going through the categories: + + How Humans use the word "branch": + + Most development starts with everyone working on the same + software, making changes and heading toward a single goal. This + is called something like "Main Line Development". Note that + though many people do main line development on CVS's "Main + Branch", that is a choice, not a requirement. + + After a release or when one or more developers want to go off + and work on some project for a while, the Software Engineers + assigned to deal with large software issues generate a "Branch + in Development" to support the release or project. (Keep in + mind that a programmer is no more a Software Engineer than a + carpenter is a Civil Engineer.) + + Essentially, the word "branch" implies a way to allow + simultaneous development on the same files by multiple people. + + The above terms are human-oriented. They refer to actions that + people would like to take. They do *not* imply any particular + implementation or set of procedures. Branches in development + can be supported in many different ways. + + How CVS uses the word "branch": + + CVS uses the word "branch" in a number of ways. The two most + important are: + + + - The vendor branch holds releases from (normally) an outside + software vendor. It is implemented using a specific RCS branch + (i.e. 1.1.1). + + + - The "Main Branch", which normally holds your "Main Line + Development", but is defined as the collection of revisions you + get when you "checkout" something fresh, or when you use the + '-A' option to "update". + + Important Note: The CVS "Main Branch" is *not* the same as the + RCS concept with the same name. If you are using Vendor + Branches, files you have never changed are on three branches at + the same time: + + + - The RCS 1.1.1 branch. + - The CVS Vendor branch. + - The CVS "Main Branch". + + The concepts overlap, but they are not equivalent. + + In referring to CVS, "branch" can be used in four other ways: + + + - A CVS working directory satisfies the definition of "branch" + for a single developer -- you are on a private "virtual branch" + that does not appear in any of the RCS files or the CVS control + files. + + + - The CVS "default branch" is the Repository source for the + collection of files in your working directory. It is *not* the + same as the RCS "default branch". Normally the CVS default + branch is the same as the CVS Main branch. If you use the "-r + <branch_tag>" option to the "checkout" command, you will record + a "sticky" tag that changes your default branch to the one you + checked out. + + + - A "magic" branch can be a branch that hasn't happened yet. It + is implemented by a special tag you can check out that is not + attached to a real RCS branch. When you commit a file to a + magic branch, the branch becomes real (i.e. a physical RCS + branch). + + + - And, of course, CVS uses "branch" to indicate a + human-oriented "branch in development". + + How RCS uses the word "branch": + + + - The RCS "Main Branch" (Synonym: "The Trunk") contains a + series of two-part revision numbers separated by a single '.' + (e.g. 1.2). It is treated specially and is the initial default + branch. (The default default?) + + + - The RCS "Default" branch starts out attached to the RCS "Main + Branch". For RCS purposes, it can be changed to point to any + branch. Within CVS, you *must*not* alter the RCS default + branch. It is used to support the CVS idea of a "Main Branch" + and it must either point to the RCS Main Branch, or the Vendor + Branch (1.1.1) if you haven't made any changes to the file + since you executed "import". + + Last modified: _6/13/1997_ + + 2. Why (or when) would I want to create a branch? + + Remember that you can think of your working directory as a "branch for + one". You can consider yourself to be on a branch all the time because + you can work without interfering with others until your project (big + or small) is done. + + The four major situations when you should create a branch: + + When you expect to take a long time or make a large set of changes + that the merging process will be difficult. Both "long" and "large" + are defined in your own environment. + + When you want to be able to "commit" and "tag" your work repeatedly + without affecting others. + + If you ever think you need Source Control for your own work, but don't + want your changes to affect others, create a private branch. (Put your + username in the branch tag, to make it obvious that it is private.) + + When you need to share code among a group of developers, but not the + whole development organization working on the files. + + Rather than trying to share a working directory, you can move onto a + branch and share your work with others by "committing" your work onto + the branch. Developers not working on the branch won't see your work + unless they switch to your branch or explicitly merge your branch into + theirs. + + When you need to make minor changes to a released system. + + Normally a "release" is labeled by a branch tag, allowing later work + on the released files. If the release is labeled by a non-branch tag, + it is easy to add a branch tag to a previously tagged module with the + "rtag" command. If the release is not tagged, you made a mistake. + Recovery requires identifying all revisions involved in the release + and adding a tag to them. + + Last modified: _6/13/1997_ + + 3. How do I create and checkout a branch? + + Suggested technique: + + Attach a non-branch tag to all the revisions you want to branch + from. (i.e. the branch point revisions) + + When you decide you really need a branch, attach a branch tag to the + same revisions marked by the non-branch tag. + + "Checkout" or "update" your working directory onto the branch. + + Suggested procedure when using modules: + + cvs rtag <branch_point_tag> module + + cvs rtag -b -r <branch_point_tag> <branch_tag> <module> + + cvs checkout -r <branch_tag> module + + Suggested procedure when using your working directory, which + contains the revisions of your working files you want to branch from: + + cvs tag <branch_point_tag> + + cvs rtag -b -r <branch_point_tag> <branch_tag> <module> + + cvs update -r <branch_tag> + + In each procedure above, Step #1 applies a non-branch tag to all the + branch point revisions in the module/directory. Though this is not + strictly necessary, if you don't add a non-branch tag to the revisions + you branch from, you won't be able to refer to the branch point in the + future. + + Between steps 1 & 2 you may commit changes. The result would be same + because "rtag -r <oldtag> <newtag>" applies <newtag> to the same + revision that <oldtag> is attached to. You can use this technique to + avoid attaching *any* branch tags until you need them. + + Step B.2 has two corollaries: + + If you plan to create the branch tag before committing anything in + your working directory, you can use "cvs tag -b <branch_tag>" instead + of the "rtag" command. + + The <module> can be a relative path to a directory from which your + working directory was checked out. + + If you have trouble figuring out what <module> to use (or pathname to + use in its place), you can aim it at whatever parent directories you + believe will cover all your work. + + If you are sure the <branch_tag> is not being used anywhere else, you + can even aim it at the whole Repository ($CVSROOT), if you have to. It + might take some extra time, but assuming that your <tag> is a unique + string and you don't use the '-f' option to "rtag -r", "rtag" will + only add a <tag> to files in which it actually *finds* the earlier + <tag>. + + In each procedure above, Step #3 may occur any time after step 2. + Unless you explicitly remove them with "tag -d", a <tag> is permanent. + + The <branch_tag> is an unusual creature. It labels a branch in a way + that allows you to "checkout" the branch, to "commit" files to the end + of the branch and to refer to the end of the branch. It does not label + the base of the branch (the branch point). + + There are two obvious ways to choose the <branch_point_tag> and + <branch_tag> names. But keep in mind that the <branch_tag> is typed by + any developer who wants to work on the branch -- you should make it + mean something to them. + + Style #1 presumes that the simple version string refers to a set of + designed, documented or promised features, not to a specific set of + files. In this case, you tag the branch with the generic Version + string and assume that whenever you refer to "Version", you want the + "latest" set of files associated with that Version, including all + patches. (You can substitute whatever you like for "bp_", as long as + your <branch_point_tag> is some modification of the <branch_tag>.) + + <branch_point_tag> Matching <branch_tag> + + bp_V1_3 V1_3 + bp_Release2-3-5 Release2-3-5 + bp_Production4_5 Release4_5 + + Style #2 presumes that the simple version string refers to the + specific set of files used to construct the first release of + "version". In this case, you tag the branch-point revisions with the + generic Version string and assume that whenever you refer to this + Version, you want the original set of released revisions. To get the + latest patched revisions of the release, you refer to the branch tag + "latest_<branch_point_tag>". (You can substitute what ever you like + for "latest_", as long as your <branch_tag> is some modification of + the <branch_point_tag>.) + + <branch_point_tag> Matching <branch_tag> + + V1_3 latest_V1_3 + Release2-3-5 latest_Release2-3-5 + Release4_5 latest_Production4_5 + + In both styles you can find out what you had to change since the + original release of this Version by typing: + + cvs diff -r <branch_point_tag> -r <branch_tag> + + For Style 1, this is: + + cvs diff -r bp_<branch_tag> -r <branch_tag> + + For Style 2, this is: + + cvs diff -r <branch_point_tag> -r latest_<branch_point_tag> + + Notes on "being on a branch": + + - "update -r <tag>" tells CVS to attach a "sticky tag" to working + directory (in ./CVS/Tag) and the checked-out files (on each line of + ./CVS/Entries). + + + - A "sticky" <tag> (including a <branch_tag>) causes most CVS commands + to act as if "-r <tag>" were on the command line. + + + - A "sticky" <branch_tag> indicates that the working directory (and + working files) are "on the branch". + + Last modified: _6/13/1997_ + + 4. Once created, how do I manage a branch? + + The most important thing you should know about managing a branch is + that the creation of a branch is not a lightweight act. When you + create a branch, you must also create a set of procedures to keep + track of it. + + Specifically, you must: + + + - Remember that the branch exists. (This is non-trivial if you create + a lot of them.) + + + - Plan when to merge it back into the main line of development. + + + - Schedule the order that multiple branch merges are to be done. + + + - If you ever intend to merge branches into each other, instead of + limiting merges of branch work back into the "main line", you must + keep careful track of which parts of which branches have merged into + which other branches. + + The simplest way to deal with branches is to limit their number, + "collapse" them back into the main line as quickly as is reasonable + and forget them. If a group wants to continue working, tell them to + create another branch off the fully merged main line. + + Remember that CVS is just a tool. Over time, it will probably handle + branching better, requiring less careful attendance. But no matter how + good it becomes, the whole idea of "branching" is a complicated + management problem. Don't take it lightly. + + Last modified: _6/13/1997_ + + 5. Are there any extra issues in managing multiple branches? + + If you plan to split from the "main line" and merge back after a time, + the only problem will be scheduling the order of branch merges. As + each branch is merged, the main line must be rebuilt and tested. + Merging multiple branches (i.e. "lines of development") before + building and testing creates more problems than you are ready for. + + If you plan to collapse some branches into others, then move the + combined branches back into the main line, you have to be careful with + the revisions and tags you hand to your "update -j" command, but it + shouldn't be much trouble. + + If you plan to allow every branch to incrementally take the work done + on other branches, you are creating an almost insurmountable + bookkeeping problem. Every developer will say "Hey, I can handle + taking just this little bit," but for the system as a whole it is + disaster. Try it once and see. If you are forced into this situation, + you will need to keep track of the beginning and end points of every + merge ever done. Good Luck. + + Last modified: _6/13/1997_ + + 6. How do I merge a whole branch back into the trunk? + + If you don't have a working directory, you can checkout and merge in + one command: + + cvs checkout -j <branch_tag> <module> + cd <module> + + If you already have a working directory: + + cd <working_directory> + cvs update <== Optional, to bring it up to date. + cvs update -j <branch_tag> + + CVS will print lines beginning with + + 'U' for files that you hadn't changed, but the branch did. + + 'M' for files that you changed and the branch didn't + *and* for files that you both changed that were merged + without overlaps. (This overload is unfortunate.) + + 'C' for files that you both changed in a way that conflicts + with each other. + + You need to go edit all the 'C' files and clean up the conflicts. Then + you must commit them. + + Last modified: _6/13/1997_ + + 7. How do I merge changes from the trunk into my branch or between + branches? + + The idea is similar to the above, but since CVS doesn't treat the main + branch like other branches, you'll have to be more careful. There are + 5 different ways to look at the problem. + + The way to merge *all* changes made on the trunk into a working + branch is to move to the branch you want via "checkout -r" or "update + -r": + + cvs update -r <branch_tag> {optional files} + + Then merge the changes from the trunk into your working branch using + the pseudo-tag named "HEAD": + + cvs up -j HEAD {optional files} + + You will get everything from the branch point of the branch named + <branch_tag> up to the HEAD of the main branch. This is still kind of + strange. If the file is on a branch, HEAD should be the latest thing + on the branch, not the HEAD of MAIN. But that's not the way CVS + (currently) works. + + If you run "cvs up -j HEAD" again after adding more revisions to the + trunk, you may get overlaps for the text you have already merged. It + depends on your version of your RCS "merge" command (actually the "co + -j" option, which depends on the version of "diff3" you configured RCS + to use). + + You can merge the difference between any two <tags> using two "-j" + options on "update" or "checkout". + + Identify the two tags on the branch you want to merge from. + + cvs update -j <tag1> -j <tag2> {optional files} + + This step assumes you were careful about tagging milestones. You can + use this technique for any two <tags> on the same branch, even the + trunk. It is also possible to use tags on different branches, but + you'll have to ponder the meaning of the difference between those two + tags. + + In place of one of the <tags>, you can use a <branch_tag> to refer to + the latest revision on that branch. See 4C.11 and 4C.3 for info on + branch points. + + Merges can also be performed by handing RCS revisions to the '-j' + options, but since revision numbers aren't the same in all files, + merging by number is normally limited to one file. Sets of files with + the exact same trees of branches and revision numbers would work too, + but that's a rare situation. + + To "take" revisions from other branches instead of merging them, see + 4C.19 for an idea. + + A way to gain the effect of merging the main to the branch is to + merge the branch into the main using the normal + + cvs update -A {optional files} + cvs update -j <branch_tag> {optional files} + cvs commit + cvs tag -F -b <same_branch_tag> {optional files} + + See part B of 4D.5 + + Other oddities. + + This also works, but is probably not officially supported: + + cvs update -j N {optional files} + + where N is a number. This will merge all the changes from the branch + point up to the highest revision on the main branch starting with N. + For example, if your highest trunk revision is 1.52, you can use this + to grab revisions from the trunk: + + cvs update -j 1 {optional files} + + Another example: Say you have a branch point at rev 1.2 for a branch + named "BR1" and trunk revisions 1.3, 1.4, 2.1, 2.2, 2.3, 3.1, 3.2. + Then: + + cvs update -j 1 {optional files} + + will merge the changes from 1.2 to 1.4 + + cvs update -j 2 {optional files} + + will merge the changes from 1.2 to 2.3 + + cvs update -j 3 {optional files} + + will merge the changes from 1.2 to 3.2, which in this example, is + equivalent to the use of "-j HEAD" in part A above. + + The intuitive (at least to me): + + cvs up -j MAIN (or TRUNK) {optional files} + + doesn't work. If the trunk (i.e. "main branch") had an implicit branch + named "MAIN", you could use: + + cvs up -j MAIN:10/26 -j MAIN:now {optional files} + + and refer to date-stamped revisions on the trunk using the + <branch_tag>:<date> support that works on other branches. + + You might also think you could place an explicit tag on branch 1 (or + higher) (e.g. MAINHACK:1) and use it in place of the implicit "MAIN", + but I haven't found the right combination. + + [[If you find working techniques, I'll add them here.]] + + Last modified: _6/13/1997_ + + 8. How do I merge onto the Main Branch a file that exists only on a branch + other than the Main Branch? (i.e. it is in the Attic) + + For how such a file can exist, see 3A.2 and 3A.3. + + For how to avoid creating such a file, see 3A.5. + + Though you might think that the "update -j" command could perform the + "merge" of a file from the side branch to the Main Branch, it isn't + (yet) smart enough. Unfortunately, there is no single CVS command to + do this -- it takes three steps: + + To move something onto the Main Branch from the Attic, you have to + physically move the file from the Attic to the main Repository + directory associated with your working directory. + + It is exactly like resurrecting a removed file. See 3L.4 + + I use something like this: (csh-like syntax) + + set repos = `cat ./CVS/Repository` mv $repos/Attic/filename,v + $repos/filename,v + + (If you use relative paths in your Repository files, that first line + becomes: set repos = $CVSROOT/`cat ./CVS/Repository`) + + Now that the file is physically in the right place within the + Repository, "update -A" will make it appear in your working directory + on the Main Branch. Do that now. + + You now have a choice. The act of physically moving the file has + fused together the <branch_tag> branch and the Main Branch for this + file. You can continue that way, making changes along the RCS Main + Branch which CVS will (for this type of file only) treat as both the + Main Branch and the <branch_tag> branch. + + The other choice, which I would suggest, is to re-tag the file with + <branch_tag>, restoring a normal-looking magic branch tag to the file: + + cvs tag -F -b <branch_tag> <file> + + After you have done the above, you can run "update -A" or "update -r + <branch_tag>" to resume whatever you were doing before you started + this procedure. + + Caveat: The final result is a file whose revision tree doesn't look + like it was ever on any branch but the Main Branch until the above + "tag -F -b" command was executed. CVS and RCS have no way of saving + the history of the actions you have just performed. + + Last modified: _6/13/1997_ + + 9. How do I know what branch I'm (working) on? + + Type: + cvs status + + and look at the "Sticky Tag" field for each file. If: + + The *same* tag is on *every* file in your working tree, *and* + + That tag matches the contents of the ./CVS/Tag file, *and* + + That tag is a branch tag, + + then you know what branch you are working on. You can get sticky Tag + information directly from the ./CVS/Entries file instead of "cvs + status". + + If all the sticky Tags don't agree, then your directory is temporarily + inconsistent. This is a feature allowing you to make changes (or + perform merges) to individual files on multiple branches without + checking out the whole directory. + + The sticky Tag on each file in the ./CVS/Entries file (as displayed by + the "status" command) indicates what branch the working file is on. + New files are added to the Tag stored in ./CVS/Tag. + + To force your entire working directory onto the same branch, type: + + cvs update -r <branch_tag> + + Last modified: _6/13/1997_ + + 10. Do I really have to know the name of the branch I'm working on? + + If a developer can't be relied on to know what branch of development + to work on, then either the developer's manager isn't planning + branches properly or the developer has serious problems. + + I have found that one of the hardest concepts to get across to + developers (and some managers) is that "a branch in development" (as + opposed to the use of RCS branches to support some other scheme) is a + heavyweight act. Every time you create a real branch in development, + you must spawn a set of managerial procedures and a schedule by which + you plan to merge each branch into each other branch. Unless you plan + to keep it simple and collapse (by merging and forgetting) branches + quickly, they are not to be created lightly. + + In other words, if you don't regularly attend group meetings in which + the branch to be worked on is a major topic of discussion, then the + group is not managing branches properly. + + We created a couple major branches a few months ago and even the + customer service people refer to the "XYZ branch" as a shorthand for + "continuing development on the XYZ project". + + Last modified: _6/13/1997_ + + 11. How do I refer to the revision where I branched so I can see what + changed since the Branch Point on another branch? + + Given the current <branch_tag> format, there is no direct way to refer + to the branch point, which is more useful in many ways than referring + to the branch, which always refers to the latest revision on the + branch. + + When CVS adds a branch tag, it attaches an RCS symbol to a + non-existent revision number containing the revision number of the + branch point as a prefix. (See Section 3O, on the "tag" command.) RCS + can't use the CVS magic branch tag and many of the CVS commands can't + refer to it. + + To be certain of your ability to refer to a branch point, you must + create a "branch point" tag at the same time as the Branch tag. See + 4C.3. + + Last modified: _6/13/1997_ + + 12. Why didn't the command "cvs admin -bBRANCH1 *" create a branch? + + Because your command creates an RCS branch, not a CVS branch. See the + above discussion on branches. RCS branches are used to support CVS + branches, but they are not the same. You can't act as if you have + direct control over the RCS files. + + The "admin" command was placed there as a convenience to allow you to + execute raw "rcs" commands on the Repository, taking advantage of + CVS's ability to find the files in the Repository. + + But you have to remember that you are using RCS commands on a CVS + Repository, which is not generally safe unless you know exactly what + CVS depends on. + + For one thing, CVS insists on control of the default branch. It is set + either to the Main branch or the Vendor branch depending on whether + you have changed the Vendor's code. If you change the default branch, + you are monkeying with the internals and you will get unexpected + results. + + To set your "default CVS branch" to BRANCH1, you must use "checkout" + or "update" with the "-r BRANCH1" option. Then you have changed CVS's + idea of your "default branch", which has little to do with RCS's + default branch. + + Last modified: _6/13/1997_ + + 13. Is it possible to set the "default CVS branch" for everyone? + + No. It doesn't work that way. + + When using CVS, all administrative information (such as what branch + you checked out) is stored in CVS sub-directories, local to the user. + There is no global state, other than the description and logging files + in the $CVSROOT/CVSROOT directory. + + You tell "checkout" or "update" what branch you want to check out via + the "-r <tag>" option. The default is CVS's "Main Branch". + + I don't see a problem in *designing* a new way to indicate what branch + you get by default, instead of the main one, but that's not how it + currently works. + + Last modified: _6/13/1997_ + + 14. How do I perform a large merge? + + Large merges require a bit more planning to be able to track what has + happened in the inevitable cases where something goes wrong. No tool + can force a "merge" to make perfect sense. + + Though you can handle the details in many different ways, the two ends + of the spectrum of merge techniques are: gonzo and paranoid. + + The gonzo method assumes that you know everything about your sources + so that recovery from failures is "just a matter of typing." You + created the branch this way: + + cvs checkout <module> + cd <module> + cvs tag -b <branch_tag> + cvs update -r <branch_tag> + >>> Edit away. + cvs commit <<== Onto branch + + Now you want to merge your branch back into the Main branch, you are + certain you can make it work, or at least detect all the failures, so + you dive in and hack away: (For simplicity, we will assume you are + collapsing (i.e. merging and forgetting) a side-branch into the Main + branch from your single working directory.) + + cvs update -A + cvs update -j <branch_tag> + >>> Edit the 'C' files and remove the overlaps. + >>> Edit some more to make it all compile and work. + cvs commit + + Looks simple. For more details on the output from the "update -j" + command, see 3P.2 and 4C.6. + + Note: You could also checkout a whole new working directory and + perform the merge at the same time by replacing the two + update commands with these two commands: + + cvs checkout -j <branch_tag> <module> + cd <module> + + The paranoid way is more difficult, but it can catch all sorts of + problems. You created the branch this way: + + cvs checkout <module> + cd <module> + cvs tag <branch_point_tag> + cvs tag -b <branch_tag> + cvs update -r <branch_tag> + >>> Edit away. + cvs commit <<== Onto branch + + The extra tag command places a non-branch tag on the Branch Point, an + act that makes it easier to do "diffs" later. Now we decide to perform + the merge: + + cvs tag <latest_on_branch_tag> + cvs update -A + *1* cvs diff -r <branch_point_tag> -r <latest_on_branch_tag> + >>> *1* shows all the changes on the branch. + *2* cvs diff -r <branch_point_tag> -r HEAD + >>> *2* shows the changes on the trunk since branching. + cvs tag <premerge_tag> + cvs update -j <branch_tag> + >>> Edit the 'C' files and remove the overlaps. + *3* cvs diff + >>> Verify that *3* matches *1*, except for line numbers. + cvs commit + cvs tag <just_merge_changes_tag> + >>> Edit some more to make it all compile and work. + cvs commit + cvs tag <after_merge_cleanup_tag> + + The reason *3* and *1* match so closely is that they are the + differences between two pairs of starting points and ending points + after the same data was inserted. If they are significantly different, + you will want to figure out why. + + NOTE: You will have to tell everyone to stay the hell out of the + Repository while you do this. If they commit something while you are + in the middle of a merge, your job will be much more difficult. If + they "update" at the wrong time, their work will be randomized until + you finish. It's better to call a halt. + + See 3H.13 for some more information about dealing with merges after + import. The last part of the procedure is applicable to any large + merge. + + Last modified: _6/13/1997_ + + 15. Is a Vendor merge any different from a branch merge? + + No. In most ways, a Vendor branch is exactly the same as any other + branch. In a Vendor merge, the data is append to the branch by the + "import" command, rather than by hand-editing, but the merge process + is the same. + + See the "import" command in section 3H. + + Last modified: _6/13/1997_ + + 16. How do I go back to a previous version of the code on a branch? + + + + + You can avoid digging into RCS revision numbers (executing "update + -r (rev)" on each file) by trying one of these: + +Use non-branch tags as you normally would. Non-branch tags + attach to specific revisions, so a "tag (tag)" command would + mark the revisions you have in your working directory, which + are on your branch. If you need to retrieve them, use "update + -r (non-branch-tag)" + + Doing this overrides the sticky (branch-tag) attached to your + working directory with a non-branch tag, which means you won't + be able to commit until you again move forward to the end of + the branch with "update -r (branch-tag)". + +Use the "update -r (branch-tag):(date)" trick. + + This is almost like using the '-D' option, but it looks for + revisions extant on (date) only along the given branch. + + As in #1, you can't commit to this kind of working area, + because it has a sticky date referring to revisions in the + middle of a branch. + +[comment from the audience: You are dreaming.. +this does not work.. try it, you get +No such tag: "MYTAG:May 1" +or similar. I wish it did because I need it. julian@whistle.com] + + +You can branch a branch. + + If you add a branch tag to file in a working directory that was + checked out on a branch, you will branch the branch. This + works just fine, though you'll have to play some games to merge + everything back together again. You'll also create 6-part + revision numbers. (They'll be 8-part revision numbers if you + branch a branch that started out with some unmodified files on + the Vendor branch. Think about it. How does revision + 1.2.4.2.4.2.2.1 grab you?) + + +(fixed formatting, kingdon@cyclic.com) + + Last modified: _9/8/1997_ + + 17. Once I've found the files I want, how do I start changing them? I keep + getting warnings about sticky tags. + + What you probably did was type "cvs update -r <tag>" where <tag> is a + non-branch tag. "update" created a sticky tag for a specific revision, + not a branch. To start working right there, you have to create a + branch to work on. + + You have two choices. + + You can do it in place and keep working: + + cvs tag -b <branch_tag> <<== To tag the current files. + cvs update -r <branch_tab> <<== To move onto the branch. + + You can do it "externally" and create a new working directory: + + cvs rtag -b -r <tag> <branch_tag> <module> + cvs checkout -r <branch_tag> <module> + + <module> can be a relative path within the Repository. + + <tag> in the above is the non-branch tag you placed earlier + that caused the error in your question. Be warned that + if <tag> is not set on all the files (or all the right + revisions) you won't get exactly what you wanted. + + Last modified: _6/13/1997_ + + 18. Why do I get the latest files on the branch when I tried to "update -r + <tag>"? + + If "update -r <tag>" always retrieves the latest files on a branch, + then <tag> is really a <branch_tag>. A branch tag is supposed to be + used to grab a branch to work on. Since you can't modify a file in the + middle of a branch, checking out a <branch_tag> will give you the + latest revision on the branch. + + If you want to "checkout" a specific collection of revisions, you must + use a "non-branch" tag. See the first part of 4C.16. + + Last modified: _6/13/1997_ + + 19. How can I avoid a merge? I just want to move the latest revision on my + working branch directly onto the trunk. + + There is no direct way to do this using CVS, though the technique is + not difficult using shell commands. Here's one way: + + Move your working directory to the Main Branch. + + cvs update -A + + Use "update -p" to grab the latest revision on the branch and write + it over your working files. Make sure you don't have an modified files + -- you will lose them. The following is in "csh" syntax. Change the + wildcard to grab the files you want + + foreach i (Makefile *.cc *.hh) + cvs update -p -r <branch_tag> $i > $i + end + + Commit all the working files onto the Main Branch. + + cvs commit -m 'Moved branch <branch_tag> onto MAIN' + + You should experiment with the above before blasting everything. + + Last modified: _6/13/1997_ + + 20. How to I avoid merge collisions in the RCS $\Log$ data? + + In short, you can't. The RCS $\Log$ keyword is handled differently + from all other RCS keywords. + + On the info-cvs mailing list, there is a periodic discussion that goes + something like this: + + Question: How do I deal with $\Log$? Answer1: You can't do much with + it. Here's how it works. . . Answer2: I've found a limited way to use + it. . . Answer3: Get rid of it. $\Log$ is an abomination. + + I tend to lean toward answer #3. There are only two sets of people who + would ever have access to logs stored within sources files, developers + and source customers. + + For developers: + + Log entries within sources files are notoriously incomplete, rushed, + poorly phrased and in many cases incorrect, making them useless for + debugging or file maintenance. I remember a maxim from "Software + Tools" (I believe): "Read the code, not the comments." No managerial + order or plan for programmer discipline will affect this in the real + world. + + Log entries are usually in an unreadable mixture of styles. Many log + entries are just plain meaningless. Some are foolish. Some are even + insulting. Examples: + + "Corrected spelling of misspelling." "Bug fix." "Reversed stupid + change in previous revisions." "If Joe could do his job, this would + already have worked." + + Log entries are not managed well by the tools. Any merge can cause + conflicts in the $\Log$ data. Branch merges produce incomplete logs. + They can be edited into chaos and they are not regenerated. They waste + space duplicating information available to the developer with a single + command. + + Even if correct when originally entered, as changes are made to the + file, log entries become false over time. Humans are not good at + reading down through a list and remembering only the last change + affecting something. Over time *most* of the log is wrong. + + Even if still correct, the log data is almost useless to developers + without the code diffs. If you can get code diffs, you can display the + log. + + For source customers the problem is even worse. The last thing you + want to show customers is a hodge-podge of tiny comments about large + changes followed by a series of emergency fixes before delivery. If + you distribute sources, then you should provide documentation, or + changelogs reviewed by people who won't let comments like "Fixed for + stupid customer." out the door. + + Conclusion: Though some people would prefer to see in this FAQ + techniques for making the $\Log$ entries the best they can be, I + believe them to be a lost cause. My suggestion is to hunt down, root + out and destroy all occurrences of $\Log$ and the unusable data + attached to it wherever you may find it. + + Last modified: _6/13/1997_ + + 21. Why should I trust automatic merges? + + Some developers have the feeling that three-way merging doesn't work. + They fear and distrust the way the "update" command automatically + merges committed changes from the Repository into the working file. + + Experience has shown that most merges are utterly painless and most of + the rest are easily resolved. The few conflicts that cause headaches + are nearly all due to poor communication between developers, a problem + no source control system can obviate. + + Some developers were troubled in the past by flaky Unix software. I + can't say that everything is perfect, but the tools CVS depends on + (RCS and diff, mainly) are fairly solid nowadays. They work. + + Since it does seem to work for most of us, the algorithm is unlikely + to change soon. Why not test it on a couple trouble spots and if it + works for you, use it for a while? Then you can make an informed + decision. + + Last modified: _6/13/1997_ + + 22. How does CVS decide if it can safely perform a merge? + + CVS can merge any text file, possibly discovering a conflict and + leaving overlaps for you to edit. Editing the conflict markers out of + the file is a moment's work, but resolving the conflict could take an + arbitrary amount of time. CVS works to determine if it *should* merge, + not if it *can*. + + See 2B.6 for how the merge proceeds. + + Last modified: _6/13/1997_ + + 23. After resolving merge conflicts in a file, what if I want to keep my + previous version, and not take any of the branch changes? + + If you want to retain your previous version, a version on the MAIN + branch greater than 1.1 (one you committed there), just throw the + merged file away and "cvs update" the file. + + You don't need to commit something to remember it. The tags you place + before and after the merge should give all the handles you need to + find various versions. You don't have to create a new version of the + file. + + If you want to retain the previous Vendor revision, you can grab a + copy of it using "cvs update -p" and commit it or use the technique + described in 3B.3 to revert back to the Vendor branch. + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Engineering/ + + " + Engineering" + + 1. Where can I find out about Software Engineering? + + A couple different people suggested this book: + + Software Configuration Management: Coordination for Team Productivity; + Wayne A. Babich; Addison Wesley; 1986; ISBN 0-201-10161-0 + + A number of others suggested Appendix B of the book "Decline and Fall + of the American Programmer" by Ed Yourdon, called "The Programmer's + Bookshelf". It list 87 books you are expected to have read. Since they + publish many of the books, Prentice-Hall distributes this list as + "Prentice Hall Professional Technical reference PTR-125-AA3. + + One interesting item from the Yourdon book: The total number of + professional computer books sold is less than the number of + programmers currently in the United States. It wasn't clear from the + book whether this meant "per year" or not, but it is still + frightening. + + Last modified: _6/13/1997_ + + 2. How do I flexibly arrange the modules file to describe my sources? + + An equivalent question might be, "How do I structure my sources?" This + can be a difficult question especially in the areas that are more + political than technical. + + Generally you want to think about which pieces of your system need to + be checked out together, built as one system or tagged as a consistent + whole. You should certainly create module names that correspond to + complete, buildable collections that you would tag and release as one + "product". It is also convenient to create module names for small + sections of the Repository containing files that will all be worked on + at the same time by the same person or group. + + Once you have defined the structure of your work, you can usually see + how to lay it out in a Repository. After that the modules file is + easy. You set up module names and aliases to match what you need to + check out by name. If you like relative directories, it is possible, + but not recommended, to work completely without a modules file. See + 1D.11 and 2C.7 for some info about the modules file. + + Here are a few types of modules. You should experiment to see what + kind of structure each of these produces. They all have different + uses. + + Connected projects in one group with two separate helper + directories. The helper directories can contain build tools, header + files, libraries, or whatever you like. + + These are all aliases that checkout relative pathnames. The equivalent + results could be produced by placing the selected relative pathnames + on the "cvs checkout" command line. + + pr1 -a P1 HELPERS + pr2 -a P2 HELPERS + pr3 -a P3 HELPERS + pr12 -a P1 P2 HELPERS + pr13 -a P1 P3 HELPERS + pr23 -a P2 P3 HELPERS + + P1 -a group1/proj1 + P2 -a group1/proj2 + P3 -a group1/proj3 + HELPERS -a group1/helper1 group1/helper2 MAKEFILE + MAKEFILE -a group1/Makefile + + Actual Repository directory structure: (from $CVSROOT down) + + group1/ Makefile The top level Makefile. helper1/ helper2/ Helper + files and dirs proj1/ Files and dirs proj2/ Files and dirs proj3/ + Files and dirs + + "checkout group1" produces a duplicate of the above. "checkout projX" + produces all but "projY" and "projZ". "checkout projXY" produces all + but "projZ". + + Here is the exact same set of module names describing the same + Repository layout using module names (and aliases containing module + names) instead of merely aliases for relative pathnames. + + There is one difference in the result. The name of the top level + directory in the checked out working tree will match the "module" name + (e.g. pr1) instead of always being "group1" as it was in the first + example above. + + pr1 group1 proj1 &HELPERS + pr2 group1 proj2 &HELPERS + pr3 group1 proj3 &HELPERS + pr12 group1 proj1 proj2 &HELPERS + pr13 group1 proj1 proj3 &HELPERS + pr23 group1 proj2 proj3 &HELPERS + + HELPERS -a helper1 helper2 group1-Makefile + helper1 group1/helper1 + helper2 group1/helper2 + group1-Makefile -d . group1 Makefile + + The above line (with the -d in it) says that when the module named + "group1-Makefile" is checked out, the file named Makefile file will be + found in a directory named $CVSROOT/group1 and will be checked out + into a directory named '.', which obviously already exists. + + The & references say to interpret those pathnames relative to the + directory where the whole module is stored. For the "pr1" module, that + directory is "group1", so the &HELPERS reference winds up placing + Makefile in '.' relative to "group1". + + A short one containing the basic "module" actions: + + m1 head/path file1 dir2 file3 dir4 file5 + + When checked out, a directory named "m1" appears in your current + directory. Elements named file1, dir2, file3, dir4, and file5 appear + in it. They were originally taken as relative paths from + $CVSROOT/head/path. + + Here's another way to construct a working directory out of pieces of + the Repository: + + projX projX Makefile &projX_inc &projX_src &projX_doc + + # The first line selects a single file within projX, plus + # the contents of three other modules. Those three other + # modules rename their directories. + + projX_inc -d include projX/inc projX_src -d source projX/src projX_doc + -d documentation projX/doc + + A Unix tree. This is similar to what CVS was developed for and the + way I have used it for years. + + # Top level + unix unix + u_bin unix/bin + u_etc unix/etc + u_man unix/man + usr-bin unix/usr.bin + + # Subdirs of top level dirs. (tiny subset) + ls unix/bin/ls + fsck unix/etc/fsck + man8 unix/man/man8 + + # Programs without subdirs. (tiny subset) + cat unix/bin Makefile cat.c + uniq unix/usr.bin Makefile uniq.c + + # /usr/local/src + localsrc localsrc + gnu localsrc/gnu + public localsrc/public + X11 localsrc/X11 + + # GNU and PD tools + cvs localsrc/gnu/cvs + emacs localsrc/gnu/emacs + rcs localsrc/gnu/rcs + btoa localsrc/public/btoa + tcsh localsrc/public/tcsh + + # X11 related items. + tvtwm localsrc/X11/contrib/tvtwm + + "unix" was checked out and built from the top down, using a set of + Makefiles that knew about the whole structure. "localsrc" was kept + checked out in /usr/local/src. + + At any time I could run "checkout ls" or "checkout cat" and get a + simple directory with only that tool in it, plus a subset Makefile + that knew how to build that tool against the installed (or alternate, + via environment variables) headers and libraries. + + I found it very handy to be able to run "ls" and see the three tools I + was porting that week. + + Last modified: _6/13/1997_ + + 3. Can I have multiple source repositories, one for each project? + + Yes, you can have as many Repositories as you like. But each + Repository must be managed separately, creating additional work. + + Question 4A.1 provides a short description of setting up a single + Repository. A few additional considerations: + + It is a good idea to start by creating a single Repository and split + it up (or create additional Repositories) only if you believe it is + really necessary. I would only create a new Repository if the data is + completely disconnected from the rest of the main Repository. + + If there is a lot of overlap among the developers working on the + collections of files you want to place in different Repositories, or + if there is any connection between those collections, I would go out + of my way to create a single Repository. It is much easier to manage. + + Disk space should not be a factor since you can build up a + Repository using symbolic links and/or remote mounts. + + Each Repository is completely distinct. You can't check out modules + from different Repositories at the same time. A better way of looking + at it is that if you *can* check out two modules or directories with a + single "checkout" command (without contortions or explicit absolute + pathnames), then they are in the same Repository. + + To "checkout" modules from multiple Repositories, you must use the + "cvs -d" option on all CVS commands or alter your $CVSROOT variable + when you change focus to another Repository. If you work with multiple + Repositories, it is a good idea to configure CVS to use absolute + pathnames in the ./CVS/Repository file, since most commands (other + than "checkout") will use that file rather than $CVSROOT. + + If you configure CVS to use relative pathnames in your + ./CVS/Repository files, you must always be careful to set your + $CVSROOT properly or you will get unexpected results. + + If you have two modules or directories by the same name at the same + relative path inside two different Repositories, you are asking for + disaster. You could unexpectedly update a directory with completely + unrelated files. This is not a fanciful example -- a Repository is + occasionally duplicated for release purposes in which case *all* the + paths in the two Repositories are the same. + + Last modified: _6/13/1997_ + + 4. Who should administer the Repository and manage the modules file? + + This is a "management style" question. In large or traditional groups, + the CVS procedures are warped to conform to local conventions. In + small groups, in groups with strong personalities or on new projects + the choice of source control procedures can help create some of the + working environment. Here is a taxonomy of environments I have worked + in or helped set up: + + Situation 1. + + A small number of competent developers working on a medium size + project. We all got along and we all respected each other (at least + technically). Anyone edited anything. + + Modules and Repository admin was mostly left to me. I never found a + problem in minor changes made by anyone else. + + Situation 2. + + A large number of experienced developers sprinkled with wackos. Many + of the developers didn't want to deal with any kind of source control. + They wanted a full-service source control system that caused them zero + thought. + + I learned "big stick" diplomacy here. There was a small number of + "designated" (by me) people who were allowed to do *anything* other + than "update" and "commit". Even "checkouts" were controlled. This is + where I found "history" and "release" the most useful. + + Situation 3. + + A small number of developers who wanted me to "help", but who didn't + want to deal with anything other than their favorite algorithms. + + I didn't have the time to baby-sit this group, so I designated one of + them to be my official contact and made him do it all. He felt sullied + by the requirement to pay attention to anything other than his pet + coding projects, but enjoyed the "status" of being the only one who + could touch the control files without my kicking the chair out from + under him. + + Situation 4. + + A huge number of developers of covering the whole spectrum of + competence and experience split into 20 groups, none of which + cooperated with the others, working on 57 different projects, most of + which didn't inter-operate. + + Managing it in any coherent way was not my responsibility (and beyond + my tolerance for chaos). Too many people. So I privately designated a + person in each group to be the contact and kept watch on the + Repository activity. When something went wrong, I notified the contact + for the group and told him what was happening and *he* kept his troops + in line. They were tougher with their own group that I would have + been. + + Eventually only a few people were willing to touch the control files, + since they were flamed from all directions if they screwed up. + + Situation 5. + + In a medium group of really *serious*, and seriously overworked, + people, someone else was designated the "master". I convinced the + master I knew what I was doing and went on my way. + + No one else in the world was allowed to touch anything. + + Situation 6. + + In a large amorphous group of beginners, experts and clowns, over whom + no one had official control, I was forced to employ a group of + relative beginners (who became experts rather quickly) to police the + world. The ultimate in locking the barn after the horse was stolen, we + kept Chaos from destroying us only by use of superior firepower. + + My choice, if allowed, is to let anyone touch anything. I keep backups + of important items and let people know individually whether I want + them to touch things or not. If someone on my "no touch" list touches + and succeeds, they are allowed more slack. If they screw up after + being warned, their screwup becomes public. After a few months, I + usually have no trouble keeping the world running smoothly, at least + from my (and CVS's) perspective. + + Last modified: _6/13/1997_ + + 5. Isn't disk space a big factor? CVS copies files out of the Repository, + duplicating everything. + + Everyone knows that disk space is getting cheaper. How do we reconcile + this with the equally well-known problem that *all* disk is *always* + filled up? + + In my opinion, the main reason disk space will never be an unlimited + resource is that it is the major variable in organizational time/space + tradeoffs. It isn't a problem of waste or an aspect of Murphy's law, + as some claim it is, but rather a direct consequence of good + management. Disk space is, and will always be, a limited resource. + + First, the cost of *deploying* that disk is not dropping as fast as + the cost of the storage medium. The cost of machines to hold the disks + and the networks to connect them are dropping more slowly than disk + media. And the cost of the human time necessary to manage the + machines, networks, disks, and the developers using them, is not + dropping at all. The cost of human time continues to rise. + + If management decides that expensive human time can be saved by using + all that new disk space to keep the last three releases online, then + that's what it will be used for. If each release takes up a Gigabyte + and you support 30 platforms, a simple time-saving suggestion has just + grabbed 100 Gigabytes of disk space. And we've ignored the potential + disk storage needed to support "better Customer Service", another + management refrain. + + Even at 30 cents per Megabyte (next year's price), you've just used up + $30,000 of disk space. And that doesn't count the computers, tape + drives and humans necessary to maintain and deploy all of it. Spending + money to save time has its own overhead, too. + + Binaries are getting bigger. Graphics and data collection devices can + eat up any amount of disk. There are more tools available, more + libraries, more raw data than you can ever store. My home computer has + a Gigabyte of disk on it. It could easily handle 30. + + The "economy" of disk storage media will never remove the need to + manage disk space. + + So, here's an un-reviewed suggestion originally from Graydon Dodson + <grdodson@lexmark.com>, which I've altered and edited heavily. + + + - Keep a directory where the whole tree is checked out. (It might be + built and tested once in a while to make sure it is worth linking to, + but that doesn't affect the source control aspect of this procedure). + Let's call it /master/build. + + + - Write a tool that creates a tree of directories (like the X11 + "lndir" command) filled with links to the checked out files in the + /master/build tree. + + This tool should also provide real copies of, not symlinks to, all the + files within the CVS administrative directories. + + + - You could also provide a way for the tool to take a list of whole + directories that you will never change, for which it would create a + single symlink to the directory and not a subtree of symlinks to + files. Or you could rm -r pieces of the resulting working directory + yourself and replace it with links. + + + - If you want to edit a file, you have to grab a real copy and keep it + until your revision shows up in the /master/build tree. I'd create a + script to do this: cvsgrab <file> + + #!/bin/csh -f + set f = $1 + if (! -l $f) then + echo "file $f is not a symlink" + exit 1 + endif + rm $f + set rev = `grep "^/$f/" CVS/Entries | awk -F/ '{print $3}'` + cvs update -p -r $rev $f > $f + + You can't do a plain "cvs update" since that would grab newer + revisions from the Repository, not the revision you wanted to start + with. After the file is no longer a symlink, you can work normally. + You'll have to run "update" before "commit" anyway if there are newer + revisions. + + + - Presumably there would also be a tool to traverse the link tree and + revert it to links if there are no modified files and/or if all the + real files match the revision of the /master/build tree. + + + - To avoid confusing CVS when the /master/build revisions are updated + but your CVS/Entries files is not, CVS would have to change to handle + symlinks. It currently causes problems with this scenario: + + ./<file> is a symlink. + + ./CVS/Entries says you are revision 1.2. + + The corresponding CVS/Entries file in /master/build says the latest + revision is 1.3. + + cvs update <file> shows a 'C' conflict flag. + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Installing_CVS/ + + " + Installing CVS" + + 1. What do I have to do before I install CVS? + + You must decide where to set up a Repository. + + Though you can construct a Repository tree structure using links and + mount points, there must be a single copy of each real file across + your entire organization. You may not "rdist" files and expect to edit + both copies. + + CVS does not support a truly distributed Repository. You can have + multiple Repositories, but each one must be mounted (not copied or + "rdist"ed) from a single place onto all machines where it will be + used. + + Initially, a Repository takes about same amount of disk space as the + sources you want to put into it, plus a bit of overhead for the RCS + files. + + See Section 4B. For multiple Repositories, see 4G.3 + + You need a directory in everyone's $PATH variable where you can + install all the executables. /usr/local/bin is a common place. + + You need some helper tools besides CVS such as "RCS" and a good set + of "diff" and "diff3" programs. See 1B.4 for suggestions. + + Read the README, INSTALL and ChangeLog files to see what you are + getting into. + + Make sure you have versions of all the programs mentioned in the + "cvs/src/options.h" and "cvs/src/rcs.h" files. + + Though you can probably muddle along without it, you should appoint + one or more "Repository Administrators" who will be responsible for + maintaining the Repository structure, administrative files and the + "modules" interface. + + Someone at your site should probably be on the info-cvs mailing list. + See 1B.5. + + Last modified: _6/13/1997_ + + 2. How do I configure the CVS programs? + + You should certainly start by reading the README file, the INSTALL + files and possibly the ChangeLogs in each directory, the Makefile.in + files and the "cvsinit.sh" program. + + Edit the "options.h" file in the "src" directory. + + You might need to specify a few site-specific pieces of information + including the names of a number of functions. + + Hint1: You probably want to set the DIFF macro to use your version of + the GNU diff program with the '-a' option. Ours is set to "gdiff -a". + + Hint2: You want to use RCS 5.6.0.1 or greater and set the "HAVE_RCS5" + macro. + + Execute the ./configure command. + + Type "make". + + After running "make" you might try running the "sanity.sh" script: + ./src/sanity.sh `pwd`/src/cvs + + It writes into /tmp/cvs-sanity by default. + + Finish reading the INSTALL file and test out the system. + + Last modified: _6/13/1997_ + + 3. What do I have to install? + + Install the "cvs" executable and "mkmodules" from the CVS sources. + The man page is useful too. If you plan to report bugs, you should + also install "cvsbug". + + Make sure you have versions of all the programs mentioned in the + options.h file, most of which are included in a standard Unix system. + + Unless you plan to reimplement RCS [:-)], you must install RCS. + + It is a very good idea to examine the RCS installation instructions + and make sure you are using the GNU versions of "diff" and "diff3" or + merges (an important part of CVS) will not work as well as you'd like. + + Set your $CVSROOT environment variable and create the Repository + (which you planned out in 4A.1) with the "cvsinit" command at the top + of the CVS sources. + + You'll need to edit the Repository control files created by + "cvsinit". + + Install any helper programs mentioned in the modules file. + + Last modified: _6/13/1997_ + + 4. How do I work around the merge problems in GNU diff version 2.1 or + later? + + See 1B.4 If you use recent versions of RCS and "diff", you won't run + into the above. If you do, see 5B.8 + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Internal_errors/ + + " + Internal errors" + + 1. Explain: "ci error: unexpected EOF in diff output" + + RCS versions earlier than 5.5 print the above error when a file does + not end in a newline character. It can be caused by: + + + - Editing with Emacs and not using "require-final-newline". + - Committing a binary file. + - Filesystem failures (NFS!) that put nulls in your file. + + The solution is to upgrade to RCS 5.5 or later. (Of course, this won't + fix filesystem failures. It will merely allow RCS (and therefore CVS) + to handle the file without error.) + + Last modified: _6/13/1997_ + + 2. Explain: "RCS file /Repository/module/file.c,v is in use" + + This is an RCS error that occurs when its internal lock file has been + left around by an RCS command interrupted by some sort of system + crash, disk failure or SIGKILL signal. + + Go into the Repository and look for files with names similar to + "file.c,v", usually starting with ',', '_' or '#'. Make sure they are + really crash remnants and do not belong to transactions in progress -- + a recent last-modified timestamp is a good indicator of a live + transaction. Delete them if they are old. + + Last modified: _6/13/1997_ + + 3. Explain: "co error, line 2: Missing access list" + + This is an error message from RCS Version 3 when it tries to read a + file created by a later version of RCS. + + HP decided to "standardize" on an ancient version of RCS some time + ago. You can't use it for CVS. See 4H.6. + + Since the error comes from having a later version of RCS than HP + supports, you probably did install the later version but must have + recently changed your $PATH or installed the HP package that has RCS + in it. + + You should either reconfigure CVS to use absolute pathnames to the + proper versions of the RCS programs that CVS uses, or change your PATH + to look there first. If you haven't installed the latest version of + RCS, you should upgrade. See 1B.4 + + Last modified: _6/13/1997_ + + 4. Explain: "error: RCS file name `xyz .c' contains white space" + + RCS 5.6 doesn't allow white space in filenames. Apparently this + restriction will be removed in RCS 5.7, but CVS may still require that + filenames have no white space in them. + + Last modified: _6/13/1997_ + + 5. Explain: cvs checkout: warning: <X> is not (any longer) pertinent + + This message occurs in three instances: + + When there is an entry in the ./CVS/Entries for file <X> and there + is no RCS file in the Repository to back it up. + + If the working file exists, and hasn't changed (determined from the + timestamp) it is removed. + + When you try to check out a piece of the Repository with: + + cvs checkout some/place/in/repository/tree + + and at least the first element of the path (i.e. "some" in the above) + exists, but some part of the rest of it does not. + + The checkout command checks the modules file first for the whole path, + then for a prefix of the path as a module name. If it doesn't find + *any* portion of your path in the modules file, it says: + + cvs checkout: cannot find module `<module/path>' - ignored + + If it finds some set of prefix directories, it prints the message you + see. + + In practice this is usually a spelling error. + + If the Repository files you are trying to check out or update are + not readable by you, the same problems can occur. Check the + permissions on the files involved. + + Last modified: _6/13/1997_ + + 6. Why did a Repository file change from <file>,v to ,<file>,? + + This is an RCS problem, since the ,<file>, syntax for file names is + used by RCS and not CVS. + + RCS constructs a new <file>,v in a temporary file named ,<file>, + (which doubles as a lock file) then renames it to <file>,v when it is + done. The only way this is reliable is if your system's version of + rename(2) is an atomic, as required by POSIX. + + If your system has a non-atomic (and therefore non-POSIX) rename(2) + system call, RCS runs uses an internal version of this algorithm to + approximate the atomic rename: + + rm <file>,v; ln ,<file>, <file>,v; rm ,<file>, + + If the system crashes, or you lose your NFS connection between the + first "rm", but before the "ln", you can be left only with the + ,<file>, file. If the crash or network failure occurs between the "ln" + and the final "rm", you could be left with a pair of linked names. + + Recovery: + - If only the ,<file>, exists, rename it to <file>,v. + + + - If both ,<file>, and <file>,v exist and are linked, remove the + ,<file>, file. + + + - If both ,<file>, and <file>,v exist and are separate files, look at + the dates, "diff" them and make your best guess. This sounds like the + remnants of two separate events. + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Other_Systems/ + + " + Other Systems" + + 1. I use a NeXT. Is there anything I need to know? + + NeXTSTEP 3.0's Interface Builder uses "nib" directories, rather than + the files used in previous revisions. It removes files it doesn't + recognize, making it impossible to place such a directory under CVS -- + the CVS admin directory will be removed. + + Some time ago, <Bob_Vadnais@pdh.com> posted a palette named CVSPalette + that claimed to resolve this problem. It was intended to preserve the + CVS administrative directories within nib documents (directories) that + Interface Builder usually removes. + + CVSPalette is no longer in its announced place: + + ftp.cs.orst.edu:/pub/next/submissions + + though I did find two other interesting files on ftp.cs.orst.edu: + + /software/NeXT/sources/tools/cvs-next-2_1_1.tar.Z + + which is a port of CVS 1.3 (along with RCS and diff) and: + + /software/NeXT/sources/programming/cvs.postamble-2.4.gz + + which appears to be a set of wrappers for CVS commands that claim to + allow you to use CVS effectively (and without need for the "command + line") on a NeXT machine. + + [[Anyone know the truth about CVS and NeXT?]] + + Last modified: _6/13/1997_ + + 2. I use OS/2 and/or DOS and/or Windows. Is there anything I need to know? + + When using a local repository, be sure to specify the local access + method or CVS will interpret the drive letter as a remote host name + due to the : following it: + + WRONG: CVSROOT=C:\SRC\CVSROOT + + RIGHT: CVSROOT=:local:C:\SRC\CVSROOT + + (larry.jones@sdrc.com) + + You can share RCS files between Unix and DOS while avoiding the MS-DOS + file name limits by setting your RCSINIT environment variable to + '-x/,v'. New RCS files will be created without the standard ",v" + suffix, though files ending in ",v" will still be found if there is no + matching file in the same directory without the ",v". + + Erik van Linstee offers an OS/2 and a DOS port of CVS 1.3 in: + + ftp.informatik.tu-muenchen.de:/pub/comp/os/os2/gnu/devtools or + ftp.rrzn.uni-hannover.de:/pub/os2-local + + The files are named: + + cvs13p?[bs].zip + + Where the ? stands for the patch level (currently 8) and the b is for + the binaries, the s for the sources. + + There are three binaries. An OS/2 only one (32-bit), a DOS only one + (16-bit) and an EMX one that runs on both (32-bit). + + There are many differences between the Unix and the DOS versions of + CVS. Read the material that comes with the DOS version before using + it. + + [[Updates?]]. + + Last modified: _9/22/1997_ + + 3. I use SCO Unix. Is there anything I need to know? + + On SCO/UNIX 3.2 V2.0 POSIX signals don't work. Unfortunately the + configure program detects POSIXness and configures in the use of POSIX + signals. Workaround : Edit out the check for POSIXness in the + configure script. [[You could also remove all occurrences of + "-DPOSIX=1" from the Makefiles after configure is run. -dgg-]] + + SCO/UNIX doesn't understand #!/<some shell> syntax. This breaks the + use of log.pl as it gets invoked by /bin/sh instead of + !#/usr/local/bin/perl. WorkAround : edit log.pl and change it into a + shell script which invokes perl with log.perl (renamed from log.pl) as + input. + Contributed by Joe Drumgoole + + Last modified: _6/13/1997_ + + 4. I use AIX. Is there anything I need to know? + + The only report on AIX claims to have no trouble using it in concert + with SunOS and IRIX platforms. + + Last modified: _6/13/1997_ + + 5. I use IRIX. Is there anything I need to know? + + If you see "uid" numbers where you would expect user names, try adding + -lsun to the link line. Without it CVS is unable to retrieve "passwd" + data through NIS. + + Last modified: _6/13/1997_ + + 6. I use an HP system. Is there anything I need to know? + + HP distributes RCS version 3 (a circa 1983 release!) with HP-UX. CVS + does not work with RCS version 3; it requires RCS version 4 or later. + Your best bet is to find the latest version of RCS and install it + somewhere. + + HP-UX 8.07 has a serious bug with the mmap system call and NFS files; + the bug can crash the operating system. Make sure that you configure + RCS to avoid mmap by setting has_mmap to 0 in RCS's conf.h. This bug + is fixed in HP-UX 9. + + Contributed by Paul Eggert + + If using the setgid() trick described in 4D.13, you will have to + create an entry in the /etc/privgroup file to give the group assigned + to the cvs executable setgid permission (see setprivgrp(1m)). + Additionally, if you are restricting "read" access to the Repository + by limiting access to the executable (this requires yet another + group), then you will require that /etc/logingroup exists and is + configured correctly (usually it's just alink to /etc/group). + + Contributed by Dale Woolridge + + Last modified: _6/13/1997_ + + 7. I use AFS. Is there anything I need to know? + + There is a problem with the way CVS performs its locking when the + files are within AFS. When your current PTS id != your uid, the locks + are not deleted. The stat() system call returns the PTS id of the + owner. If that id != your uid, CVS assumes you did not lock it, and + leaves the lock files alone. The next time you try to use it, it + complains that someone has the repository locked. + + Contributed by Michael Ganzberger + + [[This was against CVS 1.3. Is it still in CVS 1.4?]] + + Last modified: _6/13/1997_ + + 8. I use A/UX. Is there anything I need to know? + + [[??]] + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Related_Software/ + + " + Related Software" + + 1. How do I use CVS under Emacs? Is there an Emacs cvs-mode? + + The pcl-cvs package distributed with CVS is an emacs package that + helps with the update/commit process. When you are ready to update, + you use the 'cvs-update' command within emacs. This executes "update" + and fills a cvs-mode buffer with a line for each file that changed. + The most helpful features are: descriptive words for what happened + (i.e. Merged or Conflict rather than 'U' or 'C'), single keys bound to + diffs and commits, and the ability to mark arbitrary groups of files, + possibly from different directories, for commit as a whole. + + All the developers in my group that use emacs find pcl-cvs a much + friendlier and more helpful way to update/commit than raw cvs. One vi + user even converted to emacs just to use pcl-cvs. + + Contributed by Jeffrey M Loomis + + Last modified: _6/13/1997_ + + 2. What is GIC (Graphical Interface to CVS)? + + + + + GIC provides a graphical user interface to the Concurrent Version + System (CVS), a powerful revision control system. GIC is + implemented in the Tcl/Tk programming language and is intended to + augment the sometimes cumbersome CVS command line interface. + + Note that according to the official GIC page at + http://www.cpsc.ucalgary.ca/redirect/grouplab/projects/gic/ + GIC is no longer being maintained and tkCVS is recommended + instead. For more on tkCVS, see http://www.cyclic.com/tkcvs/ + + kingdon@cyclic.com + + Last modified: _9/6/1997_ + + 3. What is CAVEMAN? + + CAVEMAN is a front end to CVS written in PERL providing a collection + of features desired by the site where it was developed. + + + - The ability to spread a "project" over multiple Repositories. + - Optional automatic tagging after each commit. + - Additional locking of files. + - Extra before and after program hooks. + - A layer of event logging. + - All sorts of error messages. + - Many changes to the semantics of commands. + + It is available via anonymous ftp on ftp.llnl.gov [128.115.54.18] in + gnu/caveman_vX.Y.Z.tar.gz (The numbers X, Y, & Z vary.) + + contact Kathleen Dyer kdyer@llnl.gov + (510)423-6803 + (510)423-5112 FAX + + [[Does someone want to elaborate?]] + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Setting_up_and_Manag/ + + " + Setting up and Managing the Repository" + + 1. What do I do first? How do I create a Repository? + + First, install all the programs. (See Section 4A.) + + Then create a Repository by executing "cvsinit", which works only from + within the head of the CVS source directory. (It needs files from the + distribution to work.) + + If you want a very primitive Repository and don't want to save a + history log, refer to modules, or use any of the "info" files for + logging, pre-commit checks, or editing templates, you can dispense + with "cvsinit" entirely. I would advise executing it. + + The cvsinit program will create a short modules file containing the + module named "CVSROOT". Change to your work directory and type: + + cvs checkout CVSROOT + + Then read the files that are checked out. + + You will certainly want to add modules of your own. Edit the "modules" + file and add lines to describe the items you want to "checkout" by + module name. Here's a short list that could be used for storing a + small number of GNU and PD sources: + + local local + + gnu local/gnu + emacs local/gnu/emacs + cvs local/gnu/cvs + + public local/public + pdprog1 local/public/pdprog1 + pdprog2 local/public/pdprog2 + + test test + junk test/junk + + When you are done editing, "commit" the modules file. If you + configured CVS to use "dbm", you might have to edit and commit the + modules file twice to change the pathname of the mkmodules program in + the modules file. + + Try using the "import" command to insert the "junk" module and play + around until you are comfortable. + + Last modified: _11/7/1997_ + + 2. What are those files in $CVSROOT/CVSROOT? + + There are eight Repository control (or "database") files of interest + in the CVSROOT directory: + + modules contains the "modules" database. See 1D.11, 2C.7, 4B.6 and + 4B.7 for more details. + + commitinfo contains two columns: 1. a regular expression to match + against pathnames within the Repository and + + a <command> to execute for matching pathnames. + + When you execute "commit", CVS passes the Repository pathname for each + directory (and the files to commit within that directory) to + <command>. If <command> exits with a non-zero status, the commit is + blocked. + + A <command> associated with a pathname of "DEFAULT" is executed if + nothing else matches. Every <command> associated with a pathname of + "ALL" is executed separately. + + rcsinfo contains the same first column as commitinfo, but the second + column is a template file for specifying the log entry you are + required to enter for each commit. + + "DEFAULT" and "ALL" work the same as in the commitinfo file. + + editinfo contains the same two columns as commitinfo, but the + <command> in the second column is intended to do some consistency + checking on the commit log. + + "DEFAULT" works as in commitinfo. + + loginfo contains the same two columns as commitinfo, but the + <command> is expected to read a log message from its standard input. + The <command> can do anything it wants with the log information, but + normally it is appended to a log file or sent to mailing lists. + + "DEFAULT" & "ALL" work the same as in commitinfo. + + cvsignore contains "ignore" patterns that are added to the built-in + ignore list. See 2D.10. + + checkoutlist contains a list of other files kept under RCS in + $CVSROOT/CVSROOT that should be checked out by mkmodules to provide a + readable copy. + + history contains a stream of text records, one for each event that + the "history" command is interested in. Though the contents of the + history file can be read, it is intended to be read and displayed by + the "history" command. This file is the only one in the above list + that is not under RCS. + + Last modified: _6/13/1997_ + + 3. Is there any other state stored in the Repository besides in the + $CVSROOT/CVSROOT directory? + + Only in the RCS files. The Repository holds exactly two things: the + tree of RCS files (each usually ending in ",v") and the CVSROOT + directory described above. + + Last modified: _6/13/1997_ + + 4. How do I put sources into the Repository? + + There are three main ways to put files in the Repository: + + Use the "import" command described in Section 3H. + + This method is the fastest way to put trees of new code into the + Repository and the *only* way to handle source releases from a 3rd + party software vendor. + + Use "add" followed by "commit". + + This is how to add new files and directories to the Repository, a few + at a time. Directories don't need to be committed. + + You can move RCS files directly into the Repository. + + You should create a directory hierarchy to hold them, but you can just + move arbitrary ",v" files into the Repository. The only "state" in the + Repository other than within ",v" files is in the required CVSROOT + directory at the top of the Repository. + + Last modified: _6/13/1997_ + + 5. What file permissions should I use on (and in) the Repository? + + If you run a completely open environment (which usually means that you + don't have, or don't want to waste, the time to deal with it): + + + - Set all directory permissions to 777. + + + - Have everyone set their umasks to 0. + + (BTW, I don't suggest this. I am merely reporting it.) + + If you are a normal Unix shop and want to use groups effectively: + + + - Set all the directory permissions in the Repository to 775. + + If you are using a system that handles both System V and BSD + filesystems, you might have to set the permissions to 2775.) + + If you are using one of the many recent versions of Unix that don't + allow you to use the full octal mode, then you'll have to type: chmod + u=rwx,g=rwx,o=rx,g+s <dir> + + + - Change all the groups on the directories to match the groups you + want to write to various directories. + + + - Make sure every user is in the appropriate groups. + + + - Have everyone set their umask to 002, including root. + + If you don't want non-group members to even read the files, do the + above, but change: + + + - Repository directory permissions to 770. (or 2770) + + + - umasks to 007. + + If you work in an environment where people can't be trusted to set + their "umask" to something reasonable, you might want to set the umask + for them: + + mv /usr/local/bin/cvs /usr/local/bin/cvs.real + cat > /usr/local/bin/cvs + #!/bin/sh + umask 2 # Or whatever your site standard is. + exec /usr/local/bin/cvs.real ${1+"$@"} + ^D + + Last modified: _6/13/1997_ + + 6. How do I structure my Repository? + + The Repository holds your software. It can be all interrelated or it + can be a bunch of separately managed directories. + + How you break a whole system down into its component parts, while + defining interfaces between them, is one aspect of "Software + Engineering", a discipline that requires the study of dozens of + strange and wonderful areas of the computer and management worlds. + + CVS provides a way to keep track of changes to individual files, a way + to "tag" collections of files, and a way to "name" collections of + files and directories. That's all. Everything else is in the way you + apply it. + + In other words, you should structure your Repository to match your + needs, usually tied in with the other tools you use to build, install + and distribute your work. Common needs include the ability to: + + + - mount (or automount) directories from many places in your + organization. + - check out just what you need and no more. + - check out multiple sections in a fixed relation to each other. + - check out large sections to match the assumptions built into your + build system. (Makefiles?) + + In my opinion, you should start small and keep everything in one tree, + placing each major sub-system into a separate directory. Later, when + you know what you are doing, you can make it more sophisticated. + + Last modified: _6/13/1997_ + + 7. Why would anyone use "modules"? They are too restrictive. I want to be + able to select just the files I want to edit. + + Any form of structure is restrictive. If you believe that total chaos + is a viable working paradigm, or if you believe you can keep track of + the interrelations between all portions of your Repository in your + head, then you can do what you please. + + If you believe that systems of files require management and structure, + then the "modules" idea is very useful. It is a way to impose a naming + scheme on a tree of files, a naming scheme that can be simpler than a + large list of relative pathnames. + + The "modules" file represents a published interface to the Repository + set up by your Repository Administrator. If s/he did a creditable job, + the modules offered will be internally consistent and will smoothly + interact with the rest of your environment. + + Last modified: _6/13/1997_ + + 8. How do I rename a file or directory? What are the consequences? + + In CVS there is no single "rename" command. + + See 2C.4 for the suggested way to rename a file or directory. + + The rest of this section covers some of the consequences of renaming. + + A "renaming database" has been proposed that would keep track of name + changes so that "update -r <tag>" would continue to work across the + renaming. But as it stands, you have to pick one of the following + options: + + Use the technique described in 2C.4. (For each file, duplicate the + file in the Repository, "remove" the old version so it winds up in the + Attic and strip all Tags off the new version.) + + - "update -r <tag>" produces the correct files. + + + - The duplicated revision history can be slightly misleading. + + + - A plain (i.e. without the "-r <tag>") "checkout" or "update -d" will + create directories "renamed" this way, but you can delete it and a + plain "update" won't bring it back. + + Move the files and directories in the Repository to the new names. + + + - You save the revision history under a different file name. + + + - You save a little space. + + - "update -r <tag>" produces the wrong files or directories. + + This is not a good general solution, but if you plan never to look + back (someone may be gaining on you!), it is sometimes a useful + notion. + + If you are clever with Makefiles, you might be able to rework them to + handle either the new or old names, depending on which ones exist at + the time. Then you can move an old <tag> onto the new, more + sophisticated, revision of the Makefile. (Yes, this changes the + "released" file if <tag> indicates a release. But it is an option.) + + + - Important Note: If you rename a directory, you must rename the + corresponding directory in every checked-out working directory. At the + same time, you must edit the pathname stored in the ./CVS/Repository + file within each of the moved directories. + + The easiest way to move a lot of directories around is to tell + everyone to remove their working directories and check them out again + from scratch. + + + - The file exists in the working directory and in the ./CVS/Entries + file, but not in the Repository. For the old file, "update" prints: + + cvs update: xyz.c is no longer in the repository + + and deletes the file. If the file was modified, "update" prints: + + cvs update: conflict: xyz.c is modified but no longer in the + repository C xyz.c + + and leaves the file alone. In the new directory, you see: + + U xyz.c + + as you would if someone else executed "add" and "commit". + + For each file, copy the working file to a new name in the working + directory and use the "cvs remove" to get rid of the old old file and + "cvs add" to add the new one. Since there is no way for CVS to remove + a directory, this only works for files. + + + - This is what most people think of first. Without a "rename" command, + the remove/add technique seems obvious. + + + - You lose the connection of your new working file to its past + revision history. + + Last modified: _6/13/1997_ + + 9. What are "Attic" directories? + + When you use the "remove" command on a file, CVS doesn't delete the + file, it only registers your desire to delete it. + + When you "commit" a removed file, CVS moves the Repository's matching + RCS file into a sub-directory named "Attic" within the Repository. + + Attic files are examined when the '-r' or '-D' option is used on + "checkout" or "update". If the specified revision, tag or date matches + one on a file in the Attic, that file is checked out with the others. + + You can think of the Attic as a sort of dead branch, which is only + looked at when you refer to a <tag> or <date>. + + Last modified: _6/13/1997_ + + 10. Is it OK to remove anything from the Repository? + + In general, removing anything from the Repository is a bad idea. The + information in a deleted object is lost forever. There are many ways + to skip over files, directories and revisions without deleting them. + + Here are some of the consequences of removing the following things + stored in the Repository: + + CVSROOT files (Repository control files) + + The Repository will work without any of them, but you should + understand what you are losing by deleting them. See 4B.2. + + Revisions + + The only way to remove revisions is to use the "admin -o" command (or + the equivalent RCS command "rcs -o"). + + They are lost forever. Any tags formerly attached to deleted revisions + are now pointing into the Phantom Zone. You'll need to contact Jor-el + to get them back. + + Files + + You should not remove a file unless you truly never want to see it + again. If you want to be able to check out an old revision of this + file, use "cvs remove" instead. + + Tags + + Tags take up little space and you can't recover from deleting them. If + you depend on tags for releases you will lose vital information. + + Directories + + There is no Attic for directories, so the only way to remove them is + to use "rm -r". They are gone forever. + + If you delete (or move) a directory, all checked-out versions of that + directory will cause CVS to halt. You'll have to visit each + checked-out directory and remove the matching working directory by + hand. + + Attic files + + The "remove" command sends files to the Attic. To really delete them, + you have to go into the Attic and use "rm". + + If a file in the Attic has a Tag on it that you might ever want to + check out again, you probably don't want to delete it. + + Lock files (named: "#cvs.[wr]fl.<pid>") + + These are lock files. If you are getting "lock" errors and the dates + on the lock files indicate that they are old, you can delete them. + + Deleting lock files still in use by a CVS process might produce + unusual errors. + + Last modified: _6/13/1997_ + + 11. Can I convert to CVS from RCS without losing my revision history? + + Yes, you can simply move (or copy) your RCS files into a directory + within the Repository, check out that directory and start working. + + Last modified: _6/13/1997_ + + 12. Can I move RCS files with branches in them into the Repository? + + Yes, but they may not work if you created branches in a way that + conflicts with CVS's assumptions: + + You can't use .0. branches. (They are reserved for "Magic" branch + tags.) + + If you use branch 1.1.1, you can't use the Vendor branch. + + You can use other RCS branches under CVS. There is no need to create + "magic" branch tags because the physical branch already exists. + + Last modified: _6/13/1997_ + + 13. Can I use raw RCS commands on the Repository? + + You can use raw rcs commands directly on the Repository if you take a + little care. The Repository itself contains no "CVS state" (as opposed + to RCS revision histories) outside the CVSROOT directory. + + But using raw RCS commands to change branches, tags or other things + that CVS depends on may render the files unusable. + + See 4D.7 on RCS/CVS sharing of the Repository and Section 3B on the + "admin" command. + + Last modified: _6/13/1997_ + + 14. How do I convert from SCCS to RCS? + + You'll have to execute something like "sccs2rcs" (in the CVS contrib + directory) on every file. Then you can move the resulting RCS files + into the Repository as described above. + + Last modified: _6/13/1997_ + + 15. How do I limit access to the Repository? + + There are all sorts of ways to restrict access to Repository files, + none of which are hooked directly into CVS. + + Techniques for limiting access include: + + Training, management and good backups. + + The best form of Repository control is a combination of: + + + - A reliable backup scheme (verify it!) + - Enough training to ensure your developers are competent and + knowledgeable about all areas of your sources. + - Effective management of the boundaries and grey areas. + + In many cases, technical solutions to "security" problems are + inadequate. You should first try to avoid them. + + Personal Opinion: In an environment where "unknowns" are allowed to + touch important sources the "owner" of the CVS Repository must be a + large, loud, vigorous lout with a well-balanced truncheon and the + right to use it. Don't underestimate the effectiveness of letting + everyone know they will be strapped into the stocks on the Town Common + and pelted with vegetables if they break something they don't + understand without first asking the experts. + + Set Unix groups and permissions. See 4B.5. You can set different + owners, groups and permissions for each sub-directory within the + Repository if that helps. + + Catch invocations of "commit" by defining pre-commit programs in the + "commitinfo" file. This is fairly powerful, since it can block commits + based on anything you can program. Take a look at the programs in the + "contrib" directory of the CVS source tree. + + Use multiple Repositories, each with its own protection scheme. If + you use NFS (or AFS) you can even use "export" restrictions to various + groups of machines to keep (for example) the Engineering Repository + off the Customer Service machines. + + Try the "setgid" trick described in 4D.13. + + Try to use the RCS access control lists, though I don't think CVS + will handle them cleanly. + + Edit the source code to CVS to add your own access control. + + Last modified: _6/13/1997_ + + 16. What are the Repository Administrator's responsibilities? + + Generally, the Administrator should set "policy", create the + Repository and monitor its size and control files. + + Some specific responsibilities include: + + Examining the Repository once in a while to clean up: + + Trash files left by misguided developers who mistake the Repository + for a working directory. + + Non-RCS files. Other than the files CVS needs in the + $CVSROOT/CVSROOT directory, every file in the Repository should be an + RCS file. + + Lock files (both CVS '#*' and RCS ',*' files) left around after + crashes. + + Wrong permissions, groups and ownerships. + + Locked files. (RCS locks, that is.) + + Attic files that should never have been under CVS at all. Don't + blindly delete files from Attic directories -- they were mostly put + there (via the "cvs remove") for a reason. Files that should be + deleted are binary files (e.g. '*.o', 'core', executables) that were + mistakenly inserted by "import -I !". + + Maintaining the modules file. + + Storing site-specific ignore patterns in the + $CVSROOT/CVSROOT/cvsignore file. + + Storing the names of non-standard CVSROOT files (See 4B.2) in the + $CVSROOT/CVSROOT/checkoutlist + + Maintaining the other Repository control files: commitinfo, loginfo, + rcsinfo and editinfo. + + Pruning the history file every once in a while. (Try the + "cln_hist.pl" script in the "contrib" directory.) + + Staying aware of developments on the info-cvs mailing list and what + is available in the FTP and WWW archives. + + Running "ps ax" once in a while and kill off any "update" programs + not running as "root". It is too easy to leave the "cvs" off the front + of the "cvs update" command. + + Executing monitor programs to check the internal consistency of the + Repository files. Ideas: + + Files that have a default RCS branch that is not 1.1.1 (From an + abuse of "admin -b".) + + Files that have only Revisions 1.1 and 1.1.1.1, with a default + branch of "MAIN". (From an abuse of "admin -o".) + + Existing branch tags and various branch consistency checks. + + Last modified: _6/13/1997_ + + 17. How do I move the whole Repository? + + Copy or move the tree. (On Unix systems, a set of piped "tar" commands + works great. If the Repository does not contain any symlinks, which it + normally doesn't, you can also use "cp -r".) + + If you can avoid changing $CVSROOT (i.e. the "logical" pathname of the + Repository) by replacing the old location with a symbolic link to the + new location, you don't have to do anything else. + + (You could also mount the new location on top of the old location if + you are using NFS or some other filesystem that allows it.) + + If you must change $CVSROOT, you must also tell everyone to change the + CVSROOT environment variable in all running shells and in any personal + configuration files ('.' files on Unix) where it is set. + + The Repository itself contains no references to its own name, except + possibly in some of the files in the CVSROOT directory. If your + modules (or loginfo, commitinfo, etc.) file mentions helper programs + directly in the Repository, you'll have to change the pathnames to + point to the new Repository location. + + The main changes you'll have to make are to all the CVS administrative + files (./CVS/Repository and ./CVS/Root) in every working directory + ever checked out from the previous location of the Repository you just + moved. + + You have three choices: + + If all ./CVS/Repository files in all working directories contain + relative pathnames, you don't have to do anything else. + + Have everyone "release" or delete their working directories (after + committing, or just saving, their work) and check them all out again + from the new Repository after the move. + + Use "find . ( -name Repository -o -name Root )" and a PERL or shell + script to run through all the ./CVS/Repository and ./CVS/Root files + and edit the values in the files. + + Last modified: _6/13/1997_ + + 18. How do I change permissions on a file in the Repository by using a CVS + command? (i.e. without using "chmod 777 $CVSROOT/dir/file") + + When you first "import" or "add"/"commit" a file, the read and execute + bits on the Repository file are inherited from the original source + file, while the write bits on the Repository file are are turned off. + This is a standard RCS action. + + After that, there is no way to alter the permissions on a file in the + Repository using CVS (or RCS) commands. You have to change the + permissions on both your working file and on the Repository file from + which it was retrieved. + + Whenever you "checkout" the file or retrieve a new revision via + "update" (or after a "commit"), your working file is set to match the + permissions of the Repository file, minus any "umask" bits you have + set. + + Last modified: _6/13/1997_ + + Category: /Advanced_Topics_/Tricks_of_the_Trade/ + + " + Tricks of the Trade" + + 1. How can you even check in binary files, let alone allow CVS to do its + auto-merge trick on them? + + +First of all, if you want to use binary files, you should get RCS 5.7 +and CVS 1.9 or later (earlier versions had some support, but there have been +bug fixes). Secondly, follow the instructions for installing RCS very +carefully (it is easy to get it installed so it works for everything +except binary files). + +Then, specify 'cvs add -kb' instead of just 'cvs add' to add a binary +file. If you want to set an existing file to binary, run 'cvs admin +-kb' (and then check in a new copy of the file). Note that old +versions of CVS used -ko instead of -kb for binary files, so if you +see a reference to -ko in the context of binary files, you should +think -kb instead. + +Of course when 'cvs update' finds that a merge is needed, it can't +do this for binary files the same way as for text files. With the +latest versions (e.g. CVS 1.9.14), it should be able to give you both +versions and let you merge manually. Another approach is to +run 'cvs admin -l' to lock files, as described in +"How can I lock files while I'm working on them the way RCS does?" +elsewhere in this FAQ. See also +"Is there any way to import binary files?" and +"How do I "add" a binary file?" elsewhere in this FAQ. + +kingdon@cyclic.com + + Last modified: _9/6/1997_ + + 2. Can I edit the RCS (",v") files in the Repository? + + Yes, but be very careful. The RCS files are not free-form files, they + have a structure that is easily broken by hand-editing. The only time + I would suggest doing this is to recover from emergency failures that + are difficult to deal with using CVS commands, including the "admin" + command, which can talk directly to RCS. + + Though no one actively encourages the editing of RCS files, many + people have succumbed to the urge to do so when pressed for time. The + reasons given, usually with evident contrition, include: + + + - Editing mistakes in, or adding text to, log entries. (If you have + RCS 5.6 or later, you should use `cvs admin -m'.) + - Renaming or moving symbolic names. (You should `cvs admin -N' + instead.) + - Unlocking a file by changing the "locker" from someone else to + yourself. (It's safer to use `cvs admin -u -l'.) + - Making global changes to past history. Example: Eradicating former + employees names from old documents and Author entries. (And someone + thought the "history" command was evidence of Big Brother! I never + realized how much help a wide-open revision control system could have + provided to The Ministry of Truth.) + + Last modified: _6/13/1997_ + + 3. Can I edit the ./CVS/{Entries,Repository,Tag} files? + + Yes, but with CVS 1.3 and later, there is almost no reason to edit any + of the CVS administrative files. + + If you move pieces of your Repository around it can be faster to edit + all the ./CVS/Repository files rather than checking out a large tree. + But that is nearly the only reason to do so. + + Last modified: _6/13/1997_ + + 4. Someone executed "admin -o" and removed revisions to which tags/symbols + were attached. How do I fix them? + + It depends on what you mean by "fix". I can think of three ways to fix + your predicament: + + Remove the tags. + + Assuming you really wanted to get rid of the revision and its + associated tags, you can remove them with the "admin" command. The + "tag -d" command will only remove tags attached to existing revisions. + You can remove a tag, even if it is attached to a non-existent + revision, by typing: + + cvs admin -N<tag> <file> + + Retrieve the outdated revision. + + You should first look in your backup system for recent versions of the + file. If you can't use them, you can carefully extract each revision + that followed the earliest outdated revision using RCS (or "cvs + admin") commands and reconstruct the file with all the right + revisions, branches and tags. This is a lot of work. + + You *can't* insert a revision into the current RCS file. + + Move the Tags to another revision in each file. + + If you want to move the tags to another valid revision, you have two + choices, both of which require that you find all the revision numbers + of the files you want to "tag" and execute the following command + sequences on each <file>. + + Use "update" to grab the revision you want, then execute a normal + "tag" command to Tag that revision: + + cvs update -r <rev> <file> + cvs tag <tag> <file> + + Use "admin" to set the tag to a specific revision: + + cvs admin -N<tag>:<rev> <file> + + Last modified: _6/13/1997_ + + 5. How do I move or rename a magic branch tag? + + (To rename a non-branch <tag> see 3O.9.) + + Before reading this, read 3M.3 and 3M.4 and understand exactly how tag + and rtag use '-r' and why it won't do the right job here. + + First, I have to explain exactly what a magic branch tag is. + + A magic <branch_tag> is an artificial tag attached to a non-existent + revision on a non-existent branch number zero. It looks like this: + + TAG1:<X>.0.Y + + <X> is the "branch point revision", a normal revision with an + odd number of '.'s in it. (e.g. 1.5, 1.3.1.6, etc) + + Y is an even number (e.g. 2, 4, 6, etc.) All CVS branches, + other than the Vendor branch, are even numbered. + + TAG1 is considered by CVS to be attached to revision <X>. The first + "update -r TAG1 <file>" after applying TAG1 will produce a copy of + revision <X> with a sticky tag of TAG1. The first "commit" to that + file will cause CVS to construct an RCS branch named <X>.Y and check + in revision <X>.Y.1 on the new branch. + + Note: TAG1 is *not* considered to be attached to <X> by RCS, which + explains why you can't refer directly to the branch point revision for + some CVS commands. + + Moving a magic <branch_tag> is the act of reapplying the same tag to + different revisions in the file: + + TAG1:<X>.0.Y + to + TAG1:<X>.0.Z or TAG1:<A>.0.B + + You can move a magic branch tag to the revisions of your choice by + using "update" to find the revisions you want to tag and reapplying + the tag to all the files with the '-F' option to force it to move the + existing <branch_tag>. + + cvs update -r <tag/rev> (or '-A' for the Main Branch) + cvs tag -F -b <branch_tag> + + If the earlier location of TAG1 refers to a physical branch within any + RCS file, moving it will make the existing branch in the file seem to + disappear from CVS's view. This is not a good idea unless you really + want to forget the existence of those RCS branches. + + If the "update" above retrieves the original branch point revision + (<X>), the "tag" command above will create the tag: + + TAG1:<X>.0.Z + + Where Z is 2 greater than the highest magic branch already on revision + <X>. The TAG1 branch will still have the same branch point (i.e. + revision <X>), but the first commit to the new TAG1 branch will create + a different RCS branch number (<X>.Z instead of <X>.Y). + + Renaming a magic <branch_tag> is the act of changing + + TAG1:<X>.0.Y + to + TAG2:<X>.0.Y + + There is no harm in changing a tag name as long as you forget that + TAG1 ever existed and you clean up any working directories with sticky + TAG1 tags on them by using "update -A", "update -r <other_tag>" or by + removing the working directories. + + On the other hand, actually changing the tag is not easy. + + See 3M.3 for why the seemingly obvious solution won't work: + + cvs tag -b -r <old_branch_tag> <new_branch_tag> + + The only direct way to rename a magic tag is to use the "admin" + command on each file: (You might want to use '-n'. Read "man rcs" and + look at the '-n' and '-N' options.) + + cvs admin -N<new_branch_tag>:<old_branch_tag> . + cvs tag -d <old_branch_tag> + + But you have to be careful because "admin" is different from other CVS + commands: + + "admin" can be used recursively, but only by specifying directory + names in its argument list (e.g. '.'), + + Where "rtag -r <old_branch_tag>" would interpret <old_branch_tag> as + a magic CVS branch tag, "admin" is a direct interface to RCS which + sees a magic branch tag as a simple (though non-existent) RCS revision + number. + + This is good for us in this particular case, but different from normal + CVS. + + "admin" also skips the Attic and produces different kinds of errors + than CVS usually does. (Because they are coming directly from RCS.) + + The other way to rename a magic <branch_tag> is to edit the Repository + files with a script of some kind. I've done it in the past, but I'll + leave it as an exercise for the reader. + + Last modified: _6/13/1997_ + + 6. Can I use RCS locally to record my changes without making them globally + visible by committing them? + + You can, but it will probably confuse CVS to have ",v" files in your + working directory. And you will lose all your log entries when you + finally commit it. + + Your best bet is to create your own CVS branch and work there. You can + commit as many revisions as you want, then merge it back into the main + line (or parent branch) when you are finished. + + Last modified: _6/13/1997_ + + 7. How can I allow access to the Repository by both CVS and RCS? + + The first step is to try not to. If some people are using CVS, there + is no reason for everyone not to. It is not hard to learn the basics + and CVS makes certain operations *easier* than a series of RCS + commands. Personal preference in what software tools can be applied to + a shared Repository has to take second place to system integration + needs. If you disagree, try writing some Lisp code for inclusion in + your Unix kernel and see what kind of reception you get. + + If you really must allow routine RCS access to the CVS Repository, you + can link an RCS sub-directory into a piece of the Repository: + + ln -s /Repository/some/directory/I/want RCS + + and RCS will work just fine. + + Those who are using RCS will have to keep the following in mind: + + If a file was originally added to the Repository by "import" and has + not been changed using CVS, the *RCS* default branch will remain + attached to the Vendor branch, causing revisions checked-in by "ci" to + wind up on the Vendor branch, instead of the main branch. Only CVS + moves the RCS default branch on first commit. + + The way around this is to checkin (using "ci") all the files first and + move them into the Repository. That way they won't have Vendor + branches. Then RCS will work OK. + + It is possible to use "rcs" and "ci" to make the files unusable by + CVS. The same is true of the CVS "admin" command. + + Normal RCS practice locks a file on checkout with "co -l". In such + an environment, RCS users should plan to keep survival gear and food + for at least 30 days near their desks. When faced with bizarre and + unexpected permission errors, howling mobs of slavering CVS users will + run the RCS users out of town with pitchforks and machetes. + + See 3C.8 for a way to avoid machetes aroused by lock collisions. + + Though files checked in by RCS users will correctly cause + "up-to-date" failures during CVS "commits" and they will be + auto-merged into CVS working directories during "update", the opposite + won't happen. + + RCS users will get no warning and will not be required to merge older + work into their code. They can easily checkin an old file on top of a + new revision added by CVS, discarding work committed earlier by CVS + users. + + See the howling mob scenario described above. + + RCS is great. I have used it for years. But I wouldn't mix it this + way. In a two-camp society, you are asking for real trouble, both in + technical hassles to clean up and in political hassles to soothe. + Branch merges will also be a major problem. + + Last modified: _6/13/1997_ + + 8. I "updated" a file my friend, "bubba", committed yesterday. Why doesn't + the file now have a modified date of yesterday? + + CVS restores dates from the RCS files only on first "checkout". After + that, it is more important to maintain a timestamp relative to the + other files in the working directory. + + Example: You committed a source file at 5PM. Bubba updated his copy of + the file, grabbing your changes, then changed and committed a new + revision of the file at 6PM. At 7PM, you compile your file. Then you + execute "update". If CVS sets the date to the one in the RCS file, the + file would be given a timestamp of 6PM and your Makefile wouldn't + rebuild anything that depended on it. Bad news. + + Note that the same logic applies to retrieving a revision out of the + Repository to replace a deleted file. If CVS changes your file in an + existing working directory, whether it was because a new revision was + committed by someone else or because you deleted your working file, + the timestamp on the retrieved working file *must* be set to the + current time. + + When you first retrieve a file, there is no reason to expect any + particular timestamp on the file within your working area. But later, + when dependency checking is performed during a build, it is more + important for the timestamps on the local files to be consistent with + each other than than it is for working files to match the timestamps + on the files in the Repository. See 4D.17 for some more about + timestamps. + + Last modified: _6/13/1997_ + + 9. While in the middle of a large "commit", how do I run other commands, + like "diff" or "stat" without seeing lock errors? + + Type: + cvs -n <command> + + The '-n' option to the main cvs command turns off lock checking, a + reasonable act for read-only commands given the promise offered by + '-n' not to alter anything. The "diff", "log" and "stat" commands + provide the same information (for files that are not being committed) + when used with and without the '-n' option. + + Warning: Ignoring locks can produce inconsistent information across a + collection of files if you are looking at the revisions affected by an + active commit. Be careful when creating "patches" from the output of + "cvs -n diff". If you are looking only at your working files, tagged + revisions, and BASE revisions (revisions whose numbers are read from + your ./CVS/Entries files), you should get consistent results. Of + course, if you catch a single file in the middle of RCS activity, you + might get some strange errors. + + Note that the suggested command is "cvs -n <command>". The visually + similar command "cvs <command> -n" has no relation to the suggested + usage and has an entirely different meaning for each command. + + "cvs -n update" also works in the middle of a commit, providing + slightly different information from a plain "cvs update". But, of + course, it also avoids modifying anything. + + You could also use the RCS functions, "rlog" and "rcsdiff" to display + some of the information by referring directly to the Repository files. + + You need RCS version 5 or later for the commands described above to + work reliably. + + Last modified: _6/13/1997_ + + 10. Where did the ./CVS/Entries.Static file come from? What is it for? + + Each CVS working directory contains a ./CVS/Entries file listing the + files managed by CVS in that working directory. Normally, if the + "update" command finds a file in the Repository that is not in the + ./CVS/Entries file, "update" copies the appropriate revision of the + "new" file out of the Repository and adds the filename to the Entries + file. This happens for files: + + Added to the Repository from another working directory. + + Dragged out of the Attic when switching branches with "update -A" or + "update -r". + + Whose names were deleted from the ./CVS/Entries file. + + If the ./CVS/Entries.Static file exists, CVS will only bring out + revisions of files that are contained in either ./CVS/Entries or + ./CVS/Entries.Static. If a Repository file is found in *neither* file, + it is ignored. + + The ./CVS/Entries.Static file is created when you check out an + individual file or a module that creates working directories that + don't contain all files in the corresponding Repository directory. In + those cases, without an ./CVS/Entries.Static file, a simple "update" + would bring more files out of the Repository than the original + "checkout" wanted. + + The ./CVS/Entries.Static file can be removed by hand. It is + automatically removed if you run "update -d" to create new directories + (even if no new directories are created). (Internally, since + "checkout" turns on the '-d' flag and calls the "update" routine, a + "checkout" of a module or directory that writes into an existing + directory will also remove the ./CVS/Entries.Static file.) + + Last modified: _6/13/1997_ + + 11. Why did I get the wrong Repository in the loginfo message? + + You probably: + + Use multiple Repositories. + + Configured CVS to use absolute pathnames in the ./CVS/Repository + file. + + Configured CVS not to use the ./CVS/Root file. + + Typed the "commit" command in one Repository with your $CVSROOT + pointing at another. + + "commit" and all other CVS commands will heed an absolute pathname in + the ./CVS/Repository file (or in the "-d CVSrootdir" override), but + the log function doesn't take arguments -- it just looks at $CVSROOT. + + If you avoid even one of the four steps above, you won't see this + problem. If you configure ./CVS/Root, you won't be allowed to execute + the program causing the error. + + Last modified: _6/13/1997_ + + 12. How do I run CVS setuid so I can only allow access through the CVS + program itself? + + Setuid to root is not a great idea. Any program that modifies files + and is used by a widely distributed group of users is not a good + candidate for a setuid program. (The worst suggestion I've ever heard + was to make *Emacs* setuid to root.) + + Root access on Unix is too powerful. Also, it might not work in some + (secure?) environments. + + Running it setuid to some user other than root might work, if you add + this line to main.c near the beginning: + + setuid(geteuid()); + + Otherwise it uses *your* access rights, rather than the effective + uid's. + + Also, you have to invent a fake user whose name will show up in + various places. But many sites, especially those who might want a + setuid CVS for "security", want personal accountability -- no generic + accounts. I don't know whether accountability outweighs file security. + + And finally, unless you take action to limit the "admin" command, you + are leaving yourself unprotected anyway. + + Last modified: _6/13/1997_ + + 13. How about using groups and setgid() then? + + Here is a way to run CVS setgid in some environments: + + Stick this near the front of the main() in main.c: + + setgid(getegid()); + + This will allow "access" to work on systems where it only works on the + real gid. + + Create a group named "cvsg". (This example uses "cvsg". You can name + it as you wish.) + + Put *no* users in the "cvsg" group. You can put Repository + administrators in this group if you want to. + + Set the cvs executable to setgid (not setuid): + + cd /usr/local/bin; chown root.cvsg cvs; chmod 2755 cvs + + Make sure every file in the Repository is in group "cvsg": + + chown -R root.cvsg $CVSROOT + + Change all directory permissions to 770. This allows all access to + the files by the "cvsg" group (which has no members!) and no access at + all to anyone else. + + find $CVSROOT -type d -exec chmod 2770 {} \; + + On some systems you might have to type: + + find $CVSROOT -type d -exec chmod u=rwx,g=rwx,o=,g+s {} \; + + This should allow only the cvs program (or other "setgid to group + cvsg") programs to write into the area, but no one else. Yes the user + winds up owning the file, but s/he can't find it again later since + s/he can't traverse the tree. (If you enable the world execute bit + (mode 2771) on directories, users can traverse the tree and the user + who last wrote the file can still write to it.) + + If you want to allow read access, check out an entire tree somewhere. + You have to do this anyway to build it. + + Note: If you are using a stupid file system that can't inherit file + groups from the parent directory (even with the "setgid" (Octal 2000) + bit set), you might have to modify CVS (or RCS) to reset the group + every time you create a new file. I have not tested this. + + The setgid() method shares with the setuid() method the problem of + keeping "admin" from breaking things. + + Last modified: _6/13/1997_ + + 14. How do I use the "commitinfo" file? + + Go read 4B.2 first. + + The "commitinfo" file allows you to execute "sanity check" functions + before allowing a commit. If any function called from within the + commitinfo file exits with a non-zero status, the commit is denied. + + To fill out a "commitinfo" file, ask yourself (and those sharing your + Repository) these questions: + + + - Is there anything you want to check or change before someone is + allowed to commit a file? If not, forget commitinfo. + + If you want to serialize binary files, you might consider something + like the rcslock.pl program in the contrib directory of the CVS + sources. + + + - Do you want to execute the same exact thing before committing to + every file in the Repository? (This is useful if you want to program + the restrictions yourself.) If so, set up a single line in the + commitinfo: + + DEFAULT /absolute/path/to/program + + CVS executes the program once for each directory that "commit" + traverses, passing as arguments the directory and the files to be + committed within that directory. + + Write your program accordingly. Some examples exist in the contrib + directory. + + + - Do you want a different kind of sanity check performed for different + directories? If so, you'll have to decide what to do for all + directories and enter lines like this: + + regexp1 /absolute/path/to/program-for-regexp1 + regexp2 /absolute/path/to/program-for-regexp2 + DEFAULT /absolute/path/to/program-for-all-else + + + - Is there anything you want to happen before *all* commits, in + addition to other pattern matches? If so, include a line like this: + + ALL /absolute/path/to/program + + It is executed independently of all the above. And it's repeatable -- + you can have as many ALL lines as you like. + + Last modified: _6/13/1997_ + + 15. How do I use the "loginfo" files? + + See 4B.2 and the "commitinfo" question above. + + The "loginfo" file has the same format as the "commitinfo" file, but + its function is different. Where the "commitinfo" information is used + before a commit, the "loginfo" file is used after a commit. + + All the commands in the "loginfo" file should read data from standard + input, then either append it to a file or send a message to a mailing + list. If you want to make it simple, you can put shell (the shell used + by "popen(3)") command lines directly in the "loginfo" (or + "commitinfo") file. These seem to work: + + ^special /usr/ucb/Mail -s %s special-mailing-list ^other /usr/ucb/Mail + -s %s other-mailing-list DEFAULT (echo '===='; echo %s; cat) > + /path/name/to/log/file + + Last modified: _6/13/1997_ + + 16. How can I keep people with restrictive umask values from blocking + access to the Repository? + + If a user creates a new file with restricted permissions (e.g. 0600), + and commits it, the Repository will have a file in it that is + unreadable by everyone. The 0600 example would be unreadable by + *anyone* but root and the user who created it. + + There are 3 solutions to this: + + Let it happen. This is a valid way to protect things. If everyone is + working alone, a umask of 077 is OK. If everyone is working only in + small groups, a umask of 007 is OK. + + Train your users not to create such things if you expect to share + them. + + See 4B.5 for a small script that will reset the umask. + + I personally don't like the idea of a program automatically + *loosening* security. It would be better for you all to talk about the + issue and decide how to work together. + + Last modified: _6/13/1997_ + + 17. Why do timestamps sometimes get set to the date of the revision, + sometimes not? The inconsistency causes unnecessary recompiles. + + The "checkout" command normally sets the timestamp of a working file + to match the timestamp stored on the revision in the Repository's RCS + file. + + The "commit" command retains the timestamp of the file, if the act of + checking it in didn't change it (by expanding keywords). + + The "update" command sets the time to the revision time the first time + it sees the file. After that, it sets the time of the file to the + current time. See 4D.8 for a reason why. + + Here's a two-line PERL program to set timestamps on files based on + other timestamps. I've found this program useful. When you are certain + you don't want a source file to be recompiled, you can set its + timestamp to the stamp on the object file. + + #!/usr/local/bin/perl + # + # Set timestamp of args 2nd-Last to that of the first arg. + # + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime) + = stat(shift); + utime($atime,$mtime,@ARGV); + + Last modified: _6/13/1997_ + + Category: /Commands_/ + + " Commands " + + Category: /Commands_/add_ad_new/ + + " + "add", "ad", "new"" + + 1. What is "add" for? + + To add a new directory to the Repository or to register the desire to + add a new file to the Repository. + + The directory is created immediately, while the desire to add the file + is recorded in the local ./CVS administrative directory. To really add + the file to the Repository, you must then "commit" it. + + Last modified: _6/13/1997_ + + 2. How do I add a new file to the branch I'm working on? + + The user actions for adding a file to any branch, including the Main + Branch, are exactly the same. + + You are in a directory checked out (or updated) with the '-A' option + (to place you on the Main Branch) or the "-r <branch_tag>" option (to + place you on a branch tagged with <branch_tag>). To add <file> to the + branch you are on, you type: + + cvs add <file> + cvs commit <file> + + If no ./CVS/Tag file exists (the '-A' option deletes it), the file + will be added to the Main Branch. If a ./CVS/Tag file exists (the "-r + <branch_tag>" option creates it), the file will be added to the branch + named (i.e. tagged with) <branch_tag>. + + Unless you took steps to first add the file to the Main Branch, your + new file ends up in the Attic. + + Last modified: _6/13/1997_ + + 3. Why did my new file end up in the Attic? + + The file is thrown into the Attic to keep it from being visible when + you check out the Main Branch, since it was never committed to the + Main Branch. + + Last modified: _6/13/1997_ + + 4. Now that it's in the Attic, how do I connect it to the Main branch? + + That can be considered a kind of "merge". See 4C.8 + + Last modified: _6/13/1997_ + + 5. How do I avoid the hassle of reconnecting an Attic-only file to the Main + Branch? + + You create it on the Main Branch first, then branch it. + + If you haven't yet added the file or if you decided to delete the new + Attic file and start over, then do the following: (If you added the + file (or worse, the 157 files) to the Attic and don't want to start + over, try the procedure in 4C.8.) + + Temporarily remove the sticky branch information. Either: + + Move the whole directory back to the Main Branch. [This might not be + a good idea if you have modified files, since it will require a merge + in each direction.] + + cvs update -A + + *or* + + Move the ./CVS/Tag file out of the way. + + mv ./CVS/Tag HOLD_Tag + + Add and branch the file "normally": + + cvs add <file> + cvs commit <file> + cvs tag -b <branch_tag> <file> + + [<branch_tag> is the same Branch Tag as you used on all the other + files. Look at ./CVS/Entries or the output from "cvs stat" for sticky + tags.] + + Clean up the temporary step. + + If you moved the ./CVS/Tag file, put it back. Then move the new file + onto the branch where you are working. + + mv HOLD_Tag ./CVS/Tag + cvs update -r <branch_tag> <file> + + If you ran "update -A" rather than moving the ./CVS/Tag file, move + the whole directory (including the new file) back onto the branch + where you were working: + + cvs update -r <branch_tag> + + Last modified: _6/13/1997_ + + 6. How do I cancel an "add"? + + If you want to remove the file entirely and cancel the "add" at the + same time, type: + + cvs remove -f <file> + + If you want to cancel the "add", but leave the file as it was before + you typed "cvs add", then you have to fake it: + + mv <file> <file>.hold + cvs remove <file> + mv <file>.hold <file> + + Last modified: _6/13/1997_ + + 7. What are the ./CVS/file,p and ./CVS/file,t files for? + + The ./CVS/file,p and ./CVS/file,t files are created by the "add" + command to hold command line options and message text between the time + of the "add" command and the expected "commit". + + The ./CVS/file,p file is always null, since its function was absorbed + by the "options" field in the ./CVS/Entries file. If you put something + in this file it will be used as arguments to the RCS "ci" command that + commit uses to check the file in, but CVS itself doesn't put anything + there. + + The ./CVS/file,t file is null unless you specify an initial message in + an "add -m 'message'" command. The text is handed to "rcs -i + -t./CVS/file,t" to create the initial RCS file container. + + Both files must exist to commit a newly added file. If the + ./CVS/file,p file doesn't exist, CVS prints an error and aborts the + commit. If the ./CVS/file,t file doesn't exist, RCS prints an error + and CVS gets confused, but does no harm. + + To recover from missing ,p and ,t files, just create two zero-length + files and rerun the "commit". + + Last modified: _6/13/1997_ + + 8. How do I "add" a binary file? + + If you configured CVS to use the GNU version of "diff" and "diff3", + you only need to turn off RCS keyword expansion. + + First you turn off RCS keyword expansion for the initial checkin by + using "add -ko". It works like "update -ko" in creating a "sticky" + option only for the copy of the file in the current working directory. + + cvs add -ko <file> + + Commit the file normally. The sticky -ko option will be used. + + cvs commit <file> + + Then mark the RCS file in the Repository so that keyword expansion is + turned off for all checked out versions of the file. + + cvs admin -ko <file> + + Since "admin -ko" records the keyword substitution value in the + Repository's RCS file, you no longer need the sticky option. You can + turn it off with the "update -A" command, but if you were on a branch, + you'll have to follow it "update -r <branch_tag>" to put yourself back + on the branch. + + Managing that binary file is another problem. See 4D.1. + + Last modified: _6/13/1997_ + + Category: /Commands_/admin_adm_rcs/ + + " + "admin", "adm", "rcs"" + + 1. What is "admin" for? + + To provide direct access to the underlying "rcs" command (which is not + documented in this FAQ) bypassing all safeguards and CVS assumptions. + + Last modified: _6/13/1997_ + + 2. Wow! Isn't that dangerous? + + Yes. + + Though you can't hurt the internal structure of an RCS file using its + own "rcs" command, you *can* change the underlying RCS files using + "admin" in ways that CVS can't handle. + + If you feel the need to use "admin", create some test files with the + RCS "ci" command and experiment on them with "rcs" before blasting any + CVS files. + + Last modified: _6/13/1997_ + + 3. What would I normally use "admin" for? + + Normally, you wouldn't use admin at all. In unusual circumstances, + experts can use it to set up or restore the internal RCS state that + CVS requires. + + You can use "admin -o" (for "outdate") to remove revisions you don't + care about. This has its own problems, such as leaving dangling Tags + and confusing the "update" command. + + There is some feeling among manipulators of binary files that "admin + -l" should be used to serialize access. See 3C.8. + + An interesting use for "admin" came up while maintaining CVS itself. I + import versions of CVS onto the Vendor branch of my copy of CVS, make + changes to some files and ship the diffs (created by "cvs diff -c -r + TO_BRIAN") off to Brian Berliner. After creating the diff, I retag + ("cvs tag -F TO_BRIAN") the working directory, which is then ready to + produce the next patch. + + I'll use "add.c" as an example (only because the name is short). + + When the next release came out, I discovered that the released "add.c" + (version 1.1.1.3 on the Vendor branch) was exactly the same as my + modified file (version 1.3). I didn't care about the changelog on + versions 1.2 and 1.3 (or the evidence of having done the work), so I + decided to revert the file to the state where it looked like I had not + touched the file -- where I was just using the latest on the vendor + branch after a sequence of imports. + + To do that, I removed all the revisions on the main branch, except for + the original 1.1 from which the Vendor branch sprouts: + + cvs admin -o1.2: add.c + + Then I set the RCS "default branch" back to the Vendor branch, the way + import would have created it: + + cvs admin -b1.1.1 add.c + + And I moved the "TO_BRIAN" Tag to the latest revision on the Vendor + branch, since that is the base from which further patches would be + created (if I made any): + + cvs admin -NTO_BRIAN:1.1.1.3 add.c + + Instead of 1.1.1.3, I could have used one of the "Release Tags" last + applied by "import" (3rd through Nth arguments). + + Suggestion: Practice on non-essential files. + + Last modified: _6/13/1997_ + + 4. What should I avoid when using "admin"? + + If you know exactly what you are doing, hack away. But under normal + circumstances: + + Never use "admin" to alter branches (using the '-b' option), which CVS + takes very seriously. If you change the default branch, CVS will not + work as expected. If you create new branches without using the "tag + -b" command, you may not be able to treat them as CVS branches. + + See 3C.8 for a short discussion of how to use "admin -l" for + serializing access to binary files. + + The "admin -o <file>" allows you to delete revisions, usually a bad + idea. You should commit a correction rather than back out a revision. + Outdating a revision is prone to all sorts of problems: + + Discarding data is always a bad idea. Unless something in the + revision you just committed is a threat to your job or your life, + (like naming a function "<boss's name>_is_a_dweeb", or including the + combination to the local Mafioso's safe in a C comment), just leave it + there. No one cares about simple mistakes -- just commit a corrected + revision. + + The time travel paradoxes you can cause by changing history are not + worth the trouble. Even if CVS can't interfere with your parents' + introduction, it *can* log commits in at least two ways (history and + loginfo). The reports now lie -- the revision referred to in the logs + no longer exists. + + If you used "import" to place <file> into CVS, outdating all the + revisions on the Main branch back to and including revision 1.2 (or + worse, 1.1), will produce an invalid CVS file. + + If the <file>,v file only contains revision 1.1 (and the connected + branch revision 1.1.1.1), then the default branch must be set to the + Vendor branch as it was when you first imported the file. Outdating + back through 1.2 doesn't restore the branch setting. Despite the above + admonition against it, "admin -b" is the only way to recover: + + cvs admin -b1.1.1 <file> + + Although you can't outdate a physical (RCS) branch point without + removing the whole branch, you *can* outdate a revision referred to by + a magic branch tag. If you do so, you will invalidate the branch. + + If you "outdate" a tagged revision, you will invalidate all uses of + the <tag>, not just the one on <file>. A tag is supposed to be + attached to a consistent set of files, usually a set built as a unit. + By discarding one of the files in the set, you have destroyed the + utility of the <tag>. And it leaves a dangling tag, which points to + nothing. + + And even worse, if you commit a revision already tagged, you will + alter what the <tag> pointed to without using the "tag" command. For + example, if revision 1.3 has <tag> attached to it and you "outdate" + the 1.3 revision, <tag> will point to a nonexistent revision. Although + this is annoying, it is nowhere near as much trouble as the problem + that will occur when you commit to this file again, recreating + revision 1.3. The old tag will point to the new revision, a file that + was not in existence when the <tag> was applied. And the discrepancy + is nearly undetectable. + + If you don't understand the above, you should not use the admin + command at all. + + Last modified: _6/13/1997_ + + 5. How do I restrict the "admin" command? The -i flag in the modules file + can restrict commits. What's the equivalent for "admin"? + + At this writing, to disable the "admin" command, you will have to + change the program source code, recompile and reinstall. + + Last modified: _6/13/1997_ + + 6. I backed out a revision with "admin -o" and committed a replacement. Why + doesn't "update" retrieve the new revision? + + CVS is confused because the revision in the ./CVS/Entries file matches + the latest revision in the Repository *and* the timestamp in the + ./CVS/Entries file matches your working file. CVS believes that your + file is "up-to-date" and doesn't need to be updated. + + You can cause CVS to notice the change by "touch"ing the file. + Unfortunately what CVS will tell you is that you have a "Modified" + file. If you then "commit" the file, you will bypass the normal CVS + check for "up-to-date" and will probably commit the revision that was + originally removed by "admin -o". + + Changing a file without changing the revision number confuses CVS no + matter whether you did it by replacing the revision (using "admin -o" + and "commit" or raw RCS commands) or by applying an editor directly to + a Repository (",v") file. Don't do it unless you are absolutely + certain no one has the latest revision of the file checked out. + + The best solution to this is to institute a program of deterrent + flogging of abusers of "admin -o". + + The "admin" command has other problems." See 3B.4 above. + + Last modified: _6/13/1997_ + + Category: /Commands_/checkout_co_get/ + + " + "checkout", "co", "get"" + + 1. What is "checkout" for? + + To acquire a copy of a module (or set of files) to work on. + + All work on files controlled by CVS starts with a "checkout". + + Last modified: _6/13/1997_ + + 2. What is the "module" that "checkout" takes on the command line? + + It is a name for a directory or a collection of files in the + Repository. It provides a compact name space and the ability to + execute before and after helper functions based on definitions in the + modules file. + + See 1D.11. + + Last modified: _6/13/1997_ + + 3. Isn't a CVS "checkout" just a bunch of RCS checkouts? + + Like much of CVS, a similar RCS concept is used to support a CVS + function. But a CVS checkout is *not* the same as an RCS checkout. + + Differences include: + + CVS does not lock the files. Others may access them at the same + time. + + CVS works best when you provide a name for a collection of files (a + module or a directory) rather than an explicit list of files to work + on. + + CVS remembers what revisions you checked out and what branch you are + on, simplifying later commands. + + Last modified: _6/13/1997_ + + 4. What's the difference between "update" and "checkout"? + + The "checkout" and "update" commands are nearly equivalent in how they + treat individual files. They differ in the following ways: + + The "checkout" command always creates a directory, moves into it, + then becomes equivalent to "update -d". + + The "update" command does not create directories unless you add the + '-d' option. + + "Update" is intended to be executed within a working directory + created by "checkout". It doesn't take a module or directory argument, + but figures out what Repository files to look at by reading the files + in the ./CVS administrative directory. + + The two commands generate completely different types of records in + the "history" file. + + Last modified: _6/13/1997_ + + 5. Why can't I check out a file from within my working directory? + + Though you *can* check out a file, you normally check out a module or + directory. And you normally do it only once at the beginning of a + project. + + After the initial "checkout", you can use the "update" command to + retrieve any file you want within the checked-out directory. There is + no need for further "checkout" commands. + + If you want to retrieve another module or directory to work on, you + must provide two pathnames: where to find it in the Repository and + where to put it on disk. The "modules" file and your current directory + supply two pieces of naming information. While inside a checked-out + working directory, the CVS administrative information provides most of + the rest. + + You should be careful not to confuse CVS with RCS and use "checkout" + in the RCS sense. An RCS "checkout" (which is performed by the RCS + "co" command) is closer to a "cvs update" than to a "cvs checkout". + + Last modified: _6/13/1997_ + + 6. How do I avoid dealing with those long relative pathnames? + + This question has also been phrased: + + How do I avoid all those layers of directories on checkout? or Why do + I have to go to the top of my working directory and checkout some long + pathname to get a file or two? + + This type of question occurs only among groups of people who decide + not to use "modules". The answer is to use "modules". + + When you hand the "checkout" command a relative pathname rather than a + module name, all directories in the path are created, maintaining the + same directory hierarchy as in the Repository. The same kind of + environment results if you specify a "module" that is really an alias + expanding into a list of relative pathnames rather than a list of + module names. + + If you use "module" names, "checkout" creates a single directory by + the name of the module in your current directory. This "module" + directory becomes your working directory. + + The "module" concept combines the ability to "name" a collection of + files with the ability to structure the Repository so that consistent + sets of files are checked out together. It is the responsibility of + the Repository Administrators to set up a modules file that describes + the software within the Repository. + + Last modified: _6/13/1997_ + + 7. Can I move a checked-out directory? Does CVS remember where it was + checked out? + + Yes and Yes. + + The ./CVS/Repository file in each working directory contains a + pathname pointing to the matching directory within the Repository. The + pathname is either absolute or relative to $CVSROOT, depending on how + you configured CVS. + + When you move a checked-out directory, the CVS administrative files + will move along with it. As long as you don't move the Repository + itself, or alter your $CVSROOT variable, the moved directory will + continue to be usable. + + CVS remembers where you checked out the directory in the "history" + file, which can be edited, or even ignored if you don't use the + "working directory" information displayed by the "history" command. + + Last modified: _6/13/1997_ + + 8. How can I lock files while I'm working on them the way RCS does? + + Until the day arrives of the all-powerful merge tool, there are still + files that must be accessed serially. For those instances, here's a + potential solution: + + Install a pre-commit program in the "commitinfo" file to check for + RCS locks. The program "rcslock.pl" performs this function. It can be + found in the contrib directory of the CVS source distribution. + + When you want to make a change to a file you know can't be merged, + first use "cvs admin -l" to lock the file. If you can't acquire the + lock, use the standard "locked out" protocol: go talk to the person + holding the lock. + + Make sure the pre-commit program prints a message and exits with a + non-zero status if someone besides the user running "commit" has the + file locked. This non-zero exist status will cause the "commit" to + fail cleanly. + + Make sure the pre-commit program exits with a zero status if the + file is either unlocked or locked by the user running "commit". The + "cvs commit" command that kicked off the pre-commit program will take + a zero exist status as an OK and checkin the file, which has the + side-effect of unlocking it. + + ===> The following is opinion and context. Don't read it if you are + looking for a quick fix. + + The topic of locking CVS files resurfaces on the network every so + often, producing the same results each time: + + The Big Endians: + + CVS was designed to avoid locks, using a copy-modify-merge model. + Locking is not necessary and you should take the time to learn the CVS + model which many people find workable. So why not get with the program + and learn how to think the CVS way? + + The Little Endians: + + The users determine how a tool is to be used, not the designers. We, + the users, have always used locking, our bosses demand locking, + locking is good, locking is God. I don't want to hear any more + lectures on the CVS model. Make locking work. + + Any organization making active changes to a source base will + eventually face the need to do parallel development. Parallel + development implies merges. (If you plan to keep separate copies of + everything and never merge, good luck. Tell me who you work for so I + can buy stock in your disk suppliers this year and sell your stock + short next year.) + + Merges will never go away. CVS chose to make "merges" stand front and + center as an important, common occurrence in development. It is one + way of looking at things. + + For free-format text, the merge paradigm gives you a considerable + amount of freedom. It does take a bit of management, but any project + should be ready to deal with it. + + On the other hand, there are many files that can't be merged using + text merge techniques. Straight text merge programs like "diff3" are + guaranteed to fail on executables (with relative branch statements), + files with self-referential counts stored in the file (such as TAGS + files), or files with relative motion statements in them (such as + Frame MIF files, many postscript files). They aren't all binary files. + + For these types of files, and many others, there are only two + solutions: + + Complex merge tools that are intimately aware of the contents of the + files to be merged. (ClearCase, and probably others, allow you to + define your own "files types" with associated "merge tools".) + + Serialization of access to the file. The only technical solution to + the problem of serialization is "locking". + + Since you can call a program that offers: + + "Which one do you want? A/B?" + + a "merge tool", more and more merge tools will appear which can be + hooked into a merge-intensive program like CVS. Think of a bitmap + "merge" tool that displays the bitmaps on the screen and offers a + "paint" interface to allow you to cut and paste, overlay, invert or + fuse the two images such that the result is a "merged" file. + + My conclusion is that the need for locking is temporary, awaiting + better technology. For large development groups, locking is not an + alternative to merging for text files. + + Last modified: _6/13/1997_ + + 9. What is "checkout -s"? How is it different from "checkout -c"? + + The '-c' and '-s' options to "checkout" both cause the modules file to + appear on standard output, but formatted differently. + + "checkout -c" lists the modules file alphabetized by the module name. + It also prints all data (including options like '-a' and "-o <prog>") + specified in the modules file. + + "checkout -s" lists the modules file sorted by "status" field, then by + module name. The status field was intended to allow you to mark + modules with strings of your choice to get a quick sorted report based + on the data you chose to put in the status fields. I have used it for + priority ("Showstopper", etc as tied into a bug database), for porting + status ("Ported", "Compiled", etc. when porting a large collection of + modules), for "assignee" (the person responsible for maintenance), and + for "test suite" (which automatic test procedure to run for a + particular module). + + Last modified: _6/13/1997_ + + Category: /Commands_/commit_ci_com/ + + " + "commit", "ci", "com"" + + 1. What is "commit" for? + + To store new revisions in the Repository, making them visible to other + users. + + Last modified: _6/13/1997_ + + 2. If I edit ten files, do I have to type "commit" ten times? + + No. The "commit" command will take multiple filenames, directory names + and relative pathnames on the command line and commit them all with + the same log message. If a file is unchanged, even if it is explicitly + listed on the command line, CVS will skip it. + + Like all CVS commands, "commit" will work on the whole directory by + default. Just type "cvs commit" to tell CVS to commit all modified + files (i.e. the files that "update" would display preceded by 'M') in + the current directory and in all sub-directories. + + Last modified: _6/13/1997_ + + 3. Explain: cvs commit: Up-to-date check failed for `<file>' + + You may not "commit" a file if your BASE revision (i.e. the revision + you last checked out, committed or retrieved via "update") doesn't + match the HEAD revision (i.e the latest revision on your branch, + usually the Main Branch). + + In other words, someone committed a revision since you last executed + "checkout", "update" or "commit". You must now execute "update" to + merge the other person's changes into your working file before + "commit" will work. You are thus protected (somewhat) from a common + form of race condition in source control systems, where a checkin of a + minor alteration of a second copy of the same base file obliterates + the changes made in the first. + + Normally, the "update" command's auto-merge should be followed by + another round of building and testing before the "commit". + + Last modified: _6/13/1997_ + + 4. What happens if two people try to "commit" conflicting changes? + + Conflicts can occur only when two developers check out the same + revision of the same file and make changes. The first developer to + commit the file has no chance of seeing the conflict. Only the second + developer runs into it, usually when faced with the "Up-to-date" error + explained in the previous question. + + There are two types of conflicts: + + When two developers make changes to the same section of code, the + auto-merge caused by "update" will print a 'C' on your terminal and + leave "overlap" markers in the file. + + You are expected to examine and clean them up before committing the + file. (That may be obvious to *some* of you, but . . .) + + A more difficult problem arises when two developers change different + sections of code, but make calls to, or somehow depend on, the old + version of each other's code. + + The auto-merge does the "right" thing, if you view the file as a + series of text lines. But as a program, the two developers have + created a problem for themselves. + + This is no different from making cross-referential changes in + *separate* files. CVS can't help you. In a perfect world, you would + each refer to the specification and resolve it independently. In the + real world you have to talk/argue, read code, test and debug until the + combined changes work again. + + Welcome to the world of parallel development. + + Last modified: _6/13/1997_ + + 5. I committed something and I don't like it. How do I remove it? + + Though you *can* use the "admin -o" (synonym: "rcs -o") command to + delete revisions, unless the file you committed is so embarrassing + that the need to eradicate it overrides the need to be careful, you + should just grab an old version of the file ("update -p -r + <previous-rev>" might help here) and commit it on top of the offending + revision. + + See Section 3B on "admin". + + Last modified: _6/13/1997_ + + 6. Explain: cvs commit: sticky tag `V3' for file `X' is not a branch + + The message implies two things: + + You created your working directory by using "checkout -r V3", or you + recently executed "update -r V3". + + The tag named V3 is not a branch tag. + + CVS records (i.e. makes "sticky") any "-r <tag/rev>" argument handed + to the "checkout" or "update" commands. The <tag/rev> is recorded as + the CVS working branch, which is the branch to which "commit" will add + a new revision. + + Branch tags are created when you use the -b switch on the "tag" or + "rtag" commands. Branch tags are magic tags that don't create a + physical branch, but merely mark the revision to branch from when the + branch is needed. The first commit to a magic branch creates a + physical branch in the RCS files. + + You can commit onto the end of the Main Trunk, if you have no sticky + tag at all, or onto the end of a branch, if you have a sticky branch + tag. But you can't commit a file that has a sticky tag not pointing to + a branch. CVS assumes a sticky Tag or Revision that does not refer to + a branch is attached to the middle of a series of revisions. You can't + squeeze a new revision between two others. Sticky dates also block + commits since they never refer to a branch. + + Scenario1: + + If you don't want a branch and were just looking at an old revision, + then you can move back to the Main Branch by typing: + + cvs update -A {files or dirs, default is '.'} + + or you can move to the branch named <branch_tag> by: + + cvs update -r <branch_tag> {files or dirs, default is '.'} + + Scenario2: + + If you really wanted to be on a branch and made an earlier mistake by + tagging your branch point with a non-branch tag, you can recover by + adding a new branch tag to the old non-branch tag: + + cvs rtag -b -r <oldtag> <newtag> <module> + + (It was not a big mistake. Branch-point tags can be useful. But the + <newtag> must have a different name.) + + If you don't know the <module> name or don't use "modules", you can + also use "tag" this way: + + cvs update -r <oldtag> + cvs tag -b <newtag> . + + Then, to put your working directory onto the branch, you type: + + cvs update -r <newtag> + + You can't delete <oldtag> before adding <newtag>, and I would not + advise deleting the <oldtag> at all, because it is useful in referring + to the branch point. If you must, you can delete the non-branch tag + by: + + cvs rtag -d <oldtag> <module> + or + cvs tag -d <oldtag> . + + Scenario3: + + If you made the same mistake as in Scenario2 (of placing a non-branch + tag where you wanted a branch tag), but really want <oldtag> to be the + name of your branch, you can execute a slightly different series of + commands to rename it and move your working directory onto the branch. + + Warning: This is not a way to rename a branch tag. It is a way to turn + a non-branch tag into a branch tag with the same name. + + cvs rtag -r <oldtag> <branch_point_tag> <module> + cvs rtag -d <oldtag> <module> + cvs rtag -b -r <branch_point_tag> <oldtag> <module> + + Then, if you really must, delete the <branch_point_tag>: + + cvs rtag -d <branch_point_tag> <module> + + Note: The unwieldy mixture of "tag" and "rtag" is mostly because you + can't specify a revision (-r <tag>) to the "tag" command. + + See 4C.3 for more info on creating a branch. + + Last modified: _6/13/1997_ + + 7. Why does "commit -r <tag/rev>" put newly added files in the Attic? + + If you specify "-r <rev>" (where <rev> is a dotted numeric number like + 2.4), it correctly sets the initial revision to <rev>, but it also + attaches the numeric <rev> as a sticky tag and throws the file into + the Attic. This is a bug. The obvious solution is to move the file out + of the Attic into the associated Repository directory and "update -A" + the file. There are no Tags to clean up. + + If you specify "-r <tag>" to commit a newly added file, the <tag> is + treated like a <branch_tag>, which becomes a symbolic RCS label + pointing to the string '1', which can be considered to be the "Main + branch number" when the main branch is still at revision 1.N. The file + is also thrown into the Attic. See 4C.8 for a way to recover from + this. + + In fact, a plain "commit" without the "-r" will throw a newly added + file into the Attic if you added it to a directory checked out on a + branch. See 3A.[2-5]. + + See Section 4C, on Branching, for many more details. + + Last modified: _6/13/1997_ + + 8. Why would a "commit" of a newly added file not produce rev 1.1? + + When committing a newly added file CVS looks for the highest main + branch major number in all files in the ./CVS/Entries file. Normally + it is '1', but if you have a file of revision 3.27 in your directory, + CVS will find the '3' and create revision 3.1 for the first rev of + <file>. Normally, the first revision is 1.1. + + Last modified: _6/13/1997_ + + Category: /Commands_/diff_di_dif/ + + " + "diff", "di", "dif"" + + 1. What is "diff" for? + + To display the difference between a working file and its BASE + revision (the revision last checked out, updated or committed): + + cvs diff <file> + + To display the difference between a working file and a committed + revision of the same file: + + cvs diff -r <tag/rev> <file> + + To display the difference between two committed revisions of the + same file: + + cvs diff -r <tag1/rev1> -r <tag2/rev2> <file> + + You can specify any number of <file> arguments. Without any <file> + arguments, it compares the whole directory. + + In the examples above, "-D <date>" may be substituted wherever "-r + <tag/rev>" appears. The revision a <date> refers to is the revision + that existed on that date. + + Last modified: _6/13/1997_ + + 2. Why did "diff" display nothing when I know there are later committed + revisions in the Repository? + + By default, "diff" displays the difference between your working file + and the BASE revision. If you haven't made any changes to the file + since your last "checkout", "update" or "commit" there is no + difference to display. + + To display the difference between your working file and the latest + revision committed to your current branch, type: + + cvs diff -r HEAD <file> + + Last modified: _6/13/1997_ + + 3. How do I display what changed in the Repository since I last executed + "checkout", "update" or "commit"? + + A special tag (interpreted by CVS -- it does not appear in the Tag + list) named "BASE" always refers to the revision you last checked out, + updated or committed. Another special tag named "HEAD" always refers + to the latest revision on your working branch. + + To compare BASE and HEAD, you type: + + cvs diff -r BASE -r HEAD <file> + + Last modified: _6/13/1997_ + + 4. How do I display the difference between my working file and what I + checked in last Thursday? + + cvs diff -D "last Thursday" <file> + + where "last Thursday" is a date string. To be more precise, the + argument to the '-D' option is a timestamp. Many formats are accepted. + See the man page under "-D date_spec" for details. + + Last modified: _6/13/1997_ + + 5. Why can't I pass long options, like --unified, to "diff"? + + CVS only handles single character '-X' arguments, not the FSF long + options. CVS also passes through only arguments it knows about, + because a few arguments are captured and interpreted by CVS. + + If you didn't configure RCS and CVS to use the GNU version of diff, + long options wouldn't work even if future versions of CVS acquire the + ability to pass them through. + + Most of the long options have equivalent single-character options, + which do work. The "--unified" option is equivalent to '-u' in + revisions of GNU diff since 1.15. + + Last modified: _6/13/1997_ + + Category: /Commands_/export_exp_ex/ + + " + "export", "exp", "ex"" + + 1. What is "export" for? + + "export" checks out a copy of a module in a form intended for export + outside the CVS environment. The "export" command produces the same + directory and file structure as the "checkout" command, but it doesn't + create "CVS" sub-directories and it removes all the RCS keywords from + the files. + + Last modified: _6/13/1997_ + + 2. Why does it remove the RCS keywords so I can't use the "ident" command + on the source files? + + It removes the RCS keywords, so that if the recipient of the exported + sources checks them into another set of RCS files (with or without + CVS), and then makes modifications through RCS or CVS commands, the + revision numbers that they had when you exported them will be + preserved. (That ident no longer works is just an unfortunate side + effect.) + + The theory is that you are exporting the sources to someone else who + will make independent changes, and at some point you or they will want + to know what revisions from your Repository they started with + (probably to merge changes, or to try to decide whether to merge + changes). + + A better way to handle this situation would be to give them their own + branch of your Repository. They would need to remember to checkin the + exported sources with RCS IDs intact (ci -k) so that their changes + would get revision numbers from the branch, rather than starting at + 1.1 again. Perhaps a future version of CVS will provide a way to + export sources this way. + + Contributed by Dan Franklin + + Last modified: _6/13/1997_ + + 3. Can I override the '-kv' flag CVS passes to RCS? + + Not as of CVS version 1.4. + + Last modified: _6/13/1997_ + + 4. Why doesn't "export" have a '-k' flag like "import" does? + + Export is intended for a specific purpose -- to remove all trace of + revision control on the way *out* of CVS. + + Last modified: _6/13/1997_ + + 5. Why does "export -D" check out every file in the Attic? + + See 5B.3 for an explanation of the same problem with "update". + + Last modified: _6/13/1997_ + + Category: /Commands_/history_hi_his/ + + " + "history", "hi", "his"" + + 1. What is "history" for? + + To provide information difficult or impossible to extract out of the + RCS files, such as a "tag" history or a summary of module activities. + + Last modified: _6/13/1997_ + + 2. Of what use is it? + + I have found it useful in a number of ways, including: + + Providing a list of files changed since + + + - A tagged release. + - Yesterday, last Thursday, or a specific date. + - Someone changed a specific file. + + Providing a list of special events: + + + - Files added or removed since one of the above events. + - Merge failures since one of the above events. (Where did the + conflicts occur?) + - Has anyone (and who) grabbed the revision of this file I committed + last week, or are they still working blind? + + Telling me how often a file/directory/module has been changed. + + Dumping a summary of work done on a particular module, including who + last worked on it and what changed. + + Displaying the checked-out modules and where they are being worked + on. + + To tell me what users "joe" and "malcolm" have done this week. + + Last modified: _6/13/1997_ + + 3. What is this, Big Brother? + + War is Peace. + Freedom is Slavery. + Ignorance is Strength. + + Normally manager types and those with the power to play Big Brother + don't care about this information. The Software Engineer responsible + for integration usually wants to know who is working on what and what + changed. Use your imagination. + + Last modified: _6/13/1997_ + + 4. I deleted my working directory and "history" still says I have it + checked out. How do I fix it? + + You can use "release -f" to forcibly add a "release" record to the + history file for a working directory associated with a "module". If + your version of "release" doesn't have the '-f' option, or you checked + out the directory using a relative path, you have to edit the + $CVSROOT/CVSROOT/history file. + + You can remove the last 'O' line in the history file referring to the + module in question or add an 'F' record. + + Last modified: _6/13/1997_ + + 5. So I *can* edit the History file? + + Yes, but if you are using history at all, you should take a little + care not to lose information. I normally use Emacs on the file, since + it can detect that a file has changed out from under it. You could + also copy and zero out the history file, edit the copy and append any + new records to the edited copy before replacing it. + + Last modified: _6/13/1997_ + + 6. Why does the history file grow so quickly? + + It stores 'U' records, which come in handy sometimes when you are + tracking whether people have updated each other's code before testing. + There should (and probably will sometime) be a way to choose what + kinds of events go into the history file. + + The contributed "cln_hist.pl" script will remove all the 'U' records, + plus matching pairs of 'O' and 'F' records during your normal clean up + of the history file. + + Last modified: _6/13/1997_ + + 7. What is the difference between "cvs history -r <tag/rev>" and "cvs + history -t <tag>"? + + The '-t' option looks for a Tag record stored by "rtag" in the history + file and limits the search to dates after the last <tag> of the given + name was added. + + The '-r' option was intended to search all files looking for the <tag> + in the RCS files. It takes forever and needs to be rewritten. + + Last modified: _6/13/1997_ + + 8. Why does "cvs history -c -t <tag>" fail to print anything? + + You have been using "tag" instead of "rtag". The "tag" command + currently doesn't store a history record. This is another remnant of + CVS's earlier firm belief in "modules". But it also has a basis in how + "rtag" and "tag" were originally used. + + "rtag" was intended for large-scale tagging of large chunks of the + Repository, an event work recording. "tag" was intended for adding and + updating tags on a few files or directories, though it could also be + used to tag the entire checked-out working tree when there is no + module defined to match the tree or when the working tree is the only + place where the right collection of revisions to tag can be found. + + Last modified: _6/13/1997_ + + 9. "cvs history -a -o" only printed one line for each checked-out module. + Shouldn't it print all the directories where the modules are checked out? + + Not as designed. + + Command Question it is supposed to answer. + ---------------- ------------------------------------------ + cvs history -o What modules do I have checked out? + cvs history -a -o <same for all users> + + cvs history -o -w What working directories have I created + and what modules are in them? + cvs history -a -o -w <same for every user> + + The -o option chooses the "checked out modules" report, which is the + default history report. + + Last modified: _6/13/1997_ + + 10. I can't figure out "history", can you give me concrete examples? + + Default output selects records only for the user who executes the + "history" command. To see records for other users, add one or more "-u + user" options or the '-a' option to select *all* users. + + To list (for the selected users): Type "cvs history" and: + + + * Checked out modules: -o (the default) + * Files added since creation: -x A + * Modified files since creation: -c + * Modified files since last Friday: -c -D 'last Friday' + * Modified files since TAG was added: -c -t <tag> + * Modified files since TAG on files: -c -r <tag> + * Last modifier of file/Repository X? -c -l -[fp] X + * Modified files since string "str": -c -b str + * Tag history: (Actually "rtag".) -T + * History of file/Repository/module X: -[fpn] X + * Module report on "module": -m module + + Last modified: _6/13/1997_ + + 11. Can we merge history files when we merge Repositories? + + Assuming that the two Repositories have different sets of pathnames, + it should be possible to merge two history files by sorting them + together by the timestamp fields. + + You should be able to run: + + sort +0.1 ${dir1}/history ${dir2}/history > history + + If you "diff" a standard history file before and after such a sort, + you might see other differences caused by garbage (split lines, nulls, + etc) in the file. If your Repository is mounted through NFS onto + multiple machines you will also see a few differences caused by + different clocks on different machines. (Especially if you don't use + NTP to keep the clocks in sync.) + + Last modified: _6/13/1997_ + + Category: /Commands_/import_im_imp/ + + " + "import", "im", "imp"" + + 1. What is "import" for? + + The "import" command is a fast way to insert a whole tree of files + into CVS. + + The first "import" to a particular file within the Repository creates + an RCS file with a single revision on the "Vendor branch." Subsequent + "import"s of the same file within the Repository append a new revision + onto the Vendor branch. It does not, as some seem to believe, create a + new branch for each "import". All "imports" are appended to the single + Vendor branch. + + If the file hasn't changed, no new revision is created -- the new + "Release-Tag" is added to the previous revision. + + After the import is finished, files you have not changed locally are + considered to have changed in the "Main line of development". Files + you *have* changed locally must have the new Vendor code merged into + them before they are visible on the "Main line". + + See 4C.6 and 4C.15 + + Last modified: _6/13/1997_ + + 2. How am I supposed to use "import"? + + Create a source directory containing only the files you want to + import. Make sure you clean up any cruft left over from previous + builds or editing. You want to make sure that the directory contains + only what you want to call "source" from which everything else is + built. + + If this is not the first import from this "Vendor", you should also + compare the output of "find . ! -name CVS -print | sort" executed both + at the head of a checked out working directory and at the head of the + sources to be imported. If you find any deleted or renamed files, you + have to deal with them by hand. (See 4B.8 on renaming.) + + "cd" into your source directory and type: + + cvs import -m "Message" <repos> <Vendor-Tag> <Release-Tag> + + where <repos> is the relative directory pathname within the Repository + that corresponds to the sources you are importing. + + You might also consider using the "-I !" option to avoid ignoring + anything. It is easier to remove bogus files from the Repository than + to create a sparse tree of the ignored files and rerun "import". + + For example, if the FSF, CVS, Make and I are still active in the year + 2015, I'll import version 89.53 of GNU make this way: + + cvs import -m "GNUmake V89.53" gnu/make GNU GNUMAKE_89_53 + + See 3H.13 for more details. + + Last modified: _6/13/1997_ + + 3. Why does import put files on a branch? Why can't I work on the main + trunk instead of a Vendor branch? + + This was a Design choice. The Vendor branch is the way "import" deals + with a Vendor release. It is a solution to the Engineering problem of + how to merge multiple external releases of Vendor-supplied sources + into your ongoing work. The Vendor releases are kept on a separate, + special, "Vendor" branch and your work is kept on the RCS trunk. New + Vendor releases are imported onto the Vendor branch and then merged + into your work, if there is any, on the trunk. + + This way, you can use CVS to find out not only about your work, but + you can also find out what the Vendor changed by diffing between two + of the Release Tags you handed to "import". + + CVS was designed to work this way. If you use CVS in some other way, + you should think carefully about what you are doing. + + Note that the CVS "Main Branch" and the RCS Main Trunk are not the + same. Placing files on the Vendor Branch doesn't keep you from + creating a development branch to work on. + + See Section 4C, on Branching. + + If you are not working with 3rd party (i.e. Vendor) sources, you can + skip the "import" and avoid the Vendor branch entirely. It works just + as well to move pre-existing RCS files into Repository directories. + + You can create a whole Repository tree by copying a directory + hierarchy of normal source files directly into the Repository and + applying CVS to it. Here's an idea you should *test* before using: + + cd <your source tree> + set source = `pwd` + set module = xyzzy <<== Your choice of directory name + mkdir $CVSROOT/$module + cd $CVSROOT/$module + (cd $source; tar cf - .) | tar xvpBf - + find . -type f -exec ci -t-Original. {} \; + + The RCS "ci" command, without -u or -l options, will turn your source + file into an RCS (",v") and delete the original source. + + Last modified: _6/13/1997_ + + 4. Is there any way to import binary files? + + If you configured CVS to use the GNU version of "diff" and "diff3", + then you can import any kind of file. + + Binary files with RCS keywords in them are a problem, since you don't + want them to expand. + + If the tree you are about to "import" is entirely filled with binary + files, you can use the '-ko' option on "import". Otherwise, I would + run the import normally, then fix the binary files as described below + in 3H.5. + + See 4D.1 on Binary files. + + Last modified: _6/13/1997_ + + 5. Why does "import" corrupt some binary files? + + The RCS "co" command, when it is invoked by a CVS "checkout" or + "update" (or after a "commit") command, searches for and expands a + list of keywords within the file. They are documented in the RCS "co" + man page. Strings such as "$\Id$" (or "$\Id:"), or "$\Revision$" (or + "$\Revision:") are altered to the include the indicated information. + + [[Note: The keywords should appear in the text without the '\' + character I have inserted to *avoid* expansion here. The only real RCS + keywords in this document are at the top of the file, where I store + the Revision and Date.]] + + If RCS keyword strings show up in a binary file, they will be altered + unless you set the '-ko' option on the RCS files to tell RCS to keep + the original keyword values and not to expand new ones. After + "import", you can set the '-ko' option this way: + + cvs admin -ko <file> + rm <file> + cvs update <file> + + After an import that didn't use '-ko' (because the whole tree wasn't + of binary files) you should fix up the binary files as described above + before checking out any new copies of the files and before updating + any working directories you checked out earlier. + + See 4D.1 on Binary files. + + Last modified: _6/13/1997_ + + 6. How do I retain the original $\Revision$ strings in the sources? + + If you want to leave old RCS keywords as they are, you can use the + '-ko' tricks described above. + + Last modified: _6/13/1997_ + + 7. I imported some files for the Yarg compiler that compiles files with a + suffix of ".yarg" and whose comment prefix is "YARG> ". When I check them + out, they will no longer compile because they have this junk in them. Why? + + YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG> + YARG> $\Log: + # Revision 1.3 1998/03/03 00:16:16 bubba + # What is 2+2 anyway? + # + # Revision 1.2 1998/03/03 00:15:15 bubba + # Added scorekeeping. + YARG> + YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG>YARG> + + Well bubba, "Yarg" hasn't hit the big time yet. Neither RCS nor CVS + know about your suffix or your comment prefix. So you have two + choices: + + Check out the Yarg-less module, and tell all the files about your + comment prefix. Visit each directory and type: + + cvs admin -c"YARG> " *.yarg + + If *all* files in the whole directory tree are Yarg files, you can use + this instead: + + cvs admin -c"YARG> " . + + Then save any changes you made, remove all the "*.yarg" files and grab + new copies from the Repository: + + rm *.yarg (or: find . -name '*.yarg' -exec rm {} ';') (or: find . + -name '*.yarg' -print | xargs rm) (or: find . -name '*.yarg' -print0 | + xargs -0 rm if you have spaces in filenames and the GNU find/xargs.) + cvs update + + It might be faster to remove the whole directory and check it out + again. + + Change the import.c file in the CVS sources and add the .yarg + suffix, along with the "YARG> " comment prefix to the "comtable" + array. + + If you ever plan to add new files with $\Log in them, you should also + go into the RCS sources and make the same change in the table + contained in the "rcsfnms.c" file. + + Then delete the imported files from the Repository and re-"import" the + sources. + + Last modified: _6/13/1997_ + + 8. How do I make "import" save the timestamps on the original files? + + Use "import -d" to save the current timestamps on the files as the RCS + revision times. + + See 4D.8 for another aspect of file timestamps. + + Last modified: _6/13/1997_ + + 9. Why can't I "import" 3 releases on different branches? + + I'll bet you typed something like this: + + cd /src/blasto.v2 + cvs import -b 1.1.2 VENDOR2 Version2 + cd /src/blasto.v3 + cvs import -b 1.1.3 VENDOR3 Version3 + cd /src/blasto.v4 + cvs import -b 1.1.4 VENDOR4 Version4 + + This is wrong, or at least it won't help you much. You have created + three separate Vendor branches, which is probably not what you wanted. + + Earlier versions of CVS, as described in Brian Berliner's Usenix + paper, tried to support multiple Vendor branches on the theory that + you might receive source for the *same* program from multiple vendors. + It turns out that this is very rare, whereas the need to branch in + *your* development, for releases and for project branches, is much + greater. + + So the model now is to use a single vendor branch to contain a series + of releases from the same vendor. Your work moves along on the Main + Trunk, or on a CVS branch to support a real "branch in development". + + To set this up, you should type this instead of the above: + + cd /src/blasto.v2 + cvs import VENDOR Version2 + cd /src/blasto.v3 + cvs import VENDOR Version3 + cd /src/blasto.v4 + cvs import VENDOR Version4 + + Last modified: _6/13/1997_ + + 10. What do I do if the Vendor adds or deletes files between releases? + + Added files show up with no extra effort. To handle "removed" files, + you should always compare the tree structure of the new release + against the one you have in your Repository. If the Vendor has removed + files since the previous release, go into a working directory + containing your current version of the sources and "cvs remove" + (followed by "cvs commit" to make it really take effect) each file + that is no longer in the latest release. + + Using this scheme will allow you to "checkout" any version of the + vendor's code, with the correct revisions and files, by using + "checkout -r Version[234]". + + Renames are harder to find, since you have to compare file contents to + determine that one has occurred. If you notice one, see 4B.8 on + renaming files. + + Last modified: _6/13/1997_ + + 11. What about if the Vendor changes the names of files or directories, or + rearranges the whole structure between releases? + + Currently CVS can't handle this cleanly. It requires "renaming" a + bunch of files or directories. + + See 4B.8 on "renaming" for more details. + + What I generally do is to close the Repository for a while and make + changes in both the Repository and in a copy of the vendor release + until the structure matches, then execute the import. + + If you ever have to check out and build an old version, you may have + to use the new, or completely different Makefiles. + + Last modified: _6/13/1997_ + + 12. I thought "import" was for Vendor releases, why would I use it for code + of my own? Do I have to use import? + + For code you produce yourself, "import" is a convenience for fast + insertion of whole trees. It is not necessary. You can just as easily + create ",v" files using the RCS "ci" command and move them directly + into the Repository. + + Other than the CVSROOT directory, the Repository consists entirely of + directories of ",v" files. The Repository contains no other state + information. + + See Section 4B, on Setting up and Managing the Repository. + + Last modified: _6/13/1997_ + + 13. How do I import a large Vendor release? + + When the sum of the changes made by the Vendor and the changes made by + local developers is small, "import" is not a big problem. But when you + are managing a large Repository, any care taken up front will save you + time later. + + First read the following, then, before executing "import", see the + questions in Section 4C dealing with branch merges and Vendor branch + merges. + + If this is not the first import of this code, before starting, rtag + the whole directory you will be changing. + + The first step is to make sure the structure of the new files + matches the structure of the current Repository. + + Run "find . -print | sort" on both trees and "diff" the output. + + Alter the "source" tree until the "diff" (of the list of filenames, + not of the whole trees) shows that the directory structures are + equivalent. + + The "comm" command, if you have it, can help figure out what has been + added or deleted between releases. + + If they deleted any files, you can handle them cleanly with "cvs + remove". The command "comm -23 files.old files.new" will show you a + list of files that need to be removed. + + You should examine the list first to see if any have been renamed + rather than simply deleted. + + If they renamed any files, see 4B.8 on renaming files. + + Remember to *SAVE* the output from the import command. + + When you have dealt with removed and renamed files, then you can + execute the import: + + cd <new source> + cvs import -I ! -m "Message" <repos> <VendorTag> <ReleaseTag> + + Where + + "-I !" is an optional argument that keeps "import" from ignoring + files. The comparison of the "find" commands above will probably avoid + the need for this, but it is easier to remove files from the + Repository than to run a subset "import" to catch just the ignored + files. [You might have to quote or backwhack the '!'.] + + Message is the log message to be stored in the RCS files. + + <repos> is a relative path to a directory within the + Repository. The directory <new source> must be at + the same relative level within the new sources as + the <repos> you give is within the Repository. (I + realize this is not obvious. Experiment first.) + + <VendorTag> is a Tag used to identify the Vendor who sent you + the files you are importing. All "imports" into + the same <repos> *must* use the same VendorTag. + You can find it later by using the "log" command. + + <ReleaseTag> is a Tag used to identify the particular release of the + software you are importing. It must be unique and should be mnemonic + -- at least include the revision number in it. (Note: you can't use + '.' characters in a Tag. Substitute '_' or '-'.) + + There will be six categories of files to deal with. (Actually there + are eight, but you have already dealt with "removed" and "renamed" + files.) + + If this is the first "import" into a given <repos> directory, only the + first three of these ('I', 'L' and 'N') can occur. + + Ignored file. + + CVS prints: I filename + + You'll need to examine it to see if it *should* have been ignored. If + you use "-I !", nothing will be ignored. + + Symbolic link. + + CVS prints: L linkname + + Links are "ignored", but you'll probably want to create a "checkout + helper" function to regenerate them. + + New file. + + CVS prints: N filename + + CVS creates a new file in the Repository. You don't have to do + anything to the file, but you might have to change Makefiles to refer + to it if this is really a new file. + + A file unchanged by the Vendor since its last release. + + CVS prints: U filename + + CVS will notice this and simply add the new ReleaseTag to the latest + rev on the Vendor branch. + + No work will be needed by you, whether you have changed the file or + not. No one will notice anything. + + A file changed by the Vendor, but not by you. + + CVS prints: U filename + + CVS should add the file onto the vendor branch and attach the Release + Tag to it. + + When you next execute "update" in any working directory you'll get the + new revision. + + A file changed by both the Vendor and by you. + + CVS prints: C filename + + These are the trouble files. For each of these files (or in groups -- + I usually do one directory at a time), you must execute: + + cvs update -j <PreviousReleaseTag> -j <ReleaseTag> + or + cvs update -j <VendorTag:yesterday> -j <VendorTag> + + It will print either 'M' (if no overlaps) or 'C', if overlaps. If a + 'C' shows up, you'll need to edit the file by hand. + + Then, for every file, you'll need to execute "cvs commit". + + See the part of Section 4C dealing with branch merges. + + If you are truly performing a large import, you will most likely + need help. Managing those people is another problem area. + + Since the merge of the Vendor branch is just like any other merge, you + should read section 4C for more info about performing and cleaning up + merges. + + The larger the import, and the larger the group of people involved, + the more often you should use "tag" and "rtag" to record even trivial + milestones. See 4C.14, especially the "paranoid" section. + + Before starting the import, you should install and test a "commitinfo" + procedure to record all commits in a file or via Email to a mail + archive. Along with the tags you placed on the Repository before the + import, this archive will help to track what was changed, if problems + occur + + There are four stages to the recovery: + + Parcel out the work -- Effective Emacs Engineering. + + As input to the assignment process, you might want to examine the tree + and record the last person who changed the file. You can also + research, if you don't already know, who is expert in each area of the + software. + + Examine the import log (you saved the output, right?), estimate how + much work is involved in each area and assign groups of files to + individual developers. Unless some directory is immense, it is easier + to manage if you assign whole directories to one person. + + Keep a list. Suggest a completion date/time. Tell them to "commit" the + file when they are finished with the merge. If you tagged the + Repository before starting the import, you should have no trouble + figuring out what happened. + + If you can, find out (or tell them) which working directory to use. + You should verify that the working directory they use is on the Main + Branch ("update -A") and without modified files. + + If you trust your crew, have them notify you by Email. Have them send + you the output from "cvs update" in their working directory. You might + have to poll some people until you are certain they have finished, or + have given up. (This is not an invention. I've heard a false, "Yeah, + sure. I finished yesterday," more times that you'd believe.) + + When all reports are in, go on to the Source Verification stage. + + Source Verification -- CVS and other Tools. + + If you didn't dictate which ones to use, find all working directories + and run "cvs -n update" in all of them. The history command and the + "commitinfo" log you set up might help to find checked out working + directories. + + Sticky conflict flags will help, but they can't recover from + sloppiness or incompetence. You might want to check everything out + into a tree and grep for the parts of the merge conflict markers CVS + doesn't look for. CVS looks for the string '^>>>>>>> '. The merge + operation also puts '^<<<<<<< ' and '^======= ' markers in the file + that careless developers might leave there. + + If you find problems simply by looking at the source files and working + directories, start the flogging now. Resolving the textual conflicts + is the easy part. Weed the turkeys out before reaching the next part + of the cleanup -- the resolution of logical conflicts. + + Then apply a set of post-commit tags. + + Logical Verification -- Diff and powerful eyeballs. + + No source control system can solve the problem of resolving + distributed conflicts in program logic. If you change the argument + template for function A (defined in file A.c) and add new calls to + function A from within function B (defined in file B.c) using the old + argument format, you are outside the realm of CVS's competence. + + Assign someone to understand what the Vendor changed by running "cvs + diff -c -r <PreviousReleaseTag> <ReleaseTag>", where the tags were + those handed to the last two invocations of "import". + + Then have the same person compare that output (logically or you can + actually diff the diffs) to the output of the similar "cvs diff -c -r + <pre-import-tag> <post-commit-tag>". The two sets of differences + should be almost identical. They should both show only the work *you* + have performed. + + Product Verification -- Build and Test. + + Don't let your help off the hook until you verify that the merge + actually produced something that can compile and pass tests. Compiling + should really be part of the logical verification phase, but you + should test the output of the build system before declaring victory + and releasing the troops. + + After it is all built, apply another set of tags to mark the end of + the "import process". You can delete the intermediate tags you added + during source and logic testing, but keep the "pre-import" and + "post-import" tags forever. + + Of course, experience can tell you when to skip a step. But I'd start + out by considering each one as necessary unless you can prove + otherwise. + + Last modified: _6/13/1997_ + + 14. Explain: ERROR: cannot create link to <file>: Permission denied + + This error appears when you try to execute a second (or later) + "import" into the same module from a directory to which you don't have + write access. + + The "link error" is caused by a feature purposely added to speed up + the import. + + Though the error message is somewhat strange, it indicates that + "import" is supposed to be executed only in writable directories. + + Last modified: _6/13/1997_ + + 15. Where does the -m <message> go when the file doesn't change? + + The <message> handed to import is used as an RCS log message, but only + if the imported file changed since the last version on the Vendor + branch. If the imported file hasn't changed, then no new revision is + created. The <ReleaseTag> is still applied, but to the previous + revision. So the Tags are still correct, but the message is lost. + + Maybe it should be appended to the previous log message. But currently + it isn't. + + Last modified: _6/13/1997_ + + 16. How do I "import" just the files ignored by a previous "import"? + + A real answer follows, but first, an editorial: + + I am now convinced that you should always use the "-I !" option. + Removing a few extraneous files from the Repository is a lot easier + than the recovery step described below. + + Let's assume your original import procedure was: (We assume there is + enough disk space in /tmp.) + + cd <head-of-vendor-tree> + cvs import -m 'xyz 1.3' gnu/xyz GNU GNUXYZ_1_3 | tee /tmp/IMP + + To import just the files ignored by "import", I would do this: + + Create a list of the ignored files to import: + + cd <head-of-vendor-tree> awk '/^I / {print $2}' /tmp/IMP | sed + 's|^gnu/xyz/||' > /tmp/IG [Edit the IG file to contain just the files + you want.] + + Then create a sparse directory by handing your list to the GNU + version of "tar", installed in many places as "gtar": + + mkdir /tmp/FIXUP gtar -T /tmp/IG -c -f - . | (cd /tmp/FIXUP; gtar xvBf + -) + + Then rerun the import. Use the exact same command, but execute it in + the sparse directory tree you just created. And this time, tell it not + to ignore anything. + + cd /tmp/FIXUP + cvs import -I ! -m 'xyz 1.3' gnu/xyz GNU GNUXYZ_1_3 + + Last modified: _6/13/1997_ + + 17. Why did "import" ignore all the symlinks? + + This is another design choice. + + Like the Unix "tar" command, "import" could sprout an option to follow + symbolic links, but I don't think CVS will ever follow symbolic links + by default. + + Two possible future enhancements have been seriously discussed: + + Treat symbolic links as data in its parent directory (the way + ClearCase does) in some sort of per-directory control file. + + Treat symbolic links as version-controlled elements themselves, + whose data is the value of readlink(2). + + For now, they are simply ignored. + + If you want to save and reconstruct symlinks, you might want to define + a "checkout" or "update" program in the modules file which could + consult a file kept under CVS in your working directory and make sure + the specified links are in place. + + Last modified: _6/13/1997_ + + Category: /Commands_/log_lo_rlog/ + + " + "log", "lo", "rlog"" + + 1. What is "log" for? + + To provide an interface to the RCS "rlog" command, which displays + information about the underlying RCS files, including the revision + history and Tag (RCS calls it a "symbol") list. + + Last modified: _6/13/1997_ + + 2. How do I extract the log entries between two revisions? + + If both <rev1> and <rev2> are on the same branch, you can get what you + are looking for with: (If they aren't on the same branch you'll either + get an error or a display of the whole change log.) + + cvs log -r<rev1>:<rev2> <file> + + If you want all the revisions on the branch from <rev1> to the end of + the branch <rev1> is on, you can use: + + cvs log -r<rev1>: <file> + + (If <rev1> is a numeric RCS symbol attached to a branch revision with + an even number of '.'s in it, you get the whole branch.) + + If you want all the revisions on the branch from the beginning of the + branch <rev2> is on up to revision <rev2>, you can use: + + cvs log -r:<rev2> <file> + + Note: Depending on whether <rev1> and <rev2> are: + + - numeric or symbolic + - in the file or not + - on the same branch or not + + the RCS "rlog" (and therefore the "cvs log") command will + display some combination of: + + - error messages + - (intuitively correct) partial log listings + - a display of the entire change log. + + Last modified: _6/13/1997_ + + 3. How do I extract the log entries on a whole branch? + + cvs log -r<rev> <file> + + where <rev> must be a branch revision (one with an even number of + dots) or a *non-branch* tag on a branch revision. Non-branch tags on a + branch revision are not normally attached by CVS, to add one you will + have to explicitly tag a physical branch number within each file. + Since these branch numbers are almost never the same in different + files, this command is not all that useful. + + The intuitive command (at least from the CVS perspective): + + cvs log -r<branch_tag> <file> + + does not work. + + Last modified: _6/13/1997_ + + 4. How do I generate ChangeLogs from RCS logs? + + A program called rcs2log is distributed as part of GNU Emacs 19. A + (possibly older) version of this program appears in the contrib + directory of the cvs source tree. + + Last modified: _6/13/1997_ + + 5. Why does "log" tell me a file was committed exactly 5 hours later + + than I know it was? + + I can tell by this question that you were working in a time zone that + is 5 hours behind GMT (e.g. the U.S. East Coast in winter). + + RCS file dates are stored in GMT to allow users in different time + zones to agree on the meaning of a timestamp. At first glance this + doesn't seem necessary, but many companies use distributed file + systems, such as NFS or AFS, across multiple timezones. + + Some standard form must be used. GMT, as the "grid origin", is an + obvious candidate. The only other reasonable choice is to put the + timezone information in all the time stamps, but that changes the RCS + file format incompatibly, a step which has been avoided in the last + few RCS releases. + + Last modified: _6/13/1997_ + + Category: /Commands_/patch_pa_rdiff/ + + " + "patch", "pa", "rdiff"" + + 1. What is "patch" for? + + To produce a "diff" between tagged releases to be handed to the + "patch" command at other sites. This is the standard way that source + patches are distributed on the network. + + Last modified: _6/13/1997_ + + 2. Why does "patch" include files from the Attic when I use '-D'? + + See the explanation of the same problem with "update -D" contained in + section 5B. + + Last modified: _6/13/1997_ + + 3. How do I make "patch" produce a patch for one or two files? It seems to + work only with modules. + + Patch is intended for producing patches of whole modules between + releases to be distributed to remote sites. Instead of "patch", you + can use the "diff" command with the '-c' context option: + + cvs diff -c -r <rev/tag> -r <rev/tag> <file1> . . . + + The patch command will be able to merge such a "diff" into the remote + source files. + + If you configured CVS to use a version of "diff" that supports the + '-u' option, you can produce a more compact "patch" in "unidiff" + format. The latest revisions of the patch command can parse and apply + patches in "unidiff" format. + + Last modified: _6/13/1997_ + + Category: /Commands_/release_re_rel/ + + " + "release", "re", "rel"" + + 1. What is "release" for? + + To register that a module is no longer in use. It is intended to + reverse the effects of a "checkout" by adding a record to the history + file to balance the checkout record and by optionally allowing you to + delete the checked-out directory associated with the module name. + + Last modified: _6/13/1997_ + + 2. Why can't I reverse a "cvs checkout path/name/subdir" with a "cvs + release path/name/subdir" without an "unknown module name"? + + A simplistic implementation. (I can say this -- I wrote it.) + + The "release" function was written for CVS 1.2 under the assumption + that the "module name" is a first class, unavoidable interface to the + Repository, allowing no way to retrieve anything other than by module + name. Though it is easier to program that way, many users of CVS + believe the modules support to be too primitive to allow such a + limitation. + + Since "release" was written, other parts of CVS broke that assumption. + It needs to be revised. + + Last modified: _6/13/1997_ + + 3. Why can't I "release" portions of a checked out directory? I should be + able to "release" any file or sub-directory within my working directory. + + This isn't really a limitation in "release", per se. CVS doesn't try + to keep track of which files in which directories are "checked out" + and which are just lying there. You can delete directories and + "update" will not bring them back unless you add a special "-d" + option. + + In other words, CVS doesn't keep track of how you adjust the partition + between files you consider part of your working set and files that + were checked out because they are part of the same module or + directory. And neither does "release". + + In future CVS releases, "release" might become sophisticated enough to + handle both the reversal of a "checkout" and the deletion of random + portions of the working directory, but it isn't that way now. + + Last modified: _6/13/1997_ + + 4. I removed the tree that I was about to start working on. How do I tell + cvs that I want to release it if I don't have it anymore? + + See 3G.4. + + Last modified: _6/13/1997_ + + 5. Why doesn't "release -d module" reverse a "checkout module"? + + It does, if you are using "module" in a way that "release" expects: a + non-alias string in the left column of the "modules" database. + + If "module" is really an alias, or if you are using a relative path in + the place of "module", or if you renamed the directory with the -d + option in the modules file or on the "checkout" command line, then the + current version of "release" won't work. + + Future versions of "release" will probably fix most of these. + + Last modified: _6/13/1997_ + + 6. Why can't I release a module renamed with "cvs checkout -d"? + + The current version of "release" doesn't know how to track the + renaming option ('-d') of the "checkout" command. It will probably be + fixed in the future. + + Last modified: _6/13/1997_ + + Category: /Commands_/remove_rm_delete/ + + " + "remove", "rm", "delete"" + + 1. What is "remove" for? + + To remove a file from the working branch. It removes a file from the + main branch by placing it in an "Attic" directory. + + Last modified: _6/13/1997_ + + 2. Why doesn't "remove" work on directories when it appears to try? + + Oversight. It should be able to delete an empty directory, but you + still don't have a way to remember when it was there and when it + disappeared to allow the "-D " option to work. + + You'll have to remove the working directory and the matching directory + in the Repository. + + Note that you want to do a _cvs remove dir_ in the working directory, + do a cvs commit, and then do a _rmdir dir_ in the Repository. + (msusrtsp.mark at eds dot com) + + Last modified: _12/18/1997_ + + 3. I don't like removing files. Is there another way to ignore them? + + There's no reason to be hasty in using the "remove" command. + + If there is a way to ignore files in your build procedures, I'd just + do that. Later, when you decide that the files are really ancient, you + can execute a "remove" command to clean up. + + The CVS "ignore" concept can't ignore files already in CVS. + + Last modified: _6/13/1997_ + + 4. I just removed a file. How do I resurrect it? + + If you executed "remove", but haven't typed "commit" (you can tell + this by the 'R' notation that "update" prints next to the file), you + can execute "add" to reverse the "remove". + + If you followed the "remove" with a "commit", you'll have to move it + back out of the Attic by hand: + + I use something like this: (csh-like syntax) + + set repos = `cat ./CVS/Repository` + mv $repos/Attic/filename,v $repos/filename,v + + (If you use relative paths in your Repository files, that first line + becomes: set repos = $CVSROOT/`cat ./CVS/Repository`) + + While a file is in the Attic, you can't "add" another file by the same + name. To add such a file you either have to move it by hand as in the + above, or delete it from the Attic. + + The main reason for the Attic is to retain files with tags in them. If + you execute: "update -r <oldtag>", files with <oldtag> attached to + some revision will be taken from the normal Repository area and from + the Attic. That's why you can't "add" a file with the same name. + "remove" only moves a file off the main branch, it doesn't obliterate + it. + + Last modified: _6/13/1997_ + + 5. Why doesn't "remove" delete the file? Instead, it prints an error + message and tells me to remove the file by hand. + + Design choice. Unix software written within last decade, usually + requires an extra verification step, such as answering a question or + adding a flag on the command line. CVS currently requires that you + delete the file first unless you specify the '-f' (force) option, + which deletes the file before performing "cvs remove". + + Last modified: _6/13/1997_ + + Category: /Commands_/rtag_rt_rfreeze/ + + " + "rtag", "rt", "rfreeze"" + + 1. What is "rtag" for? + + To add a symbolic label (a "tag") to the last committed revisions of a + module directly in the Repository. + + Last modified: _6/13/1997_ + + 2. Why use "rtag"? It assumes no one is changing the Repository. + + Though the "tag" command is more useful in marking the revisions you + have in a particular working directory, "rtag" is much handier for + whole-Repository actions, which occur at major release boundaries. + + Last modified: _6/13/1997_ + + 3. What revision does "rtag -r <tag1> <tag2>" actually put the tag on? + + In short, the '-r' option is another way to select the revision to + tag. The revision is selected the same way for all commands that + accept a "-r <tag/rev>" option. + + Depending on whether <tag1> is a <branch_tag>, or a non-branch <tag> + and on whether you use the '-b' option to "rtag", you get four + different results: + + rtag -r <tag1> <tag2> + + Adds the non-branch tag <tag2> to the same revision that the + non-branch tag <tag1> is attached to. + + Example: + <tag1> --> TT1 + <tag2> --> TT2 + <file> --> Symbols: TT1:1.4 + After --> Symbols: TT1:1.4,TT2:1.4 + + rtag -r <branch_tag1> <tag2> + + Adds the non-branch tag <tag2> to the HEAD of (the highest revision + number on) the branch labelled with tag <branch_tag1>. + + Example: + <branch_tag1> --> BR1 + <tag2> --> TT2 + <file> --> Symbols: BR1:1.2.0.2 (1.2.2.5 is HEAD) + After --> Symbols: BR1:1.2.0.2,TT2:1.2.2.5 + + If the branch tagged by <branch_tag1> has not been created, then the + tag shows up on the branch point revision: + + Example: + <branch_tag1> --> BR1 + <tag2> --> TT2 + <file> --> Symbols: BR1:1.2.0.2 (No 1.2.X exists.) + After --> Symbols: BR1:1.2.0.2,TT2:1.2 + + rtag -b -r <tag1> <branch_tag2> + + Adds the magic branch tag <branch_tag2> to the revision that the + non-branch tag <tag1> is attached to, preparing it to be a branch + point. + + Example: + <tag1> --> TT1 + <branch_tag2> --> BR2 + <file> --> Symbol: TT1:1.4 + After --> Symbol: TT1:1.4, BR2:1.4.0.2 + + rtag -b -r <branch_tag1> <branch_tag2> + + Adds the magic branch tag <branch_tag2> to the revision at the HEAD of + (the highest revision number on) the branch labelled with + <branch_tag1>, preparing it to be a branch point. + + Example: + <branch_tag1> --> BR1 + <branch_tag2> --> BR2 + <file> --> Symbol: BR1:1.2.0.2 (1.2.2.5 is HEAD) + After --> Symbol: BR1:1.2.0.2,BR2:1.2.2.5.0.2 + + If the branch tagged by <branch_tag1> has not been created, then the + tag shows up as a second branch off the same branch point revision: + + Example: + <branch_tag1> --> BR1 + <tag2> --> TT2 + <file> --> Symbols: BR1:1.2.0.2 (No 1.2.X exists.) + After --> Symbols: BR1:1.2.0.2,TT2:1.2.0.4 + + In all four cases above, if <tag2> already exists on the file, you get + an error unless you specify the '-F' option. + + In all four cases, if <tag1> does not exist on the file, <tag2> is not + added unless you specify the '-f' option. + + Last modified: _6/13/1997_ + + 4. What happens if the tags are the same in "rtag -r <tag> <tag>"? + + Again, there are four cases depending on whether <tag> is a branch + tag, or a non-branch tag and on whether you use the '-b' option to + "rtag": + + rtag -r <tag> <tag> + + Is a no-op. It does nothing even with '-F' specified. + + If you add the '-f' option ("rtag -f -r <tag> <tag>"), then <tag> is + attached to the latest revision on the Main Branch if the file does + *not* already have <tag> on some revision. + + If the <tag> is already on the file, using "rtag -f" is still a no-op. + + rtag -r <branch_tag> <branch_tag> + + Produces an error, since the <branch_tag> is already on some revision + of the file. + + But, "rtag -F -r <branch_tag> <branch_tag>" turns the magic branch tag + into a non-branch tag. + + Symbols: BR1:1.4.0.2 becomes Symbols: BR1:1.4 + + rtag -b -r <tag> <tag> + + Produces an error, since the <tag> is already on the file. + + But, "rtag -F -b -r <tag> <tag>" turns the non-branch tag into a magic + branch tag. + + Symbols: BR1:1.4 becomes Symbols: BR1:1.4.0.2 + + rtag -b -r <branch_tag> <branch_tag> + + Produces an error, since the <branch_tag> is already on the file. + + But, "rtag -F -b -r <branch_tag> <branch_tag>" increments the branch + number. It essentially removes the branch and creates a new one by the + same name. + + Symbols: BR1:1.2.0.4 becomes Symbols: BR1:1.2.0.6 + + Last modified: _6/13/1997_ + + 5. Why doesn't "rtag -b -r <branch_tag1> <branch_tag2>" rename or duplicate + a magic branch tag? + + None of the "tag" or "rtag" options rename anything. They only apply + (or, with the '-F' option, move) tags to specific revisions in the + file. + + See 3M.[3-4] above for details of how it works. + + To rename a non-branch tag, see 3O.9. To rename a magic branch tag, + see 4D.5 + + Last modified: _6/13/1997_ + + Category: /Commands_/status_st_stat/ + + " + "status", "st", "stat"" + + 1. What is "status" for? + + To display the status of files, including the revision and branch you + are working on and the existence of "sticky" information. + + Last modified: _6/13/1997_ + + 2. Why does "status" limit the File: at the top to 17 characters? + + Designed that way to line up with other data. You can find the whole + filename in the line beginning with "RCS version:", which is not + limited in length. + + Last modified: _6/13/1997_ + + 3. Why does it print "Sticky" lines when the values are "(none)"? + + Oversight. It should probably elide lines without information. + + Last modified: _6/13/1997_ + + 4. Shouldn't the status "Needs Checkout" be "Needs Update"? + + Probably. + + [[Did this show up in CVS 1.4?]] + + Last modified: _6/13/1997_ + + Category: /Commands_/tag_ta_freeze/ + + " + "tag", "ta", "freeze"" + + 1. What is "tag" for? + + To add a symbolic label (a "tag") to the RCS files last checked out, + updated or committed in a working directory. + + Last modified: _6/13/1997_ + + 2. What is the difference between "tag" and "rtag"? + + The end result of both commands is that a <tag>, or symbolic name, is + attached to a single revision in each of a collection of files. + + The differences lie in: + + The collection of files they work on. + + "rtag" works on the collection of files referred to by a "module" name + as defined in the "modules" file, or a relative path within the + Repository. + + "tag" works on files and directories specified on the command line + within the user's working directory. (Default is '.') + + Both commands recursively follow directory hierarchies within the + named files and directories. + + The revisions they choose to tag. + + "rtag" places a tag on the latest committed revision of each file on + the branch specified by the '-r' option. By default it tags the Main + Branch. + + "tag" places a tag on the BASE (i.e. last checked out, updated or + committed) revision of each file found in the working directory. (The + BASE revision of a file is the one stored in the ./CVS/Entries file.) + + A different set of command line options. + + For example, "rtag" takes a "-r <oldtag>" option to retag an existing + tag. The "tag" command does not. + + How it is logged. + + Currently "rtag" records the <tag> and the module in the "history" + file, while "tag" does not. + + Last modified: _6/13/1997_ + + 3. Why does "tag -b" not put a tag on the Branch Point revision? How do I + refer to the Branch Point? + + This is probably an oversight, or a disbelief in the need for it. If + everything works perfectly, the "update -j" command will do the merge + you need and you don't need to check up on it by playing with the + branch point revision. + + The '-b' option attaches a magic branch tag to allow CVS later to + figure out the branch point. The actual revision that <tag> is + attached to does not exist. References to the branch tag are + equivalent to references to the latest revision on the branch. + + There is no way to refer to the branch point without adding a + non-branch tag. You might want to add non-branch tags as a habit and + add branch tags later, possibly immediate after adding the non-branch + tag. See 4C.3 on Creating a Branch. + + Last modified: _6/13/1997_ + + 4. So "{r}tag" labels a bunch of files. What do you use a Tag for? + + You use it to "checkout" the labeled collection of files as a single + object, referring to it by name. + + Anywhere a revision number can be used a Tag can be used. In fact tags + are more useful because they draw a line through a collection of + files, marking a development milestone. + + The way to think about a Tag is as a curve drawn through a matrix of + filename vs. revision number. Consider this: + + Say we have 5 files (in some arbitrary modules, some may be in 2 or + more modules by name, some may be in 2 or more modules because of the + Repository tree structure) with the following revisions: + + file1 file2 file3 file4 file5 + + 1.1 1.1 1.1 1.1 /--1.1* <-*- <tag> + 1.2*- 1.2 1.2 -1.2*- + 1.3 \- 1.3*- 1.3 / 1.3 + 1.4 \ 1.4 / 1.4 + \-1.5*- 1.5 + 1.6 + + At some time in the past, the '*' versions were tagged. Think of the + <tag> as a handle attached to the curve drawn through the tagged + revisions. When you pull on the handle, you get all the tagged + revisions. Another way to look at it is that you draw a straight line + through the set of revisions you care about and shuffle the other + revisions accordingly. Like this: + + file1 file2 file3 file4 file5 + + 1.1 + 1.2 + 1.1 1.3 _ + 1.1 1.2 1.4 1.1 / + 1.2*----1.3*----1.5*----1.2*----1.1 (--- <-- Look here + 1.3 1.6 1.3 \_ + 1.4 1.4 + 1.5 + + I find that using these visual aids, it is much easier to understand + what a <tag> is and what it is useful for. + + Last modified: _6/13/1997_ + + 5. How do I get "tag" and "rtag" to send mail the way "commit" does? + + The "commit" command is supported by two files ("commitinfo" and + "loginfo") not used by other commands. To do logging the same way for + "tag" and "rtag" would require another file like loginfo, which + currently doesn't exist. + + The "rtag" command requires a "module" entry, which can specify a + "tag" program using the "-t programname" option on the module line. + + There is no equivalent support for "tag". + + Last modified: _6/13/1997_ + + 6. Why can't "tag" handle the '-r' option that "rtag" takes? + + Oversight. The answer is probably "Fixed in a Future Release." + + Last modified: _6/13/1997_ + + 7. After a "tag <tag>" in my working directory, why doesn't "checkout -r + <tag>" somewhere else produce copies of my current files? + + The only reason this would fail, other than misspelling the <tag> + string, is that you didn't "commit" your work before "tagging" it. + Only committed revisions may be tagged. Modified files are not marked + for later tagging. + + Last modified: _6/13/1997_ + + 8. Why doesn't "tag" write a history record the way "rtag" does? + + The "rtag" command was originally intended to place major "release" + tags onto modules. The "tag" functionality was developed to *move* the + more significant tag when slight changes to individual files sneaked + in after the release tag was stamped onto the Repository. + + The significant event was the "rtag", which was recorded in the + "history" file for the "history -T" option to work. + + It turns out that "tag" is generally more useful than "rtag", so the + model has changed. Future revisions of CVS will probably store both + kinds of tags in the history file. + + Last modified: _6/13/1997_ + + 9. How do I rename a <tag>? + + For a procedure to rename a branch tag, See section 4D.5 The following + covers only non-branch tags. + + First, pick a <newtag> that is not in use. You could reuse (i.e. move) + an existing tag to the new revisions using the '-F' option, but that + will confuse matters when both tags are not already on a file. (It + will probably confuse "rtag -f" too.) + + Use "rtag" to place <newtag> only on revisions attached to <oldtag> in + the whole Repository, then delete the old one. + + cvs rtag -r <oldtag> <newtag> world + cvs rtag -d <oldtag> world. + + You can also checkout or update your working directory to the <oldtag> + and "tag" rather than "rtag" the result. But that will take longer and + it has the chance of producing conflicts. + + cvs update -r <oldtag> + cvs tag <newtag> + cvs tag -d <oldtag> + cvs update -A (or cvs update -r <previous_tag>) + + Last modified: _6/13/1997_ + + Category: /Commands_/update_up_upd/ + + " + "update", "up", "upd"" + + 1. What is "update" for? + + The "update" command is by far the most important command and is + probably also the most used command. + + It has five purposes: (And many options.) + + To display the status of your working files. + + Though a plain "update" also displays the status, it does so after + possibly altering your working directory. To see the status of your + working files without changing anything, type: + + cvs -n update {optional list of files} + + To merge changes made by others to the branch you are working on + into your working files. + + Each working directory is attached to a branch, usually the Main + branch. To merge changes made on your working branch since your last + checkout, update or commit, type: + + cvs update {optional list of files} + + To merge changes made on another branch into the branch you are + working on (your "working branch"). + + If you want to grab a whole branch, from the branch point, which is + assumed to be on the Main Branch, to the end of the branch, you type: + + cvs update -j <branch_tag> {optional files} + + If you want to grab the changes made between two tags or revisions, + you type: + + cvs update -j <tag1> -j <tag2> {optional files} + + (If you are working with a single file, the Tags could also be + revisions numbers. Unless you take great care to match revision + numbers across different files (a waste of time given the way Tags + work), using revision numbers in place of the Tags for multiple files + would be meaningless.) + + To move your working directory to another branch. + + A working directory is presumed to be attached to (or working on) a + particular branch, usually the Main branch. To alter what CVS believes + to be your working branch, you "move" to that branch. + + To move to a tagged branch, type: + + cvs update -r <branch_tag> {optional files} + + To move to the Main Branch, type: + + cvs update -A {optional files} + + If you have modified files in your working directory, this is not a + clean move. CVS will attempt to merge the changes necessary to make it + look like you made the same changes to the new branch as you made in + the old one. But if you do this twice without resolving the merge + conflicts each time, you can lose work. + + To retrieve old revisions of files. + + This option is similar to 4 above but you are not restricted to using + a <branch_tag>. You may specify any revision or <tag> with '-r' and + get the specified revision or the tagged revision: + + cvs update -r <tag/rev> {optional files} + + Or you may specify any date with '-D': + + cvs update -D <date> {optional files} + + The '-p' option sends the revisions to standard output (normally your + terminal) rather than setting the "sticky" tag and changing the files. + + Last modified: _6/13/1997_ + + 2. What do 'U', 'M' and 'C' mean when I type "update"? Are they different + for "cvs -n update"? + + "cvs update" merges changes made to the Repository, since your last + "checkout", "update" or "commit", into your working files. You can + think of it as changing your BASE revision. + + "cvs update" prints lines beginning with: + + 'U' after replacing your unmodified file with a different + revision from the Repository. + + 'M' for two different reasons: + + for files you have modified that have not changed in the Repository. + + after a merge, if it detected no conflicts. + + 'C' after a merge, if it detected conflicts. See 2D.7 and 3P.6 for + more info on conflict resolution and "sticky conflicts." + + "cvs -n update" shows what it *would* do, rather than doing it. Or, + another way of looking at it, "cvs -n update" displays the + relationship between your current BASE revisions (identified in your + ./CVS/Entries file) and the HEAD revisions (the latest revisions in + the Repository). + + "cvs -n update" prints lines beginning with: + + 'U' for files you have not modified that have changed in the + Repository. + + 'M' for files you have modified that have not changed in the + Repository. + + 'C' for files you have modified that have also been changed in the + Repository. + + See 4C.6 for what the letters mean when merging in from another + branch. The output is almost the same for a normal update if you + consider the Repository as the branch and your working directory as + the "trunk". + + Last modified: _6/13/1997_ + + 3. What's the difference between "update" and "checkout"? + + See 3C.4 above. + + Last modified: _6/13/1997_ + + 4. Why don't I get new files when I execute "update"? + + There are six reasons for nothing to happen during an "update": + + Nothing on your branch changed in the Repository. + + If no one has committed anything to the branch you are working on + (normally the Main branch) since the last time you executed + "checkout", "update" or "commit", nothing will happen. + + It's like shouting "xyzzy" or "plugh" in the wrong room. + + You have a "sticky" non-branch <tag> or <date> attached to the + working files you are trying to "update". + + At some time in the past you checked out or updated your directory + with the "-r <tag>" or "-D <date>" option. Until you do it again with + a different tag or date, or go back to the Main Branch with "update + -A", you will never again see any updates. + + The ./CVS/Entries.Static file exists and you are expecting a new + file. + + If your ./CVS administrative directory contains a file named + Entries.Static, no files will be checked out that aren't already in + the Entries or Entries.Static file. + + You forgot to use the '-d' option and are looking for new + directories. + + If you execute "update" without the '-d' option, it will not create + new directories that have been added to the Repository. + + You typed "update" instead of "cvs update". + + On most Unix systems, your disk caches are now furiously being flushed + by multiple update daemons, destroying performance and proving to + management that you need more CPU power. :-) + + On HP systems you might be asked what package you want to install from + the "update server". + + Someone removed (using "admin -o") your BASE revision (the revision + CVS thought you had in your working directory), then committed a + "replacement". CVS is now confused because the revision in the + Repository matches your BASE revision when the files themselves don't + match. See 3B.6. + + Last modified: _6/13/1997_ + + 5. Why does "update" say 'M' both for plain modified files and for + successful (i.e. conflict-free) merges? Aren't they different? + + A design choice. Yes, they are different internally, but that + shouldn't matter. Your files are in the same condition after the + "update" as they were before -- a "diff" will display only your + modifications. And you are expected to continue onward with parts two + and three of the normal development cycle: "emacs" (a synonym for + "edit" in most of the civilized world) and "commit". + + Last modified: _6/13/1997_ + + 6. What's a "sticky conflict"? How does it know a conflict occurred? + + When a "cvs update" (or an "update -j") creates a conflict, it prints + a 'C' and stores the timestamp of the file after the merge in a + special field in the ./CVS/Entries file. + + This conflict indication implies that the merge command altered your + working file to contain conflict markers surrounding the overlapping + code segments. For example, say that + + + - Two developers acquire revision 1.2 of <file> via "checkout" or + "update". + + + - Developer A changes line 1 from "9999" to "5555", then commits the + file, creating revision 1.3. + + + - Developer B changes line 1 from "9999" to "7777", then tries to + commit the file, but is blocked because the file is not up to date. + Developer B then runs "update" and sees the conflict marker 'C'. The + beginning of the file would look like this: + + <<<<<<< <file> The working <file> in question. + 7777 Change made to the working <file>. + ======= + 5555 Change made in the first commit (1.3) + >>>>>>> 1.3 The revision created by the first commit. + + The conflict is "sticky", which means that until the conflict is + cleared, the "update" command will continue to display the file's + status as 'C' and the "status" command will show the file's status as + "Unresolved Conflict". + + Until the conflict is cleared, "commit" is blocked for this file. + + The sticky conflict indicator can be cleared by: + + Resolving the conflict by editing the file. Two things must happen + before the conflict is considered resolved: + + The timestamp of the file must change. *and* The file must contain no + conflict markers. (The string searched for in the file is the regexp: + "^>>>>>>> ".) + + After clearing the sticky conflict indicator, you may then commit the + file normally. + + Removing the file and running "update". This throws away the local + changes and accepts the latest committed file on this branch. No + commit is needed. + + Forcing the commit to happen by using "commit -f". This is probably + a mistake since there are few lines of real text that begin with + ">>>>>>> ". + + Last modified: _6/13/1997_ + + 7. Is there a feature to tell me what I have changed, added and removed + without changing anything? + + The command "cvs -n update" will do exactly that. + + Last modified: _6/13/1997_ + + 8. Why were all my files deleted when I executed "update"? + + You probably executed "update -r <tag>" some time ago, then removed + <tag> from the Repository files. "update -r <tag>" will delete a file + that doesn't contain <tag>. + + A way to fix this is to "cd" into your working directory and type: + + cvs update -A + + If you don't want the latest revisions on the Main (or Vendor) Branch, + then decide what Tag (normal or branch) you want and type: + + cvs update -r <the_tag_you_want> + + Another way to make a file disappear is to execute "update -D <date>" + where <date> is before the date stamped onto the first revision in the + RCS file. + + Last modified: _6/13/1997_ + + Category: /Past__Future_/ + + " Past & Future " + + Category: /Past__Future_/Bugs_and_Patches/ + + " + Bugs and Patches" + + 1. Why can't CVS handle deletion of directories? + + An oversight, probably. [[Fixed in a future release?]] + + Last modified: _6/13/1997_ + + 2. Why can't CVS handle the moving of sources from one place in the + + directory hierarchy to another? + + A "renaming database" has been proposed to track the history of + pathname changes in the Repository. A general solution is a difficult + problem. See 4B.8. + + Last modified: _6/13/1997_ + + 3. When I typed "cvs update -D <date>", why did it check out all + + sorts of ancient files from the Attic? Shouldn't it just create the + set of files and revisions that existed at that date? + + This seems to be a bug, but is really the lack of any obvious place to + store the date when a file is "removed". + + There are four ranges of dates that CVS has to deal with when trying + to determine what revision was available on <date>: + + Dates before the earliest revision in the file. + + Dates between any two revisions in the file. + + Dates between the latest revision in the file and the date when the + file was moved to the Attic by "commit". + + Dates after moving the file to the Attic. + + Since the date when a file is moved to the Attic is not stored + anywhere, CVS can't tell the difference between #3 and #4. To avoid + not producing a file that should exist in case #3, it produces + extraneous files in case #4. + + For the above reason, if you have removed files in the Attic, it is + better to use "-r <tag>, or even "-r HEAD" than to use a date spec. + + If you must use "-D <date>", then you should either archive and delete + Attic files (losing some past history) or construct your Makefiles to + work with an explicit list of files and let the old source files stay + in the working directory. The contents of the revision-controlled + Makefile can then be considered to contain deletion "information". + + Last modified: _6/13/1997_ + + 4. When I typed "cvs update -D <date>" in my branch, why did it screw up + all my files? + + Currently, the internal routine ("version_ts") that looks up info + about a file, overrides both the tag and date if *either* the tag or + date is specified on the command line. If only the date is specified, + it should not override a branch tag, but it does. + + In CVS 1.3, the documented "-D <branch_tag>:<date>" syntax only works + with the Main Branch and the Vendor Branch. + + [[Is this fixed in CVS 1.4? This is one item I didn't check.]] + + Last modified: _6/13/1997_ + + 5. When I executed "checkout" into an existing directory I got "No such + file or directory" errors. Why? + + Though the man page says that "checkout" turns into an "update -d" in + directories that already exist, it is referring to directories that + already exist *and* were created by CVS. + + When you try to run "checkout" on top of an existing directory + structure, some of which wasn't created by CVS, it will handle + directories and non-CVS files within directories already under CVS, + but it will display the above error on non-CVS files within non-CVS + directories. + + Last modified: _6/13/1997_ + + 6. Why does "update" send all output to the terminal after 26 files have + been updated? + + CVS uses the "tmpnam()" function to generate temporary file names. The + ANSI standard for the "tmpnam()" function says: + + "The tmpnam function generates a different string each time it is + called, up to TMP_MAX times. If it is called more than TMP_MAX times, + the behavior is implementation defined." + + Later it says that the value of "TMP_MAX shall be at least 25." + + On some platforms, the above specification is taken literally by + turning "at least 25" into "exactly 26" and by doing something foolish + (i.e. "implementation defined") after that. Some systems return the + same name repeatedly, which causes one form of trouble. Others return + NULL or garbage, which causes a different form of trouble. + + The broken systems appear to be cycling a single character through the + alphabet. SunOS cycles 3 characters through the alphabet, so it won't + cause trouble until 26 cubed or 17576 calls to "tmpnam()". + + Since CVS doesn't depend on the exact format of the tmp files, the + workaround is to provide a "tmpnam()" that doesn't have a limit on the + number of calls to it. + + Last modified: _6/13/1997_ + + 7. Why does the merge occasionally resurrect lines of code? + + The diff3 program provided by GNU diff version 1.15 has a bug that + occasionally causes text to come back from the dead. + + This is an old problem which you can avoid by upgrading to the latest + GNU "diffutils" package. If you were using GNU diff version 1.15 and + plan to upgrade to the latest GNU diff program, see the next question. + + Last modified: _6/13/1997_ + + 8. Why does the merge fail when my "rcsmerge" program is configured to use + GNU diff version 2.1 or later? + + A change in the overlap format was introduced in GNU diff3 between + versions 2.0 and 2.1 that causes RCS versions before 5.6.0.1 to fail + during a merge. + + To get consistent rcsmerge behavior, you have four choices: + + Go back to using GNU diff 1.15 or 2.0 with RCS versions 5.5 or 5.6. + If you want to use GNU diff 2.1 or later, you'll have to pick one of + the other three choices in this list. + + Grab RCS version 5.6.0.1 from an FSF archive and set the DIFF3_A + macro to '1' as it tells you to in the Makefile: + + #define DIFF3_A 1 + + Patch the RCS 5.6 source. Change line 84 in "merger.c" from: + + DIFF3, "-am", "-L", label[0], "-L", label[1], to DIFF3, "-amE", "-L", + label[0], "-L", "", "-L", label[1], + + Wait both for RCS version 5.7 to be released and for a new version + of CVS that can deal with it. + + Last modified: _6/13/1997_ + + Category: /Past__Future_/Contributors/ + + " + Contributors" + + 1. Who wrote CVS? + + Brian Berliner <berliner@sun.com> converted a collection of scripts + written by Dick Grune <dick@cs.vu.nl> into a C program, then added all + sorts of features. He continues to maintain CVS. + + Jeff Polk <polk@bsdi.com> wrote much of the code added between + revisions 1.2 and 1.3. Many others were involved at some level. + + david d zuhn <zoo@armadillo.com> fixed a number of bugs, added some of + the new features, reworked the whole thing to be more portable, and + provided much of the energy to push CVS 1.4 out the door. + + Jim Kingdon implemented CVS 1.5's remote repository access features, + fixed many bugs, and managed the release of version 1.5. + + Take a look at the README and the ChangeLog files in the CVS sources + for more contributors. + + Last modified: _6/13/1997_ + + 2. You didn't write all of this FAQ, did you? + + In the original hunt for questions to answer (performed in Jan/Feb, + 1993), I polled hundreds of people and I rephrased all sorts of text + found on the net. Between 2/93 and 10/93, I released about 20 + versions, with corrections and additions from the info-cvs mailing + list and private correspondence. + + Between 10/93 and 10/94 I extracted frequently asked questions from + the 1200 mail messages to the info-cvs mailing list, turned them into + focused questions and tried to answer them. + + 93/02/?? ~4000 lines 93/06/?? ~5000 lines 93/10/23 7839 lines 278K + 94/10/29 9856 lines 360K 95/05/09 9981 lines 365K + + Because there are so many posers of questions, I will list only those + who contribute answers or help significantly with the content and + structure of this document. + + If I used someone else's text verbatim, I mentioned it in the given + answer. The people whose email postings have added to this document or + who have added to my understanding are: + + Brian Berliner <berliner@sun.com>, CVS maintainer. Paul Eggert + <eggert@twinsun.com>, RCS maintainer. + + Gray Watson <gray@antaire.com> Per Cederqvist <ceder@signum.se> Pete + Clark <pclark@is.com> + + all of whom have sent me copies of their tutorials and local CVS + documentation. + + Additional contributors, who have sent me ideas, text, corrections and + support include (in alphabetical order): + + Per Abrahamsen <amanda@iesd.auc.dk> Donald Amby + <amby@mixcom.mixcom.com> Mark D Baushke <mdb@cisco.com> Jim Blandy + <jimb@cyclic.com> Tom Cunningham <tomc@bouwsma,sps.mot.com> Graydon + Dodson <grdodson@lexmark.com> Joe Drumgoole + <joed@splatter.demon.co.uk> Don Dwiggins <dwig@markv.com> Bryant + Eastham <bryant@ced.utah.edu> Dan Franklin <dan@diamond.bbn.com> + Michael Ganzberger <ganzbergermd@ES.net> Steve Harris + <vsh%etnibsd@uunet.uu.net> Erik van Linstee + <linstee@dutecaj.et.tudelft.nl> Jeffrey M Loomis <jml@world.std.com> + Barry Margolin <barmar@near.net> Mark K. Mellis <mkm@ncd.com> Chris + Moore <Chris.Moore@src.bae.co.uk> Gary Oberbrunner <garyo@avs.com> + Steve Turner <stevet@carrier.sps.mot.com> Dave Wolfe + <dwolfe@pffft.sps.mot.com> Dale Woolridge <dwoolridge@cid.aes.doe.ca> + + Please send corrections. If I forgot you, remind me and I'll add your + name to the list. + + Last modified: _6/13/1997_ + + Category: /Past__Future_/Development/ + + " + Development" + + 1. Where do I send bug reports? + + First make sure it is a bug. Talk to your friends, coworkers and + anyone you know who uses CVS. Search this FAQ for related issues. Then + test it carefully. Try out variations to narrow down the problem. Make + sure it is repeatable. Look for workarounds so you can report them. + + If you are still sure it's a bug and you tried to fix it, skip to the + next question. Otherwise, send a message to the info-cvs mailing list + containing one of the following: + + If you have a good repeatable case and you think you know what is + going on, then describe the problem in detail. Include a workaround if + you have one. + + If you have no idea what is going on, go ahead and send a question + to the info-cvs mailing list. Include any information you have + describing the symptoms. + + Last modified: _6/13/1997_ + + 2. Where do I send fixes and patches? + + First make sure the "fix" does something useful. Have someone review + your fix. Spend a bit of one person's time in a detailed analysis of + your vast idea before displaying a half-vast idea to hundreds of + people. + + If you tried to fix it and the patch is small, include the patch in + your message. Make sure the patch is based on the latest released + version of CVS. + + If you tried to fix it and the patch is large, you should think about + why it is so large. Did you add a generally useful feature, or did it + grow out of hand? + + If you still believe it is solid, produce a patch file using the CVS + commands "patch" or "diff -c". [[You *are* keeping CVS under CVS, + right?]] The patch should be based on the latest released version of + CVS. Then use the "cvsbug" program (provided with the CVS sources) to + send it to the CVS maintainers. A self-contained patch that provides a + single useful feature or correction might show up independently in the + patches directory of the FTP archive. + + If careful testing reveals an RCS bug rather than a CVS bug, you can + send bug reports to: rcs-bugs@cs.purdue.edu + + Last modified: _6/13/1997_ + + 3. Where do I send ideas for future development? + + If you have a bright idea, discuss it on the info-cvs mailing list. If + you have the time to implement something you can test, send the diffs + along too as described above. + + Last modified: _6/13/1997_ + + 4. What plans are there for new features? + + + +A "rename" or "per-directory" database has been bandied about on +the net for years. Many of the goals of the rename database have +been achieved by the so-called "death support" in recent versions of +CVS (such as 1.9). For more information on what may remain to be +done, see item #189 in the TODO file of a development version of CVS. + +CVS version 1.5 supports remote repository access, but Paul +Kunz has produced another version +(rCVS) that also runs remotely. Note that as far as I know there +are no advantages to rCVS over the remote CVS in CVS 1.5 and later, +and the rCVS user community has migrated to remote CVS. +rCVS is *not* a multisite CVS (see item #186 in TODO for more on +multisite). For more on rCVS, see + +ftp://ftp.slac.stanford.edu/software/rcvs + +kingdon@cyclic.com + + Last modified: _9/6/1997_ + + 5. I have some time and I'd like to help. What can I do for you? + + + You can review this document, correct errors and fill in any of + the incomplete sections. + + You can write scripts or CVS add-ons and make them available by + web/FTP/etc. + + You could work on the regression test suite (src/sanity.sh in the + CVS source distribution). + + You can write specs for new features, fix bugs, review the + documentation or . . . + + For more information, see the files HACKING and DEVEL-CVS in the + CVS source distribution or + http://www.cyclic.com/cyclic-pages/cvsdev.html + + kingdon@cyclic.com + + Last modified: _9/6/1997_ + + Category: /Past__Future_/Professional_Support/ + + " + Professional Support" + + 1. Doesn't Cygnus support CVS? + + + + + Cygnus is a company that supports free software such as the GCC + compiler. They have never sold support for CVS, however. They + do use CVS internally and have contributed much code to CVS over + the years (for which CVS users should be grateful). + + kingdon@cyclic.com + + Last modified: _9/6/1997_ + + 2. What is Cyclic Software doing with CVS? + + +Cyclic Software exists to provide support for CVS. For details such +as prices and what this covers, see http://www.cyclic.com or ask +info@cyclic.com. + +kingdon@cyclic.com + + Last modified: _9/6/1997_ + + Category: /User_Tasks_/ + + " User Tasks " + + Category: /User_Tasks_/Common_User_Tasks/ + + " + Common User Tasks" + + 1. What is the absolute minimum I have to do to edit a file? + + Tell your Repository Administrator to create a module covering the + directory or files you care about. You will be told that your module + name is <module>. Then type: + + cvs checkout <module> + cd <module> + emacs <file> # Isn't Emacs a synonym for edit? + cvs commit <file> + + If you don't use modules (in my opinion, a mistake), you can check out + a directory by substituting its relative path within the Repository + for <module> in the example above. + + To work on a single file, you'll have to change "cd <module>" to "cd + `dirname <module>`". + + Last modified: _6/13/1997_ + + 2. If I edit multiple files, must I type "commit" for each one? + + No. You can commit a list of files and directories, including relative + paths into multiple directories. You can also commit every modified + file in the current directory or in all directories and subdirectories + from your current directory downward. See 3D.2. + + Last modified: _6/13/1997_ + + 3. How do I get rid of the <module> directory that "checkout" created? + + Change your directory to be the same as when you executed the + "checkout" command that created <module>. + + If you want to get rid of the CVS control information, but leave the + files and directories, type: + + cvs release <module> + + If you want to obliterate the entire directory, type: + + cvs release -d <module> + + ("release -d" searches through the output of "cvs -n update" and + refuses to continue if the "update" command finds any modified files + or non-ignored foreign files. Foreign directories too.) + + If you don't care about keeping "history", or checking for modified + and foreign files, you can just remove the whole directory. That's "rm + -rf <module>" under Unix. + + Last modified: _6/13/1997_ + + 4. How do I find out what has changed since my last update? + + There are many ways to answer this. + + To find out what you've changed in your current working directory + since your last checkout, update or commit, type: + + cvs diff + + To find out what other people have added (to your branch) since you + last checked out or updated, type: + + cvs diff -r BASE -r HEAD + + To look at a revision history containing the comments for all changes, + you can use the "log" command. + + You can also use "history" to trace a wide variety of events. + + Last modified: _6/13/1997_ + + 5. I just created a new file. How do I add it to the Repository? + + The "update" command will mark files CVS doesn't know about in your + working directory with a '?' indicator. + + ? <file> + + To add <file> to the Repository, type: + + cvs add <file> + cvs commit <file> + + See 3A.[2-5] and 4C.8 for branch and merge considerations. + + Last modified: _6/13/1997_ + + 6. How do I merge changes made by others into my working directory? + + If you are asking about other branches, see Section 4C on "Branching". + You will have to use the "update -j" command. + + Retrieving changes made to the Repository on the *same* branch you are + working on is the main purpose of the "update" command. The "update" + command tries to merge work committed to the Repository by others + since you last executed "checkout", "update" or "commit" into your + working files. + + For a single file, there are six possible results when you type the + "update" command: + + If the file is lying in your working directory, but is not under + CVS, it will do nothing but print: + + ? <file> + + If neither you nor anyone else has committed changes to <file>, + since your last "checkout", "update" or "commit", "update" will print + nothing and do nothing. + + If you have made no changes to a working file, but you or others + have committed changes to the Repository since your last "checkout", + "update" or "commit" of this working file, CVS will remove your + working file and replace it with a copy of the latest revision of that + file in the Repository. It will print: + + U <file> + + You might want to examine the changes (using the CVS "diff" command) + to see if they mesh with your own in related files. + + If you have made changes to a working file, but no one has changed + your BASE revision (the revision you retrieved from the Repository in + your last "checkout", "update" or "commit"), "update" will print: + + M <file> + + Nothing changes. You were told that you have a modified file in your + directory. + + If you have made changes to your working file and you or others have + committed changes to the Repository, but in different sections of the + file, CVS will merge the changes stored in the Repository since your + last "checkout", "update" or "commit" into your working file. "update" + will print: + + RCS file: /Repository/module/<file> retrieving revision 1.X retrieving + revision 1.Y Merging differences between 1.X and 1.Y into <file> M + <file> + + If you execute "diff" before and after this step, you should see the + same output, since both the base file and your working file changed in + parallel. This is one of the few times the otherwise nonsensical + phrase "same difference" means something. + + If both you and those who committed files (since your last checkout, + update or commit) have made changes to the same section of a file, CVS + will merge the changes into your file as in #5 above, but it will + leave conflict indicators in the file. "update" will print: + + RCS file: /Repository/module/<file> retrieving revision 1.X retrieving + revision 1.Y Merging differences between 1.X and 1.Y into <file> + rcsmerge warning: overlaps during merge + cvs update: conflicts found in <file> + C <file> + + This is a "conflict". The file will contain markers surrounding the + overlapping text. The 'C' conflict indicator is sticky -- subsequent + "update" commands will continue to show a 'C' until you edit the file. + + You must examine the overlaps with care and resolve the problem by + analyzing how to retain the features of both changes. See 2D.7 and + 3P.6 for more details on conflict resolution. + + Last modified: _6/13/1997_ + + 7. How do I label a set of revisions so I can retrieve them later? + + To "tag" the BASE revisions (the ones you last checked out, updated, + or committed) you should "cd" to the head of the working directory you + want to tag and type: + + cvs tag <tag> + + It recursively walks through your working directory tagging the BASE + revisions of all files. + + To "tag" the latest revision on the Main branch in the Repository, you + can use the following from anywhere: (No "cd" is required -- it works + directly on the Repository.) + + cvs rtag <tag> <module> + + Last modified: _6/13/1997_ + + 8. How do I checkout an old release of a module, directory or file? + + Module names and directories are simply ways to name sets of files. + Once the names are determined, there are 6 ways to specify which + revision of a particular file to check out: + + By tag or symbolic name, via the "-r <tag>" option. + + By date, via the "-D <date>" option. + + By branch tag (a type of tag with a magic format), via the "-r + <branch_tag>" option. + + By date within a branch, via the "-r <branch_tag>:<date>" option. + + By an explicit branch revision number ("-r <rev>"), which refers to + the latest revision on the branch. This isn't really an "old" + revision, from the branch's perspective, but from the user's + perspective the whole branch might have been abandoned in the past. + + An explicit revision number: "-r <rev>" Though this works, it is + almost useless for more than one file. + + You type: + + cvs checkout <option-specified-above> <module> + cd <module> + + Last modified: _6/13/1997_ + + 9. What do I have to remember to do periodically? + + You should execute "cvs -n update" fairly often to keep track of what + you and others have changed. It won't change anything -- it will just + give you a report. + + Unless you are purposely delaying the inclusion of others' work, you + should execute "update" once in a while and resolve the conflicts. It + is not good to get too far out of sync with the rest of the developers + working on your branch. + + It is assumed that your system administrators have arranged for editor + backup and Unix temp files (#* and .#*) to be deleted after a few + weeks. But you might want to look around for anything else that is + ignored or hidden. Try "cvs -n update -I !" to see all the ignored + files. + + If you are the Repository Administrator, see 4B.16 on Administrator + responsibilities. + + Last modified: _6/13/1997_ + + Category: /User_Tasks_/General_Questions/ + + " + General Questions" + + 1. How do I see what CVS is trying to do? + + The '-t' option on the main "cvs" command will display every external + command (mostly RCS commands and file deletions) it executes. When + combined with the '-n' option, which prevents the execution of any + command that might modify a file, you can see what it will do before + you let it fly. The '-t' option will *not* display every internal + action, only calls to external programs. + + To see a harmless example, try typing: + + cvs -nt update + + Some systems offer a "trace" or "truss" command that will display all + system calls as they happen. This is a *very* low-level interface that + does not normally follow the execution of external commands, but it + can be useful. + + The most complete answer is to read the source, compile it with the + '-g' option and step through it under a debugger. + + Last modified: _6/13/1997_ + + 2. If I work with multiple modules, should I check them all out and commit + them occasionally? Is it OK to leave modules checked out? + + The simple answers are "Yes." + + There is no reason to remove working directories, other than to save + disk space. As long as you have committed the files you choose to make + public, your working directory is just like any other directory. + + CVS doesn't care whether you leave modules checked out or not. The + advantage of leaving them checked out is that you can quickly visit + them to make and commit changes. + + Last modified: _6/13/1997_ + + 3. What is a "sticky" tag? What makes it sticky? How do I loosen it? + + When you execute "update -r <tag>", CVS remembers the <tag>. It has + become "sticky" in the sense that until you change it or remove it, + the tag is remembered and used in references to the file as if you had + typed "-r <tag>" on the command line. + + It is most useful for a <branch_tag>, which is a sticky tag indicating + what branch you are working on. + + A revision number ("-r <rev-number>") or date ("-D <date>") can also + become sticky when they are specified on the command line. + + A sticky tag, revision or date remains until you specify another tag, + revision or date the same way. The "update -A" command moves back to + the Main branch, which has the side-effect of clearing all sticky + items on the updated files. + + The "checkout" command creates sticky tags, revisions and dates the + same way "update" does. + + Also, the '-k' option records a "sticky" keyword option that is used + in further "updates until "update -A" is specified. + + Last modified: _6/13/1997_ + + 4. How do I get an old revision without updating the "sticky tag"? + + Use the '-p' option to "pipe" data to standard output. The command + "update -p -r <tag/rev>" sends the selected revision to your standard + output (usually the terminal, unless redirected). The '-p' affects no + disk files, leaving a "sticky tag" unaltered and avoiding all other + side-effects of a normal "update". + + If you want to save the result, you can redirect "stdout" to a file + using your shell's redirection capability. In most shells the + following command works: + + cvs update -p -r <tag/rev> filename > diskfile + + Last modified: _6/13/1997_ + + 5. What operations disregard sticky tags? + + The functions that routinely disregard sticky tags are: + + Those that work directly on the Repository or its administrative + files: + + admin rtag log status remove history + + Those that take Tags or revisions as arguments and ignore everything + else: (They also never *set* a sticky tag.) + + rdiff import export + + The "release" command itself ignores sticky tags, but it calls "cvs + -n update" (which *does* pay attention to a sticky tag) to figure out + what inconsistencies exist in the working directory. If no + discrepancies exist between the files you originally checked out + (possibly marked by a sticky tag) and what is there now, "release -d" + will delete them all. + + The "tag" command works on the revision lying in the working + directory however it got there. That the revision lying there might + happen to have a sticky tag attached to it is not the "tag" command's + concern. + + The main function that *does* read and write sticky tags is the + "update" command. You can avoid referring to or changing the sticky + tag by using the '-p' option, which sends files to your terminal, + touching nothing else. + + The "checkout" command sets sticky tags when checking out a new module + and it acts like "update" when checking out a module into an existing + directory. + + The "diff" and "commit" commands use the sticky tags, unless + overridden on the command line. They do not set sticky tags. Note that + you can only "commit" to a file checked out with a sticky tag, if the + tag identifies a branch. + + There are really two types of sticky tags, one attached to individual + files (in the ./CVS/Entries file) and one attached to each directory + (in the ./CVS/Tag file). They can differ. + + The "add" command registers the desire to add a new file. If the + "directory tag" (./CVS/Tag) file exists at the time of the "add", the + value stored in ./CVS/Tag becomes the "sticky tag" on the new file. + The file doesn't exist in the Repository until you "commit" it, but + the ./CVS/Entries file holds the sticky tag name from the time of the + "add" forward. + + Last modified: _6/13/1997_ + + 6. Is there a way to avoid reverting my Emacs buffer after committing a + file? Is there a "cvs-mode" for Emacs? + + See Section 4F.1 + + Last modified: _6/13/1997_ + + 7. How does conflict resolution work? What *really* happens if two of us + change the same file? + + While editing files, there is no conflict. You are working on separate + copies of the file stored in the virtual "branch" represented by your + working directories. After one of you commits a file, the other may + not commit the same file until "update" has merged the earlier + committed changes into the later working file. + + For example, say you both check out rev 1.2 of <file> and make change + to your working files. Your coworker commits revision 1.3. When you + try to commit your file, CVS says: + + cvs commit: Up-to-date check failed for `<file>' + + You must merge your coworker's changes into your working file by + typing: + + cvs update <file> + + which will produce the output described in 2B.6. + + If a conflict occurs, the filename will be shown with a status of 'C'. + After you resolve any overlaps caused by the merging process, you may + then commit the file. See 3P.6 for info on "sticky conflicts". + + Even if you get a simple 'M', you should examine the differences + before committing the file. A smooth, error-free text merge is still + no indication that the file is in proper shape. Compile and test it at + least. + + The answer to two obvious questions is "Yes". + + Yes, the first one who commits avoids the merge. Later developers have + to merge the earlier changes into their working files before + committing the merged result. Depending on how difficult the merge is + and how important the contending projects are, the order of commits + and updates might have to be carefully staged. + + And yes, between the time you execute "update" and "commit" (while you + are fixing conflicts and testing the results) someone else may commit + another revision of <file>. You will have to execute "update" again to + merge the new work before committing. Most organizations don't have + this problem. If you do, you might consider splitting the file. Or + hiring a manager. + + Last modified: _6/13/1997_ + + 8. How can I tell who has a module checked out? + + If you "checkout" module names (not relative pathnames) and you use + the release command, the "history" command will display active + checkouts, who has them and where they were checked out. It is + advisory only; it can be circumvented by using the '-l' option on the + main "cvs" command. + + Last modified: _6/13/1997_ + + 9. Where did the .#<file>.1.3 file in my working directory come from? + + It was created during an "update" when CVS merged changes from the + Repository into your modified working file. + + It serves the same purpose as any "backup" file: saving your bacon + often enough to be worth retaining. It is invaluable in recovering + when things go wrong. + + Say Developers A (you) and B check out rev 1.3 of file <file>. You + both make changes -- different changes. B commits first, so <file>,v + in the Repository contains revisions up through 1.4. + + At this point, there are 5 (yes, five) versions of the file of + interest to you: + + Revision 1.3 (What you originally checked out.) + + Revision 1.4 (What you need from developer B.) + + Your old working file. (Before the update.) + + Your new working file. (After the merge caused by "update".) + + Revision 1.5 (Which you will commit shortly.) + + In the case where your working file was not modified, #1 and #3 will + be the same, as will #2 and #4. In this degenerate case, there is no + need to create #5. The following assumes that your working file was + modified. + + If the merge executed by the "update" caused no overlaps, and you + commit the file immediately, #4 and #5 will be the same. But you can + make arbitrary changes before committing, so the difference between #4 + and #5 might be more than just the correction of overlaps. In general, + though, you don't need #4 after a commit. + + But #3 (which is the one saved as ".#<file>.1.3") holds all of your + work, independent of B's work. It could represent a major effort that + you couldn't afford to lose. If you don't save it somewhere, the merge + makes #3 *disappear* under a potential blizzard of conflicts caused by + overlapping changes. + + I have been saved a few times, and others I support have been saved + hundreds of times, by the ability to "diff <original file> <original + file with only my work added>", which can be done in the example above + by the Unix shell command: + + cvs update -p -r 1.3 <file> | diff - .#<file>.1.3 + + The assumption is that the ".#" files will be useful far beyond the + "commit" point, but not forever. You are expected to run the "normal" + Unix cleanup script from "cron", which removes "#*" and ".#*" files + older than a some period chosen by your sysadmin, usually ranging from + 7 to 30 days. + + A question was raised about the need for #3 after #5 has been + committed, under the assumption that you won't commit files until + everything is exactly as you like them. + + This assumes perfect humans, which violates one of the Cardinal rules + of Software Engineering: Never assume any form of discipline on the + part of the users of software. If restrictions are not bound into the + software, then you, the toolsmith, have to arrange a recovery path. + + In other words, I've seen every possible variety of screwup you can + imagine in #5. There is no way to make assumptions about what "should" + happen. I've seen #5 filled with zeros because of NFS failures, I've + seen emacs core dumps that leave #5 in an unreasonable state, I've + seen a foolish developer uppercase the whole file (with his "undo" + size set low so he couldn't undo it) and decide that it would be less + work to play with the uppercased file than to blow it away and start + over. I've even seen committed files with conflict markers still in + them, a sure sign of carelessness. + + There are all sorts of scenarios where having #3 is incredibly useful. + You can move it back into place and try again. + + Last modified: _6/13/1997_ + + 10. What is this "ignore" business? What is it ignoring? + + The "update" and "import" commands use collections of Unix wildcards + to skip over files and directories matching any of those patterns. + + You may add to the built-in ignore list by adding lines of + whitespace-separated wildcards to the following places: (They are read + in this order.) + + In a file named "cvsignore" in $CVSROOT/CVSROOT. + + A Repository Administrator uses this to add site-specific files and + patterns to the built-in ignore list. + + In a file named ".cvsignore" in your home directory. + + For user-specific files. For example, if you use "__" as your default + junk file prefix, you can put "__*" in your .cvsignore file. + + People who play around exclusively in directory trees where the + Makefiles are generated by "imake" or "configure" might want to put + "Makefile" in their ignore list, since they are all generated and + usually don't end up in the Repository. + + In the CVSIGNORE environment variable. + + For session-specific files. + + Via the '-I' option on "import" or "update" commands. + + For this-command-only files. + + In a file named ".cvsignore" within each directory. + + The contents of a ".cvsignore" file in each directory is temporarily + added to the ignore list. This way you can ignore files that are + peculiar to that directory, such as executables and other generated + files without known wildcard patterns. + + In any of the places listed above, a single '!' character nulls out + the ignore list. A Repository administrator can use this to override, + rather than enhance, the built-in ignore list. A user can choose to + override the system-wide ignore list. For example, if you place "! *.o + *.a" in your .cvsignore file, only *.o *.a files, plus any files a + local-directory .cvsignore file, are ignored. + + A variant of the ignore-file scheme is used internally during + checkout. "Module names" found in the modules file (or on the + "checkout" command line) that begin with a '!' are ignored during + checkout. This is useful to permanently ignore (if the '!' path is in + the modules file) or temporarily ignore (if the '!' path is on the + command line) a sub-directory within a Repository hierarchy. For + example: + + cvs checkout !gnu/emacs/tests gnu/emacs + + would checkout the module (or relative path within $CVSROOT) named + "gnu/emacs", but ignore the "tests" directory within it. + + Last modified: _6/13/1997_ + + 11. Is there a way to set user-specific configuration options? + + User-specific configuration is available through use of a ".cvsrc" + file in your home directory. + + CVS searches the first column of your ~/.cvsrc file for the cvs + command name you invoked. If the command is found, the rest of the + line is treated like a set of command line options, stuffed into the + command line before the arguments you actually typed. + + For example, if you always want to see context diffs and you never + want to have to delete a file before you run "cvs remove", then you + should create a .cvsrc file containing the following: + + diff -c + remove -f + + which will add the given options to every invocation of the given + commands. + + [[The rest of this will be removed someday, when CVS changes.]] + + I would like to stop here with a comment that the command name to use + is the full, canonical one. But the command that the cvsrc support + uses is the string you typed on the command line, not the proper + command. So to get the full effect of the above example, you should + also add all the alternate command names: + + di -c + dif -c + rm -f + delete -f + + There are two other limitations that will probably be fixed when CVS + sprouts long option names: + + It only affects options made available on the command line. + + There is a limited number of short options. With long option names, + there is no problem. You can have as many long options as you like, + affecting anything that looks malleable. + + The existing command line options do not come in on/off pairs, so + there is no easy way to override your ~/.cvsrc configuration for a + single invocation of a command. + + Choosing a good set of long option pairs would fix this. + + Last modified: _6/13/1997_ + + 12. Is it safe to interrupt CVS using Control-C? + + It depends on what you mean by "safe". ("Ah," said Arthur, "this is + obviously some strange usage of the word *safe* that I wasn't + previously aware of." -- Hitchhiker's Guide to the Galaxy) + + You won't hurt the underlying RCS files and if you are executing a + command that only *reads* data, you will have no cleanup to do. + + But you may have to hit Control-C repeatedly to stop it. CVS uses the + Unix "system" routine which blocks signals in the CVS parent process. + A single Control-C during "system" will only halt the child process, + usually some form of RCS command. + + If you don't hit another Control-C while the CVS process has control, + it is likely to continue onto the next task assuming that the earlier + one did its job. It is not enough to hit two Control-C's. You might + simply kill two child processes and not interrupt CVS at all. + Depending on the speed of your processor, your terminal and your + fingers, you might have to hit dozens of Control-C's to stop the damn + thing. + + Executing a CVS command, such as "commit" or "tag" that writes to the + files is a different matter. + + Since CVS is not a full-fledged database, with what database people + call "commit points", merely stopping the process will not back out + the "transaction" and place you back in the starting blocks. CVS has + no concept of an "atomic" transaction or of "backtracking", which + means that a command can be half-executed. + + Hitting Control-C will usually leave lock files that you have to go + clean up in the Repository. + + Example1: + + If you interrupt a multi-file "commit" in the middle of + an RCS checkin, RCS will leave the file either fully + checked-in or in its original state. But CVS might have + been half-way through the list of files to commit. The + directory or module will be inconsistent. + + To recover, you must remove the lock files, then decide + whether you want to back out or finish the job. + + To back out, you'll have to apply the "admin -o" + command, very carefully, to remove the newly committed + revisions. This is usually a bad idea, but is + occasionally necessary. + + To finish, you can simply retype the same commit command. + CVS will figure out what files are still modified and + commit them. It helps that RCS doesn't leave a file in an + intermediate state. + + Example2: + + If you interrupt a multi-file "tag" command, you have a + problem similar, but not equivalent, to interrupting a + "commit". The RCS file will still be consistent, but + unlike "commit", which only *adds* to the RCS file, "tag" + can *move* a tag and it doesn't keep a history of what + revision a tag used to be attached to. + + Normally, you have little choice but to re-execute the + command and allow it to tag everything consistently. + + You might be able to recover by carefully re-applying the + tags via the "cvs admin -N" command, but you'll still have + to dig up from outside sources the information you use to + determine what tag was on what revision in what file. + the Repository, or by using the equivalent: "cvs admin". + + Halting a new "checkout" should cause no harm. If you don't want it, + "release" (or rm -rf) it. If you do want it, re-execute the command. A + repeated "checkout" from above a directory acts like a repeated + "update -d" within it. + + Halting "update" half-way will give you an unpredictable collection of + files and revisions. To continue, you can rerun the update and it + should move you forward into in a known state. To back out, you'll + have to examine the output from the first "update" command, take a + look at each file that was modified and reconstruct the previous state + by editing the ./CVS/Entries file and by using "cvs admin". Good Luck. + + Last modified: _6/13/1997_ + + 13. How do I turn off the "admin" command? + + In the current revision, you'd have to edit the source code. + + Last modified: _6/13/1997_ + + 14. How do I turn off the ability to disable history via "cvs -l"? + + In the current revision, you'd have to edit the source code. + + Last modified: _6/13/1997_ + + 15. How do I keep certain people from accessing certain directories? + + If you don't try to run CVS set[ug]id, you can use Unix groups and + permissions to limit access to the Repository. + + If you only want to limit "commit" commands, you can write a program + to put in the "commitinfo" file. In the "contrib" directory, there are + a few scripts that might help you out. + + Last modified: _6/13/1997_ + + Category: /User_Tasks_/Getting_Started/ + + " + Getting Started" + + 1. What is the first thing I have to know? + + Your organization has most likely assigned one or more persons to + understand, baby-sit and administer the CVS programs and the data + Repository. I call these persons Repository Administrators. They + should have set up a Repository and "imported" files into it. + + If you don't believe anyone has this responsibility, or you are just + testing CVS, then *you* are the Repository Administrator. + + If you are a normal user of CVS ask your Repository Administrator what + module you should check out. + + Then you can work. + + If you *are* the Repository Administrator, you will want to read + everything you can get your hands on, including this FAQ. Source + control issues can be difficult, especially when you get to branches + and release planning. Expect to feel stupid for a few days/weeks. + + No tool in the universe avoids the need for intelligent organization. + In other words, there are all sorts of related issues you will + probably have to learn. Don't expect to dive in without any + preparation, stuff your 300 Megabytes of sources into CVS and expect + to start working. If you don't prepare first, you will probably spend + a few sleepless nights. + + Last modified: _6/13/1997_ + + 2. Where do I work? + + Wherever you have disk space. That's one of the advantages of CVS: you + use the "checkout" command to copy files from the Repository to your + working directory, which can be anywhere you have the space. + + Your local group might have conventions for where to work. Ask your + peers. + + Last modified: _6/13/1997_ + + 3. What does CVS use from my environment? + + You must set two environment variables. Some shells share these + variables with local shell variables using a different syntax. You'll + have to learn how your shell handles them. + + Variable Value (or action) + --------- --------------------- + CVSROOT Absolute pathname of the head of your Repository. + + PATH Normally set to a list of ':'-separated directory + pathnames searched to find executables. You must + make sure "cvs" is in one of the directories. + + If your CVS was built with the RCSBIN directory set + to null (""), and you don't set the RCSBIN + variable mentioned below, then the RCS commands + also must be somewhere in your PATH. + + Optional variables: (Used if set, but ignored otherwise.) + + Variable Value (or action) + --------- --------------------- + CVSEDITOR The name of your favorite fast-start editor + program. You'll be kicked into your editor to + supply revision comments if you don't specify them + via -m "Log message" on the command line. + + EDITOR Used if CVSEDITOR doesn't exist. If EDITOR + doesn't exist, CVS uses a configured constant, + usually, "vi". + + CVSREAD Sets files to read-only on "checkout". + + RCSBIN Changes where CVS finds the RCS commands. + + CVSIGNORE Adds to the ignore list. See Section 2D. + + Other variables used by CVS that are normally set upon login: + + Variable Value (or action) + --------- --------------------- + LOGNAME Used to find the real user name. + + USER Used to find the real user name if no LOGNAME. + + HOME Used to determine your home directory, if set. + Otherwise LOGNAME/USER/getuid() are used to find + your home directory from the passwd file. + + TMPDIR Used during import. It might also be used if your + platform's version of mktemp(3) is unusual, or + you have changed the source to use tmpnam(3). + + Last modified: _6/13/1997_ + + 4. OK, I've been told that CVS is set up, my module is named "ralph" and I + have to start editing. What do I type? + + cd <where you have some space to work> + cvs checkout ralph + cd ralph + + And hack away. + + Last modified: _6/13/1997_ + + 5. I have been using RCS for a while. Can I convert to CVS without losing + my revision history? How about converting from SCCS? + + If you are asking such questions, you are not a mere user of CVS, but + one of its Administrators! You should take a look at Section 4A, + "Installing CVS" and Section 4B, "Setting up and Managing the + Repository". + + Last modified: _6/13/1997_ + + Category: /User_Tasks_/Less_Common_User_Tas/ + + " + Less Common User Tasks" + + 1. Can I create non-CVS sub-directories in my working directory? + + Yes. Unless the directory exists in the Repository, "update" will skip + over them and print a '?' the way it does for files you forgot to add. + You can avoid seeing the '?' by adding the name of the foreign + directory to the ./.cvsignore file, just ask you can do with files. + + If you explicitly mention a foreign directory on the "update" command + line, it will traverse the directory and waste a bit of time, but if + any directory or sub-directory lacks the ./CVS administrative + directory, CVS will print an error and abort. + + Last modified: _6/13/1997_ + + 2. How do I add new sub-directories to the Repository? + + The "add" command will work on directories. You type: + + mkdir <dir> + cvs add <dir> + + It will respond: + + Directory /Repos/<dir> added to the repository + + and will create both a matching directory in the Repository and a + ./CVS administrative directory within the local <dir> directory. + + Last modified: _6/13/1997_ + + 3. How do I remove a file I don't need? + + (See the questions in Section 4B on removing files from the + Repository.) + + You type: + + rm <file> + cvs remove <file> + + CVS registers the file for removal. To complete the removal, you must + type: + + cvs commit <file> + + CVS moves the file to the Attic associated with your working + directory. Each directory in the Repository stores its deleted files + in an Attic sub-directory. A normal "checkout" doesn't look in the + Attic, but if you specify a tag, a date or a revision, the "checkout" + (or "update") command will retrieve files from the Attic with that + tag, date or revision. + + Last modified: _6/13/1997_ + + 4. How do I rename a file? + + CVS does not offer a way to rename a file in a way that CVS can track + later. See Section 4B for more information. + + Here is the best (to some, the only acceptable) way to get the effect + of renaming, while preserving the change log: + + Copy the RCS (",v") file directly in the Repository. + + cp $CVSROOT/<odir>/<ofile>,v $CVSROOT/<ndir>/<nfile>,v + + By duplicating the file, you will preserve the change history and the + ability to retrieve earlier revisions of the old file via the "-r + <tag/rev>" or "-D <date>" options to "checkout" and "update". + + Remove the old file using CVS. + + cd <working-dir>/<odir> rm <ofile> + cvs remove <ofile> + cvs commit <ofile> + + This will move the <ofile> to the Attic associated with <odir>. + + Retrieve <nfile> and remove all the Tags from it. + + By stripping off all the old Tags, "checkout -r" and "update -r" won't + retrieve revisions Tagged before the renaming. + + cd <working-dir>/<ndir> + cvs update <nfile> + cvs log <nfile> # Save the list of Tags + cvs tag -d <tag1> <nfile> + cvs tag -d <tag2> <nfile> + . . . + + This technique can be used to rename files within one directory or + across different directories. You can apply this idea to directories + too, as long as you apply the above to each file and don't delete the + old directory. + + Of course, you have to change your build system (e.g. Makefile) in + your <working-dir> to know about the name change. + + Warning: Stripping the old tags from the copied file will allow "-r + <tag>" to do the right thing, but you will still have problems with + "-D <date>" because there is no place to store the "deletion time". + See 5B.3 for more details. + + Last modified: _6/13/1997_ + + 5. How do I make sure that all the files and directories in my working + directory are really in the Repository? + + A "cvs update", or "cvs -n update" (which won't modify your working + directory) will display foreign elements, which have no counterpart in + the Repository, preceded by a '?'. To register foreign directories, + you can use "cvs add". To register foreign files, you can use "cvs + add" followed by "cvs commit". + + You could also checkout your module, or the Repository directory + associated with your working directory, a second time into another + work area and compare it to your working directory using the (non-CVS) + "diff -r" command. + + By default many patterns of files are ignored. If you create a file + named "core" or a file ending in ".o", it is usually ignored. If you + really want to see all the files that aren't in the Repository, you + can use a special "ignore" pattern to say "ignore no files". Try + executing: (You may have to quote or backwhack (i.e. precede by '\') + the '!' in your shell.) + + cvs -n update -I ! + + The above command will display not only the normal modified, update + and conflict indicators ('M', 'U', and 'C' respectively) on files + within the Repository, but it will also display each file not in the + Repository preceded by a '?' character. + + The '-n' option will not allow "update" to alter your working + directory. + + Last modified: _6/13/1997_ + + 6. How do I create a branch? + + Type this in your working directory: + + cvs tag -b <branch_tag> + + and you will create a branch. No files have real branches in them yet, + but if you move onto the branch by typing: + + cvs update -r <branch_tag> + + and commit a file in the normal way: + + cvs commit <file> + + then a branch will be created in the underlying <file>,v file and the + new revision of <file> will appear only on that branch. + + See Section 4C, on Branching. + + Last modified: _6/13/1997_ + + 7. How do I modify the modules file? How about the other files in the + CVSROOT administrative area? + + A module named "modules" has been provided in the default modules + file, so you can type: + + cvs checkout modules + cd modules + + Another module named CVSROOT has been provided in the default modules + file, covering all the administrative files. Type: + + cvs checkout CVSROOT + cd CVSROOT + + Then you can edit your files, followed by: + + cvs commit + + If you start with the provided template for the "modules" file, the + CVSROOT and the "modules" module will have the "mkmodules" program as + a "commit helper". After a file is committed to such a module, + "mkmodules" will convert a number of standard files (See 4B.2) in the + CVSROOT directory inside the Repository into a form that is usable by + CVS. + + Last modified: _6/13/1997_ + + 8. How do I split a file into pieces, retaining revision histories? + + If you and a coworker find yourselves repeatedly committing the same + file, but never for changes in the same area of the file, you might + want to split the file into two or more pieces. If you are both + changing the same section of code, splitting the file is of no use. + You should talk to each other instead. + + If you decide to split the file, here's a suggestion. In many ways, it + is similar to multiple "renamings" as described in 2C.4 above. + + Say you want to split <fileA>, which already in the Repository, into + three pieces, <fileA>, <fileB> and <fileC>. + + Copy the RCS (",v") files directly in the Repository, creating the + new files, then bring readable copies of the new files into the + working directory via "update". + + cp $CVSROOT/<path>/<fileA>,v $CVSROOT/<path>/<fileB>,v cp + $CVSROOT/<path>/<fileA>,v $CVSROOT/<path>/<fileC>,v + cvs update <fileB> <fileC> + + Then remove all the <tags> from the new files by using: + + cvs log <fileB> <fileC> # Save the list of <tag?> + cvs tag -d <tag1> <fileB> <fileC> + cvs tag -d <tag2> <fileB> <fileC> + . . . + + Edit each file until it has the data you want in it. This is a + hand-editing job, not something CVS can handle. Then commit all the + files. + + [From experience, I'd suggest making sure that only one copy of each + line of code exists among the three files, except for "include" + statements, which must be duplicated. And make sure the code + compiles.] + + emacs <fileA> <fileB> <fileC> + cvs commit <fileA> <fileB> <fileC> + + As in the "rename" case, by duplicating the files, you'll preserve the + change history and the ability to retrieve earlier revisions. + + Of course, you have to alter your build system (e.g. Makefiles) to + take the new names and the change in contents into account. + + Last modified: _6/13/1997_ + + Category: /What_is_CVS_/ + + " What is CVS? " + + Category: /What_is_CVS_/How_does_CVS_differ_/ + + " + How does CVS differ from other, similar software?" + + 1. How does CVS differ from RCS? + + CVS uses RCS to do much of its work and absolutely all the work of + changing the underlying RCS files in the Repository. + + RCS comprises a set of programs designed to keep track of changes to + individual files. Of course, it also allows you to refer to multiple + files on the command line, but they are handled by iterating over + individual files. There is no pretense of coordinated interaction + among groups of files. + + CVS's main intent is to provide a set of grouping functions that allow + you to treat a collection of RCS files as a single object. Of course, + CVS also has to do a lot of iteration, but it tries its best to hide + that it is doing so. In addition, CVS has some truly group-oriented + facets, such as the modules file and the CVS administrative files that + refer to a whole directory or module. + + One group aspect that can be a bit confusing is that a CVS branch is + not the same as an RCS branch. To support a CVS branch, CVS uses + "tags" (what RCS calls "symbols") and some local state, in addition to + RCS branches. + + Other features offered by CVS that are not supported directly by RCS + are + + Automatic determination of the state of a file, (e.g. modified, + up-to-date with the Repository, already tagged with the same string, + etc.) which helps in limiting the amount of displayed text you have to + wade through to figure out what changed and what to do next. + + A copy-modify-merge scheme that avoids locking the files and allows + simultaneous development on a single file. + + Serialization of commits. CVS requires you to merge all changes + committed (via "update") since you checked out your working copy of + the file. Although it is still possible to commit a file filled with + old data, it is less likely than when using raw RCS. + + Relatively easy merging of releases from external Vendors. + + Last modified: _6/13/1997_ + + 2. How does CVS differ from SCCS? + + SCCS is much closer to RCS than to CVS, so some of the previous entry + applies. + + You might want to take a look at Walter Tichy's papers on RCS, which + are referred to in the RCS man pages. + + [[More info here?]] + + Last modified: _6/13/1997_ + + 3. How does CVS differ from ClearCase? + + ClearCase is a distributed client-server version control system. + ClearCase is a variant DSEE tools, formerly available on Apollo + platforms. The ClearCase tool set includes a few X-based interface + tools, a command-line interface, and C programmer API. It is currently + available on Sun, HP, SGI and OSF/1 platforms. + + ClearCase uses a special Unix filesystem type, called "mvfs" for + "multi-version file system". Conceptually, mvfs adds another dimension + to a regular Unix filesystem. The new axis is used to store the + different versions of files and to provide a tree-hierarchical view of + a collection of objects that might be scattered across any number of + separate hosts on your local network. + + Each user acquires a "view" into the file database by creating a + special mvfs mount point on their machine. Each view has a + "configuration spec" containing a set of selection rules that specify + the particular version of each file to make visible in that view. You + can think of a "view" as a work area in CVS, except that the files + don't really exist on your local disk until you modify them. This + technique conserves disk space because it doesn't keep private copies + of read-only files. + + Another advantage is that a view is "transparent" in the sense that + all of the files in a "view" appear to be regular Unix files to other + tools and Unix system calls. An extended naming convention allows + access to particular versions of a file directly: + "test.cc@@/main/bugfix/3" identifies the third version of test.c on + the bugfix branch. + + ClearCase supports both the copy-modify-merge model of CVS (by using + what are called "unreserved checkouts" and the checkin/checkout + development model with file locking. Directories are + version-controlled objects as well as files. A graphical merge tool is + provided. Like RCS, ClearCase supports branches, symbolic tags, and + delta compression. ASCII as well as binary files are supported, and + converters from RCS, SCCS, DSEE formats are also included. + + A make-compatible build facility is provided that can identify common + object code and share it among developers. A build auditing feature + automatically records file dependencies by tracking every file that is + opened when producing a derived object, thus making explicit + dependency lists unnecessary. Pre- and post-event triggers are + available for most ClearCase operations to invoke user programs or + shell scripts. User-defined attributes can be assigned to any version + or object. Hyper-links between version controlled objects can record + their relationship. + + For more information, contact: + + Atria Software, Inc. 24 Prime Park Way Natick, MA 01760 info@atria.com + + (508) 650-1193 (phone) (508) 650-1196 (fax) + + Originally contributed by Steve Turner + Edited by the author of this FAQ. + + Last modified: _6/13/1997_ + + 4. How does CVS differ from TeamWare/SparcWorks? + + TeamWare is a configuration management tool from Sun Microsystems, a + part of SparcWorks. It uses the same copy and merge model as CVS. The + central abstraction is a workspace, which corresponds to either a CVS + branch or a checked out module. TeamWare allows you to manipulate + workspaces directly, including moving and merging code between + workspaces. You can put your workspace on tape and continue to work + with it at home, just like you can with CVS. TeamWare is built upon + and compatible with SCCS. + + TeamWare provides both a command line interface and a graphical + interface. The CodeManager tool will display the project as a tree of + workspaces, and allows you to manipulate them with drag and drop. The + other tools are VersionTool that displays and manipulates a dag with a + version history of a single file, CheckPoint that will create symbolic + tags, MakeTool, a make compatible tool with a GUI, and FileMerge which + will interactively merge files when needed (like emerge for emacs). If + you have a sun, you can try /usr/old/mergetool for an old SunView + version of FileMerge. + + Email: sunprosig@sun.com + + Originally extracted from TeamWare + Marketing literature by Per Abrahamsen. + Edited by the author of this FAQ. + + For more information, contact: + + SunExpress, Inc. P.O. Box 4426 Bridgeton, MO 63044-9863 (800)873-7869 + + Last modified: _6/13/1997_ + + 5. How does CVS differ from Aegis? + + Aegis appears to be a policy-setting tool that allows you to use other + sub-programs (make, RCS, etc.) to implement pieces of the imposed + policy. + + The initial document seems to say that most Unix tools are inadequate + for use under Aegis. + + It is not really similar to CVS and requires a different mindset. + + [[Need more info here.]] + + Last modified: _6/13/1997_ + + 6. How does CVS differ from Shapetools? + + Shapetools includes a build mechanism (called Shape, not surprisingly) + that is aware of the version mechanism, and some dependency tracking. + It is based on a file system extension called Attributed File System, + which allows arbitrary-sized "attributes" to be associated with a + file. Files are version controlled in a manner similar to RCS. + Configurations are managed through the Shapefile, an extension of the + Makefile syntax and functionality. Shape includes version selection + rules to allow sophisticated selection of component versions in a + build. + + Shapetools' concurrency control is pessimistic, in contrast to that of + CVS. Also, there's very limited support for branching and merging. It + has a built-in policy for transitioning a system from initial + development to production. + + Contributed by Don Dwiggins + + Last modified: _6/13/1997_ + + 7. How does CVS differ from TeamNet? + + TeamNet is a configuration management tool from TeamOne. + + For more information, contact: + + TeamOne 710 Lakeway Drive, Ste 100 Sunnyvale, CA 94086 (800) 442-6650 + + Contributed by Steve Turner + + Last modified: _6/13/1997_ + + 8. How does CVS differ from ProFrame? + + ProFrame is a new system integration framework from IBM. ProFrame is + compliant with the CFI (CAD Framework Initiative) industry standards, + including the Scheme extension language. + + ProFrame consists of three major components: (1) the Process Manager + that automates your local design methodology (2) the Design Data + Manager handles configuration management, and (3) Inter-tool + Communication to provide a communication path among tools running on + heterogeneous servers. + + The Design Data Manager(2) is probably the appropriate component to + compare to CVS. The Design Data Manager provides version control with + checkin/checkout capability, configuration management, and data + dependency tracking. A graphical data selection interface is provided. + Using this interface, you may create and manipulate objects and + hierarchy structures, view the revision history for an object, and + view and assign attributes to a design object. + + The ProFrame server currently runs only on RS6000, but clients may be + a wide variety of Unix platforms. Contact IBM for the latest platform + information. + + For more information, contact: + + IBM EDA Marketing and Sales P.O. Box 950, M/S P121 Poughkeepsie, NY + 12602 (800) 332-0066 + + Contributed by Steve Turner + [extracted from the ProFrame 1.1.0 datasheet] + + Last modified: _6/13/1997_ + + 9. How does CVS differ from CaseWare/CM? + + CaseWare/CM is a software configuration management product from + CaseWare, Inc. CaseWare/CM may be customized to support a wide variety + of methodologies, including various phases of the software lifecycle, + and different access rights for users. + + A GUI is provided to view version histories and configurations. A + merge tools is also included. CaseWare supports type-specific + lifecycles, which allows different types of files to move through + different lifecycles. Also provided is a build facility to support + automatic dependency analysis, parallel, distributed, and remote + builds, and variant releases. + + CaseWare/CM has been integrated with other CASE tools, including + FrameMaker, ALSYS Ada, CodeCenter/Object Center, HP SoftBench, and + Software Through Pictures. CaseWare also offers CaseWare/PT, a problem + tracking system to integrate change requests with configuration + management. + + Multiple vendors and operating systems are supported. + + For more information, contact: + + CaseWare, Inc. 108 Pacifica, 2nd Floor Irvine, CA 92718-3332 (714) + 453-2200 (phone) (714) 453-2276 (fax) + + Contributed by Steve Turner + [extracted from the CaseWare/CM data sheet] + + Last modified: _6/13/1997_ + + 10. How does CVS differ from Sublime? + + Produced by AT&T. Sablime uses SCCS as the underlying source code + control system. It uses some other control system (called sbcs I + think) for managing binary files. It uses lock, edit, comit, unlock + mechanism. It has a motif based GUI and curses based GUI (that works + only with ksh, not tcsh, or bash) to do more common tasks. It has even + a command line interface. + + Changing source happens as a result of MR. A testing person or a + developer assigns an MR (modification request) to a group of people. + They are allowed to take out files under that MR and change them and + check them back in. You can set up dependencies between and MR and do + release management to say "I want the sources to include these MRs" + etc. It is a reasonably good maintanance system. It is bit heavy + weight though, and the interface is not too polished and does not work + on windows (though that may have changed). rama@savera.com + + Last modified: _12/12/1997_ + + 11. How does CVS differ from PVCS? + + PVCS works on single files like RCS and SCCS, CVS works on complete + subsystems. PVCS has a make utility (called a configuration builder), + CVS does not. PVCS has a GUI interface for Unix, DOS, OS/2, and MS + Windows. + + Intersolv, Inc. + 1700 NW 167th Place + OR 97006 + + Contributed by Per Abrahamsen + [Extracted from Intersolv Marketing literature.] + + Last modified: _6/13/1997_ + + 12. How does CVS differ from CMVC? + + CMVC is an IBM Configuration Management and Version Control system. + (Though I'm not certain that's the right acronym expansion.) It runs + on Suns, HPs, RS6000s, OS/2 and Windows. + + Other than revision control, it apparently has features to manage + releases, bug tracking and the connection between alterations and + reported bugs and feature requests. It is a client/server system, + based on a choice of commercial Relational Database systems, and it + provides a Motif or command line interface. + + Unlike CVS, it uses a strict locking protocol to serialize source code + alterations. + + Last modified: _6/13/1997_ + + Category: /What_is_CVS_/What_do_you_mean_by_/ + + " + What do you mean by . . .? (Definitions)" + + 1. What are "The Repository", "$CVSROOT" and "CVSROOT"? + + The Repository is a directory tree containing the CVS administrative + files and all the RCS files that constitute "imported" or "committed" + work. The Repository is kept in a shared area, separate from the + working areas of all developers. + + Users of CVS must set their "CVSROOT" environment variable to the + absolute pathname of the head of the Repository. Most command line + interpreters replace an instance of "$CVSROOT" with the value of the + "CVSROOT" environment variable. By analogy, in this document + "$CVSROOT" is used as shorthand for "the absolute pathname of the + directory at the head of the Repository". + + One of the things found in $CVSROOT is a directory named CVSROOT. It + contains all the "state", the administrative files, that CVS needs + during execution. The "modules", "history", "commitinfo", "loginfo" + and other files can be found there. See 4B.2 for more information + about CVSROOT files. + + Last modified: _6/13/1997_ + + 2. What is an RCS file? + + An RCS file is a text file containing the source text and the revision + history for all committed revisions of a source file. It is stored + separately from the working files, in a directory hierarchy, called + the Repository. + + RCS is the "Revision Control System" that CVS uses to manage + individual files. RCS file names normally end in ",v", but that can be + altered (via the RCS -x option) to conform to file naming standards on + platforms with unusual filename limitations. + + Last modified: _6/13/1997_ + + 3. What is a working file? + + A working file is a disk file containing a checked-out copy of a + source file that earlier had been placed under CVS. If the working + file has been edited, the changes since the last committed revision + are invisible to other users of CVS. + + Last modified: _6/13/1997_ + + 4. What is a working directory (or working area)? + + A working directory is the place where you work and the place from + which you "commit" files. + + The "checkout" command creates a tree of working directories, filling + them with working files. Each working directory contains a + sub-directory named ./CVS containing three administrative files, which + are created by "checkout" and are always present: + + ./CVS/Entries + contains information about working files. + + ./CVS/Repository + contains the location of the directory within the + Repository that was used to create the working directory. + + ./CVS/Root + contains the value of $CVSROOT at the time you created + the working directory. + + Other files may also appear in ./CVS depending on the state of your + working directory: + + ./CVS/Tag + contains the "sticky tag" associated with the whole + directory. See 3A.2 for its main purpose. + [Created by "checkout" or "update" when using "-r <tag>".] + [Deleted by "checkout" or "update" when using '-A'.] + + ./CVS/Entries.Static + contains a fixed list of working files. If this file + exists, an "update" doesn't automatically bring newly + added files out of the Repository. + [Created and maintained by hand.] + + ./CVS/Checkin.prog + contains a program to run whenever anything in the + working directory is committed. + [Created by checkout if "-i <prog>" appears in the + modules file for the checked-out module.] + + ./CVS/Update.prog + contains a program to run whenever anything in the + working directory is updated. + [Created by checkout if "-u <prog>" appears in the + modules file for the checked-out module.] + + ./CVS/<file>,p ./CVS/<file>,t + contain (possibly zero-length) state information about an + "add" that has not been committed. + [Created by "add".] + [Deleted by "commit" or "remove".] + + Last modified: _6/13/1997_ + + 5. What is "checking out"? + + "Checking out" is the act of using the "checkout" command to copy a + particular revision from a set of RCS files into your working area. + You normally execute "checkout" only once per working directory (or + tree of working directories), maintaining them thereafter with the + "update" command. + + See section 3C on the "checkout" command. + + Last modified: _6/13/1997_ + + 6. What is a revision? + + A "revision" is a version of a file that was "committed" ("checked + in", in RCS terms) some time in the past. CVS (and RCS) can retrieve + any file that was committed by specifying its revision number or its + "tag" ("symbolic name", in RCS terms). + + In CVS, a "tag" is more useful than a revision number. It usually + marks a milestone in development represented by different revision + numbers in different files, all available as one "tagged" collection. + + Sometimes the word "revision" is used as shorthand for "the file you + get if you retrieve (via "checkout" or "update") the given revision + from the Repository." + + Last modified: _6/13/1997_ + + 7. What is a "Tag"? + + A "Tag" is a symbolic name, a synonym or alias for a particular + revision number in a file. The CVS "tag" command places the same "Tag" + on all files in a working directory, allowing you to retrieve those + files by name in the future. + + The CVS "Tag" is implemented by applying RCS "symbols" to each + individual file. The Tags on a file (or collection of files) may be + displayed using the "log" command. + + Last modified: _6/13/1997_ + + 8. What are "HEAD" and "BASE"? + + HEAD and BASE are built-in tags that don't show up in the "log" or + "status" listings. They are interpreted directly by CVS. + + "HEAD" refers to the latest revision on the current branch in the + Repository. The current branch is either the main line of development, + or a branch in development created by placing a branch tag on a set of + files and checking out that branch. + + "BASE" refers to the revision on the current branch you last checked + out, updated, or committed. If you have not modified your working + file, "BASE" is the committed revision matching it. + + Most of the time BASE and HEAD refer to the same revision. They can + become different in two ways: + + Someone else changed HEAD by committing a new revision of your file + to the Repository. You can pull BASE up to equal HEAD by executing + "update". + + You moved BASE backward by executing "checkout" or "update" with the + option "-r <rev/tag>" or "-D <date>". CVS records a sticky tag and + moves your files to the specified earlier revision. You can clear the + sticky tag and pull BASE up to equal HEAD again by executing "update + -A". + + Last modified: _6/13/1997_ + + 9. What is a Branch? + + In general, a branch is any mechanism that allows one or more + developers to modify a file without affecting anyone other than those + working on the same branch. + + There are four kinds of "branch" CVS can manage: + + The Vendor Branch. + + A single vendor branch is supported. The "import" command takes a + sequence of releases from a source code vendor (called a "vendor" even + if no money is involved), placing them on a special "Vendor" branch. + The Vendor branch is considered part of the "Main line" of + development, though it must be merged into locally modified files on + the RCS Main branch before the "import" is complete. + + See Section 3H ("import"). + + Your Working directory. + + A checked-out working directory, can be treated like a private branch. + No one but you can touch your files. You have complete control over + when you include work committed by others. However, you can't commit + or tag intermediate versions of your work. + + A Development branch. + + A group of developers can share changes among the group, without + affecting the Main line of development, by creating a branch. Only + those who have checked-out the branch see the changes committed to + that branch. This kind of branch is usually temporary, collapsing + (i.e. merge and forget) into the Main line when the project requiring + the branch is completed. + + You can also create a private branch of this type, allowing an + individual to commit (and tag) intermediate revisions without changing + the Main line. It should be managed exactly like a Development Branch + -- collapsed into the Main line (or its parent branch, if that is not + the Main Branch) and forgotten when the work is done. + + A Release branch. + + At release time, a branch should be created marking what was released. + Later, small changes (sometimes called "patches") can be made to the + release without including everything else on the Main line of + development. You avoid forcing the customer to accept new, possibly + untested, features added since the release. This is also the way to + correct bugs found during testing in an environment where other + developers have continued to commit to the Main line while you are + testing and packaging the release. + + Although the internal format of this type of branch (branch tag and + RCS branches) is the same as in a development branch, its purpose and + the way it is managed are different. The major difference is that a + Release branch is normally Permanent. Once you let a release out the + door to customers, or to the next stage of whatever process you are + using, you should retain forever the branch marking that release. + + Since the branch is permanent, you cannot incorporate the branch fixes + into the Main line by "collapsing" (merging and forgetting) the + release branch. For large changes to many files on the release branch, + you will have to perform a branch merge using "update -j <rev> -j + <rev>". (See 4C.7) + + The most common way to merge small changes back into Main line + development is to make the change in both places simultaneously. This + is faster than trying to perform a selective merge. + + See 1D.12 (merges) and Section 4C, on Branching for more info. + + Last modified: _6/13/1997_ + + 10. What is "the trunk"? + + Another name for the RCS Main Branch. The RCS Main Branch is related, + but not equivalent, to both the CVS Main branch and what developers + consider to be the Main line of development. See 3H.3 and Section 4C + on Branching. + + Last modified: _6/13/1997_ + + 11. What is a module? + + In essence, a module is a name you hand to the "checkout" command to + retrieve one or more files to work on. It was originally intended to + be a simple, unique name in the "modules" file attached to a directory + or a subset of files within a directory. + + The module idea is now a somewhat slippery concept that can be defined + in two different ways: + * A module is an argument to "checkout". There are three types: + 1. An entry in the modules file. A "module" name as described in + 'B.' below. + 2. A relative path to a directory or file in the Repository. + 3. A mixed-mode string of "modulename/relative-path". Everything + up to the first slash ('/') is looked up as a module. The + relative path is appended to the directory associated with + the module name and the resulting path is checked out as in + #2 above. + * A module is a unique (within the file) character string in the + first column of the modules file. There are five types: + 1. A name for a directory within the Repository that allows you + to ignore the parent directories above it. + Example: + emacs gnu/emacs + 2. A name for a subset of the files within such a directory. + Example: + ls unix/bin Makefile ls.c + The 2nd through Nth strings in the above can be files, + directories or module substitutions. No relative paths. + A module substitution occurs when you use a '&module-name' + reference. The module-name referred to is logically + substituted for the '&module-name' string. + 3. A relative pathname to a directory within the Repository + which, when checked out, creates an image of part of the + Repository structure in your current directory. + Example: + gnu/emacs -o /bin/emacs.helper gnu/emacs + The files checked out are exactly the same as the files + "checkout" would retrieve if the path weren't even in the + modules file. The only reason to put this kind of relative + pathname into the modules file is to hook one of the helper + functions onto it. + 4. A relative pathname to a single file within the Repository + which, when checked out, creates something you probably don't + want: It creates a directory by the name of the file and puts + the file in it. + Example: + gnu/emacs/Makefile -o /bin/emacs.helper gnu/emacs Makefile + The file checked out is the same as what you would get if you + handed the relative pathname to the "checkout" command. But + it puts it in a strange place. The only reason to do this is + to hook a helper function onto a specific file name. + 5. An alias consisting of a list of any of the above, including + other aliases, plus exceptions. + Example: + my_work -a emacs !emacs/tests gnu/bison unix/bin/ls.c + The exception "!emacs/test" above is functionally equivalent + to specifying "!emacs/tests" on the "checkout" command line. + + Another way to look at it is that the modules file is simply another + way to "name" files. The hierarchical directory structure provides + another. You should use whatever turns out to be simplest for your + development group. + + See 4G.2 for some specific ideas about how to use the modules file. + + Last modified: _11/12/1997_ + + 12. What does "merge" mean? + + A merge is a way of combining changes made in two independent copies + of a common starting file. Checking out an RCS revision produces a + file, so for the purposes of a merge "file" and "revision" are + equivalent. So, we can say there are always three "files" involved in + a merge: + + The original, starting, "base" or "branch point" file. + + A copy of the base file modified in one way. + + Another copy of the base file modified in a different way. + + Humans aren't very good at handling three things at once, so the + terminology dealing with merges can become strained. One way to think + about it is that all merges are performed by inserting the difference + between a base revision and a later revision (committed by someone + else) into your working file. Both the "later" revision and your + working file are presumed to have started life as a copy of the "base" + revision. + + In CVS, there are three main types of "merge": + + The "update" command automatically merges revisions committed by + others into your working file. In this case, the three files involved + in the merge are: + + Base: The revision you originally checked out. Later: A revision + committed onto the current branch after you checked out the Base + revision. Working: Your working file. The one lying in the working + directory containing changes you have made. + + The "update -j <branch_tag> {optional files}" command merges changes + made on the given branch into your working files, which is presumed to + be on the Main line of development. + + See 4C.6 + + The "update -j <rev> -j <rev> {optional files}" command merges the + difference between two specified revisions into files in your working + directory. The two revisions <rev> are usually on the same branch and, + when updating multiple files, they are most useful when they are Tag + names rather than numeric revisions. + + See 4C.7 + + Last modified: _6/13/1997_ + + Category: /What_is_CVS_/What_is_CVS_Whats_it/ + + " + What is CVS? What's it for? Why CVS?" + + 1. What does CVS stand for? Can you describe it in one sentence? + + "CVS" is an acronym for the "Concurrent Versions System". + + CVS is a "Source Control" or "Revision Control" tool designed to keep + track of source changes made by groups of developers working on the + same files, allowing them to stay in sync with each other as each + individual chooses. + + Last modified: _6/13/1997_ + + 2. What is CVS for? What does it do for me? + + CVS is used to keep track of collections of files in a shared + directory called "The Repository". Each collection of files can be + given a "module" name, which is used to "checkout" that collection. + + After checkout, files can be modified (using your favorite editor), + "committed" back into the Repository and compared against earlier + revisions. Collections of files can be "tagged" with a symbolic name + for later retrieval. + + You can add new files, remove files you no longer want, ask for + information about sets of files in three different ways, produce patch + "diffs" from a base revision and merge the committed changes of other + developers into your working files. + + Last modified: _6/13/1997_ + + 3. How does CVS work? + + CVS saves its version-control information in RCS files stored in a + directory hierarchy, called the Repository, which is separate from the + user's working directory. + + Files in the Repository are stored in a format dictated by the RCS + commands CVS uses to do much of its real work. RCS files are standard + byte-stream files with an internal format described by keywords stored + in the files themselves. + + To begin work, you execute a "checkout" command, handing it a module + name or directory path (relative to the $CVSROOT variable) you want to + work on. CVS copies the latest revision of each file in the specified + module or directory out of the Repository and into a directory tree + created in your current directory. You may specify a particular branch + to work on by symbolic name if you don't want to work on the default + (main or trunk) branch. + + You may then modify files in the new directory tree, build them into + output files and test the results. When you want to make your changes + available to other developers, you "commit" them back into the + Repository. + + Other developers can check out the same files at the same time. To + merge the committed work of others into your working files you use the + "update" command. When your merged files build and test correctly, you + may commit the merged result. This method is referred to as + "copy-modify-merge", which does not require locks on the source files. + + At any time, usually at some milestone, you can "tag" the committed + files, producing a symbolic name that can be handed to a future + "checkout" command. A special form of "tag" produces a branch in + development, as usually happens at "release" time. + + When you no longer plan to modify or refer to your local copy of the + files, they can be removed. + + Last modified: _6/13/1997_ + + 4. What is CVS useful for? + + CVS is intended to handle source control for files in three major + situations: + + Multiple developers working on the same files. + + The major advantage of using CVS over the simpler tools like RCS or + SCCS is that it allows multiple developers to work on the same sources + at the same time. + + The shared Repository provides a rendezvous for committed sources that + allows developers a fair amount of flexibility in how often to publish + (via the "commit" command) changes or include work committed by others + (via the "update" command). + + Tracking a stream of releases from a source vendor. + + If you are making changes to sources distributed by someone else, the + CVS feature, called the Vendor Branch, allows you to combine local + modifications with repeated vendor releases. + + I have found this most useful when dealing with sources from three + major classes of source vendor: + + Large companies who send you tapes full of the latest release (e.g. + Unix OS vendors, database companies). + + Public Domain software which *always* requires work. + + Pseudo-Public sources which may require work. (e.g. GNU programs, X, + CVS itself, etc.) + + Branching development. + + Aside from the "Vendor Branch", there are three kinds of "branches in + development" that CVS can support: + + Your working directory can be treated as a private branch. + + A Development branch can be shared by one or more developers. + + At release time, a branch is usually created for bug fixes. + + (See 1D.9 and Section 4C for more info on branches.) + + CVS's branch support is a bit primitive, but it was designed to allow + you to create branches, work on them for while and merge them back + into the main line of development. You should also be able to merge + work performed on the main branch into the branch you are working on. + Arbitrary sharing and merging between branches is not currently + supported. + + Last modified: _6/13/1997_ + + 5. What is CVS *not* useful for? + + CVS is not a build system. + + Though the structure of your Repository and modules file interact with + your build system (e.g. a tree of Makefiles), they are essentially + independent. + + CVS does not dictate how you build anything. It merely stores files + for retrieval in a tree structure you devise. + + CVS does not dictate how to use disk space in the checked out working + directories. If you require your Makefiles or build procedures to know + the relative positions of everything else, you wind up requiring the + entire Repository to be checked out. That's simply bad planning. + + If you modularize your work, and construct a build system that will + share files (via links, mounts, VPATH in Makefiles, etc.), you can + arrange your disk usage however you like. + + But you have to remember that *any* such system is a lot of work to + construct and maintain. CVS does not address the issues involved. You + must use your brain and a collection of other tools to provide a build + scheme to match your plans. + + Of course, you should use CVS to maintain the tools created to support + such a build system (scripts, Makefiles, etc). + + CVS is not a substitute for management. + + You and your project leaders are expected to plan what you are doing. + Everyone involved must be aware of schedules, merge points, branch + names, release dates and the range of procedures needed to build + products. (If you produce it and someone else uses it, it is a + product.) CVS can't cover for a failure to manage your project. + + CVS is an instrument for making sources dance to your tune. But you + are the piper and the composer. No instrument plays itself or writes + its own music. + + CVS is not a substitute for developer communication. + + When faced with conflicts within a single file, most developers manage + to resolve them without too much effort. But a more general definition + of "conflict" includes problems too difficult to solve without + communication between developers. + + CVS cannot determine when simultaneous changes within a single file, + or across a whole collection of files, will logically conflict with + one another. Its concept of a "conflict" is purely textual, arising + when two changes to the same base file are near enough to spook the + merge command into dropping conflict markers into the merged file. + + CVS is not capable of figuring out distributed conflicts in program + logic. For example, if you change the arguments to function X defined + in file A and, at the same time, edit file B, adding new calls to + function X using the old arguments. You are outside the realm of CVS's + competence. + + Acquire the habit of reading specs and talking to your peers. + + CVS is not a configuration management system. + + CVS is a source control system. The phrase "configuration management" + is a marketing term, not an industry-recognized set of functions. + + A true "configuration management system" would contain elements of the + following: + + * Source control. + * Dependency tracking. + * Build systems (i.e. What to build and how to find + things during a build. What is shared? What is local?) + * Bug tracking. + * Automated Testing procedures. + * Release Engineering documentation and procedures. + * Tape Construction. + * Customer Installation. + * A way for users to run different versions of the same + software on the same host at the same time. + + CVS provides only the first. + + Last modified: _6/13/1997_ + + Category: /What_is_CVS_/Where_do_I_find_CVS_/ + + " + Where do I find CVS? Where can I find Help?" + + 1. How do I get more information about CVS? + + The first thing I would do is to read the Info file that comes with + the CVS sources under "doc". You can format and read the cvs.texinfo + file in two ways: 1. Use TeX to format it and a "dvips" command to + print it and 2. Install the cvs.info files that are created by the + Makefile and read them online using the Emacs "info-mode" or a + stand-alone "info" reader. + + Then I'd run "cvsinit" to set up a Repository and read the man page + while trying out the commands. + + Type "cvs -H" for general help or "cvs -H command" for + command-specific help. + + For background, you can read the original CVS paper (in the source + tree, under "doc"). It describes the purpose of CVS and some of how it + was designed. Note that the emphasis of the document (especially on + multiple vendors providing the same sources) is somewhat out of date. + + For more detailed information about "internals", read the man pages + for RCS. If you are a programmer, you can also read the source code to + CVS. + + Other information and tutorials may be available in the "doc" + directory of the FTP archive described below. + + For current information, and a fair amount of detail, join the + info-cvs mailing list described below. + + Last modified: _6/13/1997_ + + 2. Is there an archive of CVS material? + + An anonymous FTP area has been set up. It contains many of the CVS + files you might want, including extra documentation, patches and a + copy of the latest release. + + ftp ftp.delos.com + >>> User: anonymous + >>> Passwd: <Your Internet address> + cd /pub/cvs + get README + get Index + + The README has more (and more up-to-date) information. The Index + contains a terse list of what is in the archive. + + A WWW home page is also available at http://www.delos.com/cvs. + + Last modified: _6/13/1997_ + + 3. How do I get files out of the archive if I don't have FTP? + + Use one of the FTP<->Email servers. These are the ones I've been told + about: + + FTPMAIL service is available from the same host as the FTP server + described above. Send mail to "ftpmail@delos.com" containing "help" in + the body of the message. For example, on most Unix systems, you can + type: + + echo help | Mail ftpmail@delos.com + + The FTPMAIL server will respond with a document describing how to use + the server. If the "Mail" command doesn't exist on your system, try + "mailx", "/usr/ucb/mail" or "/bin/mail". + + If you are on BITNET, use Princeton's BITFTP server. Type + + echo 'send help' | Mail bitftp@pucc.princeton.edu + + (It is likely that only BITNET addresses can use this one.) + + Other possibilities I've heard of from the net: (Try the one closest + to you.) + + ftpmail@decwrl.dec.com ftpmail@sunsite.unc.edu ftpmail@cs.arizona.edu + ftpmail@cs.uow.edu.au ftpmail@doc.ic.ac.uk + + Last modified: _6/13/1997_ + + 4. How do I get a copy of the latest version of CVS? + + The latest released version of CVS and all the programs it depends on + should be available through anonymous FTP on any FSF archive. The main + FSF archive is at "prep.ai.mit.edu". There are mirrors of the FSF + archive on UUNET and other large Internet sites. + + Program(s) Suggested revision + ----------- ----------------------- + CVS 1.5 + RCS 5.7 (latest version available today) + GNU diff 2.7 (or later) [contained in diffutils-2.7] + GDBM 1.5 (or later) [optional] + + The GNU version of diff is suggested by both the RCS and CVS + configuration instructions because it works better than the standard + version. + + It is a good idea not to accept the versions of CVS, RCS or diff you + find lying on your system unless you have checked out their + provenance. Using inconsistent collections of tools can cause you more + trouble than you can probably afford. + + The FTP archive mentioned above should contain the latest official + release of CVS, some official and unofficial patches and possibly + complete patched versions of CVS in use somewhere. + + Last modified: _6/13/1997_ + + 5. Is there a mailing list devoted to CVS? How do I find it? + + An Internet mailing list named "info-cvs" grew out of the private + mailing list used by the CVS 1.3 alpha testers in early 1992. + Throughout 1994, the list received an average of 100 messages per + month. + + You can add yourself to the mailing list by sending an Email message + to: + + info-cvs-request@prep.ai.mit.edu + + (Don't forget the "-request" or you'll send a message to the whole + list, some of whom are capable of remote execution.) + + Mail to the whole list should be sent to: + + info-cvs@prep.ai.mit.edu + + An archive of the mailing list is maintained in the FTP archive + mentioned above. + + Last modified: _6/13/1997_ + + 6. What happened to the CVS Usenet newsgroup I heard about? + + + A Usenet newsgroup named "gnu.cvs.info" was announced in April + 1993, with an expected creation date of August, 1993. However, + nothing came of this. + + If you want to discuss CVS on usenet, the correct group is + comp.software.config-mgmt (which also covers other configuration + management systems). Someday it might be possible to create a + comp.software.config-mgmt.cvs, but only if there is sufficient + CVS traffic on comp.software.config-mgmt. + + kingdon@cyclic.com + + Last modified: _9/6/1997_ + _________________________________________________________________ + + [Add an answer to this category] + + [Category /] + _________________________________________________________________ + + _Search the FAQ-O-Matic:_ ____________________ ______ + [matching all words] + Or look for questions modified in the last: [7.] ____ + _________________________________________________________________ + + The FAQ-O-Matic lives at http://gille.loria.fr:7000/cgi-bin/faqomatic. + The code was written by Jon Howell, and the content by folks from all + over the web. diff --git a/gnu/usr.bin/cvs/HACKING b/gnu/usr.bin/cvs/HACKING index 89f7399e0e0..a1b3d37dd30 100644 --- a/gnu/usr.bin/cvs/HACKING +++ b/gnu/usr.bin/cvs/HACKING @@ -28,6 +28,12 @@ foo (arg) bar (arg); baz (arg); } + switch (c) + { + case 'A': + aflag = 1; + break; + } } The file cvs-format.el contains settings for emacs and the NEWS file @@ -64,12 +70,13 @@ but we want to fix that code. Of course, bad input data, a corrupt repository, bad options, etc., should always print a real error message instead. -We realize that CVS contains many arbitrary limits (such as PATH_MAX). -Do not do this in new code; we are trying to *fix* those arbitrary -limits. In particular, it should be possible to pass very long -arguments (e.g. from a WWW cgi script) to CVS without having it -overrun any buffers (which might create a security hole in the WWW -example). +Do not use arbitrary limits (such as PATH_MAX) except perhaps when the +operating system or some external interface requires it. We spent a +lot of time getting rid of them, and we don't want to put them back. +If you find any that we missed, please report it as with other bugs. +In most cases such code will create security holes (for example, for +anonymous readonly access via the CVS protocol, or if a WWW cgi script +passes client-supplied arguments to CVS). Although this is a long-term goal, it also would be nice to move CVS in the direction of reentrancy. This reduces the size of the data @@ -145,7 +152,7 @@ context diffs or unidiffs for patches. Note that all submitted changes may be distributed under the terms of the GNU Public License, so if you don't like this, don't submit them. -Submit changes to bug-cvs@prep.ai.mit.edu. +Submit changes to bug-cvs@gnu.org. Generally speaking if you follow the guidelines in this file you can expect a yes or no answer about whether your patch is accepted. But @@ -185,7 +192,7 @@ test-results. One other list related to CVS development is bug-cvs. This is the list which users are requested to send bug reports to. Anyone can -subscribe; to do so send mail to bug-cvs-request@prep.ai.mit.edu. +subscribe; to do so send mail to bug-cvs-request@gnu.org. Other CVS discussions take place on the info-cvs mailing list (send mail to info-cvs-request@prep.ai.mit.edu to subscribe) or on diff --git a/gnu/usr.bin/cvs/INSTALL b/gnu/usr.bin/cvs/INSTALL index 56328345c86..c13948c4ace 100644 --- a/gnu/usr.bin/cvs/INSTALL +++ b/gnu/usr.bin/cvs/INSTALL @@ -1,13 +1,106 @@ First, read the README file. If you're still happy... +First you need to obtain and install the CVS executables. If you got +a distribution which contains executables, consult the installation +instructions for that distribution. If you got source code, do not +panic. On many platforms building CVS from source code is a +straightforward process requiring no programming knowledge. See the +section BUILDING FROM SOURCE CODE at the end of this file, which +includes a list of platforms which have been tested. + +------------------------------------------------------------------------------- + +1) Take a look at the CVS documentation, if desired. For most + purposes you want doc/cvs.texinfo, also known as _Version Management + with CVS_ by Per Cederqvist et al. Looking at it might be as simple + as "info cvs" but this will depend on your installation; see README + for more details. + + See what CVS can do for you, and if it fits your environment (or can + possibly be made to fit your environment). If things look good, + continue on. Alternately, just give CVS a try first then figure out + what it is good for. + +2) Set the CVSROOT environment variable to where you want to put your + source repository. See the "Setting up the repository" section of + the Cederqvist manual for details, but the quick summary is just to + pick some directory. We'll use /src/master as an example. For + users of a POSIX shell (sh/bash/ksh) on unix, the following + commands can be placed in user's ~/.profile, ~/.bash_profile file; + or in the site-wide /etc/profile: + + CVSROOT=/src/master; export CVSROOT + + For C shell users on unix place the following commands in the + user's ~/.cshrc, ~/.login, or /etc/chsrc file: + + setenv CVSROOT /src/master + + For Windows users, supposing the repository will be in + d:\src\master, place the following line in c:\autoexec.bat. On + Windows 95, autoexec.bat might not already exist. In that case, + just create a new file containing the following line. + + set CVSROOT=:local:d:\src\master + + If these environment variables are not already set in your current + shell, set them now by typing the above line at the command prompt + (or source the login script you just edited). + The instructions for the remaining steps assume that you have set + the CVSROOT environment variable. + +3) Create the master source repository. Again, the details are in + the "Setting up the repository" section of cvs.texinfo; the + one-line summary is: + + $ cvs init + + In this and subsequent examples we use "$" to indicate the command + prompt; do not type the "$". + +4) It might be a good idea to jump right in and put some sources or + documents directly under CVS control. From within the top-level + directory of your source tree, run the following commands: + + $ cvs import -m "test distribution" ccvs CVS_DIST CVS-TEST + + (Those last three items are, respectively, a repository location, a + "vendor tag", and a "release tag". You don't need to understand + them yet, but read the section "Starting new projects" in the + Cederqvist manual for details). + +5) Having done step 4, one should be able to checkout a fresh copy of the + sources you just imported and hack away at the sources with the + following command: + + $ cd + $ cvs checkout ccvs + + This will make the directory "ccvs" in your current directory and + populate it with the appropriate files and directories. + +6) You may wish to customize the various administrative files, in particular + modules. See the Cederqvist manual for details. + +7) Read the NEWS file to see what's new. + +8) Hack away. + +------------------------------------------------------------------------------- + +BUILDING FROM SOURCE CODE + +Tested platforms + CVS has been tested on the following platforms. The most recent version of CVS reported to have been tested is indicated, but more recent versions of CVS probably will work too. Please send updates to -this list to bug-cvs@prep.ai.mit.edu (doing so in the form of a diff -to this file is encouraged). "tested" means, at a minimum, that CVS -compiles and appears to work on simple (manual) testing. In many -cases it also means "make check" and/or "make remotecheck" passes, but -we don't try to list the platforms for which that is true. +this list to bug-cvs@gnu.org (doing so in the form of a diff +to this file, or at least exact suggested text, is encouraged). +"tested" means, at a minimum, that CVS compiles and appears to work on +simple (manual) testing. In many cases it also means "make check" +and/or "make remotecheck" passes, but we don't try to list the +platforms for which that is true. Alpha: DEC Alpha running OSF/1 version 1.3 using cc (about 1.4A2) @@ -15,6 +108,7 @@ Alpha: DEC Alpha running OSF/1 version 2.1 (about 1.4A2) DEC Alpha running OSF/1 version 3.0 (1.5.95) (footnote 7) DEC Alpha running OSF/1 version 3.2 (1.9) + DEC Alpha running Digital UNIX v4.0C using gcc 2.7.2.2 (1.9.14) DEC Alpha running VMS 6.2 (1.8.85 client-only) Cray: J90 (CVS 970215 snapshot) @@ -22,10 +116,11 @@ Cray: HPPA: HP 9000/710 running HP-UX 8.07A using gcc (about 1.4A2) HPPA running HP-UX 9 (1.8) - HPPA running HP-UX 10.01 (1.7) HPPA 1.1 running HP-UX A.09.03 (1.5.95) (footnote 8) HPPA 1.1 running HP-UX A.09.04 (1.7.1) HPPA 9000/735 running HP-UX A.09.05 (1.8.87) + HPPA running HP-UX 10.01 (1.7) + HPPA running HP-UX 10.20 using gcc 2.7.2.2 (1.9.14) NextSTEP 3.3 (1.7) i386 family: Solaris 2.4 using gcc (about 1.4A2) @@ -33,17 +128,23 @@ i386 family: Unixware 2.1 (1.8.86) ISC 4.0.1 (1.8.87) Linux (kernel 1.2.x) (1.8.86) + Linux (kernel 2.0.x, RedHat 4.2) (1.9) BSDI 2.0 (1.4.93) (footnote 5) FreeBSD 2.1.5-stable (1.8.87) NextSTEP 3.3 (1.7) SCO Unix 3.2.4.2, gcc 2.7.2 (1.8.87) (footnote 4) SCO OpenServer 5 (1.8.86) + Sequent Dynix/PTX 4.1.4 (1.9.20 or so + patches) Lynx 2.3.0 080695 (1.6.86) (footnote 9) Windows NT 3.51 (1.8.86 client; 1.8.3 local) + Windows NT 3.51 service pack 4 (1.9) + Windows NT 3.51 service pack 5 (1.9) -- DOES NOT WORK (footnote 11) Windows NT 4.0 (1.9 client and local) - Windows 95 (1.8.86 client and local) - QNX 4 (1.7 + obvious patches) + Windows 95 (1.9 client and local) + QNX (1.9.1 + patches for strippath() and va_list) OS/2 Version 3 using IBM C/C++ Tools 2.01 (1.8.86 + patches, client) + OS/2 Version 3 using EMX 0.9c (1.9.10 + patches, client) + OS/2 Version 3 using Watcom version ? (? - has this been tested?) m68k: Sun 3 running SunOS 4.1.1_U1 w/ bundled K&R /usr/5bin/cc (1.8.86+) NextSTEP 3.3p1 (1.8.87) @@ -57,6 +158,7 @@ MIPS: DECstation running Ultrix 4.3 (1.8.85) SGI running Irix 4.0.5H using gcc and cc (about 1.4A2) (footnote 2) SGI running Irix 5.3 using gcc 2.7.2 (1.8.87) + SGI running Irix 6.2 using SGI MIPSpro 6.2 and beta 7.2 compilers (1.9) SGI running Irix-6.2 (1.9.8) Siemens-Nixdorf RM600 running SINIX-Y (1.6) PowerPC or RS/6000: @@ -64,13 +166,15 @@ PowerPC or RS/6000: IBM RS/6000 running AIX 3.2.5 (1.8) IBM RS/6000 running AIX 4.1 using gcc and cc (about 1.4A2) (footnote 1) Lynx 2.3.1 120495 (1.6.86) (footnote 9) + Lynx 2.5 (1.9) (footnote 10) SPARC: - Sun SPARC running SunOS 4.1.x (1.8.87) + Sun SPARC running SunOS 4.1.x using gcc 2.7.2.1 (1.9.14) Sun SPARCstation 10 running Solaris 2.3 using gcc and cc (about 1.4A2) Sun SPARCstation running Solaris 2.4 using gcc and cc (about 1.5.91) Sun SPARC running Solaris 2.5 (1.8.87) + Sun SPARC running Solaris 2.5.1 using gcc 2.7.2.2 (1.9.14) NextSTEP 3.3 (1.7) - Sun SparcClassing running Linux 2.0.17, gcc 2.7.2 (1.8.87) + Sun SPARC running Linux 2.0.17, gcc 2.7.2 (1.8.87) VAX: VAX running VMS 6.2 (1.9+patches, client-only) (see README.VMS for information on necessary hacks). @@ -117,11 +221,19 @@ VAX: So after running configure I had to undef HAVE_DIRENT_H and define HAVE_SYS_DIR_H. +(footnote 10) + Had to compile with "make LIBS=-lbsd" (to get gethostbyname + and getservbyname). + +(footnote 11) + when I do a `cvs init' I get this message: + ci: 'RCS/loginfo,v' is not a regular file + ci: RCS/loginfo,v: Invalid argument + cvs [init aborted]: failed to checkin n:/safe/CVSROOT/loginfo + ------------------------------------------------------------------------------- -Installation under Unix (if you got a binary distribution from -somewhere, install it according to procedure for that binary -distribution, then skip to step 5): +Building from source code under Unix: 1) Run "configure": @@ -148,23 +260,8 @@ distribution, then skip to step 5): Typically this can reduce the size of the executable by around 30%. - If you are using server or local CVS, RCS needs to be installed in - the user's PATH (or a path you have configured in src/options.h, - or a path specified with the -b option). If you don't have RCS, - you will need to get it from GNU as well. It is best to get the - version 5.7 (or later) version of RCS, available from - prep.ai.mit.edu in the file pub/gnu/rcs-5.7.tar.gz. If you do not - have RCS version 5.x (for example, if you are using the old RCS - shipped with some versions of HPUX), CVS will probably fail to work - entirely. To find out what version of RCS you have, invoke "co -V". - If it fails to print a version number, it is an old version. - - If you want version control of files with binary data, make sure - that the RCS configure script finds GNU diff 1.15 or later and - notices that diff supports the -a option. CVS itself is much less - picky about which version of diff it uses, and you shouldn't need - to worry about that. If you are using GNU diff 2.6 or 2.7, you may - want to know about a (subtle) bug described in doc/DIFFUTILS-2.7-BUG. + Unlike previous versions of CVS, you do not need to install RCS + or GNU diff. NOTE: The configure program will cache the results of the previous configure execution. If you need to re-run configure from scratch, you @@ -221,11 +318,8 @@ distribution, then skip to step 5): END OF NOTE FOR NDBM GUNK. -2) Edit src/options.h. Appropriate things to look at may be the - invocation locations of programs like DIFF. - Also glance at the default values for the environment variables - that CVS uses, in particular, the RCSBIN variable, which holds the - path to where the RCS programs live on your system. +2) Edit src/options.h. The defaults should be reasonable, and in fact + if you are lazy you can safely skip this step. 3) Try to build it: @@ -257,65 +351,6 @@ distribution, then skip to step 5): Depending on your installation's configuration, you may need to be root to do this. -5) Take a look at the CVS documentation. - - $ man cvs - - and - - $ info cvs - - See what it can do for you, and if it fits your environment (or can - possibly be made to fit your environment). If things look good, - continue on... - -6) Set up the master source repository. See the "Setting up the repository" - section of cvs.texinfo for details; the one-line summary is (if you - are putting the repository in /src/master): - $ cvs -d /src/master init - -7) Have all users of the CVS system set the CVSROOT environment - variable appropriately to reflect the placement of your source - repository. If the above example is used, the following commands - can be placed in user's ~/.profile, ~/.bash_profile file; or in the - site-wide /etc/profile: - - CVSROOT=/src/master; export CVSROOT - - for sh/bash/ksh users, or place the following commands in the user's - ~/.cshrc, ~/.login, or /etc/chsrc file: - - setenv CVSROOT /src/master - - for csh/tcsh users. If these environment variables are not already set - in your current shell, set them now (or source the login script you - just edited). You will need to have the CVSROOT environment variable - set to continue on to the next step. - -8) It might be a good idea to jump right in and put the CVS distribution - directly under CVS control. From within the top-level directory of the - CVS distribution (the one that contains this README file) do the - following commands: - - $ make distclean - $ cvs import -m 'CVS 1.6 distribution' cvs CVS_DIST CVS-1_6 - -9) Having done step 8, one should be able to checkout a fresh copy of the - CVS distribution and hack away at the sources with the following command: - - $ cd - $ cvs checkout cvs - - This will make the directory "cvs" in your current directory and - populate it with the appropriate CVS files and directories. - -10) You may wish to customize the various administrative files, in particular - modules. See cvs.texinfo for details. - -11) Read the NEWS file to see what's new. - -12) Hack away. - ------------------------------------------------------------------------------- Detailed information about your interaction with "configure": @@ -351,13 +386,30 @@ behaviour: appear to be. ------------------------------------------------------------------------------- -Installation under Windows NT: + +Building from source code under Windows NT/95: You may find interesting information in windows-NT/README. -1) Using Microsoft Visual C++ version 2.1, open the project `cvsnt.mak', - in the top directory of the CVS distribution. +1) Using Microsoft Visual C++ 5.x, open the project `cvsnt.dsp', + in the top directory of the CVS distribution. If you have an older + version of Visual C++, take a look at windows-NT/README. 2) Choose "Build cvs.exe" from the "Project" menu. -3) MSVC will place the executable file cvs.exe in WinDebug, or whatever +3) MSVC will place the executable file cvs.exe in WinRel, or whatever your target directory is. + +------------------------------------------------------------------------------- + +Building from source code under other platforms: + +For OS/2, see os2/README and emx/README. + +For VMS, see README.VMS + +For Macintosh, see macintosh/README.MacCVS + +For a Java client, see jCVS (which is a separate package from CVS +itself, but which might be preferable to the Macintosh port mentioned +above, for example). + ------------------------------------------------------------------------------- diff --git a/gnu/usr.bin/cvs/MINOR-BUGS b/gnu/usr.bin/cvs/MINOR-BUGS index ba6fb182111..9eb0e7b5f53 100644 --- a/gnu/usr.bin/cvs/MINOR-BUGS +++ b/gnu/usr.bin/cvs/MINOR-BUGS @@ -45,8 +45,8 @@ particular reason to think the bug is fixed -kingdon, Sep 96). ... I claim that CVS dirs should be ignored. - (I don't *think* this always happens; is "-I !" getting picked up somewhere - something like that? -kingdon, Sep 96) + (This reportedly happens if "cvs add CVS" (or "cvs add *") + is followed by "cvs status", in client/server mode - CVS 1.9). * On remote checkout, files don't have the right time/date stamps in the CVS/Entries files. Doesn't look like the C/S protocol has any diff --git a/gnu/usr.bin/cvs/NEWS b/gnu/usr.bin/cvs/NEWS index b2827cfd21a..5e746fe6fe1 100644 --- a/gnu/usr.bin/cvs/NEWS +++ b/gnu/usr.bin/cvs/NEWS @@ -1,5 +1,30 @@ Changes since 1.9: +* One can now authenticate and encrypt using the GSSAPI network +security interface. For details see the description of :gserver: in +CVSROOT, and the -a global option. + +* All access to RCS files is now implemented internally rather than by +calling RCS programs. The main user-visible consequence of this is +that there is no need to worry about making sure that CVS finds the +correct version of RCS. The -b global option and the RCSBIN setting +in CVSROOT/config are still accepted but don't do anything. The +$RCSBIN internal variable in administrative files is no longer +accepted. + +* There is a new syntax, "cvs admin -orev1::rev2", which collapses the +revisions between rev1 and rev2 without deleting rev1 or rev2 +themselves. + +* There is a new administrative file CVSROOT/config which allows one +to specify miscellaneous aspects of CVS configuration. Currently +supported here: + + - SystemAuth, allows you to prevent pserver from checking for system + usernames/passwords. + +For more information see the "config" section of cvs.texinfo. + * When setting up the pserver server, one now must specify the allowable CVSROOT directories in inetd.conf. See the Password authentication server section of cvs.texinfo for details. Note that @@ -21,10 +46,9 @@ repository from the cvspass file. password-authenticated server (other access methods are just governed by Unix file permissions, since they require login access to the repository machine anyway). See the "Repository" section of -cvs.texinfo for details. Note that the security cautions in -cvs.texinfo ("Password authentication security"), and the requirement -that read-only users be able to create locks and write the history -file, both apply. +cvs.texinfo for details, including a discussion of security issues. +Note that the requirement that read-only users be able to create locks +and write the history file still applies. * The "checkout" command now creates a CVS directory at the top level of the new working directory, in addition to CVS directories created diff --git a/gnu/usr.bin/cvs/PROJECTS b/gnu/usr.bin/cvs/PROJECTS index 4e20f8b883a..b46eb2ab64f 100644 --- a/gnu/usr.bin/cvs/PROJECTS +++ b/gnu/usr.bin/cvs/PROJECTS @@ -46,13 +46,6 @@ are actually more appropriate for this list. (and modify) indexes. This becomes very apparent with files with several hundred revisions. -* A RCS "library", so CVS could operate on RCS files directly. - - CVS parses RCS files in order to determine if work needs to be done, - and then RCS parses the files again when it is performing the work. - This would be much faster if CVS could do whatever is necessary - by itself. (see comment at start of rcscmds.c for a few notes on this). - 1. Improved testsuite/sanity check script * Need to use a code coverage tool to determine how much the sanity diff --git a/gnu/usr.bin/cvs/README b/gnu/usr.bin/cvs/README index 977ddcb480e..e6c436ba16d 100644 --- a/gnu/usr.bin/cvs/README +++ b/gnu/usr.bin/cvs/README @@ -164,7 +164,7 @@ ChangeLog files in each directory for a more complete idea. In addition to the above contributors, the following Beta testers deserve special mention for their support. This is only a partial list; if you have helped in this way and would like to be listed, let -bug-cvs know (as described elsewhere in this file). +bug-cvs know (as described in the Cederqvist manual). Mark D. Baushke <mdb@cisco.com> Per Cederqvist <ceder@signum.se> diff --git a/gnu/usr.bin/cvs/README.VMS b/gnu/usr.bin/cvs/README.VMS index b32ed8f995b..8e459184cb1 100644 --- a/gnu/usr.bin/cvs/README.VMS +++ b/gnu/usr.bin/cvs/README.VMS @@ -26,7 +26,7 @@ of ftp servers which have VMS GNU resources, taken from ftp.spc.edu ftp.stacken.kth.se -Please send bug reports to bug-cvs@prep.ai.mit.edu. +Please send bug reports to bug-cvs@gnu.org. As of CVS 1.5.something, this port passed most of the tests in [.src]sanity.sh. I say "most" because some tests to not apply to the @@ -153,6 +153,9 @@ to the link. declares something as an int when it should be void *. Not *our* fault! +* Remove the #define's of mode_t in vms/vms.h and pid_t in vms/pwd.h. +Add "#include <sys/types.h>" in vms/pwd.h. + Credits: Initial VMS port by Benjamin J. Lee <benjamin@cyclic.com>, Cyclic diff --git a/gnu/usr.bin/cvs/TESTS b/gnu/usr.bin/cvs/TESTS index 39a38a9292e..fa9697f43ad 100644 --- a/gnu/usr.bin/cvs/TESTS +++ b/gnu/usr.bin/cvs/TESTS @@ -134,3 +134,12 @@ unnecessary baggage. The only dependency would be on tcl (that is, wish). * perl or python or <any other serious contenders here?> + +It is worth thinking about how to: + +a. include spaces in arguments which we pass to the program under +test (sanity.sh dotest cannot do this; see test rcs-9 for a +workaround). + +b. pass stdin to the program under test (sanity.sh, again, handles +this by bypassing dotest). diff --git a/gnu/usr.bin/cvs/TODO b/gnu/usr.bin/cvs/TODO index 7a9a8166c9d..cddd580845c 100644 --- a/gnu/usr.bin/cvs/TODO +++ b/gnu/usr.bin/cvs/TODO @@ -1,10 +1,14 @@ +The "TODO" file! -*-Indented-Text-*- + 22. Catch signals for cleanup when "add"ing files. 24. Insist on a log message. (If done, this should be configurable via commitinfo or some new config file -kingdon, Jun 1995). -30. Add "patch" program option to the modules database. +30. Add "rdiff" program option to the modules database (and "diff" +too?). (perhaps should think a little harder about what this is +trying to accomplish and what the best way is -kingdon, Jul 1997). 31. Think hard about ^C recovery. @@ -16,7 +20,9 @@ that other branch is already merged. This has pitfalls--it could easily lead to invisible state which could confuse users very rapidly--but having to create a tag or some such mechanism to keep - track of what has been merged is a pain. + track of what has been merged is a pain. Take a look at PRCS 1.2. + PRCS 1.0 was particularly bad the way it handled the "invisible + state", but 1.2 is significantly better. 45. Consider enhancing the "rdiff" and "tag" (rtag??) command support in the module database -- they seem hard to use since these commands @@ -45,9 +51,6 @@ 63. The "import" and vendor support commands (co -j) need to be documented better. -64. Need to greatly increase the performance of an initial checkout. - [[ it got better, then we added functionality, making it worse again ]] - 66. Length of the CVS temporary files must be limited to 14 characters for System-V stupid support. As well as the length on the CVS.adm files. @@ -57,8 +60,8 @@ 73. Consider an option (in .cvsrc?) to automatically add files that are new and specified to commit. -79. Might be nice to have some sort of interface to TFS and tagged - revisions. +79. Might be nice to have some sort of interface to Sun's Translucent + (?) File System and tagged revisions. 82. Maybe the import stuff should allow an arbitrary revision to be specified. @@ -66,8 +69,10 @@ 84. Improve the documentation about administration of the repository and how to add/remove files and the use of symbolic links. -85. Add revision controlled symbolic links to CVS using one of the tag - fields in the RCS file. +85. Make symbolic links a valid thing to put under version control. + Perhaps use one of the tag fields in the RCS file? Note that we + can only support symlinks that are relative and within the scope of + the sources being controlled. 92. Look into this: After a bit of soul searching via dbx, I realized my sin was that I'd @@ -130,11 +135,12 @@ 113. The "cvs update" command should tee its output to a log file in ".". (why? What is wrong with piping stdout to "tee"? -kingdon, Jun 1995) -119. Consider an option to have import checkout the RCS or SCCS files - if necessary. (this is if someone want to import something which is - in RCS or SCCS without preserving the history, but making sure they - do get the latest versions. It isn't clear to me how useful that is - -kingdon, June 1996). +119. When importing a directory tree that is under SCCS/RCS control, + consider an option to have import checkout the SCCS/RCS files if + necessary. (This is if someone wants to import something which + is in RCS or SCCS without preserving the history, but makes sure + they do get the latest versions. It isn't clear to me how useful + that is -kingdon, June 1996). 122. If Name_Repository fails, it currently causes CVS to die completely. It should instead return NULL and have the caller do something reasonable @@ -142,6 +148,7 @@ -kingdon, June 1996). 123. Add a flag to import to not build vendor branches for local code. + (See `importb' tests in src/sanity.sh for more details). 124. Anyway, I thought you might want to add something like the following to the cvs man pages: @@ -157,8 +164,6 @@ 127. Look at *info files; they should all be quiet if the files are not there. Should be able to point at a RCS directory and go. -128. When I tag a file, the message tells me that I'm tagging a directory. - 130. cvs diff with no -r arguments does not need to look up the current RCS version number since it only cares about what's in the Entries file. This should make it much faster. @@ -184,10 +189,14 @@ variable to limit the amount of sources that need to be duplicated for sites with giant source trees and no disk space. -141. Import should accept modules as its directory argument. +141. Import should accept modules as its directory argument. If we're + going to implement this, we should think hard about how modules + might be expanded and how to handle those cases. 143. Update the documentation to show that the source repository is - something far away from the files that you work on. + something far away from the files that you work on. (People who + come from an RCS background are used to their `repository' being + _very_ close to their working directory.) 144. Have cvs checkout look for the environment variable CVSPREFIX (or CVSMODPREFIX or some such). If it's set, then when looking @@ -227,14 +236,42 @@ .#foo.c.1.5 or whatever), so they can do the interactive part at that point -kingdon, June 1996). -149. On Sun, 2 Feb 92 22:01:38 EST, rouilj@dl5000.bc.edu (John P. Rouillard) - said: - Maybe there should be an option to cvs admin that allows a user to - change the Repository file with some degree of error checking? +149. Maybe there should be an option to cvs admin that allows a user to + change the Repository/Root file with some degree of error checking? Something like "cvs admin reposmv /old/path /new/pretty/path". Before it does the replace it check to see that the files /new/pretty/path/<dir>/<files> exist. + The obvious cases are where one moves the repository to another + machine or directory. But there are other cases, like where the + user might want to change from :pserver: to :ext:, use a different + server (if there are two server machines which share the + repository using a networked file system), etc. + + The status quo is a bit of a mess (as of, say, CVS 1.9). It is + that the -d global option has two moderately different uses. One + is to use a totally different repository (in which case we'd + probably want to give an error if it disagreed with CVS/Root, as + CVS 1.8 and earlier did). The other is the "reposmv" + functionality above (in which the two repositories really are the + same, and we want to update the CVS/Root files). A related issue + is that the fact that CVS only sets and looks at the CVS/Root + file in the directory where CVS is run; it doesn't do anything + about CVS/Root files in subdirectories. + + Note also RELATIVE_REPOS in options.h; it needs to be set for + changing CVS/Root (not CVS/Repository) to be sufficient in the + case where the directory has changed. + + This whole area is a rather bad pile of individual decisions which + accumulated over time, some of them probably bad decisions with + hindsight. But we didn't get into this mess overnight, and we're + not going to get out of it overnight (that is, we need to come up + with a replacement behavior, document what parts of the status + quo are deprecated, probably circulate some unofficial patches, &c). + + (this item originally added 2 Feb 1992 but revised since). + 150. I have a customer request for a way to specify log message per file, non-interactively before the commit, such that a single, fully recursive commit prompts for one commit message, and concatenates the @@ -256,8 +293,9 @@ message specified at commit time. Easy enough. (having cvs commit be non-interactive takes care of various issues like whether to connect to the server before or after prompting for a - message (see comment in commit.c at call to start_server) - -kingdon, June 1996) + message (see comment in commit.c at call to start_server). Also + would clean up the kludge for what to do with the message from + do_editor if the up-to-date check fails (see commit.c client code). I'm not sure about the part above about having commit prompt for an overall message--part of the point is having commit @@ -270,30 +308,41 @@ incompatibility between client/server (per-tree) and non-client/server (per-directory). + A few interesting issues with this: (1) if you do a cvs update or + some other operation which changes the working directory, do you + need to run "cvs message" again (it would, of course, bring up + the old message which you could accept)? Probably yes, after all + merging in some conflicts might change the situation. (2) How do + you change the stored messages if you change your mind before the + commit (probably run "cvs message" again, as hinted in (1))? + 151. Also, is there a flag I am missing that allows replacing Ulrtx_Build by Ultrix_build? I.E. I would like a tag replacement to be a one step operation rather than a two step "cvs rtag -r Ulrtx_Build Ultrix_Build" - followed by "cvs trag -d Ulrtx_Build" + followed by "cvs rtag -d Ulrtx_Build" 152. The "cvs -n" option does not work as one would expect for all the commands. In particular, for "commit" and "import", where one would also like to see what it would do, without actually doing anything. -153. There should be some command (maybe I just haven't figured - out which one...) to import a source directory which is already - RCS-administered without losing all prior RCS gathered data. Thus, it - would have to examine the RCS files and choose a starting version and - branch higher than previous ones used. +153. There should be some command (maybe I just haven't figured out + which one...) to import a source directory which is already + RCS-administered without losing all prior RCS gathered data. + Thus, it would have to examine the RCS files and choose a + starting version and branch higher than previous ones used. + (Check out rcs-to-cvs and see if it addresses this issue.) 154. When committing the modules file, a pre-commit check should be done to verify the validity of the new modules file before allowing it to be committed. 155. The options for "cvs history" are mutually exclusive, even though - useful queries can be done if they are not, as in specifying both a - module and a tag. A workaround is to specify the module, then run the - output through grep to only display lines that begin with T, which are - tag lines. + useful queries can be done if they are not, as in specifying both + a module and a tag. A workaround is to specify the module, then + run the output through grep to only display lines that begin with + T, which are tag lines. (Better perhaps if we redesign the whole + "history" business -- check out doc/cvs.texinfo for the entire + rant.) 156. Also, how hard would it be to allow continuation lines in the {commit,rcs,log}info files? It would probably be useful with all of @@ -313,9 +362,6 @@ revision was already locked by the user as well, thus moving the lock forward after the commit. -161. The date parser included with CVS (lib/getdate.y) does not support - such RCS-supported dates as "1992/03/07". It probably should. - 163. The rtag/tag commands should have an option that removes the specified tag from any file that is in the attic. This allows one to re-use a tag (like "Mon", "Tue", ...) all the time and still have it tag the @@ -385,10 +431,12 @@ is down!). 182. There should be a way to show log entries corresponding to -changes from tag "foo" to tag "bar". "cvs log -rfoo -rbar" doesn't -cut it, because it is inclusive on the bar end. I'm not sure that is -ever a useful or logical behavior ("cvs diff -r foo -r bar" is not -similarly inclusive), but is compatibility an issue? +changes from tag "foo" to tag "bar". "cvs log -rfoo:bar" doesn't cut +it, because it erroneously shows the changes associated with the +change from the revision before foo to foo. I'm not sure that is ever +a useful or logical behavior ("cvs diff -r foo -r bar" gets this +right), but is compatibility an issue? See +http://www.cyclic.com/cvs/unoff-log.txt for an unofficial patch. 183. "cvs status" should report on Entries.Static flag and CVS/Tag (how? maybe a "cvs status -d" to give directory status?). There should also @@ -420,3 +468,326 @@ modifying it), but even as to the general idea, I don't have a clear idea about whether it would be good (see what I mean about the need for better documentation? I work on CVS full-time, and even I don't understand the state of the art on this subject). + +186. There is a frequent discussion of multisite features. + +* There may be some overlap with the client/server CVS, which is good +especially when there is a single developer at each location. But by +"multisite" I mean something in which each site is more autonomous, to +one extent or another. + +* Vendor branches are the closest thing that CVS currently has for +multisite features. They have fixable drawbacks (such as poor +handling of added and removed files), and more fundamental drawbacks +(when you import a vendor branch, you are importing a set of files, +not importing any knowledge of their version history outside the +current repository). + +* One approach would be to require checkins (or other modifications to +the repository) to succeed at a write quorum of sites (51%) before +they are allowed to complete. To work well, the network should be +reliable enough that one can typically get to that many sites. When a +server which has been out of touch reconnects, it would want to update +its data before doing anything else. Any of the servers can service +all requests locally, except perhaps for a check that they are +up-to-date. The way this differs from a run-of-the-mill distributed +database is that if one only allows reversible operations via this +mechanism (exclude "cvs admin -o", "cvs tag -d", &c), then each site +can back up the others, such that failures at one site, including +something like deleting all the sources, can be recovered from. Thus +the sites need not trust each other as much as for many shared +databases, and the system may be resilient to many types of +organizational failures. Sometimes I call this design the +"CVScluster" design. + +* Another approach is a master/slave one. Checkins happen at the +master site, and slave sites need to check whether their local +repository is up to date before relying on its information. + +* Another approach is to have each site own a particular branch. This +one is the most tolerant of flaky networks; if checkins happen at each +site independently there is no particular problem. The big question +is whether merges happen only manually, as with existing CVS branches, +or whether there is a feature whereby there are circumstances in which +merges from one branch to the other happen automatically (for example, +the case in which the branches have not diverged). This might be a +legitimate question to ask even quite aside from multisite features. + +One additional random tidbit is to note that Eric Raymond has some +interest in this sort of thing. The item "Cooperative distributed +freeware development" on http://www.ccil.org/~esr/ has a very brief +introduction to what he is thinking about. + +187. Might want to separate out usage error messages and help +messages. The problem now is that if you specify an invalid option, +for example, the error message is lost among all the help text. In +the new regime, the error message would be followed by a one-line +message directing people to the appropriate help option ("cvs -H +<command>" or "cvs --help-commands" or whatever, according to the +situation). I'm not sure whether this change would be controversial +(as defined in HACKING), so there might be a need for further +discussion or other actions other than just coding. + +188. Option parsing and .cvsrc has at least one notable limitation. +If you want to set a global option only for some CVS commands, there +is no way to do it (for example, if one wants to set -q only for +"rdiff"). I am told that the "popt" package from RPM +(http://www.rpm.org) could solve this and other problems (for example, +if the syntax of option stuff in .cvsrc is similar to RPM, that would +be great from a user point of view). It would at least be worth a +look (it also provides a cleaner API than getopt_long). + +Another issue which may or may not be related is the issue of +overriding .cvsrc from the command line. The cleanest solution might +be to have options in mutually exclusive sets (-l/-R being a current +example, but --foo/--no-foo is a better way to name such options). Or +perhaps there is some better solution. + +189. Renaming files and directories is a frequently discussed topic. + +Some of the problems with the status quo: + +a. "cvs annotate" cannot operate on both the old and new files in a +single run. You need to run it twice, once for the new name and once +for the old name. + +b. "cvs diff" (or "cvs diff -N") shows a rename as a removal of the +old file and an addition of the new one. Some people would like to +see the differences between the file contents (but then how would we +indicate the fact that the file has been renamed? Certainly the +notion that "patch(1)" has of renames is as a removal and addition). + +c. "cvs log" should be able to show the changes between two +tags/dates, even in the presence of adds/removes/renames (I'm not sure +what the status quo is on this; see also item #182). + +d. Renaming directories is way too hard. + +Implementations: + +It is perhaps premature to try to design implementation details +without answering some of the above questions about desired behaviors +but several general implementations get mentioned. + +i. No fundamental changes (for example, a "cvs rename" command which +operated on directories could still implement the current recommended +practice for renaming directories, which is to rename each of the +files contained therein via an add and a remove). One thing to note +that the status quo gets right is proper merges, even with adds and +removals (Well, mostly right at least. There are a *LOT* of different +cases; see the testsuite for some of them). + +ii. Rename database. In this scheme the files in the repository +would have some arbitrary name, and then a separate rename database +would indicate the current correspondence between the filename in the +working directory and the actual storage. As far as I know this has +never been designed in detail for CVS. + +iii. A modest change in which the RCS files would contain some +information such as "renamed from X" or "renamed to Y". That is, this +would be generally similar to the log messages which are suggested +when one renames via an add and a removal, but would be +computer-parseable. I don't think anyone has tried to flesh out any +details here either. + +It is interesting to note that in solution ii. version numbers in the +"new file" start where the "old file" left off, while in solutions +i. and iii., version numbers restart from 1.1 each time a file is +renamed. Except perhaps in the case where we rename a file from foo +to bar and then back to foo. I'll shut up now. + +Regardless of the method we choose, we need to address how renames +affect existing CVS behaviors. For example, what happens when you +rename a file on a branch but not the trunk and then try to merge the +two? What happens when you rename a file on one branch and delete it +on another and try to merge the two? + +Ideally, we'd come up with a way to parameterize the problem and +simply write up a lookup table to determine the correct behavior. + +190. The meaning of the -q and -Q global options is very ad hoc; +there is no clear definition of which messages are suppressed by them +and which are not. Here is a classification of the current meanings +of -q; I don't know whether anyone has done a similar investigation of +-Q: + + a. The "warm fuzzies" printed upon entering each directory (for + example, "cvs update: Updating sdir"). The need for these messages + may be decreased now that most of CVS uses ->fullname instead of + ->file in messages (a project which is *still* not 100% complete, + alas). However, the issue of whether CVS can offer status as it + runs is an important one. Of course from the command line it is + hard to do this well and one ends up with options like -q. But + think about emacs, jCVS, or other environments which could flash you + the latest status line so you can see whether the system is working + or stuck. + + b. Other cases where the message just offers information (rather + than an error) and might be considered unnecessarily verbose. These + have a certain point to them, although it isn't really clear whether + it should be the same option as the warm fuzzies or whether it is + worth the conceptual hair: + + add.c: scheduling %s `%s' for addition (may be an issue) + modules.c: %s %s: Executing '%s' (I can see how that might be noise, + but...) + remove.c: scheduling `%s' for removal (analogous to the add.c one) + update.c: Checking out %s (hmm, that message is a bit on the noisy side...) + (but the similar message in annotate is not affected by -q). + + c. Suppressing various error messages. This is almost surely + bogus. + + commit.c: failed to remove tag `%s' from `%s' (Questionable. + Rationale might be that we already printed another message + elsewhere but why would it be necessary to avoid + the extra message in such an uncommon case?) + commit.c: failed to check out `%s' (likewise; this one seems to be a + vestige from before RCS_checkout was internal. Take a look at how + RCS_checkout handles errors) + commit.c: failed to commit dead revision for `%s' (likewise) + remove.c: file `%s' still in working directory (see below about rm + -f analogy) + remove.c: nothing known about `%s' (looks dubious to me, especially in + the case where the user specified it explicitly). + remove.c: removed `%s' (seems like an obscure enough case that I fail + to see the appeal of being cryptically concise here). + remove.c: file `%s' already scheduled for removal (now it is starting + to look analogous to the infamous rm -f option). + rtag.c: cannot find tag `%s' in `%s' (more rm -f like behavior) + rtag.c: failed to remove tag `%s' from `%s' (ditto) + tag.c: failed to remove tag %s from %s (see above about whether RCS_* + has already printed an error message). + tag.c: couldn't tag added but un-commited file `%s' (more rm -f + like behavior) + tag.c: skipping removed but un-commited file `%s' (ditto) + tag.c: cannot find revision control file for `%s' (ditto, but at first + glance seems even worse, as this would seem to be a "can't happen" + condition) + +191. Storing RCS files, especially binary files, takes rather more +space than it could, typically. + - The virtue of the status quo is that it is simple to implement. + Of course it is also simplest in terms of dealing with compatibility. + - Just storing the revisions as separate gzipped files is a common + technique. It also is pretty simple (no new algorithms, CVS + already has zlib around). Of course for some files (such as files + which are already compressed) the gzip step won't help, but + something which can at least sometimes avoid rewriting the entire + RCS file for each new revision would, I would think, be a big + speedup for large files. + - Josh MacDonald has written a tool called xdelta which produces + differences (that is, sufficient information to transform the old + to the new) which looks for common sequences of bytes, like RCS + currently does, but which is not based on lines. This seems to do + quite well for some kinds of files (e.g. FrameMaker documents, + text files), and not as well for others (anything which is already + compressed, executables). xdelta 1.10 also is faster than GNU diff. + - Karl Fogel has thought some about using a difference technique + analogous to fractal compression (see the comp.compression FAQ for + more on fractal compression, including at least one patent to + watch for; I don't know how analogous Karl's ideas are to the + techniques described there). + - Quite possibly want some documented interface by which a site can + plug in their choice of external difference programs (with the + ability to choose the program based on filename, magic numbers, + or some such). + +192. "cvs update" using an absolute pathname does not work if the +working directory is not a CVS-controlled directory with the correct +CVSROOT. For example, the following will fail: + + cd /tmp + cvs -d /repos co foo + cd / + cvs update /tmp/foo + +It is possible to read the CVSROOT from the administrative files in +the directory specified by the absolute pathname argument to update. +In that case, the last command above would be equivalent to: + + cd /tmp/foo + cvs update . + +This can be problematic, however, if we ask CVS to update two +directories with different CVSROOTs. Currently, CVS has no way of +changing CVSROOT mid-stream. Consider the following: + + cd /tmp + cvs -d /repos1 co foo + cvs -d /repos2 co bar + cd / + cvs update /tmp/foo /tmp/bar + +To make that example work, we need to think hard about: + + - where and when CVSROOT-related variables get set + - who caches said variables for later use + - how the remote protocol should be extended to handle sending a new + repository mid-stream + - how the client should maintain connections to a variety of servers + in a single invocation. + +Because those issues are hairy, I suspect that having a change in +CVSROOT be an error would be a better move. + +193. The client relies on timestamps to figure out whether a file is +(maybe) modified. If something goes awry, then it ends up sending +entire files to the server to be checked, and this can be quite slow +especially over a slow network. A couple of things that can happen: +(a) other programs, like make, use timestamps, so one ends up needing +to do "touch foo" and otherwise messing with timestamps, (b) changing +the timezone offset (e.g. summer vs. winter or moving a machine) +should work on unix, but there may be problems with non-unix. + +Possible solutions: + + a. Store a checksum for each file in CVS/Entries or some such + place. What to do about hash collisions is interesting: using a + checksum, like MD5, large enough to "never" have collisions + probably works in practice (of course, if there is a collision then + all hell breaks loose because that code path was not tested, but + given the tiny, tiny probability of that I suppose this is only an + aesthetic issue). + + b. I'm not thinking of others, except storing the whole file in + CVS/Base, and I'm sure using twice the disk space would be + unpopular. + +194. CVS does not separate the "metadata" from the actual revision +history; it stores them both in the RCS files. Metadata means tags +and header information such as the number of the head revision. +Storing the metadata separately could speed up "cvs tag" enormously, +which is a big problem for large repositories. It could also probably +make CVS's locking much less in the way (see comment in do_recursion +about "two-pass design"). + +195. Many people using CVS over a slow link are interested in whether +the remote protocol could be any more efficient with network +bandwidth. This item is about one aspect of that--how the server +sends a new version of a file the client has a different version of, +or vice versa. + +a. Cases in which the status quo already sends a diff. For most text +files, this is probably already close to optimal. For binary files, +and anomalous text files, it might be worth looking into other +difference algorithms (see item #191). + +b. Cases in which the status quo does not send a diff (e.g. "cvs +commit"). + +b1. With some frequency, people suggest rsync or a similar algorithm +(see ftp://samba.anu.edu.au/pub/rsync/). This could speed things up, +and in some ways involves the most minimal changes to the default CVS +paradigm. There are some downsides though: (1) there is an extra +network turnaround, (2) the algorithm is not as efficient with network +bandwidth as difference type programs (it transmits a fair bit of data +to discover what a difference program discovers locally). + +b2. If one is willing to require that users use "cvs edit" before +editing a file on the client side (in some cases, a development +environment like emacs can make this fairly easy), then the Modified +request in the protocol could be extended to allow the client to just +send differences instead of entire files. In the degenerate case +(e.g. "cvs diff" without arguments) the required network traffic is +reduced to zero, and the client need not even contact the server. diff --git a/gnu/usr.bin/cvs/acconfig.h b/gnu/usr.bin/cvs/acconfig.h index 8bbda6ff3b2..21c5fe7449a 100644 --- a/gnu/usr.bin/cvs/acconfig.h +++ b/gnu/usr.bin/cvs/acconfig.h @@ -1,6 +1,9 @@ /* Define if you have MIT Kerberos version 4 available. */ #undef HAVE_KERBEROS +/* Define if you have GSSAPI with MIT Kerberos version 5 available. */ +#undef HAVE_GSSAPI + /* Define if you want CVS to be able to be a remote repository client. */ #undef CLIENT_SUPPORT @@ -16,3 +19,20 @@ /* Define if you have the connect function. */ #undef HAVE_CONNECT + +/* Define if you have memchr (always for CVS). */ +#undef HAVE_MEMCHR + +/* Define if you have strchr (always for CVS). */ +#undef HAVE_STRCHR + +/* Define if utime requires write access to the file (true on Windows, + but not Unix). */ +#undef UTIME_EXPECTS_WRITABLE + +/* Define if setmode is required when writing binary data to stdout. */ +#undef USE_SETMODE_STDOUT + +/* Define if the diff library should use setmode for binary files. + FIXME: Why two different macros for setmode? */ +#undef HAVE_SETMODE diff --git a/gnu/usr.bin/cvs/build.com b/gnu/usr.bin/cvs/build.com index 1d5b9089b38..4ed4a6fdaed 100644 --- a/gnu/usr.bin/cvs/build.com +++ b/gnu/usr.bin/cvs/build.com @@ -1,5 +1,7 @@ $ set def [.zlib] $ @build_zlib.com +$ set def [-.diff] +$ @build_diff.com $ set def [-.vms] $ @build_vms.com $ set def [-.lib] diff --git a/gnu/usr.bin/cvs/config.h.in b/gnu/usr.bin/cvs/config.h.in index ce5ee499762..a4921909346 100644 --- a/gnu/usr.bin/cvs/config.h.in +++ b/gnu/usr.bin/cvs/config.h.in @@ -7,6 +7,9 @@ #undef _ALL_SOURCE #endif +/* Define if the closedir function returns void instead of int. */ +#undef CLOSEDIR_VOID + /* Define to empty if the keyword does not work. */ #undef const @@ -16,12 +19,18 @@ /* Define if you support file names longer than 14 characters. */ #undef HAVE_LONG_FILE_NAMES +/* Define if your struct stat has st_blksize. */ +#undef HAVE_ST_BLKSIZE + /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if utime(file, NULL) sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL +/* Define if you have <vfork.h>. */ +#undef HAVE_VFORK_H + /* Define if on MINIX. */ #undef _MINIX @@ -56,9 +65,15 @@ /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t +/* Define vfork as fork if vfork does not work. */ +#undef vfork + /* Define if you have MIT Kerberos version 4 available. */ #undef HAVE_KERBEROS +/* Define if you have GSSAPI with MIT Kerberos version 5 available. */ +#undef HAVE_GSSAPI + /* Define if you want CVS to be able to be a remote repository client. */ #undef CLIENT_SUPPORT @@ -75,6 +90,23 @@ /* Define if you have the connect function. */ #undef HAVE_CONNECT +/* Define if you have memchr (always for CVS). */ +#undef HAVE_MEMCHR + +/* Define if you have strchr (always for CVS). */ +#undef HAVE_STRCHR + +/* Define if utime requires write access to the file (true on Windows, + but not Unix). */ +#undef UTIME_EXPECTS_WRITABLE + +/* Define if setmode is required when writing binary data to stdout. */ +#undef USE_SETMODE_STDOUT + +/* Define if the diff library should use setmode for binary files. + FIXME: Why two different macros for setmode? */ +#undef HAVE_SETMODE + /* Define if you have the crypt function. */ #undef HAVE_CRYPT @@ -138,9 +170,6 @@ /* Define if you have the tzset function. */ #undef HAVE_TZSET -/* Define if you have the vfork function. */ -#undef HAVE_VFORK - /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF @@ -162,6 +191,9 @@ /* Define if you have the <io.h> header file. */ #undef HAVE_IO_H +/* Define if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + /* Define if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -180,6 +212,9 @@ /* Define if you have the <sys/dir.h> header file. */ #undef HAVE_SYS_DIR_H +/* Define if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H + /* Define if you have the <sys/ndir.h> header file. */ #undef HAVE_SYS_NDIR_H @@ -207,6 +242,9 @@ /* Define if you have the crypt library (-lcrypt). */ #undef HAVE_LIBCRYPT +/* Define if you have the gen library (-lgen). */ +#undef HAVE_LIBGEN + /* Define if you have the inet library (-linet). */ #undef HAVE_LIBINET diff --git a/gnu/usr.bin/cvs/contrib/ChangeLog b/gnu/usr.bin/cvs/contrib/ChangeLog index 0c45efae923..3db22a5604b 100644 --- a/gnu/usr.bin/cvs/contrib/ChangeLog +++ b/gnu/usr.bin/cvs/contrib/ChangeLog @@ -1,3 +1,39 @@ +Thu Aug 7 22:42:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * pvcs_to_rcs: Remove RCS keywords. Remove $Log and move the data + to this ChangeLog (below). Add paragraph that David Martin + emailed along with the script. + + Revision 1.6 1997/03/07 16:21:28 divad + Need to explicitly state archive name in PVCS get command for + those cases where the case of the workfile and the case of the + archive file are different (OS/2) + + Revision 1.5 1997/03/07 00:31:04 divad + Added capitalized extensions and framemaker files as binaries; + also overriding any path specification for workfiles at PVCS + checkout (most annoying). + + Revision 1.4 1997/03/06 21:04:55 divad + Added \n to the end of each comment line to prevent multi-line + comments for a single revision from "merging" + + Revision 1.3 1997/03/06 19:50:25 divad + Corrected bug in binary extensions; correcting processing + comment strings with double quotes + + Revision 1.2 1997/03/06 17:29:10 divad + Provided list of extensions (rather than using Unix file + command) to determine which files are binary; also printing + version label as they are applied + + Revision 1.1 1997/02/26 00:04:29 divad + Perl script to convert pvcs archives to rcs archives + + * README: mention pvcs_to_rcs. + * pvcs_to_rcs: New file. This is the file as I got it from David + Martin. Will be checking in the tweaks shortly. + 17 May 1997 Jim Kingdon * listen2.c: Failed attempt at making this do what it was diff --git a/gnu/usr.bin/cvs/contrib/README b/gnu/usr.bin/cvs/contrib/README index 900b0c75f74..223b759b0c7 100644 --- a/gnu/usr.bin/cvs/contrib/README +++ b/gnu/usr.bin/cvs/contrib/README @@ -86,6 +86,10 @@ An attempt at a table of Contents for this directory: into RCS files, retaining the info contained in the SCCS file (like dates, author, and log message). Contributed by Ken Cox <kenstir@viewlogic.com>. + pvcs_to_rcs A perl script that can convert (some) PVCS histories + into RCS files, retaining the info contained in the + PVCS history. See the comments at the start of the + file for more details. intro.doc A user's view of what you need to know to get started with CVS. Contributed by <Steven.Pemberton@cwi.nl>. diff --git a/gnu/usr.bin/cvs/cvs.spec b/gnu/usr.bin/cvs/cvs.spec index e8c837ce650..bb8656b0179 100644 --- a/gnu/usr.bin/cvs/cvs.spec +++ b/gnu/usr.bin/cvs/cvs.spec @@ -4,8 +4,8 @@ Version: @VERSION@ Release: 1 Copyright: GPL Group: Development/Version Control -Source: ftp.cyclic.com:/pub/cvs-@VERSION@.tar.gz -Buildroot: / +Source: ftp://download.cyclic.com/pub/cvs-@VERSION@/cvs-@VERSION@.tar.gz +Prefix: /usr %description CVS is a version control system, which allows you to keep old versions diff --git a/gnu/usr.bin/cvs/cvsnt.dsp b/gnu/usr.bin/cvs/cvsnt.dsp new file mode 100644 index 00000000000..4af92c05888 --- /dev/null +++ b/gnu/usr.bin/cvs/cvsnt.dsp @@ -0,0 +1,680 @@ +# Microsoft Developer Studio Project File - Name="cvsnt" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=cvsnt - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "cvsnt.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "cvsnt.mak" CFG="cvsnt - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "cvsnt - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "cvsnt - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir ".\WinRel" +# PROP BASE Intermediate_Dir ".\WinRel" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir ".\WinRel" +# PROP Intermediate_Dir ".\WinRel" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /YX /c +# ADD CPP /nologo /W3 /GX /Ob1 /I ".\windows-NT" /I ".\lib" /I ".\src" /I ".\zlib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /Fr /YX /FD /c +# SUBTRACT CPP /WX +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 advapi32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 /out:".\WinRel\cvs.exe" + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir ".\WinDebug" +# PROP BASE Intermediate_Dir ".\WinDebug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".\WinDebug" +# PROP Intermediate_Dir ".\WinDebug" +# PROP Ignore_Export_Lib 0 +# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Ob1 /I ".\windows-NT" /I ".\lib" /I ".\src" /I ".\zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /YX /FD /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 advapi32.lib /nologo /subsystem:console /debug /machine:I386 +# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\WinDebug\cvs.exe" + +!ENDIF + +# Begin Target + +# Name "cvsnt - Win32 Release" +# Name "cvsnt - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" +# Begin Source File + +SOURCE=.\src\add.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\adler32.c +# End Source File +# Begin Source File + +SOURCE=.\src\admin.c +# End Source File +# Begin Source File + +SOURCE=.\diff\analyze.c +# End Source File +# Begin Source File + +SOURCE=.\lib\argmatch.c +# End Source File +# Begin Source File + +SOURCE=.\src\buffer.c +# End Source File +# Begin Source File + +SOURCE=.\src\ChangeLog +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\ChangeLog" +# End Source File +# Begin Source File + +SOURCE=.\src\checkin.c +# End Source File +# Begin Source File + +SOURCE=.\src\checkout.c +# End Source File +# Begin Source File + +SOURCE=.\src\classify.c +# End Source File +# Begin Source File + +SOURCE=.\src\client.c +# End Source File +# Begin Source File + +SOURCE=.\diff\cmpbuf.c +# End Source File +# Begin Source File + +SOURCE=.\src\commit.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\compress.c +# End Source File +# Begin Source File + +SOURCE=.\diff\context.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\crc32.c +# End Source File +# Begin Source File + +SOURCE=.\src\create_adm.c +# End Source File +# Begin Source File + +SOURCE=.\src\cvsrc.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\deflate.c +# End Source File +# Begin Source File + +SOURCE=.\diff\diff.c + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP Intermediate_Dir ".\diff" +# PROP Ignore_Default_Tool 1 +# Begin Custom Build +InputPath=.\diff\diff.c + +"diff\diff.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl /MLd /W3 /Gm /GX /Zi /Ob1 /I ".\diff" /I ".\lib" /I ".\src" /I\ + ".\windows-NT" /D "HAVE_CONFIG_H" /Fp".\diff" /YX /Fo".\diff\diff.obj"\ + /Fd".\diff" /FD /c diff\diff.c + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\src\diff.c + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# SUBTRACT CPP /nologo + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\diff\diff3.c +# End Source File +# Begin Source File + +SOURCE=.\diff\dir.c +# End Source File +# Begin Source File + +SOURCE=.\diff\ed.c +# End Source File +# Begin Source File + +SOURCE=.\src\edit.c +# End Source File +# Begin Source File + +SOURCE=.\src\entries.c +# End Source File +# Begin Source File + +SOURCE=.\src\error.c +# End Source File +# Begin Source File + +SOURCE=.\src\expand_path.c +# End Source File +# Begin Source File + +SOURCE=.\src\fileattr.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\filesubr.c" +# End Source File +# Begin Source File + +SOURCE=.\src\find_names.c +# End Source File +# Begin Source File + +SOURCE=.\lib\fnmatch.c +# End Source File +# Begin Source File + +SOURCE=.\lib\getdate.c +# End Source File +# Begin Source File + +SOURCE=.\lib\getline.c +# End Source File +# Begin Source File + +SOURCE=.\lib\getopt.c +# End Source File +# Begin Source File + +SOURCE=.\lib\getopt1.c +# End Source File +# Begin Source File + +SOURCE=.\lib\getwd.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\gzio.c +# End Source File +# Begin Source File + +SOURCE=.\src\hash.c +# End Source File +# Begin Source File + +SOURCE=.\src\history.c +# End Source File +# Begin Source File + +SOURCE=.\diff\ifdef.c +# End Source File +# Begin Source File + +SOURCE=.\src\ignore.c +# End Source File +# Begin Source File + +SOURCE=.\src\import.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\infblock.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\infcodes.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\inffast.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\inflate.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\inftrees.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\infutil.c +# End Source File +# Begin Source File + +SOURCE=.\diff\io.c +# End Source File +# Begin Source File + +SOURCE=.\src\lock.c +# End Source File +# Begin Source File + +SOURCE=.\src\log.c +# End Source File +# Begin Source File + +SOURCE=.\src\login.c +# End Source File +# Begin Source File + +SOURCE=.\src\logmsg.c +# End Source File +# Begin Source File + +SOURCE=.\src\main.c +# End Source File +# Begin Source File + +SOURCE=.\lib\md5.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\mkdir.c" +# End Source File +# Begin Source File + +SOURCE=.\src\mkmodules.c +# End Source File +# Begin Source File + +SOURCE=.\src\modules.c +# End Source File +# Begin Source File + +SOURCE=.\src\myndbm.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\ndir.c" +# End Source File +# Begin Source File + +SOURCE=.\src\no_diff.c +# End Source File +# Begin Source File + +SOURCE=.\diff\normal.c +# End Source File +# Begin Source File + +SOURCE=.\src\parseinfo.c +# End Source File +# Begin Source File + +SOURCE=.\src\patch.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\pwd.c" +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\rcmd.c" +# End Source File +# Begin Source File + +SOURCE=.\src\rcs.c +# End Source File +# Begin Source File + +SOURCE=.\src\rcscmds.c +# End Source File +# Begin Source File + +SOURCE=.\src\recurse.c +# End Source File +# Begin Source File + +SOURCE=.\lib\regex.c +# End Source File +# Begin Source File + +SOURCE=.\src\release.c +# End Source File +# Begin Source File + +SOURCE=.\src\remove.c +# End Source File +# Begin Source File + +SOURCE=.\src\repos.c +# End Source File +# Begin Source File + +SOURCE=.\src\root.c +# End Source File +# Begin Source File + +SOURCE=.\src\rtag.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\run.c" +# End Source File +# Begin Source File + +SOURCE=.\lib\savecwd.c +# End Source File +# Begin Source File + +SOURCE=.\src\scramble.c +# End Source File +# Begin Source File + +SOURCE=.\src\server.c +# End Source File +# Begin Source File + +SOURCE=.\diff\side.c +# End Source File +# Begin Source File + +SOURCE=.\lib\sighandle.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\sockerror.c" +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\startserver.c" +# End Source File +# Begin Source File + +SOURCE=.\src\status.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\stripslash.c" +# End Source File +# Begin Source File + +SOURCE=.\src\subr.c +# End Source File +# Begin Source File + +SOURCE=.\src\tag.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\trees.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\uncompr.c +# End Source File +# Begin Source File + +SOURCE=.\src\update.c +# End Source File +# Begin Source File + +SOURCE=.\diff\util.c +# End Source File +# Begin Source File + +SOURCE=.\lib\valloc.c +# End Source File +# Begin Source File + +SOURCE=.\lib\vasprintf.c +# End Source File +# Begin Source File + +SOURCE=.\src\vers_ts.c +# End Source File +# Begin Source File + +SOURCE=.\diff\version.c + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP Intermediate_Dir ".\diff" +# PROP Ignore_Default_Tool 1 +# Begin Custom Build +InputPath=.\diff\version.c + +"diff\version.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + cl /MLd /W3 /Gm /GX /Zi /Ob1 /Fp".\diff\" /YX /Fo".\diff\" /Fd".\diff\" /FD /c\ + diff/version.c + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\src\version.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\waitpid.c" +# End Source File +# Begin Source File + +SOURCE=.\src\watch.c +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\win32.c" +# End Source File +# Begin Source File + +SOURCE=.\src\wrapper.c +# End Source File +# Begin Source File + +SOURCE=.\lib\xgetwd.c +# End Source File +# Begin Source File + +SOURCE=.\lib\yesno.c +# End Source File +# Begin Source File + +SOURCE=.\src\zlib.c +# End Source File +# Begin Source File + +SOURCE=.\zlib\zutil.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" +# Begin Source File + +SOURCE=.\src\buffer.h +# End Source File +# Begin Source File + +SOURCE=.\src\client.h +# End Source File +# Begin Source File + +SOURCE=.\diff\cmpbuf.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\deflate.h +# End Source File +# Begin Source File + +SOURCE=.\diff\diff.h +# End Source File +# Begin Source File + +SOURCE=.\src\edit.h +# End Source File +# Begin Source File + +SOURCE=.\src\fileattr.h +# End Source File +# Begin Source File + +SOURCE=.\lib\fnmatch.h +# End Source File +# Begin Source File + +SOURCE=.\lib\getline.h +# End Source File +# Begin Source File + +SOURCE=.\lib\getopt.h +# End Source File +# Begin Source File + +SOURCE=.\src\hash.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\infblock.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\infcodes.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\inffast.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\inftrees.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\infutil.h +# End Source File +# Begin Source File + +SOURCE=.\lib\md5.h +# End Source File +# Begin Source File + +SOURCE=.\src\myndbm.h +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\ndir.h" +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\pwd.h" +# End Source File +# Begin Source File + +SOURCE=".\windows-NT\rcmd.h" +# End Source File +# Begin Source File + +SOURCE=.\src\rcs.h +# End Source File +# Begin Source File + +SOURCE=.\lib\regex.h +# End Source File +# Begin Source File + +SOURCE=.\lib\savecwd.h +# End Source File +# Begin Source File + +SOURCE=.\src\server.h +# End Source File +# Begin Source File + +SOURCE=.\diff\system.h +# End Source File +# Begin Source File + +SOURCE=.\src\update.h +# End Source File +# Begin Source File + +SOURCE=.\src\watch.h +# End Source File +# Begin Source File + +SOURCE=.\zlib\zutil.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/gnu/usr.bin/cvs/cvsnt.mak b/gnu/usr.bin/cvs/cvsnt.mak index 77fdc5065e2..1bbab74ede2 100644 --- a/gnu/usr.bin/cvs/cvsnt.mak +++ b/gnu/usr.bin/cvs/cvsnt.mak @@ -31,8 +31,8 @@ NULL=nul ################################################################################ # Begin Project # PROP Target_Last_Scanned "cvsnt - Win32 Debug" -RSC=rc.exe CPP=cl.exe +RSC=rc.exe !IF "$(CFG)" == "cvsnt - Win32 Release" @@ -51,97 +51,110 @@ ALL : "$(OUTDIR)\cvs.exe" CLEAN : -@erase ".\WinRel\cvs.exe" - -@erase ".\WinRel\commit.obj" + -@erase ".\WinRel\inflate.obj" + -@erase ".\WinRel\trees.obj" + -@erase ".\WinRel\getline.obj" + -@erase ".\WinRel\edit.obj" + -@erase ".\WinRel\zutil.obj" + -@erase ".\WinRel\ifdef.obj" + -@erase ".\WinRel\create_adm.obj" + -@erase ".\WinRel\zlib.obj" + -@erase ".\WinRel\main.obj" + -@erase ".\WinRel\cmpbuf.obj" + -@erase ".\WinRel\crc32.obj" + -@erase ".\WinRel\infcodes.obj" + -@erase ".\WinRel\myndbm.obj" + -@erase ".\WinRel\savecwd.obj" + -@erase ".\WinRel\client.obj" + -@erase ".\WinRel\1\diff.obj" -@erase ".\WinRel\scramble.obj" -@erase ".\WinRel\filesubr.obj" - -@erase ".\WinRel\rcs.obj" - -@erase ".\WinRel\uncompr.obj" - -@erase ".\WinRel\inftrees.obj" + -@erase ".\WinRel\infutil.obj" + -@erase ".\WinRel\gzio.obj" + -@erase ".\WinRel\fnmatch.obj" + -@erase ".\WinRel\side.obj" + -@erase ".\WinRel\win32.obj" + -@erase ".\WinRel\inffast.obj" + -@erase ".\WinRel\startserver.obj" + -@erase ".\WinRel\ignore.obj" + -@erase ".\WinRel\expand_path.obj" + -@erase ".\WinRel\repos.obj" + -@erase ".\WinRel\rtag.obj" + -@erase ".\WinRel\valloc.obj" + -@erase ".\WinRel\cvsrc.obj" + -@erase ".\WinRel\lock.obj" + -@erase ".\WinRel\log.obj" + -@erase ".\WinRel\ed.obj" + -@erase ".\WinRel\deflate.obj" + -@erase ".\WinRel\analyze.obj" + -@erase ".\WinRel\commit.obj" + -@erase ".\WinRel\patch.obj" + -@erase ".\WinRel\classify.obj" + -@erase ".\WinRel\2\diff.obj" + -@erase ".\WinRel\history.obj" + -@erase ".\WinRel\add.obj" -@erase ".\WinRel\update.obj" - -@erase ".\WinRel\release.obj" - -@erase ".\WinRel\login.obj" - -@erase ".\WinRel\run.obj" + -@erase ".\WinRel\2\version.obj" + -@erase ".\WinRel\uncompr.obj" -@erase ".\WinRel\buffer.obj" - -@erase ".\WinRel\hash.obj" - -@erase ".\WinRel\modules.obj" + -@erase ".\WinRel\rcmd.obj" + -@erase ".\WinRel\find_names.obj" + -@erase ".\WinRel\watch.obj" -@erase ".\WinRel\getopt.obj" - -@erase ".\WinRel\subr.obj" + -@erase ".\WinRel\checkin.obj" + -@erase ".\WinRel\fileattr.obj" + -@erase ".\WinRel\modules.obj" + -@erase ".\WinRel\rcs.obj" + -@erase ".\WinRel\admin.obj" -@erase ".\WinRel\mkmodules.obj" - -@erase ".\WinRel\getdate.obj" + -@erase ".\WinRel\diff3.obj" + -@erase ".\WinRel\run.obj" + -@erase ".\WinRel\compress.obj" -@erase ".\WinRel\waitpid.obj" + -@erase ".\WinRel\normal.obj" + -@erase ".\WinRel\adler32.obj" + -@erase ".\WinRel\login.obj" -@erase ".\WinRel\sighandle.obj" - -@erase ".\WinRel\inflate.obj" - -@erase ".\WinRel\classify.obj" - -@erase ".\WinRel\tag.obj" + -@erase ".\WinRel\util.obj" + -@erase ".\WinRel\logmsg.obj" + -@erase ".\WinRel\remove.obj" -@erase ".\WinRel\entries.obj" - -@erase ".\WinRel\win32.obj" - -@erase ".\WinRel\pwd.obj" + -@erase ".\WinRel\dir.obj" -@erase ".\WinRel\getopt1.obj" - -@erase ".\WinRel\logmsg.obj" - -@erase ".\WinRel\error.obj" - -@erase ".\WinRel\fileattr.obj" - -@erase ".\WinRel\stripslash.obj" + -@erase ".\WinRel\md5.obj" -@erase ".\WinRel\xgetwd.obj" - -@erase ".\WinRel\infutil.obj" - -@erase ".\WinRel\fnmatch.obj" + -@erase ".\WinRel\yesno.obj" + -@erase ".\WinRel\no_diff.obj" + -@erase ".\WinRel\root.obj" + -@erase ".\WinRel\tag.obj" + -@erase ".\WinRel\server.obj" + -@erase ".\WinRel\pwd.obj" -@erase ".\WinRel\parseinfo.obj" - -@erase ".\WinRel\zlib.obj" - -@erase ".\WinRel\main.obj" + -@erase ".\WinRel\infblock.obj" + -@erase ".\WinRel\inftrees.obj" + -@erase ".\WinRel\regex.obj" + -@erase ".\WinRel\io.obj" + -@erase ".\WinRel\1\version.obj" -@erase ".\WinRel\vasprintf.obj" - -@erase ".\WinRel\server.obj" -@erase ".\WinRel\vers_ts.obj" - -@erase ".\WinRel\patch.obj" - -@erase ".\WinRel\compress.obj" - -@erase ".\WinRel\getwd.obj" - -@erase ".\WinRel\gzio.obj" - -@erase ".\WinRel\diff.obj" - -@erase ".\WinRel\mkdir.obj" - -@erase ".\WinRel\trees.obj" - -@erase ".\WinRel\sockerror.obj" - -@erase ".\WinRel\recurse.obj" + -@erase ".\WinRel\checkout.obj" + -@erase ".\WinRel\stripslash.obj" + -@erase ".\WinRel\error.obj" + -@erase ".\WinRel\hash.obj" + -@erase ".\WinRel\subr.obj" -@erase ".\WinRel\import.obj" - -@erase ".\WinRel\rtag.obj" + -@erase ".\WinRel\release.obj" + -@erase ".\WinRel\recurse.obj" + -@erase ".\WinRel\argmatch.obj" + -@erase ".\WinRel\sockerror.obj" + -@erase ".\WinRel\context.obj" -@erase ".\WinRel\rcscmds.obj" - -@erase ".\WinRel\root.obj" -@erase ".\WinRel\wrapper.obj" - -@erase ".\WinRel\lock.obj" - -@erase ".\WinRel\zutil.obj" - -@erase ".\WinRel\history.obj" - -@erase ".\WinRel\admin.obj" - -@erase ".\WinRel\version.obj" - -@erase ".\WinRel\crc32.obj" - -@erase ".\WinRel\create_adm.obj" - -@erase ".\WinRel\infblock.obj" -@erase ".\WinRel\status.obj" - -@erase ".\WinRel\md5.obj" - -@erase ".\WinRel\checkin.obj" - -@erase ".\WinRel\checkout.obj" - -@erase ".\WinRel\getline.obj" - -@erase ".\WinRel\rcmd.obj" - -@erase ".\WinRel\yesno.obj" - -@erase ".\WinRel\adler32.obj" - -@erase ".\WinRel\savecwd.obj" - -@erase ".\WinRel\repos.obj" - -@erase ".\WinRel\argmatch.obj" -@erase ".\WinRel\ndir.obj" - -@erase ".\WinRel\myndbm.obj" - -@erase ".\WinRel\cvsrc.obj" - -@erase ".\WinRel\startserver.obj" - -@erase ".\WinRel\client.obj" - -@erase ".\WinRel\regex.obj" - -@erase ".\WinRel\log.obj" - -@erase ".\WinRel\inffast.obj" - -@erase ".\WinRel\expand_path.obj" - -@erase ".\WinRel\remove.obj" - -@erase ".\WinRel\no_diff.obj" - -@erase ".\WinRel\edit.obj" - -@erase ".\WinRel\ignore.obj" - -@erase ".\WinRel\add.obj" - -@erase ".\WinRel\watch.obj" - -@erase ".\WinRel\deflate.obj" - -@erase ".\WinRel\find_names.obj" - -@erase ".\WinRel\valloc.obj" - -@erase ".\WinRel\infcodes.obj" + -@erase ".\WinRel\getdate.obj" + -@erase ".\WinRel\mkdir.obj" + -@erase ".\WinRel\fncase.obj" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" @@ -169,97 +182,110 @@ LINK32_FLAGS=wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ /subsystem:console /incremental:no /pdb:"$(OUTDIR)/cvs.pdb" /machine:I386\ /out:"$(OUTDIR)/cvs.exe" LINK32_OBJS= \ - "$(INTDIR)/commit.obj" \ - "$(INTDIR)/scramble.obj" \ - "$(INTDIR)/filesubr.obj" \ - "$(INTDIR)/rcs.obj" \ - "$(INTDIR)/uncompr.obj" \ - "$(INTDIR)/inftrees.obj" \ - "$(INTDIR)/update.obj" \ - "$(INTDIR)/release.obj" \ - "$(INTDIR)/login.obj" \ - "$(INTDIR)/run.obj" \ - "$(INTDIR)/buffer.obj" \ - "$(INTDIR)/hash.obj" \ - "$(INTDIR)/modules.obj" \ - "$(INTDIR)/getopt.obj" \ - "$(INTDIR)/subr.obj" \ - "$(INTDIR)/mkmodules.obj" \ - "$(INTDIR)/getdate.obj" \ - "$(INTDIR)/waitpid.obj" \ - "$(INTDIR)/sighandle.obj" \ - "$(INTDIR)/inflate.obj" \ - "$(INTDIR)/classify.obj" \ - "$(INTDIR)/tag.obj" \ - "$(INTDIR)/entries.obj" \ - "$(INTDIR)/win32.obj" \ - "$(INTDIR)/pwd.obj" \ - "$(INTDIR)/getopt1.obj" \ - "$(INTDIR)/logmsg.obj" \ - "$(INTDIR)/error.obj" \ - "$(INTDIR)/fileattr.obj" \ - "$(INTDIR)/stripslash.obj" \ - "$(INTDIR)/xgetwd.obj" \ - "$(INTDIR)/infutil.obj" \ - "$(INTDIR)/fnmatch.obj" \ - "$(INTDIR)/parseinfo.obj" \ - "$(INTDIR)/zlib.obj" \ - "$(INTDIR)/main.obj" \ - "$(INTDIR)/vasprintf.obj" \ - "$(INTDIR)/server.obj" \ - "$(INTDIR)/vers_ts.obj" \ - "$(INTDIR)/patch.obj" \ - "$(INTDIR)/compress.obj" \ - "$(INTDIR)/getwd.obj" \ - "$(INTDIR)/gzio.obj" \ - "$(INTDIR)/diff.obj" \ - "$(INTDIR)/mkdir.obj" \ - "$(INTDIR)/trees.obj" \ - "$(INTDIR)/sockerror.obj" \ - "$(INTDIR)/recurse.obj" \ - "$(INTDIR)/import.obj" \ - "$(INTDIR)/rtag.obj" \ - "$(INTDIR)/rcscmds.obj" \ - "$(INTDIR)/root.obj" \ - "$(INTDIR)/wrapper.obj" \ - "$(INTDIR)/lock.obj" \ - "$(INTDIR)/zutil.obj" \ - "$(INTDIR)/history.obj" \ - "$(INTDIR)/admin.obj" \ - "$(INTDIR)/version.obj" \ - "$(INTDIR)/crc32.obj" \ - "$(INTDIR)/create_adm.obj" \ - "$(INTDIR)/infblock.obj" \ - "$(INTDIR)/status.obj" \ - "$(INTDIR)/md5.obj" \ - "$(INTDIR)/checkin.obj" \ - "$(INTDIR)/checkout.obj" \ - "$(INTDIR)/getline.obj" \ - "$(INTDIR)/rcmd.obj" \ - "$(INTDIR)/yesno.obj" \ - "$(INTDIR)/adler32.obj" \ - "$(INTDIR)/savecwd.obj" \ - "$(INTDIR)/repos.obj" \ - "$(INTDIR)/argmatch.obj" \ - "$(INTDIR)/ndir.obj" \ - "$(INTDIR)/myndbm.obj" \ - "$(INTDIR)/cvsrc.obj" \ - "$(INTDIR)/startserver.obj" \ - "$(INTDIR)/client.obj" \ - "$(INTDIR)/regex.obj" \ - "$(INTDIR)/log.obj" \ - "$(INTDIR)/inffast.obj" \ - "$(INTDIR)/expand_path.obj" \ - "$(INTDIR)/remove.obj" \ - "$(INTDIR)/no_diff.obj" \ - "$(INTDIR)/edit.obj" \ - "$(INTDIR)/ignore.obj" \ - "$(INTDIR)/add.obj" \ - "$(INTDIR)/watch.obj" \ - "$(INTDIR)/deflate.obj" \ - "$(INTDIR)/find_names.obj" \ - "$(INTDIR)/valloc.obj" \ - "$(INTDIR)/infcodes.obj" + ".\WinRel\inflate.obj" \ + ".\WinRel\trees.obj" \ + ".\WinRel\getline.obj" \ + ".\WinRel\edit.obj" \ + ".\WinRel\zutil.obj" \ + ".\WinRel\ifdef.obj" \ + ".\WinRel\create_adm.obj" \ + ".\WinRel\zlib.obj" \ + ".\WinRel\main.obj" \ + ".\WinRel\cmpbuf.obj" \ + ".\WinRel\crc32.obj" \ + ".\WinRel\infcodes.obj" \ + ".\WinRel\myndbm.obj" \ + ".\WinRel\savecwd.obj" \ + ".\WinRel\client.obj" \ + ".\WinRel\1\diff.obj" \ + ".\WinRel\scramble.obj" \ + ".\WinRel\filesubr.obj" \ + ".\WinRel\infutil.obj" \ + ".\WinRel\gzio.obj" \ + ".\WinRel\fnmatch.obj" \ + ".\WinRel\side.obj" \ + ".\WinRel\win32.obj" \ + ".\WinRel\inffast.obj" \ + ".\WinRel\startserver.obj" \ + ".\WinRel\ignore.obj" \ + ".\WinRel\expand_path.obj" \ + ".\WinRel\repos.obj" \ + ".\WinRel\rtag.obj" \ + ".\WinRel\valloc.obj" \ + ".\WinRel\cvsrc.obj" \ + ".\WinRel\lock.obj" \ + ".\WinRel\log.obj" \ + ".\WinRel\ed.obj" \ + ".\WinRel\deflate.obj" \ + ".\WinRel\analyze.obj" \ + ".\WinRel\commit.obj" \ + ".\WinRel\patch.obj" \ + ".\WinRel\classify.obj" \ + ".\WinRel\2\diff.obj" \ + ".\WinRel\history.obj" \ + ".\WinRel\add.obj" \ + ".\WinRel\update.obj" \ + ".\WinRel\2\version.obj" \ + ".\WinRel\uncompr.obj" \ + ".\WinRel\buffer.obj" \ + ".\WinRel\rcmd.obj" \ + ".\WinRel\find_names.obj" \ + ".\WinRel\watch.obj" \ + ".\WinRel\getopt.obj" \ + ".\WinRel\checkin.obj" \ + ".\WinRel\fileattr.obj" \ + ".\WinRel\modules.obj" \ + ".\WinRel\rcs.obj" \ + ".\WinRel\admin.obj" \ + ".\WinRel\mkmodules.obj" \ + ".\WinRel\diff3.obj" \ + ".\WinRel\run.obj" \ + ".\WinRel\compress.obj" \ + ".\WinRel\waitpid.obj" \ + ".\WinRel\normal.obj" \ + ".\WinRel\adler32.obj" \ + ".\WinRel\login.obj" \ + ".\WinRel\sighandle.obj" \ + ".\WinRel\util.obj" \ + ".\WinRel\logmsg.obj" \ + ".\WinRel\remove.obj" \ + ".\WinRel\entries.obj" \ + ".\WinRel\dir.obj" \ + ".\WinRel\getopt1.obj" \ + ".\WinRel\md5.obj" \ + ".\WinRel\xgetwd.obj" \ + ".\WinRel\yesno.obj" \ + ".\WinRel\no_diff.obj" \ + ".\WinRel\root.obj" \ + ".\WinRel\tag.obj" \ + ".\WinRel\server.obj" \ + ".\WinRel\pwd.obj" \ + ".\WinRel\parseinfo.obj" \ + ".\WinRel\infblock.obj" \ + ".\WinRel\inftrees.obj" \ + ".\WinRel\regex.obj" \ + ".\WinRel\io.obj" \ + ".\WinRel\1\version.obj" \ + ".\WinRel\vasprintf.obj" \ + ".\WinRel\vers_ts.obj" \ + ".\WinRel\checkout.obj" \ + ".\WinRel\stripslash.obj" \ + ".\WinRel\error.obj" \ + ".\WinRel\hash.obj" \ + ".\WinRel\subr.obj" \ + ".\WinRel\import.obj" \ + ".\WinRel\release.obj" \ + ".\WinRel\recurse.obj" \ + ".\WinRel\argmatch.obj" \ + ".\WinRel\sockerror.obj" \ + ".\WinRel\context.obj" \ + ".\WinRel\rcscmds.obj" \ + ".\WinRel\wrapper.obj" \ + ".\WinRel\status.obj" \ + ".\WinRel\ndir.obj" \ + ".\WinRel\getdate.obj" \ + ".\WinRel\mkdir.obj" \ + ".\WinRel\fncase.obj" "$(OUTDIR)\cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< @@ -284,98 +310,115 @@ ALL : "$(OUTDIR)\cvs.exe" CLEAN : -@erase ".\WinDebug\vc40.pdb" -@erase ".\WinDebug\vc40.idb" + -@erase ".\WinDebug\1\vc40.pdb" + -@erase ".\WinDebug\1\vc40.idb" + -@erase ".\WinDebug\2\vc40.pdb" + -@erase ".\WinDebug\2\vc40.idb" -@erase ".\WinDebug\cvs.exe" - -@erase ".\WinDebug\add.obj" + -@erase ".\WinDebug\regex.obj" + -@erase ".\WinDebug\normal.obj" + -@erase ".\WinDebug\client.obj" + -@erase ".\WinDebug\util.obj" + -@erase ".\WinDebug\create_adm.obj" + -@erase ".\WinDebug\vers_ts.obj" + -@erase ".\WinDebug\logmsg.obj" + -@erase ".\WinDebug\mkmodules.obj" + -@erase ".\WinDebug\remove.obj" + -@erase ".\WinDebug\sighandle.obj" + -@erase ".\WinDebug\watch.obj" + -@erase ".\WinDebug\release.obj" + -@erase ".\WinDebug\server.obj" + -@erase ".\WinDebug\recurse.obj" + -@erase ".\WinDebug\checkout.obj" + -@erase ".\WinDebug\context.obj" + -@erase ".\WinDebug\rcscmds.obj" + -@erase ".\WinDebug\side.obj" + -@erase ".\WinDebug\wrapper.obj" + -@erase ".\WinDebug\getdate.obj" + -@erase ".\WinDebug\parseinfo.obj" + -@erase ".\WinDebug\login.obj" + -@erase ".\WinDebug\hash.obj" + -@erase ".\WinDebug\1\version.obj" + -@erase ".\WinDebug\subr.obj" + -@erase ".\WinDebug\vasprintf.obj" + -@erase ".\WinDebug\fileattr.obj" + -@erase ".\WinDebug\import.obj" + -@erase ".\WinDebug\getline.obj" + -@erase ".\WinDebug\ifdef.obj" + -@erase ".\WinDebug\crc32.obj" + -@erase ".\WinDebug\find_names.obj" + -@erase ".\WinDebug\status.obj" + -@erase ".\WinDebug\ndir.obj" -@erase ".\WinDebug\savecwd.obj" + -@erase ".\WinDebug\log.obj" -@erase ".\WinDebug\sockerror.obj" - -@erase ".\WinDebug\infcodes.obj" - -@erase ".\WinDebug\valloc.obj" - -@erase ".\WinDebug\server.obj" - -@erase ".\WinDebug\scramble.obj" - -@erase ".\WinDebug\filesubr.obj" + -@erase ".\WinDebug\infutil.obj" -@erase ".\WinDebug\win32.obj" -@erase ".\WinDebug\inffast.obj" - -@erase ".\WinDebug\inftrees.obj" - -@erase ".\WinDebug\no_diff.obj" - -@erase ".\WinDebug\repos.obj" + -@erase ".\WinDebug\ed.obj" -@erase ".\WinDebug\edit.obj" - -@erase ".\WinDebug\cvsrc.obj" - -@erase ".\WinDebug\startserver.obj" - -@erase ".\WinDebug\getopt.obj" + -@erase ".\WinDebug\add.obj" + -@erase ".\WinDebug\repos.obj" + -@erase ".\WinDebug\error.obj" -@erase ".\WinDebug\zlib.obj" - -@erase ".\WinDebug\deflate.obj" -@erase ".\WinDebug\main.obj" - -@erase ".\WinDebug\expand_path.obj" - -@erase ".\WinDebug\getwd.obj" - -@erase ".\WinDebug\md5.obj" + -@erase ".\WinDebug\filesubr.obj" + -@erase ".\WinDebug\cmpbuf.obj" + -@erase ".\WinDebug\myndbm.obj" + -@erase ".\WinDebug\xgetwd.obj" + -@erase ".\WinDebug\infblock.obj" + -@erase ".\WinDebug\inftrees.obj" + -@erase ".\WinDebug\deflate.obj" + -@erase ".\WinDebug\1\diff.obj" + -@erase ".\WinDebug\analyze.obj" -@erase ".\WinDebug\gzio.obj" - -@erase ".\WinDebug\classify.obj" + -@erase ".\WinDebug\patch.obj" + -@erase ".\WinDebug\rcs.obj" + -@erase ".\WinDebug\history.obj" + -@erase ".\WinDebug\run.obj" + -@erase ".\WinDebug\mkdir.obj" -@erase ".\WinDebug\uncompr.obj" - -@erase ".\WinDebug\diff.obj" - -@erase ".\WinDebug\watch.obj" - -@erase ".\WinDebug\release.obj" - -@erase ".\WinDebug\tag.obj" - -@erase ".\WinDebug\logmsg.obj" - -@erase ".\WinDebug\pwd.obj" - -@erase ".\WinDebug\modules.obj" + -@erase ".\WinDebug\ignore.obj" -@erase ".\WinDebug\rtag.obj" -@erase ".\WinDebug\root.obj" - -@erase ".\WinDebug\admin.obj" + -@erase ".\WinDebug\trees.obj" + -@erase ".\WinDebug\checkin.obj" + -@erase ".\WinDebug\valloc.obj" + -@erase ".\WinDebug\argmatch.obj" -@erase ".\WinDebug\lock.obj" - -@erase ".\WinDebug\getdate.obj" - -@erase ".\WinDebug\myndbm.obj" - -@erase ".\WinDebug\xgetwd.obj" + -@erase ".\WinDebug\modules.obj" + -@erase ".\WinDebug\classify.obj" + -@erase ".\WinDebug\dir.obj" + -@erase ".\WinDebug\startserver.obj" + -@erase ".\WinDebug\zutil.obj" + -@erase ".\WinDebug\stripslash.obj" + -@erase ".\WinDebug\md5.obj" + -@erase ".\WinDebug\admin.obj" + -@erase ".\WinDebug\commit.obj" + -@erase ".\WinDebug\diff3.obj" + -@erase ".\WinDebug\expand_path.obj" + -@erase ".\WinDebug\2\diff.obj" + -@erase ".\WinDebug\update.obj" -@erase ".\WinDebug\waitpid.obj" - -@erase ".\WinDebug\login.obj" -@erase ".\WinDebug\adler32.obj" -@erase ".\WinDebug\inflate.obj" - -@erase ".\WinDebug\compress.obj" - -@erase ".\WinDebug\log.obj" - -@erase ".\WinDebug\entries.obj" - -@erase ".\WinDebug\stripslash.obj" + -@erase ".\WinDebug\tag.obj" + -@erase ".\WinDebug\buffer.obj" -@erase ".\WinDebug\rcmd.obj" + -@erase ".\WinDebug\pwd.obj" + -@erase ".\WinDebug\getopt.obj" + -@erase ".\WinDebug\entries.obj" -@erase ".\WinDebug\getopt1.obj" - -@erase ".\WinDebug\ignore.obj" + -@erase ".\WinDebug\2\version.obj" -@erase ".\WinDebug\yesno.obj" - -@erase ".\WinDebug\infutil.obj" + -@erase ".\WinDebug\compress.obj" + -@erase ".\WinDebug\io.obj" + -@erase ".\WinDebug\infcodes.obj" + -@erase ".\WinDebug\no_diff.obj" + -@erase ".\WinDebug\scramble.obj" + -@erase ".\WinDebug\cvsrc.obj" -@erase ".\WinDebug\fnmatch.obj" - -@erase ".\WinDebug\import.obj" - -@erase ".\WinDebug\ndir.obj" - -@erase ".\WinDebug\regex.obj" - -@erase ".\WinDebug\commit.obj" - -@erase ".\WinDebug\mkmodules.obj" - -@erase ".\WinDebug\vers_ts.obj" - -@erase ".\WinDebug\infblock.obj" - -@erase ".\WinDebug\find_names.obj" - -@erase ".\WinDebug\rcs.obj" - -@erase ".\WinDebug\sighandle.obj" - -@erase ".\WinDebug\status.obj" - -@erase ".\WinDebug\update.obj" - -@erase ".\WinDebug\error.obj" - -@erase ".\WinDebug\checkout.obj" - -@erase ".\WinDebug\buffer.obj" - -@erase ".\WinDebug\run.obj" - -@erase ".\WinDebug\create_adm.obj" - -@erase ".\WinDebug\recurse.obj" - -@erase ".\WinDebug\patch.obj" - -@erase ".\WinDebug\rcscmds.obj" - -@erase ".\WinDebug\wrapper.obj" - -@erase ".\WinDebug\argmatch.obj" - -@erase ".\WinDebug\fileattr.obj" - -@erase ".\WinDebug\history.obj" - -@erase ".\WinDebug\version.obj" - -@erase ".\WinDebug\parseinfo.obj" - -@erase ".\WinDebug\mkdir.obj" - -@erase ".\WinDebug\vasprintf.obj" - -@erase ".\WinDebug\client.obj" - -@erase ".\WinDebug\checkin.obj" - -@erase ".\WinDebug\trees.obj" - -@erase ".\WinDebug\remove.obj" - -@erase ".\WinDebug\getline.obj" - -@erase ".\WinDebug\hash.obj" - -@erase ".\WinDebug\subr.obj" - -@erase ".\WinDebug\zutil.obj" - -@erase ".\WinDebug\crc32.obj" + -@erase ".\WinDebug\fncase.obj" -@erase ".\WinDebug\cvs.ilk" -@erase ".\WinDebug\cvs.pdb" @@ -405,97 +448,110 @@ LINK32_FLAGS=wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\ /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/cvs.pdb" /debug\ /machine:I386 /out:"$(OUTDIR)/cvs.exe" LINK32_OBJS= \ - "$(INTDIR)/add.obj" \ - "$(INTDIR)/savecwd.obj" \ - "$(INTDIR)/sockerror.obj" \ - "$(INTDIR)/infcodes.obj" \ - "$(INTDIR)/valloc.obj" \ - "$(INTDIR)/server.obj" \ - "$(INTDIR)/scramble.obj" \ - "$(INTDIR)/filesubr.obj" \ - "$(INTDIR)/win32.obj" \ - "$(INTDIR)/inffast.obj" \ - "$(INTDIR)/inftrees.obj" \ - "$(INTDIR)/no_diff.obj" \ - "$(INTDIR)/repos.obj" \ - "$(INTDIR)/edit.obj" \ - "$(INTDIR)/cvsrc.obj" \ - "$(INTDIR)/startserver.obj" \ - "$(INTDIR)/getopt.obj" \ - "$(INTDIR)/zlib.obj" \ - "$(INTDIR)/deflate.obj" \ - "$(INTDIR)/main.obj" \ - "$(INTDIR)/expand_path.obj" \ - "$(INTDIR)/getwd.obj" \ - "$(INTDIR)/md5.obj" \ - "$(INTDIR)/gzio.obj" \ - "$(INTDIR)/classify.obj" \ - "$(INTDIR)/uncompr.obj" \ - "$(INTDIR)/diff.obj" \ - "$(INTDIR)/watch.obj" \ - "$(INTDIR)/release.obj" \ - "$(INTDIR)/tag.obj" \ - "$(INTDIR)/logmsg.obj" \ - "$(INTDIR)/pwd.obj" \ - "$(INTDIR)/modules.obj" \ - "$(INTDIR)/rtag.obj" \ - "$(INTDIR)/root.obj" \ - "$(INTDIR)/admin.obj" \ - "$(INTDIR)/lock.obj" \ - "$(INTDIR)/getdate.obj" \ - "$(INTDIR)/myndbm.obj" \ - "$(INTDIR)/xgetwd.obj" \ - "$(INTDIR)/waitpid.obj" \ - "$(INTDIR)/login.obj" \ - "$(INTDIR)/adler32.obj" \ - "$(INTDIR)/inflate.obj" \ - "$(INTDIR)/compress.obj" \ - "$(INTDIR)/log.obj" \ - "$(INTDIR)/entries.obj" \ - "$(INTDIR)/stripslash.obj" \ - "$(INTDIR)/rcmd.obj" \ - "$(INTDIR)/getopt1.obj" \ - "$(INTDIR)/ignore.obj" \ - "$(INTDIR)/yesno.obj" \ - "$(INTDIR)/infutil.obj" \ - "$(INTDIR)/fnmatch.obj" \ - "$(INTDIR)/import.obj" \ - "$(INTDIR)/ndir.obj" \ - "$(INTDIR)/regex.obj" \ - "$(INTDIR)/commit.obj" \ - "$(INTDIR)/mkmodules.obj" \ - "$(INTDIR)/vers_ts.obj" \ - "$(INTDIR)/infblock.obj" \ - "$(INTDIR)/find_names.obj" \ - "$(INTDIR)/rcs.obj" \ - "$(INTDIR)/sighandle.obj" \ - "$(INTDIR)/status.obj" \ - "$(INTDIR)/update.obj" \ - "$(INTDIR)/error.obj" \ - "$(INTDIR)/checkout.obj" \ - "$(INTDIR)/buffer.obj" \ - "$(INTDIR)/run.obj" \ - "$(INTDIR)/create_adm.obj" \ - "$(INTDIR)/recurse.obj" \ - "$(INTDIR)/patch.obj" \ - "$(INTDIR)/rcscmds.obj" \ - "$(INTDIR)/wrapper.obj" \ - "$(INTDIR)/argmatch.obj" \ - "$(INTDIR)/fileattr.obj" \ - "$(INTDIR)/history.obj" \ - "$(INTDIR)/version.obj" \ - "$(INTDIR)/parseinfo.obj" \ - "$(INTDIR)/mkdir.obj" \ - "$(INTDIR)/vasprintf.obj" \ - "$(INTDIR)/client.obj" \ - "$(INTDIR)/checkin.obj" \ - "$(INTDIR)/trees.obj" \ - "$(INTDIR)/remove.obj" \ - "$(INTDIR)/getline.obj" \ - "$(INTDIR)/hash.obj" \ - "$(INTDIR)/subr.obj" \ - "$(INTDIR)/zutil.obj" \ - "$(INTDIR)/crc32.obj" + ".\WinDebug\regex.obj" \ + ".\WinDebug\normal.obj" \ + ".\WinDebug\client.obj" \ + ".\WinDebug\util.obj" \ + ".\WinDebug\create_adm.obj" \ + ".\WinDebug\vers_ts.obj" \ + ".\WinDebug\logmsg.obj" \ + ".\WinDebug\mkmodules.obj" \ + ".\WinDebug\remove.obj" \ + ".\WinDebug\sighandle.obj" \ + ".\WinDebug\watch.obj" \ + ".\WinDebug\release.obj" \ + ".\WinDebug\server.obj" \ + ".\WinDebug\recurse.obj" \ + ".\WinDebug\checkout.obj" \ + ".\WinDebug\context.obj" \ + ".\WinDebug\rcscmds.obj" \ + ".\WinDebug\side.obj" \ + ".\WinDebug\wrapper.obj" \ + ".\WinDebug\getdate.obj" \ + ".\WinDebug\parseinfo.obj" \ + ".\WinDebug\login.obj" \ + ".\WinDebug\hash.obj" \ + ".\WinDebug\1\version.obj" \ + ".\WinDebug\subr.obj" \ + ".\WinDebug\vasprintf.obj" \ + ".\WinDebug\fileattr.obj" \ + ".\WinDebug\import.obj" \ + ".\WinDebug\getline.obj" \ + ".\WinDebug\ifdef.obj" \ + ".\WinDebug\crc32.obj" \ + ".\WinDebug\find_names.obj" \ + ".\WinDebug\status.obj" \ + ".\WinDebug\ndir.obj" \ + ".\WinDebug\savecwd.obj" \ + ".\WinDebug\log.obj" \ + ".\WinDebug\sockerror.obj" \ + ".\WinDebug\infutil.obj" \ + ".\WinDebug\win32.obj" \ + ".\WinDebug\inffast.obj" \ + ".\WinDebug\ed.obj" \ + ".\WinDebug\edit.obj" \ + ".\WinDebug\add.obj" \ + ".\WinDebug\repos.obj" \ + ".\WinDebug\error.obj" \ + ".\WinDebug\zlib.obj" \ + ".\WinDebug\main.obj" \ + ".\WinDebug\filesubr.obj" \ + ".\WinDebug\cmpbuf.obj" \ + ".\WinDebug\myndbm.obj" \ + ".\WinDebug\xgetwd.obj" \ + ".\WinDebug\infblock.obj" \ + ".\WinDebug\inftrees.obj" \ + ".\WinDebug\deflate.obj" \ + ".\WinDebug\1\diff.obj" \ + ".\WinDebug\analyze.obj" \ + ".\WinDebug\gzio.obj" \ + ".\WinDebug\patch.obj" \ + ".\WinDebug\rcs.obj" \ + ".\WinDebug\history.obj" \ + ".\WinDebug\run.obj" \ + ".\WinDebug\mkdir.obj" \ + ".\WinDebug\uncompr.obj" \ + ".\WinDebug\ignore.obj" \ + ".\WinDebug\rtag.obj" \ + ".\WinDebug\root.obj" \ + ".\WinDebug\trees.obj" \ + ".\WinDebug\checkin.obj" \ + ".\WinDebug\valloc.obj" \ + ".\WinDebug\argmatch.obj" \ + ".\WinDebug\lock.obj" \ + ".\WinDebug\modules.obj" \ + ".\WinDebug\classify.obj" \ + ".\WinDebug\dir.obj" \ + ".\WinDebug\startserver.obj" \ + ".\WinDebug\zutil.obj" \ + ".\WinDebug\stripslash.obj" \ + ".\WinDebug\md5.obj" \ + ".\WinDebug\admin.obj" \ + ".\WinDebug\commit.obj" \ + ".\WinDebug\diff3.obj" \ + ".\WinDebug\expand_path.obj" \ + ".\WinDebug\2\diff.obj" \ + ".\WinDebug\update.obj" \ + ".\WinDebug\waitpid.obj" \ + ".\WinDebug\adler32.obj" \ + ".\WinDebug\inflate.obj" \ + ".\WinDebug\tag.obj" \ + ".\WinDebug\buffer.obj" \ + ".\WinDebug\rcmd.obj" \ + ".\WinDebug\pwd.obj" \ + ".\WinDebug\getopt.obj" \ + ".\WinDebug\entries.obj" \ + ".\WinDebug\getopt1.obj" \ + ".\WinDebug\2\version.obj" \ + ".\WinDebug\yesno.obj" \ + ".\WinDebug\compress.obj" \ + ".\WinDebug\io.obj" \ + ".\WinDebug\infcodes.obj" \ + ".\WinDebug\no_diff.obj" \ + ".\WinDebug\scramble.obj" \ + ".\WinDebug\cvsrc.obj" \ + ".\WinDebug\fnmatch.obj" \ + ".\WinDebug\fncase.obj" "$(OUTDIR)\cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< @@ -716,11 +772,33 @@ NODEP_CPP_DIFF_=\ ".\src\popen.h"\ ".\lib\tcpip.h"\ +INTDIR_SRC=.\WinRel\1 +"$(INTDIR_SRC)" : + if not exist "$(INTDIR_SRC)/$(NULL)" mkdir "$(INTDIR_SRC)" -"$(INTDIR)\diff.obj" : $(SOURCE) $(DEP_CPP_DIFF_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) +!IF "$(CFG)" == "cvsnt - Win32 Release" + +# PROP Intermediate_Dir "WinRel\1" + +".\WinRel\1\diff.obj" : $(SOURCE) $(DEP_CPP_DIFF_) "$(INTDIR_SRC)" + $(CPP) /nologo /ML /W3 /GX /Ob1 /I "windows-NT" /I "lib" /I "src" /I "zlib"\ + /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /Fp"WinRel/cvsnt.pch"\ + /YX /Fo"$(INTDIR_SRC)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP Intermediate_Dir "WinDebug\1" + +".\WinDebug\1\diff.obj" : $(SOURCE) $(DEP_CPP_DIFF_) "$(INTDIR_SRC)" + $(CPP) /nologo /MLd /W3 /Gm /GX /Zi /Ob1 /I "windows-NT" /I "lib" /I "src"\ + /I "zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H"\ + /Fp"WinDebug/cvsnt.pch" /YX /Fo"$(INTDIR_SRC)/" /Fd"$(INTDIR_SRC)/" /c\ + $(SOURCE) +!ENDIF + # End Source File ################################################################################ # Begin Source File @@ -1307,10 +1385,32 @@ NODEP_CPP_VERSI=\ ".\src\popen.h"\ ".\lib\tcpip.h"\ +INTDIR_SRC=.\WinRel\1 +"$(INTDIR_SRC)" : + if not exist "$(INTDIR_SRC)/$(NULL)" mkdir "$(INTDIR_SRC)" -"$(INTDIR)\version.obj" : $(SOURCE) $(DEP_CPP_VERSI) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) +!IF "$(CFG)" == "cvsnt - Win32 Release" + +# PROP Intermediate_Dir "WinRel\1" + +".\WinRel\1\version.obj" : $(SOURCE) $(DEP_CPP_VERSI) "$(INTDIR_SRC)" + $(CPP) /nologo /ML /W3 /GX /Ob1 /I "windows-NT" /I "lib" /I "src" /I "zlib"\ + /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /Fp"WinRel/cvsnt.pch"\ + /YX /Fo"$(INTDIR_SRC)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" +# PROP Intermediate_Dir "WinDebug\1" + +".\WinDebug\1\version.obj" : $(SOURCE) $(DEP_CPP_VERSI) "$(INTDIR_SRC)" + $(CPP) /nologo /MLd /W3 /Gm /GX /Zi /Ob1 /I "windows-NT" /I "lib" /I "src"\ + /I "zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H"\ + /Fp"WinDebug/cvsnt.pch" /YX /Fo"$(INTDIR_SRC)/" /Fd"$(INTDIR_SRC)/" /c\ + $(SOURCE) + + +!ENDIF # End Source File ################################################################################ @@ -1545,6 +1645,7 @@ SOURCE=.\src\add.c DEP_CPP_ADD_C=\ ".\src\cvs.h"\ ".\lib\savecwd.h"\ + ".\src\fileattr.h"\ ".\windows-NT\config.h"\ ".\windows-NT\options.h"\ ".\lib\fnmatch.h"\ @@ -1729,6 +1830,7 @@ NODEP_CPP_FIND_=\ SOURCE=.\src\rcs.c DEP_CPP_RCS_C=\ ".\src\cvs.h"\ + ".\src\edit.h"\ ".\windows-NT\config.h"\ ".\windows-NT\options.h"\ ".\lib\fnmatch.h"\ @@ -2441,28 +2543,6 @@ SOURCE=.\src\ChangeLog ################################################################################ # Begin Source File -SOURCE=.\lib\getwd.c -DEP_CPP_GETWD=\ - ".\windows-NT\config.h"\ - ".\lib\system.h"\ - {$(INCLUDE)}"\sys\Types.h"\ - {$(INCLUDE)}"\sys\Stat.h"\ - {$(INCLUDE)}"\sys\Timeb.h"\ - {$(INCLUDE)}"\sys\Utime.h"\ - ".\windows-NT\ndir.h"\ - -NODEP_CPP_GETWD=\ - ".\lib\tcpip.h"\ - - -"$(INTDIR)\getwd.obj" : $(SOURCE) $(DEP_CPP_GETWD) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - SOURCE=.\lib\sighandle.c DEP_CPP_SIGHA=\ ".\windows-NT\config.h"\ @@ -2864,6 +2944,7 @@ SOURCE=".\windows-NT\rcmd.c" DEP_CPP_RCMD_=\ ".\src\cvs.h"\ ".\windows-NT\rcmd.h"\ + {$(INCLUDE)}"\sys\Types.h"\ ".\windows-NT\config.h"\ ".\windows-NT\options.h"\ ".\lib\fnmatch.h"\ @@ -2878,7 +2959,6 @@ DEP_CPP_RCMD_=\ ".\src\rcs.h"\ ".\src\update.h"\ ".\src\server.h"\ - {$(INCLUDE)}"\sys\Types.h"\ {$(INCLUDE)}"\sys\Stat.h"\ {$(INCLUDE)}"\sys\Timeb.h"\ {$(INCLUDE)}"\sys\Utime.h"\ @@ -3181,6 +3261,314 @@ SOURCE=".\windows-NT\sockerror.c" # End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\util.c +DEP_CPP_UTIL_=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\cmpbuf.c +DEP_CPP_CMPBU=\ + ".\diff\system.h"\ + ".\diff\cmpbuf.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\cmpbuf.obj" : $(SOURCE) $(DEP_CPP_CMPBU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\context.c +DEP_CPP_CONTE=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\context.obj" : $(SOURCE) $(DEP_CPP_CONTE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\diff.c +DEP_CPP_DIFF_=\ + ".\diff\diff.h"\ + ".\lib\getopt.h"\ + ".\lib\fnmatch.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + +INTDIR_SRC=.\WinRel\2 +"$(INTDIR_SRC)" : + if not exist "$(INTDIR_SRC)/$(NULL)" mkdir "$(INTDIR_SRC)" + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +# PROP Intermediate_Dir "WinRel\2" + +".\WinRel\2\diff.obj" : $(SOURCE) $(DEP_CPP_DIFF_) "$(INTDIR_SRC)" + $(CPP) /nologo /ML /W3 /GX /Ob1 /I "windows-NT" /I "lib" /I "src" /I "zlib"\ + /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /Fp"WinRel/cvsnt.pch"\ + /YX /Fo"$(INTDIR_SRC)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP Intermediate_Dir "WinDebug\2" + +".\WinDebug\2\diff.obj" : $(SOURCE) $(DEP_CPP_DIFF_) "$(INTDIR_SRC)" + $(CPP) /nologo /MLd /W3 /Gm /GX /Zi /Ob1 /I "windows-NT" /I "lib" /I "src"\ + /I "zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H"\ + /Fp"WinDebug/cvsnt.pch" /YX /Fo"$(INTDIR_SRC)/" /Fd"$(INTDIR_SRC)/" /c\ + $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\diff3.c +DEP_CPP_DIFF3=\ + ".\diff\system.h"\ + ".\lib\getopt.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\diff3.obj" : $(SOURCE) $(DEP_CPP_DIFF3) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\dir.c +DEP_CPP_DIR_C=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\dir.obj" : $(SOURCE) $(DEP_CPP_DIR_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\ed.c +DEP_CPP_ED_Cba=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\ed.obj" : $(SOURCE) $(DEP_CPP_ED_Cba) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\ifdef.c +DEP_CPP_IFDEF=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\ifdef.obj" : $(SOURCE) $(DEP_CPP_IFDEF) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\io.c +DEP_CPP_IO_Cbe=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\io.obj" : $(SOURCE) $(DEP_CPP_IO_Cbe) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\normal.c +DEP_CPP_NORMA=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\normal.obj" : $(SOURCE) $(DEP_CPP_NORMA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\side.c +DEP_CPP_SIDE_=\ + ".\diff\diff.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\side.obj" : $(SOURCE) $(DEP_CPP_SIDE_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\analyze.c +DEP_CPP_ANALY=\ + ".\diff\diff.h"\ + ".\diff\cmpbuf.h"\ + ".\diff\system.h"\ + ".\lib\regex.h"\ + ".\windows-NT\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\windows-NT\ndir.h"\ + + +"$(INTDIR)\analyze.obj" : $(SOURCE) $(DEP_CPP_ANALY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\diff\version.c +DEP_CPP_VERSI=\ + ".\windows-NT\config.h"\ + +INTDIR_SRC=.\WinRel\2 +"$(INTDIR_SRC)" : + if not exist "$(INTDIR_SRC)/$(NULL)" mkdir "$(INTDIR_SRC)" + +!IF "$(CFG)" == "cvsnt - Win32 Release" + +# PROP Intermediate_Dir "WinRel\2" + +".\WinRel\2\version.obj" : $(SOURCE) $(DEP_CPP_VERSI) "$(INTDIR_SRC)" + $(CPP) /nologo /ML /W3 /GX /Ob1 /I "windows-NT" /I "lib" /I "src" /I "zlib"\ + /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H" /Fp"WinRel/cvsnt.pch"\ + /YX /Fo"$(INTDIR_SRC)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "cvsnt - Win32 Debug" + +# PROP Intermediate_Dir "WinDebug\2" + +".\WinDebug\2\version.obj" : $(SOURCE) $(DEP_CPP_VERSI) "$(INTDIR_SRC)" + $(CPP) /nologo /MLd /W3 /Gm /GX /Zi /Ob1 /I "windows-NT" /I "lib" /I "src"\ + /I "zlib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HAVE_CONFIG_H"\ + /Fp"WinDebug/cvsnt.pch" /YX /Fo"$(INTDIR_SRC)/" /Fd"$(INTDIR_SRC)/" /c\ + $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\lib\fncase.c +DEP_CPP_FNCAS=\ + ".\windows-NT\config.h"\ + ".\lib\system.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Timeb.h"\ + {$(INCLUDE)}"\sys\Utime.h"\ + ".\windows-NT\ndir.h"\ + +NODEP_CPP_FNCAS=\ + ".\lib\tcpip.h"\ + + +"$(INTDIR)\fncase.obj" : $(SOURCE) $(DEP_CPP_FNCAS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File # End Target # End Project ################################################################################ diff --git a/gnu/usr.bin/cvs/diff/ChangeLog b/gnu/usr.bin/cvs/diff/ChangeLog new file mode 100644 index 00000000000..34aa7077b8c --- /dev/null +++ b/gnu/usr.bin/cvs/diff/ChangeLog @@ -0,0 +1,202 @@ +Fri Jan 16 14:58:19 1998 Larry Jones <larry.jones@sdrc.com> + + * diff.c, diff3.c: Plug memory leaks. + +Thu Jan 15 13:36:46 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (installdirs): New rule, for when ../Makefile + recurses into this directory (bug reported by W. L. Estes). + +Tue Nov 11 10:48:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * diff.c (diff_run): Change #ifdef on HAVE_SETMODE to #if to match + the other uses (fixes compilation error on unix). + + * diff.c (diff_run): Don't set stdout to binary mode. + +Mon, 10 Nov 1997 Jim Kingdon + + * diff.c (run_diff): Open outfile in binary mode if --binary. + +Thu Nov 6 12:42:12 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Paul Eggert <eggert@twinsun.com> + + * analyze.c: applied Paul Eggert's patch to fix the diff3 merge + bug described in ccvs/doc/DIFFUTILS-2.7-BUG: + (shift_boundaries): new var `inhibit_hunk_merge'; use it to + control something important that I don't quite understand, but + Paul apparently does, so that's okay. + +Sat Nov 1 14:17:57 1997 Michael L.H. Brouwer <michael@thi.nl> + + * Makefile.in: Add call to ranlib to build a table of contents for + the library since some systems seem to require this. + +1997-10-28 Jim Kingdon + + * .cvsignore: Add files du jour for Visual C++, vc50.pdb and vc50.idb. + + * system.h: Define HAVE_TIME_H. + * dir.c [_WIN32]: Define CLOSEDIR_VOID. + +1997-10-18 Jim Kingdon + + * build_diff.com: Add diff3.c + +Fri Sep 26 14:24:42 1997 Tim Pierce <twp@twp.tezcat.com> + + * diff.c (diff_run): Save old value of optind before calling + getopt_long, then restore before returning. Eventually it would + be nice if diff_run were fully reentrant. + + New diff3 library for CVS. + * Makefile.in (SOURCES): Add diff3.c. + (OBJECTS): Add diff3.o. + * diff3.c: New file, copied from diffutils-2.7. See diffutils for + earlier ChangeLogs. Undefine initialize_main macro. Remove <signal.h>. + (diff3_run): Renamed from main(). Add `outfile' argument. Remove + SIGCLD handling; we do not fork. Save optind and reset to 0 + before calling getopt_long; restore after option processing done. + (read_diff): Use diff_run with a temporary output file, + instead of forking a diff subprocess and reading from a pipe. + Change DIFF_PROGRAM to "diff"; this argument is now used only for + diagnostic reporting. + (xmalloc, xrealloc): Removed. + (diff_program): Removed. + (diff_program_name): Made extern, so it may be used in other + library calls like `error'. + (initialize_main): New function. + + Namespace munging. util.c defines both fatal() and + perror_with_exit(), but these cannot be used to abort diff3: both + attempt to longjmp() to a buffer set in diff.c, used only by + diff_run. This is an awful solution, but necessary until the code + can be cleaned up. (These functions do not *have* to be renamed, + since both are declared static to diff3.c and should not clash + with libdiff.a, but it reduces potential confusion.) + * diff3.c (diff3_fatal): Renamed from fatal. + (diff3_perror_with_exit): Renamed from perror_with_exit. + + Eliminate exit calls. + (try_help): Change from `void' to `int'. Return, do not exit. + (diff3_fatal, diff3_perror_with_exit, process_diff): Change `exit' + to DIFF3_ABORT. + (diff3_run): Initialize jump buffer for nonlocal exits. Change + exit calls to returns. Change `perror_with_exit' to + `perror_with_name' and add a return. Change `fatal' to + `diff_error' and add a return. The reasoning is that we shouldn't + rely on setjmp/longjmp any more than necessary. + + Redirect stdout. + (check_output): Renamed from check_stdout. Take stream argument + instead of blindly checking stdout. Do not close stream, but + merely fflush it. + (diff3_run): Initialize outstream, and close when done. Pass this + stream (instead of stdout) to output_diff3_edscript, + output_diff3_merge, and output_diff3. + +Thu Sep 25 14:34:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * util.c (begin_output, finish_output): If PR_PROGRAM is not + defined (VMS), just give a fatal error if --paginate specified. + + * Makefile.in (DISTFILES): Add ChangeLog build_diff.com + Makefile.in. + * build_diff.com: New file. + +Wed Sep 24 10:27:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in: Also set top_srcdir. Needed to make today's other + Makefile.in change work. + + * .cvsignore: New file. + + * Makefile.in (COMPILE): Add -I options for srcdir (perhaps + unneeded) and change -I option for lib to use top_srcdir (needed + to avoid mixups with CVS's regex.h vs. the system one). + +Sun Sep 21 19:44:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (util.o): Change util.c to $<, needed for srcdir. + +Sat Sep 20 12:06:41 1997 Tim Pierce <twp@twp.tezcat.com> + + New diff library for CVS, based on diffutils-2.7. See diffutils + for earlier ChangeLogs. + * Makefile.in, analyze.c, cmpbuf.c, cmpbuf.h, config.hin, + context.c, diagmeet.note, diff.c, diff.h, dir.c, ed.c, ifdef.c, + io.c, normal.c, side.c, stamp-h.in, system.h, util.c, version.c: + New files. + (COMPILE): Add -I../lib, so we can get getopt.h. + + * Makefile.in: Removed anything not related to libdiff.a. + (dist-dir): New target, copied from ../lib/Makefile.in. + (DISTFILES): New variable. + (SOURCES): Renamed from `srcs'. + (OBJECTS): Renamed from `libdiff_o'. + (Makefile): Changed dependencies to reflect + new, shallow config directory structure. + (stamp-h.in, config.h.in, config.h, stamp-h): Removed. + * stamp-h.in, config.h.in: Removed. + + * system.h: Remove dup2 macro (provided by ../lib/dup2.c). + Include stdlib.h if STDC_HEADERS is defined (not just + HAVE_STDLIB_H). + +Sat Sep 20 05:32:18 1997 Tim Pierce <twp@twp.tezcat.com> + + Diff librarification. + + * diff.c (diff_run): New function, renamed from `main'. + Initialize `outfile' based on the value of the new `out' filename + argument. + (initialize_main): New function. + * system.h: Removed initialize_main macro. + * diffmain.c: New file. + * Makefile.in (diff): Added diffmain.o. + (libdiff): New target. + (AR, libdiff_o): New variables. libdiff_o does not include + xmalloc.o, fnmatch.o, getopt.o, getopt1.o, regex.o or error.o, + because these functions are already present in CVS. It will take + some work to make this more general-purpose. + + Redirect standard output. + * util.c: Redirect stdout to outfile: change all naked `printf' + and `putchar' statements to `fprintf (outfile)' and `putc (..., + outfile)' throughout. This should permit redirecting diff output + by changing `outfile' just once in `diff_run'. + (output_in_progress): New variable. + (begin_output, finish_output): Use `output_in_progress', rather than + `outfile', as a semaphore to avoid reentrancy problems. + (finish_output): Close `outfile' only if paginate_flag is set. + * diff.c (check_output): New function, was check_stdout. Take a + `file' argument, and flush it instead of closing it. + (diff_run): Change check_stdout to check_output. + (compare_files): Fflush outfile, not stdout. + + Eliminate exit statements. + * diff.h: Include setjmp.h. + (diff_abort_buf): New variable. + (DIFF_ABORT): New macro. + * diff.c (diff_run): Change all `exit' statements to `return'. + Set up diff_abort_buf, so we can abort diff without + terminating (for libdiff.a). + (try_help): Return int instead of void; do not exit. + * util.c (fatal): Use DIFF_ABORT instead of exit. + (pfatal_with_name): Use DIFF_ABORT instead of exit. + + Namespace cleanup (rudimentary). Strictly speaking, this is not + necessary to make diff into a library. However, namespace + clashes between diff and CVS must be resolved immediately, since + CVS is the first application targeted for use with difflib. + + * analyze.c, diff.c, diff.h, util.c (diff_error): Renamed from `error'. + + * version.c, diff.c, diff.h, cmp.c, diff3.c, sdiff.c + (diff_version_string): Renamed from version_string. + * diff.c, util.c, diff.h, diff3.c, error.c (diff_program_name): + Renamed from program_name. + + * util.c (xmalloc, xrealloc): Removed. + * Makefile.in (diff_o): Added error.o and xmalloc.o. + diff --git a/gnu/usr.bin/cvs/diff/Makefile.in b/gnu/usr.bin/cvs/diff/Makefile.in new file mode 100644 index 00000000000..333d4d9251d --- /dev/null +++ b/gnu/usr.bin/cvs/diff/Makefile.in @@ -0,0 +1,104 @@ +# Makefile for GNU DIFF +# Copyright (C) 1988,1989,1991,1992,1993,1994,1997 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. +# +# You should have received a copy of the GNU General Public License +# along with GNU DIFF; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +subdir = diff + +CC = @CC@ +AR = ar + +CPPFLAGS = @CPPFLAGS@ +DEFS = @DEFS@ +RANLIB = @RANLIB@ +CFLAGS = @CFLAGS@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +PR_PROGRAM = /bin/pr + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# 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 +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 + +all: libdiff.a + +# $(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) + +.c.o: + $(COMPILE) $< + +libdiff libdiff.a: $(OBJECTS) + $(AR) cr libdiff.a $(OBJECTS) + -$(RANLIB) libdiff.a + +$(OBJECTS): diff.h system.h +analyze.o cmpbuf.o: cmpbuf.h + +util.o: util.c + $(COMPILE) -DPR_PROGRAM=\"$(PR_PROGRAM)\" $< + +install: all + +installdirs: + @: nothing to do for installdirs +.PHONY: installdirs + +TAGS: $(SOURCES) + etags $(SOURCES) + +clean: + rm -f *.o *.a core + +mostlyclean: clean + +distclean: clean + rm -f TAGS tags Makefile + +realclean: distclean + +Makefile: Makefile.in ../config.status + cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status + +dist-dir: + mkdir ${DISTDIR} + for i in ${DISTFILES}; do \ + ln $(srcdir)/$${i} ${DISTDIR}; \ + done + +# Prevent GNU make v3 from overflowing arg limit on SysV. +.NOEXPORT: diff --git a/gnu/usr.bin/cvs/diff/analyze.c b/gnu/usr.bin/cvs/diff/analyze.c new file mode 100644 index 00000000000..0bda3cf7723 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/analyze.c @@ -0,0 +1,1087 @@ +/* Analyze file differences for GNU DIFF. + Copyright (C) 1988, 1989, 1992, 1993, 1997 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* The basic algorithm is described in: + "An O(ND) Difference Algorithm and its Variations", Eugene Myers, + Algorithmica Vol. 1 No. 2, 1986, pp. 251-266; + see especially section 4.2, which describes the variation used below. + Unless the --minimal option is specified, this code uses the TOO_EXPENSIVE + heuristic, by Paul Eggert, to limit the cost to O(N**1.5 log N) + at the price of producing suboptimal output for large inputs with + many differences. + + The basic algorithm was independently discovered as described in: + "Algorithms for Approximate String Matching", E. Ukkonen, + Information and Control Vol. 64, 1985, pp. 100-118. */ + +#include "diff.h" +#include "cmpbuf.h" + +extern int no_discards; + +static int *xvec, *yvec; /* Vectors being compared. */ +static int *fdiag; /* Vector, indexed by diagonal, containing + 1 + the X coordinate of the point furthest + along the given diagonal in the forward + search of the edit matrix. */ +static int *bdiag; /* Vector, indexed by diagonal, containing + the X coordinate of the point furthest + along the given diagonal in the backward + search of the edit matrix. */ +static int too_expensive; /* Edit scripts longer than this are too + expensive to compute. */ + +#define SNAKE_LIMIT 20 /* Snakes bigger than this are considered `big'. */ + +struct partition +{ + int xmid, ymid; /* Midpoints of this partition. */ + int lo_minimal; /* Nonzero if low half will be analyzed minimally. */ + int hi_minimal; /* Likewise for high half. */ +}; + +static int diag PARAMS((int, int, int, int, int, struct partition *)); +static struct change *add_change PARAMS((int, int, int, int, struct change *)); +static struct change *build_reverse_script PARAMS((struct file_data const[])); +static struct change *build_script PARAMS((struct file_data const[])); +static void briefly_report PARAMS((int, struct file_data const[])); +static void compareseq PARAMS((int, int, int, int, int)); +static void discard_confusing_lines PARAMS((struct file_data[])); +static void shift_boundaries PARAMS((struct file_data[])); + +/* Find the midpoint of the shortest edit script for a specified + portion of the two files. + + Scan from the beginnings of the files, and simultaneously from the ends, + doing a breadth-first search through the space of edit-sequence. + When the two searches meet, we have found the midpoint of the shortest + edit sequence. + + If MINIMAL is nonzero, find the minimal edit script regardless + of expense. Otherwise, if the search is too expensive, use + heuristics to stop the search and report a suboptimal answer. + + Set PART->(XMID,YMID) to the midpoint (XMID,YMID). The diagonal number + XMID - YMID equals the number of inserted lines minus the number + of deleted lines (counting only lines before the midpoint). + Return the approximate edit cost; this is the total number of + lines inserted or deleted (counting only lines before the midpoint), + unless a heuristic is used to terminate the search prematurely. + + Set PART->LEFT_MINIMAL to nonzero iff the minimal edit script for the + left half of the partition is known; similarly for PART->RIGHT_MINIMAL. + + This function assumes that the first lines of the specified portions + of the two files do not match, and likewise that the last lines do not + match. The caller must trim matching lines from the beginning and end + of the portions it is going to specify. + + If we return the "wrong" partitions, + the worst this can do is cause suboptimal diff output. + It cannot cause incorrect diff output. */ + +static int +diag (xoff, xlim, yoff, ylim, minimal, part) + int xoff, xlim, yoff, ylim, minimal; + struct partition *part; +{ + int *const fd = fdiag; /* Give the compiler a chance. */ + int *const bd = bdiag; /* Additional help for the compiler. */ + int const *const xv = xvec; /* Still more help for the compiler. */ + int const *const yv = yvec; /* And more and more . . . */ + int const dmin = xoff - ylim; /* Minimum valid diagonal. */ + int const dmax = xlim - yoff; /* Maximum valid diagonal. */ + int const fmid = xoff - yoff; /* Center diagonal of top-down search. */ + int const bmid = xlim - ylim; /* Center diagonal of bottom-up search. */ + int fmin = fmid, fmax = fmid; /* Limits of top-down search. */ + int bmin = bmid, bmax = bmid; /* Limits of bottom-up search. */ + int c; /* Cost. */ + int odd = (fmid - bmid) & 1; /* True if southeast corner is on an odd + diagonal with respect to the northwest. */ + + fd[fmid] = xoff; + bd[bmid] = xlim; + + for (c = 1;; ++c) + { + int d; /* Active diagonal. */ + int big_snake = 0; + + /* Extend the top-down search by an edit step in each diagonal. */ + fmin > dmin ? fd[--fmin - 1] = -1 : ++fmin; + fmax < dmax ? fd[++fmax + 1] = -1 : --fmax; + for (d = fmax; d >= fmin; d -= 2) + { + int x, y, oldx, tlo = fd[d - 1], thi = fd[d + 1]; + + if (tlo >= thi) + x = tlo + 1; + else + x = thi; + oldx = x; + y = x - d; + while (x < xlim && y < ylim && xv[x] == yv[y]) + ++x, ++y; + if (x - oldx > SNAKE_LIMIT) + big_snake = 1; + fd[d] = x; + if (odd && bmin <= d && d <= bmax && bd[d] <= x) + { + part->xmid = x; + part->ymid = y; + part->lo_minimal = part->hi_minimal = 1; + return 2 * c - 1; + } + } + + /* Similarly extend the bottom-up search. */ + bmin > dmin ? bd[--bmin - 1] = INT_MAX : ++bmin; + bmax < dmax ? bd[++bmax + 1] = INT_MAX : --bmax; + for (d = bmax; d >= bmin; d -= 2) + { + int x, y, oldx, tlo = bd[d - 1], thi = bd[d + 1]; + + if (tlo < thi) + x = tlo; + else + x = thi - 1; + oldx = x; + y = x - d; + while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) + --x, --y; + if (oldx - x > SNAKE_LIMIT) + big_snake = 1; + bd[d] = x; + if (!odd && fmin <= d && d <= fmax && x <= fd[d]) + { + part->xmid = x; + part->ymid = y; + part->lo_minimal = part->hi_minimal = 1; + return 2 * c; + } + } + + if (minimal) + continue; + + /* Heuristic: check occasionally for a diagonal that has made + lots of progress compared with the edit distance. + If we have any such, find the one that has made the most + progress and return it as if it had succeeded. + + With this heuristic, for files with a constant small density + of changes, the algorithm is linear in the file size. */ + + if (c > 200 && big_snake && heuristic) + { + int best; + + best = 0; + for (d = fmax; d >= fmin; d -= 2) + { + int dd = d - fmid; + int x = fd[d]; + int y = x - d; + int v = (x - xoff) * 2 - dd; + if (v > 12 * (c + (dd < 0 ? -dd : dd))) + { + if (v > best + && xoff + SNAKE_LIMIT <= x && x < xlim + && yoff + SNAKE_LIMIT <= y && y < ylim) + { + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + int k; + + for (k = 1; xv[x - k] == yv[y - k]; k++) + if (k == SNAKE_LIMIT) + { + best = v; + part->xmid = x; + part->ymid = y; + break; + } + } + } + } + if (best > 0) + { + part->lo_minimal = 1; + part->hi_minimal = 0; + return 2 * c - 1; + } + + best = 0; + for (d = bmax; d >= bmin; d -= 2) + { + int dd = d - bmid; + int x = bd[d]; + int y = x - d; + int v = (xlim - x) * 2 + dd; + if (v > 12 * (c + (dd < 0 ? -dd : dd))) + { + if (v > best + && xoff < x && x <= xlim - SNAKE_LIMIT + && yoff < y && y <= ylim - SNAKE_LIMIT) + { + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + int k; + + for (k = 0; xv[x + k] == yv[y + k]; k++) + if (k == SNAKE_LIMIT - 1) + { + best = v; + part->xmid = x; + part->ymid = y; + break; + } + } + } + } + if (best > 0) + { + part->lo_minimal = 0; + part->hi_minimal = 1; + return 2 * c - 1; + } + } + + /* Heuristic: if we've gone well beyond the call of duty, + give up and report halfway between our best results so far. */ + if (c >= too_expensive) + { + int fxybest, fxbest; + int bxybest, bxbest; + + fxbest = bxbest = 0; /* Pacify `gcc -Wall'. */ + + /* Find forward diagonal that maximizes X + Y. */ + fxybest = -1; + for (d = fmax; d >= fmin; d -= 2) + { + int x = min (fd[d], xlim); + int y = x - d; + if (ylim < y) + x = ylim + d, y = ylim; + if (fxybest < x + y) + { + fxybest = x + y; + fxbest = x; + } + } + + /* Find backward diagonal that minimizes X + Y. */ + bxybest = INT_MAX; + for (d = bmax; d >= bmin; d -= 2) + { + int x = max (xoff, bd[d]); + int y = x - d; + if (y < yoff) + x = yoff + d, y = yoff; + if (x + y < bxybest) + { + bxybest = x + y; + bxbest = x; + } + } + + /* Use the better of the two diagonals. */ + if ((xlim + ylim) - bxybest < fxybest - (xoff + yoff)) + { + part->xmid = fxbest; + part->ymid = fxybest - fxbest; + part->lo_minimal = 1; + part->hi_minimal = 0; + } + else + { + part->xmid = bxbest; + part->ymid = bxybest - bxbest; + part->lo_minimal = 0; + part->hi_minimal = 1; + } + return 2 * c - 1; + } + } +} + +/* Compare in detail contiguous subsequences of the two files + which are known, as a whole, to match each other. + + The results are recorded in the vectors files[N].changed_flag, by + storing a 1 in the element for each line that is an insertion or deletion. + + The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. + + Note that XLIM, YLIM are exclusive bounds. + All line numbers are origin-0 and discarded lines are not counted. + + If MINIMAL is nonzero, find a minimal difference no matter how + expensive it is. */ + +static void +compareseq (xoff, xlim, yoff, ylim, minimal) + int xoff, xlim, yoff, ylim, minimal; +{ + int * const xv = xvec; /* Help the compiler. */ + int * const yv = yvec; + + /* Slide down the bottom initial diagonal. */ + while (xoff < xlim && yoff < ylim && xv[xoff] == yv[yoff]) + ++xoff, ++yoff; + /* Slide up the top initial diagonal. */ + while (xlim > xoff && ylim > yoff && xv[xlim - 1] == yv[ylim - 1]) + --xlim, --ylim; + + /* Handle simple cases. */ + if (xoff == xlim) + while (yoff < ylim) + files[1].changed_flag[files[1].realindexes[yoff++]] = 1; + else if (yoff == ylim) + while (xoff < xlim) + files[0].changed_flag[files[0].realindexes[xoff++]] = 1; + else + { + int c; + struct partition part; + + /* Find a point of correspondence in the middle of the files. */ + + c = diag (xoff, xlim, yoff, ylim, minimal, &part); + + if (c == 1) + { + /* This should be impossible, because it implies that + one of the two subsequences is empty, + and that case was handled above without calling `diag'. + Let's verify that this is true. */ + abort (); +#if 0 + /* The two subsequences differ by a single insert or delete; + record it and we are done. */ + if (part.xmid - part.ymid < xoff - yoff) + files[1].changed_flag[files[1].realindexes[part.ymid - 1]] = 1; + else + files[0].changed_flag[files[0].realindexes[part.xmid]] = 1; +#endif + } + else + { + /* Use the partitions to split this problem into subproblems. */ + compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal); + compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal); + } + } +} + +/* Discard lines from one file that have no matches in the other file. + + A line which is discarded will not be considered by the actual + comparison algorithm; it will be as if that line were not in the file. + The file's `realindexes' table maps virtual line numbers + (which don't count the discarded lines) into real line numbers; + this is how the actual comparison algorithm produces results + that are comprehensible when the discarded lines are counted. + + When we discard a line, we also mark it as a deletion or insertion + so that it will be printed in the output. */ + +static void +discard_confusing_lines (filevec) + struct file_data filevec[]; +{ + unsigned int f, i; + char *discarded[2]; + int *equiv_count[2]; + int *p; + + /* Allocate our results. */ + p = (int *) xmalloc ((filevec[0].buffered_lines + filevec[1].buffered_lines) + * (2 * sizeof (int))); + for (f = 0; f < 2; f++) + { + filevec[f].undiscarded = p; p += filevec[f].buffered_lines; + filevec[f].realindexes = p; p += filevec[f].buffered_lines; + } + + /* Set up equiv_count[F][I] as the number of lines in file F + that fall in equivalence class I. */ + + p = (int *) xmalloc (filevec[0].equiv_max * (2 * sizeof (int))); + equiv_count[0] = p; + equiv_count[1] = p + filevec[0].equiv_max; + bzero (p, filevec[0].equiv_max * (2 * sizeof (int))); + + for (i = 0; i < filevec[0].buffered_lines; ++i) + ++equiv_count[0][filevec[0].equivs[i]]; + for (i = 0; i < filevec[1].buffered_lines; ++i) + ++equiv_count[1][filevec[1].equivs[i]]; + + /* Set up tables of which lines are going to be discarded. */ + + discarded[0] = xmalloc (sizeof (char) + * (filevec[0].buffered_lines + + filevec[1].buffered_lines)); + discarded[1] = discarded[0] + filevec[0].buffered_lines; + bzero (discarded[0], sizeof (char) * (filevec[0].buffered_lines + + filevec[1].buffered_lines)); + + /* Mark to be discarded each line that matches no line of the other file. + If a line matches many lines, mark it as provisionally discardable. */ + + for (f = 0; f < 2; f++) + { + unsigned int end = filevec[f].buffered_lines; + char *discards = discarded[f]; + int *counts = equiv_count[1 - f]; + int *equivs = filevec[f].equivs; + unsigned int many = 5; + unsigned int tem = end / 64; + + /* Multiply MANY by approximate square root of number of lines. + That is the threshold for provisionally discardable lines. */ + while ((tem = tem >> 2) > 0) + many *= 2; + + for (i = 0; i < end; i++) + { + int nmatch; + if (equivs[i] == 0) + continue; + nmatch = counts[equivs[i]]; + if (nmatch == 0) + discards[i] = 1; + else if (nmatch > many) + discards[i] = 2; + } + } + + /* Don't really discard the provisional lines except when they occur + in a run of discardables, with nonprovisionals at the beginning + and end. */ + + for (f = 0; f < 2; f++) + { + unsigned int end = filevec[f].buffered_lines; + register char *discards = discarded[f]; + + for (i = 0; i < end; i++) + { + /* Cancel provisional discards not in middle of run of discards. */ + if (discards[i] == 2) + discards[i] = 0; + else if (discards[i] != 0) + { + /* We have found a nonprovisional discard. */ + register int j; + unsigned int length; + unsigned int provisional = 0; + + /* Find end of this run of discardable lines. + Count how many are provisionally discardable. */ + for (j = i; j < end; j++) + { + if (discards[j] == 0) + break; + if (discards[j] == 2) + ++provisional; + } + + /* Cancel provisional discards at end, and shrink the run. */ + while (j > i && discards[j - 1] == 2) + discards[--j] = 0, --provisional; + + /* Now we have the length of a run of discardable lines + whose first and last are not provisional. */ + length = j - i; + + /* If 1/4 of the lines in the run are provisional, + cancel discarding of all provisional lines in the run. */ + if (provisional * 4 > length) + { + while (j > i) + if (discards[--j] == 2) + discards[j] = 0; + } + else + { + register unsigned int consec; + unsigned int minimum = 1; + unsigned int tem = length / 4; + + /* MINIMUM is approximate square root of LENGTH/4. + A subrun of two or more provisionals can stand + when LENGTH is at least 16. + A subrun of 4 or more can stand when LENGTH >= 64. */ + while ((tem = tem >> 2) > 0) + minimum *= 2; + minimum++; + + /* Cancel any subrun of MINIMUM or more provisionals + within the larger run. */ + for (j = 0, consec = 0; j < length; j++) + if (discards[i + j] != 2) + consec = 0; + else if (minimum == ++consec) + /* Back up to start of subrun, to cancel it all. */ + j -= consec; + else if (minimum < consec) + discards[i + j] = 0; + + /* Scan from beginning of run + until we find 3 or more nonprovisionals in a row + or until the first nonprovisional at least 8 lines in. + Until that point, cancel any provisionals. */ + for (j = 0, consec = 0; j < length; j++) + { + if (j >= 8 && discards[i + j] == 1) + break; + if (discards[i + j] == 2) + consec = 0, discards[i + j] = 0; + else if (discards[i + j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + + /* I advances to the last line of the run. */ + i += length - 1; + + /* Same thing, from end. */ + for (j = 0, consec = 0; j < length; j++) + { + if (j >= 8 && discards[i - j] == 1) + break; + if (discards[i - j] == 2) + consec = 0, discards[i - j] = 0; + else if (discards[i - j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + } + } + } + } + + /* Actually discard the lines. */ + for (f = 0; f < 2; f++) + { + char *discards = discarded[f]; + unsigned int end = filevec[f].buffered_lines; + unsigned int j = 0; + for (i = 0; i < end; ++i) + if (no_discards || discards[i] == 0) + { + filevec[f].undiscarded[j] = filevec[f].equivs[i]; + filevec[f].realindexes[j++] = i; + } + else + filevec[f].changed_flag[i] = 1; + filevec[f].nondiscarded_lines = j; + } + + free (discarded[0]); + free (equiv_count[0]); +} + +/* Adjust inserts/deletes of identical lines to join changes + as much as possible. + + We do something when a run of changed lines include a + line at one end and have an excluded, identical line at the other. + We are free to choose which identical line is included. + `compareseq' usually chooses the one at the beginning, + but usually it is cleaner to consider the following identical line + to be the "change". */ + +int inhibit; + +static void +shift_boundaries (filevec) + struct file_data filevec[]; +{ + int f; + int inhibit_hunk_merge = horizon_lines != context; + + for (f = 0; f < 2; f++) + { + char *changed = filevec[f].changed_flag; + char const *other_changed = filevec[1-f].changed_flag; + int const *equivs = filevec[f].equivs; + int i = 0; + int j = 0; + int i_end = filevec[f].buffered_lines; + + while (1) + { + int runlength, start, corresponding; + + /* Scan forwards to find beginning of another run of changes. + Also keep track of the corresponding point in the other file. */ + + while (i < i_end && changed[i] == 0) + { + while (other_changed[j++]) + continue; + i++; + } + + if (i == i_end) + break; + + start = i; + + /* Find the end of this run of changes. */ + + while (changed[++i]) + continue; + while (other_changed[j]) + j++; + + do + { + /* Record the length of this run of changes, so that + 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. */ + + 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 + point where it corresponds to a changed run in the other file. + 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. + 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])) + { + changed[start++] = 0; + changed[i++] = 1; + while (changed[i]) + i++; + while (other_changed[++j]) + corresponding = i; + } + } + while (runlength != i - start); + + /* If possible, move the fully-merged run of changes + back to a corresponding run in the other file. */ + + while (corresponding < i) + { + changed[--start] = 1; + changed[--i] = 0; + while (other_changed[--j]) + continue; + } + } + } +} + +/* Cons an additional entry onto the front of an edit script OLD. + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + +static struct change * +add_change (line0, line1, deleted, inserted, old) + int line0, line1, deleted, inserted; + struct change *old; +{ + struct change *new = (struct change *) xmalloc (sizeof (struct change)); + + new->line0 = line0; + new->line1 = line1; + new->inserted = inserted; + new->deleted = deleted; + new->link = old; + return new; +} + +/* Scan the tables of which lines are inserted and deleted, + producing an edit script in reverse order. */ + +static struct change * +build_reverse_script (filevec) + struct file_data const filevec[]; +{ + struct change *script = 0; + char *changed0 = filevec[0].changed_flag; + char *changed1 = filevec[1].changed_flag; + int len0 = filevec[0].buffered_lines; + int len1 = filevec[1].buffered_lines; + + /* Note that changedN[len0] does exist, and contains 0. */ + + int i0 = 0, i1 = 0; + + while (i0 < len0 || i1 < len1) + { + if (changed0[i0] || changed1[i1]) + { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[i0]) ++i0; + while (changed1[i1]) ++i1; + + /* Record this change. */ + script = add_change (line0, line1, i0 - line0, i1 - line1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0++, i1++; + } + + return script; +} + +/* Scan the tables of which lines are inserted and deleted, + producing an edit script in forward order. */ + +static struct change * +build_script (filevec) + struct file_data const filevec[]; +{ + struct change *script = 0; + char *changed0 = filevec[0].changed_flag; + char *changed1 = filevec[1].changed_flag; + int i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines; + + /* Note that changedN[-1] does exist, and contains 0. */ + + while (i0 >= 0 || i1 >= 0) + { + if (changed0[i0 - 1] || changed1[i1 - 1]) + { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[i0 - 1]) --i0; + while (changed1[i1 - 1]) --i1; + + /* Record this change. */ + script = add_change (i0, i1, line0 - i0, line1 - i1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0--, i1--; + } + + return script; +} + +/* If CHANGES, briefly report that two files differed. */ +static void +briefly_report (changes, filevec) + int changes; + struct file_data const filevec[]; +{ + if (changes) + message (no_details_flag ? "Files %s and %s differ\n" + : "Binary files %s and %s differ\n", + filevec[0].name, filevec[1].name); +} + +/* Report the differences of two files. DEPTH is the current directory + depth. */ +int +diff_2_files (filevec, depth) + struct file_data filevec[]; + int depth; +{ + int diags; + int i; + struct change *e, *p; + struct change *script; + int changes; + + + /* If we have detected that either file is binary, + compare the two files as binary. This can happen + only when the first chunk is read. + Also, --brief without any --ignore-* options means + we can speed things up by treating the files as binary. */ + + if (read_files (filevec, no_details_flag & ~ignore_some_changes)) + { + /* Files with different lengths must be different. */ + if (filevec[0].stat.st_size != filevec[1].stat.st_size + && (filevec[0].desc < 0 || S_ISREG (filevec[0].stat.st_mode)) + && (filevec[1].desc < 0 || S_ISREG (filevec[1].stat.st_mode))) + changes = 1; + + /* Standard input equals itself. */ + else if (filevec[0].desc == filevec[1].desc) + changes = 0; + + else + /* Scan both files, a buffer at a time, looking for a difference. */ + { + /* Allocate same-sized buffers for both files. */ + size_t buffer_size = buffer_lcm (STAT_BLOCKSIZE (filevec[0].stat), + STAT_BLOCKSIZE (filevec[1].stat)); + for (i = 0; i < 2; i++) + filevec[i].buffer = xrealloc (filevec[i].buffer, buffer_size); + + for (;; filevec[0].buffered_chars = filevec[1].buffered_chars = 0) + { + /* Read a buffer's worth from both files. */ + for (i = 0; i < 2; i++) + if (0 <= filevec[i].desc) + while (filevec[i].buffered_chars != buffer_size) + { + int r = read (filevec[i].desc, + filevec[i].buffer + + filevec[i].buffered_chars, + buffer_size - filevec[i].buffered_chars); + if (r == 0) + break; + if (r < 0) + pfatal_with_name (filevec[i].name); + filevec[i].buffered_chars += r; + } + + /* If the buffers differ, the files differ. */ + if (filevec[0].buffered_chars != filevec[1].buffered_chars + || (filevec[0].buffered_chars != 0 + && memcmp (filevec[0].buffer, + filevec[1].buffer, + filevec[0].buffered_chars) != 0)) + { + changes = 1; + break; + } + + /* If we reach end of file, the files are the same. */ + if (filevec[0].buffered_chars != buffer_size) + { + changes = 0; + break; + } + } + } + + briefly_report (changes, filevec); + } + else + { + /* Allocate vectors for the results of comparison: + a flag for each line of each file, saying whether that line + is an insertion or deletion. + Allocate an extra element, always zero, at each end of each vector. */ + + size_t s = filevec[0].buffered_lines + filevec[1].buffered_lines + 4; + filevec[0].changed_flag = xmalloc (s); + bzero (filevec[0].changed_flag, s); + filevec[0].changed_flag++; + filevec[1].changed_flag = filevec[0].changed_flag + + filevec[0].buffered_lines + 2; + + /* Some lines are obviously insertions or deletions + because they don't match anything. Detect them now, and + avoid even thinking about them in the main comparison algorithm. */ + + discard_confusing_lines (filevec); + + /* Now do the main comparison algorithm, considering just the + undiscarded lines. */ + + xvec = filevec[0].undiscarded; + yvec = filevec[1].undiscarded; + diags = filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3; + fdiag = (int *) xmalloc (diags * (2 * sizeof (int))); + bdiag = fdiag + diags; + fdiag += filevec[1].nondiscarded_lines + 1; + bdiag += filevec[1].nondiscarded_lines + 1; + + /* Set TOO_EXPENSIVE to be approximate square root of input size, + bounded below by 256. */ + too_expensive = 1; + for (i = filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines; + i != 0; i >>= 2) + too_expensive <<= 1; + too_expensive = max (256, too_expensive); + + files[0] = filevec[0]; + files[1] = filevec[1]; + + compareseq (0, filevec[0].nondiscarded_lines, + 0, filevec[1].nondiscarded_lines, no_discards); + + free (fdiag - (filevec[1].nondiscarded_lines + 1)); + + /* Modify the results slightly to make them prettier + in cases where that can validly be done. */ + + shift_boundaries (filevec); + + /* Get the results of comparison in the form of a chain + of `struct change's -- an edit script. */ + + if (output_style == OUTPUT_ED) + script = build_reverse_script (filevec); + else + script = build_script (filevec); + + /* Set CHANGES if we had any diffs. + If some changes are ignored, we must scan the script to decide. */ + if (ignore_blank_lines_flag || ignore_regexp_list) + { + struct change *next = script; + changes = 0; + + while (next && changes == 0) + { + struct change *this, *end; + int first0, last0, first1, last1, deletes, inserts; + + /* Find a set of changes that belong together. */ + this = next; + end = find_change (next); + + /* Disconnect them from the rest of the changes, making them + a hunk, and remember the rest for next iteration. */ + next = end->link; + end->link = 0; + + /* Determine whether this hunk is really a difference. */ + analyze_hunk (this, &first0, &last0, &first1, &last1, + &deletes, &inserts); + + /* Reconnect the script so it will all be freed properly. */ + end->link = next; + + if (deletes || inserts) + changes = 1; + } + } + else + changes = (script != 0); + + if (no_details_flag) + briefly_report (changes, filevec); + else + { + if (changes || ! no_diff_means_no_output) + { + /* Record info for starting up output, + to be used if and when we have some output to print. */ + setup_output (files[0].name, files[1].name, depth); + + switch (output_style) + { + case OUTPUT_CONTEXT: + print_context_script (script, 0); + break; + + case OUTPUT_UNIFIED: + print_context_script (script, 1); + break; + + case OUTPUT_ED: + print_ed_script (script); + break; + + case OUTPUT_FORWARD_ED: + pr_forward_ed_script (script); + break; + + case OUTPUT_RCS: + print_rcs_script (script); + break; + + case OUTPUT_NORMAL: + print_normal_script (script); + break; + + case OUTPUT_IFDEF: + print_ifdef_script (script); + break; + + case OUTPUT_SDIFF: + print_sdiff_script (script); + } + + finish_output (); + } + } + + free (filevec[0].undiscarded); + + free (filevec[0].changed_flag - 1); + + for (i = 1; i >= 0; --i) + free (filevec[i].equivs); + + for (i = 0; i < 2; ++i) + free (filevec[i].linbuf + filevec[i].linbuf_base); + + for (e = script; e; e = p) + { + p = e->link; + free (e); + } + + if (! ROBUST_OUTPUT_STYLE (output_style)) + for (i = 0; i < 2; ++i) + if (filevec[i].missing_newline) + { + diff_error ("No newline at end of file %s", filevec[i].name, ""); + changes = 2; + } + } + + if (filevec[0].buffer != filevec[1].buffer) + free (filevec[0].buffer); + free (filevec[1].buffer); + + return changes; +} diff --git a/gnu/usr.bin/cvs/diff/build_diff.com b/gnu/usr.bin/cvs/diff/build_diff.com new file mode 100644 index 00000000000..4dc68bcda3f --- /dev/null +++ b/gnu/usr.bin/cvs/diff/build_diff.com @@ -0,0 +1,18 @@ +$ CC :== CC/DEBUG/NOOPTIMIZE/STANDARD=VAXC/DEFINE=HAVE_CONFIG_H- +/INCLUDE_DIRECTORY=([-],[-.LIB],[-.SRC],[-.VMS])/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES +$ CC diff.c +$ CC analyze.c +$ CC cmpbuf.c +$ CC dir.c +$ CC io.c +$ CC util.c +$ CC context.c +$ CC ed.c +$ CC ifdef.c +$ CC normal.c +$ CC side.c +$ CC version.c +$ CC diff3.c +$ library/create diff.olb diff.obj,analyze.obj,cmpbuf.obj,- +dir.obj,io.obj,util.obj,context.obj,ed.obj,ifdef.obj,normal.obj,- +side.obj,version.obj,diff3.obj diff --git a/gnu/usr.bin/cvs/diff/cmpbuf.c b/gnu/usr.bin/cvs/diff/cmpbuf.c new file mode 100644 index 00000000000..e95a8f98ed9 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/cmpbuf.c @@ -0,0 +1,40 @@ +/* Buffer primitives for comparison operations. + Copyright (C) 1993 Free Software Foundation, Inc. + + This program 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. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "system.h" +#include "cmpbuf.h" + +/* Least common multiple of two buffer sizes A and B. */ + +size_t +buffer_lcm (a, b) + size_t a, b; +{ + size_t m, n, r; + + /* Yield reasonable values if buffer sizes are zero. */ + if (!a) + return b ? b : 8 * 1024; + if (!b) + return a; + + /* n = gcd (a, b) */ + for (m = a, n = b; (r = m % n) != 0; m = n, n = r) + continue; + + return a/n * b; +} diff --git a/gnu/usr.bin/cvs/diff/cmpbuf.h b/gnu/usr.bin/cvs/diff/cmpbuf.h new file mode 100644 index 00000000000..e3852b7bd4f --- /dev/null +++ b/gnu/usr.bin/cvs/diff/cmpbuf.h @@ -0,0 +1,20 @@ +/* Buffer primitives for comparison operations. + Copyright (C) 1993 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +size_t buffer_lcm PARAMS((size_t, size_t)); diff --git a/gnu/usr.bin/cvs/diff/context.c b/gnu/usr.bin/cvs/diff/context.c new file mode 100644 index 00000000000..14f950c5269 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/context.c @@ -0,0 +1,468 @@ +/* Context-format output routines for GNU DIFF. + Copyright (C) 1988,1989,1991,1992,1993,1994 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "diff.h" + +static struct change *find_hunk PARAMS((struct change *)); +static void find_function PARAMS((struct file_data const *, int, char const **, size_t *)); +static void mark_ignorable PARAMS((struct change *)); +static void pr_context_hunk PARAMS((struct change *)); +static void pr_unidiff_hunk PARAMS((struct change *)); +static void print_context_label PARAMS ((char const *, struct file_data *, char const *)); +static void print_context_number_range PARAMS((struct file_data const *, int, int)); +static void print_unidiff_number_range PARAMS((struct file_data const *, int, int)); + +/* Last place find_function started searching from. */ +static int find_function_last_search; + +/* The value find_function returned when it started searching there. */ +static int find_function_last_match; + +/* Print a label for a context diff, with a file name and date or a label. */ + +static void +print_context_label (mark, inf, label) + char const *mark; + struct file_data *inf; + char const *label; +{ + if (label) + fprintf (outfile, "%s %s\n", mark, label); + else + { + char const *ct = ctime (&inf->stat.st_mtime); + if (!ct) + ct = "?\n"; + /* See Posix.2 section 4.17.6.1.4 for this format. */ + fprintf (outfile, "%s %s\t%s", mark, inf->name, ct); + } +} + +/* Print a header for a context diff, with the file names and dates. */ + +void +print_context_header (inf, unidiff_flag) + struct file_data inf[]; + int unidiff_flag; +{ + if (unidiff_flag) + { + print_context_label ("---", &inf[0], file_label[0]); + print_context_label ("+++", &inf[1], file_label[1]); + } + else + { + print_context_label ("***", &inf[0], file_label[0]); + print_context_label ("---", &inf[1], file_label[1]); + } +} + +/* Print an edit script in context format. */ + +void +print_context_script (script, unidiff_flag) + struct change *script; + int unidiff_flag; +{ + if (ignore_blank_lines_flag || ignore_regexp_list) + mark_ignorable (script); + else + { + struct change *e; + for (e = script; e; e = e->link) + e->ignore = 0; + } + + find_function_last_search = - files[0].prefix_lines; + find_function_last_match = find_function_last_search - 1; + + if (unidiff_flag) + print_script (script, find_hunk, pr_unidiff_hunk); + else + print_script (script, find_hunk, pr_context_hunk); +} + +/* Print a pair of line numbers with a comma, translated for file FILE. + If the second number is not greater, use the first in place of it. + + Args A and B are internal line numbers. + We print the translated (real) line numbers. */ + +static void +print_context_number_range (file, a, b) + struct file_data const *file; + int a, b; +{ + int trans_a, trans_b; + translate_range (file, a, b, &trans_a, &trans_b); + + /* Note: we can have B < A in the case of a range of no lines. + In this case, we should print the line number before the range, + which is B. */ + if (trans_b > trans_a) + fprintf (outfile, "%d,%d", trans_a, trans_b); + else + fprintf (outfile, "%d", trans_b); +} + +/* Print a portion of an edit script in context format. + HUNK is the beginning of the portion to be printed. + The end is marked by a `link' that has been nulled out. + + Prints out lines from both files, and precedes each + line with the appropriate flag-character. */ + +static void +pr_context_hunk (hunk) + struct change *hunk; +{ + int first0, last0, first1, last1, show_from, show_to, i; + struct change *next; + char const *prefix; + char const *function; + size_t function_length; + FILE *out; + + /* Determine range of line numbers involved in each file. */ + + analyze_hunk (hunk, &first0, &last0, &first1, &last1, &show_from, &show_to); + + if (!show_from && !show_to) + return; + + /* Include a context's width before and after. */ + + i = - files[0].prefix_lines; + first0 = max (first0 - context, i); + first1 = max (first1 - context, i); + last0 = min (last0 + context, files[0].valid_lines - 1); + last1 = min (last1 + context, files[1].valid_lines - 1); + + /* If desired, find the preceding function definition line in file 0. */ + function = 0; + if (function_regexp_list) + find_function (&files[0], first0, &function, &function_length); + + begin_output (); + out = outfile; + + /* If we looked for and found a function this is part of, + include its name in the header of the diff section. */ + fprintf (out, "***************"); + + if (function) + { + fprintf (out, " "); + fwrite (function, 1, min (function_length - 1, 40), out); + } + + fprintf (out, "\n*** "); + print_context_number_range (&files[0], first0, last0); + fprintf (out, " ****\n"); + + if (show_from) + { + next = hunk; + + for (i = first0; i <= last0; i++) + { + /* Skip past changes that apply (in file 0) + only to lines before line I. */ + + while (next && next->line0 + next->deleted <= i) + next = next->link; + + /* Compute the marking for line I. */ + + prefix = " "; + if (next && next->line0 <= i) + /* The change NEXT covers this line. + If lines were inserted here in file 1, this is "changed". + Otherwise it is "deleted". */ + prefix = (next->inserted > 0 ? "!" : "-"); + + print_1_line (prefix, &files[0].linbuf[i]); + } + } + + fprintf (out, "--- "); + print_context_number_range (&files[1], first1, last1); + fprintf (out, " ----\n"); + + if (show_to) + { + next = hunk; + + for (i = first1; i <= last1; i++) + { + /* Skip past changes that apply (in file 1) + only to lines before line I. */ + + while (next && next->line1 + next->inserted <= i) + next = next->link; + + /* Compute the marking for line I. */ + + prefix = " "; + if (next && next->line1 <= i) + /* The change NEXT covers this line. + If lines were deleted here in file 0, this is "changed". + Otherwise it is "inserted". */ + prefix = (next->deleted > 0 ? "!" : "+"); + + print_1_line (prefix, &files[1].linbuf[i]); + } + } +} + +/* Print a pair of line numbers with a comma, translated for file FILE. + If the second number is smaller, use the first in place of it. + If the numbers are equal, print just one number. + + Args A and B are internal line numbers. + We print the translated (real) line numbers. */ + +static void +print_unidiff_number_range (file, a, b) + struct file_data const *file; + int a, b; +{ + int trans_a, trans_b; + translate_range (file, a, b, &trans_a, &trans_b); + + /* Note: we can have B < A in the case of a range of no lines. + In this case, we should print the line number before the range, + which is B. */ + if (trans_b <= trans_a) + fprintf (outfile, trans_b == trans_a ? "%d" : "%d,0", trans_b); + else + fprintf (outfile, "%d,%d", trans_a, trans_b - trans_a + 1); +} + +/* Print a portion of an edit script in unidiff format. + HUNK is the beginning of the portion to be printed. + The end is marked by a `link' that has been nulled out. + + Prints out lines from both files, and precedes each + line with the appropriate flag-character. */ + +static void +pr_unidiff_hunk (hunk) + struct change *hunk; +{ + int first0, last0, first1, last1, show_from, show_to, i, j, k; + struct change *next; + char const *function; + size_t function_length; + FILE *out; + + /* Determine range of line numbers involved in each file. */ + + analyze_hunk (hunk, &first0, &last0, &first1, &last1, &show_from, &show_to); + + if (!show_from && !show_to) + return; + + /* Include a context's width before and after. */ + + i = - files[0].prefix_lines; + first0 = max (first0 - context, i); + first1 = max (first1 - context, i); + last0 = min (last0 + context, files[0].valid_lines - 1); + last1 = min (last1 + context, files[1].valid_lines - 1); + + /* If desired, find the preceding function definition line in file 0. */ + function = 0; + if (function_regexp_list) + find_function (&files[0], first0, &function, &function_length); + + begin_output (); + out = outfile; + + fprintf (out, "@@ -"); + print_unidiff_number_range (&files[0], first0, last0); + fprintf (out, " +"); + print_unidiff_number_range (&files[1], first1, last1); + fprintf (out, " @@"); + + /* If we looked for and found a function this is part of, + include its name in the header of the diff section. */ + + if (function) + { + putc (' ', out); + fwrite (function, 1, min (function_length - 1, 40), out); + } + putc ('\n', out); + + next = hunk; + i = first0; + j = first1; + + while (i <= last0 || j <= last1) + { + + /* If the line isn't a difference, output the context from file 0. */ + + if (!next || i < next->line0) + { + putc (tab_align_flag ? '\t' : ' ', out); + print_1_line (0, &files[0].linbuf[i++]); + j++; + } + else + { + /* For each difference, first output the deleted part. */ + + k = next->deleted; + while (k--) + { + putc ('-', out); + if (tab_align_flag) + putc ('\t', out); + print_1_line (0, &files[0].linbuf[i++]); + } + + /* Then output the inserted part. */ + + k = next->inserted; + while (k--) + { + putc ('+', out); + if (tab_align_flag) + putc ('\t', out); + print_1_line (0, &files[1].linbuf[j++]); + } + + /* We're done with this hunk, so on to the next! */ + + next = next->link; + } + } +} + +/* Scan a (forward-ordered) edit script for the first place that more than + 2*CONTEXT unchanged lines appear, and return a pointer + to the `struct change' for the last change before those lines. */ + +static struct change * +find_hunk (start) + struct change *start; +{ + struct change *prev; + int top0, top1; + int thresh; + + do + { + /* Compute number of first line in each file beyond this changed. */ + top0 = start->line0 + start->deleted; + top1 = start->line1 + start->inserted; + prev = start; + start = start->link; + /* Threshold distance is 2*CONTEXT between two non-ignorable changes, + but only CONTEXT if one is ignorable. */ + thresh = ((prev->ignore || (start && start->ignore)) + ? context + : 2 * context + 1); + /* It is not supposed to matter which file we check in the end-test. + If it would matter, crash. */ + if (start && start->line0 - top0 != start->line1 - top1) + abort (); + } while (start + /* Keep going if less than THRESH lines + elapse before the affected line. */ + && start->line0 < top0 + thresh); + + return prev; +} + +/* Set the `ignore' flag properly in each change in SCRIPT. + It should be 1 if all the lines inserted or deleted in that change + are ignorable lines. */ + +static void +mark_ignorable (script) + struct change *script; +{ + while (script) + { + struct change *next = script->link; + int first0, last0, first1, last1, deletes, inserts; + + /* Turn this change into a hunk: detach it from the others. */ + script->link = 0; + + /* Determine whether this change is ignorable. */ + analyze_hunk (script, &first0, &last0, &first1, &last1, &deletes, &inserts); + /* Reconnect the chain as before. */ + script->link = next; + + /* If the change is ignorable, mark it. */ + script->ignore = (!deletes && !inserts); + + /* Advance to the following change. */ + script = next; + } +} + +/* Find the last function-header line in FILE prior to line number LINENUM. + This is a line containing a match for the regexp in `function_regexp'. + Store the address of the line text into LINEP and the length of the + line into LENP. + Do not store anything if no function-header is found. */ + +static void +find_function (file, linenum, linep, lenp) + struct file_data const *file; + int linenum; + char const **linep; + size_t *lenp; +{ + int i = linenum; + int last = find_function_last_search; + find_function_last_search = i; + + while (--i >= last) + { + /* See if this line is what we want. */ + struct regexp_list *r; + char const *line = file->linbuf[i]; + size_t len = file->linbuf[i + 1] - line; + + for (r = function_regexp_list; r; r = r->next) + if (0 <= re_search (&r->buf, line, len, 0, len, 0)) + { + *linep = line; + *lenp = len; + find_function_last_match = i; + return; + } + } + /* If we search back to where we started searching the previous time, + find the line we found last time. */ + if (find_function_last_match >= - file->prefix_lines) + { + i = find_function_last_match; + *linep = file->linbuf[i]; + *lenp = file->linbuf[i + 1] - *linep; + return; + } + return; +} diff --git a/gnu/usr.bin/cvs/diff/diff.c b/gnu/usr.bin/cvs/diff/diff.c new file mode 100644 index 00000000000..c0e37d7d421 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/diff.c @@ -0,0 +1,1214 @@ +/* GNU DIFF entry routine. + Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* GNU DIFF was written by Mike Haertel, David Hayes, + Richard Stallman, Len Tower, and Paul Eggert. */ + +#define GDIFF_MAIN +#include "diff.h" +#include <signal.h> +#include "getopt.h" +#include "fnmatch.h" + +#ifndef DEFAULT_WIDTH +#define DEFAULT_WIDTH 130 +#endif + +#ifndef GUTTER_WIDTH_MINIMUM +#define GUTTER_WIDTH_MINIMUM 3 +#endif + +/* diff.c has a real initialize_main function. */ +#ifdef initialize_main +#undef initialize_main +#endif + +static char const *filetype PARAMS((struct stat const *)); +static char *option_list PARAMS((char **, int)); +static int add_exclude_file PARAMS((char const *)); +static int ck_atoi PARAMS((char const *, int *)); +static int compare_files PARAMS((char const *, char const *, char const *, char const *, int)); +static int specify_format PARAMS((char **, char *)); +static void add_exclude PARAMS((char const *)); +static void add_regexp PARAMS((struct regexp_list **, char const *)); +static void specify_style PARAMS((enum output_style)); +static int try_help PARAMS((char const *)); +static void check_output PARAMS((FILE *)); +static void usage PARAMS((void)); +static void initialize_main PARAMS((int *, char ***)); + +/* Nonzero for -r: if comparing two directories, + compare their common subdirectories recursively. */ + +static int recursive; + +/* For debugging: don't do discard_confusing_lines. */ + +int no_discards; + +#if HAVE_SETMODE +/* I/O mode: nonzero only if using binary input/output. */ +static int binary_I_O; +#endif + +/* Return a string containing the command options with which diff was invoked. + Spaces appear between what were separate ARGV-elements. + There is a space at the beginning but none at the end. + If there were no options, the result is an empty string. + + Arguments: OPTIONVEC, a vector containing separate ARGV-elements, and COUNT, + the length of that vector. */ + +static char * +option_list (optionvec, count) + char **optionvec; /* Was `vector', but that collides on Alliant. */ + int count; +{ + int i; + size_t length = 0; + char *result; + + for (i = 0; i < count; i++) + length += strlen (optionvec[i]) + 1; + + result = xmalloc (length + 1); + result[0] = 0; + + for (i = 0; i < count; i++) + { + strcat (result, " "); + strcat (result, optionvec[i]); + } + + return result; +} + +/* Convert STR to a positive integer, storing the result in *OUT. + If STR is not a valid integer, return -1 (otherwise 0). */ +static int +ck_atoi (str, out) + char const *str; + int *out; +{ + char const *p; + for (p = str; *p; p++) + if (*p < '0' || *p > '9') + return -1; + + *out = atoi (optarg); + return 0; +} + +/* Keep track of excluded file name patterns. */ + +static char const **exclude; +static int exclude_alloc, exclude_count; + +int +excluded_filename (f) + char const *f; +{ + int i; + for (i = 0; i < exclude_count; i++) + if (fnmatch (exclude[i], f, 0) == 0) + return 1; + return 0; +} + +static void +add_exclude (pattern) + char const *pattern; +{ + if (exclude_alloc <= exclude_count) + exclude = (char const **) + (exclude_alloc == 0 + ? xmalloc ((exclude_alloc = 64) * sizeof (*exclude)) + : xrealloc (exclude, (exclude_alloc *= 2) * sizeof (*exclude))); + + exclude[exclude_count++] = pattern; +} + +static int +add_exclude_file (name) + char const *name; +{ + struct file_data f; + char *p, *q, *lim; + + f.name = optarg; + f.desc = (strcmp (optarg, "-") == 0 + ? STDIN_FILENO + : open (optarg, O_RDONLY, 0)); + if (f.desc < 0 || fstat (f.desc, &f.stat) != 0) + return -1; + + sip (&f, 1); + slurp (&f); + + for (p = f.buffer, lim = p + f.buffered_chars; p < lim; p = q) + { + q = (char *) memchr (p, '\n', lim - p); + if (!q) + q = lim; + *q++ = 0; + add_exclude (p); + } + + return close (f.desc); +} + +/* The numbers 129- that appear in the fourth element of some entries + tell the big switch in `diff_run' how to process those options. */ + +static struct option const longopts[] = +{ + {"ignore-blank-lines", 0, 0, 'B'}, + {"context", 2, 0, 'C'}, + {"ifdef", 1, 0, 'D'}, + {"show-function-line", 1, 0, 'F'}, + {"speed-large-files", 0, 0, 'H'}, + {"ignore-matching-lines", 1, 0, 'I'}, + {"label", 1, 0, 'L'}, + {"file-label", 1, 0, 'L'}, /* An alias, no longer recommended */ + {"new-file", 0, 0, 'N'}, + {"entire-new-file", 0, 0, 'N'}, /* An alias, no longer recommended */ + {"unidirectional-new-file", 0, 0, 'P'}, + {"starting-file", 1, 0, 'S'}, + {"initial-tab", 0, 0, 'T'}, + {"width", 1, 0, 'W'}, + {"text", 0, 0, 'a'}, + {"ascii", 0, 0, 'a'}, /* An alias, no longer recommended */ + {"ignore-space-change", 0, 0, 'b'}, + {"minimal", 0, 0, 'd'}, + {"ed", 0, 0, 'e'}, + {"forward-ed", 0, 0, 'f'}, + {"ignore-case", 0, 0, 'i'}, + {"paginate", 0, 0, 'l'}, + {"print", 0, 0, 'l'}, /* An alias, no longer recommended */ + {"rcs", 0, 0, 'n'}, + {"show-c-function", 0, 0, 'p'}, + {"brief", 0, 0, 'q'}, + {"recursive", 0, 0, 'r'}, + {"report-identical-files", 0, 0, 's'}, + {"expand-tabs", 0, 0, 't'}, + {"version", 0, 0, 'v'}, + {"ignore-all-space", 0, 0, 'w'}, + {"exclude", 1, 0, 'x'}, + {"exclude-from", 1, 0, 'X'}, + {"side-by-side", 0, 0, 'y'}, + {"unified", 2, 0, 'U'}, + {"left-column", 0, 0, 129}, + {"suppress-common-lines", 0, 0, 130}, + {"sdiff-merge-assist", 0, 0, 131}, + {"old-line-format", 1, 0, 132}, + {"new-line-format", 1, 0, 133}, + {"unchanged-line-format", 1, 0, 134}, + {"line-format", 1, 0, 135}, + {"old-group-format", 1, 0, 136}, + {"new-group-format", 1, 0, 137}, + {"unchanged-group-format", 1, 0, 138}, + {"changed-group-format", 1, 0, 139}, + {"horizon-lines", 1, 0, 140}, + {"help", 0, 0, 141}, + {"binary", 0, 0, 142}, + {0, 0, 0, 0} +}; + +int +diff_run (argc, argv, out) + int argc; + char *argv[]; + char *out; +{ + int val; + int c; + int prev = -1; + int width = DEFAULT_WIDTH; + int show_c_function = 0; + int optind_old; + + /* Do our initializations. */ + initialize_main (&argc, &argv); + + /* Decode the options. */ + + optind_old = optind; + optind = 0; + while ((c = getopt_long (argc, argv, + "0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y", + longopts, 0)) != EOF) + { + switch (c) + { + /* All digits combine in decimal to specify the context-size. */ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '0': + if (context == -1) + context = 0; + /* If a context length has already been specified, + more digits allowed only if they follow right after the others. + Reject two separate runs of digits, or digits after -C. */ + else if (prev < '0' || prev > '9') + fatal ("context length specified twice"); + + context = context * 10 + c - '0'; + break; + + case 'a': + /* Treat all files as text files; never treat as binary. */ + always_text_flag = 1; + break; + + case 'b': + /* Ignore changes in amount of white space. */ + ignore_space_change_flag = 1; + ignore_some_changes = 1; + ignore_some_line_changes = 1; + break; + + case 'B': + /* Ignore changes affecting only blank lines. */ + ignore_blank_lines_flag = 1; + ignore_some_changes = 1; + break; + + case 'C': /* +context[=lines] */ + case 'U': /* +unified[=lines] */ + if (optarg) + { + if (context >= 0) + fatal ("context length specified twice"); + + if (ck_atoi (optarg, &context)) + fatal ("invalid context length argument"); + } + + /* Falls through. */ + case 'c': + /* Make context-style output. */ + specify_style (c == 'U' ? OUTPUT_UNIFIED : OUTPUT_CONTEXT); + break; + + case 'd': + /* Don't discard lines. This makes things slower (sometimes much + slower) but will find a guaranteed minimal set of changes. */ + no_discards = 1; + break; + + case 'D': + /* Make merged #ifdef output. */ + specify_style (OUTPUT_IFDEF); + { + int i, err = 0; + static char const C_ifdef_group_formats[] = + "#ifndef %s\n%%<#endif /* not %s */\n%c#ifdef %s\n%%>#endif /* %s */\n%c%%=%c#ifndef %s\n%%<#else /* %s */\n%%>#endif /* %s */\n"; + char *b = xmalloc (sizeof (C_ifdef_group_formats) + + 7 * strlen(optarg) - 14 /* 7*"%s" */ + - 8 /* 5*"%%" + 3*"%c" */); + sprintf (b, C_ifdef_group_formats, + optarg, optarg, 0, + optarg, optarg, 0, 0, + optarg, optarg, optarg); + for (i = 0; i < 4; i++) + { + err |= specify_format (&group_format[i], b); + b += strlen (b) + 1; + } + if (err) + diff_error ("conflicting #ifdef formats", 0, 0); + } + break; + + case 'e': + /* Make output that is a valid `ed' script. */ + specify_style (OUTPUT_ED); + break; + + case 'f': + /* Make output that looks vaguely like an `ed' script + but has changes in the order they appear in the file. */ + specify_style (OUTPUT_FORWARD_ED); + break; + + case 'F': + /* Show, for each set of changes, the previous line that + matches the specified regexp. Currently affects only + context-style output. */ + add_regexp (&function_regexp_list, optarg); + break; + + case 'h': + /* Split the files into chunks of around 1500 lines + for faster processing. Usually does not change the result. + + This currently has no effect. */ + break; + + case 'H': + /* Turn on heuristics that speed processing of large files + with a small density of changes. */ + heuristic = 1; + break; + + case 'i': + /* Ignore changes in case. */ + ignore_case_flag = 1; + ignore_some_changes = 1; + ignore_some_line_changes = 1; + break; + + case 'I': + /* Ignore changes affecting only lines that match the + specified regexp. */ + add_regexp (&ignore_regexp_list, optarg); + ignore_some_changes = 1; + break; + + case 'l': + /* Pass the output through `pr' to paginate it. */ + paginate_flag = 1; +#if !defined(SIGCHLD) && defined(SIGCLD) +#define SIGCHLD SIGCLD +#endif +#ifdef SIGCHLD + /* Pagination requires forking and waiting, and + System V fork+wait does not work if SIGCHLD is ignored. */ + signal (SIGCHLD, SIG_DFL); +#endif + break; + + case 'L': + /* Specify file labels for `-c' output headers. */ + if (!file_label[0]) + file_label[0] = optarg; + else if (!file_label[1]) + file_label[1] = optarg; + else + fatal ("too many file label options"); + break; + + case 'n': + /* Output RCS-style diffs, like `-f' except that each command + specifies the number of lines affected. */ + specify_style (OUTPUT_RCS); + break; + + case 'N': + /* When comparing directories, if a file appears only in one + directory, treat it as present but empty in the other. */ + entire_new_file_flag = 1; + break; + + case 'p': + /* Make context-style output and show name of last C function. */ + show_c_function = 1; + add_regexp (&function_regexp_list, "^[_a-zA-Z$]"); + break; + + case 'P': + /* When comparing directories, if a file appears only in + the second directory of the two, + treat it as present but empty in the other. */ + unidirectional_new_file_flag = 1; + break; + + case 'q': + no_details_flag = 1; + break; + + case 'r': + /* When comparing directories, + recursively compare any subdirectories found. */ + recursive = 1; + break; + + case 's': + /* Print a message if the files are the same. */ + print_file_same_flag = 1; + break; + + case 'S': + /* When comparing directories, start with the specified + file name. This is used for resuming an aborted comparison. */ + dir_start_file = optarg; + break; + + case 't': + /* Expand tabs to spaces in the output so that it preserves + the alignment of the input files. */ + tab_expand_flag = 1; + break; + + case 'T': + /* Use a tab in the output, rather than a space, before the + text of an input line, so as to keep the proper alignment + in the input line without changing the characters in it. */ + tab_align_flag = 1; + break; + + case 'u': + /* Output the context diff in unidiff format. */ + specify_style (OUTPUT_UNIFIED); + break; + + case 'v': + printf ("diff - GNU diffutils version %s\n", diff_version_string); + return 0; + + case 'w': + /* Ignore horizontal white space when comparing lines. */ + ignore_all_space_flag = 1; + ignore_some_changes = 1; + ignore_some_line_changes = 1; + break; + + case 'x': + add_exclude (optarg); + break; + + case 'X': + if (add_exclude_file (optarg) != 0) + pfatal_with_name (optarg); + break; + + case 'y': + /* Use side-by-side (sdiff-style) columnar output. */ + specify_style (OUTPUT_SDIFF); + break; + + case 'W': + /* Set the line width for OUTPUT_SDIFF. */ + if (ck_atoi (optarg, &width) || width <= 0) + fatal ("column width must be a positive integer"); + break; + + case 129: + sdiff_left_only = 1; + break; + + case 130: + sdiff_skip_common_lines = 1; + break; + + case 131: + /* sdiff-style columns output. */ + specify_style (OUTPUT_SDIFF); + sdiff_help_sdiff = 1; + break; + + case 132: + case 133: + case 134: + specify_style (OUTPUT_IFDEF); + if (specify_format (&line_format[c - 132], optarg) != 0) + diff_error ("conflicting line format", 0, 0); + break; + + case 135: + specify_style (OUTPUT_IFDEF); + { + int i, err = 0; + for (i = 0; i < sizeof (line_format) / sizeof (*line_format); i++) + err |= specify_format (&line_format[i], optarg); + if (err) + diff_error ("conflicting line format", 0, 0); + } + break; + + case 136: + case 137: + case 138: + case 139: + specify_style (OUTPUT_IFDEF); + if (specify_format (&group_format[c - 136], optarg) != 0) + diff_error ("conflicting group format", 0, 0); + break; + + case 140: + if (ck_atoi (optarg, &horizon_lines) || horizon_lines < 0) + fatal ("horizon must be a nonnegative integer"); + break; + + case 141: + usage (); + check_output (stdout); + return 0; + + case 142: + /* Use binary I/O when reading and writing data. + On Posix hosts, this has no effect. */ +#if HAVE_SETMODE + binary_I_O = 1; +# if 0 + /* Because this code is leftover from pre-library days, + there is no way to set stdout back to the default mode + when we are done. As it turns out, I think the only + parts of CVS that pass out == NULL, and thus cause diff + to write to stdout, are "cvs diff" and "cvs rdiff". So + I'm not going to worry about this too much yet. */ + setmode (STDOUT_FILENO, O_BINARY); +# else + if (out == NULL) + error (0, 0, "warning: did not set stdout to binary mode"); +# endif +#endif + break; + + default: + return try_help (0); + } + prev = c; + } + + if (argc - optind != 2) + return try_help (argc - optind < 2 ? "missing operand" : "extra operand"); + + { + /* + * We maximize first the half line width, and then the gutter width, + * according to the following constraints: + * 1. Two half lines plus a gutter must fit in a line. + * 2. If the half line width is nonzero: + * a. The gutter width is at least GUTTER_WIDTH_MINIMUM. + * b. If tabs are not expanded to spaces, + * a half line plus a gutter is an integral number of tabs, + * so that tabs in the right column line up. + */ + int t = tab_expand_flag ? 1 : TAB_WIDTH; + int off = (width + t + GUTTER_WIDTH_MINIMUM) / (2*t) * t; + sdiff_half_width = max (0, min (off - GUTTER_WIDTH_MINIMUM, width - off)), + sdiff_column2_offset = sdiff_half_width ? off : width; + } + + if (show_c_function && output_style != OUTPUT_UNIFIED) + specify_style (OUTPUT_CONTEXT); + + if (output_style != OUTPUT_CONTEXT && output_style != OUTPUT_UNIFIED) + context = 0; + else if (context == -1) + /* Default amount of context for -c. */ + context = 3; + + if (output_style == OUTPUT_IFDEF) + { + /* Format arrays are char *, not char const *, + because integer formats are temporarily modified. + But it is safe to assign a constant like "%=" to a format array, + since "%=" does not format any integers. */ + int i; + for (i = 0; i < sizeof (line_format) / sizeof (*line_format); i++) + if (!line_format[i]) + line_format[i] = "%l\n"; + if (!group_format[OLD]) + group_format[OLD] + = group_format[UNCHANGED] ? group_format[UNCHANGED] : "%<"; + if (!group_format[NEW]) + group_format[NEW] + = group_format[UNCHANGED] ? group_format[UNCHANGED] : "%>"; + if (!group_format[UNCHANGED]) + group_format[UNCHANGED] = "%="; + if (!group_format[CHANGED]) + group_format[CHANGED] = concat (group_format[OLD], + group_format[NEW], ""); + } + + no_diff_means_no_output = + (output_style == OUTPUT_IFDEF ? + (!*group_format[UNCHANGED] + || (strcmp (group_format[UNCHANGED], "%=") == 0 + && !*line_format[UNCHANGED])) + : output_style == OUTPUT_SDIFF ? sdiff_skip_common_lines : 1); + + switch_string = option_list (argv + 1, optind - 1); + + if (out == NULL) + outfile = stdout; + else + { +#if HAVE_SETMODE + /* A diff which is full of ^Z and such isn't going to work + very well in text mode. */ + if (binary_I_O) + outfile = fopen (out, "wb"); + else +#endif + outfile = fopen (out, "w"); + if (outfile == NULL) + { + perror_with_name ("could not open output file"); + return 2; + } + } + + /* Set the jump buffer, so that diff may abort execution without + terminating the process. */ + if ((val = setjmp (diff_abort_buf)) != 0) + { + optind = optind_old; + if (outfile != stdout) + fclose (outfile); + return val; + } + + val = compare_files (0, argv[optind], 0, argv[optind + 1], 0); + + /* Print any messages that were saved up for last. */ + print_message_queue (); + + free (switch_string); + + optind = optind_old; + check_output (outfile); + if (outfile != stdout) + if (fclose (outfile) != 0) + perror ("close error on output file"); + return val; +} + +/* Add the compiled form of regexp PATTERN to REGLIST. */ + +static void +add_regexp (reglist, pattern) + struct regexp_list **reglist; + char const *pattern; +{ + struct regexp_list *r; + char const *m; + + r = (struct regexp_list *) xmalloc (sizeof (*r)); + bzero (r, sizeof (*r)); + r->buf.fastmap = xmalloc (256); + m = re_compile_pattern (pattern, strlen (pattern), &r->buf); + if (m != 0) + diff_error ("%s: %s", pattern, m); + + /* Add to the start of the list, since it's easier than the end. */ + r->next = *reglist; + *reglist = r; +} + +static int +try_help (reason) + char const *reason; +{ + if (reason) + diff_error ("%s", reason, 0); + diff_error ("Try `%s --help' for more information.", diff_program_name, 0); + return 2; +} + +static void +check_output (file) + FILE *file; +{ + if (ferror (file) || fflush (file) != 0) + fatal ("write error"); +} + +static char const * const option_help[] = { +"-i --ignore-case Consider upper- and lower-case to be the same.", +"-w --ignore-all-space Ignore all white space.", +"-b --ignore-space-change Ignore changes in the amount of white space.", +"-B --ignore-blank-lines Ignore changes whose lines are all blank.", +"-I RE --ignore-matching-lines=RE Ignore changes whose lines all match RE.", +#if HAVE_SETMODE +"--binary Read and write data in binary mode.", +#endif +"-a --text Treat all files as text.\n", +"-c -C NUM --context[=NUM] Output NUM (default 2) lines of copied context.", +"-u -U NUM --unified[=NUM] Output NUM (default 2) lines of unified context.", +" -NUM Use NUM context lines.", +" -L LABEL --label LABEL Use LABEL instead of file name.", +" -p --show-c-function Show which C function each change is in.", +" -F RE --show-function-line=RE Show the most recent line matching RE.", +"-q --brief Output only whether files differ.", +"-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.", +" --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.", +"--GTYPE-group-format=GFMT Similar, but format GTYPE input groups with GFMT.", +"--line-format=LFMT Similar, but format all input lines with LFMT.", +"--LTYPE-line-format=LFMT Similar, but format LTYPE input lines with LFMT.", +" LTYPE is `old', `new', or `unchanged'. GTYPE is LTYPE or `changed'.", +" GFMT may contain:", +" %< lines from FILE1", +" %> lines from FILE2", +" %= lines common to FILE1 and FILE2", +" %[-][WIDTH][.[PREC]]{doxX}LETTER printf-style spec for LETTER", +" LETTERs are as follows for new group, lower case for old group:", +" F first line number", +" L last line number", +" N number of lines = L-F+1", +" E F-1", +" M L+1", +" LFMT may contain:", +" %L contents of line", +" %l contents of line, excluding any trailing newline", +" %[-][WIDTH][.[PREC]]{doxX}n printf-style spec for input line number", +" Either GFMT or LFMT may contain:", +" %% %", +" %c'C' the single character C", +" %c'\\OOO' the character with octal code OOO\n", +"-l --paginate Pass the output through `pr' to paginate it.", +"-t --expand-tabs Expand tabs to spaces in output.", +"-T --initial-tab Make tabs line up by prepending a tab.\n", +"-r --recursive Recursively compare any subdirectories found.", +"-N --new-file Treat absent files as empty.", +"-P --unidirectional-new-file Treat absent first files as empty.", +"-s --report-identical-files Report when two files are the same.", +"-x PAT --exclude=PAT Exclude files that match PAT.", +"-X FILE --exclude-from=FILE Exclude files that match any pattern in FILE.", +"-S FILE --starting-file=FILE Start with FILE when comparing directories.\n", +"--horizon-lines=NUM Keep NUM lines of the common prefix and suffix.", +"-d --minimal Try hard to find a smaller set of changes.", +"-H --speed-large-files Assume large files and many scattered small changes.\n", +"-v --version Output version info.", +"--help Output this help.", +0 +}; + +static void +usage () +{ + char const * const *p; + + printf ("Usage: %s [OPTION]... FILE1 FILE2\n\n", diff_program_name); + for (p = option_help; *p; p++) + printf (" %s\n", *p); + printf ("\nIf FILE1 or FILE2 is `-', read standard input.\n"); +} + +static int +specify_format (var, value) + char **var; + char *value; +{ + int err = *var ? strcmp (*var, value) : 0; + *var = value; + return err; +} + +static void +specify_style (style) + enum output_style style; +{ + if (output_style != OUTPUT_NORMAL + && output_style != style) + diff_error ("conflicting specifications of output style", 0, 0); + output_style = style; +} + +static char const * +filetype (st) + struct stat const *st; +{ + /* See Posix.2 section 4.17.6.1.1 and Table 5-1 for these formats. + To keep diagnostics grammatical, the returned string must start + with a consonant. */ + + if (S_ISREG (st->st_mode)) + { + if (st->st_size == 0) + return "regular empty file"; + /* Posix.2 section 5.14.2 seems to suggest that we must read the file + and guess whether it's C, Fortran, etc., but this is somewhat useless + and doesn't reflect historical practice. We're allowed to guess + wrong, so we don't bother to read the file. */ + return "regular file"; + } + if (S_ISDIR (st->st_mode)) return "directory"; + + /* other Posix.1 file types */ +#ifdef S_ISBLK + if (S_ISBLK (st->st_mode)) return "block special file"; +#endif +#ifdef S_ISCHR + if (S_ISCHR (st->st_mode)) return "character special file"; +#endif +#ifdef S_ISFIFO + if (S_ISFIFO (st->st_mode)) return "fifo"; +#endif + + /* other Posix.1b file types */ +#ifdef S_TYPEISMQ + if (S_TYPEISMQ (st)) return "message queue"; +#endif +#ifdef S_TYPEISSEM + if (S_TYPEISSEM (st)) return "semaphore"; +#endif +#ifdef S_TYPEISSHM + if (S_TYPEISSHM (st)) return "shared memory object"; +#endif + + /* other popular file types */ + /* S_ISLNK is impossible with `fstat' and `stat'. */ +#ifdef S_ISSOCK + if (S_ISSOCK (st->st_mode)) return "socket"; +#endif + + return "weird file"; +} + +/* Compare two files (or dirs) with specified names + DIR0/NAME0 and DIR1/NAME1, at level DEPTH in directory recursion. + (if DIR0 is 0, then the name is just NAME0, etc.) + This is self-contained; it opens the files and closes them. + + Value is 0 if files are the same, 1 if different, + 2 if there is a problem opening them. */ + +static int +compare_files (dir0, name0, dir1, name1, depth) + char const *dir0, *dir1; + char const *name0, *name1; + int depth; +{ + struct file_data inf[2]; + register int i; + int val; + int same_files; + int failed = 0; + char *free0 = 0, *free1 = 0; + + /* If this is directory comparison, perhaps we have a file + that exists only in one of the directories. + If so, just print a message to that effect. */ + + if (! ((name0 != 0 && name1 != 0) + || (unidirectional_new_file_flag && name1 != 0) + || entire_new_file_flag)) + { + char const *name = name0 == 0 ? name1 : name0; + char const *dir = name0 == 0 ? dir1 : dir0; + message ("Only in %s: %s\n", dir, name); + /* Return 1 so that diff_dirs will return 1 ("some files differ"). */ + return 1; + } + + bzero (inf, sizeof (inf)); + + /* Mark any nonexistent file with -1 in the desc field. */ + /* Mark unopened files (e.g. directories) with -2. */ + + inf[0].desc = name0 == 0 ? -1 : -2; + inf[1].desc = name1 == 0 ? -1 : -2; + + /* Now record the full name of each file, including nonexistent ones. */ + + if (name0 == 0) + name0 = name1; + if (name1 == 0) + name1 = name0; + + inf[0].name = dir0 == 0 ? name0 : (free0 = dir_file_pathname (dir0, name0)); + inf[1].name = dir1 == 0 ? name1 : (free1 = dir_file_pathname (dir1, name1)); + + /* Stat the files. Record whether they are directories. */ + + for (i = 0; i <= 1; i++) + { + if (inf[i].desc != -1) + { + int stat_result; + + if (i && filename_cmp (inf[i].name, inf[0].name) == 0) + { + inf[i].stat = inf[0].stat; + stat_result = 0; + } + else if (strcmp (inf[i].name, "-") == 0) + { + inf[i].desc = STDIN_FILENO; + stat_result = fstat (STDIN_FILENO, &inf[i].stat); + if (stat_result == 0 && S_ISREG (inf[i].stat.st_mode)) + { + off_t pos = lseek (STDIN_FILENO, (off_t) 0, SEEK_CUR); + if (pos == -1) + stat_result = -1; + else + { + if (pos <= inf[i].stat.st_size) + inf[i].stat.st_size -= pos; + else + inf[i].stat.st_size = 0; + /* Posix.2 4.17.6.1.4 requires current time for stdin. */ + time (&inf[i].stat.st_mtime); + } + } + } + else + stat_result = stat (inf[i].name, &inf[i].stat); + + if (stat_result != 0) + { + perror_with_name (inf[i].name); + failed = 1; + } + else + { + inf[i].dir_p = S_ISDIR (inf[i].stat.st_mode) && inf[i].desc != 0; + if (inf[1 - i].desc == -1) + { + inf[1 - i].dir_p = inf[i].dir_p; + inf[1 - i].stat.st_mode = inf[i].stat.st_mode; + } + } + } + } + + if (! failed && depth == 0 && inf[0].dir_p != inf[1].dir_p) + { + /* If one is a directory, and it was specified in the command line, + use the file in that dir with the other file's basename. */ + + int fnm_arg = inf[0].dir_p; + int dir_arg = 1 - fnm_arg; + char const *fnm = inf[fnm_arg].name; + char const *dir = inf[dir_arg].name; + char const *p = filename_lastdirchar (fnm); + char const *filename = inf[dir_arg].name + = dir_file_pathname (dir, p ? p + 1 : fnm); + + if (strcmp (fnm, "-") == 0) + fatal ("can't compare - to a directory"); + + if (stat (filename, &inf[dir_arg].stat) != 0) + { + perror_with_name (filename); + failed = 1; + } + else + inf[dir_arg].dir_p = S_ISDIR (inf[dir_arg].stat.st_mode); + } + + if (failed) + { + + /* If either file should exist but does not, return 2. */ + + val = 2; + + } + else if ((same_files = inf[0].desc != -1 && inf[1].desc != -1 + && 0 < same_file (&inf[0].stat, &inf[1].stat)) + && no_diff_means_no_output) + { + /* The two named files are actually the same physical file. + We know they are identical without actually reading them. */ + + val = 0; + } + else if (inf[0].dir_p & inf[1].dir_p) + { + if (output_style == OUTPUT_IFDEF) + fatal ("-D option not supported with directories"); + + /* If both are directories, compare the files in them. */ + + if (depth > 0 && !recursive) + { + /* But don't compare dir contents one level down + unless -r was specified. */ + message ("Common subdirectories: %s and %s\n", + inf[0].name, inf[1].name); + val = 0; + } + else + { + val = diff_dirs (inf, compare_files, depth); + } + + } + else if ((inf[0].dir_p | inf[1].dir_p) + || (depth > 0 + && (! S_ISREG (inf[0].stat.st_mode) + || ! S_ISREG (inf[1].stat.st_mode)))) + { + /* Perhaps we have a subdirectory that exists only in one directory. + If so, just print a message to that effect. */ + + if (inf[0].desc == -1 || inf[1].desc == -1) + { + if ((inf[0].dir_p | inf[1].dir_p) + && recursive + && (entire_new_file_flag + || (unidirectional_new_file_flag && inf[0].desc == -1))) + val = diff_dirs (inf, compare_files, depth); + else + { + char const *dir = (inf[0].desc == -1) ? dir1 : dir0; + /* See Posix.2 section 4.17.6.1.1 for this format. */ + message ("Only in %s: %s\n", dir, name0); + val = 1; + } + } + else + { + /* We have two files that are not to be compared. */ + + /* See Posix.2 section 4.17.6.1.1 for this format. */ + message5 ("File %s is a %s while file %s is a %s\n", + inf[0].name, filetype (&inf[0].stat), + inf[1].name, filetype (&inf[1].stat)); + + /* This is a difference. */ + val = 1; + } + } + else if ((no_details_flag & ~ignore_some_changes) + && inf[0].stat.st_size != inf[1].stat.st_size + && (inf[0].desc == -1 || S_ISREG (inf[0].stat.st_mode)) + && (inf[1].desc == -1 || S_ISREG (inf[1].stat.st_mode))) + { + message ("Files %s and %s differ\n", inf[0].name, inf[1].name); + val = 1; + } + else + { + /* Both exist and neither is a directory. */ + + /* Open the files and record their descriptors. */ + + if (inf[0].desc == -2) + if ((inf[0].desc = open (inf[0].name, O_RDONLY, 0)) < 0) + { + perror_with_name (inf[0].name); + failed = 1; + } + if (inf[1].desc == -2) + if (same_files) + inf[1].desc = inf[0].desc; + else if ((inf[1].desc = open (inf[1].name, O_RDONLY, 0)) < 0) + { + perror_with_name (inf[1].name); + failed = 1; + } + +#if HAVE_SETMODE + if (binary_I_O) + for (i = 0; i <= 1; i++) + if (0 <= inf[i].desc) + setmode (inf[i].desc, O_BINARY); +#endif + + /* Compare the files, if no error was found. */ + + val = failed ? 2 : diff_2_files (inf, depth); + + /* Close the file descriptors. */ + + if (inf[0].desc >= 0 && close (inf[0].desc) != 0) + { + perror_with_name (inf[0].name); + val = 2; + } + if (inf[1].desc >= 0 && inf[0].desc != inf[1].desc + && close (inf[1].desc) != 0) + { + perror_with_name (inf[1].name); + val = 2; + } + } + + /* Now the comparison has been done, if no error prevented it, + and VAL is the value this function will return. */ + + if (val == 0 && !inf[0].dir_p) + { + if (print_file_same_flag) + message ("Files %s and %s are identical\n", + inf[0].name, inf[1].name); + } + else + fflush (outfile); + + if (free0) + free (free0); + if (free1) + free (free1); + + return val; +} + +/* Initialize status variables and flag variables used in libdiff, + to permit repeated calls to diff_run. */ + +static void +initialize_main (argcp, argvp) + int *argcp; + char ***argvp; +{ + /* These variables really must be reset each time diff_run is called. */ + output_style = OUTPUT_NORMAL; + context = -1; + file_label[0] = NULL; + file_label[1] = NULL; + diff_program_name = (*argvp)[0]; + outfile = NULL; + + /* Reset these also, just for safety's sake. (If one invocation turns + on ignore_case_flag, it must be turned off before diff_run is called + again. But it is possible to make many diffs before encountering + such a problem. */ + recursive = 0; + no_discards = 0; +#if HAVE_SETMODE + binary_I_O = 0; +#endif + no_diff_means_no_output = 0; + always_text_flag = 0; + horizon_lines = 0; + ignore_space_change_flag = 0; + ignore_all_space_flag = 0; + ignore_blank_lines_flag = 0; + ignore_some_line_changes = 0; + ignore_some_changes = 0; + ignore_case_flag = 0; + function_regexp_list = NULL; + ignore_regexp_list = NULL; + no_details_flag = 0; + print_file_same_flag = 0; + tab_align_flag = 0; + tab_expand_flag = 0; + dir_start_file = NULL; + entire_new_file_flag = 0; + unidirectional_new_file_flag = 0; + paginate_flag = 0; + bzero (group_format, sizeof (group_format)); + bzero (line_format, sizeof (line_format)); + sdiff_help_sdiff = 0; + sdiff_left_only = 0; + sdiff_skip_common_lines = 0; + sdiff_half_width = 0; + sdiff_column2_offset = 0; + switch_string = NULL; + heuristic = 0; + bzero (files, sizeof (files)); +} diff --git a/gnu/usr.bin/cvs/diff/diff.h b/gnu/usr.bin/cvs/diff/diff.h new file mode 100644 index 00000000000..fba26a7bf07 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/diff.h @@ -0,0 +1,345 @@ +/* Shared definitions for GNU DIFF + Copyright (C) 1988, 89, 91, 92, 93, 97 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "system.h" +#include <stdio.h> +#include <setjmp.h> +#include "regex.h" + +#define TAB_WIDTH 8 + +/* Variables for command line options */ + +#ifndef GDIFF_MAIN +#define EXTERN extern +#else +#define EXTERN +#endif + +enum output_style { + /* Default output style. */ + OUTPUT_NORMAL, + /* Output the differences with lines of context before and after (-c). */ + OUTPUT_CONTEXT, + /* Output the differences in a unified context diff format (-u). */ + OUTPUT_UNIFIED, + /* Output the differences as commands suitable for `ed' (-e). */ + OUTPUT_ED, + /* Output the diff as a forward ed script (-f). */ + OUTPUT_FORWARD_ED, + /* Like -f, but output a count of changed lines in each "command" (-n). */ + OUTPUT_RCS, + /* Output merged #ifdef'd file (-D). */ + OUTPUT_IFDEF, + /* Output sdiff style (-y). */ + OUTPUT_SDIFF +}; + +/* True for output styles that are robust, + i.e. can handle a file that ends in a non-newline. */ +#define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED) + +EXTERN enum output_style output_style; + +/* Nonzero if output cannot be generated for identical files. */ +EXTERN int no_diff_means_no_output; + +/* Number of lines of context to show in each set of diffs. + This is zero when context is not to be shown. */ +EXTERN int context; + +/* Consider all files as text files (-a). + Don't interpret codes over 0177 as implying a "binary file". */ +EXTERN int always_text_flag; + +/* Number of lines to keep in identical prefix and suffix. */ +EXTERN int horizon_lines; + +/* Ignore changes in horizontal white space (-b). */ +EXTERN int ignore_space_change_flag; + +/* Ignore all horizontal white space (-w). */ +EXTERN int ignore_all_space_flag; + +/* Ignore changes that affect only blank lines (-B). */ +EXTERN int ignore_blank_lines_flag; + +/* 1 if lines may match even if their contents do not match exactly. + This depends on various options. */ +EXTERN int ignore_some_line_changes; + +/* 1 if files may match even if their contents are not byte-for-byte identical. + This depends on various options. */ +EXTERN int ignore_some_changes; + +/* Ignore differences in case of letters (-i). */ +EXTERN int ignore_case_flag; + +/* File labels for `-c' output headers (-L). */ +EXTERN char *file_label[2]; + +struct regexp_list +{ + struct re_pattern_buffer buf; + struct regexp_list *next; +}; + +/* Regexp to identify function-header lines (-F). */ +EXTERN struct regexp_list *function_regexp_list; + +/* Ignore changes that affect only lines matching this regexp (-I). */ +EXTERN struct regexp_list *ignore_regexp_list; + +/* Say only whether files differ, not how (-q). */ +EXTERN int no_details_flag; + +/* Report files compared that match (-s). + Normally nothing is output when that happens. */ +EXTERN int print_file_same_flag; + +/* Output the differences with exactly 8 columns added to each line + so that any tabs in the text line up properly (-T). */ +EXTERN int tab_align_flag; + +/* Expand tabs in the output so the text lines up properly + despite the characters added to the front of each line (-t). */ +EXTERN int tab_expand_flag; + +/* In directory comparison, specify file to start with (-S). + All file names less than this name are ignored. */ +EXTERN char *dir_start_file; + +/* If a file is new (appears in only one dir) + include its entire contents (-N). + Then `patch' would create the file with appropriate contents. */ +EXTERN int entire_new_file_flag; + +/* If a file is new (appears in only the second dir) + include its entire contents (-P). + Then `patch' would create the file with appropriate contents. */ +EXTERN int unidirectional_new_file_flag; + +/* Pipe each file's output through pr (-l). */ +EXTERN int paginate_flag; + +enum line_class { + /* Lines taken from just the first file. */ + OLD, + /* Lines taken from just the second file. */ + NEW, + /* Lines common to both files. */ + UNCHANGED, + /* A hunk containing both old and new lines (line groups only). */ + CHANGED +}; + +/* Line group formats for old, new, unchanged, and changed groups. */ +EXTERN char *group_format[CHANGED + 1]; + +/* Line formats for old, new, and unchanged lines. */ +EXTERN char *line_format[UNCHANGED + 1]; + +/* If using OUTPUT_SDIFF print extra information to help the sdiff filter. */ +EXTERN int sdiff_help_sdiff; + +/* Tell OUTPUT_SDIFF to show only the left version of common lines. */ +EXTERN int sdiff_left_only; + +/* Tell OUTPUT_SDIFF to not show common lines. */ +EXTERN int sdiff_skip_common_lines; + +/* The half line width and column 2 offset for OUTPUT_SDIFF. */ +EXTERN unsigned sdiff_half_width; +EXTERN unsigned sdiff_column2_offset; + +/* String containing all the command options diff received, + with spaces between and at the beginning but none at the end. + If there were no options given, this string is empty. */ +EXTERN char * switch_string; + +/* Nonzero means use heuristics for better speed. */ +EXTERN int heuristic; + +/* Name of program the user invoked (for error messages). */ +EXTERN char *diff_program_name; + +/* Jump buffer for nonlocal exits. */ +EXTERN jmp_buf diff_abort_buf; +#define DIFF_ABORT(retval) longjmp(diff_abort_buf, retval) + +/* The result of comparison is an "edit script": a chain of `struct change'. + Each `struct change' represents one place where some lines are deleted + and some are inserted. + + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + +struct change +{ + struct change *link; /* Previous or next edit command */ + int inserted; /* # lines of file 1 changed here. */ + int deleted; /* # lines of file 0 changed here. */ + int line0; /* Line number of 1st deleted line. */ + int line1; /* Line number of 1st inserted line. */ + char ignore; /* Flag used in context.c */ +}; + +/* Structures that describe the input files. */ + +/* Data on one input file being compared. */ + +struct file_data { + int desc; /* File descriptor */ + char const *name; /* File name */ + struct stat stat; /* File status from fstat() */ + int dir_p; /* nonzero if file is a directory */ + + /* Buffer in which text of file is read. */ + char * buffer; + /* Allocated size of buffer. */ + size_t bufsize; + /* Number of valid characters now in the buffer. */ + size_t buffered_chars; + + /* Array of pointers to lines in the file. */ + char const **linbuf; + + /* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines. + linebuf[linbuf_base ... buffered_lines - 1] are possibly differing. + linebuf[linbuf_base ... valid_lines - 1] contain valid data. + linebuf[linbuf_base ... alloc_lines - 1] are allocated. */ + int linbuf_base, buffered_lines, valid_lines, alloc_lines; + + /* Pointer to end of prefix of this file to ignore when hashing. */ + char const *prefix_end; + + /* Count of lines in the prefix. + There are this many lines in the file before linbuf[0]. */ + int prefix_lines; + + /* Pointer to start of suffix of this file to ignore when hashing. */ + char const *suffix_begin; + + /* Vector, indexed by line number, containing an equivalence code for + each line. It is this vector that is actually compared with that + of another file to generate differences. */ + int *equivs; + + /* Vector, like the previous one except that + the elements for discarded lines have been squeezed out. */ + int *undiscarded; + + /* Vector mapping virtual line numbers (not counting discarded lines) + to real ones (counting those lines). Both are origin-0. */ + int *realindexes; + + /* Total number of nondiscarded lines. */ + int nondiscarded_lines; + + /* Vector, indexed by real origin-0 line number, + containing 1 for a line that is an insertion or a deletion. + The results of comparison are stored here. */ + char *changed_flag; + + /* 1 if file ends in a line with no final newline. */ + int missing_newline; + + /* 1 more than the maximum equivalence value used for this or its + sibling file. */ + int equiv_max; +}; + +/* Describe the two files currently being compared. */ + +EXTERN struct file_data files[2]; + +/* Stdio stream to output diffs to. */ + +EXTERN FILE *outfile; + +/* Declare various functions. */ + +/* analyze.c */ +int diff_2_files PARAMS((struct file_data[], int)); + +/* context.c */ +void print_context_header PARAMS((struct file_data[], int)); +void print_context_script PARAMS((struct change *, int)); + +/* diff.c */ +int excluded_filename PARAMS((char const *)); + +/* dir.c */ +int diff_dirs PARAMS((struct file_data const[], int (*) PARAMS((char const *, char const *, char const *, char const *, int)), int)); + +/* ed.c */ +void print_ed_script PARAMS((struct change *)); +void pr_forward_ed_script PARAMS((struct change *)); + +/* ifdef.c */ +void print_ifdef_script PARAMS((struct change *)); + +/* io.c */ +int read_files PARAMS((struct file_data[], int)); +int sip PARAMS((struct file_data *, int)); +void slurp PARAMS((struct file_data *)); + +/* normal.c */ +void print_normal_script PARAMS((struct change *)); + +/* rcs.c */ +void print_rcs_script PARAMS((struct change *)); + +/* side.c */ +void print_sdiff_script PARAMS((struct change *)); + +/* util.c */ +VOID *xmalloc PARAMS((size_t)); +VOID *xrealloc PARAMS((VOID *, size_t)); +char *concat PARAMS((char const *, char const *, char const *)); +char *dir_file_pathname PARAMS((char const *, char const *)); +int change_letter PARAMS((int, int)); +int line_cmp PARAMS((char const *, char const *)); +int translate_line_number PARAMS((struct file_data const *, int)); +struct change *find_change PARAMS((struct change *)); +struct change *find_reverse_change PARAMS((struct change *)); +void analyze_hunk PARAMS((struct change *, int *, int *, int *, int *, int *, int *)); +void begin_output PARAMS((void)); +void debug_script PARAMS((struct change *)); +void diff_error PARAMS((char const *, char const *, char const *)); +void fatal PARAMS((char const *)); +void finish_output PARAMS((void)); +void message PARAMS((char const *, char const *, char const *)); +void message5 PARAMS((char const *, char const *, char const *, char const *, char const *)); +void output_1_line PARAMS((char const *, char const *, char const *, char const *)); +void perror_with_name PARAMS((char const *)); +void pfatal_with_name PARAMS((char const *)); +void print_1_line PARAMS((char const *, char const * const *)); +void print_message_queue PARAMS((void)); +void print_number_range PARAMS((int, struct file_data *, int, int)); +void print_script PARAMS((struct change *, struct change * (*) PARAMS((struct change *)), void (*) PARAMS((struct change *)))); +void setup_output PARAMS((char const *, char const *, int)); +void translate_range PARAMS((struct file_data const *, int, int, int *, int *)); + +/* version.c */ +extern char const diff_version_string[]; diff --git a/gnu/usr.bin/cvs/diff/diff3.c b/gnu/usr.bin/cvs/diff/diff3.c new file mode 100644 index 00000000000..533214c436b --- /dev/null +++ b/gnu/usr.bin/cvs/diff/diff3.c @@ -0,0 +1,1809 @@ +/* Three way file comparison program (diff3) for Project GNU. + Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + + This program 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. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Written by Randy Smith */ +/* Librarification by Tim Pierce */ + +#include "system.h" +#include <stdio.h> +#include <setjmp.h> +#include "getopt.h" + +/* diff3.c has a real initialize_main function. */ +#ifdef initialize_main +#undef initialize_main +#endif + +extern char const diff_version_string[]; + +/* + * Internal data structures and macros for the diff3 program; includes + * data structures for both diff3 diffs and normal diffs. + */ + +/* Different files within a three way diff. */ +#define FILE0 0 +#define FILE1 1 +#define FILE2 2 + +/* + * A three way diff is built from two two-way diffs; the file which + * the two two-way diffs share is: + */ +#define FILEC FILE2 + +/* + * Different files within a two way diff. + * FC is the common file, FO the other file. + */ +#define FO 0 +#define FC 1 + +/* The ranges are indexed by */ +#define START 0 +#define END 1 + +enum diff_type { + ERROR, /* Should not be used */ + ADD, /* Two way diff add */ + CHANGE, /* Two way diff change */ + DELETE, /* Two way diff delete */ + DIFF_ALL, /* All three are different */ + DIFF_1ST, /* Only the first is different */ + DIFF_2ND, /* Only the second */ + DIFF_3RD /* Only the third */ +}; + +/* Two way diff */ +struct diff_block { + int ranges[2][2]; /* Ranges are inclusive */ + char **lines[2]; /* The actual lines (may contain nulls) */ + size_t *lengths[2]; /* Line lengths (including newlines, if any) */ + struct diff_block *next; +}; + +/* Three way diff */ + +struct diff3_block { + enum diff_type correspond; /* Type of diff */ + int ranges[3][2]; /* Ranges are inclusive */ + char **lines[3]; /* The actual lines (may contain nulls) */ + size_t *lengths[3]; /* Line lengths (including newlines, if any) */ + struct diff3_block *next; +}; + +/* + * Access the ranges on a diff block. + */ +#define D_LOWLINE(diff, filenum) \ + ((diff)->ranges[filenum][START]) +#define D_HIGHLINE(diff, filenum) \ + ((diff)->ranges[filenum][END]) +#define D_NUMLINES(diff, filenum) \ + (D_HIGHLINE (diff, filenum) - D_LOWLINE (diff, filenum) + 1) + +/* + * Access the line numbers in a file in a diff by relative line + * numbers (i.e. line number within the diff itself). Note that these + * are lvalues and can be used for assignment. + */ +#define D_RELNUM(diff, filenum, linenum) \ + ((diff)->lines[filenum][linenum]) +#define D_RELLEN(diff, filenum, linenum) \ + ((diff)->lengths[filenum][linenum]) + +/* + * And get at them directly, when that should be necessary. + */ +#define D_LINEARRAY(diff, filenum) \ + ((diff)->lines[filenum]) +#define D_LENARRAY(diff, filenum) \ + ((diff)->lengths[filenum]) + +/* + * Next block. + */ +#define D_NEXT(diff) ((diff)->next) + +/* + * Access the type of a diff3 block. + */ +#define D3_TYPE(diff) ((diff)->correspond) + +/* + * Line mappings based on diffs. The first maps off the top of the + * diff, the second off of the bottom. + */ +#define D_HIGH_MAPLINE(diff, fromfile, tofile, lineno) \ + ((lineno) \ + - D_HIGHLINE ((diff), (fromfile)) \ + + D_HIGHLINE ((diff), (tofile))) + +#define D_LOW_MAPLINE(diff, fromfile, tofile, lineno) \ + ((lineno) \ + - D_LOWLINE ((diff), (fromfile)) \ + + D_LOWLINE ((diff), (tofile))) + +/* + * General memory allocation function. + */ +#define ALLOCATE(number, type) \ + (type *) xmalloc ((number) * sizeof (type)) + +/* Options variables for flags set on command line. */ + +/* If nonzero, treat all files as text files, never as binary. */ +static int always_text; + +/* If nonzero, write out an ed script instead of the standard diff3 format. */ +static int edscript; + +/* If nonzero, in the case of overlapping diffs (type DIFF_ALL), + preserve the lines which would normally be deleted from + file 1 with a special flagging mechanism. */ +static int flagging; + +/* Number of lines to keep in identical prefix and suffix. */ +static int horizon_lines = 10; + +/* Use a tab to align output lines (-T). */ +static int tab_align_flag; + +/* If nonzero, do not output information for overlapping diffs. */ +static int simple_only; + +/* If nonzero, do not output information for non-overlapping diffs. */ +static int overlap_only; + +/* If nonzero, show information for DIFF_2ND diffs. */ +static int show_2nd; + +/* If nonzero, include `:wq' at the end of the script + to write out the file being edited. */ +static int finalwrite; + +/* If nonzero, output a merged file. */ +static int merge; + +extern char *diff_program_name; + +static char *read_diff PARAMS((char const *, char const *, char **)); +static char *scan_diff_line PARAMS((char *, char **, size_t *, char *, int)); +static enum diff_type process_diff_control PARAMS((char **, struct diff_block *)); +static int compare_line_list PARAMS((char * const[], size_t const[], char * const[], size_t const[], int)); +static int copy_stringlist PARAMS((char * const[], size_t const[], char *[], size_t[], int)); +static int dotlines PARAMS((FILE *, struct diff3_block *, int)); +static int output_diff3_edscript PARAMS((FILE *, struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *)); +static int output_diff3_merge PARAMS((FILE *, FILE *, struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *)); +static size_t myread PARAMS((int, char *, size_t)); +static struct diff3_block *create_diff3_block PARAMS((int, int, int, int, int, int)); +static struct diff3_block *make_3way_diff PARAMS((struct diff_block *, struct diff_block *)); +static struct diff3_block *reverse_diff3_blocklist PARAMS((struct diff3_block *)); +static struct diff3_block *using_to_diff3_block PARAMS((struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block const *)); +static struct diff_block *process_diff PARAMS((char const *, char const *, struct diff_block **, char **)); +static void check_output PARAMS((FILE *)); +static void diff3_fatal PARAMS((char const *)); +static void output_diff3 PARAMS((FILE *, struct diff3_block *, int const[3], int const[3])); +static void diff3_perror_with_exit PARAMS((char const *)); +static int try_help PARAMS((char const *)); +static void undotlines PARAMS((FILE *, int, int, int)); +static void usage PARAMS((void)); +static void initialize_main PARAMS((int *, char ***)); +static void free_diff_blocks PARAMS((struct diff_block *)); +static void free_diff3_blocks PARAMS((struct diff3_block *)); + +/* Functions provided in libdiff.a or other external sources. */ +int diff_run PARAMS((int, char **, char *)); +VOID *xmalloc PARAMS((size_t)); +VOID *xrealloc PARAMS((VOID *, size_t)); +void perror_with_name PARAMS((char const *)); +void diff_error PARAMS((char const *, char const *, char const *)); + +/* Permit non-local exits from diff3. */ +static jmp_buf diff3_abort_buf; +#define DIFF3_ABORT(retval) longjmp(diff3_abort_buf, retval) + +static struct option const longopts[] = +{ + {"text", 0, 0, 'a'}, + {"show-all", 0, 0, 'A'}, + {"ed", 0, 0, 'e'}, + {"show-overlap", 0, 0, 'E'}, + {"label", 1, 0, 'L'}, + {"merge", 0, 0, 'm'}, + {"initial-tab", 0, 0, 'T'}, + {"overlap-only", 0, 0, 'x'}, + {"easy-only", 0, 0, '3'}, + {"version", 0, 0, 'v'}, + {"help", 0, 0, 129}, + {0, 0, 0, 0} +}; + +/* + * Main program. Calls diff twice on two pairs of input files, + * combines the two diffs, and outputs them. + */ +int +diff3_run (argc, argv, outfile) + int argc; + char **argv; + char *outfile; +{ + int c, i; + int mapping[3]; + int rev_mapping[3]; + int incompat = 0; + int conflicts_found; + int status; + struct diff_block *thread0, *thread1, *last_block; + char *content0, *content1; + struct diff3_block *diff3; + int tag_count = 0; + char *tag_strings[3]; + char *commonname; + char **file; + struct stat statb; + int optind_old; + FILE *outstream; + + initialize_main (&argc, &argv); + + optind_old = optind; + optind = 0; + while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != EOF) + { + switch (c) + { + case 'a': + always_text = 1; + break; + case 'A': + show_2nd = 1; + flagging = 1; + incompat++; + break; + case 'x': + overlap_only = 1; + incompat++; + break; + case '3': + simple_only = 1; + incompat++; + break; + case 'i': + finalwrite = 1; + break; + case 'm': + merge = 1; + break; + case 'X': + overlap_only = 1; + /* Falls through */ + case 'E': + flagging = 1; + /* Falls through */ + case 'e': + incompat++; + break; + case 'T': + tab_align_flag = 1; + break; + case 'v': + printf ("diff3 - GNU diffutils version %s\n", diff_version_string); + return 0; + case 129: + usage (); + check_output (stdout); + return 0; + case 'L': + /* Handle up to three -L options. */ + if (tag_count < 3) + { + tag_strings[tag_count++] = optarg; + break; + } + return try_help ("Too many labels were given. The limit is 3."); + default: + return try_help (0); + } + } + + edscript = incompat & ~merge; /* -AeExX3 without -m implies ed script. */ + show_2nd |= ~incompat & merge; /* -m without -AeExX3 implies -A. */ + flagging |= ~incompat & merge; + + if (incompat > 1 /* Ensure at most one of -AeExX3. */ + || finalwrite & merge /* -i -m would rewrite input file. */ + || (tag_count && ! flagging)) /* -L requires one of -AEX. */ + return try_help ("incompatible options"); + + if (argc - optind != 3) + return try_help (argc - optind < 3 ? "missing operand" : "extra operand"); + + file = &argv[optind]; + + optind = optind_old; + + for (i = tag_count; i < 3; i++) + tag_strings[i] = file[i]; + + /* Always compare file1 to file2, even if file2 is "-". + This is needed for -mAeExX3. Using the file0 as + the common file would produce wrong results, because if the + 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. */ + + 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; + } + + for (i = 0; i < 3; i++) + rev_mapping[mapping[i]] = i; + + for (i = 0; i < 3; i++) + if (strcmp (file[i], "-") != 0) + { + if (stat (file[i], &statb) < 0) + { + perror_with_name (file[i]); + return 2; + } + else if (S_ISDIR(statb.st_mode)) + { + fprintf (stderr, "%s: %s: Is a directory\n", + diff_program_name, file[i]); + return 2; + } + } + + if (outfile == NULL) + outstream = stdout; + else + { + outstream = fopen (outfile, "w"); + if (outstream == NULL) + { + perror_with_name ("could not open output file"); + return 2; + } + } + + /* Set the jump buffer, so that diff may abort execution without + terminating the process. */ + status = setjmp (diff3_abort_buf); + if (status != 0) + return status; + + commonname = file[rev_mapping[FILEC]]; + thread1 = process_diff (file[rev_mapping[FILE1]], commonname, &last_block, + &content1); + 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); + if (edscript) + conflicts_found + = output_diff3_edscript (outstream, diff3, mapping, rev_mapping, + tag_strings[0], tag_strings[1], tag_strings[2]); + else if (merge) + { + if (! freopen (file[rev_mapping[FILE0]], "r", stdin)) + diff3_perror_with_exit (file[rev_mapping[FILE0]]); + conflicts_found + = output_diff3_merge (stdin, outstream, diff3, mapping, rev_mapping, + tag_strings[0], tag_strings[1], tag_strings[2]); + if (ferror (stdin)) + diff3_fatal ("read error"); + } + else + { + output_diff3 (outstream, diff3, mapping, rev_mapping); + conflicts_found = 0; + } + + free(content0); + free(content1); + free_diff_blocks(thread0); + free_diff_blocks(thread1); + free_diff3_blocks(diff3); + + check_output (outstream); + if (outstream != stdout) + if (fclose (outstream) != 0) + perror ("close error on output file"); + return conflicts_found; +} + +static int +try_help (reason) + char const *reason; +{ + if (reason) + fprintf (stderr, "%s: %s\n", diff_program_name, reason); + fprintf (stderr, "%s: Try `%s --help' for more information.\n", + diff_program_name, diff_program_name); + return 2; +} + +static void +check_output (stream) + FILE *stream; +{ + if (ferror (stream) || fflush (stream) != 0) + diff3_fatal ("write error"); +} + +/* + * Explain, patiently and kindly, how to use this program. + */ +static void +usage () +{ + printf ("Usage: %s [OPTION]... MYFILE OLDFILE YOURFILE\n\n", diff_program_name); + + printf ("%s", "\ + -e --ed Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\ + -E --show-overlap Output unmerged changes, bracketing conflicts.\n\ + -A --show-all Output all changes, bracketing conflicts.\n\ + -x --overlap-only Output overlapping changes.\n\ + -X Output overlapping changes, bracketing them.\n\ + -3 --easy-only Output unmerged nonoverlapping changes.\n\n"); + printf ("%s", "\ + -m --merge Output merged file instead of ed script (default -A).\n\ + -L LABEL --label=LABEL Use LABEL instead of file name.\n\ + -i Append `w' and `q' commands to ed scripts.\n\ + -a --text Treat all files as text.\n\ + -T --initial-tab Make tabs line up by prepending a tab.\n\n"); + printf ("%s", "\ + -v --version Output version info.\n\ + --help Output this help.\n\n"); + printf ("If a FILE is `-', read standard input.\n"); +} + +/* + * Routines that combine the two diffs together into one. The + * algorithm used follows: + * + * File2 is shared in common between the two diffs. + * Diff02 is the diff between 0 and 2. + * Diff12 is the diff between 1 and 2. + * + * 1) Find the range for the first block in File2. + * a) Take the lowest of the two ranges (in File2) in the two + * current blocks (one from each diff) as being the low + * water mark. Assign the upper end of this block as + * being the high water mark and move the current block up + * one. Mark the block just moved over as to be used. + * b) Check the next block in the diff that the high water + * mark is *not* from. + * + * *If* the high water mark is above + * the low end of the range in that block, + * + * mark that block as to be used and move the current + * block up. Set the high water mark to the max of + * the high end of this block and the current. Repeat b. + * + * 2) Find the corresponding ranges in File0 (from the blocks + * in diff02; line per line outside of diffs) and in File1. + * Create a diff3_block, reserving space as indicated by the ranges. + * + * 3) Copy all of the pointers for file2 in. At least for now, + * do memcmp's between corresponding strings in the two diffs. + * + * 4) Copy all of the pointers for file0 and 1 in. Get what you + * need from file2 (when there isn't a diff block, it's + * identical to file2 within the range between diff blocks). + * + * 5) If the diff blocks you used came from only one of the two + * strings of diffs, then that file (i.e. the one other than + * the common file in that diff) is the odd person out. If you used + * diff blocks from both sets, check to see if files 0 and 1 match: + * + * Same number of lines? If so, do a set of memcmp's (if a + * memcmp matches; copy the pointer over; it'll be easier later + * if you have to do any compares). If they match, 0 & 1 are + * the same. If not, all three different. + * + * Then you do it again, until you run out of blocks. + * + */ + +/* + * This routine makes a three way diff (chain of diff3_block's) from two + * two way diffs (chains of diff_block's). It is assumed that each of + * the two diffs passed are onto the same file (i.e. that each of the + * diffs were made "to" the same file). The three way diff pointer + * returned will have numbering FILE0--the other file in diff02, + * FILE1--the other file in diff12, and FILEC--the common file. + */ +static struct diff3_block * +make_3way_diff (thread0, thread1) + struct diff_block *thread0, *thread1; +{ +/* + * This routine works on the two diffs passed to it as threads. + * Thread number 0 is diff02, thread number 1 is diff12. The USING + * array is set to the base of the list of blocks to be used to + * construct each block of the three way diff; if no blocks from a + * particular thread are to be used, that element of the using array + * is set to 0. The elements LAST_USING array are set to the last + * elements on each of the using lists. + * + * The HIGH_WATER_MARK is set to the highest line number in the common file + * described in any of the diffs in either of the USING lists. The + * HIGH_WATER_THREAD names the thread. Similarly the BASE_WATER_MARK + * and BASE_WATER_THREAD describe the lowest line number in the common file + * described in any of the diffs in either of the USING lists. The + * HIGH_WATER_DIFF is the diff from which the HIGH_WATER_MARK was + * taken. + * + * The HIGH_WATER_DIFF should always be equal to LAST_USING + * [HIGH_WATER_THREAD]. The OTHER_DIFF is the next diff to check for + * higher water, and should always be equal to + * CURRENT[HIGH_WATER_THREAD ^ 0x1]. The OTHER_THREAD is the thread + * in which the OTHER_DIFF is, and hence should always be equal to + * HIGH_WATER_THREAD ^ 0x1. + * + * The variable LAST_DIFF is kept set to the last diff block produced + * by this routine, for line correspondence purposes between that diff + * and the one currently being worked on. It is initialized to + * ZERO_DIFF before any blocks have been created. + */ + + struct diff_block + *using[2], + *last_using[2], + *current[2]; + + int + high_water_mark; + + int + high_water_thread, + base_water_thread, + other_thread; + + struct diff_block + *high_water_diff, + *other_diff; + + struct diff3_block + *result, + *tmpblock, + **result_end; + + struct diff3_block const *last_diff3; + + static struct diff3_block const zero_diff3; + + /* Initialization */ + result = 0; + result_end = &result; + current[0] = thread0; current[1] = thread1; + last_diff3 = &zero_diff3; + + /* Sniff up the threads until we reach the end */ + + while (current[0] || current[1]) + { + using[0] = using[1] = last_using[0] = last_using[1] = 0; + + /* Setup low and high water threads, diffs, and marks. */ + if (!current[0]) + base_water_thread = 1; + else if (!current[1]) + base_water_thread = 0; + else + base_water_thread = + (D_LOWLINE (current[0], FC) > D_LOWLINE (current[1], FC)); + + high_water_thread = base_water_thread; + + high_water_diff = current[high_water_thread]; + +#if 0 + /* low and high waters start off same diff */ + base_water_mark = D_LOWLINE (high_water_diff, FC); +#endif + + high_water_mark = D_HIGHLINE (high_water_diff, FC); + + /* Make the diff you just got info from into the using class */ + using[high_water_thread] + = last_using[high_water_thread] + = high_water_diff; + current[high_water_thread] = high_water_diff->next; + last_using[high_water_thread]->next = 0; + + /* And mark the other diff */ + other_thread = high_water_thread ^ 0x1; + other_diff = current[other_thread]; + + /* Shuffle up the ladder, checking the other diff to see if it + needs to be incorporated. */ + while (other_diff + && D_LOWLINE (other_diff, FC) <= high_water_mark + 1) + { + + /* Incorporate this diff into the using list. Note that + this doesn't take it off the current list */ + if (using[other_thread]) + last_using[other_thread]->next = other_diff; + else + using[other_thread] = other_diff; + last_using[other_thread] = other_diff; + + /* Take it off the current list. Note that this following + code assumes that other_diff enters it equal to + current[high_water_thread ^ 0x1] */ + current[other_thread] = current[other_thread]->next; + other_diff->next = 0; + + /* Set the high_water stuff + If this comparison is equal, then this is the last pass + through this loop; since diff blocks within a given + thread cannot overlap, the high_water_mark will be + *below* the range_start of either of the next diffs. */ + + if (high_water_mark < D_HIGHLINE (other_diff, FC)) + { + high_water_thread ^= 1; + high_water_diff = other_diff; + high_water_mark = D_HIGHLINE (other_diff, FC); + } + + /* Set the other diff */ + other_thread = high_water_thread ^ 0x1; + other_diff = current[other_thread]; + } + + /* The using lists contain a list of all of the blocks to be + included in this diff3_block. Create it. */ + + tmpblock = using_to_diff3_block (using, last_using, + base_water_thread, high_water_thread, + last_diff3); + + if (!tmpblock) + diff3_fatal ("internal error: screwup in format of diff blocks"); + + /* Put it on the list. */ + *result_end = tmpblock; + result_end = &tmpblock->next; + + /* Set up corresponding lines correctly. */ + last_diff3 = tmpblock; + } + return result; +} + +/* + * using_to_diff3_block: + * This routine takes two lists of blocks (from two separate diff + * threads) and puts them together into one diff3 block. + * It then returns a pointer to this diff3 block or 0 for failure. + * + * All arguments besides using are for the convenience of the routine; + * they could be derived from the using array. + * LAST_USING is a pair of pointers to the last blocks in the using + * structure. + * LOW_THREAD and HIGH_THREAD tell which threads contain the lowest + * and highest line numbers for File0. + * last_diff3 contains the last diff produced in the calling routine. + * This is used for lines mappings which would still be identical to + * the state that diff ended in. + * + * A distinction should be made in this routine between the two diffs + * that are part of a normal two diff block, and the three diffs that + * are part of a diff3_block. + */ +static struct diff3_block * +using_to_diff3_block (using, last_using, low_thread, high_thread, last_diff3) + struct diff_block + *using[2], + *last_using[2]; + int low_thread, high_thread; + struct diff3_block const *last_diff3; +{ + int low[2], high[2]; + struct diff3_block *result; + struct diff_block *ptr; + int d, i; + + /* Find the range in the common file. */ + int lowc = D_LOWLINE (using[low_thread], FC); + int highc = D_HIGHLINE (last_using[high_thread], FC); + + /* Find the ranges in the other files. + If using[d] is null, that means that the file to which that diff + refers is equivalent to the common file over this range. */ + + for (d = 0; d < 2; d++) + if (using[d]) + { + low[d] = D_LOW_MAPLINE (using[d], FC, FO, lowc); + high[d] = D_HIGH_MAPLINE (last_using[d], FC, FO, highc); + } + else + { + low[d] = D_HIGH_MAPLINE (last_diff3, FILEC, FILE0 + d, lowc); + high[d] = D_HIGH_MAPLINE (last_diff3, FILEC, FILE0 + d, highc); + } + + /* Create a block with the appropriate sizes */ + result = create_diff3_block (low[0], high[0], low[1], high[1], lowc, highc); + + /* Copy information for the common file. + Return with a zero if any of the compares failed. */ + + for (d = 0; d < 2; d++) + for (ptr = using[d]; ptr; ptr = D_NEXT (ptr)) + { + int result_offset = D_LOWLINE (ptr, FC) - lowc; + + if (!copy_stringlist (D_LINEARRAY (ptr, FC), + D_LENARRAY (ptr, FC), + D_LINEARRAY (result, FILEC) + result_offset, + D_LENARRAY (result, FILEC) + result_offset, + D_NUMLINES (ptr, FC))) + return 0; + } + + /* Copy information for file d. First deal with anything that might be + before the first diff. */ + + for (d = 0; d < 2; d++) + { + struct diff_block *u = using[d]; + int lo = low[d], hi = high[d]; + + for (i = 0; + i + lo < (u ? D_LOWLINE (u, FO) : hi + 1); + i++) + { + D_RELNUM (result, FILE0 + d, i) = D_RELNUM (result, FILEC, i); + D_RELLEN (result, FILE0 + d, i) = D_RELLEN (result, FILEC, i); + } + + for (ptr = u; ptr; ptr = D_NEXT (ptr)) + { + int result_offset = D_LOWLINE (ptr, FO) - lo; + int linec; + + if (!copy_stringlist (D_LINEARRAY (ptr, FO), + D_LENARRAY (ptr, FO), + D_LINEARRAY (result, FILE0 + d) + result_offset, + D_LENARRAY (result, FILE0 + d) + result_offset, + D_NUMLINES (ptr, FO))) + return 0; + + /* Catch the lines between here and the next diff */ + linec = D_HIGHLINE (ptr, FC) + 1 - lowc; + for (i = D_HIGHLINE (ptr, FO) + 1 - lo; + i < (D_NEXT (ptr) ? D_LOWLINE (D_NEXT (ptr), FO) : hi + 1) - lo; + i++) + { + D_RELNUM (result, FILE0 + d, i) = D_RELNUM (result, FILEC, linec); + D_RELLEN (result, FILE0 + d, i) = D_RELLEN (result, FILEC, linec); + linec++; + } + } + } + + /* Set correspond */ + if (!using[0]) + D3_TYPE (result) = DIFF_2ND; + else if (!using[1]) + D3_TYPE (result) = DIFF_1ST; + else + { + int nl0 = D_NUMLINES (result, FILE0); + int nl1 = D_NUMLINES (result, FILE1); + + if (nl0 != nl1 + || !compare_line_list (D_LINEARRAY (result, FILE0), + D_LENARRAY (result, FILE0), + D_LINEARRAY (result, FILE1), + D_LENARRAY (result, FILE1), + nl0)) + D3_TYPE (result) = DIFF_ALL; + else + D3_TYPE (result) = DIFF_3RD; + } + + return result; +} + +/* + * This routine copies pointers from a list of strings to a different list + * of strings. If a spot in the second list is already filled, it + * makes sure that it is filled with the same string; if not it + * returns 0, the copy incomplete. + * Upon successful completion of the copy, it returns 1. + */ +static int +copy_stringlist (fromptrs, fromlengths, toptrs, tolengths, copynum) + char * const fromptrs[]; + char *toptrs[]; + size_t const fromlengths[]; + size_t tolengths[]; + int copynum; +{ + register char * const *f = fromptrs; + register char **t = toptrs; + register size_t const *fl = fromlengths; + register size_t *tl = tolengths; + + while (copynum--) + { + if (*t) + { if (*fl != *tl || memcmp (*f, *t, *fl)) return 0; } + else + { *t = *f ; *tl = *fl; } + + t++; f++; tl++; fl++; + } + return 1; +} + +/* + * Create a diff3_block, with ranges as specified in the arguments. + * Allocate the arrays for the various pointers (and zero them) based + * on the arguments passed. Return the block as a result. + */ +static struct diff3_block * +create_diff3_block (low0, high0, low1, high1, low2, high2) + register int low0, high0, low1, high1, low2, high2; +{ + struct diff3_block *result = ALLOCATE (1, struct diff3_block); + int numlines; + + D3_TYPE (result) = ERROR; + D_NEXT (result) = 0; + + /* Assign ranges */ + D_LOWLINE (result, FILE0) = low0; + D_HIGHLINE (result, FILE0) = high0; + D_LOWLINE (result, FILE1) = low1; + D_HIGHLINE (result, FILE1) = high1; + D_LOWLINE (result, FILE2) = low2; + D_HIGHLINE (result, FILE2) = high2; + + /* Allocate and zero space */ + numlines = D_NUMLINES (result, FILE0); + if (numlines) + { + D_LINEARRAY (result, FILE0) = ALLOCATE (numlines, char *); + D_LENARRAY (result, FILE0) = ALLOCATE (numlines, size_t); + bzero (D_LINEARRAY (result, FILE0), (numlines * sizeof (char *))); + bzero (D_LENARRAY (result, FILE0), (numlines * sizeof (size_t))); + } + else + { + D_LINEARRAY (result, FILE0) = 0; + D_LENARRAY (result, FILE0) = 0; + } + + numlines = D_NUMLINES (result, FILE1); + if (numlines) + { + D_LINEARRAY (result, FILE1) = ALLOCATE (numlines, char *); + D_LENARRAY (result, FILE1) = ALLOCATE (numlines, size_t); + bzero (D_LINEARRAY (result, FILE1), (numlines * sizeof (char *))); + bzero (D_LENARRAY (result, FILE1), (numlines * sizeof (size_t))); + } + else + { + D_LINEARRAY (result, FILE1) = 0; + D_LENARRAY (result, FILE1) = 0; + } + + numlines = D_NUMLINES (result, FILE2); + if (numlines) + { + D_LINEARRAY (result, FILE2) = ALLOCATE (numlines, char *); + D_LENARRAY (result, FILE2) = ALLOCATE (numlines, size_t); + bzero (D_LINEARRAY (result, FILE2), (numlines * sizeof (char *))); + bzero (D_LENARRAY (result, FILE2), (numlines * sizeof (size_t))); + } + else + { + D_LINEARRAY (result, FILE2) = 0; + D_LENARRAY (result, FILE2) = 0; + } + + /* Return */ + return result; +} + +/* + * Compare two lists of lines of text. + * Return 1 if they are equivalent, 0 if not. + */ +static int +compare_line_list (list1, lengths1, list2, lengths2, nl) + char * const list1[], * const list2[]; + size_t const lengths1[], lengths2[]; + int nl; +{ + char + * const *l1 = list1, + * const *l2 = list2; + size_t const + *lgths1 = lengths1, + *lgths2 = lengths2; + + while (nl--) + if (!*l1 || !*l2 || *lgths1 != *lgths2++ + || memcmp (*l1++, *l2++, *lgths1++)) + return 0; + return 1; +} + +/* + * Routines to input and parse two way diffs. + */ + +extern char **environ; + +static struct diff_block * +process_diff (filea, fileb, last_block, diff_contents) + char const *filea, *fileb; + struct diff_block **last_block; + char **diff_contents; +{ + char *diff_limit; + char *scan_diff; + enum diff_type dt; + int i; + struct diff_block *block_list, **block_list_end, *bptr; + + diff_limit = read_diff (filea, fileb, diff_contents); + scan_diff = *diff_contents; + block_list_end = &block_list; + bptr = 0; /* Pacify `gcc -W'. */ + + while (scan_diff < diff_limit) + { + bptr = ALLOCATE (1, struct diff_block); + bptr->lines[0] = bptr->lines[1] = 0; + bptr->lengths[0] = bptr->lengths[1] = 0; + + dt = process_diff_control (&scan_diff, bptr); + if (dt == ERROR || *scan_diff != '\n') + { + fprintf (stderr, "%s: diff error: ", diff_program_name); + do + { + putc (*scan_diff, stderr); + } + while (*scan_diff++ != '\n'); + DIFF3_ABORT (2); + } + scan_diff++; + + /* Force appropriate ranges to be null, if necessary */ + switch (dt) + { + case ADD: + bptr->ranges[0][0]++; + break; + case DELETE: + bptr->ranges[1][0]++; + break; + case CHANGE: + break; + default: + diff3_fatal ("internal error: invalid diff type in process_diff"); + break; + } + + /* Allocate space for the pointers for the lines from filea, and + parcel them out among these pointers */ + if (dt != ADD) + { + int numlines = D_NUMLINES (bptr, 0); + bptr->lines[0] = ALLOCATE (numlines, char *); + bptr->lengths[0] = ALLOCATE (numlines, size_t); + for (i = 0; i < numlines; i++) + scan_diff = scan_diff_line (scan_diff, + &(bptr->lines[0][i]), + &(bptr->lengths[0][i]), + diff_limit, + '<'); + } + + /* Get past the separator for changes */ + if (dt == CHANGE) + { + if (strncmp (scan_diff, "---\n", 4)) + diff3_fatal ("invalid diff format; invalid change separator"); + scan_diff += 4; + } + + /* Allocate space for the pointers for the lines from fileb, and + parcel them out among these pointers */ + if (dt != DELETE) + { + int numlines = D_NUMLINES (bptr, 1); + bptr->lines[1] = ALLOCATE (numlines, char *); + bptr->lengths[1] = ALLOCATE (numlines, size_t); + for (i = 0; i < numlines; i++) + scan_diff = scan_diff_line (scan_diff, + &(bptr->lines[1][i]), + &(bptr->lengths[1][i]), + diff_limit, + '>'); + } + + /* Place this block on the blocklist. */ + *block_list_end = bptr; + block_list_end = &bptr->next; + } + + *block_list_end = 0; + *last_block = bptr; + return block_list; +} + +/* + * This routine will parse a normal format diff control string. It + * returns the type of the diff (ERROR if the format is bad). All of + * the other important information is filled into to the structure + * pointed to by db, and the string pointer (whose location is passed + * to this routine) is updated to point beyond the end of the string + * parsed. Note that only the ranges in the diff_block will be set by + * this routine. + * + * If some specific pair of numbers has been reduced to a single + * number, then both corresponding numbers in the diff block are set + * to that number. In general these numbers are interpetted as ranges + * inclusive, unless being used by the ADD or DELETE commands. It is + * assumed that these will be special cased in a superior routine. + */ + +static enum diff_type +process_diff_control (string, db) + char **string; + struct diff_block *db; +{ + char *s = *string; + int holdnum; + enum diff_type type; + +/* These macros are defined here because they can use variables + defined in this function. Don't try this at home kids, we're + trained professionals! + + Also note that SKIPWHITE only recognizes tabs and spaces, and + that READNUM can only read positive, integral numbers */ + +#define SKIPWHITE(s) { while (*s == ' ' || *s == '\t') s++; } +#define READNUM(s, num) \ + { unsigned char c = *s; if (!ISDIGIT (c)) return ERROR; holdnum = 0; \ + do { holdnum = (c - '0' + holdnum * 10); } \ + while (ISDIGIT (c = *++s)); (num) = holdnum; } + + /* Read first set of digits */ + SKIPWHITE (s); + READNUM (s, db->ranges[0][START]); + + /* Was that the only digit? */ + SKIPWHITE (s); + if (*s == ',') + { + /* Get the next digit */ + s++; + READNUM (s, db->ranges[0][END]); + } + else + db->ranges[0][END] = db->ranges[0][START]; + + /* Get the letter */ + SKIPWHITE (s); + switch (*s) + { + case 'a': + type = ADD; + break; + case 'c': + type = CHANGE; + break; + case 'd': + type = DELETE; + break; + default: + return ERROR; /* Bad format */ + } + s++; /* Past letter */ + + /* Read second set of digits */ + SKIPWHITE (s); + READNUM (s, db->ranges[1][START]); + + /* Was that the only digit? */ + SKIPWHITE (s); + if (*s == ',') + { + /* Get the next digit */ + s++; + READNUM (s, db->ranges[1][END]); + SKIPWHITE (s); /* To move to end */ + } + else + db->ranges[1][END] = db->ranges[1][START]; + + *string = s; + return type; +} + +static char * +read_diff (filea, fileb, output_placement) + char const *filea, *fileb; + char **output_placement; +{ + char *diff_result; + size_t bytes, current_chunk_size, total; + int fd, wstatus; + struct stat pipestat; + + /* 302 / 1000 is log10(2.0) rounded up. Subtract 1 for the sign bit; + add 1 for integer division truncation; add 1 more for a minus sign. */ +#define INT_STRLEN_BOUND(type) ((sizeof(type)*CHAR_BIT - 1) * 302 / 1000 + 2) + + char const *argv[7]; + char horizon_arg[17 + INT_STRLEN_BOUND (int)]; + char const **ap; + char *diffout; + + ap = argv; + *ap++ = "diff"; + if (always_text) + *ap++ = "-a"; + sprintf (horizon_arg, "--horizon-lines=%d", horizon_lines); + *ap++ = horizon_arg; + *ap++ = "--"; + *ap++ = filea; + *ap++ = fileb; + *ap = 0; + + diffout = tmpnam(NULL); + wstatus = diff_run (ap - argv, (char **) argv, diffout); + if (wstatus == 2) + diff3_fatal ("subsidiary diff failed"); + + if (-1 == (fd = open (diffout, O_RDONLY))) + diff3_fatal ("could not open temporary diff file"); + + current_chunk_size = 8 * 1024; + if (fstat (fd, &pipestat) == 0) + current_chunk_size = max (current_chunk_size, STAT_BLOCKSIZE (pipestat)); + + diff_result = xmalloc (current_chunk_size); + total = 0; + do { + bytes = myread (fd, + diff_result + total, + current_chunk_size - total); + total += bytes; + if (total == current_chunk_size) + { + if (current_chunk_size < 2 * current_chunk_size) + current_chunk_size = 2 * current_chunk_size; + else if (current_chunk_size < (size_t) -1) + current_chunk_size = (size_t) -1; + else + diff3_fatal ("files are too large to fit into memory"); + diff_result = xrealloc (diff_result, (current_chunk_size *= 2)); + } + } while (bytes); + + if (total != 0 && diff_result[total-1] != '\n') + diff3_fatal ("invalid diff format; incomplete last line"); + + *output_placement = diff_result; + + if (close (fd) != 0) + diff3_perror_with_exit ("pipe close"); + unlink (diffout); + + return diff_result + total; +} + + +/* + * Scan a regular diff line (consisting of > or <, followed by a + * space, followed by text (including nulls) up to a newline. + * + * This next routine began life as a macro and many parameters in it + * are used as call-by-reference values. + */ +static char * +scan_diff_line (scan_ptr, set_start, set_length, limit, leadingchar) + char *scan_ptr, **set_start; + size_t *set_length; + char *limit; + int leadingchar; +{ + char *line_ptr; + + if (!(scan_ptr[0] == leadingchar + && scan_ptr[1] == ' ')) + diff3_fatal ("invalid diff format; incorrect leading line chars"); + + *set_start = line_ptr = scan_ptr + 2; + while (*line_ptr++ != '\n') + ; + + /* Include newline if the original line ended in a newline, + or if an edit script is being generated. + Copy any missing newline message to stderr if an edit script is being + generated, because edit scripts cannot handle missing newlines. + Return the beginning of the next line. */ + *set_length = line_ptr - *set_start; + if (line_ptr < limit && *line_ptr == '\\') + { + if (edscript) + fprintf (stderr, "%s:", diff_program_name); + else + --*set_length; + line_ptr++; + do + { + if (edscript) + putc (*line_ptr, stderr); + } + while (*line_ptr++ != '\n'); + } + + return line_ptr; +} + +/* + * This routine outputs a three way diff passed as a list of + * diff3_block's. + * The argument MAPPING is indexed by external file number (in the + * argument list) and contains the internal file number (from the + * diff passed). This is important because the user expects his + * outputs in terms of the argument list number, and the diff passed + * may have been done slightly differently (if the last argument + * was "-", for example). + * REV_MAPPING is the inverse of MAPPING. + */ +static void +output_diff3 (outputfile, diff, mapping, rev_mapping) + FILE *outputfile; + struct diff3_block *diff; + int const mapping[3], rev_mapping[3]; +{ + int i; + int oddoneout; + char *cp; + struct diff3_block *ptr; + int line; + size_t length; + int dontprint; + static int skew_increment[3] = { 2, 3, 1 }; /* 0==>2==>1==>3 */ + char const *line_prefix = tab_align_flag ? "\t" : " "; + + for (ptr = diff; ptr; ptr = D_NEXT (ptr)) + { + char x[2]; + + switch (ptr->correspond) + { + case DIFF_ALL: + x[0] = '\0'; + dontprint = 3; /* Print them all */ + oddoneout = 3; /* Nobody's odder than anyone else */ + break; + case DIFF_1ST: + case DIFF_2ND: + case DIFF_3RD: + oddoneout = rev_mapping[(int) ptr->correspond - (int) DIFF_1ST]; + + x[0] = oddoneout + '1'; + x[1] = '\0'; + dontprint = oddoneout==0; + break; + default: + diff3_fatal ("internal error: invalid diff type passed to output"); + } + fprintf (outputfile, "====%s\n", x); + + /* Go 0, 2, 1 if the first and third outputs are equivalent. */ + for (i = 0; i < 3; + i = (oddoneout == 1 ? skew_increment[i] : i + 1)) + { + int realfile = mapping[i]; + int + lowt = D_LOWLINE (ptr, realfile), + hight = D_HIGHLINE (ptr, realfile); + + fprintf (outputfile, "%d:", i + 1); + switch (lowt - hight) + { + case 1: + fprintf (outputfile, "%da\n", lowt - 1); + break; + case 0: + fprintf (outputfile, "%dc\n", lowt); + break; + default: + fprintf (outputfile, "%d,%dc\n", lowt, hight); + break; + } + + if (i == dontprint) continue; + + if (lowt <= hight) + { + line = 0; + do + { + fprintf (outputfile, line_prefix); + cp = D_RELNUM (ptr, realfile, line); + length = D_RELLEN (ptr, realfile, line); + fwrite (cp, sizeof (char), length, outputfile); + } + while (++line < hight - lowt + 1); + if (cp[length - 1] != '\n') + fprintf (outputfile, "\n\\ No newline at end of file\n"); + } + } + } +} + + +/* + * Output to OUTPUTFILE the lines of B taken from FILENUM. + * Double any initial '.'s; yield nonzero if any initial '.'s were doubled. + */ +static int +dotlines (outputfile, b, filenum) + FILE *outputfile; + struct diff3_block *b; + int filenum; +{ + int i; + int leading_dot = 0; + + for (i = 0; + i < D_NUMLINES (b, filenum); + i++) + { + char *line = D_RELNUM (b, filenum, i); + if (line[0] == '.') + { + leading_dot = 1; + fprintf (outputfile, "."); + } + fwrite (line, sizeof (char), + D_RELLEN (b, filenum, i), outputfile); + } + + return leading_dot; +} + +/* + * Output to OUTPUTFILE a '.' line. If LEADING_DOT is nonzero, + * also output a command that removes initial '.'s + * starting with line START and continuing for NUM lines. + */ +static void +undotlines (outputfile, leading_dot, start, num) + FILE *outputfile; + int leading_dot, start, num; +{ + fprintf (outputfile, ".\n"); + if (leading_dot) + if (num == 1) + fprintf (outputfile, "%ds/^\\.//\n", start); + else + fprintf (outputfile, "%d,%ds/^\\.//\n", start, start + num - 1); +} + +/* + * This routine outputs a diff3 set of blocks as an ed script. This + * script applies the changes between file's 2 & 3 to file 1. It + * takes the precise format of the ed script to be output from global + * variables set during options processing. Note that it does + * destructive things to the set of diff3 blocks it is passed; it + * reverses their order (this gets around the problems involved with + * changing line numbers in an ed script). + * + * Note that this routine has the same problem of mapping as the last + * one did; the variable MAPPING maps from file number according to + * the argument list to file number according to the diff passed. All + * files listed below are in terms of the argument list. + * REV_MAPPING is the inverse of MAPPING. + * + * The arguments FILE0, FILE1 and FILE2 are the strings to print + * as the names of the three files. These may be the actual names, + * or may be the arguments specified with -L. + * + * Returns 1 if conflicts were found. + */ + +static int +output_diff3_edscript (outputfile, diff, mapping, rev_mapping, + file0, file1, file2) + FILE *outputfile; + struct diff3_block *diff; + int const mapping[3], rev_mapping[3]; + char const *file0, *file1, *file2; +{ + int leading_dot; + int conflicts_found = 0, conflict; + struct diff3_block *b; + + for (b = reverse_diff3_blocklist (diff); b; b = b->next) + { + /* Must do mapping correctly. */ + enum diff_type type + = ((b->correspond == DIFF_ALL) ? + DIFF_ALL : + ((enum diff_type) + (((int) DIFF_1ST) + + rev_mapping[(int) b->correspond - (int) DIFF_1ST]))); + + /* If we aren't supposed to do this output block, skip it. */ + switch (type) + { + default: continue; + case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break; + case DIFF_3RD: if (overlap_only) continue; conflict = 0; break; + case DIFF_ALL: if (simple_only) continue; conflict = flagging; break; + } + + if (conflict) + { + conflicts_found = 1; + + + /* Mark end of conflict. */ + + fprintf (outputfile, "%da\n", D_HIGHLINE (b, mapping[FILE0])); + leading_dot = 0; + if (type == DIFF_ALL) + { + if (show_2nd) + { + /* Append lines from FILE1. */ + fprintf (outputfile, "||||||| %s\n", file1); + leading_dot = dotlines (outputfile, b, mapping[FILE1]); + } + /* Append lines from FILE2. */ + fprintf (outputfile, "=======\n"); + leading_dot |= dotlines (outputfile, b, mapping[FILE2]); + } + fprintf (outputfile, ">>>>>>> %s\n", file2); + undotlines (outputfile, leading_dot, + D_HIGHLINE (b, mapping[FILE0]) + 2, + (D_NUMLINES (b, mapping[FILE1]) + + D_NUMLINES (b, mapping[FILE2]) + 1)); + + + /* Mark start of conflict. */ + + fprintf (outputfile, "%da\n<<<<<<< %s\n", + D_LOWLINE (b, mapping[FILE0]) - 1, + type == DIFF_ALL ? file0 : file1); + leading_dot = 0; + if (type == DIFF_2ND) + { + /* Prepend lines from FILE1. */ + leading_dot = dotlines (outputfile, b, mapping[FILE1]); + fprintf (outputfile, "=======\n"); + } + undotlines (outputfile, leading_dot, + D_LOWLINE (b, mapping[FILE0]) + 1, + D_NUMLINES (b, mapping[FILE1])); + } + else if (D_NUMLINES (b, mapping[FILE2]) == 0) + /* Write out a delete */ + { + if (D_NUMLINES (b, mapping[FILE0]) == 1) + fprintf (outputfile, "%dd\n", + D_LOWLINE (b, mapping[FILE0])); + else + fprintf (outputfile, "%d,%dd\n", + D_LOWLINE (b, mapping[FILE0]), + D_HIGHLINE (b, mapping[FILE0])); + } + else + /* Write out an add or change */ + { + switch (D_NUMLINES (b, mapping[FILE0])) + { + case 0: + fprintf (outputfile, "%da\n", + D_HIGHLINE (b, mapping[FILE0])); + break; + case 1: + fprintf (outputfile, "%dc\n", + D_HIGHLINE (b, mapping[FILE0])); + break; + default: + fprintf (outputfile, "%d,%dc\n", + D_LOWLINE (b, mapping[FILE0]), + D_HIGHLINE (b, mapping[FILE0])); + break; + } + + undotlines (outputfile, dotlines (outputfile, b, mapping[FILE2]), + D_LOWLINE (b, mapping[FILE0]), + D_NUMLINES (b, mapping[FILE2])); + } + } + if (finalwrite) fprintf (outputfile, "w\nq\n"); + return conflicts_found; +} + +/* + * Read from INFILE and output to OUTPUTFILE a set of diff3_ blocks DIFF + * as a merged file. This acts like 'ed file0 <[output_diff3_edscript]', + * except that it works even for binary data or incomplete lines. + * + * As before, MAPPING maps from arg list file number to diff file number, + * REV_MAPPING is its inverse, + * and FILE0, FILE1, and FILE2 are the names of the files. + * + * Returns 1 if conflicts were found. + */ + +static int +output_diff3_merge (infile, outputfile, diff, mapping, rev_mapping, + file0, file1, file2) + FILE *infile, *outputfile; + struct diff3_block *diff; + int const mapping[3], rev_mapping[3]; + char const *file0, *file1, *file2; +{ + int c, i; + int conflicts_found = 0, conflict; + struct diff3_block *b; + int linesread = 0; + + for (b = diff; b; b = b->next) + { + /* Must do mapping correctly. */ + enum diff_type type + = ((b->correspond == DIFF_ALL) ? + DIFF_ALL : + ((enum diff_type) + (((int) DIFF_1ST) + + rev_mapping[(int) b->correspond - (int) DIFF_1ST]))); + char const *format_2nd = "<<<<<<< %s\n"; + + /* If we aren't supposed to do this output block, skip it. */ + switch (type) + { + default: continue; + case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break; + case DIFF_3RD: if (overlap_only) continue; conflict = 0; break; + case DIFF_ALL: if (simple_only) continue; conflict = flagging; + format_2nd = "||||||| %s\n"; + break; + } + + /* Copy I lines from file 0. */ + i = D_LOWLINE (b, FILE0) - linesread - 1; + linesread += i; + while (0 <= --i) + do + { + c = getc (infile); + if (c == EOF) + if (ferror (infile)) + diff3_perror_with_exit ("input file"); + else if (feof (infile)) + diff3_fatal ("input file shrank"); + putc (c, outputfile); + } + while (c != '\n'); + + if (conflict) + { + conflicts_found = 1; + + if (type == DIFF_ALL) + { + /* Put in lines from FILE0 with bracket. */ + fprintf (outputfile, "<<<<<<< %s\n", file0); + for (i = 0; + i < D_NUMLINES (b, mapping[FILE0]); + i++) + fwrite (D_RELNUM (b, mapping[FILE0], i), sizeof (char), + D_RELLEN (b, mapping[FILE0], i), outputfile); + } + + if (show_2nd) + { + /* Put in lines from FILE1 with bracket. */ + fprintf (outputfile, format_2nd, file1); + for (i = 0; + i < D_NUMLINES (b, mapping[FILE1]); + i++) + fwrite (D_RELNUM (b, mapping[FILE1], i), sizeof (char), + D_RELLEN (b, mapping[FILE1], i), outputfile); + } + + fprintf (outputfile, "=======\n"); + } + + /* Put in lines from FILE2. */ + for (i = 0; + i < D_NUMLINES (b, mapping[FILE2]); + i++) + fwrite (D_RELNUM (b, mapping[FILE2], i), sizeof (char), + D_RELLEN (b, mapping[FILE2], i), outputfile); + + if (conflict) + fprintf (outputfile, ">>>>>>> %s\n", file2); + + /* Skip I lines in file 0. */ + i = D_NUMLINES (b, FILE0); + linesread += i; + while (0 <= --i) + while ((c = getc (infile)) != '\n') + if (c == EOF) + if (ferror (infile)) + diff3_perror_with_exit ("input file"); + else if (feof (infile)) + { + if (i || b->next) + diff3_fatal ("input file shrank"); + return conflicts_found; + } + } + /* Copy rest of common file. */ + while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile))) + putc (c, outputfile); + return conflicts_found; +} + +/* + * Reverse the order of the list of diff3 blocks. + */ +static struct diff3_block * +reverse_diff3_blocklist (diff) + struct diff3_block *diff; +{ + register struct diff3_block *tmp, *next, *prev; + + for (tmp = diff, prev = 0; tmp; tmp = next) + { + next = tmp->next; + tmp->next = prev; + prev = tmp; + } + + return prev; +} + +static size_t +myread (fd, ptr, size) + int fd; + char *ptr; + size_t size; +{ + size_t result = read (fd, ptr, size); + if (result == -1) + diff3_perror_with_exit ("read failed"); + return result; +} + +static void +diff3_fatal (string) + char const *string; +{ + fprintf (stderr, "%s: %s\n", diff_program_name, string); + DIFF3_ABORT (2); +} + +static void +diff3_perror_with_exit (string) + char const *string; +{ + int e = errno; + fprintf (stderr, "%s: ", diff_program_name); + errno = e; + perror (string); + DIFF3_ABORT (2); +} + +static void +initialize_main (argcp, argvp) + int *argcp; + char ***argvp; +{ + always_text = 0; + edscript = 0; + flagging = 0; + horizon_lines = 10; + tab_align_flag = 0; + simple_only = 0; + overlap_only = 0; + show_2nd = 0; + finalwrite = 0; + merge = 0; + diff_program_name = (*argvp)[0]; +} + +static void +free_diff_blocks(p) + struct diff_block *p; +{ + register struct diff_block *next; + + while (p) + { + next = p->next; + if (p->lines[0]) free(p->lines[0]); + if (p->lines[1]) free(p->lines[1]); + if (p->lengths[0]) free(p->lengths[0]); + if (p->lengths[1]) free(p->lengths[1]); + free(p); + p = next; + } +} + +static void +free_diff3_blocks(p) + struct diff3_block *p; +{ + register struct diff3_block *next; + + while (p) + { + next = p->next; + if (p->lines[0]) free(p->lines[0]); + if (p->lines[1]) free(p->lines[1]); + if (p->lines[2]) free(p->lines[2]); + if (p->lengths[0]) free(p->lengths[0]); + if (p->lengths[1]) free(p->lengths[1]); + if (p->lengths[2]) free(p->lengths[2]); + free(p); + p = next; + } +} diff --git a/gnu/usr.bin/cvs/diff/dir.c b/gnu/usr.bin/cvs/diff/dir.c new file mode 100644 index 00000000000..6eef9a63244 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/dir.c @@ -0,0 +1,220 @@ +/* Read, sort and compare two directories. Used for GNU DIFF. + Copyright (C) 1988, 1989, 1992, 1993, 1994 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "diff.h" + +/* Read the directory named by DIR and store into DIRDATA a sorted vector + of filenames for its contents. DIR->desc == -1 means this directory is + known to be nonexistent, so set DIRDATA to an empty vector. + Return -1 (setting errno) if error, 0 otherwise. */ + +struct dirdata +{ + char const **names; /* Sorted names of files in dir, 0-terminated. */ + char *data; /* Allocated storage for file names. */ +}; + +static int compare_names PARAMS((void const *, void const *)); +static int dir_sort PARAMS((struct file_data const *, struct dirdata *)); + +#ifdef _WIN32 +#define CLOSEDIR_VOID 1 +#endif + +static int +dir_sort (dir, dirdata) + struct file_data const *dir; + struct dirdata *dirdata; +{ + register struct dirent *next; + register int i; + + /* Address of block containing the files that are described. */ + char const **names; + + /* Number of files in directory. */ + size_t nnames; + + /* Allocated and used storage for file name data. */ + char *data; + size_t data_alloc, data_used; + + dirdata->names = 0; + dirdata->data = 0; + nnames = 0; + data = 0; + + if (dir->desc != -1) + { + /* Open the directory and check for errors. */ + register DIR *reading = opendir (dir->name); + if (!reading) + return -1; + + /* Initialize the table of filenames. */ + + data_alloc = max (1, (size_t) dir->stat.st_size); + data_used = 0; + dirdata->data = data = xmalloc (data_alloc); + + /* Read the directory entries, and insert the subfiles + into the `data' table. */ + + while ((errno = 0, (next = readdir (reading)) != 0)) + { + char *d_name = next->d_name; + size_t d_size = NAMLEN (next) + 1; + + /* Ignore the files `.' and `..' */ + if (d_name[0] == '.' + && (d_name[1] == 0 || (d_name[1] == '.' && d_name[2] == 0))) + continue; + + if (excluded_filename (d_name)) + continue; + + while (data_alloc < data_used + d_size) + dirdata->data = data = xrealloc (data, data_alloc *= 2); + memcpy (data + data_used, d_name, d_size); + data_used += d_size; + nnames++; + } + if (errno) + { + int e = errno; + closedir (reading); + errno = e; + return -1; + } +#if CLOSEDIR_VOID + closedir (reading); +#else + if (closedir (reading) != 0) + return -1; +#endif + } + + /* Create the `names' table from the `data' table. */ + dirdata->names = names = (char const **) xmalloc (sizeof (char *) + * (nnames + 1)); + for (i = 0; i < nnames; i++) + { + names[i] = data; + data += strlen (data) + 1; + } + names[nnames] = 0; + + /* Sort the table. */ + qsort (names, nnames, sizeof (char *), compare_names); + + return 0; +} + +/* Sort the files now in the table. */ + +static int +compare_names (file1, file2) + void const *file1, *file2; +{ + return filename_cmp (* (char const *const *) file1, + * (char const *const *) file2); +} + +/* Compare the contents of two directories named in FILEVEC[0] and FILEVEC[1]. + This is a top-level routine; it does everything necessary for diff + on two directories. + + FILEVEC[0].desc == -1 says directory FILEVEC[0] doesn't exist, + but pretend it is empty. Likewise for FILEVEC[1]. + + HANDLE_FILE is a caller-provided subroutine called to handle each file. + It gets five operands: dir and name (rel to original working dir) of file + in dir 0, dir and name pathname of file in dir 1, and the recursion depth. + + For a file that appears in only one of the dirs, one of the name-args + to HANDLE_FILE is zero. + + DEPTH is the current depth in recursion, used for skipping top-level + files by the -S option. + + Returns the maximum of all the values returned by HANDLE_FILE, + or 2 if trouble is encountered in opening files. */ + +int +diff_dirs (filevec, handle_file, depth) + struct file_data const filevec[]; + int (*handle_file) PARAMS((char const *, char const *, char const *, char const *, int)); + int depth; +{ + struct dirdata dirdata[2]; + int val = 0; /* Return value. */ + int i; + + /* Get sorted contents of both dirs. */ + for (i = 0; i < 2; i++) + if (dir_sort (&filevec[i], &dirdata[i]) != 0) + { + perror_with_name (filevec[i].name); + val = 2; + } + + if (val == 0) + { + register char const * const *names0 = dirdata[0].names; + register char const * const *names1 = dirdata[1].names; + char const *name0 = filevec[0].name; + char const *name1 = filevec[1].name; + + /* If `-S name' was given, and this is the topmost level of comparison, + ignore all file names less than the specified starting name. */ + + if (dir_start_file && depth == 0) + { + while (*names0 && filename_cmp (*names0, dir_start_file) < 0) + names0++; + while (*names1 && filename_cmp (*names1, dir_start_file) < 0) + names1++; + } + + /* Loop while files remain in one or both dirs. */ + while (*names0 || *names1) + { + /* Compare next name in dir 0 with next name in dir 1. + At the end of a dir, + pretend the "next name" in that dir is very large. */ + int nameorder = (!*names0 ? 1 : !*names1 ? -1 + : filename_cmp (*names0, *names1)); + int v1 = (*handle_file) (name0, 0 < nameorder ? 0 : *names0++, + name1, nameorder < 0 ? 0 : *names1++, + depth + 1); + if (v1 > val) + val = v1; + } + } + + for (i = 0; i < 2; i++) + { + if (dirdata[i].names) + free (dirdata[i].names); + if (dirdata[i].data) + free (dirdata[i].data); + } + + return val; +} diff --git a/gnu/usr.bin/cvs/diff/ed.c b/gnu/usr.bin/cvs/diff/ed.c new file mode 100644 index 00000000000..717ef358d0e --- /dev/null +++ b/gnu/usr.bin/cvs/diff/ed.c @@ -0,0 +1,200 @@ +/* Output routines for ed-script format. + Copyright (C) 1988, 89, 91, 92, 93 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "diff.h" + +static void print_ed_hunk PARAMS((struct change *)); +static void print_rcs_hunk PARAMS((struct change *)); +static void pr_forward_ed_hunk PARAMS((struct change *)); + +/* Print our script as ed commands. */ + +void +print_ed_script (script) + struct change *script; +{ + print_script (script, find_reverse_change, print_ed_hunk); +} + +/* Print a hunk of an ed diff */ + +static void +print_ed_hunk (hunk) + struct change *hunk; +{ + int f0, l0, f1, l1; + int deletes, inserts; + +#if 0 + hunk = flip_script (hunk); +#endif +#ifdef DEBUG + debug_script (hunk); +#endif + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts); + if (!deletes && !inserts) + return; + + begin_output (); + + /* Print out the line number header for this hunk */ + print_number_range (',', &files[0], f0, l0); + fprintf (outfile, "%c\n", change_letter (inserts, deletes)); + + /* Print new/changed lines from second file, if needed */ + if (inserts) + { + int i; + int inserting = 1; + for (i = f1; i <= l1; i++) + { + /* Resume the insert, if we stopped. */ + if (! inserting) + fprintf (outfile, "%da\n", + i - f1 + translate_line_number (&files[0], f0) - 1); + inserting = 1; + + /* If the file's line is just a dot, it would confuse `ed'. + So output it with a double dot, and set the flag LEADING_DOT + so that we will output another ed-command later + to change the double dot into a single dot. */ + + if (files[1].linbuf[i][0] == '.' + && files[1].linbuf[i][1] == '\n') + { + fprintf (outfile, "..\n"); + fprintf (outfile, ".\n"); + /* Now change that double dot to the desired single dot. */ + fprintf (outfile, "%ds/^\\.\\././\n", + i - f1 + translate_line_number (&files[0], f0)); + inserting = 0; + } + else + /* Line is not `.', so output it unmodified. */ + print_1_line ("", &files[1].linbuf[i]); + } + + /* End insert mode, if we are still in it. */ + if (inserting) + fprintf (outfile, ".\n"); + } +} + +/* Print change script in the style of ed commands, + but print the changes in the order they appear in the input files, + which means that the commands are not truly useful with ed. */ + +void +pr_forward_ed_script (script) + struct change *script; +{ + print_script (script, find_change, pr_forward_ed_hunk); +} + +static void +pr_forward_ed_hunk (hunk) + struct change *hunk; +{ + int i; + int f0, l0, f1, l1; + int deletes, inserts; + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts); + if (!deletes && !inserts) + return; + + begin_output (); + + fprintf (outfile, "%c", change_letter (inserts, deletes)); + print_number_range (' ', files, f0, l0); + fprintf (outfile, "\n"); + + /* If deletion only, print just the number range. */ + + if (!inserts) + return; + + /* For insertion (with or without deletion), print the number range + and the lines from file 2. */ + + for (i = f1; i <= l1; i++) + print_1_line ("", &files[1].linbuf[i]); + + fprintf (outfile, ".\n"); +} + +/* Print in a format somewhat like ed commands + except that each insert command states the number of lines it inserts. + This format is used for RCS. */ + +void +print_rcs_script (script) + struct change *script; +{ + print_script (script, find_change, print_rcs_hunk); +} + +/* Print a hunk of an RCS diff */ + +static void +print_rcs_hunk (hunk) + struct change *hunk; +{ + int i; + int f0, l0, f1, l1; + int deletes, inserts; + int tf0, tl0, tf1, tl1; + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts); + if (!deletes && !inserts) + return; + + begin_output (); + + translate_range (&files[0], f0, l0, &tf0, &tl0); + + if (deletes) + { + fprintf (outfile, "d"); + /* For deletion, print just the starting line number from file 0 + and the number of lines deleted. */ + fprintf (outfile, "%d %d\n", + tf0, + (tl0 >= tf0 ? tl0 - tf0 + 1 : 1)); + } + + if (inserts) + { + fprintf (outfile, "a"); + + /* Take last-line-number from file 0 and # lines from file 1. */ + translate_range (&files[1], f1, l1, &tf1, &tl1); + fprintf (outfile, "%d %d\n", + tl0, + (tl1 >= tf1 ? tl1 - tf1 + 1 : 1)); + + /* Print the inserted lines. */ + for (i = f1; i <= l1; i++) + print_1_line ("", &files[1].linbuf[i]); + } +} diff --git a/gnu/usr.bin/cvs/diff/ifdef.c b/gnu/usr.bin/cvs/diff/ifdef.c new file mode 100644 index 00000000000..2834cbdfa23 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/ifdef.c @@ -0,0 +1,428 @@ +/* #ifdef-format output routines for GNU DIFF. + Copyright (C) 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + +This file is part of GNU DIFF. + +GNU DIFF is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY. No author or distributor +accepts responsibility to anyone for the consequences of using it +or for whether it serves any particular purpose or works at all, +unless he says so in writing. Refer to the GNU DIFF General Public +License for full details. + +Everyone is granted permission to copy, modify and redistribute +GNU DIFF, but only under the conditions described in the +GNU DIFF General Public License. A copy of this license is +supposed to have been given to you along with GNU DIFF so you +can know your rights and responsibilities. It should be in a +file named COPYING. Among other things, the copyright notice +and this notice must be preserved on all copies. */ + + +#include "diff.h" + +struct group +{ + struct file_data const *file; + int from, upto; /* start and limit lines for this group of lines */ +}; + +static char *format_group PARAMS((FILE *, char *, int, struct group const *)); +static char *scan_char_literal PARAMS((char *, int *)); +static char *scan_printf_spec PARAMS((char *)); +static int groups_letter_value PARAMS((struct group const *, int)); +static void format_ifdef PARAMS((char *, int, int, int, int)); +static void print_ifdef_hunk PARAMS((struct change *)); +static void print_ifdef_lines PARAMS((FILE *, char *, struct group const *)); + +static int next_line; + +/* Print the edit-script SCRIPT as a merged #ifdef file. */ + +void +print_ifdef_script (script) + struct change *script; +{ + next_line = - files[0].prefix_lines; + print_script (script, find_change, print_ifdef_hunk); + if (next_line < files[0].valid_lines) + { + begin_output (); + format_ifdef (group_format[UNCHANGED], next_line, files[0].valid_lines, + next_line - files[0].valid_lines + files[1].valid_lines, + files[1].valid_lines); + } +} + +/* Print a hunk of an ifdef diff. + This is a contiguous portion of a complete edit script, + describing changes in consecutive lines. */ + +static void +print_ifdef_hunk (hunk) + struct change *hunk; +{ + int first0, last0, first1, last1, deletes, inserts; + char *format; + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts); + if (inserts) + format = deletes ? group_format[CHANGED] : group_format[NEW]; + else if (deletes) + format = group_format[OLD]; + else + return; + + begin_output (); + + /* Print lines up to this change. */ + if (next_line < first0) + format_ifdef (group_format[UNCHANGED], next_line, first0, + next_line - first0 + first1, first1); + + /* Print this change. */ + next_line = last0 + 1; + format_ifdef (format, first0, next_line, first1, last1 + 1); +} + +/* Print a set of lines according to FORMAT. + Lines BEG0 up to END0 are from the first file; + lines BEG1 up to END1 are from the second file. */ + +static void +format_ifdef (format, beg0, end0, beg1, end1) + char *format; + int beg0, end0, beg1, end1; +{ + struct group groups[2]; + + groups[0].file = &files[0]; + groups[0].from = beg0; + groups[0].upto = end0; + groups[1].file = &files[1]; + groups[1].from = beg1; + groups[1].upto = end1; + format_group (outfile, format, '\0', groups); +} + +/* Print to file OUT a set of lines according to FORMAT. + The format ends at the first free instance of ENDCHAR. + Yield the address of the terminating character. + GROUPS specifies which lines to print. + If OUT is zero, do not actually print anything; just scan the format. */ + +static char * +format_group (out, format, endchar, groups) + register FILE *out; + char *format; + int endchar; + struct group const *groups; +{ + register char c; + register char *f = format; + + while ((c = *f) != endchar && c != 0) + { + f++; + if (c == '%') + { + char *spec = f; + switch ((c = *f++)) + { + case '%': + break; + + case '(': + /* Print if-then-else format e.g. `%(n=1?thenpart:elsepart)'. */ + { + int i, value[2]; + FILE *thenout, *elseout; + + for (i = 0; i < 2; i++) + { + unsigned char f0 = f[0]; + if (ISDIGIT (f0)) + { + value[i] = atoi (f); + while (ISDIGIT ((unsigned char) *++f)) + continue; + } + else + { + value[i] = groups_letter_value (groups, f0); + if (value[i] < 0) + goto bad_format; + f++; + } + if (*f++ != "=?"[i]) + goto bad_format; + } + if (value[0] == value[1]) + thenout = out, elseout = 0; + else + thenout = 0, elseout = out; + f = format_group (thenout, f, ':', groups); + if (*f) + { + f = format_group (elseout, f + 1, ')', groups); + if (*f) + f++; + } + } + continue; + + case '<': + /* Print lines deleted from first file. */ + print_ifdef_lines (out, line_format[OLD], &groups[0]); + continue; + + case '=': + /* Print common lines. */ + print_ifdef_lines (out, line_format[UNCHANGED], &groups[0]); + continue; + + case '>': + /* Print lines inserted from second file. */ + print_ifdef_lines (out, line_format[NEW], &groups[1]); + continue; + + default: + { + int value; + char *speclim; + + f = scan_printf_spec (spec); + if (!f) + goto bad_format; + speclim = f; + c = *f++; + switch (c) + { + case '\'': + f = scan_char_literal (f, &value); + if (!f) + goto bad_format; + break; + + default: + value = groups_letter_value (groups, c); + if (value < 0) + goto bad_format; + break; + } + if (out) + { + /* Temporarily replace e.g. "%3dnx" with "%3d\0x". */ + *speclim = 0; + fprintf (out, spec - 1, value); + /* Undo the temporary replacement. */ + *speclim = c; + } + } + continue; + + bad_format: + c = '%'; + f = spec; + break; + } + } + if (out) + putc (c, out); + } + return f; +} + +/* For the line group pair G, return the number corresponding to LETTER. + Return -1 if LETTER is not a group format letter. */ +static int +groups_letter_value (g, letter) + struct group const *g; + int letter; +{ + if (ISUPPER (letter)) + { + g++; + letter = tolower (letter); + } + switch (letter) + { + case 'e': return translate_line_number (g->file, g->from) - 1; + case 'f': return translate_line_number (g->file, g->from); + case 'l': return translate_line_number (g->file, g->upto) - 1; + case 'm': return translate_line_number (g->file, g->upto); + case 'n': return g->upto - g->from; + default: return -1; + } +} + +/* Print to file OUT, using FORMAT to print the line group GROUP. + But do nothing if OUT is zero. */ +static void +print_ifdef_lines (out, format, group) + register FILE *out; + char *format; + struct group const *group; +{ + struct file_data const *file = group->file; + char const * const *linbuf = file->linbuf; + int from = group->from, upto = group->upto; + + if (!out) + return; + + /* If possible, use a single fwrite; it's faster. */ + if (!tab_expand_flag && format[0] == '%') + { + if (format[1] == 'l' && format[2] == '\n' && !format[3]) + { + fwrite (linbuf[from], sizeof (char), + linbuf[upto] + (linbuf[upto][-1] != '\n') - linbuf[from], + out); + return; + } + if (format[1] == 'L' && !format[2]) + { + fwrite (linbuf[from], sizeof (char), + linbuf[upto] - linbuf[from], out); + return; + } + } + + for (; from < upto; from++) + { + register char c; + register char *f = format; + + while ((c = *f++) != 0) + { + if (c == '%') + { + char *spec = f; + switch ((c = *f++)) + { + case '%': + break; + + case 'l': + output_1_line (linbuf[from], + linbuf[from + 1] + - (linbuf[from + 1][-1] == '\n'), 0, 0); + continue; + + case 'L': + output_1_line (linbuf[from], linbuf[from + 1], 0, 0); + continue; + + default: + { + int value; + char *speclim; + + f = scan_printf_spec (spec); + if (!f) + goto bad_format; + speclim = f; + c = *f++; + switch (c) + { + case '\'': + f = scan_char_literal (f, &value); + if (!f) + goto bad_format; + break; + + case 'n': + value = translate_line_number (file, from); + break; + + default: + goto bad_format; + } + /* Temporarily replace e.g. "%3dnx" with "%3d\0x". */ + *speclim = 0; + fprintf (out, spec - 1, value); + /* Undo the temporary replacement. */ + *speclim = c; + } + continue; + + bad_format: + c = '%'; + f = spec; + break; + } + } + putc (c, out); + } + } +} + +/* Scan the character literal represented in the string LIT; LIT points just + after the initial apostrophe. Put the literal's value into *INTPTR. + Yield the address of the first character after the closing apostrophe, + or zero if the literal is ill-formed. */ +static char * +scan_char_literal (lit, intptr) + char *lit; + int *intptr; +{ + register char *p = lit; + int value, digits; + char c = *p++; + + switch (c) + { + case 0: + case '\'': + return 0; + + case '\\': + value = 0; + while ((c = *p++) != '\'') + { + unsigned digit = c - '0'; + if (8 <= digit) + return 0; + value = 8 * value + digit; + } + digits = p - lit - 2; + if (! (1 <= digits && digits <= 3)) + return 0; + break; + + default: + value = c; + if (*p++ != '\'') + return 0; + break; + } + *intptr = value; + return p; +} + +/* Scan optional printf-style SPEC of the form `-*[0-9]*(.[0-9]*)?[cdoxX]'. + Return the address of the character following SPEC, or zero if failure. */ +static char * +scan_printf_spec (spec) + register char *spec; +{ + register unsigned char c; + + while ((c = *spec++) == '-') + continue; + while (ISDIGIT (c)) + c = *spec++; + if (c == '.') + while (ISDIGIT (c = *spec++)) + continue; + switch (c) + { + case 'c': case 'd': case 'o': case 'x': case 'X': + return spec; + + default: + return 0; + } +} diff --git a/gnu/usr.bin/cvs/diff/io.c b/gnu/usr.bin/cvs/diff/io.c new file mode 100644 index 00000000000..66059155109 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/io.c @@ -0,0 +1,714 @@ +/* File I/O for GNU DIFF. + Copyright (C) 1988, 1989, 1992, 1993, 1994 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "diff.h" + +/* Rotate a value n bits to the left. */ +#define UINT_BIT (sizeof (unsigned) * CHAR_BIT) +#define ROL(v, n) ((v) << (n) | (v) >> (UINT_BIT - (n))) + +/* Given a hash value and a new character, return a new hash value. */ +#define HASH(h, c) ((c) + ROL (h, 7)) + +/* Guess remaining number of lines from number N of lines so far, + size S so far, and total size T. */ +#define GUESS_LINES(n,s,t) (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5) + +/* Type used for fast prefix comparison in find_identical_ends. */ +#ifndef word +#define word int +#endif + +/* Lines are put into equivalence classes (of lines that match in line_cmp). + Each equivalence class is represented by one of these structures, + but only while the classes are being computed. + Afterward, each class is represented by a number. */ +struct equivclass +{ + int next; /* Next item in this bucket. */ + unsigned hash; /* Hash of lines in this class. */ + char const *line; /* A line that fits this class. */ + size_t length; /* That line's length, not counting its newline. */ +}; + +/* Hash-table: array of buckets, each being a chain of equivalence classes. + buckets[-1] is reserved for incomplete lines. */ +static int *buckets; + +/* Number of buckets in the hash table array, not counting buckets[-1]. */ +static int nbuckets; + +/* Array in which the equivalence classes are allocated. + The bucket-chains go through the elements in this array. + The number of an equivalence class is its index in this array. */ +static struct equivclass *equivs; + +/* Index of first free element in the array `equivs'. */ +static int equivs_index; + +/* Number of elements allocated in the array `equivs'. */ +static int equivs_alloc; + +static void find_and_hash_each_line PARAMS((struct file_data *)); +static void find_identical_ends PARAMS((struct file_data[])); +static void prepare_text_end PARAMS((struct file_data *)); + +/* Check for binary files and compare them for exact identity. */ + +/* Return 1 if BUF contains a non text character. + SIZE is the number of characters in BUF. */ + +#define binary_file_p(buf, size) (memchr (buf, '\0', size) != 0) + +/* Get ready to read the current file. + Return nonzero if SKIP_TEST is zero, + and if it appears to be a binary file. */ + +int +sip (current, skip_test) + struct file_data *current; + int skip_test; +{ + /* If we have a nonexistent file at this stage, treat it as empty. */ + if (current->desc < 0) + { + /* Leave room for a sentinel. */ + current->bufsize = sizeof (word); + current->buffer = xmalloc (current->bufsize); + } + else + { + current->bufsize = STAT_BLOCKSIZE (current->stat); + current->buffer = xmalloc (current->bufsize); + + if (! skip_test) + { + /* Check first part of file to see if it's a binary file. */ +#if HAVE_SETMODE + int oldmode = setmode (current->desc, O_BINARY); +#endif + size_t n = read (current->desc, current->buffer, current->bufsize); + if (n == -1) + pfatal_with_name (current->name); + current->buffered_chars = n; +#if HAVE_SETMODE + if (oldmode != O_BINARY) + { + if (lseek (current->desc, - (off_t) n, SEEK_CUR) == -1) + pfatal_with_name (current->name); + setmode (current->desc, oldmode); + current->buffered_chars = 0; + } +#endif + return binary_file_p (current->buffer, n); + } + } + + current->buffered_chars = 0; + return 0; +} + +/* Slurp the rest of the current file completely into memory. */ + +void +slurp (current) + struct file_data *current; +{ + size_t cc; + + if (current->desc < 0) + /* The file is nonexistent. */ + ; + else if (S_ISREG (current->stat.st_mode)) + { + /* It's a regular file; slurp in the rest all at once. */ + + /* Get the size out of the stat block. + Allocate enough room for appended newline and sentinel. */ + cc = current->stat.st_size + 1 + sizeof (word); + if (current->bufsize < cc) + { + current->bufsize = cc; + current->buffer = xrealloc (current->buffer, cc); + } + + if (current->buffered_chars < current->stat.st_size) + { + cc = read (current->desc, + current->buffer + current->buffered_chars, + current->stat.st_size - current->buffered_chars); + if (cc == -1) + pfatal_with_name (current->name); + current->buffered_chars += cc; + } + } + /* It's not a regular file; read it, growing the buffer as needed. */ + else if (always_text_flag || current->buffered_chars != 0) + { + for (;;) + { + if (current->buffered_chars == current->bufsize) + { + current->bufsize = current->bufsize * 2; + current->buffer = xrealloc (current->buffer, current->bufsize); + } + cc = read (current->desc, + current->buffer + current->buffered_chars, + current->bufsize - current->buffered_chars); + if (cc == 0) + break; + if (cc == -1) + pfatal_with_name (current->name); + current->buffered_chars += cc; + } + /* Allocate just enough room for appended newline and sentinel. */ + current->bufsize = current->buffered_chars + 1 + sizeof (word); + current->buffer = xrealloc (current->buffer, current->bufsize); + } +} + +/* Split the file into lines, simultaneously computing the equivalence class for + each line. */ + +static void +find_and_hash_each_line (current) + struct file_data *current; +{ + unsigned h; + unsigned char const *p = (unsigned char const *) current->prefix_end; + unsigned char c; + int i, *bucket; + size_t length; + + /* Cache often-used quantities in local variables to help the compiler. */ + char const **linbuf = current->linbuf; + int alloc_lines = current->alloc_lines; + int line = 0; + int linbuf_base = current->linbuf_base; + int *cureqs = (int *) xmalloc (alloc_lines * sizeof (int)); + struct equivclass *eqs = equivs; + int eqs_index = equivs_index; + int eqs_alloc = equivs_alloc; + char const *suffix_begin = current->suffix_begin; + char const *bufend = current->buffer + current->buffered_chars; + int use_line_cmp = ignore_some_line_changes; + + while ((char const *) p < suffix_begin) + { + char const *ip = (char const *) p; + + /* Compute the equivalence class for this line. */ + + h = 0; + + /* Hash this line until we find a newline. */ + if (ignore_case_flag) + { + if (ignore_all_space_flag) + while ((c = *p++) != '\n') + { + if (! ISSPACE (c)) + h = HASH (h, ISUPPER (c) ? tolower (c) : c); + } + else if (ignore_space_change_flag) + while ((c = *p++) != '\n') + { + if (ISSPACE (c)) + { + for (;;) + { + c = *p++; + if (!ISSPACE (c)) + break; + if (c == '\n') + goto hashing_done; + } + h = HASH (h, ' '); + } + /* C is now the first non-space. */ + h = HASH (h, ISUPPER (c) ? tolower (c) : c); + } + else + while ((c = *p++) != '\n') + h = HASH (h, ISUPPER (c) ? tolower (c) : c); + } + else + { + if (ignore_all_space_flag) + while ((c = *p++) != '\n') + { + if (! ISSPACE (c)) + h = HASH (h, c); + } + else if (ignore_space_change_flag) + while ((c = *p++) != '\n') + { + if (ISSPACE (c)) + { + for (;;) + { + c = *p++; + if (!ISSPACE (c)) + break; + if (c == '\n') + goto hashing_done; + } + h = HASH (h, ' '); + } + /* C is now the first non-space. */ + h = HASH (h, c); + } + else + while ((c = *p++) != '\n') + h = HASH (h, c); + } + hashing_done:; + + bucket = &buckets[h % nbuckets]; + length = (char const *) p - ip - 1; + + if ((char const *) p == bufend + && current->missing_newline + && ROBUST_OUTPUT_STYLE (output_style)) + { + /* This line is incomplete. If this is significant, + put the line into bucket[-1]. */ + if (! (ignore_space_change_flag | ignore_all_space_flag)) + bucket = &buckets[-1]; + + /* Omit the inserted newline when computing linbuf later. */ + p--; + bufend = suffix_begin = (char const *) p; + } + + for (i = *bucket; ; i = eqs[i].next) + if (!i) + { + /* Create a new equivalence class in this bucket. */ + i = eqs_index++; + if (i == eqs_alloc) + eqs = (struct equivclass *) + xrealloc (eqs, (eqs_alloc*=2) * sizeof(*eqs)); + eqs[i].next = *bucket; + eqs[i].hash = h; + eqs[i].line = ip; + eqs[i].length = length; + *bucket = i; + break; + } + else if (eqs[i].hash == h) + { + char const *eqline = eqs[i].line; + + /* Reuse existing equivalence class if the lines are identical. + This detects the common case of exact identity + faster than complete comparison would. */ + if (eqs[i].length == length && memcmp (eqline, ip, length) == 0) + break; + + /* Reuse existing class if line_cmp reports the lines equal. */ + if (use_line_cmp && line_cmp (eqline, ip) == 0) + break; + } + + /* Maybe increase the size of the line table. */ + if (line == alloc_lines) + { + /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ + alloc_lines = 2 * alloc_lines - linbuf_base; + cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs)); + linbuf = (char const **) xrealloc (linbuf + linbuf_base, + (alloc_lines - linbuf_base) + * sizeof (*linbuf)) + - linbuf_base; + } + linbuf[line] = ip; + cureqs[line] = i; + ++line; + } + + current->buffered_lines = line; + + for (i = 0; ; i++) + { + /* Record the line start for lines in the suffix that we care about. + Record one more line start than lines, + so that we can compute the length of any buffered line. */ + if (line == alloc_lines) + { + /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ + alloc_lines = 2 * alloc_lines - linbuf_base; + linbuf = (char const **) xrealloc (linbuf + linbuf_base, + (alloc_lines - linbuf_base) + * sizeof (*linbuf)) + - linbuf_base; + } + linbuf[line] = (char const *) p; + + if ((char const *) p == bufend) + break; + + if (context <= i && no_diff_means_no_output) + break; + + line++; + + while (*p++ != '\n') + ; + } + + /* Done with cache in local variables. */ + current->linbuf = linbuf; + current->valid_lines = line; + current->alloc_lines = alloc_lines; + current->equivs = cureqs; + equivs = eqs; + equivs_alloc = eqs_alloc; + equivs_index = eqs_index; +} + +/* Prepare the end of the text. Make sure it's initialized. + Make sure text ends in a newline, + but remember that we had to add one. */ + +static void +prepare_text_end (current) + struct file_data *current; +{ + size_t buffered_chars = current->buffered_chars; + char *p = current->buffer; + + if (buffered_chars == 0 || p[buffered_chars - 1] == '\n') + current->missing_newline = 0; + else + { + p[buffered_chars++] = '\n'; + current->buffered_chars = buffered_chars; + current->missing_newline = 1; + } + + /* Don't use uninitialized storage when planting or using sentinels. */ + if (p) + bzero (p + buffered_chars, sizeof (word)); +} + +/* Given a vector of two file_data objects, find the identical + prefixes and suffixes of each object. */ + +static void +find_identical_ends (filevec) + struct file_data filevec[]; +{ + word *w0, *w1; + char *p0, *p1, *buffer0, *buffer1; + char const *end0, *beg0; + char const **linbuf0, **linbuf1; + int i, lines; + size_t n0, n1, tem; + int alloc_lines0, alloc_lines1; + int buffered_prefix, prefix_count, prefix_mask; + + slurp (&filevec[0]); + if (filevec[0].desc != filevec[1].desc) + slurp (&filevec[1]); + else + { + filevec[1].buffer = filevec[0].buffer; + filevec[1].bufsize = filevec[0].bufsize; + filevec[1].buffered_chars = filevec[0].buffered_chars; + } + for (i = 0; i < 2; i++) + prepare_text_end (&filevec[i]); + + /* Find identical prefix. */ + + p0 = buffer0 = filevec[0].buffer; + p1 = buffer1 = filevec[1].buffer; + + n0 = filevec[0].buffered_chars; + n1 = filevec[1].buffered_chars; + + if (p0 == p1) + /* The buffers are the same; sentinels won't work. */ + p0 = p1 += n1; + else + { + /* Insert end sentinels, in this case characters that are guaranteed + to make the equality test false, and thus terminate the loop. */ + + if (n0 < n1) + p0[n0] = ~p1[n0]; + else + p1[n1] = ~p0[n1]; + + /* Loop until first mismatch, or to the sentinel characters. */ + + /* Compare a word at a time for speed. */ + w0 = (word *) p0; + w1 = (word *) p1; + while (*w0++ == *w1++) + ; + --w0, --w1; + + /* Do the last few bytes of comparison a byte at a time. */ + p0 = (char *) w0; + p1 = (char *) w1; + while (*p0++ == *p1++) + ; + --p0, --p1; + + /* Don't mistakenly count missing newline as part of prefix. */ + if (ROBUST_OUTPUT_STYLE (output_style) + && (buffer0 + n0 - filevec[0].missing_newline < p0) + != + (buffer1 + n1 - filevec[1].missing_newline < p1)) + --p0, --p1; + } + + /* Now P0 and P1 point at the first nonmatching characters. */ + + /* Skip back to last line-beginning in the prefix, + and then discard up to HORIZON_LINES lines from the prefix. */ + i = horizon_lines; + while (p0 != buffer0 && (p0[-1] != '\n' || i--)) + --p0, --p1; + + /* Record the prefix. */ + filevec[0].prefix_end = p0; + filevec[1].prefix_end = p1; + + /* Find identical suffix. */ + + /* P0 and P1 point beyond the last chars not yet compared. */ + p0 = buffer0 + n0; + p1 = buffer1 + n1; + + if (! ROBUST_OUTPUT_STYLE (output_style) + || filevec[0].missing_newline == filevec[1].missing_newline) + { + end0 = p0; /* Addr of last char in file 0. */ + + /* Get value of P0 at which we should stop scanning backward: + this is when either P0 or P1 points just past the last char + of the identical prefix. */ + beg0 = filevec[0].prefix_end + (n0 < n1 ? 0 : n0 - n1); + + /* Scan back until chars don't match or we reach that point. */ + while (p0 != beg0) + if (*--p0 != *--p1) + { + /* Point at the first char of the matching suffix. */ + ++p0, ++p1; + beg0 = p0; + break; + } + + /* Are we at a line-beginning in both files? If not, add the rest of + this line to the main body. Discard up to HORIZON_LINES lines from + the identical suffix. Also, discard one extra line, + because shift_boundaries may need it. */ + i = horizon_lines + !((buffer0 == p0 || p0[-1] == '\n') + && + (buffer1 == p1 || p1[-1] == '\n')); + while (i-- && p0 != end0) + while (*p0++ != '\n') + ; + + p1 += p0 - beg0; + } + + /* Record the suffix. */ + filevec[0].suffix_begin = p0; + filevec[1].suffix_begin = p1; + + /* Calculate number of lines of prefix to save. + + prefix_count == 0 means save the whole prefix; + we need this with for options like -D that output the whole file. + We also need it for options like -F that output some preceding line; + at least we will need to find the last few lines, + but since we don't know how many, it's easiest to find them all. + + Otherwise, prefix_count != 0. Save just prefix_count lines at start + of the line buffer; they'll be moved to the proper location later. + Handle 1 more line than the context says (because we count 1 too many), + rounded up to the next power of 2 to speed index computation. */ + + if (no_diff_means_no_output && ! function_regexp_list) + { + for (prefix_count = 1; prefix_count < context + 1; prefix_count *= 2) + ; + prefix_mask = prefix_count - 1; + alloc_lines0 + = prefix_count + + GUESS_LINES (0, 0, p0 - filevec[0].prefix_end) + + context; + } + else + { + prefix_count = 0; + prefix_mask = ~0; + alloc_lines0 = GUESS_LINES (0, 0, n0); + } + + lines = 0; + linbuf0 = (char const **) xmalloc (alloc_lines0 * sizeof (*linbuf0)); + + /* If the prefix is needed, find the prefix lines. */ + if (! (no_diff_means_no_output + && filevec[0].prefix_end == p0 + && filevec[1].prefix_end == p1)) + { + p0 = buffer0; + end0 = filevec[0].prefix_end; + while (p0 != end0) + { + int l = lines++ & prefix_mask; + if (l == alloc_lines0) + linbuf0 = (char const **) xrealloc (linbuf0, (alloc_lines0 *= 2) + * sizeof(*linbuf0)); + linbuf0[l] = p0; + while (*p0++ != '\n') + ; + } + } + buffered_prefix = prefix_count && context < lines ? context : lines; + + /* Allocate line buffer 1. */ + tem = prefix_count ? filevec[1].suffix_begin - buffer1 : n1; + + alloc_lines1 + = (buffered_prefix + + GUESS_LINES (lines, filevec[1].prefix_end - buffer1, tem) + + context); + linbuf1 = (char const **) xmalloc (alloc_lines1 * sizeof (*linbuf1)); + + if (buffered_prefix != lines) + { + /* Rotate prefix lines to proper location. */ + for (i = 0; i < buffered_prefix; i++) + linbuf1[i] = linbuf0[(lines - context + i) & prefix_mask]; + for (i = 0; i < buffered_prefix; i++) + linbuf0[i] = linbuf1[i]; + } + + /* Initialize line buffer 1 from line buffer 0. */ + for (i = 0; i < buffered_prefix; i++) + linbuf1[i] = linbuf0[i] - buffer0 + buffer1; + + /* Record the line buffer, adjusted so that + linbuf*[0] points at the first differing line. */ + filevec[0].linbuf = linbuf0 + buffered_prefix; + filevec[1].linbuf = linbuf1 + buffered_prefix; + filevec[0].linbuf_base = filevec[1].linbuf_base = - buffered_prefix; + filevec[0].alloc_lines = alloc_lines0 - buffered_prefix; + filevec[1].alloc_lines = alloc_lines1 - buffered_prefix; + filevec[0].prefix_lines = filevec[1].prefix_lines = lines; +} + +/* Largest primes less than some power of two, for nbuckets. Values range + from useful to preposterous. If one of these numbers isn't prime + after all, don't blame it on me, blame it on primes (6) . . . */ +static int const primes[] = +{ + 509, + 1021, + 2039, + 4093, + 8191, + 16381, + 32749, +#if 32767 < INT_MAX + 65521, + 131071, + 262139, + 524287, + 1048573, + 2097143, + 4194301, + 8388593, + 16777213, + 33554393, + 67108859, /* Preposterously large . . . */ + 134217689, + 268435399, + 536870909, + 1073741789, + 2147483647, +#endif + 0 +}; + +/* Given a vector of two file_data objects, read the file associated + with each one, and build the table of equivalence classes. + Return 1 if either file appears to be a binary file. + If PRETEND_BINARY is nonzero, pretend they are binary regardless. */ + +int +read_files (filevec, pretend_binary) + struct file_data filevec[]; + int pretend_binary; +{ + int i; + int skip_test = always_text_flag | pretend_binary; + int appears_binary = pretend_binary | sip (&filevec[0], skip_test); + + if (filevec[0].desc != filevec[1].desc) + appears_binary |= sip (&filevec[1], skip_test | appears_binary); + else + { + filevec[1].buffer = filevec[0].buffer; + filevec[1].bufsize = filevec[0].bufsize; + filevec[1].buffered_chars = filevec[0].buffered_chars; + } + if (appears_binary) + { +#if HAVE_SETMODE + setmode (filevec[0].desc, O_BINARY); + setmode (filevec[1].desc, O_BINARY); +#endif + return 1; + } + + find_identical_ends (filevec); + + equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1; + equivs = (struct equivclass *) xmalloc (equivs_alloc * sizeof (struct equivclass)); + /* Equivalence class 0 is permanently safe for lines that were not + hashed. Real equivalence classes start at 1. */ + equivs_index = 1; + + for (i = 0; primes[i] < equivs_alloc / 3; i++) + if (! primes[i]) + abort (); + nbuckets = primes[i]; + + buckets = (int *) xmalloc ((nbuckets + 1) * sizeof (*buckets)); + bzero (buckets++, (nbuckets + 1) * sizeof (*buckets)); + + for (i = 0; i < 2; i++) + find_and_hash_each_line (&filevec[i]); + + filevec[0].equiv_max = filevec[1].equiv_max = equivs_index; + + free (equivs); + free (buckets - 1); + + return 0; +} diff --git a/gnu/usr.bin/cvs/diff/normal.c b/gnu/usr.bin/cvs/diff/normal.c new file mode 100644 index 00000000000..4d9e23cb72a --- /dev/null +++ b/gnu/usr.bin/cvs/diff/normal.c @@ -0,0 +1,71 @@ +/* Normal-format output routines for GNU DIFF. + Copyright (C) 1988, 1989, 1993 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + + +#include "diff.h" + +static void print_normal_hunk PARAMS((struct change *)); + +/* Print the edit-script SCRIPT as a normal diff. + INF points to an array of descriptions of the two files. */ + +void +print_normal_script (script) + struct change *script; +{ + print_script (script, find_change, print_normal_hunk); +} + +/* Print a hunk of a normal diff. + This is a contiguous portion of a complete edit script, + describing changes in consecutive lines. */ + +static void +print_normal_hunk (hunk) + struct change *hunk; +{ + int first0, last0, first1, last1, deletes, inserts; + register int i; + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts); + if (!deletes && !inserts) + return; + + begin_output (); + + /* Print out the line number header for this hunk */ + print_number_range (',', &files[0], first0, last0); + fprintf (outfile, "%c", change_letter (inserts, deletes)); + print_number_range (',', &files[1], first1, last1); + fprintf (outfile, "\n"); + + /* Print the lines that the first file has. */ + if (deletes) + for (i = first0; i <= last0; i++) + print_1_line ("<", &files[0].linbuf[i]); + + if (inserts && deletes) + fprintf (outfile, "---\n"); + + /* Print the lines that the second file has. */ + if (inserts) + for (i = first1; i <= last1; i++) + print_1_line (">", &files[1].linbuf[i]); +} diff --git a/gnu/usr.bin/cvs/diff/side.c b/gnu/usr.bin/cvs/diff/side.c new file mode 100644 index 00000000000..a150b5e705f --- /dev/null +++ b/gnu/usr.bin/cvs/diff/side.c @@ -0,0 +1,284 @@ +/* sdiff-format output routines for GNU DIFF. + Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +This file is part of GNU DIFF. + +GNU DIFF is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY. No author or distributor +accepts responsibility to anyone for the consequences of using it +or for whether it serves any particular purpose or works at all, +unless he says so in writing. Refer to the GNU DIFF General Public +License for full details. + +Everyone is granted permission to copy, modify and redistribute +GNU DIFF, but only under the conditions described in the +GNU DIFF General Public License. A copy of this license is +supposed to have been given to you along with GNU DIFF so you +can know your rights and responsibilities. It should be in a +file named COPYING. Among other things, the copyright notice +and this notice must be preserved on all copies. */ + + +#include "diff.h" + +static unsigned print_half_line PARAMS((char const * const *, unsigned, unsigned)); +static unsigned tab_from_to PARAMS((unsigned, unsigned)); +static void print_1sdiff_line PARAMS((char const * const *, int, char const * const *)); +static void print_sdiff_common_lines PARAMS((int, int)); +static void print_sdiff_hunk PARAMS((struct change *)); + +/* Next line number to be printed in the two input files. */ +static int next0, next1; + +/* Print the edit-script SCRIPT as a sdiff style output. */ + +void +print_sdiff_script (script) + struct change *script; +{ + begin_output (); + + next0 = next1 = - files[0].prefix_lines; + print_script (script, find_change, print_sdiff_hunk); + + print_sdiff_common_lines (files[0].valid_lines, files[1].valid_lines); +} + +/* Tab from column FROM to column TO, where FROM <= TO. Yield TO. */ + +static unsigned +tab_from_to (from, to) + unsigned from, to; +{ + FILE *out = outfile; + unsigned tab; + + if (! tab_expand_flag) + for (tab = from + TAB_WIDTH - from % TAB_WIDTH; tab <= to; tab += TAB_WIDTH) + { + putc ('\t', out); + from = tab; + } + while (from++ < to) + putc (' ', out); + return to; +} + +/* + * Print the text for half an sdiff line. This means truncate to width + * observing tabs, and trim a trailing newline. Returns the last column + * written (not the number of chars). + */ +static unsigned +print_half_line (line, indent, out_bound) + char const * const *line; + unsigned indent, out_bound; +{ + FILE *out = outfile; + register unsigned in_position = 0, out_position = 0; + register char const + *text_pointer = line[0], + *text_limit = line[1]; + + while (text_pointer < text_limit) + { + register unsigned char c = *text_pointer++; + + switch (c) + { + case '\t': + { + unsigned spaces = TAB_WIDTH - in_position % TAB_WIDTH; + if (in_position == out_position) + { + unsigned tabstop = out_position + spaces; + if (tab_expand_flag) + { + if (out_bound < tabstop) + tabstop = out_bound; + for (; out_position < tabstop; out_position++) + putc (' ', out); + } + else + if (tabstop < out_bound) + { + out_position = tabstop; + putc (c, out); + } + } + in_position += spaces; + } + break; + + case '\r': + { + putc (c, out); + tab_from_to (0, indent); + in_position = out_position = 0; + } + break; + + case '\b': + if (in_position != 0 && --in_position < out_bound) + if (out_position <= in_position) + /* Add spaces to make up for suppressed tab past out_bound. */ + for (; out_position < in_position; out_position++) + putc (' ', out); + else + { + out_position = in_position; + putc (c, out); + } + break; + + case '\f': + case '\v': + control_char: + if (in_position < out_bound) + putc (c, out); + break; + + default: + if (! ISPRINT (c)) + goto control_char; + /* falls through */ + case ' ': + if (in_position++ < out_bound) + { + out_position = in_position; + putc (c, out); + } + break; + + case '\n': + return out_position; + } + } + + return out_position; +} + +/* + * Print side by side lines with a separator in the middle. + * 0 parameters are taken to indicate white space text. + * Blank lines that can easily be caught are reduced to a single newline. + */ + +static void +print_1sdiff_line (left, sep, right) + char const * const *left; + int sep; + char const * const *right; +{ + FILE *out = outfile; + unsigned hw = sdiff_half_width, c2o = sdiff_column2_offset; + unsigned col = 0; + int put_newline = 0; + + if (left) + { + if (left[1][-1] == '\n') + put_newline = 1; + col = print_half_line (left, 0, hw); + } + + if (sep != ' ') + { + col = tab_from_to (col, (hw + c2o - 1) / 2) + 1; + if (sep == '|' && put_newline != (right[1][-1] == '\n')) + sep = put_newline ? '/' : '\\'; + putc (sep, out); + } + + if (right) + { + if (right[1][-1] == '\n') + put_newline = 1; + if (**right != '\n') + { + col = tab_from_to (col, c2o); + print_half_line (right, col, hw); + } + } + + if (put_newline) + putc ('\n', out); +} + +/* Print lines common to both files in side-by-side format. */ +static void +print_sdiff_common_lines (limit0, limit1) + int limit0, limit1; +{ + int i0 = next0, i1 = next1; + + if (! sdiff_skip_common_lines && (i0 != limit0 || i1 != limit1)) + { + if (sdiff_help_sdiff) + fprintf (outfile, "i%d,%d\n", limit0 - i0, limit1 - i1); + + if (! sdiff_left_only) + { + while (i0 != limit0 && i1 != limit1) + print_1sdiff_line (&files[0].linbuf[i0++], ' ', &files[1].linbuf[i1++]); + while (i1 != limit1) + print_1sdiff_line (0, ')', &files[1].linbuf[i1++]); + } + while (i0 != limit0) + print_1sdiff_line (&files[0].linbuf[i0++], '(', 0); + } + + next0 = limit0; + next1 = limit1; +} + +/* Print a hunk of an sdiff diff. + This is a contiguous portion of a complete edit script, + describing changes in consecutive lines. */ + +static void +print_sdiff_hunk (hunk) + struct change *hunk; +{ + int first0, last0, first1, last1, deletes, inserts; + register int i, j; + + /* Determine range of line numbers involved in each file. */ + analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts); + if (!deletes && !inserts) + return; + + /* Print out lines up to this change. */ + print_sdiff_common_lines (first0, first1); + + if (sdiff_help_sdiff) + fprintf (outfile, "c%d,%d\n", last0 - first0 + 1, last1 - first1 + 1); + + /* Print ``xxx | xxx '' lines */ + if (inserts && deletes) + { + for (i = first0, j = first1; i <= last0 && j <= last1; ++i, ++j) + print_1sdiff_line (&files[0].linbuf[i], '|', &files[1].linbuf[j]); + deletes = i <= last0; + inserts = j <= last1; + next0 = first0 = i; + next1 = first1 = j; + } + + + /* Print `` > xxx '' lines */ + if (inserts) + { + for (j = first1; j <= last1; ++j) + print_1sdiff_line (0, '>', &files[1].linbuf[j]); + next1 = j; + } + + /* Print ``xxx < '' lines */ + if (deletes) + { + for (i = first0; i <= last0; ++i) + print_1sdiff_line (&files[0].linbuf[i], '<', 0); + next0 = i; + } +} diff --git a/gnu/usr.bin/cvs/diff/system.h b/gnu/usr.bin/cvs/diff/system.h new file mode 100644 index 00000000000..7812b767592 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/system.h @@ -0,0 +1,270 @@ +/* System dependent declarations. + Copyright (C) 1988, 1989, 1992, 1993, 1994 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* We must define `volatile' and `const' first (the latter inside config.h), + so that they're used consistently in all system includes. */ +#if !__STDC__ +#ifndef volatile +#define volatile +#endif +#endif +#include <config.h> + +#include <sys/types.h> +#include <sys/stat.h> + +#if __STDC__ +#define PARAMS(args) args +#define VOID void +#else +#define PARAMS(args) () +#define VOID char +#endif + +#if STAT_MACROS_BROKEN +#undef S_ISBLK +#undef S_ISCHR +#undef S_ISDIR +#undef S_ISFIFO +#undef S_ISREG +#undef S_ISSOCK +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif +#if !defined(S_ISBLK) && defined(S_IFBLK) +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#endif +#if !defined(S_ISCHR) && defined(S_IFCHR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif +#if !defined(S_ISFIFO) && defined(S_IFFIFO) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) +#endif +#if !defined(S_ISSOCK) && defined(S_IFSOCK) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif + +#if HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#endif + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +/* I believe that all relevant systems have + time.h. It is in ANSI, for example. The + code below looks quite bogus as I don't think + sys/time.h is ever a substitute for time.h; + it is something different. */ +#define HAVE_TIME_H 1 + +#if HAVE_TIME_H +#include <time.h> +#else +#include <sys/time.h> +#endif + +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif + +#if HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +#ifndef STAT_BLOCKSIZE +#if HAVE_ST_BLKSIZE +#define STAT_BLOCKSIZE(s) (s).st_blksize +#else +#define STAT_BLOCKSIZE(s) (8 * 1024) +#endif +#endif + +#if HAVE_DIRENT_H +# include <dirent.h> +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) ((dirent)->d_namlen) +# if HAVE_SYS_NDIR_H +# include <sys/ndir.h> +# endif +# if HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif +# if HAVE_NDIR_H +# include <ndir.h> +# endif +#endif + +#if HAVE_VFORK_H +#include <vfork.h> +#endif + +#if HAVE_STDLIB_H || defined(STDC_HEADERS) +#include <stdlib.h> +#else +VOID *malloc (); +VOID *realloc (); +#endif +#ifndef getenv +char *getenv (); +#endif + +#if HAVE_LIMITS_H +#include <limits.h> +#endif +#ifndef INT_MAX +#define INT_MAX 2147483647 +#endif +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#if STDC_HEADERS || HAVE_STRING_H +# include <string.h> +# ifndef bzero +# define bzero(s, n) memset (s, 0, n) +# endif +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# if !HAVE_MEMCHR +# define memcmp(s1, s2, n) bcmp (s1, s2, n) +# define memcpy(d, s, n) bcopy (s, d, n) +void *memchr (); +# endif +#endif + +#include <ctype.h> +/* CTYPE_DOMAIN (C) is nonzero if the unsigned char C can safely be given + as an argument to <ctype.h> macros like `isspace'. */ +#if STDC_HEADERS +#define CTYPE_DOMAIN(c) 1 +#else +#define CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177) +#endif +#ifndef ISPRINT +#define ISPRINT(c) (CTYPE_DOMAIN (c) && isprint (c)) +#endif +#ifndef ISSPACE +#define ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c)) +#endif +#ifndef ISUPPER +#define ISUPPER(c) (CTYPE_DOMAIN (c) && isupper (c)) +#endif + +#ifndef ISDIGIT +#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) +#endif + +#include <errno.h> +#if !STDC_HEADERS +extern int errno; +#endif + +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#define max(a,b) ((a) >= (b) ? (a) : (b)) + +/* This section contains Posix-compliant defaults for macros + that are meant to be overridden by hand in config.h as needed. */ + +#ifndef filename_cmp +#define filename_cmp(a, b) strcmp (a, b) +#endif + +#ifndef filename_lastdirchar +#define filename_lastdirchar(filename) strrchr (filename, '/') +#endif + +#ifndef HAVE_FORK +#define HAVE_FORK 1 +#endif + +#ifndef HAVE_SETMODE +#define HAVE_SETMODE 0 +#endif + +#ifndef initialize_main +#define initialize_main(argcp, argvp) +#endif + +/* Do struct stat *S, *T describe the same file? Answer -1 if unknown. */ +#ifndef same_file +#define same_file(s,t) ((s)->st_ino==(t)->st_ino && (s)->st_dev==(t)->st_dev) +#endif + +/* Place into Q a quoted version of A suitable for `popen' or `system', + incrementing Q and junking A. + Do not increment Q by more than 4 * strlen (A) + 2. */ +#ifndef SYSTEM_QUOTE_ARG +#define SYSTEM_QUOTE_ARG(q, a) \ + { \ + *(q)++ = '\''; \ + for (; *(a); *(q)++ = *(a)++) \ + if (*(a) == '\'') \ + { \ + *(q)++ = '\''; \ + *(q)++ = '\\'; \ + *(q)++ = '\''; \ + } \ + *(q)++ = '\''; \ + } +#endif diff --git a/gnu/usr.bin/cvs/diff/util.c b/gnu/usr.bin/cvs/diff/util.c new file mode 100644 index 00000000000..89cc2741786 --- /dev/null +++ b/gnu/usr.bin/cvs/diff/util.c @@ -0,0 +1,722 @@ +/* Support routines for GNU DIFF. + Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997 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. + +You should have received a copy of the GNU General Public License +along with GNU DIFF; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "diff.h" + +/* Queue up one-line messages to be printed at the end, + when -l is specified. Each message is recorded with a `struct msg'. */ + +struct msg +{ + struct msg *next; + char const *format; + char const *arg1; + char const *arg2; + char const *arg3; + char const *arg4; +}; + +/* Head of the chain of queues messages. */ + +static struct msg *msg_chain; + +/* Tail of the chain of queues messages. */ + +static struct msg **msg_chain_end = &msg_chain; + +/* Use when a system call returns non-zero status. + TEXT should normally be the file name. */ + +void +perror_with_name (text) + char const *text; +{ + int e = errno; + fprintf (stderr, "%s: ", diff_program_name); + errno = e; + perror (text); +} + +/* Use when a system call returns non-zero status and that is fatal. */ + +void +pfatal_with_name (text) + char const *text; +{ + int e = errno; + print_message_queue (); + fprintf (stderr, "%s: ", diff_program_name); + errno = e; + perror (text); + DIFF_ABORT (2); +} + +/* Print an error message from the format-string FORMAT + with args ARG1 and ARG2. */ + +void +diff_error (format, arg, arg1) + char const *format, *arg, *arg1; +{ + fprintf (stderr, "%s: ", diff_program_name); + fprintf (stderr, format, arg, arg1); + fprintf (stderr, "\n"); +} + +/* Print an error message containing the string TEXT, then exit. */ + +void +fatal (m) + char const *m; +{ + print_message_queue (); + diff_error ("%s", m, 0); + DIFF_ABORT (2); +} + +/* Like printf, except if -l in effect then save the message and print later. + This is used for things like "binary files differ" and "Only in ...". */ + +void +message (format, arg1, arg2) + char const *format, *arg1, *arg2; +{ + message5 (format, arg1, arg2, 0, 0); +} + +void +message5 (format, arg1, arg2, arg3, arg4) + char const *format, *arg1, *arg2, *arg3, *arg4; +{ + if (paginate_flag) + { + struct msg *new = (struct msg *) xmalloc (sizeof (struct msg)); + new->format = format; + new->arg1 = concat (arg1, "", ""); + new->arg2 = concat (arg2, "", ""); + new->arg3 = arg3 ? concat (arg3, "", "") : 0; + new->arg4 = arg4 ? concat (arg4, "", "") : 0; + new->next = 0; + *msg_chain_end = new; + msg_chain_end = &new->next; + } + else + { + if (sdiff_help_sdiff) + putc (' ', outfile); + fprintf (outfile, format, arg1, arg2, arg3, arg4); + } +} + +/* Output all the messages that were saved up by calls to `message'. */ + +void +print_message_queue () +{ + struct msg *m; + + for (m = msg_chain; m; m = m->next) + fprintf (outfile, m->format, m->arg1, m->arg2, m->arg3, m->arg4); +} + +/* Call before outputting the results of comparing files NAME0 and NAME1 + to set up OUTFILE, the stdio stream for the output to go to. + + Usually, OUTFILE is just stdout. But when -l was specified + we fork off a `pr' and make OUTFILE a pipe to it. + `pr' then outputs to our stdout. */ + +static char const *current_name0; +static char const *current_name1; +static int current_depth; + +static int output_in_progress = 0; + +void +setup_output (name0, name1, depth) + char const *name0, *name1; + int depth; +{ + current_name0 = name0; + current_name1 = name1; + current_depth = depth; +} + +#if HAVE_FORK && defined (PR_PROGRAM) +static pid_t pr_pid; +#endif + +void +begin_output () +{ + char *name; + + if (output_in_progress) + return; + output_in_progress = 1; + + /* Construct the header of this piece of diff. */ + name = xmalloc (strlen (current_name0) + strlen (current_name1) + + strlen (switch_string) + 7); + /* Posix.2 section 4.17.6.1.1 specifies this format. But there is a + bug in the first printing (IEEE Std 1003.2-1992 p 251 l 3304): + it says that we must print only the last component of the pathnames. + This requirement is silly and does not match historical practice. */ + sprintf (name, "diff%s %s %s", switch_string, current_name0, current_name1); + + if (paginate_flag) + { + /* Make OUTFILE a pipe to a subsidiary `pr'. */ + +#ifdef PR_PROGRAM + +# if HAVE_FORK + int pipes[2]; + + if (pipe (pipes) != 0) + pfatal_with_name ("pipe"); + + fflush (stdout); + + pr_pid = vfork (); + if (pr_pid < 0) + pfatal_with_name ("vfork"); + + if (pr_pid == 0) + { + close (pipes[1]); + if (pipes[0] != STDIN_FILENO) + { + if (dup2 (pipes[0], STDIN_FILENO) < 0) + pfatal_with_name ("dup2"); + close (pipes[0]); + } + + execl (PR_PROGRAM, PR_PROGRAM, "-f", "-h", name, 0); + pfatal_with_name (PR_PROGRAM); + } + else + { + close (pipes[0]); + outfile = fdopen (pipes[1], "w"); + if (!outfile) + pfatal_with_name ("fdopen"); + } +# else /* ! HAVE_FORK */ + char *command = xmalloc (4 * strlen (name) + strlen (PR_PROGRAM) + 10); + char *p; + char const *a = name; + sprintf (command, "%s -f -h ", PR_PROGRAM); + p = command + strlen (command); + SYSTEM_QUOTE_ARG (p, a); + *p = 0; + outfile = popen (command, "w"); + if (!outfile) + pfatal_with_name (command); + free (command); +# endif /* ! HAVE_FORK */ +#else + fatal ("This port does not support the --paginate option to diff."); +#endif + } + else + { + + /* If -l was not specified, output the diff straight to `stdout'. */ + + /* If handling multiple files (because scanning a directory), + print which files the following output is about. */ + if (current_depth > 0) + fprintf (outfile, "%s\n", name); + } + + free (name); + + /* A special header is needed at the beginning of context output. */ + switch (output_style) + { + case OUTPUT_CONTEXT: + print_context_header (files, 0); + break; + + case OUTPUT_UNIFIED: + print_context_header (files, 1); + break; + + default: + break; + } +} + +/* Call after the end of output of diffs for one file. + If -l was given, close OUTFILE and get rid of the `pr' subfork. */ + +void +finish_output () +{ + if (paginate_flag && outfile != 0 && outfile != stdout) + { +#ifdef PR_PROGRAM + int wstatus; + if (ferror (outfile)) + fatal ("write error"); +# if ! HAVE_FORK + wstatus = pclose (outfile); +# else /* HAVE_FORK */ + if (fclose (outfile) != 0) + pfatal_with_name ("write error"); + if (waitpid (pr_pid, &wstatus, 0) < 0) + pfatal_with_name ("waitpid"); +# endif /* HAVE_FORK */ + if (wstatus != 0) + fatal ("subsidiary pr failed"); +#else + fatal ("internal error in finish_output"); +#endif + } + + output_in_progress = 0; +} + +/* Compare two lines (typically one from each input file) + according to the command line options. + For efficiency, this is invoked only when the lines do not match exactly + but an option like -i might cause us to ignore the difference. + Return nonzero if the lines differ. */ + +int +line_cmp (s1, s2) + char const *s1, *s2; +{ + register unsigned char const *t1 = (unsigned char const *) s1; + register unsigned char const *t2 = (unsigned char const *) s2; + + while (1) + { + register unsigned char c1 = *t1++; + register unsigned char c2 = *t2++; + + /* Test for exact char equality first, since it's a common case. */ + if (c1 != c2) + { + /* Ignore horizontal white space if -b or -w is specified. */ + + if (ignore_all_space_flag) + { + /* For -w, just skip past any white space. */ + while (ISSPACE (c1) && c1 != '\n') c1 = *t1++; + while (ISSPACE (c2) && c2 != '\n') c2 = *t2++; + } + else if (ignore_space_change_flag) + { + /* For -b, advance past any sequence of white space in line 1 + and consider it just one Space, or nothing at all + if it is at the end of the line. */ + if (ISSPACE (c1)) + { + while (c1 != '\n') + { + c1 = *t1++; + if (! ISSPACE (c1)) + { + --t1; + c1 = ' '; + break; + } + } + } + + /* Likewise for line 2. */ + if (ISSPACE (c2)) + { + while (c2 != '\n') + { + c2 = *t2++; + if (! ISSPACE (c2)) + { + --t2; + c2 = ' '; + break; + } + } + } + + if (c1 != c2) + { + /* If we went too far when doing the simple test + for equality, go back to the first non-white-space + character in both sides and try again. */ + if (c2 == ' ' && c1 != '\n' + && (unsigned char const *) s1 + 1 < t1 + && ISSPACE(t1[-2])) + { + --t1; + continue; + } + if (c1 == ' ' && c2 != '\n' + && (unsigned char const *) s2 + 1 < t2 + && ISSPACE(t2[-2])) + { + --t2; + continue; + } + } + } + + /* Lowercase all letters if -i is specified. */ + + if (ignore_case_flag) + { + if (ISUPPER (c1)) + c1 = tolower (c1); + if (ISUPPER (c2)) + c2 = tolower (c2); + } + + if (c1 != c2) + break; + } + if (c1 == '\n') + return 0; + } + + return (1); +} + +/* Find the consecutive changes at the start of the script START. + Return the last link before the first gap. */ + +struct change * +find_change (start) + struct change *start; +{ + return start; +} + +struct change * +find_reverse_change (start) + struct change *start; +{ + return start; +} + +/* Divide SCRIPT into pieces by calling HUNKFUN and + print each piece with PRINTFUN. + Both functions take one arg, an edit script. + + HUNKFUN is called with the tail of the script + and returns the last link that belongs together with the start + of the tail. + + PRINTFUN takes a subscript which belongs together (with a null + link at the end) and prints it. */ + +void +print_script (script, hunkfun, printfun) + struct change *script; + struct change * (*hunkfun) PARAMS((struct change *)); + void (*printfun) PARAMS((struct change *)); +{ + struct change *next = script; + + while (next) + { + struct change *this, *end; + + /* Find a set of changes that belong together. */ + this = next; + end = (*hunkfun) (next); + + /* Disconnect them from the rest of the changes, + making them a hunk, and remember the rest for next iteration. */ + next = end->link; + end->link = 0; +#ifdef DEBUG + debug_script (this); +#endif + + /* Print this hunk. */ + (*printfun) (this); + + /* Reconnect the script so it will all be freed properly. */ + end->link = next; + } +} + +/* Print the text of a single line LINE, + flagging it with the characters in LINE_FLAG (which say whether + the line is inserted, deleted, changed, etc.). */ + +void +print_1_line (line_flag, line) + char const *line_flag; + char const * const *line; +{ + char const *text = line[0], *limit = line[1]; /* Help the compiler. */ + FILE *out = outfile; /* Help the compiler some more. */ + char const *flag_format = 0; + + /* If -T was specified, use a Tab between the line-flag and the text. + Otherwise use a Space (as Unix diff does). + Print neither space nor tab if line-flags are empty. */ + + if (line_flag && *line_flag) + { + flag_format = tab_align_flag ? "%s\t" : "%s "; + fprintf (out, flag_format, line_flag); + } + + output_1_line (text, limit, flag_format, line_flag); + + if ((!line_flag || line_flag[0]) && limit[-1] != '\n') + fprintf (out, "\n\\ No newline at end of file\n"); +} + +/* Output a line from TEXT up to LIMIT. Without -t, output verbatim. + With -t, expand white space characters to spaces, and if FLAG_FORMAT + is nonzero, output it with argument LINE_FLAG after every + internal carriage return, so that tab stops continue to line up. */ + +void +output_1_line (text, limit, flag_format, line_flag) + char const *text, *limit, *flag_format, *line_flag; +{ + if (!tab_expand_flag) + fwrite (text, sizeof (char), limit - text, outfile); + else + { + register FILE *out = outfile; + register unsigned char c; + register char const *t = text; + register unsigned column = 0; + + while (t < limit) + switch ((c = *t++)) + { + case '\t': + { + unsigned spaces = TAB_WIDTH - column % TAB_WIDTH; + column += spaces; + do + putc (' ', out); + while (--spaces); + } + break; + + case '\r': + putc (c, out); + if (flag_format && t < limit && *t != '\n') + fprintf (out, flag_format, line_flag); + column = 0; + break; + + case '\b': + if (column == 0) + continue; + column--; + putc (c, out); + break; + + default: + if (ISPRINT (c)) + column++; + putc (c, out); + break; + } + } +} + +int +change_letter (inserts, deletes) + int inserts, deletes; +{ + if (!inserts) + return 'd'; + else if (!deletes) + return 'a'; + else + return 'c'; +} + +/* Translate an internal line number (an index into diff's table of lines) + into an actual line number in the input file. + The internal line number is LNUM. FILE points to the data on the file. + + Internal line numbers count from 0 starting after the prefix. + Actual line numbers count from 1 within the entire file. */ + +int +translate_line_number (file, lnum) + struct file_data const *file; + int lnum; +{ + return lnum + file->prefix_lines + 1; +} + +void +translate_range (file, a, b, aptr, bptr) + struct file_data const *file; + int a, b; + int *aptr, *bptr; +{ + *aptr = translate_line_number (file, a - 1) + 1; + *bptr = translate_line_number (file, b + 1) - 1; +} + +/* Print a pair of line numbers with SEPCHAR, translated for file FILE. + If the two numbers are identical, print just one number. + + Args A and B are internal line numbers. + We print the translated (real) line numbers. */ + +void +print_number_range (sepchar, file, a, b) + int sepchar; + struct file_data *file; + int a, b; +{ + int trans_a, trans_b; + translate_range (file, a, b, &trans_a, &trans_b); + + /* Note: we can have B < A in the case of a range of no lines. + In this case, we should print the line number before the range, + which is B. */ + if (trans_b > trans_a) + fprintf (outfile, "%d%c%d", trans_a, sepchar, trans_b); + else + fprintf (outfile, "%d", trans_b); +} + +/* Look at a hunk of edit script and report the range of lines in each file + that it applies to. HUNK is the start of the hunk, which is a chain + of `struct change'. The first and last line numbers of file 0 are stored in + *FIRST0 and *LAST0, and likewise for file 1 in *FIRST1 and *LAST1. + Note that these are internal line numbers that count from 0. + + If no lines from file 0 are deleted, then FIRST0 is LAST0+1. + + Also set *DELETES nonzero if any lines of file 0 are deleted + and set *INSERTS nonzero if any lines of file 1 are inserted. + If only ignorable lines are inserted or deleted, both are + set to 0. */ + +void +analyze_hunk (hunk, first0, last0, first1, last1, deletes, inserts) + struct change *hunk; + int *first0, *last0, *first1, *last1; + int *deletes, *inserts; +{ + int l0, l1, show_from, show_to; + int i; + int trivial = ignore_blank_lines_flag || ignore_regexp_list; + struct change *next; + + show_from = show_to = 0; + + *first0 = hunk->line0; + *first1 = hunk->line1; + + next = hunk; + do + { + l0 = next->line0 + next->deleted - 1; + l1 = next->line1 + next->inserted - 1; + show_from += next->deleted; + show_to += next->inserted; + + for (i = next->line0; i <= l0 && trivial; i++) + if (!ignore_blank_lines_flag || files[0].linbuf[i][0] != '\n') + { + struct regexp_list *r; + char const *line = files[0].linbuf[i]; + int len = files[0].linbuf[i + 1] - line; + + for (r = ignore_regexp_list; r; r = r->next) + if (0 <= re_search (&r->buf, line, len, 0, len, 0)) + break; /* Found a match. Ignore this line. */ + /* If we got all the way through the regexp list without + finding a match, then it's nontrivial. */ + if (!r) + trivial = 0; + } + + for (i = next->line1; i <= l1 && trivial; i++) + if (!ignore_blank_lines_flag || files[1].linbuf[i][0] != '\n') + { + struct regexp_list *r; + char const *line = files[1].linbuf[i]; + int len = files[1].linbuf[i + 1] - line; + + for (r = ignore_regexp_list; r; r = r->next) + if (0 <= re_search (&r->buf, line, len, 0, len, 0)) + break; /* Found a match. Ignore this line. */ + /* If we got all the way through the regexp list without + finding a match, then it's nontrivial. */ + if (!r) + trivial = 0; + } + } + while ((next = next->link) != 0); + + *last0 = l0; + *last1 = l1; + + /* If all inserted or deleted lines are ignorable, + tell the caller to ignore this hunk. */ + + if (trivial) + show_from = show_to = 0; + + *deletes = show_from; + *inserts = show_to; +} + +/* Concatenate three strings, returning a newly malloc'd string. */ + +char * +concat (s1, s2, s3) + char const *s1, *s2, *s3; +{ + size_t len = strlen (s1) + strlen (s2) + strlen (s3); + char *new = xmalloc (len + 1); + sprintf (new, "%s%s%s", s1, s2, s3); + return new; +} + +/* Yield the newly malloc'd pathname + of the file in DIR whose filename is FILE. */ + +char * +dir_file_pathname (dir, file) + char const *dir, *file; +{ + char const *p = filename_lastdirchar (dir); + return concat (dir, "/" + (p && !p[1]), file); +} + +void +debug_script (sp) + struct change *sp; +{ + fflush (stdout); + for (; sp; sp = sp->link) + fprintf (stderr, "%3d %3d delete %d insert %d\n", + sp->line0, sp->line1, sp->deleted, sp->inserted); + fflush (stderr); +} diff --git a/gnu/usr.bin/cvs/diff/version.c b/gnu/usr.bin/cvs/diff/version.c new file mode 100644 index 00000000000..343a098371c --- /dev/null +++ b/gnu/usr.bin/cvs/diff/version.c @@ -0,0 +1,5 @@ +/* Version number of GNU diff. */ + +#include <config.h> + +char const diff_version_string[] = "2.7"; diff --git a/gnu/usr.bin/cvs/doc/ChangeLog b/gnu/usr.bin/cvs/doc/ChangeLog index c56c253aaaa..3fd44332d4f 100644 --- a/gnu/usr.bin/cvs/doc/ChangeLog +++ b/gnu/usr.bin/cvs/doc/ChangeLog @@ -1,5 +1,718 @@ +Wed Jan 28 23:09:39 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Excluding directories): Add index entry for "!". + +28 Jan 1998 Karl Fogel and Jim Kingdon + + * cvsclient.texi (Requests, Responses): document + "wrapper-sendme-rcsOptions" and "Wrapper-rcsOption". + +Tue Jan 27 18:37:37 1998 Ian Lance Taylor <ian@cygnus.com> + + * cvs.texinfo (Excluding directories): New node, documenting how + to exclude directories using ! in an alias module. + +Sun Jan 18 18:23:02 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Requests): Add Kopt request. + +Thu Jan 1 17:36:42 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (BUGS, Credits): Change @unnumbered to @appendix now + that these are moved from the start to the end. + +Sat Dec 27 10:06:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add "Too many arguments!". + +Fri Dec 26 18:30:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (What is CVS?): Just point to the two canonical web + sites (Pascal Molli and Cyclic) concerning CVS downloads. The GNU + URL was out of date and GNU only has source distributions anyway. + + * cvs.texinfo: Change bug-cvs address to gnu.org per email from + Martin Hamilton. + +Tue Dec 23 18:04:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Sticky tags): Further cleanups. Fix thinko + (s/subsequent cvs update/& commands/). Remove "vi driver.c" and + commit from example (totally vestigial). Reword start of + paragraph on non-branch sticky tags, so that it better alludes + to branch sticky tags. When introducing sticky tags, make it + clear that even people who aren't trying to use sticky tags + may need to know how to avoid them. Restore comment about + CVS/Tag files. + (Accessing branches): Don't xref to merging here; that is a much + more advanced topic and the "but see" wording didn't tell us what + to see the xref about. + +Tue Dec 23 14:39:08 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon + + * cvs.texinfo (Creating a branch): Rewritten. Introduce with + `tag', then discuss `rtag' and `-r'. + +Tue Dec 23 10:03:37 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon + + * cvs.texinfo: Changes to dehairify the "Sticky tags" situation: + (Revisions): "Sticky tags" moved here, description in menu changed + to be a little more informative. + (Sticky tags): Moved from "Branching and merging" to "Revisions". + (Accessing branches): New node in "Branching and merging", + explains how to use checkout vs update to retrieve a branch. + Text and example inherited from "Sticky tags", but text mostly + rewritten. + (Sticky tags): Moved under "Revisions", rewritten somewhat (more + rewrites to follow). + Don't use "-v" in "cvs status" example. + +Mon Dec 22 11:46:05 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon + + Cleanups related to recent separation of revisions from + branching/merging: + * cvs.texinfo (Revisions): Take paragraph introducing branches, + rewrite it and move it to "Branching and merging". + (Branching and merging): Also rewrite merging intro. + (Revision numbers): Don't go into detail about branch revision + numbers here, just mention that they happen and refer to new + node "Branches and revisions". + (Branches and revisions): New node under "Branching and merging", + inherits text from "Revision numbers". + (Creating a branch): Refer to "Branches and revisions" now, not + "Revision numbers". + (Binary why): Rewrite sentence which refers to merging, so that + it isn't specific to branch merging. + (Branches motivation): Fix typo (select -> elect). Add comment + about what this node is accomplishing, in general. + +Sun Dec 21 20:57:24 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon + + This is just moving text; related cleanups to follow. + * cvs.texinfo: Changes to put branching and merging together, and + keep it all separate from revisions: + (Revisions): Renamed from "Revisions and branches". + (Branching and merging): Renamed from "Merging". + (Branches motivation, Creating a branch, Sticky tags, Magic branch + numbers): these subnodes moved to "Branching and merging" from + "Revisions". + everywhere: Adjusted cross-references to cope with above. + +Sun Dec 21 20:36:39 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon + + Note that this is just moving text, not changing it: + * cvs.texinfo: divide top-level menu into sections. + (Multiple developers, Builds, Tracking sources, Keyword + substitution): moved to be in "CVS and the Real World" section. + (Compatibility): moved to be in "References" section. + +Mon Dec 22 08:54:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Example): In comment, in citing the BNF style + used in many RFCs, cite RFC2234 not RFC822 (now that the former is + out). + +Sun Dec 21 17:42:22 1997 Karl Fogel <kfogel@floss.red-bean.com> + + * cvs.texinfo (Overview): New node. + (What is CVS?, A sample session): Put under Overview. + (What is CVS not?): New node under Overview. + [text previously was part of "What is CVS?" -kingdon] + (Preface): Removed this node and its contents. + (Checklist): Removed this node and its contents. + (Credits): Now toward end of top-level menu (was under Preface). + (BUGS): Now toward end of top-level menu (was under Preface). + +Sun Dec 14 10:14:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Responses): Add MT response. + (Text tags): New node. + + * cvs.texinfo (loginfo): Add comment about which commands run + loginfo. + +Sat Dec 13 08:41:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Connection and Authentication): State that + GSSAPI is preferred to kserver. Try to be clearer about what + the term "pserver" means. Introduce GSSAPI and cite the relevant + RFCs. Discuss the limitations of the existing features in + preventing hijacking. + + * cvs.texinfo (GSSAPI authenticated, Kerberos authenticated): + Briefly introduce what GSSAPI and Kerberos are. Be slightly more + emphatic about protecting against downgrade attacks. + +Fri Dec 12 17:36:46 1997 Ian Lance Taylor <ian@cygnus.com> + + * cvs.texinfo (GSSAPI authenticated): New node. + (Global options): Document -a. Mention GSSAPI in -x + documentation. + * cvsclient.texi (Connection and Authentication): Document GSSAPI + authentication. + (Requests): Add Gssapi-encrypt and Gssapi-authenticate. + +Fri Dec 12 09:27:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (cvsignore): Add note about comments and the + space-separated nature of the syntax. + +Sun Dec 7 09:33:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (checkout): Clarify issues regarding updating + existing working directories. + +Sun Nov 30 20:38:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Wrappers): Add comment: we don't document %s. + +Mon Nov 24 23:00:09 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi: Move Protocol Notes node to the end. + + * cvsclient.texi (Request intro): new node/section. + (Protocol): added some introductory material. + Rearranged menu into General Conventions, Protocol specification, + and Example etc sections. + (File Modes): replaces Modes, for consistency. + +Sat Nov 22 12:29:58 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Entries Lines): Clarify options in entries line. + +Tue Nov 18 09:23:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Requests): Be more explicit about "export" and + entries lines. + + * Makefile.in (DISTFILES): Remove DIFFUTILS-2.7-BUG. + +Mon Nov 17 18:20:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (tag options): Expand comment with reference to FAQ. + +Fri Nov 14 11:02:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Update discussion of "dying gasps". + + * cvs.texinfo (tag options): Add FIXME comment about renaming tags. + +Thu Nov 13 10:20:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Common options): Remove also has a -f option with a + different meaning than most. + +Wed Nov 12 21:57:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (File permissions, Connecting via rsh, Environment + variables): When putting an environment variable in the index, say + it is an environment variable. Don't index the same name twice. + + * cvs.texinfo: Many edits to reflect the fact that CVS no longer + invokes external RCS programs. + +Tue Nov 11 15:15:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Locks, CVS in repository): New nodes, document the + locking scheme and briefly outline CVS and CVS/fileattr. + +Sun Nov 9 17:39:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * DIFFUTILS-2.7-BUG: Removed; the bug is fixed and the testcases + are incorporated into sanity.sh. + +Sat Nov 8 09:49:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Binary why): Try to be a little clearer about how + merges fit into CVS. Say it may be error prone to have developers + doing merges manually. + +Tue Nov 4 13:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (admin options): Add discussion of what happens if + there are tags. + +Fri Oct 31 00:04:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (admin options): Rewrite discussion of -o to + hopefully be clearer and to also document the new :: syntax. + (admin examples): Removed; incorporated into admin options. + (Invoking CVS): Wording fix for admin -o. + + * cvs.texinfo (Binary why): New node, talks about diff and merge. + (Binary howto): Renamed from Binary files. + (Binary files): Now just contains an introduction. + + * cvs.texinfo (Error messages): Add "could not merge" message. In + discussion of "Binary files . . . differ" message, mention that + this is only an issue with old verisons of CVS. + +Thu Oct 30 15:55:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add "authorization failed" message. + +Wed Oct 29 11:52:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo: Remove fake RCSid; we decided to remove rcsid's a + while ago. Cleanups suggested by Stephen Gildea (CVSROOT/passwd + has 2 or 3 fields; /user -> /usr; noone -> no one; in used -> in + use). Add comment about making compilers happy about rcsids. + +Sat Oct 25 00:58:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * RCSFILES: rcsfile.5 is correct about {num} after next being + optional. + +Wed Oct 22 10:08:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add message about unrecognized + response from cvs server. + +1997-10-11 Noel Cragg <noel@swish.red-bean.com> + + * cvs.texinfo (checkout options): describe how the `-d' and `-N' + flags really work. Give examples. + (export options): refer the reader to the descriptions for `-d' + and `-N' in checkout options, since the behavior is the same. + +Thu Oct 9 12:01:35 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (log options): Add comment about "cvs log -r". + +Wed Oct 8 10:24:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (rtag options): Add comment about how this is + confusing. + +Tue Sep 30 12:31:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Working directory storage): Add comment about + Entries.Static. + +Thu Sep 25 23:52:57 1997 Noel Cragg <noel@swish.red-bean.com> + + * cvsclient.texi (Responses): description of Module-expansion was + missing a carriage return after the @item clause. + +Wed Sep 24 12:04:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Remote repositories): Add comment about pserver + vs. having users create their own repositories. + +Sat Sep 20 00:59:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Keyword list): Change title from "RCS Keywords" to + "Keyword list" as it is CVS that expands them. + (Avoiding substitution): Change "rcs" to "cvs", in the context of + the program which expands keywords. + +Fri Sep 19 22:57:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * RCSFILES: Grammar fix in first paragraph. Re-word section on + dead newphrase. Add item about what it means if "expand" is omitted. + + * cvs.texinfo (Magic branch numbers): Change example branch number + from 1.2.3 to 1.2.4; CVS assigns even branch numbers and I don't + think vendor branches are very relevant to this example. + +Wed Sep 17 17:21:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (admin options): Add comment about "cvs admin -b" + (with no argument to the -b). + + * RCSFILES: "next" is optional, not required. + +Tue Sep 16 15:13:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Binary files): Add comment about another possible + way to auto-detect binary files. + +Sun Sep 14 12:38:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Conflicts example): Adjust text and comments + regarding conflict markers to reflect change in CVS. + +Wed Sep 10 12:44:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Server requirements): Add comment about server + disk usage in /tmp. + + * cvs.texinfo (Common options): More comments about date formats: + "now", "yesterday", and the "3 weeks ago" family. + +Tue Sep 9 13:09:58 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * DIFFUTILS-2.7-BUG: Eggert patch is preferred to Rittle one. + +Sun Sep 7 18:38:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (history options): Revise -e to say that it includes + future record types (and remove out of date list of what record + types it implies). + + * cvs.texinfo (Environment variables): Expand/correct discussion + of HOME, HOMEDRIVE, and HOMEPATH. + (Error messages): Add "could not find out home directory". + + * cvs.texinfo (update options): Reword -r doc to hopefully be + clearer that it takes either numeric or symbolic revision. + + * cvs.texinfo (syntax): Add comment about how regexp syntax may + be, er, creatively altered, by configure.in. + +Sat Sep 6 11:29:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Working directory storage): Document Baserev and + Baserev.tmp. + (Working directory storage): Adjust comment regarding CVS/* being + text files. + +Fri Sep 5 14:42:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (BUGS): Remove mention of unsupported resources page + on http://www.cyclic.com, as it might go away in a future + reorganization. + + * DIFFUTILS-2.7-BUG: Further info from Eggert. + +1997-09-05 Paul Eggert <eggert@twinsun.com> + + * DIFFUTILS-2.7-BUG: Explain how this bug will probably be + fixed in the next diffutils release. + +Thu Sep 4 17:09:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Binary files): Reword the section on what you need + to do with cvs admin -kb to hopefully be a bit clearer. Still not + ideal (see comment). + + * cvs.texinfo (modules): Break node into separate nodes for alias + modules, regular modules, ampersand modules, and options. Expand + text with more examples and explanations. Add index entries. + +Wed Sep 3 14:49:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Multiple developers): Add idea about cvs editors + and reserved checkouts. + +Sun Aug 31 19:36:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Requests): Rewrite paragraph on cvs add on a + filename containing '/'. + +Thu Aug 28 14:13:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (diff options): Add comment about "cvs diff" + vs. "cvs diff -r HEAD". + + * cvs.texinfo (Global options): Add comment about -w not + overriding cvs watch on. + +Wed Aug 27 08:09:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Password authentication server): Grammar fix ("under + as the username" -> "as the username"). + + * cvs.texinfo: Fix doubled 'the the' typos. Reported by + karlb@atg.com. + +Tue Aug 26 12:25:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Checklist): Reword xref to point to Binary files + rather than Keyword expansion. Credit goes to jeff@alum.mit.edu + (Jeff Breidenbach) for reporting the problem. + +Mon Aug 18 17:23:18 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (modules): Suggest taginfo instead of -t. Add + comment with some of the reasons. Add comment about -u and -i + problems. + +Sat Aug 16 10:19:06 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add note about how "could not + check out foo.c" seems to also have been observed on Irix. + +Fri Aug 15 17:28:01 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add "could not check out foo.c". + +Thu Aug 14 23:57:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Wrappers): Document new -m 'COPY' behavior. + +Tue Aug 12 20:56:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Sticky tags): Add comment about how we should be + documenting sticky tags. + +Fri Aug 8 10:01:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (File status): Add comment about "working revision" + in cvs status for a locally removed file. + +Thu Aug 7 22:53:45 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (From other version control systems): Mention + pvcs_to_rcs alongside sccs2rcs. + +Tue Aug 5 17:22:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Compatibility): Add comment about how CVS probably + could be detecting the case of dead files killed by CVS 1.3. + + * cvs.texinfo (From other version control systems): Add paragraph + about converting from systems which don't export RCS files. + +Sun Aug 3 21:03:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Responses): Cite RFC1321 for MD5. + + * cvs.texinfo (A sample session): Nuke index entry for "A sample + session". The fact that this isn't "sample session" is totally + bogus, but in general the table of contents is probably better for + this entry. + + * cvs.texinfo (Error messages): Add comment about wording of error + concerning unknown -x option. + + * cvs.texinfo (Wrappers): Add comment about absolute filter pathname. + +Thu Jul 31 14:40:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo: Use @ref not @xref when reference is not at the + start of a sentence. Avoids capitalizing "See" when we shouldn't. + Fixes to other similar xref problems. + +Wed Jul 30 19:30:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Connection and Authentication): Don't use @samp + on BEGIN AUTH REQUEST and friends. Avoids overfull hbox. + +Fri Jul 25 10:40:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Requests): Remove obsolete sentence regarding + using Directory instead of Repository enabling alternate response + syntax. + + * cvsclient.texi (Response intro): Add discussing of file updating + responses and file update modifying responses. + (Responses): Refer to this description rather than trying to + describe it in each place. The descriptions in each place were + somewhat incomplete and didn't get updated when new file updating + responses were added. + + * cvsclient.texi: Split node Responses into Response intro, + Response pathnames, and Responses. + +Thu Jul 24 23:13:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (config): Document SystemAuth. + (Password authentication server): Mention SystemAuth. + +Mon Jul 21 08:57:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (DISTFILES): Add DIFFUTILS-2.7-BUG. + +Sun Jul 20 17:55:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (admin options): For options with optional + arguments, specify that there can be no space between the option + and its argument. For -N, add xref to Magic branch numbers. For + -t, talk about reading from stdin. Comment changes. + +Sat Jul 19 22:28:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Preface): Make section titles more verbose. + Likewise for the menu. + +Fri Jul 18 08:41:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): No need for an external patch if + server and client are current. Add comment with more thoughts + about messages specific to old versions of CVS. + + * cvs.texinfo (Error messages): Add "cannot start server via rcmd". + + * cvs.texinfo (Error messages): Add "cannot open CVS/Root" for cvs + init. + + * cvs.texinfo (Error messages): Add "missing author". + +Tue Jul 15 16:47:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Keyword list): Fix documentation of $Log to reflect + the fact that we no longer use the comment leader. + (admin options): Fix documentation of $Log. + (admin examples): Remove example concerning comment leader, since + the example no longer does what it claims to. + (admin, admin options): Fix various parts of the documentation to + not refer to this being implemented via RCS. Say nastier things + about -I and -x. Add comments about options to "rcs" which we + don't document. + +Mon Jul 14 00:04:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): The "cannot change permissions on + temporary directory" error has been happening in various test cases. + +Sat Jul 12 11:12:18 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Repository files): Further comments about leading + "-" in filenames. + +Fri Jul 11 21:30:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Repository files): Add comment about legal + filenames. + +Wed Jul 9 18:05:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Responses): Add Mbinary response. + +Mon Jul 7 12:04:01 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Goals): Add previously unwritten goal about only + one way to do each operation. + + * cvs.texinfo (File permissions): Rewrite paragraph on setuid to + be more verbose and less unix-specific. + +Sat Jul 5 03:16:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Connection and Authentication): When we said to + "ignore" an unrecogized code we mean to treat it as nonspecific, + not to ignore the response. + + * cvsclient.texi (Example): Refer to RFC2119 when referring to + terminology of MUST, SHALL, &c. + + * cvs.texinfo (Windows permissions): New node. + +Fri Jul 4 15:27:43 1997 Ian Lance Taylor <ian@cygnus.com> + + * cvs.texinfo (Common options): Fix typo (avaliable for + available). + +Tue Jul 1 09:19:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Server requirements): Discuss memory used by diff. + + * cvs.texinfo (Substitution modes): Add comment about -A resetting + both sticky tags/dates and sticky options. + + * cvs.texinfo (File permissions): Add paragraph concerning + ownership of the RCS files. + + * cvs.texinfo (Working directory storage): Relative repositories + in CVS/Repository are legal. + +Mon Jun 30 10:48:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Top): Add menu item for Password scrambling. + + * cvs.texinfo (Committing your changes): Add comment concerning + documentation of message prompting. + +Fri Jun 27 11:20:34 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsclient.texi (Password scrambling): New node. + (Connection and Authentication): Adjust accordingly. + (Protocol Notes): Add long discussion of character sets and + password scrambling. + + * cvs.texinfo (Repository files): Also mention doc/RCSFILES in + documenting RCS file format. + (CVSROOT, storage of files): New node. + +Thu Jun 26 09:18:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (File permissions): xref to the pserver thing about + permissions in CVSROOT. + (Kerberos authenticated): Explicitly mention kerberos rsh. + Add various index entries for "security, <foo>". + +Wed Jun 25 13:39:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Common options): Rewrite comments concerning HEAD + and testcases and solution. Changing HEAD might be too big a + change; might be better to phase it out. + (Common options, Tags): Add index entries for HEAD and BASE. + +Tue Jun 24 09:37:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add assertion failed. + + * cvsclient.texi (Connection and Authentication): Add "E" and + "error" as responses in authentication protocol. The server + already was in the (formerly bad) habit of sending them, and we + might as well implement this in the client and document it. + + * cvs.texinfo (Password authentication security): Note about + permissions on $CVSROOT also applies to its parent and so on up to + /. + +Mon Jun 23 18:28:18 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Creating a repository): xref to Server requirements + for more details on memory, CPU. + (Server requirements): Add xref to Creating a repository regarding + disk space. + + * cvs.texinfo (Read-only access, Password authentication + security): The known holes which let a read-only user execute + arbitrary programs on the server are gone. + + * cvsclient.texi (Protocol Notes): Remove multisite item; it is + replaced by item 186 in TODO. Add a general reference to TODO. + Rewrite accordingly the sentence about multisite in the item + concerning sending modified files in "cvs update". + +Fri Jun 20 17:00:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (Error messages): Add "binary files differ" when + trying to check in a binary file. + +Fri Jun 20 14:01:23 1997 David J MacKenzie <djm@va.pubnix.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo: Fix various formatting, spelling, stylistic, and + factual errors. + +Thu Jun 19 07:11:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.texinfo (config): New node. + (Password authentication server): Talk about RCSBIN in config as + an alternative to -b global option. + * cvsclient.texi (Requests): Specify when Root can/must be used. + + * cvs.texinfo (Error messages): Add + "*PANIC* administration files missing". + + * cvs.texinfo (Password authentication server): Mention + permissions on $CVSROOT and $CVSROOT/CVSROOT as part of the + installation process. + (Password authentication security): Clarify that permissions issue + applies to $CVSROOT as well as $CVSROOT/CVSROOT. + Wed Jun 18 00:03:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * cvs.texinfo (Password authentication security): Add paragraph + on write permissions of $CVSROOT/CVSROOT. + + * cvs.texinfo (Adding and removing): New node. Move Adding files, + Removing files, Removing directories, Moving files, and Moving + directories under it. + + * cvs.texinfo (Removing directories): Add sentence about how + one doesn't remove the directory itself. + * cvs.texinfo (Password authentication server): Document --allow-root. diff --git a/gnu/usr.bin/cvs/doc/RCSFILES b/gnu/usr.bin/cvs/doc/RCSFILES index 5d9c7f7b22e..6d600b8028b 100644 --- a/gnu/usr.bin/cvs/doc/RCSFILES +++ b/gnu/usr.bin/cvs/doc/RCSFILES @@ -1,4 +1,4 @@ -It would be nice for the RCS file format (which is implemented by a +It would be nice if the RCS file format (which is implemented by a great many tools, both free and non-free, both by calling GNU RCS and by reimplementing access to RCS files) were documented in some standard separate from any one tool. But as far as I know no such @@ -31,6 +31,10 @@ rcsfile.5 also showed the order of the revisions (and the "next" and "branch" fields and anything else where it would be useful to have an example of how a revision tree is represented in an RCS file). +The rcsfile.5 grammar shows the {num} after "next" as optional; if it +is omitted then there is no next delta node (for example 1.1 or the +head of a branch will typically have no next). + There is one case where CVS uses CVS-specific, non-compatible changes to the RCS file format, and this is magic branches. See cvs.texinfo for more information on them. CVS also sets the RCS state to "dead" @@ -54,8 +58,9 @@ rules. namespace RCS library done at Silicon Graphics Inc. (SGI) in 1996 (a modified RCS 5.7--not sure it has any other name). dead A set of RCS patches developed by Rich Pixley at - Cygnus. These were for CVS, and predated the current - CVS death support, which does not require RCS changes. + Cygnus about 1992. These were for CVS, and predated + the current CVS death support, which uses a state "dead" + rather than a "dead" newphrase. The rules regarding keyword expansion are not documented along with the rest of the RCS file format; they are documented in the co(1) @@ -66,6 +71,9 @@ RCS 5.7 produces a warning whenever it behaves that way, and current versions of CVS do not handle this case in a special way (CVS 1.9 and earlier invoke RCS to perform keyword expansion). +Note that if the "expand" keyword is omitted from the RCS file, the +default is "kv". + Note that the "comment {string};" syntax from rcsfile.5 specifies a comment leader, which affects expansion of the $Log keyword for old versions of RCS. The comment leader is not used by RCS 5.7 or current diff --git a/gnu/usr.bin/cvs/doc/cvsclient.texi b/gnu/usr.bin/cvs/doc/cvsclient.texi index d0aac359f9d..35fe39b34a6 100644 --- a/gnu/usr.bin/cvs/doc/cvsclient.texi +++ b/gnu/usr.bin/cvs/doc/cvsclient.texi @@ -15,9 +15,10 @@ means. @menu * Introduction:: What is CVS and what is the client/server protocol for? * Goals:: Basic design decisions, requirements, scope, etc. -* Protocol Notes:: Possible enhancements, limitations, etc. of the protocol * Connection and Authentication:: Various ways to connect to the server +* Password scrambling:: Scrambling used by pserver * Protocol:: Complete description of the protocol +* Protocol Notes:: Possible enhancements, limitations, etc. of the protocol @end menu @node Introduction @@ -111,80 +112,19 @@ current @sc{cvs} server) will make sure that it does not have any such locks in place whenever it is waiting for communication with the client; this prevents one client on a slow or flaky network from interfering with the work of others. -@end itemize - -@node Protocol Notes -@chapter Notes on the Protocol - -A number of enhancements are possible: - -@itemize @bullet -@item -The @code{Modified} request could be speeded up by sending diffs rather -than entire files. The client would need some way to keep the version -of the file which was originally checked out; probably requiring the use -of "cvs edit" in this case is the most sensible course (the "cvs edit" -could be handled by a package like VC for emacs). This would also allow -local operation of @code{cvs diff} without arguments. - -@item -Have the client keep a copy of some part of the repository. This allows -all of @code{cvs diff} and large parts of @code{cvs update} and -@code{cvs ci} to be local. The local copy could be made consistent with -the master copy at night (but if the master copy has been updated since -the latest nightly re-sync, then it would read what it needs to from the -master). - -It isn't clear exactly how this should relate to a more general -multisite feature (in which one can modify the local copy even if the -network is down between the local and the master, and then they get -reconciled by a potentially manual process). Another variant of a -multisite feature would be where version history is cached to speed up -operations such as @code{cvs diff}, but in which checkins still must be -checked in to all sites, or to a master site. - -@item -The current procedure for @code{cvs update} is highly sub-optimal if -there are many modified files. One possible alternative would be to -have the client send a first request without the contents of every -modified file, then have the server tell it what files it needs. Note -the server needs to do the what-needs-to-be-updated check twice (or -more, if changes in the repository mean it has to ask the client for -more files), because it can't keep locks open while waiting for the -network. Perhaps this whole thing is irrelevant if client-side -repositories are implemented, and the rcsmerge is done by the client. @item -The fact that @code{pserver} requires an extra network turnaround in -order to perform authentication would be nice to avoid. This relates to -the issue of reporting errors; probably the clean solution is to defer -the error until the client has issued a request which expects a -response. To some extent this might relate to the next item (in terms -of how easy it is to skip a whole bunch of requests until we get to one -that expects a response). I know that the kerberos code doesn't wait in -this fashion, but that probably can cause network deadlocks and perhaps -future problems running over a transport which is more transaction -oriented than TCP. On the other hand I'm not sure it is wise to make -the client conduct a lengthy upload only to find there is an -authentication failure. - -@item -The protocol uses an extra network turnaround for protocol negotiation -(@code{valid-requests}). It might be nice to avoid this by having the -client be able to send requests and tell the server to ignore them if -they are unrecognized (different requests could produce a fatal error if -unrecognized). To do this there should be a standard syntax for -requests. For example, perhaps all future requests should be a single -line, with mechanisms analogous to @code{Argumentx}, or several requests -working together, to provide greater amounts of information. Or there -might be a standard mechanism for counted data (analogous to that used -by @code{Modified}) or continuation lines (like a generalized -@code{Argumentx}). It would be useful to compare what HTTP is planning -in this area; last I looked they were contemplating something called -Protocol Extension Protocol but I haven't looked at the relevant IETF -documents in any detail. Obviously, we want something as simple as -possible (but no simpler). - +It is a general design goal to provide only one way to do a given +operation (where possible). For example, implementations have no choice +about whether to terminate lines with linefeeds or some other +character(s), and request and response names are case-sensitive. This +is to enhance interoperability. If a protocol allows more than one way +to do something, it is all too easy for some implementations to support +only some of them (perhaps accidentally). +@c I vaguely remember reading, probably in an RFC, about the problems +@c that were caused when some people decided that SMTP should accept +@c other line termination (in the message ("DATA")?) than CRLF. However, I +@c can't seem to track down the reference. @end itemize @node Connection and Authentication @@ -209,60 +149,191 @@ by having inetd call "cvs kserver") which defaults to 1999. The client connects, sends the usual kerberos authentication information, and then starts the cvs protocol. Note: port 1999 is officially registered for another use, and in any event one cannot register more than one port for -CVS, so the kerberized client and server should be changed to use port -2401 (see below), and send a different string in place of @samp{BEGIN -AUTH REQUEST} to identify the authentication method in use. However, -noone has yet gotten around to implementing this. +CVS, so GSS-API (see below) is recommended instead of kserver as a way +to support kerberos. @item pserver -The password authenticated server listens on a port (in the current +The name @dfn{pserver} is somewhat confusing. It refers to both a +generic framework which allows the CVS protocol to support several +authentication mechanisms, and a name for a specific mechanism which +transfers a username and a cleartext password. Servers need not support +all mechanisms, and in fact servers will typically want to support only +those mechanisms which meet the relevant security needs. + +The pserver server listens on a port (in the current implementation, by having inetd call "cvs pserver") which defaults to 2401 (this port is officially registered). The client -connects, sends the string @samp{BEGIN AUTH REQUEST}, a linefeed, the -cvs root, a linefeed, the username, a linefeed, the password trivially -encoded (see scramble.c in the cvs sources), a linefeed, the string -@samp{END AUTH REQUEST}, and a linefeed. The client must send the +connects, and sends the following: + +@itemize @bullet +@item +the string @samp{BEGIN AUTH REQUEST}, a linefeed, +@item +the cvs root, a linefeed, +@item +the username, a linefeed, +@item +the password trivially encoded (see @ref{Password scrambling}), a +linefeed, +@item +the string @samp{END AUTH REQUEST}, and a linefeed. +@end itemize + +The client must send the identical string for cvs root both here and later in the @code{Root} request of the cvs protocol itself. Servers are encouraged to enforce this restriction. -The server responds with -@samp{I LOVE YOU} and a linefeed if the authentication is successful or -@samp{I HATE YOU} and a linefeed if the authentication fails. After -receiving @samp{I LOVE YOU}, the client proceeds with the cvs protocol. +The possible server responses (each of which is followed by a linefeed) +are the following. Note that although there is a small similarity +between this authentication protocol and the cvs protocol, they are +separate. + +@table @code +@item I LOVE YOU +The authentication is successful. The client proceeds with the cvs +protocol itself. + +@item I HATE YOU +The authentication fails. After sending this response, the server may +close the connection. It is up to the server to decide whether to give +this response, which is generic, or a more specific response using +@samp{E} and/or @samp{error}. + +@item E @var{text} +Provide a message for the user. After this reponse, the authentication +protocol continues with another response. Typically the server will +provide a series of @samp{E} responses followed by @samp{error}. +Compatibility note: @sc{cvs} 1.9.10 and older clients will print +@code{unrecognized auth response} and @var{text}, and then exit, upon +receiving this response. + +@item error @var{code} @var{text} +The authentication fails. After sending this response, the server may +close the connection. The @var{code} is a code describing why it +failed, intended for computer consumption. The only code currently +defined is @samp{0} which is nonspecific, but clients must silently +treat any unrecognized codes as nonspecific. +The @var{text} should be supplied to the +user. Compatibility note: @sc{cvs} 1.9.10 and older clients will print +@code{unrecognized auth response} and @var{text}, and then exit, upon +receiving this response. +@end table + +@c If you are thinking of putting samp or code around BEGIN AUTH REQUEST +@c and friends, watch for overfull hboxes. If the client wishes to merely authenticate without starting the cvs -protocol, the procedure is the same, except @samp{BEGIN AUTH REQUEST} is -replaced with @samp{BEGIN VERIFICATION REQUEST}, @samp{END AUTH REQUEST} -is replaced with @samp{END VERIFICATION REQUEST}, and upon receipt of -@samp{I LOVE YOU} the connection is closed rather than continuing. +protocol, the procedure is the same, except BEGIN AUTH REQUEST is +replaced with BEGIN VERIFICATION REQUEST, END AUTH REQUEST +is replaced with END VERIFICATION REQUEST, and upon receipt of +I LOVE YOU the connection is closed rather than continuing. + +Another mechanism is GSSAPI authentication. GSSAPI is a +generic interface to security services such as kerberos. GSSAPI is +specified in RFC2078 (GSSAPI version 2) and RFC1508 (GSSAPI version 1); +we are not aware of differences between the two which affect the +protocol in incompatible ways, so we make no attempt to specify one +version or the other. +The procedure here is to start with @samp{BEGIN +GSSAPI REQUEST}. GSSAPI authentication information is then exchanged +between the client and the server. Each packet of information consists +of a two byte big endian length, followed by that many bytes of data. +After the GSSAPI authentication is complete, the server continues with +the responses described above (@samp{I LOVE YOU}, etc.). @item future possibilities There are a nearly unlimited number of ways to connect and authenticate. One might want to allow access based on IP address (similar to the usual rsh protocol but with different/no restrictions on ports < 1024), to -adopt mechanisms such as the General Security Service (GSS) API or -Pluggable Authentication Modules (PAM), to allow users to run their own -servers under their own usernames without root access, or any number of -other possibilities. The way to add future mechanisms, for the most -part, should be to continue to use port 2401, but to use different -strings in place of @samp{BEGIN AUTH REQUEST}. +adopt mechanisms such as Pluggable Authentication Modules (PAM), to +allow users to run their own servers under their own usernames without +root access, or any number of other possibilities. The way to add +future mechanisms, for the most part, should be to continue to use port +2401, but to use different strings in place of @samp{BEGIN AUTH +REQUEST}. @end table +@node Password scrambling +@chapter Password scrambling algorithm + +The pserver authentication protocol, as described in @ref{Connection and +Authentication}, trivially encodes the passwords. This is only to +prevent inadvertent compromise; it provides no protection against even a +relatively unsophisticated attacker. For comparison, HTTP Basic +Authentication (as described in RFC2068) uses BASE64 for a similar +purpose. CVS uses its own algorithm, described here. + +The scrambled password starts with @samp{A}, which serves to identify +the scrambling algorithm in use. After that follows a single octet for +each character in the password, according to a fixed encoding. The +values are shown here, with the encoded values in decimal. Control +characters, space, and characters outside the invariant ISO 646 +character set are not shown; such characters are not recommended for use +in passwords. There is a long discussion of character set issues in +@ref{Protocol Notes}. + +@example + 0 111 P 125 p 58 +! 120 1 52 A 57 Q 55 a 121 q 113 +" 53 2 75 B 83 R 54 b 117 r 32 + 3 119 C 43 S 66 c 104 s 90 + 4 49 D 46 T 124 d 101 t 44 +% 109 5 34 E 102 U 126 e 100 u 98 +& 72 6 82 F 40 V 59 f 69 v 60 +' 108 7 81 G 89 W 47 g 73 w 51 +( 70 8 95 H 38 X 92 h 99 x 33 +) 64 9 65 I 103 Y 71 i 63 y 97 +* 76 : 112 J 45 Z 115 j 94 z 62 ++ 67 ; 86 K 50 k 93 +, 116 < 118 L 42 l 39 +- 74 = 110 M 123 m 37 +. 68 > 122 N 91 n 61 +/ 87 ? 105 O 35 _ 56 o 48 +@end example + @node Protocol @chapter The CVS client/server protocol -In the following, @samp{\n} refers to a linefeed and @samp{\t} refers -to a horizontal tab. - +In the following, @samp{\n} refers to a linefeed and @samp{\t} refers to +a horizontal tab; @dfn{requests} are what the client sends and +@dfn{responses} are what the server sends. In general, the connection is +governed by the client---the server does not send responses without +first receiving requests to do so; see @ref{Response intro} for more +details of this convention. + +It is typical, early in the connection, for the client to transmit a +@code{Valid-responses} request, containing all the responses it +supports, followed by a @code{valid-requests} request, which elicits +from the server a @code{Valid-requests} response containing all the +requests it understands. In this way, the client and server each find +out what the other supports before exchanging large amounts of data +(such as file contents). + +@c Hmm, having 3 sections in this menu makes a certain amount of sense +@c but that structure gets lots in the printed manual (not sure about +@c HTML). Perhaps there is a better way. @menu -* Entries Lines:: -* Modes:: + +General protocol conventions: + +* Entries Lines:: Transmitting RCS data +* File Modes:: Read, write, execute, and possibly more... * Filenames:: Conventions regarding filenames * File transmissions:: How file contents are transmitted * Strings:: Strings in various requests and responses -* Requests:: -* Responses:: -* Example:: -* Requirements:: + +The protocol itself: + +* Request intro:: General conventions relating to requests +* Requests:: List of requests +* Response intro:: General conventions relating to responses +* Response pathnames:: The "pathname" in responses +* Responses:: List of responses +* Text tags:: More details about the MT response + +An example session, and some further observations: + +* Example:: A conversation between client and server +* Requirements:: Things not to omit from an implementation * Obsolete:: Former protocol features @end menu @@ -290,8 +361,16 @@ conflicts in it. The rest of @var{conflict} is @samp{=} if the timestamp matches the file, or anything else if it doesn't. If @var{conflict} does not start with a @samp{+}, it is silently ignored. -@node Modes -@section Modes +@var{options} signifies the keyword expansion options (for example +@samp{-ko}). In an @code{Entry} request, this indicates the options +that were specified with the file from the previous file updating +response (@pxref{Response intro}, for a list of file updating +responses); if the client is specifying the @samp{-k} or @samp{-A} +option to @code{update}, then it is the server which figures out what +overrides what. + +@node File Modes +@section File Modes A mode is any number of repetitions of @@ -389,8 +468,8 @@ existing practice is probably to just transmit whatever the user specifies, and hope that everyone involved agrees which character set is in use, or sticks to a common subset. -@node Requests -@section Requests +@node Request intro +@section Request intro By convention, requests which begin with a capital letter do not elicit a response from the server, while all others do -- save one. The @@ -398,6 +477,11 @@ exception is @samp{gzip-file-contents}. Unrecognized requests will always elicit a response from the server, even if that request begins with a capital letter. +@node Requests +@section Requests + +Here are the requests: + @table @code @item Root @var{pathname} \n Response expected: no. Tell the server which @code{CVSROOT} to use. @@ -408,6 +492,10 @@ already exist; if creating a new root, use the @code{init} request, not server, how to access the server, etc.; by the time the CVS protocol is in use, connection, authentication, etc., are already taken care of. +The @code{Root} request must be sent only once, and it must be sent +before any requests other than @code{Valid-responses}, +@code{valid-requests}, @code{UseUnchanged}, or @code{init}. + @item Valid-responses @var{request-list} \n Response expected: no. Tell the server what responses the client will accept. @@ -426,8 +514,7 @@ also for @code{ci} and the other commands; normal usage is to send @code{Directory} for each directory in which there will be an @code{Entry} or @code{Modified}, and then a final @code{Directory} for the original directory, then the command. -If the client uses this request, it affects the way the server returns -pathnames; see @ref{Responses}. @var{local-directory} is relative to +The @var{local-directory} is relative to the top level at which the command is occurring (i.e. the last @code{Directory} which is sent before the command); to indicate that top level, @samp{.} should be send for @@ -549,6 +636,15 @@ sent for the same file, @code{Entry} must be sent first. For a given file, one can send @code{Modified}, @code{Is-modified}, or @code{Unchanged}, but not more than one of these three. +@item Kopt @var{option} \n +This indicates to the server which keyword expansion options to use for +the file specified by the next @code{Modified} or @code{Is-modified} +request (for example @samp{-kb} for a binary file). This is similar to +@code{Entry}, but is used for a file for which there is no entries line. +Typically this will be a file being added via an @code{add} or +@code{import} request. The client may not send both @code{Kopt} and +@code{Entry} for the same file. + @item Modified @var{filename} \n Response expected: no. Additional data: mode, \n, file transmission. Send the server a copy of one locally modified file. @var{filename} is @@ -703,6 +799,38 @@ the client and server encrypt the compressed data, as opposed to compressing the encrypted data. Encrypted data is generally incompressible. +Note that this request does not fully prevent an attacker from hijacking +the connection, in the sense that it does not prevent hijacking the +connection between the initial authentication and the +@code{Kerberos-encrypt} request. + +@item Gssapi-encrypt \n +Response expected: no. +Use GSSAPI encryption to encrypt all further communication between the +client and the server. This will only work if the connection was made +over GSSAPI in the first place. See @code{Kerberos-encrypt}, above, for +the relation between @code{Gssapi-encrypt} and @code{Gzip-stream}. + +Note that this request does not fully prevent an attacker from hijacking +the connection, in the sense that it does not prevent hijacking the +connection between the initial authentication and the +@code{Gssapi-encrypt} request. + +@item Gssapi-authenticate \n +Response expected: no. +Use GSSAPI authentication to authenticate all further communication +between the client and the server. This will only work if the +connection was made over GSSAPI in the first place. Encrypted data is +automatically authenticated, so using both @code{Gssapi-authenticate} +and @code{Gssapi-encrypt} has no effect beyond that of +@code{Gssapi-encrypt}. Unlike encrypted data, it is reasonable to +compress authenticated data. + +Note that this request does not fully prevent an attacker from hijacking +the connection, in the sense that it does not prevent hijacking the +connection between the initial authentication and the +@code{Gssapi-authenticate} request. + @item Set @var{variable}=@var{value} \n Response expected: no. Set a user variable @var{variable} to @var{value}. @@ -766,7 +894,6 @@ directory. @itemx log \n @itemx remove \n @itemx admin \n -@itemx export \n @itemx history \n @itemx watchers \n @itemx editors \n @@ -788,6 +915,19 @@ correspond to except by (1) just sending the @code{co} request, and then seeing what directory names the server sends back in its responses, and (2) the @code{expand-modules} request. +@item export \n +Response expected: yes. Get files from the repository. This uses any +previous @code{Argument}, @code{Directory}, @code{Entry}, or +@code{Modified} requests, if they have been sent. Arguments to this +command are module names, as described for the @code{co} request. The +intention behind this command is that a client can get sources from a +server without storing CVS information about those sources. That is, a +client probably should not count on being able to take the entries line +returned in the @code{Created} response from an @code{export} request +and send it in a future @code{Entry} request. Note that the entries +line in the @code{Created} response must indicate whether the file is +binary or text, so the client can create it correctly. + @item rdiff \n @itemx rtag \n Response expected: yes. Actually do a cvs command. This uses any @@ -882,17 +1022,17 @@ to perform a few more checks. The client sends a subsequent @code{ci} to actually add the file to the repository. -Another quirk of the @code{add} request is that a pathname specified in +Another quirk of the @code{add} request is that with CVS 1.9 and older, +a pathname specified in an @code{Argument} request cannot contain @samp{/}. There is no good -reason for this restriction, and it could be eliminated if someone took -the effort to rewrite the @code{add} code in the CVS server to not have -it. But in the meantime, the way to comply with it is to ensure that +reason for this restriction, and in fact more recent CVS servers don't +have it. +But the way to interoperate with the older servers is to ensure that all @code{Directory} requests for @code{add} (except those used to add directories, as described above), use @samp{.} for @var{local-directory}. Specifying another string for @var{local-directory} may not get an error, but it will get you strange -@code{Checked-in} responses, until servers are fixed to send the correct -responses. +@code{Checked-in} responses from the buggy servers. @item watch-on \n @itemx watch-off \n @@ -941,6 +1081,11 @@ Availability of this request in the server indicates to the client that it may compress files sent to the server, regardless of whether the client actually uses this request. +@item wrapper-sendme-rcsOptions \n +Response expected: yes. +Request that the server transmit mappings from filenames to keyword +expansion modes in @code{Wrapper-rcsOption} responses. + @item @var{other-request} @var{text} \n Response expected: yes. Any unrecognized request expects a response, and does not @@ -951,8 +1096,8 @@ a previous command which doesn't expect a response produced an error. When the client is done, it drops the connection. -@node Responses -@section Responses +@node Response intro +@section Introduction to Responses After a command which expects a response, the server sends however many of the following responses are appropriate. The server should not send @@ -960,9 +1105,31 @@ data at other times (the current implementation may violate this principle in a few minor places, where the server is printing an error message and exiting---this should be investigated further). +Any set of responses always ends with @samp{error} or @samp{ok}. This +indicates that the response is over. + +@c "file updating response" and "file update modifying response" are +@c lame terms (mostly because they are so awkward). Any better ideas? +The responses @code{Checked-in}, @code{New-entry}, @code{Updated}, +@code{Created}, @code{Update-existing}, @code{Merged}, and +@code{Patched} are refered to as @dfn{file updating} responses, because +they change the status of a file in the working directory in some way. +The responses @code{Mode}, @code{Mod-time}, and @code{Checksum} are +referred to as @dfn{file update modifying} responses because they modify +the next file updating response. In no case shall a file update +modifying response apply to a file updating response other than the next +one. Nor can the same file update modifying response occur twice for +a given file updating response (if servers diagnose this problem, it may +aid in detecting the case where clients send an update modifying +response without following it by a file updating response). + +@node Response pathnames +@section The "pathname" in responses + +Many of the responses contain something called @var{pathname}. @c FIXME: should better document when the specified repository needs to @c end in "/.". -In the following, @var{pathname} actually indicates a pair of +The name is somewhat misleading; it actually indicates a pair of pathnames. First, a local directory name relative to the directory in which the command was given (i.e. the last @code{Directory} before the command). Then a linefeed and a repository @@ -1001,8 +1168,10 @@ greatly by only telling the client to create directories if the directory in question should exist, but until servers do this, clients will need to offer the @samp{-P} behavior described above. -Any response always ends with @samp{error} or @samp{ok}. This indicates -that the response is over. +@node Responses +@section Responses + +Here are the responses: @table @code @item Valid-requests @var{request-list} \n @@ -1096,13 +1265,14 @@ only support @code{Patched}. @item Mode @var{mode} \n This @var{mode} applies to the next file mentioned in -@code{Checked-in}. It does not apply to any request which follows a -@code{Checked-in}, @code{New-entry}, @code{Updated}, @code{Merged}, or -@code{Patched} response. +@code{Checked-in}. @code{Mode} is a file update modifying response +as described in @ref{Response intro}. @item Mod-time @var{time} \n -Set the modification time of the next file sent to @var{time}. Next -file sent means sent by @code{Checked-in}, @code{Created}, etc. The +Set the modification time of the next file sent to @var{time}. +@code{Mod-time} is a file update modifying response +as described in @ref{Response intro}. +The @var{time} is in the format specified by RFC822 as modified by RFC1123. The server may specify any timezone it chooses; clients will want to convert that to their own timezone as appropriate. An example of this @@ -1118,13 +1288,16 @@ synchronized. The server just sends its recommendation for a timestamp it (this means that the time might be in the future, for example). @item Checksum @var{checksum}\n -The @var{checksum} applies to the next file sent over via -@code{Updated}, @code{Merged}, or @code{Patched}. In the case of +The @var{checksum} applies to the next file sent (that is, +@code{Checksum} is a file update modifying response +as described in @ref{Response intro}). +In the case of @code{Patched}, the checksum applies to the file after being patched, not to the patch itself. The client should compute the checksum itself, after receiving the file or patch, and signal an error if the checksums do not match. The checksum is the 128 bit MD5 checksum represented as -32 hex digits. This response is optional, and is only used if the +32 hex digits (MD5 is described in RFC1321). +This response is optional, and is only used if the client supports it (as judged by the @code{Valid-responses} request). @item Copy-file @var{pathname} \n @@ -1194,7 +1367,8 @@ request; if there are several @code{Notify} requests for a single file, the requests should be processed in order; the first @code{Notified} response pertains to the first @code{Notify} request, etc. -@item Module-expansion @var{pathname} \n Return a file or directory +@item Module-expansion @var{pathname} \n +Return a file or directory which is included in a particular module. @var{pathname} is relative to cvsroot, unlike most pathnames in responses. @var{pathname} should be used to look and see whether some or all of the module exists on @@ -1203,9 +1377,27 @@ argument to a @code{co} request (for example, if the modules file contains the @samp{-d} option, it will be the directory specified with @samp{-d}, not the name of the module). +@item Wrapper-rcsOption @var{pattern} -k '@var{option}' \n +Transmit to the client a filename pattern which implies a certain +keyword expansion mode. The @var{pattern} is a wildcard pattern (for +example, @samp{*.exe}. The @var{option} is @samp{b} for binary, and so +on. Note that although the syntax happens to resemble the syntax in +certain CVS configuration files, it is more constrained; there must be +exactly one space between @var{pattern} and @samp{-k} and exactly one +space between @samp{-k} and @samp{'}, and no string is permitted in +place of @samp{-k} (extensions should be done with new responses, not by +extending this one, for graceful handling of @code{Valid-responses}). + @item M @var{text} \n A one-line message for the user. +@item Mbinary \n +Additional data: file transmission (note: compressed file transmissions +are not supported). This is like @samp{M}, except the contents of the +file transmission are binary and should be copied to standard output +without translation to local text file conventions. To transmit a text +file to standard output, servers should use a series of @samp{M} requests. + @item E @var{text} \n Same as @code{M} but send to stderr not stdout. @@ -1217,6 +1409,77 @@ Flush stderr. That is, make it possible for the user to see what has been written to stderr (it is up to the implementation to decide exactly how far it should go to ensure this). +@item MT @var{tagname} @var{data} \n + +This response provides for tagged text. It is similar to +SGML/HTML/XML in that the data is structured and a naive application +can also make some sense of it without understanding the structure. +The syntax is not SGML-like, however, in order to fit into the CVS +protocol better and (more importantly) to make it easier to parse, +especially in a language like perl or awk. + +The @var{tagname} can have several forms. If it starts with @samp{a} +to @samp{z} or @samp{A} to @samp{Z}, then it represents tagged text. +If the implementation recognizes @var{tagname}, then it may interpret +@var{data} in some particular fashion. If the implementation does not +recognize @var{tagname}, then it should simply treat @var{data} as +text to be sent to the user (similar to an @samp{M} response). There +are two tags which are general purpose. The @samp{text} tag is +similar to an unrecognized tag in that it provides text which will +ordinarily be sent to the user. The @samp{newline} tag is used +without @var{data} and indicates that a newline will ordinarily be +sent to the user (there is no provision for embedding newlines in the +@var{data} of other tagged text responses). + +If @var{tagname} starts with @samp{+} it indicates a start tag and if +it starts with @samp{-} it indicates an end tag. The remainder of +@var{tagname} should be the same for matching start and end tags, and +tags should be nested (for example one could have tags in the +following order @code{+bold} @code{+italic} @code{text} @code{-italic} +@code{-bold} but not @code{+bold} @code{+italic} @code{text} +@code{-bold} @code{-italic}). A particular start and end tag may be +documented to constrain the tagged text responses which are valid +between them. + +Note that if @var{data} is present there will always be exactly one +space between @var{tagname} and @var{data}; if there is more than one +space, then the spaces beyond the first are part of @var{data}. + +Here is an example of some tagged text responses. Note that there is +a trailing space after @samp{Checking in} and @samp{initial revision:} +and there are two trailing spaces after @samp{<--}. Such trailing +spaces are, of course, part of @var{data}. + +@example +MT +checking-in +MT text Checking in +MT fname gz.tst +MT text ; +MT newline +MT rcsfile /home/kingdon/zwork/cvsroot/foo/gz.tst,v +MT text <-- +MT fname gz.tst +MT newline +MT text initial revision: +MT init-rev 1.1 +MT newline +MT text done +MT newline +MT -checking-in +@end example + +If the client does not support the @samp{MT} response, the same +responses might be sent as: + +@example +M Checking in gz.tst; +M /home/kingdon/zwork/cvsroot/foo/gz.tst,v <-- gz.tst +M initial revision: 1.1 +M done +@end example + +For a list of specific tags, see @ref{Text tags}. + @item error @var{errno-code} @samp{ } @var{text} \n The command completed with an error. @var{errno-code} is a symbolic error code (e.g. @code{ENOENT}); if the server doesn't support this @@ -1229,6 +1492,35 @@ strerror(), or any other message the server wants to use. The command completed successfully. @end table +@node Text tags +@section Tags for the MT tagged text response + +The @code{MT} response, as described in @ref{Responses}, offers a +way for the server to send tagged text to the client. This section +describes specific tags. The intention is to update this section as +servers add new tags. + +In the following descriptions, @code{text} and @code{newline} tags are +omitted. Such tags contain information which is intended for users (or +to be discarded), and are subject to change at the whim of the server. +To avoid being vulnerable to such whim, clients should look for the tags +listed here, not @code{text}, @code{newline}, or other tags. + +The following tag means to indicate to the user that a file has been +updated. It is more or less redundant with the @code{Created} and +@code{Update-existing} responses, but we don't try to specify here +whether it occurs in exactly the same circumstances as @code{Created} +and @code{Update-existing}. The @var{name} is the pathname of the file +being updated relative to the directory in which the command is +occurring (that is, the last @code{Directory} request which is sent +before the command). + +@example +MT +updated +MT fname @var{name} +MT -updated +@end example + @node Example @section Example @@ -1236,9 +1528,9 @@ The command completed successfully. @c other RFC's). In other formatting concerns, we might want to think @c about whether there is an easy way to provide RFC1543 formatting @c (without negating the advantages of texinfo), and whether we should -@c use RFC822-style BNF (I fear that would be less clear than -@c what we do now, however). Plus what about IETF terminology (SHOULD, -@c MUST, etc.) or ISO terminology (shall, should, or whatever they are)? +@c use RFC2234 BNF (I fear that would be less clear than +@c what we do now, however). Plus what about RFC2119 terminology (MUST, +@c SHOULD, &c) or ISO terminology (shall, should, or whatever they are)? Here is an example; lines are prefixed by @samp{C: } to indicate the client sends them or @samp{S: } to indicate the server sends them. @@ -1410,4 +1702,102 @@ working directory, and the meaning of sending @code{Entries} without @code{Lost} or @code{Modified} was different. All current clients (CVS 1.5 and later) will send @code{UseUnchanged} if it is supported. +@node Protocol Notes +@chapter Notes on the Protocol + +A number of enhancements are possible. Also see the file @sc{todo} in +the @sc{cvs} source distribution, which has further ideas concerning +various aspects of @sc{cvs}, some of which impact the protocol. + +@itemize @bullet +@item +The @code{Modified} request could be speeded up by sending diffs rather +than entire files. The client would need some way to keep the version +of the file which was originally checked out; probably requiring the use +of "cvs edit" in this case is the most sensible course (the "cvs edit" +could be handled by a package like VC for emacs). This would also allow +local operation of @code{cvs diff} without arguments. + +@item +The current procedure for @code{cvs update} is highly sub-optimal if +there are many modified files. One possible alternative would be to +have the client send a first request without the contents of every +modified file, then have the server tell it what files it needs. Note +the server needs to do the what-needs-to-be-updated check twice (or +more, if changes in the repository mean it has to ask the client for +more files), because it can't keep locks open while waiting for the +network. Perhaps this whole thing is irrelevant if there is a multisite +capability (as noted in @sc{todo}), and therefore the rcsmerge can be +done with a repository which is connected via a fast connection. + +@item +The fact that @code{pserver} requires an extra network turnaround in +order to perform authentication would be nice to avoid. This relates to +the issue of reporting errors; probably the clean solution is to defer +the error until the client has issued a request which expects a +response. To some extent this might relate to the next item (in terms +of how easy it is to skip a whole bunch of requests until we get to one +that expects a response). I know that the kerberos code doesn't wait in +this fashion, but that probably can cause network deadlocks and perhaps +future problems running over a transport which is more transaction +oriented than TCP. On the other hand I'm not sure it is wise to make +the client conduct a lengthy upload only to find there is an +authentication failure. + +@item +The protocol uses an extra network turnaround for protocol negotiation +(@code{valid-requests}). It might be nice to avoid this by having the +client be able to send requests and tell the server to ignore them if +they are unrecognized (different requests could produce a fatal error if +unrecognized). To do this there should be a standard syntax for +requests. For example, perhaps all future requests should be a single +line, with mechanisms analogous to @code{Argumentx}, or several requests +working together, to provide greater amounts of information. Or there +might be a standard mechanism for counted data (analogous to that used +by @code{Modified}) or continuation lines (like a generalized +@code{Argumentx}). It would be useful to compare what HTTP is planning +in this area; last I looked they were contemplating something called +Protocol Extension Protocol but I haven't looked at the relevant IETF +documents in any detail. Obviously, we want something as simple as +possible (but no simpler). + +@item +The scrambling algorithm in the CVS client and server actually support +more characters than those documented in @ref{Password scrambling}. +Someday we are going to either have to document them all (but this is +not as easy as it may look, see below), or (gradually and with adequate +process) phase out the support for other characters in the CVS +implementation. This business of having the feature partly undocumented +isn't a desirable state long-term. + +The problem with documenting other characters is that unless we know +what character set is in use, there is no way to make a password +portable from one system to another. For example, a with a circle on +top might have different encodings in different character sets. + +It @emph{almost} works to say that the client picks an arbitrary, +unknown character set (indeed, having the CVS client know what character +set the user has in mind is a hard problem otherwise), and scrambles +according to a certain octet<->octet mapping. There are two problems +with this. One is that the protocol has no way to transmit character 10 +decimal (linefeed), and the current server and clients have no way to +handle 0 decimal (NUL). This may cause problems with certain multibyte +character sets, in which octets 10 and 0 will appear in the middle of +other characters. The other problem, which is more minor and possibly +not worth worrying about, is that someone can type a password on one +system and then go to another system which uses a different encoding for +the same characters, and have their password not work. + +The restriction to the ISO646 invariant subset is the best approach for +strings which are not particularly significant to users. Passwords are +visible enough that this is somewhat doubtful as applied here. ISO646 +does, however, have the virtue (!?) of offending everyone. It is easy +to say "But the $ is right on people's keyboards! Surely we can't +forbid that". From a human factors point of view, that makes quite a +bit of sense. The contrary argument, of course, is that a with a circle +on top, or some of the characters poorly handled by Unicode, are on +@emph{someone}'s keyboard. + +@end itemize + @bye diff --git a/gnu/usr.bin/cvs/emx/ChangeLog b/gnu/usr.bin/cvs/emx/ChangeLog index 58f937137fb..3533866df6c 100644 --- a/gnu/usr.bin/cvs/emx/ChangeLog +++ b/gnu/usr.bin/cvs/emx/ChangeLog @@ -1,3 +1,75 @@ +Tue Jan 13 13:17:33 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (DIFF, RCSBIN_DFLT): Remove; no longer used. + +Wed Dec 31 10:56:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * config.h, filesubr.c (convert_file): Remove; no longer used + (except for BROKEN_READWRITE_CONVERSION which doesn't apply). + +Sat Dec 27 16:57:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (HAVE_RCS5): Remove; no longer used. + + * config.h (LINES_CRLF_TERMINATED): Remove; no longer used. + +Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Change bug-cvs address from prep.ai.mit.edu to gnu.org + per email from Martin Hamilton. + +Sat Nov 29 22:20:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h: Remove declaration of getwd; see lib/ChangeLog for + rationale. + +Fri Nov 14 13:37:33 1997 Abe Feldman and Jim Kingdon + + * savecwd.c: New file, copied from lib/savecwd.c except it calls + _chdir2 not chdir. + * Makefile.in: Put savecwd in emx directory not lib directory. + +Tue Nov 4 18:20:08 1997 Abe Feldman <feldman@cyclic.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in: Adjust to add diff directory. + +Sun Sep 7 19:49:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * system.c (os2_stat): Adjust comment to reflect removal of + same_directories from src/root.c. + +Sat Sep 06 14:45:13 1997 Jim Kingdon + + * Makefile.in: Add a cvs-static.exe rule for generating + executables which don't need emx.dll (doesn't work yet). + +Fri Sep 05 12:21:56 1997 Jim Kingdon + + * filesubr.c (xchmod): Replace with "attrib"-based code from + os2/filesubr.c. + * config.h (CHMOD_BROKEN): Define. + +Wed Jul 30 15:35:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in: In comment about Makefile rule, remove note about + this not being a problem for os2/Makefile.in. It is a problem + there too. + + * README: Add note about srcdir and top_srcdir. + +Mon Jul 21 15:36:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (DISTFILES): Makefile is not in srcdir. + +Wed Jun 18 12:07:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (OS2_SOURCES): Fix comment so this is not commented + out. Remove windows-NT/rcmd.c; the make dist for the windows-NT + directory can take care of that one. + + * Makefile.in, README: Add comments about Makefile rule. + Tue Jun 17 14:44:02 1997 Jim Kingdon (unknown@beezley) * rcmd.c: Removed; no longer used. diff --git a/gnu/usr.bin/cvs/emx/Makefile.in b/gnu/usr.bin/cvs/emx/Makefile.in index f2e50167434..eff256490f5 100644 --- a/gnu/usr.bin/cvs/emx/Makefile.in +++ b/gnu/usr.bin/cvs/emx/Makefile.in @@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@ lib_dir = ${top_srcdir}/lib cvs_srcdir = ${top_srcdir}/src - +diff_srcdir = ${top_srcdir}/diff zlib_dir = ${top_srcdir}/zlib # Do we need these? @@ -26,6 +26,7 @@ zlib_dir = ${top_srcdir}/zlib # Used to say -lufc, but that would only be needed for crypt(). LIB = -lsocket + CINC = # This says we are building an object file, not a full executable. OBJ_CFLAGS = -c @@ -55,13 +56,18 @@ COMMON_HEADERS = \ ${cvs_srcdir}/server.h \ ${cvs_srcdir}/error.h +# headers in ../diff +DIFF_HEADERS = \ + ${diff_srcdir}/cmpbuf.h \ + ${diff_srcdir}/diff.h \ + ${diff_srcdir}/system.h + # sources specific to OS/2 -# was ${srcdir}/rcmd.c \ OS2_SOURCES = \ ${srcdir}/filesubr.c \ ${srcdir}/startserver.c \ ${srcdir}/stripslash.c \ - ${top_srcdir}/windows-NT/rcmd.c \ + ${srcdir}/savecwd.c \ ${srcdir}/system.c # sources we use from the common src dir, ../src @@ -121,6 +127,22 @@ COMMON_SOURCES = \ ${cvs_srcdir}/zlib.c # end of $COMMON_SOURCES +# sources in ../diff +DIFF_SOURCES = \ + ${diff_srcdir}/analyze.c \ + ${diff_srcdir}/cmpbuf.c \ + ${diff_srcdir}/context.c \ + ${diff_srcdir}/diff.c \ + ${diff_srcdir}/diff3.c \ + ${diff_srcdir}/dir.c \ + ${diff_srcdir}/ed.c \ + ${diff_srcdir}/ifdef.c \ + ${diff_srcdir}/io.c \ + ${diff_srcdir}/normal.c \ + ${diff_srcdir}/side.c \ + ${diff_srcdir}/util.c \ + ${diff_srcdir}/version.c + # sources from ../lib # FIXME: Is this used anywhere? I don't think it is. LIB_SOURCES = \ @@ -131,7 +153,6 @@ LIB_SOURCES = \ ${lib_dir}/getopt1.c \ ${lib_dir}/md5.c \ ${lib_dir}/regex.c \ - ${lib_dir}/savecwd.c \ ${lib_dir}/sighandle.c \ ${lib_dir}/valloc.c \ ${lib_dir}/yesno.c \ @@ -144,6 +165,7 @@ OS2_OBJECTS = \ ${srcdir}/startserver.o \ ${srcdir}/stripslash.o \ ${top_srcdir}/windows-NT/rcmd.o \ + ${srcdir}/savecwd.o \ ${srcdir}/system.o # object files from ../src @@ -202,6 +224,22 @@ COMMON_OBJECTS = \ ${cvs_srcdir}/zlib.o # end of $COMMON_OBJECTS +# object files in ../diff +DIFF_OBJECTS = \ + ${diff_srcdir}/analyze.o \ + ${diff_srcdir}/cmpbuf.o \ + ${diff_srcdir}/context.o \ + ${diff_srcdir}/diff.o \ + ${diff_srcdir}/diff3.o \ + ${diff_srcdir}/dir.o \ + ${diff_srcdir}/ed.o \ + ${diff_srcdir}/ifdef.o \ + ${diff_srcdir}/io.o \ + ${diff_srcdir}/normal.o \ + ${diff_srcdir}/side.o \ + ${diff_srcdir}/util.o \ + ${diff_srcdir}/version.o + # objects from ../lib LIB_OBJECTS = \ ${lib_dir}/vasprintf.o \ @@ -211,7 +249,6 @@ LIB_OBJECTS = \ ${lib_dir}/getopt1.o \ ${lib_dir}/md5.o \ ${lib_dir}/regex.o \ - ${lib_dir}/savecwd.o \ ${lib_dir}/sighandle.o \ ${lib_dir}/valloc.o \ ${lib_dir}/yesno.o \ @@ -232,14 +269,15 @@ ZLIB_OBJECTS = ${zlib_dir}/adler32.o \ ${zlib_dir}/infutil.o \ ${zlib_dir}/inffast.o -SOURCES = ${COMMON_SOURCES} ${LIB_SOURCES} ${OS2_SOURCES} -HEADERS = ${COMMON_HEADERS} ${OS2_HEADERS} -OBJECTS = ${COMMON_OBJECTS} ${LIB_OBJECTS} ${OS2_OBJECTS} ${ZLIB_OBJECTS} +SOURCES = ${COMMON_SOURCES} ${LIB_SOURCES} ${OS2_SOURCES} ${DIFF_SOURCES} +HEADERS = ${COMMON_HEADERS} ${OS2_HEADERS} ${DIFF_HEADERS} +OBJECTS = ${COMMON_OBJECTS} ${LIB_OBJECTS} ${OS2_OBJECTS} ${DIFF_OBJECTS} \ + ${ZLIB_OBJECTS} DISTFILES = ${OS2_HEADERS} ${OS2_SOURCES} \ ${srcdir}/README ${srcdir}/ChangeLog \ ${srcdir}/Makefile.in ${srcdir}/.cvsignore \ - ${srcdir}/Makefile + Makefile all: @@ -274,6 +312,7 @@ dist-dir: clean: rm -f cvs.exe cvs.out rm -f ${srcdir}/*.o + rm -f ${diff_srcdir}/*.o rm -f ${lib_dir}/*.o ${lib_dir}/*.a rm -f ${zlib_dir}/*.o ${zlib_dir}/*.a rm -f ${cvs_srcdir}/*.o @@ -281,6 +320,7 @@ clean: clean-cvs: del cvs.exe cvs.out del $(subst /,\,${srcdir}/*.o) + del $(subst /,\,${diff_srcdir}/*.o) del $(subst /,\,${lib_dir}/*.o ${lib_dir}/*.a) del $(subst /,\,${zlib_dir}/*.o ${zlib_dir}/*.a) del $(subst /,\,${cvs_srcdir}/*.o) @@ -297,13 +337,40 @@ ${lib_dir}/libcvs.a: $(LIB_OBJECTS) ${zlib_dir}/libz.a: $(ZLIB_OBJECTS) $(AR) cr $@ $(ZLIB_OBJECTS) +# Eventually probably static linking (cvs-static.exe) will be the +# default, but even so we'll want to preserve this rule so we can +# create a dynamically linked executable when we want coredumps. cvs.exe: ${OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a - gcc $(COMMON_OBJECTS) $(OS2_OBJECTS) ${lib_dir}/libcvs.a ${zlib_dir}/libz.a $(LIB) -o cvs.out + gcc $(COMMON_OBJECTS) $(OS2_OBJECTS) ${DIFF_OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a $(LIB) -o cvs.out emxbind -w -o $@.exe cvs.out +${lib_dir}/libcvs.lib: ${lib_dir}/libcvs.a + emxomf ${lib_dir}/libcvs.a + +${zlib_dir}/libz.lib: ${zlib_dir}/libz.a + emxomf ${zlib_dir}/libz.a + +# Where do -Zomf -Zsys go? When we compile the .o's? +# When I tried this rule, I had problems with (1) could not find +# socket.lib. Hmm. I thought I converted it from socket.a +# in the EMX distribution. Probably my EMX installation at fault. +# (2) could not find miscellaneous system routines like strerror. +# This might be a matter of learning to live without them (EMX +# doc is supposed to describe which are present and which are not). +# (3) some linker errors like no stack and the like. Maybe I am +# missing some options? +cvs-static.exe: ${OBJECTS} ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib + emxomf ${OBJECTS} + emxomfld -o $@ $(subst .o,.obj,${OBJECTS}) \ + ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib ${LIB} + # cvs.o: ${OBJECTS} ${SOURCES} ${HEADERS} subdir = emx +# Hmm. This rule wants to exist on unix, so that "make dist" works. +# And it doesn't want to exist on OS/2, because configure doesn't +# run on OS/2 and so ../config.status won't exist. For now we just +# say, in emx/README, that people will need to comment it out. Makefile: ../config.status $(srcdir)/Makefile.in cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status diff --git a/gnu/usr.bin/cvs/emx/README b/gnu/usr.bin/cvs/emx/README index 9b82e81d01d..5483e6a62d5 100644 --- a/gnu/usr.bin/cvs/emx/README +++ b/gnu/usr.bin/cvs/emx/README @@ -42,10 +42,14 @@ To compile CVS for OS/2, you must install the following packages: All packages can be found on ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu (You may also try http://www.leo.org/pub/comp/os/os2/leo/gnu). -Change to the `emx' directory, do "make" and get emx\cvs.exe. Assuming -you have edited the `install_dir' variable in the Makefile, you may type -"make install-cvs" to put cvs.exe in the right place. You may also "make -clean-cvs" to clean up object and library files. +Change to the `emx' directory, do "make" and get emx\cvs.exe. I had +to comment out the "Makefile" rule in emx/Makefile to avoid a +complaint about ../config.status not existing. You also might need to +edit srcdir to be "." and top_srcdir to be "..". + +Assuming you have edited the `install_dir' variable in the Makefile, +you may type "make install-cvs" to put cvs.exe in the right place. +You may also "make clean-cvs" to clean up object and library files. The cvs.exe generated will require emx.dll to run. You can try compiling with -Zomf -Zsys to generate a cvs.exe without this @@ -63,4 +67,4 @@ them. You will get about 5 warnings in lib/regex.c concerning "unused variable destination". Ignore them. -Report bugs to tepting@swol.de and bug-cvs@prep.ai.mit.edu. +Report bugs to tepting@swol.de and bug-cvs@gnu.org. diff --git a/gnu/usr.bin/cvs/emx/config.h b/gnu/usr.bin/cvs/emx/config.h index f9ec55f7672..380e73e4e19 100644 --- a/gnu/usr.bin/cvs/emx/config.h +++ b/gnu/usr.bin/cvs/emx/config.h @@ -257,18 +257,6 @@ extern int fncmp (const char *n1, const char *n2); definition for this. */ extern void fnfold (char *FILENAME); -/* #define this if your system terminates lines in text files with - CRLF instead of plain LF, and your I/O functions automatically - translate between using LF in memory and CRLF on disk, unless you - specifically tell them not to. */ -#define LINES_CRLF_TERMINATED 1 - -/* Read data from INFILE, and copy it to OUTFILE. - Open INFILE using INFLAGS, and OUTFILE using OUTFLAGS. - This is useful for converting between CRLF and LF line formats. */ -extern void convert_file (char *INFILE, int INFLAGS, - char *OUTFILE, int OUTFLAGS); - /* This is where old bits go to die under OS/2 as well as WinNT. */ #define DEVNULL "nul" @@ -323,3 +311,6 @@ extern int os2_fnmatch(const char *pattern, const char *name, int flags); /* See above; we can't use rsh without -b. */ #define RSH_NOT_TRANSPARENT 1 + +/* See discussion at xchmod in filesubr.c. */ +#define CHMOD_BROKEN 1 diff --git a/gnu/usr.bin/cvs/emx/filesubr.c b/gnu/usr.bin/cvs/emx/filesubr.c new file mode 100644 index 00000000000..6b96a1b0c76 --- /dev/null +++ b/gnu/usr.bin/cvs/emx/filesubr.c @@ -0,0 +1,812 @@ +/* filesubr.c --- subroutines for dealing with files + Jim Blandy <jimb@cyclic.com> + + This file is part of GNU CVS. + + GNU CVS 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. + + This program 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. */ + +/* These functions were moved out of subr.c because they need different + definitions under operating systems (like, say, Windows NT) with different + file system semantics. */ + +#include "cvs.h" +#include <sys/param.h> + +/* + * I don't know of a convenient way to test this at configure time, or else + * I'd certainly do it there. + */ +#if defined(NeXT) +#define LOSING_TMPNAM_FUNCTION +#endif + +static int deep_remove_dir PROTO((const char *path)); + +/* + * Copies "from" to "to". + */ +void +copy_file (from, to) + const char *from; + const char *to; +{ + struct stat sb; + struct utimbuf t; + int fdin, fdout; + + if (trace) +#ifdef SERVER_SUPPORT + (void) fprintf (stderr, "%c-> copy(%s,%s)\n", + (server_active) ? 'S' : ' ', from, to); +#else + (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to); +#endif + if (noexec) + return; + + if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0) + error (1, errno, "cannot open %s for copying", from); + if (fstat (fdin, &sb) < 0) + error (1, errno, "cannot fstat %s", from); + if ((fdout = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, + (int) sb.st_mode & 07777)) < 0) + error (1, errno, "cannot create %s for copying", to); + if (sb.st_size > 0) + { + char buf[BUFSIZ]; + int n; + + for (;;) + { + n = read (fdin, buf, sizeof(buf)); + if (n == -1) + { +#ifdef EINTR + if (errno == EINTR) + continue; +#endif + error (1, errno, "cannot read file %s for copying", from); + } + else if (n == 0) + break; + + if (write(fdout, buf, n) != n) { + error (1, errno, "cannot write file %s for copying", to); + } + } + +#ifdef HAVE_FSYNC + if (fsync (fdout)) + error (1, errno, "cannot fsync file %s after copying", to); +#endif + } + + if (close (fdin) < 0) + error (0, errno, "cannot close %s", from); + if (close (fdout) < 0) + error (1, errno, "cannot close %s", to); + + /* now, set the times for the copied file to match those of the original */ + memset ((char *) &t, 0, sizeof (t)); + t.actime = sb.st_atime; + t.modtime = sb.st_mtime; + (void) utime (to, &t); +} + +/* FIXME-krp: these functions would benefit from caching the char * & + stat buf. */ + +/* + * Returns non-zero if the argument file is a directory, or is a symbolic + * link which points to a directory. + */ +int +isdir (file) + const char *file; +{ + struct stat sb; + + if (stat (file, &sb) < 0) + return (0); + return (S_ISDIR (sb.st_mode)); +} + +/* + * Returns non-zero if the argument file is a symbolic link. + */ +int +islink (file) + const char *file; +{ +#ifdef S_ISLNK + struct stat sb; + + if (lstat (file, &sb) < 0) + return (0); + return (S_ISLNK (sb.st_mode)); +#else + return (0); +#endif +} + +/* + * Returns non-zero if the argument file exists. + */ +int +isfile (file) + const char *file; +{ + return isaccessible(file, F_OK); +} + +/* + * Returns non-zero if the argument file is readable. + */ +int +isreadable (file) + const char *file; +{ + return isaccessible(file, R_OK); +} + +/* + * Returns non-zero if the argument file is writable. + */ +int +iswritable (file) + const char *file; +{ + return isaccessible(file, W_OK); +} + +/* + * Returns non-zero if the argument file is accessable according to + * mode. If compiled with SETXID_SUPPORT also works if cvs has setxid + * bits set. + */ +int +isaccessible (file, mode) + const char *file; + const int mode; +{ +#ifdef SETXID_SUPPORT + struct stat sb; + int umask = 0; + int gmask = 0; + int omask = 0; + int uid; + + if (stat(file, &sb) == -1) + return 0; + if (mode == F_OK) + return 1; + + uid = geteuid(); + if (uid == 0) /* superuser */ + { + if (mode & X_OK) + return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH); + else + return 1; + } + + if (mode & R_OK) + { + umask |= S_IRUSR; + gmask |= S_IRGRP; + omask |= S_IROTH; + } + if (mode & W_OK) + { + umask |= S_IWUSR; + gmask |= S_IWGRP; + omask |= S_IWOTH; + } + if (mode & X_OK) + { + umask |= S_IXUSR; + gmask |= S_IXGRP; + omask |= S_IXOTH; + } + + if (sb.st_uid == uid) + return (sb.st_mode & umask) == umask; + else if (sb.st_gid == getegid()) + return (sb.st_mode & gmask) == gmask; + else + return (sb.st_mode & omask) == omask; +#else + return access(file, mode) == 0; +#endif +} + +/* + * Open a file and die if it fails + */ +FILE * +open_file (name, mode) + const char *name; + const char *mode; +{ + FILE *fp; + + if ((fp = fopen (name, mode)) == NULL) + error (1, errno, "cannot open %s", name); + return (fp); +} + +/* + * Make a directory and die if it fails + */ +void +make_directory (name) + const char *name; +{ + struct stat sb; + + if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode))) + error (0, 0, "%s already exists but is not a directory", name); + if (!noexec && mkdir (name, 0777) < 0) + error (1, errno, "cannot make directory %s", name); +} + +/* + * Make a path to the argument directory, printing a message if something + * goes wrong. + */ +void +make_directories (name) + const char *name; +{ + char *cp; + + if (noexec) + return; + + if (mkdir (name, 0777) == 0 || errno == EEXIST) + return; + if (! existence_error (errno)) + { + error (0, errno, "cannot make path to %s", name); + return; + } + if ((cp = strrchr (name, '/')) == NULL) + return; + *cp = '\0'; + make_directories (name); + *cp++ = '/'; + if (*cp == '\0') + return; + (void) mkdir (name, 0777); +} + +/* Create directory NAME if it does not already exist; fatal error for + other errors. Returns 0 if directory was created; 1 if it already + existed. */ +int +mkdir_if_needed (name) + char *name; +{ + if (mkdir (name, 0777) < 0) + { + if (errno != EEXIST) + error (1, errno, "cannot make directory %s", name); + return 1; + } + return 0; +} + +/* + * Change the mode of a file, either adding write permissions, or removing + * all write permissions. Either change honors the current umask setting. + * The EMX doc (0.9c, emxlib.doc) says that chmod sets/clears the readonly + * bit. But it always seemed to be a noop when I tried it. Therefore, + * I've copied over the "attrib" code from os2/filesubr.c. + */ +void +xchmod (fname, writable) + char *fname; + int writable; +{ + char *attrib_cmd; + char *attrib_option; + char *whole_cmd; + char *p; + char *q; + + if (!isfile (fname)) + { + error (0, 0, "cannot change mode of file %s; it does not exist", + fname); + return; + } + + attrib_cmd = "attrib "; /* No, really? */ + + if (writable) + attrib_option = "-r "; /* make writeable */ + else + attrib_option = "+r "; /* make read-only */ + + whole_cmd = xmalloc (strlen (attrib_cmd) + + strlen (attrib_option) + + strlen (fname) + + 1); + + strcpy (whole_cmd, attrib_cmd); + strcat (whole_cmd, attrib_option); + + /* Copy fname to the end of whole_cmd, translating / to \. + Attrib doesn't take / but many parts of CVS rely + on being able to use it. */ + p = whole_cmd + strlen (whole_cmd); + q = fname; + while (*q) + { + if (*q == '/') + *p++ = '\\'; + else + *p++ = *q; + ++q; + } + *p = '\0'; + + system (whole_cmd); + free (whole_cmd); +} + +/* + * Rename a file and die if it fails + */ +void +rename_file (from, to) + const char *from; + const char *to; +{ + if (trace) +#ifdef SERVER_SUPPORT + (void) fprintf (stderr, "%c-> rename(%s,%s)\n", + (server_active) ? 'S' : ' ', from, to); +#else + (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to); +#endif + if (noexec) + return; + + unlink_file (to); + if (rename (from, to) != 0) + error (1, errno, "cannot rename file %s to %s", from, to); +} + +/* + * link a file, if possible. Warning: the Windows NT version of this + * function just copies the file, so only use this function in ways + * that can deal with either a link or a copy. + */ +int +link_file (from, to) + const char *from; + const char *to; +{ + if (trace) +#ifdef SERVER_SUPPORT + (void) fprintf (stderr, "%c-> link(%s,%s)\n", + (server_active) ? 'S' : ' ', from, to); +#else + (void) fprintf (stderr, "-> link(%s,%s)\n", from, to); +#endif + if (noexec) + return (0); + + copy_file (from, to); + return 0; +} + +/* + * unlink a file, if possible. + */ +int +unlink_file (f) + const char *f; +{ + if (trace) +#ifdef SERVER_SUPPORT + (void) fprintf (stderr, "%c-> unlink(%s)\n", + (server_active) ? 'S' : ' ', f); +#else + (void) fprintf (stderr, "-> unlink(%s)\n", f); +#endif + if (noexec) + return (0); + + if (isfile (f)) + xchmod ((char *)f, 1); + return (unlink (f)); +} + +/* + * Unlink a file or dir, if possible. If it is a directory do a deep + * removal of all of the files in the directory. Return -1 on error + * (in which case errno is set). + */ +int +unlink_file_dir (f) + const char *f; +{ + if (trace) +#ifdef SERVER_SUPPORT + (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n", + (server_active) ? 'S' : ' ', f); +#else + (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f); +#endif + if (noexec) + return (0); + + /* For at least some unices, if root tries to unlink() a directory, + instead of doing something rational like returning EISDIR, + the system will gleefully go ahead and corrupt the filesystem. + So we first call isdir() to see if it is OK to call unlink(). This + doesn't quite work--if someone creates a directory between the + call to isdir() and the call to unlink(), we'll still corrupt + the filesystem. Where is the Unix Haters Handbook when you need + it? */ + if (isdir(f)) + return deep_remove_dir(f); + else + { + if (unlink (f) != 0) + return -1; + } + /* We were able to remove the file from the disk */ + return 0; +} + +/* Remove a directory and everything it contains. Returns 0 for + * success, -1 for failure (in which case errno is set). + */ + +static int +deep_remove_dir (path) + const char *path; +{ + DIR *dirp; + struct dirent *dp; + char buf[PATH_MAX]; + + if (rmdir (path) != 0) + { + if (errno == ENOTEMPTY + || errno == EEXIST + /* Ugly workaround for ugly AIX 4.1 (and 3.2) header bug + (it defines ENOTEMPTY and EEXIST to 17 but actually + returns 87). */ + || (ENOTEMPTY == 17 && EEXIST == 17 && errno == 87)) + { + if ((dirp = opendir (path)) == NULL) + /* If unable to open the directory return + * an error + */ + return -1; + + while ((dp = readdir (dirp)) != NULL) + { + if (strcmp (dp->d_name, ".") == 0 || + strcmp (dp->d_name, "..") == 0) + continue; + + sprintf (buf, "%s/%s", path, dp->d_name); + + /* See comment in unlink_file_dir explanation of why we use + isdir instead of just calling unlink and checking the + status. */ + if (isdir(buf)) + { + if (deep_remove_dir(buf)) + { + closedir(dirp); + return -1; + } + } + else + { + if (unlink (buf) != 0) + { + closedir(dirp); + return -1; + } + } + } + closedir (dirp); + return rmdir (path); + } + else + return -1; + } + + /* Was able to remove the directory return 0 */ + return 0; +} + +/* Read NCHARS bytes from descriptor FD into BUF. + Return the number of characters successfully read. + The number returned is always NCHARS unless end-of-file or error. */ +static size_t +block_read (fd, buf, nchars) + int fd; + char *buf; + size_t nchars; +{ + char *bp = buf; + size_t nread; + + do + { + nread = read (fd, bp, nchars); + if (nread == (size_t)-1) + { +#ifdef EINTR + if (errno == EINTR) + continue; +#endif + return (size_t)-1; + } + + if (nread == 0) + break; + + bp += nread; + nchars -= nread; + } while (nchars != 0); + + return bp - buf; +} + + +/* + * Compare "file1" to "file2". Return non-zero if they don't compare exactly. + */ +int +xcmp (file1, file2) + const char *file1; + const char *file2; +{ + char *buf1, *buf2; + struct stat sb1, sb2; + int fd1, fd2; + int ret; + + if ((fd1 = open (file1, O_RDONLY | O_BINARY)) < 0) + error (1, errno, "cannot open file %s for comparing", file1); + if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0) + error (1, errno, "cannot open file %s for comparing", file2); + if (fstat (fd1, &sb1) < 0) + error (1, errno, "cannot fstat %s", file1); + if (fstat (fd2, &sb2) < 0) + error (1, errno, "cannot fstat %s", file2); + + /* A generic file compare routine might compare st_dev & st_ino here + to see if the two files being compared are actually the same file. + But that won't happen in CVS, so we won't bother. */ + + if (sb1.st_size != sb2.st_size) + ret = 1; + else if (sb1.st_size == 0) + ret = 0; + else + { + /* FIXME: compute the optimal buffer size by computing the least + common multiple of the files st_blocks field */ + size_t buf_size = 8 * 1024; + size_t read1; + size_t read2; + + buf1 = xmalloc (buf_size); + buf2 = xmalloc (buf_size); + + do + { + read1 = block_read (fd1, buf1, buf_size); + if (read1 == (size_t)-1) + error (1, errno, "cannot read file %s for comparing", file1); + + read2 = block_read (fd2, buf2, buf_size); + if (read2 == (size_t)-1) + error (1, errno, "cannot read file %s for comparing", file2); + + /* assert (read1 == read2); */ + + ret = memcmp(buf1, buf2, read1); + } while (ret == 0 && read1 == buf_size); + + free (buf1); + free (buf2); + } + + (void) close (fd1); + (void) close (fd2); + return (ret); +} + + +/* Just in case this implementation does not define this. */ +#ifndef L_tmpnam +#define L_tmpnam 50 +#endif + + +#ifdef LOSING_TMPNAM_FUNCTION +char * +cvs_temp_name () +{ + char value[L_tmpnam + 1]; + + /* FIXME: Should be using TMPDIR. */ + strcpy (value, "/tmp/cvsXXXXXX"); + mktemp (value); + return xstrdup (value); +} +#else +/* Generate a unique temporary filename. Returns a pointer to a newly + malloc'd string containing the name. Returns successfully or not at + all. */ +char * +cvs_temp_name () +{ + char value[L_tmpnam + 1]; + char *retval; + + /* FIXME: should be using TMPDIR, perhaps by using tempnam on systems + which have it. */ + retval = tmpnam (value); + if (retval == NULL) + error (1, errno, "cannot generate temporary filename"); + return xstrdup (retval); +} +#endif + + +/* Return non-zero iff FILENAME is absolute. + Trivial under Unix, but more complicated under other systems. + Under EMX let _fnisabs do all this work. */ +int +isabsolute (filename) + const char *filename; +{ + return _fnisabs(filename); +} + + +/* Return a pointer into PATH's last component. */ +char * +last_component (path) + char *path; +{ + char *last; + + /* We can't be sure here if 'path' is already slashified. */ + _fnslashify (path); + + last = strrchr (path, '/'); + + if (last) + return last + 1; + else + return path; +} + +/* Return the home directory. Returns a pointer to storage + managed by this function or its callees (currently getenv). + This function will return the same thing every time it is + called. */ +char * +get_homedir () +{ + static char *home = NULL; + char *env = getenv ("HOME"); + struct passwd *pw; + + if (home != NULL) + return home; + + if (env) + home = env; + else if ((pw = (struct passwd *) getpwuid (getuid ())) + && pw->pw_dir) + home = xstrdup (pw->pw_dir); + else + return 0; + + return home; +} + +/* See cvs.h for description. On unix this does nothing, because the + shell expands the wildcards. Under EMX, use _fnexplode to get the + expanded filenames */ +void +expand_wild (argc, argv, pargc, pargv) + int argc; + char **argv; + int *pargc; + char ***pargv; +{ + int i; + *pargc = argc; + *pargv = (char **) xmalloc (argc * sizeof (char *)); + for (i = 0; i < argc; ++i) + (*pargv)[i] = xstrdup (argv[i]); +} + +unsigned char +OS2_filename_classes[] = +{ + 0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17, + 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f, + 0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27, + 0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f, + 0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37, + 0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f, + 0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, + 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, + 0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f, + 0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, + 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, + 0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f, + 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f, + 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97, + 0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f, + 0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf, + 0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7, + 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf, + 0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7, + 0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf, + 0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7, + 0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf, + 0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7, + 0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef, + 0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7, + 0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff, +}; + + +/* Like strcmp, but with the appropriate tweaks for file names. + Under OS/2, filenames are case-insensitive but case-preserving, and + both \ and / are path element separators. */ +int +fncmp (const char *n1, const char *n2) +{ + char fn1[MAXNAMLEN], fn2[MAXNAMLEN]; + + strcpy (fn1, n1); _fnslashify(fn1); + strcpy (fn2, n2); _fnslashify(fn2); + + return _fncmp ((unsigned char *) fn1, (unsigned char *) fn2); +} + + +/* Fold characters in FILENAME to their canonical forms. + If FOLD_FN_CHAR is not #defined, the system provides a default + definition for this. */ +void +fnfold (char *filename) +{ + while (*filename) + { + *filename = FOLD_FN_CHAR (*filename); + filename++; + } +} diff --git a/gnu/usr.bin/cvs/emx/options.h b/gnu/usr.bin/cvs/emx/options.h index add2795763d..c247ccb155c 100644 --- a/gnu/usr.bin/cvs/emx/options.h +++ b/gnu/usr.bin/cvs/emx/options.h @@ -17,19 +17,6 @@ */ /* - * CVS provides the most features when used in conjunction with the - * Version-5 release of RCS. Thus, it is the default. This also - * assumes that GNU diff Version-1.15 is being used as well -- you - * will have to configure your RCS V5 release separately to make this - * the case. If you do not have RCS V5 and GNU diff V1.15, comment out - * this define. You should not try mixing and matching other - * combinations of these tools. - */ -#ifndef HAVE_RCS5 -#define HAVE_RCS5 -#endif - -/* * For portability and heterogeneity reasons, CVS is shipped by * default using my own text-file version of the ndbm database library * in the src/myndbm.c file. If you want better performance and are @@ -41,23 +28,6 @@ #endif /* - * The "diff" program to execute when creating patch output. This - * "diff" must support the "-c" option for context diffing. Specify a - * full pathname if your site wants to use a particular diff. Note - * that unlike the diff used with RCS, you *must not* supply -a here - * (doing so will cause the server to generate patches which patch - * cannot handle in some cases). - * - * NOTE: this program is only used for the ``patch'' sub-command (and - * for ``update'' if you are using the server). The other commands - * use rcsdiff which will use whatever version of diff was specified - * when rcsdiff was built on your system. - */ -#ifndef DIFF -#define DIFF "diff" -#endif - -/* * The "patch" program to run when using the CVS server and accepting * patches across the network. Specify a full pathname if your site * wants to use a particular patch. @@ -66,41 +36,6 @@ #define PATCH_PROGRAM "patch" #endif -/* - * By default, RCS programs are executed with the shell or through - * execlp(), so the user's PATH environment variable is searched. If - * you'd like to bind all RCS programs to a certain directory (perhaps - * one not in most people's PATH) then set the default in RCSBIN_DFLT. - * Note that setting this here will cause all RCS programs to be - * executed from this directory, unless the user overrides the default - * with the RCSBIN environment variable or the "-b" option to CVS. - * - * If you use the password-authenticating server, then you need to - * make sure that the server can find the RCS programs to invoke them. - * The authenticating server starts out running as root, and then - * switches to run as the appropriate user once authentication is - * complete. But no actual shell is ever started by that user, so the - * PATH environment variable may not contain the directory with the - * RCS binaries, even though if that user logged in normally, PATH - * would include the directory. - * - * One way to solve this problem is to set RCSBIN_DFLT here. An - * alternative is to make sure that root has the right directory in - * its path already. Another, probably better alternative is to - * specify -b in /etc/inetd.conf. - * - * You may also have to set RCSBIN_DFLT here if there's no global - * start-up script run for users by rshd and your RCS programs are not - * in a directory in the default PATH assigned by rshd. - * - * This define should be either the empty string ("") or a full - * pathname to the directory containing all the installed programs - * from the RCS distribution. - */ -#ifndef RCSBIN_DFLT -#define RCSBIN_DFLT "" -#endif - /* Directory used for storing temporary files, if not overridden by environment variables or the -T global option. There should be little need to change this (-T is a better mechanism if you need to use a @@ -262,8 +197,3 @@ #ifndef STDC_HEADERS extern void exit (); #endif - -#ifndef getwd -extern char *getwd (); -#endif - diff --git a/gnu/usr.bin/cvs/emx/savecwd.c b/gnu/usr.bin/cvs/emx/savecwd.c new file mode 100644 index 00000000000..a0951a8188f --- /dev/null +++ b/gnu/usr.bin/cvs/emx/savecwd.c @@ -0,0 +1,141 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> + +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#ifdef HAVE_FCNTL_H +# include <fcntl.h> +#else +# include <sys/file.h> +#endif + +#ifdef HAVE_DIRECT_H +# include <direct.h> +#endif + +#ifdef HAVE_IO_H +# include <io.h> +#endif + +#include <errno.h> +# ifndef errno +extern int errno; +#endif + +#include "savecwd.h" +#include "error.h" + +char *xgetwd __PROTO((void)); + +/* Record the location of the current working directory in CWD so that + the program may change to other directories and later use restore_cwd + to return to the recorded location. This function may allocate + space using malloc (via xgetwd) or leave a file descriptor open; + use free_cwd to perform the necessary free or close. Upon failure, + no memory is allocated, any locally opened file descriptors are + closed; return non-zero -- in that case, free_cwd need not be + called, but doing so is ok. Otherwise, return zero. */ + +int +save_cwd (cwd) + struct saved_cwd *cwd; +{ + static int have_working_fchdir = 1; + + cwd->desc = -1; + cwd->name = NULL; + + if (have_working_fchdir) + { +#ifdef HAVE_FCHDIR + cwd->desc = open (".", O_RDONLY); + if (cwd->desc < 0) + { + error (0, errno, "cannot open current directory"); + return 1; + } + +# if __sun__ || sun + /* On SunOS 4, fchdir returns EINVAL if accounting is enabled, + so we have to fall back to chdir. */ + if (fchdir (cwd->desc)) + { + if (errno == EINVAL) + { + close (cwd->desc); + cwd->desc = -1; + have_working_fchdir = 0; + } + else + { + error (0, errno, "current directory"); + close (cwd->desc); + cwd->desc = -1; + return 1; + } + } +# endif /* __sun__ || sun */ +#else +#define fchdir(x) (abort (), 0) + have_working_fchdir = 0; +#endif + } + + if (!have_working_fchdir) + { + cwd->name = xgetwd (); + if (cwd->name == NULL) + { + error (0, errno, "cannot get current directory"); + return 1; + } + } + return 0; +} + +/* Change to recorded location, CWD, in directory hierarchy. + If "saved working directory", NULL)) + */ + +int +restore_cwd (cwd, dest) + const struct saved_cwd *cwd; + const char *dest; +{ + int fail = 0; + if (cwd->desc >= 0) + { + if (fchdir (cwd->desc)) + { + error (0, errno, "cannot return to %s", + (dest ? dest : "saved working directory")); + fail = 1; + } + } + else if (_chdir2 (cwd->name) < 0) + { + error (0, errno, "%s", cwd->name); + fail = 1; + } + return fail; +} + +void +free_cwd (cwd) + struct saved_cwd *cwd; +{ + if (cwd->desc >= 0) + close (cwd->desc); + if (cwd->name) + free (cwd->name); +} + diff --git a/gnu/usr.bin/cvs/emx/startserver.c b/gnu/usr.bin/cvs/emx/startserver.c new file mode 100644 index 00000000000..ae26c4e5446 --- /dev/null +++ b/gnu/usr.bin/cvs/emx/startserver.c @@ -0,0 +1,84 @@ +/* This program 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. + + This program 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. */ + +#include <assert.h> +#include "cvs.h" +#include "rcmd.h" + +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + +#include "options.h" + +static char *cvs_server; +static char *command; + +extern int trace; + +void +os2_start_server (int *tofd, int *fromfd, + char *client_user, + char *server_user, + char *server_host, + char *server_cvsroot) +{ + int fd, port; + char *portenv; + struct servent *sptr; + const char *rcmd_host = (const char *) server_host; + + if (! (cvs_server = getenv ("CVS_SERVER"))) + cvs_server = "cvs"; + command = xmalloc (strlen (cvs_server) + + strlen (server_cvsroot) + + 50); + sprintf (command, "%s server", cvs_server); + + portenv = getenv ("CVS_RCMD_PORT"); + if (portenv) + port = atoi (portenv); + else if ((sptr = getservbyname ("shell", "tcp")) != NULL) + port = sptr->s_port; + else + port = 514; /* shell/tcp */ + + if (trace) + { + fprintf (stderr, "os2_start_server(): connecting to %s:%d\n", + server_host, port); + fprintf (stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n", + client_user, (server_user ? server_user : client_user), + server_cvsroot); + } + + fd = rcmd (&rcmd_host, port, + client_user, + (server_user ? server_user : client_user), + command, 0); + + if (fd < 0) + error (1, errno, "cannot start server via rcmd()"); + + *tofd = fd; + *fromfd = fd; + free (command); +} + +void +os2_shutdown_server (int fd) +{ + /* FIXME: shutdown on files seems to have no bad effects */ + if (shutdown (fd, 2) < 0 && errno != ENOTSOCK) + error (1, 0, "couldn't shutdown server connection"); + if (close (fd) < 0) + error (1, 0, "couldn't close server connection"); +} + diff --git a/gnu/usr.bin/cvs/emx/stripslash.c b/gnu/usr.bin/cvs/emx/stripslash.c new file mode 100644 index 00000000000..a68763d5733 --- /dev/null +++ b/gnu/usr.bin/cvs/emx/stripslash.c @@ -0,0 +1,27 @@ +/* stripslash.c -- remove trailing slashes from a string + Copyright (C) 1990 Free Software Foundation, Inc. + + This program 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. + + This program 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. */ + +#include <string.h> + +/* Remove trailing slashes from PATH. */ + +void +strip_trailing_slashes (path) + char *path; +{ + int last; + + last = strlen (path) - 1; + while (last > 0 && (path[last] == '/' || path[last] == '\\')) + path[last--] = '\0'; +} diff --git a/gnu/usr.bin/cvs/emx/system.c b/gnu/usr.bin/cvs/emx/system.c new file mode 100644 index 00000000000..f4481b371dd --- /dev/null +++ b/gnu/usr.bin/cvs/emx/system.c @@ -0,0 +1,91 @@ +/* This program 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. + + This program 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. */ + +#include <io.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/param.h> +#include <fnmatch.h> + + +/* Expand wildcards in argv. We probably should be expanding wildcards + via expand_wild instead; that way we could expand only filenames and + not tag names and the like. */ + +void +os2_initialize (pargc, pargv) + int *pargc; + char **pargv[]; +{ + _wildcard (pargc, pargv); +} + + +/* Modifies 'stat' so that always the same inode is returned. EMX never + returns the same value for st_ino. Without this modification, + release_delete in module src/release.c refuses to work. Care must + be taken if someone is using the value of st_ino (but as far as I know, + no callers are). */ + +int +os2_stat (name, buffer) + const char *name; + struct stat *buffer; +{ + int rc = stat (name, buffer); + + /* There are no inodes on OS/2. */ + buffer->st_ino = 42; + + return rc; +} + + +/* We must not only change the directory, but also the current drive. + Otherwise it is be impossible to have the working directory and the + repository on different drives. */ + +int +os2_chdir (name) + const char *name; +{ + return _chdir2 (name); +} + + +/* getwd must return a drive specification. */ + +char * +xgetwd () +{ + return _getcwd2 (NULL, 1); +} + + +/* fnmatch must recognize OS/2 filename conventions: Filename case + must be preserved, but ignored in searches. It would perhaps be better + to just have CVS pick how to match based on FILENAMES_CASE_INSENSITIVE + or something rather than having an OS/2-specific version of CVS_FNMATCH. + Note that lib/fnmatch.c uses FOLD_FN_CHAR; that is how we get + case-insensitivity on NT (and VMS, I think). */ + +#define _FNM_OS2 1 +#define _FNM_IGNORECASE 128 + +int +os2_fnmatch (pattern, name, flags) + const char *pattern; + const char *name; + int flags; +{ + return fnmatch (pattern, name, _FNM_IGNORECASE | _FNM_OS2 | flags); +} diff --git a/gnu/usr.bin/cvs/lib/ChangeLog b/gnu/usr.bin/cvs/lib/ChangeLog index 02a0e1f7a33..3d858ab8659 100644 --- a/gnu/usr.bin/cvs/lib/ChangeLog +++ b/gnu/usr.bin/cvs/lib/ChangeLog @@ -1,3 +1,77 @@ +13 Jan 1998 Jim Kingdon + + * fncase.c: Include config.h before system.h. + + * system.h: Just include string.h unconditionally. We already + include it unconditionally elsewhere. + +Tue Jan 13 16:51:59 1998 Ian Lance Taylor <ian@cygnus.com> + + * fncase.c: New file, taken from windows-NT/filesubr.c. + * system.h: If __CYGWIN32__ or WIN32 are defined, define + FOLD_FN_CHAR, FILENAMES_CASE_INSENSITIVE, and ISDIRSEP, and + declare fncmp and fnfold. Taken from windows-NT/config.h. + * Makefile.in (SOURCES): Add fncase.c. + +Sat Jan 10 10:51:26 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * getline.c (getstr): Make sure to set errno when appropriate. I + didn't test the error case for the new code but inspection shows + the old code was rather broken. + +Sat Nov 29 22:03:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + getwd and getcwd were a big big mess. Although Jim's fix might + indeed be fixing a typo, the code is so tangled that I would guess + it probably breaks some system. So clean this up: + * xgetwd.c: Always assume we have getcwd (we had been anyway, + before Jim's change). + * getwd.c: Removed. + * Makefile.in: Remove getwd.c + * system.h: Remove declarations of getwd and getcwd. Move getcwd + declaration to the !HAVE_UNISTD_H section. + +1997-11-29 Jim Meyering <meyering@na-net.ornl.gov> + + * xgetwd.c: Fix typo s/ifndef/ifdef/ in test of HAVE_GETWD. + +Wed Nov 26 10:12:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * system.h: Always use "rb" and "wb". Check for O_BINARY with an + #ifdef, not the error-prone LINES_CRLF_TERMINATED. + +Thu Sep 25 10:57:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * getdate.y (get_date): If gmtime returns NULL, try to cope. + * getdate.c: Regenerated using byacc. + + * getdate.y: Remove comment about sending email concerning this file + to Rich Salz. + * getdate.c: Regenerated using byacc. + +Wed Sep 24 10:35:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (OBJECTS): Add regex.o. + +Wed Sep 17 16:37:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * getdate.y (ToSeconds): For am or pm, a hour of "12" really means 0. + * getdate.c: Regenerated using byacc (not bison per comment). + +Tue Sep 9 20:51:45 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * build_lib.com: Add vasprintf.c and vasprintf.obj. + + * build_lib.com: Remove strippath.obj from library/create command. + +Sun Sep 7 17:35:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * system.h: Replace comment referring to ChangeLog with a + comment based on the ChangeLog entries. + + * strdup.c: Removed, per change to ../configure.in + * Makefile.in (SOURCES): Remove strdup.c. + Mon Jun 16 18:59:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> * system.h: Add CVS_FNMATCH. diff --git a/gnu/usr.bin/cvs/lib/build_lib.com b/gnu/usr.bin/cvs/lib/build_lib.com index 72c71ba38c4..258038f495b 100644 --- a/gnu/usr.bin/cvs/lib/build_lib.com +++ b/gnu/usr.bin/cvs/lib/build_lib.com @@ -11,8 +11,9 @@ $ CC savecwd.c $ CC sighandle.c $ CC stripslash.c $ CC valloc.c +$ CC vasprintf.c $ CC xgetwd.c $ CC yesno.c $ library/create gnulib.olb fnmatch.obj,getdate.obj,getline.obj,- getopt.obj,getopt1.obj,md5.obj,regex.obj,savecwd.obj,sighandle.obj,- -strippath.obj,stripslash.obj,valloc.obj,xgetwd.obj,yesno.obj +stripslash.obj,valloc.obj,vasprintf.obj,xgetwd.obj,yesno.obj diff --git a/gnu/usr.bin/cvs/lib/fncase.c b/gnu/usr.bin/cvs/lib/fncase.c new file mode 100644 index 00000000000..56e7f512bcf --- /dev/null +++ b/gnu/usr.bin/cvs/lib/fncase.c @@ -0,0 +1,115 @@ +/* fncase.c -- CVS support for case insensitive file systems. + Jim Blandy <jimb@cyclic.com> + + This file is part of GNU CVS. + + GNU CVS 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. + + This program 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. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "system.h" + +/* The equivalence class mapping for filenames. + Windows NT filenames are case-insensitive, but case-preserving. + Both / and \ are path element separators. + Thus, this table maps both upper and lower case to lower case, and + both / and \ to /. */ + +#if 0 +main () +{ + int c; + + for (c = 0; c < 256; c++) + { + int t; + + if (c == '\\') + t = '/'; + else + t = tolower (c); + + if ((c & 0x7) == 0x0) + printf (" "); + printf ("0x%02x,", t); + if ((c & 0x7) == 0x7) + putchar ('\n'); + else if ((c & 0x7) == 0x3) + putchar (' '); + } +} +#endif + +unsigned char +WNT_filename_classes[] = +{ + 0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17, + 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f, + 0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27, + 0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f, + 0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37, + 0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f, + 0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, + 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, + 0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f, + 0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, + 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, + 0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f, + 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f, + 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97, + 0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f, + 0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf, + 0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7, + 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf, + 0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7, + 0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf, + 0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7, + 0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf, + 0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7, + 0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef, + 0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7, + 0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff, +}; + +/* Like strcmp, but with the appropriate tweaks for file names. + Under Windows NT, filenames are case-insensitive but case-preserving, + and both \ and / are path element separators. */ +int +fncmp (const char *n1, const char *n2) +{ + while (*n1 && *n2 + && (WNT_filename_classes[(unsigned char) *n1] + == WNT_filename_classes[(unsigned char) *n2])) + n1++, n2++; + return (WNT_filename_classes[(unsigned char) *n1] + - WNT_filename_classes[(unsigned char) *n2]); +} + +/* Fold characters in FILENAME to their canonical forms. + If FOLD_FN_CHAR is not #defined, the system provides a default + definition for this. */ +void +fnfold (char *filename) +{ + while (*filename) + { + *filename = FOLD_FN_CHAR (*filename); + filename++; + } +} diff --git a/gnu/usr.bin/cvs/lib/system.h b/gnu/usr.bin/cvs/lib/system.h index 1a692ffa4a9..7648b76355c 100644 --- a/gnu/usr.bin/cvs/lib/system.h +++ b/gnu/usr.bin/cvs/lib/system.h @@ -27,8 +27,14 @@ #undef S_ISNWK #endif -/* Not all systems have S_IFMT, but we probably want to use it if we - do. See ChangeLog for a more detailed discussion. */ +/* Not all systems have S_IFMT, but we want to use it if we have it. + The S_IFMT code below looks right (it masks and compares). The + non-S_IFMT code looks bogus (are there really systems on which + S_IFBLK, S_IFLNK, &c, each have their own bit? I suspect it was + written for OS/2 using the IBM C/C++ Tools 2.01 compiler). + + Of course POSIX systems will have S_IS*, so maybe the issue is + semi-moot. */ #if !defined(S_ISBLK) && defined(S_IFBLK) # if defined(S_IFMT) @@ -147,6 +153,7 @@ #include <limits.h> #else off_t lseek (); +char *getcwd (); #endif #if TIME_WITH_SYS_TIME @@ -276,16 +283,7 @@ int utime (); # endif #endif -#if STDC_HEADERS || HAVE_STRING_H -# include <string.h> - /* An ANSI string.h and pre-ANSI memory.h might conflict. */ -# if !STDC_HEADERS && HAVE_MEMORY_H -# include <memory.h> -# endif /* not STDC_HEADERS and HAVE_MEMORY_H */ -#else /* not STDC_HEADERS and not HAVE_STRING_H */ -# include <strings.h> - /* memory.h and strings.h conflict on some systems. */ -#endif /* not STDC_HEADERS and not HAVE_STRING_H */ +#include <string.h> #ifndef ERRNO_H_MISSING #include <errno.h> @@ -329,12 +327,6 @@ extern int errno; #define EXIT_FAILURE 1 #endif -#if defined(USG) || defined(POSIX) -char *getcwd (); -#else -char *getwd (); -#endif - /* check for POSIX signals */ #if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK) # define POSIX_SIGNALS @@ -470,6 +462,31 @@ char *getwd (); #define CVS_FNMATCH fnmatch #endif +#if defined (__CYGWIN32__) || defined (WIN32) + +/* Under Windows NT, filenames are case-insensitive, and both / and \ + are path component separators. */ + +#define FOLD_FN_CHAR(c) (WNT_filename_classes[(unsigned char) (c)]) +extern unsigned char WNT_filename_classes[]; +#define FILENAMES_CASE_INSENSITIVE 1 + +/* Is the character C a path name separator? Under + Windows NT, you can use either / or \. */ +#define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/') + +/* Like strcmp, but with the appropriate tweaks for file names. + Under Windows NT, filenames are case-insensitive but case-preserving, + and both \ and / are path element separators. */ +extern int fncmp (const char *n1, const char *n2); + +/* Fold characters in FILENAME to their canonical forms. + If FOLD_FN_CHAR is not #defined, the system provides a default + definition for this. */ +extern void fnfold (char *FILENAME); + +#endif /* defined (__CYGWIN32__) || defined (WIN32) */ + /* Some file systems are case-insensitive. If FOLD_FN_CHAR is #defined, it maps the character C onto its "canonical" form. In a case-insensitive system, it would map all alphanumeric characters @@ -488,21 +505,22 @@ char *getwd (); #endif -/* On some systems, lines in text files should be terminated with CRLF, - not just LF, and the read and write routines do this translation - for you. LINES_CRLF_TERMINATED is #defined on such systems. - - OPEN_BINARY is the flag to pass to the open function for - untranslated I/O. - - FOPEN_BINARY_READ is the string to pass to fopen to get - untranslated reading. - - FOPEN_BINARY_WRITE is the string to pass to fopen to get - untranslated writing. */ -#if LINES_CRLF_TERMINATED -#define OPEN_BINARY (O_BINARY) +/* On some systems, we have to be careful about writing/reading files + in text or binary mode (so in text mode the system can handle CRLF + vs. LF, VMS text file conventions, &c). We decide to just always + be careful. That way we don't have to worry about whether text and + binary differ on this system. We just have to worry about whether + the system has O_BINARY and "rb". The latter is easy; all ANSI C + libraries have it, SunOS4 has it, and CVS has used it unguarded + some places for a while now without complaints (e.g. "rb" in + server.c (server_updated), since CVS 1.8). The former is just an + #ifdef. */ + #define FOPEN_BINARY_READ ("rb") #define FOPEN_BINARY_WRITE ("wb") + +#ifdef O_BINARY +#define OPEN_BINARY (O_BINARY) #else #define OPEN_BINARY (0) -#define FOPEN_BINARY_READ ("r") -#define FOPEN_BINARY_WRITE ("w") #endif diff --git a/gnu/usr.bin/cvs/lib/xgetwd.c b/gnu/usr.bin/cvs/lib/xgetwd.c index e2a3baa5a69..bbae81dd6ce 100644 --- a/gnu/usr.bin/cvs/lib/xgetwd.c +++ b/gnu/usr.bin/cvs/lib/xgetwd.c @@ -1,5 +1,5 @@ /* xgetwd.c -- return current directory with unlimited length - Copyright (C) 1992 Free Software Foundation, Inc. + Copyright (C) 1992, 1997 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,14 +26,6 @@ extern int errno; #endif #include <sys/types.h> -#ifndef HAVE_GETWD -char *getwd (); -#define GETWD(buf, max) getwd (buf) -#else -char *getcwd (); -#define GETWD(buf, max) getcwd (buf, max) -#endif - /* Amount by which to increase buffer size when allocating more space. */ #define PATH_INCR 32 @@ -57,7 +49,7 @@ xgetwd () cwd = xmalloc (path_max); errno = 0; - while ((ret = GETWD (cwd, path_max)) == NULL && errno == ERANGE) + while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE) { path_max += PATH_INCR; cwd = xrealloc (cwd, path_max); diff --git a/gnu/usr.bin/cvs/man/ChangeLog b/gnu/usr.bin/cvs/man/ChangeLog index 6023631036a..c873cb27c39 100644 --- a/gnu/usr.bin/cvs/man/ChangeLog +++ b/gnu/usr.bin/cvs/man/ChangeLog @@ -1,3 +1,18 @@ +Mon Jan 12 11:10:21 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.1: Refer to Cederqvist as Cederqvist not as cvs.texinfo. + Describe it in a way which hopefully makes more sense for people + who aren't getting the CVS source distribution itself. In "SEE + ALSO" section, also mention web pages. Use a period not a comma + at the end of the references to other manpages. + + * cvs.1: Remove $Id; we decided to get rid of these some time ago. + +Sun Jan 11 13:46:54 1998 Peter Wemm <peter@netplex.com.au> + + * cvs.1: Fix "the the" typo. From Wolfram Schneider + <wosch@freebsd.org> via FreeBSD sources. + Wed Feb 12 14:20:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> * Makefile.in (install): Depend on installdirs. diff --git a/gnu/usr.bin/cvs/os2/ChangeLog b/gnu/usr.bin/cvs/os2/ChangeLog index 9541a7f0fd7..1a9973f1c6c 100644 --- a/gnu/usr.bin/cvs/os2/ChangeLog +++ b/gnu/usr.bin/cvs/os2/ChangeLog @@ -1,3 +1,48 @@ +Tue Jan 13 13:17:33 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c: Adjust run_setup for new calling convention. + + * config.h (DIFF): Remove; no longer used. + * options.h (DIFF, RCSBIN_DFLT): Remove; no longer used. + +Wed Dec 31 10:56:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * config.h, filesubr.c (convert_file): Remove; no longer used + (except for BROKEN_READWRITE_CONVERSION which doesn't apply). + +Sat Dec 27 16:57:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (HAVE_RCS5): Remove; no longer used. + + * config.h (LINES_CRLF_TERMINATED): Remove; no longer used. + +Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Change bug-cvs address from prep.ai.mit.edu to gnu.org + per email from Martin Hamilton. + +Sun Nov 30 18:03:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (run_args): Remove; nowhere used. + +Sat Nov 29 22:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h: Remove declaration of getwd; see lib/ChangeLog for + rationale. + +Sun Aug 10 20:42:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * pwd.c, pwd.h: Remove $Header; we decided to get rid of these + some time ago. + +Wed Jul 30 19:15:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * filesubr.c (os2_chdir): If ENODEV is not defined, return ENOENT. + + * README: Talk about srcdir, top_srcdir, and rule to generate + "Makefile". + * Makefile.in: Add comment about Makefile rule. + Mon Jun 16 13:49:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> * config.h, rcmd.h, rcmd.c: Add "copyright" notice. diff --git a/gnu/usr.bin/cvs/os2/Makefile.in b/gnu/usr.bin/cvs/os2/Makefile.in index 19723205b35..715959eaa7d 100644 --- a/gnu/usr.bin/cvs/os2/Makefile.in +++ b/gnu/usr.bin/cvs/os2/Makefile.in @@ -334,5 +334,9 @@ cvs.exe: ${OBJECTS} # cvs.obj: ${OBJECTS} ${SOURCES} ${HEADERS} subdir = os2 +# Hmm. This rule wants to exist on unix, so that "make dist" works. +# And it doesn't want to exist on OS/2, because configure doesn't +# run on OS/2 and so ../config.status won't exist. For now we just +# say, in emx/README, that people will need to comment it out. Makefile: ../config.status $(srcdir)/Makefile.in cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status diff --git a/gnu/usr.bin/cvs/os2/README b/gnu/usr.bin/cvs/os2/README index 64da1ce21db..8fb73f627da 100644 --- a/gnu/usr.bin/cvs/os2/README +++ b/gnu/usr.bin/cvs/os2/README @@ -3,7 +3,10 @@ has probably only been tested with the CVS client. Local CVS might or might not work, and the server would definitely not work. You'll need to edit the makefile to reflect your system's paths (unless you're our customer for this port, in which case the paths are correct because we -did the port on your machine. :-) ). +did the port on your machine. :-) ). You also may need to comment out +the "Makefile" rule in emx/Makefile to avoid a complaint about +../config.status not existing. You also might need to edit srcdir to +be "." and top_srcdir to be "..". That should be all -- edit the makefile, do "make" and get os2\cvs.exe. Assuming you have edited the `install_dir' variable in @@ -19,7 +22,7 @@ such as emacs will generally do this). There are two compiler warnings in os2/popen.c which we haven't figured out the cause of. Other than that there probably aren't a whole lot of warnings (but there might be a few). -Report bugs to <bug-cvs@prep.ai.mit.edu>. +Report bugs to <bug-cvs@gnu.org>. diff --git a/gnu/usr.bin/cvs/os2/config.h b/gnu/usr.bin/cvs/os2/config.h index 781711e19c8..71c31a0da38 100644 --- a/gnu/usr.bin/cvs/os2/config.h +++ b/gnu/usr.bin/cvs/os2/config.h @@ -146,10 +146,6 @@ that's always there. */ #undef SERVER_SUPPORT -/* the path to the gnu diff program on your system */ -/* We don't need this for CLIENT side. */ -#undef DIFF - /* Define if you have the connect function. */ /* Not used? */ /* It appears to be used in client.c now... don't know yet it OS/2 has it. */ @@ -325,18 +321,6 @@ extern int fncmp (const char *n1, const char *n2); definition for this. */ extern void fnfold (char *FILENAME); -/* #define this if your system terminates lines in text files with - CRLF instead of plain LF, and your I/O functions automatically - translate between using LF in memory and CRLF on disk, unless you - specifically tell them not to. */ -#define LINES_CRLF_TERMINATED 1 - -/* Read data from INFILE, and copy it to OUTFILE. - Open INFILE using INFLAGS, and OUTFILE using OUTFLAGS. - This is useful for converting between CRLF and LF line formats. */ -extern void convert_file (char *INFILE, int INFLAGS, - char *OUTFILE, int OUTFLAGS); - /* This is where old bits go to die under OS/2 as well as WinNT. */ #define DEVNULL "nul" diff --git a/gnu/usr.bin/cvs/os2/filesubr.c b/gnu/usr.bin/cvs/os2/filesubr.c index a8653cb7037..2413dad093f 100644 --- a/gnu/usr.bin/cvs/os2/filesubr.c +++ b/gnu/usr.bin/cvs/os2/filesubr.c @@ -748,34 +748,6 @@ last_component (char *path) } -/* Read data from INFILE, and copy it to OUTFILE. - Open INFILE using INFLAGS, and OUTFILE using OUTFLAGS. - This is useful for converting between CRLF and LF line formats. */ -void -convert_file (char *infile, int inflags, - char *outfile, int outflags) -{ - int infd, outfd; - char buf[8192]; - int len; - - if ((infd = open (infile, inflags, S_IREAD | S_IWRITE)) < 0) - error (1, errno, "couldn't read %s", infile); - if ((outfd = open (outfile, outflags, S_IREAD | S_IWRITE)) < 0) - error (1, errno, "couldn't write %s", outfile); - - while ((len = read (infd, buf, sizeof (buf))) > 0) - if (write (outfd, buf, len) < 0) - error (1, errno, "error writing %s", outfile); - if (len < 0) - error (1, errno, "error reading %s", infile); - - if (close (outfd) < 0) - error (0, errno, "warning: couldn't close %s", outfile); - if (close (infd) < 0) - error (0, errno, "warning: couldn't close %s", infile); -} - /* Return the home directory. Returns a pointer to storage managed by this function or its callees (currently getenv). */ char * @@ -916,11 +888,13 @@ expand_wild (argc, argv, pargc, pargv) *pargv = new_argv; } +/* Change drive and directory to path DIR. */ + int os2_chdir (const char *Dir) -/* Change drive and directory to the path given in Dir */ { - /* If the path includes a drive, change the current drive to the one given */ + /* If the path includes a drive, change the current drive to the one + given. */ if (strlen (Dir) >= 2 && Dir [1] == ':') { /* A drive is given in Dir. Extract the drive from the string, then @@ -952,7 +926,12 @@ os2_chdir (const char *Dir) if (DosSetDefaultDisk (Drive) != 0) { /* We had an error. Assume that the drive does not exist */ +#ifdef ENODEV errno = ENODEV; +#else + /* IBM C/C++ Tools 2.01 seems to lack ENODEV. */ + errno = ENOENT; +#endif return -1; } diff --git a/gnu/usr.bin/cvs/os2/options.h b/gnu/usr.bin/cvs/os2/options.h index fe4aa9a1480..be629655487 100644 --- a/gnu/usr.bin/cvs/os2/options.h +++ b/gnu/usr.bin/cvs/os2/options.h @@ -16,18 +16,6 @@ */ /* - * CVS provides the most features when used in conjunction with the Version-5 - * release of RCS. Thus, it is the default. This also assumes that GNU diff - * Version-1.15 is being used as well -- you will have to configure your RCS - * V5 release separately to make this the case. If you do not have RCS V5 and - * GNU diff V1.15, comment out this define. You should not try mixing and - * matching other combinations of these tools. - */ -#ifndef HAVE_RCS5 -#define HAVE_RCS5 -#endif - -/* * For portability and heterogeneity reasons, CVS is shipped by default using * my own text-file version of the ndbm database library in the src/myndbm.c * file. If you want better performance and are not concerned about @@ -38,23 +26,6 @@ #endif /* - * The "diff" program to execute when creating patch output. This "diff" - * must support the "-c" option for context diffing. Specify a full - * pathname if your site wants to use a particular diff. If you are - * using the GNU version of diff (version 1.15 or later), this should - * be "diff -a". - * - * NOTE: this program is only used for the ``patch'' sub-command (and - * for ``update'' if you are using the server). The other commands - * use rcsdiff which will use whatever version of diff was specified - * when rcsdiff was built on your system. - */ - -#ifndef DIFF -#define DIFF "diff" -#endif - -/* * The "patch" program to run when using the CVS server and accepting * patches across the network. Specify a full pathname if your site * wants to use a particular patch. @@ -67,36 +38,6 @@ #define PATCH_PROGRAM "cvspatch" #endif -/* - * By default, RCS programs are executed with the shell or through execlp(), - * so the user's PATH environment variable is searched. If you'd like to - * bind all RCS programs to a certain directory (perhaps one not in most - * people's PATH) then set the default in RCSBIN_DFLT. Note that setting - * this here will cause all RCS programs to be executed from this directory, - * unless the user overrides the default with the RCSBIN environment variable - * or the "-b" option to CVS. - * - * If you use the password-authenticating server, then you need to - * make sure that the server can find the RCS programs to invoke them. - * The authenticating server starts out running as root, and then - * switches to run as the appropriate user once authentication is - * complete. But no actual shell is ever started by that user, so the - * PATH environment variable may not contain the directory with the - * RCS binaries, even though if that user logged in normally, PATH - * would include the directory. - * - * One way to solve this problem is to set RCSBIN_DFLT here. An - * alternative is to make sure that root has the right directory in - * its path already. Another, probably better alternative is to - * specify -b in /etc/inetd.conf. - * - * This define should be either the empty string ("") or a full pathname to the - * directory containing all the installed programs from the RCS distribution. - */ -#ifndef RCSBIN_DFLT -#define RCSBIN_DFLT "" -#endif - /* Directory used for storing temporary files, if not overridden by environment variables or the -T global option. There should be little need to change this (-T is a better mechanism if you need to use a @@ -237,10 +178,6 @@ extern void exit (); #endif -#ifndef getwd -extern char *getwd (); -#endif - #ifdef AUTH_CLIENT_SUPPORT char *getpass (char *passbuf); #endif /* AUTH_CLIENT_SUPPORT */ diff --git a/gnu/usr.bin/cvs/os2/pwd.c b/gnu/usr.bin/cvs/os2/pwd.c index ab5acd9e52b..8185c71cbf6 100644 --- a/gnu/usr.bin/cvs/os2/pwd.c +++ b/gnu/usr.bin/cvs/os2/pwd.c @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/os2/pwd.c,v 1.1.1.3 1997/06/28 03:29:46 tholo Exp $ -*/ + GNU General Public License for more details. */ /* This 'implementation' is conjectured from the use of this functions in the RCS and BASH distributions. Of course these functions don't do too diff --git a/gnu/usr.bin/cvs/os2/pwd.h b/gnu/usr.bin/cvs/os2/pwd.h index 9ac94c74d93..ad225a1c7e4 100644 --- a/gnu/usr.bin/cvs/os2/pwd.h +++ b/gnu/usr.bin/cvs/os2/pwd.h @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/os2/pwd.h,v 1.1.1.3 1997/06/28 03:29:44 tholo Exp $ -*/ + GNU General Public License for more details. */ /* This 'implementation' is conjectured from the use of this functions in the RCS and BASH distributions. Of course these functions don't do too diff --git a/gnu/usr.bin/cvs/os2/run.c b/gnu/usr.bin/cvs/os2/run.c index 2086803f894..909b627dab2 100644 --- a/gnu/usr.bin/cvs/os2/run.c +++ b/gnu/usr.bin/cvs/os2/run.c @@ -24,7 +24,6 @@ #include <sys/stat.h> #include <string.h> #include <fcntl.h> -#include <stdarg.h> #include <errno.h> #include <io.h> @@ -51,19 +50,17 @@ extern char *strtok (); * The execvp() syscall will be used, so that the PATH is searched correctly. * File redirections can be performed in the call to run_exec(). */ -static char *run_prog; static char **run_argv; static int run_argc; static int run_argc_allocated; void -run_setup (const char *fmt,...) +run_setup (const char *prog) { - va_list args; char *cp; int i; - run_init_prog (); + char *run_prog; /* clean out any malloc'ed values from run_argv */ for (i = 0; i < run_argc; i++) @@ -76,14 +73,13 @@ run_setup (const char *fmt,...) } run_argc = 0; - /* process the varargs into run_prog */ - va_start (args, fmt); - (void) vsprintf (run_prog, fmt, args); - va_end (args); + run_prog = xstrdup (prog); /* put each word into run_argv, allocating it as we go */ for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t")) run_add_arg (cp); + + free (run_prog) } void @@ -93,22 +89,6 @@ run_arg (s) run_add_arg (s); } -void -run_args (const char *fmt,...) -{ - va_list args; - - run_init_prog (); - - /* process the varargs into run_prog */ - va_start (args, fmt); - (void) vsprintf (run_prog, fmt, args); - va_end (args); - - /* and add the (single) argument to the run_argv list */ - run_add_arg (run_prog); -} - /* Return a malloc'd copy of s, with double quotes around it. */ static char * quote (const char *s) @@ -148,15 +128,6 @@ run_add_arg (s) run_argv[run_argc] = (char *) 0; } -static void -run_init_prog () -{ - /* make sure that run_prog is allocated once */ - if (run_prog == (char *) 0) - run_prog = xmalloc (10 * 1024); /* 10K of args for _setup and _arg */ -} - - int run_exec (stin, stout, sterr, flags) char *stin; diff --git a/gnu/usr.bin/cvs/src/ChangeLog b/gnu/usr.bin/cvs/src/ChangeLog index 0c8b0f60930..de2f535ac39 100644 --- a/gnu/usr.bin/cvs/src/ChangeLog +++ b/gnu/usr.bin/cvs/src/ChangeLog @@ -1,1376 +1,241 @@ -Tue Jun 17 22:48:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * main.c (main): Add --allow-root=ROOT argument; call - root_allow_add for each time it is specified. Call - root_allow_free before exiting. - * root.c, cvs.h (root_allow_add, root_allow_free, root_allow_ok): - New function. - * server.c (pserver_authenticate_connection): If root_allow_ok - doesn't like the CVSROOT directory, don't allow access. - -Tue Jun 17 14:30:14 1997 Jim Kingdon (unknown@beezley) - - * client.c: Add "copyright" notice. If NO_EXT_METHOD, omit - start_rsh_method. - * client.c (update_entries): Cast argument to MD5Update from - char * to unsigned char *. - -Mon Jun 16 16:46:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * run.c (piped_child, filter_stream_through_program): - If USE_SETMODE_BINARY, then put the pipes into binary mode. - * find_names.c, ignore.c, lock.c, wrapper.c: Change fnmatch to - CVS_FNMATCH. - * client.c (start_server): If NO_EXT_METHOD, then give a fatal - error on any use of :ext:. - -Sun Jun 15 22:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (toplevel): Match U CVSROOT/* lines with DOTSTAR in - test toplevel-9. - -Thu Jun 12 10:27:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (toplevel): Remove Emptydir before starting. - - * sanity.sh: Change "rm -rf" to "rm -r" when deleting working - directories (except a few watches cases). Helps detect cases - where the testsuite has cd'd to somewhere other than where we - think it has. - (basic2): Remove "rm -r first-dir" between tests 49 and 50. The - directory was already deleted in test 45.5. - (rcs): Add "cd .." at end of tests. - (stamps): No longer cd to TESTDIR; shouldn't be necessary with - fix to "rcs" test. - -Wed Jun 11 22:28:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): Also remove CVSROOT/Emptydir at end of - test. Otherwise it affects the toplevel-9 test for remote. - -Tue Jun 10 14:03:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (toplevel): Change "update" and "checkout" to "[a-z]*" - as these read "server" instead for "make remotecheck". Change - expect strings for toplevel-9 to accept the behavior of remote CVS - (see comments for more discussion). - - * sanity.sh: New tests stamps-9 through stamps-11 test timestamp - behavior on cvs update. - -Mon Jun 9 22:42:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh: Remove "#! /bin/zsh" line at end. I assume it was - added accidentally. - -Tue Jun 10 03:08:46 1997 Norbert Kiesel <nk@psycho.de> - - * sanity.sh: new tests "toplevel" for the new toplevel CVS - directory creation (including one test which shows an error in - this area). - -Sun Jun 8 20:52:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * rcs.c (getrcsrev): Before printing error, check whether it was - feof or ferror. - - * rcs.h, import.c (add_rcs_file): No longer static. New arguments - add_vbranch, add_vhead, and add_logfp replace access to static - variables vbranch, vhead, and logfp. - * mkmodules.c: Call it instead of RCS_CI. - * import.c (process_import_file): Adjust call to add_rcs_file. - -Tue Jun 3 10:18:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): Match "." with "\." not ".". - -Tue Jun 3 13:02:37 1997 Norbert Kiesel <nk@cosa.de> - - * checkout.c (checkout): Removed restriction of not sending -k in - remote export (I think this was introduced while the -k handling - was still broken in remote mode). Give better error texts - regarding -c and -s options. Use error() instead of usage() for - reporting errors in all places. Reindented some lines. Free - xmalloc'd space of options. - -Thu May 29 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * rcscmds.c (RCS_checkin), mkmodules.c (init): Pass -w option to - "ci", specifying getcaller (). - * server.h, server.c (CVS_Username): Now extern. - * subr.c (getcaller): Return CVS_Username if it is set. - -Wed May 28 22:31:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * update.c (update_fileproc): If wrap_merge_is_copy and we would - like to do a merge, give a fatal error. See comment for why. - * sanity.sh (mwrap): New tests, tests for above fix. - -Tue May 27 21:59:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (stamps): cd to ${TESTDIR} before starting. - -Mon May 26 15:31:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (handle_mod_time): New function. - (responses): Add "Mod-time". - (stored_modtime_valid, stored_modtime): New variables. - (update_entries): If it is set, change the file's modtime. - * server.c, server.h (server_modtime): New function. - * vers_ts.c (Version_TS): Call it. - * patch.c (patch_fileproc): Add comment about why we don't. - * sanity.sh (stamps): Added, tests for above fix. - -Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * subr.c (free_names): Update documentation to reflect fact that - free_names is now called to free vectors allocated by expand_wild - as well as by line2argv. - - * main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as - specified in HACKING. - -Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de> - - * modules.c (do_module): initialize optind to 0. use local copies - of optarg's (because they might me freed within free_names). - -Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de> - - * main.c (main): initialize optind to 0. use local copies of - optarg's (because they might me freed within read_cvsrc). - - * cvsrc.c (read_cvsrc): free old argv after constructing a new - one. This fixes a memory leak. - - * recurse.c (start_recursion): use free_names() instead of - reimplementing it - - * rcs.c (RCS_deltas): free branchversion (memory leak). - - * parseinfo.c (Parse_Info): free some vars (3 memory leaks). - - * logmsg.c (logfile_write): free str_list_format (memory leak). - - * watch.c (watch_addremove), (watchers), update.c (update), tag.c - (cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove), - release.c (release), patch.c (patch), log.c (cvslog), import.c - (import), history.c (history), edit.c (watch_onoff), (edit), - (unedit), (editors), diff.c (diff), commit.c (commit), checkout.c - (checkout), add.c (add): initialize optind to 0 - - * diff.c (diff_fileproc): cosmetic change (whitespace added). - - * checkout.c (checkout): move local variable definition into the - block where the variable is used. - - * client.c (update_entries): initialize some local variables to shut up - gcc -O -Wall. - - * buffer.c (buf_read_line): initialize a local variable to shut up - gcc -O -Wall. - - -Wed May 14 16:29:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * admin.c (admin): When sending options to server, don't try to - send av[ac]. It may contain one of the names that we'll send in - send_file_names (which caused tests like keyword-6 to work, - sort of accidentally), or it may contain NULL (which would tend to - cause a coredump). - * sanity.sh (basicb): New test basicb-21 tests for above fix. - -Mon May 12 16:22:00 1997 Larry Jones <larry.jones@sdrc.com> - - * add.c (add): Free message and repository in client code. - * checkout.c (checkout): Don't free repository unless allocated. - * client.c (start_rsh_server): Free command. - -Sun May 11 11:43:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c: Remove all references to USE_DIRECT_TCP; see - ../ChangeLog for rationale. - -Fri May 9 22:19:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * main.c (main): Add comment explaining why we call exit. Pass 0 - not EXIT_SUCCESS, because lib/system.h has portability cruft for - EXIT_FAILURE but not EXIT_SUCCESS. - -Fri May 9 17:25:00 1997 Larry Jones <larry.jones@sdrc.com> - - Fix miscellaneous memory allocation problems: - * add.c (add): Free repository. - * client.c (notified_a_file): Free getline buffer. - * edit.c (notify_check): Free getline buffer. - * hash.c (dellist): Free header node when not caching. - * login.c (login): Don't continually free & allocate getline - buffer, use xstrdup instead of xmalloc/strcpy, free getline - buffer before returning. - * main.c (main): Call exit instead of returning so tools like - Purify won't consider permanently allocated memory as leaks. - * mkmodules.c (mkmodules): Free getline buffer. - * modules.c (cat_module): Call close_module. - * rcs.c (rcsvers_delproc): Free state. - * recurse.c (start_recursion): Free files_by_dir. - (unroll_files_proc): NULL out p->data after using it to set - filelist to avoid multiple frees. - * server.c (check_command_legal_p): Don't continually free & - allocate getline buffer, free getline buffer before returning. - (check_repository_password): Ditto, use xstrdup instead of - xmalloc/strcpy. - * wrapper.c (wrap_add_file): Free getline buffer. - -Thu May 8 14:21:00 1997 Larry Jones <larry.jones@sdrc.com> - and Jim Kingdon <kingdon@harvey.cyclic.com> - - * checkout.c (checkout_proc): Free finfo.rcs (memory leak). - -8 May 1997 Larry Jones <larry.jones@sdrc.com> - and Jim Kingdon <kingdon@harvey.cyclic.com> - - * hash.c: Add #ifdef's to disable caching. This makes it easier - to track down memory allocation problems. - -Thu May 8 11:40:39 1997 Larry Jones <larry.jones@sdrc.com> - - * sanity.sh: In setting "tests" use a number of statements rather - than one very long line. - -Thu May 8 11:40:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * cvsbug.sh: Remove $Id; we decided to get rid of these some time - ago. - -Thu May 8 11:34:02 1997 Larry Jones <larry.jones@sdrc.com> - - * cvsbug.sh: Put separate statements on separate lines, so it - works if awk is AT&T nawk. - -Tue May 6 16:56:00 1997 Larry Jones <larry.jones@sdrc.com> - and Jim Kingdon <kingdon@harvey.cyclic.com> - - * cvsrc.c (read_cvsrc): Fix various memory allocation problems: - rearrange code to avoid leaks, use xrealloc instead of xmalloc/ - copy/free, make sure there's room for the remaining args before - appending them. - -Tue May 6 14:20:00 1997 Larry Jones <larry.jones@sdrc.com> - - * edit.c (watch_onoff, edit, unedit, editors): Add -R like - other things with -l. - * watch.c (watch_addremove, watchers): Ditto. - -Mon May 5 18:10:37 1997 larry.jones@sdrc.com - and Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh: Change all /tmp/cvs-sanity to TESTDIR. If TESTDIR - environment variable is set, use it instead of /tmp/cvs-sanity. - * sanity.sh: Make TMPPWD the pwd equivalent of TESTDIR, not of /tmp. - -4 May 1997 Larry jones <larry.jones@sdrc.com> - and Jim Kingdon - - * checkout.c, diff.c, patch.c, rcs.c: Update usage messages. - * rcs.c (annotate): Add -R like other things with -l. - -Sat May 3 14:57:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basic1): Rewrite test (use dotest, unroll the loops - which IMHO makes the test a zillion times more understandable, and - only do the variant which tests for 4 files at a time--we test one - file at a time lots of places). - -2 May 1997 Ziv Gigus <ziv@rest.home.net> - and Jim Kingdon - - * client.c, client.h (client_process_import_file): New argument - all_files_binary means treat all files as binary. - * import.c (import_descend): Pass it if -kb is specified. - * client.c (client_process_import_file): In the - non-all_files_binary case, call wrap_rcsoption to determine - whether the file is binary. - -Thu May 1 13:44:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (binfiles2): New tests, for update -j and binary files. - -Wed Apr 30 11:18:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * recurse.c (start_recursion): Also free reposfile. - Don't look in repository if client_active (latter bug reported by Paul - Sanders <p.sanders@dial.pipex.com>). - -Mon Apr 28 22:36:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * diff.c (diff_file_nodiff): Remove SERVER_SUPPORT ifdefs. They - were not based on server_active, which doesn't really make any - sense (it meant that compiling --disable-server could affect the - behavior of the non-client/server CVS). This affected the output - in tests death2-diff-11 and death2-diff-12 in the testsuite. - * sanity.sh (newb-123j0): Also accept "Needs Checkout", for a - --disable-server CVS. - - * main.c (cmd_usage): Change "run diffs" to "show differences"; - the former is jargon. - * edit.c (edit_usage): Fix typo ("." -> ","). - * edit.c (editors_usage), watch.c (watchers_usage): Mention -l. - * checkout.c (export_usage): Say what -P does. - * history.c (history_usg): Add comment about message wording. - -Mon Apr 28 14:47:45 1997 Norbert Kiesel <nk@cosa.de> - - * checkin.c (Checkin): use filename without path when calling - wrapper (bug found by Michal Schmitz <ms@cosa.de>). - -Fri Apr 25 13:28:55 1997 Ian Lance Taylor <ian@cygnus.com> - - * client.c (update_entries): In UPDATE_ENTRIES_RCS_DIFF case, - write to a temporary file and then rename it. - -Thu Apr 24 11:35:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * subr.c, cvs.h (pathname_levels): New function, from a piece of - send_file_names. - * client.c (send_file_names): Call pathname_levels in place of the - code which was moved there. - * server.c, server.h (server_pathname_check): New function. - * recurse.c (start_recursion): Call it. - * sanity.sh (modules3): New test modules3-11b tests for above fix. - - * filesubr.c: Do not define L_tmpnam. It is in ANSI and SunOS4, - so I don't think there will be a problem with it being missing. - Defining it too small can cause memory corruption. - (cvs_temp_name): Do not use L_tmpnam in the mktemp code; this - could cause a buffer overflow if the -T global option was in use. - -Thu Apr 24 13:21:15 1997 Norbert Kiesel <nk@cosa.de> - - * filesubr.c (cvs_temp_name): Use tempnam if available, else - mktemp, else tmpnam. See the comment for rationale. - - * sanity.sh: use "tar cf - ." instead of "tar cf - *" for - directory copies. - -Wed Apr 23 23:41:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * server.c (serve_update_prog): If in readonly mode, give an error. - -Wed Apr 23 19:07:41 1997 Norbert Kiesel <nk@cosa.de> - - * subr.c (line2argv): Allocate at least 4 slots for argv. - - * checkout.c (checkout_proc): Add a comment which says why the - above change was necessary to avoid writing to unallocated memory. - -Wed Apr 23 11:20:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * entries.c (ParseTag): Always set *NONBRANCHP. - -21 Apr 1997 Jim Kingdon - - * client.c (update_entries), rcs.c (expand_keywords): Rewrite - test to avoid signed/unsigned warning. - -Mon Apr 21 09:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * update.c (patch_file): Add comment about whether auto-detecting - features of the DIFF program is a good idea. - -Mon Apr 21 00:03:34 1997 Ian Lance Taylor <ian@cygnus.com> - - Don't require the patch program: - * client.c (struct update_entries_data): Add - UPDATE_ENTRIES_RCS_DIFF to contents enum. - (update_entries): Handle UPDATE_ENTRIES_RCS_DIFF. - (handle_rcs_diff): New static function. - (responses): Add "Rcs-diff". - * server.c (server_updated): Handle SERVER_RCS_DIFF. - (server_use_rcs_diff): New function. - * server.h (enum server_updated_arg4): Add SERVER_RCS_DIFF. - (server_use_rcs_diff): Declare. - * update.c (rcs_diff_patches): New static variable. - (update): Set rcs_diff_patches. - (update_fileproc): If rcs_diff_patches, pass SERVER_RCS_DIFF - rather than SERVER_PATCHED to server_updated. - (patch_file): Correct initial comment to say diff rather than - rcsdiff. If rcs_diff_options, pass -n to diff rather than -c. - * rcs.c (rcs_change_text): New function. - * rcs.h (rcs_change_text): Declare. - -Mon Apr 21 00:08:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * diff.c (diff_fileproc): Add comment concerning updating the - client timestamp. - -Sun Apr 20 23:20:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * commit.c (commit): Add comment regarding SEND_FORCE rationale. - -Sat Apr 19 17:10:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * server.c (dirswitch): If directory ends in '/', complain. - -Fri Apr 18 18:09:57 1997 Ian Lance Taylor <ian@cygnus.com> - - * rcs.c (apply_rcs_changes): New static function, broken out of - RCS_deltas. - (RCS_deltas): Call it. - (linevector_add): Change return type to int. Return an indication - of an error for an invalid add, rather than calling error. - -Fri Apr 18 11:24:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * version.c: Change version number to 1.9.9. - - * version.c: Version 1.9.8. - - * commit.c (struct find_data): Add field force. - (find_fileproc, commit): Use it instead of force_ci to decide - whether to send files to server. - (commit): Set it if either -f or -r is specified. - * sanity.sh (basica): Add tests basica-8a0, basica-8a1, and - basica-8a2; tests for above fix. - -Wed Apr 16 11:50:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * zlib.c: Remove paragraph with Free Software Foundation address. - See 2 Jan 1997 entry in ../ChangeLog for rationale. - -Tue Apr 15 00:36:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * update.c (patch_file_write): Always assign to final_nl, so that - it ends up reflecting whether the data from the last call had a - newline, not whether the data from any of the calls ended in a - newline. Doesn't matter with the current RCS_checkout - implementation, but it will if RCS_checkout is changed to pass - less than the entire file. - - * rcs.c (RCS_cmp_file): Change NULL to RUN_TTY in passing sout to - RCS_checkout, for clarity. - - * import.c (update_rcs_file): Remove unused variable ierrno. - - * add.c, checkout.c, commit.c, diff.c, edit.c, import.c, - history.c, log.c, main.c, patch.c, release.c, remove.c, rtag.c, - status.c, tag.c, update.c, watch.c: Pass "+" to all calls to - getopt. This ensures that we maintain existing behavior even with - glibc2. - - * filesubr.c (fopen_case): Don't set *PATHP if we return an - error. Since the 9 Apr 1997 change, the behavior has been to - sometimes set it and sometimes not. - * rcs.c (RCS_parse): Adjust callers to not free it. Without this - change, they could call free() on an uninitialized variable. - - * checkout.c (checkout): Add comment about export -k. - - * root.c (check_root_consistent): Add comment about wording of - message. - -Mon Apr 14 11:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (call_in_directory): If rdirp reaches the end of - reposdirname, then just set it to NULL. If server does not create - directories one at a time, give a warning. - * sanity.sh (modules3): Enable tests modules3-8 through - modules3-11 for remote; tests for above fix. - - * client.c (call_in_directory): Don't set short_pathname to - pathname for a while; just use pathname itself (cleans up a relic - of the old "Repository" (not "Directory") code). Add comment - explaining short_pathname. - -Sun Apr 13 18:07:50 1997 Ian Lance Taylor <ian@cygnus.com> - - * rcs.c (RCS_checkout): Add pfn and callerdat parameters. Change - all callers. Move setting of expand after retrieval of file - data. - (struct cmp_file_data): Define. - (RCS_cmp_file): New function. - (cmp_file_buffer): New static function. - * rcs.h (RCSCHECKOUTPROC): Define type. - (RCS_checkout): Update declaration. - (RCS_cmp_file): Define. - * diff.c (diff_file_nodiff): Call RCS_cmp_file rather than - RCS_checkout and xcmp. - * import.c (update_rcs_file): Likewise. - * no_diff.c (No_Difference): Likewise. - * update.c (struct patch_file_data): Define. - (patch_file): Just return if noexec, or if binary file. Pass - patch_file_write to RCS_checkout. Don't check for newlines or - compute checksums here. Stat RCS file to set modes. - (patch_file_write): New static function. - - * update.c (patch_file): Checkout directly to file2, rather than - to finfo->file followed by rename. Remove check for whether - result of checkout is readable; that was for an old, obsolete, - form of death support. - -Sun Apr 13 13:16:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * checkout.c (build_one_dir): New function. - (struct dir_to_build): New structure. - (build_dirs_and_chir): Rewritten to accept a linked list of struct - dir_to_build rather than the silly string processing we had been - doing before. - (checkout_proc): Rewrite code that calls build_dirs_and_chdir - accordingly. - * sanity.sh: Enable tests modules3-10 and modules3-11 for local CVS; - tests for above fix. - - * rcs.h (RCS_CO): Removed; no longer used. - -Sun Apr 13 00:04:34 1997 Ian Lance Taylor <ian@cygnus.com> - - Expand RCS keywords internally; never call co: - * rcs.h (struct rcsversnode): Add state field. - * rcs.c (kflags): Move out of RCS_check_kflag, and make file - static. - (enum kflag): Define. - (RCS_reparsercsfile): Always save lock information. Save state in - new state field, rather than other field. - (struct rcs_keyword): Define. - (keywords): New static variable. - (enum keyword): Define. - (printable_date, escape_keyword_value): New static functions. - (expand_keywords): New static function. - (RCS_checkout): Call expand_keywords. Don't call - RCS_exec_checkout. - (RCS_deltas): Add log and loglen parameters. Change all callers. - * log.c (log_version_requested): Use new state field. - (log_version): Likewise. - * cvs.h (RCS_exec_checkout): Don't declare. - * rcscmds.c (RCS_exec_checkout): Remove. - -Sat Apr 12 17:32:59 1997 Ian Lance Taylor <ian@cygnus.com> - - * sanity.sh (modules3): Remove second-dir at end of tests. - (sticky): Correct removal of directories at end of tests. - - * sanity.sh (keyword): New tests for RCS keyword expansion. - -Sat Apr 12 16:47:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): New tests basicb-1b, basicb-1c, basicb-9b, - basic-9c test current build_dirs_and_chdir behavior. - -Fri Apr 11 23:54:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (modules3): New tests modules3-7* test for ability to - supply a path in -d in modules. Similar to modules3-8 through - modules3-11 except because the nesting is different, these ones - work. - -Thu Apr 10 00:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (modules3): New tests modules3-12 through modules3-15 - test use of a module name which contains a slash. - - * sanity.sh (basicb): New tests basicb-14 to basicb-20 test use of - co -d with two or more arguments. - - * rcscmds.c: Refer to doc/RCSFILES in comment. - -Wed Apr 9 09:49:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): New tests basicb-11 through basicb-13 test - ability to specify several directory levels in co -d (commented - out). - - * filesubr.c (fopen_case): If CVS_OPENDIR gives an - existence_error, return it to the caller instead of giving a fatal - error. - - * client.c (update_entries): Fix typo in call to error (1 -> errno). - -Tue Apr 8 23:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * error.h, error.c: Test for #ifdef __STDC__, not #if __STDC__. - This is consistent with other parts of CVS; it means that the - declaration for fperror will match the definition even if __STDC__ - is defined to 0 as the SunPro 4.0 compiler does. Reported by - Richard Smith <rjsmith@cisco.com>. - -2 Apr 1997 Jim Kingdon - - * entries.c (ParseTag): Add "break;" after "default:" to avoid - error from Visual C++. - -Wed Apr 2 12:06:44 1997 Vince Del Vecchio <vdelvecc@spd.analog.com> - and Jim Kingdon - - * client.c: In reporting errors from socket calls, use - SOCK_STRERROR and SOCK_ERRNO since strerror(errno) doesn't work - for Win32. - -Tue Apr 8 10:45:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (modules3): Add tests modules3-8 to modules3-11, to - test for ability to supply a path to -d in modules. Mostly - commented out as CVS is buggy in this area. - -Mon Apr 7 12:41:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * add.c (add): Add comment about SEND_NO_CONTENTS. - -Sun Apr 6 21:46:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * update.c (update): Add comment about noexec and SEND_NO_CONTENTS. - -Sun Apr 6 17:34:08 1997 Robert Bihlmeyer <robbe@orcus.priv.at> - - * Pass +f not f to getopt_long to prevent options from being - permuted with glibc 2.0.1. - -Sun Mar 30 00:07:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * cvs.h (struct vers_ts): Adjust comment regarding ts_user. - * server.c (serve_is_modified): New function. Set entries to show - that the file is modified but we don't know the contents. - * server.c (requests): Add "Is-modified" request. - * vers_ts.c (time_stamp_server): If the timestamp in entdata is - "M" or "D", just copy that over into ts_user. - * vers_ts.c (Version_TS): If timestamp is "D", use the entries - line for the sole purpose of passing it to time_stamp_server. - * no_diff.c (No_Difference): If ts_user is "M", conclude the files - are different. - * client.h, client.c (send_files): Replace arguments build_dirs - and force with argument flags. Add flag SEND_NO_CONTENTS and add - to struct send_data. - (send_fileproc): If no_contents, then send Is-modified instead of - Modified. - * add.c, admin.c, client.c, commit.c, diff.c, edit.c, log.c, - rcs.c, remove.c, status.c, tag.c, update.c, watch.c: Change all - send_files callers. - -Fri Mar 28 22:32:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * server.c (requests): Change "Repository" to rq_optional. I'm - not sure whether I overlooked this when I removed support for - Repository, or whether I was thinking that servers would need to - support it anyway, for CVS 1.5 to 1.9 clients, but making it - optional doesn't prevent the server from supporting it and it - seems silly for the client to complain about absence of a request - that it never will use. - -Fri Mar 28 10:06:59 1997 Steven Miller <Miller@wingra.com> - - * entries.c (Subdirs_Known): Don't create Entries.Log if noexec. - -Thu Mar 27 18:14:12 1997 Ian Lance Taylor <ian@cygnus.com> - - * sanity.sh (death2): Remove commented out test death2-21. It - would now pass, but it duplicates the new test sticky-11. - -Thu Mar 27 10:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (dotest_internal): Write test output to logfile even - if test succeeds. This was the behavior prior to 30 Sep 1996. - See the comment for rationale. - -Tue Mar 25 13:26:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * cvs.h, entries.c (WriteTag): Add arguments nonbranch, - update_dir, and repository. Move the server_set_sticky call from - callers to here. - * cvs.h, create_adm.c (Create_Admin): New argument nonbranch. - * cvs.h, entries.c (ParseTag): Add argument nonbranchp. - * cvs.h (struct stickydirtag): Add field nonbranch. - * entries.c (Entries_Open): Set it. - * cvs.h (Vers_TS): Add field nonbranch. - * vers_ts.c (Version_TS): Copy it from struct stickydirtag. - * server.c, server.h (server_set_sticky): Add argument nonbranch. - * add.c, client.c, checkout.c, modules.c, update.c, create_adm.c, - commit.c: Update callers. - * add.c (add): If nonbranch, don't add the file on that "branch". - * commit.c (write_dirnonbranch): New variable. - (commit_fileproc, commit): Set it. - (commit_dirleaveproc): Pass it to WriteTag. - * update.c (rewrite_tag, nonbranch): New variables. - (update, update_dirent_proc, update_fileproc): Set them. - (update_filesdoneproc): If rewrite_tag, call WriteTag. - * sanity.sh (sticky): New tests, test for above fix. - - * version.c: Change version number to 1.9.7. - - * version.c: Version 1.9.6. - -Mon Mar 24 13:02:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * entries.c (ParseTag): Add comment about unrecognized characters - in CVS/Tag file. - - * classify.c (Classify_File): Add comment about how specifying a - tag (bogusly?) suppresses certain messages. - -Fri Mar 21 13:37:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * rcs.h (struct rcsnode): Add comment about case of PATH. - * rcs.c (RCS_parse): If ign_case, then try opening the file with - fopen_case. - * ignore.c (ign_case): Adjust comment. - * cvs.h, filesubr.c (cvs_casecmp, fopen_case): New functions. - -20 Mar 1997 Jim Kingdon - - * client.c (send_repository): When sending Directory request, - send any ISDIRSEP character as '/'. Fixes - "cvs log foo\bar\baz.c" on NT & friends. - - * client.c (send_file_names): Don't try to read Entries file if - CVSADM directory does not exist. Fixes fairly serious regression - (warning on all fresh checkouts) introduced by 1997-01-08 change. - -Tue Mar 18 13:03:33 1997 Jim Meyering <meyering@totoro.cyclic.com> - - * sanity.sh (RCSINIT): Define to be empty and export, to hide any - existing value that might cause spurious failures. - - * Makefile.in: (install): Depend on installdirs. - Remove `CYGNUS LOCAL' comment saying not to. - -Tue Mar 18 09:36:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * recurse.c (struct recursion_frame): Reindent. - (do_dir_proc): Print message if we try to recurse into a CVSADM - directory. - * sanity.sh (basicb): New test basicb-4a tests for above fix. - -Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (death2): Replace regexp matching temporary file name - with new variable ${tempname}. For most of the tests this is a - cosmetic change, but death2-diff-6 had been missing _ which caused - it to fail on Solaris (at least sometimes). - - * sanity.sh (modes): Don't use export -n; it doesn't seem - to be sufficiently portable. - - * version.c: Change version number to 1.9.5. - - * version.c: Version 1.9.4. - - * rcscmds.c (RCS_checkin): Preserve the mode of the rcsfile. - RCS_CI usually, but not always, does this for us. - * commit.c (fix_rcs_modes): Replace algorithm with a more - CVSUMASK-friendly one. - * sanity.sh (modes): Update tests modes-5, modes-7, modes-10, and - modes-15 so they test that CVSUMASK is honored. - -Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (modes): New tests modes-7a and modes-7b test behavior - if one manually changes the modes in the repository. - - * server.c (server): Revise code which checks for errors creating - temporary directory. This won't solve the intermittent - can't create temporary directory - Unknown error -1 - but it will mean (a) the right message based on errno gets - printed, instead of "unknown error -1", and (b) the message says - that it happened in chmod instead of mkdir_p. - -Sat Mar 15 16:47:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (modes): New tests. Note that (for now) these are - just testing how CVS already behaves; I want to record that before - I move on to changing CVS's behavior with modes of RCS files. - -13 Mar 1997 Jim Kingdon - - * subr.c (line2argv): Change argv_allocated from size_t to int. - -Wed Mar 12 22:16:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * add.c (add_directory): If repository has an extraneous "." - directory at the end, strip it off. This fixes a bug which was - introduced when strip_path was nuked (this fix is much more - limited in scope than strip_path was; I _think_ that is a good - thing). - (add): Likewise, for client. - (combine_dir): New function, helps with above. - * sanity.sh (modules3): Reenable tests for this behavior. - (basica-0b, basicb-0e): Adjust test to reflect "foo/bar" instead - of "foo/./bar" in message. As with the rest of this, I believe - this is just restoring the behavior prior to the strip_path nuking - (I tried it with CVS 1.9). - -Sun Mar 9 10:06:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * root.c (parse_cvsroot), server.c (serve_root, serve_init): - If CVSroot_directory is not an absolute pathname, give a fatal error. - * sanity.sh (crerepos): New tests crerepos-6* test for above fixes. - -Sat Mar 8 22:06:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - This cleans up the last known code which can overflow its buffers - (except the Mac client). I've skimmed through much of CVS looking - for other such places; but I didn't read everything. If I missed - any please report it to bug-cvs. - * logmsg.c (logfile_write, title_proc): Realloc str_list as - needed; don't assume MAXLISTLEN is enough. - * cvs.h (MAXLISTLEN, MAXFILEPERDIR): Removed; no longer used. - * add.c, myndbm.c, parseinfo.c, update.c: Nuke MAXLINELEN limit. - * parseinfo.c, update.c, mkmodules.c: Check for errors reading file. - * cvs.h (MAXLINELEN): Removed; no longer used. - * logmsg (MAXHOSTNAMELEN): Removed; not used. - * main.c (cmd_synonyms): Allocate based on fullname, nick1, and - nick2, just in case someone makes those big enough so that 100 - bytes is not enough. - (Make_Date): Use MAXDATELEN rather than our own fixed size. - * mkmodules.c (mkmodules): Nuke arbitrary limit on line length. - * rcs.c (ALLOCINCR): Remove; not used. - (RCS_check_kflag): Add comment concerning karg size. - * run.c: Allocate run_prog to the needed size, rather than - allocating a fixed size buffer. - -Fri Mar 7 22:39:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * logmsg.c (logfile_write): Allocate prog to needed length rather - than assuming MAXPROGLEN is enough. - * cvs.h (MAXPROGLEN): Removed; no longer used. - * subr.c (MIN_INCR): Update comment to reflect MAXPROGLEN's demise. - - * subr.c (free_names): Fix comment: this function is not used to - free memory allocated by Find_Names (at least it hasn't for a long - time). - * subr.c, cvs.h (line2argv): Change calling convention so that we - allocate argv array rather than the caller. The previous one had - no way of checking whether we overflowed the passed-in buffer. - * subr.c (free_names): Free the argv array too. - * modules.c (do_module, cat_module): Update callers. - -Thu Mar 6 12:44:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * import.c: Allocate vhead and vbranch dynamically; removes - arbitrary limit. - * history.c: Likewise (since_rev, since_tag, backto, rec_types). - * ignore.c: Likewise (line). Also check for errors from getline - and add 'copyright' notice to top of file. - * wrapper.c (wrap_add_file): Likewise (line). Also check for - errors from various calls and add 'copyright' notice to top of file. - -Tue Mar 4 17:39:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (update_entries): Add comment about "move away <file>" - message. - -Mon Mar 3 21:51:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): Clean up topfile,v at end of test. Fixes - failure in modules-155b. - -Sun Mar 2 18:11:09 1997 Dan Wilder <dan@gasboy.com> - and Jim Kingdon - - * admin.c (admin): Arrange to perform recursion if "cvs admin" - is passed only options. - -Sun Mar 2 18:11:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (basicb): New tests basicb-0* test for files at top - level. - - * error.c (error): Add newline to "out of memory" message. I think - that its omission probably could cause the message to be lost in - the bowels of server.c and never passed to the user. - - * client.c (start_rsh_server): Add comment about "remsh" vs. "rsh". - - * cvs.h: Move copyright notice to top of file. - -Sun Mar 2 13:44:36 1997 Ian Lance Taylor <ian@cygnus.com> - - * sanity.sh: Use -n when testing whether rsh works. - - * server.c (serve_root): Free path. - -Sun Mar 2 13:12:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - The following are things that I noticed in the process of trying - to track down: - can't create temporary directory - Unknown error -1 - FAIL: test 28 - from nightly testing. I'm not sure that either item explains that - message however. - * server.c (server): Allocate pending_error_text; - print_pending_error will try to free it so - pending_error_text = "foo" - won't work. - (mkdir_p): Don't assume that isdir will leave errno unmolested. - -Thu Feb 27 15:29:58 1997 Ian Lance Taylor <ian@cygnus.com> - - * remove.c (cvsremove): When forcing removal in client mode, use - start_recursion rather than calling CVS_UNLINK on each argument. - (remove_force_fileproc): New static function. - * sanity.sh (deep): Add tests deep-rm7 through deep-rm10 for above +Thu Jan 29 00:01:05 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Version 1.9.24. + + * sanity.sh (multibranch2): File file2 and tests multibranch2-13 + through multibranch2-15 test a slightly different case than the + rest of multibranch2. + + * mkmodules.c (cvswrappers_contents): Rewrite. The text didn't + describe -k and had various other problems. + +28 Jan 1998 Karl Fogel and Jim Kingdon + + New feature to let server tell client about wrappers. + * client.h (struct response): Add comment about args being + '\0' terminated when passed to handle_* functions. + * client.c (start_server): send "wrapper-sendme-rcsOptions" to + server iff supported. + (responses): new response "Wrapper-rcsOption"; allows the server + to send certain lines from its cvswrappers file. + (handle_wrapper_rcs_option): new func, handles "Wrapper-rcsOption" + response from server. + * server.c (serve_wrapper_sendme_rcs_options): new func, sends + server side CVSROOT/cvswrappers rcs option lines to client. + (requests): new request "wrapper-sendme-rcsOptions"; if received, + we know we can send "Wrapper-rcsOption..." to the client. + * wrapper.c (wrap_unparse_rcs_options): new func; repeated calls + step down the wrapper list returning rcs option entries, but + repackaged as cvswrappers lines. + (wrap_setup): new guard variable `wrap_setup_already_done'; if + this function has run already, just return having done nothing. + Add comment concerning environment variable. + * cvs.h: declare wrap_unparse_rcs_options(). + +Tue Jan 27 18:27:19 1998 Ian Lance Taylor <ian@cygnus.com> + + * rtag.c (rtag_dirproc): Call ignore_directory, and skip the + directory if it returns true. + * sanity.sh (modules4): New set of tests to test some aspects of + excluding directories in the modules file, including the above patch. - * sanity.sh (death): Enable death-76a0 and death-76a1 tests for - remote, since they now work. - -Wed Feb 26 16:13:26 1997 Ian Lance Taylor <ian@cygnus.com> - - * client.c (add_prune_candidate): Skip adding this directory if - it is the same as the first directory already on the list. - -Mon Feb 24 21:36:43 1997 Noel Cragg <noel@gargle.rain.org> - - * main.c (lookup_command_attribute): Add the "init" command to the - list of commands that don't use the current working directory. - -Sun Feb 23 09:54:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh (devcom3): Clean up at end of test. - - * sanity.sh (basicb): Add commented out test basicb-8a0, for - whether CVS can print an error on bad numeric revision to diff. - Commented out until we get around to fixing CVS. - * diff.c (diff_file_nodiff): Add comment about this case. - - * fileattr.c (fileattr_read): If a filename is duplicated, - continue to ignore subsequent lines but free the node so that we - don't leak memory. - * sanity.sh (devcom3): New tests devcom3-8 and devcom3-9 test for - behavior on duplicated filenames. - - * fileattr.h: Add comment about unrecognized ENT-TYPE and order of - lines in fileattr file. - * fileattr.c (struct unrecog, unrecog_head): New variables, to - record unrecognized lines. - (fileattr_startdir): Assert that unrecog_head == NULL. - (fileattr_read): Record unrecognized lines in unrecog_head linked - list rather than ignoring them. - (fileattr_write): Also write out unrecognized lines, if any. - * sanity.sh (devcom3): New tests, test for above fix. - - * fileattr.h (fileattr_modify): Fix example in comment. - -Sat Feb 22 08:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * sanity.sh: Add variable username. - (basica rdiff multibranch log log2): Use it instead of our own - (inconsistent) ways of matching an author name. - - * filesubr.c, root.c, rtag.c, server.c, subr.c, update.c, - wrapper.c: Nuke PATH_MAX. - * cvs.h, wrapper.c (wrap_fromcvs_process_file): Now returns void - (return value had been unused). - * cvs.h: Adjust comment to reflect the fact that PATH_MAX is - gone, at least from src/*.c (except safe_location, as noted). - -22 Feb 1997 patch by Tom Hageman <tom@basil.icce.rug.nl> (4 Jun 1996) - updated and commented by Jim Kingdon <kingdon@harvey.cyclic.com> - - * update.c (checkout_file): Call unlink_file_dir on backup, not - unlink_file. - -Fri Feb 21 16:40:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * Makefile.in (DISTFILES): Remove NOTES. - - * NOTES: Removed. bcopy->memcpy is done. "static buffers" I - assume refers to what is covered by reentrancy text in HACKING. - Obstack idea moved to comment in hash.c (at nodecache). Checking - system calls for error returns largely done, and isn't a very - helpful suggestion unless you know where the bogus calls are - anyway. Sizing limits--we're in the progress of removing them - (assuming it meant things like PATH_MAX and earlier, already - nuked, limits). Removed various items about changes which were - done a long time ago (I realize that the ChangeLog's probably - aren't reliable that far back, but I'm not convinced anyone cares - anymore). CONFIRM_DIRECTORY_ADDS: I assume this is a - reference to the #if 0'd code in add_directory which asks for - confirmation--a better way of making it harder to accidentally add - directories would be to have to add and commit directories like - for files. I don't know what FORCE_MESSAGE_ON_ADD meant. - - * rcs.c (RCS_getrevtime): Fix documentation (in particular, the - size of the array that DATE must point to, but many other things - too). - * patch.c, recurse.c, release.c, remove.c, repos.c: Nuke PATH_MAX. - (patch_fileproc): Use MAXDATELEN not hardcoded 50. - -Sun Feb 16 12:00:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (client_process_import_file): New variable fullname; - pass it to send_modified. This finishes the job of untangling the - old short_pathname variable into update_dir vs. fullname. - - * client.c (client_process_import_file): Nuke first_time. If - toplevel_repos were ever NULL here, the code would dump core in - strncmp a few lines down. And client_import_setup ensures - toplevel_repos is not NULL. - -Sun Feb 16 08:16:48 1997 Ian Lance Taylor <ian@cygnus.com> - - * client.c (client_process_import_file): Rename short_pathname to - update_dir (to reflect its function) and make sure that it doesn't - point to uninitialized memory if repository and toplevel_repos - contain the same string. - -Sun Feb 16 08:16:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (start_rsh_server): Nuke comment about weirdnesses with - pre-1.5 versions of CVS and .bashrc/.cshrc. The remote protocol - is interoperable only back to 1.5, and people who need to know are - unlikely to see this comment anyway. - -Sun Dec 15 13:12:30 1996 Michael Douglass <mikedoug@texas.net> - and Jim Kingdon <kingdon@harvey.cyclic.com> - - * main.c (cmds): Added an entry for new logout command. - (cmd_usage): Added an entry for new logout command. - (lookup_command_attribute): Added 'logout' to list of commands - that set need_to_crate_root to 1. - * login.c, cvs.h (logout): New command for removing entries from - the .cvspass file. - (logout_usage): Usage information on the logout command. - -Wed Feb 12 11:19:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * client.c (struct send_data): Fix indentation. - -Wed Feb 12 08:48:04 1997 Greg A. Woods <woods@most.weird.com> - - * mkmodules.c (loginfo_contents): add missing comma in - initializer statement (caused syntax error on SunOS-4). - -Tue Feb 11 21:14:28 1997 Ian Lance Taylor <ian@cygnus.com> - - * commit.c (find_fileproc): If force_ci is set, set the status to - T_MODIFIED even if the file hasn't changed. - (commit): Pass force_ci to send_files as new force argument. - * client.c (struct send_data): Define. - (send_fileproc): The callerdat parameter now points to a send_data - struct. If force is set, always call send_modified. - (send_dirent_proc): The callerdat parameter now points to a - send_data struct. - (send_files): Add force parameter. Change all callers. Set up a - send_data struct and pass it to start_recursion as callerdat. - * client.h (send_files): Update declaration. - * sanity.sh (basica): Add a simple test for the above patch. - -Sun Feb 9 12:58:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * tag.c (cvstag), rtag.c (rtag): Pass -f to server if specified in - the client. I haven't tried to come up with a test case because - the fix seems obvious. - - * import.c (add_rcs_file): Change size of altdate1 and altdate2 to - MAXDATELEN. - * cvs.h (MAXDATELEN): Fix comments; describe what this is for. - - * diff.c (diff_usage): Document --ifdef and try to briefly say - what "rcsdiff-options" means. - - * update.c (update): If update had a nonzero status and we haven't - yet tried to fetch unpatchable files, go ahead and try it again. - The previous behavior was to quit, which meant that updates would - keep failing until you hacked around the problem. Patch and bug - report by Ian; comment, ChangeLog entry, and willingness to take - the flak if checking it is premature by Jim. - - * server.c (alloc_pending): New function. - * server.c: Call it. Fixes places where we had neglected to - check for NULL return from malloc. - - * sanity.sh (binwrap): Add test binwrap-0, tests for import.c fix - below. - -Sun, 9 Feb 1997 (submitted 19 Jul 1996) John Polstra <jdp@polstra.com> - - * import.c (import): Give error if the same tag is specified more - than once. The previous behavior was to write an RCS file which - had the same tag listed twice, once pointing to each revision, - which is not legal. - -Sun Feb 9 12:37:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * checkin.c (Checkin): Use cvs_output to print message (should - make out of order bugs no worse, as it merely substitues a - protocol_pipe vs. stderr_pipe race instead of a stdout_pipe - vs. stderr_pipe race). Add comment about stdout vs. stderr. - -Fri Feb 7 08:29:52 1997 Josef Nelissen <josef.nelissen@munich.ixos.de> +Thu Jan 22 10:05:55 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * server.c (check_command_legal_p): Don't use ANSI-style definition. + * server.c (serve_kopt): Check for length of arg. Based on + inspection of the code, plugs a buffer overrun security hole which + was introduced Monday. -Thu Feb 6 10:55:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * server.c (serve_is_modified): Don't call xmalloc; we aren't + allowed to call error() here. Remove duplicate (and potentially + confusing) variable 'p'. - * patch.c (patch): Give a fatal error for -V option (see comment - for rationale). + * log.c (log_fileproc): Look for first character of version + '0' AND second character '\0', rather than OR. I didn't try to + come up with a test case but this looks like a simple thinko + (albeit one which would show up in obscure cases if at all). - * diff.c (diff): Also send "options" to server. Pretty much the - patch submitted independently by josef.nelissen@munich.ixos.de and - Ronald Khoo <ronald@demon.net>. +Tue Jan 20 19:37:53 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Wed Feb 5 18:57:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * client.c (send_dirent_proc): Don't send nonexistent directories + unless noexec. + * sanity.sh (modules2): New tests modules2-13 through modules2-18 + test for this fix. - * modules.c (do_module): Fix typo in 30 Jan 97 PATH_MAX nuking - (free -> free_cwd). Testsuite test 151 gets credit for catching - this one. +Mon Jan 19 11:17:51 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Mon Feb 3 16:14:54 1997 Ian Lance Taylor <ian@cygnus.com> + * server.c (serve_kopt): New function. + (requests): Add "Kopt" request. + (kopt): New variable. + (serve_is_modified): Write kopts from there into entries. + (serve_modified): Call serve_is_modified so we do the same. + Declare serve_modified and serve_is_modified. + * vers_ts.c (Version_TS): Set ->options even for a dummy ("D" + timestamp) entry. + * import.c (process_import_file): Check for -k options. + * client.c (client_process_import_file): Send Kopt request. + (send_fileproc): Likewise, for "cvs add". + * sanity.sh: Enable test binwrap3-sub2-add1 for remote. + Add -I .cvswrappers to binwrap3-2a; adjust binwrap3-2d + accordingly. Tests for this fix. - * main.c (lookup_command_attribute): Don't use an ANSI prototype - when defining the function. +Mon Jan 19 08:48:59 1998 Larry Jones <larry.jones@sdrc.com> -Fri Jan 31 12:49:02 1997 Ian Lance Taylor <ian@cygnus.com> + * sanity.sh (errmsg1): Append test 168 output to log file. - * modules.c (do_module): Actually goto found if is_found is set - (fixes thinko in PATH_MAX nuking of 30 Jan 97). +Sat Jan 17 08:01:51 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Fri Jan 31 12:49:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * sanity.sh (ann-10, ann-11): Don't make assumptions about the + number of characters in the username. - * sanity.sh: Add modules3 and big to list of tests to run - by default; they were omitted by accident. +Fri Jan 16 15:34:02 1998 Larry Jones <larry.jones@sdrc.com> -Thu Jan 30 11:46:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * diff.c (diff_fileproc): Free label1 and label2 when finished. - * logmsg.c, main.c, mkmodules.c, modules.c, parseinfo.c, patch.c: - Nuke more PATH_MAX. + * edit.c (editor_set): Don't free edlist until after we're + done using it. - * server.c (server_updated): After we send Created or - Update-existing for a file, mark it as unchanged, in case we - process it again. - * sanity.sh (modules3): New tests, test for above fix. + * rcscmds.c (RCS_merge): Free xrev1 and xrev2 when finished. - * logmsg.c (do_verify): Error return from fopen is NULL, not -1. - Pass errno to error(). + * subr.c (make_message_rcslegal): Don't access uninitialized or + unallocated memory; only strip trailing blank lines. + * sanity.sh (log-3): Enhance to test this fix. - * login.c [_CRAY]: Don't declare getpass. +Fri Jan 16 12:41:03 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Mon Jan 27 17:25:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * sanity.sh: Add keywordlog to list of tests run by default. - * import.c (process_import_file): Fix freeing of rcs (Don't free - it before we are done using it, and don't free it twice). + * rcs.c (RCS_deltas): Don't call cvs_output if length is zero; + passing zero length to cvs_output does not mean output zero + bytes. The 27 Dec 1997 change to no longer '\0'-terminate the + ->text field turned this from a time bomb to a user-visible bug. + * sanity.sh (ann): New tests, test for this fix and other annotate + behaviors. - * modules.c (cat_module): Allocate line right before we use - it. The previous code was wrong because the length of the - s_h->rest changes between the time we allocate line and the time we - sprintf s_h->rest into it. +Thu Jan 15 23:52:00 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Sun Jan 26 21:58:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * root.c (root_allow_ok): If inetd.conf didn't specify an + --allow-root options at all, we know we are in trouble. Give a + specific error message. - * expand_path.c (expand_path): Revise to call expand_string as - needed. Nuke PATH_MAX. - * find_names.c (find_dirs): Likewise. - * import.c, lock.c: Nuke more PATH_MAX. +Thu Jan 15 21:24:59 1998 Ian Lance Taylor <ian@cygnus.com> - * server.c (mkdir_p): Set retval to 0 at start of function. - Previously it had been uninitialized for some cases. Thanks are - due to nightly testing for catching this one. + * sanity.sh (dotest_sort): New variant of dotest which sorts the + output, for use when the output depends upon details of the file + system, typically when doing an import. + (rdiff): Use dotest_sort for rdiff-1. + (ignore): Use dotest_sort for 188a, 188b, 189d, 190, and 191. -Sat Jan 25 21:34:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * sanity.sh: (TESTSHELL): New variable. + (editor, info, reserved): Use TESTSHELL in temporary script. - * subr.c, cvs.h (expand_string): New function. - * rcs.c (getrcskey, getrcsrev): Call it. This greatly reduces the - number of calls to realloc if there is a very large file in the - RCS file. Credit goes to Mike Heath <mike@pswtech.com> for - pointing out the problem and the basic solution (MIN_INCR, - MAX_INCR); I adapted it into the separate function expand_string. - * sanity.sh (big): New test helps insure this hasn't broken - anything obvious. + * sanity.sh (ignore): Do all tests in subdirectory, to avoid + conflict between cvsroot and CVSROOT on Windows. + (binwrap3, mwrap, info, config): Likewise. -Wed Jan 22 10:06:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * sanity.sh (binfiles2): Correct test name binfile2-7-brmod to + binfiles2-7-brmod. - * status.c (status_fileproc): Change message which is printed for - T_MODIFIED and ts_conflict set, so that it doesn't say "unresolved - confict". This message occurs whether the conflict is resolved or - not. - * sanity.sh (conflicts): Add tests conflicts-status-* to test - output of "cvs status" in the context of conflicts. Tests for - above fix. + * release.c (release_delete): If __CYGWIN32__ is defined, don't + worry about mismatched inodes. This is a hack, but then I think + the test is rather peculiar anyhow. - * rtag.c (rtag): Send -n if run_module_prog is NOT true. +Thu Jan 15 16:07:36 1998 Larry Jones <larry.jones@sdrc.com> -Thu Jan 16 00:06:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * sanity.sh (reserved-9): Use ${PROG} instead of "cvs". - * version.c: Change version number to 1.9.3. +Wed Jan 14 15:43:13 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * version.c: Version 1.9.2. + * Split ChangeLog into ChangeLog-97 and ChangeLog. + * Makefile.in (DISTFILES): Add ChangeLog-97. -Wed Jan 15 09:14:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> +13 Jan 1998 Jim Kingdon - * client.c (call_in_directory): Take code that creates CVSADM at - top level, move it before the CVS_CHDIR (dir_name) call, and do it - regardless of whether dir_name is ".". Pass "." not dir_name to - Create_Admin (when the code was written they were always the - same). Don't add reposdirname to the repository we pass to - Create_Admin (when the code was written, I think reposdirname - probably would always be "."). Don't create CVSADM if - reposdirname_absolute. - * sanity.sh (basicb): Enable tests basicb-1a and basicb-9a for - remote; tests for above fix. - (basic1): Do entire test within a "1" directory to deal with - creation of CVS directories at top level. Support --keep. - (conflicts): In test conflicts-136, only update first-dir. - (basica): Uncomment the part that tests "cvs co -l .". That tests - the existing functionality which I might have (but hopefully did not) - perturbed with the call_in_directory changes. + * client.c: Declare handle_mt. -Mon Jan 13 11:04:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> +Tue Jan 13 22:21:30 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * server.c (check_command_legal_p): Do not call error (1, ...) - here; that will always cause a protocol violation by shutting down - the connection prematurely. Remove croak_on_illegal arg. - (do_cvs_command): Move call to check_command_legal_p until after - the call to print_pending_error. Print the error message ourself. + * sanity.sh: Add comment about how pwd and /bin/pwd often differ + in behavior (but are not guaranteed to). - * mkmodules.c (filelist): Add readers and writers. Add comment - about why passwd is not included. Add comment about meaning of - NULL contents field. +Tue Jan 13 13:49:53 1998 Ian Lance Taylor <ian@cygnus.com> -Fri Jan 10 13:23:09 1997 Norbert Kiesel <nk@col.sw-ley.de> + * sanity.sh: When setting TMPPWD use just pwd, not /bin/pwd. - * release.c (release): Initialize delete_flag before reading it - (found by running purify) + * update.c (checkout_file): Don't pass set_time as true to + Version_TS if the file is dead. + * sanity.sh (modules): Add tests modules-155c6 through + modules-155c8 to test for above patch (without the above patch, + modules-155c8 will fail when remote). - * logmsg.c (do_verify): Fix reading unallocated memory (found by - running purify) +Tue Jan 13 10:37:02 1998 Larry Jones <larry.jones@sdrc.com> -Thu Jan 9 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * client.c (send_modified): Change bufsize and newsize from int + to size_t to avoid type clashes in call to read_and_gzip. - * checkout.c (build_dirs_and_chdir): Partially revert 3 Jan - change--move call to Subdir_Register back above the CVS_CHDIR call - (we need to register in the old, not the new, directory). Instead - of calling CVS_MKDIR and ignoring errors, call mkdir_if_needed; - this is an effort to catch errors there rather than catching them - in the CVS_CHDIR. This makes test 27-add-add in sanity.sh work - again. - - * find_names.c (Find_Directories): Remove code inside - #ifdef ATTIC_DIR_SUPPORT and replace it with a comment explaining - why we don't look in the attic. ATTIC_DIR_SUPPORT was never defined. - - * find_names.c (find_dirs): Add comment about tmp being unset. - - * commit.c (checkaddfile): Report errors with errno and specific - error messages. - - * rcs.c, commit.c, create_adm.c, entries.c, find_names.c, - ignore.c, history.c: Nuke PATH_MAX arbitrary limits. - -Wed Jan 8 23:07:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * add.c (add): Reindent a portion which needed it. - -1997-01-08 Jim Kingdon +Tue Jan 13 10:33:02 1998 Larry Jones <larry.jones@sdrc.com> - * client.c (send_file_names): When looking name up in Entries, - call Entries_Open and Entries_Close. This has two effects: - (1) we look at Entries.Log, and (2) we don't skip 'D' entries, - both of which are needed to make us get the right (command - line) name for a directory we are adding. - -Wed Jan 8 14:50:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - - * Makefile.in, cvs.h, hash.h, myndbm.h, rcs.h: Remove CVSid; we - decided to get rid of these some time ago. + * zlib.c (read_and_gzip): Set finish to 0; it was uninitialized. -Tue Jan 7 12:56:10 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn> +Tue Jan 13 10:26:43 1998 Larry Jones <larry.jones@sdrc.com> - * root.c (check_root_consistent): new func, compares below new - global var with CVSroot_directory, assuming both set. - (set_local_cvsroot): use above new func for security check. - (parse_cvsroot): same. - But do all of above only #ifdef AUTH_SERVER_SUPPORT. + * add.c, rcs.c: Plug memory leaks. - * server.c: (Pserver_Repos): new global var, init to NULL. - (pserver_authenticate_connection): set above new global. - (check_repository_password): be a good scout and use - CVSROOTADM and CVSROOTADM_PASSWD, now that they are the standard. - Make sure all of above is in #ifdef AUTH_SERVER_SUPPORT. - (check_command_legal_p): wrap most of body in #ifdef - AUTH_SERVER_SUPPORT. - Everywhere: wrap all references to CVS_Username in #ifdef - AUTH_SERVER_SUPPORT. +Mon Jan 12 10:45:27 1998 Larry Jones <larry.jones@sdrc.com> - * cvs.h (Pserver_Repos): new var, used in consistency [security] - check. Defined only #ifdef AUTH_SERVER_SUPPORT. - (CVSROOTADM_PASSWD): new #define, trying to get with the program. + * server.c (mkdir_p): Don't try to create nameless directories + (i.e., given "/foo//bar", don't try to create "/foo/", + just "/foo" and "/foo//bar") since it isn't necessary and + it fails on some systems in unexpected ways. -Fri Jan 3 18:10:39 1997 Ian Lance Taylor <ian@cygnus.com> +1998-01-11 enami tsugutomo <enami@but-b.or.jp> - * checkout.c (build_dirs_and_chdir): Move call to Subdir_Register - until after we know that the directory exists. - -Thu Jan 2 13:30:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * rcs.c (linevector_copy): Delete lines before overwriting them. - * Makefile.in, cvsbug.sh, edit.c, edit.h, error.c, error.h, - fileattr.c, fileattr.h, filesubr.c, run.c, update.h, watch.c, - watch.h: Remove "675" paragraph; see ../ChangeLog for rationale. +Sat Jan 10 11:05:40 1998 Jim Kingdon <kingdon@harvey.cyclic.com> -Thu Jan 2 12:27:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * cvsrc.c, entries.c, login.c, logmsg.c, myndbm.c, patch.c, + release.c, server.c: Check for errors from getline, CVS_FOPEN, + fprintf, CVS_UNLINK and fclose. Note that the new errors are + nonfatal. This is because of conservatism more than because + it is always the best thing. + * login.c (get_cvs_password): Close the file when done with it. + * client.c (notified_a_file): If -1 return from getline, check + feof rather than assuming errno is set. - * sanity.sh (info): New test info-cleanup-verifymsg gets rid of - verifymsg when we are done with it. +Fri Jan 9 14:38:54 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * sanity.sh (basicb): Skip tests basicb-1a and basicb-9a for remote. - * sanity.sh (modules-155a4): It is OK if a CVS directory exists. - * sanity.sh (ignore): Do everything inside a "1" directory. The - change to create CVS directories at top-level causes messages such as - "? home" otherwise. In test 191, specify -I CVS so that new CVS - directory is ignored. - * sanity.sh (crerepos): Manually remove CVS directory which had not - existed before. + * server.c (expand_proc): Also output server_dir in + "Module-expansion", not just in output_dir ("Created", &c). + * sanity.sh (modules2): New tests modules2-9 through modules2-12 + test for this. -Thu Jan 2 09:06:20 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn> +Thu Jan 8 12:56:55 1998 Yasutoshi Hiroe <hiroe@rgk.ricoh.co.jp> - * server.c: Changes for pserver read-only repository access: - (check_command_legal_p): new func. Right now, just checks if - repository modification is permitted, and that only if pserver is - active. - (do_cvs_command): take new parameter `cmd_name', a string. All - callers changed. Pass it on to new func check_command_legal_p() - before executing the command. - (CVS_Username): new global, init to NULL. Used by - check_command_legal_p(), set in check_password(). - (check_password): set above new global CVS_Username; reorganized a - bit to facilitate this. - (check_repository_password): give *host_user_ptr permanent - storage iff success. + * import.c (import): Don't strcat on uninitialized memory. Fixes + possible SIGSEGV with zero-length message. - * main.c: Changes for pserver read-only repository access: - (lookup_command_attribute): new func. - (main): use new func lookup_command_attribute() to establish if - CVS_CMD_IGNORE_ADMROOT and CVS_CMD_USES_WORK_DIR. +Tue Jan 6 22:56:29 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * cvs.h: Changes for pserver read-only repository access: - (CVSROOTADM_READERS, CVSROOTADM_WRITERS): new #defines. - Prototype lookup_command_attribute(). - (CVS_CMD_IGNORE_ADMROOT, CVS_CMD_USES_WORK_DIR, - CVS_CMD_MODIFIES_REPOSITORY): new #defines for - lookup_command_attribute() and its callers. + * sanity.sh (crerepos): Fix mistaken variable name which caused us + not to clean up at the end of the test. -Wed Jan 1 19:50:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> +Mon Dec 22 01:40:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> - * options.h.in: Reword comment for TMPDIR_DFLT to make it clear - that this isn't specific to the pserver server. + * add.c (add): Also look for .cvswrappers files. + * sanity.sh (binwrap3): New tests binwrap3-2*, binwrap3-sub2-add* + test for this. - * modules.c (do_module): Give an error message if one tries to - specify -a together with another option. - * sanity.sh (modules2): New tests modules2-a* test for above fix. +Tue Jan 6 11:50:38 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * sanity.sh (devcom): Add tests devcom-a-nonexist and - devcom-t-nonexist for "cvs watchers" on nonexistent argument. + * sanity.sh (crerepos): New tests crerepos-8 through crerepos-18 + test behaviors when mixing repositories. -1997-01-01 Fred Fish <fnf@ninemoons.com> +Sun Jan 4 17:40:22 1998 Jim Kingdon <kingdon@harvey.cyclic.com> - * run.c (piped_child, filter_stream_through_program): Actually - install these HAVE_VFORK patches that got missed. - (There was a log entry for these changes for 29 Nov 1996 but it - seems I accidentally forgot to actually check them in -kingdon). + * version.c: Change version number to 1.9.23. -Wed Jan 1 18:32:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + * Version 1.9.22. - * Makefile.in: Add ChangeLog-96. - * ChangeLog-96: New file, contains former contents of ChangeLog. - * ChangeLog: Now just contains 1997 changes. - -For older changes see ChangeLog-96. +For older changes see ChangeLog-97. diff --git a/gnu/usr.bin/cvs/src/ChangeLog-97 b/gnu/usr.bin/cvs/src/ChangeLog-97 new file mode 100644 index 00000000000..ce7180b39d3 --- /dev/null +++ b/gnu/usr.bin/cvs/src/ChangeLog-97 @@ -0,0 +1,3249 @@ +1997-12-30 enami tsugutomo <enami@but-b.or.jp> + + * rcs.c (RCS_checkin): Use gmtime() instead of localtime() + (restores behavior from RCS 5.x which was broken with RCS library + -kingdon). + +Mon Dec 29 12:53:00 1997 Ian Lance Taylor <ian@cygnus.com> + + * modules.c (do_module): Check for a request for a file within a + module which is not a directory. + * sanity.sh (modules): Add test 149b1 for above patch. + + * client.c (start_tcp_server): Remove useless assignment, left + behind by Dec 15 patch. + +Sat Dec 27 17:41:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c, options.h.in, history.c, import.c, main.c, rcs.c, + update.c: Remove !HAVE_RCS5 code. It had bit-rotted a while ago, + and more to the point is obsolete with the RCS library. + +27 Dec 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * zlib.c, server.h (gunzip_and_write): New function. + * client.c (update_entries): Call it instead of a gunzip subprocess. + * zlib.c, server.h (read_and_gzip): New function. + * client.c (send_modified): Call it instead of a gzip subprocess. + +Sat Dec 27 13:07:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + Decrease RCS_deltas memory usage to what we need (approximately + the size of the file we are patching plus the size of the largest + patch). Previously memory usage had been approximately the size + of the RCS file because we never freed lines until the end. + * rcs.c (linevector_free, linevector_copy, linevector_add, + linevector_delete): + Instead of having all the lines and struct line's in the alloc_* + space, have each line and its struct line in its own malloc'd + space. Use a refcount to deal with curlines vs. headlines + vs. trunklines in RCS_deltas. + (struct allocblock, blocks, block_alloc, block_free): Remove; no + longer used. + (apply_rcs_changes, RCS_deltas): Don't copy lines into allocated + space; linevector_add now does that for us. + (rcs_change_text, RCS_deltas): Don't call block_free. + +Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsbug.sh: Change bug-cvs address from prep.ai.mit.edu to gnu.org + per email from Martin Hamilton. + +Sun Dec 21 21:49:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_checkin): Disable keyword expansion when generating + the change text. + * sanity.sh: Move tests keyword-24 through keyword-27 into + new section keywordlog and expand greatly. Note that CVS 1.9.18 + passes the new tests both local and remote but the current + version failed them both local and remote before this fix. + +Sat Dec 20 19:56:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_delete_revs): Clean up temporary files even if noexec. + Without this fix, basica-o5a in sanity.sh would leave files around. + +Thu Dec 18 13:05:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c: Fix typo in declaration (evecvp -> execvp) (credit to + Erik Walthinsen for reporting this). Only declare it if not + HAVE_UNISTD_H. Move declaration to before the first use. + +Tue Dec 16 12:59:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c: Collapse two identical declarations for join_file. + +Mon Dec 15 16:01:49 1997 Ian Lance Taylor <ian@cygnus.com> + + * client.c (start_tcp_server): Remove calls to htons and add one + call to ntohs (init_sockaddr calls htons on the port argument). + +Mon Dec 15 00:07:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (failure_exit): New variable. + (get_server_responses): If it is set, then return + failure. + (updated_seen, updated_fname): New variables. + (update_entries): Use updated_fname if set. In the "move away + foo.c; it is in the way" case print "C" not "U", and set + failure_exit. + (handle_mt): If we get +updated tagged text, stash it away in + updated_fname rather than printing it immediately. + (handle_mt, get_server_responses): If we stashed a filename and + didn't get around to printing it, go ahead and print it. + * sanity.sh (conflicts2-142d2): Adjust to test for fix. Remote is + now like local was in terms of exit status and "C aa.c" message. + +Sun Dec 14 00:27:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + Implement tagged text feature: + * update.c (write_letter): Take a single finfo argument rather + than file and update_dir. While we are at it change it to return + void (since the returned value always had been 0). + * update.c: Update callers. + * server.c, cvs.h (cvs_output_tagged): New function. + * client.c (responses): Add "MT" response. + (handle_mt): New function. + * update.c (write_letter): Output via cvs_output_tagged. + +Sun Dec 14 14:13:05 1997 Ian Lance Taylor <ian@cygnus.com> + + * recurse.c (do_dir_proc): Only check for CVS/Repository if + W_LOCAL. + * sanity.sh (devcom-t2, devcom-t3): New tests for above patch. + +Sun Dec 14 00:27:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * root.c (parse_cvsroot): Initialize check_hostname (fixes thinko + in GSSAPI changes). + +Sat Dec 13 13:15:35 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c: Use indentation to indicate nesting of #ifdef's. + + * client.c (connect_to_gserver): Reindent (in one place). + +Fri Dec 12 17:38:15 1997 Chris Provenzano <proven@cygnus.com> + and Ian Lance Taylor <ian@cygnus.com> + + * cvs.h (CVSmethod): Add gserver_method. + * root.c (method_names): Add gserver. + (parse_cvsroot): Handle :gserver:. + * client.h (cvsauthenticate): Declare. + (cvs_gssapi_encrypt): Declare if HAVE_GSSAPI and ENCRYPTION. + (cvs_gssapi_wrap_buffer_initialize): Declare if HAVE_GSSAPI. + (connect_to_pserver): Update declaration. + (pserver_authenticate_connection): Declare when HAVE_GSSAPI and + SERVER_SUPPORT is defined in addition to other case. + * client.c: If HAVE_GSSAPI, include GSSAPI header files. + (gcontext): New static variable if HAVE_GSSAPI. + (connect_to_pserver): Add do_gssapi parameter. Change all + callers. Move rejection handling to bottom of function. + (recv_bytes): New static function if HAVE_GSSAPI. + (connect_to_gserver): Likewise. + (start_server): Handle gserver_method. Handle GSSAPI encryption + and authentication. + * server.c: Include <sys/socket.h> if HAVE_GSSAPI, in addition to + existing cases. If HAVE_GSSAPI, include GSSAPI header files. + Include <grp.h> even if AUTH_SERVER_SUPPORT is not defined. + (gcontext, cvs_gssapi_wrapping): New static variables if + HAVE_GSSAPI. + (cvs_gssapi_encrypt): New global variable if HAVE_GSSAPI and + ENCRYPTION. + (serve_gssapi_encrypt): New static function if HAVE_GSSAPI and + ENCRYPTION. + (serve_gssapi_authenticate): New static function if HAVE_GSSAPI. + (requests): Add Gssapi-encrypt if HAVE_GSSAPI and ENCRYPTION. Add + Gssapi-authenticate if HAVE_GSSAPI. + (switch_to_user): Compile if HAVE_GSSAPI, in addition to existing + cases. + (pserver_authenticate_connection): Likewise. Ifdef out part of + the code for AUTH_SERVER_SUPPORT. Handle a GSSAPI request. + (gserver_authenticate_connection): New static function if + HAVE_GSSAPI. + (cvsauthenticate): New global variable. + (struct cvs_gssapi_wrap_data): Define if HAVE_GSSAPI. + (cvs_gssapi_wrap_buffer_initialize): New function if HAVE_GSSAPI. + (cvs_gssapi_wrap_input): New static function if HAVE_GSSAPI. + (cvs_gssapi_wrap_output): Likewise. + * main.c (opt_usage): Mention -a. + (main): Handle -a. Handle pserver if HAVE_GSSAPI, in addition to + existing cases. + * login.c (login): Pass new argument to connect_to_pserver. + +Fri Dec 12 15:33:19 1997 Ian Lance Taylor <ian@cygnus.com> + + * buffer.c (PACKET_SLOP): Define. + (packetizing_buffer_initialize): Use PACKET_SLOP when allocating + holdbuf. + (packetizing_buffer_input): Allow up to PACKET_SLOP bytes in + stackoutbuf. + (packetizing_buffer_output): Use just BUFFER_DATA_SIZE + 2 for + inbuf. Allow PACKET_SLOP + 4 extra bytes in stack_outbuf. + Correct >= to > in test of incoming number of bytes. Use + PACKET_SLOP in other tests. + +Fri Dec 12 10:27:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (start_tcp_server): Revise comment to reflect + SOCK_STRERROR and SOCK_ERRNO now being in use. + +Thu Dec 11 15:32:31 1997 Ian Lance Taylor <ian@cygnus.com> + + * client.c (init_sockaddr): Compile if HAVE_KERBEROS, as well as + if AUTH_CLIENT_SUPPORT. Return a pointer to a struct hostent. + (start_tcp_server): Clean up. Use init_sockaddr. Use + SOCK_STRERROR and SOCK_ERRNO. Don't bind the socket. + + Generalize buffering code used by Kerberos encryption routines + into a generic packetizing buffer. The new code in buffer.c is a + modified version of the code removed from server.c. + * buffer.c (struct packetizing_buffer): Define. + (packetizing_buffer_initialize): New function. + (packetizing_buffer_input): New static function. + (packetizing_buffer_output): New static function. + (packetizing_buffer_flush): New static function. + (packetizing_buffer_block): New static function. + (packetizing_buffer_shutdown): New static function. + * buffer.h (packetizing_buffer_initialize): Declare. + * server.c (struct krb_encrypt_data): Rename from + krb_encrypt_buffer, and remove all fields not related to + encryption. + (krb_encrypt_buffer_initialize): Just call + packetizing_buffer_initialize. + (krb_encrypt_input): New static function. + (krb_encrypt_output): New static function. + (krb_encrypt_buffer_input): Remove. + (krb_encrypt_buffer_output): Remove. + (krb_encrypt_buffer_flush): Remove. + (krb_encrypt_buffer_block): Remove. + (krb_encrypt_buffer_shutdown): Remove. + +Wed Dec 10 15:39:44 1997 Ian Lance Taylor <ian@cygnus.com> + + * buffer.c (stdio_buffer_initialize): Correct formatting. + +Sun Dec 7 09:37:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb-0d0): New test, for checkout on existing + directory. + +Sat Dec 6 00:25:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (binwrap3): Clean up repository too. Clean up working + directory with "rm -r" not "rm -rf". + +Thu Dec 4 17:11:18 1997 Larry Jones <larry.jones@sdrc.com> + + * subr.c (check_numeric): Don't reference argv[1] when argc is 1 + (should be argv[0]). + + * sanity.sh: Fix lines that look like conflict markers but aren't + to prevent problems checking in. + (binwrap3): Remove local CVSROOT when done so that later + tests that expect to create it don't fail. + +Thu Dec 4 18:19:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.h: Remove mempcpy definition. I think the polite way to + describe my feelings about mempcpy is something like "we don't + have agreement that it is a good idea". + * rcs.c (truncate_revnum): Don't call it. + * sanity.sh: Run multibranch2 test by default. + (multibranch2): Use ${TESTDIR} a few places. + (multibranch2-9): Accept "P file1" as well as "U file1". + + * sanity.sh: Don't add 1997 to the copyright notice. Add GPL + terms. Add discussion of copyright issues. + * rcs.c (truncate_revnum, truncate_revnum_in_place, + compare_truncated_revnums): Reindent. + +1997-12-04 Jim Meyering <meyering@na-net.ornl.gov> + + * subr.c (xstrdup): Use memcpy rather than strcpy. + (compare_revnums): Declare parameters to be `const'. + Remove unnecessary uses of xstrdup and corresponding frees. + (increment_revnum): Declare parameter to be `const'. + Use memcpy rather than strcpy. + (gca): Declare parameters to be `const'. + (check_numeric): Declare REV parameter to be `const'. + (file_has_markers): Declare parameter to be `const'. + (get_file): Declare `char*' parameters to be `const'. + * run.c (run_exec): Declare `char*' parameters to be `const'. + * cvs.h (mempcpy) [! HAVE_MEMPCPY]: Define it. + Add `const' to types in several prototypes. + + * rcs.c (truncate_revnum): New function. + (truncate_revnum_in_place): New function. + (compare_truncated_revnums): New function. + (max_rev): New function. + (RCS_addbranch): Make BRANCH parameter `const'. + Use the above functions rather than open-coding them. + When BRANCH is a revision number, insert it *in order* + in the sorted list of branch numbers, not at the end. + Add assertion that insertion succeeds. + * sanity.sh (multibranch2): Test for this. + (Copyright): Add 1997. + +Dec 1997 Karl Fogel <kfogel@floss.red-bean.com> + + * wrapper.c (wrap_name_has): loop as far as wrap_count + + wrap_temp_count, not wrap_count + wrap_saved_count, otherwise + some wrappers get skipped. + (wrap_matching_entry): same. + * sanity.sh (binwrap3): new test, for import with + CVSROOT/cvswrappers and .cvswrappers specifying -k 'b' options. + +1997-11-30 Jim Meyering <meyering@na-net.ornl.gov> + + * client.c (send_a_repository): Strip trailing slashes from the name + of the update directory. Otherwise, running `cvs update dir/' provokes + this failure `protocol error: illegal directory syntax in dir/' when + running in client/server mode. + + * hash.c (insert_before): New function derived from addnode. + (addnode): Simply return insert_before. + (addnode_at_front): Simply return insert_before. + * hash.h (insert_before): Add prototype. + + * server.c (dirswitch): Compute `strlen(dir)' once and save it, + rather than computing it four times. Also do s/illegal/invalid/ to + this diagnostic: "E protocol error: illegal directory syntax in %s". + +Sun Nov 30 18:03:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * admin.c: Fix comment (no longer a front-end to "rcs"). + + * error.c, error.h (rcserror): Remove. + * admin.c, rcs.c: Call error instead of rcserror. This changes + the format of these messages from "rcs: <path>: error" to "cvs + <command>: <path>: error". The former format wasn't quite what + RCS printed anyway (because RCS would sometimes print "ci", "co", + &c, not "rcs"), and preserving RCS's exact output probably is not + a good idea anyway (because it will make people think that the + error was caused by an external program). In two cases, I tidied + up the message in a more drastic fashion ("cannot stat" in + RCS_checkin and "could not diff" in RCS_delete_revs). + + * sanity.sh (basica-o2b, binfiles2-o1, admin-18, admin-22-o10, + admin-22-o17): Look for "cvs <command>" not "rcs". + + * run.c, cvs.h (run_setup): Replace varargs nonsense with a single + argument which gets parsed as the result of the vasprintf + used to. + * client.c, commit.c, logmsg.c, modules.c, rtag.c, tag.c, update.c, + wrapper.c: Update callers, either to do the sprintf themself or to + just call run_arg if it will do the job. + * rcscmds.c: Likewise for call_diff_setup and callers. + + * run.c, cvs.h (run_args): Remove; nowhere used. + +Sat Nov 29 22:15:06 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h.in: Remove declaration of getwd; see lib/ChangeLog for + rationale. + +1997-11-29 Jim Meyering <meyering@na-net.ornl.gov> + + * update.c (checkout_file): Initialize `backup'. + + * diff.c (diff_fileproc): Initialize `tmp' and `fname'. + + * modules.c (do_module): Initialize `server_dir_to_restore'. + (do_module): Initialize `value' in an else clause. + + * rcs.c (RCS_checkin): Initialize `commitpt'. + (RCS_delete_revs): Initialize `revp'. + (RCS_copydeltas): Always initialize `insertbefore'. + + * run.c (run_print): Define `outfn' even in error case. + +Mon Nov 24 17:28:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_findlock_or_tip): Prototype. + (RCS_checkin): Fix call to pass correct number of arguments. + +Sun Nov 23 10:34:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * recurse.c (do_dir_proc): Move check for CVS/Repository and + CVS/Entries to before where we call the direntproc. + * client.c (send_dirent_proc): Remove code to check for + CVS/Repository, now that recurse.c does it. + * sanity.sh (conflicts3-18 through conflicts3-19): New tests, for this. + +Sat Nov 22 10:54:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * recurse.c (do_dir_proc): Check that CVS/Repository and + CVS/Entries exist. + * sanity.sh (conflicts3-14 through conflicts3-17): New tests, for this. + + * client.c (send_fileproc): Send options field from + vers->entdata->options not vers->options. + * cvs.h (struct entnode): Add comment (options and timestamp must + not be NULL). + * sanity.sh (binfiles-9 through binfiles-13, binfiles-sticky5, + keyword-17): Remove kludges for remote; tests for fix. + + * update.c (update_fileproc): Fix comment; direct checkout is + still faster than patches for local but not for quite the + same reasons. + + * add.c (add): Pass SEND_NO_CONTENTS to send_files. + +Wed Nov 19 18:25:03 1997 Mike Glendinning <mikeg@sequent.com> + + * update.c (patch_file_write): Missing cast provided. + +Wed Nov 19 15:57:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_deltas): Solve trigraph problem (once and for all, I + hope) with 3 calls to cvs_output. + +Wed Nov 19 01:52:57 1997 Andy Piper <andyp@parallax.co.uk> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * classify.c (Classify_File), cvs.h (struct vers_ts), vers_ts.c + (Version_TS): Clarify NULL versus "" for options in comments. + * vers_ts.c (Version_TS): Treat "" the same way as NULL in options + and vers_ts->options. + * sanity.sh: New tests binfiles-sticky5 through binfiles-17 test + for this. + +1997-11-16 Karl Fogel <kfogel@floss.red-bean.com> + + * client.c (update_entries): parse server-sent entries line even + in the case of "cvs export", because we need to know if -kb option + is set. + Init `options' to NULL like anything else. + +Tue Nov 18 09:20:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.21. + + * Version 1.9.20. + +Mon Nov 17 14:35:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (server_updated): If scratched_file and noexec are set, + clean up so we don't get a "duplicate Scratch_Entry" warning + later. + * sanity.sh: New tests conflicts3-10 to conflicts3-13, for this. + + * sanity.sh (conflicts3): Don't allow "file1 was lost" messages + here; I don't think CVS actually produced them, and they don't + belong. + +Sun Nov 16 23:19:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Accept either "U file1" or "P file1". + +Fri Nov 14 12:32:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c: Add comment about cleaning up ,foo, file on ^C. + +Fri Nov 14 11:56:29 1997 Andy Piper <andyp@parallax.co.uk> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * filesubr.c (unlink_file_dir): Don't print trace message in the + server. + +Fri Nov 14 11:28:55 1997 Jim Meyering and Jim Kingdon + + * rcs.c (RCS_getdatebranch): If the branch we are looking for + doesn't exist, return a revision which matches the date, not + just NULL. + * sanity.sh (tagdate): New test, for this. + +Thu Nov 13 10:11:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb-21): Fix comment which described a behavior + which no longer exists. + +Wed Nov 12 16:24:45 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + Clean up infrastructure made unnecessary by RCS library: + * rcscmds.c (diff_exec, diff_execv): Use literal "diff" not DIFF. + * options.h.in (DIFF), rcs.h (RCS, RCS_CI, RCS_DIFF, + RCS_RCSMERGE): Removed; no longer used. + * commit.c (commit), patch.c (patch_fileproc), + rcscmds.c (RCS_exec_rcsdiff), start of rcscmds.c: Update comments + to reflect librarification of RCS. + * options.h.in (RCSBIN_DFLT): Removed. + * main.c, cvs.h (Rcsbin, free_Rcsbin): Removed. + * main.c (main): Don't check RCSBIN environment variable. -b + global option is now a noop. + * cvs.h (RCSBIN_ENV): Removed. + * expand_path.c (expand_variable): $RCSBIN is now an error. + * mkmodules.c (config_contents): Remove RCSBIN. + * parseinfo.c (parse_config): RCSBIN now a noop. + * server.c (server): Don't put Rcsbin in PATH. + +Mon, 10 Nov 1997 Jim Kingdon + + * rcs.c (RCS_checkin): Actually, when we get a change text + for a text file using get_file, we want text mode, although + the reasons are kind of subtle (see comment). + + * rcs.c (RCS_checkin): Pass correct mode to get_file for + binary files. + + * rcscmds.c: Declare vasprintf. + +Mon Nov 10 11:11:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + This fixes problems with windows-NT/run.c improperly quoting, and + is cleaner anyway. + * rcscmds.c (call_diff_setup, call_diff_arg, call_diff_add_arg, + call_diff_argv, call_diff_argc, call_diff_argc_allocated): New + functions/variables, lightly adapted from src/run.c. + * cvs.h, run.c (call_diff, call_diff3): Move from here... + * rcscmds.c: ...to here. + +Sun, 9 Nov 1997 Jim Kingdon + + * rcs.c (rcs_internal_unlockfile): Call rename_file not rename. + This makes it work on NT again. + +Sun Nov 9 16:54:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (diffmerge2): Protect keywords against unwanted + expansion. They got clobbered and the testcase stopped working + when I checked it in. + +Fri Nov 7 13:23:38 1997 Karl Fogel <kfogel@floss.red-bean.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (diffmerge1, diffmerge2): new tests, for bugs, or + potential bugs, in ../diff/analyze.c which were fixed by Paul + Eggert's patch. + +Sun Nov 9 10:28:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_settag): Reindent. + + * rcs.c (rcs_internal_lockfile): Fix typo (thow -> throw). + +Sat Nov 8 15:58:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (cvsadm): Remove most of the tests which tested + CVS/Root. This takes the run time for the cvsadm tests from + about 5 minutes 15 seconds to about 4 minutes 10 seconds with no + significant loss in coverage. + + * rcs.c (rcs_internal_lockfile): Check for errors from system + calls. If open() gives an error, don't muck with stat and errno + (I don't know what the RCS code that this comes from was trying to + do, but it clearly isn't accomplishing anything here). + (RCS_rewrite, RCS_delete_revs): Check for errors from system calls. + +Sat Nov 1 14:21:29 1997 Michael L.H. Brouwer <michael@thi.nl> + + * rcs.c (RCS_checkin): Change type of bufsize from int to size_t. + (RCS_delete_revs): Change type of bufsize and len from int to size_t. + (RCS_getdeltatext): Change type of textlen from int to size_t. + * rcs.h (struct deltatext): Change len from int to size_t to keep + the compiler happy on systems where size_t is unsigned int. + [This goes well beyond keeping the compiler happy; if sizeof + (size_t) != sizeof (int), the old code was quite broken -kingdon] + +Sat Nov 1 14:21:29 1997 Michael L.H. Brouwer <michael@thi.nl> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_checkin): When checking if we were holding the lock + use delta->author instead of user since the latter might have been + clobbered by a call to getcaller. This resulted in the failure of + test basica-7. + [I don't completely follow the scenario where it gets clobbered, + it but sounds vaguely plausible and the replacement seems + cleaner, precisely because it avoids allocation issues -kingdon] + +Wed Nov 5 20:16:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * checkin.c, checkout.c, commit.c, cvs.h, import.c, login.c, + main.c, update.c: Change FALSE to 0 and TRUE to 1 and replace + monstrosities like "cvswrite == TRUE" with just "cvswrite". FALSE + and TRUE sometimes conflicted with system headers (NextStep3.3?), + but more to the point, good old 1 and 0 are fine and were used by + most of CVS already. + +Tue Nov 4 12:19:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_checkin, RCS_lock, RCS_unlock): Rename local variable + quiet to checkin_quiet or some such, to avoid confusion with + global variable quiet. + + * lock.c: Update comment to refer to add_rcs_file rather than "rcs + -i". + + * rcs.h (struct rcsnode): Add comments for all fields. + * rcs.c (RCS_delete_revs): Refuse to delete revisions which have + symbolic names. Fix fencepost bug which caused us to sometimes + check one more revision than we should for locks, branches, and + this. + (findtag): New function, to help above code. + + * admin.c (admin): Take out writelocks not readlocks. This has + been a bug "forever", but may become more noticeable with + rcs_internal_lockfile relying on the writelocks. + +Mon Nov 3 10:17:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_rewrite): Don't write the file if noexec. + * sanity.sh (basica, branches): Test for this. + +Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.h (struct deltatext): Comment text and log fields. + + * admin.c (admin_fileproc): Call RCS_reparsercsfile not + RCS_fully_parse. Don't muck with ->other field in RCSVers (it + doesn't need to be set). + * rcs.h, rcs.c (RCS_reparsercsfile): No longer static. No point + in having this static when RCS_rewrite and RCS_fully_parse are not. + * rcs.c (getdelta): Remove obsolete comment about not storing the + newphrases from the deltas, since we now do. + +Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + and Paul Eggert + + * rcs.c (rcs_internal_lockfile): Clarify the comments about O_EXCL + and such matters. + +Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_delete_revs): Pass force_tag_match to RCS_settag. + * sanity.sh (basica-o2a, basica-o2b): Test for this. + +1997-11-01 Peter Brandstrom <d91-pbr@nada.kth.se> + + * sanity.sh: Use ${username} more places. + +Sat Nov 1 00:14:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (rcs_internal_lockfile): Add comments about what we are + trying to accomplish here (versus what RCS tries to accomplish). + + * rcs.c (RCS_parsercsfile_i): Clarify/expand comment about + the purpose of having both this and RCS_reparsercsfile. + (RCS_rewrite): Add comment about how this works. + + * admin.c (admin_fileproc): Add comment about call to + RCS_fully_parse not RCS_reparsercsfile. + * rcs.h: Comment on what delta_pos field of struct rcsnode is. + +Fri Oct 31 16:38:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + and Abe Feldman + + * client.c (update_entries): If UTIME_EXPECTS_WRITABLE, if + necessary change the file to be writable temporarily to set its + modification time. + +Thu Oct 30 17:42:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * admin.c (admin): Deal with new :: syntax for ranges. + * rcs.c, rcs.h (RCS_delete_revs): New arg inclusive (set for the old + behavior, clear to enable new code). + * admin.c (admin_fileproc): Set it if :, clear it if ::. + * sanity.sh (basica, head, branches, log): Add tests for this feature. + + * admin.c (admin_fileproc): Clean up the error message which + happens if one of the RCS_* functions returns an error status; it + is confusing to say that "rcs" failed now that this is implemented + internally. + * sanity.sh (admin): Update accordingly. + +Wed Oct 29 07:07:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (admin-22-o24): New test, tests that admin -o + correctly munged the deltatexts on a branch too. + + * rcs.c (RCS_delete_revs): If we are deleting an entire branch, + delete the node in ->branches rather than setting the ->key to the + bogus value NULL. + * rcs.c (RCS_delete_revs): If "rev1" equals "branchpoint", then set + "before" to the revision on the trunk that we branch from. + * rcs.c (RCS_delete_revs): Don't set rev2 to revp->version (the + code is missing an xstrdup, but it doesn't matter because rev2 + isn't used after this point). + * sanity.sh (binfiles2-o2 to binfiles2-o4): New tests, for this. + +Tue Oct 28 19:30:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_delete_revs): Restore code which passes rev2 to + RCS_getbranchpoint if rev1 is NULL; it still makes sense for the + non-trunk case. Fixes admin-22-o22 in testsuite. + + * sanity.sh (admin-18): Adjust to reflect "rcs failed" no longer + being suppressed by global -q option. + + * rcs.c (RCS_delete_revs): If rev1 == NULL and rev2 is on the + trunk, handle it the same way we do everything else--by swapping + the two. This replaces the code which tried to kludge what we + passed to RCS_getbranchpoint (which didn't work). + * sanity.sh (binfiles2-o1 to binfiles2-o4): New tests, for this fix. + * admin.c (admin_fileproc): Don't have -q global option suppress + "rcs failed" message. + +1997-10-28 Jim Kingdon + + * log.c (printlock_proc), rcs.c (putlock_proc): Prototype. + * rcs.c (rcs_internal_lockfile): Only try to call fchmod if + HAVE_FCHMOD is defined. + +Tue Oct 28 10:27:03 1997 Ian Lance Taylor <ian@cygnus.com> + + * rcs.c (RCS_deltas): Don't use \? in string if __STDC__ is not + defined. + + * rcs.c (make_file_label): Remove extraneous `+'. + +Mon Oct 27 14:40:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * status.c (status): Don't pass SEND_NO_CONTENTS to send_files. + +Sat Oct 25 00:33:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_delete_revs): Use : not - for range in error message. + + * rcs.h: Add comment about '\0' in RCS fields. + + * rcs.c (getdelta): Add comment about branches and next field + being mandatory. + + * rcs.c (RCS_reparsercsfile, RCS_deltas), sanity.sh (reserved): + Reindent sections which were misindented as a result of recent + changes. + +Fri Oct 24 10:22:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_findlock_or_tip): Don't worry about file ownership + and nonstrict locking when returning the default branch or head. + The most conspicuous problem with the old code is that in the + error case it would examine rstat.st_uid when it had not been + set. For a discussion of more fundamental reasons, see comment. + + * admin.c (admin_fileproc): In handling -A, don't handle relative + pathnames differently from absolute pathnames. See comment for + rationale. If problem opening the file, give a nice error not a + coredump. + * sanity.sh (admin-19a-admin, admin-19a-log, admin-19a-fix): + New tests, test for traditional "cvs admin -A" behavior with + relative pathnames. + * sanity.sh (admin-19a-nonexist): Test for the core dump fix. + * sanity.sh (admin-22-o1): Look for ${PROG} not cvs. + + * sanity.sh (reserved-16): Remove commitinfo change with "cvs + commit" not "cvs admin -o". In addition to commit being The Right + Thing on general principles, cvs admin -o doesn't work because it + doesn't rebuild the administrative file database. + + * update.c (patch_file): If the first revision does not exist in + the RCS file, fall back to sending entire file. Fixes + admin-22-o15 in make remotecheck. + +1997-10-23 enami tsugutomo <enami@but-b.or.jp> + + * rcs.c (RCS_checkin): Unlink temporary files stored in variable + `tmpfile' and `changefile'. + +Wed Oct 22 12:16:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (rcs_lockfilename): Allocate enough memory for terminating + '\0'. + + * admin.c (admin_fileproc): Don't support '-' for ranges in "cvs + admin -o". + (admin): Adjust comment. + + * rcs.h (RCSVers): New field other_delta. + * rcs.c (free_rcsvers_contents): Also free other_delta. + (getdelta): Read newphrases from deltas into other_delta field. + (putdelta): Write those newphrases. + * sanity.sh (rcs-8a): New test, for this fix. + * admin.c (admin_fileproc): If "-b" without argument, then set + branch to NULL, not "" (uncovered by rcs-8a test). + * rcs.c (putrcsfield_proc): Add comment about how we (mis)handle + values in newphrases. + + * sanity.sh (reserved): Instead of looking for rcslock.pl in CVS + distribution, just use our own equivalent. + + * rcs.c (RCS_rewrite): Call ferror before fclose to avoid "Invalid + argument" warnings. + +Mon Oct 20 00:30:16 1997 Tim Pierce <twp@twp.tezcat.com> + + [I removed a ChangeLog entry for a change to sanity.sh (editor), + because the actual change was not made. With this change, CVS no + longer runs RCS. I'll be checking in my cleanups shortly. -kingdon] + + Librarify `ci'. + * rcscmds.c, cvs.h (RCS_checkin): Removed. + * rcs.c, rcs.h (RCS_checkin, RCS_getbranchpoint, RCS_addbranch, + RCS_findlock_or_tip): New functions. RCS_checkin completely + rewritten to eliminate RCS 5.7; change `rcs' parameter from string + to RCSNode, so we can update RCSNode without re-reading from + disk. + * checkin.c (Checkin): Updated RCS_checkin caller, moved RCS_parse + call to before RCS_checkin. + * import.c (add_rev): Updated caller. + * commit.c (remove_file): Updated caller. + (checkaddfile): Updated caller. Parse `rcsfile' after + calling add_rcs_file. Free `rcsfile' instead of asserting it to + be NULL. + + Librarify `rcs'. + * rcscmds.c, cvs.h (RCS_exec_settag, RCS_exec_deltag, + RCS_exec_setbranch, RCS_exec_lock, RCS_exec_unlock): Removed. + + * rcs.c (RCS_settag): Rewritten to eliminate RCS 5.7. + * commit.c (checkaddfile): Call RCS_rewrite after calling RCS_settag. + * import.c (add_tags): Same. + * rtag.c (rtag_fileproc): Same. + * tag.c (tag_fileproc): Same. + + * rcs.c (RCS_deltag): Rewritten to eliminate RCS 5.7. Remove + `quiet' parameter, since this function no longer prints any output. + * commit.c (remove_file): Update caller. Also call RCS_rewrite + after RCS_deltag. + * rtag.c (rtag_delete): Same. + * tag.c (tag_fileproc): Same. + + * rcs.c (RCS_setbranch): Rewritten to eliminate RCS 5.7. + * commit.c (remove_file): Call RCS_rewrite after calling RCS_setbranch. + (fixbranch): Same. + (lock_RCS): Same. + + * rcs.c (RCS_lock): Rewritten to eliminate RCS 5.7. Change third + arg to mean `quiet' and not `noerr', permitting admin_fileproc to + run RCS_lock verbosely. + * commit.c (lock_RCS): Update callers; call + RCS_rewrite after RCS_lock. + (remove_file): Same. Call RCS_lock quietly. + * import.c (add_rev): Same. Do not print `fork failed' error + message, since we're no longer forking. + + * rcs.c (RCS_unlock): Rewritten to eliminate RCS 5.7. Change + `noerr' arg to mean `quiet', permitting admin_fileproc to run + RCS_unlock verbosely. Use notify_do when breaking another user's + lock. Include "edit.h" for notify_do prototype. + * checkin.c (Checkin): Update caller; use RCS_rewrite after RCS_unlock. + * commit.c (unlockrcs): Same. + * import.c (add_rev): Same. + + * rcs.c, rcs.h (RCS_getlocks, RCS_addaccess, RCS_delaccess, + RCS_getaccess, RCS_delete_revs): New functions. + (expand_keywords, RCS_lock, RCS_unlock): Use RCS_getlocks. + * log.c (log_fileproc, log_version): Call RCS_getlocks. Don't add + bogus ";locker" nodes to RCSVers nodes -- walk lock list with + printlock_proc. + (printlock_proc): New function. + + * admin.c (admin_fileproc): Largely rewritten: call internal RCS + library functions instead of forking RCS processes. + (admin, admin_fileproc): Obsolete -V option. + (struct admin_data): Remove `version' member. + * sanity.sh (admin-24): Remove -V test case. + + New functions for reading and writing RCS files. + * rcs.h (struct deltatext, Deltatext): New types. + (struct rcsversnode): New members `text' and `outdated'. + (struct rcsnode): New members `access', `locks', `strict_locks', + `comment', and `desc'. + * rcs.c (RCS_reparsercsfile, expand_keywords): Use new RCSNode members. + (free_rcsnode_contents): Free them. + * log.c (log_fileproc): Use new RCSNode members instead of ->other. + + * rcs.c (getdelta, RCS_getdeltatext, freedeltatext, do_locks, + RCS_putadmin, RCS_putdtree, RCS_putdesc, putdelta, + putrcsfield_proc, putsymbol_proc, RCS_copydeltas, putdeltatext, + RCS_rewrite, getrevnum, rcs_internal_lockfile, + rcs_internal_unlockfile, rcs_lockfilename): New functions. + + (RCS_reparsercsfile): Use getdelta, making sure fp is positioned + correctly before calling it. Skip `head' and `branch' nodes: we + have already parsed them, and they were being added incorrectly to + rcs->other. Do not signal error if the RCS file has an empty + delta tree; this made it impossible for RCS_checkin to perform an + initial checkin. Remove `all' parameter; always store all RCS + fields. + (RCS_fully_parse, RCS_gettag, RCS_getbranch, RCS_getdate, + RCS_getdatebranch, RCS_getrevtime, RCS_symbols, translate_symtag, + RCS_isdead, RCS_getexpand, RCS_checkout, annotate_fileproc): + Update all callers to remove `all' parameter. + + (getrcskey): Do not append trailing whitespace to a value. This + corrupted some log fields and wrecked some sanity.sh test cases. + + (free_rcsvers_contents): New function. + (rcsvers_delproc): Call it. + + * rcs.h (NODELTA): Removed symbol; now obsolete (since RCSNodes + do not go stale). + * import.c (add_rev): Removed NODELTA reference. + * rcs.c (RCS_reparsercsfile, RCS_checkout, RCS_settag, RCS_deltag, + RCS_setbranch, RCS_lock, RCS_unlock, RCS_deltas): Removed NODELTA + references. + + Miscellaneous changes to support RCS librarification and fix some bugs. + * subr.c, cvs.h (line2argv): Add `sepchars' argument. + * modules.c (cat_module, admin_fileproc): Update all callers. + + * subr.c, cvs.h (compare_revnums, increment_revnum): New functions. + (make_message_rcslegal): Strip whitespace from end of + lines and end of string, a la `cleanlogmsg' in RCS 5.7. + (get_file): Terminate buf with \0, extending it if + necessary. Read from stdin if `name' arg is NULL. + * admin.c (admin_fileproc): Call get_file to read -t arg from stdin. + + * error.c, error.h (rcserror): New function, used everywhere. + + * hash.c, hash.h (addnode_at_front): New function. + * rcs.c (RCS_settag, RCS_lock): Call it. + + * import.c, cvs.h (expand_at_signs): Make extern. + * rcs.c (putrcsfield_proc, RCS_putadmin, RCS_putdesc, + putdeltatext): Call it. + + * rcs.c (make_file_label): Use last_component to get file's basename. + + * sanity.sh (srcdir): New variable. + (rcs-7): Remove newphrase warning, no longer produced by CVS. + (rcs-8): Permit random whitespace around newphrase fields. + (admin-22): New test cases for -o options: admin-22-o{1..23}. + (reserved): New test cases for rcslock.pl: reserved-{8..16}. + +Tue Oct 21 16:48:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * tag.c (tag_check_valid): Add comment about locking or lack + thereof. + +1997-10-20 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.19. + +1997-10-19 Jim Kingdon + + * Version 1.9.18. + +Wed Oct 15 15:21:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (username): Add '-' to characters allowed in user name. + + * rcscmds.c (diff_exec): Remove item about external diff + programs. It doesn't really belong here now that diff is + librarified and TODO #191 now mentions this. + + * checkout.c (checkout_proc): Add comment about assuming '/' is + the only path separator. + * options.h.in: Fix thinko (CVS/Repository -> CVS/Root). + +Mon Oct 13 22:46:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * commit.c (commit): Add comment about CVS_BADROOT and command + other than "commit". + +1997-10-11 Noel Cragg <noel@swish.red-bean.com> + + * options.h.in: RELATIVE_REPOS has been checked for bitrot -- it + now works again. Change the comment before the #define to say + that we'll be switching to it soon. + + * sanity.sh (basicb-1, basicb-1a): update dotest strings to match + no matter if we're running with RELATIVE_REPOS defined or not. + (basicb-9b, basicb-9c): same. + + * sanity.sh (basicb-9b, basicb-9c): modified tests, since the + checkout.c fix changes the way this test module is checked out. + (basicb-9d, basicb-9e, basicb-9f): new tests, same. + (basicb-18): modify test, same. + (cvsadm): new set of exhaustive tests to check the contents of + CVS/Root and CVS/Repository files under various conditions. As a + side effect, it tests the behavior of the "-d" flags (command line + and modules file). + (modules3-7e through modules3-7h): removed, since these tests were + a small subset of what is tested in the new cvsadm section. + (modules-1b, modules-1c): same. + (modules-2b, modules-2c): same. + (modules-3b, modules-3c, modules-3e, modules-3f): same. + + * create_adm.c (Create_Admin): be a bit more verbose when using + trace mode. + + * checkout.c (checkout_proc): rewrote the code that sets the where + variable and the code that matches directory names with repository + directories. This fixes a long-standing bug in CVS. (It used to + be the case that "cvs co -d foo <mod1> <mod2>" would not properly, + where <mod1> and <mod2> where defined in the modules file. While + the first module would be checked out correctly, the second would + be checked out under the name of the directory to which the module + referred rather than the module name!). This fix also allows us + to check out things into directories that are more than one deep + (e.g. "cvs -d foo/bar/baz co blah" will now work). + (checkout): remove code that performed a CHDIR if the + number of arguments specified was greater than one, since it's no + longer necessary. Also remove the code that prevented us from + doing "cvs co -d <dir1>/<dir2>" without <dir1> existing, since + checkout_proc handles things correctly now. + + * cvs.h: fix typo. + + * rtag.c (rtag): reformat so that we don't run over 80 characters + per line. + (rtag_dirproc): same. + + * sanity.sh: change all old test cases to use pass and fail + functions rather than doing some combination of echo and exit + themselves. + + * commit.c (commit_direntproc): remove the "warm fuzzy" -- this + code never gets called when running in client/server mode, and we + should have CVS' output match as much as possible between the two + modes. Moreover, there is no analogous place to put this same + message when we're running in c/s mode. + (find_direntproc): print the same "fuzzy" as in check_direntproc + so that local and c/s mode have the same messages. + * sanity.sh (187a3): update test case to reflect the above. + +Thu Oct 9 10:57:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * parseinfo.c (parse_config): Add comment about compatibility + issues with adding keywords. + +Wed Oct 8 16:40:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * recurse.c (do_dir_proc), commit.c (check_direntproc, + commit_direntproc, find_dirent_proc): If this + directory doesn't exist, skip it. + * diff.c (diff_dirproc): Reindent. + * sanity.sh (deep-4b0a, deep-4b0b): Check for this fix. + +Thu Sep 26 16:30:00 1997 Larry Jones <larry.jones@sdrc.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (checkout_file): Don't set timestamp in noexec mode. + * vers_ts.c (Version_TS): Add comment about ignoring errors from + utime. + * sanity.sh (conflicts3): New tests, for this fix. + +Fri Oct 3 09:47:04 1997 Noel Cragg <noel@swish.red-bean.com> + + * sanity.sh (168): use PROG instead of CVSBASE, since they are + equal. + (importb-2): refer to PROG instead of "cvs" in error message. + + * add.c (add): use PROGRAM_NAME in the error message rather than + "cvs". + * classify.c (Classify_File): same. + * commit.c (find_fileproc): same. + * sanity.sh: change all add notification messages to refer to PROG + rather than "cvs". Fixed nasty quoting in several places at the + same time, replacing older "'command'" forms with newer + ".command." for simplicity. + +Sat Sep 27 01:37:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (rcslib-merge-8): Accept "P file1" as well as "U file1". + +Fri Sep 26 22:24:10 1997 Noel Cragg <noel@swish.red-bean.com> + + * create_adm.c (Create_Admin): assign our duplicate pointer `cp' + after the xrealloc of `reposcopy' because the latter might have + changed addresses. + +Fri Sep 26 14:25:59 1997 Tim Pierce <twp@twp.tezcat.com> + + * run.c (call_diff): Don't reset optind; this is done by diff_run now. + + Librarify rcsmerge/diff3. + * rcscmds.c, cvs.h (RCS_merge): Rewritten from scratch: check out + selected files and diff3 them. Take new `rcs' and `workfile' + arguments, so we can resolve symbolic tags and manipulate the + working file. + * update.c (merge_file, join_file): Update RCS_merge calls. + * run.c, cvs.h (call_diff3): New function. + + * sanity.sh (rcslib): New tests, rcslib-merge-{1..13}. + +Fri Sep 26 22:59:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * create_adm.c (Create_Admin): Fix thinko in Noel's change: keep + track of the originally allocated "cp" and free it, rather than + calling free on a pointer which may point halfway into the allocation. + * repos.c (Sanitize_Repository_Name): Per HACKING, assert that + repository != NULL, rather than just silently returning if NULL. + Reindent a line. + +Fri Sep 26 15:40:00 1997 Noel Cragg <noel@swish.red-bean.com> + + * sanity.sh (modules): add tests modules-[123]* that make sure the + administrative files get rebuilt in various cases. + + * add.c (combine_dir): removed function, since we no longer need + to worry about stripping the "." path element out. Changed the + two callers to simply concatenate their two arguments. + + * recurse.c (do_dir_proc): don't bother trying to strip off "." in + the repository name since the below changes fix that behavior -- + simply concatenate the repository and directory names together. + + * checkout.c (checkout_proc): sanitize the repository name after + constructing it (we may create "/path/to/repos/.", but we don't + want that to be passed around). Remove the code that tacks on + "/." when constructing top_repository, since the below changes fix + that behavior. Added comments to the part of this function that + builds administrative files. + + * sanity.sh (basicb): now that the below weirdness is fixed, the + extra "." path element in test basicb-0c doesn't appear when a + top-level file is checked out. Remove it from the expect string. + + * create_adm.c (Create_Admin): now that the repository name isn't + floating around with "." as the last path element, make creation + of the top-level administrative files a special case -- save the + repository name as "/path/to/repos/." Why? I considered not + including the "." but didn't know how it would affect the remote + protocol when RELATIVE_REPOS was defined (do we have a way of + sending "" via the protocol?). After I make sure that the + RELATIVE_REPOS patches still work, I'll check the "" possibility + so we don't have to have a this special case. + + * repos.c (Sanitize_Repository_Name): new function that removes + (if present) the trailing slash and "." component from the + repository name. Many routines break if we don't guarantee this. + See the comment before the function for complete information. + (Name_Repository): call Sanitize_Repository_Name before returning + the value. + * cvs.h: add prototype for Sanitize_Repository_Name. + +Fri Sep 26 14:19:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.h (CVS_CMD_USES_WORK_DIR): Fix comment (the sense of the + flag is not reversed from what it would seem; when I thought so it + was because I was misreading the lookup_command_attribute code). + +Thu Sep 25 23:14:47 1997 Noel Cragg <noel@swish.red-bean.com> + + * parseinfo.c (Parse_Info): fix typo in the trace message. + +Thu Sep 25 14:22:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * build_src.com: Also link with diff.olb. + + * main.c (Make_Date): If gmtime returns NULL, try localtime. + +Wed Sep 24 19:18:40 1997 Noel Cragg <noel@swish.red-bean.com> + + * checkout.c (checkout): fix typo in comment. + +Wed Sep 24 08:31:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (patch_file): Revise comments about diff -a now that + diff is librarified. + +Sun Sep 21 21:28:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (call_diff): Sleep for a second, in hopes of helping with + out of order bugs. + +Sat Sep 20 07:19:18 1997 Tim Pierce <twp@twp.tezcat.com> + + Integrate diff library into CVS. + * run.c, cvs.h (call_diff): New function. + * rcscmds.c (diff_exec, diff_execv): Get diffs from call_diff + instead of running diff as a subprocess. + * Makefile.in (cvs): Add ../diff/libdiff.a. + + * diff.c (longopts, diff): Use 131 for --ifdef, fixing Jim's thinko + (using 147 for both --side-by-side and --ifdef). + + * sanity.sh (rcslib): Added tests rcslib-diffrgx-*, to test + handling of regex diff options. + +1997-09-21 Jim Kingdon <kingdon@harvey.cyclic.com> + + (Note that this requires that DIFF support -L. I'll be checking + in a fix to that in a moment, but I wanted separate checkins in + case that helps with clarity). + Tweaks to rcsdiff librarification: + * sanity.sh (rcslib): Change "cvs" to "${PROG}" and subcommand + names (e.g. "add") to "[a-z]*". Former should deal with ${testcvs} + being "cvs.old" or something; latter fixes make remotecheck. + * rcs.c (make_file_label): Take into account strlen (rev) when + allocating space. Removes a FIXME and probably fixes a buffer + overrun security hole. + * rcscmds.c (RCS_exec_rcsdiff): Remove #if 0'd code to call + rcsdiff. Tim says he has compared the new code with rcsdiff code + and is confident that the behavior is preserved, so we need to + nuke the comment which says this has not been done. #if 0 isn't + really a very good way to document the way it used to work anyway; + the old code is still in CVS. + * diff.c: Add comment about rcsdiff options that we don't support, + which Tim had sent in email. Remove -T and -y, as the + previous meaning had been very confused. + +1997-09-21 Tim Pierce <twp@xochi.tezcat.com> + + Librarify rcsdiff. + + * diff.c (have_rev1_label, have_rev2_label): New variables. + (diff): Generate file labels with make_file_label if necessary; + pass labels, revisions and working file name to RCS_exec_rcsdiff. + * rcscmds.c, cvs.h (RCS_exec_rcsdiff): Completely revised function + to eliminate rcsdiff dependency, based on patch from JimK. + (diff_execv): New function, to exec diff with explicit -L args. + * rcs.c, rcs.h (make_file_label): New function. + (RCS_output_diff_options): New function. + * sanity.sh (rcslib): New test. + +Fri Sep 19 15:08:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_nodeisbranch): Assert that RCS is non-NULL. + * commit.c (remove_file), rcs.c (RCS_getversion), rtag.c + (rtag_fileproc), status.c (status_fileproc, tag_list_proc), tag.c + (tag_fileproc): Call RCS_nodeisbranch not RCS_isbranch + in contexts where we know the RCS argument is non-NULL. + + * commit.c (find_fileproc): Pass tag not NULL to Version_TS for + the tag. + * vers_ts.c (Version_TS): Improve (somewhat) the introductory + comment. + * sanity.sh (editor): New test editor-9 tests for above fix. + Renumber/tweak surrounding tests to fit. + + * log.c (log_version): If p->data is NULL, it is an empty log + message. + * sanity.sh (rcs-14): New test, tests for above fix (previously + this was a coredump). + +Thu Sep 18 08:45:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (rcs-7): Fix stupid ${TESTDIR} omission. + +Wed Sep 17 16:27:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (rcs): New tests rcs-5 through rcs-13 test for + getdate.y fix (rcs-12 and rcs-13 both failed with the buggy + getdate.y). + +Tue Sep 16 00:07:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (editor): Clean up first-dir at end of test. + + * sanity.sh (editor): New tests test do_editor. + + * commit.c (commit): For the client, if we got the log message + from do_editor and there was an error, don't toss the message. + +Mon Sep 15 14:27:54 1997 martin.sjoelin@ubs.com + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (RCS_checkout): fwrite in bite-size pieces, not the whole + file in one fwrite. + +Sun Sep 14 12:23:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * commit.c (check_fileproc): If the file has "conflict + indicators", spit a warning and proceed with the checkin. + * sanity.sh (conflicts): Adjust tests conflicts-132, + conflicts-status-3, conflicts-133, and conflicts-status-4 + for new behavior. + +Fri Sep 12 11:12:34 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c, admin.c, checkin.c, checkout.c, classify.c, commit.c, + create_adm.c, cvsrc.c, diff.c, entries.c, find_names.c, hash.c, + import.c, lock.c, log.c, logmsg.c, main.c, modules.c, myndbm.c, + no_diff.c, parseinfo.c, patch.c, rcs.c, rcscmds.c, recurse.c, + remove.c, repos.c, root.c, rtag.c, status.c, subr.c, tag.c, + update.c, vers_ts.c, hash.h, rcs.h, options.h.in: Change "CVS 1.4 + kit" to "CVS source distribution". + + * sanity.sh: Comment out call to "whoami". + +Thu Sep 11 10:09:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * commit.c (classify_file_internal): Add comment about saving + quiet vs. saving really_quiet. + + * sanity.sh (newb-123j0): Use two regexps instead of assuming that + expr has "\(", "\|", and "\)". If we want to require the latter, + we should check for it up front, rather than let people get + halfway through and wonder why the test failed. + +Tue Sep 9 19:22:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * expand_path.c (expand_path): If GETPWNAM_MISSING is defined, + just give an error instead of calling getpwnam. + + * subr.c (getcaller): If SYSTEM_GETCALLER is defined, call it + instead of all the getlogin/getpwuid/etc. + * wrapper.c (wrap_setup): Call get_homedir not getpwuid. + +Mon Sep 8 17:54:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicc): Change ls -1 to echo *; according to + larry.jones@sdrc.com, ls -1 isn't portable. + +Sun Sep 7 07:45:35 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basic2): In test basic2-64, match usernames with + ${username}. + + * root.c: Reindent a few things. + * root.c, cvs.h (same_directories): Remove. Never used, + portability hassle. + + * add.c (add_directory): When checking for CVSADM, call fncmp not + strcmp. I actually suspect this code doesn't do much these days, + but fncmp clearly will make more sense than strcmp. + + * rtag.c (rtag_usage), tag.c (tag_usage): Reword to hopefully be + clearer that -r takes either numeric or symbolic revision. + + * ignore.c (ign_dir_add, ignore_directory): Reindent. Tweaks to + comments. + + * update.c (checkout_file): Only ignore existence_error from + unlink_file_dir, not all errors. + + * checkout.c (safe_location): Check for errors from xgetwd. + * create_adm.c (Create_Admin): Remove call to xgetwd; it is just + debugging code anyway and it wasn't checking for errors. + + * sanity.sh: Add comment about default value for TESTDIR. + + * server.c (serve_log): Change "cvslog" to "log". This + (accidental, I presume) error had made it impossible for anonymous + users to run "cvs log". + + * classify.c (sticky_ck): Change to take an finfo argument rather + than several arguments taken from there. Cleans up the way the + calling convention had depended on SERVER_SUPPORT. + (Classify_File): Change callers. + + * version.c: Change version number to 1.9.17. + + * Version 1.9.16. + + * recurse.c (do_dir_proc): In combining repository and dir, omit + trailing "/." from repository. + * sanity.sh (modules3): Adjust test modules3-4 so we test for + this fix (this is not just cosmetic; the bug prevented the + "Rebuilding administrative file database" from happening). + modules2 already tests the "co CVSROOT/modules" usage. + + * checkout.c (checkout_proc): When building top-level CVSADM + directory, continue the process of walking up the repository one + more level, rather than putting in the same repository as for the + first-level directory. + * sanity.sh: Adjust tests basicb-1b, basicb-9b, modules3-7f, + toplevel-9, and toplevel-11 to test for this fix. + + (For reference, this takes CVS's text segment from 344460 to + 344140 bytes. I know, this may seem unimportant, but it is so + unusual for programs to shrink and I think it is so cool when they + do without losing functionality/clarity/etc). + * checkout.c, cvs.h (emptydir_name): New function. + * checkout.c (checkout, checkout_proc), modules.c (do_module): + Call it instead of duplicating the code to do that. + + * sanity.sh (basicc): Clean up first-dir at end of test. + +Sat Sep 6 09:48:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (join): Fix cut and paste error in join-28 + (/home/kingdon/... -> ${TESTDIR}). + + * recurse.c (start_recursion): If there is no CVSADM and no + subdirectories, give an error. + * sanity.sh (basicc): New tests, test for this fix. + + * sanity.sh (join): New tests join-25 through join-29 test merging + from one branch to a different branch. + + * release.c: In comment about CVSROOTADM_IGNORE, also mention + comment just added to entries.c. + * entries.c: Expand this comment, especially the part about + CVS/Template. + + Keep track of what revisions CVS/Base correspond to: + * cvs.h (CVSADM_BASEREV, CVSADM_BASEREVTMP): Added. + * entries.c, cvs.h (base_register, base_deregister, base_get, + base_walk): New functions. + * edit.c (edit_fileproc): Call base_register when setting up CVS/Base. + (unedit_fileproc): When taking a file out of CVS/Base, put its + revision back into entries, and base_deregister it. + * sanity.sh (watch4): New tests watch4-10 through watch4-18 test + for above fix. + +Fri Sep 5 09:14:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c: Only declare start_rsh_server if we are going to + define it (!NO_EXT_METHOD). + + * subr.c, cvs.h (check_numeric): New function. + * admin.c (admin): Call it. + * sanity.sh (admin): New tests admin-10a and admin-10b test for fix. + +Thu Sep 4 15:55:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (binwrap2): New tests, test for the ability to specify + all files are binary except certain patterns. + + * sanity.sh (modules3): New tests modules3-16 and modules3-17 test + for another behavior involving '/' in a module name. + +Sun Aug 31 12:03:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add): Remove checks for '/' in pathnames. + (add): Move code which handles entries and repository inside loop, + since these now might be different for each argument. Add code to + set finfo.update_dir, finfo.file, and finfo.fullname appropriately + even if pathname contains '/'. Replace user variable with + finfo.file or finfo.fullname, depending on which is meant. chdir + into update_dir for each argument. Likewise for the client code + which creates directories. + (add_directory): Replace arguments with a single finfo argument. + Replace dir with finfo->fullname as needed. + (add): Update call to add_directory. + * client.c, client.h (send_a_repository): No longer static. + * sanity.sh (errmsg2): Adjust tests to test for '/' in pathname. + + * sanity.sh (errmsg2): New tests errmsg2-13 through errmsg2-16 + test the status quo with respect to '/' in cvs add argument. + +Sat Aug 30 17:37:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (run_popen): Add comment on return value. + * release.c (release): Check for NULL return from popen. + +Fri Aug 29 17:49:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (get_server_responses): Add comment about "ok^M". + +Thu Aug 28 13:35:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * edit.c (edit_fileproc): If file doesn't exist, give an error. + * sanity.sh (devcom2): Tests devcom2-12 through devcom2-17 test + for above fix. + +Tue Aug 26 16:42:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * subr.c (xmalloc): Reword error message to clarify that memory, + not disk space or some other resource, is in question. + +Tue Aug 26 01:04:48 1997 Steve Ralston <sralston@ppdpost.ks.symbios.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add_directory): In allocating message, also allocate + enough for tag and date related text. + +Tue Aug 26 01:04:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (update_dirent_proc): Use update_dir not dir in "new + directory" message. + * find_names.c (find_dirs): Skip CVSNULLREPOS. + (Find_Directories): Add comment about find_dirs skipping CVSATTIC + and CVSLCK in working directories. + * sanity.sh (basicb): New tests basicb-edir-* test for find_dirs + fix. Change other tests to test that Emptydir is not special in + non-CVSNULLREPOS contexts. + +Sun Aug 17 14:44:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * import.c (add_rcs_file): Add comment about -k overriding wrappers. + +Sat Aug 16 18:09:05 1997 Martin Sjoelin <martin.sjoelin@ubs.ch> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * import.c (add_rcs_file): Before opening the input file + when importing, if options is binary, open the file in + binary mode. + +1997-08-16 enami tsugutomo <enami@ba2.so-net.or.jp> + + * sanity.sh (mcopy): Unset CVSWRAPPERS last of all. + +Fri Aug 15 11:11:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add_directory): Copy default file attributes from the + parent directory to the directory we are creating. + * fileattr.h, fileattr.c (fileattr_getall, fileattr_setall): + New functions, in support of above. + * fileattr.c (fileattr_free): Add comment about fileattr_write + maybe not clearing attrs_modified. + * sanity.sh (watch4): New test, tests for above fix. + +Thu Aug 14 11:08:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (merge_file, join_file): If wrap_merge_is_copy, treat + files as nonmergeable (as we had been treating binary files). + (join_file, update_fileproc): Remove previous wrap_merge_is_copy + cruft. + * sanity.sh (mcopy): New tests, test for above fix. + (binfiles2): New tests binfiles2-9a-* correct an oversight. + (binfiles, binfiles2): Adjust to reflect wording change from + "binary file" to "nonmergeable file". + (mwrap): Adjust tests mwrap-8 through mwrap-10 for new behavior. + + * main.c (main): Reword copyright notices to include the latest + year, to refer to "other authors" in addition to the ones listed, + and to be more concisely formatted. + +Wed Aug 13 13:50:00 1997 Larry Jones <larry.jones@sdrc.com> + + * sanity.sh: Replace hard-coded directory with ${TESTDIR}, add + join3 to default tests + +Wed Aug 13 11:42:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcscmds.c: Adjust comment to reflect progress on removing RCS + execs outside this file. + +Mon Aug 11 10:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * vers_ts.c (Version_TS): If vers_ts->vn_rcs == NULL, skip setting + modification time in server case as well as local case. + * server.c (server_modtime): Add assertion to clarify that caller + must assure that vers_ts->vn_rcs != NULL. + * sanity.sh (join3): Add file "file2" to test for above fix. + + * modules.c (save_d): When parsing -s option, don't assume that + we will hit a space before we hit the '\0'. + (struct sortrec): Document allocation policies (status quo except + status field is now malloc'd). + (cat_module): No longer need to set the '\0' at the end of the + status field back to ' ', as it no longer shares storage with the + rest field. + * sanity.sh (modules): Add "statusmod" to test for above fix. + +Sun Aug 10 12:18:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Remove TODO item about more keyword expansion tests. + The keyword test and others cover it pretty well, and such an item + isn't useful unless it is specific. + + * sanity.sh (importb): New tests test "cvs import -b". + + * mkmodules.c: Update comment with more reasons why having + CVSROOT/passwd be a regular administrative file would be a Bad + Idea. + + * server.c (switch_to_user): Add comment about checking for errors + from setuid and friends. + +Wed Aug 6 13:48:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (main): Add comment about errors writing CVS/Root in + need_to_create_root code. + +Tue Aug 5 22:05:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * entries.c (write_entries): If trouble writing Entries.Backup, + make it a warning not an error. + +Wed Jul 30 08:42:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * parseinfo.c (parse_config): If AUTH_SERVER_SUPPORT is not + defined, don't set system_auth. + + * version.c: Change version number to 1.9.15. + + * Version 1.9.14. + + * create_adm.c, cvs.h (Create_Admin): If new argument WARN is set, + then make creating the CVS directory itself a warning not a fatal + error. New return value indicates whether we did this. + * checkout.c (build_one_dir), client.c (call_in_directory): + Pass WARN as one. + * add.c, client.c, checkout.c, modules.c, update.c: Pass WARN as + zero for all other Create_Admin callers. + * sanity.sh (toplevel): New test toplevel-12 tests for this fix. + * filesubr.c (mkdir_if_needed): Also check EACCES/isdir. Needed + to make toplevel-12 test work. + + * sanity.sh (toplevel): New test toplevel-11 and friends test for + another variation of the toplevel-9 bug. + +Tue Jul 29 12:11:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * login.c (construct_cvspass_filename): Revert this change. The + main reason is procedural; Karl is not a current CVS developer. + The other thing is that the new text doesn't say anything about + HOMEDRIVE and HOMEPATH. + +Tue Jul 29 11:36:22 1997 Karl Fogel <kfogel@harvey.cyclic.com> + + * login.c (construct_cvspass_filename): error message informs user + she may need to set HOME environment variable by hand. + +Sun Jul 27 15:36:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * admin.c (admin): Remove comment "XXX send -ko too with i = 0". + It turns out to be a description of a bugfix which was applied on + 8 Oct 1995, and never should have been in a comment in the first + place. + + * admin.c (admin, admin_fileproc): Parse options ourself rather + than blindly passing them to RCS. + Accordingly, add struct admin_data and function arg_add, and delete + global variables ac and av. + * sanity.sh (admin): Change admin-3 test to reflect cvs admin -i + now being an error. + (basicb): Change basicb-21 test to relect the improved error + message here. + +Sat Jul 26 11:34:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (join3): New tests, test a new branch topology and + greatest common ancestor. + +Fri Jul 25 09:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (serve_directory): Repository must start with + CVSroot_directory rather than some random pathname. + + * remove.c (remove_fileproc): If there is a numeric sticky tag, + don't allow the remove. + * commit.c (check_fileproc): Add comment about this case. + * sanity.sh (sticky): New tests sticky-15 through sticky-23 + test for this behavior and the analogous behavior with + non-branch sticky tags (which is unchanged). + + * client.c (update_entries): Clear the stored mode, modtime, and + checksum even on an error. + * sanity.sh (contents2-142d*): Also test cvs status. Also test + the case in which the contents of the file are unchanged. Also + test running diff to see the conflict, and resolving the conflict. + Without the fix above, the new contents2-142d2 test would get a + "duplicate Mod-time" warning. + +Thu Jul 24 13:29:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (pserver_authenticate_connection): Call parse_config + here too. + * parseinfo.c (parse_config): If we are called several times, the + times beyond the first do nothing. + * cvs.h, parseinfo.c (parse_config): New argument cvsroot. + * server.c, main.c: Update callers. + * server.c, server.h (system_auth): New variable. + * parseinfo.c (parse_config): Parse new keyword SystemAuth. + * mkmodules.c (config_contents): Add comments for SystemAuth. + * server.c (check_password): If !system_auth, then skip the check + for a system username/password. + + * main.c (main): No fatal error if parse_config returned an error. + * server.c (serve_root): Likewise. + * error.c (error): Add comment about calling from the server. + * parseinfo.c, cvs.h (parse_config): Remove NOERR crock. + Closer reading of server.c makes it seem like calling error + here is OK after all. + * sanity.sh (config): New test, tests for above fix. + + * server.c (serve_root): Fix typo ("doign" -> "doing"). + +Wed Jul 23 13:55:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * vers_ts.c (Version_TS): If entdata is for a directory, don't set + vn_user and friends. + * server.c (dirswitch): Add comment about why Subdir_Register is + sometimes a noop here. + * cvs.h (struct vers_ts): Fix comments about NULL vs. "" in vn_user. + * sanity.sh (errmsg2): New tests errmsg2-10 through errmsg2-12 test + for above fix. + * add.c (add_directory): Call cvs_output not printf. This fixes + an out-of-order bug which was showing up in the testcase. + +21 Jul 1997 Jim Kingdon + + * subr.c (get_file): Put st_size into an unsigned variable to + avoid signed/unsigned warnings. + +Mon Jul 21 00:19:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.13. + + * Version 1.9.12. + + * sanity.sh (toplevel, head): Delete our files from the repository + when done with them. + +Sun Jul 20 15:53:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (admin, reserved): New tests, test most cvs admin + behaviors. + (log2): New tests log2-5 through log2-10 test setting the + description via cvs admin. + +Thu Jul 17 12:39:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (socket_buffer_input, socket_buffer_output): Add + comment regarding size of of buffer we pass to send and recv. + +Sat Jul 12 15:21:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * import.c, rcs.h (add_rcs_file): New argument key_opt replaces + access to global variable keyword_opt. New arguments desctext and + desclen allow one to set the description. If add_vhead is NULL, + then omit a revision, like rcs -i. + * import.c (process_import_file), mkmodules.c (init): Change + callers. + * subr.c, cvs.h (get_file): New function, adapted from code in + update_entries. + * client.c (update_entries): Call it. + * commit.c (checkaddfile): Create new RCS files with add_rcs_file + rather than rcs -i. + +Fri Jul 11 12:14:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (join_file): Handle binary files ourself rather than + passing them to RCS_merge (which sort of tries to handle binary + files, but does so badly). + * sanity.sh (binfile2): New "brmod", "brmod-trmod", and + "brmod-wdmod" tests test for this fix. + + * add.c (add): Exit status is now nonzero if any of the arguments + failed (already was mostly true, make it true for the new sanity + check). Move check for '/' (now ISDIRSEP) up to sanity check, so + the client does it too. + * sanity.sh (errmsg2): Test for this fix. + +Thu Jul 10 00:02:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add): Check for CVSADM, ".", and "..", and skip any + attempt to add them. + * sanity.sh (errmsg2): New tests, tests for above fix. + + * main.c (main): In text printed upon --version, also refer + people to --help. + + * rcscmds.c (RCS_exec_rcsdiff): Add comment about timezones. + + * server.c, cvs.h (cvs_output_binary): New function. + * rcs.c (RCS_checkout): For a binary file, call cvs_output_binary + rather than cvs_output. + * client.c (handle_mbinary): New function. + (responses): Add "Mbinary". + +Tue Jul 8 12:18:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * filesubr.c (get_homedir): Add comment about root vs. user + directory in pserver server. + +Mon Jul 7 14:39:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (big): Also test Rcs-diff case. + + * client.c (update_entries): Reindent a line. + + * sanity.sh (death2): Add comment about Sun diff. Thanks to + Warren Jones <wjones@TC.FLUKE.COM> for reporting this. + + * client.c (update_entries): If DONT_USE_PATCH, then just treat a + Patched response as an indication to try again with complete files. + * update.c (update): Remove DONT_USE_PATCH ifdefs, since a CVS + with DONT_USE_PATCH defined can still handle Rcs-diff. + * sanity.sh (serverpatch): Add comment about this coming up in + real life if the user modifies the file while CVS is running. + + * client.c (start_server): Add comment about logfiles if there are + several connections to the server. + (log_buffer_shutdown): Close the logfile after shutting down the + underlying buffer. This way at least we get the last set of + logfiles rather than a bizarre mishmash. + +1997-07-06 enami tsugutomo <enami@but-b.or.jp> + + * logmsg.c (do_verify): Unlink temporary file before call error(). + Remove unneeded `return' statement. Fix comment. + +Sun Jul 6 13:36:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * diff.c (diff_fileproc): Change message from "during rcsdiff of" + to "while diffing". For a while now, that message might be + printed after a call to DIFF instead of rcsdiff. + + * diff.c (diff_fileproc): Call cvs_output not printf. Remove + calls to fflush (should be handled now by call to cvs_outflush in + recurse.c). + * patch.c (patch_fileproc): Likewise. + + * rcscmds.c, cvs.h (diff_exec): New function. + * diff.c (diff_fileproc), patch.c (patch_fileproc), + update.c (patch_file): Call it. + + * rcscmds.c: Adjust comments concerning diff library to point to + new, expanded comments at diff_exec. Remove comments concerning + patch library; Rcs-diff should be adequate. + + * client.c (update_entries): Add comment about GNU patch usage (-b + option and so on). + +Sat Jul 5 04:13:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcscmds.c, cvs.h (RCS_exec_rcsdiff): New function. + * diff.c (diff_fileproc): Call it. + +Thu Jul 3 09:50:07 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (main): Add comment about how long we should keep the + deprecated "cvs rlog" alias. + + * server.c (cvs_output): Add comment about whether to fflush. + +Wed Jul 2 18:57:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (join2): New tests join2-19 and friends test for a + case that we can't readily get right (see comments). + +Tue Jul 1 09:52:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (cmd_usage): Say "specify" --help rather than the vague + "use". + (opt_usage, cmd_synonyms): Mention --help here too. + * add.c, admin.c, checkout.c, commit.c, diff.c, edit.c, import.c, + log.c, login.c, mkmodules.c, patch.c, rcs.c, release.c, remove.c, + rtag.c, status.c, tag.c, update.c, watch.c: Likewise, for all the + other help messages. + + * sanity.sh (join2): New tests. + + * repos.c (Name_Repository): Check for errors from fclose. + +Fri Jun 27 10:27:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * scramble.c, login.c: Reindent. + + * client.c (connect_to_pserver): Check for errors from send(). + If socket() fails, include SOCK_STRERROR (SOCK_ERRNO) in message. + +Wed Jun 25 11:21:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c: New option --help-options, with much of the text + from --help. Fix a few capitalization and punctuation problems. + Rewrite text for --help to be an intro to all the --help-* + options. + + * sanity.sh (head): New tests, concerning meaning of HEAD. + +Tue Jun 24 10:14:18 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (recv_line): New function. + (connect_to_pserver): Call it, and rewrite accordingly. Also + accept new "E" and "error" responses. Change \n to \012. + * server.c (pserver_authenticate_connection): Adjust comment + accordingly, concerning sending I HATE YOU not "error". + +Sun, 22 Jun 1997 Jim Kingdon + + * main.c (main): Move setting of server_active inside #ifdef + SERVER_SUPPORT; otherwise the variable doesn't exist. + * main.c (main): Call return after exit to shut up warning. + +Fri Jun 20 22:56:34 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (connect_to_pserver): On "I HATE YOU", give + "authorization failed" fatal error regardless of verify_only. + * login.c (login): Don't print that "incorrect password" message; + it now is possible with an --allow-root failure as well as an + incorrect password. cvsclient.texi doesn't really specify what I + HATE YOU means in any detail, and it seems a little silly for + login to give different messages than the other commands. + * client.c, client.h (connect_to_pserver): Return type now void. + +Thu Jun 19 12:16:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (serve_root): Give error on duplicate Root request. + Call parse_config. + * parseinfo.c, cvs.h (parse_config): New function. + * cvs.h (CVSROOTADM_CONFIG): Added. + * main.c (main): Set server_active here... + * server.c (server): ...not here. That seems cleaner than + strcmp's between command_name and "server" in main.c. + * main.c (main): Call parse_config. + * main.c, cvs.h (free_Rcsbin): Make global. + * mkmodules.c (filelist): Add CVSROOTADM_CONFIG. + +Wed Jun 18 11:24:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.11. + + * Version 1.9.10. + +Tue Jun 17 22:48:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (main): Add --allow-root=ROOT argument; call + root_allow_add for each time it is specified. Call + root_allow_free before exiting. + * root.c, cvs.h (root_allow_add, root_allow_free, root_allow_ok): + New function. + * server.c (pserver_authenticate_connection): If root_allow_ok + doesn't like the CVSROOT directory, don't allow access. + +Tue Jun 17 14:30:14 1997 Jim Kingdon (unknown@beezley) + + * client.c: Add "copyright" notice. If NO_EXT_METHOD, omit + start_rsh_method. + * client.c (update_entries): Cast argument to MD5Update from + char * to unsigned char *. + +Mon Jun 16 16:46:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (piped_child, filter_stream_through_program): + If USE_SETMODE_BINARY, then put the pipes into binary mode. + * find_names.c, ignore.c, lock.c, wrapper.c: Change fnmatch to + CVS_FNMATCH. + * client.c (start_server): If NO_EXT_METHOD, then give a fatal + error on any use of :ext:. + +Sun Jun 15 22:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (toplevel): Match U CVSROOT/* lines with DOTSTAR in + test toplevel-9. + +Thu Jun 12 10:27:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (toplevel): Remove Emptydir before starting. + + * sanity.sh: Change "rm -rf" to "rm -r" when deleting working + directories (except a few watches cases). Helps detect cases + where the testsuite has cd'd to somewhere other than where we + think it has. + (basic2): Remove "rm -r first-dir" between tests 49 and 50. The + directory was already deleted in test 45.5. + (rcs): Add "cd .." at end of tests. + (stamps): No longer cd to TESTDIR; shouldn't be necessary with + fix to "rcs" test. + +Wed Jun 11 22:28:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): Also remove CVSROOT/Emptydir at end of + test. Otherwise it affects the toplevel-9 test for remote. + +Tue Jun 10 14:03:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (toplevel): Change "update" and "checkout" to "[a-z]*" + as these read "server" instead for "make remotecheck". Change + expect strings for toplevel-9 to accept the behavior of remote CVS + (see comments for more discussion). + + * sanity.sh: New tests stamps-9 through stamps-11 test timestamp + behavior on cvs update. + +Mon Jun 9 22:42:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Remove "#! /bin/zsh" line at end. I assume it was + added accidentally. + +Tue Jun 10 03:08:46 1997 Norbert Kiesel <nk@psycho.de> + + * sanity.sh: new tests "toplevel" for the new toplevel CVS + directory creation (including one test which shows an error in + this area). + +Sun Jun 8 20:52:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.c (getrcsrev): Before printing error, check whether it was + feof or ferror. + + * rcs.h, import.c (add_rcs_file): No longer static. New arguments + add_vbranch, add_vhead, and add_logfp replace access to static + variables vbranch, vhead, and logfp. + * mkmodules.c: Call it instead of RCS_CI. + * import.c (process_import_file): Adjust call to add_rcs_file. + +Tue Jun 3 10:18:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): Match "." with "\." not ".". + +Tue Jun 3 13:02:37 1997 Norbert Kiesel <nk@cosa.de> + + * checkout.c (checkout): Removed restriction of not sending -k in + remote export (I think this was introduced while the -k handling + was still broken in remote mode). Give better error texts + regarding -c and -s options. Use error() instead of usage() for + reporting errors in all places. Reindented some lines. Free + xmalloc'd space of options. + +Thu May 29 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcscmds.c (RCS_checkin), mkmodules.c (init): Pass -w option to + "ci", specifying getcaller (). + * server.h, server.c (CVS_Username): Now extern. + * subr.c (getcaller): Return CVS_Username if it is set. + +Wed May 28 22:31:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (update_fileproc): If wrap_merge_is_copy and we would + like to do a merge, give a fatal error. See comment for why. + * sanity.sh (mwrap): New tests, tests for above fix. + +Tue May 27 21:59:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (stamps): cd to ${TESTDIR} before starting. + +Mon May 26 15:31:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (handle_mod_time): New function. + (responses): Add "Mod-time". + (stored_modtime_valid, stored_modtime): New variables. + (update_entries): If it is set, change the file's modtime. + * server.c, server.h (server_modtime): New function. + * vers_ts.c (Version_TS): Call it. + * patch.c (patch_fileproc): Add comment about why we don't. + * sanity.sh (stamps): Added, tests for above fix. + +Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * subr.c (free_names): Update documentation to reflect fact that + free_names is now called to free vectors allocated by expand_wild + as well as by line2argv. + + * main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as + specified in HACKING. + +Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de> + + * modules.c (do_module): initialize optind to 0. use local copies + of optarg's (because they might me freed within free_names). + +Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de> + + * main.c (main): initialize optind to 0. use local copies of + optarg's (because they might me freed within read_cvsrc). + + * cvsrc.c (read_cvsrc): free old argv after constructing a new + one. This fixes a memory leak. + + * recurse.c (start_recursion): use free_names() instead of + reimplementing it + + * rcs.c (RCS_deltas): free branchversion (memory leak). + + * parseinfo.c (Parse_Info): free some vars (3 memory leaks). + + * logmsg.c (logfile_write): free str_list_format (memory leak). + + * watch.c (watch_addremove), (watchers), update.c (update), tag.c + (cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove), + release.c (release), patch.c (patch), log.c (cvslog), import.c + (import), history.c (history), edit.c (watch_onoff), (edit), + (unedit), (editors), diff.c (diff), commit.c (commit), checkout.c + (checkout), add.c (add): initialize optind to 0 + + * diff.c (diff_fileproc): cosmetic change (whitespace added). + + * checkout.c (checkout): move local variable definition into the + block where the variable is used. + + * client.c (update_entries): initialize some local variables to shut up + gcc -O -Wall. + + * buffer.c (buf_read_line): initialize a local variable to shut up + gcc -O -Wall. + + +Wed May 14 16:29:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * admin.c (admin): When sending options to server, don't try to + send av[ac]. It may contain one of the names that we'll send in + send_file_names (which caused tests like keyword-6 to work, + sort of accidentally), or it may contain NULL (which would tend to + cause a coredump). + * sanity.sh (basicb): New test basicb-21 tests for above fix. + +Mon May 12 16:22:00 1997 Larry Jones <larry.jones@sdrc.com> + + * add.c (add): Free message and repository in client code. + * checkout.c (checkout): Don't free repository unless allocated. + * client.c (start_rsh_server): Free command. + +Sun May 11 11:43:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c: Remove all references to USE_DIRECT_TCP; see + ../ChangeLog for rationale. + +Fri May 9 22:19:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (main): Add comment explaining why we call exit. Pass 0 + not EXIT_SUCCESS, because lib/system.h has portability cruft for + EXIT_FAILURE but not EXIT_SUCCESS. + +Fri May 9 17:25:00 1997 Larry Jones <larry.jones@sdrc.com> + + Fix miscellaneous memory allocation problems: + * add.c (add): Free repository. + * client.c (notified_a_file): Free getline buffer. + * edit.c (notify_check): Free getline buffer. + * hash.c (dellist): Free header node when not caching. + * login.c (login): Don't continually free & allocate getline + buffer, use xstrdup instead of xmalloc/strcpy, free getline + buffer before returning. + * main.c (main): Call exit instead of returning so tools like + Purify won't consider permanently allocated memory as leaks. + * mkmodules.c (mkmodules): Free getline buffer. + * modules.c (cat_module): Call close_module. + * rcs.c (rcsvers_delproc): Free state. + * recurse.c (start_recursion): Free files_by_dir. + (unroll_files_proc): NULL out p->data after using it to set + filelist to avoid multiple frees. + * server.c (check_command_legal_p): Don't continually free & + allocate getline buffer, free getline buffer before returning. + (check_repository_password): Ditto, use xstrdup instead of + xmalloc/strcpy. + * wrapper.c (wrap_add_file): Free getline buffer. + +Thu May 8 14:21:00 1997 Larry Jones <larry.jones@sdrc.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * checkout.c (checkout_proc): Free finfo.rcs (memory leak). + +8 May 1997 Larry Jones <larry.jones@sdrc.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * hash.c: Add #ifdef's to disable caching. This makes it easier + to track down memory allocation problems. + +Thu May 8 11:40:39 1997 Larry Jones <larry.jones@sdrc.com> + + * sanity.sh: In setting "tests" use a number of statements rather + than one very long line. + +Thu May 8 11:40:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsbug.sh: Remove $Id; we decided to get rid of these some time + ago. + +Thu May 8 11:34:02 1997 Larry Jones <larry.jones@sdrc.com> + + * cvsbug.sh: Put separate statements on separate lines, so it + works if awk is AT&T nawk. + +Tue May 6 16:56:00 1997 Larry Jones <larry.jones@sdrc.com> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvsrc.c (read_cvsrc): Fix various memory allocation problems: + rearrange code to avoid leaks, use xrealloc instead of xmalloc/ + copy/free, make sure there's room for the remaining args before + appending them. + +Tue May 6 14:20:00 1997 Larry Jones <larry.jones@sdrc.com> + + * edit.c (watch_onoff, edit, unedit, editors): Add -R like + other things with -l. + * watch.c (watch_addremove, watchers): Ditto. + +Mon May 5 18:10:37 1997 larry.jones@sdrc.com + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Change all /tmp/cvs-sanity to TESTDIR. If TESTDIR + environment variable is set, use it instead of /tmp/cvs-sanity. + * sanity.sh: Make TMPPWD the pwd equivalent of TESTDIR, not of /tmp. + +4 May 1997 Larry jones <larry.jones@sdrc.com> + and Jim Kingdon + + * checkout.c, diff.c, patch.c, rcs.c: Update usage messages. + * rcs.c (annotate): Add -R like other things with -l. + +Sat May 3 14:57:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basic1): Rewrite test (use dotest, unroll the loops + which IMHO makes the test a zillion times more understandable, and + only do the variant which tests for 4 files at a time--we test one + file at a time lots of places). + +2 May 1997 Ziv Gigus <ziv@rest.home.net> + and Jim Kingdon + + * client.c, client.h (client_process_import_file): New argument + all_files_binary means treat all files as binary. + * import.c (import_descend): Pass it if -kb is specified. + * client.c (client_process_import_file): In the + non-all_files_binary case, call wrap_rcsoption to determine + whether the file is binary. + +Thu May 1 13:44:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (binfiles2): New tests, for update -j and binary files. + +Wed Apr 30 11:18:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * recurse.c (start_recursion): Also free reposfile. + Don't look in repository if client_active (latter bug reported by Paul + Sanders <p.sanders@dial.pipex.com>). + +Mon Apr 28 22:36:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * diff.c (diff_file_nodiff): Remove SERVER_SUPPORT ifdefs. They + were not based on server_active, which doesn't really make any + sense (it meant that compiling --disable-server could affect the + behavior of the non-client/server CVS). This affected the output + in tests death2-diff-11 and death2-diff-12 in the testsuite. + * sanity.sh (newb-123j0): Also accept "Needs Checkout", for a + --disable-server CVS. + + * main.c (cmd_usage): Change "run diffs" to "show differences"; + the former is jargon. + * edit.c (edit_usage): Fix typo ("." -> ","). + * edit.c (editors_usage), watch.c (watchers_usage): Mention -l. + * checkout.c (export_usage): Say what -P does. + * history.c (history_usg): Add comment about message wording. + +Mon Apr 28 14:47:45 1997 Norbert Kiesel <nk@cosa.de> + + * checkin.c (Checkin): use filename without path when calling + wrapper (bug found by Michal Schmitz <ms@cosa.de>). + +Fri Apr 25 13:28:55 1997 Ian Lance Taylor <ian@cygnus.com> + + * client.c (update_entries): In UPDATE_ENTRIES_RCS_DIFF case, + write to a temporary file and then rename it. + +Thu Apr 24 11:35:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * subr.c, cvs.h (pathname_levels): New function, from a piece of + send_file_names. + * client.c (send_file_names): Call pathname_levels in place of the + code which was moved there. + * server.c, server.h (server_pathname_check): New function. + * recurse.c (start_recursion): Call it. + * sanity.sh (modules3): New test modules3-11b tests for above fix. + + * filesubr.c: Do not define L_tmpnam. It is in ANSI and SunOS4, + so I don't think there will be a problem with it being missing. + Defining it too small can cause memory corruption. + (cvs_temp_name): Do not use L_tmpnam in the mktemp code; this + could cause a buffer overflow if the -T global option was in use. + +Thu Apr 24 13:21:15 1997 Norbert Kiesel <nk@cosa.de> + + * filesubr.c (cvs_temp_name): Use tempnam if available, else + mktemp, else tmpnam. See the comment for rationale. + + * sanity.sh: use "tar cf - ." instead of "tar cf - *" for + directory copies. + +Wed Apr 23 23:41:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (serve_update_prog): If in readonly mode, give an error. + +Wed Apr 23 19:07:41 1997 Norbert Kiesel <nk@cosa.de> + + * subr.c (line2argv): Allocate at least 4 slots for argv. + + * checkout.c (checkout_proc): Add a comment which says why the + above change was necessary to avoid writing to unallocated memory. + +Wed Apr 23 11:20:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * entries.c (ParseTag): Always set *NONBRANCHP. + +21 Apr 1997 Jim Kingdon + + * client.c (update_entries), rcs.c (expand_keywords): Rewrite + test to avoid signed/unsigned warning. + +Mon Apr 21 09:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (patch_file): Add comment about whether auto-detecting + features of the DIFF program is a good idea. + +Mon Apr 21 00:03:34 1997 Ian Lance Taylor <ian@cygnus.com> + + Don't require the patch program: + * client.c (struct update_entries_data): Add + UPDATE_ENTRIES_RCS_DIFF to contents enum. + (update_entries): Handle UPDATE_ENTRIES_RCS_DIFF. + (handle_rcs_diff): New static function. + (responses): Add "Rcs-diff". + * server.c (server_updated): Handle SERVER_RCS_DIFF. + (server_use_rcs_diff): New function. + * server.h (enum server_updated_arg4): Add SERVER_RCS_DIFF. + (server_use_rcs_diff): Declare. + * update.c (rcs_diff_patches): New static variable. + (update): Set rcs_diff_patches. + (update_fileproc): If rcs_diff_patches, pass SERVER_RCS_DIFF + rather than SERVER_PATCHED to server_updated. + (patch_file): Correct initial comment to say diff rather than + rcsdiff. If rcs_diff_options, pass -n to diff rather than -c. + * rcs.c (rcs_change_text): New function. + * rcs.h (rcs_change_text): Declare. + +Mon Apr 21 00:08:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * diff.c (diff_fileproc): Add comment concerning updating the + client timestamp. + +Sun Apr 20 23:20:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * commit.c (commit): Add comment regarding SEND_FORCE rationale. + +Sat Apr 19 17:10:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (dirswitch): If directory ends in '/', complain. + +Fri Apr 18 18:09:57 1997 Ian Lance Taylor <ian@cygnus.com> + + * rcs.c (apply_rcs_changes): New static function, broken out of + RCS_deltas. + (RCS_deltas): Call it. + (linevector_add): Change return type to int. Return an indication + of an error for an invalid add, rather than calling error. + +Fri Apr 18 11:24:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.9. + + * version.c: Version 1.9.8. + + * commit.c (struct find_data): Add field force. + (find_fileproc, commit): Use it instead of force_ci to decide + whether to send files to server. + (commit): Set it if either -f or -r is specified. + * sanity.sh (basica): Add tests basica-8a0, basica-8a1, and + basica-8a2; tests for above fix. + +Wed Apr 16 11:50:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * zlib.c: Remove paragraph with Free Software Foundation address. + See 2 Jan 1997 entry in ../ChangeLog for rationale. + +Tue Apr 15 00:36:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (patch_file_write): Always assign to final_nl, so that + it ends up reflecting whether the data from the last call had a + newline, not whether the data from any of the calls ended in a + newline. Doesn't matter with the current RCS_checkout + implementation, but it will if RCS_checkout is changed to pass + less than the entire file. + + * rcs.c (RCS_cmp_file): Change NULL to RUN_TTY in passing sout to + RCS_checkout, for clarity. + + * import.c (update_rcs_file): Remove unused variable ierrno. + + * add.c, checkout.c, commit.c, diff.c, edit.c, import.c, + history.c, log.c, main.c, patch.c, release.c, remove.c, rtag.c, + status.c, tag.c, update.c, watch.c: Pass "+" to all calls to + getopt. This ensures that we maintain existing behavior even with + glibc2. + + * filesubr.c (fopen_case): Don't set *PATHP if we return an + error. Since the 9 Apr 1997 change, the behavior has been to + sometimes set it and sometimes not. + * rcs.c (RCS_parse): Adjust callers to not free it. Without this + change, they could call free() on an uninitialized variable. + + * checkout.c (checkout): Add comment about export -k. + + * root.c (check_root_consistent): Add comment about wording of + message. + +Mon Apr 14 11:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (call_in_directory): If rdirp reaches the end of + reposdirname, then just set it to NULL. If server does not create + directories one at a time, give a warning. + * sanity.sh (modules3): Enable tests modules3-8 through + modules3-11 for remote; tests for above fix. + + * client.c (call_in_directory): Don't set short_pathname to + pathname for a while; just use pathname itself (cleans up a relic + of the old "Repository" (not "Directory") code). Add comment + explaining short_pathname. + +Sun Apr 13 18:07:50 1997 Ian Lance Taylor <ian@cygnus.com> + + * rcs.c (RCS_checkout): Add pfn and callerdat parameters. Change + all callers. Move setting of expand after retrieval of file + data. + (struct cmp_file_data): Define. + (RCS_cmp_file): New function. + (cmp_file_buffer): New static function. + * rcs.h (RCSCHECKOUTPROC): Define type. + (RCS_checkout): Update declaration. + (RCS_cmp_file): Define. + * diff.c (diff_file_nodiff): Call RCS_cmp_file rather than + RCS_checkout and xcmp. + * import.c (update_rcs_file): Likewise. + * no_diff.c (No_Difference): Likewise. + * update.c (struct patch_file_data): Define. + (patch_file): Just return if noexec, or if binary file. Pass + patch_file_write to RCS_checkout. Don't check for newlines or + compute checksums here. Stat RCS file to set modes. + (patch_file_write): New static function. + + * update.c (patch_file): Checkout directly to file2, rather than + to finfo->file followed by rename. Remove check for whether + result of checkout is readable; that was for an old, obsolete, + form of death support. + +Sun Apr 13 13:16:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * checkout.c (build_one_dir): New function. + (struct dir_to_build): New structure. + (build_dirs_and_chir): Rewritten to accept a linked list of struct + dir_to_build rather than the silly string processing we had been + doing before. + (checkout_proc): Rewrite code that calls build_dirs_and_chdir + accordingly. + * sanity.sh: Enable tests modules3-10 and modules3-11 for local CVS; + tests for above fix. + + * rcs.h (RCS_CO): Removed; no longer used. + +Sun Apr 13 00:04:34 1997 Ian Lance Taylor <ian@cygnus.com> + + Expand RCS keywords internally; never call co: + * rcs.h (struct rcsversnode): Add state field. + * rcs.c (kflags): Move out of RCS_check_kflag, and make file + static. + (enum kflag): Define. + (RCS_reparsercsfile): Always save lock information. Save state in + new state field, rather than other field. + (struct rcs_keyword): Define. + (keywords): New static variable. + (enum keyword): Define. + (printable_date, escape_keyword_value): New static functions. + (expand_keywords): New static function. + (RCS_checkout): Call expand_keywords. Don't call + RCS_exec_checkout. + (RCS_deltas): Add log and loglen parameters. Change all callers. + * log.c (log_version_requested): Use new state field. + (log_version): Likewise. + * cvs.h (RCS_exec_checkout): Don't declare. + * rcscmds.c (RCS_exec_checkout): Remove. + +Sat Apr 12 17:32:59 1997 Ian Lance Taylor <ian@cygnus.com> + + * sanity.sh (modules3): Remove second-dir at end of tests. + (sticky): Correct removal of directories at end of tests. + + * sanity.sh (keyword): New tests for RCS keyword expansion. + +Sat Apr 12 16:47:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): New tests basicb-1b, basicb-1c, basicb-9b, + basic-9c test current build_dirs_and_chdir behavior. + +Fri Apr 11 23:54:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (modules3): New tests modules3-7* test for ability to + supply a path in -d in modules. Similar to modules3-8 through + modules3-11 except because the nesting is different, these ones + work. + +Thu Apr 10 00:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (modules3): New tests modules3-12 through modules3-15 + test use of a module name which contains a slash. + + * sanity.sh (basicb): New tests basicb-14 to basicb-20 test use of + co -d with two or more arguments. + + * rcscmds.c: Refer to doc/RCSFILES in comment. + +Wed Apr 9 09:49:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): New tests basicb-11 through basicb-13 test + ability to specify several directory levels in co -d (commented + out). + + * filesubr.c (fopen_case): If CVS_OPENDIR gives an + existence_error, return it to the caller instead of giving a fatal + error. + + * client.c (update_entries): Fix typo in call to error (1 -> errno). + +Tue Apr 8 23:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * error.h, error.c: Test for #ifdef __STDC__, not #if __STDC__. + This is consistent with other parts of CVS; it means that the + declaration for fperror will match the definition even if __STDC__ + is defined to 0 as the SunPro 4.0 compiler does. Reported by + Richard Smith <rjsmith@cisco.com>. + +2 Apr 1997 Jim Kingdon + + * entries.c (ParseTag): Add "break;" after "default:" to avoid + error from Visual C++. + +Wed Apr 2 12:06:44 1997 Vince Del Vecchio <vdelvecc@spd.analog.com> + and Jim Kingdon + + * client.c: In reporting errors from socket calls, use + SOCK_STRERROR and SOCK_ERRNO since strerror(errno) doesn't work + for Win32. + +Tue Apr 8 10:45:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (modules3): Add tests modules3-8 to modules3-11, to + test for ability to supply a path to -d in modules. Mostly + commented out as CVS is buggy in this area. + +Mon Apr 7 12:41:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add): Add comment about SEND_NO_CONTENTS. + +Sun Apr 6 21:46:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (update): Add comment about noexec and SEND_NO_CONTENTS. + +Sun Apr 6 17:34:08 1997 Robert Bihlmeyer <robbe@orcus.priv.at> + + * Pass +f not f to getopt_long to prevent options from being + permuted with glibc 2.0.1. + +Sun Mar 30 00:07:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.h (struct vers_ts): Adjust comment regarding ts_user. + * server.c (serve_is_modified): New function. Set entries to show + that the file is modified but we don't know the contents. + * server.c (requests): Add "Is-modified" request. + * vers_ts.c (time_stamp_server): If the timestamp in entdata is + "M" or "D", just copy that over into ts_user. + * vers_ts.c (Version_TS): If timestamp is "D", use the entries + line for the sole purpose of passing it to time_stamp_server. + * no_diff.c (No_Difference): If ts_user is "M", conclude the files + are different. + * client.h, client.c (send_files): Replace arguments build_dirs + and force with argument flags. Add flag SEND_NO_CONTENTS and add + to struct send_data. + (send_fileproc): If no_contents, then send Is-modified instead of + Modified. + * add.c, admin.c, client.c, commit.c, diff.c, edit.c, log.c, + rcs.c, remove.c, status.c, tag.c, update.c, watch.c: Change all + send_files callers. + +Fri Mar 28 22:32:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (requests): Change "Repository" to rq_optional. I'm + not sure whether I overlooked this when I removed support for + Repository, or whether I was thinking that servers would need to + support it anyway, for CVS 1.5 to 1.9 clients, but making it + optional doesn't prevent the server from supporting it and it + seems silly for the client to complain about absence of a request + that it never will use. + +Fri Mar 28 10:06:59 1997 Steven Miller <Miller@wingra.com> + + * entries.c (Subdirs_Known): Don't create Entries.Log if noexec. + +Thu Mar 27 18:14:12 1997 Ian Lance Taylor <ian@cygnus.com> + + * sanity.sh (death2): Remove commented out test death2-21. It + would now pass, but it duplicates the new test sticky-11. + +Thu Mar 27 10:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (dotest_internal): Write test output to logfile even + if test succeeds. This was the behavior prior to 30 Sep 1996. + See the comment for rationale. + +Tue Mar 25 13:26:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * cvs.h, entries.c (WriteTag): Add arguments nonbranch, + update_dir, and repository. Move the server_set_sticky call from + callers to here. + * cvs.h, create_adm.c (Create_Admin): New argument nonbranch. + * cvs.h, entries.c (ParseTag): Add argument nonbranchp. + * cvs.h (struct stickydirtag): Add field nonbranch. + * entries.c (Entries_Open): Set it. + * cvs.h (Vers_TS): Add field nonbranch. + * vers_ts.c (Version_TS): Copy it from struct stickydirtag. + * server.c, server.h (server_set_sticky): Add argument nonbranch. + * add.c, client.c, checkout.c, modules.c, update.c, create_adm.c, + commit.c: Update callers. + * add.c (add): If nonbranch, don't add the file on that "branch". + * commit.c (write_dirnonbranch): New variable. + (commit_fileproc, commit): Set it. + (commit_dirleaveproc): Pass it to WriteTag. + * update.c (rewrite_tag, nonbranch): New variables. + (update, update_dirent_proc, update_fileproc): Set them. + (update_filesdoneproc): If rewrite_tag, call WriteTag. + * sanity.sh (sticky): New tests, test for above fix. + + * version.c: Change version number to 1.9.7. + + * version.c: Version 1.9.6. + +Mon Mar 24 13:02:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * entries.c (ParseTag): Add comment about unrecognized characters + in CVS/Tag file. + + * classify.c (Classify_File): Add comment about how specifying a + tag (bogusly?) suppresses certain messages. + +Fri Mar 21 13:37:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * rcs.h (struct rcsnode): Add comment about case of PATH. + * rcs.c (RCS_parse): If ign_case, then try opening the file with + fopen_case. + * ignore.c (ign_case): Adjust comment. + * cvs.h, filesubr.c (cvs_casecmp, fopen_case): New functions. + +20 Mar 1997 Jim Kingdon + + * client.c (send_repository): When sending Directory request, + send any ISDIRSEP character as '/'. Fixes + "cvs log foo\bar\baz.c" on NT & friends. + + * client.c (send_file_names): Don't try to read Entries file if + CVSADM directory does not exist. Fixes fairly serious regression + (warning on all fresh checkouts) introduced by 1997-01-08 change. + +Tue Mar 18 13:03:33 1997 Jim Meyering <meyering@totoro.cyclic.com> + + * sanity.sh (RCSINIT): Define to be empty and export, to hide any + existing value that might cause spurious failures. + + * Makefile.in: (install): Depend on installdirs. + Remove `CYGNUS LOCAL' comment saying not to. + +Tue Mar 18 09:36:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * recurse.c (struct recursion_frame): Reindent. + (do_dir_proc): Print message if we try to recurse into a CVSADM + directory. + * sanity.sh (basicb): New test basicb-4a tests for above fix. + +Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (death2): Replace regexp matching temporary file name + with new variable ${tempname}. For most of the tests this is a + cosmetic change, but death2-diff-6 had been missing _ which caused + it to fail on Solaris (at least sometimes). + + * sanity.sh (modes): Don't use export -n; it doesn't seem + to be sufficiently portable. + + * version.c: Change version number to 1.9.5. + + * version.c: Version 1.9.4. + + * rcscmds.c (RCS_checkin): Preserve the mode of the rcsfile. + RCS_CI usually, but not always, does this for us. + * commit.c (fix_rcs_modes): Replace algorithm with a more + CVSUMASK-friendly one. + * sanity.sh (modes): Update tests modes-5, modes-7, modes-10, and + modes-15 so they test that CVSUMASK is honored. + +Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (modes): New tests modes-7a and modes-7b test behavior + if one manually changes the modes in the repository. + + * server.c (server): Revise code which checks for errors creating + temporary directory. This won't solve the intermittent + can't create temporary directory + Unknown error -1 + but it will mean (a) the right message based on errno gets + printed, instead of "unknown error -1", and (b) the message says + that it happened in chmod instead of mkdir_p. + +Sat Mar 15 16:47:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (modes): New tests. Note that (for now) these are + just testing how CVS already behaves; I want to record that before + I move on to changing CVS's behavior with modes of RCS files. + +13 Mar 1997 Jim Kingdon + + * subr.c (line2argv): Change argv_allocated from size_t to int. + +Wed Mar 12 22:16:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add_directory): If repository has an extraneous "." + directory at the end, strip it off. This fixes a bug which was + introduced when strip_path was nuked (this fix is much more + limited in scope than strip_path was; I _think_ that is a good + thing). + (add): Likewise, for client. + (combine_dir): New function, helps with above. + * sanity.sh (modules3): Reenable tests for this behavior. + (basica-0b, basicb-0e): Adjust test to reflect "foo/bar" instead + of "foo/./bar" in message. As with the rest of this, I believe + this is just restoring the behavior prior to the strip_path nuking + (I tried it with CVS 1.9). + +Sun Mar 9 10:06:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * root.c (parse_cvsroot), server.c (serve_root, serve_init): + If CVSroot_directory is not an absolute pathname, give a fatal error. + * sanity.sh (crerepos): New tests crerepos-6* test for above fixes. + +Sat Mar 8 22:06:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + This cleans up the last known code which can overflow its buffers + (except the Mac client). I've skimmed through much of CVS looking + for other such places; but I didn't read everything. If I missed + any please report it to bug-cvs. + * logmsg.c (logfile_write, title_proc): Realloc str_list as + needed; don't assume MAXLISTLEN is enough. + * cvs.h (MAXLISTLEN, MAXFILEPERDIR): Removed; no longer used. + * add.c, myndbm.c, parseinfo.c, update.c: Nuke MAXLINELEN limit. + * parseinfo.c, update.c, mkmodules.c: Check for errors reading file. + * cvs.h (MAXLINELEN): Removed; no longer used. + * logmsg (MAXHOSTNAMELEN): Removed; not used. + * main.c (cmd_synonyms): Allocate based on fullname, nick1, and + nick2, just in case someone makes those big enough so that 100 + bytes is not enough. + (Make_Date): Use MAXDATELEN rather than our own fixed size. + * mkmodules.c (mkmodules): Nuke arbitrary limit on line length. + * rcs.c (ALLOCINCR): Remove; not used. + (RCS_check_kflag): Add comment concerning karg size. + * run.c: Allocate run_prog to the needed size, rather than + allocating a fixed size buffer. + +Fri Mar 7 22:39:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * logmsg.c (logfile_write): Allocate prog to needed length rather + than assuming MAXPROGLEN is enough. + * cvs.h (MAXPROGLEN): Removed; no longer used. + * subr.c (MIN_INCR): Update comment to reflect MAXPROGLEN's demise. + + * subr.c (free_names): Fix comment: this function is not used to + free memory allocated by Find_Names (at least it hasn't for a long + time). + * subr.c, cvs.h (line2argv): Change calling convention so that we + allocate argv array rather than the caller. The previous one had + no way of checking whether we overflowed the passed-in buffer. + * subr.c (free_names): Free the argv array too. + * modules.c (do_module, cat_module): Update callers. + +Thu Mar 6 12:44:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * import.c: Allocate vhead and vbranch dynamically; removes + arbitrary limit. + * history.c: Likewise (since_rev, since_tag, backto, rec_types). + * ignore.c: Likewise (line). Also check for errors from getline + and add 'copyright' notice to top of file. + * wrapper.c (wrap_add_file): Likewise (line). Also check for + errors from various calls and add 'copyright' notice to top of file. + +Tue Mar 4 17:39:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (update_entries): Add comment about "move away <file>" + message. + +Mon Mar 3 21:51:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): Clean up topfile,v at end of test. Fixes + failure in modules-155b. + +Sun Mar 2 18:11:09 1997 Dan Wilder <dan@gasboy.com> + and Jim Kingdon + + * admin.c (admin): Arrange to perform recursion if "cvs admin" + is passed only options. + +Sun Mar 2 18:11:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (basicb): New tests basicb-0* test for files at top + level. + + * error.c (error): Add newline to "out of memory" message. I think + that its omission probably could cause the message to be lost in + the bowels of server.c and never passed to the user. + + * client.c (start_rsh_server): Add comment about "remsh" vs. "rsh". + + * cvs.h: Move copyright notice to top of file. + +Sun Mar 2 13:44:36 1997 Ian Lance Taylor <ian@cygnus.com> + + * sanity.sh: Use -n when testing whether rsh works. + + * server.c (serve_root): Free path. + +Sun Mar 2 13:12:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + The following are things that I noticed in the process of trying + to track down: + can't create temporary directory + Unknown error -1 + FAIL: test 28 + from nightly testing. I'm not sure that either item explains that + message however. + * server.c (server): Allocate pending_error_text; + print_pending_error will try to free it so + pending_error_text = "foo" + won't work. + (mkdir_p): Don't assume that isdir will leave errno unmolested. + +Thu Feb 27 15:29:58 1997 Ian Lance Taylor <ian@cygnus.com> + + * remove.c (cvsremove): When forcing removal in client mode, use + start_recursion rather than calling CVS_UNLINK on each argument. + (remove_force_fileproc): New static function. + * sanity.sh (deep): Add tests deep-rm7 through deep-rm10 for above + patch. + + * sanity.sh (death): Enable death-76a0 and death-76a1 tests for + remote, since they now work. + +Wed Feb 26 16:13:26 1997 Ian Lance Taylor <ian@cygnus.com> + + * client.c (add_prune_candidate): Skip adding this directory if + it is the same as the first directory already on the list. + +Mon Feb 24 21:36:43 1997 Noel Cragg <noel@gargle.rain.org> + + * main.c (lookup_command_attribute): Add the "init" command to the + list of commands that don't use the current working directory. + +Sun Feb 23 09:54:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (devcom3): Clean up at end of test. + + * sanity.sh (basicb): Add commented out test basicb-8a0, for + whether CVS can print an error on bad numeric revision to diff. + Commented out until we get around to fixing CVS. + * diff.c (diff_file_nodiff): Add comment about this case. + + * fileattr.c (fileattr_read): If a filename is duplicated, + continue to ignore subsequent lines but free the node so that we + don't leak memory. + * sanity.sh (devcom3): New tests devcom3-8 and devcom3-9 test for + behavior on duplicated filenames. + + * fileattr.h: Add comment about unrecognized ENT-TYPE and order of + lines in fileattr file. + * fileattr.c (struct unrecog, unrecog_head): New variables, to + record unrecognized lines. + (fileattr_startdir): Assert that unrecog_head == NULL. + (fileattr_read): Record unrecognized lines in unrecog_head linked + list rather than ignoring them. + (fileattr_write): Also write out unrecognized lines, if any. + * sanity.sh (devcom3): New tests, test for above fix. + + * fileattr.h (fileattr_modify): Fix example in comment. + +Sat Feb 22 08:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Add variable username. + (basica rdiff multibranch log log2): Use it instead of our own + (inconsistent) ways of matching an author name. + + * filesubr.c, root.c, rtag.c, server.c, subr.c, update.c, + wrapper.c: Nuke PATH_MAX. + * cvs.h, wrapper.c (wrap_fromcvs_process_file): Now returns void + (return value had been unused). + * cvs.h: Adjust comment to reflect the fact that PATH_MAX is + gone, at least from src/*.c (except safe_location, as noted). + +22 Feb 1997 patch by Tom Hageman <tom@basil.icce.rug.nl> (4 Jun 1996) + updated and commented by Jim Kingdon <kingdon@harvey.cyclic.com> + + * update.c (checkout_file): Call unlink_file_dir on backup, not + unlink_file. + +Fri Feb 21 16:40:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in (DISTFILES): Remove NOTES. + + * NOTES: Removed. bcopy->memcpy is done. "static buffers" I + assume refers to what is covered by reentrancy text in HACKING. + Obstack idea moved to comment in hash.c (at nodecache). Checking + system calls for error returns largely done, and isn't a very + helpful suggestion unless you know where the bogus calls are + anyway. Sizing limits--we're in the progress of removing them + (assuming it meant things like PATH_MAX and earlier, already + nuked, limits). Removed various items about changes which were + done a long time ago (I realize that the ChangeLog's probably + aren't reliable that far back, but I'm not convinced anyone cares + anymore). CONFIRM_DIRECTORY_ADDS: I assume this is a + reference to the #if 0'd code in add_directory which asks for + confirmation--a better way of making it harder to accidentally add + directories would be to have to add and commit directories like + for files. I don't know what FORCE_MESSAGE_ON_ADD meant. + + * rcs.c (RCS_getrevtime): Fix documentation (in particular, the + size of the array that DATE must point to, but many other things + too). + * patch.c, recurse.c, release.c, remove.c, repos.c: Nuke PATH_MAX. + (patch_fileproc): Use MAXDATELEN not hardcoded 50. + +Sun Feb 16 12:00:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (client_process_import_file): New variable fullname; + pass it to send_modified. This finishes the job of untangling the + old short_pathname variable into update_dir vs. fullname. + + * client.c (client_process_import_file): Nuke first_time. If + toplevel_repos were ever NULL here, the code would dump core in + strncmp a few lines down. And client_import_setup ensures + toplevel_repos is not NULL. + +Sun Feb 16 08:16:48 1997 Ian Lance Taylor <ian@cygnus.com> + + * client.c (client_process_import_file): Rename short_pathname to + update_dir (to reflect its function) and make sure that it doesn't + point to uninitialized memory if repository and toplevel_repos + contain the same string. + +Sun Feb 16 08:16:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (start_rsh_server): Nuke comment about weirdnesses with + pre-1.5 versions of CVS and .bashrc/.cshrc. The remote protocol + is interoperable only back to 1.5, and people who need to know are + unlikely to see this comment anyway. + +Sun Dec 15 13:12:30 1996 Michael Douglass <mikedoug@texas.net> + and Jim Kingdon <kingdon@harvey.cyclic.com> + + * main.c (cmds): Added an entry for new logout command. + (cmd_usage): Added an entry for new logout command. + (lookup_command_attribute): Added 'logout' to list of commands + that set need_to_crate_root to 1. + * login.c, cvs.h (logout): New command for removing entries from + the .cvspass file. + (logout_usage): Usage information on the logout command. + +Wed Feb 12 11:19:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (struct send_data): Fix indentation. + +Wed Feb 12 08:48:04 1997 Greg A. Woods <woods@most.weird.com> + + * mkmodules.c (loginfo_contents): add missing comma in + initializer statement (caused syntax error on SunOS-4). + +Tue Feb 11 21:14:28 1997 Ian Lance Taylor <ian@cygnus.com> + + * commit.c (find_fileproc): If force_ci is set, set the status to + T_MODIFIED even if the file hasn't changed. + (commit): Pass force_ci to send_files as new force argument. + * client.c (struct send_data): Define. + (send_fileproc): The callerdat parameter now points to a send_data + struct. If force is set, always call send_modified. + (send_dirent_proc): The callerdat parameter now points to a + send_data struct. + (send_files): Add force parameter. Change all callers. Set up a + send_data struct and pass it to start_recursion as callerdat. + * client.h (send_files): Update declaration. + * sanity.sh (basica): Add a simple test for the above patch. + +Sun Feb 9 12:58:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * tag.c (cvstag), rtag.c (rtag): Pass -f to server if specified in + the client. I haven't tried to come up with a test case because + the fix seems obvious. + + * import.c (add_rcs_file): Change size of altdate1 and altdate2 to + MAXDATELEN. + * cvs.h (MAXDATELEN): Fix comments; describe what this is for. + + * diff.c (diff_usage): Document --ifdef and try to briefly say + what "rcsdiff-options" means. + + * update.c (update): If update had a nonzero status and we haven't + yet tried to fetch unpatchable files, go ahead and try it again. + The previous behavior was to quit, which meant that updates would + keep failing until you hacked around the problem. Patch and bug + report by Ian; comment, ChangeLog entry, and willingness to take + the flak if checking it is premature by Jim. + + * server.c (alloc_pending): New function. + * server.c: Call it. Fixes places where we had neglected to + check for NULL return from malloc. + + * sanity.sh (binwrap): Add test binwrap-0, tests for import.c fix + below. + +Sun, 9 Feb 1997 (submitted 19 Jul 1996) John Polstra <jdp@polstra.com> + + * import.c (import): Give error if the same tag is specified more + than once. The previous behavior was to write an RCS file which + had the same tag listed twice, once pointing to each revision, + which is not legal. + +Sun Feb 9 12:37:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * checkin.c (Checkin): Use cvs_output to print message (should + make out of order bugs no worse, as it merely substitues a + protocol_pipe vs. stderr_pipe race instead of a stdout_pipe + vs. stderr_pipe race). Add comment about stdout vs. stderr. + +Fri Feb 7 08:29:52 1997 Josef Nelissen <josef.nelissen@munich.ixos.de> + + * server.c (check_command_legal_p): Don't use ANSI-style definition. + +Thu Feb 6 10:55:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * patch.c (patch): Give a fatal error for -V option (see comment + for rationale). + + * diff.c (diff): Also send "options" to server. Pretty much the + patch submitted independently by josef.nelissen@munich.ixos.de and + Ronald Khoo <ronald@demon.net>. + +Wed Feb 5 18:57:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * modules.c (do_module): Fix typo in 30 Jan 97 PATH_MAX nuking + (free -> free_cwd). Testsuite test 151 gets credit for catching + this one. + +Mon Feb 3 16:14:54 1997 Ian Lance Taylor <ian@cygnus.com> + + * main.c (lookup_command_attribute): Don't use an ANSI prototype + when defining the function. + +Fri Jan 31 12:49:02 1997 Ian Lance Taylor <ian@cygnus.com> + + * modules.c (do_module): Actually goto found if is_found is set + (fixes thinko in PATH_MAX nuking of 30 Jan 97). + +Fri Jan 31 12:49:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Add modules3 and big to list of tests to run + by default; they were omitted by accident. + +Thu Jan 30 11:46:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * logmsg.c, main.c, mkmodules.c, modules.c, parseinfo.c, patch.c: + Nuke more PATH_MAX. + + * server.c (server_updated): After we send Created or + Update-existing for a file, mark it as unchanged, in case we + process it again. + * sanity.sh (modules3): New tests, test for above fix. + + * logmsg.c (do_verify): Error return from fopen is NULL, not -1. + Pass errno to error(). + + * login.c [_CRAY]: Don't declare getpass. + +Mon Jan 27 17:25:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * import.c (process_import_file): Fix freeing of rcs (Don't free + it before we are done using it, and don't free it twice). + + * modules.c (cat_module): Allocate line right before we use + it. The previous code was wrong because the length of the + s_h->rest changes between the time we allocate line and the time we + sprintf s_h->rest into it. + +Sun Jan 26 21:58:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * expand_path.c (expand_path): Revise to call expand_string as + needed. Nuke PATH_MAX. + * find_names.c (find_dirs): Likewise. + * import.c, lock.c: Nuke more PATH_MAX. + + * server.c (mkdir_p): Set retval to 0 at start of function. + Previously it had been uninitialized for some cases. Thanks are + due to nightly testing for catching this one. + +Sat Jan 25 21:34:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * subr.c, cvs.h (expand_string): New function. + * rcs.c (getrcskey, getrcsrev): Call it. This greatly reduces the + number of calls to realloc if there is a very large file in the + RCS file. Credit goes to Mike Heath <mike@pswtech.com> for + pointing out the problem and the basic solution (MIN_INCR, + MAX_INCR); I adapted it into the separate function expand_string. + * sanity.sh (big): New test helps insure this hasn't broken + anything obvious. + +Wed Jan 22 10:06:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * status.c (status_fileproc): Change message which is printed for + T_MODIFIED and ts_conflict set, so that it doesn't say "unresolved + confict". This message occurs whether the conflict is resolved or + not. + * sanity.sh (conflicts): Add tests conflicts-status-* to test + output of "cvs status" in the context of conflicts. Tests for + above fix. + + * rtag.c (rtag): Send -n if run_module_prog is NOT true. + +Thu Jan 16 00:06:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * version.c: Change version number to 1.9.3. + + * version.c: Version 1.9.2. + +Wed Jan 15 09:14:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * client.c (call_in_directory): Take code that creates CVSADM at + top level, move it before the CVS_CHDIR (dir_name) call, and do it + regardless of whether dir_name is ".". Pass "." not dir_name to + Create_Admin (when the code was written they were always the + same). Don't add reposdirname to the repository we pass to + Create_Admin (when the code was written, I think reposdirname + probably would always be "."). Don't create CVSADM if + reposdirname_absolute. + * sanity.sh (basicb): Enable tests basicb-1a and basicb-9a for + remote; tests for above fix. + (basic1): Do entire test within a "1" directory to deal with + creation of CVS directories at top level. Support --keep. + (conflicts): In test conflicts-136, only update first-dir. + (basica): Uncomment the part that tests "cvs co -l .". That tests + the existing functionality which I might have (but hopefully did not) + perturbed with the call_in_directory changes. + +Mon Jan 13 11:04:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * server.c (check_command_legal_p): Do not call error (1, ...) + here; that will always cause a protocol violation by shutting down + the connection prematurely. Remove croak_on_illegal arg. + (do_cvs_command): Move call to check_command_legal_p until after + the call to print_pending_error. Print the error message ourself. + + * mkmodules.c (filelist): Add readers and writers. Add comment + about why passwd is not included. Add comment about meaning of + NULL contents field. + +Fri Jan 10 13:23:09 1997 Norbert Kiesel <nk@col.sw-ley.de> + + * release.c (release): Initialize delete_flag before reading it + (found by running purify) + + * logmsg.c (do_verify): Fix reading unallocated memory (found by + running purify) + +Thu Jan 9 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * checkout.c (build_dirs_and_chdir): Partially revert 3 Jan + change--move call to Subdir_Register back above the CVS_CHDIR call + (we need to register in the old, not the new, directory). Instead + of calling CVS_MKDIR and ignoring errors, call mkdir_if_needed; + this is an effort to catch errors there rather than catching them + in the CVS_CHDIR. This makes test 27-add-add in sanity.sh work + again. + + * find_names.c (Find_Directories): Remove code inside + #ifdef ATTIC_DIR_SUPPORT and replace it with a comment explaining + why we don't look in the attic. ATTIC_DIR_SUPPORT was never defined. + + * find_names.c (find_dirs): Add comment about tmp being unset. + + * commit.c (checkaddfile): Report errors with errno and specific + error messages. + + * rcs.c, commit.c, create_adm.c, entries.c, find_names.c, + ignore.c, history.c: Nuke PATH_MAX arbitrary limits. + +Wed Jan 8 23:07:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * add.c (add): Reindent a portion which needed it. + +1997-01-08 Jim Kingdon + + * client.c (send_file_names): When looking name up in Entries, + call Entries_Open and Entries_Close. This has two effects: + (1) we look at Entries.Log, and (2) we don't skip 'D' entries, + both of which are needed to make us get the right (command + line) name for a directory we are adding. + +Wed Jan 8 14:50:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in, cvs.h, hash.h, myndbm.h, rcs.h: Remove CVSid; we + decided to get rid of these some time ago. + +Tue Jan 7 12:56:10 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn> + + * root.c (check_root_consistent): new func, compares below new + global var with CVSroot_directory, assuming both set. + (set_local_cvsroot): use above new func for security check. + (parse_cvsroot): same. + But do all of above only #ifdef AUTH_SERVER_SUPPORT. + + * server.c: (Pserver_Repos): new global var, init to NULL. + (pserver_authenticate_connection): set above new global. + (check_repository_password): be a good scout and use + CVSROOTADM and CVSROOTADM_PASSWD, now that they are the standard. + Make sure all of above is in #ifdef AUTH_SERVER_SUPPORT. + (check_command_legal_p): wrap most of body in #ifdef + AUTH_SERVER_SUPPORT. + Everywhere: wrap all references to CVS_Username in #ifdef + AUTH_SERVER_SUPPORT. + + * cvs.h (Pserver_Repos): new var, used in consistency [security] + check. Defined only #ifdef AUTH_SERVER_SUPPORT. + (CVSROOTADM_PASSWD): new #define, trying to get with the program. + +Fri Jan 3 18:10:39 1997 Ian Lance Taylor <ian@cygnus.com> + + * checkout.c (build_dirs_and_chdir): Move call to Subdir_Register + until after we know that the directory exists. + +Thu Jan 2 13:30:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in, cvsbug.sh, edit.c, edit.h, error.c, error.h, + fileattr.c, fileattr.h, filesubr.c, run.c, update.h, watch.c, + watch.h: Remove "675" paragraph; see ../ChangeLog for rationale. + +Thu Jan 2 12:27:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh (info): New test info-cleanup-verifymsg gets rid of + verifymsg when we are done with it. + + * sanity.sh (basicb): Skip tests basicb-1a and basicb-9a for remote. + * sanity.sh (modules-155a4): It is OK if a CVS directory exists. + * sanity.sh (ignore): Do everything inside a "1" directory. The + change to create CVS directories at top-level causes messages such as + "? home" otherwise. In test 191, specify -I CVS so that new CVS + directory is ignored. + * sanity.sh (crerepos): Manually remove CVS directory which had not + existed before. + +Thu Jan 2 09:06:20 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn> + + * server.c: Changes for pserver read-only repository access: + (check_command_legal_p): new func. Right now, just checks if + repository modification is permitted, and that only if pserver is + active. + (do_cvs_command): take new parameter `cmd_name', a string. All + callers changed. Pass it on to new func check_command_legal_p() + before executing the command. + (CVS_Username): new global, init to NULL. Used by + check_command_legal_p(), set in check_password(). + (check_password): set above new global CVS_Username; reorganized a + bit to facilitate this. + (check_repository_password): give *host_user_ptr permanent + storage iff success. + + * main.c: Changes for pserver read-only repository access: + (lookup_command_attribute): new func. + (main): use new func lookup_command_attribute() to establish if + CVS_CMD_IGNORE_ADMROOT and CVS_CMD_USES_WORK_DIR. + + * cvs.h: Changes for pserver read-only repository access: + (CVSROOTADM_READERS, CVSROOTADM_WRITERS): new #defines. + Prototype lookup_command_attribute(). + (CVS_CMD_IGNORE_ADMROOT, CVS_CMD_USES_WORK_DIR, + CVS_CMD_MODIFIES_REPOSITORY): new #defines for + lookup_command_attribute() and its callers. + +Wed Jan 1 19:50:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h.in: Reword comment for TMPDIR_DFLT to make it clear + that this isn't specific to the pserver server. + + * modules.c (do_module): Give an error message if one tries to + specify -a together with another option. + * sanity.sh (modules2): New tests modules2-a* test for above fix. + + * sanity.sh (devcom): Add tests devcom-a-nonexist and + devcom-t-nonexist for "cvs watchers" on nonexistent argument. + +1997-01-01 Fred Fish <fnf@ninemoons.com> + + * run.c (piped_child, filter_stream_through_program): Actually + install these HAVE_VFORK patches that got missed. + (There was a log entry for these changes for 29 Nov 1996 but it + seems I accidentally forgot to actually check them in -kingdon). + +Wed Jan 1 18:32:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * Makefile.in: Add ChangeLog-96. + * ChangeLog-96: New file, contains former contents of ChangeLog. + * ChangeLog: Now just contains 1997 changes. + + +For older changes see ChangeLog-96. diff --git a/gnu/usr.bin/cvs/src/add.c b/gnu/usr.bin/cvs/src/add.c index 92209306b56..ab667df39a8 100644 --- a/gnu/usr.bin/cvs/src/add.c +++ b/gnu/usr.bin/cvs/src/add.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Add * @@ -26,8 +26,9 @@ #include "cvs.h" #include "savecwd.h" +#include "fileattr.h" -static int add_directory PROTO((char *repository, List *, char *dir)); +static int add_directory PROTO ((struct file_info *finfo)); static int build_entry PROTO((char *repository, char *user, char *options, char *message, List * entries, char *tag)); @@ -36,57 +37,16 @@ static const char *const add_usage[] = "Usage: %s %s [-k rcs-kflag] [-m message] files...\n", "\t-k\tUse \"rcs-kflag\" to add the file with the specified kflag.\n", "\t-m\tUse \"message\" for the creation log.\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; -static char *combine_dir PROTO ((char *, char *)); - -/* Given a directory DIR and a subdirectory within it, SUBDIR, combine - the two into a new directory name. Returns a newly malloc'd string. - For now this is a fairly simple affair, but perhaps it will want - to have grander ambitions in the context of VMS or others (or perhaps - not, perhaps that should all be hidden inside CVS_FOPEN and libc and so - on, and CVS should just see foo/bar/baz style pathnames). */ -static char * -combine_dir (dir, subdir) - char *dir; - char *subdir; -{ - char *retval; - size_t dir_len; - - dir_len = strlen (dir); - retval = xmalloc (dir_len + strlen (subdir) + 10); - if (dir_len >= 2 - && dir[dir_len - 1] == '.' - && ISDIRSEP (dir[dir_len - 2])) - { - /* The dir name has an extraneous "." at the end. - I'm not completely sure that this is the best place - to strip it off--it is possible that Name_Repository - should do so, or it shouldn't be in the CVS/Repository - file in the first place. Fixing it here seems like - a safe, small change, but I'm not sure it catches - all the cases. */ - strncpy (retval, dir, dir_len - 2); - retval[dir_len - 2] = '\0'; - } - else - { - strcpy (retval, dir); - } - strcat (retval, "/"); - strcat (retval, subdir); - return retval; -} - int add (argc, argv) int argc; char **argv; { char *message = NULL; - char *user; int i; char *repository; int c; @@ -95,6 +55,7 @@ add (argc, argv) char *options = NULL; List *entries; Vers_TS *vers; + struct saved_cwd cwd; if (argc == 1 || argc == -1) usage (add_usage); @@ -128,17 +89,64 @@ add (argc, argv) if (argc <= 0) usage (add_usage); - /* find the repository associated with our current dir */ - repository = Name_Repository ((char *) NULL, (char *) NULL); + /* First some sanity checks. I know that the CVS case is (sort of) + also handled by add_directory, but we need to check here so the + client won't get all confused in send_file_names. */ + for (i = 0; i < argc; i++) + { + int skip_file = 0; + + /* If it were up to me I'd probably make this a fatal error. + But some people are really fond of their "cvs add *", and + don't seem to object to the warnings. + Whatever. */ + strip_trailing_slashes (argv[i]); + if (strcmp (argv[i], ".") == 0 + || strcmp (argv[i], "..") == 0 + || fncmp (argv[i], CVSADM) == 0) + { + error (0, 0, "cannot add special file `%s'; skipping", argv[i]); + skip_file = 1; + } + + if (skip_file) + { + int j; + + /* FIXME: We don't do anything about free'ing argv[i]. But + the problem is that it is only sometimes allocated (see + cvsrc.c). */ + + for (j = i; j < argc - 1; ++j) + argv[j] = argv[j + 1]; + --argc; + /* Check the new argv[i] again. */ + --i; + ++err; + } + } #ifdef CLIENT_SUPPORT if (client_active) { int i; + + if (argc == 0) + /* We snipped out all the arguments in the above sanity + check. We can just forget the whole thing (and we + better, because if we fired up the server and passed it + nothing, it would spit back a usage message). */ + return err; + start_server (); ign_setup (); if (options) send_arg(options); option_with_arg ("-m", message); + + repository = Name_Repository (NULL, NULL); + send_a_repository ("", repository, ""); + free (repository); + for (i = 0; i < argc; ++i) /* FIXME: Does this erroneously call Create_Admin in error conditions which are only detected once the server gets its @@ -149,16 +157,48 @@ add (argc, argv) char *date; int nonbranch; char *rcsdir; + char *p; + char *update_dir; + /* This is some mungeable storage into which we can point + with p and/or update_dir. */ + char *filedir; + + if (save_cwd (&cwd)) + error_exit (); + + filedir = xstrdup (argv[i]); + p = last_component (filedir); + if (p == filedir) + { + update_dir = ""; + } + else + { + p[-1] = '\0'; + update_dir = filedir; + if (CVS_CHDIR (update_dir) < 0) + error (1, errno, + "could not chdir to %s", update_dir); + } + + /* find the repository associated with our current dir */ + repository = Name_Repository (NULL, update_dir); /* before we do anything else, see if we have any per-directory tags */ ParseTag (&tag, &date, &nonbranch); - rcsdir = combine_dir (repository, argv[i]); + rcsdir = xmalloc (strlen (repository) + strlen (p) + 5); + sprintf (rcsdir, "%s/%s", repository, p); + + Create_Admin (p, argv[i], rcsdir, tag, date, + nonbranch, 0); - strip_trailing_slashes (argv[i]); + send_a_repository ("", repository, update_dir); - Create_Admin (argv[i], argv[i], rcsdir, tag, date, nonbranch); + if (restore_cwd (&cwd, NULL)) + error_exit (); + free_cwd (&cwd); if (tag) free (tag); @@ -166,32 +206,24 @@ add (argc, argv) free (date); free (rcsdir); - if (strchr (argv[i], '/') == NULL) + if (p == filedir) Subdir_Register ((List *) NULL, (char *) NULL, argv[i]); else { - char *cp, *b; - - cp = xstrdup (argv[i]); - b = strrchr (cp, '/'); - *b++ = '\0'; - Subdir_Register ((List *) NULL, cp, b); - free (cp); + Subdir_Register ((List *) NULL, update_dir, p); } + free (repository); + free (filedir); } send_file_names (argc, argv, SEND_EXPAND_WILD); - /* FIXME: should be able to pass SEND_NO_CONTENTS, I think. */ - send_files (argc, argv, 0, 0, SEND_BUILD_DIRS); + send_files (argc, argv, 0, 0, SEND_BUILD_DIRS | SEND_NO_CONTENTS); send_to_server ("add\012", 0); if (message) free (message); - free (repository); - return get_responses_and_close (); + return err + get_responses_and_close (); } #endif - entries = Entries_Open (0); - /* walk the arg list adding files/dirs */ for (i = 0; i < argc; i++) { @@ -200,24 +232,42 @@ add (argc, argv) int begin_added_files = added_files; #endif struct file_info finfo; + char *p; + + memset (&finfo, 0, sizeof finfo); - user = argv[i]; - strip_trailing_slashes (user); - if (strchr (user, '/') != NULL) + if (save_cwd (&cwd)) + error_exit (); + + finfo.fullname = xstrdup (argv[i]); + p = last_component (argv[i]); + if (p == argv[i]) { - error (0, 0, - "cannot add files with '/' in their name; %s not added", user); - err++; - continue; + finfo.update_dir = ""; + finfo.file = p; + } + else + { + p[-1] = '\0'; + finfo.update_dir = argv[i]; + finfo.file = p; + if (CVS_CHDIR (finfo.update_dir) < 0) + error (1, errno, "could not chdir to %s", finfo.update_dir); } - memset (&finfo, 0, sizeof finfo); - finfo.file = user; - finfo.update_dir = ""; - finfo.fullname = user; + /* Add wrappers for this directory. They exist only until + the next call to wrap_add_file. */ + wrap_add_file (CVSDOTWRAPPER, 1); + + finfo.rcs = NULL; + + /* Find the repository associated with our current dir. */ + repository = Name_Repository (NULL, finfo.update_dir); + + entries = Entries_Open (0); + finfo.repository = repository; finfo.entries = entries; - finfo.rcs = NULL; /* We pass force_tag_match as 1. If the directory has a sticky branch tag, and there is already an RCS file which @@ -233,23 +283,25 @@ add (argc, argv) if (vers->ts_user == NULL) { /* There is no user file either */ - error (0, 0, "nothing known about %s", user); + error (0, 0, "nothing known about %s", finfo.fullname); err++; } - else if (!isdir (user) || wrap_name_has (user, WRAP_TOCVS)) + else if (!isdir (finfo.file) + || wrap_name_has (finfo.file, WRAP_TOCVS)) { /* * See if a directory exists in the repository with * the same name. If so, blow this request off. */ - char *dname = xmalloc (strlen (repository) + strlen (user) + char *dname = xmalloc (strlen (repository) + + strlen (finfo.file) + 10); - (void) sprintf (dname, "%s/%s", repository, user); + (void) sprintf (dname, "%s/%s", repository, finfo.file); if (isdir (dname)) { error (0, 0, "cannot add file `%s' since the directory", - user); + finfo.fullname); error (0, 0, "`%s' already exists in the repository", dname); error (1, 0, "illegal filename overlap"); @@ -262,11 +314,11 @@ add (argc, argv) rcs file if it existed, e.g. the file exists on another branch). Check for a value from the wrapper stuff. */ - if (wrap_name_has (user, WRAP_RCSOPTION)) + if (wrap_name_has (finfo.file, WRAP_RCSOPTION)) { if (vers->options) free (vers->options); - vers->options = wrap_rcsoption (user, 1); + vers->options = wrap_rcsoption (finfo.file, 1); } } @@ -280,7 +332,7 @@ add (argc, argv) else { /* There is a user file, so build the entry for it */ - if (build_entry (repository, user, vers->options, + if (build_entry (repository, finfo.file, vers->options, message, entries, vers->tag) != 0) err++; else @@ -291,17 +343,19 @@ add (argc, argv) if (vers->tag) error (0, 0, "\ scheduling %s `%s' for addition on branch `%s'", - (wrap_name_has (user, WRAP_TOCVS) + (wrap_name_has (finfo.file, + WRAP_TOCVS) ? "wrapper" : "file"), - user, vers->tag); + finfo.fullname, vers->tag); else error (0, 0, "scheduling %s `%s' for addition", - (wrap_name_has (user, WRAP_TOCVS) + (wrap_name_has (finfo.file, + WRAP_TOCVS) ? "wrapper" : "file"), - user); + finfo.fullname); } } } @@ -309,10 +363,11 @@ scheduling %s `%s' for addition on branch `%s'", } else if (RCS_isdead (vers->srcfile, vers->vn_rcs)) { - if (isdir (user) && !wrap_name_has (user, WRAP_TOCVS)) + if (isdir (finfo.file) + && !wrap_name_has (finfo.file, WRAP_TOCVS)) { error (0, 0, "\ -the directory `%s' cannot be added because a file of the", user); +the directory `%s' cannot be added because a file of the", finfo.fullname); error (1, 0, "\ same name already exists in the repository."); } @@ -330,7 +385,7 @@ same name already exists in the repository."); if (vers->tag) error (0, 0, "\ file `%s' will be added on branch `%s' from version %s", - user, vers->tag, vers->vn_rcs); + finfo.fullname, vers->tag, vers->vn_rcs); else /* I'm not sure that mentioning vers->vn_rcs makes any sense here; I @@ -338,8 +393,9 @@ file `%s' will be added on branch `%s' from version %s", message which is not confusing. */ error (0, 0, "\ re-adding file %s (in place of dead revision %s)", - user, vers->vn_rcs); - Register (entries, user, "0", vers->ts_user, NULL, + finfo.fullname, vers->vn_rcs); + Register (entries, finfo.file, "0", vers->ts_user, + NULL, vers->tag, NULL, NULL); ++added_files; } @@ -351,7 +407,8 @@ re-adding file %s (in place of dead revision %s)", * There is an RCS file already, so somebody else must've * added it */ - error (0, 0, "%s added independently by second party", user); + error (0, 0, "%s added independently by second party", + finfo.fullname); err++; } } @@ -362,7 +419,7 @@ re-adding file %s (in place of dead revision %s)", * An entry for a new-born file, ts_rcs is dummy, but that is * inappropriate here */ - error (0, 0, "%s has already been entered", user); + error (0, 0, "%s has already been entered", finfo.fullname); err++; } else if (vers->vn_user[0] == '-') @@ -379,7 +436,7 @@ re-adding file %s (in place of dead revision %s)", * it from under us */ error (0, 0, "\ -cannot resurrect %s; RCS file removed by second party", user); +cannot resurrect %s; RCS file removed by second party", finfo.fullname); err++; } else @@ -389,12 +446,13 @@ cannot resurrect %s; RCS file removed by second party", user); * There is an RCS file, so remove the "-" from the * version number and restore the file */ - char *tmp = xmalloc (strlen (user) + 50); + char *tmp = xmalloc (strlen (finfo.file) + 50); (void) strcpy (tmp, vers->vn_user + 1); (void) strcpy (vers->vn_user, tmp); - (void) sprintf (tmp, "Resurrected %s", user); - Register (entries, user, vers->vn_user, tmp, vers->options, + (void) sprintf (tmp, "Resurrected %s", finfo.file); + Register (entries, finfo.file, vers->vn_user, tmp, + vers->options, vers->tag, vers->date, vers->ts_conflict); free (tmp); @@ -404,12 +462,13 @@ cannot resurrect %s; RCS file removed by second party", user); check the file out. */ if (update (2, argv + i - 1) == 0) { - error (0, 0, "%s, version %s, resurrected", user, + error (0, 0, "%s, version %s, resurrected", + finfo.fullname, vers->vn_user); } else { - error (0, 0, "could not resurrect %s", user); + error (0, 0, "could not resurrect %s", finfo.fullname); err++; } } @@ -418,14 +477,15 @@ cannot resurrect %s; RCS file removed by second party", user); { /* The user file shouldn't be there */ error (0, 0, "\ -%s should be removed and is still there (or is back again)", user); +%s should be removed and is still there (or is back again)", finfo.fullname); err++; } } else { /* A normal entry, ts_rcs is valid, so it must already be there */ - error (0, 0, "%s already exists, with version number %s", user, + error (0, 0, "%s already exists, with version number %s", + finfo.fullname, vers->vn_user); err++; } @@ -433,26 +493,34 @@ cannot resurrect %s; RCS file removed by second party", user); /* passed all the checks. Go ahead and add it if its a directory */ if (begin_err == err - && isdir (user) - && !wrap_name_has (user, WRAP_TOCVS)) + && isdir (finfo.file) + && !wrap_name_has (finfo.file, WRAP_TOCVS)) { - err += add_directory (repository, entries, user); - continue; + err += add_directory (&finfo); } + else + { #ifdef SERVER_SUPPORT - if (server_active && begin_added_files != added_files) - server_checked_in (user, ".", repository); + if (server_active && begin_added_files != added_files) + server_checked_in (finfo.file, finfo.update_dir, repository); #endif + } + free (repository); + Entries_Close (entries); + + if (restore_cwd (&cwd, NULL)) + error_exit (); + free_cwd (&cwd); + + free (finfo.fullname); } if (added_files) - error (0, 0, "use 'cvs commit' to add %s permanently", + error (0, 0, "use '%s commit' to add %s permanently", + program_name, (added_files == 1) ? "this file" : "these files"); - Entries_Close (entries); - if (message) free (message); - free (repository); return (err); } @@ -465,24 +533,28 @@ cannot resurrect %s; RCS file removed by second party", user); * Returns 1 on failure, 0 on success. */ static int -add_directory (repository, entries, dir) - char *repository; - List *entries; - char *dir; +add_directory (finfo) + struct file_info *finfo; { + char *repository = finfo->repository; + List *entries = finfo->entries; + char *dir = finfo->file; + char *rcsdir = NULL; struct saved_cwd cwd; char *message = NULL; char *tag, *date; int nonbranch; + char *attrs; if (strchr (dir, '/') != NULL) { + /* "Can't happen". */ error (0, 0, "directory %s not added; must be a direct sub-directory", dir); return (1); } - if (strcmp (dir, CVSADM) == 0) + if (fncmp (dir, CVSADM) == 0) { error (0, 0, "cannot add a `%s' directory", CVSADM); return (1); @@ -491,12 +563,18 @@ add_directory (repository, entries, dir) /* before we do anything else, see if we have any per-directory tags */ ParseTag (&tag, &date, &nonbranch); + /* Remember the default attributes from this directory, so we can apply + them to the new directory. */ + fileattr_startdir (repository); + attrs = fileattr_getall (NULL); + fileattr_free (); + /* now, remember where we were, so we can get back */ if (save_cwd (&cwd)) return (1); if ( CVS_CHDIR (dir) < 0) { - error (0, errno, "cannot chdir to %s", dir); + error (0, errno, "cannot chdir to %s", finfo->fullname); return (1); } #ifdef SERVER_SUPPORT @@ -505,19 +583,24 @@ add_directory (repository, entries, dir) if (isfile (CVSADM)) #endif { - error (0, 0, "%s/%s already exists", dir, CVSADM); + error (0, 0, "%s/%s already exists", finfo->fullname, CVSADM); goto out; } - rcsdir = combine_dir (repository, dir); + rcsdir = xmalloc (strlen (repository) + strlen (dir) + 5); + sprintf (rcsdir, "%s/%s", repository, dir); if (isfile (rcsdir) && !isdir (rcsdir)) { - error (0, 0, "%s is not a directory; %s not added", rcsdir, dir); + error (0, 0, "%s is not a directory; %s not added", rcsdir, + finfo->fullname); goto out; } /* setup the log message */ - message = xmalloc (strlen (rcsdir) + 80); + message = xmalloc (strlen (rcsdir) + + 80 + + (tag == NULL ? 0 : strlen (tag) + 80) + + (date == NULL ? 0 : strlen (date) + 80)); (void) sprintf (message, "Directory %s added to the repository\n", rcsdir); if (tag) { @@ -559,6 +642,15 @@ add_directory (repository, entries, dir) (void) umask (omask); } + /* Now set the default file attributes to the ones we inherited + from the parent directory. */ + fileattr_startdir (rcsdir); + fileattr_setall (NULL, attrs); + fileattr_write (); + fileattr_free (); + if (attrs != NULL) + free (attrs); + /* * Set up an update list with a single title node for Update_Logfile */ @@ -579,9 +671,9 @@ add_directory (repository, entries, dir) #ifdef SERVER_SUPPORT if (!server_active) - Create_Admin (".", dir, rcsdir, tag, date, nonbranch); + Create_Admin (".", finfo->fullname, rcsdir, tag, date, nonbranch, 0); #else - Create_Admin (".", dir, rcsdir, tag, date, nonbranch); + Create_Admin (".", finfo->fullname, rcsdir, tag, date, nonbranch, 0); #endif if (tag) free (tag); @@ -594,7 +686,8 @@ add_directory (repository, entries, dir) Subdir_Register (entries, (char *) NULL, dir); - (void) printf ("%s", message); + cvs_output (message, 0); + free (rcsdir); free (message); diff --git a/gnu/usr.bin/cvs/src/buffer.h b/gnu/usr.bin/cvs/src/buffer.h index b62456cf63c..c632490c041 100644 --- a/gnu/usr.bin/cvs/src/buffer.h +++ b/gnu/usr.bin/cvs/src/buffer.h @@ -110,6 +110,10 @@ extern struct buffer *stdio_buffer_initialize PROTO((FILE *, int, void (*) (struct buffer *))); extern struct buffer *compress_buffer_initialize PROTO((struct buffer *, int, int, void (*) (struct buffer *))); +extern struct buffer *packetizing_buffer_initialize + PROTO((struct buffer *, int (*) (void *, const char *, char *, int), + int (*) (void *, const char *, char *, int, int *), void *, + void (*) (struct buffer *))); extern int buf_empty_p PROTO((struct buffer *)); extern void buf_output PROTO((struct buffer *, const char *, int)); extern void buf_output0 PROTO((struct buffer *, const char *)); diff --git a/gnu/usr.bin/cvs/src/build_src.com b/gnu/usr.bin/cvs/src/build_src.com index 784adb5e415..3adb1e4f53d 100644 --- a/gnu/usr.bin/cvs/src/build_src.com +++ b/gnu/usr.bin/cvs/src/build_src.com @@ -65,4 +65,4 @@ status.obj,- subr.obj,tag.obj,update.obj,version.obj,vers_ts.obj,watch.obj,wrapper.obj,- zlib.obj $ link/nodeb/exe=cvs.exe main.obj,cvslib.olb/lib,[-.lib]gnulib.olb/lib,- -[-.vms]openvmslib.olb/lib,[-.zlib]zlib.olb/lib +[-.vms]openvmslib.olb/lib,[-.zlib]zlib.olb/lib,[-.diff]diff.olb/lib diff --git a/gnu/usr.bin/cvs/src/checkin.c b/gnu/usr.bin/cvs/src/checkin.c index 0da220c6f03..1d89ae12cd9 100644 --- a/gnu/usr.bin/cvs/src/checkin.c +++ b/gnu/usr.bin/cvs/src/checkin.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Check In * @@ -69,7 +69,10 @@ Checkin (type, finfo, rcs, rev, tag, options, message) } } - switch (RCS_checkin (rcs, NULL, message, rev, 0)) + if (finfo->rcs == NULL) + finfo->rcs = RCS_parse (finfo->file, finfo->repository); + + switch (RCS_checkin (finfo->rcs, NULL, message, rev, 0)) { case 0: /* everything normal */ @@ -85,12 +88,6 @@ Checkin (type, finfo, rcs, rev, tag, options, message) if (strcmp (options, "-V4") == 0) /* upgrade to V5 now */ options[0] = '\0'; - /* Reparse the RCS file, so that we can safely call - RCS_checkout. FIXME: We could probably calculate - all the changes. */ - freercsnode (&finfo->rcs); - finfo->rcs = RCS_parse (finfo->file, finfo->repository); - /* FIXME: should be checking for errors. */ (void) RCS_checkout (finfo->rcs, finfo->file, rev, (char *) NULL, options, RUN_TTY, @@ -117,7 +114,7 @@ Checkin (type, finfo, rcs, rev, tag, options, message) * If we want read-only files, muck the permissions here, before * getting the file time-stamp. */ - if (cvswrite == FALSE || fileattr_get (finfo->file, "_watched")) + if (!cvswrite || fileattr_get (finfo->file, "_watched")) xchmod (finfo->file, 0); /* Re-register with the new data. */ @@ -173,6 +170,7 @@ Checkin (type, finfo, rcs, rev, tag, options, message) if (rev) { (void) RCS_unlock (finfo->rcs, NULL, 1); + RCS_rewrite (finfo->rcs, NULL, NULL); } #ifdef SERVER_SUPPORT diff --git a/gnu/usr.bin/cvs/src/classify.c b/gnu/usr.bin/cvs/src/classify.c index 55851f7bb24..57c23cdc9b3 100644 --- a/gnu/usr.bin/cvs/src/classify.c +++ b/gnu/usr.bin/cvs/src/classify.c @@ -3,19 +3,14 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * */ #include "cvs.h" -#ifdef SERVER_SUPPORT -static void sticky_ck PROTO((char *file, int aflag, Vers_TS * vers, - List * entries, - char *repository, char *update_dir)); -#else -static void sticky_ck PROTO((char *file, int aflag, Vers_TS * vers, List * entries)); -#endif +static void sticky_ck PROTO ((struct file_info *finfo, int aflag, + Vers_TS * vers)); /* * Classify the state of a file @@ -26,7 +21,11 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp, struct file_info *finfo; char *tag; char *date; + + /* Keyword expansion options. Can be either NULL or "" to + indicate none are specified here. */ char *options; + int force_tag_match; int aflag; Vers_TS **versp; @@ -68,8 +67,8 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp, is what I would expect. */ if (!force_tag_match || !(vers->tag || vers->date)) if (!really_quiet) - error (0, 0, "use `cvs add' to create an entry for %s", - finfo->fullname); + error (0, 0, "use `%s add' to create an entry for %s", + program_name, finfo->fullname); ret = T_UNKNOWN; } } @@ -79,8 +78,8 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp, ret = T_UPTODATE; else { - error (0, 0, "use `cvs add' to create an entry for %s", - finfo->fullname); + error (0, 0, "use `%s add' to create an entry for %s", + program_name, finfo->fullname); ret = T_UNKNOWN; } } @@ -308,12 +307,7 @@ conflict: %s created independently by second party", ret = T_CHECKOUT; else { -#ifdef SERVER_SUPPORT - sticky_ck (finfo->file, aflag, vers, finfo->entries, - finfo->repository, finfo->update_dir); -#else - sticky_ck (finfo->file, aflag, vers, finfo->entries); -#endif + sticky_ck (finfo, aflag, vers); ret = T_UPTODATE; } } @@ -339,12 +333,7 @@ conflict: %s created independently by second party", ret = T_NEEDS_MERGE; #else ret = T_MODIFIED; -#ifdef SERVER_SUPPORT - sticky_ck (finfo->file, aflag, vers, finfo->entries, - finfo->repository, finfo->update_dir); -#else - sticky_ck (finfo->file, aflag, vers, finfo->entries); -#endif /* SERVER_SUPPORT */ + sticky_ck (finfo, aflag, vers); #endif } else @@ -434,19 +423,10 @@ conflict: %s created independently by second party", } static void -#ifdef SERVER_SUPPORT -sticky_ck (file, aflag, vers, entries, repository, update_dir) -#else -sticky_ck (file, aflag, vers, entries) -#endif - char *file; +sticky_ck (finfo, aflag, vers) + struct file_info *finfo; int aflag; Vers_TS *vers; - List *entries; -#ifdef SERVER_SUPPORT - char *repository; - char *update_dir; -#endif { if (aflag || vers->tag || vers->date) { @@ -458,7 +438,7 @@ sticky_ck (file, aflag, vers, entries) (entdate && vers->date && strcmp (entdate, vers->date)) || ((entdate && !vers->date) || (!entdate && vers->date))) { - Register (entries, file, vers->vn_user, vers->ts_rcs, + Register (finfo->entries, finfo->file, vers->vn_user, vers->ts_rcs, vers->options, vers->tag, vers->date, vers->ts_conflict); #ifdef SERVER_SUPPORT @@ -468,7 +448,7 @@ sticky_ck (file, aflag, vers, entries) It is possible we will later update it again via server_updated or some such, but that is OK. */ server_update_entries - (file, update_dir, repository, + (finfo->file, finfo->update_dir, finfo->repository, strcmp (vers->ts_rcs, vers->ts_user) == 0 ? SERVER_UPDATED : SERVER_MERGED); } diff --git a/gnu/usr.bin/cvs/src/client.h b/gnu/usr.bin/cvs/src/client.h index 1f9c27f3087..119168ccde6 100644 --- a/gnu/usr.bin/cvs/src/client.h +++ b/gnu/usr.bin/cvs/src/client.h @@ -11,9 +11,14 @@ extern int filter_through_gunzip PROTO((int, int, pid_t *)); #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) +/* Whether the connection should be encrypted. */ extern int cvsencrypt; +/* Whether the connection should use per-packet authentication. */ +extern int cvsauthenticate; + #ifdef ENCRYPTION + #ifdef HAVE_KERBEROS /* We can't declare the arguments without including krb.h, and I don't @@ -21,8 +26,24 @@ extern int cvsencrypt; extern struct buffer *krb_encrypt_buffer_initialize (); #endif /* HAVE_KERBEROS */ + +#ifdef HAVE_GSSAPI + +/* Set this to turn on GSSAPI encryption. */ +extern int cvs_gssapi_encrypt; + +#endif /* HAVE_GSSAPI */ + #endif /* ENCRYPTION */ +#ifdef HAVE_GSSAPI + +/* We can't declare the arguments without including gssapi.h, and I + don't want to do that in every file. */ +extern struct buffer *cvs_gssapi_wrap_buffer_initialize (); + +#endif /* HAVE_GSSAPI */ + #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */ #ifdef CLIENT_SUPPORT @@ -37,13 +58,14 @@ extern int client_prune_dirs; #ifdef AUTH_CLIENT_SUPPORT extern int use_authenticating_server; -int connect_to_pserver PROTO((int *tofdp, int* fromfdp, int verify_only)); +void connect_to_pserver PROTO ((int *tofdp, int* fromfdp, int verify_only, + int do_gssapi)); # ifndef CVS_AUTH_PORT # define CVS_AUTH_PORT 2401 # endif /* CVS_AUTH_PORT */ #endif /* AUTH_CLIENT_SUPPORT */ -#ifdef AUTH_SERVER_SUPPORT +#if defined (AUTH_SERVER_SUPPORT) || (defined (SERVER_SUPPORT) && defined (HAVE_GSSAPI)) extern void pserver_authenticate_connection PROTO ((void)); #endif @@ -98,6 +120,8 @@ send_arg PROTO((char *string)); void send_option_string PROTO((char *string)); +extern void send_a_repository PROTO ((char *, char *, char *)); + #endif /* CLIENT_SUPPORT */ /* @@ -115,6 +139,8 @@ struct response * Function to carry out the response. ARGS is the text of the * command after name and, if present, a single space, have been * stripped off. The function can scribble into ARGS if it wants. + * Note that although LEN is given, ARGS is also guaranteed to be + * '\0' terminated. */ void (*func) PROTO((char *args, int len)); diff --git a/gnu/usr.bin/cvs/src/create_adm.c b/gnu/usr.bin/cvs/src/create_adm.c index 0ef6e57fc5e..c1772b216f6 100644 --- a/gnu/usr.bin/cvs/src/create_adm.c +++ b/gnu/usr.bin/cvs/src/create_adm.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Create Administration. * @@ -13,35 +13,41 @@ #include "cvs.h" -/* update_dir includes dir as its last component. */ +/* update_dir includes dir as its last component. -void -Create_Admin (dir, update_dir, repository, tag, date, nonbranch) + Return value is 0 for success, or 1 if we printed a warning message. + Note that many errors are still fatal; particularly for unlikely errors + a fatal error is probably better than a warning which might be missed + or after which CVS might do something non-useful. If WARN is zero, then + don't print warnings; all errors are fatal then. */ + +int +Create_Admin (dir, update_dir, repository, tag, date, nonbranch, warn) char *dir; char *update_dir; char *repository; char *tag; char *date; int nonbranch; + int warn; { FILE *fout; char *cp; + char *reposcopy; char *tmp; #ifdef SERVER_SUPPORT if (trace) { - char *wd = xgetwd (); - fprintf (stderr, "%c-> Create_Admin (%s, %s, %s, %s, %s) in %s\n", + fprintf (stderr, "%c-> Create_Admin (%s, %s, %s, %s, %s, %d, %d)\n", (server_active) ? 'S' : ' ', - dir, update_dir, repository, tag ? tag : "", - date ? date : "", wd); - free (wd); + dir, update_dir, repository, tag ? tag : "", + date ? date : "", nonbranch, warn); } #endif if (noexec) - return; + return 0; tmp = xmalloc (strlen (dir) + 100); if (dir != NULL) @@ -51,7 +57,21 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch) if (isfile (tmp)) error (1, 0, "there is a version in %s already", update_dir); - make_directory (tmp); + if (CVS_MKDIR (tmp, 0777) < 0) + { + if (warn) + { + /* The reason that this is a warning, rather than silently + just skipping creating the directory, is that we don't want + CVS's behavior to vary subtly based on factors (like directory + permissions) which are not made clear to the user. With + the warning at least we let them know what is going on. */ + error (0, errno, "warning: cannot make directory %s", tmp); + return 1; + } + else + error (1, errno, "cannot make directory %s", tmp); + } /* record the current cvs root for later use */ @@ -68,8 +88,22 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch) else error (1, errno, "cannot open %s/%s", update_dir, CVSADM_REP); } - cp = repository; - strip_trailing_slashes (cp); + reposcopy = xstrdup (repository); + Sanitize_Repository_Name (reposcopy); + + /* The top level of the repository is a special case -- we need to + write it with an extra dot at the end. This trailing `.' stuff + rubs me the wrong way -- on the other hand, I don't want to + spend the time making sure all of the code can handle it if we + don't do it. */ + + if (strcmp (reposcopy, CVSroot_directory) == 0) + { + reposcopy = xrealloc (reposcopy, strlen (reposcopy) + 3); + strcat (reposcopy, "/."); + } + + cp = reposcopy; #ifdef RELATIVE_REPOS /* @@ -81,8 +115,8 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch) char *path = xmalloc (strlen (CVSroot_directory) + 10); (void) sprintf (path, "%s/", CVSroot_directory); - if (strncmp (repository, path, strlen (path)) == 0) - cp = repository + strlen (path); + if (strncmp (cp, path, strlen (path)) == 0) + cp += strlen (path); free (path); } #endif @@ -139,5 +173,7 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch) } #endif + free (reposcopy); free (tmp); + return 0; } diff --git a/gnu/usr.bin/cvs/src/error.c b/gnu/usr.bin/cvs/src/error.c index 5c7eef500ae..cb69bdeff4f 100644 --- a/gnu/usr.bin/cvs/src/error.c +++ b/gnu/usr.bin/cvs/src/error.c @@ -83,7 +83,13 @@ error_exit PROTO ((void)) format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status EXIT_FAILURE if STATUS is nonzero. If MESSAGE is "", - no need to print a message. */ + no need to print a message. + + I think this is largely cleaned up to the point where it does the right + thing for the server, whether the normal server_active (child process) + case or the error_use_protocol (parent process) case. The one exception + is that STATUS nonzero for error_use_protocol probably doesn't work yet; + in that case still need to use the pending_error machinery in server.c. */ /* VARARGS */ void #if defined (HAVE_VPRINTF) && defined (__STDC__) diff --git a/gnu/usr.bin/cvs/src/expand_path.c b/gnu/usr.bin/cvs/src/expand_path.c index 7d0bc39e5ab..5cf414e35d7 100644 --- a/gnu/usr.bin/cvs/src/expand_path.c +++ b/gnu/usr.bin/cvs/src/expand_path.c @@ -184,6 +184,19 @@ expand_path (name, file, line) t = get_homedir (); else { +#ifdef GETPWNAM_MISSING + for (; *p!='/' && *p; p++) + ; + *p = 0; + if (line != 0) + error (0, 0, + "%s:%d:tilde expansion not supported on this system", + file, line); + else + error (0, 0, "%s:tilde expansion not supported on this system", + file); + return NULL; +#else struct passwd *ps; for (; *p!='/' && *p; p++) ; @@ -199,6 +212,7 @@ expand_path (name, file, line) return NULL; } t = ps->pw_dir; +#endif } doff = d - buf; expand_string (&buf, &buf_size, doff + 1); @@ -256,8 +270,11 @@ expand_variable (name, file, line) { if (strcmp (name, CVSROOT_ENV) == 0) return CVSroot_original; - else if (strcmp (name, RCSBIN_ENV) == 0) - return Rcsbin; + else if (strcmp (name, "RCSBIN") == 0) + { + error (0, 0, "RCSBIN internal variable is no longer supported"); + return NULL; + } else if (strcmp (name, EDITOR1_ENV) == 0) return Editor; else if (strcmp (name, EDITOR2_ENV) == 0) diff --git a/gnu/usr.bin/cvs/src/fileattr.h b/gnu/usr.bin/cvs/src/fileattr.h index c6362afa993..7e02b3a3cdb 100644 --- a/gnu/usr.bin/cvs/src/fileattr.h +++ b/gnu/usr.bin/cvs/src/fileattr.h @@ -115,6 +115,17 @@ extern char *fileattr_modify PROTO ((char *list, const char *attrname, extern void fileattr_set PROTO ((const char *filename, const char *attrname, const char *attrval)); +/* Get all the attributes for file FILENAME. They are returned as malloc'd + data in an unspecified format which is guaranteed only to be good for + passing to fileattr_setall, or NULL if no attributes. If FILENAME is + NULL, get default attributes. */ +extern char *fileattr_getall PROTO ((const char *filename)); + +/* Set the attributes for file FILENAME to ATTRS, overwriting all previous + attributes for that file. ATTRS was obtained from a previous call to + fileattr_getall (malloc'd data or NULL). */ +extern void fileattr_setall PROTO ((const char *filename, const char *attrs)); + /* Set the attributes for file FILENAME in whatever manner is appropriate for a newly created file. */ extern void fileattr_newfile PROTO ((const char *filename)); diff --git a/gnu/usr.bin/cvs/src/find_names.c b/gnu/usr.bin/cvs/src/find_names.c index 5d2a79e89b9..ed6c5c44b14 100644 --- a/gnu/usr.bin/cvs/src/find_names.c +++ b/gnu/usr.bin/cvs/src/find_names.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Find Names * @@ -200,6 +200,15 @@ Find_Directories (repository, which, entries) information is not recorded in the Entries file. Find the subdirectories the hard way, and, if possible, add it to the Entries file for next time. */ + + /* FIXME-maybe: find_dirs is bogus for this usage because + it skips CVSATTIC and CVSLCK directories--those names + should be special only in the repository. However, in + the interests of not perturbing this code, we probably + should leave well enough alone unless we want to write + a sanity.sh test case (which would operate by manually + hacking on the CVS/Entries file). */ + if (find_dirs (".", dirlist, 1, tmpentries) != 0) error (1, errno, "cannot open current directory"); if (tmpentries != NULL) @@ -292,6 +301,16 @@ find_dirs (dir, list, checkadm, entries) size_t tmp_size = 0; struct dirent *dp; DIR *dirp; + int skip_emptydir = 0; + + /* First figure out whether we need to skip directories named + Emptydir. Except in the CVSNULLREPOS case, Emptydir is just + a normal directory name. */ + if (isabsolute (dir) + && strncmp (dir, CVSroot_directory, strlen (CVSroot_directory)) == 0 + && ISDIRSEP (dir[strlen (CVSroot_directory)]) + && strcmp (dir + strlen (CVSroot_directory) + 1, CVSROOTADM) == 0) + skip_emptydir = 1; /* set up to read the dir */ if ((dirp = CVS_OPENDIR (dir)) == NULL) @@ -313,6 +332,10 @@ find_dirs (dir, list, checkadm, entries) if (entries != NULL && findnode (entries, dp->d_name) != NULL) continue; + if (skip_emptydir + && strcmp (dp->d_name, CVSNULLREPOS) == 0) + continue; + #ifdef DT_DIR if (dp->d_type != DT_DIR) { diff --git a/gnu/usr.bin/cvs/src/hash.c b/gnu/usr.bin/cvs/src/hash.c index a978d1f1bd8..ff3f122b747 100644 --- a/gnu/usr.bin/cvs/src/hash.c +++ b/gnu/usr.bin/cvs/src/hash.c @@ -2,7 +2,7 @@ * Copyright (c) 1992, Brian Berliner and Jeff Polk * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Polk's hash list manager. So cool. */ @@ -220,21 +220,23 @@ freenode (p) } /* - * insert item p at end of list "list" (maybe hash it too) if hashing and it - * already exists, return -1 and don't actually put it in the list + * Link item P into list LIST before item MARKER. If P->KEY is non-NULL and + * that key is already in the hash table, return -1 without modifying any + * parameter. * * return 0 on success */ int -addnode (list, p) +insert_before (list, marker, p) List *list; + Node *marker; Node *p; { - int hashval; - Node *q; - if (p->key != NULL) /* hash it too? */ { + int hashval; + Node *q; + hashval = hashp (p->key); if (list->hasharray[hashval] == NULL) /* make a header for list? */ { @@ -257,15 +259,40 @@ addnode (list, p) q->hashprev = p; } - /* put it into the regular list */ - p->prev = list->list->prev; - p->next = list->list; - list->list->prev->next = p; - list->list->prev = p; + p->next = marker; + p->prev = marker->prev; + marker->prev->next = p; + marker->prev = p; return (0); } +/* + * insert item p at end of list "list" (maybe hash it too) if hashing and it + * already exists, return -1 and don't actually put it in the list + * + * return 0 on success + */ +int +addnode (list, p) + List *list; + Node *p; +{ + return insert_before (list, list->list, p); +} + +/* + * Like addnode, but insert p at the front of `list'. This bogosity is + * necessary to preserve last-to-first output order for some RCS functions. + */ +int +addnode_at_front (list, p) + List *list; + Node *p; +{ + return insert_before (list, list->list->next, p); +} + /* Look up an entry in hash list table and return a pointer to the node. Return NULL if not found. Abort with a fatal error for errors. */ diff --git a/gnu/usr.bin/cvs/src/hash.h b/gnu/usr.bin/cvs/src/hash.h index a22bc1045c8..d29c757db4b 100644 --- a/gnu/usr.bin/cvs/src/hash.h +++ b/gnu/usr.bin/cvs/src/hash.h @@ -2,7 +2,7 @@ * Copyright (c) 1992, Brian Berliner and Jeff Polk * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. */ /* @@ -47,7 +47,9 @@ List *getlist PROTO((void)); Node *findnode PROTO((List * list, const char *key)); Node *findnode_fn PROTO((List * list, const char *key)); Node *getnode PROTO((void)); +int insert_before PROTO((List * list, Node * marker, Node * p)); int addnode PROTO((List * list, Node * p)); +int addnode_at_front PROTO((List * list, Node * p)); int walklist PROTO((List * list, int (*)(Node *n, void *closure), void *closure)); int list_isempty PROTO ((List *list)); void dellist PROTO((List ** listp)); diff --git a/gnu/usr.bin/cvs/src/myndbm.c b/gnu/usr.bin/cvs/src/myndbm.c index 1a3fcaea1a2..949ac7898fa 100644 --- a/gnu/usr.bin/cvs/src/myndbm.c +++ b/gnu/usr.bin/cvs/src/myndbm.c @@ -2,7 +2,7 @@ * Copyright (c) 1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * A simple ndbm-emulator for CVS. It parses a text file of the format: * @@ -21,6 +21,8 @@ static void mydbm_load_file PROTO ((FILE *, List *)); +/* Returns NULL on error in which case errno has been set to indicate + the error. Can also call error() itself. */ /* ARGSUSED */ DBM * mydbm_open (file, flags, mode) @@ -203,11 +205,12 @@ mydbm_load_file (fp, list) size_t value_allocated; char *cp, *vp; int len, cont; + int line_length; value_allocated = 1; value = xmalloc (value_allocated); - for (cont = 0; getline (&line, &line_len, fp) >= 0;) + for (cont = 0; (line_length = getline (&line, &line_len, fp)) >= 0;) { if ((cp = strrchr (line, '\012')) != NULL) *cp = '\0'; /* strip the newline */ @@ -288,6 +291,10 @@ mydbm_load_file (fp, list) } } } + if (line_length < 0 && !feof (fp)) + /* FIXME: should give the name of the file. */ + error (0, errno, "cannot read file in mydbm_load_file"); + free (line); free (value); } diff --git a/gnu/usr.bin/cvs/src/no_diff.c b/gnu/usr.bin/cvs/src/no_diff.c index 384800fda6b..6d6a6fbf101 100644 --- a/gnu/usr.bin/cvs/src/no_diff.c +++ b/gnu/usr.bin/cvs/src/no_diff.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * No Difference * diff --git a/gnu/usr.bin/cvs/src/options.h.in b/gnu/usr.bin/cvs/src/options.h.in index 476d747d0c4..144980e068a 100644 --- a/gnu/usr.bin/cvs/src/options.h.in +++ b/gnu/usr.bin/cvs/src/options.h.in @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * This file holds (most of) the configuration tweaks that can be made to * customize CVS for your site. CVS comes configured for a typical SunOS 4.x @@ -16,19 +16,6 @@ */ /* - * CVS provides the most features when used in conjunction with the - * Version-5 release of RCS. Thus, it is the default. This also - * assumes that GNU diff Version-1.15 is being used as well -- you - * will have to configure your RCS V5 release separately to make this - * the case. If you do not have RCS V5 and GNU diff V1.15, comment out - * this define. You should not try mixing and matching other - * combinations of these tools. - */ -#ifndef HAVE_RCS5 -#define HAVE_RCS5 -#endif - -/* * For portability and heterogeneity reasons, CVS is shipped by * default using my own text-file version of the ndbm database library * in the src/myndbm.c file. If you want better performance and are @@ -40,23 +27,6 @@ #endif /* - * The "diff" program to execute when creating patch output. This - * "diff" must support the "-c" option for context diffing. Specify a - * full pathname if your site wants to use a particular diff. Note - * that unlike the diff used with RCS, you *must not* supply -a here - * (doing so will cause the server to generate patches which patch - * cannot handle in some cases). - * - * NOTE: this program is only used for the ``patch'' sub-command (and - * for ``update'' if you are using the server). The other commands - * use rcsdiff which will use whatever version of diff was specified - * when rcsdiff was built on your system. - */ -#ifndef DIFF -#define DIFF "diff" -#endif - -/* * The "patch" program to run when using the CVS server and accepting * patches across the network. Specify a full pathname if your site * wants to use a particular patch. @@ -65,41 +35,6 @@ #define PATCH_PROGRAM "patch" #endif -/* - * By default, RCS programs are executed with the shell or through - * execlp(), so the user's PATH environment variable is searched. If - * you'd like to bind all RCS programs to a certain directory (perhaps - * one not in most people's PATH) then set the default in RCSBIN_DFLT. - * Note that setting this here will cause all RCS programs to be - * executed from this directory, unless the user overrides the default - * with the RCSBIN environment variable or the "-b" option to CVS. - * - * If you use the password-authenticating server, then you need to - * make sure that the server can find the RCS programs to invoke them. - * The authenticating server starts out running as root, and then - * switches to run as the appropriate user once authentication is - * complete. But no actual shell is ever started by that user, so the - * PATH environment variable may not contain the directory with the - * RCS binaries, even though if that user logged in normally, PATH - * would include the directory. - * - * One way to solve this problem is to set RCSBIN_DFLT here. An - * alternative is to make sure that root has the right directory in - * its path already. Another, probably better alternative is to - * specify -b in /etc/inetd.conf. - * - * You may also have to set RCSBIN_DFLT here if there's no global - * start-up script run for users by rshd and your RCS programs are not - * in a directory in the default PATH assigned by rshd. - * - * This define should be either the empty string ("") or a full - * pathname to the directory containing all the installed programs - * from the RCS distribution. - */ -#ifndef RCSBIN_DFLT -#define RCSBIN_DFLT "" -#endif - /* Directory used for storing temporary files, if not overridden by environment variables or the -T global option. There should be little need to change this (-T is a better mechanism if you need to use a @@ -149,10 +84,14 @@ * working directory. This path is either a full-path or a path * relative to CVSROOT. * - * The only advantage that I can see to having a relative path is that + * The big advantage that I can see to having a relative path is that * one can change the physical location of the master source - * repository, change one's CVSROOT environment variable, and CVS will - * work without problems. I recommend using full-paths. + * repository, change the contents of CVS/Root files in your + * checked-out code, and CVS will work without problems. + * + * This is likely to be the default in the future, but we want to give + * people who may be relying on absolute pathnames time to update + * their scripts/software. */ #ifndef RELATIVE_REPOS /* #define RELATIVE_REPOS */ @@ -261,8 +200,3 @@ #ifndef STDC_HEADERS extern void exit (); #endif - -#ifndef getwd -extern char *getwd (); -#endif - diff --git a/gnu/usr.bin/cvs/src/rcs.h b/gnu/usr.bin/cvs/src/rcs.h index 1855fb99c76..d0f47bba381 100644 --- a/gnu/usr.bin/cvs/src/rcs.h +++ b/gnu/usr.bin/cvs/src/rcs.h @@ -3,16 +3,11 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * RCS source control definitions needed by rcs.c and friends */ -#define RCS "rcs" -#define RCS_CI "ci" -#define RCS_DIFF "rcsdiff" -#define RCS_RCSMERGE "rcsmerge" - /* String which indicates a conflict if it occurs at the start of a line. */ #define RCS_MERGE_PAT ">>>>>>> " @@ -40,11 +35,21 @@ #define VALID 0x1 /* flags field contains valid data */ #define INATTIC 0x2 /* RCS file is located in the Attic */ #define PARTIAL 0x4 /* RCS file not completly parsed */ -#define NODELTA 0x8 /* delta_pos no longer valid */ + +/* All the "char *" fields in RCSNode, Deltatext, and RCSVers are + '\0'-terminated (except "text" in Deltatext). This means that we + can't deal with fields containing '\0', which is a limitation that + RCS does not have. Would be nice to fix this some day. */ struct rcsnode { + /* Reference count for this structure. Used to deal with the + fact that there might be a pointer from the Vers_TS or might + not. Callers who increment this field are responsible for + calling freercsnode when they are done with their reference. */ int refcount; + + /* Flags (INATTIC, PARTIAL, &c), see above. */ int flags; /* File name of the RCS file. This is not necessarily the name @@ -53,28 +58,102 @@ struct rcsnode (the various names might differ in case). */ char *path; + /* Value for head keyword from RCS header, or NULL if empty. */ char *head; + + /* Value for branch keyword from RCS header, or NULL if omitted. */ char *branch; + + /* Raw data on symbolic revisions. The first time that RCS_symbols is + called, we parse these into ->symbols, and free ->symbols_data. */ char *symbols_data; + + /* Value for expand keyword from RCS header, or NULL if omitted. */ char *expand; + + /* List of nodes, the key of which is the symbolic name and the data + of which is the numeric revision that it corresponds to (malloc'd). */ List *symbols; + + /* List of nodes (type RCSVERS), the key of which the numeric revision + number, and the data of which is an RCSVers * for the revision. */ List *versions; + + /* Value for access keyword from RCS header, or NULL if empty. + FIXME: RCS_delaccess would also seem to use "" for empty. We + should pick one or the other. */ + char *access; + + /* Raw data on locked revisions. The first time that RCS_getlocks is + called, we parse these into ->locks, and free ->locks_data. */ + char *locks_data; + + /* List of nodes, the key of which is the numeric revision and the + data of which is the user that it corresponds to (malloc'd). */ + List *locks; + + /* Set for the strict keyword from the RCS header. */ + int strict_locks; + + /* Value for the comment keyword from RCS header (comment leader), or + NULL if omitted. */ + char *comment; + + /* Value for the desc field in the RCS file, or NULL if empty. */ + char *desc; + + /* File offset of the first deltatext node, so we can seek there. */ long delta_pos; + + /* Newphrases from the RCS header. List of nodes, the key of which + is the "id" which introduces the newphrase, and the value of which + is the value from the newphrase. */ List *other; }; typedef struct rcsnode RCSNode; +struct deltatext { + char *version; + + /* Log message, or NULL if we do not intend to change the log message + (that is, RCS_copydeltas should just use the log message from the + file). */ + char *log; + + /* Change text, or NULL if we do not intend to change the change text + (that is, RCS_copydeltas should just use the change text from the + file). Note that it is perfectly legal to have log be NULL and + text non-NULL, or vice-versa. */ + char *text; + size_t len; + + /* Newphrase fields from deltatext nodes. FIXME: duplicates the + other field in the rcsversnode, I think. */ + List *other; +}; +typedef struct deltatext Deltatext; + struct rcsversnode { + /* Duplicate of the key by which this structure is indexed. */ char *version; + char *date; char *author; char *state; char *next; int dead; + int outdated; + Deltatext *text; List *branches; + /* Newphrase fields from deltatext nodes. Also contains ";add" and + ";delete" magic fields (see rcs.c, log.c). I think this is + only used by log.c (where it looks up "log"). Duplicates the + other field in struct deltatext, I think. */ List *other; + /* Newphrase fields from delta nodes. */ + List *other_delta; }; typedef struct rcsversnode RCSVers; @@ -96,6 +175,8 @@ typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t)); RCSNode *RCS_parse PROTO((const char *file, const char *repos)); RCSNode *RCS_parsercsfile PROTO((char *rcsfile)); void RCS_fully_parse PROTO((RCSNode *)); +void RCS_reparsercsfile PROTO((RCSNode *, FILE **)); + char *RCS_check_kflag PROTO((const char *arg)); char *RCS_getdate PROTO((RCSNode * rcs, char *date, int force_tag_match)); char *RCS_gettag PROTO((RCSNode * rcs, char *symtag, int force_tag_match, @@ -111,6 +192,7 @@ int RCS_datecmp PROTO((char *date1, char *date2)); time_t RCS_getrevtime PROTO((RCSNode * rcs, char *rev, char *date, int fudge)); List *RCS_symbols PROTO((RCSNode *rcs)); void RCS_check_tag PROTO((const char *tag)); +List *RCS_getlocks PROTO((RCSNode *rcs)); void freercsnode PROTO((RCSNode ** rnodep)); char *RCS_getbranch PROTO((RCSNode * rcs, char *tag, int force_tag_match)); @@ -118,15 +200,24 @@ int RCS_isdead PROTO((RCSNode *, const char *)); char *RCS_getexpand PROTO ((RCSNode *)); int RCS_checkout PROTO ((RCSNode *, char *, char *, char *, char *, char *, RCSCHECKOUTPROC, void *)); +int RCS_checkin PROTO ((RCSNode *rcs, char *workfile, char *message, + char *rev, int flags)); int RCS_cmp_file PROTO ((RCSNode *, char *, char *, const char *)); int RCS_settag PROTO ((RCSNode *, const char *, const char *)); -int RCS_deltag PROTO ((RCSNode *, const char *, int)); +int RCS_deltag PROTO ((RCSNode *, const char *)); int RCS_setbranch PROTO((RCSNode *, const char *)); int RCS_lock PROTO ((RCSNode *, const char *, int)); int RCS_unlock PROTO ((RCSNode *, const char *, int)); +int RCS_delete_revs PROTO ((RCSNode *, char *, char *, int)); +void RCS_addaccess PROTO ((RCSNode *, char *)); +void RCS_delaccess PROTO ((RCSNode *, char *)); +char *RCS_getaccess PROTO ((RCSNode *)); +void RCS_rewrite PROTO ((RCSNode *, Deltatext *, char *)); int rcs_change_text PROTO ((const char *, char *, size_t, const char *, size_t, char **, size_t *)); +char *make_file_label PROTO ((char *, char *, RCSNode *)); /* From import.c. */ -extern int add_rcs_file PROTO ((char *, char *, char *, char *, - char *, char *, int, char **, FILE *)); +extern int add_rcs_file PROTO ((char *, char *, char *, char *, char *, + char *, char *, int, char **, + char *, size_t, FILE *)); diff --git a/gnu/usr.bin/cvs/src/remove.c b/gnu/usr.bin/cvs/src/remove.c index 46c416938a9..9ed32d72a11 100644 --- a/gnu/usr.bin/cvs/src/remove.c +++ b/gnu/usr.bin/cvs/src/remove.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Remove a File * @@ -37,6 +37,7 @@ static const char *const remove_usage[] = "\t-f\tDelete the file before removing it.\n", "\t-l\tProcess this directory only (not recursive).\n", "\t-R\tProcess directories recursively.\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; @@ -215,6 +216,22 @@ remove_fileproc (callerdat, finfo) error (0, 0, "file `%s' already scheduled for removal", finfo->fullname); } + else if (vers->tag != NULL && isdigit (*vers->tag)) + { + /* Commit will just give an error, and so there seems to be + little reason to allow the remove. I mean, conflicts that + arise out of parallel development are one thing, but conflicts + that arise from sticky tags are quite another. + + I would have thought that non-branch sticky tags should be the + same but at least now, removing a file with a non-branch sticky + tag means to delete the tag from the file. I'm not sure that + is a good behavior, but until it is changed, we need to allow + it. */ + error (0, 0, "\ +cannot remove file `%s' which has a numeric sticky tag of `%s'", + finfo->fullname, vers->tag); + } else { char *fname; diff --git a/gnu/usr.bin/cvs/src/run.c b/gnu/usr.bin/cvs/src/run.c index 5b59bca9833..dc35a78216c 100644 --- a/gnu/usr.bin/cvs/src/run.c +++ b/gnu/usr.bin/cvs/src/run.c @@ -14,30 +14,18 @@ #include "cvs.h" -#ifdef HAVE_VPRINTF -#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__) -#include <stdarg.h> -#define VA_START(args, lastarg) va_start(args, lastarg) -#else -#include <varargs.h> -#define VA_START(args, lastarg) va_start(args) -#endif -#else -#define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; +#ifndef HAVE_UNISTD_H +extern int execvp PROTO((char *file, char **argv)); #endif static void run_add_arg PROTO((const char *s)); extern char *strtok (); -extern int vasprintf (); - /* - * To exec a program under CVS, first call run_setup() to setup any initial - * arguments. The options to run_setup are essentially like printf(). The - * arguments will be parsed into whitespace separated words and added to the - * global run_argv list. + * To exec a program under CVS, first call run_setup() to setup initial + * arguments. The argument to run_setup will be parsed into whitespace + * separated words and added to the global run_argv list. * * Then, optionally call run_arg() for each additional argument that you'd like * to pass to the executed program. @@ -51,19 +39,10 @@ static int run_argc; static int run_argc_allocated; /* VARARGS */ -#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)) void -run_setup (const char *fmt,...) -#else -void -run_setup (fmt, va_alist) - char *fmt; - va_dcl -#endif +run_setup (prog) + const char *prog; { -#ifdef HAVE_VPRINTF - va_list args; -#endif char *cp; int i; char *run_prog; @@ -79,16 +58,7 @@ run_setup (fmt, va_alist) } run_argc = 0; - /* process the varargs into run_prog */ -#ifdef HAVE_VPRINTF - VA_START (args, fmt); - (void) vasprintf (&run_prog, fmt, args); - va_end (args); -#else - you lose -#endif - if (run_prog == NULL) - error (1, 0, "out of memory"); + run_prog = xstrdup (prog); /* put each word into run_argv, allocating it as we go */ for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t")) @@ -103,38 +73,6 @@ run_arg (s) run_add_arg (s); } -/* VARARGS */ -#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)) -void -run_args (const char *fmt,...) -#else -void -run_args (fmt, va_alist) - char *fmt; - va_dcl -#endif -{ -#ifdef HAVE_VPRINTF - va_list args; -#endif - char *run_prog; - - /* process the varargs into run_prog */ -#ifdef HAVE_VPRINTF - VA_START (args, fmt); - (void) vasprintf (&run_prog, fmt, args); - va_end (args); -#else - you lose -#endif - if (run_prog == NULL) - error (1, 0, "out of memory"); - - /* and add the (single) argument to the run_argv list */ - run_add_arg (run_prog); - free (run_prog); -} - static void run_add_arg (s) const char *s; @@ -155,9 +93,9 @@ run_add_arg (s) int run_exec (stin, stout, sterr, flags) - char *stin; - char *stout; - char *sterr; + const char *stin; + const char *stout; + const char *sterr; int flags; { int shin, shout, sherr; @@ -398,7 +336,13 @@ run_print (fp) else if (fp == stdout) outfn = cvs_output; else + { error (1, 0, "internal error: bad argument to run_print"); + /* Solely to placate gcc -Wall. + FIXME: it'd be better to use a function named `fatal' that + is known never to return. Then kludges wouldn't be necessary. */ + outfn = NULL; + } for (i = 0; i < run_argc; i++) { @@ -410,6 +354,11 @@ run_print (fp) } } +/* Return value is NULL for error, or if noexec was set. If there was an + error, return NULL and I'm not sure whether errno was set (the Red Hat + Linux 4.1 popen manpage was kind of vague but discouraging; and the noexec + case complicates this even aside from popen behavior). */ + FILE * run_popen (cmd, mode) const char *cmd; @@ -428,8 +377,6 @@ run_popen (cmd, mode) return (popen (cmd, mode)); } -extern int evecvp PROTO((char *file, char **argv)); - int piped_child (command, tofdp, fromfdp) char **command; diff --git a/gnu/usr.bin/cvs/src/sanity.sh b/gnu/usr.bin/cvs/src/sanity.sh index a815fc0539c..e407cbd04ab 100644 --- a/gnu/usr.bin/cvs/src/sanity.sh +++ b/gnu/usr.bin/cvs/src/sanity.sh @@ -2,7 +2,19 @@ : # sanity.sh -- a growing testsuite for cvs. # -# Copyright (C) 1992, 1993 Cygnus Support +# The copyright notice said: "Copyright (C) 1992, 1993 Cygnus Support" +# I'm not adding new copyright notices for new years as our recent +# practice has been to include copying terms without copyright notices. +# +# This program 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. +# +# This program 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. # # Original Author: K. Richard Pixley @@ -15,16 +27,38 @@ # You can't run CVS as root; print a nice error message here instead # of somewhere later, after making a mess. -case "`whoami`" in - "root" ) - echo "sanity.sh: test suite does not work correctly when run as root" >&2 - exit 1 - ;; -esac +# Commented out because: +# (1) whoami is not portable. If memory serves the POSIX way is "id -un". +# ("logname" or "who am i" are similar but different--they have more to +# do with who logged in on your tty than your uid). +# (2) This definition of "root" doesn't quite match CVS's (which is based +# on uid 0, not username "root"). +#case "`whoami`" in +# "root" ) +# echo "sanity.sh: test suite does not work correctly when run as root" >&2 +# exit 1 +# ;; +#esac # required to make this script work properly. unset CVSREAD +# The default value of /tmp/cvs-sanity for TESTDIR is dubious, +# because it loses if two people/scripts try to run the tests +# at the same time. Some possible solutions: +# 1. Use /tmp/cvs-test$$. One disadvantage is that the old +# cvs-test* directories would pile up, because they wouldn't +# necessarily get removed. +# 2. Have everyone/everything running the testsuite set +# TESTDIR to some appropriate directory. +# 3. Have the default value of TESTDIR be some variation of +# `pwd`/cvs-sanity. The biggest problem here is that we have +# been fairly careful to test that CVS prints in messages the +# actual pathnames that we pass to it, rather than a different +# pathname for the same directory, as may come out of `pwd`. +# So this would be lost if everything was `pwd`-based. I suppose +# if we wanted to get baroque we could start making symlinks +# to ensure the two are different. TESTDIR=${TESTDIR:-/tmp/cvs-sanity} # "debugger" @@ -79,12 +113,22 @@ PROG=`basename ${testcvs}` # Regexp to match an author name. I'm not really sure what characters # should be here. a-zA-Z obviously. People complained when 0-9 were # not allowed in usernames. Other than that I'm not sure. -username="[a-zA-Z0-9][a-zA-Z0-9]*" +username="[-a-zA-Z0-9][-a-zA-Z0-9]*" # Regexp to match the name of a temporary file (from cvs_temp_name). # This appears in certain diff output. tempname="[-a-zA-Z0-9/.%_]*" +# On cygwin32, we may not have /bin/sh. +if [ -r /bin/sh ]; then + TESTSHELL="/bin/sh" +else + TESTSHELL=`type -p sh 2>/dev/null` + if [ ! -r "$TESTSHELL" ]; then + TESTSHELL="/bin/sh" + fi +fi + # FIXME: try things (what things? checkins?) without -m. # # Some of these tests are written to expect -Q. But testing with @@ -452,6 +496,22 @@ dotest_status () dotest_internal "$1" "$3" "$4" "$5" } +# Like dotest except output is sorted. +dotest_sort () +{ + rm -f ${TESTDIR}/dotest.ex? 2>&1 + if $2 >${TESTDIR}/dotest.tmp1 2>&1; then + : so far so good + else + status=$? + cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE} + echo "exit status was $status" >>${LOGFILE} + fail "$1" + fi + sort < ${TESTDIR}/dotest.tmp1 > ${TESTDIR}/dotest.tmp + dotest_internal "$@" +} + # clean any old remnants rm -rf ${TESTDIR} mkdir ${TESTDIR} @@ -459,7 +519,17 @@ cd ${TESTDIR} # This will show up in cvs history output where it prints the working # directory. It should *not* appear in any cvs output referring to the # repository; cvs should use the name of the repository as specified. -TMPPWD=`/bin/pwd` +# +# Note that using pwd here rather than /bin/pwd will make it even less +# likely that we test whether CVS is distinguishing between TMPPWD +# and TESTDIR. However, there is no guarantee that will test it anyway. +# If we really care, we should do something along the lines of: +# cd /tmp/cvs-sanity # In reality, overridable with environment variable? +# mkdir realdir +# ln -s realdir testdir +# TESTDIR=/tmp/cvs-sanity/testdir +# TMPPWD=/tmp/cvs-sanity/realdir +TMPPWD=`pwd` # Avoid picking up any stray .cvsrc, etc., from the user running the tests mkdir home @@ -478,12 +548,20 @@ RCSINIT=; export RCSINIT # tests. if test x"$*" = x; then - tests="basica basicb basic1 deep basic2 rdiff death death2 branches" - tests="${tests} multibranch import join new newb conflicts conflicts2" - tests="${tests} modules modules2 modules3 mflag errmsg1 devcom devcom2" - tests="${tests} devcom3 ignore binfiles binfiles2 binwrap mwrap info" - tests="${tests} serverpatch log log2 crerepos rcs big modes stamps" - tests="${tests} sticky keyword toplevel" + tests="basica basicb basicc basic1 deep basic2" + tests="${tests} rdiff death death2 branches" + tests="${tests} rcslib multibranch import importb join join2 join3" + tests="${tests} new newb conflicts conflicts2 conflicts3" + tests="${tests} modules modules2 modules3 modules4" + tests="${tests} mflag editor errmsg1 errmsg2" + tests="${tests} devcom devcom2 devcom3 watch4" + tests="${tests} ignore binfiles binfiles2 mcopy binwrap binwrap2" + tests="${tests} binwrap3 mwrap info config" + tests="${tests} serverpatch log log2 ann crerepos rcs big modes stamps" + tests="${tests} sticky keyword keywordlog" + tests="${tests} toplevel head tagdate multibranch2" + tests="${tests} admin reserved" + tests="${tests} cvsadm diffmerge1 diffmerge2" else tests="$*" fi @@ -594,14 +672,14 @@ Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository" # that I consider to be more correct, but local cvs prints the # "nothing known" message and noone has gotten around to fixing it. dotest_fail basica-notadded "${testcvs} -q ci ssfile" \ -"${PROG} [a-z]*: use "'`cvs add'\'' to create an entry for ssfile -'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \ +"${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile +${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \ "${PROG}"' [a-z]*: nothing known about `ssfile'\'' '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!' dotest basica-4 "${testcvs} add ssfile" \ "${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \ "${PROG} [a-z]*: nothing known about ssfile ${PROG} "'\[[a-z]* aborted\]: correct the above errors first!' @@ -701,6 +779,68 @@ diff -r1\.2 -r1\.3" \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1\.1 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile 1\.2 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2' + + # As long as we have a file with a few revisions, test + # a few "cvs admin -o" invocations. + cd sdir/ssdir + dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \ +"${PROG} [a-z]*: while processing more than one file: +${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision" + dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +done" + dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +done" + dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist. +${PROG} [a-z]*: cannot modify RCS file for .ssfile." + dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +done" + dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +done" + dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +done" + dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +deleting revision 2\.0 +deleting revision 1\.3 +done" + dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +deleting revision 2\.0 +deleting revision 1\.3 +done" + dotest basica-o7 "${testcvs} log -N ssfile" " +RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v +Working file: ssfile +head: 3\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 3; selected revisions: 3 +description: +---------------------------- +revision 3\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0 +bump-it +---------------------------- +revision 1\.2 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +modify-it +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +add-it +=============================================================================" + dotest basica-o8 "${testcvs} -q update -p -r 1.1 ssfile" "ssfile" + cd ../.. + cd .. rm -rf ${CVSROOT_DIRNAME}/first-dir @@ -714,18 +854,25 @@ diff -r1\.2 -r1\.3" touch topfile dotest basicb-0b "${testcvs} add topfile" \ "${PROG} [a-z]*: scheduling file .topfile. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \ -"RCS file: ${TESTDIR}/cvsroot/\./topfile,v +"RCS file: ${TESTDIR}/cvsroot/topfile,v done Checking in topfile; -${TESTDIR}/cvsroot/\./topfile,v <-- topfile +${TESTDIR}/cvsroot/topfile,v <-- topfile initial revision: 1\.1 done" cd .. rm -r 1 mkdir 2; cd 2 dotest basicb-0d "${testcvs} -q co -l ." "U topfile" + # Now test the ability to run checkout on an existing working + # directory without having it lose its mind. I don't know + # whether this is tested elsewhere in sanity.sh. A more elaborate + # test might also have modified files, make sure it works if + # the modules file was modified to add new directories to the + # module, and such. + dotest basicb-0d0 "${testcvs} -q co -l ." "" mkdir first-dir dotest basicb-0e "${testcvs} add first-dir" \ "Directory ${TESTDIR}/cvsroot/first-dir added to the repository" @@ -735,24 +882,33 @@ done" : mkdir ${CVSROOT_DIRNAME}/first-dir dotest basicb-1 "${testcvs} -q co first-dir" '' dotest basicb-1a "test -d CVS" '' - # See comment at modules3-7f for more on this behavior. + + # In 1b and 1c, the first string matches if we're using absolute + # paths, while the second matches if RELATIVE_REPOS is defined + # (we're using relative paths). + dotest basicb-1b "cat CVS/Repository" \ -"${TESTDIR}/cvsroot/first-dir" "${TESTDIR}/cvsroot/\." +"${TESTDIR}/cvsroot/\." \ +"\." dotest basicb-1c "cat first-dir/CVS/Repository" \ -"${TESTDIR}/cvsroot/first-dir" +"${TESTDIR}/cvsroot/first-dir" \ +"first-dir" cd first-dir - mkdir sdir1 sdir2 - dotest basicb-2 "${testcvs} add sdir1 sdir2" \ -"Directory ${TESTDIR}/cvsroot/first-dir/sdir1 added to the repository + # Note that the name Emptydir is chosen to test that CVS just + # treats it like any other directory name. It should be + # special only when it is directly in $CVSROOT/CVSROOT. + mkdir Emptydir sdir2 + dotest basicb-2 "${testcvs} add Emptydir sdir2" \ +"Directory ${TESTDIR}/cvsroot/first-dir/Emptydir added to the repository Directory ${TESTDIR}/cvsroot/first-dir/sdir2 added to the repository" - cd sdir1 + cd Emptydir echo sfile1 starts >sfile1 dotest basicb-2a10 "${testcvs} -n add sfile1" \ "${PROG} [a-z]*: scheduling file .sfile1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-2a11 "${testcvs} status sfile1" \ -"${PROG} [a-z]*: use .cvs add' to create an entry for sfile1 +"${PROG} [a-z]*: use .${PROG} add. to create an entry for sfile1 =================================================================== File: sfile1 Status: Unknown @@ -760,7 +916,7 @@ File: sfile1 Status: Unknown Repository revision: No revision control file" dotest basicb-3 "${testcvs} add sfile1" \ "${PROG} [a-z]*: scheduling file .sfile1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-3a1 "${testcvs} status sfile1" \ "=================================================================== File: sfile1 Status: Locally Added @@ -775,16 +931,16 @@ File: sfile1 Status: Locally Added echo sfile2 starts >sfile2 dotest basicb-4 "${testcvs} add sfile2" \ "${PROG} [a-z]*: scheduling file .sfile2. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-4a "${testcvs} -q ci CVS" \ "${PROG} [a-z]*: warning: directory CVS specified in argument ${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory" cd .. dotest basicb-5 "${testcvs} -q ci -m add" \ -"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v +"RCS file: ${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v done -Checking in sdir1/sfile1; -${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v <-- sfile1 +Checking in Emptydir/sfile1; +${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v <-- sfile1 initial revision: 1\.1 done RCS file: ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v @@ -793,13 +949,13 @@ Checking in sdir2/sfile2; ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v <-- sfile2 initial revision: 1\.1 done" - echo sfile1 develops >sdir1/sfile1 + echo sfile1 develops >Emptydir/sfile1 dotest basicb-6 "${testcvs} -q ci -m modify" \ -"Checking in sdir1/sfile1; -${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v <-- sfile1 +"Checking in Emptydir/sfile1; +${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v <-- sfile1 new revision: 1\.2; previous revision: 1\.1 done" - dotest basicb-7 "${testcvs} -q tag release-1" 'T sdir1/sfile1 + dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1 T sdir2/sfile2' echo not in time for release-1 >sdir2/sfile2 dotest basicb-8 "${testcvs} -q ci -m modify-2" \ @@ -817,22 +973,48 @@ done" # for existing files, even if co -d is in use. touch first-dir/extra dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \ -'U first-dir1/sdir1/sfile1 +'U first-dir1/Emptydir/sfile1 U first-dir1/sdir2/sfile2' rm -r first-dir1 rm -r first-dir + + # FIXME? basicb-9 used to check things out like this: + # U newdir/Emptydir/sfile1 + # U newdir/sdir2/sfile2 + # but that's difficult to do. The whole "shorten" thing + # is pretty bogus, because it will break on things + # like "cvs co foo/bar baz/quux". Unless there's some + # pretty detailed expansion and analysis of the command-line + # arguments, we shouldn't do "shorten" stuff at all. + dotest basicb-9 \ -"${testcvs} -q co -d newdir -r release-1 first-dir/sdir1 first-dir/sdir2" \ -'U newdir/sdir1/sfile1 -U newdir/sdir2/sfile2' +"${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \ +'U newdir/first-dir/Emptydir/sfile1 +U newdir/first-dir/sdir2/sfile2' dotest basicb-9a "test -d CVS" '' - # See comment at modules3-7f for more on this behavior. + + # In 9b through 9f, the first string matches if we're using + # absolute paths, while the second matches if RELATIVE_REPOS + # is defined (we're using relative paths). + dotest basicb-9b "cat CVS/Repository" \ -"${TESTDIR}/cvsroot/first-dir" "${TESTDIR}/cvsroot/\." +"${TESTDIR}/cvsroot/\." \ +"\." dotest basicb-9c "cat newdir/CVS/Repository" \ -"${TESTDIR}/cvsroot/CVSROOT/Emptydir" - dotest basicb-10 "cat newdir/sdir1/sfile1 newdir/sdir2/sfile2" \ +"${TESTDIR}/cvsroot/\." \ +"\." + dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \ +"${TESTDIR}/cvsroot/first-dir" \ +"first-dir" + dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \ +"${TESTDIR}/cvsroot/first-dir/Emptydir" \ +"first-dir/Emptydir" + dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \ +"${TESTDIR}/cvsroot/first-dir/sdir2" \ +"first-dir/sdir2" + + dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \ "sfile1 develops sfile2 starts" @@ -842,7 +1024,7 @@ sfile2 starts" # seem to deal with it... if false; then dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \ -"U sub1/sub2/sdir1/sfile1 +"U sub1/sub2/Emptydir/sfile1 U sub1/sub2/sdir2/sfile2" cd sub1 dotest basicb-12 "${testcvs} -q update" '' @@ -864,7 +1046,7 @@ U sub1/sub2/sdir2/sfile2" touch aa dotest basicb-16 "${testcvs} add aa" \ "${PROG} [a-z]*: scheduling file .aa. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-17 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/second-dir/aa,v done @@ -874,16 +1056,13 @@ initial revision: 1\.1 done" cd ../.. rm -r 1 - # Now here is the kicker: note that the semantics of -d - # are fundamentally different if we specify two or more directories - # rather than one! I consider this to be seriously bogus, - # but for the moment I am just trying to figure out what - # CVS's current behaviors are. - dotest basicb-18 "${testcvs} -q co -d test2 first-dir second-dir" \ -"U test2/first-dir/sdir1/sfile1 -U test2/first-dir/sdir2/sfile2 -U test2/second-dir/aa" - cd test2 + + # Let's see if we can add something to Emptydir. + dotest basicb-18 "${testcvs} -q co -d t2/t3 first-dir second-dir" \ +"U t2/t3/first-dir/Emptydir/sfile1 +U t2/t3/first-dir/sdir2/sfile2 +U t2/t3/second-dir/aa" + cd t2 touch emptyfile # The fact that CVS lets us add a file here is a CVS bug, right? # I can just make this an error message (on the add and/or the @@ -892,7 +1071,7 @@ U test2/second-dir/aa" # Right? dotest basicb-19 "${testcvs} add emptyfile" \ "${PROG} [a-z]*: scheduling file .emptyfile. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest basicb-20 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v done @@ -901,32 +1080,75 @@ ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v <-- emptyfile initial revision: 1\.1 done" cd .. + rm -r t2 mkdir 1; cd 1 - # "cvs admin" tests are scattered around a bit. Here we test - # ability to reject an unrecognized option. The "keyword" - # test has a test of "cvs admin -l" and the "binfiles" test - # has a test of "cvs admin -k". Note that -H is an illegal - # option. It probably should be an error message. But - # currently it is one error message for each file operated on, - # which in this case is zero files. - dotest basicb-21 "${testcvs} -q admin -H" "" + # Note that -H is an illegal option. + # I suspect that the choice between "illegal" and "invalid" + # depends on the user's environment variables, the phase + # of the moon (weirdness with optind), and who knows what else. + # I've been seeing "illegal"... + dotest_fail basicb-21 "${testcvs} -q admin -H" \ +"admin: illegal option -- H +${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \ +"admin: invalid option -- H +${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" cd .. rmdir 1 + # OK, while we have an Emptydir around, test a few obscure + # things about it. + mkdir edir; cd edir + dotest basicb-edir-1 "${testcvs} -q co -l CVSROOT" \ +"U CVSROOT${DOTSTAR}" + cd CVSROOT + dotest_fail basicb-edir-2 "test -d Emptydir" '' + # This tests the code in find_dirs which skips Emptydir. + dotest basicb-edir-3 "${testcvs} -q -n update -d -P" '' + cd ../.. + rm -r edir + if test "$keep" = yes; then echo Keeping ${TESTDIR} and exiting due to --keep exit 0 fi - rm -r test2 - rm -rf ${CVSROOT_DIRNAME}/first-dir rm -rf ${CVSROOT_DIRNAME}/second-dir rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir rm -f ${CVSROOT_DIRNAME}/topfile,v ;; + basicc) + # More tests of basic/miscellaneous functionality. + mkdir 1; cd 1 + dotest_fail basicc-1 "${testcvs} diff" \ +"${PROG} [a-z]*: in directory \.: +${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first" + dotest basicc-2 "${testcvs} -q co -l ." '' + mkdir first-dir second-dir + dotest basicc-3 "${testcvs} add first-dir second-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository +Directory ${TESTDIR}/cvsroot/second-dir added to the repository" + # Old versions of CVS often didn't create this top-level CVS + # directory in the first place. I think that maybe the only + # way to get avoid it currently is to let CVS create it, and + # then blow it away. But that is perfectly legal; people who + # are used to the old behavior especially may be interested. + rm -r CVS + dotest basicc-4 "echo *" "first-dir second-dir" + dotest basicc-5 "${testcvs} update" \ +"${PROG} [a-z]*: Updating first-dir +${PROG} [a-z]*: Updating second-dir" \ +"${PROG} [a-z]*: Updating \. +${PROG} [a-z]*: Updating first-dir +${PROG} [a-z]*: Updating second-dir" + + cd .. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + basic1) # first dive - add a files, first singly, then in a group. mkdir ${CVSROOT_DIRNAME}/first-dir @@ -945,7 +1167,7 @@ done" ${PROG} [a-z]*: scheduling file \`file3' for addition ${PROG} [a-z]*: scheduling file \`file4' for addition ${PROG} [a-z]*: scheduling file \`file5' for addition -${PROG} [a-z]*: use 'cvs commit' to add these files permanently" +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" dotest basic1-15-add-add \ "${testcvs} -q update file2 file3 file4 file5" \ "A file2 @@ -1315,7 +1537,7 @@ done" echo file1 >file1 dotest deep-3-$i "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' done cd ../../../../../../../../.. dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE @@ -1391,6 +1613,8 @@ done" # that "cvs release -d" is the way to delete the directory # and have it stay gone -kingdon, Oct1996). rm -r dir6 + dotest deep-4b0a "${testcvs} -q diff" '' + dotest deep-4b0b "${testcvs} -q ci" '' dotest deep-4b1 "${testcvs} -q update" '' dotest deep-4b2 "${testcvs} -q update -d -P" \ 'U dir6/file1 @@ -1462,9 +1686,9 @@ done" if test ! -d $i ; then mkdir $i if ${CVS} add $i >> ${LOGFILE}; then - echo "PASS: test 29-$i" >>${LOGFILE} + pass 29-$i else - echo "FAIL: test 29-$i" | tee -a ${LOGFILE} ; exit 1 + fail 29-$i fi fi @@ -1475,48 +1699,48 @@ done" done if ${CVS} add file6 file7 2>> ${LOGFILE}; then - echo "PASS: test 30-$i-$j" >>${LOGFILE} + pass 30-$i-$j else - echo "FAIL: test 30-$i-$j" | tee -a ${LOGFILE} ; exit 1 + fail 30-$i-$j fi done cd ../../.. if ${CVS} update first-dir ; then - echo "PASS: test 31" >>${LOGFILE} + pass 31 else - echo "FAIL: test 31" | tee -a ${LOGFILE} ; exit 1 + fail 31 fi # fixme: doesn't work right for added files. if ${CVS} log first-dir >> ${LOGFILE}; then - echo "PASS: test 32" >>${LOGFILE} + pass 32 else - echo "FAIL: test 32" | tee -a ${LOGFILE} # ; exit 1 + fail 32 fi if ${CVS} status first-dir >> ${LOGFILE}; then - echo "PASS: test 33" >>${LOGFILE} + pass 33 else - echo "FAIL: test 33" | tee -a ${LOGFILE} ; exit 1 + fail 33 fi # XXX why is this commented out??? # if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then -# echo "PASS: test 34" >>${LOGFILE} +# pass 34 # else -# echo "FAIL: test 34" | tee -a ${LOGFILE} # ; exit 1 +# fail 34 # fi if ${CVS} ci -m "second dive" first-dir >> ${LOGFILE} 2>&1; then - echo "PASS: test 35" >>${LOGFILE} + pass 35 else - echo "FAIL: test 35" | tee -a ${LOGFILE} ; exit 1 + fail 35 fi if ${CVS} tag second-dive first-dir ; then - echo "PASS: test 36" >>${LOGFILE} + pass 36 else - echo "FAIL: test 36" | tee -a ${LOGFILE} ; exit 1 + fail 36 fi # third dive - in bunch o' directories, add bunch o' files, @@ -1532,137 +1756,137 @@ done" rm file7 if ${CVS} rm file7 2>> ${LOGFILE}; then - echo "PASS: test 37-$i" >>${LOGFILE} + pass 37-$i else - echo "FAIL: test 37-$i" | tee -a ${LOGFILE} ; exit 1 + fail 37-$i fi # and add a new file echo file14 >file14 if ${CVS} add file14 2>> ${LOGFILE}; then - echo "PASS: test 38-$i" >>${LOGFILE} + pass 38-$i else - echo "FAIL: test 38-$i" | tee -a ${LOGFILE} ; exit 1 + fail 38-$i fi done cd ../../.. if ${CVS} update first-dir ; then - echo "PASS: test 39" >>${LOGFILE} + pass 39 else - echo "FAIL: test 39" | tee -a ${LOGFILE} ; exit 1 + fail 39 fi # FIXME: doesn't work right for added files if ${CVS} log first-dir >> ${LOGFILE}; then - echo "PASS: test 40" >>${LOGFILE} + pass 40 else - echo "FAIL: test 40" | tee -a ${LOGFILE} # ; exit 1 + fail 40 fi if ${CVS} status first-dir >> ${LOGFILE}; then - echo "PASS: test 41" >>${LOGFILE} + pass 41 else - echo "FAIL: test 41" | tee -a ${LOGFILE} ; exit 1 + fail 41 fi # XXX why is this commented out? # if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then -# echo "PASS: test 42" >>${LOGFILE} +# pass 42 # else -# echo "FAIL: test 42" | tee -a ${LOGFILE} # ; exit 1 +# fail 42 # fi if ${CVS} ci -m "third dive" first-dir >>${LOGFILE} 2>&1; then - echo "PASS: test 43" >>${LOGFILE} + pass 43 else - echo "FAIL: test 43" | tee -a ${LOGFILE} ; exit 1 + fail 43 fi dotest 43.5 "${testcvs} -q update first-dir" '' if ${CVS} tag third-dive first-dir ; then - echo "PASS: test 44" >>${LOGFILE} + pass 44 else - echo "FAIL: test 44" | tee -a ${LOGFILE} ; exit 1 + fail 44 fi if echo "yes" | ${CVS} release -d first-dir ; then - echo "PASS: test 45" >>${LOGFILE} + pass 45 else - echo "FAIL: test 45" | tee -a ${LOGFILE} ; exit 1 + fail 45 fi # end of third dive if test -d first-dir ; then - echo "FAIL: test 45.5" | tee -a ${LOGFILE} ; exit 1 + fail 45.5 else - echo "PASS: test 45.5" >>${LOGFILE} + pass 45.5 fi # now try some rtags # rtag HEADS if ${CVS} rtag rtagged-by-head first-dir ; then - echo "PASS: test 46" >>${LOGFILE} + pass 46 else - echo "FAIL: test 46" | tee -a ${LOGFILE} ; exit 1 + fail 46 fi # tag by tag if ${CVS} rtag -r rtagged-by-head rtagged-by-tag first-dir ; then - echo "PASS: test 47" >>${LOGFILE} + pass 47 else - echo "FAIL: test 47" | tee -a ${LOGFILE} ; exit 1 + fail 47 fi # tag by revision if ${CVS} rtag -r1.1 rtagged-by-revision first-dir ; then - echo "PASS: test 48" >>${LOGFILE} + pass 48 else - echo "FAIL: test 48" | tee -a ${LOGFILE} ; exit 1 + fail 48 fi # rdiff by revision if ${CVS} rdiff -r1.1 -rrtagged-by-head first-dir >> ${LOGFILE} || test $? = 1 ; then - echo "PASS: test 49" >>${LOGFILE} + pass 49 else - echo "FAIL: test 49" | tee -a ${LOGFILE} ; exit 1 + fail 49 fi # now export by rtagged-by-head and rtagged-by-tag and compare. if ${CVS} export -r rtagged-by-head first-dir ; then - echo "PASS: test 50" >>${LOGFILE} + pass 50 else - echo "FAIL: test 50" | tee -a ${LOGFILE} ; exit 1 + fail 50 fi mv first-dir 1dir if ${CVS} export -r rtagged-by-tag first-dir ; then - echo "PASS: test 51" >>${LOGFILE} + pass 51 else - echo "FAIL: test 51" | tee -a ${LOGFILE} ; exit 1 + fail 51 fi directory_cmp 1dir first-dir if $ISDIFF ; then - echo "FAIL: test 52" | tee -a ${LOGFILE} ; exit 1 + fail 52 else - echo "PASS: test 52" >>${LOGFILE} + pass 52 fi rm -r 1dir first-dir # checkout by revision vs export by rtagged-by-revision and compare. if ${CVS} export -rrtagged-by-revision -d export-dir first-dir ; then - echo "PASS: test 53" >>${LOGFILE} + pass 53 else - echo "FAIL: test 53" | tee -a ${LOGFILE} ; exit 1 + fail 53 fi if ${CVS} co -r1.1 first-dir ; then - echo "PASS: test 54" >>${LOGFILE} + pass 54 else - echo "FAIL: test 54" | tee -a ${LOGFILE} ; exit 1 + fail 54 fi # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem. @@ -1671,9 +1895,9 @@ done" directory_cmp first-dir export-dir if $ISDIFF ; then - echo "FAIL: test 55" | tee -a ${LOGFILE} ; exit 1 + fail 55 else - echo "PASS: test 55" >>${LOGFILE} + pass 55 fi # interrupt, while we've got a clean 1.1 here, let's import it @@ -1696,17 +1920,17 @@ No conflicts created by this import" cd .. if ${CVS} export -r HEAD second-dir ; then - echo "PASS: test 57" >>${LOGFILE} + pass 57 else - echo "FAIL: test 57" | tee -a ${LOGFILE} ; exit 1 + fail 57 fi directory_cmp first-dir second-dir if $ISDIFF ; then - echo "FAIL: test 58" | tee -a ${LOGFILE} ; exit 1 + fail 58 else - echo "PASS: test 58" >>${LOGFILE} + pass 58 fi rm -r second-dir @@ -1718,22 +1942,22 @@ No conflicts created by this import" # update the top, cancelling sticky tags, retag, update other copy, compare. cd first-dir if ${CVS} update -A -l *file* 2>> ${LOGFILE}; then - echo "PASS: test 59" >>${LOGFILE} + pass 59 else - echo "FAIL: test 59" | tee -a ${LOGFILE} ; exit 1 + fail 59 fi # If we don't delete the tag first, cvs won't retag it. # This would appear to be a feature. if ${CVS} tag -l -d rtagged-by-revision ; then - echo "PASS: test 60a" >>${LOGFILE} + pass 60a else - echo "FAIL: test 60a" | tee -a ${LOGFILE} ; exit 1 + fail 60a fi if ${CVS} tag -l rtagged-by-revision ; then - echo "PASS: test 60b" >>${LOGFILE} + pass 60b else - echo "FAIL: test 60b" | tee -a ${LOGFILE} ; exit 1 + fail 60b fi cd .. @@ -1744,9 +1968,9 @@ No conflicts created by this import" dotest 61 "${testcvs} -q diff -u" '' if ${CVS} update ; then - echo "PASS: test 62" >>${LOGFILE} + pass 62 else - echo "FAIL: test 62" | tee -a ${LOGFILE} ; exit 1 + fail 62 fi cd .. @@ -1756,9 +1980,9 @@ No conflicts created by this import" # directory_cmp 1dir first-dir # # if $ISDIFF ; then -# echo "FAIL: test 63" | tee -a ${LOGFILE} # ; exit 1 +# fail 63 # else -# echo "PASS: test 63" >>${LOGFILE} +# pass 63 # fi rm -r 1dir first-dir @@ -1774,44 +1998,44 @@ No conflicts created by this import" # which don't exist in the remote output? would seem to be # a CVS bug. dotest basic2-64 "${testcvs} his -x TOFWUCGMAR -a" \ -"O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir =first-dir= ${TMPPWD}/\* -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1 == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1 == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1/dir2 == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1/dir2 == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir == ${TMPPWD} -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1 == ${TMPPWD} -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1 == ${TMPPWD} -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1/dir2 == ${TMPPWD} -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1/dir2 == ${TMPPWD} -F [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* =first-dir= ${TMPPWD}/\* -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\] -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\] -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1\.1\] -O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir =first-dir= ${TMPPWD}/\* -U [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == ${TMPPWD}/first-dir -U [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file7 first-dir == ${TMPPWD}/first-dir" \ -"O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir =first-dir= <remote>/\* -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1 == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1 == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1/dir2 == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1/dir2 == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir == <remote> -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1 == <remote> -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1 == <remote> -A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1/dir2 == <remote> -M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1/dir2 == <remote> -F [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* =first-dir= <remote>/\* -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\] -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\] -T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1\.1\] -O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir =first-dir= <remote>/\*" +"O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= ${TMPPWD}/\* +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == ${TMPPWD} +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == ${TMPPWD} +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == ${TMPPWD} +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == ${TMPPWD} +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == ${TMPPWD} +F [0-9/]* [0-9:]* ${PLUS}0000 ${username} =first-dir= ${TMPPWD}/\* +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\] +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\] +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\] +O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= ${TMPPWD}/\* +U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TMPPWD}/first-dir +U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir == ${TMPPWD}/first-dir" \ +"O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= <remote>/\* +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == <remote> +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == <remote> +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == <remote> +A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == <remote> +M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == <remote> +F [0-9/]* [0-9:]* ${PLUS}0000 ${username} =first-dir= <remote>/\* +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\] +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\] +T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\] +O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= <remote>/\*" rm -rf ${CVSROOT_DIRNAME}/first-dir rm -rf ${CVSROOT_DIRNAME}/second-dir @@ -1828,11 +2052,12 @@ O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir = echo '$''Name$' >> foo echo '$''Id$' > bar echo '$''Name$' >> bar - dotest rdiff-1 \ + dotest_sort rdiff-1 \ "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \ -'N trdiff/foo -N trdiff/bar +' +N trdiff/bar +N trdiff/foo No conflicts created by this import' dotest rdiff-2 \ "${testcvs} co -ko trdiff" \ @@ -1852,7 +2077,7 @@ done" dotest rdiff-4 \ "${testcvs} add -m new-file-description new" \ "${PROG} [a-z]*: scheduling file \`new' for addition -${PROG} [a-z]*: use 'cvs commit' to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest rdiff-5 \ "${testcvs} commit -m added-new-file new" \ "RCS file: ${TESTDIR}/cvsroot/trdiff/new,v @@ -1932,9 +2157,9 @@ diff -c /dev/null trdiff/new:1\.1 mkdir ${CVSROOT_DIRNAME}/first-dir if ${CVS} co first-dir ; then - echo "PASS: test 65" >>${LOGFILE} + pass 65 else - echo "FAIL: test 65" | tee -a ${LOGFILE} ; exit 1 + fail 65 fi cd first-dir @@ -1948,7 +2173,7 @@ diff -c /dev/null trdiff/new:1\.1 echo file in subdir >sfile dotest 65a1 "${testcvs} add sfile" \ "${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest 65a2 "${testcvs} -q ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v done @@ -1959,7 +2184,7 @@ done" rm sfile dotest 65a3 "${testcvs} rm sfile" \ "${PROG}"' [a-z]*: scheduling `sfile'\'' for removal -'"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently' dotest 65a4 "${testcvs} -q ci -m remove-it" \ "Removing sfile; ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v <-- sfile @@ -1972,31 +2197,31 @@ done" # add a file. touch file1 if ${CVS} add file1 2>> ${LOGFILE}; then - echo "PASS: test 66" >>${LOGFILE} + pass 66 else - echo "FAIL: test 66" | tee -a ${LOGFILE} ; exit 1 + fail 66 fi # commit if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then - echo "PASS: test 67" >>${LOGFILE} + pass 67 else - echo "FAIL: test 67" | tee -a ${LOGFILE} ; exit 1 + fail 67 fi # remove rm file1 if ${CVS} rm file1 2>> ${LOGFILE}; then - echo "PASS: test 68" >>${LOGFILE} + pass 68 else - echo "FAIL: test 68" | tee -a ${LOGFILE} ; exit 1 + fail 68 fi # commit if ${CVS} ci -m test >>${LOGFILE} ; then - echo "PASS: test 69" >>${LOGFILE} + pass 69 else - echo "FAIL: test 69" | tee -a ${LOGFILE} ; exit 1 + fail 69 fi dotest_fail 69a0 "test -f file1" '' @@ -2011,30 +2236,30 @@ done" # create second file touch file2 if ${CVS} add file1 file2 2>> ${LOGFILE}; then - echo "PASS: test 70" >>${LOGFILE} + pass 70 else - echo "FAIL: test 70" | tee -a ${LOGFILE} ; exit 1 + fail 70 fi # commit if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then - echo "PASS: test 71" >>${LOGFILE} + pass 71 else - echo "FAIL: test 71" | tee -a ${LOGFILE} ; exit 1 + fail 71 fi # log if ${CVS} log file1 >> ${LOGFILE}; then - echo "PASS: test 72" >>${LOGFILE} + pass 72 else - echo "FAIL: test 72" | tee -a ${LOGFILE} ; exit 1 + fail 72 fi # file4 will be dead at the time of branching and stay dead. echo file4 > file4 dotest death-file4-add "${testcvs} add file4" \ "${PROG}"' [a-z]*: scheduling file `file4'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v done @@ -2045,7 +2270,7 @@ done" rm file4 dotest death-file4-rm "${testcvs} remove file4" \ "${PROG}"' [a-z]*: scheduling `file4'\'' for removal -'"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently' dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \ "Removing file4; ${TESTDIR}/cvsroot/first-dir/file4,v <-- file4 @@ -2058,16 +2283,16 @@ T file2' # branch1 if ${CVS} tag -b branch1 ; then - echo "PASS: test 73" >>${LOGFILE} + pass 73 else - echo "FAIL: test 73" | tee -a ${LOGFILE} ; exit 1 + fail 73 fi # and move to the branch. if ${CVS} update -r branch1 ; then - echo "PASS: test 74" >>${LOGFILE} + pass 74 else - echo "FAIL: test 74" | tee -a ${LOGFILE} ; exit 1 + fail 74 fi dotest_fail death-file4-3 "test -f file4" '' @@ -2075,16 +2300,16 @@ T file2' # add a file in the branch echo line1 from branch1 >> file3 if ${CVS} add file3 2>> ${LOGFILE}; then - echo "PASS: test 75" >>${LOGFILE} + pass 75 else - echo "FAIL: test 75" | tee -a ${LOGFILE} ; exit 1 + fail 75 fi # commit if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then - echo "PASS: test 76" >>${LOGFILE} + pass 76 else - echo "FAIL: test 76" | tee -a ${LOGFILE} ; exit 1 + fail 76 fi dotest death-76a0 \ @@ -2111,31 +2336,31 @@ diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed # remove rm file3 if ${CVS} rm file3 2>> ${LOGFILE}; then - echo "PASS: test 77" >>${LOGFILE} + pass 77 else - echo "FAIL: test 77" | tee -a ${LOGFILE} ; exit 1 + fail 77 fi # commit if ${CVS} ci -m test >>${LOGFILE} ; then - echo "PASS: test 78" >>${LOGFILE} + pass 78 else - echo "FAIL: test 78" | tee -a ${LOGFILE} ; exit 1 + fail 78 fi # add again echo line1 from branch1 >> file3 if ${CVS} add file3 2>> ${LOGFILE}; then - echo "PASS: test 79" >>${LOGFILE} + pass 79 else - echo "FAIL: test 79" | tee -a ${LOGFILE} ; exit 1 + fail 79 fi # commit if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then - echo "PASS: test 80" >>${LOGFILE} + pass 80 else - echo "FAIL: test 80" | tee -a ${LOGFILE} ; exit 1 + fail 80 fi # change the first file @@ -2143,39 +2368,39 @@ diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed # commit if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then - echo "PASS: test 81" >>${LOGFILE} + pass 81 else - echo "FAIL: test 81" | tee -a ${LOGFILE} ; exit 1 + fail 81 fi # remove the second rm file2 if ${CVS} rm file2 2>> ${LOGFILE}; then - echo "PASS: test 82" >>${LOGFILE} + pass 82 else - echo "FAIL: test 82" | tee -a ${LOGFILE} ; exit 1 + fail 82 fi # commit if ${CVS} ci -m test >>${LOGFILE}; then - echo "PASS: test 83" >>${LOGFILE} + pass 83 else - echo "FAIL: test 83" | tee -a ${LOGFILE} ; exit 1 + fail 83 fi # back to the trunk. if ${CVS} update -A 2>> ${LOGFILE}; then - echo "PASS: test 84" >>${LOGFILE} + pass 84 else - echo "FAIL: test 84" | tee -a ${LOGFILE} ; exit 1 + fail 84 fi dotest_fail death-file4-4 "test -f file4" '' if test -f file3 ; then - echo "FAIL: test 85" | tee -a ${LOGFILE} ; exit 1 + fail 85 else - echo "PASS: test 85" >>${LOGFILE} + pass 85 fi # join @@ -2190,24 +2415,23 @@ U file3" dotest_fail death-file4-5 "test -f file4" '' if test -f file3 ; then - echo "PASS: test 87" >>${LOGFILE} + pass 87 else - echo "FAIL: test 87" | tee -a ${LOGFILE} ; exit 1 + fail 87 fi # Make sure that we joined the correct change to file1 if echo line2 from branch1 | cmp - file1 >/dev/null; then - echo 'PASS: test 87a' >>${LOGFILE} + pass 87a else - echo 'FAIL: test 87a' | tee -a ${LOGFILE} - exit 1 + fail 87a fi # update if ${CVS} update ; then - echo "PASS: test 88" >>${LOGFILE} + pass 88 else - echo "FAIL: test 88" | tee -a ${LOGFILE} ; exit 1 + fail 88 fi # commit @@ -2236,22 +2460,22 @@ U first-dir/file3' # remove first file. rm file1 if ${CVS} rm file1 2>> ${LOGFILE}; then - echo "PASS: test 90" >>${LOGFILE} + pass 90 else - echo "FAIL: test 90" | tee -a ${LOGFILE} ; exit 1 + fail 90 fi # commit if ${CVS} ci -m test >>${LOGFILE}; then - echo "PASS: test 91" >>${LOGFILE} + pass 91 else - echo "FAIL: test 91" | tee -a ${LOGFILE} ; exit 1 + fail 91 fi if test -f file1 ; then - echo "FAIL: test 92" | tee -a ${LOGFILE} ; exit 1 + fail 92 else - echo "PASS: test 92" >>${LOGFILE} + pass 92 fi # typo; try to get to the branch and fail @@ -2259,29 +2483,29 @@ U first-dir/file3' "${PROG}"' \[[a-z]* aborted\]: no such tag brnach1' # Make sure we are still on the trunk if test -f file1 ; then - echo "FAIL: 92.1b" | tee -a ${LOGFILE} ; exit 1 + fail 92.1b else - echo "PASS: 92.1b" >>${LOGFILE} + pass 92.1b fi if test -f file3 ; then - echo "PASS: 92.1c" >>${LOGFILE} + pass 92.1c else - echo "FAIL: 92.1c" | tee -a ${LOGFILE} ; exit 1 + fail 92.1c fi # back to branch1 if ${CVS} update -r branch1 2>> ${LOGFILE}; then - echo "PASS: test 93" >>${LOGFILE} + pass 93 else - echo "FAIL: test 93" | tee -a ${LOGFILE} ; exit 1 + fail 93 fi dotest_fail death-file4-6 "test -f file4" '' if test -f file1 ; then - echo "PASS: test 94" >>${LOGFILE} + pass 94 else - echo "FAIL: test 94" | tee -a ${LOGFILE} ; exit 1 + fail 94 fi # and join @@ -2312,7 +2536,7 @@ U first-dir/file3' echo "first revision" > file1 dotest death2-2 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest death2-3 "${testcvs} -q commit -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -2339,6 +2563,9 @@ ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently" dotest_fail death2-diff-1 "${testcvs} -q diff file1" \ "${PROG} [a-z]*: file1 was removed, no comparison available" + # If the DIFF that CVS is using (options.h) is Sun diff, this + # test is said to fail (I think the /dev/null is the part + # that differs), along with a number of the other similar tests. dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \ "Index: file1 =================================================================== @@ -2408,7 +2635,7 @@ diff -c first-dir/file1:1\.1 first-dir/file1:removed echo "second revision" > file1 dotest death2-9 "${testcvs} add file1" \ "${PROG}"' [a-z]*: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1 -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' # Test diff of the added file before it is committed. dotest_fail death2-diff-7 "${testcvs} -q diff file1" \ @@ -2439,7 +2666,7 @@ done" echo "first revision" > file2 dotest death2-12 "${testcvs} add file2" \ "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest death2-13 "${testcvs} -q commit -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v done @@ -2462,7 +2689,7 @@ ${PROG} [a-z]*: file2 is no longer in the repository" echo "branch revision" > file2 dotest death2-15 "${testcvs} add file2" \ "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\'' -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest death2-16 "${testcvs} -q commit -m add" \ "Checking in file2; ${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 @@ -2473,7 +2700,7 @@ done" echo "first revision" > file3 dotest death2-17 "${testcvs} add file3" \ "${PROG}"' [a-z]*: scheduling file `file3'\'' for addition on branch `branch'\'' -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest death2-18 "${testcvs} -q commit -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file3,v done @@ -2594,7 +2821,8 @@ ${PLUS} first revision" '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently' + dotest branches-2a "${testcvs} -n -q ci -m dont-commit" "" dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -2627,6 +2855,13 @@ HERE ${TESTDIR}/cvsroot/first-dir/file4,v <-- file4 new revision: 1\.2; previous revision: 1\.1 done" + # The "cvs log file4" in test branches-14.3 will test that we + # didn't really add the tag. + dotest branches-3.3 "${testcvs} -qn tag dont-tag" \ +"T file1 +T file2 +T file3 +T file4" dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \. T file1 T file2 @@ -2713,29 +2948,29 @@ total revisions: 6; selected revisions: 6 description: ---------------------------- revision 1\.3 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1 +date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 trunk-change-after-branch ---------------------------- revision 1\.2 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1 +date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 branches: 1\.2\.2; trunk-before-branch ---------------------------- revision 1\.1 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; +date: [0-9/: ]*; author: ${username}; state: Exp; add-it ---------------------------- revision 1\.2\.2\.2 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1 +date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 change-on-br1 ---------------------------- revision 1\.2\.2\.1 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1 +date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 branches: 1\.2\.2\.1\.2; modify ---------------------------- revision 1\.2\.2\.1\.2\.1 -date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1 +date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 modify =============================================================================" dotest_status branches-14.4 1 \ @@ -2780,6 +3015,232 @@ rcsmerge: warning: conflicts during merge" ======= 1:brbr [>]>>>>>> 1\.1\.2\.1\.2\.1' + + dotest branches-o1 "${testcvs} -q admin -o ::brbr" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v +done" + cd .. + + if test "$keep" = yes; then + echo Keeping ${TESTDIR} and exiting due to --keep + exit 0 + fi + + rm -rf ${CVSROOT_DIRNAME}/first-dir + rm -r first-dir + ;; + + rcslib) + # Test librarification of RCS. + # First: test whether `cvs diff' handles $Name expansion + # correctly. We diff two revisions with their symbolic tags; + # neither tag should be expanded in the output. Also diff + # one revision with the working copy. + + mkdir ${CVSROOT_DIRNAME}/first-dir + dotest rcsdiff-1 "${testcvs} -q co first-dir" '' + cd first-dir + echo "I am the first foo, and my name is $""Name$." > foo.c + dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \ +"${PROG} [a-z]*: scheduling file .foo\.c. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v +done +Checking in foo\.c; +${TESTDIR}/cvsroot/first-dir/foo.c,v <-- foo\.c +initial revision: 1\.1 +done" + dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c" + dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \ +"=================================================================== +Checking out foo\.c +RCS: ${TESTDIR}/cvsroot/first-dir/foo\.c,v +VERS: 1\.1 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +I am the first foo, and my name is \$""Name: first \$\." + + echo "I am the second foo, and my name is $""Name$." > foo.c + dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \ +"Checking in foo\.c; +${TESTDIR}/cvsroot/first-dir/foo\.c,v <-- foo\.c +new revision: 1\.2; previous revision: 1\.1 +done" + dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c" + dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \ +"=================================================================== +Checking out foo\.c +RCS: ${TESTDIR}/cvsroot/first-dir/foo\.c,v +VERS: 1\.2 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +I am the second foo, and my name is \$""Name: second \$\." + + dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \ +"${PROG} [a-z]*: Diffing \. +Index: foo\.c +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v +retrieving revision 1\.1 +retrieving revision 1\.2 +diff -r1\.1 -r1\.2 +1c1 +< I am the first foo, and my name is \$""Name: \$\. +--- +> I am the second foo, and my name is \$""Name: \$\." + + echo "I am the once and future foo, and my name is $""Name$." > foo.c + dotest_fail rcsdiff-10 "${testcvs} diff -r first" \ +"${PROG} [a-z]*: Diffing \. +Index: foo\.c +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v +retrieving revision 1\.1 +diff -r1\.1 foo\.c +1c1 +< I am the first foo, and my name is \$""Name: \$\. +--- +> I am the once and future foo, and my name is \$""Name\$\." + + # Test handling of libdiff options. diff gets quite enough + # of a workout elsewhere in sanity.sh, so we assume that it's + # mostly working properly if it passes all the other tests. + # The main one we want to try is regex handling, since we are + # using CVS's regex matcher and not diff's. + + cat >rgx.c <<EOF +test_regex (whiz, bang) +{ +foo; +bar; +baz; +grumble; +} +EOF + + dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \ +"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v +done +Checking in rgx\.c; +${TESTDIR}/cvsroot/first-dir/rgx\.c,v <-- rgx\.c +initial revision: 1\.1 +done" + cat >rgx.c <<EOF +test_regex (whiz, bang) +{ +foo; +bar; +baz; +mumble; +} +EOF + # Use dotest_fail because exit status from `cvs diff' must be 1. + dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F.*( rgx.c" \ +"Index: rgx\.c +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v +retrieving revision 1\.1 +diff -c -F\.\*( -r1\.1 rgx\.c +\*\*\* rgx\.c [0-9/]* [0-9:]* 1\.1 +--- rgx\.c [0-9/]* [0-9:]* +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang) +\*\*\* 3,7 \*\*\*\* + foo; + bar; + baz; +! grumble; + } +--- 3,7 ---- + foo; + bar; + baz; +! mumble; + }" + + # Tests of rcsmerge/diff3. Merge operations get a good general + # workout elsewhere; we want to make sure that options are still + # handled properly. Try merging two branches with -kv, to test + # both -j and -k switches. + + cd .. + + rm -rf ${CVSROOT_DIRNAME}/first-dir + rm -r first-dir + + mkdir 1; cd 1 + dotest rcslib-merge-1 "${testcvs} -q co -l ." "" + mkdir first-dir + dotest rcslib-merge-2 "${testcvs} -q add first-dir" \ +"Directory ${TESTDIR}/cvsroot.*/first-dir added to the repository" + cd ..; rm -r 1 + + dotest rcslib-merge-3 "${testcvs} -q co first-dir" "" + cd first-dir + + echo '$''Revision$' > file1 + echo '2' >> file1 + echo '3' >> file1 + dotest rcslib-merge-4 "${testcvs} -q add file1" \ +"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + sed -e 's/2/two/' file1 > f; mv f file1 + dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1" + dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1" + dotest rcslib-merge-9 "${testcvs} -q status" \ +"=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v + Sticky Tag: patch1 (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" + dotest rcslib-merge-10 "cat file1" \ +'$''Revision: 1\.1 $ +2 +3' + sed -e 's/3/three/' file1 > f; mv f file1 + dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \ +"U file1 +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.2 +Merging differences between 1\.1 and 1\.2 into file1 +rcsmerge: warning: conflicts during merge" + dotest rcslib-merge-13 "cat file1" \ +"<<<<<<< file1 +1\.1\.2\.1 +2 +three +[=]====== +1\.2 +two +3 +[>]>>>>>> 1\.2" + cd .. if test "$keep" = yes; then @@ -2800,7 +3261,7 @@ rcsmerge: warning: conflicts during merge" echo 1:trunk-1 >file1 dotest multibranch-2 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -2875,6 +3336,19 @@ modify-on-br1 ;; import) # test death after import + # Tests of "cvs import": + # basic2 + # rdiff -- imports with keywords + # import -- more tests of imports with keywords + # importb -- -b option. + # modules3 + # mflag -- various -m messages + # ignore -- import and cvsignore + # binwrap -- import and -k wrappers + # info -- imports which are rejected by verifymsg + # head -- intended to test vendor branches and HEAD, + # although it doesn't really do it yet. + # import mkdir import-dir ; cd import-dir @@ -2891,9 +3365,9 @@ modify-on-br1 cp imported-f2 ../imported-f2-orig.tmp if ${CVS} import -m first-import first-dir vendor-branch junk-1_0 ; then - echo "PASS: test 96" >>${LOGFILE} + pass 96 else - echo "FAIL: test 96" | tee -a ${LOGFILE} ; exit 1 + fail 96 fi if cmp ../imported-f2-orig.tmp imported-f2; then @@ -2905,31 +3379,31 @@ modify-on-br1 # co if ${CVS} co first-dir ; then - echo "PASS: test 97" >>${LOGFILE} + pass 97 else - echo "FAIL: test 97" | tee -a ${LOGFILE} ; exit 1 + fail 97 fi cd first-dir for i in 1 2 3 4 ; do if test -f imported-f"$i" ; then - echo "PASS: test 98-$i" >>${LOGFILE} + pass 98-$i else - echo "FAIL: test 98-$i" | tee -a ${LOGFILE} ; exit 1 + fail 98-$i fi done if test -d RCS; then - echo "FAIL: test 98.5" | tee -a ${LOGFILE} ; exit 1 + fail 98.5 else - echo "PASS: test 98.5" >>${LOGFILE} + pass 98.5 fi # remove rm imported-f1 if ${CVS} rm imported-f1 2>> ${LOGFILE}; then - echo "PASS: test 99" >>${LOGFILE} + pass 99 else - echo "FAIL: test 99" | tee -a ${LOGFILE} ; exit 1 + fail 99 fi # change @@ -2937,46 +3411,46 @@ modify-on-br1 # commit if ${CVS} ci -m local-changes >> ${LOGFILE} 2>&1; then - echo "PASS: test 100" >>${LOGFILE} + pass 100 else - echo "FAIL: test 100" | tee -a ${LOGFILE} ; exit 1 + fail 100 fi # log if ${CVS} log imported-f1 | grep '1.1.1.2 (dead)' ; then - echo "FAIL: test 101" | tee -a ${LOGFILE} ; exit 1 + fail 101 else - echo "PASS: test 101" >>${LOGFILE} + pass 101 fi # update into the vendor branch. if ${CVS} update -rvendor-branch ; then - echo "PASS: test 102" >>${LOGFILE} + pass 102 else - echo "FAIL: test 102" | tee -a ${LOGFILE} ; exit 1 + fail 102 fi # remove file4 on the vendor branch rm imported-f4 if ${CVS} rm imported-f4 2>> ${LOGFILE}; then - echo "PASS: test 103" >>${LOGFILE} + pass 103 else - echo "FAIL: test 103" | tee -a ${LOGFILE} ; exit 1 + fail 103 fi # commit if ${CVS} ci -m vendor-removed imported-f4 >>${LOGFILE}; then - echo "PASS: test 104" >>${LOGFILE} + pass 104 else - echo "FAIL: test 104" | tee -a ${LOGFILE} ; exit 1 + fail 104 fi # update to main line if ${CVS} update -A 2>> ${LOGFILE}; then - echo "PASS: test 105" >>${LOGFILE} + pass 105 else - echo "FAIL: test 105" | tee -a ${LOGFILE} ; exit 1 + fail 105 fi # second import - file4 deliberately unchanged @@ -2987,9 +3461,9 @@ modify-on-br1 cp imported-f2 ../imported-f2-orig.tmp if ${CVS} import -m second-import first-dir vendor-branch junk-2_0 ; then - echo "PASS: test 106" >>${LOGFILE} + pass 106 else - echo "FAIL: test 106" | tee -a ${LOGFILE} ; exit 1 + fail 106 fi if cmp ../imported-f2-orig.tmp imported-f2; then pass 106.5 @@ -3000,45 +3474,45 @@ modify-on-br1 # co if ${CVS} co first-dir ; then - echo "PASS: test 107" >>${LOGFILE} + pass 107 else - echo "FAIL: test 107" | tee -a ${LOGFILE} ; exit 1 + fail 107 fi cd first-dir if test -f imported-f1 ; then - echo "FAIL: test 108" | tee -a ${LOGFILE} ; exit 1 + fail 108 else - echo "PASS: test 108" >>${LOGFILE} + pass 108 fi for i in 2 3 ; do if test -f imported-f"$i" ; then - echo "PASS: test 109-$i" >>${LOGFILE} + pass 109-$i else - echo "FAIL: test 109-$i" | tee -a ${LOGFILE} ; exit 1 + fail 109-$i fi done # check vendor branch for file4 if ${CVS} update -rvendor-branch ; then - echo "PASS: test 110" >>${LOGFILE} + pass 110 else - echo "FAIL: test 110" | tee -a ${LOGFILE} ; exit 1 + fail 110 fi if test -f imported-f4 ; then - echo "PASS: test 111" >>${LOGFILE} + pass 111 else - echo "FAIL: test 111" | tee -a ${LOGFILE} ; exit 1 + fail 111 fi # update to main line if ${CVS} update -A 2>> ${LOGFILE}; then - echo "PASS: test 112" >>${LOGFILE} + pass 112 else - echo "FAIL: test 112" | tee -a ${LOGFILE} ; exit 1 + fail 112 fi cd .. @@ -3055,26 +3529,26 @@ rcsmerge: warning: conflicts during merge" cd first-dir if test -f imported-f1 ; then - echo "FAIL: test 114" | tee -a ${LOGFILE} ; exit 1 + fail 114 else - echo "PASS: test 114" >>${LOGFILE} + pass 114 fi for i in 2 3 ; do if test -f imported-f"$i" ; then - echo "PASS: test 115-$i" >>${LOGFILE} + pass 115-$i else - echo "FAIL: test 115-$i" | tee -a ${LOGFILE} ; exit 1 + fail 115-$i fi done dotest import-116 'cat imported-f2' \ 'imported file2 [<]<<<<<< imported-f2 -import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$ +import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$ local-change [=]====== -import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$ +import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$ rev 2 of file 2 [>]>>>>>> 1\.1\.1\.2' @@ -3084,9 +3558,128 @@ rev 2 of file 2 rm -r import-dir ;; + importb) + # More cvs import tests, especially -b option. + + # OK, first we get some sources from the NetMunger project, and + # import them into the 1.1.1 vendor branch. + mkdir imp-dir + cd imp-dir + echo 'OpenMunger sources' >file1 + echo 'OpenMunger sources' >file2 + dotest importb-1 \ +"${testcvs} import -m add first-dir openmunger openmunger-1_0" \ +"N first-dir/file1 +N first-dir/file2 + +No conflicts created by this import" + cd .. + rm -r imp-dir + + # Now we put the sources we get from FreeMunger into 1.1.3 + mkdir imp-dir + cd imp-dir + echo 'FreeMunger sources' >file1 + echo 'FreeMunger sources' >file2 + # Not completely sure how the conflict detection is supposed to + # be working here (haven't really thought about it). + dotest importb-2 \ +"${testcvs} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \ +"C first-dir/file1 +C first-dir/file2 + +2 conflicts created by this import. +Use the following command to help the merge: + + ${PROG} checkout -jfreemunger:yesterday -jfreemunger first-dir" + cd .. + rm -r imp-dir + + # Now a test of main branch import (into second-dir, not first-dir). + mkdir imp-dir + cd imp-dir + echo 'my own stuff' >mine1.c + echo 'my own stuff' >mine2.c + dotest_fail importb-3 \ +"${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \ +"${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1" + : when we implement main-branch import, should be \ +"N second-dir/mine1\.c +N second-dir/mine2\.c + +No conflicts created by this import" + cd .. + rm -r imp-dir + + mkdir 1 + cd 1 + # when we implement main branch import, will want to + # add "second-dir" here. + dotest importb-4 "${testcvs} -q co first-dir" \ +"U first-dir/file1 +U first-dir/file2" + cd first-dir + dotest importb-5 "${testcvs} -q log file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: 1\.1\.1 +locks: strict +access list: +symbolic names: + freemunger-1_0: 1\.1\.3\.1 + freemunger: 1\.1\.3 + openmunger-1_0: 1\.1\.1\.1 + openmunger: 1\.1\.1 +keyword substitution: kv +total revisions: 3; selected revisions: 3 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.1; 1\.1\.3; +Initial revision +---------------------------- +revision 1\.1\.3\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1 +add +---------------------------- +revision 1\.1\.1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0 +add +=============================================================================" + + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir + ;; + join) # Test doing joins which involve adding and removing files. + # Variety of scenarios (see list below), in the context of: + # * merge changes from T1 to T2 into the main line + # * merge changes from branch 'branch' into the main line + # * merge changes from branch 'branch' into branch 'br2'. # See also binfile2, which does similar things with binary files. + # See also join2, which tests joining (and update -A) on only + # a single file, rather than a directory. + # See also join3, which tests some cases involving the greatest + # common ancestor. Here is a list of tests according to branch + # topology: + # + # --->bp---->trunk too many to mention + # \----->branch + # + # /----->branch1 + # --->bp---->trunk multibranch, multibranch2 + # \----->branch2 + # + # --->bp1----->bp2---->trunk join3 + # \->br1 \->br2 + # + # --->bp1----->trunk + # \----bp2---->branch branches + # \------>branch-of-branch # We check merging changes from T1 to T2 into the main line. # Here are the interesting cases I can think of: @@ -3147,7 +3740,7 @@ rev 2 of file 2 '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file6'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file8'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently' dotest join-3 "${testcvs} -q commit -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v @@ -3190,11 +3783,11 @@ T file8' dotest join-5 "${testcvs} add file2 file7" \ "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file7'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently' dotest join-6 "${testcvs} rm file6 file8" \ "${PROG}"' [a-z]*: scheduling `file6'\'' for removal '"${PROG}"' [a-z]*: scheduling `file8'\'' for removal -'"${PROG}"' [a-z]*: use '\'"${PROG} commit"\'' to remove these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently' dotest join-7 "${testcvs} -q ci -mx ." \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v done @@ -3241,7 +3834,7 @@ U first-dir/file8' echo 'first branch revision of file5' > file5 dotest join-9 "${testcvs} add file5" \ "${PROG}"' [a-z]*: scheduling file `file5'\'' for addition on branch `branch'\'' -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest join-10 "${testcvs} -q ci -mx ." \ "Checking in file3; ${TESTDIR}/cvsroot/first-dir/file3,v <-- file3 @@ -3277,13 +3870,13 @@ T file8' dotest join-12 "${testcvs} add file1 file2" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition on branch `branch'\'' '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\'' -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently' dotest join-13 "${testcvs} rm file3 file4 file5 file6" \ "${PROG}"' [a-z]*: scheduling `file3'\'' for removal '"${PROG}"' [a-z]*: scheduling `file4'\'' for removal '"${PROG}"' [a-z]*: scheduling `file5'\'' for removal '"${PROG}"' [a-z]*: scheduling `file6'\'' for removal -'"${PROG}"' [a-z]*: use '\'"${PROG} commit"\'' to remove these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently' dotest join-14 "${testcvs} -q ci -mx ." \ "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file1,v done @@ -3421,59 +4014,323 @@ M file2 R file3 M file4' + cd .. + + # Checkout the main line again and make a new branch which we + # merge to. + rm -r first-dir + dotest join-25 "${testcvs} -q co first-dir" \ +'U first-dir/file2 +U first-dir/file3 +U first-dir/file4 +U first-dir/file7' + cd first-dir + dotest join-26 "${testcvs} -q tag -b br2" \ +"T file2 +T file3 +T file4 +T file7" + dotest join-27 "${testcvs} -q update -r br2" "" + # The handling of file8 here looks fishy to me. I don't see + # why it should be different from the case where we merge to + # the trunk (e.g. join-23). + dotest join-28 "${testcvs} -q update -j branch" \ +"U file1 +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +retrieving revision 1.1 +retrieving revision 1.1.2.1 +Merging differences between 1.1 and 1.1.2.1 into file2 +${PROG} [a-z]*: scheduling file3 for removal +${PROG} [a-z]*: file file4 has been modified, but has been removed in revision branch +U file8" + # Verify that the right changes have been scheduled. + dotest join-29 "${testcvs} -q update" \ +"A file1 +M file2 +R file3 +A file8" + cd ../.. + rm -r 1 2 3 rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + join2) + # More joining tests. + + # First the usual setup; create a directory first-dir, a file + # first-dir/file1, and a branch br1. + mkdir 1; cd 1 + dotest join2-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest join2-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + echo 'initial contents of file1' >file1 + dotest join2-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest join2-4 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + dotest join2-5 "${testcvs} -q tag -b br1" "T file1" + dotest join2-6 "${testcvs} -q update -r br1" "" + echo 'modify on branch' >>file1 + touch bradd + dotest join2-6a "${testcvs} add bradd" \ +"${PROG} [a-z]*: scheduling file .bradd. for addition on branch .br1. +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest join2-7 "${testcvs} -q ci -m modify" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v +done +Checking in bradd; +${TESTDIR}/cvsroot/first-dir/Attic/bradd,v <-- bradd +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + + # Here is the unusual/pathological part. We switch back to + # the trunk *for file1 only*, not for the whole directory. + dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1' + dotest join2-9 "${testcvs} -q status file1" \ +"=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)" + dotest join2-10 "cat CVS/Tag" "Tbr1" + + dotest join2-11 "${testcvs} -q update -j br1 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.1\.2\.1 +Merging differences between 1\.1 and 1\.1\.2\.1 into file1" + dotest join2-12 "cat file1" "initial contents of file1 +modify on branch" + # We should have no sticky tag on file1 + dotest join2-13 "${testcvs} -q status file1" \ +"=================================================================== +File: file1 Status: Locally Modified + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)" + dotest join2-14 "cat CVS/Tag" "Tbr1" + # And the checkin should go to the trunk + dotest join2-15 "${testcvs} -q ci -m modify file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + + # OK, the above is all well and good and has worked for some + # time. Now try the case where the file had been added on + # the branch. + dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1" + # The workaround is to update the whole directory. + # The non-circumvented version won't work. The reason is that + # update removes the entry from CVS/Entries, so of course we get + # the tag from CVS/Tag and not Entries. I suppose maybe + # we could invent some new format in Entries which would handle + # this, but doing so, and handling it properly throughout + # CVS, would be a lot of work and I'm not sure this case justifies + # it. + dotest join2-17-circumvent "${testcvs} -q update -A" \ +"${PROG} [a-z]*: warning: bradd is not (any longer) pertinent +[UP] file1" +: dotest join2-17 "${testcvs} -q update -A bradd" \ +"${PROG} [a-z]*: warning: bradd is not (any longer) pertinent" + dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd" + dotest join2-19 "${testcvs} -q status bradd" \ +"=================================================================== +File: bradd Status: Locally Added + + Working revision: New file! + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)" + dotest join2-20 "${testcvs} -q ci -m modify bradd" \ +"Checking in bradd; +${TESTDIR}/cvsroot/first-dir/bradd,v <-- bradd +new revision: 1\.2; previous revision: 1\.1 +done" + + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + join3) + # See "join" for a list of other joining/branching tests. + # First the usual setup; create a directory first-dir, a file + # first-dir/file1, and a branch br1. + mkdir 1; cd 1 + dotest join3-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest join3-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + echo 'initial contents of file1' >file1 + dotest join3-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest join3-4 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + dotest join3-5 "${testcvs} -q tag -b br1" "T file1" + dotest join3-6 "${testcvs} -q update -r br1" "" + echo 'br1:line1' >>file1 + dotest join3-7 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + + # Now back to the trunk for: + # another revision and another branch for file1. + # add file2, which will exist on trunk and br2 but not br1. + dotest join3-8 "${testcvs} -q update -A" "[UP] file1" + echo 'trunk:line1' > file2 + dotest join3-8a "${testcvs} add file2" \ +"${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + echo 'trunk:line1' >>file1 + dotest join3-9 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + dotest join3-10 "${testcvs} -q tag -b br2" "T file1 +T file2" + + # Before we actually have any revision on br2, let's try a join + dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1 +${PROG} [a-z]*: file2 is no longer in the repository" + dotest join3-12 "${testcvs} -q update -j br2" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.2 +Merging differences between 1\.1 and 1\.2 into file1 +rcsmerge: warning: conflicts during merge +U file2" + dotest join3-13 "cat file1" \ +"initial contents of file1 +[<]<<<<<< file1 +br1:line1 +[=]====== +trunk:line1 +[>]>>>>>> 1\.2" + rm file1 + + # OK, we'll try the same thing with a revision on br2. + dotest join3-14 "${testcvs} -q update -r br2 file1" \ +"${PROG} [a-z]*: warning: file1 was lost +U file1" "U file1" + echo 'br2:line1' >>file1 + dotest join3-15 "${testcvs} -q ci -m modify file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2\.2\.1; previous revision: 1\.2 +done" + + # OK, now we can join br2 to br1 + dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1" + # It may seem odd, to merge a higher branch into a lower + # branch, but in fact CVS defines the ancestor as 1.1 + # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes. + # This seems like a reasonably plausible behavior. + dotest join3-17 "${testcvs} -q update -j br2 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.2\.2\.1 +Merging differences between 1\.1 and 1\.2\.2\.1 into file1 +rcsmerge: warning: conflicts during merge" + dotest join3-18 "cat file1" \ +"initial contents of file1 +[<]<<<<<< file1 +br1:line1 +[=]====== +trunk:line1 +br2:line1 +[>]>>>>>> 1\.2\.2\.1" + + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + new) # look for stray "no longer pertinent" messages. mkdir ${CVSROOT_DIRNAME}/first-dir if ${CVS} co first-dir ; then - echo "PASS: test 117" >>${LOGFILE} + pass 117 else - echo "FAIL: test 117" | tee -a ${LOGFILE} ; exit 1 + fail 117 fi cd first-dir touch a if ${CVS} add a 2>>${LOGFILE}; then - echo "PASS: test 118" >>${LOGFILE} + pass 118 else - echo "FAIL: test 118" | tee -a ${LOGFILE} ; exit 1 + fail 118 fi if ${CVS} ci -m added >>${LOGFILE} 2>&1; then - echo "PASS: test 119" >>${LOGFILE} + pass 119 else - echo "FAIL: test 119" | tee -a ${LOGFILE} ; exit 1 + fail 119 fi rm a if ${CVS} rm a 2>>${LOGFILE}; then - echo "PASS: test 120" >>${LOGFILE} + pass 120 else - echo "FAIL: test 120" | tee -a ${LOGFILE} ; exit 1 + fail 120 fi if ${CVS} ci -m removed >>${LOGFILE} ; then - echo "PASS: test 121" >>${LOGFILE} + pass 121 else - echo "FAIL: test 121" | tee -a ${LOGFILE} ; exit 1 + fail 121 fi if ${CVS} update -A 2>&1 | grep longer ; then - echo "FAIL: test 122" | tee -a ${LOGFILE} ; exit 1 + fail 122 else - echo "PASS: test 122" >>${LOGFILE} + pass 122 fi if ${CVS} update -rHEAD 2>&1 | grep longer ; then - echo "FAIL: test 123" | tee -a ${LOGFILE} ; exit 1 + fail 123 else - echo "PASS: test 123" >>${LOGFILE} + pass 123 fi cd .. @@ -3495,7 +4352,7 @@ M file4' touch a dotest newb-123b "${testcvs} add a" \ "${PROG} [a-z]*: scheduling file .a. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest newb-123c "${testcvs} -q ci -m added" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v done @@ -3548,7 +4405,15 @@ done" # --disable-server. dotest newb-123j0 "${testcvs} status a" \ "=================================================================== -File: a Status: Needs \(Patch\|Checkout\) +File: a Status: Needs Patch + + Working revision: 1\.1.* + Repository revision: 1\.1\.2\.1 ${TESTDIR}/cvsroot/first-dir/a,v + Sticky Tag: branch (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" \ +"=================================================================== +File: a Status: Needs Checkout Working revision: 1\.1.* Repository revision: 1\.1\.2\.1 ${TESTDIR}/cvsroot/first-dir/a,v @@ -3582,7 +4447,7 @@ File: a Status: Needs \(Patch\|Checkout\) dotest conflicts-125 "${testcvs} add a" \ "${PROG} [a-z]*: scheduling file .a. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest conflicts-126 "${testcvs} -q ci -m added" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v done @@ -3605,15 +4470,15 @@ RCS: ${TMPPWD}/cvsroot/first-dir/a,v VERS: 1\.1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*" if ${CVS} co first-dir ; then - echo 'PASS: test 127' >>${LOGFILE} + pass 127 else - echo 'FAIL: test 127' | tee -a ${LOGFILE} + fail 127 fi cd first-dir if test -f a; then - echo 'PASS: test 127a' >>${LOGFILE} + pass 127a else - echo 'FAIL: test 127a' | tee -a ${LOGFILE} + fail 127a fi cd ../../1/first-dir @@ -3708,31 +4573,36 @@ File: a Status: File had conflicts on merge Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)" - dotest_fail conflicts-132 "${testcvs} -q ci -m try" \ -"${PROG} [a-z]*: file .a. still contains conflict indicators -${PROG} \[[a-z]* aborted\]: correct above errors first!" + dotest conflicts-132 "${testcvs} -q ci -m try" \ +"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators +Checking in a; +${TESTDIR}/cvsroot/first-dir/a,v <-- a +new revision: 1\.3; previous revision: 1\.2 +done" + # OK, the user saw the warning (good user), and now + # resolves it for real. echo resolve conflict >a dotest conflicts-status-3 "${testcvs} status a" \ "=================================================================== -File: a Status: File had conflicts on merge +File: a Status: Locally Modified - Working revision: 1\.2.* - Repository revision: 1\.2 ${TESTDIR}/cvsroot/first-dir/a,v + Working revision: 1\.3.* + Repository revision: 1\.3 ${TESTDIR}/cvsroot/first-dir/a,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)" dotest conflicts-133 "${testcvs} -q ci -m resolved" \ "Checking in a; ${TESTDIR}/cvsroot/first-dir/a,v <-- a -new revision: 1\.3; previous revision: 1\.2 +new revision: 1\.4; previous revision: 1\.3 done" dotest conflicts-status-4 "${testcvs} status a" \ "=================================================================== File: a Status: Up-to-date - Working revision: 1\.3.* - Repository revision: 1\.3 ${TESTDIR}/cvsroot/first-dir/a,v + Working revision: 1\.4.* + Repository revision: 1\.4 ${TESTDIR}/cvsroot/first-dir/a,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)" @@ -3742,14 +4612,14 @@ File: a Status: Up-to-date cd ../../1/first-dir echo abc >abc if ${testcvs} add abc >>${LOGFILE} 2>&1; then - echo 'PASS: test 134' >>${LOGFILE} + pass 134 else - echo 'FAIL: test 134' | tee -a ${LOGFILE} + fail 134 fi if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then - echo 'PASS: test 135' >>${LOGFILE} + pass 135 else - echo 'FAIL: test 135' | tee -a ${LOGFILE} + fail 135 fi cd ../../2 mkdir first-dir/dir1 first-dir/sdir @@ -3769,41 +4639,41 @@ File: a Status: Up-to-date cd ../1/first-dir mkdir subdir if ${testcvs} add subdir >>${LOGFILE}; then - echo 'PASS: test 138' >>${LOGFILE} + pass 138 else - echo 'FAIL: test 138' | tee -a ${LOGFILE} + fail 138 fi cd ../.. mkdir 3 cd 3 if ${testcvs} -q co first-dir/abc first-dir/subdir \ >>${LOGFILE}; then - echo 'PASS: test 139' >>${LOGFILE} + pass 139 else - echo 'FAIL: test 139' | tee -a ${LOGFILE} + fail 139 fi cd ../1/first-dir/subdir echo sss >sss if ${testcvs} add sss >>${LOGFILE} 2>&1; then - echo 'PASS: test 140' >>${LOGFILE} + pass 140 else - echo 'FAIL: test 140' | tee -a ${LOGFILE} + fail 140 fi if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then - echo 'PASS: test 140' >>${LOGFILE} + pass 140 else - echo 'FAIL: test 140' | tee -a ${LOGFILE} + fail 140 fi cd ../../../3/first-dir if ${testcvs} -q update >>${LOGFILE}; then - echo 'PASS: test 141' >>${LOGFILE} + pass 141 else - echo 'FAIL: test 141' | tee -a ${LOGFILE} + fail 141 fi if test -f subdir/sss; then - echo 'PASS: test 142' >>${LOGFILE} + pass 142 else - echo 'FAIL: test 142' | tee -a ${LOGFILE} + fail 142 fi cd ../.. rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir @@ -3825,7 +4695,7 @@ File: a Status: Up-to-date dotest conflicts2-142a2 "${testcvs} add a abc" \ "${PROG} [a-z]*: scheduling file .a. for addition ${PROG} [a-z]*: scheduling file .abc. for addition -${PROG} [a-z]*: use .cvs commit. to add these files permanently" +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" dotest conflicts2-142a3 "${testcvs} -q ci -m added" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v done @@ -3899,48 +4769,301 @@ ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently" # party has a file of the same name, cvs notices cd 1/first-dir touch aa.c - dotest conflicts2-142d0 "${testcvs} add aa.c" \ + echo 'contents unchanged' >same.c + dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \ "${PROG} [a-z]*: scheduling file .aa\.c. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: scheduling file .same\.c. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" dotest conflicts2-142d1 "${testcvs} -q ci -m added" \ -"RCS file: ${TESTDIR}/cvsroot/first-dir/aa.c,v +"RCS file: ${TESTDIR}/cvsroot/first-dir/aa\.c,v done -Checking in aa.c; -${TESTDIR}/cvsroot/first-dir/aa.c,v <-- aa.c +Checking in aa\.c; +${TESTDIR}/cvsroot/first-dir/aa\.c,v <-- aa\.c +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/same\.c,v +done +Checking in same\.c; +${TESTDIR}/cvsroot/first-dir/same\.c,v <-- same\.c initial revision: 1\.1 done" cd ../../2/first-dir echo "don't you dare obliterate this text" >aa.c - # Doing this test separately for remote and local is a fair - # bit of a kludge, but the exit status differs. I'm not sure - # which exit status is the more appropriate one. + echo 'contents unchanged' >same.c + # Note the discrepancy between local and remote in the handling + # of same.c. I kind + # of suspect that the local CVS behavior is the more useful one + # although I do sort of wonder whether we should make people run + # cvs add just to get them in that habit (also, trying to implement + # the local CVS behavior for remote without the cvs add seems + # pretty difficult). if test "$remote" = yes; then - dotest conflicts2-142d2 "${testcvs} -q update" \ + dotest_fail conflicts2-142d2 "${testcvs} -q update" \ "${QUESTION} aa\.c -U aa\.c -${PROG} update: move away \./aa\.c; it is in the way" +${QUESTION} same\.c +${PROG} update: move away \./aa\.c; it is in the way +C aa\.c +${PROG} update: move away \./same\.c; it is in the way +C same\.c" else dotest_fail conflicts2-142d2 "${testcvs} -q update" \ "${PROG} [a-z]*: move away aa\.c; it is in the way -C aa\.c" +C aa\.c +U same\.c" fi + dotest conflicts2-142d3 "${testcvs} -q status aa.c" \ +"${PROG} [a-z]*: move away aa\.c; it is in the way +=================================================================== +File: aa\.c Status: Unresolved Conflict + + Working revision: No entry for aa\.c + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/aa\.c,v" + + # Could also be testing the case in which the cvs add happened + # before the commit by the other user. + # This message seems somewhat bogus. I mean, parallel development + # means that we get to work in parallel if we choose, right? And + # then at commit time it would be a conflict. + dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \ +"${PROG} [a-z]*: aa.c added independently by second party" + + # The user might want to see just what the conflict is. + # Don't bother, diff seems to kind of lose its mind, with or + # without -N. This is a CVS bug(s). + #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme + + # Now: "how can the user resolve this conflict", I hear you cry. + # Well, one way is to forget about the file in the working + # directory. + # Since it didn't let us do the add in conflicts2-142d4, there + # is no need to run cvs rm here. + #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme + dotest conflicts2-142d6 "rm aa.c" '' + dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c" + dotest conflicts2-142d8 "cat aa.c" '' + + # The other way is to use the version from the working directory + # instead of the version from the repository. Unfortunately, + # there doesn't seem to be any particularly clear way to do + # this (?). + cd ../.. rm -r 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + conflicts3) + # More tests of conflicts and/or multiple working directories + # in general. + + mkdir 1; cd 1 + dotest conflicts3-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest conflicts3-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd .. + mkdir 2; cd 2 + dotest conflicts3-3 "${testcvs} -q co -l first-dir" '' + cd ../1/first-dir + touch file1 file2 + dotest conflicts3-4 "${testcvs} add file1 file2" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest conflicts3-5 "${testcvs} -q ci -m add-them" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + cd ../../2/first-dir + # Check that -n doesn't make CVS lose its mind as it creates + # (or rather, doesn't) a new file. + dotest conflicts3-6 "${testcvs} -nq update" \ +"U file1 +U file2" + dotest_fail conflicts3-7 "test -f file1" '' + dotest conflicts3-8 "${testcvs} -q update" \ +"U file1 +U file2" + dotest conflicts3-9 "test -f file2" '' + + # OK, now remove two files at once + dotest conflicts3-10 "${testcvs} rm -f file1 file2" \ +"${PROG} [a-z]*: scheduling .file1. for removal +${PROG} [a-z]*: scheduling .file2. for removal +${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently" + dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \ +"Removing file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: delete; previous revision: 1\.1 +done +Removing file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +new revision: delete; previous revision: 1\.1 +done" + cd ../../1/first-dir + dotest conflicts3-12 "${testcvs} -n -q update" \ +"${PROG} [a-z]*: warning: file1 is not (any longer) pertinent +${PROG} [a-z]*: warning: file2 is not (any longer) pertinent" + dotest conflicts3-13 "${testcvs} -q update" \ +"${PROG} [a-z]*: warning: file1 is not (any longer) pertinent +${PROG} [a-z]*: warning: file2 is not (any longer) pertinent" + + # OK, now add a directory to both working directories + # and see that CVS doesn't lose its mind. + mkdir sdir + dotest conficts3-14 "${testcvs} add sdir" \ +"Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository" + cd ../../2/first-dir + + # Create a CVS directory without the proper administrative + # files in it. This can happen for example if you hit ^C + # in the middle of a checkout. + mkdir sdir + mkdir sdir/CVS + # OK, in the local case CVS sees that the directory exists + # in the repository and recurses into it. In the remote case + # CVS can't see the repository and has no way of knowing + # that sdir is even a directory (stat'ing everything would be + # too slow). The remote behavior makes more sense to me (but + # would this affect other cases?). + if test "$remote" = yes; then + dotest conflicts3-15 "${testcvs} -q update" \ +"${QUESTION} sdir" + else + dotest conflicts3-15 "${testcvs} -q update" \ +"${QUESTION} sdir +${PROG} [a-z]*: ignoring sdir (CVS/Repository missing)" + touch sdir/CVS/Repository + dotest conflicts3-16 "${testcvs} -q update" \ +"${QUESTION} sdir +${PROG} [a-z]*: ignoring sdir (CVS/Entries missing)" + fi + rm -r sdir + + # OK, now the same thing, but the directory doesn't exist + # in the repository. + mkdir newdir + mkdir newdir/CVS + dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir" + echo "D/newdir////" >> CVS/Entries + dotest conflicts3-18 "${testcvs} -q update" \ +"${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)" + touch newdir/CVS/Repository + dotest conflicts3-19 "${testcvs} -q update" \ +"${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)" + rm -r newdir + + cd ../.. + + rm -r 1 2 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + modules) # Tests of various ways to define and use modules. + + ############################################################ + # These tests are to make sure that administrative files get + # rebuilt, regardless of how and where files are checked + # out. + ############################################################ + # Check out the whole repository + mkdir 1; cd 1 + dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist +U CVSROOT/commitinfo +U CVSROOT/config +U CVSROOT/cvswrappers +U CVSROOT/editinfo +U CVSROOT/loginfo +U CVSROOT/modules +U CVSROOT/notify +U CVSROOT/rcsinfo +U CVSROOT/taginfo +U CVSROOT/verifymsg' + echo "# made a change" >>CVSROOT/modules + dotest modules-1d "${testcvs} -q ci -m add-modules" \ +"Checking in CVSROOT/modules; +${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd .. + rm -rf 1 + + ############################################################ + # Check out CVSROOT + mkdir 1; cd 1 + dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist +U CVSROOT/commitinfo +U CVSROOT/config +U CVSROOT/cvswrappers +U CVSROOT/editinfo +U CVSROOT/loginfo +U CVSROOT/modules +U CVSROOT/notify +U CVSROOT/rcsinfo +U CVSROOT/taginfo +U CVSROOT/verifymsg' + echo "# made a change" >>CVSROOT/modules + dotest modules-2d "${testcvs} -q ci -m add-modules" \ +"Checking in CVSROOT/modules; +${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd .. + rm -rf 1 + + ############################################################ + # Check out CVSROOT in some other directory + mkdir ${CVSROOT_DIRNAME}/somedir + mkdir 1; cd 1 + dotest modules-3 "${testcvs} -q co somedir" '' + cd somedir + dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist +U CVSROOT/commitinfo +U CVSROOT/config +U CVSROOT/cvswrappers +U CVSROOT/editinfo +U CVSROOT/loginfo +U CVSROOT/modules +U CVSROOT/notify +U CVSROOT/rcsinfo +U CVSROOT/taginfo +U CVSROOT/verifymsg' + echo "# made a change" >>CVSROOT/modules + dotest modules-3g "${testcvs} -q ci -m add-modules" \ +"Checking in CVSROOT/modules; +${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd ../.. + rm -rf 1 + rm -rf ${CVSROOT_DIRNAME}/somedir + ############################################################ + # end rebuild tests + ############################################################ + + mkdir ${CVSROOT_DIRNAME}/first-dir mkdir 1 cd 1 if ${testcvs} -q co first-dir; then - echo 'PASS: test 143' >>${LOGFILE} + pass 143 else - echo 'FAIL: test 143' | tee -a ${LOGFILE} - exit 1 + fail 143 fi cd first-dir @@ -3954,25 +5077,22 @@ C aa\.c" touch a b if ${testcvs} add a b 2>>${LOGFILE} ; then - echo 'PASS: test 144' >>${LOGFILE} + pass 144 else - echo 'FAIL: test 144' | tee -a ${LOGFILE} - exit 1 + fail 144 fi if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then - echo 'PASS: test 145' >>${LOGFILE} + pass 145 else - echo 'FAIL: test 145' | tee -a ${LOGFILE} - exit 1 + fail 145 fi cd .. if ${testcvs} -q co CVSROOT >>${LOGFILE}; then - echo 'PASS: test 146' >>${LOGFILE} + pass 146 else - echo 'FAIL: test 146' | tee -a ${LOGFILE} - exit 1 + fail 146 fi # Here we test that CVS can deal with CVSROOT (whose repository @@ -3980,10 +5100,9 @@ C aa\.c" # is a subdirectory of first-dir). TODO: Might want to check that # files can actually get updated in this state. if ${testcvs} -q update; then - echo 'PASS: test 147' >>${LOGFILE} + pass 147 else - echo 'FAIL: test 147' | tee -a ${LOGFILE} - exit 1 + fail 147 fi echo realmodule first-dir/subdir a >CVSROOT/modules @@ -3993,6 +5112,7 @@ C aa\.c" echo aliasnested -a first-dir/subdir/ssdir >>CVSROOT/modules echo topfiles -a first-dir/file1 first-dir/file2 >>CVSROOT/modules echo world -a . >>CVSROOT/modules + echo statusmod -s Mungeable >>CVSROOT/modules # Options must come before arguments. It is possible this should # be relaxed at some point (though the result would be bizarre for @@ -4000,85 +5120,86 @@ C aa\.c" echo bogusalias first-dir/subdir/a -a >>CVSROOT/modules if ${testcvs} ci -m 'add modules' CVSROOT/modules \ >>${LOGFILE} 2>&1; then - echo 'PASS: test 148' >>${LOGFILE} + pass 148 else - echo 'FAIL: test 148' | tee -a ${LOGFILE} - exit 1 + fail 148 fi cd .. + # The "statusmod" module contains an error; trying to use it + # will produce "modules file missing directory" I think. + # However, that shouldn't affect the ability of "cvs co -c" or + # "cvs co -s" to do something reasonable with it. dotest 148a0 "${testcvs} co -c" 'aliasmodule -a first-dir/subdir/a aliasnested -a first-dir/subdir/ssdir bogusalias first-dir/subdir/a -a dirmodule first-dir/subdir namedmodule -d nameddir first-dir/subdir realmodule first-dir/subdir a +statusmod -s Mungeable topfiles -a first-dir/file1 first-dir/file2 -world -a .' - # I don't know why aliasmodule isn't printed (I would have thought - # that it gets printed without the -a; although I'm not sure that - # printing expansions without options is useful). +world -a \.' + # There is code in modules.c:save_d which explicitly skips + # modules defined with -a, which is why aliasmodule is not + # listed. dotest 148a1 "${testcvs} co -s" \ -'bogusalias NONE first-dir/subdir/a -a +'statusmod Mungeable +bogusalias NONE first-dir/subdir/a -a dirmodule NONE first-dir/subdir namedmodule NONE first-dir/subdir realmodule NONE first-dir/subdir a' # Test that real modules check out to realmodule/a, not subdir/a. if ${testcvs} co realmodule >>${LOGFILE}; then - echo 'PASS: test 149a1' >>${LOGFILE} + pass 149a1 else - echo 'FAIL: test 149a1' | tee -a ${LOGFILE} - exit 1 + fail 149a1 fi if test -d realmodule && test -f realmodule/a; then - echo 'PASS: test 149a2' >>${LOGFILE} + pass 149a2 else - echo 'FAIL: test 149a2' | tee -a ${LOGFILE} - exit 1 + fail 149a2 fi if test -f realmodule/b; then - echo 'FAIL: test 149a3' | tee -a ${LOGFILE} - exit 1 + fail 149a3 else - echo 'PASS: test 149a3' >>${LOGFILE} + pass 149a3 fi if ${testcvs} -q co realmodule; then - echo 'PASS: test 149a4' >>${LOGFILE} + pass 149a4 else - echo 'FAIL: test 149a4' | tee -a ${LOGFILE} - exit 1 + fail 149a4 fi if echo "yes" | ${testcvs} release -d realmodule >>${LOGFILE} ; then - echo 'PASS: test 149a5' >>${LOGFILE} + pass 149a5 else - echo 'FAIL: test 149a5' | tee -a ${LOGFILE} - exit 1 + fail 149a5 fi + dotest_fail 149b1 "${testcvs} co realmodule/a" \ +"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \ +"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory +'"${PROG}"' \[[a-z]* aborted\]: cannot expand modules' + # Now test the ability to check out a single file from a directory if ${testcvs} co dirmodule/a >>${LOGFILE}; then - echo 'PASS: test 150c' >>${LOGFILE} + pass 150c else - echo 'FAIL: test 150c' | tee -a ${LOGFILE} - exit 1 + fail 150c fi if test -d dirmodule && test -f dirmodule/a; then - echo 'PASS: test 150d' >>${LOGFILE} + pass 150d else - echo 'FAIL: test 150d' | tee -a ${LOGFILE} - exit 1 + fail 150d fi if test -f dirmodule/b; then - echo 'FAIL: test 150e' | tee -a ${LOGFILE} - exit 1 + fail 150e else - echo 'PASS: test 150e' >>${LOGFILE} + pass 150e fi if echo "yes" | ${testcvs} release -d dirmodule >>${LOGFILE} ; then - echo 'PASS: test 150f' >>${LOGFILE} + pass 150f else - echo 'FAIL: test 150f' | tee -a ${LOGFILE} - exit 1 + fail 150f fi # Now test the ability to correctly reject a non-existent filename. # For maximum studliness we would check that an error message is @@ -4087,18 +5208,17 @@ realmodule NONE first-dir/subdir a' # We accept a zero exit status because it is what CVS does # (Dec 95). Probably the exit status should be nonzero, # however. - echo 'PASS: test 150g1' >>${LOGFILE} + pass 150g1 else - echo 'PASS: test 150g1' >>${LOGFILE} + pass 150g1 fi # We tolerate the creation of the dirmodule directory, since that # is what CVS does, not because we view that as preferable to not # creating it. if test -f dirmodule/a || test -f dirmodule/b; then - echo 'FAIL: test 150g2' | tee -a ${LOGFILE} - exit 1 + fail 150g2 else - echo 'PASS: test 150g2' >>${LOGFILE} + pass 150g2 fi rm -r dirmodule @@ -4124,31 +5244,27 @@ U nameddir/b' # Now test that alias modules check out to subdir/a, not # aliasmodule/a. if ${testcvs} co aliasmodule >>${LOGFILE}; then - echo 'PASS: test 151' >>${LOGFILE} + pass 151 else - echo 'FAIL: test 151' | tee -a ${LOGFILE} - exit 1 + fail 151 fi if test -d aliasmodule; then - echo 'FAIL: test 152' | tee -a ${LOGFILE} - exit 1 + fail 152 else - echo 'PASS: test 152' >>${LOGFILE} + pass 152 fi echo abc >>first-dir/subdir/a if (${testcvs} -q co aliasmodule | tee test153.tmp) \ >>${LOGFILE}; then - echo 'PASS: test 153' >>${LOGFILE} + pass 153 else - echo 'FAIL: test 153' | tee -a ${LOGFILE} - exit 1 + fail 153 fi echo 'M first-dir/subdir/a' >ans153.tmp if cmp test153.tmp ans153.tmp; then - echo 'PASS: test 154' >>${LOGFILE} + pass 154 else - echo 'FAIL: test 154' | tee -a ${LOGFILE} - exit 1 + fail 154 fi cd .. @@ -4193,7 +5309,7 @@ U first-dir/subdir/b" dotest modules-155c2 "${testcvs} add file1 file2" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently' dotest modules-155c3 "${testcvs} -q ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -4214,6 +5330,22 @@ done" "U first-dir/file1 U first-dir/file2" dotest modules-155c5 "${testcvs} -q co topfiles" "" + + # Make sure the right thing happens if we remove a file. + cd first-dir + dotest modules-155c6 "${testcvs} -q rm -f file1" \ +"${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently" + dotest modules-155c7 "${testcvs} -q ci -m remove-it" \ +"Removing file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: delete; previous revision: 1\.1 +done" + cd .. + rm -r first-dir + dotest modules-155c8 "${testcvs} -q co topfiles" \ +"${PROG} [a-z]*: warning: first-dir/file1 is not (any longer) pertinent +U first-dir/file2" + cd .. rm -r 1 @@ -4222,8 +5354,28 @@ U first-dir/file2" modules2) # More tests of modules, in particular the & feature. - mkdir ${CVSROOT_DIRNAME}/first-dir - mkdir ${CVSROOT_DIRNAME}/second-dir + mkdir 1; cd 1 + dotest modules2-setup-1 "${testcvs} -q co -l ." '' + mkdir first-dir second-dir third-dir + dotest modules2-setup-2 \ +"${testcvs} add first-dir second-dir third-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository +Directory ${TESTDIR}/cvsroot/second-dir added to the repository +Directory ${TESTDIR}/cvsroot/third-dir added to the repository" + cd third-dir + touch file3 + dotest modules2-setup-3 "${testcvs} add file3" \ +"${PROG} [a-z]*: scheduling file .file3. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \ +"RCS file: ${TESTDIR}/cvsroot/third-dir/file3,v +done +Checking in file3; +${TESTDIR}/cvsroot/third-dir/file3,v <-- file3 +initial revision: 1\.1 +done" + cd ../.. + rm -r 1 mkdir 1 cd 1 @@ -4232,6 +5384,7 @@ U first-dir/file2" 'U CVSROOT/modules' cd CVSROOT echo 'ampermodule &first-dir &second-dir' > modules + echo 'combmodule third-dir file3 &first-dir' >> modules # Depending on whether the user also ran the modules test # we will be checking in revision 1.2 or 1.3. dotest modules2-2 "${testcvs} -q ci -m add-modules" \ @@ -4263,8 +5416,98 @@ EOF cd .. + # Now we create another directory named first-dir and make + # sure that CVS doesn't get them mixed up. + mkdir first-dir + # Note that this message should say "Updating ampermodule/first-dir" + # I suspect. This is a long-standing behavior/bug.... + dotest modules2-9 "${testcvs} co ampermodule" \ +"${PROG} [a-z]*: Updating first-dir +${PROG} [a-z]*: Updating second-dir" + touch ampermodule/first-dir/amper1 + dotest modules2-10 "${testcvs} add ampermodule/first-dir/amper1" \ +"${PROG} [a-z]*: scheduling file .ampermodule/first-dir/amper1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + + # As with the "Updating xxx" message, the "U first-dir/amper1" + # message (instead of "U ampermodule/first-dir/amper1") is + # rather fishy. + dotest modules2-12 "${testcvs} co ampermodule" \ +"${PROG} [a-z]*: Updating first-dir +A first-dir/amper1 +${PROG} [a-z]*: Updating second-dir" + + if test "$remote" = no; then + dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v +done +Checking in ampermodule/first-dir/amper1; +${TESTDIR}/cvsroot/first-dir/amper1,v <-- amper1 +initial revision: 1\.1 +done" + else + # Trying this as above led to a "protocol error" message. + # Work around this bug. + cd ampermodule + dotest modules2-13 "${testcvs} -q ci -m add-it" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v +done +Checking in first-dir/amper1; +${TESTDIR}/cvsroot/first-dir/amper1,v <-- amper1 +initial revision: 1\.1 +done" + cd .. + fi + + # Now test the "combmodule" module (combining regular modules + # and ampersand modules in the same module definition). + cd .. + rm -r 1 + mkdir 1; cd 1 + dotest modules2-14 "${testcvs} co combmodule" \ +"U combmodule/file3 +${PROG} [a-z]*: Updating first-dir +U first-dir/amper1" + dotest modules2-15 "test -f combmodule/file3" "" + dotest modules2-16 "test -f combmodule/first-dir/amper1" "" + cd combmodule + rm -r first-dir + # Might be possible to have a more graceful error message, + # but at least for now there is no way to tell CVS that + # some files/subdirectories come from one repository directory, + # and others from another. + if test "$remote" = no; then + dotest_fail modules2-17 "${testcvs} update -d" \ +"${PROG} [a-z]*: Updating \. +${PROG} [a-z]*: Updating first-dir +${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/third-dir/first-dir: No such file or directory" + # Clean up the droppings left by the previous command. + # This should definitely not be necessary (I think). + rm -r first-dir + else + # This seems like a pretty sensible behavior to me, in the + # sense that first-dir doesn't "really" exist within + # third-dir, so CVS just acts as if there is nothing there + # to do. + dotest modules2-17 "${testcvs} update -d" \ +"${PROG} server: Updating \." + fi + + cd .. + dotest modules2-18 "${testcvs} -q co combmodule" \ +"U first-dir/amper1" + dotest modules2-19 "test -f combmodule/first-dir/amper1" "" + cd .. + rm -r 1 + # Test that CVS gives an error if one combines -a with # other options. + # Probably would be better to break this out into a separate + # test. Although it is short, it shares no files/state with + # the rest of the modules2 tests. + mkdir 1; cd 1 + dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \ +'U CVSROOT/modules' cd CVSROOT echo 'aliasopt -a -d onedir first-dir' >modules dotest modules2-a0 "${testcvs} -q ci -m add-modules" \ @@ -4285,6 +5528,7 @@ ${PROG} \[[a-z]* aborted\]: cannot expand modules" rm -r 1 rm -rf ${CVSROOT_DIRNAME}/first-dir rm -rf ${CVSROOT_DIRNAME}/second-dir + rm -rf ${CVSROOT_DIRNAME}/third-dir ;; modules3) @@ -4303,7 +5547,7 @@ ${PROG} \[[a-z]* aborted\]: cannot expand modules" echo file1 >file1 dotest modules3-2 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest modules3-3 "${testcvs} -q ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -4313,8 +5557,8 @@ initial revision: 1\.1 done" cd .. - dotest modules3-4 "${testcvs} -q co CVSROOT/modules" \ -'U CVSROOT/modules' + dotest modules3-4 "${testcvs} -q update -d CVSROOT" \ +"U CVSROOT${DOTSTAR}" cd CVSROOT cat >modules <<EOF mod1 -a first-dir/file1 @@ -4323,6 +5567,7 @@ namednest -d src/sub/dir first-dir nestdeeper -d src/sub1/sub2/sub3/dir first-dir nestshallow -d src/dir second-dir/suba/subb path/in/modules &mod1 +another/path/test -d another/path/test first-dir EOF dotest modules3-5 "${testcvs} -q ci -m add-modules" \ "Checking in modules; @@ -4375,7 +5620,7 @@ ${PROG} [a-z]*: Updating second-dir/suba/subb" \ touch fileb dotest modules3-7c "${testcvs} add fileb" \ "${PROG} [a-z]*: scheduling file .fileb. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest modules3-7d "${testcvs} -q ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/second-dir/suba/subb/fileb,v done @@ -4386,26 +5631,6 @@ done" cd ../../.. cd ..; rm -r 1 - mkdir 1; cd 1 - dotest modules3-7e "${testcvs} -q co nestshallow" \ -"U src/dir/fileb" - - # Using ${TESTDIR}/cvsroot/second-dir/suba instead of - # ${TESTDIR}/cvsroot/second-dir seems wrong, it seems like the - # 30 Dec 1996 change to build_dirs_and_chdir simply failed - # to consider what to put in CVS/Repository. - # Remote does "${TESTDIR}/cvsroot/\." which seems equally wrong, - # if in a different way, but variety is the spice of life, - # eh? - dotest modules3-7f "cat CVS/Repository" \ -"${TESTDIR}/cvsroot/second-dir/suba" "${TESTDIR}/cvsroot/\." - - dotest modules3-7g "cat src/CVS/Repository" \ -"${TESTDIR}/cvsroot/second-dir/suba" - dotest modules3-7h "cat src/dir/CVS/Repository" \ -"${TESTDIR}/cvsroot/second-dir/suba/subb" - cd ..; rm -r 1 - mkdir 1 cd 1 dotest modules3-8 "${testcvs} -q co namednest" \ @@ -4442,10 +5667,11 @@ done" # need to keep doing it, but it is what CVS currently does... # Skip it for remote; the remote code has the good sense to # not deal with it (on the minus side it gives - # "internal error: repository string too short." instead of a - # real error). - # I kind of suspect that it would be OK to just make it a fatal - # error to have '/' in a module name. + # "internal error: repository string too short." (CVS 1.9) or + # "warning: server is not creating directories one at a time" (now) + # instead of a real error). + # I'm tempted to just make it a fatal error to have '/' in a + # module name. But see comments at modules3-16. if test "x$remote" = xno; then mkdir 1; cd 1 dotest modules3-12 "${testcvs} -q co path/in/modules" \ @@ -4465,10 +5691,120 @@ done" cd ..; rm -r 1 fi # end of tests skipped for remote + # Some people seem to want this to work. I still suspect there + # are dark corners in slashes in module names. This probably wants + # more thought before we start hacking on CVS (one way or the other) + # or documenting this. + mkdir 2; cd 2 + dotest modules3-16 "${testcvs} -q co another/path/test" \ +"U another/path/test/file1" + dotest modules3-17 "cat another/path/test/file1" 'file1' + cd ..; rm -r 2 + rm -rf ${CVSROOT_DIRNAME}/first-dir rm -rf ${CVSROOT_DIRNAME}/second-dir ;; + modules4) + # Some tests using the modules file with aliases that + # exclude particular directories. + + mkdir 1; cd 1 + + dotest modules4-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest modules4-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + + cd first-dir + mkdir subdir + dotest modules4-3 "${testcvs} add subdir" \ +"Directory ${TESTDIR}/cvsroot/first-dir/subdir added to the repository" + + echo file1 > file1 + dotest modules4-4 "${testcvs} add file1" \ +"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' + + echo file2 > subdir/file2 + dotest modules4-5 "${testcvs} add subdir/file2" \ +"${PROG}"' [a-z]*: scheduling file `subdir/file2'\'' for addition +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' + + dotest modules4-6 "${testcvs} -q ci -m add-it" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/file2,v +done +Checking in subdir/file2; +${TESTDIR}/cvsroot/first-dir/subdir/file2,v <-- file2 +initial revision: 1\.1 +done" + + cd .. + + dotest modules4-7 "${testcvs} -q update -d CVSROOT" \ +"U CVSROOT${DOTSTAR}" + cd CVSROOT + cat >modules <<EOF +all -a first-dir +some -a !first-dir/subdir first-dir +EOF + dotest modules4-8 "${testcvs} -q ci -m add-modules" \ +"Checking in modules; +${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd .. + + cd .. + mkdir 2; cd 2 + + dotest modules4-9 "${testcvs} -q co all" \ +"U first-dir/file1 +U first-dir/subdir/file2" + rm -r first-dir + + dotest modules4-10 "${testcvs} -q co some" "U first-dir/file1" + dotest_fail modules4-11 "test -d first-dir/subdir" '' + rm -r first-dir + + cd .. + rm -r 2 + + dotest modules4-12 "${testcvs} rtag tag some" \ +"${PROG} [a-z]*: Tagging first-dir +${PROG} [a-z]*: Ignoring first-dir/subdir" + + cd 1/first-dir/subdir + dotest modules4-13 "${testcvs} log file2" " +RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/file2,v +Working file: file2 +head: 1\.1 +branch: +locks: strict +access list: +symbolic names: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +add-it +=============================================================================" + + cd ../../.. + rm -r 1 + + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + mflag) for message in '' ' ' ' ' ' test' ; do @@ -4477,49 +5813,43 @@ done" # Test handling of -m during import echo testa >>test if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then - echo 'PASS: test 156' >>${LOGFILE} + pass 156 else - echo 'FAIL: test 156' | tee -a ${LOGFILE} - exit 1 + fail 156 fi # Must import twice since the first time uses inline code that # avoids RCS call. echo testb >>test if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then - echo 'PASS: test 157' >>${LOGFILE} + pass 157 else - echo 'FAIL: test 157' | tee -a ${LOGFILE} - exit 1 + fail 157 fi # Test handling of -m during ci cd ..; rm -r a-dir if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then - echo 'PASS: test 158' >>${LOGFILE} + pass 158 else - echo 'FAIL: test 158' | tee -a ${LOGFILE} - exit 1 + fail 158 fi cd a-dir echo testc >>test if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then - echo 'PASS: test 159' >>${LOGFILE} + pass 159 else - echo 'FAIL: test 159' | tee -a ${LOGFILE} - exit 1 + fail 159 fi # Test handling of -m during rm/ci rm test; if ${testcvs} rm test >>${LOGFILE} 2>&1; then - echo 'PASS: test 160' >>${LOGFILE} + pass 160 else - echo 'FAIL: test 160' | tee -a ${LOGFILE} - exit 1 + fail 160 fi if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then - echo 'PASS: test 161' >>${LOGFILE} + pass 161 else - echo 'FAIL: test 161' | tee -a ${LOGFILE} - exit 1 + fail 161 fi # Clean up cd .. @@ -4527,70 +5857,245 @@ done" rm -rf ${CVSROOT_DIRNAME}/a-dir done ;; + + editor) + # More tests of log messages, in this case the ability to + # run an external editor. + # TODO: + # * also test $EDITOR, $CVSEDITOR, &c. + # * test what happens if up-to-date check fails. + + # Our "editor" puts "x" at the start of each line, so we + # can see the "CVS:" lines. + cat >${TESTDIR}/editme <<EOF +#!${TESTSHELL} +sleep 1 +sed <\$1 -e 's/^/x&/g' >${TESTDIR}/edit.new +mv ${TESTDIR}/edit.new \$1 +exit 0 +EOF + chmod +x ${TESTDIR}/editme + + mkdir 1; cd 1 + dotest editor-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest editor-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + touch file1 file2 + dotest editor-3 "${testcvs} add file1 file2" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + dotest editor-5 "${testcvs} -q tag -b br" "T file1 +T file2" + dotest editor-6 "${testcvs} -q update -r br" '' + echo modify >>file1 + dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + # OK, now we want to make sure "ci -r" puts in the branch + # where appropriate. Note that we can check in on the branch + # without being on the branch, because there is not a revision + # already on the branch. If there were a revision on the branch, + # CVS would correctly give an up-to-date check failed. + dotest editor-8 "${testcvs} -q update -A" "U file1" + echo add a line >>file2 + dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \ +"Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + + dotest editor-log-file1 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Committing in . +xCVS: +xCVS: Added Files: +xCVS: file1 file2 +xCVS: ---------------------------------------------------------------------- +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Committing in . +xCVS: +xCVS: Modified Files: +xCVS: Tag: br +xCVS: file1 +xCVS: ---------------------------------------------------------------------- +=============================================================================" + + # The only difference between the two expect strings is the + # presence or absence of "Committing in ." for 1.1.2.1. + dotest editor-log-file2 "${testcvs} log -N file2" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +Working file: file2 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Committing in . +xCVS: +xCVS: Added Files: +xCVS: file1 file2 +xCVS: ---------------------------------------------------------------------- +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Modified Files: +xCVS: Tag: br +xCVS: file2 +xCVS: ---------------------------------------------------------------------- +=============================================================================" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +Working file: file2 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Committing in . +xCVS: +xCVS: Added Files: +xCVS: file1 file2 +xCVS: ---------------------------------------------------------------------- +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +x +xCVS: ---------------------------------------------------------------------- +xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically +xCVS: +xCVS: Committing in . +xCVS: +xCVS: Modified Files: +xCVS: Tag: br +xCVS: file2 +xCVS: ---------------------------------------------------------------------- +=============================================================================" + cd ../.. + rm -r 1 + rm ${TESTDIR}/editme + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + errmsg1) mkdir ${CVSROOT_DIRNAME}/1dir mkdir 1 cd 1 if ${testcvs} -q co 1dir; then - echo 'PASS: test 162' >>${LOGFILE} + pass 162 else - echo 'FAIL: test 162' | tee -a ${LOGFILE} - exit 1 + fail 162 fi cd 1dir touch foo if ${testcvs} add foo 2>>${LOGFILE}; then - echo 'PASS: test 163' >>${LOGFILE} + pass 163 else - echo 'FAIL: test 163' | tee -a ${LOGFILE} - exit 1 + fail 163 fi if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then - echo 'PASS: test 164' >>${LOGFILE} + pass 164 else - echo 'FAIL: test 164' | tee -a ${LOGFILE} - exit 1 + fail 164 fi cd ../.. mkdir 2 cd 2 if ${testcvs} -q co 1dir >>${LOGFILE}; then - echo 'PASS: test 165' >>${LOGFILE} + pass 165 else - echo 'FAIL: test 165' | tee -a ${LOGFILE} - exit 1 + fail 165 fi chmod a-w 1dir cd ../1/1dir rm foo; if ${testcvs} rm foo >>${LOGFILE} 2>&1; then - echo 'PASS: test 166' >>${LOGFILE} + pass 166 else - echo 'FAIL: test 166' | tee -a ${LOGFILE} - exit 1 + fail 166 fi if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then - echo 'PASS: test 167' >>${LOGFILE} + pass 167 else - echo 'FAIL: test 167' | tee -a ${LOGFILE} - exit 1 + fail 167 fi cd ../../2/1dir - # FIXME: should be using dotest and PROG. + # FIXME: should be using dotest. ${testcvs} -q update 2>../tst167.err - CVSBASE=`basename $testcvs` # Get basename of CVS executable. + cat ../tst167.err >>${LOGFILE} cat <<EOF >../tst167.ans -$CVSBASE server: warning: foo is not (any longer) pertinent -$CVSBASE update: unable to remove ./foo: Permission denied +${PROG} server: warning: foo is not (any longer) pertinent +${PROG} update: unable to remove ./foo: Permission denied EOF if cmp ../tst167.ans ../tst167.err >/dev/null || - ( echo "$CVSBASE [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null ) + ( echo "${PROG} [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null ) then - echo 'PASS: test 168' >>${LOGFILE} + pass 168 else - echo 'FAIL: test 168' | tee -a ${LOGFILE} - exit 1 + fail 168 fi cd .. @@ -4600,47 +6105,166 @@ EOF rm -rf ${CVSROOT_DIRNAME}/1dir ;; + errmsg2) + # More tests of various miscellaneous error handling, + # and cvs add behavior in general. + # See also test basicb-4a, concerning "cvs ci CVS". + # Too many tests to mention test the simple cases of + # adding files and directories. + # Test basicb-2a10 tests cvs -n add. + + # First the usual setup; create a directory first-dir. + mkdir 1; cd 1 + dotest errmsg2-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest errmsg2-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + dotest_fail errmsg2-3 "${testcvs} add CVS" \ +"${PROG} [a-z]*: cannot add special file .CVS.; skipping" + touch file1 + # For the most part add returns a failure exitstatus if + # there are any errors, even if the remaining files are + # processed without incident. The "cannot add + # special file" message fits this pattern, at + # least currently. + dotest_fail errmsg2-4 "${testcvs} add CVS file1" \ +"${PROG} [a-z]*: cannot add special file .CVS.; skipping +${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + # I'm not sure these tests completely convey the various strange + # behaviors that CVS had before it specially checked for "." and + # "..". Suffice it to say that these are unlikely to work right + # without a special case. + dotest_fail errmsg2-5 "${testcvs} add ." \ +"${PROG} [a-z]*: cannot add special file .\..; skipping" + dotest_fail errmsg2-6 "${testcvs} add .." \ +"${PROG} [a-z]*: cannot add special file .\.\..; skipping" + # Make sure that none of the error messages left droppings + # which interfere with normal operation. + dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + mkdir sdir + cd .. + dotest errmsg2-8 "${testcvs} add first-dir/sdir" \ +"Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository" + + cd first-dir + + touch file10 + mkdir sdir10 + dotest errmsg2-10 "${testcvs} add file10 sdir10" \ +"${PROG} [a-z]*: scheduling file .file10. for addition +Directory ${TESTDIR}/cvsroot/first-dir/sdir10 added to the repository +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file10,v +done +Checking in file10; +${TESTDIR}/cvsroot/first-dir/file10,v <-- file10 +initial revision: 1\.1 +done" + # Try to see that there are no droppings left by + # any of the previous tests. + dotest errmsg2-12 "${testcvs} -q update" "" + + # Now test adding files with '/' in the name, both one level + # down and more than one level down. + cd .. + mkdir first-dir/sdir10/ssdir + dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \ +"Directory ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir added to the repository" + + touch first-dir/sdir10/ssdir/ssfile + dotest errmsg2-14 \ + "${testcvs} add first-dir/sdir10/ssdir/ssfile" \ +"${PROG} [a-z]*: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + touch first-dir/file15 + dotest errmsg2-15 "${testcvs} add first-dir/file15" \ +"${PROG} [a-z]*: scheduling file .first-dir/file15. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + + # Now the case where we try to give it a directory which is not + # under CVS control. + mkdir bogus-dir + touch bogus-dir/file16 + # The first message, from local CVS, is nice. The second one + # is not nice; would be good to fix remote CVS to give a clearer + # message (e.g. the one from local CVS). But at least it is an + # error message. + dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \ +"${PROG} [a-z]*: in directory bogus-dir: +${PROG} \[[a-z]* aborted\]: there is no version here; do .${PROG} checkout. first" \ +"${PROG} [a-z]*: cannot open CVS/Entries for reading: No such file or directory +${PROG} \[add aborted\]: no repository" + rm -r bogus-dir + + # One error condition we don't test for is trying to add a file + # or directory which already is there. + + dotest errmsg2-17 "${testcvs} -q ci -m checkin" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file15,v +done +Checking in first-dir/file15; +${TESTDIR}/cvsroot/first-dir/file15,v <-- file15 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v +done +Checking in first-dir/sdir10/ssdir/ssfile; +${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v <-- ssfile +initial revision: 1\.1 +done" + + cd .. + rm -r 1 + rm -rf ${TESTDIR}/cvsroot/first-dir + ;; + devcom) mkdir ${CVSROOT_DIRNAME}/first-dir mkdir 1 cd 1 if ${testcvs} -q co first-dir >>${LOGFILE} ; then - echo 'PASS: test 169' >>${LOGFILE} + pass 169 else - echo 'FAIL: test 169' | tee -a ${LOGFILE} - exit 1 + fail 169 fi cd first-dir echo abb >abb if ${testcvs} add abb 2>>${LOGFILE}; then - echo 'PASS: test 170' >>${LOGFILE} + pass 170 else - echo 'FAIL: test 170' | tee -a ${LOGFILE} - exit 1 + fail 170 fi if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then - echo 'PASS: test 171' >>${LOGFILE} + pass 171 else - echo 'FAIL: test 171' | tee -a ${LOGFILE} - exit 1 + fail 171 fi dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}" if ${testcvs} watch on; then - echo 'PASS: test 172' >>${LOGFILE} + pass 172 else - echo 'FAIL: test 172' | tee -a ${LOGFILE} + fail 172 fi echo abc >abc if ${testcvs} add abc 2>>${LOGFILE}; then - echo 'PASS: test 173' >>${LOGFILE} + pass 173 else - echo 'FAIL: test 173' | tee -a ${LOGFILE} + fail 173 fi if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then - echo 'PASS: test 174' >>${LOGFILE} + pass 174 else - echo 'FAIL: test 174' | tee -a ${LOGFILE} + fail 174 fi cd ../.. @@ -4648,119 +6272,117 @@ EOF cd 2 if ${testcvs} -q co first-dir >>${LOGFILE}; then - echo 'PASS: test 175' >>${LOGFILE} + pass 175 else - echo 'FAIL: test 175' | tee -a ${LOGFILE} + fail 175 fi cd first-dir if test -w abb; then - echo 'FAIL: test 176' | tee -a ${LOGFILE} + fail 176 else - echo 'PASS: test 176' >>${LOGFILE} + pass 176 fi if test -w abc; then - echo 'FAIL: test 177' | tee -a ${LOGFILE} + fail 177 else - echo 'PASS: test 177' >>${LOGFILE} + pass 177 fi if ${testcvs} editors >../ans178.tmp; then - echo 'PASS: test 178' >>${LOGFILE} + pass 178 else - echo 'FAIL: test 178' | tee -a ${LOGFILE} + fail 178 fi cat ../ans178.tmp >>${LOGFILE} if test -s ../ans178.tmp; then - echo 'FAIL: test 178a' | tee -a ${LOGFILE} + fail 178a else - echo 'PASS: test 178a' >>${LOGFILE} + pass 178a fi if ${testcvs} edit abb; then - echo 'PASS: test 179' >>${LOGFILE} + pass 179 else - echo 'FAIL: test 179' | tee -a ${LOGFILE} - exit 1 + fail 179 fi if ${testcvs} editors >../ans180.tmp; then - echo 'PASS: test 180' >>${LOGFILE} + pass 180 else - echo 'FAIL: test 180' | tee -a ${LOGFILE} - exit 1 + fail 180 fi cat ../ans180.tmp >>${LOGFILE} if test -s ../ans180.tmp; then - echo 'PASS: test 181' >>${LOGFILE} + pass 181 else - echo 'FAIL: test 181' | tee -a ${LOGFILE} + fail 181 fi echo aaaa >>abb if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then - echo 'PASS: test 182' >>${LOGFILE} + pass 182 else - echo 'FAIL: test 182' | tee -a ${LOGFILE} + fail 182 fi # Unedit of a file not being edited should be a noop. dotest 182.5 "${testcvs} unedit abb" '' if ${testcvs} editors >../ans183.tmp; then - echo 'PASS: test 183' >>${LOGFILE} + pass 183 else - echo 'FAIL: test 183' | tee -a ${LOGFILE} + fail 183 fi cat ../ans183.tmp >>${LOGFILE} if test -s ../ans183.tmp; then - echo 'FAIL: test 184' | tee -a ${LOGFILE} + fail 184 else - echo 'PASS: test 184' >>${LOGFILE} + pass 184 fi if test -w abb; then - echo 'FAIL: test 185' | tee -a ${LOGFILE} + fail 185 else - echo 'PASS: test 185' >>${LOGFILE} + pass 185 fi if ${testcvs} edit abc; then - echo 'PASS: test 186a1' >>${LOGFILE} + pass 186a1 else - echo 'FAIL: test 186a1' | tee -a ${LOGFILE} + fail 186a1 fi # Unedit of an unmodified file. if ${testcvs} unedit abc; then - echo 'PASS: test 186a2' >>${LOGFILE} + pass 186a2 else - echo 'FAIL: test 186a2' | tee -a ${LOGFILE} + fail 186a2 fi if ${testcvs} edit abc; then - echo 'PASS: test 186a3' >>${LOGFILE} + pass 186a3 else - echo 'FAIL: test 186a3' | tee -a ${LOGFILE} + fail 186a3 fi echo changedabc >abc # Try to unedit a modified file; cvs should ask for confirmation if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then - echo 'PASS: test 186a4' >>${LOGFILE} + pass 186a4 else - echo 'FAIL: test 186a4' | tee -a ${LOGFILE} + fail 186a4 fi if echo changedabc | cmp - abc; then - echo 'PASS: test 186a5' >>${LOGFILE} + pass 186a5 else - echo 'FAIL: test 186a5' | tee -a ${LOGFILE} + fail 186a5 fi # OK, now confirm the unedit if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then - echo 'PASS: test 186a6' >>${LOGFILE} + pass 186a6 else - echo 'FAIL: test 186a6' | tee -a ${LOGFILE} + fail 186a6 fi if echo abc | cmp - abc; then - echo 'PASS: test 186a7' >>${LOGFILE} + pass 186a7 else - echo 'FAIL: test 186a7' | tee -a ${LOGFILE} + fail 186a7 fi dotest devcom-a0 "${testcvs} watchers" '' @@ -4771,11 +6393,11 @@ EOF dotest devcom-a1 "${testcvs} watch add" '' dotest devcom-a2 "${testcvs} watchers" \ -'abb [a-z0-9]* edit unedit commit -abc [a-z0-9]* edit unedit commit' +"abb ${username} edit unedit commit +abc ${username} edit unedit commit" dotest devcom-a3 "${testcvs} watch remove -a unedit abb" '' dotest devcom-a4 "${testcvs} watchers abb" \ -'abb [a-z0-9]* edit commit' +"abb ${username} edit commit" # Check tagging and checking out while we have a CVS # directory in the repository. @@ -4798,6 +6420,29 @@ T abc' # Since first-dir/abb is readonly, use -f. rm -rf 3 + # Test checking out the directory rather than the file. + mkdir 3 + cd 3 + dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \ +'U first-dir/abb +U first-dir/abc' + cd .. + # Since the files are readonly, use -f. + rm -rf 3 + + # Now do it again, after removing the val-tags file created + # by devcom-t1 to force CVS to search the repository + # containing CVS directories. + rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags + mkdir 3 + cd 3 + dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \ +'U first-dir/abb +U first-dir/abc' + cd .. + # Since the files are readonly, use -f. + rm -rf 3 + # Now remove all the file attributes cd 2/first-dir dotest devcom-b0 "${testcvs} watch off" '' @@ -4872,6 +6517,26 @@ U first-dir/w3' dotest_fail devcom2-9 "test -w first-dir/w1" '' dotest_fail devcom2-10 "test -w first-dir/w2" '' dotest_fail devcom2-11 "test -w first-dir/w3" '' + + cd first-dir + # OK, now we want to try files in various states with cvs edit. + dotest devcom2-12 "${testcvs} edit w4" \ +"${PROG} edit: no such file w4; ignored" + # Try the same thing with a per-directory watch set. + dotest devcom2-13 "${testcvs} watch on" '' + dotest devcom2-14 "${testcvs} edit w5" \ +"${PROG} edit: no such file w5; ignored" + dotest devcom2-15 "${testcvs} editors" '' + dotest devcom2-16 "${testcvs} editors w4" '' + # Make sure there are no droppings lying around + dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \ +"Fw1 _watched= +Fw2 _watched= +Fw3 _watched= +Fnw1 _watched= +D _watched=" + cd .. + cd .. # Use -f because of the readonly files. @@ -4936,17 +6601,114 @@ G@#..!@#=&" rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + watch4) + # More watch tests, including adding directories. + mkdir 1; cd 1 + dotest watch4-0a "${testcvs} -q co -l ." '' + mkdir first-dir + dotest watch4-0b "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + + cd first-dir + dotest watch4-1 "${testcvs} watch on" '' + # This is just like the 173 test + touch file1 + dotest watch4-2 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest watch4-3 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + # Now test the analogous behavior for directories. + mkdir subdir + dotest watch4-4 "${testcvs} add subdir" \ +"Directory ${TESTDIR}/cvsroot/first-dir/subdir added to the repository" + cd subdir + touch sfile + dotest watch4-5 "${testcvs} add sfile" \ +"${PROG} [a-z]*: scheduling file .sfile. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest watch4-6 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v +done +Checking in sfile; +${TESTDIR}/cvsroot/first-dir/subdir/sfile,v <-- sfile +initial revision: 1\.1 +done" + cd ../../.. + mkdir 2; cd 2 + dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1 +U first-dir/subdir/sfile" + dotest_fail watch4-8 "test -w first-dir/file1" '' + dotest_fail watch4-9 "test -w first-dir/subdir/sfile" '' + cd first-dir + dotest watch4-10 "${testcvs} edit file1" '' + echo 'edited in 2' >file1 + cd ../.. + + cd 1/first-dir + dotest watch4-11 "${testcvs} edit file1" '' + echo 'edited in 1' >file1 + dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + cd ../.. + cd 2/first-dir + dotest watch4-13 "${testcvs} -q update" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.2 +Merging differences between 1\.1 and 1\.2 into file1 +rcsmerge: warning: conflicts during merge +${PROG} [a-z]*: conflicts found in file1 +C file1" + if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then + pass watch4-14 + else + fail watch4-15 + fi + # This could plausibly be defined to either go back to the revision + # which was cvs edit'd (the status quo), or back to revision 1.2 + # (that is, the merge could update CVS/Base/file1). We pick the + # former because it is easier to implement, not because we have + # thought much about which is better. + dotest watch4-16 "cat file1" '' + # Make sure CVS really thinks we are at 1.1. + dotest watch4-17 "${testcvs} -q update" "U file1" + dotest watch4-18 "cat file1" "edited in 1" + cd ../.. + + # As a sanity check, make sure we are in the right place. + dotest watch4-cleanup-1 "test -d 1" '' + dotest watch4-cleanup-1 "test -d 2" '' + # Specify -f because of the readonly files. + rm -rf 1 2 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + ignore) + # On Windows, we can't check out CVSROOT, because the case + # insensitivity means that this conflicts with cvsroot. + mkdir wnt + cd wnt + dotest 187a1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}" cd CVSROOT echo rootig.c >cvsignore dotest 187a2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition -'"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' # As of Jan 96, local CVS prints "Examining ." and remote doesn't. # Accept either. dotest 187a3 " ${testcvs} ci -m added" \ -"${DOTSTAR}CS file: ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v +"${PROG} [a-z]*: Examining \. +RCS file: ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v done Checking in cvsignore; ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v <-- cvsignore @@ -4956,10 +6718,9 @@ ${PROG} [a-z]*: Rebuilding administrative file database" cd .. if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then - echo 'PASS: test 187a4' >>${LOGFILE} + pass 187a4 else - echo 'FAIL: test 187a4' | tee -a ${LOGFILE} - exit 1 + fail 187a4 fi # CVS looks at the home dir from getpwuid, not HOME (is that correct @@ -4969,32 +6730,27 @@ ${PROG} [a-z]*: Rebuilding administrative file database" mkdir dir-to-import cd dir-to-import touch foobar.c bar.c rootig.c defig.o envig.c optig.c - # We really should allow the files to be listed in any order. - # But we (kludgily) just list the orders which have been observed. - dotest 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \ - 'N first-dir/foobar.c -N first-dir/bar.c -I first-dir/rootig.c -I first-dir/defig.o -I first-dir/envig.c -I first-dir/optig.c + # We use sort because we can't predict the order in which + # the files will be listed. + dotest_sort 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \ +' -No conflicts created by this import' 'I first-dir/defig.o +I first-dir/defig.o I first-dir/envig.c I first-dir/optig.c -N first-dir/foobar.c -N first-dir/bar.c I first-dir/rootig.c - +N first-dir/bar.c +N first-dir/foobar.c No conflicts created by this import' - dotest 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \ - 'N second-dir/foobar.c + dotest_sort 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \ +' + N second-dir/bar.c -N second-dir/rootig.c N second-dir/defig.o N second-dir/envig.c +N second-dir/foobar.c N second-dir/optig.c - +N second-dir/rootig.c No conflicts created by this import' cd .. rm -r dir-to-import @@ -5015,11 +6771,12 @@ U first-dir/foobar.c' dotest 189c "${testcvs} -q update -I optig.c" "${QUESTION} notig.c" # The fact that CVS requires us to specify -I CVS here strikes me # as a bug. - dotest 189d "${testcvs} -q update -I ! -I CVS" "${QUESTION} rootig.c -${QUESTION} defig.o + dotest_sort 189d "${testcvs} -q update -I ! -I CVS" \ +"${QUESTION} defig.o ${QUESTION} envig.c +${QUESTION} notig.c ${QUESTION} optig.c -${QUESTION} notig.c" +${QUESTION} rootig.c" # Now test that commands other than update also print "? notig.c" # where appropriate. Only test this for remote, because local @@ -5045,26 +6802,17 @@ ${QUESTION} notig.c" echo notig.c >first-dir/.cvsignore echo foobar.c >second-dir/.cvsignore touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c - dotest 190 "${testcvs} -qn update" \ + dotest_sort 190 "${testcvs} -qn update" \ "${QUESTION} first-dir/.cvsignore ${QUESTION} second-dir/.cvsignore -${QUESTION} second-dir/notig.c" \ +${QUESTION} second-dir/notig.c" + dotest_sort 191 "${testcvs} -qn update -I! -I CVS" \ "${QUESTION} first-dir/.cvsignore -${QUESTION} second-dir/notig.c -${QUESTION} second-dir/.cvsignore" - dotest 191 "${testcvs} -qn update -I! -I CVS" \ -"${QUESTION} first-dir/rootig.c ${QUESTION} first-dir/defig.o ${QUESTION} first-dir/envig.c -${QUESTION} first-dir/.cvsignore +${QUESTION} first-dir/rootig.c ${QUESTION} second-dir/.cvsignore -${QUESTION} second-dir/notig.c" \ -"${QUESTION} first-dir/rootig.c -${QUESTION} first-dir/defig.o -${QUESTION} first-dir/envig.c -${QUESTION} first-dir/.cvsignore -${QUESTION} second-dir/notig.c -${QUESTION} second-dir/.cvsignore" +${QUESTION} second-dir/notig.c" if echo yes | ${testcvs} release -d first-dir \ >${TESTDIR}/ignore.tmp; then @@ -5091,6 +6839,8 @@ You have \[1\] altered files in this repository. Are you sure you want to release (and delete) directory .second-dir': " cd .. rm -r 1 + cd .. + rm -r wnt rm ${TESTDIR}/ignore.tmp rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir ;; @@ -5107,7 +6857,7 @@ Are you sure you want to release (and delete) directory .second-dir': " cp ../binfile.dat binfile dotest binfiles-2 "${testcvs} add -kb binfile" \ "${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest binfiles-3 "${testcvs} -q ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v done @@ -5175,7 +6925,7 @@ done" echo 'edits in dir 2' >binfile dotest binfiles-con1 "${testcvs} -q update" \ "U binfile -${PROG} [a-z]*: binary file needs merge +${PROG} [a-z]*: nonmergeable file needs merge ${PROG} [a-z]*: revision 1\.3 from repository is now in binfile ${PROG} [a-z]*: file from working directory is now in \.#binfile\.1\.2 C binfile" @@ -5191,14 +6941,11 @@ done" cd ../../1/first-dir dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile' - # The bugs which these test for are apparently not fixed for remote. - if test "$remote" = no; then - dotest binfiles-9 "${testcvs} -q update -A" '' - dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile' - dotest binfiles-11 "${testcvs} -q update" '' - dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile' - dotest binfiles-13 "${testcvs} -q update -A" '' - fi + dotest binfiles-9 "${testcvs} -q update -A" '' + dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile' + dotest binfiles-11 "${testcvs} -q update" '' + dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile' + dotest binfiles-13 "${testcvs} -q update -A" '' cd ../.. rm -r 1 @@ -5270,7 +7017,7 @@ File: binfile Status: Up-to-date # Do sticky options work when used with 'cvs update'? echo "Not a binary file." > nibfile dotest binfiles-sticky1 "${testcvs} -q add nibfile" \ -"${PROG} [a-z]*: use "\''cvs commit'\'' to add this file permanently' +"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v done @@ -5289,7 +7036,53 @@ File: nibfile Status: Up-to-date Sticky Tag: (none) Sticky Date: (none) Sticky Options: -kb" - # Eventually we should test that -A removes the -kb here... + + # Now test that -A can clear the sticky option. + dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \ +"[UP] nibfile" + dotest binfiles-sticky6 "${testcvs} -q status nibfile" \ +"=================================================================== +File: nibfile Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/nibfile,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)" + dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v +done" + dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile" + dotest binfiles-17 "${testcvs} -q status nibfile" \ +"=================================================================== +File: nibfile Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/nibfile,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: -kb" + + dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v +deleting revision 1\.5 +deleting revision 1\.4 +done" + dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v +deleting revision 1\.2 +deleting revision 1\.1 +done" + dotest binfiles-o3 "${testcvs} -q log -h -N binfile" " +RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v +Working file: binfile +head: 1\.3 +branch: +locks: strict +access list: +keyword substitution: v +total revisions: 1 +=============================================================================" cd ../.. rm -rf ${CVSROOT_DIRNAME}/first-dir @@ -5302,45 +7095,177 @@ File: nibfile Status: Up-to-date # doesn't print "cannot merge binary files" or some such, in # situations where no merging is required. # See also "join" which does this with non-binary files. + # + # Cases (we are merging from the branch to the trunk): + # binfile.dat) File added on branch, not on trunk. + # File should be marked for addition. + # brmod) File modified on branch, not on trunk. + # File should be copied over to trunk (no merging is needed). + # brmod-trmod) File modified on branch, also on trunk. + # This is a conflict. Present the user with both files and + # let them figure it out. + # brmod-wdmod) File modified on branch, not modified in the trunk + # repository, but modified in the (trunk) working directory. + # This is also a conflict. mkdir ${CVSROOT_DIRNAME}/first-dir mkdir 1; cd 1 dotest binfiles2-1 "${testcvs} -q co first-dir" '' cd first-dir + + # The most important thing here is that binfile, binfile2, &c + # each be distinct from each other. We also make sure to include + # a few likely end-of-line patterns to make sure nothing is + # being munged as if in text mode. + awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \ + </dev/null >../binfile + cat ../binfile ../binfile >../binfile2 + cat ../binfile2 ../binfile >../binfile3 + # FIXCVS: unless a branch has at least one file on it, - # tag_check_valid won't know it exists. So creating a - # file here is a workaround. - touch dummy - dotest binfiles2-1a "${testcvs} add dummy" \ -"${PROG} [a-z]*: scheduling file .dummy. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" - dotest binfiles2-1b "${testcvs} -q ci -m add-it" \ -"RCS file: ${TESTDIR}/cvsroot/first-dir/dummy,v -done -Checking in dummy; -${TESTDIR}/cvsroot/first-dir/dummy,v <-- dummy + # tag_check_valid won't know it exists. So if brmod didn't + # exist, we would have to invent it. + cp ../binfile brmod + cp ../binfile brmod-trmod + cp ../binfile brmod-wdmod + dotest binfiles2-1a \ +"${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \ +"${PROG} [a-z]*: scheduling file .brmod. for addition +${PROG} [a-z]*: scheduling file .brmod-trmod. for addition +${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest binfiles2-1b "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v +done +Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod initial revision: 1\.1 done" - dotest binfiles2-2 "${testcvs} -q tag -b br" 'T dummy' + dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod +T brmod-trmod +T brmod-wdmod' dotest binfiles2-3 "${testcvs} -q update -r br" '' - awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \ - </dev/null >../binfile cp ../binfile binfile.dat dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \ "${PROG} [a-z]*: scheduling file .binfile\.dat. for addition on branch .br. -${PROG} [a-z]*: use .cvs commit. to add this file permanently" - dotest binfiles2-5 "${testcvs} -q ci -m add-it" \ +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + cp ../binfile2 brmod + cp ../binfile2 brmod-trmod + cp ../binfile2 brmod-wdmod + dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v done Checking in binfile\.dat; ${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v <-- binfile\.dat new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 done" dotest binfiles2-6 "${testcvs} -q update -A" \ -"${PROG} [a-z]*: warning: binfile\.dat is not (any longer) pertinent" +"${PROG} [a-z]*: warning: binfile\.dat is not (any longer) pertinent +[UP] brmod +[UP] brmod-trmod +[UP] brmod-wdmod" dotest_fail binfiles2-7 "test -f binfile.dat" '' - dotest binfiles2-8 "${testcvs} -q update -j br" "U binfile.dat" + dotest binfiles2-7-brmod "cmp ../binfile brmod" + cp ../binfile3 brmod-trmod + dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \ +"Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.2; previous revision: 1\.1 +done" + cp ../binfile3 brmod-wdmod + + dotest binfiles2-8 "${testcvs} -q update -j br" \ +"U binfile\.dat +U brmod +${PROG} [a-z]*: nonmergeable file needs merge +${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod +${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2 +C brmod-trmod +M brmod-wdmod +${PROG} [a-z]*: nonmergeable file needs merge +${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod +${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1 +C brmod-wdmod" + dotest binfiles2-9 "cmp ../binfile binfile.dat" + dotest binfiles2-9-brmod "cmp ../binfile2 brmod" + dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod" + dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod" + dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2" + dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1" + + # Test that everything was properly scheduled. + dotest binfiles2-10 "${testcvs} -q ci -m checkin" \ +"Checking in binfile\.dat; +${TESTDIR}/cvsroot/first-dir/binfile\.dat,v <-- binfile\.dat +new revision: 1\.2; previous revision: 1\.1 +done +Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +new revision: 1\.2; previous revision: 1\.1 +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.3; previous revision: 1\.2 +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod +new revision: 1\.2; previous revision: 1\.1 +done" + + dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +deleting revision 1\.2 +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v: can't remove branch point 1\.1 +${PROG} [a-z]*: cannot modify RCS file for .brmod-trmod." + dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +deleting revision 1\.1\.2\.1 +done" + dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +deleting revision 1\.2 +deleting revision 1\.1 +done" + dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" " +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +Working file: brmod-trmod +head: 1\.3 +branch: +locks: strict +access list: +keyword substitution: b +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.3 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +checkin +=============================================================================" cd .. cd .. @@ -5348,10 +7273,164 @@ done" rm -r 1 ;; + mcopy) + # See comment at "mwrap" test for list of other wrappers tests. + # Test cvs's ability to handle nonmergeable files specified with + # -m 'COPY' in wrappers. Similar to the binfiles2 test, + # which tests the same thing for binary files + # (which are non-mergeable in the same sense). + # + # Cases (we are merging from the branch to the trunk): + # brmod) File modified on branch, not on trunk. + # File should be copied over to trunk (no merging is needed). + # brmod-trmod) File modified on branch, also on trunk. + # This is a conflict. Present the user with both files and + # let them figure it out. + # brmod-wdmod) File modified on branch, not modified in the trunk + # repository, but modified in the (trunk) working directory. + # This is also a conflict. + + # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS + # (see wrap_send). So skip these tests for remote. + if test "x$remote" = xno; then + + mkdir ${CVSROOT_DIRNAME}/first-dir + mkdir 1; cd 1 + dotest mcopy-1 "${testcvs} -q co first-dir" '' + cd first-dir + + # FIXCVS: unless a branch has at least one file on it, + # tag_check_valid won't know it exists. So if brmod didn't + # exist, we would have to invent it. + echo 'brmod initial contents' >brmod + echo 'brmod-trmod initial contents' >brmod-trmod + echo 'brmod-wdmod initial contents' >brmod-wdmod + echo "* -m 'COPY'" >.cvswrappers + dotest mcopy-1a \ +"${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \ +"${PROG} [a-z]*: scheduling file .\.cvswrappers. for addition +${PROG} [a-z]*: scheduling file .brmod. for addition +${PROG} [a-z]*: scheduling file .brmod-trmod. for addition +${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest mcopy-1b "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v +done +Checking in \.cvswrappers; +${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v <-- \.cvswrappers +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v +done +Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod +initial revision: 1\.1 +done" + + # NOTE: .cvswrappers files are broken (see comment in + # src/wrapper.c). So doing everything via the environment + # variable is a workaround. Better would be to test them + # both. + CVSWRAPPERS="* -m 'COPY'" + export CVSWRAPPERS + dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers +T brmod +T brmod-trmod +T brmod-wdmod' + dotest mcopy-3 "${testcvs} -q update -r br" '' + echo 'modify brmod on br' >brmod + echo 'modify brmod-trmod on br' >brmod-trmod + echo 'modify brmod-wdmod on br' >brmod-wdmod + dotest mcopy-5 "${testcvs} -q ci -m br-changes" \ +"Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + dotest mcopy-6 "${testcvs} -q update -A" \ +"[UP] brmod +[UP] brmod-trmod +[UP] brmod-wdmod" + dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \ +"brmod initial contents +brmod-trmod initial contents +brmod-wdmod initial contents" + + echo 'modify brmod-trmod again on trunk' >brmod-trmod + dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \ +"Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.2; previous revision: 1\.1 +done" + echo 'modify brmod-wdmod in working dir' >brmod-wdmod + + dotest mcopy-8 "${testcvs} -q update -j br" \ +"U brmod +${PROG} [a-z]*: nonmergeable file needs merge +${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod +${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2 +C brmod-trmod +M brmod-wdmod +${PROG} [a-z]*: nonmergeable file needs merge +${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod +${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1 +C brmod-wdmod" + + dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \ +"modify brmod on br +modify brmod-trmod on br +modify brmod-wdmod on br" + dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \ +"modify brmod-trmod again on trunk +modify brmod-wdmod in working dir" + + # Test that everything was properly scheduled. + dotest mcopy-10 "${testcvs} -q ci -m checkin" \ +"Checking in brmod; +${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod +new revision: 1\.2; previous revision: 1\.1 +done +Checking in brmod-trmod; +${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod +new revision: 1\.3; previous revision: 1\.2 +done +Checking in brmod-wdmod; +${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod +new revision: 1\.2; previous revision: 1\.1 +done" + cd .. + cd .. + + rm -rf ${CVSROOT_DIRNAME}/first-dir + rm -r 1 + unset CVSWRAPPERS + + fi # end of tests to be skipped for remote + + ;; + binwrap) # Test the ability to specify binary-ness based on file name. - # We could also be testing the ability to use the other - # ways to specify a wrapper (CVSROOT/cvswrappers, etc.). + # See "mwrap" for a list of other wrappers tests. mkdir dir-to-import cd dir-to-import @@ -5394,9 +7473,311 @@ File: foo\.exe Status: Up-to-date rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + binwrap2) + # Test the ability to specify binary-ness based on file name. + # See "mwrap" for a list of other wrappers tests. + + mkdir dir-to-import + cd dir-to-import + touch foo.c foo.exe + + # Specify that all files are binary except *.c. + # The order seems to matter, with the earlier rules taking + # precedence. I'm not sure whether that is good or not, + # but it is the current behavior. + if ${testcvs} import -m message -I ! \ + -W "*.c -k 'o'" -W "* -k 'b'" \ + first-dir tag1 tag2 >>${LOGFILE}; then + pass binwrap2-1 + else + fail binwrap2-1 + fi + cd .. + rm -r dir-to-import + dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c +U first-dir/foo.exe' + dotest binwrap2-3 "${testcvs} -q status first-dir" \ +"=================================================================== +File: foo\.c Status: Up-to-date + + Working revision: 1\.1\.1\.1.* + Repository revision: 1\.1\.1\.1 ${TESTDIR}/cvsroot/first-dir/foo\.c,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: -ko + +=================================================================== +File: foo\.exe Status: Up-to-date + + Working revision: 1\.1\.1\.1.* + Repository revision: 1\.1\.1\.1 ${TESTDIR}/cvsroot/first-dir/foo\.exe,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: -kb" + rm -r first-dir + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + binwrap3) + # Test communication of file-specified -k wrappers between + # client and server, in `import': + # + # 1. Set up a directory tree, populate it with files. + # 2. Give each directory a different .cvswrappers file. + # 3. Give the server its own .cvswrappers file. + # 4. Import the whole tree, see if the right files got set + # to binary. + # + # The tree has a top ("0th") level, and two subdirs, sub1/ + # and sub2/; sub2/ contains directory subsub/. Every + # directory has a .cvswrappers file as well as regular + # files. + # + # In the file names, "foo-b.*" should end up binary, and + # "foo-t.*" should end up text. Don't worry about the two + # letter extensions; they're just there to help me keep + # things straight. + # + # Here's the directory tree: + # + # ./ + # .cvswrappers + # foo-b.c0 + # foo-b.sb + # foo-t.c1 + # foo-t.st + # + # sub1/ sub2/ + # .cvswrappers .cvswrappers + # foo-b.c1 foo-b.sb + # foo-b.sb foo-b.st + # foo-t.c0 foo-t.c0 + # foo-t.st foo-t.c1 + # foo-t.c2 + # foo-t.c3 + # + # subsub/ + # .cvswrappers + # foo-b.c3 + # foo-b.sb + # foo-t.c0 + # foo-t.c1 + # foo-t.c2 + # foo-t.st + + binwrap3_line1="This is a test file " + binwrap3_line2="containing little of use " + binwrap3_line3="except this non-haiku" + + binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}" + + cd ${TESTDIR} + + # On Windows, we can't check out CVSROOT, because the case + # insensitivity means that this conflicts with cvsroot. + mkdir wnt + cd wnt + + mkdir binwrap3 # the 0th dir + mkdir binwrap3/sub1 + mkdir binwrap3/sub2 + mkdir binwrap3/sub2/subsub + + echo "*.c0 -k 'b'" > binwrap3/.cvswrappers + echo "whatever -k 'b'" >> binwrap3/.cvswrappers + echo ${binwrap3_text} > binwrap3/foo-b.c0 + echo ${binwrap3_text} > binwrap3/foo-b.sb + echo ${binwrap3_text} > binwrap3/foo-t.c1 + echo ${binwrap3_text} > binwrap3/foo-t.st + + echo "*.c1 -k 'b'" > binwrap3/sub1/.cvswrappers + echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers + echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1 + echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb + echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0 + echo ${binwrap3_text} > binwrap3/sub1/foo-t.st + + echo "*.st -k 'b'" > binwrap3/sub2/.cvswrappers + echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb + echo ${binwrap3_text} > binwrap3/sub2/foo-b.st + echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0 + echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1 + echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2 + echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3 + + echo "*.c3 -k 'b'" > binwrap3/sub2/subsub/.cvswrappers + echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers + echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3 + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0 + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1 + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2 + echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st + + # Now set up CVSROOT/cvswrappers, the easy way: + dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}" + cd CVSROOT + # This destroys anything currently in cvswrappers, but + # presumably other tests will take care of it themselves if + # they use cvswrappers: + echo "foo*.sb -k 'b'" > cvswrappers + dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \ +"Checking in cvswrappers; +${TESTDIR}/cvsroot/CVSROOT/cvswrappers,v <-- cvswrappers +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd .. + + # Avoid environmental interference + CVSWRAPPERS_SAVED=${CVSWRAPPERS} + unset CVSWRAPPERS + + # Do the import + cd binwrap3 + # Not importing .cvswrappers tests whether the client is really + # letting the server know "honestly" whether the file is binary, + # rather than just letting the server see the .cvswrappers file. + dotest binwrap3-2a \ +"${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \ +"[NI] ${DOTSTAR}" + + # OK, now test "cvs add". + cd .. + rm -r binwrap3 + dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}" + cd binwrap3 + cd sub2 + echo "*.newbin -k 'b'" > .cvswrappers + echo .cvswrappers >.cvsignore + echo .cvsignore >>.cvsignore + touch file1.newbin file1.txt + dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \ +"${PROG} [a-z]*: scheduling file .file1\.newbin. for addition +${PROG} [a-z]*: scheduling file .file1\.txt. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest binwrap3-2d "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v +done +Checking in file1\.newbin; +${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v <-- file1\.newbin +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v +done +Checking in file1\.txt; +${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v <-- file1\.txt +initial revision: 1\.1 +done" + cd .. + + # Now check out the module and see which files are binary. + cd .. + rm -r binwrap3 + dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}" + cd binwrap3 + + # Running "cvs status" and matching output is too + # error-prone, too likely to falsely fail. Instead, we'll + # just grep the Entries lines: + + dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \ + "/foo-b.c0/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \ + "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \ + "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \ + "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \ + "/foo-b.c1/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \ + "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \ + "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \ + "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \ + "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \ + "/foo-b.st/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \ + "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \ + "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \ + "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \ + "/foo-t.c3/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \ + "/foo-b.c3/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \ + "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/" + + dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \ + "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \ + "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \ + "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \ + "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//" + + dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \ + "/file1.newbin/1.1/[A-Za-z0-9 :]*/-kb/" + dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \ + "/file1.txt/1.1/[A-Za-z0-9 :]*//" + + # Restore and clean up + cd .. + rm -r binwrap3 CVSROOT + cd .. + rm -r wnt + rm -rf ${CVSROOT_DIRNAME}/binwrap3 + CVSWRAPPERS=${CVSWRAPPERS_SAVED} + ;; + mwrap) - # Tests relating to the -m wrappers options. -k tests are in - # binwrap and -t/-f tests haven't been written yet. + # Tests of various wrappers features: + # -m 'COPY' and cvs update: mwrap + # -m 'COPY' and joining: mcopy + # -k: binwrap, binwrap2 + # -t/-f: hasn't been written yet. + # + # Tests of different ways of specifying wrappers: + # CVSROOT/cvswrappers: mwrap + # -W: binwrap, binwrap2 + # .cvswrappers in working directory, local: mcopy + # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3 + # CVSWRAPPERS environment variable: mcopy + + # This test is similar to binfiles-con1; -m 'COPY' specifies + # non-mergeableness the same way that -kb does. + + # On Windows, we can't check out CVSROOT, because the case + # insensitivity means that this conflicts with cvsroot. + mkdir wnt + cd wnt + dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}" cd CVSROOT echo "* -m 'COPY'" >>cvswrappers @@ -5416,7 +7797,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database" touch aa dotest mwrap-3 "${testcvs} add aa" \ "${PROG} [a-z]*: scheduling file .aa. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest mwrap-4 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v done @@ -5438,14 +7819,14 @@ done" cd m1/first-dir echo "changed in m1" >aa dotest_fail mwrap-7 "${testcvs} -nq update" "C aa" - dotest_fail mwrap-8 "${testcvs} -q update" \ -"${PROG} [a-z]*: A -m .COPY. wrapper is specified -${PROG} [a-z]*: but file aa needs merge -${PROG} \[[a-z]* aborted\]: You probably want to avoid -m .COPY. wrappers" - # Under the old, dangerous behavior, this would have been - # "changed in m2" -- that is, the changes in the working directory - # would have been clobbered (!). - dotest mwrap-9 "cat aa" "changed in m1" + dotest mwrap-8 "${testcvs} -q update" \ +"U aa +${PROG} [a-z]*: nonmergeable file needs merge +${PROG} [a-z]*: revision 1\.2 from repository is now in aa +${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1 +C aa" + dotest mwrap-9 "cat aa" "changed in m2" + dotest mwrap-10 "cat .#aa.1.1" "changed in m1" cd ../.. cd CVSROOT echo '# comment out' >cvswrappers @@ -5458,11 +7839,26 @@ ${PROG} [a-z]*: Rebuilding administrative file database" cd .. rm -r CVSROOT rm -r m1 m2 + cd .. + rm -r wnt rm -rf ${CVSROOT_DIRNAME}/first-dir ;; info) - # Test CVS's ability to handle *info files. + # Administrative file tests. + # Here is a list of where each administrative file is tested: + # loginfo: info + # modules: modules, modules2, modules3 + # cvsignore: ignore + # verifymsg: info + # cvswrappers: mwrap + # config: config + + # On Windows, we can't check out CVSROOT, because the case + # insensitivity means that this conflicts with cvsroot. + mkdir wnt + cd wnt + dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}" cd CVSROOT echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo @@ -5478,7 +7874,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database" # with "cvs init". : dotest info-2 "${testcvs} add loginfo" \ "${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition -'"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest info-3 "${testcvs} -q ci -m new-loginfo" \ "Checking in loginfo; @@ -5494,7 +7890,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database" touch file1 dotest info-6 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -5511,7 +7907,7 @@ ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 new revision: 1\.2; previous revision: 1\.1 done" cd .. - dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=[a-z0-9@][a-z0-9@]*=${TESTDIR}/cvsroot=" + dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${TESTDIR}/cvsroot=" dotest info-10 "cat $TESTDIR/testlog2" 'first-dir file1,NONE,1.1 first-dir 1.1 first-dir file1 @@ -5534,7 +7930,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database" # Now test verifymsg cat >${TESTDIR}/vscript <<EOF -#!/bin/sh +#!${TESTSHELL} if head -1 < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then exit 0 else @@ -5598,12 +7994,58 @@ ${PROG} [a-z]*: Rebuilding administrative file database" else fail info-cleanup-2 fi + cd .. + rm -r wnt rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + config) + # Tests of the CVSROOT/config file. See the comment at the + # "info" tests for a full list of administrative file tests. + + # On Windows, we can't check out CVSROOT, because the case + # insensitivity means that this conflicts with cvsroot. + mkdir wnt + cd wnt + + dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}" + cd CVSROOT + echo 'bogus line' >config + dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \ +"Checking in config; +${TESTDIR}/cvsroot/CVSROOT/config,v <-- config +new revision: 1\.2; previous revision: 1\.1 +done +${PROG} [a-z]*: Rebuilding administrative file database" + echo 'BogusOption=yes' >config + dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \ +"${PROG} [a-z]*: syntax error in ${TESTDIR}/cvsroot/CVSROOT/config: line 'bogus line' is missing '=' +Checking in config; +${TESTDIR}/cvsroot/CVSROOT/config,v <-- config +new revision: 1\.3; previous revision: 1\.2 +done +${PROG} [a-z]*: Rebuilding administrative file database" + echo '# No config is a good config' > config + dotest config-5 "${testcvs} -q ci -m change-to-comment" \ +"${PROG} [a-z]*: ${TESTDIR}/cvsroot/CVSROOT/config: unrecognized keyword 'BogusOption' +Checking in config; +${TESTDIR}/cvsroot/CVSROOT/config,v <-- config +new revision: 1\.4; previous revision: 1\.3 +done +${PROG} [a-z]*: Rebuilding administrative file database" + dotest config-6 "${testcvs} -q update" '' + + cd .. + rm -r CVSROOT + cd .. + rm -r wnt + ;; + serverpatch) # Test remote CVS handling of unpatchable files. This isn't # much of a test for local CVS. + # We test this with some keyword expansion games, but the situation + # also arises if the user modifies the file while CVS is running. mkdir ${CVSROOT_DIRNAME}/first-dir mkdir 1 cd 1 @@ -5616,7 +8058,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database" echo '1' >> file1 dotest serverpatch-2 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest serverpatch-3 "${testcvs} -q commit -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v @@ -5667,10 +8109,14 @@ U file1' log) # Test selecting revisions with cvs log. # See also log2 tests for more tests. - # See also rcs tests, for -d option to log. # See also branches-14.3 for logging with a branch off of a branch. # See also multibranch-14 for logging with several branches off the # same branchpoint. + # Tests of each option to cvs log: + # -h: admin-19a-log + # -N: log, log2, admin-19a-log + # -b, -r: log + # -d: rcs # Check in a file with a few revisions and branches. mkdir ${CVSROOT_DIRNAME}/first-dir @@ -5679,15 +8125,23 @@ U file1' echo 'first revision' > file1 dotest log-2 "${testcvs} add file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' - - dotest log-3 "${testcvs} -q commit -m 1" \ +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' + + # While we're at it, check multi-line comments, input from file, + # and trailing whitespace trimming + echo 'line 1 ' >${TESTDIR}/comment.tmp + echo ' ' >>${TESTDIR}/comment.tmp + echo 'line 2 ' >>${TESTDIR}/comment.tmp + echo ' ' >>${TESTDIR}/comment.tmp + echo ' ' >>${TESTDIR}/comment.tmp + dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done Checking in file1; ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 initial revision: 1\.1 done" + rm -f ${TESTDIR}/comment.tmp echo 'second revision' > file1 dotest log-4 "${testcvs} -q ci -m2 file1" \ @@ -5742,7 +8196,9 @@ revision' log_lines=" lines: ${PLUS}1 -1" log_rev1="${log_dash} 1\.1 ${log_date} -1" +line 1 + +line 2" log_rev2="${log_dash} 1\.2 ${log_date}${log_lines} branches: 1\.2\.2; @@ -5886,6 +8342,29 @@ ${log_rev2} ${log_rev1} ${log_trailer}" + dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +deleting revision 1\.2\.2\.2 +done" + dotest log-o3 "${testcvs} log file1" \ +"${log_header} +${log_tags} +${log_header2} +total revisions: 4; selected revisions: 4 +description: +${log_rev3} +${log_rev2} +${log_rev1} +${log_rev1b} +${log_trailer}" + dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \ +"first branch revision" cd .. rm -r first-dir rm -rf ${CVSROOT_DIRNAME}/first-dir @@ -5894,10 +8373,6 @@ ${log_trailer}" log2) # More "cvs log" tests, for example the file description. - # Setting the file description doesn't yet work client/server, so - # skip these tests for remote. - if test "x$remote" = xno; then - # Check in a file mkdir ${CVSROOT_DIRNAME}/first-dir dotest log2-1 "${testcvs} -q co first-dir" '' @@ -5905,7 +8380,7 @@ ${log_trailer}" echo 'first revision' > file1 dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \ "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition -'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently' +'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently' dotest log2-3 "${testcvs} -q commit -m 1" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -5913,6 +8388,10 @@ Checking in file1; ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 initial revision: 1\.1 done" + # Setting the file description with add -m doesn't yet work + # client/server, so skip log2-4 for remote. + if test "x$remote" = xno; then + dotest log2-4 "${testcvs} log -N file1" " RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v Working file: file1 @@ -5930,13 +8409,204 @@ date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; 1 =============================================================================" + fi # end of tests skipped for remote + + dotest log2-5 "${testcvs} admin -t-change-description file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest log2-6 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +change-description +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +1 +=============================================================================" + + # I believe that in Real Life (TM), this is broken for remote. + # That is, the filename in question must be the filename of a + # file on the server. It only happens to work here because the + # client machine and the server machine are one and the same. + echo 'longer description' >${TESTDIR}/descrip + echo 'with two lines' >>${TESTDIR}/descrip + dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest log2-8 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +longer description +with two lines +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +1 +=============================================================================" + + # Reading the description from stdin is broken for remote. + # See comments in cvs.texinfo for a few more notes on this. + if test "x$remote" = xno; then + + if echo change from stdin | ${testcvs} admin -t -q file1 + then + pass log2-9 + else + fail log2-9 + fi + dotest log2-10 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +change from stdin +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +1 +=============================================================================" + + fi # end of tests skipped for remote + cd .. + rm ${TESTDIR}/descrip rm -r first-dir rm -rf ${CVSROOT_DIRNAME}/first-dir - fi # end of tests skipped for remote + ;; + + ann) + # Tests of "cvs annotate". See also basica-10. + mkdir 1; cd 1 + dotest ann-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest ann-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + cat >file1 <<EOF +this +is +the +ancestral +file +EOF + dotest ann-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest ann-4 "${testcvs} -q ci -m add file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + cat >file1 <<EOF +this +is +a +file + +with +a +blank +line +EOF + dotest ann-5 "${testcvs} -q ci -m modify file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + dotest ann-6 "${testcvs} -q tag -b br" "T file1" + cat >file1 <<EOF +this +is +a +trunk file + +with +a +blank +line +EOF + dotest ann-7 "${testcvs} -q ci -m modify file1" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.3; previous revision: 1\.2 +done" + dotest ann-8 "${testcvs} -q update -r br" "[UP] file1" + cat >file1 <<EOF +this +is +a +file + +with +a +blank +line +and some +branched content +EOF + dotest ann-9 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2\.2\.1; previous revision: 1\.2 +done" + # Note that this annotates the trunk despite the presence + # of a sticky tag in the current directory. This is + # fairly bogus, but it is the longstanding behavior for + # whatever that is worth. + dotest ann-10 "${testcvs} ann" \ +"Annotations for file1 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +1\.1 (${username} *[0-9a-zA-Z-]*): this +1\.1 (${username} *[0-9a-zA-Z-]*): is +1\.2 (${username} *[0-9a-zA-Z-]*): a +1\.3 (${username} *[0-9a-zA-Z-]*): trunk file +1\.2 (${username} *[0-9a-zA-Z-]*): +1\.2 (${username} *[0-9a-zA-Z-]*): with +1\.2 (${username} *[0-9a-zA-Z-]*): a +1\.2 (${username} *[0-9a-zA-Z-]*): blank +1\.2 (${username} *[0-9a-zA-Z-]*): line" + dotest ann-11 "${testcvs} ann -r br" \ +"Annotations for file1 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +1\.1 (${username} *[0-9a-zA-Z-]*): this +1\.1 (${username} *[0-9a-zA-Z-]*): is +1\.2 (${username} *[0-9a-zA-Z-]*): a +1\.1 (${username} *[0-9a-zA-Z-]*): file +1\.2 (${username} *[0-9a-zA-Z-]*): +1\.2 (${username} *[0-9a-zA-Z-]*): with +1\.2 (${username} *[0-9a-zA-Z-]*): a +1\.2 (${username} *[0-9a-zA-Z-]*): blank +1\.2 (${username} *[0-9a-zA-Z-]*): line +1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some +1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content" + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + crerepos) # Various tests relating to creating repositories, operating # on repositories created with old versions of CVS, etc. @@ -5983,12 +8653,17 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then # The directory tmp should be empty dotest crerepos-6 "rmdir tmp" '' + CREREPOS_ROOT=${TESTDIR}/crerepos + else # For remote, just create the repository. We don't yet do # the various other tests above for remote but that should be # changed. mkdir crerepos mkdir crerepos/CVSROOT + + CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos + fi if test "x$remote" = "xno"; then @@ -6027,6 +8702,82 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then dotest_fail crerepos-7 \ "test -f ${TESTDIR}/crerepos/CVSROOT/history" '' + # Now test mixing repositories. This kind of thing tends to + # happen accidentally when people work with several repositories. + mkdir 1; cd 1 + dotest crerepos-8 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest crerepos-9 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + touch file1 + dotest crerepos-10 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest crerepos-11 "${testcvs} -q ci -m add-it" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + cd ../.. + rm -r 1 + + mkdir 1; cd 1 + dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." '' + mkdir crerepos-dir + dotest crerepos-13 "${testcvs} add crerepos-dir" \ +"Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository" + cd crerepos-dir + touch cfile + dotest crerepos-14 "${testcvs} add cfile" \ +"${PROG} [a-z]*: scheduling file .cfile. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest crerepos-15 "${testcvs} -q ci -m add-it" \ +"RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v +done +Checking in cfile; +${TESTDIR}/crerepos/crerepos-dir/cfile,v <-- cfile +initial revision: 1\.1 +done" + cd ../.. + rm -r 1 + + mkdir 1; cd 1 + dotest crerepos-16 "${testcvs} co first-dir" \ +"${PROG} [a-z]*: Updating first-dir +U first-dir/file1" + dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \ +"${PROG} [a-z]*: Updating crerepos-dir +U crerepos-dir/cfile" + + if test x`cat CVS/Repository` = x.; then + # RELATIVE_REPOS + # Fatal error so that we don't go traipsing through the + # directories which happen to have the same names from the + # wrong repository. + dotest_fail crerepos-18 "${testcvs} -q update" \ +"${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/crerepos-dir: .*" '' + else + if test "$remote" = no; then + # The lack of an error doesn't mean CVS is really + # working (things are getting logged to the wrong + # history file and such). + dotest crerepos-18 "${testcvs} -q update" '' + else + # Fatal error so that we don't go traipsing through the + # directories which happen to have the same names from the + # wrong repository. + dotest_fail crerepos-18 "${testcvs} -q update" \ +"protocol error: directory .${TESTDIR}/crerepos/crerepos-dir. not within root .${TESTDIR}/cvsroot." + fi + fi + + cd .. + + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos ;; rcs) @@ -6035,20 +8786,27 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then # implements this format, will be out there "forever" and # CVS must always be able to import such files. - # TODO: would be nice to have a corresponding test for exporting - # RCS files. Rather than try to write a rigorous check for whether - # the file CVS exports is legal, we could just write a simpler test - # for what CVS actually exports, and revise the check as needed. + # See tests admin-13, admin-25 and rcs-8a for exporting RCS files. mkdir ${CVSROOT_DIRNAME}/first-dir # Currently the way to import an RCS file is to copy it # directly into the repository. + # # This file was written by RCS 5.7, and then the dates were # hacked so that we test year 2000 stuff. Note also that # "author" names are just strings, as far as importing # RCS files is concerned--they need not correspond to user # IDs on any particular system. + # + # I also tried writing a file with the RCS supplied with + # HPUX A.09.05. According to "man rcsintro" this is + # "Revision Number: 3.0; Release Date: 83/05/11". There + # were a few minor differences like whitespace but at least + # in simple cases like this everything else seemed the same + # as the file written by RCS 5.7 (so I won't try to make it + # a separate test case). + cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v head 1.3; access; @@ -6200,6 +8958,243 @@ add file1 else fail rcs-4 fi + + # OK, here is another one. This one was written by hand based on + # doc/RCSFILES and friends. + cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v +head 1.5 ; + branch 1.2.6; +access ; +symbols; +locks; +testofanewphrase @without newphrase we'd have trouble extending @@ all@ ; +1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4; +1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3; +1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2; +1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1; +1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph; +1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next; +desc @@ +1.5 log @@ newphrase1; newphrase2 42; text @head revision@ +1.4 log @@ text @d1 1 +a1 1 +new year revision@ +1.3 log @@ text @d1 1 +a1 1 +old year revision@ +1.2 log @@ text @d1 1 +a1 1 +mid revision@ 1.1 + +log @@ text @d1 1 +a1 1 +start revision@ +1.2.6.1 log @@ text @d1 1 +a1 1 +branch revision@ +EOF + # First test the default branch. + dotest rcs-5 "${testcvs} -q update file2" "U file2" + dotest rcs-6 "cat file2" "branch revision" + + # Now get rid of the default branch, it will get in the way. + dotest rcs-7 "${testcvs} admin -b file2" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done" + # But we do want to make sure that "cvs admin" leaves the newphrases + # in the file. + # The extra whitespace regexps are for the RCS library, which does + # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp + dotest rcs-8 \ +"grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \ +"testofanewphrase[ ][ ]*@without newphrase we'd have trouble extending @@ all@[ ]*;" + # The easiest way to test for newphrases in deltas and deltatexts + # is to just look at the whole file, I guess. + dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \ +"head 1\.5; +access; +symbols; +locks; + +testofanewphrase @without newphrase we'd have trouble extending @@ all@; + +1\.5 +date 71\.01\.01\.01\.00\.00; author joe; state bogus; +branches; +next 1\.4; + +1\.4 +date 71\.01\.01\.00\.00\.05; author joe; state bogus; +branches; +next 1\.3; + +1\.3 +date 70\.12\.31\.15\.00\.05; author joe; state bogus; +branches; +next 1\.2; + +1\.2 +date 70\.12\.31\.12\.15\.05; author me; state bogus; +branches + 1\.2\.6\.1; +next 1\.1; + +1\.1 +date 70\.12\.31\.11\.00\.05; author joe; state bogus; +branches; +next ; +newph ; + +1\.2\.6\.1 +date 71\.01\.01\.08\.00\.05; author joe; state Exp; +branches; +next ; + + +desc +@@ + + +1\.5 +log +@@ +newphrase1 ; +newphrase2 42; +text +@head revision@ + + +1\.4 +log +@@ +text +@d1 1 +a1 1 +new year revision@ + + +1\.3 +log +@@ +text +@d1 1 +a1 1 +old year revision@ + + +1\.2 +log +@@ +text +@d1 1 +a1 1 +mid revision@ + + +1\.1 +log +@@ +text +@d1 1 +a1 1 +start revision@ + + +1\.2\.6\.1 +log +@@ +text +@d1 1 +a1 1 +branch revision@" + + # For remote, the "update -p -D" usage seems not to work. + # I'm not sure what is going on. + if test "x$remote" = "xno"; then + + if ${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2 \ + >${TESTDIR}/rcs4.tmp + then + dotest rcs-9 "cat ${TESTDIR}/rcs4.tmp" "start revision" + else + fail rcs-9 + fi + + if ${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2 \ + >${TESTDIR}/rcs4.tmp + then + dotest rcs-10 "cat ${TESTDIR}/rcs4.tmp" "mid revision" + else + fail rcs-10 + fi + + if ${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2 \ + >${TESTDIR}/rcs4.tmp + then + dotest rcs-11 "cat ${TESTDIR}/rcs4.tmp" "new year revision" + else + fail rcs-11 + fi + + # Same test as rcs-10, but with am/pm. + if ${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2 \ + >${TESTDIR}/rcs4.tmp + then + dotest rcs-12 "cat ${TESTDIR}/rcs4.tmp" "mid revision" + else + fail rcs-12 + fi + + # Same test as rcs-11, but with am/pm. + if ${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2 \ + >${TESTDIR}/rcs4.tmp + then + dotest rcs-13 "cat ${TESTDIR}/rcs4.tmp" "new year revision" + else + fail rcs-13 + fi + + fi # end of tests skipped for remote + + # OK, now make sure cvs log doesn't have any trouble with the + # newphrases and such. + dotest rcs-14 "${testcvs} -q log file2" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +Working file: file2 +head: 1\.5 +branch: +locks: +access list: +symbolic names: +keyword substitution: kv +total revisions: 6; selected revisions: 6 +description: +---------------------------- +revision 1\.5 +date: 1971/01/01 01:00:00; author: joe; state: bogus; lines: ${PLUS}1 -1 +\*\*\* empty log message \*\*\* +---------------------------- +revision 1\.4 +date: 1971/01/01 00:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1 +\*\*\* empty log message \*\*\* +---------------------------- +revision 1\.3 +date: 1970/12/31 15:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1 +\*\*\* empty log message \*\*\* +---------------------------- +revision 1\.2 +date: 1970/12/31 12:15:05; author: me; state: bogus; lines: ${PLUS}1 -1 +branches: 1\.2\.6; +\*\*\* empty log message \*\*\* +---------------------------- +revision 1\.1 +date: 1970/12/31 11:00:05; author: joe; state: bogus; +\*\*\* empty log message \*\*\* +---------------------------- +revision 1\.2\.6\.1 +date: 1971/01/01 08:00:05; author: joe; state: Exp; lines: ${PLUS}1 -1 +\*\*\* empty log message \*\*\* +=============================================================================" cd .. rm -r first-dir ${TESTDIR}/rcs4.tmp @@ -6231,7 +9226,7 @@ add file1 done dotest big-2 "${testcvs} add file1" \ "${PROG} [a-z]*: scheduling file .file1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest big-3 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -6240,15 +9235,28 @@ ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 initial revision: 1\.1 done" cd .. - rm -r first-dir + mkdir 2 + cd 2 dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1" + cd ../first-dir + echo "add a line to the end" >>file1 + dotest big-5 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + cd ../2/first-dir + # The idea here is particularly to test the Rcs-diff response + # and the reallocing thereof, for remote. + dotest big-6 "${testcvs} -q update" "[UP] file1" + cd ../.. if test "$keep" = yes; then echo Keeping ${TESTDIR} and exiting due to --keep exit 0 fi - rm -r first-dir + rm -r first-dir 2 rm -rf ${CVSROOT_DIRNAME}/first-dir ;; @@ -6275,7 +9283,7 @@ done" touch aa dotest modes-3 "${testcvs} add aa" \ "${PROG} [a-z]*: scheduling file .aa. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest modes-4 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v done @@ -6318,7 +9326,7 @@ done" chmod +x ab dotest modes-8 "${testcvs} add ab" \ "${PROG} [a-z]*: scheduling file .ab. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest modes-9 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/ab,v done @@ -6345,7 +9353,7 @@ T ab' touch ac dotest modes-13 "${testcvs} add ac" \ "${PROG} [a-z]*: scheduling file .ac. for addition on branch .br. -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" # Not sure it really makes sense to refer to a "previous revision" # when we are just now adding the file; as far as I know # that is longstanding CVS behavior, for what it's worth. @@ -6395,7 +9403,7 @@ done" dotest stamps-3 "${testcvs} add aa kw" \ "${PROG} [a-z]*: scheduling file .aa. for addition ${PROG} [a-z]*: scheduling file .kw. for addition -${PROG} [a-z]*: use .cvs commit. to add these files permanently" +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" ls -l aa >${TESTDIR}/1/stamp.aa.add ls -l kw >${TESTDIR}/1/stamp.kw.add # "cvs add" should not muck with the timestamp. @@ -6518,6 +9526,9 @@ done" sticky) # More tests of sticky tags, particularly non-branch sticky tags. + # See many tests (e.g. multibranch) for ordinary sticky tag + # operations such as adding files on branches. + # See "head" test for interaction between stick tags and HEAD. mkdir 1; cd 1 dotest sticky-1 "${testcvs} -q co -l ." '' mkdir first-dir @@ -6528,7 +9539,7 @@ done" touch file1 dotest sticky-3 "${testcvs} add file1" \ "${PROG} [a-z]*: scheduling file .file1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest sticky-4 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -6555,7 +9566,54 @@ ${QUESTION} file2" "${QUESTION} file2 [UP] file1" dotest sticky-13 "${testcvs} add file2" \ "${PROG} [a-z]*: scheduling file .file2. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest sticky-14 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + + # Now back to tag1 + dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1 +${PROG} [a-z]*: file2 is no longer in the repository" + + rm file1 + dotest sticky-16 "${testcvs} rm file1" \ +"${PROG} [a-z]*: scheduling .file1. for removal +${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently" + # Hmm, this command seems to silently remove the tag from + # the file. This appears to be intentional. + # The silently part especially strikes me as odd, though. + dotest sticky-17 "${testcvs} -q ci -m remove-it" "" + dotest sticky-18 "${testcvs} -q update -A" "U file1 +U file2" + dotest sticky-19 "${testcvs} -q update -r tag1" \ +"${PROG} [a-z]*: file1 is no longer in the repository +${PROG} [a-z]*: file2 is no longer in the repository" + dotest sticky-20 "${testcvs} -q update -A" "U file1 +U file2" + + # Now try with a numeric revision. + dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1" + rm file1 + dotest sticky-22 "${testcvs} rm file1" \ +"${PROG} [a-z]*: cannot remove file .file1. which has a numeric sticky tag of .1\.1." + # The old behavior was that remove allowed this and then commit + # gave an error, which was somewhat hard to clear. I mean, you + # could get into a long elaborate discussion of this being a + # conflict and two ways to resolve it, but I don't really see + # why CVS should have a concept of conflict that arises, not from + # parallel development, but from CVS's own sticky tags. + + # I'm kind of surprised that the "file1 was lost" doesn't crop + # up elsewhere in the testsuite. It is a long-standing + # discrepency between local and remote CVS and should probably + # be cleaned up at some point. + dotest sticky-23 "${testcvs} -q update -A" \ +"${PROG} [a-z]*: warning: file1 was lost +U file1" "U file1" cd ../.. rm -r 1 @@ -6564,6 +9622,14 @@ ${PROG} [a-z]*: use .cvs commit. to add this file permanently" keyword) # Test keyword expansion. + # Various other tests relate to our ability to correctly + # set the keyword expansion mode. + # "binfiles" tests "cvs admin -k". + # "binfiles" and "binfiles2" test "cvs add -k". + # "rdiff" tests "cvs co -k". + # "binfiles" (and this test) test "cvs update -k". + # "binwrap" tests setting the mode from wrappers. + # I don't think any test is testing "cvs import -k". mkdir 1; cd 1 dotest keyword-1 "${testcvs} -q co -l ." '' mkdir first-dir @@ -6591,7 +9657,7 @@ ${PROG} [a-z]*: use .cvs commit. to add this file permanently" dotest keyword-3 "${testcvs} add file1" \ "${PROG} [a-z]*: scheduling file .file1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest keyword-4 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v done @@ -6725,17 +9791,7 @@ xx "'\$'"Log"'\$' # Test the Name keyword. First go back to normal expansion. - # FIXME: When using remote, update -A does not revert the - # keyword expansion mode. We work around that bug here. - # This workaround should be removed when the bug is fixed. - if test "x$remote" = "xyes"; then - cd .. - rm -r first-dir - dotest keyword-17 "${testcvs} -q co first-dir" "U first-dir/file1" - cd first-dir - else - dotest keyword-17 "${testcvs} update -A file1" "U file1" - fi + dotest keyword-17 "${testcvs} update -A file1" "U file1" echo '$''Name$' > file1 dotest keyword-18 "${testcvs} ci -m modify file1" \ @@ -6759,44 +9815,160 @@ done" dotest keyword-23 "${testcvs} update -A file1" "[UP] file1" + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + keywordlog) # Test the Log keyword. + mkdir 1; cd 1 + dotest keywordlog-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest keywordlog-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + echo change >file1 + dotest keywordlog-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + + # Note that we wanted to try "ci -r 1.3 -m add file1" and CVS + # seemed to get all confused, thinking it was adding on a branch + # or something. FIXME? Do something about this? Document it + # in BUGS or someplace? + + dotest keywordlog-4 "${testcvs} -q ci -m add file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + + cd ../.. + mkdir 2; cd 2 + dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1" + cd ../1/first-dir + echo 'xx $''Log$' > file1 cat >${TESTDIR}/comment.tmp <<EOF First log line Second log line EOF - dotest keyword-24 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \ + dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \ "Checking in file1; ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 -new revision: 1\.4; previous revision: 1\.3 +new revision: 1\.2; previous revision: 1\.1 done" rm -f ${TESTDIR}/comment.tmp - dotest keyword-25 "cat file1" \ + dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1" + dotest keywordlog-7 "cat file1" \ "xx "'\$'"Log: file1,v "'\$'" -xx Revision 1\.4 [0-9/]* [0-9:]* ${username} +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} xx First log line xx Second log line xx" + cd ../../2/first-dir + dotest keywordlog-8 "${testcvs} -q update" "[UP] file1" + dotest keywordlog-9 "cat file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx" + cd ../../1/first-dir + echo "change" >> file1 - dotest keyword-26 "${testcvs} ci -m modify file1" \ + dotest keywordlog-10 "${testcvs} ci -m modify file1" \ "Checking in file1; ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 -new revision: 1\.5; previous revision: 1\.4 +new revision: 1\.3; previous revision: 1\.2 done" - dotest keyword-27 "cat file1" \ + dotest keywordlog-11 "cat file1" \ "xx "'\$'"Log: file1,v "'\$'" -xx Revision 1\.5 [0-9/]* [0-9:]* ${username} +xx Revision 1\.3 [0-9/]* [0-9:]* ${username} xx modify xx -xx Revision 1\.4 [0-9/]* [0-9:]* ${username} +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} xx First log line xx Second log line xx change" + cd ../../2/first-dir + dotest keywordlog-12 "${testcvs} -q update" "[UP] file1" + dotest keywordlog-13 "cat file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.3 [0-9/]* [0-9:]* ${username} +xx modify +xx +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx +change" + + cd ../../1/first-dir + dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1" + echo br-change >>file1 + dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2\.2\.1; previous revision: 1\.2 +done" + dotest keywordlog-16 "cat file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username} +xx br-modify +xx +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx +br-change" + cd ../../2/first-dir + dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1" + dotest keywordlog-18 "cat file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username} +xx br-modify +xx +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx +br-change" cd ../.. - rm -r 1 + dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username} +xx br-modify +xx +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx +br-change" + dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.3 [0-9/]* [0-9:]* ${username} +xx modify +xx +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx +change" + dotest keywordlog-21 "${testcvs} -q co -p -r 1.2 first-dir/file1" \ +"xx "'\$'"Log: file1,v "'\$'" +xx Revision 1\.2 [0-9/]* [0-9:]* ${username} +xx First log line +xx Second log line +xx" + + rm -r 1 2 rm -rf ${CVSROOT_DIRNAME}/first-dir ;; @@ -6811,15 +9983,16 @@ change" mkdir 1; cd 1 dotest toplevel-1 "${testcvs} -q co -l ." '' - mkdir top-dir - dotest toplevel-2 "${testcvs} add top-dir" \ -"Directory ${TESTDIR}/cvsroot/top-dir added to the repository" + mkdir top-dir second-dir + dotest toplevel-2 "${testcvs} add top-dir second-dir" \ +"Directory ${TESTDIR}/cvsroot/top-dir added to the repository +Directory ${TESTDIR}/cvsroot/second-dir added to the repository" cd top-dir touch file1 dotest toplevel-3 "${testcvs} add file1" \ "${PROG} [a-z]*: scheduling file .file1. for addition -${PROG} [a-z]*: use .cvs commit. to add this file permanently" +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" dotest toplevel-4 "${testcvs} -q ci -m add" \ "RCS file: ${TESTDIR}/cvsroot/top-dir/file1,v done @@ -6827,6 +10000,20 @@ Checking in file1; ${TESTDIR}/cvsroot/top-dir/file1,v <-- file1 initial revision: 1\.1 done" + cd .. + + cd second-dir + touch file2 + dotest toplevel-3s "${testcvs} add file2" \ +"${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest toplevel-4s "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/second-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/second-dir/file2,v <-- file2 +initial revision: 1\.1 +done" cd ../.. rm -r 1; mkdir 1; cd 1 @@ -6842,16 +10029,11 @@ ${PROG} [a-z]*: Updating top-dir" dotest toplevel-8 "${testcvs} update -d top-dir" \ "${PROG} [a-z]*: Updating top-dir" - # FIXME: This test fails in cvs starting from 1.9.2 because - # it updates "file1" in "1". Test modules3-7f also finds - # (and tolerates) this bug. The second expect string below - # should be removed when this is fixed. The first expect - # string is the behavior of remote CVS. There is some sentiment - # that + # There is some sentiment that # "${PROG} [a-z]*: Updating \. # ${PROG} [a-z]*: Updating top-dir" # is correct but it isn't clear why that would be correct instead - # of the remote CVS behavior. + # of the remote CVS behavior (which also updates CVSROOT). # # The DOTSTAR matches of a bunch of lines like # "U CVSROOT/checkoutlist". Trying to match them more precisely @@ -6862,13 +10044,3401 @@ ${PROG} [a-z]*: Updating top-dir" "${PROG} [a-z]*: Updating \. ${PROG} [a-z]*: Updating CVSROOT ${DOTSTAR} -${PROG} [a-z]*: Updating top-dir" \ -"${PROG} [a-z]*: Updating \. -U file1 ${PROG} [a-z]*: Updating top-dir" cd .. + rm -r 1; mkdir 1; cd 1 + dotest toplevel-10 "${testcvs} co top-dir" \ +"${PROG} [a-z]*: Updating top-dir +U top-dir/file1" + # This tests more or less the same thing, in a particularly + # "real life" example. + dotest toplevel-11 "${testcvs} -q update -d second-dir" \ +"U second-dir/file2" + + # Now remove the CVS directory (people may do this manually, + # especially if they formed their habits with CVS + # 1.9 and older, which didn't create it. Or perhaps the working + # directory itself was created with 1.9 or older). + rm -r CVS + # Now set the permissions so we can't recreate it. + chmod -w ../1 + # Now see whether CVS has trouble because it can't create CVS. + dotest toplevel-12 "${testcvs} co top-dir" \ +"${PROG} [a-z]*: warning: cannot make directory ./CVS: Permission denied +${PROG} [a-z]*: Updating top-dir" + chmod +w ../1 + + cd .. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/top-dir + ;; + + head) + # Testing handling of the HEAD special tag. + # There are many cases involving added and removed files + # which we don't yet try to deal with. + # TODO: We also could be paying much closer attention to + # "head of the trunk" versus "head of the default branch". + # That is what "cvs import" is doing here (but I didn't really + # fully follow through on writing the tests for that case). + mkdir imp-dir + cd imp-dir + echo 'imported contents' >file1 + # It may seem like we don't do much with file2, but do note that + # the "cvs diff" invocations do also diff file2 (and come up empty). + echo 'imported contents' >file2 + dotest head-1 "${testcvs} import -m add first-dir tag1 tag2" \ +"N first-dir/file1 +N first-dir/file2 + +No conflicts created by this import" + cd .. + rm -r imp-dir + mkdir 1 + cd 1 + dotest head-2 "${testcvs} -q co first-dir" \ +"U first-dir/file1 +U first-dir/file2" + cd first-dir + echo 'add a line on trunk' >> file1 + dotest head-3 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + dotest head-4 "${testcvs} -q tag trunktag" "T file1 +T file2" + echo 'add a line on trunk after trunktag' >> file1 + dotest head-5 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.3; previous revision: 1\.2 +done" + dotest head-6 "${testcvs} -q tag -b br1" "T file1 +T file2" + dotest head-7 "${testcvs} -q update -r br1" "" + echo 'modify on branch' >>file1 + dotest head-8 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.3\.2\.1; previous revision: 1\.3 +done" + dotest head-9 "${testcvs} -q tag brtag" "T file1 +T file2" + echo 'modify on branch after brtag' >>file1 + dotest head-10 "${testcvs} -q ci -m modify" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1 +done" + # With no sticky tags, HEAD is the head of the trunk. + dotest head-trunk-setup "${testcvs} -q update -A" "[UP] file1" + dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \ +"imported contents +add a line on trunk +add a line on trunk after trunktag" + # and diff thinks so too. Case (a) from the comment in + # cvs.texinfo (Common options). + dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \ +"Index: file1 +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.3 +retrieving revision 1\.3\.2\.2 +diff -c -r1\.3 -r1\.3\.2\.2 +\*\*\* file1 [0-9/]* [0-9:]* 1\.3 +--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +\*\*\* 1,3 \*\*\*\* +--- 1,5 ---- + imported contents + add a line on trunk + add a line on trunk after trunktag +${PLUS} modify on branch +${PLUS} modify on branch after brtag" + + # With a branch sticky tag, HEAD is the head of the trunk. + dotest head-br1-setup "${testcvs} -q update -r br1" "[UP] file1" + dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \ +"imported contents +add a line on trunk +add a line on trunk after trunktag" + # But diff thinks that HEAD is "br1". Case (b) from cvs.texinfo. + # Probably people are relying on it. + dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" "" + + # With a nonbranch sticky tag on a branch, + # HEAD is the head of the trunk + dotest head-brtag-setup "${testcvs} -q update -r brtag" "[UP] file1" + dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \ +"imported contents +add a line on trunk +add a line on trunk after trunktag" + # But diff thinks that HEAD is "brtag". Case (c) from + # cvs.texinfo (the "strange, maybe accidental" case). + dotest_fail head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" \ +"Index: file1 +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.3\.2\.1 +retrieving revision 1\.3\.2\.2 +diff -c -r1\.3\.2\.1 -r1\.3\.2\.2 +\*\*\* file1 [0-9/]* [0-9:]* 1\.3\.2\.1 +--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +\*\*\* 2,4 \*\*\*\* +--- 2,5 ---- + add a line on trunk + add a line on trunk after trunktag + modify on branch +${PLUS} modify on branch after brtag" + + # With a nonbranch sticky tag on the trunk, HEAD is the head + # of the trunk, I think. + dotest head-trunktag-setup "${testcvs} -q update -r trunktag" \ +"[UP] file1" + dotest head-trunktag-check "cat file1" "imported contents +add a line on trunk" + dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \ +"imported contents +add a line on trunk +add a line on trunk after trunktag" + # Like head-brtag-diff, HEAD is the sticky tag. Similarly + # questionable. + dotest_fail head-trunktag-diff \ + "${testcvs} -q diff -c -r HEAD -r br1" \ +"Index: file1 +=================================================================== +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +retrieving revision 1\.2 +retrieving revision 1\.3\.2\.2 +diff -c -r1\.2 -r1\.3\.2\.2 +\*\*\* file1 [0-9/]* [0-9:]* 1\.2 +--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +\*\*\* 1,2 \*\*\*\* +--- 1,5 ---- + imported contents + add a line on trunk +${PLUS} add a line on trunk after trunktag +${PLUS} modify on branch +${PLUS} modify on branch after brtag" + + # Also might test what happens if we setup with update -r + # HEAD. In general, if sticky tags matter, does the + # behavior of "update -r <foo>" (without -p) depend on the + # sticky tags before or after the update? + + # Note that we are testing both the case where this deletes + # a revision (file1) and the case where it does not (file2) + dotest_fail head-o0a "${testcvs} admin -o ::br1" \ +"${PROG} [a-z]*: Administrating \. +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +${PROG} [a-z]*: cannot remove revision 1\.3\.2\.1 because it has tags +${PROG} [a-z]*: cannot modify RCS file for .file1. +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done" + dotest head-o0b "${testcvs} tag -d brtag" \ +"${PROG} [a-z]*: Untagging \. +D file1 +D file2" + dotest head-o1 "${testcvs} admin -o ::br1" \ +"${PROG} [a-z]*: Administrating \. +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +deleting revision 1\.3\.2\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done" + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + tagdate) + # Test combining -r and -D. + mkdir 1; cd 1 + dotest tagdate-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest tagdate-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + + echo trunk-1 >file1 + dotest tagdate-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest tagdate-4 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1" + dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1" + echo trunk-2 >file1 + dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + # We are testing -r -D where br1 is a (magic) branch without + # any revisions. First the case where br2 doesn't have any + # revisions either: + dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1" + dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1" + echo br2-1 >file1 + dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.4\.1; previous revision: 1\.1 +done" + # Then the case where br2 does have revisions: + dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1" + + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + multibranch2) + # Commit the first delta on branch A when there is an older + # branch, B, that already has a delta. A and B come from the + # same branch point. Then verify that branches A and B are + # in the right order. + mkdir 1; cd 1 + dotest multibranch2-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest multibranch2-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + + echo trunk-1 >file1 + echo trunk-1 >file2 + dotest multibranch2-3 "${testcvs} add file1 file2" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest multibranch2-4 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1 +T file2" + dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1 +T file2" + + dotest multibranch2-7 "${testcvs} -q update -r B" '' + echo branch-B >file1 + echo branch-B >file2 + dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.4\.1; previous revision: 1\.1 +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +new revision: 1\.1\.4\.1; previous revision: 1\.1 +done" + + dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1 +[UP] file2' + echo branch-A >file1 + # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c. + dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + + dotest multibranch2-11 "${testcvs} -q log file1" \ +" +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +symbolic names: + B: 1\.1\.0\.4 + A: 1\.1\.0\.2 +keyword substitution: kv +total revisions: 3; selected revisions: 3 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: $username; state: Exp; +branches: 1\.1\.2; 1\.1\.4; +add +---------------------------- +revision 1\.1\.4\.1 +date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1 +modify-on-B +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1 +modify-on-A +=============================================================================" + + # This one is more concise. + dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \ +" +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +symbolic names: + B: 1\.1\.0\.4 + A: 1\.1\.0\.2 +keyword substitution: kv +total revisions: 3; selected revisions: 1 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: $username; state: Exp; +branches: 1\.1\.2; 1\.1\.4; +add +=============================================================================" + + # OK, try very much the same thing except we run update -j to + # bring the changes from B to A. Probably tests many of the + # same code paths but might as well keep it separate, I guess. + + dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1 +[UP] file2" + dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \ +"[UP] file2 +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +retrieving revision 1.1 +retrieving revision 1.1.4.1 +Merging differences between 1.1 and 1.1.4.1 into file2" + dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \ +"Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + + admin) + # More "cvs admin" tests. + # The basicb-21 test tests rejecting an illegal option. + # For -l and -u, see "reserved" and "keyword" tests. + # "binfiles" test has a test of "cvs admin -k". + # "log2" test has tests of -t and -q options to cvs admin. + # "rcs" tests -b option also. + # For -o, see: + # admin-22-o1 through admin-23 (various cases not involving ::) + # binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch) + # basica-o1 through basica-o3 (basic :: usage) + # head-o1 (::branch, where this deletes a revision or is noop) + # branches-o1 (::branch, similar, with different branch topology) + # log-o1 (1.3.2.1::) + # binfiles-o1 (1.3:: and ::1.3) + # Also could be testing: + # 1.3.2.6::1.3.2.8 + # 1.3.2.6::1.3.2 + # 1.3.2.1::1.3.2.6 + # 1.3::1.3.2.6 (error? or synonym for ::1.3.2.6?) + + mkdir 1; cd 1 + dotest admin-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest admin-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + + dotest_fail admin-3 "${testcvs} -q admin -i file1" \ +"${PROG} admin: the -i option to admin is not supported +${PROG} admin: run add or import to create an RCS file +${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" + dotest_fail admin-4 "${testcvs} -q log file1" \ +"${PROG} [a-z]*: nothing known about file1" + + # Set up some files, file2 a plain one and file1 with a revision + # on a branch. + touch file1 file2 + dotest admin-5 "${testcvs} add file1 file2" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: scheduling file .file2. for addition +${PROG} [a-z]*: use .${PROG} commit. to add these files permanently" + dotest admin-6 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done +Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + dotest admin-7 "${testcvs} -q tag -b br" "T file1 +T file2" + dotest admin-8 "${testcvs} -q update -r br" "" + echo 'add a line on the branch' >> file1 + dotest admin-9 "${testcvs} -q ci -m modify-on-branch" \ +"Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + dotest admin-10 "${testcvs} -q update -A" "U file1" + + # Try to recurse with a numeric revision arg. + # If we wanted to comprehensive about this, we would also test + # this for -l, -u, and all the different -o syntaxes. + dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \ +"${PROG} [a-z]*: while processing more than one file: +${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision" + dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \ +"${PROG} [a-z]*: while processing more than one file: +${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision" + + # Note that -s option applies to the new default branch, not + # the old one. + # Also note that the implementation of -a via "rcs" requires + # no space between -a and the argument. However, we expect + # to change that once CVS parses options. + dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \ +-b1.1.2 -cxx -U -sfoo file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + + dotest admin-12 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: 1\.1\.2 +locks: +access list: + foo + bar + baz +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +add +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0 +modify-on-branch +=============================================================================" + + # "cvs log" doesn't print the comment leader. RCS 5.7 will print + # the comment leader only if one specifies "-V4" to rlog. So it + # seems like the only way to test it is by looking at the RCS file + # directly. This also serves as a test of exporting RCS files + # (analogous to the import tests in "rcs"). + # Rather than try to write a rigorous check for whether the + # file CVS exports is legal, we just write a simpler + # test for what CVS actually exports, and figure we can revise + # the check as needed (within the confines of the RCS5 format as + # documented in RCSFILES). + dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \ +"head 1\.1; +branch 1\.1\.2; +access + foo + bar + baz; +symbols + br:1\.1\.0\.2; +locks; +comment @xx@; + + +1\.1 +date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp; +branches + 1\.1\.2\.1; +next ; + +1\.1\.2\.1 +date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo; +branches; +next ; + + +desc +@@ + + +1\.1 +log +@add +@ +text +@@ + + +1\.1\.2\.1 +log +@modify-on-branch +@ +text +@a0 1 +add a line on the branch +@" + dotest admin-14 "${testcvs} -q admin -aauth3 -aauth2,foo \ +-soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +done" + dotest admin-15 "${testcvs} -q log file2" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +Working file: file2 +head: 1\.1 +branch: +locks: strict +access list: + auth3 + auth2 + foo +symbolic names: + tagone: 1\.1 + br: 1\.1\.0\.2 +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: oneone; +changed-log-message +=============================================================================" + + dotest admin-16 "${testcvs} -q admin \ +-A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest admin-17 "${testcvs} -q log file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: + foo + bar + baz + auth3 + auth2 +symbolic names: + br: 1\.1 +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +add +---------------------------- +revision 1\.1\.2\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0 +modify-on-branch +=============================================================================" + + dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file1,v: symbolic name br already bound to 1\.1 +${PROG} [a-z]*: cannot modify RCS file for .file1." + dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest admin-20 "${testcvs} -q log file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: + foo + auth2 +symbolic names: +keyword substitution: kv +total revisions: 2; selected revisions: 2 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +branches: 1\.1\.2; +add +---------------------------- +revision 1.1.2.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0 +modify-on-branch +=============================================================================" + + # OK, this is starting to get ridiculous, in terms of + # testing a feature (access lists) which doesn't do anything + # useful, but what about nonexistent files and + # relative pathnames in admin -A? + dotest_fail admin-19a-nonexist \ +"${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +${PROG} [a-z]*: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory +${PROG} \[[a-z]* aborted\]: cannot continue" + + # In the remote case, we are cd'd off into the temp directory + # and so these tests give "No such file or directory" errors. + if test "x$remote" = xno; then + + dotest admin-19a-admin "${testcvs} -q admin -A../../cvsroot/first-dir/file2,v file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + dotest admin-19a-log "${testcvs} -q log -h -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: + foo + auth2 + auth3 +keyword substitution: kv +total revisions: 2 +=============================================================================" + # Put the access list back, to avoid special cases later. + dotest admin-19a-fix "${testcvs} -q admin -eauth3 file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done" + fi # end of tests skipped for remote + + # Add another revision to file2, so we can delete one. + echo 'add a line' >> file2 + dotest admin-21 "${testcvs} -q ci -m modify file2" \ +"Checking in file2; +${TESTDIR}/cvsroot/first-dir/file2,v <-- file2 +new revision: 1\.2; previous revision: 1\.1 +done" + dotest admin-22 "${testcvs} -q admin -o1.1 file2" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +deleting revision 1\.1 +done" + # Test admin -o. More variants that we could be testing: + # * REV: [on branch] + # * REV1:REV2 [deleting whole branch] + # * high branch numbers (e.g. 1.2.2.3.2.3) + # ... and probably others. See RCS_delete_revs for ideas. + + echo first rev > aaa + dotest admin-22-o1 "${testcvs} add aaa" \ +"${PROG} [a-z]*: scheduling file .aaa. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +done +Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +initial revision: 1\.1 +done" + echo second rev >> aaa + dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.2; previous revision: 1\.1 +done" + echo third rev >> aaa + dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.3; previous revision: 1\.2 +done" + echo fourth rev >> aaa + dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.4; previous revision: 1\.3 +done" + echo fifth rev >>aaa + dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.5; previous revision: 1\.4 +done" + echo sixth rev >> aaa + dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.6; previous revision: 1\.5 +done" + dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +1\.6 locked +done" + dotest admin-22-o9 "${testcvs} log -r1.6 aaa" " +RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +Working file: aaa +head: 1\.6 +branch: +locks: strict + ${username}: 1\.6 +access list: +symbolic names: +keyword substitution: kv +total revisions: 6; selected revisions: 1 +description: +---------------------------- +revision 1\.6 locked by: ${username}; +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +sixth +=============================================================================" + dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove locked revision 1\.6 +${PROG} [a-z]*: cannot modify RCS file for .aaa." + dotest admin-22-o11 "${testcvs} admin -u aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +1\.6 unlocked +done" + dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +deleting revision 1\.6 +deleting revision 1\.5 +done" + dotest admin-22-o13 "${testcvs} log aaa" " +RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +Working file: aaa +head: 1\.4 +branch: +locks: strict +access list: +symbolic names: +keyword substitution: kv +total revisions: 4; selected revisions: 4 +description: +---------------------------- +revision 1\.4 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +fourth +---------------------------- +revision 1\.3 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +third +---------------------------- +revision 1\.2 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +second +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +first +=============================================================================" + + dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa" + dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa" + echo new branch rev >> aaa + dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.3\.2\.1; previous revision: 1\.3 +done" + dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +deleting revision 1\.4 +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove branch point 1\.3 +${PROG} [a-z]*: cannot modify RCS file for .aaa." + dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \ +"=================================================================== +Checking out aaa +RCS: ${TESTDIR}/cvsroot/first-dir/aaa,v +VERS: 1\.4 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +first rev +second rev +third rev +fourth rev" + echo second branch rev >> aaa + dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1 +done" + echo third branch rev >> aaa + dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2 +done" + echo fourth branch rev >> aaa + dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \ +"Checking in aaa; +${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa +new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3 +done" + dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +deleting revision 1\.3\.2\.1 +deleting revision 1\.3\.2\.2 +deleting revision 1\.3\.2\.3 +done" + dotest admin-22-o23 "${testcvs} log aaa" " +RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v +Working file: aaa +head: 1\.4 +branch: +locks: strict +access list: +symbolic names: + br1: 1\.3\.0\.2 +keyword substitution: kv +total revisions: 5; selected revisions: 5 +description: +---------------------------- +revision 1\.4 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +fourth +---------------------------- +revision 1\.3 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +branches: 1\.3\.2; +third +---------------------------- +revision 1\.2 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0 +second +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +first +---------------------------- +revision 1\.3\.2\.4 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}4 -0 +branch-four +=============================================================================" + + dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \ +"first rev +second rev +third rev +new branch rev +second branch rev +third branch rev +fourth branch rev" + + # The bit here about how there is a "tagone" tag pointing to + # a nonexistent revision is documented by rcs. I dunno, I + # wonder whether the "cvs admin -o" should give a warning in + # this case. + dotest admin-23 "${testcvs} -q log file2" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v +Working file: file2 +head: 1\.2 +branch: +locks: strict +access list: + auth3 + auth2 + foo +symbolic names: + tagone: 1\.1 + br: 1\.1\.0\.2 +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.2 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +modify +=============================================================================" + + dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \ +"head 1\.1; +access + foo + auth2; +symbols; +locks; strict; +comment @xx@; + + +1\.1 +date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp; +branches + 1\.1\.2\.1; +next ; + +1\.1\.2\.1 +date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo; +branches; +next ; + + +desc +@@ + + +1\.1 +log +@add +@ +text +@@ + + +1\.1\.2\.1 +log +@modify-on-branch +@ +text +@a0 1 +add a line on the branch +@" + + cd ../.. + rm -r 1 + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + reserved) + # Tests of reserved checkouts. Eventually this will test + # rcslock.pl (or equivalent) and all kinds of stuff. Right + # now it just does some very basic checks on cvs admin -u + # and cvs admin -l. + # Also should test locking on a branch (and making sure that + # locks from one branch don't get mixed up with those from + # another. Both the case where one of the branches is the + # main branch, and in which neither one is). + # See also test keyword, which tests that keywords and -kkvl + # do the right thing in the presence of locks. + + # The usual setup, directory first-dir containing file file1. + mkdir 1; cd 1 + dotest reserved-1 "${testcvs} -q co -l ." '' + mkdir first-dir + dotest reserved-2 "${testcvs} add first-dir" \ +"Directory ${TESTDIR}/cvsroot/first-dir added to the repository" + cd first-dir + touch file1 + dotest reserved-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest reserved-4 "${testcvs} -q ci -m add" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +done +Checking in file1; +${TESTDIR}/cvsroot/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + + dotest reserved-5 "${testcvs} -q admin -l file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +1\.1 locked +done" + dotest reserved-6 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict + ${username}: 1\.1 +access list: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.1 locked by: ${username}; +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +add +=============================================================================" + + # Note that this just tests the owner of the lock giving + # it up. It doesn't test breaking a lock. + dotest reserved-7 "${testcvs} -q admin -u file1" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +1\.1 unlocked +done" + + dotest reserved-8 "${testcvs} log -N file1" " +RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v +Working file: file1 +head: 1\.1 +branch: +locks: strict +access list: +keyword substitution: kv +total revisions: 1; selected revisions: 1 +description: +---------------------------- +revision 1\.1 +date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; +add +=============================================================================" + + # rcslock.pl tests. Of course, the point isn't to test + # rcslock.pl from the distribution but equivalent + # functionality (for example, many sites may have an old + # rcslock.pl). The functionality of this hook falls + # short of the real rcslock.pl though. + # Note that we can use rlog or look at the RCS file directly, + # but we can't use "cvs log" because "cvs commit" has a lock. + + cat >${TESTDIR}/lockme <<EOF +#!${TESTSHELL} +line=\`grep <\$1/\$2,v 'locks ${username}:1\.[0-9];'\` +if test -z "\$line"; then + # It isn't locked + exit 0 +else + user=\`echo \$line | sed -e 's/locks \\(${username}\\):[0-9.]*;.*/\\1/'\` + version=\`echo \$line | sed -e 's/locks ${username}:\\([0-9.]*\\);.*/\\1/'\` + echo "\$user has file a-lock locked for version \$version" + exit 1 +fi +EOF + chmod +x ${TESTDIR}/lockme + + echo stuff > a-lock + dotest reserved-9 "${testcvs} add a-lock" \ +"${PROG} [a-z]*: scheduling file .a-lock. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file permanently" + dotest reserved-10 "${testcvs} -q ci -m new a-lock" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v +done +Checking in a-lock; +${TESTDIR}/cvsroot/first-dir/a-lock,v <-- a-lock +initial revision: 1\.1 +done" + # FIXME: the contents of CVSROOT fluctuate a lot + # here. Maybe the expect pattern should just + # confirm that commitinfo is one of the files checked out, + # but for now we just check that CVS exited with success. + cd .. + if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then + pass reserved-11 + else + fail reserved-11 + fi + cd CVSROOT + echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo + dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \ +"Checking in commitinfo; +${TESTDIR}/cvsroot/CVSROOT/commitinfo,v <-- commitinfo +new revision: 1\.2; previous revision: 1\.1 +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd ..; cd first-dir + + # Simulate (approximately) what a-lock would look like + # if someone else had locked revision 1.1. + sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${TESTDIR}/cvsroot/first-dir/a-lock,v > a-lock,v + chmod 644 ${TESTDIR}/cvsroot/first-dir/a-lock,v + dotest reserved-13 "mv a-lock,v ${TESTDIR}/cvsroot/first-dir/a-lock,v" + chmod 444 ${TESTDIR}/cvsroot/first-dir/a-lock,v + echo more stuff >> a-lock + dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \ +"fred has file a-lock locked for version 1\.1 +${PROG} [a-z]*: Pre-commit check failed +${PROG} \[[a-z]* aborted\]: correct above errors first!" + + dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \ +"RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v +1\.1 unlocked +done" + dotest reserved-15 "${testcvs} -q ci -m success a-lock" \ +"Checking in a-lock; +${TESTDIR}/cvsroot/first-dir/a-lock,v <-- a-lock +new revision: 1\.2; previous revision: 1\.1 +done" + + # undo commitinfo changes + cd ../CVSROOT + echo '# vanilla commitinfo' >commitinfo + dotest reserved-16 "${testcvs} -q ci -m back commitinfo" \ +"Checking in commitinfo; +${TESTDIR}/cvsroot/CVSROOT/commitinfo,v <-- commitinfo +new revision: 1\.3; previous revision: 1\.2 +done +${PROG} [a-z]*: Rebuilding administrative file database" + cd ..; rm -r CVSROOT; cd first-dir + + cd ../.. rm -r 1 + rm ${TESTDIR}/lockme + rm -rf ${CVSROOT_DIRNAME}/first-dir + ;; + + cvsadm) + # These test check the content of CVS' administrative + # files as they are checked out in various configurations. + # (As a side note, I'm not using the "-q" flag in any of + # this code, which should provide some extra checking for + # those messages which don't seem to be checked thoroughly + # anywhere else.) To do a thorough test, we need to make + # a bunch of modules in various configurations. + # + # <1mod> is a directory at the top level of cvsroot + # ``foo bar'' + # <2mod> is a directory at the second level of cvsroot + # ``foo bar/baz'' + # <1d1mod> is a directory at the top level which is + # checked out into another directory + # ``foo -d bar baz'' + # <1d2mod> is a directory at the second level which is + # checked out into another directory + # ``foo -d bar baz/quux'' + # <2d1mod> is a directory at the top level which is + # checked out into a directory that is two deep + # ``foo -d bar/baz quux'' + # <2d2mod> is a directory at the second level which is + # checked out into a directory that is two deep + # ``foo -d bar/baz quux'' + # + # The tests do each of these types separately and in twos. + # We also repeat each test -d flag for 1-deep and 2-deep + # directories. + # + # Each test should check the output for the Repository + # file, since that is the one which varies depending on + # the directory and how it was checked out. + # + # Yes, this is verbose, but at least it's very thorough. + + # convenience variables + REP=${CVSROOT} + + # First, check out the modules file and edit it. + mkdir 1; cd 1 + dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \ +"U CVSROOT/modules" + + # Try to determine whether RELATIVE_REPOS is defined + # so that we can make the following a lot less + # verbose. + + echo "${CVSROOT_DIRNAME}/." > ${TESTDIR}/dotest.abs + echo "." > ${TESTDIR}/dotest.rel + if cmp ${TESTDIR}/dotest.abs CVS/Repository >/dev/null 2>&1; then + AREP="${CVSROOT_DIRNAME}/" + elif cmp ${TESTDIR}/dotest.rel CVS/Repository >/dev/null 2>&1; then + AREP="" + else + fail "Cannot figure out if RELATIVE_REPOS is defined." + fi + + # Test CVS/Root once. Since there is only one part of + # the code which writes CVS/Root files (Create_Admin), + # there is no point in testing this every time. + dotest cvsadm-1a "cat CVS/Root" ${REP} + dotest cvsadm-1b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP} + dotest cvsadm-1d "cat CVSROOT/CVS/Repository" \ +"${AREP}CVSROOT" + # All of the defined module names begin with a number. + # All of the top-level directory names begin with "dir". + # All of the subdirectory names begin with "sub". + # All of the top-level modules begin with "mod". + echo "# Module defs for cvsadm tests" > CVSROOT/modules + echo "1mod mod1" >> CVSROOT/modules + echo "1mod-2 mod1-2" >> CVSROOT/modules + echo "2mod mod2/sub2" >> CVSROOT/modules + echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules + echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules + echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules + echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules + echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules + echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules + echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules + echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules + echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules + dotest cvsadm-1e "${testcvs} ci -m add-modules" \ +"${PROG} [a-z]*: Examining . +${PROG} [a-z]*: Examining CVSROOT +Checking in CVSROOT/modules; +${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules +new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* +done +${PROG} [a-z]*: Rebuilding administrative file database" + rm -rf CVS CVSROOT; + + # Create the various modules + mkdir ${CVSROOT_DIRNAME}/mod1 + mkdir ${CVSROOT_DIRNAME}/mod1-2 + mkdir ${CVSROOT_DIRNAME}/mod2 + mkdir ${CVSROOT_DIRNAME}/mod2/sub2 + mkdir ${CVSROOT_DIRNAME}/mod2-2 + mkdir ${CVSROOT_DIRNAME}/mod2-2/sub2-2 + dotest cvsadm-2 "${testcvs} co mod1 mod1-2 mod2 mod2-2" \ +"${PROG} [a-z]*: Updating mod1 +${PROG} [a-z]*: Updating mod1-2 +${PROG} [a-z]*: Updating mod2 +${PROG} [a-z]*: Updating mod2/sub2 +${PROG} [a-z]*: Updating mod2-2 +${PROG} [a-z]*: Updating mod2-2/sub2-2" + + # Populate the directories for the halibut + echo "file1" > mod1/file1 + echo "file1-2" > mod1-2/file1-2 + echo "file2" > mod2/sub2/file2 + echo "file2-2" > mod2-2/sub2-2/file2-2 + dotest cvsadm-2a "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \ +"${PROG} [a-z]*: scheduling file .mod1/file1. for addition +${PROG} [a-z]*: scheduling file .mod1-2/file1-2. for addition +${PROG} [a-z]*: scheduling file .mod2/sub2/file2. for addition +${PROG} [a-z]*: scheduling file .mod2-2/sub2-2/file2-2. for addition +${PROG} [a-z]*: use '${PROG} commit' to add these files permanently" + + dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \ +"${PROG} [a-z]*: Examining mod1 +${PROG} [a-z]*: Examining mod1-2 +${PROG} [a-z]*: Examining mod2 +${PROG} [a-z]*: Examining mod2/sub2 +${PROG} [a-z]*: Examining mod2-2 +${PROG} [a-z]*: Examining mod2-2/sub2-2 +RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v +done +Checking in mod1/file1; +${CVSROOT_DIRNAME}/mod1/file1,v <-- file1 +initial revision: 1.1 +done +RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v +done +Checking in mod1-2/file1-2; +${CVSROOT_DIRNAME}/mod1-2/file1-2,v <-- file1-2 +initial revision: 1.1 +done +RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v +done +Checking in mod2/sub2/file2; +${CVSROOT_DIRNAME}/mod2/sub2/file2,v <-- file2 +initial revision: 1.1 +done +RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v +done +Checking in mod2-2/sub2-2/file2-2; +${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v <-- file2-2 +initial revision: 1.1 +done" + # Finished creating the modules -- clean up. + rm -rf CVS mod1 mod1-2 mod2 mod2-2 + # Done. + + ################################################## + ## Start the dizzying array of possibilities. + ## Begin with each module type separately. + ################################################## + + # Pattern -- after each checkout, first check the top-level + # CVS directory. Then, check the directories in numerical + # order. + + dotest cvsadm-3 "${testcvs} co 1mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1" + dotest cvsadm-3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-3d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 1mod + + dotest cvsadm-4 "${testcvs} co 2mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2" + dotest cvsadm-4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-4d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 2mod + + dotest cvsadm-5 "${testcvs} co 1d1mod" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1" + dotest cvsadm-5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-5d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir1d1 + + dotest cvsadm-6 "${testcvs} co 1d2mod" \ +"${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2" + dotest cvsadm-6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-6d "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir1d2 + + dotest cvsadm-7 "${testcvs} co 2d1mod" \ +"${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + dotest cvsadm-7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-7d "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir2d1 + + dotest cvsadm-8 "${testcvs} co 2d2mod" \ +"${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + dotest cvsadm-8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-8d "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir2d2 + + ################################################## + ## You are in a shell script of twisted little + ## module combination statements, all alike. + ################################################## + + ### 1mod + + dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating 1mod-2 +U 1mod-2/file1-2" + # the usual for the top level + dotest cvsadm-9b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-9d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1mod copy + dotest cvsadm-9f "cat 1mod-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS 1mod 1mod-2 + + # 1mod 2mod redmod bluemod + dotest cvsadm-10 "${testcvs} co 1mod 2mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating 2mod +U 2mod/file2" + # the usual for the top level + dotest cvsadm-10b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-10d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2dmod + dotest cvsadm-10f "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 1mod 2mod + + dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1" + # the usual for the top level + dotest cvsadm-11b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-11d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d1mod + dotest cvsadm-11f "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 1mod dir1d1 + + dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2" + # the usual for the top level + dotest cvsadm-12b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-12d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d2mod + dotest cvsadm-12f "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 1mod dir1d2 + + dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + # the usual for the top level + dotest cvsadm-13b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-13d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-13f "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 1mod dir2d1 + + dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1 +${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + # the usual for the top level + dotest cvsadm-14b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-14d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-14f "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 1mod dir2d2 + + + ### 2mod + + dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2 +${PROG} [a-z]*: Updating 2mod-2 +U 2mod-2/file2-2" + # the usual for the top level + dotest cvsadm-15b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-15d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2mod copy + dotest cvsadm-15f "cat 2mod-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS 2mod 2mod-2 + + + dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2 +${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1" + # the usual for the top level + dotest cvsadm-16b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-16d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d1mod + dotest cvsadm-16f "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 2mod dir1d1 + + dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2 +${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2" + # the usual for the top level + dotest cvsadm-17b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-17d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d2mod + dotest cvsadm-17f "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 2mod dir1d2 + + dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2 +${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + # the usual for the top level + dotest cvsadm-18b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-18d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d1mod + dotest cvsadm-18f "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 2mod dir2d1 + + dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2 +${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + # the usual for the top level + dotest cvsadm-19b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-19d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-19f "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 2mod dir2d2 + + + ### 1d1mod + + dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1 +${PROG} [a-z]*: Updating dir1d1-2 +U dir1d1-2/file1-2" + # the usual for the top level + dotest cvsadm-20b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-20d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d1mod copy + dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS dir1d1 dir1d1-2 + + dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1 +${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2" + # the usual for the top level + dotest cvsadm-21b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-21d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d2mod + dotest cvsadm-21f "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir1d1 dir1d2 + + dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1 +${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + # the usual for the top level + dotest cvsadm-22b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-22d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-22f "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir1d1 dir2d1 + + dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1 +${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + # the usual for the top level + dotest cvsadm-23b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-23d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-23f "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir1d1 dir2d2 + + + ### 1d2mod + + dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \ +"${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2 +${PROG} [a-z]*: Updating dir1d2-2 +U dir1d2-2/file2-2" + # the usual for the top level + dotest cvsadm-24b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-24d "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d2mod copy + dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS dir1d2 dir1d2-2 + + dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2 +${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + # the usual for the top level + dotest cvsadm-25b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-25d "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d1mod + dotest cvsadm-25f "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir1d2 dir2d1 + + dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2 +${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + # the usual for the top level + dotest cvsadm-26b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-26d "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-26f "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir1d2 dir2d2 + + + # 2d1mod + + dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \ +"${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1 +${PROG} [a-z]*: Updating dir2d1-2/sub2d1-2 +U dir2d1-2/sub2d1-2/file1-2" + # the usual for the top level + dotest cvsadm-27b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2d1mod + dotest cvsadm-27d "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS dir2d1 dir2d1-2 + + dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1 +${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + # the usual for the top level + dotest cvsadm-28b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2d1mod + dotest cvsadm-28d "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-28h "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir2d1 dir2d2 + + + # 2d2mod + + dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \ +"${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2 +${PROG} [a-z]*: Updating dir2d2-2/sub2d2-2 +U dir2d2-2/sub2d2-2/file2-2" + # the usual for the top level + dotest cvsadm-29b "cat CVS/Repository" \ +"${AREP}\." + # the usual for 2d2mod + dotest cvsadm-29d "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS dir2d2 dir2d2-2 + + ################################################## + ## And now, all of that again using the "-d" flag + ## on the command line. + ################################################## + + dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file1" + dotest cvsadm-1d3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d3d "cat dir/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file2" + dotest cvsadm-1d4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d4d "cat dir/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file1" + dotest cvsadm-1d5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d5d "cat dir/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file2" + dotest cvsadm-1d6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d6d "cat dir/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file1" + dotest cvsadm-1d7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d7d "cat dir/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \ +"${PROG} [a-z]*: Updating dir +U dir/file2" + dotest cvsadm-1d8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-1d8d "cat dir/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + ################################################## + ## Los Combonaciones + ################################################## + + ### 1mod + + dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/1mod-2 +U dir/1mod-2/file1-2" + # the usual for the top level + dotest cvsadm-1d9b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d9d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1mod copy + dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS dir + + # 1mod 2mod redmod bluemod + dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2" + dotest cvsadm-1d10b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d10d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2dmod + dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1" + dotest cvsadm-1d11b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d11d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d1mod + dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2" + dotest cvsadm-1d12b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d12d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d2mod + dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1" + dotest cvsadm-1d13b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d13d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1 +${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-1d14b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d14d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1mod + dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + + ### 2mod + + dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2 +${PROG} [a-z]*: Updating dir/2mod-2 +U dir/2mod-2/file2-2" + dotest cvsadm-1d15b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d15d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2mod copy + dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS dir + + dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2 +${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1" + dotest cvsadm-1d16b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d16d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d1mod + dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2 +${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2" + dotest cvsadm-1d17b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d17d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d2mod + dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2 +${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1" + dotest cvsadm-1d18b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d18d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d1mod + dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2 +${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-1d19b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d19d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2mod + dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + + ### 1d1mod + + dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \ +"${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1 +${PROG} [a-z]*: Updating dir/dir1d1-2 +U dir/dir1d1-2/file1-2" + dotest cvsadm-1d20b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d20d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d1mod copy + dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS dir + + dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \ +"${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1 +${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2" + dotest cvsadm-1d21b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d21d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 1d2mod + dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1 +${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1" + dotest cvsadm-1d22b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d22d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1 +${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-1d23b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d23d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d1mod + dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + + ### 1d2mod + + dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \ +"${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2 +${PROG} [a-z]*: Updating dir/dir1d2-2 +U dir/dir1d2-2/file2-2" + dotest cvsadm-1d24b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d24d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 1d2mod copy + dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS dir + + dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \ +"${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2 +${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1" + dotest cvsadm-1d25b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d25d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d1mod + dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2 +${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-1d26b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d26d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 1d2mod + dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + + # 2d1mod + + dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \ +"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1 +${PROG} [a-z]*: Updating dir/dir2d1-2/sub2d1-2 +U dir/dir2d1-2/sub2d1-2/file1-2" + dotest cvsadm-1d27b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d27d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2d1mod + dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d1mod + dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \ +"${AREP}mod1-2" + rm -rf CVS dir + + dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1 +${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-1d28b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d28d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2d1mod + dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + # the usual for 2d2mod + dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + + # 2d2mod + + dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \ +"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2 +${PROG} [a-z]*: Updating dir/dir2d2-2/sub2d2-2 +U dir/dir2d2-2/sub2d2-2/file2-2" + dotest cvsadm-1d29b "cat CVS/Repository" \ +"${AREP}\." + # the usual for the dir level + dotest cvsadm-1d29d "cat dir/CVS/Repository" \ +"${AREP}\." + # the usual for 2d2mod + dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + # the usual for 2d2mod + dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \ +"${AREP}mod2-2/sub2-2" + rm -rf CVS dir + + ################################################## + ## And now, some of that again using the "-d" flag + ## on the command line, but use a longer path. + ################################################## + + dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file1" + dotest cvsadm-2d3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d3d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file2" + dotest cvsadm-2d4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d4d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file1" + dotest cvsadm-2d5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d5d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file2" + dotest cvsadm-2d6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d6d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file1" + dotest cvsadm-2d7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d7d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2 +U dir/dir2/file2" + dotest cvsadm-2d8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-2d8d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + ################################################## + ## And now, a few of those tests revisited to + ## test the behavior of the -N flag. + ################################################## + + dotest cvsadm-N3 "${testcvs} co -N 1mod" \ +"${PROG} [a-z]*: Updating 1mod +U 1mod/file1" + dotest cvsadm-N3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N3d "cat 1mod/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS 1mod + + dotest cvsadm-N4 "${testcvs} co -N 2mod" \ +"${PROG} [a-z]*: Updating 2mod +U 2mod/file2" + dotest cvsadm-N4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N4d "cat 2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS 2mod + + dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \ +"${PROG} [a-z]*: Updating dir1d1 +U dir1d1/file1" + dotest cvsadm-N5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N5d "cat dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir1d1 + + dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \ +"${PROG} [a-z]*: Updating dir1d2 +U dir1d2/file2" + dotest cvsadm-N6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N6d "cat dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir1d2 + + dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \ +"${PROG} [a-z]*: Updating dir2d1/sub2d1 +U dir2d1/sub2d1/file1" + dotest cvsadm-N7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N7d "cat dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir2d1 + + dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \ +"${PROG} [a-z]*: Updating dir2d2/sub2d2 +U dir2d2/sub2d2/file2" + dotest cvsadm-N8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N8d "cat dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir2d2 + + ## the ones in one-deep directories + + dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \ +"${PROG} [a-z]*: Updating dir/1mod +U dir/1mod/file1" + dotest cvsadm-N1d3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d3d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \ +"${PROG} [a-z]*: Updating dir/2mod +U dir/2mod/file2" + dotest cvsadm-N1d4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d4d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \ +"${PROG} [a-z]*: Updating dir/dir1d1 +U dir/dir1d1/file1" + dotest cvsadm-N1d5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d5d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \ +"${PROG} [a-z]*: Updating dir/dir1d2 +U dir/dir1d2/file2" + dotest cvsadm-N1d6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d6d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \ +"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1 +U dir/dir2d1/sub2d1/file1" + dotest cvsadm-N1d7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d7d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2 +U dir/dir2d2/sub2d2/file2" + dotest cvsadm-N1d8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d8d "cat dir/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + ## the ones in two-deep directories + + dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \ +"${PROG} [a-z]*: Updating dir/dir2/1mod +U dir/dir2/1mod/file1" + dotest cvsadm-N2d3b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d3d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \ +"${PROG} [a-z]*: Updating dir/dir2/2mod +U dir/dir2/2mod/file2" + dotest cvsadm-N2d4b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d4d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \ +"${PROG} [a-z]*: Updating dir/dir2/dir1d1 +U dir/dir2/dir1d1/file1" + dotest cvsadm-N2d5b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d5d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2/dir1d2 +U dir/dir2/dir1d2/file2" + dotest cvsadm-N2d6b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d6d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \ +"${PROG} [a-z]*: Updating dir/dir2/dir2d1/sub2d1 +U dir/dir2/dir2d1/sub2d1/file1" + dotest cvsadm-N2d7b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d7d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d7f "cat dir/dir2/dir2d1/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \ +"${AREP}mod1" + rm -rf CVS dir + + dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \ +"${PROG} [a-z]*: Updating dir/dir2/dir2d2/sub2d2 +U dir/dir2/dir2d2/sub2d2/file2" + dotest cvsadm-N2d8b "cat CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d8d "cat dir/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" \ +"${AREP}\." + dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" \ +"${AREP}CVSROOT/Emptydir" + dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \ +"${AREP}mod2/sub2" + rm -rf CVS dir + + ################################################## + ## That's enough of that, thank you very much. + ################################################## + + # remove our junk + cd .. + rm -rf 1 + rm -rf ${CVSROOT_DIRNAME}/1mod + rm -rf ${CVSROOT_DIRNAME}/1mod-2 + rm -rf ${CVSROOT_DIRNAME}/2mod + rm -rf ${CVSROOT_DIRNAME}/2mod-2 + ;; + + diffmerge1) + # Make sure CVS can merge correctly in circumstances where it + # used to mess up (due to a bug which existed in diffutils 2.7 + # and 2.6, but not 2.5, and which has been fixed in CVS's diff + # lib by Paul Eggert, bless his bitty heart). + + # This first test involves two working copies, "mine" and + # "yours", checked out from the same repository at the same + # time. In yours, you remove some text from the end of the + # file and check it in; meanwhile, "me" has commented out some + # lines earlier in the file, and I go to check it in right + # after you checked yours in. CVS naturally tells me the file + # is not up-to-date, so I run cvs update, but it updates + # incorrectly, leaving in the lines of text you just deleted. + # Bad! I'm in too much of a hurry to actually look at the + # file, so I check it in and go home, and so your changes have + # been lost. Later you discover this, and you suspect me of + # deliberately sabotaging your work, so you let all the air + # out of my tires. Only after a series of expensive lawsuits + # and countersuits do we discover it this was all CVS's + # fault. + # + # Luckily, this problem has been fixed now, as our test will + # handily confirm, no doubt: + + # First make a repository containing the original text: + + # We should be here anyway, but cd to it just in case: + cd ${TESTDIR} + + mkdir diffmerge1 + cd diffmerge1 + + # The text of the file is inlined here because `echo' loses + # newlines, and I don't know how portable the -e flag is. + # + # This is the file we both start out with: + echo "// Button.java + +package random.application; + +import random.util.star; + +public class Button +{ + /star Instantiates a Button with origin (0, 0) and zero width and height. + star You must call an initializer method to properly initialize the Button. + star/ + public Button () + { + super (); + + _titleColor = Color.black; + _disabledTitleColor = Color.gray; + _titleFont = Font.defaultFont (); + } + + /star Convenience constructor for instantiating a Button with + star bounds x, y, width, and height. Equivalent to + star foo = new Button (); + star foo.init (x, y, width, height); + star/ + public Button (int x, int y, int width, int height) + { + this (); + init (x, y, width, height); + } +}" > the_file + + dotest diffmerge1_import \ + "${testcvs} import -m import diffmerge1 tag1 tag2" \ + "${DOTSTAR}No conflicts created by this import" + cd .. + rm -rf diffmerge1 + + # Check out two working copies, one for "you" and one for "me" + ${testcvs} checkout diffmerge1 >/dev/null 2>&1 + mv diffmerge1 diffmerge1_yours + ${testcvs} checkout diffmerge1 >/dev/null 2>&1 + mv diffmerge1 diffmerge1_mine + + # In your working copy, you'll remove the Button() method, and + # then check in your change before I check in mine: + cd diffmerge1_yours + echo "// Button.java + +package random.application; + +import random.util.star; + +public class Button +{ + /star Instantiates a Button with origin (0, 0) and zero width and height. + star You must call an initializer method to properly initialize the Button. + star/ + public Button () + { + super (); + + _titleColor = Color.black; + _disabledTitleColor = Color.gray; + _titleFont = Font.defaultFont (); + } +}" > the_file + dotest diffmerge1_yours \ + "${testcvs} ci -m yours" \ + "${DOTSTAR}hecking in ${DOTSTAR}" + + # My working copy still has the Button() method, but I + # comment out some code at the top of the class. Then I + # update, after both my modifications and your checkin: + cd ../diffmerge1_mine + echo "// Button.java + +package random.application; + +import random.util.star; + +public class Button +{ + /star Instantiates a Button with origin (0, 0) and zero width and height. + star You must call an initializer method to properly initialize the Button. + star/ + public Button () + { + super (); + + // _titleColor = Color.black; + // _disabledTitleColor = Color.gray; + // _titleFont = Font.defaultFont (); + } + + /star Convenience constructor for instantiating a Button with + star bounds x, y, width, and height. Equivalent to + star foo = new Button (); + star foo.init (x, y, width, height); + star/ + public Button (int x, int y, int width, int height) + { + this (); + init (x, y, width, height); + } +}" > the_file + dotest diffmerge1_mine \ + "${testcvs} update" \ + "${DOTSTAR}erging${DOTSTAR}" + + # So if your changes didn't make it into my working copy, or + # in any case if the file does not look like the final text as + # quoted below, then the test flunks: + echo "// Button.java + +package random.application; + +import random.util.star; + +public class Button +{ + /star Instantiates a Button with origin (0, 0) and zero width and height. + star You must call an initializer method to properly initialize the Button. + star/ + public Button () + { + super (); + + // _titleColor = Color.black; + // _disabledTitleColor = Color.gray; + // _titleFont = Font.defaultFont (); + } +}" > comp_me + dotest diffmerge1_cmp "cmp the_file comp_me" '' + + # Clean up after ourselves: + cd .. + rm -rf diffmerge1_yours diffmerge1_mine ${CVSROOT_DIRNAME}/diffmerge1 + + ;; + + diffmerge2) + + # FIXME: This test should be rewritten to be much more concise. + # It currently weighs in at something like 600 lines, but the + # same thing could probably be tested in more like 50-100 lines. + mkdir diffmerge2 + + # This tests for another diffmerge bug reported by Martin + # Tomes; actually, his bug was probably caused by an initial + # fix for the bug in test diffmerge1, and likely wasn't ever + # a problem in CVS as long as one was using a normal + # distribution of diff or a version of CVS that has the diff + # lib in it. + # + # Nevertheless, once burned twice cautious, so we test for his + # bug here. + # + # Here is his report, more or less verbatim: + # ------------------------------------------ + # + # Put the attached file (sgrid.h,v) into your repository + # somewhere, check out the module and do this: + # + # cvs update -j Review_Phase_2_Enhancements sgrid.h + # cvs diff -r Review_V1p3 sgrid.h + # + # As there have been no changes made on the trunk there + # should be no differences, however this is output: + # + # % cvs diff -r Review_V1p3 sgrid.h + # Index: sgrid.h + # =================================================================== + # RCS file: /usr/local/repository/play/fred/sgrid.h,v + # retrieving revision 1.1.2.1 + # diff -r1.1.2.1 sgrid.h + # 178a179,184 + # > /*-------------------------------------------------------------- + # > INLINE FUNCTION : HORIZONTALLINES + # > NOTES : Description at the end of the file + # > ----------------------------------------------------------------*/ + # > uint16 horizontalLines( void ); + # > + # + # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those + # differences to sgrid.h version 1.1 and got the correct result + # so it looks like the built in patch is faulty. + # ------------------------------------------------------------------- + # + # This is the RCS file, sgrid.h,v, that he sent: + + echo "head 1.1; +access; +symbols + Review_V1p3:1.1.2.1 + Review_V1p3C:1.1.2.1 + Review_1p3A:1.1.2.1 + Review_V1p3A:1.1.2.1 + Review_Phase_2_Enhancements:1.1.0.2 + Review_V1p2:1.1 + Review_V1p2B:1.1 + Review_V1p2A:1.1 + Review_V1p1:1.1 + Review_1p1:1.1; +locks; strict; +comment @ * @; + + +1.1 +date 97.04.02.11.20.05; author colinl; state Exp; +branches + 1.1.2.1; +next ; + +1.1.2.1 +date 97.06.09.10.00.07; author colinl; state Exp; +branches; +next ; + + +desc +@@ + + +1.1 +log +@Project: DEV1175 +DCN: +Tested By: Colin Law +Reviewed By: +Reason for Change: Initial Revision of all files + +Design Change Details: + +Implications: +@ +text +@/* \$""Header: L:/gpanels/dis/sgrid.h_v 1.1.1.0 24 Jan 1996 14:59:20 PAULT \$ */ +/* + * \$""Log: L:/gpanels/dis/sgrid.h_v \$ + * + * Rev 1.1.1.0 24 Jan 1996 14:59:20 PAULT + * Branched + * + * Rev 1.1 24 Jan 1996 12:09:52 PAULT + * Consolidated 4100 code merged to trunk + * + * Rev 1.0.2.0 01 Jun 1995 14:18:58 DAVEH + * Branched + * + * Rev 1.0 19 Apr 1995 16:32:48 COLINL + * Initial revision. +*/ +/***************************************************************************** +FILE : SGRID.H +VERSION : 2.1 +AUTHOR : Dave Hartley +SYSTEM : Borland C++ +DESCRIPTION : The declaration of the scrolling grid class + +*****************************************************************************/ +#if !defined(__SGRID_H) +#define __SGRID_H + +#if !defined(__SCROLL_H) +#include <scroll.h> +#endif + +#if !defined(__GKI_H) +#include \"gki.h\" +#endif + +#if defined PRINTING_SUPPORT +class Printer; +#endif + +/***************************************************************************** +CLASS : ScrollingGrid +DESCRIPTION: This class inherits from a grid and a scrollable, and + can therefore use all the PUBLIC services provided by these + classes. A description of these can be found in + GRID.H and SCROLL.H. + A scrolling grid is a set of horizontal and vertical lines + that scroll and continually update to provide a complete grid + +*****************************************************************************/ + +class ScrollingGrid : public Scrollable +{ + public: +#if defined _WINDOWS +/*--------------------------------------------------------------------------- +FUNCTION : CONSTRUCTOR +DESCRIPTION : sets up the details of the grid, ready for painting +ARGUMENTS : name : sgColour + - the colour of the grid + sgLineType + - the syle of line + sgHorizontalTotal + - the total number of horizontal grid lines + verticalSpacingMin + - the min distance between the vertical grid lines + on the scrolling axis + currentTimestamp + - timestamp value now + ticksPerSecond + - number of timestamp ticks per second + ticksPerPixel + - number of timestamp ticks per pixel required + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, + uint16 sgHorizontalTotal, + uint16 verticalSpacingMin, uint32 currentTimestamp, + uint16 ticksPerSecond, uint32 ticksPerPixel ); +#else +/*--------------------------------------------------------------------------- +FUNCTION : CONSTRUCTOR +DESCRIPTION : sets up the details of the grid, ready for painting +ARGUMENTS : name : sgColour + - the colour of the grid + sgLineType + - the syle of line + sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 ) + - the total number of horizontal grid lines + sgVerticalSpacing + - the distance between the vertical grid lines + on the scrolling axis + +RETURN : None +NOTES : If the caller does not get the total grid lines value, synced + with the overall size of the viewport, the spacing between + grid lines will not be consistent. + +---------------------------------------------------------------------------*/ + ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType + , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing ); +#endif +/*--------------------------------------------------------------------------- +FUNCTION : DESTRUCTOR +DESCRIPTION : tidies it all up +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + ~ScrollingGrid( void ); + +/*--------------------------------------------------------------------------- +FUNCTION : ATTACH +DESCRIPTION : This service overloads the base class service, as it does + additional work at the time of attachment. + +ARGUMENTS : name : tDrawingArea + - the scrolled viewport to attach this trend to + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void attach( SViewport *tDrawingArea ); + +#if defined _WINDOWS +/*--------------------------------------------------------------------------- +FUNCTION : calculateVerticalSpacing +DESCRIPTION : determines optimum spacing along time axis +ARGUMENTS : +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void calculateVerticalSpacing(); + +/*--------------------------------------------------------------------------- +FUNCTION : gridSpacingTicks +DESCRIPTION : Provides the grid spacing in the time axis in ticks +ARGUMENTS : +RETURN : Number of ticks +NOTES : +---------------------------------------------------------------------------*/ + uint32 gridSpacingTicks(); + +#endif + +/*--------------------------------------------------------------------------- +INLINE FUNCTION : HORIZONTALLINES +NOTES : Description at the end of the file +---------------------------------------------------------------------------*/ + uint16 horizontalLines( void ); + +#if defined _WINDOWS +// In Windows the OnDraw() function replaces paint() +/*--------------------------------------------------------------------------- +FUNCTION : ScrollingGrid OnDraw +DESCRIPTION : Paints the given area of the grid. + Pure virtual +ARGUMENTS : pDC pointer to the device context to use for display + Note that the device context operates in the coords + of the window owning the viewport +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + virtual void OnDraw( CDC *pDC ); + +#else // not Windows + +/*--------------------------------------------------------------------------- +FUNCTION : PAINT +DESCRIPTION : This extends the standard grid paint method to paint the + viewport relative to its current position. + +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paint( void ); +#endif + +/*--------------------------------------------------------------------------- +FUNCTION : P A I N T T E X T M A R K E R S +DESCRIPTION : this service allow the text markers to be painted seperatley + from the grid lines + +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paintTextMarkers(); + +#if defined PRINTING_SUPPORT +/*--------------------------------------------------------------------------- +FUNCTION : P R I N T +DESCRIPTION : This print service prints a grid marker ( being either a + timestamp or a date, IF there is one at the plot position + given + +ARGUMENTS : name : + displayPosition + - Where in the log to look to see if there is an + entry to print + + - printerPtr + the printer to print to + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void print( uint16 currentPrintPos, Printer *printerPtr ); +#endif + +/*--------------------------------------------------------------------------- +FUNCTION : S E T D R I V E D I R E C T I O N +DESCRIPTION : Sets direction for update and scrolling forwards or backwards +ARGUMENTS : direction - required direction +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void setDriveDirection( ScrollDirection direction ); + +/*--------------------------------------------------------------------------- +FUNCTION : S E T U P +DESCRIPTION : service that will setup the grid prior to a paint + +ARGUMENTS : name : + - newTimestamp + + + - newTimeBase + the number of ticks that represent a plot point on + the trendgraph. + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void setup( uint32 newTimestamp, uint32 newTimeBase ); + +#if defined PRINTING_SUPPORT +/*--------------------------------------------------------------------------- +FUNCTION : S E T U P F O R P R I N T +DESCRIPTION : This service iis to be called prior to printing. It allows + the grid to prepare its markers ready for the print + commands + +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void setupForPrint(); +#endif + +/*--------------------------------------------------------------------------- +FUNCTION : UPDATE +DESCRIPTION : When this service is called it will calculate what needs to + be painted and fill in the display again. + +ARGUMENTS : name : timeStamp + - the reference time of this update. + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void update( uint32 timeStamp ); + +/*--------------------------------------------------------------------------- +FUNCTION : U P D A T E B U F F E R +DESCRIPTION : When a display update is not required, use this method. It + updates the internal data ready for a call to paint that + will then show the grid in the right position + +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void updateBuffer( void ); + + private: + +/*--------------------------------------------------------------------------- +FUNCTION : M A K E G R I D M A R K E R +DESCRIPTION : service that perpares a string for display. The string will + either be a short date, or short time. this is determined + by the current setting of the dateMarker flag + +ARGUMENTS : name : timestampVal + - the value to convert + + storePtr + - the place to put the string + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void makeGridMarker( uint32 timestampVal, char *storePtr ); + +/*--------------------------------------------------------------------------- +FUNCTION : P A I N T G R I D M A R K E R +DESCRIPTION : given a position will put the string on the display + +ARGUMENTS : name : + yPos + - were it goes on the Y-axis + + gridMarkerPtr + - what it is + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paintGridMarker( uint16 yPos, char *gridMarkerPtr ); + +#if defined _WINDOWS +/*--------------------------------------------------------------------------- +FUNCTION : PAINTHORIZONTALLINES +DESCRIPTION : responsible for painting the grids horizontal lines +ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing. + in viewport coords + pDC pointer to device context to use + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC ); +#else +/*--------------------------------------------------------------------------- +FUNCTION : PAINTHORIZONTALLINES +DESCRIPTION : responsible for painting the grids horizontal lines +ARGUMENTS : name: xStart + - the starting X co-ordinate for the horizontal line + xEnd + - the ending X co-ordinate for the horizontal line + +RETURN : None +NOTES : Remember lines are drawn from origin. The origin in a + horizontal viewport will be the top. +---------------------------------------------------------------------------*/ + void paintHorizontalLines( uint16 xStart, uint16 xEnd ); +#endif + +#if defined _WINDOWS +/*--------------------------------------------------------------------------- +FUNCTION : PAINTVERTICALLINES +DESCRIPTION : responsible for painting the grids vertical lines +ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing. + in viewport coords + offset offset from rhs that rightmost line would be + drawn if rectangle included whole viewport + pDC pointer to device context to use +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset, + CDC* pDC ); +#else +/*--------------------------------------------------------------------------- +FUNCTION : PAINTVERTICALLINES +DESCRIPTION : responsible for painting the grids vertical lines +ARGUMENTS : name : yStart + - the starting Y co-ordinate for the vertical line + yEnd + - the ending Y co-ordinate for the vertical line + offset + - a starting point offset that determines at what X + position the first line will be drawn + + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset ); +#endif + +#if defined _WINDOWS +/*--------------------------------------------------------------------------- +FUNCTION : PAINTVERTICALLINE +DESCRIPTION : paints one line at the position specified, and length +ARGUMENTS : name : yStart + - the starting point on the y axis for the line + yEnd + - the end point on the y axis for the line + xPosition + - The horizontal offset from the start of the viewport + pDC pointer to device context to use + +RETURN : None +NOTES : There is not an equivalent horizontal method as yet. This + is a seperate method because the service is useful to a + derivation of this class +---------------------------------------------------------------------------*/ + void paintVerticalLine( uint16 yStart, uint16 yEnd + , uint16 xPosition, CDC *pDC ); +#else +/*--------------------------------------------------------------------------- +FUNCTION : PAINTVERTICALLINE +DESCRIPTION : paints one line at the position specified, and length +ARGUMENTS : name : yStart + - the starting point on the y axis for the line + yEnd + - the end point on the y axis for the line + xPosition + - The horizontal offset from the start of the viewport + +RETURN : None +NOTES : There is not an equivalent horizontal method as yet. This + is a seperate method because the service is useful to a + derivation of this class +---------------------------------------------------------------------------*/ + void paintVerticalLine( uint16 yStart, uint16 yEnd + , uint16 xPosition ); +#endif + +/*--------------------------------------------------------------------------- +INLINE FUNCTION : VERTICALSPACING +NOTES : Description at the end of the file +---------------------------------------------------------------------------*/ + uint16 verticalSpacing( void ); + + + // Position in viewport that we are now writing to if going forwards + // Note that if this is greater than viewport length then we have + // just scrolled and value must be adjusted before use. + sint16 forwardsOutputPosition; + + // Position in viewport that we are now writing to if going backwards + // Note that if this is less than zero then we have + // just scrolled and value must be adjusted before use. + sint16 backwardsOutputPosition; + + // position in grid cycle of forwards output position. + // if zero then it is time to output a grid line + sint16 forwardsIntervalCount; + + // position in grid cycle of forwards output position. + // if zero then it is time to output a grid line + sint16 backwardsIntervalCount; + + uint32 lastUpdateTimestamp; + uint32 timeBase; // ticks per pixel + uint16 currentOutputPosition; + uint16 gridTimestampSpacing; + uint16 intervalCount; + uint16 horizontalTotal; + uint16 vSpacing; +#if defined PRINTING_SUPPORT + uint16 numberOfGridMarkersPrinted; +#endif + bool firstTime; // indicates first time through + bool dateMarker; + + GkiLineType lineType; + GkiColour gridColour; + + #if defined _WINDOWS + uint16 ticksPerSec; // number of time ticks per second + uint16 vSpacingMin; // minimum pixels per division along time axis + CPen *pPen; // the pen to use for drawing in windows + #endif + +}; + + +/***************************************************************************** + I N L I N E F U N C T I O N S +*****************************************************************************/ + +/*--------------------------------------------------------------------------- +FUNCTION : HORIZONTALLINES +DESCRIPTION : supplies the number of horizontal lines in the grid +ARGUMENTS : name : + +RETURN : +NOTES : +---------------------------------------------------------------------------*/ +inline uint16 ScrollingGrid::horizontalLines( void ) +{ + return( horizontalTotal ); +} +/*--------------------------------------------------------------------------- +FUNCTION : VERTICALSPACING +DESCRIPTION : returns the distance between adjacent vertical lines +ARGUMENTS : name : + +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ +inline uint16 ScrollingGrid::verticalSpacing( void ) +{ + return( vSpacing ); +} + +#endif +@ + + +1.1.2.1 +log +@DEV1194:DS4 Provision of major and minor grid lines +@ +text +@d1 1 +a1 1 +/* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */ +d3 1 +a3 12 + * \$""Log: sgrid.h,v \$ + * Revision 1.1 1997/04/02 11:20:05 colinl + * Project: DEV1175 + * DCN: + * Tested By: Colin Law + * Reviewed By: + * Reason for Change: Initial Revision of all files + * + * Design Change Details: + * + * Implications: + * +d58 6 +a63 5 +ARGUMENTS : name : majorColour colour for major grid lines + minorColour colour for minor grid lines + sgLineType line type for minor grid lines + yMajorGridLines number of major y lines on grid + yMinorGridLines number of major y lines on grid +d77 2 +a78 3 + ScrollingGrid( GkiColour majorColour, GkiColour minorColour, + GkiLineType sgLineType, + uint16 yMajorGridLines, uint16 yMinorGridLines, +a137 17 +FUNCTION : DrawHorizontalGridLines + +DESCRIPTION : Draws major or minor grid lines +ARGUMENTS : pDC device context + pPen pen to use + numLines total lines required + yLow, yHigh, xLow, xHigh rectangle to draw in + yMax max y value +RETURN : None +NOTES : +---------------------------------------------------------------------------*/ + void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, + uint16 numLines, + uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, + uint16 yMax ); + +/*--------------------------------------------------------------------------- +d148 6 +d448 1 +a448 2 + uint16 m_yMajorGridLines; + uint16 m_yMinorGridLines; +d456 2 +a457 3 + GkiLineType lineType; // line type for minor grid lines + GkiColour m_majorColour; + GkiColour m_minorColour; +d462 1 +a462 2 + CPen *pMajorPen; // pen to use for drawing major grid lines + CPen *pMinorPen; // pen to use for drawing minor grid lines +d472 12 +@" > diffmerge2/sgrid.h,v + + # We have to put the RCS file in the repository by hand for + # this test: + mkdir ${CVSROOT_DIRNAME}/diffmerge2 + cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v + rm -rf diffmerge2 + dotest diffmerge2_co \ + "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}" + cd diffmerge2 + dotest diffmerge2_update \ + "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \ + "${DOTSTAR}erging ${DOTSTAR}" + # This is the one that counts -- there should be no output: + dotest diffmerge2_diff \ + "${testcvs} diff -r Review_V1p3 sgrid.h" '' + ;; *) @@ -6891,7 +13461,6 @@ echo "OK, all tests completed." # * Test all flags in modules file. # Test that ciprog gets run both on checkin in that directory, or a # higher-level checkin which recurses into it. -# * More tests of keyword expansion. # * Test operations on a directory that contains other directories but has # no files of its own. # * -t global option @@ -6909,7 +13478,8 @@ echo "OK, all tests completed." # same). # * Test that remote edit and/or unedit works when disconnected from # server (e.g. set CVS_SERVER to "foobar"). -# * Test things to do with the CVS/* files, esp. CVS/Root.... +# * Test the contents of adm files other than Root and Repository. +# Entries seems the next most important thing. # End of TODO list. # Remove the test directory, but first change out of it. diff --git a/gnu/usr.bin/cvs/src/scramble.c b/gnu/usr.bin/cvs/src/scramble.c index 07094a6cb2e..77376faa82b 100644 --- a/gnu/usr.bin/cvs/src/scramble.c +++ b/gnu/usr.bin/cvs/src/scramble.c @@ -50,23 +50,23 @@ */ static unsigned char -shifts[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 114, 120, -53, 79, 96, 109, 72, 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52, -75, 119, 49, 34, 82, 81, 95, 65, 112, 86, 118, 110, 122, 105, 41, 57, -83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123, 91, 35, 125, 55, -54, 66, 124, 126, 59, 47, 92, 71, 115, 78, 88, 107, 106, 56, 36, 121, -117, 104, 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, 58, 113, -32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85, 223, 225, 216, -187, 166, 229, 189, 222, 188, 141, 249, 148, 200, 184, 136, 248, 190, -199, 170, 181, 204, 138, 232, 218, 183, 255, 234, 220, 247, 213, 203, -226, 193, 174, 172, 228, 252, 217, 201, 131, 230, 197, 211, 145, 238, -161, 179, 160, 212, 207, 221, 254, 173, 202, 146, 224, 151, 140, 196, -205, 130, 135, 133, 143, 246, 192, 159, 244, 239, 185, 168, 215, 144, -139, 165, 180, 157, 147, 186, 214, 176, 227, 231, 219, 169, 175, 156, -206, 198, 129, 164, 150, 210, 154, 177, 134, 127, 182, 128, 158, 208, -162, 132, 167, 209, 149, 241, 153, 251, 237, 236, 171, 195, 243, 233, -253, 240, 194, 250, 191, 155, 142, 137, 245, 235, 163, 242, 178, 152 }; +shifts[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 114,120, 53, 79, 96,109, 72,108, 70, 64, 76, 67,116, 74, 68, 87, + 111, 52, 75,119, 49, 34, 82, 81, 95, 65,112, 86,118,110,122,105, + 41, 57, 83, 43, 46,102, 40, 89, 38,103, 45, 50, 42,123, 91, 35, + 125, 55, 54, 66,124,126, 59, 47, 92, 71,115, 78, 88,107,106, 56, + 36,121,117,104,101,100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, + 58,113, 32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85,223, + 225,216,187,166,229,189,222,188,141,249,148,200,184,136,248,190, + 199,170,181,204,138,232,218,183,255,234,220,247,213,203,226,193, + 174,172,228,252,217,201,131,230,197,211,145,238,161,179,160,212, + 207,221,254,173,202,146,224,151,140,196,205,130,135,133,143,246, + 192,159,244,239,185,168,215,144,139,165,180,157,147,186,214,176, + 227,231,219,169,175,156,206,198,129,164,150,210,154,177,134,127, + 182,128,158,208,162,132,167,209,149,241,153,251,237,236,171,195, + 243,233,253,240,194,250,191,155,142,137,245,235,163,242,178,152 }; /* SCRAMBLE and DESCRAMBLE work like this: @@ -85,57 +85,56 @@ shifts[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, /* Return a malloc'd, scrambled version of STR. */ char * scramble (str) - char *str; + char *str; { - int i; - char *s; + int i; + char *s; - /* +2 to hold the 'A' prefix that indicates which version of - * scrambling this is (the first, obviously, since we only do one - * kind of scrambling so far), and then the '\0' of course. - */ - s = (char *) xmalloc (strlen (str) + 2); + /* +2 to hold the 'A' prefix that indicates which version of + scrambling this is (the first, obviously, since we only do one + kind of scrambling so far), and then the '\0' of course. */ + s = (char *) xmalloc (strlen (str) + 2); - s[0] = 'A'; /* Scramble (TM) version prefix. */ - strcpy (s + 1, str); + /* Scramble (TM) version prefix. */ + s[0] = 'A'; + strcpy (s + 1, str); - for (i = 1; s[i]; i++) - s[i] = shifts[(unsigned char)(s[i])]; + for (i = 1; s[i]; i++) + s[i] = shifts[(unsigned char)(s[i])]; - return s; + return s; } /* Decode the string in place. */ char * descramble (str) - char *str; + char *str; { - char *s; - int i; + char *s; + int i; - /* For now we can only handle one kind of scrambling. In the future - * there may be other kinds, and this `if' will become a `switch'. - */ - if (str[0] != 'A') + /* For now we can only handle one kind of scrambling. In the future + there may be other kinds, and this `if' will become a `switch'. */ + if (str[0] != 'A') #ifndef DIAGNOSTIC - error (1, 0, "descramble: unknown scrambling method"); + error (1, 0, "descramble: unknown scrambling method"); #else /* DIAGNOSTIC */ - { - fprintf (stderr, "descramble: unknown scrambling method\n", str); - fflush (stderr); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "descramble: unknown scrambling method\n", str); + fflush (stderr); + exit (EXIT_FAILURE); + } #endif /* DIAGNOSTIC */ - /* Method `A' is symmetrical, so scramble again to decrypt. */ - s = scramble (str + 1); + /* Method `A' is symmetrical, so scramble again to decrypt. */ + s = scramble (str + 1); - /* Shift the whole string one char to the left, pushing the unwanted - 'A' off the left end. Safe, because s is null-terminated. */ - for (i = 0; s[i]; i++) - s[i] = s[i + 1]; + /* Shift the whole string one char to the left, pushing the unwanted + 'A' off the left end. Safe, because s is null-terminated. */ + for (i = 0; s[i]; i++) + s[i] = s[i + 1]; - return s; + return s; } #endif /* (AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT) from top of file */ @@ -144,38 +143,38 @@ descramble (str) int main () { - int i; - char *e, *m, biggie[256]; - - char *cleartexts[5]; - cleartexts[0] = "first"; - cleartexts[1] = "the second"; - cleartexts[2] = "this is the third"; - cleartexts[3] = "$#% !!\\3"; - cleartexts[4] = biggie; - - /* Set up the most important test string: */ - /* Can't have a real ASCII zero in the string, because we want to - use printf, so we substitute the character zero. */ - biggie[0] = '0'; - /* The rest of the string gets straight ascending ASCII. */ - for (i = 1; i < 256; i++) - biggie[i] = i; - - /* Test all the strings. */ - for (i = 0; i < 5; i++) + int i; + char *e, *m, biggie[256]; + + char *cleartexts[5]; + cleartexts[0] = "first"; + cleartexts[1] = "the second"; + cleartexts[2] = "this is the third"; + cleartexts[3] = "$#% !!\\3"; + cleartexts[4] = biggie; + + /* Set up the most important test string: */ + /* Can't have a real ASCII zero in the string, because we want to + use printf, so we substitute the character zero. */ + biggie[0] = '0'; + /* The rest of the string gets straight ascending ASCII. */ + for (i = 1; i < 256; i++) + biggie[i] = i; + + /* Test all the strings. */ + for (i = 0; i < 5; i++) { - printf ("clear%d: %s\n", i, cleartexts[i]); - e = scramble (cleartexts[i]); - printf ("scram%d: %s\n", i, e); - m = descramble (e); - free (e); - printf ("clear%d: %s\n\n", i, m); - free (m); + printf ("clear%d: %s\n", i, cleartexts[i]); + e = scramble (cleartexts[i]); + printf ("scram%d: %s\n", i, e); + m = descramble (e); + free (e); + printf ("clear%d: %s\n\n", i, m); + free (m); } - fflush (stdout); - return 0; + fflush (stdout); + return 0; } #endif /* DIAGNOSTIC */ diff --git a/gnu/usr.bin/cvs/src/status.c b/gnu/usr.bin/cvs/src/status.c index cdc09493601..98be085fb6c 100644 --- a/gnu/usr.bin/cvs/src/status.c +++ b/gnu/usr.bin/cvs/src/status.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Status Information */ @@ -26,6 +26,7 @@ static const char *const status_usage[] = "\t-v\tVerbose format; includes tag information for the file\n", "\t-l\tProcess this directory only (not recursive).\n", "\t-R\tProcess directories recursively.\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; @@ -77,13 +78,21 @@ status (argc, argv) send_arg("-l"); send_file_names (argc, argv, SEND_EXPAND_WILD); - /* Note that by setting SEND_NO_CONTENTS, we do prevent the + + /* For a while, we tried setting SEND_NO_CONTENTS here so this + could be a fast operation. That prevents the server from updating our timestamp if the timestamp is - unchanged and the file is unmodified. And I think it is a - user-visible thing in that case (shows "locally modified" - instead of "up to date" I would think). But the speed seems - to be worth it. */ - send_files (argc, argv, local, 0, SEND_NO_CONTENTS); + changed but the file is unmodified. Worse, it is user-visible + (shows "locally modified" instead of "up to date" if + timestamp is changed but file is not). And there is no good + workaround (you might not want to run "cvs update"; "cvs -n + update" doesn't update CVS/Entries; "cvs diff --brief" or + something perhaps could be made to work but somehow that + seems nonintuitive to me even if so). Given that timestamps + seem to have the potential to get munged for any number of + reasons, it seems better to not rely too much on them. */ + + send_files (argc, argv, local, 0, 0); send_to_server ("status\012", 0); err = get_responses_and_close (); @@ -243,7 +252,7 @@ status_fileproc (callerdat, finfo) { char *branch = NULL; - if (RCS_isbranch (finfo->rcs, edata->tag)) + if (RCS_nodeisbranch (finfo->rcs, edata->tag)) branch = RCS_whatbranch(finfo->rcs, edata->tag); cvs_output (" Sticky Tag:\t\t", 0); @@ -328,7 +337,7 @@ tag_list_proc (p, closure) char *branch = NULL; char *buf; - if (RCS_isbranch (xrcsnode, p->key)) + if (RCS_nodeisbranch (xrcsnode, p->key)) branch = RCS_whatbranch(xrcsnode, p->key) ; buf = xmalloc (80 + strlen (p->key) diff --git a/gnu/usr.bin/cvs/src/tag.c b/gnu/usr.bin/cvs/src/tag.c index 93e6c6723fc..a97da5c1237 100644 --- a/gnu/usr.bin/cvs/src/tag.c +++ b/gnu/usr.bin/cvs/src/tag.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. * * Tag * @@ -63,11 +63,13 @@ static const char *const tag_usage[] = "\t-l\tLocal directory only, not recursive.\n", "\t-R\tProcess directories recursively.\n", "\t-d\tDelete the given tag.\n", - "\t-[rD]\tExisting tag or date.\n", + "\t-r rev\tExisting revision/tag.\n", + "\t-D\tExisting date.\n", "\t-f\tForce a head revision if specified tag not found.\n", "\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n", "\t-F\tMove tag if it already exists.\n", "\t-c\tCheck that working files are unmodified.\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; @@ -370,11 +372,10 @@ pretag_proc(repository, filter) } free(s); } - run_setup("%s %s %s %s", - filter, - symtag, - delete_flag ? "del" : force_tag_move ? "mov" : "add", - repository); + run_setup (filter); + run_arg (symtag); + run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add"); + run_arg (repository); walklist(tlist, pretag_list_proc, NULL); return (run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY)); } @@ -480,7 +481,7 @@ tag_fileproc (callerdat, finfo) } free (version); - if ((retcode = RCS_deltag(vers->srcfile, symtag, 1)) != 0) + if ((retcode = RCS_deltag(vers->srcfile, symtag)) != 0) { if (!quiet) error (0, retcode == -1 ? errno : 0, @@ -489,6 +490,7 @@ tag_fileproc (callerdat, finfo) freevers_ts (&vers); return (1); } + RCS_rewrite (vers->srcfile, NULL, NULL); /* warm fuzzies */ if (!really_quiet) @@ -554,7 +556,7 @@ tag_fileproc (callerdat, finfo) (int *) NULL); if (oversion != NULL) { - int isbranch = RCS_isbranch (finfo->rcs, symtag); + int isbranch = RCS_nodeisbranch (finfo->rcs, symtag); /* * if versions the same and neither old or new are branches don't have @@ -598,6 +600,7 @@ tag_fileproc (callerdat, finfo) freevers_ts (&vers); return (1); } + RCS_rewrite (vers->srcfile, NULL, NULL); /* more warm fuzzies */ if (!really_quiet) @@ -752,6 +755,11 @@ Numeric tag %s contains characters other than digits and '.'", name); || strcmp (name, TAG_HEAD) == 0) return; + /* FIXME: This routine doesn't seem to do any locking whatsoever + (and it is called from places which don't have locks in place). + If two processes try to write val-tags at the same time, it would + seem like we are in trouble. */ + mytag.dptr = name; mytag.dsize = strlen (name); diff --git a/gnu/usr.bin/cvs/src/vers_ts.c b/gnu/usr.bin/cvs/src/vers_ts.c index 613e52eb21e..bae3a43c661 100644 --- a/gnu/usr.bin/cvs/src/vers_ts.c +++ b/gnu/usr.bin/cvs/src/vers_ts.c @@ -3,7 +3,7 @@ * Copyright (c) 1989-1992, Brian Berliner * * You may distribute under the terms of the GNU General Public License as - * specified in the README file that comes with the CVS 1.4 kit. + * specified in the README file that comes with the CVS source distribution. */ #include "cvs.h" @@ -12,14 +12,16 @@ static void time_stamp_server PROTO((char *, Vers_TS *, Entnode *)); #endif -/* - * Fill in and return a Vers_TS structure "user" is the name of the local - * file; entries is the entries file - preparsed for our pleasure. rcs is - * the current source control file - preparsed for our pleasure. - */ +/* Fill in and return a Vers_TS structure for the file FINFO. TAG and + DATE are from the command line. */ + Vers_TS * Version_TS (finfo, options, tag, date, force_tag_match, set_time) struct file_info *finfo; + + /* Keyword expansion options, I think generally from the command + line. Can be either NULL or "" to indicate none are specified + here. */ char *options; char *tag; char *date; @@ -57,6 +59,18 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time) { entdata = (Entnode *) p->data; + if (entdata->type == ENT_SUBDIR) + { + /* According to cvs.texinfo, the various fields in the Entries + file for a directory (other than the name) do not have a + defined meaning. We need to pass them along without getting + confused based on what is in them. Therefore we make sure + not to set vn_user and the like from Entries, add.c and + perhaps other code will expect these fields to be NULL for + a directory. */ + vers_ts->entdata = entdata; + } + else #ifdef SERVER_SUPPORT /* An entries line with "D" in the timestamp indicates that the client sent Is-modified without sending Entry. So we want to @@ -79,22 +93,25 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time) if (!(sdtp && sdtp->aflag)) vers_ts->date = xstrdup (entdata->date); } - if (!options || (options && *options == '\0')) - { - if (!(sdtp && sdtp->aflag)) - vers_ts->options = xstrdup (entdata->options); - } vers_ts->entdata = entdata; } + /* Even if we don't have an "entries line" as such + (vers_ts->entdata), we want to pick up options which could + have been from a Kopt protocol request. */ + if (!options || (options && *options == '\0')) + { + if (!(sdtp && sdtp->aflag)) + vers_ts->options = xstrdup (entdata->options); + } } /* * -k options specified on the command line override (and overwrite) * options stored in the entries file */ - if (options) + if (options && *options != '\0') vers_ts->options = xstrdup (options); - else if (!vers_ts->options) + else if (!vers_ts->options || *vers_ts->options == '\0') { if (finfo->rcs != NULL) { @@ -175,7 +192,7 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time) * get the Date the revision was checked in. If "user" exists, set * its mtime. */ - if (set_time) + if (set_time && vers_ts->vn_rcs != NULL) { #ifdef SERVER_SUPPORT if (server_active) @@ -186,15 +203,18 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time) struct utimbuf t; memset (&t, 0, sizeof (t)); - if (vers_ts->vn_rcs) + t.modtime = + RCS_getrevtime (rcsdata, vers_ts->vn_rcs, 0, 0); + if (t.modtime != (time_t) -1) { - t.modtime = - RCS_getrevtime (rcsdata, vers_ts->vn_rcs, 0, 0); - if (t.modtime != (time_t) -1) - { - t.actime = t.modtime; - (void) utime (finfo->file, &t); - } + t.actime = t.modtime; + + /* This used to need to ignore existence_errors + (for cases like where update.c now clears + set_time if noexec, but didn't used to). I + think maybe now it doesn't (server_modtime does + not like those kinds of cases). */ + (void) utime (finfo->file, &t); } } } diff --git a/gnu/usr.bin/cvs/src/version.c b/gnu/usr.bin/cvs/src/version.c index c44217985a3..1f77f585e90 100644 --- a/gnu/usr.bin/cvs/src/version.c +++ b/gnu/usr.bin/cvs/src/version.c @@ -12,7 +12,7 @@ #include "cvs.h" -char *version_string = "\nConcurrent Versions System (CVS) 1.9.10"; +char *version_string = "\nConcurrent Versions System (CVS) 1.9.24"; #ifdef CLIENT_SUPPORT #ifdef SERVER_SUPPORT diff --git a/gnu/usr.bin/cvs/src/watch.c b/gnu/usr.bin/cvs/src/watch.c index 6cec1573621..d9ba1d74171 100644 --- a/gnu/usr.bin/cvs/src/watch.c +++ b/gnu/usr.bin/cvs/src/watch.c @@ -24,6 +24,7 @@ const char *const watch_usage[] = "-R (on/off/add/remove): Process directories recursively\n", "-a (add/remove): Specify what actions, one of\n", " edit,unedit,commit,all,none\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; @@ -417,6 +418,7 @@ static const char *const watchers_usage[] = "Usage: %s %s [-lR] [files...]\n", "\t-l\tProcess this directory only (not recursive).\n", "\t-R\tProcess directories recursively.\n", + "(Specify the --help global option for a list of other help options)\n", NULL }; diff --git a/gnu/usr.bin/cvs/vms/ChangeLog b/gnu/usr.bin/cvs/vms/ChangeLog index 26d000dceed..153bde3cd8a 100644 --- a/gnu/usr.bin/cvs/vms/ChangeLog +++ b/gnu/usr.bin/cvs/vms/ChangeLog @@ -1,3 +1,57 @@ +Tue Jan 13 13:17:33 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (DIFF, RCSBIN_DFLT): Remove; no longer used. + +Sat Dec 27 16:57:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (HAVE_RCS5): Remove; no longer used. + + * config.h (LINES_CRLF_TERMINATED): Remove; no longer used. + +Sat Nov 29 22:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + See lib/ChangeLog for rationale: + * options.h: Remove declaration of getwd + * getwd.c: Implement xgetwd not getwd. + * stat.c: Call xgetwd not getwd. + +Thu Sep 25 15:26:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * misc.c, misc.h (fatal, xmalloc, xrealloc): Remove; nowhere used. + + * ndir.c, ndir.h: Change return type of closedir from void to int. + + * config.h (HAVE_NDIR_H): Define. + * vms.h: Add comment about the include of ndir.h. + * ndir.h: Protect against multiple inclusion. + +Tue, 9 Sep 1997 Jim Kingdon + + * config.h: Define HAVE_VPRINTF. + + * pwd.h, vms.h: Define pid_t and mode_t. + +Tue Sep 9 18:53:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * pwd.h, pwd.c: Remove getpwnam per change to expand_path. + * config.h: Define GETPWNAM_MISSING. + + * pwd.c (getpwuid): Declare argument as unsigned int not uid_t. + + * config.h (SYSTEM_GETCALLER): Define. + * pwd.c (getpwuid, getpwnam): Always return NULL (see comment + for rationale). + * options.h: Don't define CVS_BADROOT. + * pwd.h: Nuke uid_t and related changes. + + * filesubr.c (fnfold): Further expand comment about how to handle + filenames like "y.tab.c". + +Sun Sep 7 17:38:58 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * config.h (HAVE_STRDUP): Remove; not used anywhere. + * misc.h, misc.c: Remove strdup per change to ../configure.in. + Sun Jun 8 23:42:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com> * config.h (HAVE_MKFIFO): Remove; not used anywhere. diff --git a/gnu/usr.bin/cvs/vms/config.h b/gnu/usr.bin/cvs/vms/config.h index a22a3738cf1..63e7d6251e6 100644 --- a/gnu/usr.bin/cvs/vms/config.h +++ b/gnu/usr.bin/cvs/vms/config.h @@ -15,9 +15,6 @@ /* More issues with how VMS names files, kind of a kludge. See login.c. */ #define NO_SLASH_AFTER_HOME 1 -/* Only good for NT or DOS with hacked open */ -/* #undef LINES_CRLF_TERMINATED */ - /* Define to empty if the keyword does not work. */ /* #undef const */ @@ -47,7 +44,7 @@ /* #undef mode_t */ /* Define if you don't have <dirent.h>, but have <ndir.h>. */ -/* #undef NDIR */ +#define HAVE_NDIR_H 1 /* Define to `int' if <sys/types.h> doesn't define. */ /* #undef pid_t */ @@ -113,9 +110,6 @@ /* Define if you have the rename function */ #define HAVE_RENAME 1 -/* Define if you have the strdup function */ -#define HAVE_STRDUP 1 - /* Define if you have the putenv function. */ /* #undef HAVE_PUTENV */ @@ -126,7 +120,7 @@ #define HAVE_VFORK /* Define if you have the vprintf function. */ -/* #undef HAVE_VPRINTF */ +#define HAVE_VPRINTF /* Define if you have the <errno.h> header file. */ /* #undef HAVE_ERRNO_H */ @@ -186,6 +180,8 @@ extern void fnfold (char *FILENAME); #define NO_SOCKET_TO_FD 1 #define START_SERVER_RETURNS_SOCKET 1 #define SEND_NEVER_PARTIAL 1 +#define SYSTEM_GETCALLER() getlogin () +#define GETPWNAM_MISSING 1 /* Avoid name conflicts with VMS libraries. */ #define getopt cvs_getopt diff --git a/gnu/usr.bin/cvs/vms/filesubr.c b/gnu/usr.bin/cvs/vms/filesubr.c index 1c0e6246d4e..affca1a6d01 100644 --- a/gnu/usr.bin/cvs/vms/filesubr.c +++ b/gnu/usr.bin/cvs/vms/filesubr.c @@ -754,7 +754,10 @@ fncmp (const char *n1, const char *n2) rather than "canonical form"). The idea is that files we create would get thusly munged, but CVS can cope with their names being different the same way that the NT port copes with it if the user - renames a file from "foo" to "FOO". */ + renames a file from "foo" to "FOO". + + Alternately, this kind of handling could/should go into CVS_FOPEN + and friends (if we want to do it like the Mac port, anyway). */ void fnfold (char *filename) { diff --git a/gnu/usr.bin/cvs/vms/getwd.c b/gnu/usr.bin/cvs/vms/getwd.c index db1e9c56913..7bbdc55e27e 100644 --- a/gnu/usr.bin/cvs/vms/getwd.c +++ b/gnu/usr.bin/cvs/vms/getwd.c @@ -1,6 +1,23 @@ +/* This program 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. + + This program 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. */ + #include <unixlib.h> -char *getwd(char *pathname) +#include "cvs.h" + +/* Return the current directory, newly allocated, arbitrarily long. + Return NULL and set errno on error. */ +char * +xgetwd () { - return getcwd(pathname, 256, 0); + char pathname[256]; + + return xstrdup (getcwd (pathname, sizeof (pathname) - 2, 0)); } diff --git a/gnu/usr.bin/cvs/vms/misc.c b/gnu/usr.bin/cvs/vms/misc.c index 82e9c70c423..cc564ec1c99 100644 --- a/gnu/usr.bin/cvs/vms/misc.c +++ b/gnu/usr.bin/cvs/vms/misc.c @@ -27,42 +27,6 @@ #include <ctype.h> #include <lib$routines.h> -/* Print message and force core dump (unix) or traceback (vms) - * These are taken from other GNU software more-or-less as-is - */ -void fatal (char *s) -{ - int *x; - printf ("%s\n", s); - lib$signal(44); -} - -/* GNU's lib implementation (alloca.c) is more portable, so I disabled these - for this distribution (benjamin@cyclic.com) */ -#ifdef USE_VMSLIB_MEMORY_ALLOCATION -void *xmalloc (int size) -{ - register void *val; - /* Avoid failure if malloc (0) returns 0. */ - if (size == 0) - size = 1; - val = (void *) malloc (size); - if (!val) fatal ("xmalloc: can't satisfy request"); - return val; -} - -void *xrealloc (void *block, int size) -{ - register void *val; - /* Avoid failure if malloc (0) returns 0. */ - if (size == 0) - size = 1; - val = (void *) realloc (block, size); - if (!val) fatal ("xrealloc: can't satisfy request"); - return val; -} -#endif - /* See in misc.h why it is done like this. */ void x_free (void *block) { @@ -80,12 +44,6 @@ char *downcase (char *s) return (s); } -char *strdup (char *src) { - char *dst = (char*) xmalloc (strlen(src) + 1); - strcpy (dst, src); - return (dst); -} - char *strndup (char *src, int len) { char *dst = (char *) xmalloc (len + 1); strncpy (dst, src, len); diff --git a/gnu/usr.bin/cvs/vms/misc.h b/gnu/usr.bin/cvs/vms/misc.h index 35a48ccc154..e92596c7556 100644 --- a/gnu/usr.bin/cvs/vms/misc.h +++ b/gnu/usr.bin/cvs/vms/misc.h @@ -17,9 +17,6 @@ * GNU General Public License for more details. */ -void fatal (); -void *xmalloc (); -void *xrealloc (); void x_free(); /* This is a trick, because the linker wants uppercase symbols, and in that case, xfree is confused with Xfree, which is bad. */ @@ -29,7 +26,6 @@ void x_free(); * Some string utilities. */ char *downcase (); -char *strdup (); char *strndup (); int fixpath (); diff --git a/gnu/usr.bin/cvs/vms/ndir.c b/gnu/usr.bin/cvs/vms/ndir.c index a9758eae1dd..99c85121190 100644 --- a/gnu/usr.bin/cvs/vms/ndir.c +++ b/gnu/usr.bin/cvs/vms/ndir.c @@ -181,7 +181,7 @@ opendir (infilename, filepattern) return (DIR *) dirp; /* I had to cast, for VMS sake. */ } -void +int closedir (dirp) register DIR *dirp; /* stream from opendir */ { @@ -195,6 +195,7 @@ closedir (dirp) } xfree ((char *) dirp); + return 0; } struct direct dir_static; /* simulated directory contents */ diff --git a/gnu/usr.bin/cvs/vms/ndir.h b/gnu/usr.bin/cvs/vms/ndir.h index 1bc59f708b6..21ad429f2a7 100644 --- a/gnu/usr.bin/cvs/vms/ndir.h +++ b/gnu/usr.bin/cvs/vms/ndir.h @@ -1,9 +1,12 @@ /* <ndir.h> -- definitions for 4.2BSD-compatible directory access - last edit: 28-dec-1994 Richard Levitte + 28-dec-1994 Richard Levitte + See ChangeLog for more recent modification history. */ +#ifndef NDIR_H + #if 0 #ifndef FAB$C_BID #include <fab.h> @@ -52,6 +55,9 @@ extern struct direct *readdir(); extern long telldir(); extern void seekdir(); #endif -extern void closedir(); +extern int closedir(); #define rewinddir( dirp ) seekdir( dirp, 0L ) + +#define NDIR_H 1 +#endif /* ndir.h */ diff --git a/gnu/usr.bin/cvs/vms/options.h b/gnu/usr.bin/cvs/vms/options.h index a53091e0aeb..b2eb89bec3f 100644 --- a/gnu/usr.bin/cvs/vms/options.h +++ b/gnu/usr.bin/cvs/vms/options.h @@ -16,18 +16,6 @@ */ /* - * CVS provides the most features when used in conjunction with the Version-5 - * release of RCS. Thus, it is the default. This also assumes that GNU diff - * Version-1.15 is being used as well -- you will have to configure your RCS - * V5 release separately to make this the case. If you do not have RCS V5 and - * GNU diff V1.15, comment out this define. You should not try mixing and - * matching other combinations of these tools. - */ -#ifndef HAVE_RCS5 -#define HAVE_RCS5 -#endif - -/* * For portability and heterogeneity reasons, CVS is shipped by default using * my own text-file version of the ndbm database library in the src/myndbm.c * file. If you want better performance and are not concerned about @@ -38,23 +26,6 @@ #endif /* - * The "diff" program to execute when creating patch output. This "diff" - * must support the "-c" option for context diffing. Specify a full - * pathname if your site wants to use a particular diff. If you are - * using the GNU version of diff (version 1.15 or later), this should - * be "diff -a". - * - * NOTE: this program is only used for the ``patch'' sub-command (and - * for ``update'' if you are using the server). The other commands - * use rcsdiff which will use whatever version of diff was specified - * when rcsdiff was built on your system. - */ - -#ifndef DIFF -#define DIFF "/usr/local/bin/diff -a" -#endif - -/* * The "patch" program to run when using the CVS server and accepting * patches across the network. Specify a full pathname if your site * wants to use a particular patch. @@ -63,35 +34,6 @@ #define PATCH_PROGRAM "patch" #endif -/* - * By default, RCS programs are executed with the shell or through execlp(), - * so the user's PATH environment variable is searched. If you'd like to - * bind all RCS programs to a certain directory (perhaps one not in most - * people's PATH) then set the default in RCSBIN_DFLT. Note that setting - * this here will cause all RCS programs to be executed from this directory, - * unless the user overrides the default with the RCSBIN environment variable - * or the "-b" option to CVS. - * - * If you use the password-authenticating server, then you need to - * make sure that the server can find the RCS programs to invoke them. - * The authenticating server starts out running as root, and then - * switches to run as the appropriate user once authentication is - * complete. But no actual shell is ever started by that user, so the - * PATH environment variable may not contain the directory with the - * RCS binaries, even though if that user logged in normally, PATH - * would include the directory. - * - * One way to solve this problem is to set RCSBIN_DFLT here. An - * alternative is to make sure that root has the right directory in - * its path already. Another, probably better alternative is to - * specify -b in /etc/inetd.conf. - * - * This define should be either the empty string ("") or a full pathname to the - * directory containing all the installed programs from the RCS distribution. */ -#ifndef RCSBIN_DFLT -#define RCSBIN_DFLT "" -#endif - /* Directory used for storing temporary files, if not overridden by environment variables or the -T global option. There should be little need to change this (-T is a better mechanism if you need to use a @@ -176,18 +118,16 @@ /* #define CVS_FUDGELOCKS */ #endif -/* - * When committing a permanent change, CVS and RCS make a log entry of - * who committed the change. If you are committing the change logged in - * as "root" (not under "su" or other root-priv giving program), CVS/RCS - * cannot determine who is actually making the change. - * - * As such, by default, CVS disallows changes to be committed by users - * logged in as "root". You can disable this option by commenting - * out the lines below. - */ +/* There is some pretty unixy code in src/commit.c which tries to + prevent people from commiting changes as "root" (which would prevent + CVS from making a log entry with the actual user). On VMS, I suppose + one could say that SYSTEM is equivalent, but I would think that it + actually is not necessary; at least at the VMS sites I've worked at + people just used their own accounts (turning privileges on and off + as desired). */ + #ifndef CVS_BADROOT -#define CVS_BADROOT +/* #define CVS_BADROOT */ #endif /* @@ -243,9 +183,5 @@ extern void exit (); #endif -#ifndef getwd -extern char *getwd (); -#endif - #define NO_SOCKET_TO_FD 1 #include "vms.h" diff --git a/gnu/usr.bin/cvs/vms/pwd.c b/gnu/usr.bin/cvs/vms/pwd.c index 97b5c5ca1b1..5d81194e1a6 100644 --- a/gnu/usr.bin/cvs/vms/pwd.c +++ b/gnu/usr.bin/cvs/vms/pwd.c @@ -4,22 +4,13 @@ static struct passwd pw; -struct passwd *getpwuid(uid_t uid) +/* This is only called from one relevant place, lock.c. In that context + the code is really trying to figure out who owns a directory. Nothing + which has anything to do with getpwuid or anything of the sort can help + us on VMS (getuid returns only the group part of the UIC). */ +struct passwd *getpwuid(unsigned int uid) { - pw.pw_name = getlogin(); - pw.pw_uid = getuid(); - pw.pw_gid = getgid(); - - return &pw; -} - -struct passwd *getpwnam(char *name) -{ - pw.pw_name = getlogin(); - pw.pw_uid = getuid(); - pw.pw_gid = getgid(); - - return &pw; + return NULL; } char *getlogin() diff --git a/gnu/usr.bin/cvs/vms/pwd.h b/gnu/usr.bin/cvs/vms/pwd.h index 3ca5dbce872..857d75188f7 100644 --- a/gnu/usr.bin/cvs/vms/pwd.h +++ b/gnu/usr.bin/cvs/vms/pwd.h @@ -1,17 +1,20 @@ #ifndef _PWD_H #define _PWD_H -#include <sys/types.h> +/* Trying to declare uid_t is a mess. We tried #include <sys/types.h>, which + only worked on VAX (VMS 6.2, I think), and we tried defining it here + which only worked on alpha, I think. In any event, the VMS C library's + concept of uid_t is fundamentally broken anyway (getuid() returns only + the group part of the UIC), so we are better off with higher-level + hooks like get_homedir and SYSTEM_GETCALLER. */ + +#define pid_t int struct passwd { char *pw_name; - uid_t pw_uid; - gid_t pw_gid; - char *pw_dir; - }; +}; -struct passwd *getpwuid(uid_t); -struct passwd *getpwnam(char *); +struct passwd *getpwuid(/* really uid_t, but see above about declaring it */); char *getlogin(void); #else diff --git a/gnu/usr.bin/cvs/vms/stat.c b/gnu/usr.bin/cvs/vms/stat.c index af3b5acc3af..661df75c215 100644 --- a/gnu/usr.bin/cvs/vms/stat.c +++ b/gnu/usr.bin/cvs/vms/stat.c @@ -12,9 +12,16 @@ struct stat *buffer; strcpy(statpath, path); strip_trailing_slashes (statpath); if(strcmp(statpath, ".") == 0) - getwd(statpath); + { + char *wd; + wd = xgetwd (); + rs = stat (wd, buffer); + free (wd); + } + else + rs = stat (statpath, buffer); - if ((rs = stat (statpath, buffer)) < 0) + if (rs < 0) { /* If stat() fails try again after appending ".dir" to the filename this allows you to stat things like "bloogle/CVS" from VMS 6.1 */ diff --git a/gnu/usr.bin/cvs/vms/vms.h b/gnu/usr.bin/cvs/vms/vms.h index 9cd0b509eb7..d41e196be44 100644 --- a/gnu/usr.bin/cvs/vms/vms.h +++ b/gnu/usr.bin/cvs/vms/vms.h @@ -1,5 +1,7 @@ /* Determined from CC RTL function prototypes in online documentation */ +#define mode_t unsigned int + #define fork(x) vfork(x) #include <sys/types.h> @@ -15,7 +17,12 @@ extern int fnmatch(char *pattern, char *string, int options); +/* With the define of HAVE_NDIR_H in config.h, lib/system.h and + diff/system.h should include ndir.h for us. But I'm too lazy to + track down and make _sure_ all bases are covered, so I'm leaving in + this include for now. */ #include "ndir.h" + #include "pwd.h" #include "pipe.h" diff --git a/gnu/usr.bin/cvs/windows-NT/ChangeLog b/gnu/usr.bin/cvs/windows-NT/ChangeLog index 806b73a3345..7b73005f3c3 100644 --- a/gnu/usr.bin/cvs/windows-NT/ChangeLog +++ b/gnu/usr.bin/cvs/windows-NT/ChangeLog @@ -1,3 +1,132 @@ +Fri Jan 16 00:57:31 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * sanity.sh: Remove. As far as I know the Windows hacks in this + file have been superceded by improvements to Cygwin and/or Ian's + recent changes to src/sanity.sh. The ones I noticed: we had been + working around lack of /dev/null (apprently Cygwin now has it); we + had been not expecting rm -rf to delete readonly files (apparently + it now does); there was an issue with case of arguments passed on + command line (it would seem like Cygwin has changed this). + I also notice that the file had not even been in the distribution + because it was missing from Makefile.in (ugh). + +13 Jan 1998 Jim Kingdon + + * run.c (run_exec): Change parameters from char * to const char *. + +Tue Jan 13 16:57:56 1998 Ian Lance Taylor <ian@cygnus.com> + + * config.h (FOLD_FN_CHAR): Don't define; instead move to + lib/system.h, where it is defined conditionally. + (FILENAMES_CASE_INSENSITIVE, ISDIRSEP): Likewise. + (WNT_filename_classes, fncmp, fnfold): Likewise for declarations. + * filesubr.c (WNT_filename_classes): Remove; now in lib/fncase.c. + (fncmp, fnfold): Likewise. + +Tue Jan 13 13:15:34 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c: Adjust run_setup for new calling convention. + + * config.h (DIFF): Remove; no longer used. + * options.h (DIFF, RCSBIN_DFLT): Remove; no longer used. + +Wed Dec 31 10:56:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * config.h, filesubr.c (convert_file): Remove; no longer used + (except for BROKEN_READWRITE_CONVERSION which doesn't apply). + +Sat Dec 27 16:57:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h (HAVE_RCS5): Remove; no longer used. + + * config.h (LINES_CRLF_TERMINATED): Remove; no longer used. + +Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Change bug-cvs address from prep.ai.mit.edu to gnu.org + per email from Martin Hamilton. + +Sun Nov 30 18:03:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (run_args): Remove; nowhere used. + +Sat Nov 29 22:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * options.h: Remove declaration of getwd; see lib/ChangeLog for + rationale. + +Wed, 12 Nov 1997 Jim Kingdon + + * config.h: Define same_file. + +Sun, 9 Nov 1997 Jim Kingdon + + * config.h: Define HAVE_SETMODE. + +Mon Nov 10 11:15:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c (call_diff, call_diff3): Removed, per change to + src/rcscmds.c. + +Fri Oct 31 16:52:30 1997 Abe Feldman + + * config.h: Define UTIME_EXPECTS_WRITABLE. + +Tue Oct 28 14:50:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * run.c: Also define call_diff and call_diff3. + +Sat Sep 13 20:13:09 1997 <Martin.Sjoelin@ubs.ch> + indentation/whitespace fixes by Jim Kingdon + + * run.c (quote): quote any " included in argument string to + avoid having ci choke on message string format. + +Sun Sep 7 19:59:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Add section on coding standards (win32, ANSI, &c). + +Fri Aug 29 19:13:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * filesubr.c (isabsolute): Add comment about interaction with + strip_trailing_slashes (reported by Jin S Choi <jsc@w3health.com>). + +Thu Aug 28 12:06:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * filesubr.c (link_file): Remove #if 0'd version; the real version + is elsewhere in this file. + +Sun Aug 10 21:08:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * ndir.c, ndir.h, pwd.c, pwd.h: Remove $Header; we decided to + get rid of these some time ago. + +Sun Aug 3 21:14:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Note KLUDGE_FOR_WNT_TESTSUITE when discussing tests. + +Fri Jul 18 09:49:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README: Adjust discussion of makefiles to deal with Visual C++ + 5.x. One doesn't need patch if client and server are current. + +10 Jul 1997 Jim Kingdon + + * config.h: Define USE_SETMODE_STDOUT. + +8 Jul 1997 Jim Kingdon + + * rcmd.c (rcmd_authenticate): With error message, print the + user names that we were attempting to use. + * win32.c (win32getlogin): If GetUserName returns "", return + NULL. + +Sun, 22 Jun 1997 Jim Kingdon + + * win32.c: Also include winsock.h. + Include stdlib.h (for exit()). + * rcmd.c: Move include of cvs.h above test of HAVE_WINSOCK_H. + Tue Jun 17 16:35:06 1997 Jim Kingdon (unknown@beezley) * rcmd.c: Check HAVE_WINSOCK_H in figuring out which files diff --git a/gnu/usr.bin/cvs/windows-NT/README b/gnu/usr.bin/cvs/windows-NT/README index 2a821746b4b..60321e659a1 100644 --- a/gnu/usr.bin/cvs/windows-NT/README +++ b/gnu/usr.bin/cvs/windows-NT/README @@ -19,22 +19,29 @@ distribution's top directory. At least with the tar port I'm using, the sources get extracted without carriage returns and you must add carriage returns to the end of every line in cvsnt.mak. I also had to add them to src/server.c. It doesn't seem to be necessary to add them -to any other file. This makefile was generated with Visual C++ 2.1. -As far as is known, it should work with Visual C++ 4.0 also. - -Send bug reports to bug-cvs@prep.ai.mit.edu. - -This port passes all of the tests in src/sanity.sh, save the one that -deals with reserved all-upper-case tags (BASE and HEAD), due to a -limitation in the NT command shell. sanity.sh provides pretty minimal -feature coverage, but still gives me some confidence it isn't totally -broken. - -To operate in client mode, you will need GNU patch. To do compressed -transfers with old versions of CVS (1.8 and older), you also need -gzip. Note that you do NOT need an rsh client if you are using the -:server: access method (which uses the internal rsh client), except -perhaps for debugging. +to any other file. This makefile was generated with Visual C++ 4.x. +For Visual C++ 5.x use cvsnet.dsp (which is probably more likely to be +up to date than cvsnt.mak anyway). For Visual C++ 2.x you probably +are in the position of digging through old versions of CVS for a +cvsnt.mak and then updating it. Feel free to let us know about +problems of this sort as with other bug reports; our impression thus +far is that relatively few people care about which versions of Visual +C++ work. + +Send bug reports to bug-cvs@gnu.org. + +As of May 1996, this port passed all of the tests in src/sanity.sh, +save the one that deals with reserved all-upper-case tags (BASE and +HEAD), due to a limitation in the NT command shell. sanity.sh +provides pretty minimal feature coverage, but still gives me some +confidence it isn't totally broken. The tests were run by defining +KLUDGE_FOR_WNT_TESTSUITE (see src/main.c). + +To operate in client mode with old versions of CVS (1.9 and older), +you will need GNU patch. To do compressed transfers with old versions +of CVS (1.8 and older), you also need gzip. Note that you do NOT need +an rsh client if you are using the :server: access method (which uses +the internal rsh client), except perhaps for debugging. To operate in local mode, you will need GNU patch, GNU diffutils, and rcs version 5.7 installed on your system. Make @@ -100,3 +107,22 @@ The following harmless warnings are known: .\lib\getdate.c(1612) : warning C4102: 'yynewstate' : unreferenced label +CODING STANDARDS for Windows + +For general coding standards, see ../HACKING. + +In my opinion win32 is the right API to write to. Microsoft seems to +be better about compatibility across versions than unix vendors (on a +good day, anyway)--the Visual C++ package I bought has not only win32 +but also win16 too (that is, they also include Visual C++ 1.x). As +far as I know there is only one win32 (not counting win32s or win32c +or whatever), not multiple versions. + +ANSI C is also good. As far as I know these calls work fairly well on +NT. + +What one should avoid like the plague on NT (IMHO) is POSIX calls such +as stat(). These tend to be very poorly supported, and tend to break +from version to version or vendor to vendor (the latter being +particularly an issue on OS/2, with IBM, Watcom, and EMX all having +_very_ different C libraries). diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/.cvsignore b/gnu/usr.bin/cvs/windows-NT/SCC/.cvsignore index be11970367c..e880feb51ab 100644 --- a/gnu/usr.bin/cvs/windows-NT/SCC/.cvsignore +++ b/gnu/usr.bin/cvs/windows-NT/SCC/.cvsignore @@ -1,4 +1,8 @@ SCC.mdp SCC.ncb +SCC.opt +SCC.dsw +SCC.plg Debug +Release Makefile diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/ChangeLog b/gnu/usr.bin/cvs/windows-NT/SCC/ChangeLog index d1f67a76fd1..9673b144931 100644 --- a/gnu/usr.bin/cvs/windows-NT/SCC/ChangeLog +++ b/gnu/usr.bin/cvs/windows-NT/SCC/ChangeLog @@ -1,3 +1,79 @@ +Tue Jan 27 12:54:05 1998 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt: Update bug-cvs address to gnu.org. + +Thu Dec 11 22:17:45 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt: Add Access to list of development environments which + implement SCC. + +Wed Oct 29 11:45:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt: CVSwiz runs the command line CVS; it is not an + independent implementation of the protocol. + +Sun Oct 26 14:57:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt: Add section "OTHER INTERFACES". + +Tue Oct 21 23:25:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt (TOOLS IMPLEMENTING THE SCC): Add comment about + Powerbuilder versions. + +Mon Sep 8 08:52:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt (TOOLS IMPLEMENTING THE SCC): Be a little more + specific about Powersoft and CodeWright. + + * Makefile.in (DISTFILES): Add pubscc.h. Thanks to Frederic Van + Haren for pointing this out. + +Tue Sep 2 13:39:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt (SPECIFICATIONS OR OTHER DOCUMENTS DESCRIBING THE + SCC): New section. + +Mon Aug 4 10:46:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * pubscc.h: Add comment listing new CodeWright 5.00c functions. + Add comment about CodeWright calling SccQueryInfo without + SCC_cap_QueryInfo set. Thanks to Frederic Van Haren for + pointing out these issues. + +4 Aug 1997 Jim Kingdon + + Changes for Visual C++ 5.0: + * SCC.dsp: New file. + * .cvsignore: add SCC.dsw SCC.opt SCC.plg Release. + + * scc.c (SccGet): Replace #if 0'd code with a comment and + adjust to avoid compiler warning. + +Mon Aug 4 09:58:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * scc.c: Split out the interface declarations into a new file + pubscc.h. This should make it easier to handle multiple + scc.c-equivalents. + +Mon Jul 14 15:58:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * scc.c: Add many comments and defines to document additional + aspects of the SCC API. + +7 Jul 1997 Frederic Van Haren <Frederic.Van.Haren@lhs.be> + + * scc.c (SccHistory): file_names is LPSTR * not LPSTR. + +Mon Jul 7 16:45:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * scc.c (SccGetVersion): Change arguments from () to (void). + Clarify context_arg. Also document 'window' arg. + +Sat Jul 5 13:01:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com> + + * README.txt: PowerJ and Power++ are also said to implement SCC. + 21 Mar 1997 Jim Kingdon * scc.c (SccCheckout): Write to debuglog and return diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/Makefile.in b/gnu/usr.bin/cvs/windows-NT/SCC/Makefile.in index 9b1f59428a1..cafed149acd 100644 --- a/gnu/usr.bin/cvs/windows-NT/SCC/Makefile.in +++ b/gnu/usr.bin/cvs/windows-NT/SCC/Makefile.in @@ -14,7 +14,7 @@ SHELL = /bin/sh DISTFILES = \ .cvsignore ChangeLog Makefile.in README.txt \ - SCC.mak scc.c scc.def + SCC.mak scc.c scc.def pubscc.h all: .PHONY: all diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/README.txt b/gnu/usr.bin/cvs/windows-NT/SCC/README.txt index bc8cc76c6c3..816ede95e47 100644 --- a/gnu/usr.bin/cvs/windows-NT/SCC/README.txt +++ b/gnu/usr.bin/cvs/windows-NT/SCC/README.txt @@ -61,6 +61,53 @@ the programs which implement the Integrated Development Environment worse yet, usenet posting, so it probably should be verified before relying on it. -* Microsoft Developer Studio 4.x Professional (not Standard, not 2.x) -* Powersoft's Optima++ -* CodeWright editor +* Microsoft Developer Studio 4.x Professional (not Standard, not 2.x). +* Microsoft Access V7.0 +* Powersoft's Optima++, PowerJ, and Power++ + (not sure which versions, but this information was added in 1997 if + that helps. Someone on usenet reports 32 bit Powerbuilder version + 5.03 but not version 4, version 5.0, or 16 bit Powerbuilder.). +* Premia's CodeWright editor + (versions 5.00b and 5.00c; not sure about older versions). + +SPECIFICATIONS OR OTHER DOCUMENTS DESCRIBING THE SCC + +The only publicly available document which we are aware of is pubscc.h +in this directory. This should be sufficient to get a start at +playing around with the SCC, and if you have done that and then +proceed to run into those areas which pubscc.h does not document well, +you are encouraged to send mail to bug-cvs@gnu.org with your +questions. + +OTHER INTERFACES + +There are other interfaces which interface between a development +environment (or other front-end) and a source control system. That +is, in general terms they provide somewhat the function of the SCC, +although they may be at a somewhat different level and systems may +support/use several interfaces rather than it being an either/or thing. + +If you know of other interfaces which should be added here I guess the +best place to make suggestions is bug-cvs@prep.ai.mit.edu (although +this list is not intended to be CVS-centric). + +* The CVS remote protocol is documented in doc/cvsclient.texi in the +CVS distribution and has at least 2 implementations of the client +(jCVS and CVS command line client), in addition to having been +implemented at least once by a special-purpose perl script. + +* Microsoft's OLE Automation interface. The spec is available for +download at http://www.microsoft.com/ssafe. I'm not sure whether this +has been implemented by other source control systems. Metrowerks +implements this via a module which speaks the Metrowerks API out one +end and the OLE Automation interface out the other (the module runs on +Windows, not Mac). + +* There is an API (for Java, I think) which is supported by Symantec's +Visual Cafe 2.0, and will be supported by a service pack which will +implement it for StarTeam 2.1 (source: usenet post by Steve Reynolds +of StarBase, Oct 1997). + +* Metrowerks publishes and implements the CodeWarrior IDE Version +Control System API. I think maybe the way to get a copy of the spec +is as part of CodeWarrior but I'm not completely clear on that. diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/pubscc.h b/gnu/usr.bin/cvs/windows-NT/SCC/pubscc.h new file mode 100644 index 00000000000..0962abdba9a --- /dev/null +++ b/gnu/usr.bin/cvs/windows-NT/SCC/pubscc.h @@ -0,0 +1,538 @@ +/* This file was written by Jim Kingdon, and is hereby placed + in the public domain. */ + +/* Bits of the SCC interface. + For paranoia's sake, I'm not using the same names as Microsoft. + I don't imagine copying a few names could be a credible copyright + case, but it seems safer to stick to only what is necessary for + the interface to work. + + Note that some of the descriptions here have a certain amount of + guesswork (for example, sometimes I have tried to translate to CVS + terminology without actually verifying that the item means what I + think it does). If you find errors, please let us know according to + the usual procedures for reporting CVS bugs. */ +typedef long SCC_return; +#define SCC_return_success 0 +#define SCC_return_unknown_project -2 +/* The file is not under SCC control. */ +#define SCC_return_non_scc_file -11 +/* This operation is not supported. I believe this status can only + be returned from SccGet, SccAdd, SccRemove, SccHistory, or + SccQueryInfo. I'm not really sure what happens if it is returned + from other calls. */ +#define SCC_return_not_supported -14 +#define SCC_return_non_specific_error -15 + +enum SCC_command +{ + SCC_command_get, + SCC_command_checkout, + SCC_command_checkin, + SCC_command_uncheckout, + SCC_command_add, + SCC_command_remove, + SCC_command_diff, + SCC_command_history, + SCC_command_rename, + SCC_command_properties, + SCC_command_options +}; + +/* Outproc codes, for second argument to outproc. */ +#define SCC_outproc_info 1L +#define SCC_outproc_warning 2L +#define SCC_outproc_error 3L +/* Codes 4-7 relate to cancels and are only supported if the + development environment said so with SccSetOption. */ +/* A status message, typically goes in something analogous to the emacs + minibuffer. For both this and SCC_outproc_nostatus, the development + environment returns SCC_outproc_return_cancelled if the user has + hit the cancel button. */ +#define SCC_outproc_status 4L +/* Like SCC_outproc_status, but there is no message to report. */ +#define SCC_outproc_nostatus 5L +/* Tell the development environment to offer a cancel button. */ +#define SCC_outproc_cancel_on 6L +/* Tell the development environment to not offer a cancel button. */ +#define SCC_outproc_cancel_off 7L + +/* Return values from outproc. */ +#define SCC_outproc_return_success 0L +#define SCC_outproc_return_cancelled -1L +typedef long (*SCC_outproc) (char *, long); + +typedef BOOL (*SCC_popul_proc) (LPVOID callerdat, BOOL add_keep, + LONG status, LPCSTR file); + +/* Maximum sizes of various strings. These are arbitrary limits + which are imposed by the SCC. */ +/* Name argument to SccInitialize. */ +#define SCC_max_name 31 +/* Path argument to SccInitialize. */ +#define SCC_max_init_path 31 +/* Various paths many places in the interface. */ +#include <stdlib.h> +#define SCC_max_path _MAX_PATH + +/* Status codes, as used by QueryInfo and GetEvents. */ +/* This means that we can't get status. If the status is not + SCC_status_error, then the status is a set of bit flags, as defined by + the other SCC_status_* codes. */ +#define SCC_status_error -1L + +/* The following status codes are things which the development environment + is encouraged to check to determine things like whether to allow + a checkin. */ +/* The current user has the file checked out (that is, under "cvs edit"). + It may or may not be in the directory where the development + environment thinks it should be. */ +#define SCC_status_out_me 0x1000L +/* Should be set only if out_me is set. The file is checked out where + the development environment thinks it should be. */ +#define SCC_status_out_here 2L +/* Some other user has the file checked out. */ +#define SCC_status_out_someoneelse 4L +/* Reserved checkouts are in effect for the file. */ +#define SCC_status_reserved 8L +/* Reserved checkouts are not in effect for the file. Multiple users + can edit it. Only one of SCC_status_reserved or SCC_status_nonreserved + should be set. I think maybe this flag should only be set if there + actually is more than one copy currently checked out. */ +#define SCC_status_nonreserved 0x10L + +/* The following flags are intended for the development environment to + display the status of a file. We are allowed to support them or not + as we choose. */ +/* The file in the working directory is not the latest version in the + repository. Like when "cvs status" says "Needs Checkout". */ +#define SCC_status_needs_update 0x20L +/* The file is no longer in the project. I think this is the case where + cvs update prints "file xxx is no longer pertinent" (but I don't know, + there are other statuses involved with removed files). */ +#define SCC_status_not_pertinent 0x40L +/* No checkins are permitted for this file. No real CVS analogue, because + this sort of thing would be done by commitinfo, &c. */ +#define SCC_status_no_checkins 0x80L +/* There was a merge, but the user hasn't yet dealt with it. I think this + probably should be used both if there were conflicts on the merge and + if there were not (not sure, though). */ +#define SCC_status_had_conflicts 0x100L +/* This indicates something has happened to the file. I suspect it mainly + is intended for cases in which we detect that something happened to the + file behind our backs. I suppose CVS might use this for cases in which + sanity checks on the CVSADM files fail, or in which the file has been + made read/write without a "cvs edit", or that sort of thing. + + Or maybe it should be set if the file has been edited in the + normal fashion. I'm not sure. */ +#define SCC_status_munged 0x800L +/* The file exists in several projects. In CVS I would suppose the + equivalent probably would be that several modules (using features + like -d) are capable of checking out a given file in the repository + in several locations. CVS has no current ability to give a different + status when that has happened, but it might be cool. */ +#define SCC_status_several_projects 0x200L +/* There is a sticky tag or date in effect. */ +#define SCC_status_stuck 0x400L + +/* Bits to set in the caps used by SccInitialize. Most of these are + relatively straightforward, for example SCC_cap_QueryInfo is set to + indicate that the SccQueryInfo function is supported. */ +/* CodeWright 5.00b and 5.00c seem to call SccQueryInfo regardless of whether + this bit is set in caps. */ +#define SCC_cap_QueryInfo 0x80L +#define SCC_cap_GetProjPath 0x200L +#define SCC_cap_AddFromScc 0x400L +#define SCC_cap_want_outproc 0x8000L + +/* These are command options. Some of them are specific to a particular + command, some of them are good for more than one command. Because many + values are reused for different commands, look at the listed commands + to see what a particular value means for a particular command. */ +/* Recurse into directories. SccGet. */ +#define SCC_cmdopt_recurse 2L +/* This means to get all the files in a directory. SccGet. */ +#define SCC_cmdopt_dir 1L +/* Without this flag, after a checkin, files are normally not checked + out. This flag disables that handling, and if it is set files will + still be checked out after the checkin completes. SccCheckin, SccAdd. */ +#define SCC_cmdopt_no_unedit 0x1000L +/* File is text. SccAdd. */ +#define SCC_cmdopt_text 1L +/* File is binary. SccAdd. */ +#define SCC_cmdopt_binary 2L +/* We are supposed to decide whether it is text or binary. We can use the + CVS wrappers stuff to decide based on the file name. Obviously, this + constant is just another way of saying that neither SCC_cmdopt_text nor + SCC_cmdopt_binary are set. SccAdd. */ +#define SCC_cmdopt_auto 0L +/* Maintain only a head revision for the file, no history. SccAdd. */ +#define SCC_cmdopt_only_one 4L +/* In addition to removing the file from the repository, also delete it + from the working directory. My guess is that development environments + would generally tend to pass this flag by default. SccRemove. */ +#define SCC_cmdopt_retain_local 1L +/* Compare files in a case-insensitive fashion. SccDiff. */ +#define SCC_cmdopt_case_insensitive 2L +/* Ignore whitespace in comparing files. SccDiff. */ +#define SCC_cmdopt_ignore_all_space 4L +/* Instead of generating diffs, just say whether files are equal, based on + the file contents. SccDiff. */ +#define SCC_cmdopt_compare_files 0x10L +/* Instead of generating diffs, just say whether files are equal. This may + use a checksum if we want, or if not, it can be the same as + SCC_cmdopt_compare_files. */ +#define SCC_cmdopt_consult_checksum 0x20L +/* Instead of generating diffs, just say whether files are equal. This may + use a timestamp if we want, or if not, it can be the same as either + SCC_cmdopt_consult_checksum or SCC_cmdopt_compare_files. */ +#define SCC_cmdopt_consult_timestamp 0x40L + +/* Values for the flags argument to OpenProject. */ +/* If this is set, and the development environment tries to open a project + which doesn't exist, then create it. */ +#define SCC_open_autocreate 1L +/* If autocreate is not set, and the development environment tries to + open a project which doesn't exist, and may_prompt is set, we are + allowed to prompt the user to create a new project. If may_prompt + is not set, we should just return SCC_return_unknown_project and + not open the project. */ +#define SCC_open_may_prompt 2L + +/* Constants for SccSetOption. */ +#define SCC_option_background 1L +/* If option is SCC_option_background, then val turns background + processing on or off. If it is off, we can, if we need to, queue + up events or something which won't disturb the development + environment. */ +# define SCC_option_background_yes 1L +# define SCC_option_background_no 0L +#define SCC_option_cancel 3L +/* If option is SCC_option_cancel, then val says whether the development + environment supports the SCC_outproc_* codes related to having the + development environment handle a cancel button. If this is not set, + we are allowed/encouraged to implement a cancel button ourselves. */ +# define SCC_option_cancel_on 1L +# define SCC_option_cancel_off 0L +/* A SCC_option_* value of 10 has also been observed (I think from + CodeWright 5.00). I have no idea what it means; it isn't documented + by the SCC API from Microsoft (version 0.99.0823). */ + +/* The "void *context_arg" argument to most of the Scc* functions + stores a pointer to a structure that the version control system + gets to allocate, so it doesn't need any global variables. */ + +/* In addition to context_arg, most of the Scc* functions take a + "HWND window" argument. This is so that we can put up dialogs. + The window which is passed in is the IDE's window, which we + should use as the parent of dialogs that we put up. */ + +#include <windows.h> + +/* Return the version of the SCC spec, major version in the high word, + minor version in the low word. Recommended value is 0x10001 for + version 1.1 of the spec. */ +extern LONG SccGetVersion (void); + +/* Set up the version control system. This should be called before any + other SCC calls other than SccGetVersion. */ +extern SCC_return SccInitialize + (/* The version control system should allocate the context argument + in SccInitialize and store a pointer to it in *contextp. */ + void **contextp, + + HWND window, LPSTR caller, + /* Version control system should copy in the + name of the version control system here, + up to SCC_max_name bytes. */ + LPSTR name, + + /* Version control system should set *caps to indicate what it + supports, using bits from SCC_cap_*. */ + LPLONG caps, + + /* Version control system should copy in a string here, that the + development environment can put places like a makefile to + distinguish this version control system from others. Up to + SCC_max_init_path bytes. */ + LPSTR path, + + /* Version control system should set these to the maximum size for + checkout comments and comments. I'm not sure whether existing + development environments tend to allocate fixed size arrays + based on the return length (I would recommend that a development + environment not do so, but that is a different question). */ + LPDWORD co_comment_len, + LPDWORD comment_len); + +/* The version control system should free any resources it has allocated, + including the context structure itself. */ +extern SCC_return SccUninitialize (void *context_arg); + +extern SCC_return SccOpenProject + (void *context_arg, HWND window, LPSTR user, + LPSTR project, LPSTR local_proj, + LPSTR aux_proj, + LPSTR comment, + + /* This is the function which the version control system can call + to ask the development environment to display output, or + (SCC_outproc)0 if the development environment doesn't support + the outproc feature. */ + SCC_outproc outproc, + + /* One or more of the SCC_open_* settings. */ + LONG flags); + +extern SCC_return SccCloseProject (void *context_arg); + +/* cvs get. */ +extern SCC_return SccGet + (void *context_arg, HWND window, + + /* Files to get, where file_names is an array + of num_files names. */ + /* As with all file names passed to us by the SCC, these file names + are absolute pathnames. I think they will tend to be paths + within the local directory specified by the local_proj argument + to SccOpenProject, although I don't know whether there are any + exceptions to that. */ + LONG num_files, + LPSTR *file_names, + + /* Command options. */ + LONG options, + + void *prov_options); + +/* cvs edit. */ +extern SCC_return SccCheckout + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + LPSTR comment, + + /* Command options. I'm not sure what command options, if any, are + defined for SccCheckout. */ + LONG options, + + void *prov_options); + +/* cvs ci. */ +extern SCC_return SccCheckin + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + LPSTR comment, + + /* Command options. */ + LONG options, + + void *prov_options); + +/* cvs unedit. */ +extern SCC_return SccUncheckout + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + /* Command options. I'm not sure what command options, if any, are + defined for SccUncheckout. */ + LONG options, + + void *prov_options); + +/* cvs add + cvs ci, more or less, I think (but see also + the "keep checked out" flag in options). */ +extern SCC_return SccAdd + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + LPSTR comment, + + /* Array of num_files command options, one for each file. */ + LONG *options, + + void *prov_options); + +/* cvs rm -f + cvs ci, I think. Should barf if SCC_REMOVE_KEEP + (or maybe just put the file there, as if the user had removed + it and then done a "copy <saved-file> <filename>". */ +extern SCC_return SccRemove + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + LPSTR comment, + + /* Command options. */ + LONG options, + + void *prov_options); + +/* mv, cvs add, cvs rm, and cvs ci, I think. */ +extern SCC_return SccRename + (void *context_arg, HWND window, LPSTR old_name, + LPSTR new_name); + +/* If SCC_cmdopt_compare_files, SCC_cmdopt_consult_checksum, or + SCC_cmdopt_consult_timestamp, then we are supposed to silently + return a status, without providing any information directly to the + user. For no args or checksum (which we fall back to full compare) + basically a call to No_Diff or ? in the client case. For + timestamp, just a Classify_File. Now, if contents not set, then + want to do a cvs diff, and preferably start up WinDiff or something + (to be determined, for now perhaps could just return text via + outproc). */ +extern SCC_return SccDiff + (void *context_arg, HWND window, LPSTR file_name, + + /* Command options. */ + LONG options, + + void *prov_options); + +/* cvs log, I presume. If we want to get fancier we could bring + up a screen more analogous to the tkCVS log window, let the user + do "cvs update -r", etc. */ +extern SCC_return SccHistory + (void *context_arg, HWND window, + + /* Files to operate on, where file_names is an array of num_files + names. */ + LONG num_files, + LPSTR *file_names, + + /* Command options. I'm not sure what command options, + if any, are defined for SccHistory. */ + LONG options, + + void *prov_options); + +/* cvs status, presumably. */ +extern SCC_return SccProperties + (void *context_arg, HWND window, LPSTR file_name); + +/* Not sure what this should do. The most obvious thing is some + kind of front-end to "cvs admin" but I'm not actually sure that + is the most useful thing. */ +extern SCC_return SccRunScc + (void *context_arg, HWND window, + + LONG num_files, + LPSTR *file_names); + +/* Lots of things that we could do here. Options to get/update + such as -r -D -k etc. just for starters. Note that the terminology is + a little confusing here. This function relates to "provider options" + (prov_options) which are a way for us to provide extra dialogs beyond + the basic ones for a particular command. It is unrelated to "command + options" (SCC_cmdopt_*). */ +extern SCC_return SccGetCommandOptions + (void *context_arg, HWND window, + enum SCC_command command, + void **prov_optionsp); + +/* Not existing CVS functionality, I don't think. + Need to be able to tell user about what files + are out there without actually getting them. */ +extern SCC_return SccPopulateList + (void *context_arg, enum SCC_command command, + + LONG num_files, + LPSTR *file_names, + + SCC_popul_proc populate, + void *callerdat, + + /* Command options. I'm not sure what command options, + if any, are defined for SccPopulateList. */ + LONG options); + +/* cvs status, sort of. */ +extern SCC_return SccQueryInfo + (void *context_arg, + + LONG num_files, LPSTR *file_names, + + /* This is an array of NUM_FILES entries. In each one + we store a SCC_status_* code. */ + LPLONG status); + +/* Like QueryInfo, but fast and for only a single file. For example, the + development environment might call this quite frequently to keep its + screen display updated. Supposed to only return cached status + information, not go to disk or anything. I assume that + QueryInfo and probably the usual calls like Get would cause + the version control system to cache the status in the first place. */ +extern SCC_return SccGetEvents + (void *context_arg, LPSTR file_name, + + /* Here the version control system stores the SCC_status_* code. */ + LPLONG status, + + LPLONG events_remaining); + +/* This is where the user gives us the CVSROOT. */ +extern SCC_return SccGetProjPath + (void *context_arg, HWND window, LPSTR user, + + /* Version control system copies in the project name + here, up to SCC_max_path bytes. */ + LPSTR proj_name, + + /* If allow_change, the version control system may copy + into this field, up to SCC_max_path bytes. */ + LPSTR local_proj, + + /* Version control system copies into this field, up to + SCC_max_path bytes. */ + LPSTR aux_proj, + + BOOL allow_change, BOOL *new); + +/* Pretty much similar to SccPopulateList. Not sure whether this also + involves getting the files, or whether the development environment will + typically call SccGet after this function. */ +extern SCC_return SccAddFromScc + (void *context_arg, HWND window, + + /* Version control system sets *files to the number of files and + *file_names to an array each element of which and contains the + name of one of the files. The names can be relative pathnames + (e.g. "foo.c"). If files is NULL, that means something different; + the version control system should free the memory that it allocated + for file_names. */ + LONG *files, + char ***file_names); + +/* This changes several aspects of how we interact with the IDE. */ +extern SCC_return SccSetOption + (void *context_arg, + /* One of the SCC_option_* codes. */ + LONG option, + /* Meaning of this will depend on the value of option. */ + LONG val); + +/* New functions with CodeWright 5.00c: SccAddRef, SccRelease, + SccDiffToRev, SccLabel, SccLock and SccMerge. I don't have any + details on them. */ diff --git a/gnu/usr.bin/cvs/windows-NT/SCC/scc.c b/gnu/usr.bin/cvs/windows-NT/SCC/scc.c index c8f10512b3a..9f74af4c6b1 100644 --- a/gnu/usr.bin/cvs/windows-NT/SCC/scc.c +++ b/gnu/usr.bin/cvs/windows-NT/SCC/scc.c @@ -5,70 +5,11 @@ #include <stdio.h> #include <direct.h> /* For chdir */ - -/* Bits of the interface. - For paranoia's sake, I'm not using the same names as Microsoft. - I don't imagine copying a few names could be a credible copyright - case, but it seems safer to stick to only what is necessary for - the interface to work. */ -typedef long SCC_return; -#define SCC_return_success 0 -#define SCC_return_unknown_project -2 -/* The file is not under SCC control. */ -#define SCC_return_non_scc_file -11 -/* This operation is not supported. I believe this status can only - be returned from SccGet, SccAdd, SccRemove, SccHistory, or - SccQueryInfo. I'm not really sure what happens if it is returned - from other calls. */ -#define SCC_return_not_supported -14 -#define SCC_return_non_specific_error -15 -enum SCC_command -{ - SCC_command_get, - SCC_command_checkout, - SCC_command_checkin, - SCC_command_uncheckout, - SCC_command_add, - SCC_command_remove, - SCC_command_diff, - SCC_command_history, - SCC_command_rename, - SCC_command_properties, - SCC_command_options -}; - -/* Outproc codes, for second argument to outproc. */ -#define SCC_outproc_info 1 -#define SCC_outproc_warning 2 -#define SCC_outproc_error 3 -typedef long (*SCC_outproc) (char *, long); - -typedef BOOL (*SCC_popul_proc) (LPVOID callerdat, BOOL add_keep, - LONG status, LPCSTR file); - -/* Maximum sizes of various strings. These are arbitrary limits - which are imposed by the SCC. */ -/* Name argument to SccInitialize. */ -#define SCC_max_name 31 -/* Path argument to SccInitialize. */ -#define SCC_max_init_path 31 -/* Various paths many places in the interface. */ -#include <stdlib.h> -#define SCC_max_path _MAX_PATH - -/* Bits to set in the caps used by SccInitialize. */ -#define SCC_cap_GetProjPath 0x200L -#define SCC_cap_AddFromScc 0x400L -#define SCC_cap_want_outproc 0x8000L - -/* Flags for SccGet. */ -#define SCC_RECURSE 2L -/* This means to get all the files in a directory. */ -#define SCC_DIR 1L - +#include "pubscc.h" /* We get to put whatever we want here, and the caller will pass it - to us, so we don't need any global variables. */ + to us, so we don't need any global variables. This is the + "void *context_arg" argument to most of the Scc* functions. */ struct context { FILE *debuglog; /* Value of the CVSROOT we are currently working with (that is, the @@ -80,6 +21,11 @@ struct context { SCC_outproc outproc; }; +/* In addition to context_arg, most of the Scc* functions take a + "HWND window" argument. This is so that we can put up dialogs. + The window which is passed in is the IDE's window, which we + should use as the parent of dialogs that we put up. */ + #include <windows.h> /* Report a malloc error and return the SCC_return_* value which the @@ -97,7 +43,7 @@ malloc_error (struct context *context) /* Return the version of the SCC spec, major version in the high word, minor version in the low word. */ LONG -SccGetVersion () +SccGetVersion (void) { /* We implement version 1.1 of the spec. */ return 0x10001; @@ -161,8 +107,9 @@ SccUninitialize (void *context_arg) SCC_return SccOpenProject (void *context_arg, HWND window, LPSTR user, - LPSTR project, LPSTR local_proj, LPSTR aux_proj, - LPSTR comment, SCC_outproc outproc, LONG flags) + LPSTR project, LPSTR local_proj, LPSTR aux_proj, + LPSTR comment, SCC_outproc outproc, + LONG flags) { struct context *context = (struct context *)context_arg; @@ -218,7 +165,9 @@ SccCloseProject (void *context_arg) /* cvs get. */ SCC_return SccGet (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LONG options, void *prov_options) + LPSTR *file_names, + LONG options, + void *prov_options) { struct context *context = (struct context *)context_arg; int i; @@ -232,25 +181,21 @@ SccGet (void *context_arg, HWND window, LONG num_files, } #endif fprintf (context->debuglog, "\n"); - if (options & SCC_DIR) + if (options & SCC_cmdopt_dir) fprintf (context->debuglog, " Get all\n"); /* Should be using this flag to set -R vs. -l. */ - if (options & SCC_RECURSE) + if (options & SCC_cmdopt_recurse) fprintf (context->debuglog, " recurse\n"); for (i = 0; i < num_files; ++i) { - FILE *fp; - /* As with all file names passed to us by the SCC, these file names are absolute pathnames. I think they will tend to be paths within context->local, although I don't know whether there are any exceptions to that. */ fname = file_names[i]; fprintf (context->debuglog, "%s ", fname); -#if 0 - fp = fopen (fname, "w"); -#endif + /* Here we would write to the file named fname. */ } fprintf (context->debuglog, "\nExiting SccGet\n"); fflush (context->debuglog); @@ -260,7 +205,8 @@ SccGet (void *context_arg, HWND window, LONG num_files, /* cvs edit. */ SCC_return SccCheckout (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LPSTR comment, LONG options, + LPSTR *file_names, LPSTR comment, + LONG options, void *prov_options) { struct context *context = (struct context *)context_arg; @@ -278,7 +224,8 @@ SccCheckout (void *context_arg, HWND window, LONG num_files, /* cvs ci. */ SCC_return SccCheckin (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LPSTR comment, LONG options, + LPSTR *file_names, LPSTR comment, + LONG options, void *prov_options) { return SCC_return_not_supported; @@ -287,7 +234,9 @@ SccCheckin (void *context_arg, HWND window, LONG num_files, /* cvs unedit. */ SCC_return SccUncheckout (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LONG options, void *prov_options) + LPSTR *file_names, + LONG options, + void *prov_options) { return SCC_return_not_supported; } @@ -296,7 +245,8 @@ SccUncheckout (void *context_arg, HWND window, LONG num_files, the "keep checked out" flag in options). */ SCC_return SccAdd (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LPSTR comment, LONG *options, + LPSTR *file_names, LPSTR comment, + LONG *options, void *prov_options) { return SCC_return_not_supported; @@ -307,7 +257,8 @@ SccAdd (void *context_arg, HWND window, LONG num_files, it and then done a "copy <saved-file> <filename>". */ SCC_return SccRemove (void *context_arg, HWND window, LONG num_files, - LPSTR *file_names, LPSTR comment, LONG options, + LPSTR *file_names, LPSTR comment, + LONG options, void *prov_options) { return SCC_return_not_supported; @@ -321,15 +272,19 @@ SccRename (void *context_arg, HWND window, LPSTR old_name, return SCC_return_not_supported; } -/* If "contents flag", then implement this ourself. For no - args or checksum (which we fall back to full compare) basically a - call to No_Diff or ? in the client case. For timestamp, just a - Classify_File. Now, if contents not set, then want to do a - cvs diff, and preferably start up WinDiff or something (to be - determined, for now perhaps could just shove in the text). */ +/* If SCC_cmdopt_compare_files, SCC_cmdopt_consult_checksum, or + SCC_cmdopt_consult_timestamp, then we are supposed to silently + return a status, without providing any information directly to the + user. For no args or checksum (which we fall back to full compare) + basically a call to No_Diff or ? in the client case. For + timestamp, just a Classify_File. Now, if contents not set, then + want to do a cvs diff, and preferably start up WinDiff or something + (to be determined, for now perhaps could just return text via + outproc). */ SCC_return SccDiff (void *context_arg, HWND window, LPSTR file_name, - LONG options, void *prov_options) + LONG options, + void *prov_options) { return SCC_return_not_supported; } @@ -339,7 +294,9 @@ SccDiff (void *context_arg, HWND window, LPSTR file_name, do "cvs update -r", etc. */ SCC_return SccHistory (void *context_arg, HWND window, LONG num_files, - LPSTR file_names, LONG options, void *prov_options) + LPSTR *file_names, + LONG options, + void *prov_options) { return SCC_return_not_supported; } @@ -362,7 +319,11 @@ SccRunScc (void *context_arg, HWND window, LONG num_files, } /* Lots of things that we could do here. Options to get/update - such as -r -D -k etc. just for starters. */ + such as -r -D -k etc. just for starters. Note that the terminology is + a little confusing here. This function relates to "provider options" + (prov_options) which are a way for us to provide extra dialogs beyond + the basic ones for a particular command. It is unrelated to "command + options" (SCC_cmdopt_*). */ SCC_return SccGetCommandOptions (void *context_arg, HWND window, enum SCC_command command, @@ -378,7 +339,8 @@ SCC_return SccPopulateList (void *context_arg, enum SCC_command command, LONG num_files, LPSTR *file_names, SCC_popul_proc populate, - void *callerdat, LONG options) + void *callerdat, + LONG options) { return SCC_return_success; } @@ -391,14 +353,18 @@ SccQueryInfo (void *context_arg, LONG num_files, LPSTR *file_names, return SCC_return_not_supported; } +/* Like QueryInfo, but fast and for only a single file. For example, the + development environment might call this quite frequently to keep its + screen display updated. */ SCC_return -SccGetEvents (void *context_arg, LPSTR file_name, LPLONG status, +SccGetEvents (void *context_arg, LPSTR file_name, + LPLONG status, LPLONG events_remaining) { /* They say this is supposed to only return cached status - information, not go to disk or anything. OK, although I - haven't really figured out what calls would cause us to - cache status without returning it then. */ + information, not go to disk or anything. I assume that + QueryInfo and probably the usual calls like Get would cause + us to cache the status in the first place. */ return SCC_return_success; } @@ -495,7 +461,9 @@ SccAddFromScc (void *context_arg, HWND window, LONG *files, /* This changes several aspects of how we interact with the IDE. */ SCC_return -SccSetOption (void *context_arg, LONG option, LONG val) +SccSetOption (void *context_arg, + LONG option, + LONG val) { return SCC_return_success; } diff --git a/gnu/usr.bin/cvs/windows-NT/config.h b/gnu/usr.bin/cvs/windows-NT/config.h index b4d6f94765b..f385726166c 100644 --- a/gnu/usr.bin/cvs/windows-NT/config.h +++ b/gnu/usr.bin/cvs/windows-NT/config.h @@ -34,6 +34,10 @@ I have neither the CD-ROM nor a CD-ROM drive to put it in. */ #define HAVE_UTIME_NULL 1 +/* On Windows NT, when a file is being watched, utime expects a file + to be writable */ +#define UTIME_EXPECTS_WRITABLE + /* Define if on MINIX. */ /* Hah. */ #undef _MINIX @@ -100,10 +104,6 @@ that's always there. */ #undef SERVER_SUPPORT -/* the path to the gnu diff program on your system */ -/* We don't need this for CLIENT side. */ -#undef DIFF - /* Define if you have the connect function. */ /* Not used? */ #define HAVE_CONNECT @@ -254,37 +254,18 @@ unsigned int sleep (unsigned int); #define popen _popen #define pclose _pclose -/* Under Windows NT, filenames are case-insensitive, and both / and \ - are path component separators. */ -#define FOLD_FN_CHAR(c) (WNT_filename_classes[(unsigned char) (c)]) -extern unsigned char WNT_filename_classes[]; -#define FILENAMES_CASE_INSENSITIVE 1 - -/* Is the character C a path name separator? Under - Windows NT, you can use either / or \. */ -#define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/') - -/* Like strcmp, but with the appropriate tweaks for file names. - Under Windows NT, filenames are case-insensitive but case-preserving, - and both \ and / are path element separators. */ -extern int fncmp (const char *n1, const char *n2); - -/* Fold characters in FILENAME to their canonical forms. - If FOLD_FN_CHAR is not #defined, the system provides a default - definition for this. */ -extern void fnfold (char *FILENAME); - -/* #define this if your system terminates lines in text files with - CRLF instead of plain LF, and your I/O functions automatically - translate between using LF in memory and CRLF on disk, unless you - specifically tell them not to. */ -#define LINES_CRLF_TERMINATED 1 - -/* Read data from INFILE, and copy it to OUTFILE. - Open INFILE using INFLAGS, and OUTFILE using OUTFLAGS. - This is useful for converting between CRLF and LF line formats. */ -extern void convert_file (char *INFILE, int INFLAGS, - char *OUTFILE, int OUTFLAGS); +/* When writing binary data to stdout, we better set + stdout to binary mode using setmode. */ +#define USE_SETMODE_STDOUT 1 + +/* Diff also has an ifdef for setmode, and it is HAVE_SETMODE. */ +#define HAVE_SETMODE 1 + +/* Diff needs us to define this. I think it could always be + -1 for CVS, because we pass temporary files to diff, but + config.h seems like the easiest place to put this, so for + now we put it here. */ +#define same_file(s,t) (-1) /* This is where old bits go to die under Windows NT. */ #define DEVNULL "nul" diff --git a/gnu/usr.bin/cvs/windows-NT/filesubr.c b/gnu/usr.bin/cvs/windows-NT/filesubr.c index 6ad8d76359f..5cb15300eea 100644 --- a/gnu/usr.bin/cvs/windows-NT/filesubr.c +++ b/gnu/usr.bin/cvs/windows-NT/filesubr.c @@ -408,33 +408,6 @@ rename_file (from, to) error (1, errno, "cannot rename file %s to %s", from, to); } -/* Windows NT doesn't have hard links or symbolic links. - There was only one place in CVS which used this function, - so I rewrote it to work another way, so this function isn't - used any more. */ -#if 0 -/* - * link a file, if possible. - */ -int -link_file (from, to) - const char *from; - const char *to; -{ - if (trace) -#ifdef SERVER_SUPPORT - (void) fprintf (stderr, "%c-> link(%s,%s)\n", - (server_active) ? 'S' : ' ', from, to); -#else - (void) fprintf (stderr, "-> link(%s,%s)\n", from, to); -#endif - if (noexec) - return (0); - - return (link (from, to)); -} -#endif - /* * unlink a file, if possible. */ @@ -660,103 +633,6 @@ xcmp (file1, file2) return (ret); } - -/* The equivalence class mapping for filenames. - Windows NT filenames are case-insensitive, but case-preserving. - Both / and \ are path element separators. - Thus, this table maps both upper and lower case to lower case, and - both / and \ to /. */ - -#if 0 -main () -{ - int c; - - for (c = 0; c < 256; c++) - { - int t; - - if (c == '\\') - t = '/'; - else - t = tolower (c); - - if ((c & 0x7) == 0x0) - printf (" "); - printf ("0x%02x,", t); - if ((c & 0x7) == 0x7) - putchar ('\n'); - else if ((c & 0x7) == 0x3) - putchar (' '); - } -} -#endif - - -unsigned char -WNT_filename_classes[] = -{ - 0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f, - 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17, - 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f, - 0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27, - 0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f, - 0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37, - 0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f, - 0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, - 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, - 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, - 0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f, - 0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67, - 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f, - 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77, - 0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f, - 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87, - 0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f, - 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97, - 0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f, - 0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7, - 0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf, - 0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7, - 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf, - 0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7, - 0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf, - 0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7, - 0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf, - 0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7, - 0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef, - 0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7, - 0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff, -}; - -/* Like strcmp, but with the appropriate tweaks for file names. - Under Windows NT, filenames are case-insensitive but case-preserving, - and both \ and / are path element separators. */ -int -fncmp (const char *n1, const char *n2) -{ - while (*n1 && *n2 - && (WNT_filename_classes[(unsigned char) *n1] - == WNT_filename_classes[(unsigned char) *n2])) - n1++, n2++; - return (WNT_filename_classes[(unsigned char) *n1] - - WNT_filename_classes[(unsigned char) *n2]); -} - -/* Fold characters in FILENAME to their canonical forms. - If FOLD_FN_CHAR is not #defined, the system provides a default - definition for this. */ -void -fnfold (char *filename) -{ - while (*filename) - { - *filename = FOLD_FN_CHAR (*filename); - filename++; - } -} - /* Generate a unique temporary filename. Returns a pointer to a newly malloc'd string containing the name. Returns successfully or not at @@ -778,6 +654,12 @@ int isabsolute (filename) const char *filename; { + /* FIXME: This routine seems to interact poorly with + strip_trailing_slashes. For example, specify ":local:r:\" as + CVSROOT. The CVS/Root file will contain ":local:r:" and then + isabsolute will complain about the root not being an absolute + pathname. My guess is that strip_trailing_slashes is the right + place to fix this. */ return (ISDIRSEP (filename[0]) || (filename[0] != '\0' && filename[1] == ':' @@ -802,35 +684,6 @@ last_component (char *path) } -/* Read data from INFILE, and copy it to OUTFILE. - Open INFILE using INFLAGS, and OUTFILE using OUTFLAGS. - This is useful for converting between CRLF and LF line formats. */ -void -convert_file (char *infile, int inflags, - char *outfile, int outflags) -{ - int infd, outfd; - char buf[8192]; - int len; - - if ((infd = open (infile, inflags)) < 0) - error (1, errno, "couldn't read %s", infile); - if ((outfd = open (outfile, outflags, S_IWRITE)) < 0) - error (1, errno, "couldn't write %s", outfile); - - while ((len = read (infd, buf, sizeof (buf))) > 0) - if (write (outfd, buf, len) < 0) - error (1, errno, "error writing %s", outfile); - if (len < 0) - error (1, errno, "error reading %s", infile); - - if (close (outfd) < 0) - error (0, errno, "warning: couldn't close %s", outfile); - if (close (infd) < 0) - error (0, errno, "warning: couldn't close %s", infile); -} - - /* NT has two evironment variables, HOMEPATH and HOMEDRIVE, which, when combined as ${HOMEDRIVE}${HOMEPATH}, give the unix equivalent of HOME. Some NT users are just too unixy, though, and set the diff --git a/gnu/usr.bin/cvs/windows-NT/ndir.c b/gnu/usr.bin/cvs/windows-NT/ndir.c index a5045b210af..9db46b385a6 100644 --- a/gnu/usr.bin/cvs/windows-NT/ndir.c +++ b/gnu/usr.bin/cvs/windows-NT/ndir.c @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/windows-NT/ndir.c,v 1.1.1.3 1997/06/28 03:29:36 tholo Exp $ - */ + GNU General Public License for more details. */ /* Everything non trivial in this code is from: @(#)msd_dir.c 1.4 87/11/06. A public domain implementation of BSD directory routines diff --git a/gnu/usr.bin/cvs/windows-NT/ndir.h b/gnu/usr.bin/cvs/windows-NT/ndir.h index 6cc9e40fc9b..4cfc0b3fa18 100644 --- a/gnu/usr.bin/cvs/windows-NT/ndir.h +++ b/gnu/usr.bin/cvs/windows-NT/ndir.h @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/windows-NT/ndir.h,v 1.1.1.4 1997/06/28 03:29:35 tholo Exp $ - */ + GNU General Public License for more details. */ /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4 87/11/06. A public domain implementation of BSD directory routines diff --git a/gnu/usr.bin/cvs/windows-NT/options.h b/gnu/usr.bin/cvs/windows-NT/options.h index 33103dda051..d8f17fc1acc 100644 --- a/gnu/usr.bin/cvs/windows-NT/options.h +++ b/gnu/usr.bin/cvs/windows-NT/options.h @@ -16,18 +16,6 @@ */ /* - * CVS provides the most features when used in conjunction with the Version-5 - * release of RCS. Thus, it is the default. This also assumes that GNU diff - * Version-1.15 is being used as well -- you will have to configure your RCS - * V5 release separately to make this the case. If you do not have RCS V5 and - * GNU diff V1.15, comment out this define. You should not try mixing and - * matching other combinations of these tools. - */ -#ifndef HAVE_RCS5 -#define HAVE_RCS5 -#endif - -/* * For portability and heterogeneity reasons, CVS is shipped by default using * my own text-file version of the ndbm database library in the src/myndbm.c * file. If you want better performance and are not concerned about @@ -38,23 +26,6 @@ #endif /* - * The "diff" program to execute when creating patch output. This "diff" - * must support the "-c" option for context diffing. Specify a full - * pathname if your site wants to use a particular diff. If you are - * using the GNU version of diff (version 1.15 or later), this should - * be "diff -a". - * - * NOTE: this program is only used for the ``patch'' sub-command (and - * for ``update'' if you are using the server). The other commands - * use rcsdiff which will use whatever version of diff was specified - * when rcsdiff was built on your system. - */ - -#ifndef DIFF -#define DIFF "diff" -#endif - -/* * The "patch" program to run when using the CVS server and accepting * patches across the network. Specify a full pathname if your site * wants to use a particular patch. @@ -63,36 +34,6 @@ #define PATCH_PROGRAM "patch" #endif -/* - * By default, RCS programs are executed with the shell or through execlp(), - * so the user's PATH environment variable is searched. If you'd like to - * bind all RCS programs to a certain directory (perhaps one not in most - * people's PATH) then set the default in RCSBIN_DFLT. Note that setting - * this here will cause all RCS programs to be executed from this directory, - * unless the user overrides the default with the RCSBIN environment variable - * or the "-b" option to CVS. - * - * If you use the password-authenticating server, then you need to - * make sure that the server can find the RCS programs to invoke them. - * The authenticating server starts out running as root, and then - * switches to run as the appropriate user once authentication is - * complete. But no actual shell is ever started by that user, so the - * PATH environment variable may not contain the directory with the - * RCS binaries, even though if that user logged in normally, PATH - * would include the directory. - * - * One way to solve this problem is to set RCSBIN_DFLT here. An - * alternative is to make sure that root has the right directory in - * its path already. Another, probably better alternative is to - * specify -b in /etc/inetd.conf. - * - * This define should be either the empty string ("") or a full pathname to the - * directory containing all the installed programs from the RCS distribution. - */ -#ifndef RCSBIN_DFLT -#define RCSBIN_DFLT "" -#endif - /* Directory used for storing temporary files, if not overridden by environment variables or the -T global option. There should be little need to change this (-T is a better mechanism if you need to use a @@ -224,8 +165,3 @@ #ifndef STDC_HEADERS extern void exit (); #endif - -#ifndef getwd -extern char *getwd (); -#endif - diff --git a/gnu/usr.bin/cvs/windows-NT/pwd.c b/gnu/usr.bin/cvs/windows-NT/pwd.c index 3a3d10097c2..683bb0c3653 100644 --- a/gnu/usr.bin/cvs/windows-NT/pwd.c +++ b/gnu/usr.bin/cvs/windows-NT/pwd.c @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/windows-NT/pwd.c,v 1.1.1.3 1997/06/28 03:29:37 tholo Exp $ -*/ + GNU General Public License for more details. */ /* This 'implementation' is conjectured from the use of this functions in the RCS and BASH distributions. Of course these functions don't do too diff --git a/gnu/usr.bin/cvs/windows-NT/pwd.h b/gnu/usr.bin/cvs/windows-NT/pwd.h index 614c41785ac..ad225a1c7e4 100644 --- a/gnu/usr.bin/cvs/windows-NT/pwd.h +++ b/gnu/usr.bin/cvs/windows-NT/pwd.h @@ -9,10 +9,7 @@ This program 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. - - $Header: /cvs/OpenBSD/src/gnu/usr.bin/cvs/windows-NT/pwd.h,v 1.1.1.3 1997/06/28 03:29:35 tholo Exp $ -*/ + GNU General Public License for more details. */ /* This 'implementation' is conjectured from the use of this functions in the RCS and BASH distributions. Of course these functions don't do too diff --git a/gnu/usr.bin/cvs/windows-NT/rcmd.c b/gnu/usr.bin/cvs/windows-NT/rcmd.c index 3a45b625623..8437e3cd438 100644 --- a/gnu/usr.bin/cvs/windows-NT/rcmd.c +++ b/gnu/usr.bin/cvs/windows-NT/rcmd.c @@ -12,6 +12,9 @@ Jim Blandy <jimb@cyclic.com> --- August 1995 */ +#include "cvs.h" +#include "rcmd.h" + #include <io.h> #include <fcntl.h> #include <malloc.h> @@ -39,9 +42,6 @@ #include <stdio.h> #include <assert.h> -#include "cvs.h" -#include "rcmd.h" - /* The rest of this file contains the rcmd() code, which is used only by START_SERVER. The idea for a long-term direction is that this code can be made portable (by using SOCK_ERRNO and @@ -167,6 +167,11 @@ rcmd_authenticate (int fd, char *locuser, char *remuser, char *command) } if (c != '\0') { + /* All the junk with USER, LOGNAME, GetUserName, &c, is so + confusing that we better give some clue as to what sort + of user name we decided on. */ + error (0, 0, "cannot log in as local user '%s', remote user '%s'", + locuser, remuser); error (1, 0, "Permission denied by rshd"); } } diff --git a/gnu/usr.bin/cvs/windows-NT/run.c b/gnu/usr.bin/cvs/windows-NT/run.c index d3e20865c26..e3411cba477 100644 --- a/gnu/usr.bin/cvs/windows-NT/run.c +++ b/gnu/usr.bin/cvs/windows-NT/run.c @@ -22,19 +22,6 @@ #include <io.h> #include <fcntl.h> -#ifdef HAVE_VPRINTF -#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__) -#include <stdarg.h> -#define VA_START(args, lastarg) va_start(args, lastarg) -#else -#include <varargs.h> -#define VA_START(args, lastarg) va_start(args) -#endif -#else -#define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -#endif - static void run_add_arg PROTO((const char *s)); static void run_init_prog PROTO((void)); @@ -53,29 +40,17 @@ extern char *strtok (); * The execvp() syscall will be used, so that the PATH is searched correctly. * File redirections can be performed in the call to run_exec(). */ -static char *run_prog; static char **run_argv; static int run_argc; static int run_argc_allocated; -/* VARARGS */ -#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)) -void -run_setup (const char *fmt,...) -#else -void -run_setup (fmt, va_alist) - char *fmt; - va_dcl -#endif +void +run_setup (const char *prog) { -#ifdef HAVE_VPRINTF - va_list args; -#endif char *cp; int i; - run_init_prog (); + char *run_prog; /* clean out any malloc'ed values from run_argv */ for (i = 0; i < run_argc; i++) @@ -88,18 +63,13 @@ run_setup (fmt, va_alist) } run_argc = 0; - /* process the varargs into run_prog */ -#ifdef HAVE_VPRINTF - VA_START (args, fmt); - (void) vsprintf (run_prog, fmt, args); - va_end (args); -#else - (void) sprintf (run_prog, fmt, a1, a2, a3, a4, a5, a6, a7, a8); -#endif + run_prog = xstrdup (prog); /* put each word into run_argv, allocating it as we go */ for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t")) run_add_arg (cp); + + free (run_prog); } void @@ -109,50 +79,32 @@ run_arg (s) run_add_arg (s); } -/* VARARGS */ -#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)) -void -run_args (const char *fmt,...) -#else -void -run_args (fmt, va_alist) - char *fmt; - va_dcl -#endif -{ -#ifdef HAVE_VPRINTF - va_list args; -#endif - - run_init_prog (); - - /* process the varargs into run_prog */ -#ifdef HAVE_VPRINTF - VA_START (args, fmt); - (void) vsprintf (run_prog, fmt, args); - va_end (args); -#else - (void) sprintf (run_prog, fmt, a1, a2, a3, a4, a5, a6, a7, a8); -#endif - - /* and add the (single) argument to the run_argv list */ - run_add_arg (run_prog); -} - /* Return a malloc'd copy of s, with double quotes around it. */ static char * quote (const char *s) { - size_t s_len = strlen (s); - char *copy = xmalloc (s_len + 3); - char *scan = copy; - + size_t s_len = 0; + char *copy = NULL; + char *scan = (char *) s; + + /* scan string for extra quotes ... */ + while (*scan) + if ('"' == *scan++) + s_len += 2; /* one extra for the quote character */ + else + s_len++; + /* allocate length + byte for ending zero + for double quotes around */ + scan = copy = xmalloc(s_len + 3); *scan++ = '"'; - strcpy (scan, s); - scan += s_len; + while (*s) + { + if ('"' == *s) + *scan++ = '\\'; + *scan++ = *s++; + } + /* ending quote and closing zero */ *scan++ = '"'; *scan++ = '\0'; - return copy; } @@ -177,20 +129,11 @@ run_add_arg (s) run_argv[run_argc] = (char *) 0; /* not post-incremented on purpose! */ } -static void -run_init_prog () -{ - /* make sure that run_prog is allocated once */ - if (run_prog == (char *) 0) - run_prog = xmalloc (10 * 1024); /* 10K of args for _setup and _arg */ -} - - int run_exec (stin, stout, sterr, flags) - char *stin; - char *stout; - char *sterr; + const char *stin; + const char *stout; + const char *sterr; int flags; { int shin, shout, sherr; @@ -339,7 +282,6 @@ run_exec (stin, stout, sterr, flags) return (status); } - void run_print (fp) FILE *fp; diff --git a/gnu/usr.bin/cvs/windows-NT/win32.c b/gnu/usr.bin/cvs/windows-NT/win32.c index 35710ef63c6..8a25aa6e6ba 100644 --- a/gnu/usr.bin/cvs/windows-NT/win32.c +++ b/gnu/usr.bin/cvs/windows-NT/win32.c @@ -12,6 +12,8 @@ #include <windows.h> #include <config.h> +#include <winsock.h> +#include <stdlib.h> void init_winsock () @@ -42,11 +44,14 @@ int gethostname(char* name, int namelen) } #endif -char* win32getlogin() +char *win32getlogin() { - static char name[256]; - DWORD dw = 256; - GetUserName(name, &dw); + static char name[256]; + DWORD dw = 256; + GetUserName (name, &dw); + if (name[0] == '\0') + return NULL; + else return name; } |