]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/src/sanity.sh
Import cvs-1.9.23 as at 19980123. There are a number of really nice
[FreeBSD/FreeBSD.git] / contrib / cvs / src / sanity.sh
1 #! /bin/sh
2 :
3 #       sanity.sh -- a growing testsuite for cvs.
4 #
5 # The copyright notice said: "Copyright (C) 1992, 1993 Cygnus Support"
6 # I'm not adding new copyright notices for new years as our recent 
7 # practice has been to include copying terms without copyright notices.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # Original Author: K. Richard Pixley
20
21 # usage: sanity.sh [-r] @var{cvs-to-test} @var{tests-to-run}
22 # -r means to test remote instead of local cvs.
23 # @var{tests-to-run} are the names of the tests to run; if omitted run all
24 # tests.
25
26 # See TODO list at end of file.
27
28 # You can't run CVS as root; print a nice error message here instead
29 # of somewhere later, after making a mess.
30 # Commented out because:
31 # (1) whoami is not portable.  If memory serves the POSIX way is "id -un".
32 #     ("logname" or "who am i" are similar but different--they have more to
33 #      do with who logged in on your tty than your uid).
34 # (2) This definition of "root" doesn't quite match CVS's (which is based
35 #     on uid 0, not username "root").
36 #case "`whoami`" in
37 #  "root" )
38 #    echo "sanity.sh: test suite does not work correctly when run as root" >&2
39 #    exit 1
40 #  ;;
41 #esac
42
43 # required to make this script work properly.
44 unset CVSREAD
45
46 # The default value of /tmp/cvs-sanity for TESTDIR is dubious,
47 # because it loses if two people/scripts try to run the tests
48 # at the same time.  Some possible solutions:
49 # 1.  Use /tmp/cvs-test$$.  One disadvantage is that the old
50 #     cvs-test* directories would pile up, because they wouldn't
51 #     necessarily get removed.
52 # 2.  Have everyone/everything running the testsuite set
53 #     TESTDIR to some appropriate directory.
54 # 3.  Have the default value of TESTDIR be some variation of
55 #     `pwd`/cvs-sanity.  The biggest problem here is that we have
56 #     been fairly careful to test that CVS prints in messages the
57 #     actual pathnames that we pass to it, rather than a different
58 #     pathname for the same directory, as may come out of `pwd`.
59 #     So this would be lost if everything was `pwd`-based.  I suppose
60 #     if we wanted to get baroque we could start making symlinks
61 #     to ensure the two are different.
62 TESTDIR=${TESTDIR:-/tmp/cvs-sanity}
63
64 # "debugger"
65 #set -x
66
67 echo 'This test should produce no other output than this line, and a final "OK".'
68
69 if test x"$1" = x"-r"; then
70         shift
71         remote=yes
72         # If we're going to do remote testing, make sure 'rsh' works first.
73         host="`hostname`"
74         if test "x`${CVS_RSH-rsh} $host -n 'echo hi'`" != "xhi"; then
75             echo "ERROR: cannot test remote CVS, because \`rsh $host' fails." >&2
76             exit 1
77         fi
78 else
79         remote=no
80 fi
81
82 # The --keep option will eventually cause all the tests to leave around the
83 # contents of the /tmp directory; right now only some implement it.  Not
84 # useful if you are running more than one test.
85 # FIXME: need some real option parsing so this doesn't depend on the order
86 # in which they are specified.
87 if test x"$1" = x"--keep"; then
88   shift
89   keep=yes
90 else
91   keep=no
92 fi
93
94 # Use full path for CVS executable, so that CVS_SERVER gets set properly
95 # for remote.
96 case $1 in
97 /*)
98         testcvs=$1
99         ;;
100 *)
101         testcvs=`pwd`/$1
102         ;;
103 esac
104
105 shift
106
107 # Regexp to match what CVS will call itself in output that it prints.
108 # FIXME: we don't properly quote this--if the name contains . we'll
109 # just spuriously match a few things; if the name contains other regexp
110 # special characters we are probably in big trouble.
111 PROG=`basename ${testcvs}`
112
113 # Regexp to match an author name.  I'm not really sure what characters
114 # should be here.  a-zA-Z obviously.  People complained when 0-9 were
115 # not allowed in usernames.  Other than that I'm not sure.
116 username="[-a-zA-Z0-9][-a-zA-Z0-9]*"
117
118 # Regexp to match the name of a temporary file (from cvs_temp_name).
119 # This appears in certain diff output.
120 tempname="[-a-zA-Z0-9/.%_]*"
121
122 # On cygwin32, we may not have /bin/sh.
123 if [ -r /bin/sh ]; then
124   TESTSHELL="/bin/sh"
125 else
126   TESTSHELL=`type -p sh 2>/dev/null`
127   if [ ! -r "$TESTSHELL" ]; then
128     TESTSHELL="/bin/sh"
129   fi
130 fi
131
132 # FIXME: try things (what things? checkins?) without -m.
133 #
134 # Some of these tests are written to expect -Q.  But testing with
135 # -Q is kind of bogus, it is not the way users actually use CVS (usually).
136 # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
137 # and then they've obviously got to do something with the output....
138 #
139 CVS="${testcvs} -Q"
140
141 LOGFILE=`pwd`/check.log
142
143 # Save the previous log in case the person running the tests decides
144 # they want to look at it.  The extension ".plog" is chosen for consistency
145 # with dejagnu.
146 if test -f check.log; then
147         mv check.log check.plog
148 fi
149
150 GEXPRLOCS="`echo $PATH | sed 's/:/ /g'` /usr/local/bin /usr/contrib/bin /usr/gnu/bin /local/bin /local/gnu/bin /gun/bin"
151
152 EXPR=expr
153
154 # Cause NextStep 3.3 users to lose in a more graceful fashion.
155 if $EXPR 'abc
156 def' : 'abc
157 def' >/dev/null; then
158   : good, it works
159 else
160   for path in $GEXPRLOCS ; do
161     if test -x $path/gexpr ; then
162       if test "X`$path/gexpr --version`" != "X--version" ; then
163         EXPR=$path/gexpr
164         break
165       fi
166     fi
167     if test -x $path/expr ; then
168       if test "X`$path/expr --version`" != "X--version" ; then
169         EXPR=$path/expr
170         break
171       fi
172     fi
173   done
174   if test -z "$EXPR" ; then
175     echo 'Running these tests requires an "expr" program that can handle'
176     echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but'
177     echo 'not all vendor-supplied versions) is in your path.'
178     exit 1
179   fi
180 fi
181
182 # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
183 # if we can't find a GNU expr to ease their troubles...
184 if $EXPR 'a
185 b' : 'a
186 c' >/dev/null; then
187   for path in $GEXPRLOCS ; do
188     if test -x $path/gexpr ; then
189       if test "X`$path/gexpr --version`" != "X--version" ; then
190         EXPR=$path/gexpr
191         break
192       fi
193     fi
194     if test -x $path/expr ; then
195       if test "X`$path/expr --version`" != "X--version" ; then
196         EXPR=$path/expr
197         break
198       fi
199     fi
200   done
201   if test -z "$EXPR" ; then
202     echo 'Warning: you are using a version of expr which does not correctly'
203     echo 'match multi-line patterns.  Some tests may spuriously pass.'
204     echo 'You may wish to make sure GNU expr is in your path.'
205     EXPR=expr
206   fi
207 else
208   : good, it works
209 fi
210
211 # That we should have to do this is total bogosity, but GNU expr
212 # version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix
213 # (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
214 # next release of GNU expr after 1.12 (but we still have to cater to the old
215 # ones for some time because they are in many linux distributions).
216 ENDANCHOR="$"
217 if $EXPR 'abc
218 def' : 'abc$' >/dev/null; then
219   ENDANCHOR='\'\'
220 fi
221
222 # Work around another GNU expr (version 1.10-1.12) bug/incompatibility.
223 # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
224 # Note that the workaround is not a complete equivalent of .* because
225 # the first parenthesized expression in the regexp must match something
226 # in order for expr to return a successful exit status.
227 # Rumor has it this will be fixed in the
228 # next release of GNU expr after 1.12 (but we still have to cater to the old
229 # ones for some time because they are in many linux distributions).
230 DOTSTAR='.*'
231 if $EXPR 'abc
232 def' : "a${DOTSTAR}f" >/dev/null; then
233   : good, it works
234 else
235   DOTSTAR='\(.\|
236 \)*'
237 fi
238
239 # Work around yet another GNU expr (version 1.10) bug/incompatibility.
240 # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
241 # it is not.  I doubt that POSIX allows us to use \+ and assume it means
242 # (non-special) +, so here is another workaround
243 # Rumor has it this will be fixed in the
244 # next release of GNU expr after 1.12 (but we still have to cater to the old
245 # ones for some time because they are in many linux distributions).
246 PLUS='+'
247 if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
248   : good, it works
249 else
250   PLUS='\+'
251 fi
252
253 # Likewise, for ?
254 QUESTION='?'
255 if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
256   : good, it works
257 else
258   QUESTION='\?'
259 fi
260
261 pass ()
262 {
263   echo "PASS: $1" >>${LOGFILE}
264 }
265
266 fail ()
267 {
268   echo "FAIL: $1" | tee -a ${LOGFILE}
269   # This way the tester can go and see what remnants were left
270   exit 1
271 }
272
273 # See dotest and dotest_fail for explanation (this is the parts
274 # of the implementation common to the two).
275 dotest_internal ()
276 {
277   # expr can't distinguish between "zero characters matched" and "no match",
278   # so special-case it.
279   if test -z "$3"; then
280     if test -s ${TESTDIR}/dotest.tmp; then
281       echo "** expected: " >>${LOGFILE}
282       echo "$3" >>${LOGFILE}
283       echo "$3" > ${TESTDIR}/dotest.exp
284       rm -f ${TESTDIR}/dotest.ex2
285       echo "** got: " >>${LOGFILE}
286       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
287       fail "$1"
288     else
289       pass "$1"
290     fi
291   else
292     if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
293         "$3"${ENDANCHOR} >/dev/null; then
294       # See below about writing this to the logfile.
295       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
296       pass "$1"
297     else
298       if test x"$4" != x; then
299         if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
300             "$4"${ENDANCHOR} >/dev/null; then
301           # Why, I hear you ask, do we write this to the logfile
302           # even when the test passes?  The reason is that the test
303           # may give us the regexp which we were supposed to match,
304           # but sometimes it may be useful to look at the exact
305           # text which was output.  For example, suppose one wants
306           # to grep for a particular warning, and make _sure_ that
307           # CVS never hits it (even in cases where the tests might
308           # match it with .*).  Or suppose one wants to see the exact
309           # date format output in a certain case (where the test will
310           # surely use a somewhat non-specific pattern).
311           cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
312           pass "$1"
313         else
314           echo "** expected: " >>${LOGFILE}
315           echo "$3" >>${LOGFILE}
316           echo "$3" > ${TESTDIR}/dotest.ex1
317           echo "** or: " >>${LOGFILE}
318           echo "$4" >>${LOGFILE}
319           echo "$4" > ${TESTDIR}/dotest.ex2
320           echo "** got: " >>${LOGFILE}
321           cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
322           fail "$1"
323         fi
324       else
325         echo "** expected: " >>${LOGFILE}
326         echo "$3" >>${LOGFILE}
327         echo "$3" > ${TESTDIR}/dotest.exp
328         echo "** got: " >>${LOGFILE}
329         cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
330         fail "$1"
331       fi
332     fi
333   fi
334 }
335
336 dotest_all_in_one ()
337 {
338   if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
339          "`cat ${TESTDIR}/dotest.exp`" >/dev/null; then
340     return 0
341   fi
342   return 1
343 }
344
345 # WARNING: this won't work with REs that match newlines....
346 #
347 dotest_line_by_line ()
348 {
349   line=1
350   while [ $line -le `wc -l ${TESTDIR}/dotest.tmp` ] ; do
351     echo "$line matched \c" >>$LOGFILE
352     if $EXPR "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" : \
353        "`sed -n ${line}p ${TESTDIR}/dotest.exp`" >/dev/null; then
354       :
355     else
356       echo "**** expected line: " >>${LOGFILE}
357       sed -n ${line}p ${TESTDIR}/dotest.exp >>${LOGFILE}
358       echo "**** got line: " >>${LOGFILE}
359       sed -n ${line}p ${TESTDIR}/dotest.tmp >>${LOGFILE}
360       unset line
361       return 1
362     fi
363     line=`expr $line + 1`
364   done
365   unset line
366   return 0
367 }
368
369 # If you are having trouble telling which line of a multi-line
370 # expression is not being matched, replace calls to dotest_internal()
371 # with calls to this function:
372 #
373 dotest_internal_debug ()
374 {
375   if test -z "$3"; then
376     if test -s ${TESTDIR}/dotest.tmp; then
377       echo "** expected: " >>${LOGFILE}
378       echo "$3" >>${LOGFILE}
379       echo "$3" > ${TESTDIR}/dotest.exp
380       rm -f ${TESTDIR}/dotest.ex2
381       echo "** got: " >>${LOGFILE}
382       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
383       fail "$1"
384     else
385       pass "$1"
386     fi
387   else
388     echo "$3" > ${TESTDIR}/dotest.exp
389     if dotest_line_by_line "$1" "$2"; then
390       pass "$1"
391     else
392       if test x"$4" != x; then
393         mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1
394         echo "$4" > ${TESTDIR}/dotest.exp
395         if dotest_line_by_line "$1" "$2"; then
396           pass "$1"
397         else
398           mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2
399           echo "** expected: " >>${LOGFILE}
400           echo "$3" >>${LOGFILE}
401           echo "** or: " >>${LOGFILE}
402           echo "$4" >>${LOGFILE}
403           echo "** got: " >>${LOGFILE}
404           cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
405           fail "$1"
406         fi
407       else
408         echo "** expected: " >>${LOGFILE}
409         echo "$3" >>${LOGFILE}
410         echo "** got: " >>${LOGFILE}
411         cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
412         fail "$1"
413       fi
414     fi
415   fi
416 }
417
418 # Usage:
419 #  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
420 # TESTNAME is the name used in the log to identify the test.
421 # COMMAND is the command to run; for the test to pass, it exits with
422 # exitstatus zero.
423 # OUTPUT is a regexp which is compared against the output (stdout and
424 # stderr combined) from the test.  It is anchored to the start and end
425 # of the output, so should start or end with ".*" if that is what is desired.
426 # Trailing newlines are stripped from the command's actual output before
427 # matching against OUTPUT.
428 # If OUTPUT2 is specified and the output matches it, then it is also
429 # a pass (partial workaround for the fact that some versions of expr
430 # lack \|).
431 dotest ()
432 {
433   rm -f ${TESTDIR}/dotest.ex? 2>&1
434   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
435     : so far so good
436   else
437     status=$?
438     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
439     echo "exit status was $status" >>${LOGFILE}
440     fail "$1"
441   fi
442   dotest_internal "$@"
443 }
444
445 # Like dotest except only 2 args and result must exactly match stdin
446 dotest_lit ()
447 {
448   rm -f ${TESTDIR}/dotest.ex? 2>&1
449   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
450     : so far so good
451   else
452     status=$?
453     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
454     echo "exit status was $status" >>${LOGFILE}
455     fail "$1"
456   fi
457   cat >${TESTDIR}/dotest.exp
458   if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
459     pass "$1"
460   else
461     echo "** expected: " >>${LOGFILE}
462     cat ${TESTDIR}/dotest.exp >>${LOGFILE}
463     echo "** got: " >>${LOGFILE}
464     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
465     fail "$1"
466   fi
467 }
468
469 # Like dotest except exitstatus should be nonzero.
470 dotest_fail ()
471 {
472   rm -f ${TESTDIR}/dotest.ex? 2>&1
473   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
474     status=$?
475     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
476     echo "exit status was $status" >>${LOGFILE}
477     fail "$1"
478   else
479     : so far so good
480   fi
481   dotest_internal "$@"
482 }
483
484 # Like dotest except second argument is the required exitstatus.
485 dotest_status ()
486 {
487   $3 >${TESTDIR}/dotest.tmp 2>&1
488   status=$?
489   if test "$status" = "$2"; then
490     : so far so good
491   else
492     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
493     echo "exit status was $status; expected $2" >>${LOGFILE}
494     fail "$1"
495   fi
496   dotest_internal "$1" "$3" "$4" "$5"
497 }
498
499 # Like dotest except output is sorted.
500 dotest_sort ()
501 {
502   rm -f ${TESTDIR}/dotest.ex? 2>&1
503   if $2 >${TESTDIR}/dotest.tmp1 2>&1; then
504     : so far so good
505   else
506     status=$?
507     cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
508     echo "exit status was $status" >>${LOGFILE}
509     fail "$1"
510   fi
511   sort < ${TESTDIR}/dotest.tmp1 > ${TESTDIR}/dotest.tmp
512   dotest_internal "$@"
513 }
514
515 # clean any old remnants
516 rm -rf ${TESTDIR}
517 mkdir ${TESTDIR}
518 cd ${TESTDIR}
519 # This will show up in cvs history output where it prints the working
520 # directory.  It should *not* appear in any cvs output referring to the
521 # repository; cvs should use the name of the repository as specified.
522 #
523 # Note that using pwd here rather than /bin/pwd will make it even less
524 # likely that we test whether CVS is distinguishing between TMPPWD
525 # and TESTDIR.  However, there is no guarantee that will test it anyway.
526 # If we really care, we should do something along the lines of:
527 #   cd /tmp/cvs-sanity  # In reality, overridable with environment variable?
528 #   mkdir realdir
529 #   ln -s realdir testdir
530 #   TESTDIR=/tmp/cvs-sanity/testdir
531 #   TMPPWD=/tmp/cvs-sanity/realdir
532 TMPPWD=`pwd`
533
534 # Avoid picking up any stray .cvsrc, etc., from the user running the tests
535 mkdir home
536 HOME=${TESTDIR}/home; export HOME
537
538 # Make sure this variable is not defined to anything that would
539 # change the format of rcs dates.  Otherwise people using e.g.,
540 # RCSINIT=-zLT get lots of spurious failures.
541 RCSINIT=; export RCSINIT
542
543 # Remaining arguments are the names of tests to run.
544 #
545 # The testsuite is broken up into (hopefully manageably-sized)
546 # independently runnable tests, so that one can quickly get a result
547 # from a cvs or testsuite change, and to facilitate understanding the
548 # tests.
549
550 if test x"$*" = x; then
551         tests="basica basicb basicc basic1 deep basic2"
552         tests="${tests} rdiff death death2 branches"
553         tests="${tests} rcslib multibranch import importb join join2 join3"
554         tests="${tests} new newb conflicts conflicts2 conflicts3"
555         tests="${tests} modules modules2 modules3 mflag editor errmsg1 errmsg2"
556         tests="${tests} devcom devcom2 devcom3 watch4"
557         tests="${tests} ignore binfiles binfiles2 mcopy binwrap binwrap2"
558         tests="${tests} binwrap3 mwrap info config"
559         tests="${tests} serverpatch log log2 ann crerepos rcs big modes stamps"
560         tests="${tests} sticky keyword keywordlog"
561         tests="${tests} toplevel head tagdate multibranch2"
562         tests="${tests} admin reserved"
563         tests="${tests} cvsadm diffmerge1 diffmerge2"
564 else
565         tests="$*"
566 fi
567
568 # a simple function to compare directory contents
569 #
570 # Returns: {nothing}
571 # Side Effects: ISDIFF := true|false
572 #
573 directory_cmp ()
574 {
575         OLDPWD=`pwd`
576         DIR_1=$1
577         DIR_2=$2
578         ISDIFF=false
579
580         cd $DIR_1
581         find . -print | fgrep -v /CVS | sort > /tmp/dc$$d1
582
583         # go back where we were to avoid symlink hell...
584         cd $OLDPWD
585         cd $DIR_2
586         find . -print | fgrep -v /CVS | sort > /tmp/dc$$d2
587
588         if diff /tmp/dc$$d1 /tmp/dc$$d2 >/dev/null 2>&1
589         then
590                 :
591         else
592                 ISDIFF=true
593                 return
594         fi
595         cd $OLDPWD
596         while read a
597         do
598                 if test -f $DIR_1/"$a" ; then
599                         cmp -s $DIR_1/"$a" $DIR_2/"$a"
600                         if test $? -ne 0 ; then
601                                 ISDIFF=true
602                         fi
603                 fi
604         done < /tmp/dc$$d1
605         rm -f /tmp/dc$$*
606 }
607
608 # Set up CVSROOT (the crerepos tests will test operating without CVSROOT set).
609 CVSROOT_DIRNAME=${TESTDIR}/cvsroot
610 CVSROOT=${CVSROOT_DIRNAME} ; export CVSROOT
611 if test "x$remote" = xyes; then
612         # Use rsh so we can test it without having to muck with inetd
613         # or anything like that.  Also needed to get CVS_SERVER to
614         # work.
615         CVSROOT=:ext:`hostname`:${CVSROOT_DIRNAME} ; export CVSROOT
616         CVS_SERVER=${testcvs}; export CVS_SERVER
617 fi
618
619 dotest 1 "${testcvs} init" ''
620
621 ### The big loop
622 for what in $tests; do
623         case $what in
624         basica)
625           # Similar in spirit to some of the basic1, and basic2
626           # tests, but hopefully a lot faster.  Also tests operating on
627           # files two directories down *without* operating on the parent dirs.
628
629           # Tests basica-0a and basica-0b provide the equivalent of the:
630           #    mkdir ${CVSROOT_DIRNAME}/first-dir
631           # used by many of the tests.  It is "more official" in the sense
632           # that is does everything through CVS; the reason most of the
633           # tests don't use it is mostly historical.
634           mkdir 1; cd 1
635           dotest basica-0a "${testcvs} -q co -l ." ''
636           mkdir first-dir
637           dotest basica-0b "${testcvs} add first-dir" \
638 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
639           cd ..
640           rm -r 1
641
642           dotest basica-1 "${testcvs} -q co first-dir" ''
643           cd first-dir
644
645           # Test a few operations, to ensure they gracefully do
646           # nothing in an empty directory.
647           dotest basica-1a0 "${testcvs} -q update" ''
648           dotest basica-1a1 "${testcvs} -q diff -c" ''
649           dotest basica-1a2 "${testcvs} -q status" ''
650
651           mkdir sdir
652           # Remote CVS gives the "cannot open CVS/Entries" error, which is
653           # clearly a bug, but not a simple one to fix.
654           dotest basica-1a10 "${testcvs} -n add sdir" \
655 "Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository" \
656 "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
657 Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
658           dotest_fail basica-1a11 \
659             "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
660           dotest basica-2 "${testcvs} add sdir" \
661 "Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
662           cd sdir
663           mkdir ssdir
664           dotest basica-3 "${testcvs} add ssdir" \
665 "Directory ${TESTDIR}/cvsroot/first-dir/sdir/ssdir added to the repository"
666           cd ssdir
667           echo ssfile >ssfile
668
669           # Trying to commit it without a "cvs add" should be an error.
670           # The "use `cvs add' to create an entry" message is the one
671           # that I consider to be more correct, but local cvs prints the
672           # "nothing known" message and noone has gotten around to fixing it.
673           dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
674 "${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
675 ${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
676 "${PROG}"' [a-z]*: nothing known about `ssfile'\''
677 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
678
679           dotest basica-4 "${testcvs} add ssfile" \
680 "${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition
681 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
682           dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
683 "${PROG} [a-z]*: nothing known about ssfile
684 ${PROG} "'\[[a-z]* aborted\]: correct the above errors first!'
685           cd ../..
686           dotest basica-5 "${testcvs} -q ci -m add-it" \
687 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
688 done
689 Checking in sdir/ssdir/ssfile;
690 ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
691 initial revision: 1\.1
692 done"
693           dotest_fail basica-5a \
694             "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
695 "${PROG} [a-z]*: Attempt to add reserved tag name BASE
696 ${PROG} \[[a-z]* aborted\]: failed to set tag BASE to revision 1\.1 in ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v"
697           dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
698 'T sdir/ssdir/ssfile'
699
700           dotest basica-6 "${testcvs} -q update" ''
701           echo "ssfile line 2" >>sdir/ssdir/ssfile
702           dotest_status basica-6.2 1 "${testcvs} -q diff -c" \
703 "Index: sdir/ssdir/ssfile
704 ===================================================================
705 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
706 retrieving revision 1\.1
707 diff -c -r1\.1 ssfile
708 \*\*\* ssfile   [0-9/]* [0-9:]* 1\.1
709 --- ssfile      [0-9/]* [0-9:]*
710 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
711 \*\*\* 1 \*\*\*\*
712 --- 1,2 ----
713   ssfile
714 ${PLUS} ssfile line 2"
715           dotest_status basica-6.3 1 "${testcvs} -q diff -c -rBASE" \
716 "Index: sdir/ssdir/ssfile
717 ===================================================================
718 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
719 retrieving revision 1\.1
720 diff -c -r1\.1 ssfile
721 \*\*\* ssfile   [0-9/]* [0-9:]* 1\.1
722 --- ssfile      [0-9/]* [0-9:]*
723 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
724 \*\*\* 1 \*\*\*\*
725 --- 1,2 ----
726   ssfile
727 ${PLUS} ssfile line 2"
728           dotest basica-7 "${testcvs} -q ci -m modify-it" \
729 "Checking in sdir/ssdir/ssfile;
730 ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
731 new revision: 1\.2; previous revision: 1\.1
732 done"
733           dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
734 "${PROG}"' [a-z]*: nothing known about `nonexist'\''
735 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
736           dotest basica-8 "${testcvs} -q update" ''
737
738           # Test the -f option to ci
739           cd sdir/ssdir
740           dotest basica-8a0 "${testcvs} -q ci -m not-modified ssfile" ''
741           dotest basica-8a "${testcvs} -q ci -f -m force-it" \
742 "Checking in ssfile;
743 ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
744 new revision: 1\.3; previous revision: 1\.2
745 done"
746           dotest basica-8a1 "${testcvs} -q ci -m bump-it -r 2.0" \
747 "Checking in ssfile;
748 ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
749 new revision: 2\.0; previous revision: 1\.3
750 done"
751           # -f should not be necessary, but it should be harmless.
752           # Also test the "-r 3" (rather than "-r 3.0") usage.
753           dotest basica-8a2 "${testcvs} -q ci -m bump-it -f -r 3" \
754 "Checking in ssfile;
755 ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
756 new revision: 3\.1; previous revision: 2\.0
757 done"
758           cd ../..
759           dotest basica-8b "${testcvs} -q diff -r1.2 -r1.3" \
760 "Index: sdir/ssdir/ssfile
761 ===================================================================
762 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
763 retrieving revision 1\.2
764 retrieving revision 1\.3
765 diff -r1\.2 -r1\.3"
766
767           # The .* here will normally be "No such file or directory",
768           # but if memory serves some systems (AIX?) have a different message.
769 :         dotest_fail basica-9 \
770             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
771 "${PROG}: cannot access cvs root ${TESTDIR}/nonexist: .*"
772           dotest_fail basica-9 \
773             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
774 "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/nonexist/CVSROOT: .*"
775
776           dotest basica-10 "${testcvs} annotate" \
777 'Annotations for sdir/ssdir/ssfile
778 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
779 1\.1          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile
780 1\.2          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2'
781
782           # As long as we have a file with a few revisions, test
783           # a few "cvs admin -o" invocations.
784           cd sdir/ssdir
785           dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
786 "${PROG} [a-z]*: while processing more than one file:
787 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
788           dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
789 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
790 done"
791           dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
792 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
793 done"
794           dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
795 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
796 ${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
797 ${PROG} [a-z]*: cannot modify RCS file for .ssfile."
798           dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
799 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
800 done"
801           dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
802 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
803 done"
804           dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
805 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
806 done"
807           dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
808 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
809 deleting revision 2\.0
810 deleting revision 1\.3
811 done"
812           dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
813 "RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
814 deleting revision 2\.0
815 deleting revision 1\.3
816 done"
817           dotest basica-o7 "${testcvs} log -N ssfile" "
818 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
819 Working file: ssfile
820 head: 3\.1
821 branch:
822 locks: strict
823 access list:
824 keyword substitution: kv
825 total revisions: 3;     selected revisions: 3
826 description:
827 ----------------------------
828 revision 3\.1
829 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
830 bump-it
831 ----------------------------
832 revision 1\.2
833 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
834 modify-it
835 ----------------------------
836 revision 1\.1
837 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
838 add-it
839 ============================================================================="
840           dotest basica-o8 "${testcvs} -q update -p -r 1.1 ssfile" "ssfile"
841           cd ../..
842
843           cd ..
844
845           rm -rf ${CVSROOT_DIRNAME}/first-dir
846           rm -r first-dir
847           ;;
848
849         basicb)
850           # More basic tests, including non-branch tags and co -d.
851           mkdir 1; cd 1
852           dotest basicb-0a "${testcvs} -q co -l ." ''
853           touch topfile
854           dotest basicb-0b "${testcvs} add topfile" \
855 "${PROG} [a-z]*: scheduling file .topfile. for addition
856 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
857           dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
858 "RCS file: ${TESTDIR}/cvsroot/topfile,v
859 done
860 Checking in topfile;
861 ${TESTDIR}/cvsroot/topfile,v  <--  topfile
862 initial revision: 1\.1
863 done"
864           cd ..
865           rm -r 1
866           mkdir 2; cd 2
867           dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
868           # Now test the ability to run checkout on an existing working
869           # directory without having it lose its mind.  I don't know
870           # whether this is tested elsewhere in sanity.sh.  A more elaborate
871           # test might also have modified files, make sure it works if
872           # the modules file was modified to add new directories to the
873           # module, and such.
874           dotest basicb-0d0 "${testcvs} -q co -l ." ""
875           mkdir first-dir
876           dotest basicb-0e "${testcvs} add first-dir" \
877 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
878           cd ..
879           rm -r 2
880
881 :         mkdir ${CVSROOT_DIRNAME}/first-dir
882           dotest basicb-1 "${testcvs} -q co first-dir" ''
883           dotest basicb-1a "test -d CVS" ''
884
885           # In 1b and 1c, the first string matches if we're using absolute
886           # paths, while the second matches if RELATIVE_REPOS is defined
887           # (we're using relative paths).
888
889           dotest basicb-1b "cat CVS/Repository" \
890 "${TESTDIR}/cvsroot/\." \
891 "\."
892           dotest basicb-1c "cat first-dir/CVS/Repository" \
893 "${TESTDIR}/cvsroot/first-dir" \
894 "first-dir"
895
896           cd first-dir
897           # Note that the name Emptydir is chosen to test that CVS just
898           # treats it like any other directory name.  It should be
899           # special only when it is directly in $CVSROOT/CVSROOT.
900           mkdir Emptydir sdir2
901           dotest basicb-2 "${testcvs} add Emptydir sdir2" \
902 "Directory ${TESTDIR}/cvsroot/first-dir/Emptydir added to the repository
903 Directory ${TESTDIR}/cvsroot/first-dir/sdir2 added to the repository"
904           cd Emptydir
905           echo sfile1 starts >sfile1
906           dotest basicb-2a10 "${testcvs} -n add sfile1" \
907 "${PROG} [a-z]*: scheduling file .sfile1. for addition
908 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
909           dotest basicb-2a11 "${testcvs} status sfile1" \
910 "${PROG} [a-z]*: use .${PROG} add. to create an entry for sfile1
911 ===================================================================
912 File: sfile1            Status: Unknown
913
914    Working revision:    No entry for sfile1
915    Repository revision: No revision control file"
916           dotest basicb-3 "${testcvs} add sfile1" \
917 "${PROG} [a-z]*: scheduling file .sfile1. for addition
918 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
919           dotest basicb-3a1 "${testcvs} status sfile1" \
920 "===================================================================
921 File: sfile1            Status: Locally Added
922
923    Working revision:    New file!
924    Repository revision: No revision control file
925    Sticky Tag:          (none)
926    Sticky Date:         (none)
927    Sticky Options:      (none)"
928
929           cd ../sdir2
930           echo sfile2 starts >sfile2
931           dotest basicb-4 "${testcvs} add sfile2" \
932 "${PROG} [a-z]*: scheduling file .sfile2. for addition
933 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
934           dotest basicb-4a "${testcvs} -q ci CVS" \
935 "${PROG} [a-z]*: warning: directory CVS specified in argument
936 ${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
937           cd ..
938           dotest basicb-5 "${testcvs} -q ci -m add" \
939 "RCS file: ${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v
940 done
941 Checking in Emptydir/sfile1;
942 ${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v  <--  sfile1
943 initial revision: 1\.1
944 done
945 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v
946 done
947 Checking in sdir2/sfile2;
948 ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v  <--  sfile2
949 initial revision: 1\.1
950 done"
951           echo sfile1 develops >Emptydir/sfile1
952           dotest basicb-6 "${testcvs} -q ci -m modify" \
953 "Checking in Emptydir/sfile1;
954 ${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v  <--  sfile1
955 new revision: 1\.2; previous revision: 1\.1
956 done"
957           dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
958 T sdir2/sfile2'
959           echo not in time for release-1 >sdir2/sfile2
960           dotest basicb-8 "${testcvs} -q ci -m modify-2" \
961 "Checking in sdir2/sfile2;
962 ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v  <--  sfile2
963 new revision: 1\.2; previous revision: 1\.1
964 done"
965           # See if CVS can correctly notice when an invalid numeric
966           # revision is specified.
967           # Commented out until we get around to fixing CVS
968 :         dotest basicb-8a0 "${testcvs} diff -r 1.5 -r 1.7 sfile2" 'error msg'
969           cd ..
970
971           # Test that we recurse into the correct directory when checking
972           # for existing files, even if co -d is in use.
973           touch first-dir/extra
974           dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
975 'U first-dir1/Emptydir/sfile1
976 U first-dir1/sdir2/sfile2'
977           rm -r first-dir1
978
979           rm -r first-dir
980
981           # FIXME? basicb-9 used to check things out like this:
982           #   U newdir/Emptydir/sfile1
983           #   U newdir/sdir2/sfile2
984           # but that's difficult to do.  The whole "shorten" thing
985           # is pretty bogus, because it will break on things
986           # like "cvs co foo/bar baz/quux".  Unless there's some
987           # pretty detailed expansion and analysis of the command-line
988           # arguments, we shouldn't do "shorten" stuff at all.
989
990           dotest basicb-9 \
991 "${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
992 'U newdir/first-dir/Emptydir/sfile1
993 U newdir/first-dir/sdir2/sfile2'
994           dotest basicb-9a "test -d CVS" ''
995
996           # In 9b through 9f, the first string matches if we're using
997           # absolute paths, while the second matches if RELATIVE_REPOS
998           # is defined (we're using relative paths).
999
1000           dotest basicb-9b "cat CVS/Repository" \
1001 "${TESTDIR}/cvsroot/\." \
1002 "\."
1003           dotest basicb-9c "cat newdir/CVS/Repository" \
1004 "${TESTDIR}/cvsroot/\." \
1005 "\."
1006           dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
1007 "${TESTDIR}/cvsroot/first-dir" \
1008 "first-dir"
1009           dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
1010 "${TESTDIR}/cvsroot/first-dir/Emptydir" \
1011 "first-dir/Emptydir"
1012           dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
1013 "${TESTDIR}/cvsroot/first-dir/sdir2" \
1014 "first-dir/sdir2"
1015
1016           dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
1017 "sfile1 develops
1018 sfile2 starts"
1019
1020           rm -r newdir
1021
1022           # Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
1023           # seem to deal with it...
1024           if false; then
1025           dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
1026 "U sub1/sub2/Emptydir/sfile1
1027 U sub1/sub2/sdir2/sfile2"
1028           cd sub1
1029           dotest basicb-12 "${testcvs} -q update" ''
1030           touch xx
1031           dotest basicb-13 "${testcvs} add xx" fixme
1032           cd ..
1033           rm -r sub1
1034           # to test: sub1/sub2/sub3
1035           fi # end of tests commented out.
1036
1037           # Create a second directory.
1038           mkdir 1
1039           cd 1
1040           dotest basicb-14 "${testcvs} -q co -l ." 'U topfile'
1041           mkdir second-dir
1042           dotest basicb-15 "${testcvs} add second-dir" \
1043 "Directory ${TESTDIR}/cvsroot/second-dir added to the repository"
1044           cd second-dir
1045           touch aa
1046           dotest basicb-16 "${testcvs} add aa" \
1047 "${PROG} [a-z]*: scheduling file .aa. for addition
1048 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1049           dotest basicb-17 "${testcvs} -q ci -m add" \
1050 "RCS file: ${TESTDIR}/cvsroot/second-dir/aa,v
1051 done
1052 Checking in aa;
1053 ${TESTDIR}/cvsroot/second-dir/aa,v  <--  aa
1054 initial revision: 1\.1
1055 done"
1056           cd ../..
1057           rm -r 1
1058
1059           # Let's see if we can add something to Emptydir.
1060           dotest basicb-18 "${testcvs} -q co -d t2/t3 first-dir second-dir" \
1061 "U t2/t3/first-dir/Emptydir/sfile1
1062 U t2/t3/first-dir/sdir2/sfile2
1063 U t2/t3/second-dir/aa"
1064           cd t2
1065           touch emptyfile
1066           # The fact that CVS lets us add a file here is a CVS bug, right?
1067           # I can just make this an error message (on the add and/or the
1068           # commit) without getting flamed, right?
1069           # Right?
1070           # Right?
1071           dotest basicb-19 "${testcvs} add emptyfile" \
1072 "${PROG} [a-z]*: scheduling file .emptyfile. for addition
1073 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1074           dotest basicb-20 "${testcvs} -q ci -m add" \
1075 "RCS file: ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v
1076 done
1077 Checking in emptyfile;
1078 ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v  <--  emptyfile
1079 initial revision: 1\.1
1080 done"
1081           cd ..
1082           rm -r t2
1083
1084           mkdir 1; cd 1
1085           # Note that -H is an illegal option.
1086           # I suspect that the choice between "illegal" and "invalid"
1087           # depends on the user's environment variables, the phase
1088           # of the moon (weirdness with optind), and who knows what else.
1089           # I've been seeing "illegal"...
1090           dotest_fail basicb-21 "${testcvs} -q admin -H" \
1091 "admin: illegal option -- H
1092 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
1093 "admin: invalid option -- H
1094 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
1095           cd ..
1096           rmdir 1
1097
1098           # OK, while we have an Emptydir around, test a few obscure
1099           # things about it.
1100           mkdir edir; cd edir
1101           dotest basicb-edir-1 "${testcvs} -q co -l CVSROOT" \
1102 "U CVSROOT${DOTSTAR}"
1103           cd CVSROOT
1104           dotest_fail basicb-edir-2 "test -d Emptydir" ''
1105           # This tests the code in find_dirs which skips Emptydir.
1106           dotest basicb-edir-3 "${testcvs} -q -n update -d -P" ''
1107           cd ../..
1108           rm -r edir
1109
1110           if test "$keep" = yes; then
1111             echo Keeping ${TESTDIR} and exiting due to --keep
1112             exit 0
1113           fi
1114
1115           rm -rf ${CVSROOT_DIRNAME}/first-dir
1116           rm -rf ${CVSROOT_DIRNAME}/second-dir
1117           rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
1118           rm -f ${CVSROOT_DIRNAME}/topfile,v
1119           ;;
1120
1121         basicc)
1122           # More tests of basic/miscellaneous functionality.
1123           mkdir 1; cd 1
1124           dotest_fail basicc-1 "${testcvs} diff" \
1125 "${PROG} [a-z]*: in directory \.:
1126 ${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
1127           dotest basicc-2 "${testcvs} -q co -l ." ''
1128           mkdir first-dir second-dir
1129           dotest basicc-3 "${testcvs} add first-dir second-dir" \
1130 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository
1131 Directory ${TESTDIR}/cvsroot/second-dir added to the repository"
1132           # Old versions of CVS often didn't create this top-level CVS
1133           # directory in the first place.  I think that maybe the only
1134           # way to get avoid it currently is to let CVS create it, and
1135           # then blow it away.  But that is perfectly legal; people who
1136           # are used to the old behavior especially may be interested.
1137           rm -r CVS
1138           dotest basicc-4 "echo *" "first-dir second-dir"
1139           dotest basicc-5 "${testcvs} update" \
1140 "${PROG} [a-z]*: Updating first-dir
1141 ${PROG} [a-z]*: Updating second-dir" \
1142 "${PROG} [a-z]*: Updating \.
1143 ${PROG} [a-z]*: Updating first-dir
1144 ${PROG} [a-z]*: Updating second-dir"
1145
1146           cd ..
1147           rm -r 1
1148           rm -rf ${CVSROOT_DIRNAME}/first-dir
1149           ;;
1150
1151         basic1)
1152           # first dive - add a files, first singly, then in a group.
1153           mkdir ${CVSROOT_DIRNAME}/first-dir
1154           mkdir 1; cd 1
1155           # check out an empty directory
1156           dotest basic1-1 "${testcvs} -q co first-dir" ''
1157
1158           cd first-dir
1159           echo file2 >file2
1160           echo file3 >file3
1161           echo file4 >file4
1162           echo file5 >file5
1163
1164           dotest basic1-14-add-add "${testcvs} add file2 file3 file4 file5" \
1165 "${PROG} [a-z]*: scheduling file \`file2' for addition
1166 ${PROG} [a-z]*: scheduling file \`file3' for addition
1167 ${PROG} [a-z]*: scheduling file \`file4' for addition
1168 ${PROG} [a-z]*: scheduling file \`file5' for addition
1169 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
1170           dotest basic1-15-add-add \
1171 "${testcvs} -q update file2 file3 file4 file5" \
1172 "A file2
1173 A file3
1174 A file4
1175 A file5"
1176           dotest basic1-16-add-add "${testcvs} -q update" \
1177 "A file2
1178 A file3
1179 A file4
1180 A file5"
1181           dotest basic1-17-add-add "${testcvs} -q status" \
1182 "===================================================================
1183 File: file2             Status: Locally Added
1184
1185    Working revision:    New file!
1186    Repository revision: No revision control file
1187    Sticky Tag:          (none)
1188    Sticky Date:         (none)
1189    Sticky Options:      (none)
1190
1191 ===================================================================
1192 File: file3             Status: Locally Added
1193
1194    Working revision:    New file!
1195    Repository revision: No revision control file
1196    Sticky Tag:          (none)
1197    Sticky Date:         (none)
1198    Sticky Options:      (none)
1199
1200 ===================================================================
1201 File: file4             Status: Locally Added
1202
1203    Working revision:    New file!
1204    Repository revision: No revision control file
1205    Sticky Tag:          (none)
1206    Sticky Date:         (none)
1207    Sticky Options:      (none)
1208
1209 ===================================================================
1210 File: file5             Status: Locally Added
1211
1212    Working revision:    New file!
1213    Repository revision: No revision control file
1214    Sticky Tag:          (none)
1215    Sticky Date:         (none)
1216    Sticky Options:      (none)"
1217           dotest basic1-18-add-add "${testcvs} -q log" \
1218 "${PROG} [a-z]*: file2 has been added, but not committed
1219 ${PROG} [a-z]*: file3 has been added, but not committed
1220 ${PROG} [a-z]*: file4 has been added, but not committed
1221 ${PROG} [a-z]*: file5 has been added, but not committed"
1222           cd ..
1223           dotest basic1-21-add-add "${testcvs} -q update" \
1224 "A first-dir/file2
1225 A first-dir/file3
1226 A first-dir/file4
1227 A first-dir/file5"
1228           # FIXCVS?  Shouldn't this read first-dir/file2 instead of file2?
1229           dotest basic1-22-add-add "${testcvs} log first-dir" \
1230 "${PROG} [a-z]*: Logging first-dir
1231 ${PROG} [a-z]*: file2 has been added, but not committed
1232 ${PROG} [a-z]*: file3 has been added, but not committed
1233 ${PROG} [a-z]*: file4 has been added, but not committed
1234 ${PROG} [a-z]*: file5 has been added, but not committed"
1235           dotest basic1-23-add-add "${testcvs} status first-dir" \
1236 "${PROG} [a-z]*: Examining first-dir
1237 ===================================================================
1238 File: file2             Status: Locally Added
1239
1240    Working revision:    New file!
1241    Repository revision: No revision control file
1242    Sticky Tag:          (none)
1243    Sticky Date:         (none)
1244    Sticky Options:      (none)
1245
1246 ===================================================================
1247 File: file3             Status: Locally Added
1248
1249    Working revision:    New file!
1250    Repository revision: No revision control file
1251    Sticky Tag:          (none)
1252    Sticky Date:         (none)
1253    Sticky Options:      (none)
1254
1255 ===================================================================
1256 File: file4             Status: Locally Added
1257
1258    Working revision:    New file!
1259    Repository revision: No revision control file
1260    Sticky Tag:          (none)
1261    Sticky Date:         (none)
1262    Sticky Options:      (none)
1263
1264 ===================================================================
1265 File: file5             Status: Locally Added
1266
1267    Working revision:    New file!
1268    Repository revision: No revision control file
1269    Sticky Tag:          (none)
1270    Sticky Date:         (none)
1271    Sticky Options:      (none)"
1272           dotest basic1-24-add-add "${testcvs} update first-dir" \
1273 "${PROG} [a-z]*: Updating first-dir
1274 A first-dir/file2
1275 A first-dir/file3
1276 A first-dir/file4
1277 A first-dir/file5"
1278           dotest basic1-27-add-add "${testcvs} co first-dir" \
1279 "${PROG} [a-z]*: Updating first-dir
1280 A first-dir/file2
1281 A first-dir/file3
1282 A first-dir/file4
1283 A first-dir/file5"
1284           cd first-dir
1285           dotest basic1-14-add-ci \
1286 "${testcvs} commit -m test file2 file3 file4 file5" \
1287 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
1288 done
1289 Checking in file2;
1290 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
1291 initial revision: 1\.1
1292 done
1293 RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
1294 done
1295 Checking in file3;
1296 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
1297 initial revision: 1\.1
1298 done
1299 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
1300 done
1301 Checking in file4;
1302 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
1303 initial revision: 1\.1
1304 done
1305 RCS file: ${TESTDIR}/cvsroot/first-dir/file5,v
1306 done
1307 Checking in file5;
1308 ${TESTDIR}/cvsroot/first-dir/file5,v  <--  file5
1309 initial revision: 1\.1
1310 done"
1311           dotest basic1-15-add-ci \
1312 "${testcvs} -q update file2 file3 file4 file5" ''
1313           dotest basic1-16-add-ci "${testcvs} -q update" ''
1314           dotest basic1-17-add-ci "${testcvs} -q status" \
1315 "===================================================================
1316 File: file2             Status: Up-to-date
1317
1318    Working revision:    1\.1.*
1319    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file2,v
1320    Sticky Tag:          (none)
1321    Sticky Date:         (none)
1322    Sticky Options:      (none)
1323
1324 ===================================================================
1325 File: file3             Status: Up-to-date
1326
1327    Working revision:    1\.1.*
1328    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file3,v
1329    Sticky Tag:          (none)
1330    Sticky Date:         (none)
1331    Sticky Options:      (none)
1332
1333 ===================================================================
1334 File: file4             Status: Up-to-date
1335
1336    Working revision:    1\.1.*
1337    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file4,v
1338    Sticky Tag:          (none)
1339    Sticky Date:         (none)
1340    Sticky Options:      (none)
1341
1342 ===================================================================
1343 File: file5             Status: Up-to-date
1344
1345    Working revision:    1\.1.*
1346    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file5,v
1347    Sticky Tag:          (none)
1348    Sticky Date:         (none)
1349    Sticky Options:      (none)"
1350           # The "log" tests and friends probably already test the output 
1351           # from log quite adequately.
1352           # Note: using dotest fails here.  It seems to be related
1353           # to the output being sufficiently large (Red Hat 4.1).
1354           # dotest basic1-18-add-ci "${testcvs} log" "${DOTSTAR}"
1355           if ${testcvs} -q log >>${LOGFILE}; then
1356             pass basic1-18-add-ci
1357           else
1358             pass basic1-18-add-ci
1359           fi
1360           cd ..
1361           dotest basic1-21-add-ci "${testcvs} -q update" ''
1362           # See test basic1-18-add-ci for explanation of non-use of dotest.
1363           if ${testcvs} -q log first-dir >>${LOGFILE}; then
1364             pass basic1-22-add-ci
1365           else
1366             pass basic1-22-add-ci
1367           fi
1368           # At least for the moment I am going to consider 17-add-ci
1369           # an adequate test of the output here.
1370           # See test basic1-18-add-ci for explanation of non-use of dotest.
1371           if ${testcvs} -q status first-dir >>${LOGFILE}; then
1372             pass basic1-23-add-ci
1373           else
1374             pass basic1-23-add-ci
1375           fi
1376           dotest basic1-24-add-ci "${testcvs} -q update first-dir" ''
1377           dotest basic1-27-add-ci "${testcvs} -q co first-dir" ''
1378
1379           cd first-dir
1380           rm file2 file3 file4 file5
1381           dotest basic1-14-rm-rm "${testcvs} rm file2 file3 file4 file5" \
1382 "${PROG} [a-z]*: scheduling .file2. for removal
1383 ${PROG} [a-z]*: scheduling .file3. for removal
1384 ${PROG} [a-z]*: scheduling .file4. for removal
1385 ${PROG} [a-z]*: scheduling .file5. for removal
1386 ${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
1387           # 15-rm-rm was commented out.  Why?
1388           dotest basic1-15-rm-rm \
1389 "${testcvs} -q update file2 file3 file4 file5" \
1390 "R file2
1391 R file3
1392 R file4
1393 R file5"
1394           dotest basic1-16-rm-rm "${testcvs} -q update" \
1395 "R file2
1396 R file3
1397 R file4
1398 R file5"
1399           dotest basic1-17-rm-rm "${testcvs} -q status" \
1400 "===================================================================
1401 File: no file file2             Status: Locally Removed
1402
1403    Working revision:    -1\.1.*
1404    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file2,v
1405    Sticky Tag:          (none)
1406    Sticky Date:         (none)
1407    Sticky Options:      (none)
1408
1409 ===================================================================
1410 File: no file file3             Status: Locally Removed
1411
1412    Working revision:    -1\.1.*
1413    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file3,v
1414    Sticky Tag:          (none)
1415    Sticky Date:         (none)
1416    Sticky Options:      (none)
1417
1418 ===================================================================
1419 File: no file file4             Status: Locally Removed
1420
1421    Working revision:    -1\.1.*
1422    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file4,v
1423    Sticky Tag:          (none)
1424    Sticky Date:         (none)
1425    Sticky Options:      (none)
1426
1427 ===================================================================
1428 File: no file file5             Status: Locally Removed
1429
1430    Working revision:    -1\.1.*
1431    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file5,v
1432    Sticky Tag:          (none)
1433    Sticky Date:         (none)
1434    Sticky Options:      (none)"
1435           # Would be nice to test that real logs appear (with dead state
1436           # and all), either here or someplace like log2 tests.
1437           if ${testcvs} -q log >>${LOGFILE}; then
1438             pass basic1-18-rm-rm
1439           else
1440             fail basic1-18-rm-rm
1441           fi
1442           cd ..
1443           dotest basic1-21-rm-rm "${testcvs} -q update" \
1444 "R first-dir/file2
1445 R first-dir/file3
1446 R first-dir/file4
1447 R first-dir/file5"
1448           if ${testcvs} -q log first-dir >>${LOGFILE}; then
1449             pass basic1-22-rm-rm
1450           else
1451             fail basic1-22-rm-rm
1452           fi
1453           if ${testcvs} -q status first-dir >>${LOGFILE}; then
1454             pass basic1-23-rm-rm
1455           else
1456             fail basic1-23-rm-rm
1457           fi
1458           dotest basic1-24-rm-rm "${testcvs} -q update first-dir" \
1459 "R first-dir/file2
1460 R first-dir/file3
1461 R first-dir/file4
1462 R first-dir/file5"
1463           dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
1464 "R first-dir/file2
1465 R first-dir/file3
1466 R first-dir/file4
1467 R first-dir/file5"
1468           cd first-dir
1469           dotest basic1-14-rm-ci "${testcvs} -q commit -m test" \
1470 "Removing file2;
1471 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
1472 new revision: delete; previous revision: 1\.1
1473 done
1474 Removing file3;
1475 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
1476 new revision: delete; previous revision: 1\.1
1477 done
1478 Removing file4;
1479 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
1480 new revision: delete; previous revision: 1\.1
1481 done
1482 Removing file5;
1483 ${TESTDIR}/cvsroot/first-dir/file5,v  <--  file5
1484 new revision: delete; previous revision: 1\.1
1485 done"
1486           dotest basic1-15-rm-ci \
1487 "${testcvs} -q update file2 file3 file4 file5" ''
1488           dotest basic1-16-rm-ci "${testcvs} -q update" ''
1489           dotest basic1-17-rm-ci "${testcvs} -q status" ''
1490           # Would be nice to test that real logs appear (with dead state
1491           # and all), either here or someplace like log2 tests.
1492           if ${testcvs} -q log >>${LOGFILE}; then
1493             pass basic1-18-rm-ci
1494           else
1495             fail basic1-18-rm-ci
1496           fi
1497           cd ..
1498           dotest basic1-21-rm-ci "${testcvs} -q update" ''
1499           if ${testcvs} -q log first-dir >>${LOGFILE}; then
1500             pass basic1-22-rm-ci
1501           else
1502             fail basic1-22-rm-ci
1503           fi
1504           if ${testcvs} -q status first-dir >>${LOGFILE}; then
1505             pass basic1-23-rm-ci
1506           else
1507             fail basic1-23-rm-ci
1508           fi
1509           dotest basic1-24-rm-ci "${testcvs} -q update first-dir" ''
1510           dotest basic1-27-rm-ci "${testcvs} -q co first-dir" ''
1511           cd first-dir
1512           # All the files are removed, so nothing gets tagged.
1513           dotest basic1-28 "${testcvs} -q tag first-dive" ''
1514           cd ..
1515           cd ..
1516
1517           if test "$keep" = yes; then
1518             echo Keeping ${TESTDIR} and exiting due to --keep
1519             exit 0
1520           fi
1521
1522           rm -r 1
1523           rm -rf ${CVSROOT_DIRNAME}/first-dir
1524           ;;
1525
1526         deep)
1527           # Test the ability to operate on directories nested rather deeply.
1528           mkdir ${CVSROOT_DIRNAME}/first-dir
1529           dotest deep-1 "${testcvs} -q co first-dir" ''
1530           cd first-dir
1531           for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
1532             mkdir $i
1533             dotest deep-2-$i "${testcvs} add $i" \
1534 "Directory ${TESTDIR}/cvsroot/first-dir/dir1[/dir0-9]* added to the repository"
1535             cd $i
1536             echo file1 >file1
1537             dotest deep-3-$i "${testcvs} add file1" \
1538 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
1539 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
1540           done
1541           cd ../../../../../../../../..
1542           dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
1543 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/file1,v
1544 done
1545 Checking in first-dir/dir1/file1;
1546 ${TESTDIR}/cvsroot/first-dir/dir1/file1,v  <--  file1
1547 initial revision: 1.1
1548 done
1549 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/file1,v
1550 done
1551 Checking in first-dir/dir1/dir2/file1;
1552 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/file1,v  <--  file1
1553 initial revision: 1.1
1554 done
1555 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/file1,v
1556 done
1557 Checking in first-dir/dir1/dir2/dir3/file1;
1558 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/file1,v  <--  file1
1559 initial revision: 1.1
1560 done
1561 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v
1562 done
1563 Checking in first-dir/dir1/dir2/dir3/dir4/file1;
1564 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
1565 initial revision: 1.1
1566 done
1567 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
1568 done
1569 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
1570 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
1571 initial revision: 1.1
1572 done
1573 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
1574 done
1575 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
1576 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
1577 initial revision: 1.1
1578 done
1579 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
1580 done
1581 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
1582 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
1583 initial revision: 1.1
1584 done
1585 RCS file: ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
1586 done
1587 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
1588 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
1589 initial revision: 1.1
1590 done
1591 HERE
1592
1593           cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
1594           rm file1
1595           dotest deep-4a0 "${testcvs} rm file1" \
1596 "${PROG} [a-z]*: scheduling .file1. for removal
1597 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
1598           dotest deep-4a1 "${testcvs} -q ci -m rm-it" "Removing file1;
1599 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
1600 new revision: delete; previous revision: 1\.1
1601 done"
1602           cd ../../..
1603           dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
1604           # Should be using "test -e" if that is portable enough.
1605           dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
1606
1607           # Test that if we remove the working directory, CVS does not
1608           # recreate it.  (I realize that this behavior is what the
1609           # users expect, but in the longer run we might want to
1610           # re-think it.  The corresponding behavior for a file is that
1611           # CVS *will* recreate it, and we might want to make it so
1612           # that "cvs release -d" is the way to delete the directory
1613           # and have it stay gone -kingdon, Oct1996).
1614           rm -r dir6
1615           dotest deep-4b0a "${testcvs} -q diff" ''
1616           dotest deep-4b0b "${testcvs} -q ci" ''
1617           dotest deep-4b1 "${testcvs} -q update" ''
1618           dotest deep-4b2 "${testcvs} -q update -d -P" \
1619 'U dir6/file1
1620 U dir6/dir7/file1'
1621
1622           # Test what happens if one uses -P when there are files removed
1623           # but not committed.
1624           cd dir6/dir7
1625           dotest deep-rm1 "${testcvs} rm -f file1" \
1626 "${PROG} [a-z]*: scheduling .file1. for removal
1627 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
1628           cd ..
1629           dotest deep-rm2 "${testcvs} -q update -d -P" 'R dir7/file1'
1630           dotest deep-rm3 "test -d dir7" ''
1631           dotest deep-rm4 "${testcvs} -q ci -m rm-it" "Removing dir7/file1;
1632 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
1633 new revision: delete; previous revision: 1\.1
1634 done"
1635           dotest deep-rm5 "${testcvs} -q update -d -P" ''
1636           dotest_fail deep-rm6 "test -d dir7" ''
1637
1638           # Test rm -f -R.
1639           cd ../..
1640           dotest deep-rm7 "${testcvs} rm -f -R dir5" \
1641 "${PROG} [a-z]*: Removing dir5
1642 ${PROG} [a-z]*: scheduling .dir5/file1. for removal
1643 ${PROG} [a-z]*: Removing dir5/dir6
1644 ${PROG} [a-z]*: scheduling .dir5/dir6/file1. for removal
1645 ${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
1646           dotest deep-rm8 "${testcvs} -q ci -m rm-it" \
1647 "Removing dir5/file1;
1648 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
1649 new revision: delete; previous revision: 1\.1
1650 done
1651 Removing dir5/dir6/file1;
1652 ${TESTDIR}/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
1653 new revision: delete; previous revision: 1\.1
1654 done"
1655           dotest deep-rm9 "${testcvs} -q update -d -P" ''
1656           dotest_fail deep-rm10 "test -d dir5"
1657
1658           cd ../../../../..
1659
1660           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
1661             pass deep-5
1662           else
1663             fail deep-5
1664           fi
1665           rm -rf ${CVSROOT_DIRNAME}/first-dir
1666           ;;
1667
1668         basic2)
1669                 # Test rtag, import, history, various miscellaneous operations
1670
1671                 # NOTE: this section has reached the size and
1672                 # complexity where it is getting to be a good idea to
1673                 # add new tests to a new section rather than
1674                 # continuing to piggyback them onto the tests here.
1675
1676                 # First empty the history file
1677                 rm ${CVSROOT_DIRNAME}/CVSROOT/history
1678                 touch ${CVSROOT_DIRNAME}/CVSROOT/history
1679
1680 ### XXX maybe should use 'cvs imprt -b1 -m new-module first-dir F F1' in an
1681 ### empty directory to do this instead of hacking directly into $CVSROOT
1682                 mkdir ${CVSROOT_DIRNAME}/first-dir
1683                 dotest basic2-1 "${testcvs} -q co first-dir" ''
1684                 for i in first-dir dir1 dir2 ; do
1685                         if test ! -d $i ; then
1686                                 mkdir $i
1687                                 if ${CVS} add $i  >> ${LOGFILE}; then
1688                                     pass 29-$i
1689                                 else
1690                                     fail 29-$i
1691                                 fi
1692                         fi
1693
1694                         cd $i
1695
1696                         for j in file6 file7; do
1697                                 echo $j > $j
1698                         done
1699
1700                         if ${CVS} add file6 file7  2>> ${LOGFILE}; then
1701                             pass 30-$i-$j
1702                         else
1703                             fail 30-$i-$j
1704                         fi
1705                 done
1706                 cd ../../..
1707                 if ${CVS} update first-dir  ; then
1708                     pass 31
1709                 else
1710                     fail 31
1711                 fi
1712
1713                 # fixme: doesn't work right for added files.
1714                 if ${CVS} log first-dir  >> ${LOGFILE}; then
1715                     pass 32
1716                 else
1717                     fail 32
1718                 fi
1719
1720                 if ${CVS} status first-dir  >> ${LOGFILE}; then
1721                     pass 33
1722                 else
1723                     fail 33
1724                 fi
1725
1726 # XXX why is this commented out???
1727 #               if ${CVS} diff -u first-dir   >> ${LOGFILE} || test $? = 1 ; then
1728 #                   pass 34
1729 #               else
1730 #                   fail 34
1731 #               fi
1732
1733                 if ${CVS} ci -m "second dive" first-dir  >> ${LOGFILE} 2>&1; then
1734                     pass 35
1735                 else
1736                     fail 35
1737                 fi
1738
1739                 if ${CVS} tag second-dive first-dir  ; then
1740                     pass 36
1741                 else
1742                     fail 36
1743                 fi
1744
1745                 # third dive - in bunch o' directories, add bunch o' files,
1746                 # delete some, change some.
1747
1748                 for i in first-dir dir1 dir2 ; do
1749                         cd $i
1750
1751                         # modify a file
1752                         echo file6 >>file6
1753
1754                         # delete a file
1755                         rm file7
1756
1757                         if ${CVS} rm file7  2>> ${LOGFILE}; then
1758                             pass 37-$i
1759                         else
1760                             fail 37-$i
1761                         fi
1762
1763                         # and add a new file
1764                         echo file14 >file14
1765
1766                         if ${CVS} add file14  2>> ${LOGFILE}; then
1767                             pass 38-$i
1768                         else
1769                             fail 38-$i
1770                         fi
1771                 done
1772                 cd ../../..
1773                 if ${CVS} update first-dir  ; then
1774                     pass 39
1775                 else
1776                     fail 39
1777                 fi
1778
1779                 # FIXME: doesn't work right for added files
1780                 if ${CVS} log first-dir  >> ${LOGFILE}; then
1781                     pass 40
1782                 else
1783                     fail 40
1784                 fi
1785
1786                 if ${CVS} status first-dir  >> ${LOGFILE}; then
1787                     pass 41
1788                 else
1789                     fail 41
1790                 fi
1791
1792 # XXX why is this commented out?
1793 #               if ${CVS} diff -u first-dir  >> ${LOGFILE} || test $? = 1 ; then
1794 #                   pass 42
1795 #               else
1796 #                   fail 42
1797 #               fi
1798
1799                 if ${CVS} ci -m "third dive" first-dir  >>${LOGFILE} 2>&1; then
1800                     pass 43
1801                 else
1802                     fail 43
1803                 fi
1804                 dotest 43.5 "${testcvs} -q update first-dir" ''
1805
1806                 if ${CVS} tag third-dive first-dir  ; then
1807                     pass 44
1808                 else
1809                     fail 44
1810                 fi
1811
1812                 if echo "yes" | ${CVS} release -d first-dir  ; then
1813                     pass 45
1814                 else
1815                     fail 45
1816                 fi
1817
1818                 # end of third dive
1819                 if test -d first-dir ; then
1820                     fail 45.5
1821                 else
1822                     pass 45.5
1823                 fi
1824
1825                 # now try some rtags
1826
1827                 # rtag HEADS
1828                 if ${CVS} rtag rtagged-by-head first-dir  ; then
1829                     pass 46
1830                 else
1831                     fail 46
1832                 fi
1833
1834                 # tag by tag
1835                 if ${CVS} rtag -r rtagged-by-head rtagged-by-tag first-dir  ; then
1836                     pass 47
1837                 else
1838                     fail 47
1839                 fi
1840
1841                 # tag by revision
1842                 if ${CVS} rtag -r1.1 rtagged-by-revision first-dir  ; then
1843                     pass 48
1844                 else
1845                     fail 48
1846                 fi
1847
1848                 # rdiff by revision
1849                 if ${CVS} rdiff -r1.1 -rrtagged-by-head first-dir  >> ${LOGFILE} || test $? = 1 ; then
1850                     pass 49
1851                 else
1852                     fail 49
1853                 fi
1854
1855                 # now export by rtagged-by-head and rtagged-by-tag and compare.
1856                 if ${CVS} export -r rtagged-by-head first-dir  ; then
1857                     pass 50
1858                 else
1859                     fail 50
1860                 fi
1861
1862                 mv first-dir 1dir
1863                 if ${CVS} export -r rtagged-by-tag first-dir  ; then
1864                     pass 51
1865                 else
1866                     fail 51
1867                 fi
1868
1869                 directory_cmp 1dir first-dir
1870
1871                 if $ISDIFF ; then
1872                     fail 52
1873                 else
1874                     pass 52
1875                 fi
1876                 rm -r 1dir first-dir
1877
1878                 # checkout by revision vs export by rtagged-by-revision and compare.
1879                 if ${CVS} export -rrtagged-by-revision -d export-dir first-dir  ; then
1880                     pass 53
1881                 else
1882                     fail 53
1883                 fi
1884
1885                 if ${CVS} co -r1.1 first-dir  ; then
1886                     pass 54
1887                 else
1888                     fail 54
1889                 fi
1890
1891                 # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
1892                 mkdir first-dir.cpy ; (cd first-dir ; tar cf - . | (cd ../first-dir.cpy ; tar xf -))
1893
1894                 directory_cmp first-dir export-dir
1895
1896                 if $ISDIFF ; then
1897                     fail 55
1898                 else
1899                     pass 55
1900                 fi
1901
1902                 # interrupt, while we've got a clean 1.1 here, let's import it
1903                 # into a couple of other modules.
1904                 cd export-dir
1905                 dotest 56 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
1906 "N second-dir/file14
1907 N second-dir/file6
1908 N second-dir/file7
1909 ${PROG} [a-z]*: Importing ${TESTDIR}/cvsroot/second-dir/dir1
1910 N second-dir/dir1/file14
1911 N second-dir/dir1/file6
1912 N second-dir/dir1/file7
1913 ${PROG} [a-z]*: Importing ${TESTDIR}/cvsroot/second-dir/dir1/dir2
1914 N second-dir/dir1/dir2/file14
1915 N second-dir/dir1/dir2/file6
1916 N second-dir/dir1/dir2/file7
1917
1918 No conflicts created by this import"
1919                 cd ..
1920
1921                 if ${CVS} export -r HEAD second-dir  ; then
1922                     pass 57
1923                 else
1924                     fail 57
1925                 fi
1926
1927                 directory_cmp first-dir second-dir
1928
1929                 if $ISDIFF ; then
1930                     fail 58
1931                 else
1932                     pass 58
1933                 fi
1934
1935                 rm -r second-dir
1936
1937                 rm -r export-dir first-dir
1938                 mkdir first-dir
1939                 (cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
1940
1941                 # update the top, cancelling sticky tags, retag, update other copy, compare.
1942                 cd first-dir
1943                 if ${CVS} update -A -l *file*  2>> ${LOGFILE}; then
1944                     pass 59
1945                 else
1946                     fail 59
1947                 fi
1948
1949                 # If we don't delete the tag first, cvs won't retag it.
1950                 # This would appear to be a feature.
1951                 if ${CVS} tag -l -d rtagged-by-revision  ; then
1952                     pass 60a
1953                 else
1954                     fail 60a
1955                 fi
1956                 if ${CVS} tag -l rtagged-by-revision  ; then
1957                     pass 60b
1958                 else
1959                     fail 60b
1960                 fi
1961
1962                 cd ..
1963                 mv first-dir 1dir
1964                 mv first-dir.cpy first-dir
1965                 cd first-dir
1966
1967                 dotest 61 "${testcvs} -q diff -u" ''
1968
1969                 if ${CVS} update  ; then
1970                     pass 62
1971                 else
1972                     fail 62
1973                 fi
1974
1975                 cd ..
1976
1977                 #### FIXME: is this expected to work???  Need to investigate
1978                 #### and fix or remove the test.
1979 #               directory_cmp 1dir first-dir
1980 #
1981 #               if $ISDIFF ; then
1982 #                   fail 63
1983 #               else
1984 #                   pass 63
1985 #               fi
1986                 rm -r 1dir first-dir
1987
1988                 # Test the cvs history command.
1989
1990                 # The reason that there are two patterns rather than using
1991                 # \(${TESTDIR}\|<remote>\) is that we are trying to
1992                 # make this portable.  Perhaps at some point we should
1993                 # ditch that notion and require GNU expr (or dejagnu or....)
1994                 # since it seems to be so painful.
1995
1996                 # why are there two lines at the end of the local output
1997                 # which don't exist in the remote output?  would seem to be
1998                 # a CVS bug.
1999                 dotest basic2-64 "${testcvs} his -x TOFWUCGMAR -a" \
2000 "O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= ${TMPPWD}/\*
2001 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == ${TMPPWD}
2002 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == ${TMPPWD}
2003 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == ${TMPPWD}
2004 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == ${TMPPWD}
2005 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == ${TMPPWD}
2006 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == ${TMPPWD}
2007 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == ${TMPPWD}
2008 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TMPPWD}
2009 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == ${TMPPWD}
2010 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == ${TMPPWD}
2011 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == ${TMPPWD}
2012 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == ${TMPPWD}
2013 F [0-9/]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= ${TMPPWD}/\*
2014 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
2015 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
2016 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
2017 O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= ${TMPPWD}/\*
2018 U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TMPPWD}/first-dir
2019 U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == ${TMPPWD}/first-dir" \
2020 "O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= <remote>/\*
2021 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == <remote>
2022 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == <remote>
2023 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == <remote>
2024 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == <remote>
2025 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == <remote>
2026 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == <remote>
2027 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == <remote>
2028 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
2029 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == <remote>
2030 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == <remote>
2031 A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == <remote>
2032 M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == <remote>
2033 F [0-9/]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= <remote>/\*
2034 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
2035 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
2036 T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
2037 O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= <remote>/\*"
2038
2039                 rm -rf ${CVSROOT_DIRNAME}/first-dir
2040                 rm -rf ${CVSROOT_DIRNAME}/second-dir
2041                 ;;
2042
2043         rdiff)
2044                 # Test rdiff
2045                 # XXX for now this is just the most essential test...
2046                 cd ${TESTDIR}
2047
2048                 mkdir testimport
2049                 cd testimport
2050                 echo '$''Id$' > foo
2051                 echo '$''Name$' >> foo
2052                 echo '$''Id$' > bar
2053                 echo '$''Name$' >> bar
2054                 dotest_sort rdiff-1 \
2055                   "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
2056 '
2057
2058 N trdiff/bar
2059 N trdiff/foo
2060 No conflicts created by this import'
2061                 dotest rdiff-2 \
2062                   "${testcvs} co -ko trdiff" \
2063 "${PROG} [a-z]*: Updating trdiff
2064 U trdiff/bar
2065 U trdiff/foo"
2066                 cd trdiff
2067                 echo something >> foo
2068                 dotest rdiff-3 \
2069                   "${testcvs} ci -m added-something foo" \
2070 "Checking in foo;
2071 ${TESTDIR}/cvsroot/trdiff/foo,v  <--  foo
2072 new revision: 1\.2; previous revision: 1\.1
2073 done"
2074                 echo '#ident    "@(#)trdiff:$''Name$:$''Id$"' > new
2075                 echo "new file" >> new
2076                 dotest rdiff-4 \
2077                   "${testcvs} add -m new-file-description new" \
2078 "${PROG} [a-z]*: scheduling file \`new' for addition
2079 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
2080                 dotest rdiff-5 \
2081                   "${testcvs} commit -m added-new-file new" \
2082 "RCS file: ${TESTDIR}/cvsroot/trdiff/new,v
2083 done
2084 Checking in new;
2085 ${TESTDIR}/cvsroot/trdiff/new,v  <--  new
2086 initial revision: 1\.1
2087 done"
2088                 dotest rdiff-6 \
2089                   "${testcvs} tag local-v0" \
2090 "${PROG} [a-z]*: Tagging .
2091 T bar
2092 T foo
2093 T new"
2094                 dotest rdiff-7 \
2095                   "${testcvs} status -v foo" \
2096 "===================================================================
2097 File: foo               Status: Up-to-date
2098
2099    Working revision:    1\.2.*
2100    Repository revision: 1\.2    ${TESTDIR}/cvsroot/trdiff/foo,v
2101    Sticky Tag:          (none)
2102    Sticky Date:         (none)
2103    Sticky Options:      -ko
2104
2105    Existing Tags:
2106         local-v0                        (revision: 1\.2)
2107         T1                              (revision: 1\.1\.1\.1)
2108         TRDIFF                          (branch: 1\.1\.1)"
2109
2110                 cd ..
2111                 rm -r trdiff
2112
2113                 dotest rdiff-8 \
2114                   "${testcvs} rdiff -r T1 -r local-v0 trdiff" \
2115 "${PROG}"' [a-z]*: Diffing trdiff
2116 Index: trdiff/foo
2117 diff -c trdiff/foo:1\.1\.1\.1 trdiff/foo:1\.2
2118 \*\*\* trdiff/foo:1\.1\.1\.1    .*
2119 --- trdiff/foo  .*
2120 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2121 \*\*\* 1,2 \*\*\*\*
2122 ! \$''Id: foo,v 1\.1\.1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$
2123 ! \$''Name: T1 \$
2124 --- 1,3 ----
2125 ! \$''Id: foo,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
2126 ! \$''Name: local-v0 \$
2127 ! something
2128 Index: trdiff/new
2129 diff -c /dev/null trdiff/new:1\.1
2130 \*\*\* /dev/null        .*
2131 --- trdiff/new  .*
2132 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2133 \*\*\* 0 \*\*\*\*
2134 --- 1,2 ----
2135 '"${PLUS}"' #ident      "@(#)trdiff:\$''Name: local-v0 \$:\$''Id: new,v 1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$"
2136 '"${PLUS}"' new file'
2137
2138 # FIXME: will this work here?
2139 #               if test "$keep" = yes; then
2140 #                 echo Keeping ${TESTDIR} and exiting due to --keep
2141 #                 exit 0
2142 #               fi
2143
2144                 cd ..
2145                 rm -r testimport
2146                 rm -rf ${CVSROOT_DIRNAME}/trdiff
2147                 ;;
2148
2149         death)
2150                 # next dive.  test death support.
2151
2152                 # NOTE: this section has reached the size and
2153                 # complexity where it is getting to be a good idea to
2154                 # add new death support tests to a new section rather
2155                 # than continuing to piggyback them onto the tests here.
2156
2157                 mkdir  ${CVSROOT_DIRNAME}/first-dir
2158                 if ${CVS} co first-dir  ; then
2159                     pass 65
2160                 else
2161                     fail 65
2162                 fi
2163
2164                 cd first-dir
2165
2166                 # Create a directory with only dead files, to make sure CVS
2167                 # doesn't get confused by it.
2168                 mkdir subdir
2169                 dotest 65a0 "${testcvs} add subdir" \
2170 "Directory ${TESTDIR}/cvsroot/first-dir/subdir added to the repository"
2171                 cd subdir
2172                 echo file in subdir >sfile
2173                 dotest 65a1 "${testcvs} add sfile" \
2174 "${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition
2175 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2176                 dotest 65a2 "${testcvs} -q ci -m add-it" \
2177 "RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v
2178 done
2179 Checking in sfile;
2180 ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v  <--  sfile
2181 initial revision: 1\.1
2182 done"
2183                 rm sfile
2184                 dotest 65a3 "${testcvs} rm sfile" \
2185 "${PROG}"' [a-z]*: scheduling `sfile'\'' for removal
2186 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
2187                 dotest 65a4 "${testcvs} -q ci -m remove-it" \
2188 "Removing sfile;
2189 ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v  <--  sfile
2190 new revision: delete; previous revision: 1\.1
2191 done"
2192                 cd ..
2193                 dotest 65a5 "${testcvs} -q update -P" ''
2194                 dotest_fail 65a6 "test -d subdir" ''
2195
2196                 # add a file.
2197                 touch file1
2198                 if ${CVS} add file1  2>> ${LOGFILE}; then
2199                     pass 66
2200                 else
2201                     fail 66
2202                 fi
2203
2204                 # commit
2205                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
2206                     pass 67
2207                 else
2208                     fail 67
2209                 fi
2210
2211                 # remove
2212                 rm file1
2213                 if ${CVS} rm file1  2>> ${LOGFILE}; then
2214                     pass 68
2215                 else
2216                     fail 68
2217                 fi
2218
2219                 # commit
2220                 if ${CVS} ci -m test  >>${LOGFILE} ; then
2221                     pass 69
2222                 else
2223                     fail 69
2224                 fi
2225
2226                 dotest_fail 69a0 "test -f file1" ''
2227                 # get the old contents of file1 back
2228                 if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
2229                   pass 69a1
2230                 else
2231                   fail 69a1
2232                 fi
2233                 dotest 69a2 "cat file1" ''
2234
2235                 # create second file
2236                 touch file2
2237                 if ${CVS} add file1 file2  2>> ${LOGFILE}; then
2238                     pass 70
2239                 else
2240                     fail 70
2241                 fi
2242
2243                 # commit
2244                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
2245                     pass 71
2246                 else
2247                     fail 71
2248                 fi
2249
2250                 # log
2251                 if ${CVS} log file1  >> ${LOGFILE}; then
2252                     pass 72
2253                 else
2254                     fail 72
2255                 fi
2256
2257                 # file4 will be dead at the time of branching and stay dead.
2258                 echo file4 > file4
2259                 dotest death-file4-add "${testcvs} add file4" \
2260 "${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
2261 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2262                 dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
2263 "RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
2264 done
2265 Checking in file4;
2266 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2267 initial revision: 1\.1
2268 done"
2269                 rm file4
2270                 dotest death-file4-rm "${testcvs} remove file4" \
2271 "${PROG}"' [a-z]*: scheduling `file4'\'' for removal
2272 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
2273                 dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
2274 "Removing file4;
2275 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2276 new revision: delete; previous revision: 1\.1
2277 done"
2278
2279                 # Tag the branchpoint.
2280                 dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
2281 T file2'
2282
2283                 # branch1
2284                 if ${CVS} tag -b branch1  ; then
2285                     pass 73
2286                 else
2287                     fail 73
2288                 fi
2289
2290                 # and move to the branch.
2291                 if ${CVS} update -r branch1  ; then
2292                     pass 74
2293                 else
2294                     fail 74
2295                 fi
2296
2297                 dotest_fail death-file4-3 "test -f file4" ''
2298
2299                 # add a file in the branch
2300                 echo line1 from branch1 >> file3
2301                 if ${CVS} add file3  2>> ${LOGFILE}; then
2302                     pass 75
2303                 else
2304                     fail 75
2305                 fi
2306
2307                 # commit
2308                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
2309                     pass 76
2310                 else
2311                     fail 76
2312                 fi
2313
2314                 dotest death-76a0 \
2315 "${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
2316 "Index: first-dir/file3
2317 diff -c /dev/null first-dir/file3:1\.1\.2\.1
2318 \*\*\* /dev/null        .*
2319 --- first-dir/file3     .*
2320 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2321 \*\*\* 0 \*\*\*\*
2322 --- 1 ----
2323 ${PLUS} line1 from branch1"
2324                 dotest death-76a1 \
2325 "${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
2326 'Index: first-dir/file3
2327 diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
2328 \*\*\* first-dir/file3:1\.1\.2\.1       .*
2329 --- first-dir/file3     .*
2330 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2331 \*\*\* 1 \*\*\*\*
2332 - line1 from branch1
2333 --- 0 ----'
2334
2335                 # remove
2336                 rm file3
2337                 if ${CVS} rm file3  2>> ${LOGFILE}; then
2338                     pass 77
2339                 else
2340                     fail 77
2341                 fi
2342
2343                 # commit
2344                 if ${CVS} ci -m test  >>${LOGFILE} ; then
2345                     pass 78
2346                 else
2347                     fail 78
2348                 fi
2349
2350                 # add again
2351                 echo line1 from branch1 >> file3
2352                 if ${CVS} add file3  2>> ${LOGFILE}; then
2353                     pass 79
2354                 else
2355                     fail 79
2356                 fi
2357
2358                 # commit
2359                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
2360                     pass 80
2361                 else
2362                     fail 80
2363                 fi
2364
2365                 # change the first file
2366                 echo line2 from branch1 >> file1
2367
2368                 # commit
2369                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
2370                     pass 81
2371                 else
2372                     fail 81
2373                 fi
2374
2375                 # remove the second
2376                 rm file2
2377                 if ${CVS} rm file2  2>> ${LOGFILE}; then
2378                     pass 82
2379                 else
2380                     fail 82
2381                 fi
2382
2383                 # commit
2384                 if ${CVS} ci -m test  >>${LOGFILE}; then
2385                     pass 83
2386                 else
2387                     fail 83
2388                 fi
2389
2390                 # back to the trunk.
2391                 if ${CVS} update -A  2>> ${LOGFILE}; then
2392                     pass 84
2393                 else
2394                     fail 84
2395                 fi
2396
2397                 dotest_fail death-file4-4 "test -f file4" ''
2398
2399                 if test -f file3 ; then
2400                     fail 85
2401                 else
2402                     pass 85
2403                 fi
2404
2405                 # join
2406                 dotest 86 "${testcvs} -q update -j branch1" \
2407 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
2408 retrieving revision 1\.3
2409 retrieving revision 1\.3\.2\.1
2410 Merging differences between 1\.3 and 1\.3\.2\.1 into file1
2411 ${PROG} [a-z]*: scheduling file2 for removal
2412 U file3"
2413
2414                 dotest_fail death-file4-5 "test -f file4" ''
2415
2416                 if test -f file3 ; then
2417                     pass 87
2418                 else
2419                     fail 87
2420                 fi
2421
2422                 # Make sure that we joined the correct change to file1
2423                 if echo line2 from branch1 | cmp - file1 >/dev/null; then
2424                     pass 87a
2425                 else
2426                     fail 87a
2427                 fi
2428
2429                 # update
2430                 if ${CVS} update  ; then
2431                     pass 88
2432                 else
2433                     fail 88
2434                 fi
2435
2436                 # commit
2437                 dotest 89 "${testcvs} -q ci -m test" \
2438 "Checking in file1;
2439 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2440 new revision: 1\.4; previous revision: 1\.3
2441 done
2442 Removing file2;
2443 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
2444 new revision: delete; previous revision: 1\.1
2445 done
2446 Checking in file3;
2447 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
2448 new revision: 1\.2; previous revision: 1\.1
2449 done"
2450                 cd ..
2451                 mkdir 2
2452                 cd 2
2453                 dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
2454 U first-dir/file3'
2455                 cd ..
2456                 rm -r 2
2457                 cd first-dir
2458
2459                 # remove first file.
2460                 rm file1
2461                 if ${CVS} rm file1  2>> ${LOGFILE}; then
2462                     pass 90
2463                 else
2464                     fail 90
2465                 fi
2466
2467                 # commit
2468                 if ${CVS} ci -m test  >>${LOGFILE}; then
2469                     pass 91
2470                 else
2471                     fail 91
2472                 fi
2473
2474                 if test -f file1 ; then
2475                     fail 92
2476                 else
2477                     pass 92
2478                 fi
2479
2480                 # typo; try to get to the branch and fail
2481                 dotest_fail 92.1a "${testcvs} update -r brnach1" \
2482                   "${PROG}"' \[[a-z]* aborted\]: no such tag brnach1'
2483                 # Make sure we are still on the trunk
2484                 if test -f file1 ; then
2485                     fail 92.1b
2486                 else
2487                     pass 92.1b
2488                 fi
2489                 if test -f file3 ; then
2490                     pass 92.1c
2491                 else
2492                     fail 92.1c
2493                 fi
2494
2495                 # back to branch1
2496                 if ${CVS} update -r branch1  2>> ${LOGFILE}; then
2497                     pass 93
2498                 else
2499                     fail 93
2500                 fi
2501
2502                 dotest_fail death-file4-6 "test -f file4" ''
2503
2504                 if test -f file1 ; then
2505                     pass 94
2506                 else
2507                     fail 94
2508                 fi
2509
2510                 # and join
2511                 dotest 95 "${testcvs} -q update -j HEAD" \
2512 "${PROG}"' [a-z]*: file file1 has been modified, but has been removed in revision HEAD
2513 '"${PROG}"' [a-z]*: file file3 exists, but has been added in revision HEAD'
2514
2515                 dotest_fail death-file4-7 "test -f file4" ''
2516
2517                 # file2 should not have been recreated.  It was
2518                 # deleted on the branch, and has not been modified on
2519                 # the trunk.  That means that there have been no
2520                 # changes between the greatest common ancestor (the
2521                 # trunk version) and HEAD.
2522                 dotest_fail death-file2-1 "test -f file2" ''
2523
2524                 cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
2525                 ;;
2526
2527         death2)
2528           # More tests of death support.
2529           mkdir ${CVSROOT_DIRNAME}/first-dir
2530           dotest death2-1 "${testcvs} -q co first-dir" ''
2531
2532           cd first-dir
2533
2534           # Add a file on the trunk.
2535           echo "first revision" > file1
2536           dotest death2-2 "${testcvs} add file1" \
2537 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
2538 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2539
2540           dotest death2-3 "${testcvs} -q commit -m add" \
2541 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
2542 done
2543 Checking in file1;
2544 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2545 initial revision: 1\.1
2546 done"
2547
2548           # Make a branch and a non-branch tag.
2549           dotest death2-4 "${testcvs} -q tag -b branch" 'T file1'
2550           dotest death2-5 "${testcvs} -q tag tag" 'T file1'
2551
2552           # Switch over to the branch.
2553           dotest death2-6 "${testcvs} -q update -r branch" ''
2554
2555           # Delete the file on the branch.
2556           rm file1
2557           dotest death2-7 "${testcvs} rm file1" \
2558 "${PROG} [a-z]*: scheduling .file1. for removal
2559 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
2560
2561           # Test diff of the removed file before it is committed.
2562           dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
2563 "${PROG} [a-z]*: file1 was removed, no comparison available"
2564
2565           # If the DIFF that CVS is using (options.h) is Sun diff, this
2566           # test is said to fail (I think the /dev/null is the part
2567           # that differs), along with a number of the other similar tests.
2568           dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
2569 "Index: file1
2570 ===================================================================
2571 RCS file: file1
2572 diff -N file1
2573 \*\*\* ${tempname}[     ][      ]*[a-zA-Z0-9: ]*
2574 --- /dev/null[  ][      ]*[a-zA-Z0-9: ]*
2575 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2576 \*\*\* 1 \*\*\*\*
2577 - first revision
2578 --- 0 ----"
2579
2580           dotest death2-8 "${testcvs} -q ci -m removed" \
2581 "Removing file1;
2582 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2583 new revision: delete; previous revision: 1\.1\.2
2584 done"
2585
2586           # Test diff of a dead file.
2587           dotest_fail death2-diff-3 \
2588 "${testcvs} -q diff -r1.1 -rbranch -c file1" \
2589 "${PROG} [a-z]*: file1 was removed, no comparison available"
2590
2591           dotest_fail death2-diff-4 \
2592 "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
2593 "Index: file1
2594 ===================================================================
2595 RCS file: file1
2596 diff -N file1
2597 \*\*\* ${tempname}[     ][      ]*[a-zA-Z0-9: ]*
2598 --- /dev/null[  ][      ]*[a-zA-Z0-9: ]*
2599 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2600 \*\*\* 1 \*\*\*\*
2601 - first revision
2602 --- 0 ----"
2603
2604           dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \
2605 "${PROG} [a-z]*: file1 no longer exists, no comparison available"
2606
2607           dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \
2608 "Index: file1
2609 ===================================================================
2610 RCS file: file1
2611 diff -N file1
2612 \*\*\* ${tempname}[     ][      ]*[a-zA-Z0-9: ]*
2613 --- /dev/null[  ][      ]*[a-zA-Z0-9: ]*
2614 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2615 \*\*\* 1 \*\*\*\*
2616 - first revision
2617 --- 0 ----"
2618
2619           # Test rdiff of a dead file.
2620           dotest death2-rdiff-1 \
2621 "${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
2622
2623           dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
2624 "Index: first-dir/file1
2625 diff -c first-dir/file1:1\.1 first-dir/file1:removed
2626 \*\*\* first-dir/file1:1\.1[    ][      ]*[a-zA-Z0-9: ]*
2627 --- first-dir/file1[    ][      ]*[a-zA-Z0-9: ]*
2628 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2629 \*\*\* 1 \*\*\*\*
2630 - first revision
2631 --- 0 ----"
2632
2633           # Readd the file to the branch.
2634           echo "second revision" > file1
2635           dotest death2-9 "${testcvs} add file1" \
2636 "${PROG}"' [a-z]*: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
2637 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2638
2639           # Test diff of the added file before it is committed.
2640           dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
2641 "${PROG} [a-z]*: file1 is a new entry, no comparison available"
2642
2643           dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \
2644 "Index: file1
2645 ===================================================================
2646 RCS file: file1
2647 diff -N file1
2648 \*\*\* /dev/null[       ][      ]*[a-zA-Z0-9: ]*
2649 --- ${tempname}[        ][      ]*[a-zA-Z0-9: ]*
2650 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2651 \*\*\* 0 \*\*\*\*
2652 --- 1 ----
2653 ${PLUS} second revision"
2654
2655           dotest death2-10 "${testcvs} -q commit -m add" \
2656 "Checking in file1;
2657 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2658 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
2659 done"
2660
2661           # Back to the trunk.
2662           dotest death2-11 "${testcvs} -q update -A" 'U file1' 'P file1'
2663
2664           # Add another file on the trunk.
2665           echo "first revision" > file2
2666           dotest death2-12 "${testcvs} add file2" \
2667 "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
2668 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2669           dotest death2-13 "${testcvs} -q commit -m add" \
2670 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
2671 done
2672 Checking in file2;
2673 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
2674 initial revision: 1\.1
2675 done"
2676
2677           # Back to the branch.
2678           # The ``no longer in the repository'' message doesn't really
2679           # look right to me, but that's what CVS currently prints for
2680           # this case.
2681           dotest death2-14 "${testcvs} -q update -r branch" \
2682 "U file1
2683 ${PROG} [a-z]*: file2 is no longer in the repository" \
2684 "P file1
2685 ${PROG} [a-z]*: file2 is no longer in the repository"
2686
2687           # Add a file on the branch with the same name.
2688           echo "branch revision" > file2
2689           dotest death2-15 "${testcvs} add file2" \
2690 "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
2691 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2692           dotest death2-16 "${testcvs} -q commit -m add" \
2693 "Checking in file2;
2694 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
2695 new revision: 1\.1\.2\.1; previous revision: 1\.1
2696 done"
2697
2698           # Add a new file on the branch.
2699           echo "first revision" > file3
2700           dotest death2-17 "${testcvs} add file3" \
2701 "${PROG}"' [a-z]*: scheduling file `file3'\'' for addition on branch `branch'\''
2702 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2703           dotest death2-18 "${testcvs} -q commit -m add" \
2704 "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file3,v
2705 done
2706 Checking in file3;
2707 ${TESTDIR}/cvsroot/first-dir/Attic/file3,v  <--  file3
2708 new revision: 1\.1\.2\.1; previous revision: 1\.1
2709 done"
2710
2711           # Test diff of a nonexistent tag
2712           dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \
2713 "${PROG} [a-z]*: tag tag is not in file file3"
2714
2715           dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \
2716 "Index: file3
2717 ===================================================================
2718 RCS file: file3
2719 diff -N file3
2720 \*\*\* /dev/null[       ][      ]*[a-zA-Z0-9: ]*
2721 --- ${tempname}[        ][      ]*[a-zA-Z0-9: ]*
2722 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2723 \*\*\* 0 \*\*\*\*
2724 --- 1 ----
2725 ${PLUS} first revision"
2726
2727           dotest_fail death2-diff-11 "${testcvs} -q diff -rtag -c ." \
2728 "Index: file1
2729 ===================================================================
2730 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
2731 retrieving revision 1\.1
2732 retrieving revision 1\.1\.2\.2
2733 diff -c -r1\.1 -r1\.1\.2\.2
2734 \*\*\* file1[   ][      ]*[a-zA-Z0-9:./         ]*
2735 --- file1[      ][      ]*[a-zA-Z0-9:./         ]*
2736 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2737 \*\*\* 1 \*\*\*\*
2738 ! first revision
2739 --- 1 ----
2740 ! second revision
2741 ${PROG} [a-z]*: tag tag is not in file file2
2742 ${PROG} [a-z]*: tag tag is not in file file3"
2743
2744           dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \
2745 "Index: file1
2746 ===================================================================
2747 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
2748 retrieving revision 1\.1
2749 retrieving revision 1\.1\.2\.2
2750 diff -c -r1\.1 -r1\.1\.2\.2
2751 \*\*\* file1[   ][      ]*[a-zA-Z0-9:./         ]*
2752 --- file1[      ][      ]*[a-zA-Z0-9:./         ]*
2753 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2754 \*\*\* 1 \*\*\*\*
2755 ! first revision
2756 --- 1 ----
2757 ! second revision
2758 Index: file2
2759 ===================================================================
2760 RCS file: file2
2761 diff -N file2
2762 \*\*\* /dev/null[       ][      ]*[a-zA-Z0-9: ]*
2763 --- ${tempname}[        ][      ]*[a-zA-Z0-9: ]*
2764 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2765 \*\*\* 0 \*\*\*\*
2766 --- 1 ----
2767 ${PLUS} branch revision
2768 Index: file3
2769 ===================================================================
2770 RCS file: file3
2771 diff -N file3
2772 \*\*\* /dev/null[       ][      ]*[a-zA-Z0-9: ]*
2773 --- ${tempname}[        ][      ]*[a-zA-Z0-9: ]*
2774 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2775 \*\*\* 0 \*\*\*\*
2776 --- 1 ----
2777 ${PLUS} first revision"
2778
2779           # Switch to the nonbranch tag.
2780           dotest death2-19 "${testcvs} -q update -r tag" \
2781 "U file1
2782 ${PROG} [a-z]*: file2 is no longer in the repository
2783 ${PROG} [a-z]*: file3 is no longer in the repository" \
2784 "P file1
2785 ${PROG} [a-z]*: file2 is no longer in the repository
2786 ${PROG} [a-z]*: file3 is no longer in the repository"
2787
2788           dotest_fail death2-20 "test -f file2"
2789
2790           # Make sure diff only reports appropriate files.
2791           dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \
2792 "${PROG} [a-z]*: file1 is a new entry, no comparison available"
2793
2794           dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \
2795 "Index: file1
2796 ===================================================================
2797 RCS file: file1
2798 diff -N file1
2799 \*\*\* /dev/null[       ][      ]*[a-zA-Z0-9: ]*
2800 --- ${tempname}[        ][      ]*[a-zA-Z0-9: ]*
2801 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2802 \*\*\* 0 \*\*\*\*
2803 --- 1 ----
2804 ${PLUS} first revision"
2805
2806           cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
2807           ;;
2808
2809         branches)
2810           # More branch tests, including branches off of branches
2811           mkdir ${CVSROOT_DIRNAME}/first-dir
2812           dotest branches-1 "${testcvs} -q co first-dir" ''
2813           cd first-dir
2814           echo 1:ancest >file1
2815           echo 2:ancest >file2
2816           echo 3:ancest >file3
2817           echo 4:trunk-1 >file4
2818           dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
2819 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
2820 '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
2821 '"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
2822 '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
2823 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
2824           dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
2825           dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
2826 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
2827 done
2828 Checking in file1;
2829 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2830 initial revision: 1.1
2831 done
2832 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
2833 done
2834 Checking in file2;
2835 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
2836 initial revision: 1.1
2837 done
2838 RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
2839 done
2840 Checking in file3;
2841 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
2842 initial revision: 1.1
2843 done
2844 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
2845 done
2846 Checking in file4;
2847 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2848 initial revision: 1.1
2849 done
2850 HERE
2851           echo 4:trunk-2 >file4
2852           dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
2853 "Checking in file4;
2854 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2855 new revision: 1\.2; previous revision: 1\.1
2856 done"
2857           # The "cvs log file4" in test branches-14.3 will test that we
2858           # didn't really add the tag.
2859           dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
2860 "T file1
2861 T file2
2862 T file3
2863 T file4"
2864           dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \.
2865 T file1
2866 T file2
2867 T file3
2868 T file4'
2869           dotest branches-5 "${testcvs} update -r br1" \
2870 "${PROG}"' [a-z]*: Updating \.'
2871           echo 1:br1 >file1
2872           echo 2:br1 >file2
2873           echo 4:br1 >file4
2874           dotest branches-6 "${testcvs} -q ci -m modify" \
2875 "Checking in file1;
2876 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2877 new revision: 1\.1\.2\.1; previous revision: 1\.1
2878 done
2879 Checking in file2;
2880 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
2881 new revision: 1\.1\.2\.1; previous revision: 1\.1
2882 done
2883 Checking in file4;
2884 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2885 new revision: 1\.2\.2\.1; previous revision: 1\.2
2886 done"
2887           dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
2888 T file2
2889 T file3
2890 T file4'
2891           dotest branches-8 "${testcvs} -q update -r brbr" ''
2892           echo 1:brbr >file1
2893           echo 4:brbr >file4
2894           dotest branches-9 "${testcvs} -q ci -m modify" \
2895 "Checking in file1;
2896 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
2897 new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
2898 done
2899 Checking in file4;
2900 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2901 new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
2902 done"
2903           dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
2904 2:br1
2905 3:ancest
2906 4:brbr'
2907           dotest branches-11 "${testcvs} -q update -r br1" \
2908 '[UP] file1
2909 [UP] file4'
2910           dotest branches-12 "cat file1 file2 file3 file4" '1:br1
2911 2:br1
2912 3:ancest
2913 4:br1'
2914           echo 4:br1-2 >file4
2915           dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
2916 "Checking in file4;
2917 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2918 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
2919 done"
2920           dotest branches-13 "${testcvs} -q update -A" '[UP] file1
2921 [UP] file2
2922 [UP] file4'
2923           dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
2924 2:ancest
2925 3:ancest
2926 4:trunk-2'
2927           echo 4:trunk-3 >file4
2928           dotest branches-14.2 \
2929             "${testcvs} -q ci -m trunk-change-after-branch" \
2930 "Checking in file4;
2931 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
2932 new revision: 1\.3; previous revision: 1\.2
2933 done"
2934           dotest branches-14.3 "${testcvs} log file4" \
2935 "
2936 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
2937 Working file: file4
2938 head: 1\.3
2939 branch:
2940 locks: strict
2941 access list:
2942 symbolic names:
2943         brbr: 1\.2\.2\.1\.0\.2
2944         br1: 1\.2\.0\.2
2945 keyword substitution: kv
2946 total revisions: 6;     selected revisions: 6
2947 description:
2948 ----------------------------
2949 revision 1\.3
2950 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
2951 trunk-change-after-branch
2952 ----------------------------
2953 revision 1\.2
2954 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
2955 branches:  1\.2\.2;
2956 trunk-before-branch
2957 ----------------------------
2958 revision 1\.1
2959 date: [0-9/: ]*;  author: ${username};  state: Exp;
2960 add-it
2961 ----------------------------
2962 revision 1\.2\.2\.2
2963 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
2964 change-on-br1
2965 ----------------------------
2966 revision 1\.2\.2\.1
2967 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
2968 branches:  1\.2\.2\.1\.2;
2969 modify
2970 ----------------------------
2971 revision 1\.2\.2\.1\.2\.1
2972 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
2973 modify
2974 ============================================================================="
2975           dotest_status branches-14.4 1 \
2976             "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
2977 "Index: file4
2978 ===================================================================
2979 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
2980 retrieving revision 1\.1
2981 retrieving revision 1\.3
2982 diff -c -r1\.1 -r1\.3
2983 \*\*\* file4    [0-9/]* [0-9:]* 1\.1
2984 --- file4       [0-9/]* [0-9:]* 1\.3
2985 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2986 \*\*\* 1 \*\*\*\*
2987 ! 4:trunk-1
2988 --- 1 ----
2989 ! 4:trunk-3"
2990           dotest_status branches-14.5 1 \
2991             "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
2992 "Index: file4
2993 ===================================================================
2994 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
2995 retrieving revision 1\.1
2996 retrieving revision 1\.2\.2\.1
2997 diff -c -r1\.1 -r1\.2\.2\.1
2998 \*\*\* file4    [0-9/]* [0-9:]* 1\.1
2999 --- file4       [0-9/]* [0-9:]* 1\.2\.2\.1
3000 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3001 \*\*\* 1 \*\*\*\*
3002 ! 4:trunk-1
3003 --- 1 ----
3004 ! 4:br1"
3005           dotest branches-15 \
3006             "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
3007             "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3008 retrieving revision 1\.1\.2\.1
3009 retrieving revision 1\.1\.2\.1\.2\.1
3010 Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
3011 rcsmerge: warning: conflicts during merge"
3012           dotest branches-16 "cat file1" '<<<<<<< file1
3013 1:ancest
3014 =======
3015 1:brbr
3016 [>]>>>>>> 1\.1\.2\.1\.2\.1'
3017
3018           dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
3019 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3020 done
3021 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
3022 done
3023 RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
3024 done
3025 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
3026 done"
3027           cd ..
3028
3029           if test "$keep" = yes; then
3030             echo Keeping ${TESTDIR} and exiting due to --keep
3031             exit 0
3032           fi
3033
3034           rm -rf ${CVSROOT_DIRNAME}/first-dir
3035           rm -r first-dir
3036           ;;
3037
3038         rcslib)
3039           # Test librarification of RCS.
3040           # First: test whether `cvs diff' handles $Name expansion
3041           # correctly.  We diff two revisions with their symbolic tags;
3042           # neither tag should be expanded in the output.  Also diff
3043           # one revision with the working copy.
3044
3045           mkdir ${CVSROOT_DIRNAME}/first-dir
3046           dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
3047           cd first-dir
3048           echo "I am the first foo, and my name is $""Name$." > foo.c
3049           dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
3050 "${PROG} [a-z]*: scheduling file .foo\.c. for addition
3051 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3052           dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
3053 "RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
3054 done
3055 Checking in foo\.c;
3056 ${TESTDIR}/cvsroot/first-dir/foo.c,v  <--  foo\.c
3057 initial revision: 1\.1
3058 done"
3059           dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
3060           dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
3061 "===================================================================
3062 Checking out foo\.c
3063 RCS:  ${TESTDIR}/cvsroot/first-dir/foo\.c,v
3064 VERS: 1\.1
3065 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3066 I am the first foo, and my name is \$""Name: first \$\."
3067
3068           echo "I am the second foo, and my name is $""Name$." > foo.c
3069           dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
3070 "Checking in foo\.c;
3071 ${TESTDIR}/cvsroot/first-dir/foo\.c,v  <--  foo\.c
3072 new revision: 1\.2; previous revision: 1\.1
3073 done"
3074           dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
3075           dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
3076 "===================================================================
3077 Checking out foo\.c
3078 RCS:  ${TESTDIR}/cvsroot/first-dir/foo\.c,v
3079 VERS: 1\.2
3080 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3081 I am the second foo, and my name is \$""Name: second \$\."
3082
3083         dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
3084 "${PROG} [a-z]*: Diffing \.
3085 Index: foo\.c
3086 ===================================================================
3087 RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
3088 retrieving revision 1\.1
3089 retrieving revision 1\.2
3090 diff -r1\.1 -r1\.2
3091 1c1
3092 < I am the first foo, and my name is \$""Name:  \$\.
3093 ---
3094 > I am the second foo, and my name is \$""Name:  \$\."
3095
3096           echo "I am the once and future foo, and my name is $""Name$." > foo.c
3097           dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
3098 "${PROG} [a-z]*: Diffing \.
3099 Index: foo\.c
3100 ===================================================================
3101 RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
3102 retrieving revision 1\.1
3103 diff -r1\.1 foo\.c
3104 1c1
3105 < I am the first foo, and my name is \$""Name:  \$\.
3106 ---
3107 > I am the once and future foo, and my name is \$""Name\$\."
3108
3109           # Test handling of libdiff options.  diff gets quite enough
3110           # of a workout elsewhere in sanity.sh, so we assume that it's
3111           # mostly working properly if it passes all the other tests.
3112           # The main one we want to try is regex handling, since we are
3113           # using CVS's regex matcher and not diff's.
3114
3115           cat >rgx.c <<EOF
3116 test_regex (whiz, bang)
3117 {
3118 foo;
3119 bar;
3120 baz;
3121 grumble;
3122 }
3123 EOF
3124
3125           dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
3126 "${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3127           dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
3128 "RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v
3129 done
3130 Checking in rgx\.c;
3131 ${TESTDIR}/cvsroot/first-dir/rgx\.c,v  <--  rgx\.c
3132 initial revision: 1\.1
3133 done"
3134           cat >rgx.c <<EOF
3135 test_regex (whiz, bang)
3136 {
3137 foo;
3138 bar;
3139 baz;
3140 mumble;
3141 }
3142 EOF
3143           # Use dotest_fail because exit status from `cvs diff' must be 1.
3144           dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F.*( rgx.c" \
3145 "Index: rgx\.c
3146 ===================================================================
3147 RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v
3148 retrieving revision 1\.1
3149 diff -c -F\.\*( -r1\.1 rgx\.c
3150 \*\*\* rgx\.c   [0-9/]* [0-9:]* 1\.1
3151 --- rgx\.c      [0-9/]* [0-9:]*
3152 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
3153 \*\*\* 3,7 \*\*\*\*
3154   foo;
3155   bar;
3156   baz;
3157 ! grumble;
3158   }
3159 --- 3,7 ----
3160   foo;
3161   bar;
3162   baz;
3163 ! mumble;
3164   }"
3165
3166           # Tests of rcsmerge/diff3.  Merge operations get a good general
3167           # workout elsewhere; we want to make sure that options are still
3168           # handled properly.  Try merging two branches with -kv, to test
3169           # both -j and -k switches.
3170
3171           cd ..
3172
3173           rm -rf ${CVSROOT_DIRNAME}/first-dir
3174           rm -r first-dir
3175
3176           mkdir 1; cd 1
3177           dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
3178           mkdir first-dir
3179           dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
3180 "Directory ${TESTDIR}/cvsroot.*/first-dir added to the repository"
3181           cd ..; rm -r 1
3182
3183           dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
3184           cd first-dir
3185
3186           echo '$''Revision$' > file1
3187           echo '2' >> file1
3188           echo '3' >> file1
3189           dotest rcslib-merge-4 "${testcvs} -q add file1" \
3190 "${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3191           dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
3192 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3193 done
3194 Checking in file1;
3195 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3196 initial revision: 1\.1
3197 done"
3198           sed -e 's/2/two/' file1 > f; mv f file1
3199           dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
3200 "Checking in file1;
3201 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3202 new revision: 1\.2; previous revision: 1\.1
3203 done"
3204           dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
3205           dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
3206           dotest rcslib-merge-9 "${testcvs} -q status" \
3207 "===================================================================
3208 File: file1             Status: Up-to-date
3209
3210    Working revision:    1\.1.*
3211    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file1,v
3212    Sticky Tag:          patch1 (branch: 1\.1\.2)
3213    Sticky Date:         (none)
3214    Sticky Options:      (none)"
3215           dotest rcslib-merge-10 "cat file1" \
3216 '$''Revision: 1\.1 $
3217 2
3218 3'
3219           sed -e 's/3/three/' file1 > f; mv f file1
3220           dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
3221 "Checking in file1;
3222 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3223 new revision: 1\.1\.2\.1; previous revision: 1\.1
3224 done"
3225           dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
3226 "U file1
3227 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3228 retrieving revision 1\.1
3229 retrieving revision 1\.2
3230 Merging differences between 1\.1 and 1\.2 into file1
3231 rcsmerge: warning: conflicts during merge"
3232           dotest rcslib-merge-13 "cat file1" \
3233 "<<<<<<< file1
3234 1\.1\.2\.1
3235 2
3236 three
3237 [=]======
3238 1\.2
3239 two
3240 3
3241 [>]>>>>>> 1\.2"
3242
3243           cd ..
3244
3245           if test "$keep" = yes; then
3246             echo Keeping ${TESTDIR} and exiting due to --keep
3247             exit 0
3248           fi
3249
3250           rm -rf ${CVSROOT_DIRNAME}/first-dir
3251           rm -r first-dir
3252           ;;
3253
3254         multibranch)
3255           # Test the ability to have several branchpoints coming off the
3256           # same revision.
3257           mkdir ${CVSROOT_DIRNAME}/first-dir
3258           dotest multibranch-1 "${testcvs} -q co first-dir" ''
3259           cd first-dir
3260           echo 1:trunk-1 >file1
3261           dotest multibranch-2 "${testcvs} add file1" \
3262 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
3263 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
3264           dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
3265 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3266 done
3267 Checking in file1;
3268 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3269 initial revision: 1.1
3270 done
3271 HERE
3272           dotest multibranch-4 "${testcvs} tag -b br1" \
3273 "${PROG} [a-z]*: Tagging \.
3274 T file1"
3275           dotest multibranch-5 "${testcvs} tag -b br2" \
3276 "${PROG} [a-z]*: Tagging \.
3277 T file1"
3278           dotest multibranch-6 "${testcvs} -q update -r br1" ''
3279           echo on-br1 >file1
3280           dotest multibranch-7 "${testcvs} -q ci -m modify-on-br1" \
3281 "Checking in file1;
3282 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3283 new revision: 1\.1\.2\.1; previous revision: 1\.1
3284 done"
3285           dotest multibranch-8 "${testcvs} -q update -r br2" '[UP] file1'
3286           echo br2 adds a line >>file1
3287           dotest multibranch-9 "${testcvs} -q ci -m modify-on-br2" \
3288 "Checking in file1;
3289 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
3290 new revision: 1\.1\.4\.1; previous revision: 1\.1
3291 done"
3292           dotest multibranch-10 "${testcvs} -q update -r br1" '[UP] file1'
3293           dotest multibranch-11 "cat file1" 'on-br1'
3294           dotest multibranch-12 "${testcvs} -q update -r br2" '[UP] file1'
3295           dotest multibranch-13 "cat file1" '1:trunk-1
3296 br2 adds a line'
3297
3298           dotest multibranch-14 "${testcvs} log file1" \
3299 "
3300 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3301 Working file: file1
3302 head: 1\.1
3303 branch:
3304 locks: strict
3305 access list:
3306 symbolic names:
3307         br2: 1\.1\.0\.4
3308         br1: 1\.1\.0\.2
3309 keyword substitution: kv
3310 total revisions: 3;     selected revisions: 3
3311 description:
3312 ----------------------------
3313 revision 1\.1
3314 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3315 branches:  1\.1\.2;  1\.1\.4;
3316 add-it
3317 ----------------------------
3318 revision 1\.1\.4\.1
3319 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
3320 modify-on-br2
3321 ----------------------------
3322 revision 1\.1\.2\.1
3323 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
3324 modify-on-br1
3325 ============================================================================="
3326           cd ..
3327
3328           if test "$keep" = yes; then
3329             echo Keeping ${TESTDIR} and exiting due to --keep
3330             exit 0
3331           fi
3332
3333           rm -rf ${CVSROOT_DIRNAME}/first-dir
3334           rm -r first-dir
3335           ;;
3336
3337         import) # test death after import
3338                 # Tests of "cvs import":
3339                 # basic2
3340                 # rdiff  -- imports with keywords
3341                 # import  -- more tests of imports with keywords
3342                 # importb  -- -b option.
3343                 # modules3
3344                 # mflag -- various -m messages
3345                 # ignore  -- import and cvsignore
3346                 # binwrap -- import and -k wrappers
3347                 # info -- imports which are rejected by verifymsg
3348                 # head -- intended to test vendor branches and HEAD,
3349                 #   although it doesn't really do it yet.
3350
3351                 # import
3352                 mkdir import-dir ; cd import-dir
3353
3354                 for i in 1 2 3 4 ; do
3355                         echo imported file"$i" > imported-f"$i"
3356                 done
3357
3358                 # This directory should be on the default ignore list,
3359                 # so it shouldn't get imported.
3360                 mkdir RCS
3361                 echo ignore.me >RCS/ignore.me
3362
3363                 echo 'import should not expand $''Id$' >>imported-f2
3364                 cp imported-f2 ../imported-f2-orig.tmp
3365
3366                 if ${CVS} import -m first-import first-dir vendor-branch junk-1_0  ; then
3367                     pass 96
3368                 else
3369                     fail 96
3370                 fi
3371
3372                 if cmp ../imported-f2-orig.tmp imported-f2; then
3373                   pass 96.5
3374                 else
3375                   fail 96.5
3376                 fi
3377                 cd ..
3378
3379                 # co
3380                 if ${CVS} co first-dir  ; then
3381                     pass 97
3382                 else
3383                     fail 97
3384                 fi
3385
3386                 cd first-dir
3387                 for i in 1 2 3 4 ; do
3388                         if test -f imported-f"$i" ; then
3389                             pass 98-$i
3390                         else
3391                             fail 98-$i
3392                         fi
3393                 done
3394                 if test -d RCS; then
3395                     fail 98.5
3396                 else
3397                     pass 98.5
3398                 fi
3399
3400                 # remove
3401                 rm imported-f1
3402                 if ${CVS} rm imported-f1  2>> ${LOGFILE}; then
3403                     pass 99
3404                 else
3405                     fail 99
3406                 fi
3407
3408                 # change
3409                 echo local-change >> imported-f2
3410
3411                 # commit
3412                 if ${CVS} ci -m local-changes  >> ${LOGFILE} 2>&1; then
3413                     pass 100
3414                 else
3415                     fail 100
3416                 fi
3417
3418                 # log
3419                 if ${CVS} log imported-f1 | grep '1.1.1.2 (dead)'  ; then
3420                     fail 101
3421                 else
3422                     pass 101
3423                 fi
3424
3425                 # update into the vendor branch.
3426                 if ${CVS} update -rvendor-branch  ; then
3427                     pass 102
3428                 else
3429                     fail 102
3430                 fi
3431
3432                 # remove file4 on the vendor branch
3433                 rm imported-f4
3434
3435                 if ${CVS} rm imported-f4  2>> ${LOGFILE}; then
3436                     pass 103
3437                 else
3438                     fail 103
3439                 fi
3440
3441                 # commit
3442                 if ${CVS} ci -m vendor-removed imported-f4 >>${LOGFILE}; then
3443                     pass 104
3444                 else
3445                     fail 104
3446                 fi
3447
3448                 # update to main line
3449                 if ${CVS} update -A  2>> ${LOGFILE}; then
3450                     pass 105
3451                 else
3452                     fail 105
3453                 fi
3454
3455                 # second import - file4 deliberately unchanged
3456                 cd ../import-dir
3457                 for i in 1 2 3 ; do
3458                         echo rev 2 of file $i >> imported-f"$i"
3459                 done
3460                 cp imported-f2 ../imported-f2-orig.tmp
3461
3462                 if ${CVS} import -m second-import first-dir vendor-branch junk-2_0  ; then
3463                     pass 106
3464                 else
3465                     fail 106
3466                 fi
3467                 if cmp ../imported-f2-orig.tmp imported-f2; then
3468                   pass 106.5
3469                 else
3470                   fail 106.5
3471                 fi
3472                 cd ..
3473
3474                 # co
3475                 if ${CVS} co first-dir  ; then
3476                     pass 107
3477                 else
3478                     fail 107
3479                 fi
3480
3481                 cd first-dir
3482
3483                 if test -f imported-f1 ; then
3484                     fail 108
3485                 else
3486                     pass 108
3487                 fi
3488
3489                 for i in 2 3 ; do
3490                         if test -f imported-f"$i" ; then
3491                             pass 109-$i
3492                         else
3493                             fail 109-$i
3494                         fi
3495                 done
3496
3497                 # check vendor branch for file4
3498                 if ${CVS} update -rvendor-branch  ; then
3499                     pass 110
3500                 else
3501                     fail 110
3502                 fi
3503
3504                 if test -f imported-f4 ; then
3505                     pass 111
3506                 else
3507                     fail 111
3508                 fi
3509
3510                 # update to main line
3511                 if ${CVS} update -A  2>> ${LOGFILE}; then
3512                     pass 112
3513                 else
3514                     fail 112
3515                 fi
3516
3517                 cd ..
3518
3519                 dotest import-113 \
3520 "${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
3521 "${PROG} [a-z]*: file first-dir/imported-f1 is present in revision junk-2_0
3522 RCS file: ${TESTDIR}/cvsroot/first-dir/imported-f2,v
3523 retrieving revision 1\.1\.1\.1
3524 retrieving revision 1\.1\.1\.2
3525 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
3526 rcsmerge: warning: conflicts during merge"
3527
3528                 cd first-dir
3529
3530                 if test -f imported-f1 ; then
3531                     fail 114
3532                 else
3533                     pass 114
3534                 fi
3535
3536                 for i in 2 3 ; do
3537                         if test -f imported-f"$i" ; then
3538                             pass 115-$i
3539                         else
3540                             fail 115-$i
3541                         fi
3542                 done
3543
3544                 dotest import-116 'cat imported-f2' \
3545 'imported file2
3546 [<]<<<<<< imported-f2
3547 import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
3548 local-change
3549 [=]======
3550 import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
3551 rev 2 of file 2
3552 [>]>>>>>> 1\.1\.1\.2'
3553
3554                 cd ..
3555                 rm -r first-dir
3556                 rm -rf ${CVSROOT_DIRNAME}/first-dir
3557                 rm -r import-dir
3558                 ;;
3559
3560         importb)
3561           # More cvs import tests, especially -b option.
3562
3563           # OK, first we get some sources from the NetMunger project, and
3564           # import them into the 1.1.1 vendor branch.
3565           mkdir imp-dir
3566           cd imp-dir
3567           echo 'OpenMunger sources' >file1
3568           echo 'OpenMunger sources' >file2
3569           dotest importb-1 \
3570 "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
3571 "N first-dir/file1
3572 N first-dir/file2
3573
3574 No conflicts created by this import"
3575           cd ..
3576           rm -r imp-dir
3577
3578           # Now we put the sources we get from FreeMunger into 1.1.3
3579           mkdir imp-dir
3580           cd imp-dir
3581           echo 'FreeMunger sources' >file1
3582           echo 'FreeMunger sources' >file2
3583           # Not completely sure how the conflict detection is supposed to
3584           # be working here (haven't really thought about it).
3585           dotest importb-2 \
3586 "${testcvs} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
3587 "C first-dir/file1
3588 C first-dir/file2
3589
3590 2 conflicts created by this import.
3591 Use the following command to help the merge:
3592
3593         ${PROG} checkout -jfreemunger:yesterday -jfreemunger first-dir"
3594           cd ..
3595           rm -r imp-dir
3596
3597           # Now a test of main branch import (into second-dir, not first-dir).
3598           mkdir imp-dir
3599           cd imp-dir
3600           echo 'my own stuff' >mine1.c
3601           echo 'my own stuff' >mine2.c
3602           dotest_fail importb-3 \
3603 "${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
3604 "${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1"
3605           : when we implement main-branch import, should be \
3606 "N second-dir/mine1\.c
3607 N second-dir/mine2\.c
3608
3609 No conflicts created by this import"
3610           cd ..
3611           rm -r imp-dir
3612
3613           mkdir 1
3614           cd 1
3615           # when we implement main branch import, will want to 
3616           # add "second-dir" here.
3617           dotest importb-4 "${testcvs} -q co first-dir" \
3618 "U first-dir/file1
3619 U first-dir/file2"
3620           cd first-dir
3621           dotest importb-5 "${testcvs} -q log file1" "
3622 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
3623 Working file: file1
3624 head: 1\.1
3625 branch: 1\.1\.1
3626 locks: strict
3627 access list:
3628 symbolic names:
3629         freemunger-1_0: 1\.1\.3\.1
3630         freemunger: 1\.1\.3
3631         openmunger-1_0: 1\.1\.1\.1
3632         openmunger: 1\.1\.1
3633 keyword substitution: kv
3634 total revisions: 3;     selected revisions: 3
3635 description:
3636 ----------------------------
3637 revision 1\.1
3638 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3639 branches:  1\.1\.1;  1\.1\.3;
3640 Initial revision
3641 ----------------------------
3642 revision 1\.1\.3\.1
3643 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
3644 add
3645 ----------------------------
3646 revision 1\.1\.1\.1
3647 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
3648 add
3649 ============================================================================="
3650
3651           cd ../..
3652           rm -r 1
3653           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
3654           ;;
3655
3656         join)
3657           # Test doing joins which involve adding and removing files.
3658           #   Variety of scenarios (see list below), in the context of:
3659           #     * merge changes from T1 to T2 into the main line
3660           #     * merge changes from branch 'branch' into the main line
3661           #     * merge changes from branch 'branch' into branch 'br2'.
3662           # See also binfile2, which does similar things with binary files.
3663           # See also join2, which tests joining (and update -A) on only
3664           # a single file, rather than a directory.
3665           # See also join3, which tests some cases involving the greatest
3666           # common ancestor.  Here is a list of tests according to branch
3667           # topology:
3668           #
3669           # --->bp---->trunk          too many to mention
3670           #     \----->branch
3671           #
3672           #     /----->branch1
3673           # --->bp---->trunk          multibranch
3674           #     \----->branch2
3675           #
3676           # --->bp1----->bp2---->trunk   join3
3677           #     \->br1   \->br2
3678           #
3679           # --->bp1----->trunk
3680           #     \----bp2---->branch                branches
3681           #          \------>branch-of-branch
3682
3683           # We check merging changes from T1 to T2 into the main line.
3684           # Here are the interesting cases I can think of:
3685           #   1) File added between T1 and T2, not on main line.
3686           #      File should be marked for addition.
3687           #   2) File added between T1 and T2, also added on main line.
3688           #      Conflict.
3689           #   3) File removed between T1 and T2, unchanged on main line.
3690           #      File should be marked for removal.
3691           #   4) File removed between T1 and T2, modified on main line.
3692           #      If mod checked in, file should be marked for removal.
3693           #      If mod still in working directory, conflict.
3694           #   5) File removed between T1 and T2, was never on main line.
3695           #      Nothing should happen.
3696           #   6) File removed between T1 and T2, also removed on main line.
3697           #      Nothing should happen.
3698           #   7) File added on main line, not added between T1 and T2.
3699           #      Nothing should happen.
3700           #   8) File removed on main line, not modified between T1 and T2.
3701           #      Nothing should happen.
3702
3703           # We also check merging changes from a branch into the main
3704           # line.  Here are the interesting cases:
3705           #   1) File added on branch, not on main line.
3706           #      File should be marked for addition.
3707           #   2) File added on branch, also added on main line.
3708           #      Conflict.
3709           #   3) File removed on branch, unchanged on main line.
3710           #      File should be marked for removal.
3711           #   4) File removed on branch, modified on main line.
3712           #      Conflict.
3713           #   5) File removed on branch, was never on main line.
3714           #      Nothing should happen.
3715           #   6) File removed on branch, also removed on main line.
3716           #      Nothing should happen.
3717           #   7) File added on main line, not added on branch.
3718           #      Nothing should happen.
3719           #   8) File removed on main line, not modified on branch.
3720           #      Nothing should happen.
3721
3722           # In the tests below, fileN represents case N in the above
3723           # lists.
3724
3725           mkdir ${CVSROOT_DIRNAME}/first-dir
3726           mkdir 1
3727           cd 1
3728           dotest join-1 "${testcvs} -q co first-dir" ''
3729
3730           cd first-dir
3731
3732           # Add two files.
3733           echo 'first revision of file3' > file3
3734           echo 'first revision of file4' > file4
3735           echo 'first revision of file6' > file6
3736           echo 'first revision of file8' > file8
3737           dotest join-2 "${testcvs} add file3 file4 file6 file8" \
3738 "${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
3739 '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
3740 '"${PROG}"' [a-z]*: scheduling file `file6'\'' for addition
3741 '"${PROG}"' [a-z]*: scheduling file `file8'\'' for addition
3742 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
3743
3744           dotest join-3 "${testcvs} -q commit -m add" \
3745 "RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
3746 done
3747 Checking in file3;
3748 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
3749 initial revision: 1\.1
3750 done
3751 RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
3752 done
3753 Checking in file4;
3754 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
3755 initial revision: 1\.1
3756 done
3757 RCS file: ${TESTDIR}/cvsroot/first-dir/file6,v
3758 done
3759 Checking in file6;
3760 ${TESTDIR}/cvsroot/first-dir/file6,v  <--  file6
3761 initial revision: 1\.1
3762 done
3763 RCS file: ${TESTDIR}/cvsroot/first-dir/file8,v
3764 done
3765 Checking in file8;
3766 ${TESTDIR}/cvsroot/first-dir/file8,v  <--  file8
3767 initial revision: 1\.1
3768 done"
3769
3770           # Make a branch.
3771           dotest join-4 "${testcvs} -q tag -b branch ." \
3772 'T file3
3773 T file4
3774 T file6
3775 T file8'
3776
3777           # Add file2 and file7, modify file4, and remove file6 and file8.
3778           echo 'first revision of file2' > file2
3779           echo 'second revision of file4' > file4
3780           echo 'first revision of file7' > file7
3781           rm file6 file8
3782           dotest join-5 "${testcvs} add file2 file7" \
3783 "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
3784 '"${PROG}"' [a-z]*: scheduling file `file7'\'' for addition
3785 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
3786           dotest join-6 "${testcvs} rm file6 file8" \
3787 "${PROG}"' [a-z]*: scheduling `file6'\'' for removal
3788 '"${PROG}"' [a-z]*: scheduling `file8'\'' for removal
3789 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
3790           dotest join-7 "${testcvs} -q ci -mx ." \
3791 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
3792 done
3793 Checking in file2;
3794 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
3795 initial revision: 1\.1
3796 done
3797 Checking in file4;
3798 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
3799 new revision: 1\.2; previous revision: 1\.1
3800 done
3801 Removing file6;
3802 ${TESTDIR}/cvsroot/first-dir/file6,v  <--  file6
3803 new revision: delete; previous revision: 1\.1
3804 done
3805 RCS file: ${TESTDIR}/cvsroot/first-dir/file7,v
3806 done
3807 Checking in file7;
3808 ${TESTDIR}/cvsroot/first-dir/file7,v  <--  file7
3809 initial revision: 1\.1
3810 done
3811 Removing file8;
3812 ${TESTDIR}/cvsroot/first-dir/file8,v  <--  file8
3813 new revision: delete; previous revision: 1\.1
3814 done"
3815
3816           # Check out the branch.
3817           cd ../..
3818           mkdir 2
3819           cd 2
3820           dotest join-8 "${testcvs} -q co -r branch first-dir" \
3821 'U first-dir/file3
3822 U first-dir/file4
3823 U first-dir/file6
3824 U first-dir/file8'
3825
3826           cd first-dir
3827
3828           # Modify the files on the branch, so that T1 is not an
3829           # ancestor of the main line, and add file5
3830           echo 'first branch revision of file3' > file3
3831           echo 'first branch revision of file4' > file4
3832           echo 'first branch revision of file6' > file6
3833           echo 'first branch revision of file5' > file5
3834           dotest join-9 "${testcvs} add file5" \
3835 "${PROG}"' [a-z]*: scheduling file `file5'\'' for addition on branch `branch'\''
3836 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
3837           dotest join-10 "${testcvs} -q ci -mx ." \
3838 "Checking in file3;
3839 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
3840 new revision: 1\.1\.2\.1; previous revision: 1\.1
3841 done
3842 Checking in file4;
3843 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
3844 new revision: 1\.1\.2\.1; previous revision: 1\.1
3845 done
3846 RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file5,v
3847 done
3848 Checking in file5;
3849 ${TESTDIR}/cvsroot/first-dir/Attic/file5,v  <--  file5
3850 new revision: 1\.1\.2\.1; previous revision: 1\.1
3851 done
3852 Checking in file6;
3853 ${TESTDIR}/cvsroot/first-dir/Attic/file6,v  <--  file6
3854 new revision: 1\.1\.2\.1; previous revision: 1\.1
3855 done"
3856
3857           # Tag the current revisions on the branch.
3858           dotest join-11 "${testcvs} -q tag T1 ." \
3859 'T file3
3860 T file4
3861 T file5
3862 T file6
3863 T file8'
3864
3865           # Add file1 and file2, and remove the other files.
3866           echo 'first branch revision of file1' > file1
3867           echo 'first branch revision of file2' > file2
3868           rm file3 file4 file5 file6
3869           dotest join-12 "${testcvs} add file1 file2" \
3870 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition on branch `branch'\''
3871 '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
3872 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
3873           dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
3874 "${PROG}"' [a-z]*: scheduling `file3'\'' for removal
3875 '"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
3876 '"${PROG}"' [a-z]*: scheduling `file5'\'' for removal
3877 '"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
3878 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
3879           dotest join-14 "${testcvs} -q ci -mx ." \
3880 "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file1,v
3881 done
3882 Checking in file1;
3883 ${TESTDIR}/cvsroot/first-dir/Attic/file1,v  <--  file1
3884 new revision: 1\.1\.2\.1; previous revision: 1\.1
3885 done
3886 Checking in file2;
3887 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
3888 new revision: 1\.1\.2\.1; previous revision: 1\.1
3889 done
3890 Removing file3;
3891 ${TESTDIR}/cvsroot/first-dir/file3,v  <--  file3
3892 new revision: delete; previous revision: 1\.1\.2\.1
3893 done
3894 Removing file4;
3895 ${TESTDIR}/cvsroot/first-dir/file4,v  <--  file4
3896 new revision: delete; previous revision: 1\.1\.2\.1
3897 done
3898 Removing file5;
3899 ${TESTDIR}/cvsroot/first-dir/Attic/file5,v  <--  file5
3900 new revision: delete; previous revision: 1\.1\.2\.1
3901 done
3902 Removing file6;
3903 ${TESTDIR}/cvsroot/first-dir/Attic/file6,v  <--  file6
3904 new revision: delete; previous revision: 1\.1\.2\.1
3905 done"
3906
3907           # Tag the current revisions on the branch.
3908           dotest join-15 "${testcvs} -q tag T2 ." \
3909 'T file1
3910 T file2
3911 T file8'
3912
3913           # Do a checkout with a merge.
3914           cd ../..
3915           mkdir 3
3916           cd 3
3917           dotest join-16 "${testcvs} -q co -jT1 -jT2 first-dir" \
3918 'U first-dir/file1
3919 U first-dir/file2
3920 '"${PROG}"' [a-z]*: file first-dir/file2 exists, but has been added in revision T2
3921 U first-dir/file3
3922 '"${PROG}"' [a-z]*: scheduling first-dir/file3 for removal
3923 U first-dir/file4
3924 '"${PROG}"' [a-z]*: scheduling first-dir/file4 for removal
3925 U first-dir/file7'
3926
3927           # Verify that the right changes have been scheduled.
3928           cd first-dir
3929           dotest join-17 "${testcvs} -q update" \
3930 'A file1
3931 R file3
3932 R file4'
3933
3934           # Modify file4 locally, and do an update with a merge.
3935           cd ../../1/first-dir
3936           echo 'third revision of file4' > file4
3937           dotest join-18 "${testcvs} -q update -jT1 -jT2 ." \
3938 'U file1
3939 '"${PROG}"' [a-z]*: file file2 exists, but has been added in revision T2
3940 '"${PROG}"' [a-z]*: scheduling file3 for removal
3941 M file4
3942 '"${PROG}"' [a-z]*: file file4 is locally modified, but has been removed in revision T2'
3943
3944           # Verify that the right changes have been scheduled.
3945           dotest join-19 "${testcvs} -q update" \
3946 'A file1
3947 R file3
3948 M file4'
3949
3950           # Do a checkout with a merge from a single revision.
3951
3952           # FIXME: CVS currently gets this wrong.  file2 has been
3953           # added on both the branch and the main line, and so should
3954           # be regarded as a conflict.  However, given the way that
3955           # CVS sets up the RCS file, there is no way to distinguish
3956           # this case from the case of file2 having existed before the
3957           # branch was made.  This could be fixed by reserving
3958           # a revision somewhere, perhaps 1.1, as an always dead
3959           # revision which can be used as the source for files added
3960           # on branches.
3961           cd ../../3
3962           rm -r first-dir
3963           dotest join-20 "${testcvs} -q co -jbranch first-dir" \
3964 "U first-dir/file1
3965 U first-dir/file2
3966 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
3967 retrieving revision 1\.1
3968 retrieving revision 1\.1\.2\.1
3969 Merging differences between 1\.1 and 1\.1\.2\.1 into file2
3970 U first-dir/file3
3971 ${PROG} [a-z]*: scheduling first-dir/file3 for removal
3972 U first-dir/file4
3973 ${PROG} [a-z]*: file first-dir/file4 has been modified, but has been removed in revision branch
3974 U first-dir/file7"
3975
3976           # Verify that the right changes have been scheduled.
3977           # The M file2 line is a bug; see above join-20.
3978           cd first-dir
3979           dotest join-21 "${testcvs} -q update" \
3980 'A file1
3981 M file2
3982 R file3'
3983
3984           # Checkout the main line again.
3985           cd ../../1
3986           rm -r first-dir
3987           dotest join-22 "${testcvs} -q co first-dir" \
3988 'U first-dir/file2
3989 U first-dir/file3
3990 U first-dir/file4
3991 U first-dir/file7'
3992
3993           # Modify file4 locally, and do an update with a merge from a
3994           # single revision.
3995           # The file2 handling is a bug; see above join-20.
3996           cd first-dir
3997           echo 'third revision of file4' > file4
3998           dotest join-23 "${testcvs} -q update -jbranch ." \
3999 "U file1
4000 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
4001 retrieving revision 1\.1
4002 retrieving revision 1\.1\.2\.1
4003 Merging differences between 1\.1 and 1\.1\.2\.1 into file2
4004 ${PROG} [a-z]*: scheduling file3 for removal
4005 M file4
4006 ${PROG} [a-z]*: file file4 is locally modified, but has been removed in revision branch"
4007
4008           # Verify that the right changes have been scheduled.
4009           # The M file2 line is a bug; see above join-20
4010           dotest join-24 "${testcvs} -q update" \
4011 'A file1
4012 M file2
4013 R file3
4014 M file4'
4015
4016           cd ..
4017
4018           # Checkout the main line again and make a new branch which we
4019           # merge to.
4020           rm -r first-dir
4021           dotest join-25 "${testcvs} -q co first-dir" \
4022 'U first-dir/file2
4023 U first-dir/file3
4024 U first-dir/file4
4025 U first-dir/file7'
4026           cd first-dir
4027           dotest join-26 "${testcvs} -q tag -b br2" \
4028 "T file2
4029 T file3
4030 T file4
4031 T file7"
4032           dotest join-27 "${testcvs} -q update -r br2" ""
4033           # The handling of file8 here looks fishy to me.  I don't see
4034           # why it should be different from the case where we merge to
4035           # the trunk (e.g. join-23).
4036           dotest join-28 "${testcvs} -q update -j branch" \
4037 "U file1
4038 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
4039 retrieving revision 1.1
4040 retrieving revision 1.1.2.1
4041 Merging differences between 1.1 and 1.1.2.1 into file2
4042 ${PROG} [a-z]*: scheduling file3 for removal
4043 ${PROG} [a-z]*: file file4 has been modified, but has been removed in revision branch
4044 U file8"
4045           # Verify that the right changes have been scheduled.
4046           dotest join-29 "${testcvs} -q update" \
4047 "A file1
4048 M file2
4049 R file3
4050 A file8"
4051
4052           cd ../..
4053
4054           rm -r 1 2 3
4055           rm -rf ${CVSROOT_DIRNAME}/first-dir
4056           ;;
4057
4058         join2)
4059           # More joining tests.
4060
4061           # First the usual setup; create a directory first-dir, a file
4062           # first-dir/file1, and a branch br1.
4063           mkdir 1; cd 1
4064           dotest join2-1 "${testcvs} -q co -l ." ''
4065           mkdir first-dir
4066           dotest join2-2 "${testcvs} add first-dir" \
4067 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
4068           cd first-dir
4069           echo 'initial contents of file1' >file1
4070           dotest join2-3 "${testcvs} add file1" \
4071 "${PROG} [a-z]*: scheduling file .file1. for addition
4072 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4073           dotest join2-4 "${testcvs} -q ci -m add" \
4074 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4075 done
4076 Checking in file1;
4077 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4078 initial revision: 1\.1
4079 done"
4080           dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
4081           dotest join2-6 "${testcvs} -q update -r br1" ""
4082           echo 'modify on branch' >>file1
4083           touch bradd
4084           dotest join2-6a "${testcvs} add bradd" \
4085 "${PROG} [a-z]*: scheduling file .bradd. for addition on branch .br1.
4086 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4087           dotest join2-7 "${testcvs} -q ci -m modify" \
4088 "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v
4089 done
4090 Checking in bradd;
4091 ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v  <--  bradd
4092 new revision: 1\.1\.2\.1; previous revision: 1\.1
4093 done
4094 Checking in file1;
4095 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4096 new revision: 1\.1\.2\.1; previous revision: 1\.1
4097 done"
4098
4099           # Here is the unusual/pathological part.  We switch back to
4100           # the trunk *for file1 only*, not for the whole directory.
4101           dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
4102           dotest join2-9 "${testcvs} -q status file1" \
4103 "===================================================================
4104 File: file1             Status: Up-to-date
4105
4106    Working revision:    1\.1.*
4107    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file1,v
4108    Sticky Tag:          (none)
4109    Sticky Date:         (none)
4110    Sticky Options:      (none)"
4111           dotest join2-10 "cat CVS/Tag" "Tbr1"
4112
4113           dotest join2-11 "${testcvs} -q update -j br1 file1" \
4114 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4115 retrieving revision 1\.1
4116 retrieving revision 1\.1\.2\.1
4117 Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
4118           dotest join2-12 "cat file1" "initial contents of file1
4119 modify on branch"
4120           # We should have no sticky tag on file1
4121           dotest join2-13 "${testcvs} -q status file1" \
4122 "===================================================================
4123 File: file1             Status: Locally Modified
4124
4125    Working revision:    1\.1.*
4126    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/file1,v
4127    Sticky Tag:          (none)
4128    Sticky Date:         (none)
4129    Sticky Options:      (none)"
4130           dotest join2-14 "cat CVS/Tag" "Tbr1"
4131           # And the checkin should go to the trunk
4132           dotest join2-15 "${testcvs} -q ci -m modify file1" \
4133 "Checking in file1;
4134 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4135 new revision: 1\.2; previous revision: 1\.1
4136 done"
4137
4138           # OK, the above is all well and good and has worked for some
4139           # time.  Now try the case where the file had been added on
4140           # the branch.
4141           dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
4142           # The workaround is to update the whole directory.
4143           # The non-circumvented version won't work.  The reason is that
4144           # update removes the entry from CVS/Entries, so of course we get
4145           # the tag from CVS/Tag and not Entries.  I suppose maybe
4146           # we could invent some new format in Entries which would handle
4147           # this, but doing so, and handling it properly throughout
4148           # CVS, would be a lot of work and I'm not sure this case justifies
4149           # it.
4150           dotest join2-17-circumvent "${testcvs} -q update -A" \
4151 "${PROG} [a-z]*: warning: bradd is not (any longer) pertinent
4152 [UP] file1"
4153 :         dotest join2-17 "${testcvs} -q update -A bradd" \
4154 "${PROG} [a-z]*: warning: bradd is not (any longer) pertinent"
4155           dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
4156           dotest join2-19 "${testcvs} -q status bradd" \
4157 "===================================================================
4158 File: bradd             Status: Locally Added
4159
4160    Working revision:    New file!
4161    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v
4162    Sticky Tag:          (none)
4163    Sticky Date:         (none)
4164    Sticky Options:      (none)"
4165           dotest join2-20 "${testcvs} -q ci -m modify bradd" \
4166 "Checking in bradd;
4167 ${TESTDIR}/cvsroot/first-dir/bradd,v  <--  bradd
4168 new revision: 1\.2; previous revision: 1\.1
4169 done"
4170
4171           cd ../..
4172           rm -r 1
4173           rm -rf ${CVSROOT_DIRNAME}/first-dir
4174           ;;
4175
4176         join3)
4177           # See "join" for a list of other joining/branching tests.
4178           # First the usual setup; create a directory first-dir, a file
4179           # first-dir/file1, and a branch br1.
4180           mkdir 1; cd 1
4181           dotest join3-1 "${testcvs} -q co -l ." ''
4182           mkdir first-dir
4183           dotest join3-2 "${testcvs} add first-dir" \
4184 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
4185           cd first-dir
4186           echo 'initial contents of file1' >file1
4187           dotest join3-3 "${testcvs} add file1" \
4188 "${PROG} [a-z]*: scheduling file .file1. for addition
4189 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4190           dotest join3-4 "${testcvs} -q ci -m add" \
4191 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4192 done
4193 Checking in file1;
4194 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4195 initial revision: 1\.1
4196 done"
4197           dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
4198           dotest join3-6 "${testcvs} -q update -r br1" ""
4199           echo 'br1:line1' >>file1
4200           dotest join3-7 "${testcvs} -q ci -m modify" \
4201 "Checking in file1;
4202 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4203 new revision: 1\.1\.2\.1; previous revision: 1\.1
4204 done"
4205
4206           # Now back to the trunk for:
4207           # another revision and another branch for file1.
4208           # add file2, which will exist on trunk and br2 but not br1.
4209           dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
4210           echo 'trunk:line1' > file2
4211           dotest join3-8a "${testcvs} add file2" \
4212 "${PROG} [a-z]*: scheduling file .file2. for addition
4213 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4214           echo 'trunk:line1' >>file1
4215           dotest join3-9 "${testcvs} -q ci -m modify" \
4216 "Checking in file1;
4217 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4218 new revision: 1\.2; previous revision: 1\.1
4219 done
4220 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
4221 done
4222 Checking in file2;
4223 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
4224 initial revision: 1\.1
4225 done"
4226           dotest join3-10 "${testcvs} -q tag -b br2" "T file1
4227 T file2"
4228
4229           # Before we actually have any revision on br2, let's try a join
4230           dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
4231 ${PROG} [a-z]*: file2 is no longer in the repository"
4232           dotest join3-12 "${testcvs} -q update -j br2" \
4233 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4234 retrieving revision 1\.1
4235 retrieving revision 1\.2
4236 Merging differences between 1\.1 and 1\.2 into file1
4237 rcsmerge: warning: conflicts during merge
4238 U file2"
4239           dotest join3-13 "cat file1" \
4240 "initial contents of file1
4241 [<]<<<<<< file1
4242 br1:line1
4243 [=]======
4244 trunk:line1
4245 [>]>>>>>> 1\.2"
4246           rm file1
4247
4248           # OK, we'll try the same thing with a revision on br2.
4249           dotest join3-14 "${testcvs} -q update -r br2 file1" \
4250 "${PROG} [a-z]*: warning: file1 was lost
4251 U file1" "U file1"
4252           echo 'br2:line1' >>file1
4253           dotest join3-15 "${testcvs} -q ci -m modify file1" \
4254 "Checking in file1;
4255 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4256 new revision: 1\.2\.2\.1; previous revision: 1\.2
4257 done"
4258
4259           # OK, now we can join br2 to br1
4260           dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
4261           # It may seem odd, to merge a higher branch into a lower
4262           # branch, but in fact CVS defines the ancestor as 1.1
4263           # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
4264           # This seems like a reasonably plausible behavior.
4265           dotest join3-17 "${testcvs} -q update -j br2 file1" \
4266 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4267 retrieving revision 1\.1
4268 retrieving revision 1\.2\.2\.1
4269 Merging differences between 1\.1 and 1\.2\.2\.1 into file1
4270 rcsmerge: warning: conflicts during merge"
4271           dotest join3-18 "cat file1" \
4272 "initial contents of file1
4273 [<]<<<<<< file1
4274 br1:line1
4275 [=]======
4276 trunk:line1
4277 br2:line1
4278 [>]>>>>>> 1\.2\.2\.1"
4279
4280           cd ../..
4281           rm -r 1
4282           rm -rf ${CVSROOT_DIRNAME}/first-dir
4283           ;;
4284
4285         new) # look for stray "no longer pertinent" messages.
4286                 mkdir ${CVSROOT_DIRNAME}/first-dir
4287
4288                 if ${CVS} co first-dir  ; then
4289                     pass 117
4290                 else
4291                     fail 117
4292                 fi
4293
4294                 cd first-dir
4295                 touch a
4296
4297                 if ${CVS} add a  2>>${LOGFILE}; then
4298                     pass 118
4299                 else
4300                     fail 118
4301                 fi
4302
4303                 if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
4304                     pass 119
4305                 else
4306                     fail 119
4307                 fi
4308
4309                 rm a
4310
4311                 if ${CVS} rm a  2>>${LOGFILE}; then
4312                     pass 120
4313                 else
4314                     fail 120
4315                 fi
4316
4317                 if ${CVS} ci -m removed >>${LOGFILE} ; then
4318                     pass 121
4319                 else
4320                     fail 121
4321                 fi
4322
4323                 if ${CVS} update -A  2>&1 | grep longer ; then
4324                     fail 122
4325                 else
4326                     pass 122
4327                 fi
4328
4329                 if ${CVS} update -rHEAD 2>&1 | grep longer ; then
4330                     fail 123
4331                 else
4332                     pass 123
4333                 fi
4334
4335                 cd ..
4336                 rm -r first-dir
4337                 rm -rf ${CVSROOT_DIRNAME}/first-dir
4338                 ;;
4339
4340         newb)
4341           # Test removing a file on a branch and then checking it out.
4342
4343           # We call this "newb" only because it, like the "new" tests,
4344           # has something to do with "no longer pertinent" messages.
4345           # Not necessarily the most brilliant nomenclature.
4346
4347           # Create file 'a'.
4348           mkdir ${CVSROOT_DIRNAME}/first-dir
4349           dotest newb-123a "${testcvs} -q co first-dir" ''
4350           cd first-dir
4351           touch a
4352           dotest newb-123b "${testcvs} add a" \
4353 "${PROG} [a-z]*: scheduling file .a. for addition
4354 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4355           dotest newb-123c "${testcvs} -q ci -m added" \
4356 "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
4357 done
4358 Checking in a;
4359 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4360 initial revision: 1\.1
4361 done"
4362
4363           # Make a branch.
4364           dotest newb-123d "${testcvs} -q tag -b branch" "T a"
4365
4366           # Check out the branch.
4367           cd ..
4368           rm -r first-dir
4369           mkdir 1
4370           cd 1
4371           dotest newb-123e "${testcvs} -q co -r branch first-dir" \
4372 "U first-dir/a"
4373
4374           # Remove 'a' on another copy of the branch.
4375           cd ..
4376           mkdir 2
4377           cd 2
4378           dotest newb-123f "${testcvs} -q co -r branch first-dir" \
4379 "U first-dir/a"
4380           cd first-dir
4381           rm a
4382           dotest newb-123g "${testcvs} rm a" \
4383 "${PROG} [a-z]*: scheduling .a. for removal
4384 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4385           dotest newb-123h "${testcvs} -q ci -m removed" \
4386 "Removing a;
4387 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4388 new revision: delete; previous revision: 1\.1\.2
4389 done"
4390
4391           # Check out the file on the branch.  This should report
4392           # that the file is not pertinent, but it should not
4393           # say anything else.
4394           cd ..
4395           rm -r first-dir
4396           dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
4397 "${PROG} [a-z]*: warning: first-dir/a is not (any longer) pertinent"
4398
4399           # Update the other copy, and make sure that a is removed.
4400           cd ../1/first-dir
4401           # "Needs Patch" is a rather strange output here.  Something like
4402           # "Removed in Repository" would make more sense.
4403           # The "Need Checkout" output is what CVS does if configured
4404           # --disable-server.
4405           dotest newb-123j0 "${testcvs} status a" \
4406 "===================================================================
4407 File: a                 Status: Needs Patch
4408
4409    Working revision:    1\.1.*
4410    Repository revision: 1\.1\.2\.1      ${TESTDIR}/cvsroot/first-dir/a,v
4411    Sticky Tag:          branch (branch: 1\.1\.2)
4412    Sticky Date:         (none)
4413    Sticky Options:      (none)" \
4414 "===================================================================
4415 File: a                 Status: Needs Checkout
4416
4417    Working revision:    1\.1.*
4418    Repository revision: 1\.1\.2\.1      ${TESTDIR}/cvsroot/first-dir/a,v
4419    Sticky Tag:          branch (branch: 1\.1\.2)
4420    Sticky Date:         (none)
4421    Sticky Options:      (none)"
4422           dotest newb-123j "${testcvs} -q update" \
4423 "${PROG} [a-z]*: warning: a is not (any longer) pertinent"
4424
4425           if test -f a; then
4426             fail newb-123k
4427           else
4428             pass newb-123k
4429           fi
4430
4431           cd ../..
4432           rm -r 1 2
4433           rm -rf ${CVSROOT_DIRNAME}/first-dir
4434           ;;
4435
4436         conflicts)
4437                 mkdir ${CVSROOT_DIRNAME}/first-dir
4438
4439                 mkdir 1
4440                 cd 1
4441
4442                 dotest conflicts-124 "${testcvs} -q co first-dir" ''
4443
4444                 cd first-dir
4445                 touch a
4446
4447                 dotest conflicts-125 "${testcvs} add a" \
4448 "${PROG} [a-z]*: scheduling file .a. for addition
4449 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4450                 dotest conflicts-126 "${testcvs} -q ci -m added" \
4451 "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
4452 done
4453 Checking in a;
4454 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4455 initial revision: 1\.1
4456 done"
4457
4458                 cd ../..
4459                 mkdir 2
4460                 cd 2
4461
4462                 # The need for TMPPWD here is a (minor) CVS bug; the
4463                 # output should use the name of the repository as specified.
4464                 dotest conflicts-126.5 "${testcvs} co -p first-dir" \
4465 "${PROG} [a-z]*: Updating first-dir
4466 ===================================================================
4467 Checking out first-dir/a
4468 RCS:  ${TMPPWD}/cvsroot/first-dir/a,v
4469 VERS: 1\.1
4470 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
4471                 if ${CVS} co first-dir ; then
4472                     pass 127
4473                 else
4474                     fail 127
4475                 fi
4476                 cd first-dir
4477                 if test -f a; then
4478                     pass 127a
4479                 else
4480                     fail 127a
4481                 fi
4482
4483                 cd ../../1/first-dir
4484                 echo add a line >>a
4485                 mkdir dir1
4486                 dotest conflicts-127b "${testcvs} add dir1" \
4487 "Directory ${TESTDIR}/cvsroot/first-dir/dir1 added to the repository"
4488                 dotest conflicts-128 "${testcvs} -q ci -m changed" \
4489 "Checking in a;
4490 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4491 new revision: 1\.2; previous revision: 1\.1
4492 done"
4493                 cd ../..
4494
4495                 # Similar to conflicts-126.5, but now the file has nonempty
4496                 # contents.
4497                 mkdir 3
4498                 cd 3
4499                 # The need for TMPPWD here is a (minor) CVS bug; the
4500                 # output should use the name of the repository as specified.
4501                 dotest conflicts-128.5 "${testcvs} co -p -l first-dir" \
4502 "${PROG} [a-z]*: Updating first-dir
4503 ===================================================================
4504 Checking out first-dir/a
4505 RCS:  ${TMPPWD}/cvsroot/first-dir/a,v
4506 VERS: 1\.2
4507 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4508 add a line"
4509                 cd ..
4510                 rmdir 3
4511
4512                 # Now go over the to the other working directory and
4513                 # start testing conflicts
4514                 cd 2/first-dir
4515                 echo add a conflicting line >>a
4516                 dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
4517 "${PROG}"' [a-z]*: Up-to-date check failed for `a'\''
4518 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
4519                 mkdir dir1
4520                 mkdir sdir
4521                 dotest conflicts-status-0 "${testcvs} status a" \
4522 "===================================================================
4523 File: a                 Status: Needs Merge
4524
4525    Working revision:    1\.1.*
4526    Repository revision: 1\.2    ${TESTDIR}/cvsroot/first-dir/a,v
4527    Sticky Tag:          (none)
4528    Sticky Date:         (none)
4529    Sticky Options:      (none)"
4530                 dotest conflicts-130 "${testcvs} -q update" \
4531 "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
4532 retrieving revision 1\.1
4533 retrieving revision 1\.2
4534 Merging differences between 1\.1 and 1\.2 into a
4535 rcsmerge: warning: conflicts during merge
4536 ${PROG} [a-z]*: conflicts found in a
4537 C a
4538 ${QUESTION} dir1
4539 ${QUESTION} sdir" \
4540 "${QUESTION} dir1
4541 ${QUESTION} sdir
4542 RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
4543 retrieving revision 1\.1
4544 retrieving revision 1\.2
4545 Merging differences between 1\.1 and 1\.2 into a
4546 rcsmerge: warning: conflicts during merge
4547 ${PROG} [a-z]*: conflicts found in a
4548 C a"
4549                 rmdir dir1 sdir
4550
4551                 dotest conflicts-status-1 "${testcvs} status a" \
4552 "===================================================================
4553 File: a                 Status: File had conflicts on merge
4554
4555    Working revision:    1\.2.*
4556    Repository revision: 1\.2    ${TESTDIR}/cvsroot/first-dir/a,v
4557    Sticky Tag:          (none)
4558    Sticky Date:         (none)
4559    Sticky Options:      (none)"
4560                 dotest_fail conflicts-131 "${testcvs} -q ci -m try" \
4561 "${PROG} [a-z]*: file .a. had a conflict and has not been modified
4562 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
4563
4564                 echo lame attempt at resolving it >>a
4565                 # Try to check in the file with the conflict markers in it.
4566                 dotest conflicts-status-2 "${testcvs} status a" \
4567 "===================================================================
4568 File: a                 Status: File had conflicts on merge
4569
4570    Working revision:    1\.2.*
4571    Repository revision: 1\.2    ${TESTDIR}/cvsroot/first-dir/a,v
4572    Sticky Tag:          (none)
4573    Sticky Date:         (none)
4574    Sticky Options:      (none)"
4575                 dotest conflicts-132 "${testcvs} -q ci -m try" \
4576 "${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators
4577 Checking in a;
4578 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4579 new revision: 1\.3; previous revision: 1\.2
4580 done"
4581
4582                 # OK, the user saw the warning (good user), and now
4583                 # resolves it for real.
4584                 echo resolve conflict >a
4585                 dotest conflicts-status-3 "${testcvs} status a" \
4586 "===================================================================
4587 File: a                 Status: Locally Modified
4588
4589    Working revision:    1\.3.*
4590    Repository revision: 1\.3    ${TESTDIR}/cvsroot/first-dir/a,v
4591    Sticky Tag:          (none)
4592    Sticky Date:         (none)
4593    Sticky Options:      (none)"
4594                 dotest conflicts-133 "${testcvs} -q ci -m resolved" \
4595 "Checking in a;
4596 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4597 new revision: 1\.4; previous revision: 1\.3
4598 done"
4599                 dotest conflicts-status-4 "${testcvs} status a" \
4600 "===================================================================
4601 File: a                 Status: Up-to-date
4602
4603    Working revision:    1\.4.*
4604    Repository revision: 1\.4    ${TESTDIR}/cvsroot/first-dir/a,v
4605    Sticky Tag:          (none)
4606    Sticky Date:         (none)
4607    Sticky Options:      (none)"
4608
4609                 # Now test that we can add a file in one working directory
4610                 # and have an update in another get it.
4611                 cd ../../1/first-dir
4612                 echo abc >abc
4613                 if ${testcvs} add abc >>${LOGFILE} 2>&1; then
4614                     pass 134
4615                 else
4616                     fail 134
4617                 fi
4618                 if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
4619                     pass 135
4620                 else
4621                     fail 135
4622                 fi
4623                 cd ../../2
4624                 mkdir first-dir/dir1 first-dir/sdir
4625                 dotest conflicts-136 "${testcvs} -q update first-dir" \
4626 '[UP] first-dir/abc
4627 '"${QUESTION}"' first-dir/dir1
4628 '"${QUESTION}"' first-dir/sdir' \
4629 ''"${QUESTION}"' first-dir/dir1
4630 '"${QUESTION}"' first-dir/sdir
4631 [UP] first-dir/abc'
4632                 dotest conflicts-137 'test -f first-dir/abc' ''
4633                 rmdir first-dir/dir1 first-dir/sdir
4634
4635                 # Now test something similar, but in which the parent directory
4636                 # (not the directory in question) has the Entries.Static flag
4637                 # set.
4638                 cd ../1/first-dir
4639                 mkdir subdir
4640                 if ${testcvs} add subdir >>${LOGFILE}; then
4641                     pass 138
4642                 else
4643                     fail 138
4644                 fi
4645                 cd ../..
4646                 mkdir 3
4647                 cd 3
4648                 if ${testcvs} -q co first-dir/abc first-dir/subdir \
4649                     >>${LOGFILE}; then
4650                     pass 139
4651                 else
4652                     fail 139
4653                 fi
4654                 cd ../1/first-dir/subdir
4655                 echo sss >sss
4656                 if ${testcvs} add sss >>${LOGFILE} 2>&1; then
4657                     pass 140
4658                 else
4659                     fail 140
4660                 fi
4661                 if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
4662                     pass 140
4663                 else
4664                     fail 140
4665                 fi
4666                 cd ../../../3/first-dir
4667                 if ${testcvs} -q update >>${LOGFILE}; then
4668                     pass 141
4669                 else
4670                     fail 141
4671                 fi
4672                 if test -f subdir/sss; then
4673                     pass 142
4674                 else
4675                     fail 142
4676                 fi
4677                 cd ../..
4678                 rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
4679                 ;;
4680
4681         conflicts2)
4682           # More conflicts tests; separate from conflicts to keep each
4683           # test a manageable size.
4684           mkdir ${CVSROOT_DIRNAME}/first-dir
4685
4686           mkdir 1
4687           cd 1
4688
4689           dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
4690
4691           cd first-dir
4692           touch a abc
4693
4694           dotest conflicts2-142a2 "${testcvs} add a abc" \
4695 "${PROG} [a-z]*: scheduling file .a. for addition
4696 ${PROG} [a-z]*: scheduling file .abc. for addition
4697 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
4698           dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
4699 "RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
4700 done
4701 Checking in a;
4702 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4703 initial revision: 1\.1
4704 done
4705 RCS file: ${TESTDIR}/cvsroot/first-dir/abc,v
4706 done
4707 Checking in abc;
4708 ${TESTDIR}/cvsroot/first-dir/abc,v  <--  abc
4709 initial revision: 1\.1
4710 done"
4711
4712           cd ../..
4713           mkdir 2
4714           cd 2
4715
4716           dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
4717 U first-dir/abc'
4718           cd ..
4719
4720           # Now test that if one person modifies and commits a
4721           # file and a second person removes it, it is a
4722           # conflict
4723           cd 1/first-dir
4724           echo modify a >>a
4725           dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
4726 "Checking in a;
4727 ${TESTDIR}/cvsroot/first-dir/a,v  <--  a
4728 new revision: 1\.2; previous revision: 1\.1
4729 done"
4730           cd ../../2/first-dir
4731           rm a
4732           dotest conflicts2-142b3 "${testcvs} rm a" \
4733 "${PROG} [a-z]*: scheduling .a. for removal
4734 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4735           dotest_fail conflicts2-142b4 "${testcvs} -q update" \
4736 "${PROG} [a-z]*: conflict: removed a was modified by second party
4737 C a"
4738           # Resolve the conflict by deciding not to remove the file
4739           # after all.
4740           dotest conflicts2-142b5 "${testcvs} add a" "U a
4741 ${PROG} [a-z]*: a, version 1\.1, resurrected"
4742           dotest conflicts2-142b6 "${testcvs} -q update" ''
4743           cd ../..
4744
4745           # Now test that if one person removes a file and
4746           # commits it, and a second person removes it, is it
4747           # not a conflict.
4748           cd 1/first-dir
4749           rm abc
4750           dotest conflicts2-142c0 "${testcvs} rm abc" \
4751 "${PROG} [a-z]*: scheduling .abc. for removal
4752 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4753           dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
4754 "Removing abc;
4755 ${TESTDIR}/cvsroot/first-dir/abc,v  <--  abc
4756 new revision: delete; previous revision: 1\.1
4757 done"
4758           cd ../../2/first-dir
4759           rm abc
4760           dotest conflicts2-142c2 "${testcvs} rm abc" \
4761 "${PROG} [a-z]*: scheduling .abc. for removal
4762 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4763           dotest conflicts2-142c3 "${testcvs} update" \
4764 "${PROG} [a-z]*: Updating \."
4765           cd ../..
4766
4767           # conflicts2-142d*: test that if one party adds a file, and another
4768           # party has a file of the same name, cvs notices
4769           cd 1/first-dir
4770           touch aa.c
4771           echo 'contents unchanged' >same.c
4772           dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
4773 "${PROG} [a-z]*: scheduling file .aa\.c. for addition
4774 ${PROG} [a-z]*: scheduling file .same\.c. for addition
4775 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
4776           dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
4777 "RCS file: ${TESTDIR}/cvsroot/first-dir/aa\.c,v
4778 done
4779 Checking in aa\.c;
4780 ${TESTDIR}/cvsroot/first-dir/aa\.c,v  <--  aa\.c
4781 initial revision: 1\.1
4782 done
4783 RCS file: ${TESTDIR}/cvsroot/first-dir/same\.c,v
4784 done
4785 Checking in same\.c;
4786 ${TESTDIR}/cvsroot/first-dir/same\.c,v  <--  same\.c
4787 initial revision: 1\.1
4788 done"
4789           cd ../../2/first-dir
4790           echo "don't you dare obliterate this text" >aa.c
4791           echo 'contents unchanged' >same.c
4792           # Note the discrepancy between local and remote in the handling
4793           # of same.c.  I kind
4794           # of suspect that the local CVS behavior is the more useful one
4795           # although I do sort of wonder whether we should make people run
4796           # cvs add just to get them in that habit (also, trying to implement
4797           # the local CVS behavior for remote without the cvs add seems 
4798           # pretty difficult).
4799           if test "$remote" = yes; then
4800             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
4801 "${QUESTION} aa\.c
4802 ${QUESTION} same\.c
4803 ${PROG} update: move away \./aa\.c; it is in the way
4804 C aa\.c
4805 ${PROG} update: move away \./same\.c; it is in the way
4806 C same\.c"
4807           else
4808             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
4809 "${PROG} [a-z]*: move away aa\.c; it is in the way
4810 C aa\.c
4811 U same\.c"
4812           fi
4813           dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
4814 "${PROG} [a-z]*: move away aa\.c; it is in the way
4815 ===================================================================
4816 File: aa\.c                     Status: Unresolved Conflict
4817
4818    Working revision:    No entry for aa\.c
4819    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/aa\.c,v"
4820
4821           # Could also be testing the case in which the cvs add happened
4822           # before the commit by the other user.
4823           # This message seems somewhat bogus.  I mean, parallel development
4824           # means that we get to work in parallel if we choose, right?  And
4825           # then at commit time it would be a conflict.
4826           dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
4827 "${PROG} [a-z]*: aa.c added independently by second party"
4828
4829           # The user might want to see just what the conflict is.
4830           # Don't bother, diff seems to kind of lose its mind, with or
4831           # without -N.  This is a CVS bug(s).
4832           #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
4833
4834           # Now: "how can the user resolve this conflict", I hear you cry.
4835           # Well, one way is to forget about the file in the working
4836           # directory.
4837           # Since it didn't let us do the add in conflicts2-142d4, there
4838           # is no need to run cvs rm here.
4839           #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
4840           dotest conflicts2-142d6 "rm aa.c" ''
4841           dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
4842           dotest conflicts2-142d8 "cat aa.c" ''
4843
4844           # The other way is to use the version from the working directory
4845           # instead of the version from the repository.  Unfortunately,
4846           # there doesn't seem to be any particularly clear way to do
4847           # this (?).
4848
4849           cd ../..
4850
4851           rm -r 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
4852           ;;
4853
4854         conflicts3)
4855           # More tests of conflicts and/or multiple working directories
4856           # in general.
4857
4858           mkdir 1; cd 1
4859           dotest conflicts3-1 "${testcvs} -q co -l ." ''
4860           mkdir first-dir
4861           dotest conflicts3-2 "${testcvs} add first-dir" \
4862 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
4863           cd ..
4864           mkdir 2; cd 2
4865           dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
4866           cd ../1/first-dir
4867           touch file1 file2
4868           dotest conflicts3-4 "${testcvs} add file1 file2" \
4869 "${PROG} [a-z]*: scheduling file .file1. for addition
4870 ${PROG} [a-z]*: scheduling file .file2. for addition
4871 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
4872           dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
4873 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
4874 done
4875 Checking in file1;
4876 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4877 initial revision: 1\.1
4878 done
4879 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
4880 done
4881 Checking in file2;
4882 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
4883 initial revision: 1\.1
4884 done"
4885           cd ../../2/first-dir
4886           # Check that -n doesn't make CVS lose its mind as it creates
4887           # (or rather, doesn't) a new file.
4888           dotest conflicts3-6 "${testcvs} -nq update" \
4889 "U file1
4890 U file2"
4891           dotest_fail conflicts3-7 "test -f file1" ''
4892           dotest conflicts3-8 "${testcvs} -q update" \
4893 "U file1
4894 U file2"
4895           dotest conflicts3-9 "test -f file2" ''
4896
4897           # OK, now remove two files at once
4898           dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
4899 "${PROG} [a-z]*: scheduling .file1. for removal
4900 ${PROG} [a-z]*: scheduling .file2. for removal
4901 ${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
4902           dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
4903 "Removing file1;
4904 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
4905 new revision: delete; previous revision: 1\.1
4906 done
4907 Removing file2;
4908 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
4909 new revision: delete; previous revision: 1\.1
4910 done"
4911           cd ../../1/first-dir
4912           dotest conflicts3-12 "${testcvs} -n -q update" \
4913 "${PROG} [a-z]*: warning: file1 is not (any longer) pertinent
4914 ${PROG} [a-z]*: warning: file2 is not (any longer) pertinent"
4915           dotest conflicts3-13 "${testcvs} -q update" \
4916 "${PROG} [a-z]*: warning: file1 is not (any longer) pertinent
4917 ${PROG} [a-z]*: warning: file2 is not (any longer) pertinent"
4918
4919           # OK, now add a directory to both working directories
4920           # and see that CVS doesn't lose its mind.
4921           mkdir sdir
4922           dotest conficts3-14 "${testcvs} add sdir" \
4923 "Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
4924           cd ../../2/first-dir
4925
4926           # Create a CVS directory without the proper administrative
4927           # files in it.  This can happen for example if you hit ^C
4928           # in the middle of a checkout.
4929           mkdir sdir
4930           mkdir sdir/CVS
4931           # OK, in the local case CVS sees that the directory exists
4932           # in the repository and recurses into it.  In the remote case
4933           # CVS can't see the repository and has no way of knowing
4934           # that sdir is even a directory (stat'ing everything would be
4935           # too slow).  The remote behavior makes more sense to me (but
4936           # would this affect other cases?).
4937           if test "$remote" = yes; then
4938             dotest conflicts3-15 "${testcvs} -q update" \
4939 "${QUESTION} sdir"
4940           else
4941             dotest conflicts3-15 "${testcvs} -q update" \
4942 "${QUESTION} sdir
4943 ${PROG} [a-z]*: ignoring sdir (CVS/Repository missing)"
4944             touch sdir/CVS/Repository
4945             dotest conflicts3-16 "${testcvs} -q update" \
4946 "${QUESTION} sdir
4947 ${PROG} [a-z]*: ignoring sdir (CVS/Entries missing)"
4948           fi
4949           rm -r sdir
4950
4951           # OK, now the same thing, but the directory doesn't exist
4952           # in the repository.
4953           mkdir newdir
4954           mkdir newdir/CVS
4955           dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
4956           echo "D/newdir////" >> CVS/Entries
4957           dotest conflicts3-18 "${testcvs} -q update" \
4958 "${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
4959           touch newdir/CVS/Repository
4960           dotest conflicts3-19 "${testcvs} -q update" \
4961 "${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
4962           rm -r newdir
4963
4964           cd ../..
4965
4966           rm -r 1 2
4967           rm -rf ${CVSROOT_DIRNAME}/first-dir
4968           ;;
4969
4970         modules)
4971           # Tests of various ways to define and use modules.
4972
4973           ############################################################
4974           # These tests are to make sure that administrative files get
4975           # rebuilt, regardless of how and where files are checked
4976           # out.
4977           ############################################################
4978           # Check out the whole repository
4979           mkdir 1; cd 1
4980           dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
4981 U CVSROOT/commitinfo
4982 U CVSROOT/config
4983 U CVSROOT/cvswrappers
4984 U CVSROOT/editinfo
4985 U CVSROOT/loginfo
4986 U CVSROOT/modules
4987 U CVSROOT/notify
4988 U CVSROOT/rcsinfo
4989 U CVSROOT/taginfo
4990 U CVSROOT/verifymsg'
4991           echo "# made a change" >>CVSROOT/modules
4992           dotest modules-1d "${testcvs} -q ci -m add-modules" \
4993 "Checking in CVSROOT/modules;
4994 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
4995 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
4996 done
4997 ${PROG} [a-z]*: Rebuilding administrative file database"
4998           cd ..
4999           rm -rf 1
5000
5001           ############################################################
5002           # Check out CVSROOT
5003           mkdir 1; cd 1
5004           dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
5005 U CVSROOT/commitinfo
5006 U CVSROOT/config
5007 U CVSROOT/cvswrappers
5008 U CVSROOT/editinfo
5009 U CVSROOT/loginfo
5010 U CVSROOT/modules
5011 U CVSROOT/notify
5012 U CVSROOT/rcsinfo
5013 U CVSROOT/taginfo
5014 U CVSROOT/verifymsg'
5015           echo "# made a change" >>CVSROOT/modules
5016           dotest modules-2d "${testcvs} -q ci -m add-modules" \
5017 "Checking in CVSROOT/modules;
5018 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
5019 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
5020 done
5021 ${PROG} [a-z]*: Rebuilding administrative file database"
5022           cd ..
5023           rm -rf 1
5024
5025           ############################################################
5026           # Check out CVSROOT in some other directory
5027           mkdir ${CVSROOT_DIRNAME}/somedir
5028           mkdir 1; cd 1
5029           dotest modules-3 "${testcvs} -q co somedir" ''
5030           cd somedir
5031           dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
5032 U CVSROOT/commitinfo
5033 U CVSROOT/config
5034 U CVSROOT/cvswrappers
5035 U CVSROOT/editinfo
5036 U CVSROOT/loginfo
5037 U CVSROOT/modules
5038 U CVSROOT/notify
5039 U CVSROOT/rcsinfo
5040 U CVSROOT/taginfo
5041 U CVSROOT/verifymsg'
5042           echo "# made a change" >>CVSROOT/modules
5043           dotest modules-3g "${testcvs} -q ci -m add-modules" \
5044 "Checking in CVSROOT/modules;
5045 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
5046 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
5047 done
5048 ${PROG} [a-z]*: Rebuilding administrative file database"
5049           cd ../..
5050           rm -rf 1
5051           rm -rf ${CVSROOT_DIRNAME}/somedir
5052           ############################################################
5053           # end rebuild tests
5054           ############################################################
5055
5056
5057           mkdir ${CVSROOT_DIRNAME}/first-dir
5058
5059           mkdir 1
5060           cd 1
5061
5062           if ${testcvs} -q co first-dir; then
5063               pass 143
5064           else
5065               fail 143
5066           fi
5067
5068           cd first-dir
5069           mkdir subdir
5070           ${testcvs} add subdir >>${LOGFILE}
5071           cd subdir
5072
5073           mkdir ssdir
5074           ${testcvs} add ssdir >>${LOGFILE}
5075
5076           touch a b
5077
5078           if ${testcvs} add a b 2>>${LOGFILE} ; then
5079               pass 144
5080           else
5081               fail 144
5082           fi
5083
5084           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
5085               pass 145
5086           else
5087               fail 145
5088           fi
5089
5090           cd ..
5091           if ${testcvs} -q co CVSROOT >>${LOGFILE}; then
5092               pass 146
5093           else
5094               fail 146
5095           fi
5096
5097           # Here we test that CVS can deal with CVSROOT (whose repository
5098           # is at top level) in the same directory as subdir (whose repository
5099           # is a subdirectory of first-dir).  TODO: Might want to check that
5100           # files can actually get updated in this state.
5101           if ${testcvs} -q update; then
5102               pass 147
5103           else
5104               fail 147
5105           fi
5106
5107           echo realmodule first-dir/subdir a >CVSROOT/modules
5108           echo dirmodule first-dir/subdir >>CVSROOT/modules
5109           echo namedmodule -d nameddir first-dir/subdir >>CVSROOT/modules
5110           echo aliasmodule -a first-dir/subdir/a >>CVSROOT/modules
5111           echo aliasnested -a first-dir/subdir/ssdir >>CVSROOT/modules
5112           echo topfiles -a first-dir/file1 first-dir/file2 >>CVSROOT/modules
5113           echo world -a . >>CVSROOT/modules
5114           echo statusmod -s Mungeable >>CVSROOT/modules
5115
5116           # Options must come before arguments.  It is possible this should
5117           # be relaxed at some point (though the result would be bizarre for
5118           # -a); for now test the current behavior.
5119           echo bogusalias first-dir/subdir/a -a >>CVSROOT/modules
5120           if ${testcvs} ci -m 'add modules' CVSROOT/modules \
5121               >>${LOGFILE} 2>&1; then
5122               pass 148
5123           else
5124               fail 148
5125           fi
5126           cd ..
5127           # The "statusmod" module contains an error; trying to use it
5128           # will produce "modules file missing directory" I think.
5129           # However, that shouldn't affect the ability of "cvs co -c" or
5130           # "cvs co -s" to do something reasonable with it.
5131           dotest 148a0 "${testcvs} co -c" 'aliasmodule  -a first-dir/subdir/a
5132 aliasnested  -a first-dir/subdir/ssdir
5133 bogusalias   first-dir/subdir/a -a
5134 dirmodule    first-dir/subdir
5135 namedmodule  -d nameddir first-dir/subdir
5136 realmodule   first-dir/subdir a
5137 statusmod    -s Mungeable
5138 topfiles     -a first-dir/file1 first-dir/file2
5139 world        -a \.'
5140           # There is code in modules.c:save_d which explicitly skips
5141           # modules defined with -a, which is why aliasmodule is not
5142           # listed.
5143           dotest 148a1 "${testcvs} co -s" \
5144 'statusmod    Mungeable  
5145 bogusalias   NONE        first-dir/subdir/a -a
5146 dirmodule    NONE        first-dir/subdir
5147 namedmodule  NONE        first-dir/subdir
5148 realmodule   NONE        first-dir/subdir a'
5149
5150           # Test that real modules check out to realmodule/a, not subdir/a.
5151           if ${testcvs} co realmodule >>${LOGFILE}; then
5152               pass 149a1
5153           else
5154               fail 149a1
5155           fi
5156           if test -d realmodule && test -f realmodule/a; then
5157               pass 149a2
5158           else
5159               fail 149a2
5160           fi
5161           if test -f realmodule/b; then
5162               fail 149a3
5163           else
5164               pass 149a3
5165           fi
5166           if ${testcvs} -q co realmodule; then
5167               pass 149a4
5168           else
5169               fail 149a4
5170           fi
5171           if echo "yes" | ${testcvs} release -d realmodule >>${LOGFILE} ; then
5172               pass 149a5
5173           else
5174               fail 149a5
5175           fi
5176
5177           dotest_fail 149b1 "${testcvs} co realmodule/a" \
5178 "${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
5179 "${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory
5180 '"${PROG}"' \[[a-z]* aborted\]: cannot expand modules'
5181
5182           # Now test the ability to check out a single file from a directory
5183           if ${testcvs} co dirmodule/a >>${LOGFILE}; then
5184               pass 150c
5185           else
5186               fail 150c
5187           fi
5188           if test -d dirmodule && test -f dirmodule/a; then
5189               pass 150d
5190           else
5191               fail 150d
5192           fi
5193           if test -f dirmodule/b; then
5194               fail 150e
5195           else
5196               pass 150e
5197           fi
5198           if echo "yes" | ${testcvs} release -d dirmodule >>${LOGFILE} ; then
5199               pass 150f
5200           else
5201               fail 150f
5202           fi
5203           # Now test the ability to correctly reject a non-existent filename.
5204           # For maximum studliness we would check that an error message is
5205           # being output.
5206           if ${testcvs} co dirmodule/nonexist >>${LOGFILE} 2>&1; then
5207             # We accept a zero exit status because it is what CVS does
5208             # (Dec 95).  Probably the exit status should be nonzero,
5209             # however.
5210               pass 150g1
5211           else
5212               pass 150g1
5213           fi
5214           # We tolerate the creation of the dirmodule directory, since that
5215           # is what CVS does, not because we view that as preferable to not
5216           # creating it.
5217           if test -f dirmodule/a || test -f dirmodule/b; then
5218               fail 150g2
5219           else
5220               pass 150g2
5221           fi
5222           rm -r dirmodule
5223
5224           # Now test that a module using -d checks out to the specified
5225           # directory.
5226           dotest 150h1 "${testcvs} -q co namedmodule" 'U nameddir/a
5227 U nameddir/b'
5228           if test -f nameddir/a && test -f nameddir/b; then
5229             pass 150h2
5230           else
5231             fail 150h2
5232           fi
5233           echo add line >>nameddir/a
5234           dotest 150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
5235           rm nameddir/a
5236           dotest 150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
5237           if echo "yes" | ${testcvs} release -d nameddir >>${LOGFILE} ; then
5238             pass 150h99
5239           else
5240             fail 150h99
5241           fi
5242
5243           # Now test that alias modules check out to subdir/a, not
5244           # aliasmodule/a.
5245           if ${testcvs} co aliasmodule >>${LOGFILE}; then
5246               pass 151
5247           else
5248               fail 151
5249           fi
5250           if test -d aliasmodule; then
5251               fail 152
5252           else
5253               pass 152
5254           fi
5255           echo abc >>first-dir/subdir/a
5256           if (${testcvs} -q co aliasmodule | tee test153.tmp) \
5257               >>${LOGFILE}; then
5258               pass 153
5259           else
5260               fail 153
5261           fi
5262           echo 'M first-dir/subdir/a' >ans153.tmp
5263           if cmp test153.tmp ans153.tmp; then
5264               pass 154
5265           else
5266               fail 154
5267           fi
5268
5269           cd ..
5270           rm -r 1
5271
5272           mkdir 2
5273           cd 2
5274           dotest modules-155a0 "${testcvs} co aliasnested" \
5275 "${PROG} [a-z]*: Updating first-dir/subdir/ssdir"
5276           dotest modules-155a1 "test -d first-dir" ''
5277           dotest modules-155a2 "test -d first-dir/subdir" ''
5278           dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
5279           # Test that nothing extraneous got created.
5280           dotest modules-155a4 "ls" "first-dir" \
5281 "CVS
5282 first-dir"
5283           cd ..
5284           rm -r 2
5285
5286           # Test checking out everything.
5287           mkdir 1
5288           cd 1
5289           dotest modules-155b "${testcvs} -q co world" \
5290 "U CVSROOT/${DOTSTAR}
5291 U first-dir/subdir/a
5292 U first-dir/subdir/b"
5293           cd ..
5294           rm -r 1
5295
5296           # Test checking out a module which lists at least two
5297           # specific files twice.  At one time, this failed over
5298           # remote CVS.
5299           mkdir 1
5300           cd 1
5301           dotest modules-155c1 "${testcvs} -q co first-dir" \
5302 "U first-dir/subdir/a
5303 U first-dir/subdir/b"
5304
5305           cd first-dir
5306           echo 'first revision' > file1
5307           echo 'first revision' > file2
5308           dotest modules-155c2 "${testcvs} add file1 file2" \
5309 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
5310 '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
5311 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
5312           dotest modules-155c3 "${testcvs} -q ci -m add-it" \
5313 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
5314 done
5315 Checking in file1;
5316 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
5317 initial revision: 1\.1
5318 done
5319 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
5320 done
5321 Checking in file2;
5322 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
5323 initial revision: 1\.1
5324 done"
5325
5326           cd ..
5327           rm -r first-dir
5328           dotest modules-155c4 "${testcvs} -q co topfiles" \
5329 "U first-dir/file1
5330 U first-dir/file2"
5331           dotest modules-155c5 "${testcvs} -q co topfiles" ""
5332
5333           # Make sure the right thing happens if we remove a file.
5334           cd first-dir
5335           dotest modules-155c6 "${testcvs} -q rm -f file1" \
5336 "${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
5337           dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
5338 "Removing file1;
5339 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
5340 new revision: delete; previous revision: 1\.1
5341 done"
5342           cd ..
5343           rm -r first-dir
5344           dotest modules-155c8 "${testcvs} -q co topfiles" \
5345 "${PROG} [a-z]*: warning: first-dir/file1 is not (any longer) pertinent
5346 U first-dir/file2"
5347
5348           cd ..
5349           rm -r 1
5350
5351           rm -rf ${CVSROOT_DIRNAME}/first-dir
5352           ;;
5353
5354         modules2)
5355           # More tests of modules, in particular the & feature.
5356           mkdir 1; cd 1
5357           dotest modules2-setup-1 "${testcvs} -q co -l ." ''
5358           mkdir first-dir second-dir third-dir
5359           dotest modules2-setup-2 \
5360 "${testcvs} add first-dir second-dir third-dir" \
5361 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository
5362 Directory ${TESTDIR}/cvsroot/second-dir added to the repository
5363 Directory ${TESTDIR}/cvsroot/third-dir added to the repository"
5364           cd third-dir
5365           touch file3
5366           dotest modules2-setup-3 "${testcvs} add file3" \
5367 "${PROG} [a-z]*: scheduling file .file3. for addition
5368 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5369           dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
5370 "RCS file: ${TESTDIR}/cvsroot/third-dir/file3,v
5371 done
5372 Checking in file3;
5373 ${TESTDIR}/cvsroot/third-dir/file3,v  <--  file3
5374 initial revision: 1\.1
5375 done"
5376           cd ../..
5377           rm -r 1
5378
5379           mkdir 1
5380           cd 1
5381
5382           dotest modules2-1 "${testcvs} -q co CVSROOT/modules" \
5383 'U CVSROOT/modules'
5384           cd CVSROOT
5385           echo 'ampermodule &first-dir &second-dir' > modules
5386           echo 'combmodule third-dir file3 &first-dir' >> modules
5387           # Depending on whether the user also ran the modules test
5388           # we will be checking in revision 1.2 or 1.3.
5389           dotest modules2-2 "${testcvs} -q ci -m add-modules" \
5390 "Checking in modules;
5391 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
5392 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
5393 done
5394 ${PROG} [a-z]*: Rebuilding administrative file database"
5395
5396           cd ..
5397
5398           dotest modules2-3 "${testcvs} -q co ampermodule" ''
5399           dotest modules2-4 "test -d ampermodule/first-dir" ''
5400           dotest modules2-5 "test -d ampermodule/second-dir" ''
5401
5402           # Test ability of cvs release to handle multiple arguments
5403           cd ampermodule
5404           if ${testcvs} release -d first-dir second-dir <<EOF >>${LOGFILE}
5405 yes
5406 yes
5407 EOF
5408           then
5409             pass modules2-6
5410           else
5411             fail modules2-6
5412           fi
5413           dotest_fail modules2-7 "test -d first-dir" ''
5414           dotest_fail modules2-8 "test -d second-dir" ''
5415
5416           cd ..
5417
5418           # Now we create another directory named first-dir and make
5419           # sure that CVS doesn't get them mixed up.
5420           mkdir first-dir
5421           # Note that this message should say "Updating ampermodule/first-dir"
5422           # I suspect.  This is a long-standing behavior/bug....
5423           dotest modules2-9 "${testcvs} co ampermodule" \
5424 "${PROG} [a-z]*: Updating first-dir
5425 ${PROG} [a-z]*: Updating second-dir"
5426           touch ampermodule/first-dir/amper1
5427           dotest modules2-10 "${testcvs} add ampermodule/first-dir/amper1" \
5428 "${PROG} [a-z]*: scheduling file .ampermodule/first-dir/amper1. for addition
5429 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5430
5431           # As with the "Updating xxx" message, the "U first-dir/amper1"
5432           # message (instead of "U ampermodule/first-dir/amper1") is
5433           # rather fishy.
5434           dotest modules2-12 "${testcvs} co ampermodule" \
5435 "${PROG} [a-z]*: Updating first-dir
5436 A first-dir/amper1
5437 ${PROG} [a-z]*: Updating second-dir"
5438
5439           if test "$remote" = no; then
5440             dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
5441 "RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v
5442 done
5443 Checking in ampermodule/first-dir/amper1;
5444 ${TESTDIR}/cvsroot/first-dir/amper1,v  <--  amper1
5445 initial revision: 1\.1
5446 done"
5447           else
5448             # Trying this as above led to a "protocol error" message.
5449             # Work around this bug.
5450             cd ampermodule
5451             dotest modules2-13 "${testcvs} -q ci -m add-it" \
5452 "RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v
5453 done
5454 Checking in first-dir/amper1;
5455 ${TESTDIR}/cvsroot/first-dir/amper1,v  <--  amper1
5456 initial revision: 1\.1
5457 done"
5458             cd ..
5459           fi
5460
5461           # Now test the "combmodule" module (combining regular modules
5462           # and ampersand modules in the same module definition).
5463           cd ..
5464           rm -r 1
5465           mkdir 1; cd 1
5466           dotest modules2-14 "${testcvs} co combmodule" \
5467 "U combmodule/file3
5468 ${PROG} [a-z]*: Updating first-dir
5469 U first-dir/amper1"
5470           dotest modules2-15 "test -f combmodule/file3" ""
5471           dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
5472           cd combmodule
5473           rm -r first-dir
5474           # Might be possible to have a more graceful error message,
5475           # but at least for now there is no way to tell CVS that
5476           # some files/subdirectories come from one repository directory,
5477           # and others from another.
5478           if test "$remote" = no; then
5479             dotest_fail modules2-17 "${testcvs} update -d" \
5480 "${PROG} [a-z]*: Updating \.
5481 ${PROG} [a-z]*: Updating first-dir
5482 ${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/third-dir/first-dir: No such file or directory"
5483             # Clean up the droppings left by the previous command.
5484             # This should definitely not be necessary (I think).
5485             rm -r first-dir
5486           else
5487             # This seems like a pretty sensible behavior to me, in the
5488             # sense that first-dir doesn't "really" exist within
5489             # third-dir, so CVS just acts as if there is nothing there
5490             # to do.
5491             dotest modules2-17 "${testcvs} update -d" \
5492 "${PROG} server: Updating \."
5493           fi
5494
5495           cd ..
5496           dotest modules2-18 "${testcvs} -q co combmodule" \
5497 "U first-dir/amper1"
5498           dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
5499           cd ..
5500           rm -r 1
5501
5502           # Test that CVS gives an error if one combines -a with
5503           # other options.
5504           # Probably would be better to break this out into a separate
5505           # test.  Although it is short, it shares no files/state with
5506           # the rest of the modules2 tests.
5507           mkdir 1; cd 1
5508           dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
5509 'U CVSROOT/modules'
5510           cd CVSROOT
5511           echo 'aliasopt -a -d onedir first-dir' >modules
5512           dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
5513 "Checking in modules;
5514 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
5515 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
5516 done
5517 ${PROG} [a-z]*: Rebuilding administrative file database"
5518           cd ..
5519           dotest_fail modules2-a1 "${testcvs} -q co aliasopt" \
5520 "${PROG} [a-z]*: -a cannot be specified in the modules file along with other options" \
5521 "${PROG} [a-z]*: -a cannot be specified in the modules file along with other options
5522 ${PROG} \[[a-z]* aborted\]: cannot expand modules"
5523
5524           # Clean up.
5525           rm -r CVSROOT
5526           cd ..
5527           rm -r 1
5528           rm -rf ${CVSROOT_DIRNAME}/first-dir
5529           rm -rf ${CVSROOT_DIRNAME}/second-dir
5530           rm -rf ${CVSROOT_DIRNAME}/third-dir
5531           ;;
5532
5533         modules3)
5534           # More tests of modules, in particular what happens if several
5535           # modules point to the same file.
5536
5537           # First just set up a directory first-dir and a file file1 in it.
5538           mkdir 1; cd 1
5539
5540           dotest modules3-0 "${testcvs} -q co -l ." ''
5541           mkdir first-dir
5542           dotest modules3-1 "${testcvs} add first-dir" \
5543 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
5544
5545           cd first-dir
5546           echo file1 >file1
5547           dotest modules3-2 "${testcvs} add file1" \
5548 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
5549 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
5550           dotest modules3-3 "${testcvs} -q ci -m add-it" \
5551 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
5552 done
5553 Checking in file1;
5554 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
5555 initial revision: 1\.1
5556 done"
5557           cd ..
5558
5559           dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
5560 "U CVSROOT${DOTSTAR}"
5561           cd CVSROOT
5562           cat >modules <<EOF
5563 mod1 -a first-dir/file1
5564 bigmod -a mod1 first-dir/file1
5565 namednest -d src/sub/dir first-dir
5566 nestdeeper -d src/sub1/sub2/sub3/dir first-dir
5567 nestshallow -d src/dir second-dir/suba/subb
5568 path/in/modules &mod1
5569 another/path/test -d another/path/test first-dir
5570 EOF
5571           dotest modules3-5 "${testcvs} -q ci -m add-modules" \
5572 "Checking in modules;
5573 ${TESTDIR}/cvsroot/CVSROOT/modules,v  <--  modules
5574 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
5575 done
5576 ${PROG} [a-z]*: Rebuilding administrative file database"
5577           cd ..
5578
5579           dotest modules3-6 "${testcvs} -q co bigmod" ''
5580           rm -r first-dir
5581           dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
5582           cd ..
5583           rm -r 1
5584
5585           mkdir 1; cd 1
5586           mkdir suba
5587           mkdir suba/subb
5588           # This fails to work remote (it doesn't notice the directories,
5589           # I suppose because they contain no files).  Bummer, especially
5590           # considering this is a documented technique and everything.
5591           dotest modules3-7a \
5592 "${testcvs} import -m add-dirs second-dir tag1 tag2" \
5593 "${PROG} [a-z]*: Importing ${TESTDIR}/cvsroot/second-dir/suba
5594 ${PROG} [a-z]*: Importing ${TESTDIR}/cvsroot/second-dir/suba/subb
5595
5596 No conflicts created by this import" "
5597 No conflicts created by this import"
5598           cd ..; rm -r 1
5599           mkdir 1; cd 1
5600           dotest modules3-7b "${testcvs} co second-dir" \
5601 "${PROG} [a-z]*: Updating second-dir
5602 ${PROG} [a-z]*: Updating second-dir/suba
5603 ${PROG} [a-z]*: Updating second-dir/suba/subb" \
5604 "${PROG} server: Updating second-dir"
5605
5606           if test "x$remote" = xyes; then
5607             cd second-dir
5608             mkdir suba
5609             dotest modules3-7-workaround1 "${testcvs} add suba" \
5610 "Directory ${TESTDIR}/cvsroot/second-dir/suba added to the repository"
5611             cd suba
5612             mkdir subb
5613             dotest modules3-7-workaround2 "${testcvs} add subb" \
5614 "Directory ${TESTDIR}/cvsroot/second-dir/suba/subb added to the repository"
5615             cd ../..
5616           fi
5617
5618           cd second-dir/suba/subb
5619           touch fileb
5620           dotest modules3-7c "${testcvs} add fileb" \
5621 "${PROG} [a-z]*: scheduling file .fileb. for addition
5622 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5623           dotest modules3-7d "${testcvs} -q ci -m add-it" \
5624 "RCS file: ${TESTDIR}/cvsroot/second-dir/suba/subb/fileb,v
5625 done
5626 Checking in fileb;
5627 ${TESTDIR}/cvsroot/second-dir/suba/subb/fileb,v  <--  fileb
5628 initial revision: 1\.1
5629 done"
5630           cd ../../..
5631           cd ..; rm -r 1
5632
5633           mkdir 1
5634           cd 1
5635           dotest modules3-8 "${testcvs} -q co namednest" \
5636 'U src/sub/dir/file1'
5637           dotest modules3-9 "test -f src/sub/dir/file1" ''
5638           cd ..
5639           rm -r 1
5640
5641           # Try the same thing, but with the directories nested even
5642           # deeper (deeply enough so they are nested more deeply than
5643           # the number of directories from / to ${TESTDIR}).
5644           mkdir 1
5645           cd 1
5646           dotest modules3-10 "${testcvs} -q co nestdeeper" \
5647 'U src/sub1/sub2/sub3/dir/file1'
5648           dotest modules3-11 "test -f src/sub1/sub2/sub3/dir/file1" ''
5649
5650           # While we are doing things like twisted uses of '/' (e.g.
5651           # modules3-12), try this one.
5652           if test "x$remote" = xyes; then
5653             dotest_fail modules3-11b \
5654 "${testcvs} -q update ${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1" \
5655 "${PROG} .server aborted.: absolute pathname .${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1. illegal for server"
5656           fi # end of remote-only tests
5657
5658           cd ..
5659           rm -r 1
5660
5661           # This one is almost too twisted for words.  The pathname output
5662           # in the message from "co" doesn't include the "path/in/modules",
5663           # but those directories do get created (with no CVSADM except
5664           # in "modules" which has a CVSNULLREPOS).
5665           # I'm not sure anyone is relying on this nonsense or whether we
5666           # need to keep doing it, but it is what CVS currently does...
5667           # Skip it for remote; the remote code has the good sense to
5668           # not deal with it (on the minus side it gives
5669           # "internal error: repository string too short." (CVS 1.9) or
5670           # "warning: server is not creating directories one at a time" (now)
5671           # instead of a real error).
5672           # I'm tempted to just make it a fatal error to have '/' in a
5673           # module name.  But see comments at modules3-16.
5674           if test "x$remote" = xno; then
5675           mkdir 1; cd 1
5676           dotest modules3-12 "${testcvs} -q co path/in/modules" \
5677 "U first-dir/file1"
5678           dotest modules3-13 "test -f path/in/modules/first-dir/file1" ''
5679           cd ..; rm -r 1
5680
5681           # Now here is where it gets seriously bogus.
5682           mkdir 1; cd 1
5683           dotest modules3-14 \
5684 "${testcvs} -q rtag tag1 path/in/modules" ''
5685           # CVS creates this even though rtag should *never* affect
5686           # the directory current when it is called!
5687           dotest modules3-15 "test -d path/in/modules" ''
5688           # Just for trivia's sake, rdiff is not similarly vulnerable
5689           # because it passes 0 for run_module_prog to do_module.
5690           cd ..; rm -r 1
5691           fi # end of tests skipped for remote
5692
5693           # Some people seem to want this to work.  I still suspect there
5694           # are dark corners in slashes in module names.  This probably wants
5695           # more thought before we start hacking on CVS (one way or the other)
5696           # or documenting this.
5697           mkdir 2; cd 2
5698           dotest modules3-16 "${testcvs} -q co another/path/test" \
5699 "U another/path/test/file1"
5700           dotest modules3-17 "cat another/path/test/file1" 'file1'
5701           cd ..; rm -r 2
5702
5703           rm -rf ${CVSROOT_DIRNAME}/first-dir
5704           rm -rf ${CVSROOT_DIRNAME}/second-dir
5705           ;;
5706
5707         mflag)
5708           for message in '' ' ' '       
5709            ' '                  test' ; do
5710             # Set up
5711             mkdir a-dir; cd a-dir
5712             # Test handling of -m during import
5713             echo testa >>test
5714             if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
5715                 pass 156
5716             else
5717                 fail 156
5718             fi
5719             # Must import twice since the first time uses inline code that
5720             # avoids RCS call.
5721             echo testb >>test
5722             if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
5723                 pass 157
5724             else
5725                 fail 157
5726             fi
5727             # Test handling of -m during ci
5728             cd ..; rm -r a-dir
5729             if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
5730                 pass 158
5731             else
5732                 fail 158
5733             fi
5734             cd a-dir
5735             echo testc >>test
5736             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
5737                 pass 159
5738             else
5739                 fail 159
5740             fi
5741             # Test handling of -m during rm/ci
5742             rm test;
5743             if ${testcvs} rm test >>${LOGFILE} 2>&1; then
5744                 pass 160
5745             else
5746                 fail 160
5747             fi
5748             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
5749                 pass 161
5750             else
5751                 fail 161
5752             fi
5753             # Clean up
5754             cd ..
5755             rm -r a-dir
5756             rm -rf ${CVSROOT_DIRNAME}/a-dir
5757           done
5758           ;;
5759
5760         editor)
5761           # More tests of log messages, in this case the ability to
5762           # run an external editor.
5763           # TODO:
5764           #   * also test $EDITOR, $CVSEDITOR, &c.
5765           #   * test what happens if up-to-date check fails.
5766
5767           # Our "editor" puts "x" at the start of each line, so we
5768           # can see the "CVS:" lines.
5769           cat >${TESTDIR}/editme <<EOF
5770 #!${TESTSHELL}
5771 sleep 1
5772 sed <\$1 -e 's/^/x&/g' >${TESTDIR}/edit.new
5773 mv ${TESTDIR}/edit.new \$1
5774 exit 0
5775 EOF
5776           chmod +x ${TESTDIR}/editme
5777
5778           mkdir 1; cd 1
5779           dotest editor-1 "${testcvs} -q co -l ." ''
5780           mkdir first-dir
5781           dotest editor-2 "${testcvs} add first-dir" \
5782 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
5783           cd first-dir
5784           touch file1 file2
5785           dotest editor-3 "${testcvs} add file1 file2" \
5786 "${PROG} [a-z]*: scheduling file .file1. for addition
5787 ${PROG} [a-z]*: scheduling file .file2. for addition
5788 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
5789           dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
5790 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
5791 done
5792 Checking in file1;
5793 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
5794 initial revision: 1\.1
5795 done
5796 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
5797 done
5798 Checking in file2;
5799 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
5800 initial revision: 1\.1
5801 done"
5802           dotest editor-5 "${testcvs} -q tag -b br" "T file1
5803 T file2"
5804           dotest editor-6 "${testcvs} -q update -r br" ''
5805           echo modify >>file1
5806           dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
5807 "Checking in file1;
5808 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
5809 new revision: 1\.1\.2\.1; previous revision: 1\.1
5810 done"
5811           # OK, now we want to make sure "ci -r" puts in the branch
5812           # where appropriate.  Note that we can check in on the branch
5813           # without being on the branch, because there is not a revision
5814           # already on the branch.  If there were a revision on the branch,
5815           # CVS would correctly give an up-to-date check failed.
5816           dotest editor-8 "${testcvs} -q update -A" "U file1"
5817           echo add a line >>file2
5818           dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
5819 "Checking in file2;
5820 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
5821 new revision: 1\.1\.2\.1; previous revision: 1\.1
5822 done"
5823
5824           dotest editor-log-file1 "${testcvs} log -N file1" "
5825 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
5826 Working file: file1
5827 head: 1\.1
5828 branch:
5829 locks: strict
5830 access list:
5831 keyword substitution: kv
5832 total revisions: 2;     selected revisions: 2
5833 description:
5834 ----------------------------
5835 revision 1\.1
5836 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
5837 branches:  1\.1\.2;
5838 x
5839 xCVS: ----------------------------------------------------------------------
5840 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5841 xCVS:
5842 xCVS: Committing in .
5843 xCVS:
5844 xCVS: Added Files:
5845 xCVS:   file1 file2
5846 xCVS: ----------------------------------------------------------------------
5847 ----------------------------
5848 revision 1\.1\.2\.1
5849 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
5850 x
5851 xCVS: ----------------------------------------------------------------------
5852 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5853 xCVS:
5854 xCVS: Committing in .
5855 xCVS:
5856 xCVS: Modified Files:
5857 xCVS:  Tag: br
5858 xCVS:   file1
5859 xCVS: ----------------------------------------------------------------------
5860 ============================================================================="
5861
5862           # The only difference between the two expect strings is the
5863           # presence or absence of "Committing in ." for 1.1.2.1.
5864           dotest editor-log-file2 "${testcvs} log -N file2" "
5865 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
5866 Working file: file2
5867 head: 1\.1
5868 branch:
5869 locks: strict
5870 access list:
5871 keyword substitution: kv
5872 total revisions: 2;     selected revisions: 2
5873 description:
5874 ----------------------------
5875 revision 1\.1
5876 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
5877 branches:  1\.1\.2;
5878 x
5879 xCVS: ----------------------------------------------------------------------
5880 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5881 xCVS:
5882 xCVS: Committing in .
5883 xCVS:
5884 xCVS: Added Files:
5885 xCVS:   file1 file2
5886 xCVS: ----------------------------------------------------------------------
5887 ----------------------------
5888 revision 1\.1\.2\.1
5889 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
5890 x
5891 xCVS: ----------------------------------------------------------------------
5892 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5893 xCVS:
5894 xCVS: Modified Files:
5895 xCVS:  Tag: br
5896 xCVS:   file2
5897 xCVS: ----------------------------------------------------------------------
5898 =============================================================================" "
5899 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
5900 Working file: file2
5901 head: 1\.1
5902 branch:
5903 locks: strict
5904 access list:
5905 keyword substitution: kv
5906 total revisions: 2;     selected revisions: 2
5907 description:
5908 ----------------------------
5909 revision 1\.1
5910 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
5911 branches:  1\.1\.2;
5912 x
5913 xCVS: ----------------------------------------------------------------------
5914 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5915 xCVS:
5916 xCVS: Committing in .
5917 xCVS:
5918 xCVS: Added Files:
5919 xCVS:   file1 file2
5920 xCVS: ----------------------------------------------------------------------
5921 ----------------------------
5922 revision 1\.1\.2\.1
5923 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
5924 x
5925 xCVS: ----------------------------------------------------------------------
5926 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
5927 xCVS:
5928 xCVS: Committing in .
5929 xCVS:
5930 xCVS: Modified Files:
5931 xCVS:  Tag: br
5932 xCVS:   file2
5933 xCVS: ----------------------------------------------------------------------
5934 ============================================================================="
5935           cd ../..
5936           rm -r 1
5937           rm ${TESTDIR}/editme
5938           rm -rf ${CVSROOT_DIRNAME}/first-dir
5939           ;;
5940
5941         errmsg1)
5942           mkdir ${CVSROOT_DIRNAME}/1dir
5943           mkdir 1
5944           cd 1
5945           if ${testcvs} -q co 1dir; then
5946               pass 162
5947           else
5948               fail 162
5949           fi
5950           cd 1dir
5951           touch foo
5952           if ${testcvs} add foo 2>>${LOGFILE}; then
5953               pass 163
5954           else
5955               fail 163
5956           fi
5957           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
5958               pass 164
5959           else
5960               fail 164
5961           fi
5962           cd ../..
5963           mkdir 2
5964           cd 2
5965           if ${testcvs} -q co 1dir >>${LOGFILE}; then
5966               pass 165
5967           else
5968               fail 165
5969           fi
5970           chmod a-w 1dir
5971           cd ../1/1dir
5972           rm foo;
5973           if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
5974               pass 166
5975           else
5976               fail 166
5977           fi
5978           if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
5979               pass 167
5980           else
5981               fail 167
5982           fi
5983
5984           cd ../../2/1dir
5985           # FIXME: should be using dotest.
5986           ${testcvs} -q update 2>../tst167.err
5987           cat ../tst167.err >>${LOGFILE}
5988           cat <<EOF >../tst167.ans
5989 ${PROG} server: warning: foo is not (any longer) pertinent
5990 ${PROG} update: unable to remove ./foo: Permission denied
5991 EOF
5992           if cmp ../tst167.ans ../tst167.err >/dev/null ||
5993           ( echo "${PROG} [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null )
5994           then
5995               pass 168
5996           else
5997               fail 168
5998           fi
5999
6000           cd ..
6001           chmod u+w 1dir
6002           cd ..
6003           rm -r 1 2
6004           rm -rf ${CVSROOT_DIRNAME}/1dir
6005           ;;
6006
6007         errmsg2)
6008           # More tests of various miscellaneous error handling,
6009           # and cvs add behavior in general.
6010           # See also test basicb-4a, concerning "cvs ci CVS".
6011           # Too many tests to mention test the simple cases of
6012           # adding files and directories.
6013           # Test basicb-2a10 tests cvs -n add.
6014
6015           # First the usual setup; create a directory first-dir.
6016           mkdir 1; cd 1
6017           dotest errmsg2-1 "${testcvs} -q co -l ." ''
6018           mkdir first-dir
6019           dotest errmsg2-2 "${testcvs} add first-dir" \
6020 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
6021           cd first-dir
6022           dotest_fail errmsg2-3 "${testcvs} add CVS" \
6023 "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
6024           touch file1
6025           # For the most part add returns a failure exitstatus if
6026           # there are any errors, even if the remaining files are
6027           # processed without incident.  The "cannot add
6028           # special file" message fits this pattern, at
6029           # least currently.
6030           dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
6031 "${PROG} [a-z]*: cannot add special file .CVS.; skipping
6032 ${PROG} [a-z]*: scheduling file .file1. for addition
6033 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6034           # I'm not sure these tests completely convey the various strange
6035           # behaviors that CVS had before it specially checked for "." and
6036           # "..".  Suffice it to say that these are unlikely to work right
6037           # without a special case.
6038           dotest_fail errmsg2-5 "${testcvs} add ." \
6039 "${PROG} [a-z]*: cannot add special file .\..; skipping"
6040           dotest_fail errmsg2-6 "${testcvs} add .." \
6041 "${PROG} [a-z]*: cannot add special file .\.\..; skipping"
6042           # Make sure that none of the error messages left droppings
6043           # which interfere with normal operation.
6044           dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
6045 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
6046 done
6047 Checking in file1;
6048 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
6049 initial revision: 1\.1
6050 done"
6051           mkdir sdir
6052           cd ..
6053           dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
6054 "Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
6055
6056           cd first-dir
6057
6058           touch file10
6059           mkdir sdir10
6060           dotest errmsg2-10 "${testcvs} add file10 sdir10" \
6061 "${PROG} [a-z]*: scheduling file .file10. for addition
6062 Directory ${TESTDIR}/cvsroot/first-dir/sdir10 added to the repository
6063 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6064           dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
6065 "RCS file: ${TESTDIR}/cvsroot/first-dir/file10,v
6066 done
6067 Checking in file10;
6068 ${TESTDIR}/cvsroot/first-dir/file10,v  <--  file10
6069 initial revision: 1\.1
6070 done"
6071           # Try to see that there are no droppings left by
6072           # any of the previous tests.
6073           dotest errmsg2-12 "${testcvs} -q update" ""
6074
6075           # Now test adding files with '/' in the name, both one level
6076           # down and more than one level down.
6077           cd ..
6078           mkdir first-dir/sdir10/ssdir
6079           dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
6080 "Directory ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir added to the repository"
6081
6082           touch first-dir/sdir10/ssdir/ssfile
6083           dotest errmsg2-14 \
6084             "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
6085 "${PROG} [a-z]*: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
6086 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6087           touch first-dir/file15
6088           dotest errmsg2-15 "${testcvs} add first-dir/file15" \
6089 "${PROG} [a-z]*: scheduling file .first-dir/file15. for addition
6090 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6091
6092           # Now the case where we try to give it a directory which is not
6093           # under CVS control.
6094           mkdir bogus-dir
6095           touch bogus-dir/file16
6096           # The first message, from local CVS, is nice.  The second one
6097           # is not nice; would be good to fix remote CVS to give a clearer
6098           # message (e.g. the one from local CVS).  But at least it is an
6099           # error message.
6100           dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
6101 "${PROG} [a-z]*: in directory bogus-dir:
6102 ${PROG} \[[a-z]* aborted\]: there is no version here; do .${PROG} checkout. first" \
6103 "${PROG} [a-z]*: cannot open CVS/Entries for reading: No such file or directory
6104 ${PROG} \[add aborted\]: no repository"
6105           rm -r bogus-dir
6106
6107           # One error condition we don't test for is trying to add a file
6108           # or directory which already is there.
6109
6110           dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
6111 "RCS file: ${TESTDIR}/cvsroot/first-dir/file15,v
6112 done
6113 Checking in first-dir/file15;
6114 ${TESTDIR}/cvsroot/first-dir/file15,v  <--  file15
6115 initial revision: 1\.1
6116 done
6117 RCS file: ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v
6118 done
6119 Checking in first-dir/sdir10/ssdir/ssfile;
6120 ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v  <--  ssfile
6121 initial revision: 1\.1
6122 done"
6123
6124           cd ..
6125           rm -r 1
6126           rm -rf ${TESTDIR}/cvsroot/first-dir
6127           ;;
6128
6129         devcom)
6130           mkdir ${CVSROOT_DIRNAME}/first-dir
6131           mkdir 1
6132           cd 1
6133           if ${testcvs} -q co first-dir >>${LOGFILE} ; then
6134               pass 169
6135           else
6136               fail 169
6137           fi
6138
6139           cd first-dir
6140           echo abb >abb
6141           if ${testcvs} add abb 2>>${LOGFILE}; then
6142               pass 170
6143           else
6144               fail 170
6145           fi
6146           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
6147               pass 171
6148           else
6149               fail 171
6150           fi
6151           dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}"
6152           if ${testcvs} watch on; then
6153               pass 172
6154           else
6155               fail 172
6156           fi
6157           echo abc >abc
6158           if ${testcvs} add abc 2>>${LOGFILE}; then
6159               pass 173
6160           else
6161               fail 173
6162           fi
6163           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
6164               pass 174
6165           else
6166               fail 174
6167           fi
6168
6169           cd ../..
6170           mkdir 2
6171           cd 2
6172
6173           if ${testcvs} -q co first-dir >>${LOGFILE}; then
6174               pass 175
6175           else
6176               fail 175
6177           fi
6178           cd first-dir
6179           if test -w abb; then
6180               fail 176
6181           else
6182               pass 176
6183           fi
6184           if test -w abc; then
6185               fail 177
6186           else
6187               pass 177
6188           fi
6189
6190           if ${testcvs} editors >../ans178.tmp; then
6191               pass 178
6192           else
6193               fail 178
6194           fi
6195           cat ../ans178.tmp >>${LOGFILE}
6196           if test -s ../ans178.tmp; then
6197               fail 178a
6198           else
6199               pass 178a
6200           fi
6201
6202           if ${testcvs} edit abb; then
6203               pass 179
6204           else
6205               fail 179
6206           fi
6207
6208           if ${testcvs} editors >../ans180.tmp; then
6209               pass 180
6210           else
6211               fail 180
6212           fi
6213           cat ../ans180.tmp >>${LOGFILE}
6214           if test -s ../ans180.tmp; then
6215               pass 181
6216           else
6217               fail 181
6218           fi
6219
6220           echo aaaa >>abb
6221           if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then
6222               pass 182
6223           else
6224               fail 182
6225           fi
6226           # Unedit of a file not being edited should be a noop.
6227           dotest 182.5 "${testcvs} unedit abb" ''
6228
6229           if ${testcvs} editors >../ans183.tmp; then
6230               pass 183
6231           else
6232               fail 183
6233           fi
6234           cat ../ans183.tmp >>${LOGFILE}
6235           if test -s ../ans183.tmp; then
6236               fail 184
6237           else
6238               pass 184
6239           fi
6240
6241           if test -w abb; then
6242               fail 185
6243           else
6244               pass 185
6245           fi
6246
6247           if ${testcvs} edit abc; then
6248               pass 186a1
6249           else
6250               fail 186a1
6251           fi
6252           # Unedit of an unmodified file.
6253           if ${testcvs} unedit abc; then
6254               pass 186a2
6255           else
6256               fail 186a2
6257           fi
6258           if ${testcvs} edit abc; then
6259               pass 186a3
6260           else
6261               fail 186a3
6262           fi
6263           echo changedabc >abc
6264           # Try to unedit a modified file; cvs should ask for confirmation
6265           if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then
6266               pass 186a4
6267           else
6268               fail 186a4
6269           fi
6270           if echo changedabc | cmp - abc; then
6271               pass 186a5
6272           else
6273               fail 186a5
6274           fi
6275           # OK, now confirm the unedit
6276           if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then
6277               pass 186a6
6278           else
6279               fail 186a6
6280           fi
6281           if echo abc | cmp - abc; then
6282               pass 186a7
6283           else
6284               fail 186a7
6285           fi
6286
6287           dotest devcom-a0 "${testcvs} watchers" ''
6288
6289           # FIXME: This probably should be an error message instead
6290           # of silently succeeding and printing nothing.
6291           dotest devcom-a-nonexist "${testcvs} watchers nonexist" ''
6292
6293           dotest devcom-a1 "${testcvs} watch add" ''
6294           dotest devcom-a2 "${testcvs} watchers" \
6295 "abb    ${username}     edit    unedit  commit
6296 abc     ${username}     edit    unedit  commit"
6297           dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
6298           dotest devcom-a4 "${testcvs} watchers abb" \
6299 "abb    ${username}     edit    commit"
6300
6301           # Check tagging and checking out while we have a CVS
6302           # directory in the repository.
6303           dotest devcom-t0 "${testcvs} -q tag tag" \
6304 'T abb
6305 T abc'
6306           cd ../..
6307           mkdir 3
6308           cd 3
6309
6310           # Test commented out because the bug it tests for is not fixed
6311           # The error is:
6312           # cvs watchers: cannot open CVS/Entries for reading: No such file or directory
6313           # cvs: ../../work/ccvs/src/fileattr.c:75: fileattr_read: Assertion `fileattr_stored_repos != ((void *)0)' failed.
6314 :         dotest devcom-t-nonexist "${testcvs} watchers nonexist" fixme
6315
6316           dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
6317 'U first-dir/abb'
6318           cd ..
6319           # Since first-dir/abb is readonly, use -f.
6320           rm -rf 3
6321
6322           # Test checking out the directory rather than the file.
6323           mkdir 3
6324           cd 3
6325           dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
6326 'U first-dir/abb
6327 U first-dir/abc'
6328           cd ..
6329           # Since the files are readonly, use -f.
6330           rm -rf 3
6331
6332           # Now do it again, after removing the val-tags file created
6333           # by devcom-t1 to force CVS to search the repository
6334           # containing CVS directories.
6335           rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags
6336           mkdir 3
6337           cd 3
6338           dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
6339 'U first-dir/abb
6340 U first-dir/abc'
6341           cd ..
6342           # Since the files are readonly, use -f.
6343           rm -rf 3
6344
6345           # Now remove all the file attributes
6346           cd 2/first-dir
6347           dotest devcom-b0 "${testcvs} watch off" ''
6348           dotest devcom-b1 "${testcvs} watch remove" ''
6349           # Test that CVS 1.6 and earlier can handle the repository.
6350           dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
6351
6352           # Now test watching just some, not all, files.
6353           dotest devcom-some0 "${testcvs} watch on abc" ''
6354           cd ../..
6355           mkdir 3
6356           cd 3
6357           dotest devcom-some1 "${testcvs} -q co first-dir" 'U first-dir/abb
6358 U first-dir/abc'
6359           dotest devcom-some2 "test -w first-dir/abb" ''
6360           dotest_fail devcom-some3 "test -w first-dir/abc" ''
6361           cd ..
6362
6363           if test "$keep" = yes; then
6364             echo Keeping ${TESTDIR} and exiting due to --keep
6365             exit 0
6366           fi
6367
6368           # Use -f because of the readonly files.
6369           rm -rf 1 2 3
6370           rm -rf ${CVSROOT_DIRNAME}/first-dir
6371           ;;
6372
6373         devcom2)
6374           # More watch tests, most notably setting watches on
6375           # files in various different states.
6376           mkdir ${CVSROOT_DIRNAME}/first-dir
6377           mkdir 1
6378           cd 1
6379           dotest devcom2-1 "${testcvs} -q co first-dir" ''
6380           cd first-dir
6381
6382           # This should probably be an error; setting a watch on a totally
6383           # unknown file is more likely to be a typo than intentional.
6384           # But that isn't the currently implemented behavior.
6385           dotest devcom2-2 "${testcvs} watch on w1" ''
6386
6387           touch w1 w2 w3 nw1
6388           dotest devcom2-3 "${testcvs} add w1 w2 w3 nw1" "${DOTSTAR}"
6389           # Letting the user set the watch here probably can be considered
6390           # a feature--although it leads to a few potentially strange
6391           # consequences like one user can set the watch and another actually
6392           # adds the file.
6393           dotest devcom2-4 "${testcvs} watch on w2" ''
6394           dotest devcom2-5 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
6395
6396           # Note that this test differs in a subtle way from devcom-some0;
6397           # in devcom-some0 the watch is creating a new fileattr file, and
6398           # here we are modifying an existing one.
6399           dotest devcom2-6 "${testcvs} watch on w3" ''
6400
6401           # Now test that all the watches got set on the correct files
6402           # FIXME: CVS should have a way to report whether watches are
6403           # set, I think.  The "check it out and see if it read-only" is
6404           # sort of OK, but is complicated by CVSREAD and doesn't help
6405           # if the file is added and not yet committed or some such.
6406           # Probably "cvs status" should report "watch: on" if watch is on
6407           # (and nothing if watch is off, so existing behavior is preserved).
6408           cd ../..
6409           mkdir 2
6410           cd 2
6411           dotest devcom2-7 "${testcvs} -q co first-dir" 'U first-dir/nw1
6412 U first-dir/w1
6413 U first-dir/w2
6414 U first-dir/w3'
6415           dotest devcom2-8 "test -w first-dir/nw1" ''
6416           dotest_fail devcom2-9 "test -w first-dir/w1" ''
6417           dotest_fail devcom2-10 "test -w first-dir/w2" ''
6418           dotest_fail devcom2-11 "test -w first-dir/w3" ''
6419
6420           cd first-dir
6421           # OK, now we want to try files in various states with cvs edit.
6422           dotest devcom2-12 "${testcvs} edit w4" \
6423 "${PROG} edit: no such file w4; ignored"
6424           # Try the same thing with a per-directory watch set.
6425           dotest devcom2-13 "${testcvs} watch on" ''
6426           dotest devcom2-14 "${testcvs} edit w5" \
6427 "${PROG} edit: no such file w5; ignored"
6428           dotest devcom2-15 "${testcvs} editors" ''
6429           dotest devcom2-16 "${testcvs} editors w4" ''
6430           # Make sure there are no droppings lying around
6431           dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
6432 "Fw1    _watched=
6433 Fw2     _watched=
6434 Fw3     _watched=
6435 Fnw1    _watched=
6436 D       _watched="
6437           cd ..
6438
6439           cd ..
6440
6441           # Use -f because of the readonly files.
6442           rm -rf 1 2
6443           rm -rf ${CVSROOT_DIRNAME}/first-dir
6444           ;;
6445
6446         devcom3)
6447           # More watch tests, most notably handling of features designed
6448           # for future expansion.
6449           mkdir ${CVSROOT_DIRNAME}/first-dir
6450           mkdir 1
6451           cd 1
6452           dotest devcom3-1 "${testcvs} -q co first-dir" ''
6453           cd first-dir
6454
6455           touch w1 w2
6456           dotest devcom3-2 "${testcvs} add w1 w2" "${DOTSTAR}"
6457           dotest devcom3-3 "${testcvs} watch on w1 w2" ''
6458           dotest devcom3-4 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
6459
6460           # OK, since we are about to delve into CVS's internals, make
6461           # sure that we seem to be correct about how they work.
6462           dotest devcom3-5 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
6463 "Fw1    _watched=
6464 Fw2     _watched="
6465           # Now write a few more lines, just as if we were a newer version
6466           # of CVS implementing some new feature.
6467           cat <<EOF >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
6468 Enew    line    here
6469 G@#$^!@#=&
6470 EOF
6471           # Now get CVS to write to the fileattr file....
6472           dotest devcom3-6 "${testcvs} watch off w1" ''
6473           # ...and make sure that it hasn't clobbered our new lines.
6474           # Note that writing these lines in another order would be OK
6475           # too.
6476           dotest devcom3-7 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
6477 "Fw2    _watched=
6478 G@#..!@#=&
6479 Enew    line    here"
6480
6481           # See what CVS does when a file name is duplicated.  The
6482           # behavior of all versions of CVS since file attributes were
6483           # implemented is that it nukes the duplications.  This seems
6484           # reasonable enough, although it means it isn't clear how
6485           # useful duplicates would be for purposes of future
6486           # expansion.  But in the interests of keeping behaviors
6487           # predictable, might as well test for it, I guess.
6488           echo 'Fw2     duplicate=' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
6489           dotest devcom3-8 "${testcvs} watch on w1" ''
6490           dotest devcom3-9 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
6491 "Fw2    _watched=
6492 Fw1     _watched=
6493 Enew    line    here
6494 G@#..!@#=&"
6495
6496           cd ../..
6497
6498           # Use -f because of the readonly files.
6499           rm -rf 1
6500           rm -rf ${CVSROOT_DIRNAME}/first-dir
6501           ;;
6502
6503         watch4)
6504           # More watch tests, including adding directories.
6505           mkdir 1; cd 1
6506           dotest watch4-0a "${testcvs} -q co -l ." ''
6507           mkdir first-dir
6508           dotest watch4-0b "${testcvs} add first-dir" \
6509 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
6510
6511           cd first-dir
6512           dotest watch4-1 "${testcvs} watch on" ''
6513           # This is just like the 173 test
6514           touch file1
6515           dotest watch4-2 "${testcvs} add file1" \
6516 "${PROG} [a-z]*: scheduling file .file1. for addition
6517 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6518           dotest watch4-3 "${testcvs} -q ci -m add" \
6519 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
6520 done
6521 Checking in file1;
6522 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
6523 initial revision: 1\.1
6524 done"
6525           # Now test the analogous behavior for directories.
6526           mkdir subdir
6527           dotest watch4-4 "${testcvs} add subdir" \
6528 "Directory ${TESTDIR}/cvsroot/first-dir/subdir added to the repository"
6529           cd subdir
6530           touch sfile
6531           dotest watch4-5 "${testcvs} add sfile" \
6532 "${PROG} [a-z]*: scheduling file .sfile. for addition
6533 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6534           dotest watch4-6 "${testcvs} -q ci -m add" \
6535 "RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v
6536 done
6537 Checking in sfile;
6538 ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v  <--  sfile
6539 initial revision: 1\.1
6540 done"
6541           cd ../../..
6542           mkdir 2; cd 2
6543           dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
6544 U first-dir/subdir/sfile"
6545           dotest_fail watch4-8 "test -w first-dir/file1" ''
6546           dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
6547           cd first-dir
6548           dotest watch4-10 "${testcvs} edit file1" ''
6549           echo 'edited in 2' >file1
6550           cd ../..
6551
6552           cd 1/first-dir
6553           dotest watch4-11 "${testcvs} edit file1" ''
6554           echo 'edited in 1' >file1
6555           dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
6556 "Checking in file1;
6557 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
6558 new revision: 1\.2; previous revision: 1\.1
6559 done"
6560           cd ../..
6561           cd 2/first-dir
6562           dotest watch4-13 "${testcvs} -q update" \
6563 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
6564 retrieving revision 1\.1
6565 retrieving revision 1\.2
6566 Merging differences between 1\.1 and 1\.2 into file1
6567 rcsmerge: warning: conflicts during merge
6568 ${PROG} [a-z]*: conflicts found in file1
6569 C file1"
6570           if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
6571             pass watch4-14
6572           else
6573             fail watch4-15
6574           fi
6575           # This could plausibly be defined to either go back to the revision
6576           # which was cvs edit'd (the status quo), or back to revision 1.2
6577           # (that is, the merge could update CVS/Base/file1).  We pick the
6578           # former because it is easier to implement, not because we have
6579           # thought much about which is better.
6580           dotest watch4-16 "cat file1" ''
6581           # Make sure CVS really thinks we are at 1.1.
6582           dotest watch4-17 "${testcvs} -q update" "U file1"
6583           dotest watch4-18 "cat file1" "edited in 1"
6584           cd ../..
6585
6586           # As a sanity check, make sure we are in the right place.
6587           dotest watch4-cleanup-1 "test -d 1" ''
6588           dotest watch4-cleanup-1 "test -d 2" ''
6589           # Specify -f because of the readonly files.
6590           rm -rf 1 2
6591           rm -rf ${CVSROOT_DIRNAME}/first-dir
6592           ;;
6593
6594         ignore)
6595           # On Windows, we can't check out CVSROOT, because the case
6596           # insensitivity means that this conflicts with cvsroot.
6597           mkdir wnt
6598           cd wnt
6599
6600           dotest 187a1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
6601           cd CVSROOT
6602           echo rootig.c >cvsignore
6603           dotest 187a2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition
6604 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
6605
6606           # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
6607           # Accept either.
6608           dotest 187a3 " ${testcvs} ci -m added" \
6609 "${PROG} [a-z]*: Examining \.
6610 RCS file: ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v
6611 done
6612 Checking in cvsignore;
6613 ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v  <--  cvsignore
6614 initial revision: 1\.1
6615 done
6616 ${PROG} [a-z]*: Rebuilding administrative file database"
6617
6618           cd ..
6619           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
6620               pass 187a4
6621           else
6622               fail 187a4
6623           fi
6624
6625           # CVS looks at the home dir from getpwuid, not HOME (is that correct
6626           # behavior?), so this is hard to test and we won't try.
6627           # echo foobar.c >${HOME}/.cvsignore
6628           CVSIGNORE=envig.c; export CVSIGNORE
6629           mkdir dir-to-import
6630           cd dir-to-import
6631           touch foobar.c bar.c rootig.c defig.o envig.c optig.c
6632           # We use sort because we can't predict the order in which
6633           # the files will be listed.
6634           dotest_sort 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \
6635 '
6636
6637 I first-dir/defig.o
6638 I first-dir/envig.c
6639 I first-dir/optig.c
6640 I first-dir/rootig.c
6641 N first-dir/bar.c
6642 N first-dir/foobar.c
6643 No conflicts created by this import'
6644           dotest_sort 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \
6645 '
6646
6647 N second-dir/bar.c
6648 N second-dir/defig.o
6649 N second-dir/envig.c
6650 N second-dir/foobar.c
6651 N second-dir/optig.c
6652 N second-dir/rootig.c
6653 No conflicts created by this import'
6654           cd ..
6655           rm -r dir-to-import
6656
6657           mkdir 1
6658           cd 1
6659           dotest 189a "${testcvs} -q co second-dir" \
6660 'U second-dir/bar.c
6661 U second-dir/defig.o
6662 U second-dir/envig.c
6663 U second-dir/foobar.c
6664 U second-dir/optig.c
6665 U second-dir/rootig.c'
6666           dotest 189b "${testcvs} -q co first-dir" 'U first-dir/bar.c
6667 U first-dir/foobar.c'
6668           cd first-dir
6669           touch rootig.c defig.o envig.c optig.c notig.c
6670           dotest 189c "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
6671           # The fact that CVS requires us to specify -I CVS here strikes me
6672           # as a bug.
6673           dotest_sort 189d "${testcvs} -q update -I ! -I CVS" \
6674 "${QUESTION} defig.o
6675 ${QUESTION} envig.c
6676 ${QUESTION} notig.c
6677 ${QUESTION} optig.c
6678 ${QUESTION} rootig.c"
6679
6680           # Now test that commands other than update also print "? notig.c"
6681           # where appropriate.  Only test this for remote, because local
6682           # CVS only prints it on update.
6683           rm optig.c
6684           if test "x$remote" = xyes; then
6685             dotest 189e "${testcvs} -q diff" "${QUESTION} notig.c"
6686
6687             # Force the server to be contacted.  Ugh.  Having CVS
6688             # contact the server for the sole purpose of checking
6689             # the CVSROOT/cvsignore file does not seem like such a
6690             # good idea, so I imagine this will continue to be
6691             # necessary.  Oh well, at least we test CVS's ablity to
6692             # handle a file with a modified timestamp but unmodified
6693             # contents.
6694             touch bar.c
6695
6696             dotest 189f "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
6697           fi
6698
6699           # now test .cvsignore files
6700           cd ..
6701           echo notig.c >first-dir/.cvsignore
6702           echo foobar.c >second-dir/.cvsignore
6703           touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
6704           dotest_sort 190 "${testcvs} -qn update" \
6705 "${QUESTION} first-dir/.cvsignore
6706 ${QUESTION} second-dir/.cvsignore
6707 ${QUESTION} second-dir/notig.c"
6708           dotest_sort 191 "${testcvs} -qn update -I! -I CVS" \
6709 "${QUESTION} first-dir/.cvsignore
6710 ${QUESTION} first-dir/defig.o
6711 ${QUESTION} first-dir/envig.c
6712 ${QUESTION} first-dir/rootig.c
6713 ${QUESTION} second-dir/.cvsignore
6714 ${QUESTION} second-dir/notig.c"
6715
6716           if echo yes | ${testcvs} release -d first-dir \
6717             >${TESTDIR}/ignore.tmp; then
6718             pass ignore-192
6719           else
6720             fail ignore-192
6721           fi
6722           dotest ignore-193 "cat ${TESTDIR}/ignore.tmp" \
6723 "${QUESTION} \.cvsignore
6724 You have \[0\] altered files in this repository.
6725 Are you sure you want to release (and delete) directory .first-dir': "
6726
6727           echo add a line >>second-dir/foobar.c
6728           rm second-dir/notig.c second-dir/.cvsignore
6729           if echo yes | ${testcvs} release -d second-dir \
6730             >${TESTDIR}/ignore.tmp; then
6731             pass ignore-194
6732           else
6733             fail ignore-194
6734           fi
6735           dotest ignore-195 "cat ${TESTDIR}/ignore.tmp" \
6736 "M foobar.c
6737 You have \[1\] altered files in this repository.
6738 Are you sure you want to release (and delete) directory .second-dir': "
6739           cd ..
6740           rm -r 1
6741           cd ..
6742           rm -r wnt
6743           rm ${TESTDIR}/ignore.tmp
6744           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
6745           ;;
6746
6747         binfiles)
6748           # Test cvs's ability to handle binary files.
6749           mkdir ${CVSROOT_DIRNAME}/first-dir
6750           mkdir 1; cd 1
6751           dotest binfiles-1 "${testcvs} -q co first-dir" ''
6752           awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
6753             </dev/null >binfile.dat
6754           cat binfile.dat binfile.dat >binfile2.dat
6755           cd first-dir
6756           cp ../binfile.dat binfile
6757           dotest binfiles-2 "${testcvs} add -kb binfile" \
6758 "${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition
6759 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
6760           dotest binfiles-3 "${testcvs} -q ci -m add-it" \
6761 "RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
6762 done
6763 Checking in binfile;
6764 ${TESTDIR}/cvsroot/first-dir/binfile,v  <--  binfile
6765 initial revision: 1\.1
6766 done"
6767           cd ../..
6768           mkdir 2; cd 2
6769           dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
6770           cd first-dir
6771           dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
6772           # Testing that sticky options is -kb is the closest thing we have
6773           # to testing that binary files work right on non-unix machines
6774           # (until there is automated testing for such machines, of course).
6775           dotest binfiles-5.5 "${testcvs} status binfile" \
6776 "===================================================================
6777 File: binfile           Status: Up-to-date
6778
6779    Working revision:    1\.1.*
6780    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/binfile,v
6781    Sticky Tag:          (none)
6782    Sticky Date:         (none)
6783    Sticky Options:      -kb"
6784
6785           # Test whether the default options from the RCS file are
6786           # also used when operating on files instead of whole
6787           # directories
6788           cd ../..
6789           mkdir 3; cd 3
6790           dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
6791 'U first-dir/binfile'
6792           cd first-dir
6793           dotest binfiles-5.5b1 "${testcvs} status binfile" \
6794 "===================================================================
6795 File: binfile           Status: Up-to-date
6796
6797    Working revision:    1\.1.*
6798    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/binfile,v
6799    Sticky Tag:          (none)
6800    Sticky Date:         (none)
6801    Sticky Options:      -kb"
6802           cd ../..
6803           rm -r 3
6804           cd 2/first-dir
6805
6806           cp ../../1/binfile2.dat binfile
6807           dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
6808 "Checking in binfile;
6809 ${TESTDIR}/cvsroot/first-dir/binfile,v  <--  binfile
6810 new revision: 1\.2; previous revision: 1\.1
6811 done"
6812           cd ../../1/first-dir
6813           dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
6814           dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
6815
6816           # Now test handling of conflicts with binary files.
6817           cp ../binfile.dat binfile
6818           dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
6819 "Checking in binfile;
6820 ${TESTDIR}/cvsroot/first-dir/binfile,v  <--  binfile
6821 new revision: 1\.3; previous revision: 1\.2
6822 done"
6823           cd ../../2/first-dir
6824           echo 'edits in dir 2' >binfile
6825           dotest binfiles-con1 "${testcvs} -q update" \
6826 "U binfile
6827 ${PROG} [a-z]*: nonmergeable file needs merge
6828 ${PROG} [a-z]*: revision 1\.3 from repository is now in binfile
6829 ${PROG} [a-z]*: file from working directory is now in \.#binfile\.1\.2
6830 C binfile"
6831           dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
6832           dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
6833
6834           cp ../../1/binfile2.dat binfile
6835           dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
6836 "Checking in binfile;
6837 ${TESTDIR}/cvsroot/first-dir/binfile,v  <--  binfile
6838 new revision: 1\.4; previous revision: 1\.3
6839 done"
6840           cd ../../1/first-dir
6841           dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
6842
6843           dotest binfiles-9 "${testcvs} -q update -A" ''
6844           dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
6845           dotest binfiles-11 "${testcvs} -q update" ''
6846           dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
6847           dotest binfiles-13 "${testcvs} -q update -A" ''
6848
6849           cd ../..
6850           rm -r 1
6851
6852           mkdir 3
6853           cd 3
6854           dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
6855 'U first-dir/binfile'
6856           cd first-dir
6857           dotest binfiles-13a1 "${testcvs} status binfile" \
6858 "===================================================================
6859 File: binfile           Status: Up-to-date
6860
6861    Working revision:    1\.4.*
6862    Repository revision: 1\.4    ${TESTDIR}/cvsroot/first-dir/binfile,v
6863    Sticky Tag:          HEAD (revision: 1\.4)
6864    Sticky Date:         (none)
6865    Sticky Options:      -kb"
6866           cd ../..
6867           rm -r 3
6868
6869           cd 2/first-dir
6870           echo 'this file is $''RCSfile$' >binfile
6871           dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
6872 "Checking in binfile;
6873 ${TESTDIR}/cvsroot/first-dir/binfile,v  <--  binfile
6874 new revision: 1\.5; previous revision: 1\.4
6875 done"
6876           dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
6877           # See binfiles-5.5 for discussion of -kb.
6878           dotest binfiles-14c "${testcvs} status binfile" \
6879 "===================================================================
6880 File: binfile           Status: Up-to-date
6881
6882    Working revision:    1\.5.*
6883    Repository revision: 1\.5    ${TESTDIR}/cvsroot/first-dir/binfile,v
6884    Sticky Tag:          (none)
6885    Sticky Date:         (none)
6886    Sticky Options:      -kb"
6887           dotest binfiles-14d "${testcvs} admin -kv binfile" \
6888 "RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
6889 done"
6890           # cvs admin doesn't change the checked-out file or its sticky
6891           # kopts.  There probably should be a way which does (but
6892           # what if the file is modified?  And do we try to version
6893           # control the kopt setting?)
6894           dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
6895           dotest binfiles-14f "${testcvs} status binfile" \
6896 "===================================================================
6897 File: binfile           Status: Up-to-date
6898
6899    Working revision:    1\.5.*
6900    Repository revision: 1\.5    ${TESTDIR}/cvsroot/first-dir/binfile,v
6901    Sticky Tag:          (none)
6902    Sticky Date:         (none)
6903    Sticky Options:      -kb"
6904           dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
6905           dotest binfiles-14h "cat binfile" 'this file is binfile,v'
6906           dotest binfiles-14i "${testcvs} status binfile" \
6907 "===================================================================
6908 File: binfile           Status: Up-to-date
6909
6910    Working revision:    1\.5.*
6911    Repository revision: 1\.5    ${TESTDIR}/cvsroot/first-dir/binfile,v
6912    Sticky Tag:          (none)
6913    Sticky Date:         (none)
6914    Sticky Options:      -kv"
6915
6916           # Do sticky options work when used with 'cvs update'?
6917           echo "Not a binary file." > nibfile
6918           dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
6919 "${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
6920           dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
6921             "RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v
6922 done
6923 Checking in nibfile;
6924 ${TESTDIR}/cvsroot/first-dir/nibfile,v  <--  nibfile
6925 initial revision: 1\.1
6926 done"
6927           dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
6928             '[UP] nibfile'
6929           dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
6930 "===================================================================
6931 File: nibfile           Status: Up-to-date
6932
6933    Working revision:    1\.1.*
6934    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/nibfile,v
6935    Sticky Tag:          (none)
6936    Sticky Date:         (none)
6937    Sticky Options:      -kb"
6938
6939           # Now test that -A can clear the sticky option.
6940           dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
6941 "[UP] nibfile"
6942           dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
6943 "===================================================================
6944 File: nibfile           Status: Up-to-date
6945
6946    Working revision:    1\.1.*
6947    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/nibfile,v
6948    Sticky Tag:          (none)
6949    Sticky Date:         (none)
6950    Sticky Options:      (none)"
6951           dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
6952 "RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v
6953 done"
6954           dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
6955           dotest binfiles-17 "${testcvs} -q status nibfile" \
6956 "===================================================================
6957 File: nibfile           Status: Up-to-date
6958
6959    Working revision:    1\.1.*
6960    Repository revision: 1\.1    ${TESTDIR}/cvsroot/first-dir/nibfile,v
6961    Sticky Tag:          (none)
6962    Sticky Date:         (none)
6963    Sticky Options:      -kb"
6964
6965           dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
6966 "RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
6967 deleting revision 1\.5
6968 deleting revision 1\.4
6969 done"
6970           dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
6971 "RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
6972 deleting revision 1\.2
6973 deleting revision 1\.1
6974 done"
6975           dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
6976 RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
6977 Working file: binfile
6978 head: 1\.3
6979 branch:
6980 locks: strict
6981 access list:
6982 keyword substitution: v
6983 total revisions: 1
6984 ============================================================================="
6985
6986           cd ../..
6987           rm -rf ${CVSROOT_DIRNAME}/first-dir
6988           rm -r 2
6989           ;;
6990
6991         binfiles2)
6992           # Test cvs's ability to handle binary files, particularly branching
6993           # and joining.  The key thing we are worrying about is that CVS
6994           # doesn't print "cannot merge binary files" or some such, in 
6995           # situations where no merging is required.
6996           # See also "join" which does this with non-binary files.
6997           #
6998           # Cases (we are merging from the branch to the trunk):
6999           # binfile.dat) File added on branch, not on trunk.
7000           #      File should be marked for addition.
7001           # brmod) File modified on branch, not on trunk.
7002           #      File should be copied over to trunk (no merging is needed).
7003           # brmod-trmod) File modified on branch, also on trunk.
7004           #      This is a conflict.  Present the user with both files and
7005           #      let them figure it out.
7006           # brmod-wdmod) File modified on branch, not modified in the trunk
7007           #      repository, but modified in the (trunk) working directory.
7008           #      This is also a conflict.
7009
7010           mkdir ${CVSROOT_DIRNAME}/first-dir
7011           mkdir 1; cd 1
7012           dotest binfiles2-1 "${testcvs} -q co first-dir" ''
7013           cd first-dir
7014
7015           # The most important thing here is that binfile, binfile2, &c
7016           # each be distinct from each other.  We also make sure to include
7017           # a few likely end-of-line patterns to make sure nothing is
7018           # being munged as if in text mode.
7019           awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
7020             </dev/null >../binfile
7021           cat ../binfile ../binfile >../binfile2
7022           cat ../binfile2 ../binfile >../binfile3
7023
7024           # FIXCVS: unless a branch has at least one file on it,
7025           # tag_check_valid won't know it exists.  So if brmod didn't
7026           # exist, we would have to invent it.
7027           cp ../binfile brmod
7028           cp ../binfile brmod-trmod
7029           cp ../binfile brmod-wdmod
7030           dotest binfiles2-1a \
7031 "${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
7032 "${PROG} [a-z]*: scheduling file .brmod. for addition
7033 ${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
7034 ${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
7035 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
7036           dotest binfiles2-1b "${testcvs} -q ci -m add" \
7037 "RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v
7038 done
7039 Checking in brmod;
7040 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7041 initial revision: 1\.1
7042 done
7043 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7044 done
7045 Checking in brmod-trmod;
7046 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7047 initial revision: 1\.1
7048 done
7049 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v
7050 done
7051 Checking in brmod-wdmod;
7052 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7053 initial revision: 1\.1
7054 done"
7055           dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
7056 T brmod-trmod
7057 T brmod-wdmod'
7058           dotest binfiles2-3 "${testcvs} -q update -r br" ''
7059           cp ../binfile binfile.dat
7060           dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
7061 "${PROG} [a-z]*: scheduling file .binfile\.dat. for addition on branch .br.
7062 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7063           cp ../binfile2 brmod
7064           cp ../binfile2 brmod-trmod
7065           cp ../binfile2 brmod-wdmod
7066           dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
7067 "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v
7068 done
7069 Checking in binfile\.dat;
7070 ${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v  <--  binfile\.dat
7071 new revision: 1\.1\.2\.1; previous revision: 1\.1
7072 done
7073 Checking in brmod;
7074 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7075 new revision: 1\.1\.2\.1; previous revision: 1\.1
7076 done
7077 Checking in brmod-trmod;
7078 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7079 new revision: 1\.1\.2\.1; previous revision: 1\.1
7080 done
7081 Checking in brmod-wdmod;
7082 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7083 new revision: 1\.1\.2\.1; previous revision: 1\.1
7084 done"
7085           dotest binfiles2-6 "${testcvs} -q update -A" \
7086 "${PROG} [a-z]*: warning: binfile\.dat is not (any longer) pertinent
7087 [UP] brmod
7088 [UP] brmod-trmod
7089 [UP] brmod-wdmod"
7090           dotest_fail binfiles2-7 "test -f binfile.dat" ''
7091           dotest binfiles2-7-brmod "cmp ../binfile brmod"
7092           cp ../binfile3 brmod-trmod
7093           dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
7094 "Checking in brmod-trmod;
7095 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7096 new revision: 1\.2; previous revision: 1\.1
7097 done"
7098           cp ../binfile3 brmod-wdmod
7099
7100           dotest binfiles2-8 "${testcvs} -q update -j br" \
7101 "U binfile\.dat
7102 U brmod
7103 ${PROG} [a-z]*: nonmergeable file needs merge
7104 ${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
7105 ${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
7106 C brmod-trmod
7107 M brmod-wdmod
7108 ${PROG} [a-z]*: nonmergeable file needs merge
7109 ${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
7110 ${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
7111 C brmod-wdmod"
7112
7113           dotest binfiles2-9 "cmp ../binfile binfile.dat"
7114           dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
7115           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
7116           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
7117           dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
7118           dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
7119
7120           # Test that everything was properly scheduled.
7121           dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
7122 "Checking in binfile\.dat;
7123 ${TESTDIR}/cvsroot/first-dir/binfile\.dat,v  <--  binfile\.dat
7124 new revision: 1\.2; previous revision: 1\.1
7125 done
7126 Checking in brmod;
7127 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7128 new revision: 1\.2; previous revision: 1\.1
7129 done
7130 Checking in brmod-trmod;
7131 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7132 new revision: 1\.3; previous revision: 1\.2
7133 done
7134 Checking in brmod-wdmod;
7135 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7136 new revision: 1\.2; previous revision: 1\.1
7137 done"
7138
7139           dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
7140 "RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7141 deleting revision 1\.2
7142 ${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v: can't remove branch point 1\.1
7143 ${PROG} [a-z]*: cannot modify RCS file for .brmod-trmod."
7144           dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
7145 "RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7146 deleting revision 1\.1\.2\.1
7147 done"
7148           dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
7149 "RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7150 deleting revision 1\.2
7151 deleting revision 1\.1
7152 done"
7153           dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
7154 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7155 Working file: brmod-trmod
7156 head: 1\.3
7157 branch:
7158 locks: strict
7159 access list:
7160 keyword substitution: b
7161 total revisions: 1;     selected revisions: 1
7162 description:
7163 ----------------------------
7164 revision 1\.3
7165 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7166 checkin
7167 ============================================================================="
7168           cd ..
7169           cd ..
7170
7171           rm -rf ${CVSROOT_DIRNAME}/first-dir
7172           rm -r 1
7173           ;;
7174
7175         mcopy)
7176           # See comment at "mwrap" test for list of other wrappers tests.
7177           # Test cvs's ability to handle nonmergeable files specified with
7178           # -m 'COPY' in wrappers.  Similar to the binfiles2 test,
7179           # which tests the same thing for binary files
7180           # (which are non-mergeable in the same sense).
7181           #
7182           # Cases (we are merging from the branch to the trunk):
7183           # brmod) File modified on branch, not on trunk.
7184           #      File should be copied over to trunk (no merging is needed).
7185           # brmod-trmod) File modified on branch, also on trunk.
7186           #      This is a conflict.  Present the user with both files and
7187           #      let them figure it out.
7188           # brmod-wdmod) File modified on branch, not modified in the trunk
7189           #      repository, but modified in the (trunk) working directory.
7190           #      This is also a conflict.
7191
7192           # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
7193           # (see wrap_send).  So skip these tests for remote.
7194           if test "x$remote" = xno; then
7195
7196           mkdir ${CVSROOT_DIRNAME}/first-dir
7197           mkdir 1; cd 1
7198           dotest mcopy-1 "${testcvs} -q co first-dir" ''
7199           cd first-dir
7200
7201           # FIXCVS: unless a branch has at least one file on it,
7202           # tag_check_valid won't know it exists.  So if brmod didn't
7203           # exist, we would have to invent it.
7204           echo 'brmod initial contents' >brmod
7205           echo 'brmod-trmod initial contents' >brmod-trmod
7206           echo 'brmod-wdmod initial contents' >brmod-wdmod
7207           echo "* -m 'COPY'" >.cvswrappers
7208           dotest mcopy-1a \
7209 "${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
7210 "${PROG} [a-z]*: scheduling file .\.cvswrappers. for addition
7211 ${PROG} [a-z]*: scheduling file .brmod. for addition
7212 ${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
7213 ${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
7214 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
7215           dotest mcopy-1b "${testcvs} -q ci -m add" \
7216 "RCS file: ${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v
7217 done
7218 Checking in \.cvswrappers;
7219 ${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v  <--  \.cvswrappers
7220 initial revision: 1\.1
7221 done
7222 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v
7223 done
7224 Checking in brmod;
7225 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7226 initial revision: 1\.1
7227 done
7228 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
7229 done
7230 Checking in brmod-trmod;
7231 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7232 initial revision: 1\.1
7233 done
7234 RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v
7235 done
7236 Checking in brmod-wdmod;
7237 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7238 initial revision: 1\.1
7239 done"
7240
7241           # NOTE: .cvswrappers files are broken (see comment in
7242           # src/wrapper.c).  So doing everything via the environment
7243           # variable is a workaround.  Better would be to test them
7244           # both.
7245           CVSWRAPPERS="* -m 'COPY'"
7246           export CVSWRAPPERS
7247           dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
7248 T brmod
7249 T brmod-trmod
7250 T brmod-wdmod'
7251           dotest mcopy-3 "${testcvs} -q update -r br" ''
7252           echo 'modify brmod on br' >brmod
7253           echo 'modify brmod-trmod on br' >brmod-trmod
7254           echo 'modify brmod-wdmod on br' >brmod-wdmod
7255           dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
7256 "Checking in brmod;
7257 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7258 new revision: 1\.1\.2\.1; previous revision: 1\.1
7259 done
7260 Checking in brmod-trmod;
7261 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7262 new revision: 1\.1\.2\.1; previous revision: 1\.1
7263 done
7264 Checking in brmod-wdmod;
7265 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7266 new revision: 1\.1\.2\.1; previous revision: 1\.1
7267 done"
7268           dotest mcopy-6 "${testcvs} -q update -A" \
7269 "[UP] brmod
7270 [UP] brmod-trmod
7271 [UP] brmod-wdmod"
7272           dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
7273 "brmod initial contents
7274 brmod-trmod initial contents
7275 brmod-wdmod initial contents"
7276
7277           echo 'modify brmod-trmod again on trunk' >brmod-trmod
7278           dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
7279 "Checking in brmod-trmod;
7280 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7281 new revision: 1\.2; previous revision: 1\.1
7282 done"
7283           echo 'modify brmod-wdmod in working dir' >brmod-wdmod
7284
7285           dotest mcopy-8 "${testcvs} -q update -j br" \
7286 "U brmod
7287 ${PROG} [a-z]*: nonmergeable file needs merge
7288 ${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
7289 ${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
7290 C brmod-trmod
7291 M brmod-wdmod
7292 ${PROG} [a-z]*: nonmergeable file needs merge
7293 ${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
7294 ${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
7295 C brmod-wdmod"
7296
7297           dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
7298 "modify brmod on br
7299 modify brmod-trmod on br
7300 modify brmod-wdmod on br"
7301           dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
7302 "modify brmod-trmod again on trunk
7303 modify brmod-wdmod in working dir"
7304
7305           # Test that everything was properly scheduled.
7306           dotest mcopy-10 "${testcvs} -q ci -m checkin" \
7307 "Checking in brmod;
7308 ${TESTDIR}/cvsroot/first-dir/brmod,v  <--  brmod
7309 new revision: 1\.2; previous revision: 1\.1
7310 done
7311 Checking in brmod-trmod;
7312 ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v  <--  brmod-trmod
7313 new revision: 1\.3; previous revision: 1\.2
7314 done
7315 Checking in brmod-wdmod;
7316 ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v  <--  brmod-wdmod
7317 new revision: 1\.2; previous revision: 1\.1
7318 done"
7319           cd ..
7320           cd ..
7321
7322           rm -rf ${CVSROOT_DIRNAME}/first-dir
7323           rm -r 1
7324           unset CVSWRAPPERS
7325
7326           fi # end of tests to be skipped for remote
7327
7328           ;;
7329
7330         binwrap)
7331           # Test the ability to specify binary-ness based on file name.
7332           # See "mwrap" for a list of other wrappers tests.
7333
7334           mkdir dir-to-import
7335           cd dir-to-import
7336           touch foo.c foo.exe
7337
7338           # While we're here, test for rejection of duplicate tag names.
7339           dotest_fail binwrap-0 \
7340             "${testcvs} import -m msg -I ! first-dir dup dup" \
7341 "${PROG} \[[a-z]* aborted\]: tag .dup. was specified more than once"
7342
7343           if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
7344               first-dir tag1 tag2 >>${LOGFILE}; then
7345             pass binwrap-1
7346           else
7347             fail binwrap-1
7348           fi
7349           cd ..
7350           rm -r dir-to-import
7351           dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
7352 U first-dir/foo.exe'
7353           dotest binwrap-3 "${testcvs} -q status first-dir" \
7354 "===================================================================
7355 File: foo\.c                    Status: Up-to-date
7356
7357    Working revision:    1\.1\.1\.1.*
7358    Repository revision: 1\.1\.1\.1      ${TESTDIR}/cvsroot/first-dir/foo\.c,v
7359    Sticky Tag:          (none)
7360    Sticky Date:         (none)
7361    Sticky Options:      (none)
7362
7363 ===================================================================
7364 File: foo\.exe                  Status: Up-to-date
7365
7366    Working revision:    1\.1\.1\.1.*
7367    Repository revision: 1\.1\.1\.1      ${TESTDIR}/cvsroot/first-dir/foo\.exe,v
7368    Sticky Tag:          (none)
7369    Sticky Date:         (none)
7370    Sticky Options:      -kb"
7371           rm -r first-dir
7372           rm -rf ${CVSROOT_DIRNAME}/first-dir
7373           ;;
7374
7375         binwrap2)
7376           # Test the ability to specify binary-ness based on file name.
7377           # See "mwrap" for a list of other wrappers tests.
7378
7379           mkdir dir-to-import
7380           cd dir-to-import
7381           touch foo.c foo.exe
7382
7383           # Specify that all files are binary except *.c.
7384           # The order seems to matter, with the earlier rules taking
7385           # precedence.  I'm not sure whether that is good or not,
7386           # but it is the current behavior.
7387           if ${testcvs} import -m message -I ! \
7388               -W "*.c -k 'o'" -W "* -k 'b'" \
7389               first-dir tag1 tag2 >>${LOGFILE}; then
7390             pass binwrap2-1
7391           else
7392             fail binwrap2-1
7393           fi
7394           cd ..
7395           rm -r dir-to-import
7396           dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
7397 U first-dir/foo.exe'
7398           dotest binwrap2-3 "${testcvs} -q status first-dir" \
7399 "===================================================================
7400 File: foo\.c                    Status: Up-to-date
7401
7402    Working revision:    1\.1\.1\.1.*
7403    Repository revision: 1\.1\.1\.1      ${TESTDIR}/cvsroot/first-dir/foo\.c,v
7404    Sticky Tag:          (none)
7405    Sticky Date:         (none)
7406    Sticky Options:      -ko
7407
7408 ===================================================================
7409 File: foo\.exe                  Status: Up-to-date
7410
7411    Working revision:    1\.1\.1\.1.*
7412    Repository revision: 1\.1\.1\.1      ${TESTDIR}/cvsroot/first-dir/foo\.exe,v
7413    Sticky Tag:          (none)
7414    Sticky Date:         (none)
7415    Sticky Options:      -kb"
7416           rm -r first-dir
7417           rm -rf ${CVSROOT_DIRNAME}/first-dir
7418           ;;
7419
7420         binwrap3)
7421           # Test communication of file-specified -k wrappers between
7422           # client and server, in `import':
7423           #
7424           #   1. Set up a directory tree, populate it with files.
7425           #   2. Give each directory a different .cvswrappers file. 
7426           #   3. Give the server its own .cvswrappers file.
7427           #   4. Import the whole tree, see if the right files got set
7428           #      to binary.
7429           #
7430           # The tree has a top ("0th") level, and two subdirs, sub1/
7431           # and sub2/; sub2/ contains directory subsub/.  Every
7432           # directory has a .cvswrappers file as well as regular
7433           # files.
7434           #
7435           # In the file names, "foo-b.*" should end up binary, and
7436           # "foo-t.*" should end up text.  Don't worry about the two
7437           # letter extensions; they're just there to help me keep
7438           # things straight.
7439           #
7440           # Here's the directory tree:
7441           #
7442           # ./
7443           #    .cvswrappers
7444           #    foo-b.c0
7445           #    foo-b.sb
7446           #    foo-t.c1
7447           #    foo-t.st
7448           #
7449           #    sub1/             sub2/
7450           #      .cvswrappers      .cvswrappers
7451           #      foo-b.c1          foo-b.sb
7452           #      foo-b.sb          foo-b.st
7453           #      foo-t.c0          foo-t.c0
7454           #      foo-t.st          foo-t.c1
7455           #                        foo-t.c2
7456           #                        foo-t.c3
7457           #
7458           #                        subsub/
7459           #                          .cvswrappers
7460           #                          foo-b.c3
7461           #                          foo-b.sb
7462           #                          foo-t.c0
7463           #                          foo-t.c1
7464           #                          foo-t.c2
7465           #                          foo-t.st
7466
7467           binwrap3_line1="This is a test file "
7468           binwrap3_line2="containing little of use "
7469           binwrap3_line3="except this non-haiku"
7470
7471           binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
7472
7473           cd ${TESTDIR}
7474
7475           # On Windows, we can't check out CVSROOT, because the case
7476           # insensitivity means that this conflicts with cvsroot.
7477           mkdir wnt
7478           cd wnt
7479
7480           mkdir binwrap3 # the 0th dir
7481           mkdir binwrap3/sub1
7482           mkdir binwrap3/sub2
7483           mkdir binwrap3/sub2/subsub
7484           
7485           echo "*.c0 -k 'b'" > binwrap3/.cvswrappers
7486           echo "whatever -k 'b'" >> binwrap3/.cvswrappers
7487           echo ${binwrap3_text} > binwrap3/foo-b.c0
7488           echo ${binwrap3_text} > binwrap3/foo-b.sb
7489           echo ${binwrap3_text} > binwrap3/foo-t.c1
7490           echo ${binwrap3_text} > binwrap3/foo-t.st
7491
7492           echo "*.c1 -k 'b'" > binwrap3/sub1/.cvswrappers
7493           echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
7494           echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
7495           echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
7496           echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
7497           echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
7498
7499           echo "*.st -k 'b'" > binwrap3/sub2/.cvswrappers
7500           echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
7501           echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
7502           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
7503           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
7504           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
7505           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
7506
7507           echo "*.c3 -k 'b'" > binwrap3/sub2/subsub/.cvswrappers
7508           echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
7509           echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
7510           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
7511           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
7512           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
7513           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
7514           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
7515           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
7516
7517           # Now set up CVSROOT/cvswrappers, the easy way:
7518           dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
7519           cd CVSROOT
7520           # This destroys anything currently in cvswrappers, but
7521           # presumably other tests will take care of it themselves if
7522           # they use cvswrappers:
7523           echo "foo*.sb  -k 'b'" > cvswrappers
7524           dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
7525 "Checking in cvswrappers;
7526 ${TESTDIR}/cvsroot/CVSROOT/cvswrappers,v  <--  cvswrappers
7527 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
7528 done
7529 ${PROG} [a-z]*: Rebuilding administrative file database"
7530           cd ..
7531
7532           # Avoid environmental interference
7533           CVSWRAPPERS_SAVED=${CVSWRAPPERS}
7534           unset CVSWRAPPERS
7535
7536           # Do the import
7537           cd binwrap3
7538           # Not importing .cvswrappers tests whether the client is really
7539           # letting the server know "honestly" whether the file is binary,
7540           # rather than just letting the server see the .cvswrappers file.
7541           dotest binwrap3-2a \
7542 "${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
7543 "[NI] ${DOTSTAR}"
7544
7545           # OK, now test "cvs add".
7546           cd ..
7547           rm -r binwrap3
7548           dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
7549           cd binwrap3
7550           cd sub2
7551           echo "*.newbin -k 'b'" > .cvswrappers
7552           echo .cvswrappers >.cvsignore
7553           echo .cvsignore >>.cvsignore
7554           touch file1.newbin file1.txt
7555           dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
7556 "${PROG} [a-z]*: scheduling file .file1\.newbin. for addition
7557 ${PROG} [a-z]*: scheduling file .file1\.txt. for addition
7558 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
7559           dotest binwrap3-2d "${testcvs} -q ci -m add" \
7560 "RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v
7561 done
7562 Checking in file1\.newbin;
7563 ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v  <--  file1\.newbin
7564 initial revision: 1\.1
7565 done
7566 RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v
7567 done
7568 Checking in file1\.txt;
7569 ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v  <--  file1\.txt
7570 initial revision: 1\.1
7571 done"
7572           cd ..
7573
7574           # Now check out the module and see which files are binary.
7575           cd ..
7576           rm -r binwrap3
7577           dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
7578           cd binwrap3
7579
7580           # Running "cvs status" and matching output is too
7581           # error-prone, too likely to falsely fail.  Instead, we'll
7582           # just grep the Entries lines:
7583
7584           dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
7585                  "/foo-b.c0/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7586
7587           dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
7588                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7589
7590           dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
7591                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
7592
7593           dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
7594                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
7595
7596           dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
7597                  "/foo-b.c1/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7598
7599           dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
7600                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7601
7602           dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
7603                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
7604
7605           dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
7606                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
7607
7608           dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
7609                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7610
7611           dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
7612                  "/foo-b.st/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7613
7614           dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
7615                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
7616
7617           dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
7618                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
7619
7620           dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
7621                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
7622
7623           dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
7624                  "/foo-t.c3/1.1.1.1/[A-Za-z0-9  :]*//"
7625
7626           dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
7627                  "/foo-b.c3/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7628
7629           dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
7630                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
7631
7632           dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
7633                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
7634
7635           dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
7636                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
7637
7638           dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
7639                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
7640
7641           dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
7642                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
7643
7644           dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
7645             "/file1.newbin/1.1/[A-Za-z0-9       :]*/-kb/"
7646           dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
7647             "/file1.txt/1.1/[A-Za-z0-9  :]*//"
7648
7649           # Restore and clean up
7650           cd ..
7651           rm -r binwrap3 CVSROOT
7652           cd ..
7653           rm -r wnt
7654           rm -rf ${CVSROOT_DIRNAME}/binwrap3
7655           CVSWRAPPERS=${CVSWRAPPERS_SAVED}
7656           ;; 
7657
7658         mwrap)
7659           # Tests of various wrappers features:
7660           # -m 'COPY' and cvs update: mwrap
7661           # -m 'COPY' and joining: mcopy
7662           # -k: binwrap, binwrap2
7663           # -t/-f: hasn't been written yet.
7664           # 
7665           # Tests of different ways of specifying wrappers:
7666           # CVSROOT/cvswrappers: mwrap
7667           # -W: binwrap, binwrap2
7668           # .cvswrappers in working directory, local: mcopy
7669           # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
7670           # CVSWRAPPERS environment variable: mcopy
7671
7672           # This test is similar to binfiles-con1; -m 'COPY' specifies
7673           # non-mergeableness the same way that -kb does.
7674
7675           # On Windows, we can't check out CVSROOT, because the case
7676           # insensitivity means that this conflicts with cvsroot.
7677           mkdir wnt
7678           cd wnt
7679
7680           dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
7681           cd CVSROOT
7682           echo "* -m 'COPY'" >>cvswrappers
7683           dotest mwrap-c2 "${testcvs} -q ci -m wrapper-mod" \
7684 "Checking in cvswrappers;
7685 ${TESTDIR}/cvsroot/CVSROOT/cvswrappers,v  <--  cvswrappers
7686 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
7687 done
7688 ${PROG} [a-z]*: Rebuilding administrative file database"
7689           cd ..
7690           mkdir m1; cd m1
7691           dotest mwrap-1 "${testcvs} -q co -l ." ''
7692           mkdir first-dir
7693           dotest mwrap-2 "${testcvs} add first-dir" \
7694 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
7695           cd first-dir
7696           touch aa
7697           dotest mwrap-3 "${testcvs} add aa" \
7698 "${PROG} [a-z]*: scheduling file .aa. for addition
7699 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7700           dotest mwrap-4 "${testcvs} -q ci -m add" \
7701 "RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
7702 done
7703 Checking in aa;
7704 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
7705 initial revision: 1\.1
7706 done"
7707           cd ../..
7708           mkdir m2; cd m2
7709           dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
7710           cd first-dir
7711           echo "changed in m2" >aa
7712           dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
7713 "Checking in aa;
7714 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
7715 new revision: 1\.2; previous revision: 1\.1
7716 done"
7717           cd ../..
7718           cd m1/first-dir
7719           echo "changed in m1" >aa
7720           dotest_fail mwrap-7 "${testcvs} -nq update" "C aa"
7721           dotest mwrap-8 "${testcvs} -q update" \
7722 "U aa
7723 ${PROG} [a-z]*: nonmergeable file needs merge
7724 ${PROG} [a-z]*: revision 1\.2 from repository is now in aa
7725 ${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1
7726 C aa"
7727           dotest mwrap-9 "cat aa" "changed in m2"
7728           dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
7729           cd ../..
7730           cd CVSROOT
7731           echo '# comment out' >cvswrappers
7732           dotest mwrap-ce "${testcvs} -q ci -m wrapper-mod" \
7733 "Checking in cvswrappers;
7734 ${TESTDIR}/cvsroot/CVSROOT/cvswrappers,v  <--  cvswrappers
7735 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
7736 done
7737 ${PROG} [a-z]*: Rebuilding administrative file database"
7738           cd ..
7739           rm -r CVSROOT
7740           rm -r m1 m2
7741           cd ..
7742           rm -r wnt
7743           rm -rf ${CVSROOT_DIRNAME}/first-dir
7744           ;;
7745
7746         info)
7747           # Administrative file tests.
7748           # Here is a list of where each administrative file is tested:
7749           # loginfo: info
7750           # modules: modules, modules2, modules3
7751           # cvsignore: ignore
7752           # verifymsg: info
7753           # cvswrappers: mwrap
7754           # config: config
7755
7756           # On Windows, we can't check out CVSROOT, because the case
7757           # insensitivity means that this conflicts with cvsroot.
7758           mkdir wnt
7759           cd wnt
7760
7761           dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
7762           cd CVSROOT
7763           echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
7764           # The following cases test the format string substitution
7765           echo "ALL echo %{sVv} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
7766           echo "ALL echo %{v} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
7767           echo "ALL echo %s >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
7768           echo "ALL echo %{V}AX >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
7769           echo "ALL echo %sux >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
7770
7771           # Might be nice to move this to crerepos tests; it should
7772           # work to create a loginfo file if you didn't create one
7773           # with "cvs init".
7774           : dotest info-2 "${testcvs} add loginfo" \
7775 "${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition
7776 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
7777
7778           dotest info-3 "${testcvs} -q ci -m new-loginfo" \
7779 "Checking in loginfo;
7780 ${TESTDIR}/cvsroot/CVSROOT/loginfo,v  <--  loginfo
7781 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
7782 done
7783 ${PROG} [a-z]*: Rebuilding administrative file database"
7784           cd ..
7785
7786           mkdir ${CVSROOT_DIRNAME}/first-dir
7787           dotest info-5 "${testcvs} -q co first-dir" ''
7788           cd first-dir
7789           touch file1
7790           dotest info-6 "${testcvs} add file1" \
7791 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
7792 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
7793           echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
7794           dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
7795 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
7796 done
7797 Checking in file1;
7798 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
7799 initial revision: 1\.1
7800 done
7801 ${PROG} [a-z]*: loginfo:1: no such user variable \${=ZEE}"
7802           echo line1 >>file1
7803           dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
7804 "Checking in file1;
7805 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
7806 new revision: 1\.2; previous revision: 1\.1
7807 done"
7808           cd ..
7809           dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${TESTDIR}/cvsroot="
7810           dotest info-10 "cat $TESTDIR/testlog2" 'first-dir file1,NONE,1.1
7811 first-dir 1.1
7812 first-dir file1
7813 first-dir NONEAX
7814 first-dir file1ux
7815 first-dir file1,1.1,1.2
7816 first-dir 1.2
7817 first-dir file1
7818 first-dir 1.1AX
7819 first-dir file1ux'
7820
7821           cd CVSROOT
7822           echo '# do nothing' >loginfo
7823           dotest info-11 "${testcvs} -q -s ZEE=garbage ci -m nuke-loginfo" \
7824 "Checking in loginfo;
7825 ${TESTDIR}/cvsroot/CVSROOT/loginfo,v  <--  loginfo
7826 new revision: 1\.[0-9]; previous revision: 1\.[0-9]
7827 done
7828 ${PROG} [a-z]*: Rebuilding administrative file database"
7829
7830           # Now test verifymsg
7831           cat >${TESTDIR}/vscript <<EOF
7832 #!${TESTSHELL}
7833 if head -1 < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
7834     exit 0
7835 else
7836     echo "No BugId found."
7837     exit 1
7838 fi
7839 EOF
7840           chmod +x ${TESTDIR}/vscript
7841           echo "^first-dir ${TESTDIR}/vscript" >>verifymsg
7842           dotest info-v1 "${testcvs} -q ci -m add-verification" \
7843 "Checking in verifymsg;
7844 ${TESTDIR}/cvsroot/CVSROOT/verifymsg,v  <--  verifymsg
7845 new revision: 1\.2; previous revision: 1\.1
7846 done
7847 ${PROG} [a-z]*: Rebuilding administrative file database"
7848
7849           cd ../first-dir
7850           echo line2 >>file1
7851           dotest_fail info-v2 "${testcvs} -q ci -m bogus" \
7852 "No BugId found\.
7853 ${PROG} \[[a-z]* aborted\]: Message verification failed"
7854
7855           cat >${TESTDIR}/comment.tmp <<EOF
7856 BugId: 42
7857 and many more lines after it
7858 EOF
7859           dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
7860 "Checking in file1;
7861 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
7862 new revision: 1\.3; previous revision: 1\.2
7863 done"
7864           cd ..
7865           mkdir another-dir
7866           cd another-dir
7867           touch file2
7868           dotest_fail info-v4 \
7869             "${testcvs} import -m bogus first-dir/another x y" \
7870 "No BugId found\.
7871 ${PROG} \[[a-z]* aborted\]: Message verification failed"
7872           rm file2
7873           cd ..
7874           rmdir another-dir
7875
7876           cd CVSROOT
7877           echo '# do nothing' >verifymsg
7878           dotest info-cleanup-verifymsg "${testcvs} -q ci -m nuke-verifymsg" \
7879 "Checking in verifymsg;
7880 ${TESTDIR}/cvsroot/CVSROOT/verifymsg,v  <--  verifymsg
7881 new revision: 1\.[0-9]; previous revision: 1\.[0-9]
7882 done
7883 ${PROG} [a-z]*: Rebuilding administrative file database"
7884           cd ..
7885
7886           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
7887             pass info-cleanup
7888           else
7889             fail info-cleanup
7890           fi
7891           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
7892             pass info-cleanup-2
7893           else
7894             fail info-cleanup-2
7895           fi
7896           cd ..
7897           rm -r wnt
7898           rm -rf ${CVSROOT_DIRNAME}/first-dir
7899           ;;
7900
7901         config)
7902           # Tests of the CVSROOT/config file.  See the comment at the
7903           # "info" tests for a full list of administrative file tests.
7904
7905           # On Windows, we can't check out CVSROOT, because the case
7906           # insensitivity means that this conflicts with cvsroot.
7907           mkdir wnt
7908           cd wnt
7909
7910           dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
7911           cd CVSROOT
7912           echo 'bogus line' >config
7913           dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
7914 "Checking in config;
7915 ${TESTDIR}/cvsroot/CVSROOT/config,v  <--  config
7916 new revision: 1\.2; previous revision: 1\.1
7917 done
7918 ${PROG} [a-z]*: Rebuilding administrative file database"
7919           echo 'BogusOption=yes' >config
7920           dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
7921 "${PROG} [a-z]*: syntax error in ${TESTDIR}/cvsroot/CVSROOT/config: line 'bogus line' is missing '='
7922 Checking in config;
7923 ${TESTDIR}/cvsroot/CVSROOT/config,v  <--  config
7924 new revision: 1\.3; previous revision: 1\.2
7925 done
7926 ${PROG} [a-z]*: Rebuilding administrative file database"
7927           echo '# No config is a good config' > config
7928           dotest config-5 "${testcvs} -q ci -m change-to-comment" \
7929 "${PROG} [a-z]*: ${TESTDIR}/cvsroot/CVSROOT/config: unrecognized keyword 'BogusOption'
7930 Checking in config;
7931 ${TESTDIR}/cvsroot/CVSROOT/config,v  <--  config
7932 new revision: 1\.4; previous revision: 1\.3
7933 done
7934 ${PROG} [a-z]*: Rebuilding administrative file database"
7935           dotest config-6 "${testcvs} -q update" ''
7936
7937           cd ..
7938           rm -r CVSROOT
7939           cd ..
7940           rm -r wnt
7941           ;;
7942
7943         serverpatch)
7944           # Test remote CVS handling of unpatchable files.  This isn't
7945           # much of a test for local CVS.
7946           # We test this with some keyword expansion games, but the situation
7947           # also arises if the user modifies the file while CVS is running.
7948           mkdir ${CVSROOT_DIRNAME}/first-dir
7949           mkdir 1
7950           cd 1
7951           dotest serverpatch-1 "${testcvs} -q co first-dir" ''
7952
7953           cd first-dir
7954
7955           # Add a file with an RCS keyword.
7956           echo '$''Name$' > file1
7957           echo '1' >> file1
7958           dotest serverpatch-2 "${testcvs} add file1" \
7959 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
7960 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
7961
7962           dotest serverpatch-3 "${testcvs} -q commit -m add" \
7963 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
7964 done
7965 Checking in file1;
7966 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
7967 initial revision: 1\.1
7968 done"
7969
7970           # Tag the file.
7971           dotest serverpatch-4 "${testcvs} -q tag tag file1" 'T file1'
7972
7973           # Check out a tagged copy of the file.
7974           cd ../..
7975           mkdir 2
7976           cd 2
7977           dotest serverpatch-5 "${testcvs} -q co -r tag first-dir" \
7978 'U first-dir/file1'
7979
7980           # Remove the tag.  This will leave the tag string in the
7981           # expansion of the Name keyword.
7982           dotest serverpatch-6 "${testcvs} -q update -A" ''
7983
7984           # Modify and check in the first copy.
7985           cd ../1/first-dir
7986           echo '2' >> file1
7987           dotest serverpatch-7 "${testcvs} -q ci -mx file1" \
7988 "Checking in file1;
7989 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
7990 new revision: 1\.2; previous revision: 1\.1
7991 done"
7992
7993           # Now update the second copy.  When using remote CVS, the
7994           # patch will fail, forcing the file to be refetched.
7995           cd ../../2/first-dir
7996           dotest serverpatch-8 "${testcvs} -q update" \
7997 'U file1' \
7998 'P file1
7999 '"${PROG}"' [a-z]*: checksum failure after patch to ./file1; will refetch
8000 '"${PROG}"' [a-z]*: refetching unpatchable files
8001 U file1'
8002
8003           cd ../..
8004           rm -r 1 2
8005           rm -rf ${CVSROOT_DIRNAME}/first-dir
8006           ;;
8007
8008         log)
8009           # Test selecting revisions with cvs log.
8010           # See also log2 tests for more tests.
8011           # See also branches-14.3 for logging with a branch off of a branch.
8012           # See also multibranch-14 for logging with several branches off the
8013           #   same branchpoint.
8014           # Tests of each option to cvs log:
8015           #   -h: admin-19a-log
8016           #   -N: log, log2, admin-19a-log
8017           #   -b, -r: log
8018           #   -d: rcs
8019
8020           # Check in a file with a few revisions and branches.
8021           mkdir ${CVSROOT_DIRNAME}/first-dir
8022           dotest log-1 "${testcvs} -q co first-dir" ''
8023           cd first-dir
8024           echo 'first revision' > file1
8025           dotest log-2 "${testcvs} add file1" \
8026 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
8027 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
8028
8029           # While we're at it, check multi-line comments, input from file,
8030           # and trailing whitespace trimming
8031           echo 'line 1     '     >${TESTDIR}/comment.tmp
8032           echo '     '          >>${TESTDIR}/comment.tmp
8033           echo 'line 2  '       >>${TESTDIR}/comment.tmp
8034           echo '        '       >>${TESTDIR}/comment.tmp
8035           echo '          '     >>${TESTDIR}/comment.tmp
8036           dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
8037 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8038 done
8039 Checking in file1;
8040 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8041 initial revision: 1\.1
8042 done"
8043           rm -f ${TESTDIR}/comment.tmp
8044
8045           echo 'second revision' > file1
8046           dotest log-4 "${testcvs} -q ci -m2 file1" \
8047 "Checking in file1;
8048 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8049 new revision: 1\.2; previous revision: 1\.1
8050 done"
8051
8052           dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
8053
8054           echo 'third revision' > file1
8055           dotest log-6 "${testcvs} -q ci -m3 file1" \
8056 "Checking in file1;
8057 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8058 new revision: 1\.3; previous revision: 1\.2
8059 done"
8060
8061           dotest log-7 "${testcvs} -q update -r branch" '[UP] file1'
8062
8063           echo 'first branch revision' > file1
8064           dotest log-8 "${testcvs} -q ci -m1b file1" \
8065 "Checking in file1;
8066 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8067 new revision: 1\.2\.2\.1; previous revision: 1\.2
8068 done"
8069
8070           dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
8071
8072           echo 'second branch revision' > file1
8073           dotest log-10 "${testcvs} -q ci -m2b file1" \
8074 "Checking in file1;
8075 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8076 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
8077 done"
8078
8079           # Set up a bunch of shell variables to make the later tests
8080           # easier to describe.=
8081           log_header="
8082 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8083 Working file: file1
8084 head: 1\.3
8085 branch:
8086 locks: strict
8087 access list:"
8088           log_tags='symbolic names:
8089         tag: 1\.2\.2\.1
8090         branch: 1\.2\.0\.2'
8091           log_header2='keyword substitution: kv'
8092           log_dash='----------------------------
8093 revision'
8094           log_date="date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;"
8095           log_lines="  lines: ${PLUS}1 -1"
8096           log_rev1="${log_dash} 1\.1
8097 ${log_date}
8098 line 1
8099
8100 line 2"
8101           log_rev2="${log_dash} 1\.2
8102 ${log_date}${log_lines}
8103 branches:  1\.2\.2;
8104 2"
8105           log_rev3="${log_dash} 1\.3
8106 ${log_date}${log_lines}
8107 3"
8108           log_rev1b="${log_dash} 1\.2\.2\.1
8109 ${log_date}${log_lines}
8110 1b"
8111           log_rev2b="${log_dash} 1\.2\.2\.2
8112 ${log_date}${log_lines}
8113 2b"
8114           log_trailer='============================================================================='
8115
8116           # Now, finally, test the log output.
8117
8118           dotest log-11 "${testcvs} log file1" \
8119 "${log_header}
8120 ${log_tags}
8121 ${log_header2}
8122 total revisions: 5;     selected revisions: 5
8123 description:
8124 ${log_rev3}
8125 ${log_rev2}
8126 ${log_rev1}
8127 ${log_rev2b}
8128 ${log_rev1b}
8129 ${log_trailer}"
8130
8131           dotest log-12 "${testcvs} log -N file1" \
8132 "${log_header}
8133 ${log_header2}
8134 total revisions: 5;     selected revisions: 5
8135 description:
8136 ${log_rev3}
8137 ${log_rev2}
8138 ${log_rev1}
8139 ${log_rev2b}
8140 ${log_rev1b}
8141 ${log_trailer}"
8142
8143           dotest log-13 "${testcvs} log -b file1" \
8144 "${log_header}
8145 ${log_tags}
8146 ${log_header2}
8147 total revisions: 5;     selected revisions: 3
8148 description:
8149 ${log_rev3}
8150 ${log_rev2}
8151 ${log_rev1}
8152 ${log_trailer}"
8153
8154           dotest log-14 "${testcvs} log -r file1" \
8155 "${log_header}
8156 ${log_tags}
8157 ${log_header2}
8158 total revisions: 5;     selected revisions: 1
8159 description:
8160 ${log_rev3}
8161 ${log_trailer}"
8162
8163           dotest log-15 "${testcvs} log -r1.2 file1" \
8164 "${log_header}
8165 ${log_tags}
8166 ${log_header2}
8167 total revisions: 5;     selected revisions: 1
8168 description:
8169 ${log_rev2}
8170 ${log_trailer}"
8171
8172           dotest log-16 "${testcvs} log -r1.2.2 file1" \
8173 "${log_header}
8174 ${log_tags}
8175 ${log_header2}
8176 total revisions: 5;     selected revisions: 2
8177 description:
8178 ${log_rev2b}
8179 ${log_rev1b}
8180 ${log_trailer}"
8181
8182           # This test would fail with the old invocation of rlog, but it
8183           # works with the builtin log support.
8184           dotest log-17 "${testcvs} log -rbranch file1" \
8185 "${log_header}
8186 ${log_tags}
8187 ${log_header2}
8188 total revisions: 5;     selected revisions: 2
8189 description:
8190 ${log_rev2b}
8191 ${log_rev1b}
8192 ${log_trailer}"
8193
8194           dotest log-18 "${testcvs} log -r1.2.2. file1" \
8195 "${log_header}
8196 ${log_tags}
8197 ${log_header2}
8198 total revisions: 5;     selected revisions: 1
8199 description:
8200 ${log_rev2b}
8201 ${log_trailer}"
8202
8203           # This test would fail with the old invocation of rlog, but it
8204           # works with the builtin log support.
8205           dotest log-19 "${testcvs} log -rbranch. file1" \
8206 "${log_header}
8207 ${log_tags}
8208 ${log_header2}
8209 total revisions: 5;     selected revisions: 1
8210 description:
8211 ${log_rev2b}
8212 ${log_trailer}"
8213
8214           dotest log-20 "${testcvs} log -r1.2: file1" \
8215 "${log_header}
8216 ${log_tags}
8217 ${log_header2}
8218 total revisions: 5;     selected revisions: 2
8219 description:
8220 ${log_rev3}
8221 ${log_rev2}
8222 ${log_trailer}"
8223
8224           dotest log-21 "${testcvs} log -r:1.2 file1" \
8225 "${log_header}
8226 ${log_tags}
8227 ${log_header2}
8228 total revisions: 5;     selected revisions: 2
8229 description:
8230 ${log_rev2}
8231 ${log_rev1}
8232 ${log_trailer}"
8233
8234           dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
8235 "${log_header}
8236 ${log_tags}
8237 ${log_header2}
8238 total revisions: 5;     selected revisions: 2
8239 description:
8240 ${log_rev2}
8241 ${log_rev1}
8242 ${log_trailer}"
8243
8244           dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
8245 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8246 done"
8247           dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
8248 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8249 done"
8250           dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
8251 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8252 deleting revision 1\.2\.2\.2
8253 done"
8254           dotest log-o3 "${testcvs} log file1" \
8255 "${log_header}
8256 ${log_tags}
8257 ${log_header2}
8258 total revisions: 4;     selected revisions: 4
8259 description:
8260 ${log_rev3}
8261 ${log_rev2}
8262 ${log_rev1}
8263 ${log_rev1b}
8264 ${log_trailer}"
8265           dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
8266 "first branch revision"
8267           cd ..
8268           rm -r first-dir
8269           rm -rf ${CVSROOT_DIRNAME}/first-dir
8270           ;;
8271
8272         log2)
8273           # More "cvs log" tests, for example the file description.
8274
8275           # Check in a file
8276           mkdir ${CVSROOT_DIRNAME}/first-dir
8277           dotest log2-1 "${testcvs} -q co first-dir" ''
8278           cd first-dir
8279           echo 'first revision' > file1
8280           dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
8281 "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
8282 '"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
8283           dotest log2-3 "${testcvs} -q commit -m 1" \
8284 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8285 done
8286 Checking in file1;
8287 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8288 initial revision: 1\.1
8289 done"
8290           # Setting the file description with add -m doesn't yet work
8291           # client/server, so skip log2-4 for remote.
8292           if test "x$remote" = xno; then
8293
8294           dotest log2-4 "${testcvs} log -N file1" "
8295 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8296 Working file: file1
8297 head: 1\.1
8298 branch:
8299 locks: strict
8300 access list:
8301 keyword substitution: kv
8302 total revisions: 1;     selected revisions: 1
8303 description:
8304 file1-is-for-testing
8305 ----------------------------
8306 revision 1\.1
8307 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8308 1
8309 ============================================================================="
8310
8311           fi # end of tests skipped for remote
8312
8313           dotest log2-5 "${testcvs} admin -t-change-description file1" \
8314 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8315 done"
8316           dotest log2-6 "${testcvs} log -N file1" "
8317 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8318 Working file: file1
8319 head: 1\.1
8320 branch:
8321 locks: strict
8322 access list:
8323 keyword substitution: kv
8324 total revisions: 1;     selected revisions: 1
8325 description:
8326 change-description
8327 ----------------------------
8328 revision 1\.1
8329 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8330 1
8331 ============================================================================="
8332
8333           # I believe that in Real Life (TM), this is broken for remote.
8334           # That is, the filename in question must be the filename of a
8335           # file on the server.  It only happens to work here because the
8336           # client machine and the server machine are one and the same.
8337           echo 'longer description' >${TESTDIR}/descrip
8338           echo 'with two lines' >>${TESTDIR}/descrip
8339           dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
8340 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8341 done"
8342           dotest log2-8 "${testcvs} log -N file1" "
8343 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8344 Working file: file1
8345 head: 1\.1
8346 branch:
8347 locks: strict
8348 access list:
8349 keyword substitution: kv
8350 total revisions: 1;     selected revisions: 1
8351 description:
8352 longer description
8353 with two lines
8354 ----------------------------
8355 revision 1\.1
8356 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8357 1
8358 ============================================================================="
8359
8360           # Reading the description from stdin is broken for remote.
8361           # See comments in cvs.texinfo for a few more notes on this.
8362           if test "x$remote" = xno; then
8363
8364             if echo change from stdin | ${testcvs} admin -t -q file1
8365             then
8366               pass log2-9
8367             else
8368               fail log2-9
8369             fi
8370             dotest log2-10 "${testcvs} log -N file1" "
8371 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8372 Working file: file1
8373 head: 1\.1
8374 branch:
8375 locks: strict
8376 access list:
8377 keyword substitution: kv
8378 total revisions: 1;     selected revisions: 1
8379 description:
8380 change from stdin
8381 ----------------------------
8382 revision 1\.1
8383 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8384 1
8385 ============================================================================="
8386
8387           fi # end of tests skipped for remote
8388
8389           cd ..
8390           rm ${TESTDIR}/descrip
8391           rm -r first-dir
8392           rm -rf ${CVSROOT_DIRNAME}/first-dir
8393
8394           ;;
8395
8396         ann)
8397           # Tests of "cvs annotate".  See also basica-10.
8398           mkdir 1; cd 1
8399           dotest ann-1 "${testcvs} -q co -l ." ''
8400           mkdir first-dir
8401           dotest ann-2 "${testcvs} add first-dir" \
8402 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
8403           cd first-dir
8404           cat >file1 <<EOF
8405 this
8406 is
8407 the
8408 ancestral
8409 file
8410 EOF
8411           dotest ann-3 "${testcvs} add file1" \
8412 "${PROG} [a-z]*: scheduling file .file1. for addition
8413 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8414           dotest ann-4 "${testcvs} -q ci -m add file1" \
8415 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8416 done
8417 Checking in file1;
8418 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8419 initial revision: 1\.1
8420 done"
8421           cat >file1 <<EOF
8422 this
8423 is
8424 a
8425 file
8426
8427 with
8428 a
8429 blank
8430 line
8431 EOF
8432           dotest ann-5 "${testcvs} -q ci -m modify file1" \
8433 "Checking in file1;
8434 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8435 new revision: 1\.2; previous revision: 1\.1
8436 done"
8437           dotest ann-6 "${testcvs} -q tag -b br" "T file1"
8438           cat >file1 <<EOF
8439 this
8440 is
8441 a
8442 trunk file
8443
8444 with
8445 a
8446 blank
8447 line
8448 EOF
8449           dotest ann-7 "${testcvs} -q ci -m modify file1" \
8450 "Checking in file1;
8451 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8452 new revision: 1\.3; previous revision: 1\.2
8453 done"
8454           dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
8455           cat >file1 <<EOF
8456 this
8457 is
8458 a
8459 file
8460
8461 with
8462 a
8463 blank
8464 line
8465 and some
8466 branched content
8467 EOF
8468           dotest ann-9 "${testcvs} -q ci -m modify" \
8469 "Checking in file1;
8470 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8471 new revision: 1\.2\.2\.1; previous revision: 1\.2
8472 done"
8473           # Note that this annotates the trunk despite the presence
8474           # of a sticky tag in the current directory.  This is
8475           # fairly bogus, but it is the longstanding behavior for
8476           # whatever that is worth.
8477           dotest ann-10 "${testcvs} ann" \
8478 "Annotations for file1
8479 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
8480 1\.1          (${username} *[0-9a-zA-Z-]*): this
8481 1\.1          (${username} *[0-9a-zA-Z-]*): is
8482 1\.2          (${username} *[0-9a-zA-Z-]*): a
8483 1\.3          (${username} *[0-9a-zA-Z-]*): trunk file
8484 1\.2          (${username} *[0-9a-zA-Z-]*): 
8485 1\.2          (${username} *[0-9a-zA-Z-]*): with
8486 1\.2          (${username} *[0-9a-zA-Z-]*): a
8487 1\.2          (${username} *[0-9a-zA-Z-]*): blank
8488 1\.2          (${username} *[0-9a-zA-Z-]*): line"
8489           dotest ann-11 "${testcvs} ann -r br" \
8490 "Annotations for file1
8491 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
8492 1\.1          (${username} *[0-9a-zA-Z-]*): this
8493 1\.1          (${username} *[0-9a-zA-Z-]*): is
8494 1\.2          (${username} *[0-9a-zA-Z-]*): a
8495 1\.1          (${username} *[0-9a-zA-Z-]*): file
8496 1\.2          (${username} *[0-9a-zA-Z-]*): 
8497 1\.2          (${username} *[0-9a-zA-Z-]*): with
8498 1\.2          (${username} *[0-9a-zA-Z-]*): a
8499 1\.2          (${username} *[0-9a-zA-Z-]*): blank
8500 1\.2          (${username} *[0-9a-zA-Z-]*): line
8501 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
8502 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
8503
8504           cd ../..
8505           rm -r 1
8506           rm -rf ${CVSROOT_DIRNAME}/first-dir
8507           ;;
8508
8509         crerepos)
8510           # Various tests relating to creating repositories, operating
8511           # on repositories created with old versions of CVS, etc.
8512
8513           # Because this test is all about -d options and such, it
8514           # at least to some extent needs to be different for remote vs.
8515           # local.
8516           if test "x$remote" = "xno"; then
8517
8518             # First, if the repository doesn't exist at all...
8519             dotest_fail crerepos-1 \
8520 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
8521 "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
8522             mkdir crerepos
8523
8524             # The repository exists but CVSROOT doesn't.
8525             dotest_fail crerepos-2 \
8526 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
8527 "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
8528             mkdir crerepos/CVSROOT
8529
8530             # Checkout of nonexistent module
8531             dotest_fail crerepos-3 \
8532 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
8533 "${PROG} [a-z]*: cannot find module .cvs-sanity. - ignored"
8534
8535             # Now test that CVS works correctly without a modules file
8536             # or any of that other stuff.  In particular, it *must*
8537             # function if administrative files added to CVS recently (since
8538             # CVS 1.3) do not exist, because the repository might have
8539             # been created with an old version of CVS.
8540             mkdir tmp; cd tmp
8541             dotest crerepos-4 \
8542 "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
8543 ''
8544             if echo yes | \
8545 ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
8546               pass crerepos-5
8547             else
8548               fail crerepos-5
8549             fi
8550             rm -r CVS
8551             cd ..
8552             # The directory tmp should be empty
8553             dotest crerepos-6 "rmdir tmp" ''
8554
8555             CREREPOS_ROOT=${TESTDIR}/crerepos
8556
8557           else
8558             # For remote, just create the repository.  We don't yet do
8559             # the various other tests above for remote but that should be
8560             # changed.
8561             mkdir crerepos
8562             mkdir crerepos/CVSROOT
8563
8564             CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos
8565
8566           fi
8567
8568           if test "x$remote" = "xno"; then
8569             # Test that CVS rejects a relative path in CVSROOT.
8570             mkdir 1; cd 1
8571             dotest_fail crerepos-6a "${testcvs} -q -d ../crerepos get ." \
8572 "${PROG} \[[a-z]* aborted\]: CVSROOT ../crerepos must be an absolute pathname"
8573             cd ..
8574             rm -r 1
8575
8576             mkdir 1; cd 1
8577             dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
8578 "${PROG} \[[a-z]* aborted\]: CVSROOT crerepos must be an absolute pathname"
8579             cd ..
8580             rm -r 1
8581           else # remote
8582             # Test that CVS rejects a relative path in CVSROOT.
8583             mkdir 1; cd 1
8584             dotest_fail crerepos-6a \
8585 "${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
8586 "Root ../crerepos must be an absolute pathname"
8587             cd ..
8588             rm -r 1
8589
8590             mkdir 1; cd 1
8591             dotest_fail crerepos-6b \
8592 "${testcvs} -d :ext:`hostname`:crerepos init" \
8593 "Root crerepos must be an absolute pathname"
8594             cd ..
8595             rm -r 1
8596           fi # end of tests to be skipped for remote
8597
8598           # CVS better not create a history file--if the administrator 
8599           # doesn't need it and wants to save on disk space, they just
8600           # delete it.
8601           dotest_fail crerepos-7 \
8602 "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
8603
8604           # Now test mixing repositories.  This kind of thing tends to
8605           # happen accidentally when people work with several repositories.
8606           mkdir 1; cd 1
8607           dotest crerepos-8 "${testcvs} -q co -l ." ''
8608           mkdir first-dir
8609           dotest crerepos-9 "${testcvs} add first-dir" \
8610 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
8611           cd first-dir
8612           touch file1
8613           dotest crerepos-10 "${testcvs} add file1" \
8614 "${PROG} [a-z]*: scheduling file .file1. for addition
8615 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8616           dotest crerepos-11 "${testcvs} -q ci -m add-it" \
8617 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8618 done
8619 Checking in file1;
8620 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
8621 initial revision: 1\.1
8622 done"
8623           cd ../..
8624           rm -r 1
8625
8626           mkdir 1; cd 1
8627           dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
8628           mkdir crerepos-dir
8629           dotest crerepos-13 "${testcvs} add crerepos-dir" \
8630 "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
8631           cd crerepos-dir
8632           touch cfile
8633           dotest crerepos-14 "${testcvs} add cfile" \
8634 "${PROG} [a-z]*: scheduling file .cfile. for addition
8635 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8636           dotest crerepos-15 "${testcvs} -q ci -m add-it" \
8637 "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
8638 done
8639 Checking in cfile;
8640 ${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
8641 initial revision: 1\.1
8642 done"
8643           cd ../..
8644           rm -r 1
8645
8646           mkdir 1; cd 1
8647           dotest crerepos-16 "${testcvs} co first-dir" \
8648 "${PROG} [a-z]*: Updating first-dir
8649 U first-dir/file1"
8650           dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
8651 "${PROG} [a-z]*: Updating crerepos-dir
8652 U crerepos-dir/cfile"
8653
8654           if test x`cat CVS/Repository` = x.; then
8655             # RELATIVE_REPOS
8656             # Fatal error so that we don't go traipsing through the
8657             # directories which happen to have the same names from the
8658             # wrong repository.
8659             dotest_fail crerepos-18 "${testcvs} -q update" \
8660 "${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/crerepos-dir: .*" ''
8661           else
8662             if test "$remote" = no; then
8663               # The lack of an error doesn't mean CVS is really
8664               # working (things are getting logged to the wrong
8665               # history file and such).
8666               dotest crerepos-18 "${testcvs} -q update" ''
8667             else
8668               # Fatal error so that we don't go traipsing through the
8669               # directories which happen to have the same names from the
8670               # wrong repository.
8671               dotest_fail crerepos-18 "${testcvs} -q update" \
8672 "protocol error: directory .${TESTDIR}/crerepos/crerepos-dir. not within root .${TESTDIR}/cvsroot."
8673             fi
8674           fi
8675
8676           cd ..
8677
8678           rm -r 1
8679           rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
8680           ;;
8681
8682         rcs)
8683           # Test ability to import an RCS file.  Note that this format
8684           # is fixed--files written by RCS5, and other software which
8685           # implements this format, will be out there "forever" and
8686           # CVS must always be able to import such files.
8687
8688           # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
8689
8690           mkdir ${CVSROOT_DIRNAME}/first-dir
8691
8692           # Currently the way to import an RCS file is to copy it
8693           # directly into the repository.
8694           #
8695           # This file was written by RCS 5.7, and then the dates were
8696           # hacked so that we test year 2000 stuff.  Note also that
8697           # "author" names are just strings, as far as importing
8698           # RCS files is concerned--they need not correspond to user
8699           # IDs on any particular system.
8700           #
8701           # I also tried writing a file with the RCS supplied with
8702           # HPUX A.09.05.  According to "man rcsintro" this is
8703           # "Revision Number: 3.0; Release Date: 83/05/11".  There
8704           # were a few minor differences like whitespace but at least
8705           # in simple cases like this everything else seemed the same
8706           # as the file written by RCS 5.7 (so I won't try to make it
8707           # a separate test case).
8708
8709           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
8710 head    1.3;
8711 access;
8712 symbols;
8713 locks; strict;
8714 comment @# @;
8715
8716
8717 1.3
8718 date    2000.11.24.15.58.37;    author kingdon; state Exp;
8719 branches;
8720 next    1.2;
8721
8722 1.2
8723 date    96.11.24.15.57.41;      author kingdon; state Exp;
8724 branches;
8725 next    1.1;
8726
8727 1.1
8728 date    96.11.24.15.56.05;      author kingdon; state Exp;
8729 branches;
8730 next    ;
8731
8732
8733 desc
8734 @file1 is for testing CVS
8735 @
8736
8737
8738 1.3
8739 log
8740 @delete second line; modify twelfth line
8741 @
8742 text
8743 @This is the first line
8744 This is the third line
8745 This is the fourth line
8746 This is the fifth line
8747 This is the sixth line
8748 This is the seventh line
8749 This is the eighth line
8750 This is the ninth line
8751 This is the tenth line
8752 This is the eleventh line
8753 This is the twelfth line (and what a line it is)
8754 This is the thirteenth line
8755 @
8756
8757
8758 1.2
8759 log
8760 @add more lines
8761 @
8762 text
8763 @a1 1
8764 This is the second line
8765 d11 1
8766 a11 1
8767 This is the twelfth line
8768 @
8769
8770
8771 1.1
8772 log
8773 @add file1
8774 @
8775 text
8776 @d2 12
8777 @
8778 EOF
8779           dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
8780           cd first-dir
8781           dotest rcs-2 "${testcvs} -q log" "
8782 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8783 Working file: file1
8784 head: 1\.3
8785 branch:
8786 locks: strict
8787 access list:
8788 symbolic names:
8789 keyword substitution: kv
8790 total revisions: 3;     selected revisions: 3
8791 description:
8792 file1 is for testing CVS
8793 ----------------------------
8794 revision 1\.3
8795 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
8796 delete second line; modify twelfth line
8797 ----------------------------
8798 revision 1\.2
8799 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
8800 add more lines
8801 ----------------------------
8802 revision 1\.1
8803 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
8804 add file1
8805 ============================================================================="
8806
8807           # Note that the dates here are chosen so that (a) we test
8808           # at least one date after 2000, (b) we will notice if the
8809           # month and day are getting mixed up with each other.
8810           # TODO: also test that year isn't getting mixed up with month
8811           # or day, for example 01-02-03.
8812
8813           # ISO8601 format.  There are many, many, other variations
8814           # specified by ISO8601 which we should be testing too.
8815           dotest rcs-3 "${testcvs} -q log -d 1996-12-11<" "
8816 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8817 Working file: file1
8818 head: 1\.3
8819 branch:
8820 locks: strict
8821 access list:
8822 symbolic names:
8823 keyword substitution: kv
8824 total revisions: 3;     selected revisions: 1
8825 description:
8826 file1 is for testing CVS
8827 ----------------------------
8828 revision 1\.3
8829 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
8830 delete second line; modify twelfth line
8831 ============================================================================="
8832
8833           # RFC822 format (as amended by RFC1123).
8834           if ${testcvs} -q log -d '<3 Apr 2000 00:00' >${TESTDIR}/rcs4.tmp
8835           then
8836             dotest rcs-4 "cat ${TESTDIR}/rcs4.tmp" "
8837 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
8838 Working file: file1
8839 head: 1\.3
8840 branch:
8841 locks: strict
8842 access list:
8843 symbolic names:
8844 keyword substitution: kv
8845 total revisions: 3;     selected revisions: 2
8846 description:
8847 file1 is for testing CVS
8848 ----------------------------
8849 revision 1\.2
8850 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
8851 add more lines
8852 ----------------------------
8853 revision 1\.1
8854 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
8855 add file1
8856 ============================================================================="
8857           else
8858             fail rcs-4
8859           fi
8860
8861           # OK, here is another one.  This one was written by hand based on
8862           # doc/RCSFILES and friends.
8863           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
8864 head                            1.5                 ;
8865      branch        1.2.6;
8866 access ;
8867 symbols;
8868 locks;
8869 testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
8870 1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
8871 1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
8872 1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
8873 1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
8874 1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
8875 1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
8876 desc @@
8877 1.5 log @@ newphrase1; newphrase2 42; text @head revision@
8878 1.4 log @@ text @d1 1
8879 a1 1
8880 new year revision@
8881 1.3 log @@ text @d1 1
8882 a1 1
8883 old year revision@
8884 1.2 log @@ text @d1 1
8885 a1 1
8886 mid revision@ 1.1
8887
8888 log           @@ text @d1 1
8889 a1 1
8890 start revision@
8891 1.2.6.1 log @@ text @d1 1
8892 a1 1
8893 branch revision@
8894 EOF
8895           # First test the default branch.
8896           dotest rcs-5 "${testcvs} -q update file2" "U file2"
8897           dotest rcs-6 "cat file2" "branch revision"
8898
8899           # Now get rid of the default branch, it will get in the way.
8900           dotest rcs-7 "${testcvs} admin -b file2" \
8901 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
8902 done"
8903           # But we do want to make sure that "cvs admin" leaves the newphrases
8904           # in the file.
8905           # The extra whitespace regexps are for the RCS library, which does
8906           # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
8907           dotest rcs-8 \
8908 "grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
8909 "testofanewphrase[       ][     ]*@without newphrase we'd have trouble extending @@ all@[        ]*;"
8910           # The easiest way to test for newphrases in deltas and deltatexts
8911           # is to just look at the whole file, I guess.
8912           dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
8913 "head   1\.5;
8914 access;
8915 symbols;
8916 locks;
8917
8918 testofanewphrase        @without newphrase we'd have trouble extending @@ all@;
8919
8920 1\.5
8921 date    71\.01\.01\.01\.00\.00; author joe;     state bogus;
8922 branches;
8923 next    1\.4;
8924
8925 1\.4
8926 date    71\.01\.01\.00\.00\.05; author joe;     state bogus;
8927 branches;
8928 next    1\.3;
8929
8930 1\.3
8931 date    70\.12\.31\.15\.00\.05; author joe;     state bogus;
8932 branches;
8933 next    1\.2;
8934
8935 1\.2
8936 date    70\.12\.31\.12\.15\.05; author me;      state bogus;
8937 branches
8938         1\.2\.6\.1;
8939 next    1\.1;
8940
8941 1\.1
8942 date    70\.12\.31\.11\.00\.05; author joe;     state bogus;
8943 branches;
8944 next    ;
8945 newph   ;
8946
8947 1\.2\.6\.1
8948 date    71\.01\.01\.08\.00\.05; author joe;     state Exp;
8949 branches;
8950 next    ;
8951
8952
8953 desc
8954 @@
8955
8956
8957 1\.5
8958 log
8959 @@
8960 newphrase1      ;
8961 newphrase2      42;
8962 text
8963 @head revision@
8964
8965
8966 1\.4
8967 log
8968 @@
8969 text
8970 @d1 1
8971 a1 1
8972 new year revision@
8973
8974
8975 1\.3
8976 log
8977 @@
8978 text
8979 @d1 1
8980 a1 1
8981 old year revision@
8982
8983
8984 1\.2
8985 log
8986 @@
8987 text
8988 @d1 1
8989 a1 1
8990 mid revision@
8991
8992
8993 1\.1
8994 log
8995 @@
8996 text
8997 @d1 1
8998 a1 1
8999 start revision@
9000
9001
9002 1\.2\.6\.1
9003 log
9004 @@
9005 text
9006 @d1 1
9007 a1 1
9008 branch revision@"
9009
9010           # For remote, the "update -p -D" usage seems not to work.
9011           # I'm not sure what is going on.
9012           if test "x$remote" = "xno"; then
9013
9014           if ${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2 \
9015               >${TESTDIR}/rcs4.tmp
9016           then
9017             dotest rcs-9 "cat ${TESTDIR}/rcs4.tmp" "start revision"
9018           else
9019             fail rcs-9
9020           fi
9021
9022           if ${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2 \
9023               >${TESTDIR}/rcs4.tmp
9024           then
9025             dotest rcs-10 "cat ${TESTDIR}/rcs4.tmp" "mid revision"
9026           else
9027             fail rcs-10
9028           fi
9029
9030           if ${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2 \
9031               >${TESTDIR}/rcs4.tmp
9032           then
9033             dotest rcs-11 "cat ${TESTDIR}/rcs4.tmp" "new year revision"
9034           else
9035             fail rcs-11
9036           fi
9037
9038           # Same test as rcs-10, but with am/pm.
9039           if ${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2 \
9040               >${TESTDIR}/rcs4.tmp
9041           then
9042             dotest rcs-12 "cat ${TESTDIR}/rcs4.tmp" "mid revision"
9043           else
9044             fail rcs-12
9045           fi
9046
9047           # Same test as rcs-11, but with am/pm.
9048           if ${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2 \
9049               >${TESTDIR}/rcs4.tmp
9050           then
9051             dotest rcs-13 "cat ${TESTDIR}/rcs4.tmp" "new year revision"
9052           else
9053             fail rcs-13
9054           fi
9055
9056           fi # end of tests skipped for remote
9057
9058           # OK, now make sure cvs log doesn't have any trouble with the
9059           # newphrases and such.
9060           dotest rcs-14 "${testcvs} -q log file2" "
9061 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
9062 Working file: file2
9063 head: 1\.5
9064 branch:
9065 locks:
9066 access list:
9067 symbolic names:
9068 keyword substitution: kv
9069 total revisions: 6;     selected revisions: 6
9070 description:
9071 ----------------------------
9072 revision 1\.5
9073 date: 1971/01/01 01:00:00;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
9074 \*\*\* empty log message \*\*\*
9075 ----------------------------
9076 revision 1\.4
9077 date: 1971/01/01 00:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
9078 \*\*\* empty log message \*\*\*
9079 ----------------------------
9080 revision 1\.3
9081 date: 1970/12/31 15:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
9082 \*\*\* empty log message \*\*\*
9083 ----------------------------
9084 revision 1\.2
9085 date: 1970/12/31 12:15:05;  author: me;  state: bogus;  lines: ${PLUS}1 -1
9086 branches:  1\.2\.6;
9087 \*\*\* empty log message \*\*\*
9088 ----------------------------
9089 revision 1\.1
9090 date: 1970/12/31 11:00:05;  author: joe;  state: bogus;
9091 \*\*\* empty log message \*\*\*
9092 ----------------------------
9093 revision 1\.2\.6\.1
9094 date: 1971/01/01 08:00:05;  author: joe;  state: Exp;  lines: ${PLUS}1 -1
9095 \*\*\* empty log message \*\*\*
9096 ============================================================================="
9097           cd ..
9098
9099           rm -r first-dir ${TESTDIR}/rcs4.tmp
9100           rm -rf ${CVSROOT_DIRNAME}/first-dir
9101           ;;
9102
9103         big)
9104
9105           # Test ability to operate on big files.  Intention is to
9106           # test various realloc'ing code in RCS_deltas, rcsgetkey,
9107           # etc.  "big" is currently defined to be 1000 lines (64000
9108           # bytes), which in terms of files that users will use is not
9109           # large, merely average, but my reasoning is that this
9110           # should be big enough to make sure realloc'ing is going on
9111           # and that raising it a lot would start to stress resources
9112           # on machines which run the tests, without any significant
9113           # benefit.
9114
9115           mkdir ${CVSROOT_DIRNAME}/first-dir
9116           dotest big-1 "${testcvs} -q co first-dir" ''
9117           cd first-dir
9118           for i in 0 1 2 3 4 5 6 7 8 9; do
9119             for j in 0 1 2 3 4 5 6 7 8 9; do
9120               for k in 0 1 2 3 4 5 6 7 8 9; do
9121                 echo \
9122 "This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
9123               done
9124             done
9125           done
9126           dotest big-2 "${testcvs} add file1" \
9127 "${PROG} [a-z]*: scheduling file .file1. for addition
9128 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9129           dotest big-3 "${testcvs} -q ci -m add" \
9130 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
9131 done
9132 Checking in file1;
9133 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9134 initial revision: 1\.1
9135 done"
9136           cd ..
9137           mkdir 2
9138           cd 2
9139           dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
9140           cd ../first-dir
9141           echo "add a line to the end" >>file1
9142           dotest big-5 "${testcvs} -q ci -m modify" \
9143 "Checking in file1;
9144 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9145 new revision: 1\.2; previous revision: 1\.1
9146 done"
9147           cd ../2/first-dir
9148           # The idea here is particularly to test the Rcs-diff response
9149           # and the reallocing thereof, for remote.
9150           dotest big-6 "${testcvs} -q update" "[UP] file1"
9151           cd ../..
9152
9153           if test "$keep" = yes; then
9154             echo Keeping ${TESTDIR} and exiting due to --keep
9155             exit 0
9156           fi
9157
9158           rm -r first-dir 2
9159           rm -rf ${CVSROOT_DIRNAME}/first-dir
9160           ;;
9161
9162         modes)
9163           # Test repository permissions (CVSUMASK and so on).
9164           # Although the tests in this section "cheat" by testing
9165           # repository permissions, which are sort of not a user-visible
9166           # sort of thing, the modes do have user-visible consequences,
9167           # such as whether a second user can check out the files.  But
9168           # it would be awkward to test the consequences, so we don't.
9169
9170           # Solaris /bin/sh doesn't support export -n.  I'm not sure
9171           # what we can do about this, other than hope that whoever
9172           # is running the tests doesn't have CVSUMASK set.
9173           #export -n CVSUMASK # if unset, defaults to 002
9174
9175           umask 077
9176           mkdir 1; cd 1
9177           dotest modes-1 "${testcvs} -q co -l ." ''
9178           mkdir first-dir
9179           dotest modes-2 "${testcvs} add first-dir" \
9180 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
9181           cd first-dir
9182           touch aa
9183           dotest modes-3 "${testcvs} add aa" \
9184 "${PROG} [a-z]*: scheduling file .aa. for addition
9185 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9186           dotest modes-4 "${testcvs} -q ci -m add" \
9187 "RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
9188 done
9189 Checking in aa;
9190 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
9191 initial revision: 1\.1
9192 done"
9193           dotest modes-5 "ls -l ${TESTDIR}/cvsroot/first-dir/aa,v" \
9194 "-r--r--r-- .*"
9195
9196           # Test for whether we can set the execute bit.
9197           chmod +x aa
9198           echo change it >>aa
9199           dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
9200 "Checking in aa;
9201 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
9202 new revision: 1\.2; previous revision: 1\.1
9203 done"
9204           # If CVS let us update the execute bit, it would be set here.
9205           # But it doesn't, and as far as I know that is longstanding
9206           # CVS behavior.
9207           dotest modes-7 "ls -l ${TESTDIR}/cvsroot/first-dir/aa,v" \
9208 "-r--r--r-- .*"
9209
9210           # OK, now manually change the modes and see what happens.
9211           chmod g=r,o= ${TESTDIR}/cvsroot/first-dir/aa,v
9212           echo second line >>aa
9213           dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
9214 "Checking in aa;
9215 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
9216 new revision: 1\.3; previous revision: 1\.2
9217 done"
9218           dotest modes-7b "ls -l ${TESTDIR}/cvsroot/first-dir/aa,v" \
9219 "-r--r----- .*"
9220
9221           CVSUMASK=007
9222           export CVSUMASK
9223           touch ab
9224           # Might as well test the execute bit too.
9225           chmod +x ab
9226           dotest modes-8 "${testcvs} add ab" \
9227 "${PROG} [a-z]*: scheduling file .ab. for addition
9228 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9229           dotest modes-9 "${testcvs} -q ci -m add" \
9230 "RCS file: ${TESTDIR}/cvsroot/first-dir/ab,v
9231 done
9232 Checking in ab;
9233 ${TESTDIR}/cvsroot/first-dir/ab,v  <--  ab
9234 initial revision: 1\.1
9235 done"
9236           if test "x$remote" = xyes; then
9237             # The problem here is that the CVSUMASK environment variable
9238             # needs to be set on the server (e.g. .bashrc).  This is, of
9239             # course, bogus, but that is the way it is currently.
9240             dotest modes-10 "ls -l ${TESTDIR}/cvsroot/first-dir/ab,v" \
9241 "-r-xr-x---.*" "-r-xr-xr-x.*"
9242           else
9243             dotest modes-10 "ls -l ${TESTDIR}/cvsroot/first-dir/ab,v" \
9244 "-r-xr-x---.*"
9245           fi
9246
9247           # OK, now add a file on a branch.  Check that the mode gets
9248           # set the same way (it is a different code path in CVS).
9249           dotest modes-11 "${testcvs} -q tag -b br" 'T aa
9250 T ab'
9251           dotest modes-12 "${testcvs} -q update -r br" ''
9252           touch ac
9253           dotest modes-13 "${testcvs} add ac" \
9254 "${PROG} [a-z]*: scheduling file .ac. for addition on branch .br.
9255 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9256           # Not sure it really makes sense to refer to a "previous revision"
9257           # when we are just now adding the file; as far as I know
9258           # that is longstanding CVS behavior, for what it's worth.
9259           dotest modes-14 "${testcvs} -q ci -m add" \
9260 "RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/ac,v
9261 done
9262 Checking in ac;
9263 ${TESTDIR}/cvsroot/first-dir/Attic/ac,v  <--  ac
9264 new revision: 1\.1\.2\.1; previous revision: 1\.1
9265 done"
9266           if test "x$remote" = xyes; then
9267             # The problem here is that the CVSUMASK environment variable
9268             # needs to be set on the server (e.g. .bashrc).  This is, of
9269             # course, bogus, but that is the way it is currently.
9270             dotest modes-15 \
9271 "ls -l ${TESTDIR}/cvsroot/first-dir/Attic/ac,v" \
9272 "-r--r--r--.*"
9273           else
9274             dotest modes-15 \
9275 "ls -l ${TESTDIR}/cvsroot/first-dir/Attic/ac,v" \
9276 "-r--r-----.*"
9277           fi
9278
9279           cd ../..
9280           rm -r 1
9281           rm -rf ${CVSROOT_DIRNAME}/first-dir
9282           # Perhaps should restore the umask and CVSUMASK.  But the other
9283           # tests "should" not care about them...
9284           ;;
9285
9286         stamps)
9287           # Test timestamps.
9288           mkdir 1; cd 1
9289           dotest stamps-1 "${testcvs} -q co -l ." ''
9290           mkdir first-dir
9291           dotest stamps-2 "${testcvs} add first-dir" \
9292 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
9293           cd first-dir
9294           touch aa
9295           echo '$''Id$' >kw
9296           ls -l aa >${TESTDIR}/1/stamp.aa.touch
9297           ls -l kw >${TESTDIR}/1/stamp.kw.touch
9298           # "sleep 1" would suffice if we could assume ls --full-time, but
9299           # that is as far as I know unique to GNU ls.  Is there some POSIX.2
9300           # way to get the timestamp of a file, including the seconds?
9301           sleep 60
9302           dotest stamps-3 "${testcvs} add aa kw" \
9303 "${PROG} [a-z]*: scheduling file .aa. for addition
9304 ${PROG} [a-z]*: scheduling file .kw. for addition
9305 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
9306           ls -l aa >${TESTDIR}/1/stamp.aa.add
9307           ls -l kw >${TESTDIR}/1/stamp.kw.add
9308           # "cvs add" should not muck with the timestamp.
9309           dotest stamps-4aa \
9310 "cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
9311           dotest stamps-4kw \
9312 "cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
9313           sleep 60
9314           dotest stamps-5 "${testcvs} -q ci -m add" \
9315 "RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
9316 done
9317 Checking in aa;
9318 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
9319 initial revision: 1\.1
9320 done
9321 RCS file: ${TESTDIR}/cvsroot/first-dir/kw,v
9322 done
9323 Checking in kw;
9324 ${TESTDIR}/cvsroot/first-dir/kw,v  <--  kw
9325 initial revision: 1\.1
9326 done"
9327           ls -l aa >${TESTDIR}/1/stamp.aa.ci
9328           ls -l kw >${TESTDIR}/1/stamp.kw.ci
9329           # If there are no keywords, "cvs ci" leaves the timestamp alone
9330           # If there are, it sets the timestamp to the date of the commit.
9331           # I'm not sure how logical this is, but it is intentional.
9332           # If we wanted to get fancy we would make sure the time as
9333           # reported in "cvs log kw" matched stamp.kw.ci.  But that would
9334           # be a lot of work.
9335           dotest stamps-6aa \
9336             "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
9337           if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
9338           then
9339             fail stamps-6kw
9340           else
9341             pass stamps-6kw
9342           fi
9343           cd ../..
9344           sleep 60
9345           mkdir 2
9346           cd 2
9347           dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
9348 U first-dir/kw"
9349           cd first-dir
9350           ls -l aa >${TESTDIR}/1/stamp.aa.get
9351           ls -l kw >${TESTDIR}/1/stamp.kw.get
9352           # On checkout, CVS should set the timestamp to the date that the
9353           # file was committed.  Could check that the time as reported in
9354           # "cvs log aa" matches stamp.aa.get, but that would be a lot of
9355           # work.
9356           if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
9357           then
9358             fail stamps-8aa
9359           else
9360             pass stamps-8aa
9361           fi
9362           dotest stamps-8kw \
9363             "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
9364
9365           # Now we want to see what "cvs update" does.
9366           sleep 60
9367           echo add a line >>aa
9368           echo add a line >>kw
9369           dotest stamps-9 "${testcvs} -q ci -m change-them" \
9370 "Checking in aa;
9371 ${TESTDIR}/cvsroot/first-dir/aa,v  <--  aa
9372 new revision: 1\.2; previous revision: 1\.1
9373 done
9374 Checking in kw;
9375 ${TESTDIR}/cvsroot/first-dir/kw,v  <--  kw
9376 new revision: 1\.2; previous revision: 1\.1
9377 done"
9378           ls -l aa >${TESTDIR}/1/stamp.aa.ci2
9379           ls -l kw >${TESTDIR}/1/stamp.kw.ci2
9380           cd ../..
9381           cd 1/first-dir
9382           sleep 60
9383           dotest stamps-10 "${testcvs} -q update" '[UP] aa
9384 [UP] kw'
9385           # this doesn't serve any function other than being able to
9386           # look at it manually, as we have no machinery for dates being
9387           # newer or older than other dates.
9388           date >${TESTDIR}/1/stamp.debug.update
9389           ls -l aa >${TESTDIR}/1/stamp.aa.update
9390           ls -l kw >${TESTDIR}/1/stamp.kw.update
9391           # stamp.aa.update and stamp.kw.update should both be approximately
9392           # the same as stamp.debug.update.  Perhaps we could be testing
9393           # this in a more fancy fashion by "touch stamp.before" before
9394           # stamps-10, "touch stamp.after" after, and then using ls -t
9395           # to check them.  But for now we just make sure that the *.update
9396           # stamps differ from the *.ci2 ones.
9397           # As for the rationale, this is so that if one updates and gets
9398           # a new revision, then "make" will be sure to regard those files
9399           # as newer than .o files which may be sitting around.
9400           if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
9401              >/dev/null
9402           then
9403             fail stamps-11aa
9404           else
9405             pass stamps-11aa
9406           fi
9407           if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
9408              >/dev/null
9409           then
9410             fail stamps-11kw
9411           else
9412             pass stamps-11kw
9413           fi
9414
9415           cd ../..
9416
9417           if test "$keep" = yes; then
9418             echo Keeping ${TESTDIR} and exiting due to --keep
9419             exit 0
9420           fi
9421
9422           rm -r 1 2
9423           rm -rf ${CVSROOT_DIRNAME}/first-dir
9424           ;;
9425
9426         sticky)
9427           # More tests of sticky tags, particularly non-branch sticky tags.
9428           # See many tests (e.g. multibranch) for ordinary sticky tag
9429           # operations such as adding files on branches.
9430           # See "head" test for interaction between stick tags and HEAD.
9431           mkdir 1; cd 1
9432           dotest sticky-1 "${testcvs} -q co -l ." ''
9433           mkdir first-dir
9434           dotest sticky-2 "${testcvs} add first-dir" \
9435 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
9436           cd first-dir
9437
9438           touch file1
9439           dotest sticky-3 "${testcvs} add file1" \
9440 "${PROG} [a-z]*: scheduling file .file1. for addition
9441 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9442           dotest sticky-4 "${testcvs} -q ci -m add" \
9443 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
9444 done
9445 Checking in file1;
9446 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9447 initial revision: 1\.1
9448 done"
9449           dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
9450           echo add a line >>file1
9451           dotest sticky-6 "${testcvs} -q ci -m modify" \
9452 "Checking in file1;
9453 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9454 new revision: 1\.2; previous revision: 1\.1
9455 done"
9456           dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
9457           dotest sticky-8 "cat file1" ''
9458           dotest sticky-9 "${testcvs} -q update" ''
9459           dotest sticky-10 "cat file1" ''
9460           touch file2
9461           dotest_fail sticky-11 "${testcvs} add file2" \
9462 "${PROG} [a-z]*: cannot add file on non-branch tag tag1"
9463           dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
9464 ${QUESTION} file2" "${QUESTION} file2
9465 [UP] file1"
9466           dotest sticky-13 "${testcvs} add file2" \
9467 "${PROG} [a-z]*: scheduling file .file2. for addition
9468 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9469           dotest sticky-14 "${testcvs} -q ci -m add" \
9470 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
9471 done
9472 Checking in file2;
9473 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
9474 initial revision: 1\.1
9475 done"
9476
9477           # Now back to tag1
9478           dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
9479 ${PROG} [a-z]*: file2 is no longer in the repository"
9480
9481           rm file1
9482           dotest sticky-16 "${testcvs} rm file1" \
9483 "${PROG} [a-z]*: scheduling .file1. for removal
9484 ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
9485           # Hmm, this command seems to silently remove the tag from
9486           # the file.  This appears to be intentional.
9487           # The silently part especially strikes me as odd, though.
9488           dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
9489           dotest sticky-18 "${testcvs} -q update -A" "U file1
9490 U file2"
9491           dotest sticky-19 "${testcvs} -q update -r tag1" \
9492 "${PROG} [a-z]*: file1 is no longer in the repository
9493 ${PROG} [a-z]*: file2 is no longer in the repository"
9494           dotest sticky-20 "${testcvs} -q update -A" "U file1
9495 U file2"
9496
9497           # Now try with a numeric revision.
9498           dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
9499           rm file1
9500           dotest sticky-22 "${testcvs} rm file1" \
9501 "${PROG} [a-z]*: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
9502           # The old behavior was that remove allowed this and then commit
9503           # gave an error, which was somewhat hard to clear.  I mean, you
9504           # could get into a long elaborate discussion of this being a
9505           # conflict and two ways to resolve it, but I don't really see
9506           # why CVS should have a concept of conflict that arises, not from
9507           # parallel development, but from CVS's own sticky tags.
9508
9509           # I'm kind of surprised that the "file1 was lost" doesn't crop
9510           # up elsewhere in the testsuite.  It is a long-standing
9511           # discrepency between local and remote CVS and should probably
9512           # be cleaned up at some point.
9513           dotest sticky-23 "${testcvs} -q update -A" \
9514 "${PROG} [a-z]*: warning: file1 was lost
9515 U file1" "U file1"
9516
9517           cd ../..
9518           rm -r 1
9519           rm -rf ${CVSROOT_DIRNAME}/first-dir
9520           ;;
9521
9522         keyword)
9523           # Test keyword expansion.
9524           # Various other tests relate to our ability to correctly
9525           # set the keyword expansion mode.
9526           # "binfiles" tests "cvs admin -k".
9527           # "binfiles" and "binfiles2" test "cvs add -k".
9528           # "rdiff" tests "cvs co -k".
9529           # "binfiles" (and this test) test "cvs update -k".
9530           # "binwrap" tests setting the mode from wrappers.
9531           # I don't think any test is testing "cvs import -k".
9532           mkdir 1; cd 1
9533           dotest keyword-1 "${testcvs} -q co -l ." ''
9534           mkdir first-dir
9535           dotest keyword-2 "${testcvs} add first-dir" \
9536 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
9537           cd first-dir
9538
9539           echo '$''Author$' > file1
9540           echo '$''Date$' >> file1
9541           echo '$''Header$' >> file1
9542           echo '$''Id$' >> file1
9543           echo '$''Locker$' >> file1
9544           echo '$''Name$' >> file1
9545           echo '$''RCSfile$' >> file1
9546           echo '$''Revision$' >> file1
9547           echo '$''Source$' >> file1
9548           echo '$''State$' >> file1
9549           echo '$''Nonkey$' >> file1
9550           # Omit the trailing dollar sign
9551           echo '$''Date' >> file1
9552           # Put two keywords on one line
9553           echo '$''State$' '$''State$' >> file1
9554           # Use a header for Log
9555           echo 'xx $''Log$' >> file1
9556
9557           dotest keyword-3 "${testcvs} add file1" \
9558 "${PROG} [a-z]*: scheduling file .file1. for addition
9559 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9560           dotest keyword-4 "${testcvs} -q ci -m add" \
9561 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
9562 done
9563 Checking in file1;
9564 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9565 initial revision: 1\.1
9566 done"
9567           dotest keyword-5 "cat file1" \
9568 '\$'"Author: ${username} "'\$'"
9569 "'\$'"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]:[0-9][0-9] "'\$'"
9570 "'\$'"Header: ${TESTDIR}/cvsroot/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
9571 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
9572 "'\$'"Locker:  "'\$'"
9573 "'\$'"Name:  "'\$'"
9574 "'\$'"RCSfile: file1,v "'\$'"
9575 "'\$'"Revision: 1\.1 "'\$'"
9576 "'\$'"Source: ${TESTDIR}/cvsroot/first-dir/file1,v "'\$'"
9577 "'\$'"State: Exp "'\$'"
9578 "'\$'"Nonkey"'\$'"
9579 "'\$'"Date
9580 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
9581 xx "'\$'"Log: file1,v "'\$'"
9582 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
9583 xx add
9584 xx"
9585
9586           # Use cvs admin to lock the RCS file in order to check -kkvl
9587           # vs. -kkv.  CVS does not normally lock RCS files, but some
9588           # people use cvs admin to enforce reserved checkouts.
9589           dotest keyword-6 "${testcvs} admin -l file1" \
9590 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
9591 1\.1 locked
9592 done"
9593
9594           dotest keyword-7 "${testcvs} update -kkv file1" "U file1"
9595           dotest keyword-8 "cat file1" \
9596 '\$'"Author: ${username} "'\$'"
9597 "'\$'"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]:[0-9][0-9] "'\$'"
9598 "'\$'"Header: ${TESTDIR}/cvsroot/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
9599 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
9600 "'\$'"Locker:  "'\$'"
9601 "'\$'"Name:  "'\$'"
9602 "'\$'"RCSfile: file1,v "'\$'"
9603 "'\$'"Revision: 1\.1 "'\$'"
9604 "'\$'"Source: ${TESTDIR}/cvsroot/first-dir/file1,v "'\$'"
9605 "'\$'"State: Exp "'\$'"
9606 "'\$'"Nonkey"'\$'"
9607 "'\$'"Date
9608 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
9609 xx "'\$'"Log: file1,v "'\$'"
9610 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
9611 xx add
9612 xx"
9613
9614           dotest keyword-9 "${testcvs} update -kkvl file1" "U file1"
9615           dotest keyword-10 "cat file1" \
9616 '\$'"Author: ${username} "'\$'"
9617 "'\$'"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]:[0-9][0-9] "'\$'"
9618 "'\$'"Header: ${TESTDIR}/cvsroot/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
9619 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
9620 "'\$'"Locker: ${username} "'\$'"
9621 "'\$'"Name:  "'\$'"
9622 "'\$'"RCSfile: file1,v "'\$'"
9623 "'\$'"Revision: 1\.1 "'\$'"
9624 "'\$'"Source: ${TESTDIR}/cvsroot/first-dir/file1,v "'\$'"
9625 "'\$'"State: Exp "'\$'"
9626 "'\$'"Nonkey"'\$'"
9627 "'\$'"Date
9628 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
9629 xx "'\$'"Log: file1,v "'\$'"
9630 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
9631 xx add
9632 xx"
9633
9634           dotest keyword-11 "${testcvs} update -kk file1" "U file1"
9635           dotest keyword-12 "cat file1" \
9636 '\$'"Author"'\$'"
9637 "'\$'"Date"'\$'"
9638 "'\$'"Header"'\$'"
9639 "'\$'"Id"'\$'"
9640 "'\$'"Locker"'\$'"
9641 "'\$'"Name"'\$'"
9642 "'\$'"RCSfile"'\$'"
9643 "'\$'"Revision"'\$'"
9644 "'\$'"Source"'\$'"
9645 "'\$'"State"'\$'"
9646 "'\$'"Nonkey"'\$'"
9647 "'\$'"Date
9648 "'\$'"State"'\$'" "'\$'"State"'\$'"
9649 xx "'\$'"Log"'\$'"
9650 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
9651 xx add
9652 xx"
9653
9654           dotest keyword-13 "${testcvs} update -kv file1" "U file1"
9655           dotest keyword-14 "cat file1" \
9656 "${username}
9657 [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]
9658 ${TESTDIR}/cvsroot/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
9659 file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
9660
9661
9662 file1,v
9663 1\.1
9664 ${TESTDIR}/cvsroot/first-dir/file1,v
9665 Exp
9666 "'\$'"Nonkey"'\$'"
9667 "'\$'"Date
9668 Exp Exp
9669 xx file1,v
9670 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
9671 xx add
9672 xx"
9673
9674           dotest keyword-15 "${testcvs} update -ko file1" "U file1"
9675           dotest keyword-16 "cat file1" \
9676 '\$'"Author"'\$'"
9677 "'\$'"Date"'\$'"
9678 "'\$'"Header"'\$'"
9679 "'\$'"Id"'\$'"
9680 "'\$'"Locker"'\$'"
9681 "'\$'"Name"'\$'"
9682 "'\$'"RCSfile"'\$'"
9683 "'\$'"Revision"'\$'"
9684 "'\$'"Source"'\$'"
9685 "'\$'"State"'\$'"
9686 "'\$'"Nonkey"'\$'"
9687 "'\$'"Date
9688 "'\$'"State"'\$'" "'\$'"State"'\$'"
9689 xx "'\$'"Log"'\$'
9690
9691           # Test the Name keyword.  First go back to normal expansion.
9692
9693           dotest keyword-17 "${testcvs} update -A file1" "U file1"
9694
9695           echo '$''Name$' > file1
9696           dotest keyword-18 "${testcvs} ci -m modify file1" \
9697 "Checking in file1;
9698 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9699 new revision: 1\.2; previous revision: 1\.1
9700 done"
9701           dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
9702           echo "change" >> file1
9703           dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
9704 "Checking in file1;
9705 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9706 new revision: 1\.3; previous revision: 1\.2
9707 done"
9708           dotest keyword-21 "${testcvs} -q update -r tag1" "[UP] file1"
9709
9710           # FIXME: This test fails when remote.  The second expect
9711           # string below should be removed when this is fixed.
9712           dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$' \
9713 '\$'"Name:  "'\$'
9714
9715           dotest keyword-23 "${testcvs} update -A file1" "[UP] file1"
9716
9717           cd ../..
9718           rm -r 1
9719           rm -rf ${CVSROOT_DIRNAME}/first-dir
9720           ;;
9721
9722         keywordlog)
9723           # Test the Log keyword.
9724           mkdir 1; cd 1
9725           dotest keywordlog-1 "${testcvs} -q co -l ." ''
9726           mkdir first-dir
9727           dotest keywordlog-2 "${testcvs} add first-dir" \
9728 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
9729           cd first-dir
9730           echo change >file1
9731           dotest keywordlog-3 "${testcvs} add file1" \
9732 "${PROG} [a-z]*: scheduling file .file1. for addition
9733 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9734
9735           # Note that we wanted to try "ci -r 1.3 -m add file1" and CVS
9736           # seemed to get all confused, thinking it was adding on a branch
9737           # or something.  FIXME?  Do something about this?  Document it
9738           # in BUGS or someplace?
9739
9740           dotest keywordlog-4 "${testcvs} -q ci -m add file1" \
9741 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
9742 done
9743 Checking in file1;
9744 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9745 initial revision: 1\.1
9746 done"
9747
9748           cd ../..
9749           mkdir 2; cd 2
9750           dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
9751           cd ../1/first-dir
9752
9753           echo 'xx $''Log$' > file1
9754           cat >${TESTDIR}/comment.tmp <<EOF
9755 First log line
9756 Second log line
9757 EOF
9758           dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
9759 "Checking in file1;
9760 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9761 new revision: 1\.2; previous revision: 1\.1
9762 done"
9763           rm -f ${TESTDIR}/comment.tmp
9764           dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
9765           dotest keywordlog-7 "cat file1" \
9766 "xx "'\$'"Log: file1,v "'\$'"
9767 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9768 xx First log line
9769 xx Second log line
9770 xx"
9771
9772           cd ../../2/first-dir
9773           dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
9774           dotest keywordlog-9 "cat file1" \
9775 "xx "'\$'"Log: file1,v "'\$'"
9776 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9777 xx First log line
9778 xx Second log line
9779 xx"
9780           cd ../../1/first-dir
9781
9782           echo "change" >> file1
9783           dotest keywordlog-10 "${testcvs} ci -m modify file1" \
9784 "Checking in file1;
9785 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9786 new revision: 1\.3; previous revision: 1\.2
9787 done"
9788           dotest keywordlog-11 "cat file1" \
9789 "xx "'\$'"Log: file1,v "'\$'"
9790 xx Revision 1\.3  [0-9/]* [0-9:]*  ${username}
9791 xx modify
9792 xx
9793 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9794 xx First log line
9795 xx Second log line
9796 xx
9797 change"
9798
9799           cd ../../2/first-dir
9800           dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
9801           dotest keywordlog-13 "cat file1" \
9802 "xx "'\$'"Log: file1,v "'\$'"
9803 xx Revision 1\.3  [0-9/]* [0-9:]*  ${username}
9804 xx modify
9805 xx
9806 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9807 xx First log line
9808 xx Second log line
9809 xx
9810 change"
9811
9812           cd ../../1/first-dir
9813           dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
9814           echo br-change >>file1
9815           dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
9816 "Checking in file1;
9817 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
9818 new revision: 1\.2\.2\.1; previous revision: 1\.2
9819 done"
9820           dotest keywordlog-16 "cat file1" \
9821 "xx "'\$'"Log: file1,v "'\$'"
9822 xx Revision 1\.2\.2\.1  [0-9/]* [0-9:]*  ${username}
9823 xx br-modify
9824 xx
9825 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9826 xx First log line
9827 xx Second log line
9828 xx
9829 br-change"
9830           cd ../../2/first-dir
9831           dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
9832           dotest keywordlog-18 "cat file1" \
9833 "xx "'\$'"Log: file1,v "'\$'"
9834 xx Revision 1\.2\.2\.1  [0-9/]* [0-9:]*  ${username}
9835 xx br-modify
9836 xx
9837 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9838 xx First log line
9839 xx Second log line
9840 xx
9841 br-change"
9842           cd ../..
9843           dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
9844 "xx "'\$'"Log: file1,v "'\$'"
9845 xx Revision 1\.2\.2\.1  [0-9/]* [0-9:]*  ${username}
9846 xx br-modify
9847 xx
9848 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9849 xx First log line
9850 xx Second log line
9851 xx
9852 br-change"
9853           dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
9854 "xx "'\$'"Log: file1,v "'\$'"
9855 xx Revision 1\.3  [0-9/]* [0-9:]*  ${username}
9856 xx modify
9857 xx
9858 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9859 xx First log line
9860 xx Second log line
9861 xx
9862 change"
9863           dotest keywordlog-21 "${testcvs} -q co -p -r 1.2 first-dir/file1" \
9864 "xx "'\$'"Log: file1,v "'\$'"
9865 xx Revision 1\.2  [0-9/]* [0-9:]*  ${username}
9866 xx First log line
9867 xx Second log line
9868 xx"
9869
9870           rm -r 1 2
9871           rm -rf ${CVSROOT_DIRNAME}/first-dir
9872           ;;
9873
9874         toplevel)
9875           # test the feature that cvs creates a CVS subdir also for
9876           # the toplevel directory
9877
9878           # Some test, somewhere, is creating Emptydir.  That test
9879           # should, perhaps, clean up for itself, but I don't know which
9880           # one it is.
9881           rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
9882
9883           mkdir 1; cd 1
9884           dotest toplevel-1 "${testcvs} -q co -l ." ''
9885           mkdir top-dir second-dir
9886           dotest toplevel-2 "${testcvs} add top-dir second-dir" \
9887 "Directory ${TESTDIR}/cvsroot/top-dir added to the repository
9888 Directory ${TESTDIR}/cvsroot/second-dir added to the repository"
9889           cd top-dir
9890
9891           touch file1
9892           dotest toplevel-3 "${testcvs} add file1" \
9893 "${PROG} [a-z]*: scheduling file .file1. for addition
9894 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9895           dotest toplevel-4 "${testcvs} -q ci -m add" \
9896 "RCS file: ${TESTDIR}/cvsroot/top-dir/file1,v
9897 done
9898 Checking in file1;
9899 ${TESTDIR}/cvsroot/top-dir/file1,v  <--  file1
9900 initial revision: 1\.1
9901 done"
9902           cd ..
9903
9904           cd second-dir
9905           touch file2
9906           dotest toplevel-3s "${testcvs} add file2" \
9907 "${PROG} [a-z]*: scheduling file .file2. for addition
9908 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9909           dotest toplevel-4s "${testcvs} -q ci -m add" \
9910 "RCS file: ${TESTDIR}/cvsroot/second-dir/file2,v
9911 done
9912 Checking in file2;
9913 ${TESTDIR}/cvsroot/second-dir/file2,v  <--  file2
9914 initial revision: 1\.1
9915 done"
9916
9917           cd ../..
9918           rm -r 1; mkdir 1; cd 1
9919           dotest toplevel-5 "${testcvs} co top-dir" \
9920 "${PROG} [a-z]*: Updating top-dir
9921 U top-dir/file1"
9922
9923           dotest toplevel-6 "${testcvs} update top-dir" \
9924 "${PROG} [a-z]*: Updating top-dir"
9925           dotest toplevel-7 "${testcvs} update"  \
9926 "${PROG} [a-z]*: Updating \.
9927 ${PROG} [a-z]*: Updating top-dir"
9928
9929           dotest toplevel-8 "${testcvs} update -d top-dir" \
9930 "${PROG} [a-z]*: Updating top-dir"
9931           # There is some sentiment that
9932           #   "${PROG} [a-z]*: Updating \.
9933           #   ${PROG} [a-z]*: Updating top-dir"
9934           # is correct but it isn't clear why that would be correct instead
9935           # of the remote CVS behavior (which also updates CVSROOT).
9936           #
9937           # The DOTSTAR matches of a bunch of lines like
9938           # "U CVSROOT/checkoutlist".  Trying to match them more precisely
9939           # seemed to cause trouble.  For example CVSROOT/cvsignore will
9940           # be present or absent depending on whether we ran the "ignore"
9941           # test or not.
9942           dotest toplevel-9 "${testcvs} update -d" \
9943 "${PROG} [a-z]*: Updating \.
9944 ${PROG} [a-z]*: Updating CVSROOT
9945 ${DOTSTAR}
9946 ${PROG} [a-z]*: Updating top-dir"
9947
9948           cd ..
9949           rm -r 1; mkdir 1; cd 1
9950           dotest toplevel-10 "${testcvs} co top-dir" \
9951 "${PROG} [a-z]*: Updating top-dir
9952 U top-dir/file1"
9953           # This tests more or less the same thing, in a particularly
9954           # "real life" example.
9955           dotest toplevel-11 "${testcvs} -q update -d second-dir" \
9956 "U second-dir/file2"
9957
9958           # Now remove the CVS directory (people may do this manually,
9959           # especially if they formed their habits with CVS
9960           # 1.9 and older, which didn't create it.  Or perhaps the working
9961           # directory itself was created with 1.9 or older).
9962           rm -r CVS
9963           # Now set the permissions so we can't recreate it.
9964           chmod -w ../1
9965           # Now see whether CVS has trouble because it can't create CVS.
9966           dotest toplevel-12 "${testcvs} co top-dir" \
9967 "${PROG} [a-z]*: warning: cannot make directory ./CVS: Permission denied
9968 ${PROG} [a-z]*: Updating top-dir"
9969           chmod +w ../1
9970
9971           cd ..
9972           rm -r 1
9973           rm -rf ${CVSROOT_DIRNAME}/top-dir
9974           ;;
9975
9976         head)
9977           # Testing handling of the HEAD special tag.
9978           # There are many cases involving added and removed files
9979           # which we don't yet try to deal with.
9980           # TODO: We also could be paying much closer attention to
9981           # "head of the trunk" versus "head of the default branch".
9982           # That is what "cvs import" is doing here (but I didn't really
9983           # fully follow through on writing the tests for that case).
9984           mkdir imp-dir
9985           cd imp-dir
9986           echo 'imported contents' >file1
9987           # It may seem like we don't do much with file2, but do note that
9988           # the "cvs diff" invocations do also diff file2 (and come up empty).
9989           echo 'imported contents' >file2
9990           dotest head-1 "${testcvs} import -m add first-dir tag1 tag2" \
9991 "N first-dir/file1
9992 N first-dir/file2
9993
9994 No conflicts created by this import"
9995           cd ..
9996           rm -r imp-dir
9997           mkdir 1
9998           cd 1
9999           dotest head-2 "${testcvs} -q co first-dir" \
10000 "U first-dir/file1
10001 U first-dir/file2"
10002           cd first-dir
10003           echo 'add a line on trunk' >> file1
10004           dotest head-3 "${testcvs} -q ci -m modify" \
10005 "Checking in file1;
10006 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10007 new revision: 1\.2; previous revision: 1\.1
10008 done"
10009           dotest head-4 "${testcvs} -q tag trunktag" "T file1
10010 T file2"
10011           echo 'add a line on trunk after trunktag' >> file1
10012           dotest head-5 "${testcvs} -q ci -m modify" \
10013 "Checking in file1;
10014 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10015 new revision: 1\.3; previous revision: 1\.2
10016 done"
10017           dotest head-6 "${testcvs} -q tag -b br1" "T file1
10018 T file2"
10019           dotest head-7 "${testcvs} -q update -r br1" ""
10020           echo 'modify on branch' >>file1
10021           dotest head-8 "${testcvs} -q ci -m modify" \
10022 "Checking in file1;
10023 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10024 new revision: 1\.3\.2\.1; previous revision: 1\.3
10025 done"
10026           dotest head-9 "${testcvs} -q tag brtag" "T file1
10027 T file2"
10028           echo 'modify on branch after brtag' >>file1
10029           dotest head-10 "${testcvs} -q ci -m modify" \
10030 "Checking in file1;
10031 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10032 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
10033 done"
10034           # With no sticky tags, HEAD is the head of the trunk.
10035           dotest head-trunk-setup "${testcvs} -q update -A" "[UP] file1"
10036           dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
10037 "imported contents
10038 add a line on trunk
10039 add a line on trunk after trunktag"
10040           # and diff thinks so too.  Case (a) from the comment in
10041           # cvs.texinfo (Common options).
10042           dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
10043 "Index: file1
10044 ===================================================================
10045 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10046 retrieving revision 1\.3
10047 retrieving revision 1\.3\.2\.2
10048 diff -c -r1\.3 -r1\.3\.2\.2
10049 \*\*\* file1    [0-9/]* [0-9:]* 1\.3
10050 --- file1       [0-9/]* [0-9:]* 1\.3\.2\.2
10051 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
10052 \*\*\* 1,3 \*\*\*\*
10053 --- 1,5 ----
10054   imported contents
10055   add a line on trunk
10056   add a line on trunk after trunktag
10057 ${PLUS} modify on branch
10058 ${PLUS} modify on branch after brtag"
10059
10060           # With a branch sticky tag, HEAD is the head of the trunk.
10061           dotest head-br1-setup "${testcvs} -q update -r br1" "[UP] file1"
10062           dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
10063 "imported contents
10064 add a line on trunk
10065 add a line on trunk after trunktag"
10066           # But diff thinks that HEAD is "br1".  Case (b) from cvs.texinfo.
10067           # Probably people are relying on it.
10068           dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
10069
10070           # With a nonbranch sticky tag on a branch,
10071           # HEAD is the head of the trunk
10072           dotest head-brtag-setup "${testcvs} -q update -r brtag" "[UP] file1"
10073           dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
10074 "imported contents
10075 add a line on trunk
10076 add a line on trunk after trunktag"
10077           # But diff thinks that HEAD is "brtag".  Case (c) from
10078           # cvs.texinfo (the "strange, maybe accidental" case).
10079           dotest_fail head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" \
10080 "Index: file1
10081 ===================================================================
10082 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10083 retrieving revision 1\.3\.2\.1
10084 retrieving revision 1\.3\.2\.2
10085 diff -c -r1\.3\.2\.1 -r1\.3\.2\.2
10086 \*\*\* file1    [0-9/]* [0-9:]* 1\.3\.2\.1
10087 --- file1       [0-9/]* [0-9:]* 1\.3\.2\.2
10088 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
10089 \*\*\* 2,4 \*\*\*\*
10090 --- 2,5 ----
10091   add a line on trunk
10092   add a line on trunk after trunktag
10093   modify on branch
10094 ${PLUS} modify on branch after brtag"
10095
10096           # With a nonbranch sticky tag on the trunk, HEAD is the head
10097           # of the trunk, I think.
10098           dotest head-trunktag-setup "${testcvs} -q update -r trunktag" \
10099 "[UP] file1"
10100           dotest head-trunktag-check "cat file1" "imported contents
10101 add a line on trunk"
10102           dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
10103 "imported contents
10104 add a line on trunk
10105 add a line on trunk after trunktag"
10106           # Like head-brtag-diff, HEAD is the sticky tag.  Similarly
10107           # questionable.
10108           dotest_fail head-trunktag-diff \
10109             "${testcvs} -q diff -c -r HEAD -r br1" \
10110 "Index: file1
10111 ===================================================================
10112 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10113 retrieving revision 1\.2
10114 retrieving revision 1\.3\.2\.2
10115 diff -c -r1\.2 -r1\.3\.2\.2
10116 \*\*\* file1    [0-9/]* [0-9:]* 1\.2
10117 --- file1       [0-9/]* [0-9:]* 1\.3\.2\.2
10118 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
10119 \*\*\* 1,2 \*\*\*\*
10120 --- 1,5 ----
10121   imported contents
10122   add a line on trunk
10123 ${PLUS} add a line on trunk after trunktag
10124 ${PLUS} modify on branch
10125 ${PLUS} modify on branch after brtag"
10126
10127           # Also might test what happens if we setup with update -r
10128           # HEAD.  In general, if sticky tags matter, does the
10129           # behavior of "update -r <foo>" (without -p) depend on the
10130           # sticky tags before or after the update?
10131
10132           # Note that we are testing both the case where this deletes
10133           # a revision (file1) and the case where it does not (file2)
10134           dotest_fail head-o0a "${testcvs} admin -o ::br1" \
10135 "${PROG} [a-z]*: Administrating \.
10136 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10137 ${PROG} [a-z]*: cannot remove revision 1\.3\.2\.1 because it has tags
10138 ${PROG} [a-z]*: cannot modify RCS file for .file1.
10139 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10140 done"
10141           dotest head-o0b "${testcvs} tag -d brtag" \
10142 "${PROG} [a-z]*: Untagging \.
10143 D file1
10144 D file2"
10145           dotest head-o1 "${testcvs} admin -o ::br1" \
10146 "${PROG} [a-z]*: Administrating \.
10147 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10148 deleting revision 1\.3\.2\.1
10149 done
10150 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10151 done"
10152           cd ../..
10153           rm -r 1
10154           rm -rf ${CVSROOT_DIRNAME}/first-dir
10155           ;;
10156
10157         tagdate)
10158           # Test combining -r and -D.
10159           mkdir 1; cd 1
10160           dotest tagdate-1 "${testcvs} -q co -l ." ''
10161           mkdir first-dir
10162           dotest tagdate-2 "${testcvs} add first-dir" \
10163 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
10164           cd first-dir
10165
10166           echo trunk-1 >file1
10167           dotest tagdate-3 "${testcvs} add file1" \
10168 "${PROG} [a-z]*: scheduling file .file1. for addition
10169 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
10170           dotest tagdate-4 "${testcvs} -q ci -m add" \
10171 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10172 done
10173 Checking in file1;
10174 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10175 initial revision: 1\.1
10176 done"
10177           dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
10178           dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
10179           echo trunk-2 >file1
10180           dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
10181 "Checking in file1;
10182 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10183 new revision: 1\.2; previous revision: 1\.1
10184 done"
10185           # We are testing -r -D where br1 is a (magic) branch without
10186           # any revisions.  First the case where br2 doesn't have any
10187           # revisions either:
10188           dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
10189           dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
10190           echo br2-1 >file1
10191           dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
10192 "Checking in file1;
10193 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10194 new revision: 1\.1\.4\.1; previous revision: 1\.1
10195 done"
10196           # Then the case where br2 does have revisions:
10197           dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
10198
10199           cd ../..
10200           rm -r 1
10201           rm -rf ${CVSROOT_DIRNAME}/first-dir
10202           ;;
10203
10204         multibranch2)
10205           # Commit the first delta on branch A when there is an older
10206           # branch, B, that already has a delta.  A and B come from the
10207           # same branch point.  Then verify that branches A and B are
10208           # in the right order.
10209           mkdir 1; cd 1
10210           dotest multibranch2-1 "${testcvs} -q co -l ." ''
10211           mkdir first-dir
10212           dotest multibranch2-2 "${testcvs} add first-dir" \
10213 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
10214           cd first-dir
10215
10216           echo trunk-1 >file1
10217           dotest multibranch2-3 "${testcvs} add file1" \
10218 "${PROG} [a-z]*: scheduling file .file1. for addition
10219 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
10220           dotest multibranch2-4 "${testcvs} -q ci -m add" \
10221 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10222 done
10223 Checking in file1;
10224 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10225 initial revision: 1\.1
10226 done"
10227           dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1"
10228           dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1"
10229
10230           dotest multibranch2-7 "${testcvs} -q update -r B" ''
10231           echo branch-B >file1
10232           dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
10233 "Checking in file1;
10234 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10235 new revision: 1\.1\.4\.1; previous revision: 1\.1
10236 done"
10237
10238           dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1'
10239           echo branch-A >file1
10240           # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
10241           dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
10242 "Checking in file1;
10243 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10244 new revision: 1\.1\.2\.1; previous revision: 1\.1
10245 done"
10246
10247           dotest multibranch2-11 "${testcvs} -q log" \
10248 "
10249 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10250 Working file: file1
10251 head: 1\.1
10252 branch:
10253 locks: strict
10254 access list:
10255 symbolic names:
10256         B: 1\.1\.0\.4
10257         A: 1\.1\.0\.2
10258 keyword substitution: kv
10259 total revisions: 3;     selected revisions: 3
10260 description:
10261 ----------------------------
10262 revision 1\.1
10263 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
10264 branches:  1\.1\.2;  1\.1\.4;
10265 add
10266 ----------------------------
10267 revision 1\.1\.4\.1
10268 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
10269 modify-on-B
10270 ----------------------------
10271 revision 1\.1\.2\.1
10272 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
10273 modify-on-A
10274 ============================================================================="
10275
10276           # This one is more concise.
10277           dotest multibranch2-12 "${testcvs} -q log -r1.1" \
10278 "
10279 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10280 Working file: file1
10281 head: 1\.1
10282 branch:
10283 locks: strict
10284 access list:
10285 symbolic names:
10286         B: 1\.1\.0\.4
10287         A: 1\.1\.0\.2
10288 keyword substitution: kv
10289 total revisions: 3;     selected revisions: 1
10290 description:
10291 ----------------------------
10292 revision 1\.1
10293 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
10294 branches:  1\.1\.2;  1\.1\.4;
10295 add
10296 ============================================================================="
10297
10298           cd ../..
10299           rm -r 1
10300           rm -rf ${CVSROOT_DIRNAME}/first-dir
10301           ;;
10302
10303
10304         admin)
10305           # More "cvs admin" tests.
10306           # The basicb-21 test tests rejecting an illegal option.
10307           # For -l and -u, see "reserved" and "keyword" tests.
10308           # "binfiles" test has a test of "cvs admin -k".
10309           # "log2" test has tests of -t and -q options to cvs admin.
10310           # "rcs" tests -b option also.
10311           # For -o, see:
10312           #   admin-22-o1 through admin-23 (various cases not involving ::)
10313           #   binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
10314           #   basica-o1 through basica-o3 (basic :: usage)
10315           #   head-o1 (::branch, where this deletes a revision or is noop)
10316           #   branches-o1 (::branch, similar, with different branch topology)
10317           #   log-o1 (1.3.2.1::)
10318           #   binfiles-o1 (1.3:: and ::1.3)
10319           #   Also could be testing:
10320           #     1.3.2.6::1.3.2.8
10321           #     1.3.2.6::1.3.2
10322           #     1.3.2.1::1.3.2.6
10323           #     1.3::1.3.2.6 (error?  or synonym for ::1.3.2.6?)
10324
10325           mkdir 1; cd 1
10326           dotest admin-1 "${testcvs} -q co -l ." ''
10327           mkdir first-dir
10328           dotest admin-2 "${testcvs} add first-dir" \
10329 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
10330           cd first-dir
10331
10332           dotest_fail admin-3 "${testcvs} -q admin -i file1" \
10333 "${PROG} admin: the -i option to admin is not supported
10334 ${PROG} admin: run add or import to create an RCS file
10335 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
10336           dotest_fail admin-4 "${testcvs} -q log file1" \
10337 "${PROG} [a-z]*: nothing known about file1"
10338
10339           # Set up some files, file2 a plain one and file1 with a revision
10340           # on a branch.
10341           touch file1 file2
10342           dotest admin-5 "${testcvs} add file1 file2" \
10343 "${PROG} [a-z]*: scheduling file .file1. for addition
10344 ${PROG} [a-z]*: scheduling file .file2. for addition
10345 ${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
10346           dotest admin-6 "${testcvs} -q ci -m add" \
10347 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10348 done
10349 Checking in file1;
10350 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10351 initial revision: 1\.1
10352 done
10353 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10354 done
10355 Checking in file2;
10356 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
10357 initial revision: 1\.1
10358 done"
10359           dotest admin-7 "${testcvs} -q tag -b br" "T file1
10360 T file2"
10361           dotest admin-8 "${testcvs} -q update -r br" ""
10362           echo 'add a line on the branch' >> file1
10363           dotest admin-9 "${testcvs} -q ci -m modify-on-branch" \
10364 "Checking in file1;
10365 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10366 new revision: 1\.1\.2\.1; previous revision: 1\.1
10367 done"
10368           dotest admin-10 "${testcvs} -q update -A" "U file1"
10369
10370           # Try to recurse with a numeric revision arg.
10371           # If we wanted to comprehensive about this, we would also test
10372           # this for -l, -u, and all the different -o syntaxes.
10373           dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
10374 "${PROG} [a-z]*: while processing more than one file:
10375 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
10376           dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
10377 "${PROG} [a-z]*: while processing more than one file:
10378 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
10379
10380           # Note that -s option applies to the new default branch, not
10381           # the old one.
10382           # Also note that the implementation of -a via "rcs" requires
10383           # no space between -a and the argument.  However, we expect
10384           # to change that once CVS parses options.
10385           dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
10386 -b1.1.2 -cxx -U -sfoo file1" \
10387 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10388 done"
10389
10390           dotest admin-12 "${testcvs} log -N file1" "
10391 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10392 Working file: file1
10393 head: 1\.1
10394 branch: 1\.1\.2
10395 locks:
10396 access list:
10397         foo
10398         bar
10399         baz
10400 keyword substitution: kv
10401 total revisions: 2;     selected revisions: 2
10402 description:
10403 ----------------------------
10404 revision 1\.1
10405 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10406 branches:  1\.1\.2;
10407 add
10408 ----------------------------
10409 revision 1\.1\.2\.1
10410 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
10411 modify-on-branch
10412 ============================================================================="
10413
10414           # "cvs log" doesn't print the comment leader.  RCS 5.7 will print
10415           # the comment leader only if one specifies "-V4" to rlog.  So it
10416           # seems like the only way to test it is by looking at the RCS file
10417           # directly.  This also serves as a test of exporting RCS files
10418           # (analogous to the import tests in "rcs").
10419           # Rather than try to write a rigorous check for whether the
10420           # file CVS exports is legal, we just write a simpler
10421           # test for what CVS actually exports, and figure we can revise
10422           # the check as needed (within the confines of the RCS5 format as
10423           # documented in RCSFILES).
10424           dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
10425 "head   1\.1;
10426 branch  1\.1\.2;
10427 access
10428         foo
10429         bar
10430         baz;
10431 symbols
10432         br:1\.1\.0\.2;
10433 locks;
10434 comment @xx@;
10435
10436
10437 1\.1
10438 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;
10439 branches
10440         1\.1\.2\.1;
10441 next    ;
10442
10443 1\.1\.2\.1
10444 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;
10445 branches;
10446 next    ;
10447
10448
10449 desc
10450 @@
10451
10452
10453 1\.1
10454 log
10455 @add
10456 @
10457 text
10458 @@
10459
10460
10461 1\.1\.2\.1
10462 log
10463 @modify-on-branch
10464 @
10465 text
10466 @a0 1
10467 add a line on the branch
10468 @"
10469           dotest admin-14 "${testcvs} -q admin -aauth3 -aauth2,foo \
10470 -soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
10471 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10472 done"
10473           dotest admin-15 "${testcvs} -q log file2" "
10474 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10475 Working file: file2
10476 head: 1\.1
10477 branch:
10478 locks: strict
10479 access list:
10480         auth3
10481         auth2
10482         foo
10483 symbolic names:
10484         tagone: 1\.1
10485         br: 1\.1\.0\.2
10486 keyword substitution: kv
10487 total revisions: 1;     selected revisions: 1
10488 description:
10489 ----------------------------
10490 revision 1\.1
10491 date: [0-9/]* [0-9:]*;  author: ${username};  state: oneone;
10492 changed-log-message
10493 ============================================================================="
10494
10495           dotest admin-16 "${testcvs} -q admin \
10496 -A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
10497 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10498 done"
10499           dotest admin-17 "${testcvs} -q log file1" "
10500 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10501 Working file: file1
10502 head: 1\.1
10503 branch:
10504 locks: strict
10505 access list:
10506         foo
10507         bar
10508         baz
10509         auth3
10510         auth2
10511 symbolic names:
10512         br: 1\.1
10513 keyword substitution: kv
10514 total revisions: 2;     selected revisions: 2
10515 description:
10516 ----------------------------
10517 revision 1\.1
10518 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10519 branches:  1\.1\.2;
10520 add
10521 ----------------------------
10522 revision 1\.1\.2\.1
10523 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
10524 modify-on-branch
10525 ============================================================================="
10526
10527           dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
10528 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10529 ${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file1,v: symbolic name br already bound to 1\.1
10530 ${PROG} [a-z]*: cannot modify RCS file for .file1."
10531           dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
10532 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10533 done"
10534           dotest admin-20 "${testcvs} -q log file1" "
10535 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10536 Working file: file1
10537 head: 1\.1
10538 branch:
10539 locks: strict
10540 access list:
10541         foo
10542         auth2
10543 symbolic names:
10544 keyword substitution: kv
10545 total revisions: 2;     selected revisions: 2
10546 description:
10547 ----------------------------
10548 revision 1\.1
10549 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10550 branches:  1\.1\.2;
10551 add
10552 ----------------------------
10553 revision 1.1.2.1
10554 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
10555 modify-on-branch
10556 ============================================================================="
10557
10558           # OK, this is starting to get ridiculous, in terms of
10559           # testing a feature (access lists) which doesn't do anything
10560           # useful, but what about nonexistent files and
10561           # relative pathnames in admin -A?
10562           dotest_fail admin-19a-nonexist \
10563 "${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
10564 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10565 ${PROG} [a-z]*: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
10566 ${PROG} \[[a-z]* aborted\]: cannot continue"
10567
10568           # In the remote case, we are cd'd off into the temp directory
10569           # and so these tests give "No such file or directory" errors.
10570           if test "x$remote" = xno; then
10571
10572           dotest admin-19a-admin "${testcvs} -q admin -A../../cvsroot/first-dir/file2,v file1" \
10573 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10574 done"
10575           dotest admin-19a-log "${testcvs} -q log -h -N file1" "
10576 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10577 Working file: file1
10578 head: 1\.1
10579 branch:
10580 locks: strict
10581 access list:
10582         foo
10583         auth2
10584         auth3
10585 keyword substitution: kv
10586 total revisions: 2
10587 ============================================================================="
10588           # Put the access list back, to avoid special cases later.
10589           dotest admin-19a-fix "${testcvs} -q admin -eauth3 file1" \
10590 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10591 done"
10592           fi # end of tests skipped for remote
10593
10594           # Add another revision to file2, so we can delete one.
10595           echo 'add a line' >> file2
10596           dotest admin-21 "${testcvs} -q ci -m modify file2" \
10597 "Checking in file2;
10598 ${TESTDIR}/cvsroot/first-dir/file2,v  <--  file2
10599 new revision: 1\.2; previous revision: 1\.1
10600 done"
10601           dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
10602 "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10603 deleting revision 1\.1
10604 done"
10605           # Test admin -o.  More variants that we could be testing:
10606           # * REV: [on branch]
10607           # * REV1:REV2 [deleting whole branch]
10608           # * high branch numbers (e.g. 1.2.2.3.2.3)
10609           # ... and probably others.  See RCS_delete_revs for ideas.
10610
10611           echo first rev > aaa
10612           dotest admin-22-o1 "${testcvs} add aaa" \
10613 "${PROG} [a-z]*: scheduling file .aaa. for addition
10614 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
10615           dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
10616 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10617 done
10618 Checking in aaa;
10619 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10620 initial revision: 1\.1
10621 done"
10622           echo second rev >> aaa
10623           dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
10624 "Checking in aaa;
10625 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10626 new revision: 1\.2; previous revision: 1\.1
10627 done"
10628           echo third rev >> aaa
10629           dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
10630 "Checking in aaa;
10631 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10632 new revision: 1\.3; previous revision: 1\.2
10633 done"
10634           echo fourth rev >> aaa
10635           dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
10636 "Checking in aaa;
10637 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10638 new revision: 1\.4; previous revision: 1\.3
10639 done"
10640           echo fifth rev >>aaa
10641           dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
10642 "Checking in aaa;
10643 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10644 new revision: 1\.5; previous revision: 1\.4
10645 done"
10646           echo sixth rev >> aaa
10647           dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
10648 "Checking in aaa;
10649 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10650 new revision: 1\.6; previous revision: 1\.5
10651 done"
10652           dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
10653 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10654 1\.6 locked
10655 done"
10656           dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
10657 RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10658 Working file: aaa
10659 head: 1\.6
10660 branch:
10661 locks: strict
10662         ${username}: 1\.6
10663 access list:
10664 symbolic names:
10665 keyword substitution: kv
10666 total revisions: 6;     selected revisions: 1
10667 description:
10668 ----------------------------
10669 revision 1\.6   locked by: ${username};
10670 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10671 sixth
10672 ============================================================================="
10673           dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
10674 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10675 ${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove locked revision 1\.6
10676 ${PROG} [a-z]*: cannot modify RCS file for .aaa."
10677           dotest admin-22-o11 "${testcvs} admin -u aaa" \
10678 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10679 1\.6 unlocked
10680 done"
10681           dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
10682 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10683 deleting revision 1\.6
10684 deleting revision 1\.5
10685 done"
10686           dotest admin-22-o13 "${testcvs} log aaa" "
10687 RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10688 Working file: aaa
10689 head: 1\.4
10690 branch:
10691 locks: strict
10692 access list:
10693 symbolic names:
10694 keyword substitution: kv
10695 total revisions: 4;     selected revisions: 4
10696 description:
10697 ----------------------------
10698 revision 1\.4
10699 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10700 fourth
10701 ----------------------------
10702 revision 1\.3
10703 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10704 third
10705 ----------------------------
10706 revision 1\.2
10707 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10708 second
10709 ----------------------------
10710 revision 1\.1
10711 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10712 first
10713 ============================================================================="
10714
10715           dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
10716           dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
10717           echo new branch rev >> aaa
10718           dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
10719 "Checking in aaa;
10720 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10721 new revision: 1\.3\.2\.1; previous revision: 1\.3
10722 done"
10723           dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
10724 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10725 deleting revision 1\.4
10726 ${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove branch point 1\.3
10727 ${PROG} [a-z]*: cannot modify RCS file for .aaa."
10728           dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
10729 "===================================================================
10730 Checking out aaa
10731 RCS:  ${TESTDIR}/cvsroot/first-dir/aaa,v
10732 VERS: 1\.4
10733 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
10734 first rev
10735 second rev
10736 third rev
10737 fourth rev"
10738           echo second branch rev >> aaa
10739           dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
10740 "Checking in aaa;
10741 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10742 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
10743 done"
10744           echo third branch rev >> aaa
10745           dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
10746 "Checking in aaa;
10747 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10748 new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
10749 done"
10750           echo fourth branch rev >> aaa
10751           dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
10752 "Checking in aaa;
10753 ${TESTDIR}/cvsroot/first-dir/aaa,v  <--  aaa
10754 new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
10755 done"
10756           dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
10757 "RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10758 deleting revision 1\.3\.2\.1
10759 deleting revision 1\.3\.2\.2
10760 deleting revision 1\.3\.2\.3
10761 done"
10762           dotest admin-22-o23 "${testcvs} log aaa" "
10763 RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
10764 Working file: aaa
10765 head: 1\.4
10766 branch:
10767 locks: strict
10768 access list:
10769 symbolic names:
10770         br1: 1\.3\.0\.2
10771 keyword substitution: kv
10772 total revisions: 5;     selected revisions: 5
10773 description:
10774 ----------------------------
10775 revision 1\.4
10776 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10777 fourth
10778 ----------------------------
10779 revision 1\.3
10780 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10781 branches:  1\.3\.2;
10782 third
10783 ----------------------------
10784 revision 1\.2
10785 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
10786 second
10787 ----------------------------
10788 revision 1\.1
10789 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10790 first
10791 ----------------------------
10792 revision 1\.3\.2\.4
10793 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
10794 branch-four
10795 ============================================================================="
10796
10797           dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
10798 "first rev
10799 second rev
10800 third rev
10801 new branch rev
10802 second branch rev
10803 third branch rev
10804 fourth branch rev"
10805
10806           # The bit here about how there is a "tagone" tag pointing to
10807           # a nonexistent revision is documented by rcs.  I dunno, I
10808           # wonder whether the "cvs admin -o" should give a warning in
10809           # this case.
10810           dotest admin-23 "${testcvs} -q log file2" "
10811 RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
10812 Working file: file2
10813 head: 1\.2
10814 branch:
10815 locks: strict
10816 access list:
10817         auth3
10818         auth2
10819         foo
10820 symbolic names:
10821         tagone: 1\.1
10822         br: 1\.1\.0\.2
10823 keyword substitution: kv
10824 total revisions: 1;     selected revisions: 1
10825 description:
10826 ----------------------------
10827 revision 1\.2
10828 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10829 modify
10830 ============================================================================="
10831
10832           dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
10833 "head   1\.1;
10834 access
10835         foo
10836         auth2;
10837 symbols;
10838 locks; strict;
10839 comment @xx@;
10840
10841
10842 1\.1
10843 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;
10844 branches
10845         1\.1\.2\.1;
10846 next    ;
10847
10848 1\.1\.2\.1
10849 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;
10850 branches;
10851 next    ;
10852
10853
10854 desc
10855 @@
10856
10857
10858 1\.1
10859 log
10860 @add
10861 @
10862 text
10863 @@
10864
10865
10866 1\.1\.2\.1
10867 log
10868 @modify-on-branch
10869 @
10870 text
10871 @a0 1
10872 add a line on the branch
10873 @"
10874
10875           cd ../..
10876           rm -r 1
10877           rm -rf ${CVSROOT_DIRNAME}/first-dir
10878           ;;
10879
10880         reserved)
10881           # Tests of reserved checkouts.  Eventually this will test
10882           # rcslock.pl (or equivalent) and all kinds of stuff.  Right
10883           # now it just does some very basic checks on cvs admin -u
10884           # and cvs admin -l.
10885           # Also should test locking on a branch (and making sure that
10886           # locks from one branch don't get mixed up with those from
10887           # another.  Both the case where one of the branches is the
10888           # main branch, and in which neither one is).
10889           # See also test keyword, which tests that keywords and -kkvl
10890           # do the right thing in the presence of locks.
10891
10892           # The usual setup, directory first-dir containing file file1.
10893           mkdir 1; cd 1
10894           dotest reserved-1 "${testcvs} -q co -l ." ''
10895           mkdir first-dir
10896           dotest reserved-2 "${testcvs} add first-dir" \
10897 "Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
10898           cd first-dir
10899           touch file1
10900           dotest reserved-3 "${testcvs} add file1" \
10901 "${PROG} [a-z]*: scheduling file .file1. for addition
10902 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
10903           dotest reserved-4 "${testcvs} -q ci -m add" \
10904 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10905 done
10906 Checking in file1;
10907 ${TESTDIR}/cvsroot/first-dir/file1,v  <--  file1
10908 initial revision: 1\.1
10909 done"
10910
10911           dotest reserved-5 "${testcvs} -q admin -l file1" \
10912 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10913 1\.1 locked
10914 done"
10915           dotest reserved-6 "${testcvs} log -N file1" "
10916 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10917 Working file: file1
10918 head: 1\.1
10919 branch:
10920 locks: strict
10921         ${username}: 1\.1
10922 access list:
10923 keyword substitution: kv
10924 total revisions: 1;     selected revisions: 1
10925 description:
10926 ----------------------------
10927 revision 1\.1   locked by: ${username};
10928 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10929 add
10930 ============================================================================="
10931
10932           # Note that this just tests the owner of the lock giving
10933           # it up.  It doesn't test breaking a lock.
10934           dotest reserved-7 "${testcvs} -q admin -u file1" \
10935 "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10936 1\.1 unlocked
10937 done"
10938
10939           dotest reserved-8 "${testcvs} log -N file1" "
10940 RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
10941 Working file: file1
10942 head: 1\.1
10943 branch:
10944 locks: strict
10945 access list:
10946 keyword substitution: kv
10947 total revisions: 1;     selected revisions: 1
10948 description:
10949 ----------------------------
10950 revision 1\.1
10951 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
10952 add
10953 ============================================================================="
10954
10955           # rcslock.pl tests.  Of course, the point isn't to test
10956           # rcslock.pl from the distribution but equivalent
10957           # functionality (for example, many sites may have an old
10958           # rcslock.pl).  The functionality of this hook falls
10959           # short of the real rcslock.pl though.
10960           # Note that we can use rlog or look at the RCS file directly,
10961           # but we can't use "cvs log" because "cvs commit" has a lock.
10962
10963           cat >${TESTDIR}/lockme <<EOF
10964 #!${TESTSHELL}
10965 line=\`grep <\$1/\$2,v 'locks ${username}:1\.[0-9];'\`
10966 if test -z "\$line"; then
10967   # It isn't locked
10968   exit 0
10969 else
10970   user=\`echo \$line | sed -e 's/locks \\(${username}\\):[0-9.]*;.*/\\1/'\`
10971   version=\`echo \$line | sed -e 's/locks ${username}:\\([0-9.]*\\);.*/\\1/'\`
10972   echo "\$user has file a-lock locked for version  \$version"
10973   exit 1
10974 fi
10975 EOF
10976           chmod +x ${TESTDIR}/lockme
10977
10978           echo stuff > a-lock
10979           dotest reserved-9 "${testcvs} add a-lock" \
10980 "${PROG} [a-z]*: scheduling file .a-lock. for addition
10981 ${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
10982           dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
10983 "RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v
10984 done
10985 Checking in a-lock;
10986 ${TESTDIR}/cvsroot/first-dir/a-lock,v  <--  a-lock
10987 initial revision: 1\.1
10988 done"
10989           # FIXME: the contents of CVSROOT fluctuate a lot
10990           # here. Maybe the expect pattern should just
10991           # confirm that commitinfo is one of the files checked out,
10992           # but for now we just check that CVS exited with success.
10993           cd ..
10994           if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
10995             pass reserved-11
10996           else
10997             fail reserved-11
10998           fi
10999           cd CVSROOT
11000           echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
11001           dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
11002 "Checking in commitinfo;
11003 ${TESTDIR}/cvsroot/CVSROOT/commitinfo,v  <--  commitinfo
11004 new revision: 1\.2; previous revision: 1\.1
11005 done
11006 ${PROG} [a-z]*: Rebuilding administrative file database"
11007           cd ..; cd first-dir
11008
11009           # Simulate (approximately) what a-lock would look like
11010           # if someone else had locked revision 1.1.
11011           sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${TESTDIR}/cvsroot/first-dir/a-lock,v > a-lock,v
11012           chmod 644 ${TESTDIR}/cvsroot/first-dir/a-lock,v
11013           dotest reserved-13 "mv a-lock,v ${TESTDIR}/cvsroot/first-dir/a-lock,v"
11014           chmod 444 ${TESTDIR}/cvsroot/first-dir/a-lock,v
11015           echo more stuff >> a-lock
11016           dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
11017 "fred has file a-lock locked for version  1\.1
11018 ${PROG} [a-z]*: Pre-commit check failed
11019 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
11020
11021           dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
11022 "RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v
11023 1\.1 unlocked
11024 done"
11025           dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
11026 "Checking in a-lock;
11027 ${TESTDIR}/cvsroot/first-dir/a-lock,v  <--  a-lock
11028 new revision: 1\.2; previous revision: 1\.1
11029 done"
11030
11031           # undo commitinfo changes
11032           cd ../CVSROOT
11033           echo '# vanilla commitinfo' >commitinfo
11034           dotest reserved-16 "${testcvs} -q ci -m back commitinfo" \
11035 "Checking in commitinfo;
11036 ${TESTDIR}/cvsroot/CVSROOT/commitinfo,v  <--  commitinfo
11037 new revision: 1\.3; previous revision: 1\.2
11038 done
11039 ${PROG} [a-z]*: Rebuilding administrative file database"
11040           cd ..; rm -r CVSROOT; cd first-dir
11041
11042           cd ../..
11043           rm -r 1
11044           rm ${TESTDIR}/lockme
11045           rm -rf ${CVSROOT_DIRNAME}/first-dir
11046           ;;
11047
11048         cvsadm)
11049           # These test check the content of CVS' administrative
11050           # files as they are checked out in various configurations.
11051           # (As a side note, I'm not using the "-q" flag in any of
11052           # this code, which should provide some extra checking for
11053           # those messages which don't seem to be checked thoroughly
11054           # anywhere else.)  To do a thorough test, we need to make
11055           # a bunch of modules in various configurations.
11056           #
11057           # <1mod> is a directory at the top level of cvsroot
11058           #    ``foo bar''
11059           # <2mod> is a directory at the second level of cvsroot
11060           #    ``foo bar/baz''
11061           # <1d1mod> is a directory at the top level which is
11062           #   checked out into another directory
11063           #     ``foo -d bar baz''
11064           # <1d2mod> is a directory at the second level which is
11065           #   checked out into another directory
11066           #     ``foo -d bar baz/quux''
11067           # <2d1mod> is a directory at the top level which is
11068           #   checked out into a directory that is two deep
11069           #     ``foo -d bar/baz quux''
11070           # <2d2mod> is a directory at the second level which is
11071           #   checked out into a directory that is two deep
11072           #     ``foo -d bar/baz quux''
11073           #
11074           # The tests do each of these types separately and in twos.
11075           # We also repeat each test -d flag for 1-deep and 2-deep
11076           # directories.
11077           #
11078           # Each test should check the output for the Repository
11079           # file, since that is the one which varies depending on 
11080           # the directory and how it was checked out.
11081           #
11082           # Yes, this is verbose, but at least it's very thorough.
11083
11084           # convenience variables
11085           REP=${CVSROOT}
11086
11087           # First, check out the modules file and edit it.
11088           mkdir 1; cd 1
11089           dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
11090 "U CVSROOT/modules"
11091
11092           # Try to determine whether RELATIVE_REPOS is defined
11093           # so that we can make the following a lot less
11094           # verbose.
11095
11096           echo "${CVSROOT_DIRNAME}/." > ${TESTDIR}/dotest.abs
11097           echo "." > ${TESTDIR}/dotest.rel
11098           if cmp ${TESTDIR}/dotest.abs CVS/Repository >/dev/null 2>&1; then
11099             AREP="${CVSROOT_DIRNAME}/"
11100           elif cmp ${TESTDIR}/dotest.rel CVS/Repository >/dev/null 2>&1; then
11101             AREP=""
11102           else
11103             fail "Cannot figure out if RELATIVE_REPOS is defined."
11104           fi
11105
11106           # Test CVS/Root once.  Since there is only one part of
11107           # the code which writes CVS/Root files (Create_Admin),
11108           # there is no point in testing this every time.
11109           dotest cvsadm-1a "cat CVS/Root" ${REP}
11110           dotest cvsadm-1b "cat CVS/Repository" \
11111 "${AREP}\."
11112           dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
11113           dotest cvsadm-1d "cat CVSROOT/CVS/Repository" \
11114 "${AREP}CVSROOT"
11115           # All of the defined module names begin with a number.
11116           # All of the top-level directory names begin with "dir".
11117           # All of the subdirectory names begin with "sub".
11118           # All of the top-level modules begin with "mod".
11119           echo "# Module defs for cvsadm tests" > CVSROOT/modules
11120           echo "1mod mod1" >> CVSROOT/modules
11121           echo "1mod-2 mod1-2" >> CVSROOT/modules
11122           echo "2mod mod2/sub2" >> CVSROOT/modules
11123           echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
11124           echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
11125           echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
11126           echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
11127           echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
11128           echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
11129           echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
11130           echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
11131           echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
11132           dotest cvsadm-1e "${testcvs} ci -m add-modules" \
11133 "${PROG} [a-z]*: Examining .
11134 ${PROG} [a-z]*: Examining CVSROOT
11135 Checking in CVSROOT/modules;
11136 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11137 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11138 done
11139 ${PROG} [a-z]*: Rebuilding administrative file database"
11140           rm -rf CVS CVSROOT;
11141
11142           # Create the various modules
11143           mkdir ${CVSROOT_DIRNAME}/mod1
11144           mkdir ${CVSROOT_DIRNAME}/mod1-2
11145           mkdir ${CVSROOT_DIRNAME}/mod2
11146           mkdir ${CVSROOT_DIRNAME}/mod2/sub2
11147           mkdir ${CVSROOT_DIRNAME}/mod2-2
11148           mkdir ${CVSROOT_DIRNAME}/mod2-2/sub2-2
11149           dotest cvsadm-2 "${testcvs} co mod1 mod1-2 mod2 mod2-2" \
11150 "${PROG} [a-z]*: Updating mod1
11151 ${PROG} [a-z]*: Updating mod1-2
11152 ${PROG} [a-z]*: Updating mod2
11153 ${PROG} [a-z]*: Updating mod2/sub2
11154 ${PROG} [a-z]*: Updating mod2-2
11155 ${PROG} [a-z]*: Updating mod2-2/sub2-2"
11156
11157           # Populate the directories for the halibut
11158           echo "file1" > mod1/file1
11159           echo "file1-2" > mod1-2/file1-2
11160           echo "file2" > mod2/sub2/file2
11161           echo "file2-2" > mod2-2/sub2-2/file2-2
11162           dotest cvsadm-2a "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
11163 "${PROG} [a-z]*: scheduling file .mod1/file1. for addition
11164 ${PROG} [a-z]*: scheduling file .mod1-2/file1-2. for addition
11165 ${PROG} [a-z]*: scheduling file .mod2/sub2/file2. for addition
11166 ${PROG} [a-z]*: scheduling file .mod2-2/sub2-2/file2-2. for addition
11167 ${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
11168
11169           dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
11170 "${PROG} [a-z]*: Examining mod1
11171 ${PROG} [a-z]*: Examining mod1-2
11172 ${PROG} [a-z]*: Examining mod2
11173 ${PROG} [a-z]*: Examining mod2/sub2
11174 ${PROG} [a-z]*: Examining mod2-2
11175 ${PROG} [a-z]*: Examining mod2-2/sub2-2
11176 RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
11177 done
11178 Checking in mod1/file1;
11179 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
11180 initial revision: 1.1
11181 done
11182 RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
11183 done
11184 Checking in mod1-2/file1-2;
11185 ${CVSROOT_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
11186 initial revision: 1.1
11187 done
11188 RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
11189 done
11190 Checking in mod2/sub2/file2;
11191 ${CVSROOT_DIRNAME}/mod2/sub2/file2,v  <--  file2
11192 initial revision: 1.1
11193 done
11194 RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
11195 done
11196 Checking in mod2-2/sub2-2/file2-2;
11197 ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v  <--  file2-2
11198 initial revision: 1.1
11199 done"
11200           # Finished creating the modules -- clean up.
11201           rm -rf CVS mod1 mod1-2 mod2 mod2-2
11202           # Done.
11203
11204           ##################################################
11205           ## Start the dizzying array of possibilities.
11206           ## Begin with each module type separately.
11207           ##################################################
11208           
11209           # Pattern -- after each checkout, first check the top-level
11210           # CVS directory.  Then, check the directories in numerical
11211           # order.
11212
11213           dotest cvsadm-3 "${testcvs} co 1mod" \
11214 "${PROG} [a-z]*: Updating 1mod
11215 U 1mod/file1"
11216           dotest cvsadm-3b "cat CVS/Repository" \
11217 "${AREP}\."
11218           dotest cvsadm-3d "cat 1mod/CVS/Repository" \
11219 "${AREP}mod1"
11220           rm -rf CVS 1mod
11221
11222           dotest cvsadm-4 "${testcvs} co 2mod" \
11223 "${PROG} [a-z]*: Updating 2mod
11224 U 2mod/file2"
11225           dotest cvsadm-4b "cat CVS/Repository" \
11226 "${AREP}\."
11227           dotest cvsadm-4d "cat 2mod/CVS/Repository" \
11228 "${AREP}mod2/sub2"
11229           rm -rf CVS 2mod
11230
11231           dotest cvsadm-5 "${testcvs} co 1d1mod" \
11232 "${PROG} [a-z]*: Updating dir1d1
11233 U dir1d1/file1"
11234           dotest cvsadm-5b "cat CVS/Repository" \
11235 "${AREP}\."
11236           dotest cvsadm-5d "cat dir1d1/CVS/Repository" \
11237 "${AREP}mod1"
11238           rm -rf CVS dir1d1
11239
11240           dotest cvsadm-6 "${testcvs} co 1d2mod" \
11241 "${PROG} [a-z]*: Updating dir1d2
11242 U dir1d2/file2"
11243           dotest cvsadm-6b "cat CVS/Repository" \
11244 "${AREP}\."
11245           dotest cvsadm-6d "cat dir1d2/CVS/Repository" \
11246 "${AREP}mod2/sub2"
11247           rm -rf CVS dir1d2
11248
11249           dotest cvsadm-7 "${testcvs} co 2d1mod" \
11250 "${PROG} [a-z]*: Updating dir2d1/sub2d1
11251 U dir2d1/sub2d1/file1"
11252           dotest cvsadm-7b "cat CVS/Repository" \
11253 "${AREP}\."
11254           dotest cvsadm-7d "cat dir2d1/CVS/Repository" \
11255 "${AREP}CVSROOT/Emptydir"
11256           dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" \
11257 "${AREP}mod1"
11258           rm -rf CVS dir2d1
11259
11260           dotest cvsadm-8 "${testcvs} co 2d2mod" \
11261 "${PROG} [a-z]*: Updating dir2d2/sub2d2
11262 U dir2d2/sub2d2/file2"
11263           dotest cvsadm-8b "cat CVS/Repository" \
11264 "${AREP}\."
11265           dotest cvsadm-8d "cat dir2d2/CVS/Repository" \
11266 "${AREP}CVSROOT/Emptydir"
11267           dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" \
11268 "${AREP}mod2/sub2"
11269           rm -rf CVS dir2d2
11270
11271           ##################################################
11272           ## You are in a shell script of twisted little
11273           ## module combination statements, all alike.
11274           ##################################################
11275
11276           ### 1mod
11277           
11278           dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
11279 "${PROG} [a-z]*: Updating 1mod
11280 U 1mod/file1
11281 ${PROG} [a-z]*: Updating 1mod-2
11282 U 1mod-2/file1-2"
11283           # the usual for the top level
11284           dotest cvsadm-9b "cat CVS/Repository" \
11285 "${AREP}\."
11286           # the usual for 1mod
11287           dotest cvsadm-9d "cat 1mod/CVS/Repository" \
11288 "${AREP}mod1"
11289           # the usual for 1mod copy
11290           dotest cvsadm-9f "cat 1mod-2/CVS/Repository" \
11291 "${AREP}mod1-2"
11292           rm -rf CVS 1mod 1mod-2
11293
11294           # 1mod 2mod redmod bluemod
11295           dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
11296 "${PROG} [a-z]*: Updating 1mod
11297 U 1mod/file1
11298 ${PROG} [a-z]*: Updating 2mod
11299 U 2mod/file2"
11300           # the usual for the top level
11301           dotest cvsadm-10b "cat CVS/Repository" \
11302 "${AREP}\."
11303           # the usual for 1mod
11304           dotest cvsadm-10d "cat 1mod/CVS/Repository" \
11305 "${AREP}mod1"
11306           # the usual for 2dmod
11307           dotest cvsadm-10f "cat 2mod/CVS/Repository" \
11308 "${AREP}mod2/sub2"
11309           rm -rf CVS 1mod 2mod
11310
11311           dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
11312 "${PROG} [a-z]*: Updating 1mod
11313 U 1mod/file1
11314 ${PROG} [a-z]*: Updating dir1d1
11315 U dir1d1/file1"
11316           # the usual for the top level
11317           dotest cvsadm-11b "cat CVS/Repository" \
11318 "${AREP}\."
11319           # the usual for 1mod
11320           dotest cvsadm-11d "cat 1mod/CVS/Repository" \
11321 "${AREP}mod1"
11322           # the usual for 1d1mod
11323           dotest cvsadm-11f "cat dir1d1/CVS/Repository" \
11324 "${AREP}mod1"
11325           rm -rf CVS 1mod dir1d1
11326
11327           dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
11328 "${PROG} [a-z]*: Updating 1mod
11329 U 1mod/file1
11330 ${PROG} [a-z]*: Updating dir1d2
11331 U dir1d2/file2"
11332           # the usual for the top level
11333           dotest cvsadm-12b "cat CVS/Repository" \
11334 "${AREP}\."
11335           # the usual for 1mod
11336           dotest cvsadm-12d "cat 1mod/CVS/Repository" \
11337 "${AREP}mod1"
11338           # the usual for 1d2mod
11339           dotest cvsadm-12f "cat dir1d2/CVS/Repository" \
11340 "${AREP}mod2/sub2"
11341           rm -rf CVS 1mod dir1d2
11342
11343           dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
11344 "${PROG} [a-z]*: Updating 1mod
11345 U 1mod/file1
11346 ${PROG} [a-z]*: Updating dir2d1/sub2d1
11347 U dir2d1/sub2d1/file1"
11348           # the usual for the top level
11349           dotest cvsadm-13b "cat CVS/Repository" \
11350 "${AREP}\."
11351           # the usual for 1mod
11352           dotest cvsadm-13d "cat 1mod/CVS/Repository" \
11353 "${AREP}mod1"
11354           # the usual for 2d1mod
11355           dotest cvsadm-13f "cat dir2d1/CVS/Repository" \
11356 "${AREP}CVSROOT/Emptydir"
11357           dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" \
11358 "${AREP}mod1"
11359           rm -rf CVS 1mod dir2d1
11360
11361           dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
11362 "${PROG} [a-z]*: Updating 1mod
11363 U 1mod/file1
11364 ${PROG} [a-z]*: Updating dir2d2/sub2d2
11365 U dir2d2/sub2d2/file2"
11366           # the usual for the top level
11367           dotest cvsadm-14b "cat CVS/Repository" \
11368 "${AREP}\."
11369           # the usual for 1mod
11370           dotest cvsadm-14d "cat 1mod/CVS/Repository" \
11371 "${AREP}mod1"
11372           # the usual for 2d2mod
11373           dotest cvsadm-14f "cat dir2d2/CVS/Repository" \
11374 "${AREP}CVSROOT/Emptydir"
11375           dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" \
11376 "${AREP}mod2/sub2"
11377           rm -rf CVS 1mod dir2d2
11378
11379
11380           ### 2mod
11381           
11382           dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
11383 "${PROG} [a-z]*: Updating 2mod
11384 U 2mod/file2
11385 ${PROG} [a-z]*: Updating 2mod-2
11386 U 2mod-2/file2-2"
11387           # the usual for the top level
11388           dotest cvsadm-15b "cat CVS/Repository" \
11389 "${AREP}\."
11390           # the usual for 2mod
11391           dotest cvsadm-15d "cat 2mod/CVS/Repository" \
11392 "${AREP}mod2/sub2"
11393           # the usual for 2mod copy
11394           dotest cvsadm-15f "cat 2mod-2/CVS/Repository" \
11395 "${AREP}mod2-2/sub2-2"
11396           rm -rf CVS 2mod 2mod-2
11397
11398
11399           dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
11400 "${PROG} [a-z]*: Updating 2mod
11401 U 2mod/file2
11402 ${PROG} [a-z]*: Updating dir1d1
11403 U dir1d1/file1"
11404           # the usual for the top level
11405           dotest cvsadm-16b "cat CVS/Repository" \
11406 "${AREP}\."
11407           # the usual for 2mod
11408           dotest cvsadm-16d "cat 2mod/CVS/Repository" \
11409 "${AREP}mod2/sub2"
11410           # the usual for 1d1mod
11411           dotest cvsadm-16f "cat dir1d1/CVS/Repository" \
11412 "${AREP}mod1"
11413           rm -rf CVS 2mod dir1d1
11414
11415           dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
11416 "${PROG} [a-z]*: Updating 2mod
11417 U 2mod/file2
11418 ${PROG} [a-z]*: Updating dir1d2
11419 U dir1d2/file2"
11420           # the usual for the top level
11421           dotest cvsadm-17b "cat CVS/Repository" \
11422 "${AREP}\."
11423           # the usual for 2mod
11424           dotest cvsadm-17d "cat 2mod/CVS/Repository" \
11425 "${AREP}mod2/sub2"
11426           # the usual for 1d2mod
11427           dotest cvsadm-17f "cat dir1d2/CVS/Repository" \
11428 "${AREP}mod2/sub2"
11429           rm -rf CVS 2mod dir1d2
11430
11431           dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
11432 "${PROG} [a-z]*: Updating 2mod
11433 U 2mod/file2
11434 ${PROG} [a-z]*: Updating dir2d1/sub2d1
11435 U dir2d1/sub2d1/file1"
11436           # the usual for the top level
11437           dotest cvsadm-18b "cat CVS/Repository" \
11438 "${AREP}\."
11439           # the usual for 2mod
11440           dotest cvsadm-18d "cat 2mod/CVS/Repository" \
11441 "${AREP}mod2/sub2"
11442           # the usual for 2d1mod
11443           dotest cvsadm-18f "cat dir2d1/CVS/Repository" \
11444 "${AREP}CVSROOT/Emptydir"
11445           dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" \
11446 "${AREP}mod1"
11447           rm -rf CVS 2mod dir2d1
11448
11449           dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
11450 "${PROG} [a-z]*: Updating 2mod
11451 U 2mod/file2
11452 ${PROG} [a-z]*: Updating dir2d2/sub2d2
11453 U dir2d2/sub2d2/file2"
11454           # the usual for the top level
11455           dotest cvsadm-19b "cat CVS/Repository" \
11456 "${AREP}\."
11457           # the usual for 2mod
11458           dotest cvsadm-19d "cat 2mod/CVS/Repository" \
11459 "${AREP}mod2/sub2"
11460           # the usual for 2d2mod
11461           dotest cvsadm-19f "cat dir2d2/CVS/Repository" \
11462 "${AREP}CVSROOT/Emptydir"
11463           dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" \
11464 "${AREP}mod2/sub2"
11465           rm -rf CVS 2mod dir2d2
11466
11467
11468           ### 1d1mod
11469
11470           dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
11471 "${PROG} [a-z]*: Updating dir1d1
11472 U dir1d1/file1
11473 ${PROG} [a-z]*: Updating dir1d1-2
11474 U dir1d1-2/file1-2"
11475           # the usual for the top level
11476           dotest cvsadm-20b "cat CVS/Repository" \
11477 "${AREP}\."
11478           # the usual for 1d1mod
11479           dotest cvsadm-20d "cat dir1d1/CVS/Repository" \
11480 "${AREP}mod1"
11481           # the usual for 1d1mod copy
11482           dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" \
11483 "${AREP}mod1-2"
11484           rm -rf CVS dir1d1 dir1d1-2
11485
11486           dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
11487 "${PROG} [a-z]*: Updating dir1d1
11488 U dir1d1/file1
11489 ${PROG} [a-z]*: Updating dir1d2
11490 U dir1d2/file2"
11491           # the usual for the top level
11492           dotest cvsadm-21b "cat CVS/Repository" \
11493 "${AREP}\."
11494           # the usual for 1d1mod
11495           dotest cvsadm-21d "cat dir1d1/CVS/Repository" \
11496 "${AREP}mod1"
11497           # the usual for 1d2mod
11498           dotest cvsadm-21f "cat dir1d2/CVS/Repository" \
11499 "${AREP}mod2/sub2"
11500           rm -rf CVS dir1d1 dir1d2
11501
11502           dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
11503 "${PROG} [a-z]*: Updating dir1d1
11504 U dir1d1/file1
11505 ${PROG} [a-z]*: Updating dir2d1/sub2d1
11506 U dir2d1/sub2d1/file1"
11507           # the usual for the top level
11508           dotest cvsadm-22b "cat CVS/Repository" \
11509 "${AREP}\."
11510           # the usual for 1d1mod
11511           dotest cvsadm-22d "cat dir1d1/CVS/Repository" \
11512 "${AREP}mod1"
11513           # the usual for 2d1mod
11514           dotest cvsadm-22f "cat dir2d1/CVS/Repository" \
11515 "${AREP}CVSROOT/Emptydir"
11516           dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" \
11517 "${AREP}mod1"
11518           rm -rf CVS dir1d1 dir2d1
11519
11520           dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
11521 "${PROG} [a-z]*: Updating dir1d1
11522 U dir1d1/file1
11523 ${PROG} [a-z]*: Updating dir2d2/sub2d2
11524 U dir2d2/sub2d2/file2"
11525           # the usual for the top level
11526           dotest cvsadm-23b "cat CVS/Repository" \
11527 "${AREP}\."
11528           # the usual for 1d1mod
11529           dotest cvsadm-23d "cat dir1d1/CVS/Repository" \
11530 "${AREP}mod1"
11531           # the usual for 2d2mod
11532           dotest cvsadm-23f "cat dir2d2/CVS/Repository" \
11533 "${AREP}CVSROOT/Emptydir"
11534           dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" \
11535 "${AREP}mod2/sub2"
11536           rm -rf CVS dir1d1 dir2d2
11537
11538
11539           ### 1d2mod
11540
11541           dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
11542 "${PROG} [a-z]*: Updating dir1d2
11543 U dir1d2/file2
11544 ${PROG} [a-z]*: Updating dir1d2-2
11545 U dir1d2-2/file2-2"
11546           # the usual for the top level
11547           dotest cvsadm-24b "cat CVS/Repository" \
11548 "${AREP}\."
11549           # the usual for 1d2mod
11550           dotest cvsadm-24d "cat dir1d2/CVS/Repository" \
11551 "${AREP}mod2/sub2"
11552           # the usual for 1d2mod copy
11553           dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" \
11554 "${AREP}mod2-2/sub2-2"
11555           rm -rf CVS dir1d2 dir1d2-2
11556
11557           dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
11558 "${PROG} [a-z]*: Updating dir1d2
11559 U dir1d2/file2
11560 ${PROG} [a-z]*: Updating dir2d1/sub2d1
11561 U dir2d1/sub2d1/file1"
11562           # the usual for the top level
11563           dotest cvsadm-25b "cat CVS/Repository" \
11564 "${AREP}\."
11565           # the usual for 1d2mod
11566           dotest cvsadm-25d "cat dir1d2/CVS/Repository" \
11567 "${AREP}mod2/sub2"
11568           # the usual for 2d1mod
11569           dotest cvsadm-25f "cat dir2d1/CVS/Repository" \
11570 "${AREP}CVSROOT/Emptydir"
11571           dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" \
11572 "${AREP}mod1"
11573           rm -rf CVS dir1d2 dir2d1
11574
11575           dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
11576 "${PROG} [a-z]*: Updating dir1d2
11577 U dir1d2/file2
11578 ${PROG} [a-z]*: Updating dir2d2/sub2d2
11579 U dir2d2/sub2d2/file2"
11580           # the usual for the top level
11581           dotest cvsadm-26b "cat CVS/Repository" \
11582 "${AREP}\."
11583           # the usual for 1d2mod
11584           dotest cvsadm-26d "cat dir1d2/CVS/Repository" \
11585 "${AREP}mod2/sub2"
11586           # the usual for 2d2mod
11587           dotest cvsadm-26f "cat dir2d2/CVS/Repository" \
11588 "${AREP}CVSROOT/Emptydir"
11589           dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" \
11590 "${AREP}mod2/sub2"
11591           rm -rf CVS dir1d2 dir2d2
11592
11593
11594           # 2d1mod
11595
11596           dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
11597 "${PROG} [a-z]*: Updating dir2d1/sub2d1
11598 U dir2d1/sub2d1/file1
11599 ${PROG} [a-z]*: Updating dir2d1-2/sub2d1-2
11600 U dir2d1-2/sub2d1-2/file1-2"
11601           # the usual for the top level
11602           dotest cvsadm-27b "cat CVS/Repository" \
11603 "${AREP}\."
11604           # the usual for 2d1mod
11605           dotest cvsadm-27d "cat dir2d1/CVS/Repository" \
11606 "${AREP}CVSROOT/Emptydir"
11607           dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" \
11608 "${AREP}mod1"
11609           # the usual for 2d1mod
11610           dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" \
11611 "${AREP}CVSROOT/Emptydir"
11612           dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" \
11613 "${AREP}mod1-2"
11614           rm -rf CVS dir2d1 dir2d1-2
11615
11616           dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
11617 "${PROG} [a-z]*: Updating dir2d1/sub2d1
11618 U dir2d1/sub2d1/file1
11619 ${PROG} [a-z]*: Updating dir2d2/sub2d2
11620 U dir2d2/sub2d2/file2"
11621           # the usual for the top level
11622           dotest cvsadm-28b "cat CVS/Repository" \
11623 "${AREP}\."
11624           # the usual for 2d1mod
11625           dotest cvsadm-28d "cat dir2d1/CVS/Repository" \
11626 "${AREP}CVSROOT/Emptydir"
11627           dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" \
11628 "${AREP}mod1"
11629           # the usual for 2d2mod
11630           dotest cvsadm-28h "cat dir2d2/CVS/Repository" \
11631 "${AREP}CVSROOT/Emptydir"
11632           dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" \
11633 "${AREP}mod2/sub2"
11634           rm -rf CVS dir2d1 dir2d2
11635
11636           
11637           # 2d2mod
11638
11639           dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
11640 "${PROG} [a-z]*: Updating dir2d2/sub2d2
11641 U dir2d2/sub2d2/file2
11642 ${PROG} [a-z]*: Updating dir2d2-2/sub2d2-2
11643 U dir2d2-2/sub2d2-2/file2-2"
11644           # the usual for the top level
11645           dotest cvsadm-29b "cat CVS/Repository" \
11646 "${AREP}\."
11647           # the usual for 2d2mod
11648           dotest cvsadm-29d "cat dir2d2/CVS/Repository" \
11649 "${AREP}CVSROOT/Emptydir"
11650           dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" \
11651 "${AREP}mod2/sub2"
11652           # the usual for 2d2mod
11653           dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" \
11654 "${AREP}CVSROOT/Emptydir"
11655           dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
11656 "${AREP}mod2-2/sub2-2"
11657           rm -rf CVS dir2d2 dir2d2-2
11658
11659           ##################################################
11660           ## And now, all of that again using the "-d" flag
11661           ## on the command line.
11662           ##################################################
11663
11664           dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
11665 "${PROG} [a-z]*: Updating dir
11666 U dir/file1"
11667           dotest cvsadm-1d3b "cat CVS/Repository" \
11668 "${AREP}\."
11669           dotest cvsadm-1d3d "cat dir/CVS/Repository" \
11670 "${AREP}mod1"
11671           rm -rf CVS dir
11672
11673           dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
11674 "${PROG} [a-z]*: Updating dir
11675 U dir/file2"
11676           dotest cvsadm-1d4b "cat CVS/Repository" \
11677 "${AREP}\."
11678           dotest cvsadm-1d4d "cat dir/CVS/Repository" \
11679 "${AREP}mod2/sub2"
11680           rm -rf CVS dir
11681
11682           dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
11683 "${PROG} [a-z]*: Updating dir
11684 U dir/file1"
11685           dotest cvsadm-1d5b "cat CVS/Repository" \
11686 "${AREP}\."
11687           dotest cvsadm-1d5d "cat dir/CVS/Repository" \
11688 "${AREP}mod1"
11689           rm -rf CVS dir
11690
11691           dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
11692 "${PROG} [a-z]*: Updating dir
11693 U dir/file2"
11694           dotest cvsadm-1d6b "cat CVS/Repository" \
11695 "${AREP}\."
11696           dotest cvsadm-1d6d "cat dir/CVS/Repository" \
11697 "${AREP}mod2/sub2"
11698           rm -rf CVS dir
11699
11700           dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
11701 "${PROG} [a-z]*: Updating dir
11702 U dir/file1"
11703           dotest cvsadm-1d7b "cat CVS/Repository" \
11704 "${AREP}\."
11705           dotest cvsadm-1d7d "cat dir/CVS/Repository" \
11706 "${AREP}mod1"
11707           rm -rf CVS dir
11708
11709           dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
11710 "${PROG} [a-z]*: Updating dir
11711 U dir/file2"
11712           dotest cvsadm-1d8b "cat CVS/Repository" \
11713 "${AREP}\."
11714           dotest cvsadm-1d8d "cat dir/CVS/Repository" \
11715 "${AREP}mod2/sub2"
11716           rm -rf CVS dir
11717
11718           ##################################################
11719           ## Los Combonaciones
11720           ##################################################
11721
11722           ### 1mod
11723
11724           dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
11725 "${PROG} [a-z]*: Updating dir/1mod
11726 U dir/1mod/file1
11727 ${PROG} [a-z]*: Updating dir/1mod-2
11728 U dir/1mod-2/file1-2"
11729           # the usual for the top level
11730           dotest cvsadm-1d9b "cat CVS/Repository" \
11731 "${AREP}\."
11732           # the usual for the dir level
11733           dotest cvsadm-1d9d "cat dir/CVS/Repository" \
11734 "${AREP}\."
11735           # the usual for 1mod
11736           dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" \
11737 "${AREP}mod1"
11738           # the usual for 1mod copy
11739           dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" \
11740 "${AREP}mod1-2"
11741           rm -rf CVS dir
11742
11743           # 1mod 2mod redmod bluemod
11744           dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
11745 "${PROG} [a-z]*: Updating dir/1mod
11746 U dir/1mod/file1
11747 ${PROG} [a-z]*: Updating dir/2mod
11748 U dir/2mod/file2"
11749           dotest cvsadm-1d10b "cat CVS/Repository" \
11750 "${AREP}\."
11751           # the usual for the dir level
11752           dotest cvsadm-1d10d "cat dir/CVS/Repository" \
11753 "${AREP}\."
11754           # the usual for 1mod
11755           dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" \
11756 "${AREP}mod1"
11757           # the usual for 2dmod
11758           dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" \
11759 "${AREP}mod2/sub2"
11760           rm -rf CVS dir
11761
11762           dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
11763 "${PROG} [a-z]*: Updating dir/1mod
11764 U dir/1mod/file1
11765 ${PROG} [a-z]*: Updating dir/dir1d1
11766 U dir/dir1d1/file1"
11767           dotest cvsadm-1d11b "cat CVS/Repository" \
11768 "${AREP}\."
11769           # the usual for the dir level
11770           dotest cvsadm-1d11d "cat dir/CVS/Repository" \
11771 "${AREP}\."
11772           # the usual for 1mod
11773           dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" \
11774 "${AREP}mod1"
11775           # the usual for 1d1mod
11776           dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" \
11777 "${AREP}mod1"
11778           rm -rf CVS dir
11779
11780           dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
11781 "${PROG} [a-z]*: Updating dir/1mod
11782 U dir/1mod/file1
11783 ${PROG} [a-z]*: Updating dir/dir1d2
11784 U dir/dir1d2/file2"
11785           dotest cvsadm-1d12b "cat CVS/Repository" \
11786 "${AREP}\."
11787           # the usual for the dir level
11788           dotest cvsadm-1d12d "cat dir/CVS/Repository" \
11789 "${AREP}\."
11790           # the usual for 1mod
11791           dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" \
11792 "${AREP}mod1"
11793           # the usual for 1d2mod
11794           dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" \
11795 "${AREP}mod2/sub2"
11796           rm -rf CVS dir
11797
11798           dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
11799 "${PROG} [a-z]*: Updating dir/1mod
11800 U dir/1mod/file1
11801 ${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
11802 U dir/dir2d1/sub2d1/file1"
11803           dotest cvsadm-1d13b "cat CVS/Repository" \
11804 "${AREP}\."
11805           # the usual for the dir level
11806           dotest cvsadm-1d13d "cat dir/CVS/Repository" \
11807 "${AREP}\."
11808           # the usual for 1mod
11809           dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" \
11810 "${AREP}mod1"
11811           # the usual for 2d1mod
11812           dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" \
11813 "${AREP}CVSROOT/Emptydir"
11814           dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" \
11815 "${AREP}mod1"
11816           rm -rf CVS dir
11817
11818           dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
11819 "${PROG} [a-z]*: Updating dir/1mod
11820 U dir/1mod/file1
11821 ${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
11822 U dir/dir2d2/sub2d2/file2"
11823           dotest cvsadm-1d14b "cat CVS/Repository" \
11824 "${AREP}\."
11825           # the usual for the dir level
11826           dotest cvsadm-1d14d "cat dir/CVS/Repository" \
11827 "${AREP}\."
11828           # the usual for 1mod
11829           dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" \
11830 "${AREP}mod1"
11831           # the usual for 2d2mod
11832           dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" \
11833 "${AREP}CVSROOT/Emptydir"
11834           dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" \
11835 "${AREP}mod2/sub2"
11836           rm -rf CVS dir
11837
11838
11839           ### 2mod
11840
11841           dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
11842 "${PROG} [a-z]*: Updating dir/2mod
11843 U dir/2mod/file2
11844 ${PROG} [a-z]*: Updating dir/2mod-2
11845 U dir/2mod-2/file2-2"
11846           dotest cvsadm-1d15b "cat CVS/Repository" \
11847 "${AREP}\."
11848           # the usual for the dir level
11849           dotest cvsadm-1d15d "cat dir/CVS/Repository" \
11850 "${AREP}\."
11851           # the usual for 2mod
11852           dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" \
11853 "${AREP}mod2/sub2"
11854           # the usual for 2mod copy
11855           dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" \
11856 "${AREP}mod2-2/sub2-2"
11857           rm -rf CVS dir
11858
11859           dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
11860 "${PROG} [a-z]*: Updating dir/2mod
11861 U dir/2mod/file2
11862 ${PROG} [a-z]*: Updating dir/dir1d1
11863 U dir/dir1d1/file1"
11864           dotest cvsadm-1d16b "cat CVS/Repository" \
11865 "${AREP}\."
11866           # the usual for the dir level
11867           dotest cvsadm-1d16d "cat dir/CVS/Repository" \
11868 "${AREP}\."
11869           # the usual for 2mod
11870           dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" \
11871 "${AREP}mod2/sub2"
11872           # the usual for 1d1mod
11873           dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" \
11874 "${AREP}mod1"
11875           rm -rf CVS dir
11876
11877           dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
11878 "${PROG} [a-z]*: Updating dir/2mod
11879 U dir/2mod/file2
11880 ${PROG} [a-z]*: Updating dir/dir1d2
11881 U dir/dir1d2/file2"
11882           dotest cvsadm-1d17b "cat CVS/Repository" \
11883 "${AREP}\."
11884           # the usual for the dir level
11885           dotest cvsadm-1d17d "cat dir/CVS/Repository" \
11886 "${AREP}\."
11887           # the usual for 2mod
11888           dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" \
11889 "${AREP}mod2/sub2"
11890           # the usual for 1d2mod
11891           dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" \
11892 "${AREP}mod2/sub2"
11893           rm -rf CVS dir
11894
11895           dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
11896 "${PROG} [a-z]*: Updating dir/2mod
11897 U dir/2mod/file2
11898 ${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
11899 U dir/dir2d1/sub2d1/file1"
11900           dotest cvsadm-1d18b "cat CVS/Repository" \
11901 "${AREP}\."
11902           # the usual for the dir level
11903           dotest cvsadm-1d18d "cat dir/CVS/Repository" \
11904 "${AREP}\."
11905           # the usual for 2mod
11906           dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" \
11907 "${AREP}mod2/sub2"
11908           # the usual for 2d1mod
11909           dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" \
11910 "${AREP}CVSROOT/Emptydir"
11911           dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" \
11912 "${AREP}mod1"
11913           rm -rf CVS dir
11914
11915           dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
11916 "${PROG} [a-z]*: Updating dir/2mod
11917 U dir/2mod/file2
11918 ${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
11919 U dir/dir2d2/sub2d2/file2"
11920           dotest cvsadm-1d19b "cat CVS/Repository" \
11921 "${AREP}\."
11922           # the usual for the dir level
11923           dotest cvsadm-1d19d "cat dir/CVS/Repository" \
11924 "${AREP}\."
11925           # the usual for 2mod
11926           dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" \
11927 "${AREP}mod2/sub2"
11928           # the usual for 2d2mod
11929           dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" \
11930 "${AREP}CVSROOT/Emptydir"
11931           dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" \
11932 "${AREP}mod2/sub2"
11933           rm -rf CVS dir
11934
11935
11936           ### 1d1mod
11937
11938           dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
11939 "${PROG} [a-z]*: Updating dir/dir1d1
11940 U dir/dir1d1/file1
11941 ${PROG} [a-z]*: Updating dir/dir1d1-2
11942 U dir/dir1d1-2/file1-2"
11943           dotest cvsadm-1d20b "cat CVS/Repository" \
11944 "${AREP}\."
11945           # the usual for the dir level
11946           dotest cvsadm-1d20d "cat dir/CVS/Repository" \
11947 "${AREP}\."
11948           # the usual for 1d1mod
11949           dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" \
11950 "${AREP}mod1"
11951           # the usual for 1d1mod copy
11952           dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" \
11953 "${AREP}mod1-2"
11954           rm -rf CVS dir
11955
11956           dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
11957 "${PROG} [a-z]*: Updating dir/dir1d1
11958 U dir/dir1d1/file1
11959 ${PROG} [a-z]*: Updating dir/dir1d2
11960 U dir/dir1d2/file2"
11961           dotest cvsadm-1d21b "cat CVS/Repository" \
11962 "${AREP}\."
11963           # the usual for the dir level
11964           dotest cvsadm-1d21d "cat dir/CVS/Repository" \
11965 "${AREP}\."
11966           # the usual for 1d1mod
11967           dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" \
11968 "${AREP}mod1"
11969           # the usual for 1d2mod
11970           dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" \
11971 "${AREP}mod2/sub2"
11972           rm -rf CVS dir
11973
11974           dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
11975 "${PROG} [a-z]*: Updating dir/dir1d1
11976 U dir/dir1d1/file1
11977 ${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
11978 U dir/dir2d1/sub2d1/file1"
11979           dotest cvsadm-1d22b "cat CVS/Repository" \
11980 "${AREP}\."
11981           # the usual for the dir level
11982           dotest cvsadm-1d22d "cat dir/CVS/Repository" \
11983 "${AREP}\."
11984           # the usual for 1d1mod
11985           dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" \
11986 "${AREP}mod1"
11987           # the usual for 2d1mod
11988           dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" \
11989 "${AREP}CVSROOT/Emptydir"
11990           dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" \
11991 "${AREP}mod1"
11992           rm -rf CVS dir
11993
11994           dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
11995 "${PROG} [a-z]*: Updating dir/dir1d1
11996 U dir/dir1d1/file1
11997 ${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
11998 U dir/dir2d2/sub2d2/file2"
11999           dotest cvsadm-1d23b "cat CVS/Repository" \
12000 "${AREP}\."
12001           # the usual for the dir level
12002           dotest cvsadm-1d23d "cat dir/CVS/Repository" \
12003 "${AREP}\."
12004           # the usual for 1d1mod
12005           dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" \
12006 "${AREP}mod1"
12007           # the usual for 2d2mod
12008           dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" \
12009 "${AREP}CVSROOT/Emptydir"
12010           dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" \
12011 "${AREP}mod2/sub2"
12012           rm -rf CVS dir
12013
12014
12015           ### 1d2mod
12016
12017           dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
12018 "${PROG} [a-z]*: Updating dir/dir1d2
12019 U dir/dir1d2/file2
12020 ${PROG} [a-z]*: Updating dir/dir1d2-2
12021 U dir/dir1d2-2/file2-2"
12022           dotest cvsadm-1d24b "cat CVS/Repository" \
12023 "${AREP}\."
12024           # the usual for the dir level
12025           dotest cvsadm-1d24d "cat dir/CVS/Repository" \
12026 "${AREP}\."
12027           # the usual for 1d2mod
12028           dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" \
12029 "${AREP}mod2/sub2"
12030           # the usual for 1d2mod copy
12031           dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" \
12032 "${AREP}mod2-2/sub2-2"
12033           rm -rf CVS dir
12034
12035           dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
12036 "${PROG} [a-z]*: Updating dir/dir1d2
12037 U dir/dir1d2/file2
12038 ${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
12039 U dir/dir2d1/sub2d1/file1"
12040           dotest cvsadm-1d25b "cat CVS/Repository" \
12041 "${AREP}\."
12042           # the usual for the dir level
12043           dotest cvsadm-1d25d "cat dir/CVS/Repository" \
12044 "${AREP}\."
12045           # the usual for 1d2mod
12046           dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" \
12047 "${AREP}mod2/sub2"
12048           # the usual for 2d1mod
12049           dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" \
12050 "${AREP}CVSROOT/Emptydir"
12051           dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" \
12052 "${AREP}mod1"
12053           rm -rf CVS dir
12054
12055           dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
12056 "${PROG} [a-z]*: Updating dir/dir1d2
12057 U dir/dir1d2/file2
12058 ${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
12059 U dir/dir2d2/sub2d2/file2"
12060           dotest cvsadm-1d26b "cat CVS/Repository" \
12061 "${AREP}\."
12062           # the usual for the dir level
12063           dotest cvsadm-1d26d "cat dir/CVS/Repository" \
12064 "${AREP}\."
12065           # the usual for 1d2mod
12066           dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" \
12067 "${AREP}mod2/sub2"
12068           # the usual for 2d2mod
12069           dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" \
12070 "${AREP}CVSROOT/Emptydir"
12071           dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" \
12072 "${AREP}mod2/sub2"
12073           rm -rf CVS dir
12074
12075
12076           # 2d1mod
12077
12078           dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
12079 "${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
12080 U dir/dir2d1/sub2d1/file1
12081 ${PROG} [a-z]*: Updating dir/dir2d1-2/sub2d1-2
12082 U dir/dir2d1-2/sub2d1-2/file1-2"
12083           dotest cvsadm-1d27b "cat CVS/Repository" \
12084 "${AREP}\."
12085           # the usual for the dir level
12086           dotest cvsadm-1d27d "cat dir/CVS/Repository" \
12087 "${AREP}\."
12088           # the usual for 2d1mod
12089           dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" \
12090 "${AREP}CVSROOT/Emptydir"
12091           dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" \
12092 "${AREP}mod1"
12093           # the usual for 2d1mod
12094           dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" \
12095 "${AREP}CVSROOT/Emptydir"
12096           dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
12097 "${AREP}mod1-2"
12098           rm -rf CVS dir
12099
12100           dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
12101 "${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
12102 U dir/dir2d1/sub2d1/file1
12103 ${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
12104 U dir/dir2d2/sub2d2/file2"
12105           dotest cvsadm-1d28b "cat CVS/Repository" \
12106 "${AREP}\."
12107           # the usual for the dir level
12108           dotest cvsadm-1d28d "cat dir/CVS/Repository" \
12109 "${AREP}\."
12110           # the usual for 2d1mod
12111           dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" \
12112 "${AREP}CVSROOT/Emptydir"
12113           dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" \
12114 "${AREP}mod1"
12115           # the usual for 2d2mod
12116           dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" \
12117 "${AREP}CVSROOT/Emptydir"
12118           dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" \
12119 "${AREP}mod2/sub2"
12120           rm -rf CVS dir
12121
12122           
12123           # 2d2mod
12124
12125           dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
12126 "${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
12127 U dir/dir2d2/sub2d2/file2
12128 ${PROG} [a-z]*: Updating dir/dir2d2-2/sub2d2-2
12129 U dir/dir2d2-2/sub2d2-2/file2-2"
12130           dotest cvsadm-1d29b "cat CVS/Repository" \
12131 "${AREP}\."
12132           # the usual for the dir level
12133           dotest cvsadm-1d29d "cat dir/CVS/Repository" \
12134 "${AREP}\."
12135           # the usual for 2d2mod
12136           dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" \
12137 "${AREP}CVSROOT/Emptydir"
12138           dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" \
12139 "${AREP}mod2/sub2"
12140           # the usual for 2d2mod
12141           dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" \
12142 "${AREP}CVSROOT/Emptydir"
12143           dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
12144 "${AREP}mod2-2/sub2-2"
12145           rm -rf CVS dir
12146
12147           ##################################################
12148           ## And now, some of that again using the "-d" flag
12149           ## on the command line, but use a longer path.
12150           ##################################################
12151
12152           dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
12153 "${PROG} [a-z]*: Updating dir/dir2
12154 U dir/dir2/file1"
12155           dotest cvsadm-2d3b "cat CVS/Repository" \
12156 "${AREP}\."
12157           dotest cvsadm-2d3d "cat dir/CVS/Repository" \
12158 "${AREP}CVSROOT/Emptydir"
12159           dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" \
12160 "${AREP}mod1"
12161           rm -rf CVS dir
12162
12163           dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
12164 "${PROG} [a-z]*: Updating dir/dir2
12165 U dir/dir2/file2"
12166           dotest cvsadm-2d4b "cat CVS/Repository" \
12167 "${AREP}\."
12168           dotest cvsadm-2d4d "cat dir/CVS/Repository" \
12169 "${AREP}CVSROOT/Emptydir"
12170           dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" \
12171 "${AREP}mod2/sub2"
12172           rm -rf CVS dir
12173
12174           dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
12175 "${PROG} [a-z]*: Updating dir/dir2
12176 U dir/dir2/file1"
12177           dotest cvsadm-2d5b "cat CVS/Repository" \
12178 "${AREP}\."
12179           dotest cvsadm-2d5d "cat dir/CVS/Repository" \
12180 "${AREP}CVSROOT/Emptydir"
12181           dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" \
12182 "${AREP}mod1"
12183           rm -rf CVS dir
12184
12185           dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
12186 "${PROG} [a-z]*: Updating dir/dir2
12187 U dir/dir2/file2"
12188           dotest cvsadm-2d6b "cat CVS/Repository" \
12189 "${AREP}\."
12190           dotest cvsadm-2d6d "cat dir/CVS/Repository" \
12191 "${AREP}CVSROOT/Emptydir"
12192           dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" \
12193 "${AREP}mod2/sub2"
12194           rm -rf CVS dir
12195
12196           dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
12197 "${PROG} [a-z]*: Updating dir/dir2
12198 U dir/dir2/file1"
12199           dotest cvsadm-2d7b "cat CVS/Repository" \
12200 "${AREP}\."
12201           dotest cvsadm-2d7d "cat dir/CVS/Repository" \
12202 "${AREP}CVSROOT/Emptydir"
12203           dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" \
12204 "${AREP}mod1"
12205           rm -rf CVS dir
12206
12207           dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
12208 "${PROG} [a-z]*: Updating dir/dir2
12209 U dir/dir2/file2"
12210           dotest cvsadm-2d8b "cat CVS/Repository" \
12211 "${AREP}\."
12212           dotest cvsadm-2d8d "cat dir/CVS/Repository" \
12213 "${AREP}CVSROOT/Emptydir"
12214           dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" \
12215 "${AREP}mod2/sub2"
12216           rm -rf CVS dir
12217
12218           ##################################################
12219           ## And now, a few of those tests revisited to
12220           ## test the behavior of the -N flag.
12221           ##################################################
12222
12223           dotest cvsadm-N3 "${testcvs} co -N 1mod" \
12224 "${PROG} [a-z]*: Updating 1mod
12225 U 1mod/file1"
12226           dotest cvsadm-N3b "cat CVS/Repository" \
12227 "${AREP}\."
12228           dotest cvsadm-N3d "cat 1mod/CVS/Repository" \
12229 "${AREP}mod1"
12230           rm -rf CVS 1mod
12231
12232           dotest cvsadm-N4 "${testcvs} co -N 2mod" \
12233 "${PROG} [a-z]*: Updating 2mod
12234 U 2mod/file2"
12235           dotest cvsadm-N4b "cat CVS/Repository" \
12236 "${AREP}\."
12237           dotest cvsadm-N4d "cat 2mod/CVS/Repository" \
12238 "${AREP}mod2/sub2"
12239           rm -rf CVS 2mod
12240
12241           dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
12242 "${PROG} [a-z]*: Updating dir1d1
12243 U dir1d1/file1"
12244           dotest cvsadm-N5b "cat CVS/Repository" \
12245 "${AREP}\."
12246           dotest cvsadm-N5d "cat dir1d1/CVS/Repository" \
12247 "${AREP}mod1"
12248           rm -rf CVS dir1d1
12249
12250           dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
12251 "${PROG} [a-z]*: Updating dir1d2
12252 U dir1d2/file2"
12253           dotest cvsadm-N6b "cat CVS/Repository" \
12254 "${AREP}\."
12255           dotest cvsadm-N6d "cat dir1d2/CVS/Repository" \
12256 "${AREP}mod2/sub2"
12257           rm -rf CVS dir1d2
12258
12259           dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
12260 "${PROG} [a-z]*: Updating dir2d1/sub2d1
12261 U dir2d1/sub2d1/file1"
12262           dotest cvsadm-N7b "cat CVS/Repository" \
12263 "${AREP}\."
12264           dotest cvsadm-N7d "cat dir2d1/CVS/Repository" \
12265 "${AREP}CVSROOT/Emptydir"
12266           dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" \
12267 "${AREP}mod1"
12268           rm -rf CVS dir2d1
12269
12270           dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
12271 "${PROG} [a-z]*: Updating dir2d2/sub2d2
12272 U dir2d2/sub2d2/file2"
12273           dotest cvsadm-N8b "cat CVS/Repository" \
12274 "${AREP}\."
12275           dotest cvsadm-N8d "cat dir2d2/CVS/Repository" \
12276 "${AREP}CVSROOT/Emptydir"
12277           dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" \
12278 "${AREP}mod2/sub2"
12279           rm -rf CVS dir2d2
12280
12281           ## the ones in one-deep directories
12282
12283           dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
12284 "${PROG} [a-z]*: Updating dir/1mod
12285 U dir/1mod/file1"
12286           dotest cvsadm-N1d3b "cat CVS/Repository" \
12287 "${AREP}\."
12288           dotest cvsadm-N1d3d "cat dir/CVS/Repository" \
12289 "${AREP}\."
12290           dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" \
12291 "${AREP}mod1"
12292           rm -rf CVS dir
12293
12294           dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
12295 "${PROG} [a-z]*: Updating dir/2mod
12296 U dir/2mod/file2"
12297           dotest cvsadm-N1d4b "cat CVS/Repository" \
12298 "${AREP}\."
12299           dotest cvsadm-N1d4d "cat dir/CVS/Repository" \
12300 "${AREP}\."
12301           dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" \
12302 "${AREP}mod2/sub2"
12303           rm -rf CVS dir
12304
12305           dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
12306 "${PROG} [a-z]*: Updating dir/dir1d1
12307 U dir/dir1d1/file1"
12308           dotest cvsadm-N1d5b "cat CVS/Repository" \
12309 "${AREP}\."
12310           dotest cvsadm-N1d5d "cat dir/CVS/Repository" \
12311 "${AREP}\."
12312           dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" \
12313 "${AREP}mod1"
12314           rm -rf CVS dir
12315
12316           dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
12317 "${PROG} [a-z]*: Updating dir/dir1d2
12318 U dir/dir1d2/file2"
12319           dotest cvsadm-N1d6b "cat CVS/Repository" \
12320 "${AREP}\."
12321           dotest cvsadm-N1d6d "cat dir/CVS/Repository" \
12322 "${AREP}\."
12323           dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" \
12324 "${AREP}mod2/sub2"
12325           rm -rf CVS dir
12326
12327           dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
12328 "${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
12329 U dir/dir2d1/sub2d1/file1"
12330           dotest cvsadm-N1d7b "cat CVS/Repository" \
12331 "${AREP}\."
12332           dotest cvsadm-N1d7d "cat dir/CVS/Repository" \
12333 "${AREP}\."
12334           dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" \
12335 "${AREP}CVSROOT/Emptydir"
12336           dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" \
12337 "${AREP}mod1"
12338           rm -rf CVS dir
12339
12340           dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
12341 "${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
12342 U dir/dir2d2/sub2d2/file2"
12343           dotest cvsadm-N1d8b "cat CVS/Repository" \
12344 "${AREP}\."
12345           dotest cvsadm-N1d8d "cat dir/CVS/Repository" \
12346 "${AREP}\."
12347           dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" \
12348 "${AREP}CVSROOT/Emptydir"
12349           dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
12350 "${AREP}mod2/sub2"
12351           rm -rf CVS dir
12352
12353           ## the ones in two-deep directories
12354
12355           dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
12356 "${PROG} [a-z]*: Updating dir/dir2/1mod
12357 U dir/dir2/1mod/file1"
12358           dotest cvsadm-N2d3b "cat CVS/Repository" \
12359 "${AREP}\."
12360           dotest cvsadm-N2d3d "cat dir/CVS/Repository" \
12361 "${AREP}CVSROOT/Emptydir"
12362           dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" \
12363 "${AREP}\."
12364           dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" \
12365 "${AREP}mod1"
12366           rm -rf CVS dir
12367
12368           dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
12369 "${PROG} [a-z]*: Updating dir/dir2/2mod
12370 U dir/dir2/2mod/file2"
12371           dotest cvsadm-N2d4b "cat CVS/Repository" \
12372 "${AREP}\."
12373           dotest cvsadm-N2d4d "cat dir/CVS/Repository" \
12374 "${AREP}CVSROOT/Emptydir"
12375           dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" \
12376 "${AREP}\."
12377           dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" \
12378 "${AREP}mod2/sub2"
12379           rm -rf CVS dir
12380
12381           dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
12382 "${PROG} [a-z]*: Updating dir/dir2/dir1d1
12383 U dir/dir2/dir1d1/file1"
12384           dotest cvsadm-N2d5b "cat CVS/Repository" \
12385 "${AREP}\."
12386           dotest cvsadm-N2d5d "cat dir/CVS/Repository" \
12387 "${AREP}CVSROOT/Emptydir"
12388           dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" \
12389 "${AREP}\."
12390           dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" \
12391 "${AREP}mod1"
12392           rm -rf CVS dir
12393
12394           dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
12395 "${PROG} [a-z]*: Updating dir/dir2/dir1d2
12396 U dir/dir2/dir1d2/file2"
12397           dotest cvsadm-N2d6b "cat CVS/Repository" \
12398 "${AREP}\."
12399           dotest cvsadm-N2d6d "cat dir/CVS/Repository" \
12400 "${AREP}CVSROOT/Emptydir"
12401           dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" \
12402 "${AREP}\."
12403           dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" \
12404 "${AREP}mod2/sub2"
12405           rm -rf CVS dir
12406
12407           dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
12408 "${PROG} [a-z]*: Updating dir/dir2/dir2d1/sub2d1
12409 U dir/dir2/dir2d1/sub2d1/file1"
12410           dotest cvsadm-N2d7b "cat CVS/Repository" \
12411 "${AREP}\."
12412           dotest cvsadm-N2d7d "cat dir/CVS/Repository" \
12413 "${AREP}CVSROOT/Emptydir"
12414           dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" \
12415 "${AREP}\."
12416           dotest cvsadm-N2d7f "cat dir/dir2/dir2d1/CVS/Repository" \
12417 "${AREP}CVSROOT/Emptydir"
12418           dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
12419 "${AREP}mod1"
12420           rm -rf CVS dir
12421
12422           dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
12423 "${PROG} [a-z]*: Updating dir/dir2/dir2d2/sub2d2
12424 U dir/dir2/dir2d2/sub2d2/file2"
12425           dotest cvsadm-N2d8b "cat CVS/Repository" \
12426 "${AREP}\."
12427           dotest cvsadm-N2d8d "cat dir/CVS/Repository" \
12428 "${AREP}CVSROOT/Emptydir"
12429           dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" \
12430 "${AREP}\."
12431           dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" \
12432 "${AREP}CVSROOT/Emptydir"
12433           dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
12434 "${AREP}mod2/sub2"
12435           rm -rf CVS dir
12436
12437           ##################################################
12438           ## That's enough of that, thank you very much.
12439           ##################################################
12440
12441           # remove our junk
12442           cd ..
12443           rm -rf 1
12444           rm -rf ${CVSROOT_DIRNAME}/1mod
12445           rm -rf ${CVSROOT_DIRNAME}/1mod-2
12446           rm -rf ${CVSROOT_DIRNAME}/2mod
12447           rm -rf ${CVSROOT_DIRNAME}/2mod-2
12448           ;;
12449
12450         diffmerge1)
12451           # Make sure CVS can merge correctly in circumstances where it
12452           # used to mess up (due to a bug which existed in diffutils 2.7
12453           # and 2.6, but not 2.5, and which has been fixed in CVS's diff
12454           # lib by Paul Eggert, bless his bitty heart).
12455
12456           # This first test involves two working copies, "mine" and
12457           # "yours", checked out from the same repository at the same
12458           # time.  In yours, you remove some text from the end of the
12459           # file and check it in; meanwhile, "me" has commented out some
12460           # lines earlier in the file, and I go to check it in right
12461           # after you checked yours in.  CVS naturally tells me the file
12462           # is not up-to-date, so I run cvs update, but it updates
12463           # incorrectly, leaving in the lines of text you just deleted.
12464           # Bad!  I'm in too much of a hurry to actually look at the
12465           # file, so I check it in and go home, and so your changes have
12466           # been lost.  Later you discover this, and you suspect me of
12467           # deliberately sabotaging your work, so you let all the air
12468           # out of my tires.  Only after a series of expensive lawsuits
12469           # and countersuits do we discover it this was all CVS's
12470           # fault.
12471           #
12472           # Luckily, this problem has been fixed now, as our test will
12473           # handily confirm, no doubt:
12474
12475           # First make a repository containing the original text:
12476
12477           # We should be here anyway, but cd to it just in case:
12478           cd ${TESTDIR}
12479
12480           mkdir diffmerge1
12481           cd diffmerge1
12482
12483           # The text of the file is inlined here because `echo' loses
12484           # newlines, and I don't know how portable the -e flag is.
12485           # 
12486           # This is the file we both start out with:
12487           echo "// Button.java
12488
12489 package random.application;
12490
12491 import random.util.star;
12492
12493 public class Button
12494 {
12495   /star Instantiates a Button with origin (0, 0) and zero width and height.
12496    star You must call an initializer method to properly initialize the Button.
12497    star/
12498   public Button ()
12499   {
12500     super ();
12501
12502     _titleColor = Color.black;
12503     _disabledTitleColor = Color.gray;
12504     _titleFont = Font.defaultFont ();
12505   }
12506
12507   /star Convenience constructor for instantiating a Button with
12508    star bounds x, y, width, and height.  Equivalent to
12509    star     foo = new Button ();
12510    star     foo.init (x, y, width, height);
12511    star/
12512   public Button (int x, int y, int width, int height)
12513   {
12514     this ();
12515     init (x, y, width, height);
12516   }
12517 }" > the_file
12518
12519           dotest diffmerge1_import \
12520             "${testcvs} import -m import diffmerge1 tag1 tag2" \
12521             "${DOTSTAR}No conflicts created by this import"
12522           cd ..
12523           rm -rf diffmerge1
12524
12525           # Check out two working copies, one for "you" and one for "me"
12526           ${testcvs} checkout diffmerge1 >/dev/null 2>&1
12527           mv diffmerge1 diffmerge1_yours
12528           ${testcvs} checkout diffmerge1 >/dev/null 2>&1
12529           mv diffmerge1 diffmerge1_mine
12530
12531           # In your working copy, you'll remove the Button() method, and
12532           # then check in your change before I check in mine:
12533           cd diffmerge1_yours
12534           echo "// Button.java
12535
12536 package random.application;
12537
12538 import random.util.star;
12539
12540 public class Button
12541 {
12542   /star Instantiates a Button with origin (0, 0) and zero width and height.
12543    star You must call an initializer method to properly initialize the Button.
12544    star/
12545   public Button ()
12546   {
12547     super ();
12548
12549     _titleColor = Color.black;
12550     _disabledTitleColor = Color.gray;
12551     _titleFont = Font.defaultFont ();
12552   }
12553 }" > the_file
12554           dotest diffmerge1_yours \
12555             "${testcvs} ci -m yours" \
12556             "${DOTSTAR}hecking in ${DOTSTAR}"
12557
12558           # My working copy still has the Button() method, but I
12559           # comment out some code at the top of the class.  Then I
12560           # update, after both my modifications and your checkin:
12561           cd ../diffmerge1_mine
12562           echo "// Button.java
12563
12564 package random.application;
12565
12566 import random.util.star;
12567
12568 public class Button
12569 {
12570   /star Instantiates a Button with origin (0, 0) and zero width and height.
12571    star You must call an initializer method to properly initialize the Button.
12572    star/
12573   public Button ()
12574   {
12575     super ();
12576
12577     // _titleColor = Color.black;
12578     // _disabledTitleColor = Color.gray;
12579     // _titleFont = Font.defaultFont ();
12580   }
12581
12582   /star Convenience constructor for instantiating a Button with
12583    star bounds x, y, width, and height.  Equivalent to
12584    star     foo = new Button ();
12585    star     foo.init (x, y, width, height);
12586    star/
12587   public Button (int x, int y, int width, int height)
12588   {
12589     this ();
12590     init (x, y, width, height);
12591   }
12592 }" > the_file
12593           dotest diffmerge1_mine \
12594             "${testcvs} update" \
12595             "${DOTSTAR}erging${DOTSTAR}"
12596
12597           # So if your changes didn't make it into my working copy, or
12598           # in any case if the file does not look like the final text as
12599           # quoted below, then the test flunks:
12600           echo "// Button.java
12601
12602 package random.application;
12603
12604 import random.util.star;
12605
12606 public class Button
12607 {
12608   /star Instantiates a Button with origin (0, 0) and zero width and height.
12609    star You must call an initializer method to properly initialize the Button.
12610    star/
12611   public Button ()
12612   {
12613     super ();
12614
12615     // _titleColor = Color.black;
12616     // _disabledTitleColor = Color.gray;
12617     // _titleFont = Font.defaultFont ();
12618   }
12619 }" > comp_me
12620           dotest diffmerge1_cmp "cmp the_file comp_me" ''
12621
12622           # Clean up after ourselves:
12623           cd ..
12624           rm -rf diffmerge1_yours diffmerge1_mine ${CVSROOT_DIRNAME}/diffmerge1
12625
12626           ;;
12627
12628         diffmerge2)
12629
12630           # FIXME: This test should be rewritten to be much more concise.
12631           # It currently weighs in at something like 600 lines, but the
12632           # same thing could probably be tested in more like 50-100 lines.
12633           mkdir diffmerge2
12634
12635           # This tests for another diffmerge bug reported by Martin
12636           # Tomes; actually, his bug was probably caused by an initial
12637           # fix for the bug in test diffmerge1, and likely wasn't ever
12638           # a problem in CVS as long as one was using a normal
12639           # distribution of diff or a version of CVS that has the diff
12640           # lib in it. 
12641           #
12642           # Nevertheless, once burned twice cautious, so we test for his
12643           # bug here.
12644           #
12645           # Here is his report, more or less verbatim:
12646           # ------------------------------------------
12647           #
12648           # Put the attached file (sgrid.h,v) into your repository
12649           # somewhere, check out the module and do this:
12650           #
12651           # cvs update -j Review_Phase_2_Enhancements sgrid.h
12652           # cvs diff -r Review_V1p3 sgrid.h
12653           #
12654           # As there have been no changes made on the trunk there
12655           # should be no differences, however this is output:
12656           #
12657           # % cvs diff -r Review_V1p3 sgrid.h
12658           # Index: sgrid.h
12659           # ===================================================================
12660           # RCS file: /usr/local/repository/play/fred/sgrid.h,v
12661           # retrieving revision 1.1.2.1
12662           # diff -r1.1.2.1 sgrid.h
12663           # 178a179,184
12664           # > /*--------------------------------------------------------------
12665           # > INLINE FUNCTION    :    HORIZONTALLINES
12666           # > NOTES              :    Description at the end of the file
12667           # > ----------------------------------------------------------------*/
12668           # >         uint16 horizontalLines( void );
12669           # >
12670           #
12671           # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
12672           # differences to sgrid.h version 1.1 and got the correct result
12673           # so it looks like the built in patch is faulty.
12674           # -------------------------------------------------------------------
12675           #
12676           # This is the RCS file, sgrid.h,v, that he sent:
12677
12678           echo "head    1.1;
12679 access;
12680 symbols
12681         Review_V1p3:1.1.2.1
12682         Review_V1p3C:1.1.2.1
12683         Review_1p3A:1.1.2.1
12684         Review_V1p3A:1.1.2.1
12685         Review_Phase_2_Enhancements:1.1.0.2
12686         Review_V1p2:1.1
12687         Review_V1p2B:1.1
12688         Review_V1p2A:1.1
12689         Review_V1p1:1.1
12690         Review_1p1:1.1;
12691 locks; strict;
12692 comment @ * @;
12693
12694
12695 1.1
12696 date    97.04.02.11.20.05;      author colinl;  state Exp;
12697 branches
12698         1.1.2.1;
12699 next    ;
12700
12701 1.1.2.1
12702 date    97.06.09.10.00.07;      author colinl;  state Exp;
12703 branches;
12704 next    ;
12705
12706
12707 desc
12708 @@
12709
12710
12711 1.1
12712 log
12713 @Project:     DEV1175
12714 DCN:
12715 Tested By:   Colin Law
12716 Reviewed By:
12717 Reason for Change: Initial Revision of all files
12718
12719 Design Change Details:
12720
12721 Implications:
12722 @
12723 text
12724 @/* \$""Header:   L:/gpanels/dis/sgrid.h_v   1.1.1.0   24 Jan 1996 14:59:20   PAULT  \$ */
12725 /*
12726  * \$""Log:   L:/gpanels/dis/sgrid.h_v  \$
12727  * 
12728  *    Rev 1.1.1.0   24 Jan 1996 14:59:20   PAULT
12729  * Branched
12730  * 
12731  *    Rev 1.1   24 Jan 1996 12:09:52   PAULT
12732  * Consolidated 4100 code merged to trunk
12733  * 
12734  *    Rev 1.0.2.0   01 Jun 1995 14:18:58   DAVEH
12735  * Branched
12736  * 
12737  *    Rev 1.0   19 Apr 1995 16:32:48   COLINL
12738  * Initial revision.
12739 */
12740 /*****************************************************************************
12741 FILE        :   SGRID.H
12742 VERSION     :   2.1
12743 AUTHOR      :   Dave Hartley
12744 SYSTEM      :   Borland C++
12745 DESCRIPTION :   The declaration of the scrolling grid class
12746                   
12747 *****************************************************************************/
12748 #if !defined(__SGRID_H)
12749 #define __SGRID_H
12750
12751 #if !defined(__SCROLL_H)
12752 #include <scroll.h>
12753 #endif
12754
12755 #if !defined(__GKI_H)
12756 #include \"gki.h\"
12757 #endif
12758
12759 #if defined PRINTING_SUPPORT
12760 class Printer;
12761 #endif
12762
12763 /*****************************************************************************
12764 CLASS      :    ScrollingGrid   
12765 DESCRIPTION:    This class inherits from a grid and a scrollable, and
12766                 can therefore use all the PUBLIC services provided by these
12767                 classes. A description of these can be found in
12768                 GRID.H and SCROLL.H.
12769                 A scrolling grid is a set of horizontal and vertical lines
12770                 that scroll and continually update to provide a complete grid
12771
12772 *****************************************************************************/
12773
12774 class ScrollingGrid : public Scrollable
12775 {
12776     public:
12777 #if defined _WINDOWS
12778 /*---------------------------------------------------------------------------
12779 FUNCTION    :   CONSTRUCTOR
12780 DESCRIPTION :   sets up the details of the grid, ready for painting
12781 ARGUMENTS   :   name  : sgColour
12782                         - the colour of the grid
12783                         sgLineType
12784                         - the syle of line
12785                         sgHorizontalTotal
12786                         - the total number of horizontal grid lines
12787                         verticalSpacingMin
12788                         - the min distance between the vertical grid lines
12789                           on the scrolling axis
12790                         currentTimestamp
12791                         - timestamp value now
12792                         ticksPerSecond
12793                         - number of timestamp ticks per second
12794                         ticksPerPixel
12795                         - number of timestamp ticks per pixel required
12796                       
12797 RETURN      :   None
12798 NOTES       :   
12799 ---------------------------------------------------------------------------*/
12800         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, 
12801             uint16 sgHorizontalTotal, 
12802             uint16 verticalSpacingMin, uint32 currentTimestamp, 
12803             uint16 ticksPerSecond, uint32 ticksPerPixel );
12804 #else
12805 /*---------------------------------------------------------------------------
12806 FUNCTION    :   CONSTRUCTOR
12807 DESCRIPTION :   sets up the details of the grid, ready for painting
12808 ARGUMENTS   :   name  : sgColour
12809                         - the colour of the grid
12810                         sgLineType
12811                         - the syle of line
12812                         sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
12813                         - the total number of horizontal grid lines
12814                         sgVerticalSpacing
12815                         - the distance between the vertical grid lines
12816                         on the scrolling axis
12817                       
12818 RETURN      :   None
12819 NOTES       :   If the caller does not get the total grid lines value, synced
12820                 with the overall size of the viewport, the spacing between
12821                 grid lines will not be consistent.
12822
12823 ---------------------------------------------------------------------------*/
12824         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
12825                      , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
12826 #endif
12827 /*---------------------------------------------------------------------------
12828 FUNCTION    :   DESTRUCTOR
12829 DESCRIPTION :   tidies it all up
12830 ARGUMENTS   :   name  :      
12831                       
12832 RETURN      :   None
12833 NOTES       : 
12834 ---------------------------------------------------------------------------*/
12835         ~ScrollingGrid( void );
12836
12837 /*---------------------------------------------------------------------------
12838 FUNCTION    :   ATTACH
12839 DESCRIPTION :   This service overloads the base class service, as it does
12840                 additional work at the time of attachment.
12841
12842 ARGUMENTS   :   name  : tDrawingArea
12843                         - the scrolled viewport to attach this trend to
12844                       
12845 RETURN      :   None
12846 NOTES       :
12847 ---------------------------------------------------------------------------*/
12848         void attach( SViewport *tDrawingArea );
12849
12850 #if defined _WINDOWS
12851 /*---------------------------------------------------------------------------
12852 FUNCTION    :   calculateVerticalSpacing
12853 DESCRIPTION :   determines optimum spacing along time axis
12854 ARGUMENTS   :   
12855 RETURN      :   None
12856 NOTES       : 
12857 ---------------------------------------------------------------------------*/
12858         void calculateVerticalSpacing();
12859
12860 /*---------------------------------------------------------------------------
12861 FUNCTION    :   gridSpacingTicks
12862 DESCRIPTION :   Provides the grid spacing in the time axis in ticks
12863 ARGUMENTS   :   
12864 RETURN      :   Number of ticks
12865 NOTES       : 
12866 ---------------------------------------------------------------------------*/
12867         uint32 gridSpacingTicks();
12868
12869 #endif
12870
12871 /*---------------------------------------------------------------------------
12872 INLINE FUNCTION    :    HORIZONTALLINES
12873 NOTES              :    Description at the end of the file
12874 ---------------------------------------------------------------------------*/
12875         uint16 horizontalLines( void );
12876
12877 #if defined _WINDOWS
12878 // In Windows the OnDraw() function replaces paint()
12879 /*---------------------------------------------------------------------------
12880 FUNCTION    :   ScrollingGrid OnDraw   
12881 DESCRIPTION :   Paints the given area of the grid.
12882                 Pure virtual
12883 ARGUMENTS   :   pDC     pointer to the device context to use for display
12884                         Note that the device context operates in the coords
12885                         of the window owning the viewport
12886 RETURN      :   None
12887 NOTES       : 
12888 ---------------------------------------------------------------------------*/
12889         virtual void OnDraw( CDC *pDC );
12890
12891 #else   // not Windows            
12892
12893 /*---------------------------------------------------------------------------
12894 FUNCTION    :   PAINT
12895 DESCRIPTION :   This extends the standard grid paint method to paint the
12896                 viewport relative to its current position. 
12897                 
12898 ARGUMENTS   :   name  :      
12899                       
12900 RETURN      :   None
12901 NOTES       : 
12902 ---------------------------------------------------------------------------*/
12903         void paint( void );
12904 #endif
12905
12906 /*---------------------------------------------------------------------------
12907 FUNCTION    :   P A I N T   T E X T   M A R K E R S 
12908 DESCRIPTION :   this service allow the text markers to be painted seperatley
12909                 from the grid lines
12910
12911 ARGUMENTS   :   name : 
12912                                                                           
12913 RETURN      :   None
12914 NOTES       : 
12915 ---------------------------------------------------------------------------*/
12916         void paintTextMarkers();
12917
12918 #if defined PRINTING_SUPPORT
12919 /*---------------------------------------------------------------------------
12920 FUNCTION    :   P R I N T 
12921 DESCRIPTION :   This print service prints a grid marker ( being either a
12922                 timestamp or a date, IF there is one at the plot position
12923                 given
12924
12925 ARGUMENTS   :   name :
12926                         displayPosition
12927                         - Where in the log to look to see if there is an
12928                           entry to print
12929
12930                         - printerPtr
12931                           the printer to print to
12932                                                                           
12933 RETURN      :   None
12934 NOTES       : 
12935 ---------------------------------------------------------------------------*/
12936         void print( uint16 currentPrintPos, Printer *printerPtr );
12937 #endif
12938
12939 /*---------------------------------------------------------------------------
12940 FUNCTION    :   S E T  D R I V E  D I R E C T I O N
12941 DESCRIPTION :   Sets direction for update and scrolling forwards or backwards
12942 ARGUMENTS   :   direction  - required direction
12943 RETURN      :   None
12944 NOTES       : 
12945 ---------------------------------------------------------------------------*/
12946         void setDriveDirection( ScrollDirection direction );
12947
12948 /*---------------------------------------------------------------------------
12949 FUNCTION    :   S E T U P 
12950 DESCRIPTION :   service that will setup the grid prior to a paint
12951
12952 ARGUMENTS   :   name :
12953                         - newTimestamp
12954                             
12955
12956                         - newTimeBase
12957                         the number of ticks that represent a plot point on
12958                         the trendgraph. 
12959                                                                           
12960 RETURN      :   None
12961 NOTES       : 
12962 ---------------------------------------------------------------------------*/
12963         void setup( uint32 newTimestamp, uint32 newTimeBase );
12964
12965 #if defined PRINTING_SUPPORT
12966 /*---------------------------------------------------------------------------
12967 FUNCTION    :   S E T U P   F O R   P R I N T   
12968 DESCRIPTION :   This service iis to be called prior to printing. It allows
12969                 the grid to prepare its markers ready for the print
12970                 commands
12971
12972 ARGUMENTS   :   name : 
12973                                                                           
12974 RETURN      :   None
12975 NOTES       : 
12976 ---------------------------------------------------------------------------*/
12977         void setupForPrint();
12978 #endif
12979
12980 /*---------------------------------------------------------------------------
12981 FUNCTION    :   UPDATE
12982 DESCRIPTION :   When this service is called it will calculate what needs to
12983                 be painted and fill in the display again.
12984
12985 ARGUMENTS   :   name  :     timeStamp
12986                             - the reference time of this update.
12987                       
12988 RETURN      :   None
12989 NOTES       : 
12990 ---------------------------------------------------------------------------*/
12991         void update( uint32 timeStamp );
12992
12993 /*---------------------------------------------------------------------------
12994 FUNCTION    :   U P D A T E   B U F F E R
12995 DESCRIPTION :   When a display update is not required, use this method. It
12996                 updates the internal data ready for a call to paint that
12997                 will then show the grid in the right position
12998
12999 ARGUMENTS   :   name  :      
13000                       
13001 RETURN      :   None
13002 NOTES       : 
13003 ---------------------------------------------------------------------------*/
13004         void updateBuffer( void );
13005
13006     private:
13007
13008 /*---------------------------------------------------------------------------
13009 FUNCTION    :   M A K E   G R I D   M A R K E R 
13010 DESCRIPTION :   service that perpares a string for display. The string will
13011                 either be a short date, or short time. this is determined
13012                 by the current setting of the dateMarker flag
13013
13014 ARGUMENTS   :   name :  timestampVal
13015                         - the value to convert
13016                         
13017                         storePtr
13018                         - the place to put the string
13019
13020 RETURN      :   None
13021 NOTES       : 
13022 ---------------------------------------------------------------------------*/
13023         void makeGridMarker( uint32 timestampVal, char *storePtr );
13024             
13025 /*---------------------------------------------------------------------------
13026 FUNCTION    :   P A I N T   G R I D   M A R K E R 
13027 DESCRIPTION :   given a position will put the string on the display
13028
13029 ARGUMENTS   :   name :
13030                         yPos
13031                         - were it goes on the Y-axis
13032
13033                         gridMarkerPtr
13034                         - what it is
13035                                                                           
13036 RETURN      :   None
13037 NOTES       : 
13038 ---------------------------------------------------------------------------*/
13039         void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
13040
13041 #if defined _WINDOWS
13042 /*---------------------------------------------------------------------------
13043 FUNCTION    :   PAINTHORIZONTALLINES
13044 DESCRIPTION :   responsible for painting the grids horizontal lines 
13045 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
13046                                 in viewport coords
13047                 pDC             pointer to device context to use
13048                       
13049 RETURN      : None
13050 NOTES       :
13051 ---------------------------------------------------------------------------*/
13052         void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
13053 #else
13054 /*---------------------------------------------------------------------------
13055 FUNCTION    :   PAINTHORIZONTALLINES
13056 DESCRIPTION :   responsible for painting the grids horizontal lines 
13057 ARGUMENTS   : name: xStart
13058                     - the starting X co-ordinate for the horizontal line
13059                     xEnd
13060                     - the ending X co-ordinate for the horizontal line
13061                       
13062 RETURN      : None
13063 NOTES       : Remember lines are drawn from origin. The origin in a
13064               horizontal viewport will be the top.    
13065 ---------------------------------------------------------------------------*/
13066         void paintHorizontalLines( uint16 xStart, uint16 xEnd );
13067 #endif
13068
13069 #if defined _WINDOWS
13070 /*---------------------------------------------------------------------------
13071 FUNCTION    :   PAINTVERTICALLINES
13072 DESCRIPTION :   responsible for painting the grids vertical lines 
13073 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
13074                                 in viewport coords
13075                 offset          offset from rhs that rightmost line would be 
13076                                 drawn if rectangle included whole viewport
13077                 pDC             pointer to device context to use
13078 RETURN      : None
13079 NOTES       : 
13080 ---------------------------------------------------------------------------*/
13081         void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
13082             CDC* pDC );
13083 #else
13084 /*---------------------------------------------------------------------------
13085 FUNCTION    :   PAINTVERTICALLINES
13086 DESCRIPTION :   responsible for painting the grids vertical lines 
13087 ARGUMENTS   : name  :   yStart
13088                         - the starting Y co-ordinate for the vertical line
13089                         yEnd
13090                         - the ending Y co-ordinate for the vertical line
13091                         offset
13092                         - a starting point offset that determines at what X
13093                         position the first line will be drawn
13094
13095                       
13096 RETURN      : None
13097 NOTES       : 
13098 ---------------------------------------------------------------------------*/
13099         void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
13100 #endif
13101
13102 #if defined _WINDOWS
13103 /*---------------------------------------------------------------------------
13104 FUNCTION    :   PAINTVERTICALLINE
13105 DESCRIPTION :   paints one line at the position specified, and length
13106 ARGUMENTS   :   name  : yStart
13107                         - the starting point on the y axis for the line
13108                         yEnd
13109                         - the end point on the y axis for the line
13110                         xPosition
13111                         - The horizontal offset from the start of the viewport
13112                 pDC             pointer to device context to use
13113                       
13114 RETURN      :   None
13115 NOTES       :   There is not an equivalent horizontal method as yet. This
13116                 is a seperate method because the service is useful to a
13117                 derivation of this class
13118 ---------------------------------------------------------------------------*/
13119         void paintVerticalLine( uint16 yStart, uint16 yEnd
13120                               , uint16 xPosition, CDC *pDC );
13121 #else
13122 /*---------------------------------------------------------------------------
13123 FUNCTION    :   PAINTVERTICALLINE
13124 DESCRIPTION :   paints one line at the position specified, and length
13125 ARGUMENTS   :   name  : yStart
13126                         - the starting point on the y axis for the line
13127                         yEnd
13128                         - the end point on the y axis for the line
13129                         xPosition
13130                         - The horizontal offset from the start of the viewport
13131                       
13132 RETURN      :   None
13133 NOTES       :   There is not an equivalent horizontal method as yet. This
13134                 is a seperate method because the service is useful to a
13135                 derivation of this class
13136 ---------------------------------------------------------------------------*/
13137         void paintVerticalLine( uint16 yStart, uint16 yEnd
13138                               , uint16 xPosition );
13139 #endif
13140
13141 /*---------------------------------------------------------------------------
13142 INLINE FUNCTION    :    VERTICALSPACING
13143 NOTES              :    Description at the end of the file
13144 ---------------------------------------------------------------------------*/
13145         uint16 verticalSpacing( void );
13146
13147
13148         // Position in viewport that we are now writing to if going forwards
13149         // Note that if this is greater than viewport length then we have
13150         // just scrolled and value must be adjusted before use.
13151         sint16 forwardsOutputPosition;
13152         
13153         // Position in viewport that we are now writing to if going backwards
13154         // Note that if this is less than zero then we have
13155         // just scrolled and value must be adjusted before use.
13156         sint16 backwardsOutputPosition;
13157
13158         // position in grid cycle of forwards output position.
13159         // if zero then it is time to output a grid line
13160         sint16 forwardsIntervalCount;
13161
13162         // position in grid cycle of forwards output position.
13163         // if zero then it is time to output a grid line
13164         sint16 backwardsIntervalCount;
13165         
13166         uint32  lastUpdateTimestamp;
13167         uint32  timeBase;       // ticks per pixel
13168         uint16  currentOutputPosition;
13169         uint16  gridTimestampSpacing;
13170         uint16  intervalCount;
13171         uint16  horizontalTotal;
13172         uint16  vSpacing;
13173 #if defined PRINTING_SUPPORT
13174         uint16  numberOfGridMarkersPrinted;
13175 #endif
13176         bool    firstTime;       // indicates first time through
13177         bool    dateMarker;
13178
13179         GkiLineType lineType;
13180         GkiColour   gridColour;
13181
13182     #if defined _WINDOWS
13183         uint16 ticksPerSec;     // number of time ticks per second
13184         uint16 vSpacingMin;     // minimum pixels per division along time axis 
13185         CPen *pPen;             // the pen to use for drawing in windows
13186     #endif
13187
13188 };
13189
13190
13191 /*****************************************************************************
13192                         I N L I N E   F U N C T I O N S   
13193 *****************************************************************************/
13194
13195 /*---------------------------------------------------------------------------
13196 FUNCTION    :   HORIZONTALLINES
13197 DESCRIPTION :   supplies the number of horizontal lines in the grid
13198 ARGUMENTS   :   name  :      
13199                       
13200 RETURN      :   
13201 NOTES       : 
13202 ---------------------------------------------------------------------------*/
13203 inline uint16 ScrollingGrid::horizontalLines( void )
13204 {
13205     return( horizontalTotal );
13206 }
13207 /*---------------------------------------------------------------------------
13208 FUNCTION    :   VERTICALSPACING
13209 DESCRIPTION :   returns the distance between adjacent vertical lines
13210 ARGUMENTS   :   name  :      
13211                       
13212 RETURN      :   None
13213 NOTES       : 
13214 ---------------------------------------------------------------------------*/
13215 inline uint16 ScrollingGrid::verticalSpacing( void )
13216 {
13217     return( vSpacing );
13218 }
13219
13220 #endif
13221 @
13222
13223
13224 1.1.2.1
13225 log
13226 @DEV1194:DS4    Provision of major and minor grid lines
13227 @
13228 text
13229 @d1 1
13230 a1 1
13231 /* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
13232 d3 1
13233 a3 12
13234  * \$""Log: sgrid.h,v \$
13235  * Revision 1.1  1997/04/02 11:20:05  colinl
13236  * Project:     DEV1175
13237  * DCN:
13238  * Tested By:   Colin Law
13239  * Reviewed By:
13240  * Reason for Change: Initial Revision of all files
13241  *
13242  * Design Change Details:
13243  *
13244  * Implications:
13245  *
13246 d58 6
13247 a63 5
13248 ARGUMENTS   :   name  : majorColour         colour for major grid lines
13249                         minorColour         colour for minor grid lines
13250                         sgLineType          line type for minor grid lines
13251                         yMajorGridLines     number of major y lines on grid
13252                         yMinorGridLines     number of major y lines on grid
13253 d77 2
13254 a78 3
13255         ScrollingGrid( GkiColour majorColour, GkiColour minorColour, 
13256             GkiLineType sgLineType, 
13257             uint16 yMajorGridLines, uint16 yMinorGridLines,
13258 a137 17
13259 FUNCTION    :   DrawHorizontalGridLines
13260
13261 DESCRIPTION :   Draws major or minor grid lines
13262 ARGUMENTS   :   pDC         device context
13263                 pPen        pen to use
13264                 numLines    total lines required
13265                 yLow, yHigh, xLow, xHigh   rectangle to draw in
13266                 yMax        max y value
13267 RETURN      :   None
13268 NOTES       :   
13269 ---------------------------------------------------------------------------*/
13270         void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, 
13271             uint16 numLines,
13272             uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, 
13273             uint16 yMax );
13274
13275 /*---------------------------------------------------------------------------
13276 d148 6
13277 d448 1
13278 a448 2
13279         uint16  m_yMajorGridLines;
13280         uint16  m_yMinorGridLines;
13281 d456 2
13282 a457 3
13283         GkiLineType lineType;    // line type for minor grid lines
13284         GkiColour   m_majorColour;
13285         GkiColour   m_minorColour;
13286 d462 1
13287 a462 2
13288         CPen *pMajorPen;        // pen to use for drawing major grid lines
13289         CPen *pMinorPen;        // pen to use for drawing minor grid lines
13290 d472 12
13291 @" > diffmerge2/sgrid.h,v
13292
13293           # We have to put the RCS file in the repository by hand for
13294           # this test:
13295           mkdir ${CVSROOT_DIRNAME}/diffmerge2
13296           cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
13297           rm -rf diffmerge2
13298           dotest diffmerge2_co \
13299             "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
13300           cd diffmerge2
13301           dotest diffmerge2_update \
13302             "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
13303             "${DOTSTAR}erging ${DOTSTAR}"
13304           # This is the one that counts -- there should be no output:
13305           dotest diffmerge2_diff \
13306             "${testcvs} diff -r Review_V1p3 sgrid.h" ''
13307
13308           ;;
13309
13310         *)
13311            echo $what is not the name of a test -- ignored
13312            ;;
13313         esac
13314 done
13315
13316 echo "OK, all tests completed."
13317
13318 # TODO:
13319 # * use "test" not "[" and see if all test's support `-z'
13320 # * Test `cvs update -d foo' (where foo does not exist).
13321 # * Test `cvs update foo bar' (where foo and bar are both from the
13322 #   same directory in the repository).  Suppose one is a branch--make
13323 #   sure that both directories get updated with the respective correct
13324 #   thing.
13325 # * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
13326 #   foo/.././../bar foo/../bar etc.
13327 # * Test all flags in modules file.
13328 #   Test that ciprog gets run both on checkin in that directory, or a
13329 #     higher-level checkin which recurses into it.
13330 # * Test operations on a directory that contains other directories but has
13331 #   no files of its own.
13332 # * -t global option
13333 # * cvs rm followed by cvs add or vice versa (with no checkin in between).
13334 # * cvs rm twice (should be a nice error message).
13335 # * -P option to checkout--(a) refrains from checking out new empty dirs,
13336 #   (b) prunes empty dirs already there.
13337 # * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
13338 #   gives an appropriate error (e.g.
13339 #     Cannot access ${TESTDIR}/non-existent/CVSROOT
13340 #     No such file or directory).
13341 #   (like basica-9, but for remote).
13342 # * Test ability to send notifications in response to watches.  (currently
13343 #   hard to test because CVS doesn't send notifications if username is the
13344 #   same).
13345 # * Test that remote edit and/or unedit works when disconnected from
13346 #   server (e.g. set CVS_SERVER to "foobar").
13347 # * Test the contents of adm files other than Root and Repository.
13348 #   Entries seems the next most important thing.
13349 # End of TODO list.
13350
13351 # Remove the test directory, but first change out of it.
13352 cd /tmp
13353 rm -rf ${TESTDIR}
13354
13355 # end of sanity.sh