diff options
Diffstat (limited to 'contrib/cvs/src/sanity.sh')
-rwxr-xr-x | contrib/cvs/src/sanity.sh | 7878 |
1 files changed, 7157 insertions, 721 deletions
diff --git a/contrib/cvs/src/sanity.sh b/contrib/cvs/src/sanity.sh index a815fc0..4084b5f 100755 --- a/contrib/cvs/src/sanity.sh +++ b/contrib/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,19 @@ 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 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 +671,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 +778,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 +853,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 +881,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 +915,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 +930,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 +948,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 +972,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 +1023,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 +1045,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 +1055,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 +1070,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 +1079,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 +1166,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 +1536,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 +1612,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 +1685,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 +1698,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 +1755,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 +1894,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 +1919,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 +1941,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 +1967,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 +1979,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 +1997,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 +2051,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 +2076,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 +2156,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 +2172,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 +2183,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 +2196,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 +2235,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 +2269,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 +2282,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 +2299,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 +2335,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 +2367,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 +2414,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 +2459,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 +2482,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 +2535,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 +2562,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 +2634,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 +2665,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 +2688,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 +2699,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 +2820,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 +2854,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 +2947,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 +3014,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 +3260,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 +3335,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 +3364,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 +3378,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 +3410,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 +3460,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 +3473,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 +3528,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 +3557,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 + # \----->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 +3739,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 +3782,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 +3833,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 +3869,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 +4013,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 +4351,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 +4404,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 +4446,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 +4469,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 +4572,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 +4611,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 +4638,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 +4694,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 +4768,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 +5076,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 +5099,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 +5111,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 +5119,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 +5207,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 +5243,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 +5308,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 +5329,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 +5353,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 +5383,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 +5415,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 +5527,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 +5546,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 +5556,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 +5566,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 +5619,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 +5630,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 +5666,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,6 +5690,16 @@ 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 ;; @@ -4477,49 +5712,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 +5756,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 +6004,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 +6171,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 +6292,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 +6319,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 +6416,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 +6500,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 +6617,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 +6629,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 +6670,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 +6701,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 +6738,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 +6756,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 +6824,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 +6840,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 +6916,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 +6935,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,56 +6994,342 @@ 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 .. + + rm -rf ${CVSROOT_DIRNAME}/first-dir + 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 +7372,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 +7696,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 +7718,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 +7738,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 +7773,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 +7789,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 +7806,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 +7829,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 +7893,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 +7957,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 +8008,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 +8024,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 +8095,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 +8241,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 +8272,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 +8279,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 +8287,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 +8308,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 +8552,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 +8601,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 +8685,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 +8857,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 +9125,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 +9134,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 +9182,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 +9225,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 +9252,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 +9302,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 +9425,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 +9438,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 +9465,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 +9521,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 +9556,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 +9690,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 +9714,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\.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 ../../2/first-dir + dotest keywordlog-12 "${testcvs} -q update" "[UP] file1" + dotest keywordlog-13 "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 ../../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 +9882,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 +9899,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 +9928,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 +9943,3368 @@ ${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 + dotest multibranch2-3 "${testcvs} add file1" \ +"${PROG} [a-z]*: scheduling file .file1. for addition +${PROG} [a-z]*: use .${PROG} commit. to add this file 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" + dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1" + dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1" + + dotest multibranch2-7 "${testcvs} -q update -r B" '' + echo branch-B >file1 + 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" + + dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1' + 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" \ +" +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" \ +" +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 +=============================================================================" + + 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 +13327,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 +13344,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. |