]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/contrib/cvs/src/sanity.sh
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / 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:
22 usage ()
23 {
24     echo "Usage: `basename $0` --help"
25     echo "Usage: `basename $0` [-klr] [-f FROM-TEST] [-h HOSTNAME] CVS-TO-TEST [TESTS-TO-RUN...]"
26 }
27
28 exit_usage ()
29 {
30     usage 1>&2
31     exit 2
32 }
33
34 exit_help ()
35 {
36     usage
37     echo
38     echo "-H|--help     display this text"
39     echo "-l|--link-root"
40     echo "              test CVS using a symlink to a real CVSROOT"
41     echo "-r|--remote   test remote instead of local cvs"
42     echo "-h HOSTNAME   Use :ext:HOSTNAME to run remote tests rather than"
43     echo "              :fork:.  Implies --remote and assumes that \$TESTDIR"
44     echo "              resolves to the same directory on both the client and"
45     echo "              the server."
46     echo "-k|--keep     try to keep directories created by individual tests"
47     echo "              around, exiting after the first test which supports"
48     echo "              --keep"
49     echo "-f FROM-TEST  run TESTS-TO-RUN, skipping all tests in the list before"
50     echo "              FROM-TEST"
51     echo
52     echo "CVS-TO-TEST   the path to the CVS executable to be tested"
53     echo "TESTS-TO-RUN  the names of the tests to run (defaults to all tests)"
54     exit 2
55 }
56
57 # See TODO list at end of file.
58
59 # required to make this script work properly.
60 unset CVSREAD
61
62 # We want to invoke a predictable set of i18n behaviors, not whatever
63 # the user running this script might have set.
64 # In particular:
65 #   'sort' and tabs and spaces (LC_COLLATE).
66 #   Messages from getopt (LC_MESSAGES) (in the future, CVS itself might 
67 #     also alter its messages based on LC_MESSAGES).
68 LANG=C
69 export LANG
70 LC_ALL=C
71 export LC_ALL
72
73
74
75 #
76 # read our options
77 #
78 unset fromtest
79 unset remotehost
80 keep=false
81 linkroot=false
82 remote=false
83 while getopts f:h:Hklr-: option ; do
84     # convert the long opts to short opts
85     if test x$option = x-;  then
86         case "$OPTARG" in
87             [hH]|[hH][eE]|[hH][eE][lL]|[hH][eE][lL][pP])
88                 option=H;
89                 OPTARG=
90                 ;;
91             [kK]|[kK][eE]|[kK][eE][eE]|[kK][eE][eE][pP])
92                 option=k;
93                 OPTARG=
94                 ;;
95             l|li|lin|link|link-|link-r]|link-ro|link-roo|link-root)
96                 option=l;
97                 OPTARG=
98                 ;;
99             [rR]|[rR][eE]|[rR][eE][mM]|[rR][eE][mM][oO]|[rR][eE][mM][oO][tT]|[rR][eE][mM][oO][tT][eE])
100                 option=k;
101                 OPTARG=
102                 ;;
103             *)
104                 option=\?
105                 OPTARG=
106         esac
107     fi
108     case "$option" in
109         f)
110             fromtest="$OPTARG"
111             ;;
112         h)
113             # Set a remotehost to run the remote tests on via :ext:
114             # Implies `-r' and assumes that $TESTDIR resolves to the same
115             # directory on the client and the server.
116             remotehost="$OPTARG"
117             remote=:
118             ;;
119         H)
120             exit_help
121             ;;
122         k)
123             # The -k (keep) option will eventually cause all the tests to
124             # leave around the contents of the /tmp directory; right now only
125             # some implement it.  Not originally intended to be useful with
126             # more than one test, but this should work if each test uses a
127             # uniquely named dir (use the name of the test).
128             keep=:
129             ;;
130         l)
131             linkroot=:
132             ;;
133         r)
134             remote=:
135             ;;
136         \?)
137             exit_usage
138             ;;
139     esac
140 done
141
142 # boot the arguments we used above
143 while test $OPTIND -gt 1 ; do
144     shift
145     OPTIND=`expr $OPTIND - 1`
146 done
147
148 # Use full path for CVS executable, so that CVS_SERVER gets set properly
149 # for remote.
150 case $1 in
151 "")
152   exit_usage
153   ;;
154 /*)
155   testcvs=$1
156   ;;
157 *)
158   testcvs=`pwd`/$1
159   ;;
160 esac
161 shift
162
163 # If $remotehost is set, warn if $TESTDIR isn't since we are pretty sure
164 # that its default value of `/tmp/cvs-sanity' will not resolve to the same
165 # directory on two different machines.
166 if test -n "$remotehost" && test -z "$TESTDIR"; then
167     echo "WARNING: CVS server hostname is set and \$TESTDIR is not.  If" >&2
168     echo "$remotehost is not the local machine, then it is unlikely that" >&2
169     echo "the default value assigned to \$TESTDIR will resolve to the same" >&2
170     echo "directory on both this client and the CVS server." >&2
171 fi
172
173
174
175 ###
176 ### GUTS
177 ###
178
179 # "debugger"
180 #set -x
181
182 echo 'This test should produce no other output than this message, and a final "OK".'
183 echo '(Note that the test can take an hour or more to run and periodically stops'
184 echo 'for as long as one minute.  Do not assume there is a problem just because'
185 echo 'nothing seems to happen for a long time.  If you cannot live without'
186 echo "running status, try the command: \`tail -f check.log' from another window.)"
187
188 # Regexp to match what CVS will call itself in output that it prints.
189 # FIXME: we don't properly quote this--if the name contains . we'll
190 # just spuriously match a few things; if the name contains other regexp
191 # special characters we are probably in big trouble.
192 PROG=`basename ${testcvs}`
193
194 # Regexp to match an author name.  I'm not really sure what characters
195 # should be here.  a-zA-Z obviously.  People complained when 0-9 were
196 # not allowed in usernames.  Other than that I'm not sure.
197 username="[-a-zA-Z0-9][-a-zA-Z0-9]*"
198 author="[-a-zA-Z0-9][-a-zA-Z0-9]*"
199 hostname="[-_.a-zA-Z0-9]*"
200
201 # Regexp to match the name of a temporary file (from cvs_temp_name).
202 # This appears in certain diff output.
203 tempname="[-a-zA-Z0-9/.%_]*"
204
205 # Regexp to match a date in RFC822 format (as amended by RFC1123).
206 RFCDATE="[a-zA-Z0-9 ][a-zA-Z0-9 ]* [0-9:][0-9:]* -0000"
207 RFCDATE_EPOCH="1 Jan 1970 00:00:00 -0000"
208
209 # Regexp to match a date in standard Unix format as used by rdiff
210 # FIXCVS: There's no reason for rdiff to use a different date format
211 # than diff does
212 DATE="[a-zA-Z]* [a-zA-Z]* [ 1-3][0-9] [0-9:]* [0-9]*"
213
214 # On cygwin32, we may not have /bin/sh.
215 if test -r /bin/sh; then
216   TESTSHELL="/bin/sh"
217 else
218   TESTSHELL=`type -p sh 2>/dev/null`
219   if test ! -r "$TESTSHELL"; then
220     TESTSHELL="/bin/sh"
221   fi
222 fi
223
224 # FIXME: try things (what things? checkins?) without -m.
225 #
226 # Some of these tests are written to expect -Q.  But testing with
227 # -Q is kind of bogus, it is not the way users actually use CVS (usually).
228 # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
229 # and then they've obviously got to do something with the output....
230 #
231 CVS="${testcvs} -Q"
232
233 LOGFILE=`pwd`/check.log
234
235 # Save the previous log in case the person running the tests decides
236 # they want to look at it.  The extension ".plog" is chosen for consistency
237 # with dejagnu.
238 if test -f check.log; then
239         mv check.log check.plog
240 fi
241
242 # Create the log file so check.log can be tailed almost immediately after
243 # this script is started.  Otherwise it can take up to a minute or two before
244 # the log file gets created when $remotehost is specified on some systems,
245 # which makes for a lot of failed `tail -f' attempts.
246 touch check.log
247
248 # The default value of /tmp/cvs-sanity for TESTDIR is dubious,
249 # because it loses if two people/scripts try to run the tests
250 # at the same time.  Some possible solutions:
251 # 1.  Use /tmp/cvs-test$$.  One disadvantage is that the old
252 #     cvs-test* directories would pile up, because they wouldn't
253 #     necessarily get removed.
254 # 2.  Have everyone/everything running the testsuite set
255 #     TESTDIR to some appropriate directory.
256 # 3.  Have the default value of TESTDIR be some variation of
257 #     `pwd`/cvs-sanity.  The biggest problem here is that we have
258 #     been fairly careful to test that CVS prints in messages the
259 #     actual pathnames that we pass to it, rather than a different
260 #     pathname for the same directory, as may come out of `pwd`.
261 #     So this would be lost if everything was `pwd`-based.  I suppose
262 #     if we wanted to get baroque we could start making symlinks
263 #     to ensure the two are different.
264 : ${CVS_RSH=rsh}; export CVS_RSH
265 if test -n "$remotehost"; then
266         # We need to set $tmp on the server since $TMPDIR is compared against
267         # messages generated by the server.
268         tmp=`$CVS_RSH $remotehost 'cd /tmp; /bin/pwd || pwd' 2>/dev/null`
269         if test $? != 0; then
270             echo "$CVS_RSH $remotehost failed." >&2
271             exit 1
272         fi
273 else
274         tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null`
275 fi
276
277 # Now:
278 #       1) Set TESTDIR if it's not set already
279 #       2) Remove any old test remnants
280 #       3) Create $TESTDIR
281 #       4) Normalize TESTDIR with `cd && (/bin/pwd || pwd)`
282 #          (This will match CVS output later)
283 : ${TESTDIR=$tmp/cvs-sanity}
284 # clean any old remnants (we need the chmod because some tests make
285 # directories read-only)
286 if test -d ${TESTDIR}; then
287     chmod -R a+wx ${TESTDIR}
288     rm -rf ${TESTDIR}
289 fi
290 # These exits are important.  The first time I tried this, if the `mkdir && cd`
291 # failed then the build directory would get blown away.  Some people probably
292 # wouldn't appreciate that.
293 mkdir ${TESTDIR} || exit 1
294 cd ${TESTDIR} || exit 1
295 # Ensure $TESTDIR is absolute
296 if echo "${TESTDIR}" |grep '^[^/]'; then
297     # Don't resolve this unless we have to.  This keeps symlinks intact.  This
298     # is important at least when testing using -h $remotehost, because the same
299     # value for $TESTDIR must resolve to the same directory on the client and
300     # the server and we likely used Samba, and possibly symlinks, to do this.
301     TESTDIR=`(/bin/pwd || pwd) 2>/dev/null`
302 fi
303
304 if test -z "${TESTDIR}" || echo "${TESTDIR}" |grep '^[^/]'; then
305     echo "Unable to resolve TESTDIR to an absolute directory." >&2
306     exit 1
307 fi
308 cd ${TESTDIR}
309
310 # Now set $TMPDIR if the user hasn't overridden it.
311 #
312 # We use a $TMPDIR under $TESTDIR by default so that two tests may be run at
313 # the same time without bumping heads without requiring the user to specify
314 # more than $TESTDIR.  See the test for leftover cvs-serv* directories near the
315 # end of this script at the end of "The big loop".
316 : ${TMPDIR=$TESTDIR/tmp}
317 export TMPDIR
318 if test -d $TMPDIR; then :; else
319     mkdir $TMPDIR
320 fi
321
322 # Make sure various tools work the way we expect, or try to find
323 # versions that do.
324 : ${AWK=awk}
325 : ${EXPR=expr}
326 : ${ID=id}
327 : ${TR=tr}
328
329 find_tool ()
330 {
331   GLOCS="`echo $PATH | sed 's/:/ /g'` /usr/local/bin /usr/contrib/bin /usr/gnu/bin /local/bin /local/gnu/bin /gnu/bin"
332   TOOL=""
333   for path in $GLOCS ; do
334     if test -x $path/g$1 ; then
335       RES="`$path/g$1 --version </dev/null 2>/dev/null`"
336       if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
337         TOOL=$path/g$1
338         break
339       fi
340     fi
341     if test -x $path/$1 ; then
342       RES="`$path/$1 --version </dev/null 2>/dev/null`"
343       if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
344         TOOL=$path/$1
345         break
346       fi
347     fi
348   done
349   if test -z "$TOOL"; then
350     :
351   else
352     echo "Notice: The default version of \`$1' is defective, using" >&2
353     echo "\`$TOOL' instead." >&2
354   fi
355   echo "$TOOL"
356 }  
357
358 # You can't run CVS as root; print a nice error message here instead
359 # of somewhere later, after making a mess.
360 #
361 # FIXME - find_tool() finds the 'gid' from GNU id-utils if I pull 'id' out of
362 # my path.
363 for pass in false :; do
364   case "`$ID -u 2>/dev/null`" in
365     "0")
366       echo "Test suite does not work correctly when run as root" >&2
367       exit 1
368       ;;
369
370     "")
371       if $pass; then :; else
372         ID=`find_tool id`
373       fi
374       if $pass || test -z "$ID" ; then
375         echo "Running these tests requires an \`id' program that understands the" >&2
376         echo "-u and -n flags.  Make sure that such an id (GNU, or many but not" >&2
377         echo "all vendor-supplied versions) is in your path." >&2
378         exit 1
379       fi
380       ;;
381
382     *)
383       break
384       ;;
385   esac
386 done
387
388 # Cause NextStep 3.3 users to lose in a more graceful fashion.
389 if $EXPR 'abc
390 def' : 'abc
391 def' >/dev/null; then
392   : good, it works
393 else
394   EXPR=`find_tool expr`
395   if test -z "$EXPR" ; then
396     echo 'Running these tests requires an "expr" program that can handle' >&2
397     echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but' >&2
398     echo 'not all vendor-supplied versions) is in your path.' >&2
399     exit 1
400   fi
401 fi
402
403 # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
404 # if we can't find a GNU expr to ease their troubles...
405 if $EXPR 'a
406 b' : 'a
407 c' >/dev/null; then
408   EXPR=`find_tool expr`
409   if test -z "$EXPR" ; then
410     echo 'Warning: you are using a version of expr that does not correctly'
411     echo 'match multi-line patterns.  Some tests may spuriously pass or fail.'
412     echo 'You may wish to make sure GNU expr is in your path.'
413     EXPR=expr
414   fi
415 else
416   : good, it works
417 fi
418
419 # More SunOS lossage...
420 echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo
421 cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
422 cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo
423 cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
424 if $EXPR "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then
425   : good, it works
426 else
427   EXPR=`find_tool expr`
428   if test -z "$EXPR" ; then
429     echo 'Warning: you are using a version of expr that does not correctly'
430     echo 'match large patterns.  Some tests may spuriously pass or fail.'
431     echo 'You may wish to make sure GNU expr is in your path.'
432     EXPR=expr
433   fi
434 fi
435 if $EXPR "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then
436   EXPR=`find_tool expr`
437   if test -z "$EXPR" ; then
438     echo 'Warning: you are using a version of expr that does not correctly'
439     echo 'match large patterns.  Some tests may spuriously pass or fail.'
440     echo 'You may wish to make sure GNU expr is in your path.'
441     EXPR=expr
442   fi
443 else
444   : good, it works
445 fi
446
447 # That we should have to do this is total bogosity, but GNU expr
448 # version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix
449 # (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
450 # next release of GNU expr after 1.12 (but we still have to cater to the old
451 # ones for some time because they are in many linux distributions).
452 ENDANCHOR="$"
453 if $EXPR 'abc
454 def' : 'abc$' >/dev/null; then
455   ENDANCHOR='\'\'
456 fi
457
458 # Work around another GNU expr (version 1.10-1.12) bug/incompatibility.
459 # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
460 # Note that the workaround is not a complete equivalent of .* because
461 # the first parenthesized expression in the regexp must match something
462 # in order for expr to return a successful exit status.
463 # Rumor has it this will be fixed in the
464 # next release of GNU expr after 1.12 (but we still have to cater to the old
465 # ones for some time because they are in many linux distributions).
466 DOTSTAR='.*'
467 if $EXPR 'abc
468 def' : "a${DOTSTAR}f" >/dev/null; then
469   : good, it works
470 else
471   DOTSTAR='\(.\|
472 \)*'
473 fi
474
475 # Now that we have DOTSTAR, make sure it works with big matches
476 if $EXPR "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then
477   : good, it works
478 else
479   EXPR=`find_tool expr`
480   if test -z "$EXPR" ; then
481     echo 'Warning: you are using a version of expr that does not correctly'
482     echo 'match large patterns.  Some tests may spuriously pass or fail.'
483     echo 'You may wish to make sure GNU expr is in your path.'
484     EXPR=expr
485   fi
486 fi
487
488 rm -f ${TESTDIR}/foo ${TESTDIR}/bar
489
490 # Work around yet another GNU expr (version 1.10) bug/incompatibility.
491 # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
492 # it is not.  I doubt that POSIX allows us to use \+ and assume it means
493 # (non-special) +, so here is another workaround
494 # Rumor has it this will be fixed in the
495 # next release of GNU expr after 1.12 (but we still have to cater to the old
496 # ones for some time because they are in many linux distributions).
497 PLUS='+'
498 if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
499   : good, it works
500 else
501   PLUS='\+'
502 fi
503
504 # Likewise, for ?
505 QUESTION='?'
506 if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
507   : good, it works
508 else
509   QUESTION='\?'
510 fi
511
512 # Now test the username to make sure it contains only valid characters
513 username=`$ID -un`
514 if $EXPR "${username}" : "${username}" >/dev/null; then
515   : good, it works
516 else
517   echo "Test suite does not work correctly when run by a username" >&2
518   echo "containing regular expression meta-characters." >&2
519   exit 1
520 fi
521
522 # now make sure that tr works on NULs
523 if $EXPR `echo "123" | ${TR} '2' '\0'` : "123" >/dev/null 2>&1; then
524   TR=`find_tool tr`
525   if test -z "$TR" ; then
526     echo 'Warning: you are using a version of tr which does not correctly'
527     echo 'handle NUL bytes.  Some tests may spuriously pass or fail.'
528     echo 'You may wish to make sure GNU tr is in your path.'
529     TR=tr
530   fi
531 else
532   : good, it works
533 fi
534
535 pass ()
536 {
537   echo "PASS: $1" >>${LOGFILE}
538 }
539
540 fail ()
541 {
542   echo "FAIL: $1" | tee -a ${LOGFILE}
543   echo "*** Please see the \`TESTS' and \`check.log' files for more information." >&2
544   # This way the tester can go and see what remnants were left
545   exit 1
546 }
547
548 # See dotest and dotest_fail for explanation (this is the parts
549 # of the implementation common to the two).
550 dotest_internal ()
551 {
552   if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$3${ENDANCHOR}" >/dev/null; then
553     # Why, I hear you ask, do we write this to the logfile
554     # even when the test passes?  The reason is that the test
555     # may give us the regexp which we were supposed to match,
556     # but sometimes it may be useful to look at the exact
557     # text which was output.  For example, suppose one wants
558     # to grep for a particular warning, and make _sure_ that
559     # CVS never hits it (even in cases where the tests might
560     # match it with .*).  Or suppose one wants to see the exact
561     # date format output in a certain case (where the test will
562     # surely use a somewhat non-specific pattern).
563     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
564     pass "$1"
565   # expr can't distinguish between "zero characters matched" and "no match",
566   # so special-case it.
567   elif test -z "$3" && test ! -s ${TESTDIR}/dotest.tmp; then
568     pass "$1"
569   elif test x"$4" != x; then
570     if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$4${ENDANCHOR}" >/dev/null; then
571       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
572       pass "$1"
573     else
574       echo "** expected: " >>${LOGFILE}
575       echo "$3" >>${LOGFILE}
576       echo "$3" > ${TESTDIR}/dotest.ex1
577       echo "** or: " >>${LOGFILE}
578       echo "$4" >>${LOGFILE}
579       echo "$4" > ${TESTDIR}/dotest.ex2
580       echo "** got: " >>${LOGFILE}
581       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
582       fail "$1"
583     fi
584   else
585     echo "** expected: " >>${LOGFILE}
586     echo "$3" >>${LOGFILE}
587     echo "$3" > ${TESTDIR}/dotest.exp
588     echo "** got: " >>${LOGFILE}
589     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
590     fail "$1"
591   fi
592 }
593
594 dotest_all_in_one ()
595 {
596   if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
597          "`cat ${TESTDIR}/dotest.exp`" >/dev/null; then
598     return 0
599   fi
600   return 1
601 }
602
603 # WARNING: this won't work with REs that match newlines....
604 #
605 dotest_line_by_line ()
606 {
607   line=1
608   while [ $line -le `wc -l <${TESTDIR}/dotest.tmp` ] ; do
609     if $EXPR "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" : \
610        "`sed -n ${line}p ${TESTDIR}/dotest.exp`" >/dev/null; then
611       :
612     elif test -z "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" &&
613        test -z "`sed -n ${line}p ${TESTDIR}/dotest.exp`"; then
614       :
615     else
616       echo "Line $line:" >> ${LOGFILE}
617       echo "**** expected: " >>${LOGFILE}
618       sed -n ${line}p ${TESTDIR}/dotest.exp >>${LOGFILE}
619       echo "**** got: " >>${LOGFILE}
620       sed -n ${line}p ${TESTDIR}/dotest.tmp >>${LOGFILE}
621       unset line
622       return 1
623     fi
624     line=`expr $line + 1`
625   done
626   unset line
627   return 0
628 }
629
630 # If you are having trouble telling which line of a multi-line
631 # expression is not being matched, replace calls to dotest_internal()
632 # with calls to this function:
633 #
634 dotest_internal_debug ()
635 {
636   if test -z "$3"; then
637     if test -s ${TESTDIR}/dotest.tmp; then
638       echo "** expected: " >>${LOGFILE}
639       echo "$3" >>${LOGFILE}
640       echo "$3" > ${TESTDIR}/dotest.exp
641       rm -f ${TESTDIR}/dotest.ex2
642       echo "** got: " >>${LOGFILE}
643       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
644       fail "$1"
645     else
646       pass "$1"
647     fi
648   else
649     echo "$3" > ${TESTDIR}/dotest.exp
650     if dotest_line_by_line "$1" "$2"; then
651       pass "$1"
652     else
653       if test x"$4" != x; then
654         mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1
655         echo "$4" > ${TESTDIR}/dotest.exp
656         if dotest_line_by_line "$1" "$2"; then
657           pass "$1"
658         else
659           mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2
660           echo "** expected: " >>${LOGFILE}
661           echo "$3" >>${LOGFILE}
662           echo "** or: " >>${LOGFILE}
663           echo "$4" >>${LOGFILE}
664           echo "** got: " >>${LOGFILE}
665           cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
666           fail "$1"
667         fi
668       else
669         echo "** expected: " >>${LOGFILE}
670         echo "$3" >>${LOGFILE}
671         echo "** got: " >>${LOGFILE}
672         cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
673         fail "$1"
674       fi
675     fi
676   fi
677 }
678
679 # Usage:
680 #  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
681 # TESTNAME is the name used in the log to identify the test.
682 # COMMAND is the command to run; for the test to pass, it exits with
683 # exitstatus zero.
684 # OUTPUT is a regexp which is compared against the output (stdout and
685 # stderr combined) from the test.  It is anchored to the start and end
686 # of the output, so should start or end with ".*" if that is what is desired.
687 # Trailing newlines are stripped from the command's actual output before
688 # matching against OUTPUT.
689 # If OUTPUT2 is specified and the output matches it, then it is also
690 # a pass (partial workaround for the fact that some versions of expr
691 # lack \|).
692 dotest ()
693 {
694   rm -f ${TESTDIR}/dotest.ex? 2>&1
695   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
696   status=$?
697   if test "$status" != 0; then
698     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
699     echo "exit status was $status" >>${LOGFILE}
700     fail "$1"
701   fi
702   dotest_internal "$@"
703 }
704
705 # Like dotest except only 2 args and result must exactly match stdin
706 dotest_lit ()
707 {
708   rm -f ${TESTDIR}/dotest.ex? 2>&1
709   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
710   status=$?
711   if test "$status" != 0; then
712     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
713     echo "exit status was $status" >>${LOGFILE}
714     fail "$1"
715   fi
716   cat >${TESTDIR}/dotest.exp
717   if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
718     pass "$1"
719   else
720     echo "** expected: " >>${LOGFILE}
721     cat ${TESTDIR}/dotest.exp >>${LOGFILE}
722     echo "** got: " >>${LOGFILE}
723     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
724     fail "$1"
725   fi
726 }
727
728 # Like dotest except exitstatus should be nonzero.
729 dotest_fail ()
730 {
731   rm -f ${TESTDIR}/dotest.ex? 2>&1
732   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
733   status=$?
734   if test "$status" = 0; then
735     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
736     echo "exit status was $status" >>${LOGFILE}
737     fail "$1"
738   fi
739   dotest_internal "$@"
740 }
741
742 # Like dotest except output is sorted.
743 dotest_sort ()
744 {
745   rm -f ${TESTDIR}/dotest.ex? 2>&1
746   eval "$2" >${TESTDIR}/dotest.tmp1 2>&1
747   status=$?
748   if test "$status" != 0; then
749     cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
750     echo "exit status was $status" >>${LOGFILE}
751     fail "$1"
752   fi
753   ${TR} '       ' ' ' < ${TESTDIR}/dotest.tmp1 | sort > ${TESTDIR}/dotest.tmp
754   dotest_internal "$@"
755 }
756
757 # Avoid picking up any stray .cvsrc, etc., from the user running the tests
758 mkdir home
759 HOME=${TESTDIR}/home; export HOME
760
761 # Make sure this variable is not defined to anything that would
762 # change the format of rcs dates.  Otherwise people using e.g.,
763 # RCSINIT=-zLT get lots of spurious failures.
764 RCSINIT=; export RCSINIT
765
766 # Remaining arguments are the names of tests to run.
767 #
768 # The testsuite is broken up into (hopefully manageably-sized)
769 # independently runnable tests, so that one can quickly get a result
770 # from a cvs or testsuite change, and to facilitate understanding the
771 # tests.
772
773 if test x"$*" = x; then
774         # Basic/miscellaneous functionality
775         tests="version basica basicb basicc basic1 deep basic2"
776         tests="${tests} parseroot files spacefiles commit-readonly"
777         tests="${tests} commit-add-missing"
778         tests="${tests} status"
779         # Branching, tagging, removing, adding, multiple directories
780         tests="${tests} rdiff rdiff-short"
781         tests="${tests} rdiff2 diff diffnl death death2"
782         tests="${tests} rm-update-message rmadd rmadd2 rmadd3 resurrection"
783         tests="${tests} dirs dirs2 branches branches2 tagc tagf"
784         tests="${tests} rcslib multibranch import importb importc import-CVS"
785         tests="${tests} update-p import-after-initial branch-after-import"
786         tests="${tests} join join2 join3 join4 join5 join6"
787         tests="${tests} join-readonly-conflict join-admin join-admin-2"
788         tests="${tests} join-rm"
789         tests="${tests} new newb conflicts conflicts2 conflicts3"
790         tests="${tests} clean"
791         # Checking out various places (modules, checkout -d, &c)
792         tests="${tests} modules modules2 modules3 modules4 modules5 modules6"
793         tests="${tests} mkmodules co-d"
794         tests="${tests} cvsadm emptydir abspath abspath2 toplevel toplevel2"
795         tests="${tests} rstar-toplevel trailingslashes checkout_repository"
796         # Log messages, error messages.
797         tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg opterrmsg"
798         # Watches, binary files, history browsing, &c.
799         tests="${tests} devcom devcom2 devcom3 watch4 watch5"
800         tests="${tests} unedit-without-baserev"
801         tests="${tests} ignore ignore-on-branch binfiles binfiles2 binfiles3"
802         tests="${tests} mcopy binwrap binwrap2"
803         tests="${tests} binwrap3 mwrap info taginfo config"
804         tests="${tests} serverpatch log log2 logopt ann ann-id"
805         # Repository Storage (RCS file format, CVS lock files, creating
806         # a repository without "cvs init", &c).
807         tests="${tests} crerepos rcs rcs2 rcs3 lockfiles backuprecover"
808         # More history browsing, &c.
809         tests="${tests} history"
810         tests="${tests} big modes modes2 modes3 stamps"
811         # PreservePermissions stuff: permissions, symlinks et al.
812         # tests="${tests} perms symlinks symlinks2 hardlinks"
813         # More tag and branch tests, keywords.
814         tests="${tests} sticky keyword keywordlog keywordname keyword2"
815         tests="${tests} head tagdate multibranch2 tag8k"
816         # "cvs admin", reserved checkouts.
817         tests="${tests} admin reserved"
818         # Nuts and bolts of diffing/merging (diff library, &c)
819         tests="${tests} diffmerge1 diffmerge2"
820         # Release of multiple directories
821         tests="${tests} release"
822         tests="${tests} recase"
823         # Multiple root directories and low-level protocol tests.
824         tests="${tests} multiroot multiroot2 multiroot3 multiroot4"
825         tests="${tests} rmroot reposmv pserver server server2 client"
826         tests="${tests} dottedroot fork commit-d"
827 else
828         tests="$*"
829 fi
830
831 # Now check the -f argument for validity.
832 if test -n "$fromtest"; then
833         # Don't allow spaces - they are our delimiters in tests
834         count=0
835         for sub in $fromtest; do
836           count=`expr $count + 1`
837         done
838         if test $count != 1; then
839                 echo "No such test \`$fromtest'." >&2
840                 exit 2
841         fi
842         # make sure it is in $tests
843         case " $tests " in
844                 *" $fromtest "*)
845                         ;;
846                 *)
847                         echo "No such test \`$fromtest'." >&2
848                         exit 2
849                         ;;
850         esac
851 fi
852
853
854
855 # a simple function to compare directory contents
856 #
857 # Returns: 0 for same, 1 for different
858 #
859 directory_cmp ()
860 {
861         OLDPWD=`pwd`
862         DIR_1=$1
863         DIR_2=$2
864
865         cd $DIR_1
866         find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d1
867
868         # go back where we were to avoid symlink hell...
869         cd $OLDPWD
870         cd $DIR_2
871         find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d2
872
873         if diff $TESTDIR/dc$$d1 $TESTDIR/dc$$d2 >/dev/null 2>&1
874         then
875                 :
876         else
877                 return 1
878         fi
879         cd $OLDPWD
880         while read a
881         do
882                 if test -f $DIR_1/"$a" ; then
883                         cmp -s $DIR_1/"$a" $DIR_2/"$a"
884                         if test $? -ne 0 ; then
885                                 return 1
886                         fi
887                 fi
888         done < $TESTDIR/dc$$d1
889         rm -f $TESTDIR/dc$$*
890         return 0
891 }
892
893
894
895 #
896 # The following 4 functions are used by the diffmerge1 test case.  They set up,
897 # respectively, the four versions of the files necessary:
898 #
899 #       1.  Ancestor revisions.
900 #       2.  "Your" changes.
901 #       3.  "My" changes.
902 #       4.  Expected merge result.
903 #
904
905 # Create ancestor revisions for diffmerge1
906 diffmerge_create_older_files() {
907           # This test case was supplied by Noah Friedman:
908           cat >testcase01 <<EOF
909 // Button.java
910
911 package random.application;
912
913 import random.util.*;
914
915 public class Button
916 {
917   /* Instantiates a Button with origin (0, 0) and zero width and height.
918    * You must call an initializer method to properly initialize the Button.
919    */
920   public Button ()
921   {
922     super ();
923
924     _titleColor = Color.black;
925     _disabledTitleColor = Color.gray;
926     _titleFont = Font.defaultFont ();
927   }
928
929   /* Convenience constructor for instantiating a Button with
930    * bounds x, y, width, and height.  Equivalent to
931    *     foo = new Button ();
932    *     foo.init (x, y, width, height);
933    */
934   public Button (int x, int y, int width, int height)
935   {
936     this ();
937     init (x, y, width, height);
938   }
939 }
940 EOF
941
942           # This test case was supplied by Jacob Burckhardt:
943           cat >testcase02 <<EOF
944 a
945 a
946 a
947 a
948 a
949 EOF
950
951           # This test case was supplied by Karl Tomlinson who also wrote the
952           # patch which lets CVS correctly handle this and several other cases:
953           cat >testcase03 <<EOF
954 x
955 s
956 a
957 b
958 s
959 y
960 EOF
961
962           # This test case was supplied by Karl Tomlinson:
963           cat >testcase04 <<EOF
964 s
965 x
966 m
967 m
968 x
969 s
970 v
971 s
972 x
973 m
974 m
975 x
976 s
977 EOF
978
979           # This test case was supplied by Karl Tomlinson:
980           cat >testcase05 <<EOF
981 s
982 x
983 m
984 m
985 x
986 x
987 x
988 x
989 x
990 x
991 x
992 x
993 x
994 x
995 s
996 s
997 s
998 s
999 s
1000 s
1001 s
1002 s
1003 s
1004 s
1005 v
1006 EOF
1007
1008           # This test case was supplied by Jacob Burckhardt:
1009           cat >testcase06 <<EOF
1010 g
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022 i
1023 EOF
1024
1025           # This test is supposed to verify that the horizon lines are the same
1026           # for both 2-way diffs, but unfortunately, it does not fail with the
1027           # old version of cvs.  However, Karl Tomlinson still thought it would
1028           # be good to test it anyway:
1029           cat >testcase07 <<EOF
1030 h
1031 f
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041 g
1042 r
1043
1044
1045
1046 i
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057 i
1058 EOF
1059
1060           # This test case was supplied by Jacob Burckhardt:
1061           cat >testcase08 <<EOF
1062 Both changes move this line to the end of the file.
1063
1064 no
1065 changes
1066 here
1067
1068 First change will delete this line.
1069
1070 First change will also delete this line.
1071
1072     no
1073     changes
1074     here
1075
1076 Second change will change it here.
1077
1078         no
1079         changes
1080         here
1081 EOF
1082
1083           # This test case was supplied by Jacob Burckhardt.  Note that I do not
1084           # think cvs has ever failed with this case, but I include it anyway,
1085           # since I think it is a hard case.  It is hard because Peter Miller's
1086           # fmerge utility fails on it:
1087           cat >testcase09 <<EOF
1088 m
1089 a
1090 {
1091 }
1092 b
1093 {
1094 }
1095 EOF
1096
1097           # This test case was supplied by Martin Dorey and simplified by Jacob
1098           # Burckhardt:
1099           cat >testcase10 <<EOF
1100
1101     petRpY ( MtatRk );
1102     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1103
1104     MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1105     OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1106
1107     Bloke_GttpfIRte_MtpeaL ( &acI );
1108 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1109 {
1110     fV ( Y < 16 )
1111     {
1112         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1113                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1114                                 jfle_Uecopd_MfJe_fY_Mectopk,
1115                                 nRVVep ) );
1116     }
1117     elke
1118     {
1119         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1120                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1121                                 jfle_Uecopd_MfJe_fY_Mectopk,
1122                                 nRVVep ) );
1123     }
1124
1125 }
1126
1127
1128 /****************************************************************************
1129 *                                                                           *
1130 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1131 *                                                                           *
1132 ****************************************************************************/
1133
1134 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1135 {
1136 MTGTXM MtatRk = Zy;
1137
1138     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1139
1140     petRpY ( MtatRk );
1141
1142 }
1143     HfkQipfte ( waYdle,                 /*  waYdle                         */
1144                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1145                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1146                 0,                      /*  MRrepVlRoRk KfxoYfkL           */
1147                 beYgtz                  /*  nEtek to Apfte                 */
1148               );
1149
1150     petRpY ( Zy );
1151 }
1152 EOF
1153 }
1154
1155 # Create "your" revisions for diffmerge1
1156 diffmerge_create_your_files() {
1157           # remove the Button() method
1158           cat >testcase01 <<\EOF
1159 // Button.java
1160
1161 package random.application;
1162
1163 import random.util.*;
1164
1165 public class Button
1166 {
1167   /* Instantiates a Button with origin (0, 0) and zero width and height.
1168    * You must call an initializer method to properly initialize the Button.
1169    */
1170   public Button ()
1171   {
1172     super ();
1173
1174     _titleColor = Color.black;
1175     _disabledTitleColor = Color.gray;
1176     _titleFont = Font.defaultFont ();
1177   }
1178 }
1179 EOF
1180
1181           cat >testcase02 <<\EOF
1182 y
1183 a
1184 a
1185 a
1186 a
1187 EOF
1188
1189           cat >testcase03 <<\EOF
1190 x
1191 s
1192 a
1193 b
1194 s
1195 b
1196 s
1197 y
1198 EOF
1199
1200           cat >testcase04 <<\EOF
1201 s
1202 m
1203 s
1204 v
1205 s
1206 m
1207 s
1208 EOF
1209
1210           cat >testcase05 <<\EOF
1211 v
1212 s
1213 m
1214 s
1215 s
1216 s
1217 s
1218 s
1219 s
1220 s
1221 s
1222 s
1223 s
1224 v
1225 EOF
1226
1227           # Test case 6 and test case 7 both use the same input files, but they
1228           # order the input files differently.  In one case, a certain file is
1229           # used as the older file, but in the other test case, that same file
1230           # is used as the file which has changes.  I could have put echo
1231           # commands here, but since the echo lines would be the same as those
1232           # in the previous function, I decided to save space and avoid repeating
1233           # several lines of code.  Instead, I merely swap the files:
1234           mv testcase07 tmp
1235           mv testcase06 testcase07
1236           mv tmp testcase06
1237
1238           # Make the date newer so that cvs thinks that the files are changed:
1239           touch testcase06 testcase07
1240
1241           cat >testcase08 <<\EOF
1242 no
1243 changes
1244 here
1245
1246 First change has now added this in.
1247
1248     no
1249     changes
1250     here
1251
1252 Second change will change it here.
1253
1254         no
1255         changes
1256         here
1257
1258 Both changes move this line to the end of the file.
1259 EOF
1260
1261           cat >testcase09 <<\EOF
1262
1263 m
1264 a
1265 {
1266 }
1267 b
1268 {
1269 }
1270 c
1271 {
1272 }
1273 EOF
1274
1275           cat >testcase10 <<\EOF
1276
1277     fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
1278
1279     petRpY ( MtatRk );
1280     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1281
1282     fV ( jfle_Uecopd_KRLIep < 16 )
1283     {
1284         MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
1285     }
1286     elke
1287     {
1288         MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
1289         fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1290
1291         MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1292         OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1293
1294     Bloke_GttpfIRte_MtpeaL ( &acI );
1295 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1296 {
1297 MTGTXM MtatRk = Zy;
1298
1299     fV ( Y < 16 )
1300     {
1301         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1302                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1303                                 jfle_Uecopd_MfJe_fY_Mectopk,
1304                                 nRVVep ) );
1305     }
1306     elke
1307     {
1308         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1309                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1310                                 jfle_Uecopd_MfJe_fY_Mectopk,
1311                                 nRVVep ) );
1312     }
1313
1314     petRpY ( MtatRk );
1315
1316 }
1317
1318
1319 /****************************************************************************
1320 *                                                                           *
1321 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1322 *                                                                           *
1323 ****************************************************************************/
1324
1325 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1326 {
1327 MTGTXM MtatRk = Zy;
1328
1329     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1330
1331     petRpY ( MtatRk );
1332
1333 }
1334     HfkQipfte ( waYdle,                 /*  waYdle                         */
1335                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1336                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1337                 0,                      /*  MRrepVlRoRk KfxoYfkL           */
1338                 beYgtz                  /*  nEtek to Apfte                 */
1339               );
1340
1341     petRpY ( Zy );
1342 }
1343
1344 EOF
1345 }
1346
1347 # Create "my" revisions for diffmerge1
1348 diffmerge_create_my_files() {
1349           # My working copy still has the Button() method, but I
1350           # comment out some code at the top of the class.
1351           cat >testcase01 <<\EOF
1352 // Button.java
1353
1354 package random.application;
1355
1356 import random.util.*;
1357
1358 public class Button
1359 {
1360   /* Instantiates a Button with origin (0, 0) and zero width and height.
1361    * You must call an initializer method to properly initialize the Button.
1362    */
1363   public Button ()
1364   {
1365     super ();
1366
1367     // _titleColor = Color.black;
1368     // _disabledTitleColor = Color.gray;
1369     // _titleFont = Font.defaultFont ();
1370   }
1371
1372   /* Convenience constructor for instantiating a Button with
1373    * bounds x, y, width, and height.  Equivalent to
1374    *     foo = new Button ();
1375    *     foo.init (x, y, width, height);
1376    */
1377   public Button (int x, int y, int width, int height)
1378   {
1379     this ();
1380     init (x, y, width, height);
1381   }
1382 }
1383 EOF
1384
1385           cat >testcase02 <<\EOF
1386 a
1387 a
1388 a
1389 a
1390 m
1391 EOF
1392
1393           cat >testcase03 <<\EOF
1394 x
1395 s
1396 c
1397 s
1398 b
1399 s
1400 y
1401 EOF
1402
1403           cat >testcase04 <<\EOF
1404 v
1405 s
1406 x
1407 m
1408 m
1409 x
1410 s
1411 v
1412 s
1413 x
1414 m
1415 m
1416 x
1417 s
1418 v
1419 EOF
1420
1421           # Note that in test case 5, there are no changes in the "mine"
1422           # section, which explains why there is no command here which writes to
1423           # file testcase05.
1424
1425           # no changes for testcase06
1426
1427           # The two branches make the same changes:
1428           cp ../yours/testcase07 .
1429
1430           cat >testcase08 <<\EOF
1431 no
1432 changes
1433 here
1434
1435 First change will delete this line.
1436
1437 First change will also delete this line.
1438
1439     no
1440     changes
1441     here
1442
1443 Second change has now changed it here.
1444
1445         no
1446         changes
1447         here
1448
1449 Both changes move this line to the end of the file.
1450 EOF
1451
1452           cat >testcase09 <<\EOF
1453 m
1454 a
1455 {
1456 }
1457 b
1458 {
1459 }
1460 c
1461 {
1462 }
1463 EOF
1464
1465           cat >testcase10 <<\EOF
1466
1467     petRpY ( MtatRk );
1468     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1469
1470     MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1471     OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1472
1473     Bloke_GttpfIRte_MtpeaL ( &acI );
1474 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1475 {
1476     fV ( Y < 16 )
1477     {
1478         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1479                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1480                                 jfle_Uecopd_MfJe_fY_Mectopk,
1481                                 nRVVep ) );
1482     }
1483     elke
1484     {
1485         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1486                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1487                                 jfle_Uecopd_MfJe_fY_Mectopk,
1488                                 nRVVep ) );
1489     }
1490
1491 }
1492
1493
1494 /****************************************************************************
1495 *                                                                           *
1496 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1497 *                                                                           *
1498 ****************************************************************************/
1499
1500 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1501 {
1502 MTGTXM MtatRk = Zy;
1503
1504     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1505
1506     petRpY ( MtatRk );
1507
1508 }
1509     HfkQipfte ( waYdle,                 /*  waYdle                         */
1510                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1511                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1512                 beYgtz                  /*  nEtek to Apfte                 */
1513               );
1514
1515     petRpY ( Zy );
1516 }
1517
1518 EOF
1519 }
1520
1521 # Create expected results of merge for diffmerge1
1522 diffmerge_create_expected_files() {
1523           cat >testcase01 <<\EOF
1524 // Button.java
1525
1526 package random.application;
1527
1528 import random.util.*;
1529
1530 public class Button
1531 {
1532   /* Instantiates a Button with origin (0, 0) and zero width and height.
1533    * You must call an initializer method to properly initialize the Button.
1534    */
1535   public Button ()
1536   {
1537     super ();
1538
1539     // _titleColor = Color.black;
1540     // _disabledTitleColor = Color.gray;
1541     // _titleFont = Font.defaultFont ();
1542   }
1543 }
1544 EOF
1545
1546           cat >testcase02 <<\EOF
1547 y
1548 a
1549 a
1550 a
1551 m
1552 EOF
1553
1554           cat >testcase03 <<\EOF
1555 x
1556 s
1557 c
1558 s
1559 b
1560 s
1561 b
1562 s
1563 y
1564 EOF
1565
1566           cat >testcase04 <<\EOF
1567 v
1568 s
1569 m
1570 s
1571 v
1572 s
1573 m
1574 s
1575 v
1576 EOF
1577
1578           # Since there are no changes in the "mine" section, just take exactly
1579           # the version in the "yours" section:
1580           cp ../yours/testcase05 .
1581
1582           cp ../yours/testcase06 .
1583
1584           # Since the two branches make the same changes, the result should be
1585           # the same as both branches.  Here, I happen to pick yours to copy from,
1586           # but I could have also picked mine, since the source of the copy is
1587           # the same in either case.  However, the mine has already been
1588           # altered by the update command, so don't use it.  Instead, use the
1589           # yours section which has not had an update on it and so is unchanged:
1590           cp ../yours/testcase07 .
1591
1592           cat >testcase08 <<\EOF
1593 no
1594 changes
1595 here
1596
1597 First change has now added this in.
1598
1599     no
1600     changes
1601     here
1602
1603 Second change has now changed it here.
1604
1605         no
1606         changes
1607         here
1608
1609 Both changes move this line to the end of the file.
1610 EOF
1611
1612           cat >testcase09 <<\EOF
1613
1614 m
1615 a
1616 {
1617 }
1618 b
1619 {
1620 }
1621 c
1622 {
1623 }
1624 EOF
1625
1626           cat >testcase10 <<\EOF
1627
1628     fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
1629
1630     petRpY ( MtatRk );
1631     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1632
1633     fV ( jfle_Uecopd_KRLIep < 16 )
1634     {
1635         MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
1636     }
1637     elke
1638     {
1639         MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
1640         fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1641
1642         MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1643         OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1644
1645     Bloke_GttpfIRte_MtpeaL ( &acI );
1646 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1647 {
1648 MTGTXM MtatRk = Zy;
1649
1650     fV ( Y < 16 )
1651     {
1652         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1653                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1654                                 jfle_Uecopd_MfJe_fY_Mectopk,
1655                                 nRVVep ) );
1656     }
1657     elke
1658     {
1659         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1660                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1661                                 jfle_Uecopd_MfJe_fY_Mectopk,
1662                                 nRVVep ) );
1663     }
1664
1665     petRpY ( MtatRk );
1666
1667 }
1668
1669
1670 /****************************************************************************
1671 *                                                                           *
1672 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1673 *                                                                           *
1674 ****************************************************************************/
1675
1676 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1677 {
1678 MTGTXM MtatRk = Zy;
1679
1680     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1681
1682     petRpY ( MtatRk );
1683
1684 }
1685     HfkQipfte ( waYdle,                 /*  waYdle                         */
1686                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1687                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1688                 beYgtz                  /*  nEtek to Apfte                 */
1689               );
1690
1691     petRpY ( Zy );
1692 }
1693
1694 EOF
1695 }
1696
1697
1698
1699 # Echo a new CVSROOT based on $1, $remote, and $remotehost
1700 newroot() {
1701   if $remote; then
1702     if test -n "$remotehost"; then
1703       echo :ext:$remotehost$1
1704     else
1705       echo :fork:$1
1706     fi
1707   else
1708     echo $1
1709   fi
1710 }
1711
1712
1713
1714 # Set up CVSROOT (the crerepos tests will test operating without CVSROOT set).
1715 #
1716 # Currently we test :fork: and :ext: (see crerepos test).  There is a
1717 # known difference between the two in modes-15 (see comments there).
1718 #
1719 # :ext: can be tested against a remote machine if:
1720 #
1721 #    1. $remotehost is set using the `-h' option to this script.
1722 #    2. ${CVS_RSH=rsh} $remotehost works.
1723 #    3. The path to $TESTDIR is the same on both machines (symlinks are okay)
1724 #    4. The path to $testcvs is the same on both machines (symlinks are okay)
1725 #       or $CVS_SERVER is overridden in this script's environment to point to
1726 #       a working CVS exectuable on the remote machine.
1727 #
1728 # Testing :pserver: would be hard (inetd issues).  (How about using tcpserver
1729 # and some high port number?  DRP)
1730
1731 # Allow CVS_SERVER to be overridden.  This facilitates constructs like
1732 # testing a local case-insensitive client against a remote case
1733 # sensitive server and visa versa.
1734 : ${CVS_SERVER=$testcvs}; export CVS_SERVER
1735
1736 if $linkroot; then
1737     mkdir ${TESTDIR}/realcvsroot
1738     ln -s realcvsroot ${TESTDIR}/cvsroot
1739 fi
1740 CVSROOT_DIRNAME=${TESTDIR}/cvsroot
1741 CVSROOT=`newroot $CVSROOT_DIRNAME`; export CVSROOT
1742
1743
1744
1745 ###
1746 ### The tests
1747 ###
1748 dotest 1 "${testcvs} init" ''
1749 dotest 1a "${testcvs} init" ''
1750
1751 ### The big loop
1752 for what in $tests; do
1753         if test -n "$fromtest" ; then
1754             if test $fromtest = $what ; then
1755                 unset fromtest
1756             else
1757                 continue
1758             fi
1759         fi
1760         case $what in
1761
1762         version)
1763           # We've had cases where the version command started dumping core,
1764           # so we might as well test it
1765           dotest version-1 "${testcvs} --version" \
1766 '
1767 Concurrent Versions System (CVS) [0-9.]*.*
1768
1769 Copyright (c) [-0-9]* Brian Berliner, david d .zoo. zuhn, 
1770                         Jeff Polk, and other authors
1771
1772 CVS may be copied only under the terms of the GNU General Public License,
1773 a copy of which can be found with the CVS distribution kit.
1774
1775 Specify the --help option for further information about CVS'
1776
1777           if $remote; then
1778                 dotest version-2r "${testcvs} version" \
1779 'Client: Concurrent Versions System (CVS) [0-9p.]* (client/server)
1780 Server: Concurrent Versions System (CVS) [0-9p.]* (client/server)'
1781           else
1782                 dotest version-2 "${testcvs} version" \
1783 'Concurrent Versions System (CVS) [0-9.]*.*'
1784           fi
1785           ;;
1786
1787         basica)
1788           # Similar in spirit to some of the basic1, and basic2
1789           # tests, but hopefully a lot faster.  Also tests operating on
1790           # files two directories down *without* operating on the parent dirs.
1791
1792           # Tests basica-0a and basica-0b provide the equivalent of the:
1793           #    mkdir ${CVSROOT_DIRNAME}/first-dir
1794           # used by many of the tests.  It is "more official" in the sense
1795           # that is does everything through CVS; the reason most of the
1796           # tests don't use it is mostly historical.
1797           mkdir 1; cd 1
1798           dotest basica-0a "${testcvs} -q co -l ." ''
1799           mkdir first-dir
1800           dotest basica-0b "${testcvs} add first-dir" \
1801 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
1802           cd ..
1803           rm -r 1
1804
1805           dotest basica-1 "${testcvs} -q co first-dir" ''
1806           cd first-dir
1807
1808           # Test a few operations, to ensure they gracefully do
1809           # nothing in an empty directory.
1810           dotest basica-1a0 "${testcvs} -q update" ''
1811           dotest basica-1a1 "${testcvs} -q diff -c" ''
1812           dotest basica-1a2 "${testcvs} -q status" ''
1813           dotest basica-1a3 "${testcvs} -q update ." ''
1814           dotest basica-1a4 "${testcvs} -q update ./" ''
1815
1816           mkdir sdir
1817           # Remote CVS gives the "cannot open CVS/Entries" error, which is
1818           # clearly a bug, but not a simple one to fix.
1819           dotest basica-1a10 "${testcvs} -n add sdir" \
1820 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository" \
1821 "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
1822 Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
1823           dotest_fail basica-1a11 \
1824             "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
1825           dotest basica-2 "${testcvs} add sdir" \
1826 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
1827           cd sdir
1828           mkdir ssdir
1829           dotest basica-3 "${testcvs} add ssdir" \
1830 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir added to the repository"
1831           cd ssdir
1832           echo ssfile >ssfile
1833
1834           # Trying to commit it without a "cvs add" should be an error.
1835           # The "use `cvs add' to create an entry" message is the one
1836           # that I consider to be more correct, but local cvs prints the
1837           # "nothing known" message and noone has gotten around to fixing it.
1838           dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
1839 "${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
1840 ${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
1841 "${PROG}"' [a-z]*: nothing known about `ssfile'\''
1842 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
1843
1844           dotest basica-4 "${testcvs} add ssfile" \
1845 "${PROG}"' add: scheduling file `ssfile'\'' for addition
1846 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
1847           dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
1848 "${PROG} tag: nothing known about ssfile
1849 ${PROG} "'\[tag aborted\]: correct the above errors first!'
1850           cd ../..
1851           dotest basica-5 "${testcvs} -q ci -m add-it" \
1852 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1853 done
1854 Checking in sdir/ssdir/ssfile;
1855 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1856 initial revision: 1\.1
1857 done"
1858           dotest_fail basica-5a \
1859             "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
1860 "${PROG} tag: Attempt to add reserved tag name BASE
1861 ${PROG} \[tag aborted\]: failed to set tag BASE to revision 1\.1 in ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v"
1862           dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
1863 'T sdir/ssdir/ssfile'
1864
1865           dotest basica-6 "${testcvs} -q update" ''
1866           echo "ssfile line 2" >>sdir/ssdir/ssfile
1867           dotest_fail basica-6.2 "${testcvs} -q diff -c" \
1868 "Index: sdir/ssdir/ssfile
1869 ===================================================================
1870 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1871 retrieving revision 1\.1
1872 diff -c -r1\.1 ssfile
1873 \*\*\* sdir/ssdir/ssfile        ${RFCDATE}      1\.1
1874 --- sdir/ssdir/ssfile   ${RFCDATE}
1875 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1876 \*\*\* 1 \*\*\*\*
1877 --- 1,2 ----
1878   ssfile
1879 ${PLUS} ssfile line 2"
1880           dotest_fail basica-6.3 "${testcvs} -q diff -c -rBASE" \
1881 "Index: sdir/ssdir/ssfile
1882 ===================================================================
1883 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1884 retrieving revision 1\.1
1885 diff -c -r1\.1 ssfile
1886 \*\*\* sdir/ssdir/ssfile        ${RFCDATE}      1\.1
1887 --- sdir/ssdir/ssfile   ${RFCDATE}
1888 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1889 \*\*\* 1 \*\*\*\*
1890 --- 1,2 ----
1891   ssfile
1892 ${PLUS} ssfile line 2"
1893           dotest_fail basica-6.4 "${testcvs} -q diff -c -rBASE -C3isacrowd" \
1894 "Index: sdir/ssdir/ssfile
1895 ===================================================================
1896 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1897 retrieving revision 1\.1
1898 diff -c -C3isacrowd -r1\.1 ssfile
1899 ${PROG} diff: invalid context length argument"
1900           dotest basica-7 "${testcvs} -q ci -m modify-it" \
1901 "Checking in sdir/ssdir/ssfile;
1902 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1903 new revision: 1\.2; previous revision: 1\.1
1904 done"
1905           dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
1906 "${PROG}"' [a-z]*: nothing known about `nonexist'\''
1907 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
1908           dotest basica-8 "${testcvs} -q update ." ''
1909
1910           # Test the -f option to ci
1911           cd sdir/ssdir
1912           dotest basica-8a0 "${testcvs} -q ci -m not-modified ssfile" ''
1913           dotest basica-8a "${testcvs} -q ci -f -m force-it" \
1914 "Checking in ssfile;
1915 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1916 new revision: 1\.3; previous revision: 1\.2
1917 done"
1918           dotest basica-8a1 "${testcvs} -q ci -m bump-it -r 2.0" \
1919 "Checking in ssfile;
1920 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1921 new revision: 2\.0; previous revision: 1\.3
1922 done"
1923           dotest basica-8a1a "${testcvs} -q ci -m bump-it -r 2.9" \
1924 "Checking in ssfile;
1925 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1926 new revision: 2\.9; previous revision: 2\.0
1927 done"
1928           # Test string-based revion number increment rollover
1929           dotest basica-8a1b "${testcvs} -q ci -m bump-it -f -r 2" \
1930 "Checking in ssfile;
1931 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1932 new revision: 2\.10; previous revision: 2\.9
1933 done"
1934           dotest basica-8a1c "${testcvs} -q ci -m bump-it -r 2.99" \
1935 "Checking in ssfile;
1936 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1937 new revision: 2\.99; previous revision: 2\.10
1938 done"
1939           # Test string-based revion number increment rollover
1940           dotest basica-8a1d "${testcvs} -q ci -m bump-it -f -r 2" \
1941 "Checking in ssfile;
1942 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1943 new revision: 2\.100; previous revision: 2\.99
1944 done"
1945           dotest basica-8a1e "${testcvs} -q ci -m bump-it -r 2.1099" \
1946 "Checking in ssfile;
1947 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1948 new revision: 2\.1099; previous revision: 2\.100
1949 done"
1950           # Test string-based revion number increment rollover
1951           dotest basica-8a1f "${testcvs} -q ci -m bump-it -f -r 2" \
1952 "Checking in ssfile;
1953 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1954 new revision: 2\.1100; previous revision: 2\.1099
1955 done"
1956           # -f should not be necessary, but it should be harmless.
1957           # Also test the "-r 3" (rather than "-r 3.0") usage.
1958           dotest basica-8a2 "${testcvs} -q ci -m bump-it -f -r 3" \
1959 "Checking in ssfile;
1960 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1961 new revision: 3\.1; previous revision: 2\.1100
1962 done"
1963
1964           # Test using -r to create a branch
1965           dotest_fail basica-8a3 "${testcvs} -q ci -m bogus -r 3.0.0" \
1966 "Checking in ssfile;
1967 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1968 ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: can't find branch point 3\.0
1969 ${PROG} commit: could not check in ssfile"
1970           dotest basica-8a4 "${testcvs} -q ci -m valid -r 3.1.2" \
1971 "Checking in ssfile;
1972 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1973 new revision: 3\.1\.2\.1; previous revision: 3\.1
1974 done"
1975           # now get rid of the sticky tag and go back to the trunk
1976           dotest basica-8a5 "${testcvs} -q up -A ./" "[UP] ssfile"
1977
1978           cd ../..
1979           dotest basica-8b "${testcvs} -q diff -r1.2 -r1.3"
1980           dotest basica-8b1 "${testcvs} -q diff -r1.2 -r1.3 -C 3isacrowd"
1981
1982           # The .* here will normally be "No such file or directory",
1983           # but if memory serves some systems (AIX?) have a different message.
1984 :         dotest_fail basica-9 \
1985             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
1986 "${PROG}: cannot access cvs root ${TESTDIR}/nonexist: .*"
1987           dotest_fail basica-9 \
1988             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
1989 "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/nonexist/CVSROOT: .*"
1990
1991           dotest basica-10 "${testcvs} annotate" \
1992 '
1993 Annotations for sdir/ssdir/ssfile
1994 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1995 1\.1          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile
1996 1\.2          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2'
1997
1998           # Test resurrecting with strange revision numbers
1999           cd sdir/ssdir
2000           dotest basica-r1 "${testcvs} rm -f ssfile" \
2001 "${PROG} remove: scheduling .ssfile. for removal
2002 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
2003           dotest basica-r2 "${testcvs} -q ci -m remove" \
2004 "Removing ssfile;
2005 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2006 new revision: delete; previous revision: 3\.1
2007 done"
2008           dotest basica-r3 "${testcvs} -q up -p -r 3.1 ./ssfile >ssfile" ""
2009           dotest basica-r4 "${testcvs} add ssfile" \
2010 "${PROG} add: Re-adding file .ssfile. (in place of dead revision 3\.2)\.
2011 ${PROG} add: use .${PROG} commit. to add this file permanently"
2012           dotest basica-r5 "${testcvs} -q ci -m resurrect" \
2013 "Checking in ssfile;
2014 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2015 new revision: 3\.3; previous revision: 3\.2
2016 done"
2017           cd ../..
2018
2019           # As long as we have a file with a few revisions, test
2020           # a few "cvs admin -o" invocations.
2021           cd sdir/ssdir
2022           dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
2023 "${PROG} [a-z]*: while processing more than one file:
2024 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
2025           dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
2026 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2027 done"
2028           dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
2029 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2030 done"
2031           dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
2032 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2033 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
2034 ${PROG} admin: RCS file for .ssfile. not modified\."
2035           dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
2036 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2037 done"
2038           dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
2039 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2040 deleting revision 3\.3
2041 deleting revision 3\.2
2042 done"
2043           dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
2044 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2045 done"
2046           dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
2047 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2048 deleting revision 2\.1100
2049 deleting revision 2\.1099
2050 deleting revision 2\.100
2051 deleting revision 2\.99
2052 deleting revision 2\.10
2053 deleting revision 2\.9
2054 deleting revision 2\.0
2055 deleting revision 1\.3
2056 done"
2057           dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
2058 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2059 deleting revision 2\.1100
2060 deleting revision 2\.1099
2061 deleting revision 2\.100
2062 deleting revision 2\.99
2063 deleting revision 2\.10
2064 deleting revision 2\.9
2065 deleting revision 2\.0
2066 deleting revision 1\.3
2067 done"
2068           dotest basica-o6a "${testcvs} admin -o 3.1.2: ssfile" \
2069 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2070 deleting revision 3\.1\.2\.1
2071 done"
2072           dotest basica-o7 "${testcvs} log -N ssfile" "
2073 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2074 Working file: ssfile
2075 head: 3\.1
2076 branch:
2077 locks: strict
2078 access list:
2079 keyword substitution: kv
2080 total revisions: 3;     selected revisions: 3
2081 description:
2082 ----------------------------
2083 revision 3\.1
2084 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
2085 bump-it
2086 ----------------------------
2087 revision 1\.2
2088 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
2089 modify-it
2090 ----------------------------
2091 revision 1\.1
2092 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2093 add-it
2094 ============================================================================="
2095           dotest basica-o8 "${testcvs} -q update -p -r 1.1 ./ssfile" "ssfile"
2096           cd ../..
2097
2098           cd ..
2099
2100           rm -rf ${CVSROOT_DIRNAME}/first-dir
2101           rm -r first-dir
2102           ;;
2103
2104         basicb)
2105           # More basic tests, including non-branch tags and co -d.
2106           mkdir 1; cd 1
2107           dotest basicb-0a "${testcvs} -q co -l ." ''
2108           touch topfile
2109           dotest basicb-0b "${testcvs} add topfile" \
2110 "${PROG} add: scheduling file .topfile. for addition
2111 ${PROG} add: use .${PROG} commit. to add this file permanently"
2112           dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
2113 "RCS file: ${CVSROOT_DIRNAME}/topfile,v
2114 done
2115 Checking in topfile;
2116 ${CVSROOT_DIRNAME}/topfile,v  <--  topfile
2117 initial revision: 1\.1
2118 done"
2119           cd ..
2120           rm -r 1
2121           mkdir 2; cd 2
2122           dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
2123           # Now test the ability to run checkout on an existing working
2124           # directory without having it lose its mind.  I don't know
2125           # whether this is tested elsewhere in sanity.sh.  A more elaborate
2126           # test might also have modified files, make sure it works if
2127           # the modules file was modified to add new directories to the
2128           # module, and such.
2129           dotest basicb-0d0 "${testcvs} -q co -l ." ""
2130           mkdir first-dir
2131           dotest basicb-0e "${testcvs} add first-dir" \
2132 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
2133           cd ..
2134           rm -r 2
2135
2136           dotest basicb-1 "${testcvs} -q co first-dir" ''
2137
2138           # The top-level CVS directory is not created by default.
2139           # I'm leaving basicb-1a and basicb-1b untouched, mostly, in
2140           # case we decide that the default should be reversed...
2141
2142           dotest_fail basicb-1a "test -d CVS" ''
2143
2144           dotest basicb-1c "cat first-dir/CVS/Repository" "first-dir"
2145
2146           cd first-dir
2147           # Note that the name Emptydir is chosen to test that CVS just
2148           # treats it like any other directory name.  It should be
2149           # special only when it is directly in $CVSROOT/CVSROOT.
2150           mkdir Emptydir sdir2
2151           dotest basicb-2 "${testcvs} add Emptydir sdir2" \
2152 "Directory ${CVSROOT_DIRNAME}/first-dir/Emptydir added to the repository
2153 Directory ${CVSROOT_DIRNAME}/first-dir/sdir2 added to the repository"
2154           cd Emptydir
2155           echo sfile1 starts >sfile1
2156           dotest basicb-2a10 "${testcvs} -n add sfile1" \
2157 "${PROG} add: scheduling file .sfile1. for addition
2158 ${PROG} add: use .${PROG} commit. to add this file permanently"
2159           dotest basicb-2a11 "${testcvs} status sfile1" \
2160 "${PROG} status: use .${PROG} add. to create an entry for sfile1
2161 ===================================================================
2162 File: sfile1            Status: Unknown
2163
2164    Working revision:    No entry for sfile1
2165    Repository revision: No revision control file"
2166           dotest basicb-3 "${testcvs} add sfile1" \
2167 "${PROG} add: scheduling file .sfile1. for addition
2168 ${PROG} add: use .${PROG} commit. to add this file permanently"
2169           dotest basicb-3a1 "${testcvs} status sfile1" \
2170 "===================================================================
2171 File: sfile1            Status: Locally Added
2172
2173    Working revision:    New file!
2174    Repository revision: No revision control file
2175    Sticky Tag:          (none)
2176    Sticky Date:         (none)
2177    Sticky Options:      (none)"
2178
2179           cd ../sdir2
2180           echo sfile2 starts >sfile2
2181           dotest basicb-4 "${testcvs} add sfile2" \
2182 "${PROG} add: scheduling file .sfile2. for addition
2183 ${PROG} add: use .${PROG} commit. to add this file permanently"
2184           dotest basicb-4a "${testcvs} -q ci CVS" \
2185 "${PROG} [a-z]*: warning: directory CVS specified in argument
2186 ${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
2187           cd ..
2188           dotest basicb-5 "${testcvs} -q ci -m add" \
2189 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v
2190 done
2191 Checking in Emptydir/sfile1;
2192 ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
2193 initial revision: 1\.1
2194 done
2195 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2196 done
2197 Checking in sdir2/sfile2;
2198 ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2199 initial revision: 1\.1
2200 done"
2201           echo sfile1 develops >Emptydir/sfile1
2202           dotest basicb-6 "${testcvs} -q ci -m modify" \
2203 "Checking in Emptydir/sfile1;
2204 ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
2205 new revision: 1\.2; previous revision: 1\.1
2206 done"
2207           dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
2208 T sdir2/sfile2'
2209           echo not in time for release-1 >sdir2/sfile2
2210           dotest basicb-8 "${testcvs} -q ci -m modify-2" \
2211 "Checking in sdir2/sfile2;
2212 ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2213 new revision: 1\.2; previous revision: 1\.1
2214 done"
2215           # See if CVS can correctly notice when an invalid numeric
2216           # revision is specified.
2217           # Commented out until we get around to fixing CVS
2218 :         dotest basicb-8a0 "${testcvs} diff -r 1.5 -r 1.7 sfile2" 'error msg'
2219           cd ..
2220
2221           # Test that we recurse into the correct directory when checking
2222           # for existing files, even if co -d is in use.
2223           touch first-dir/extra
2224           dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
2225 'U first-dir1/Emptydir/sfile1
2226 U first-dir1/sdir2/sfile2'
2227           rm -r first-dir1
2228
2229           rm -r first-dir
2230
2231           # FIXME? basicb-9 used to check things out like this:
2232           #   U newdir/Emptydir/sfile1
2233           #   U newdir/sdir2/sfile2
2234           # but that's difficult to do.  The whole "shorten" thing
2235           # is pretty bogus, because it will break on things
2236           # like "cvs co foo/bar baz/quux".  Unless there's some
2237           # pretty detailed expansion and analysis of the command-line
2238           # arguments, we shouldn't do "shorten" stuff at all.
2239
2240           dotest basicb-9 \
2241 "${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
2242 'U newdir/first-dir/Emptydir/sfile1
2243 U newdir/first-dir/sdir2/sfile2'
2244
2245           # basicb-9a and basicb-9b: see note about basicb-1a
2246
2247           dotest_fail basicb-9a "test -d CVS" ''
2248
2249           dotest basicb-9c "cat newdir/CVS/Repository" "\."
2250           dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
2251 "${CVSROOT_DIRNAME}/first-dir" \
2252 "first-dir"
2253           dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
2254 "${CVSROOT_DIRNAME}/first-dir/Emptydir" \
2255 "first-dir/Emptydir"
2256           dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
2257 "${CVSROOT_DIRNAME}/first-dir/sdir2" \
2258 "first-dir/sdir2"
2259
2260           dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
2261 "sfile1 develops
2262 sfile2 starts"
2263
2264           rm -r newdir
2265
2266           # Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
2267           # seem to deal with it...
2268           if false; then
2269           dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
2270 "U sub1/sub2/Emptydir/sfile1
2271 U sub1/sub2/sdir2/sfile2"
2272           cd sub1
2273           dotest basicb-12 "${testcvs} -q update ./." ''
2274           touch xx
2275           dotest basicb-13 "${testcvs} add xx" fixme
2276           cd ..
2277           rm -r sub1
2278           # to test: sub1/sub2/sub3
2279           fi # end of tests commented out.
2280
2281           # Create a second directory.
2282           mkdir 1
2283           cd 1
2284           dotest basicb-14 "${testcvs} -q co -l ." 'U topfile'
2285           mkdir second-dir
2286           dotest basicb-15 "${testcvs} add second-dir" \
2287 "Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2288           cd second-dir
2289           touch aa
2290           dotest basicb-16 "${testcvs} add aa" \
2291 "${PROG} add: scheduling file .aa. for addition
2292 ${PROG} add: use .${PROG} commit. to add this file permanently"
2293           dotest basicb-17 "${testcvs} -q ci -m add" \
2294 "RCS file: ${CVSROOT_DIRNAME}/second-dir/aa,v
2295 done
2296 Checking in aa;
2297 ${CVSROOT_DIRNAME}/second-dir/aa,v  <--  aa
2298 initial revision: 1\.1
2299 done"
2300           cd ..
2301
2302           # Try to remove all revisions in a file.
2303           dotest_fail basicb-o1 "${testcvs} admin -o1.1 topfile" \
2304 "RCS file: ${CVSROOT_DIRNAME}/topfile,v
2305 deleting revision 1\.1
2306 ${PROG} \[admin aborted\]: attempt to delete all revisions"
2307           dotest basicb-o2 "${testcvs} -q update -d first-dir" \
2308 "U first-dir/Emptydir/sfile1
2309 U first-dir/sdir2/sfile2"
2310           dotest_fail basicb-o3 \
2311 "${testcvs} admin -o1.1:1.2 first-dir/sdir2/sfile2" \
2312 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2313 deleting revision 1\.2
2314 deleting revision 1\.1
2315 ${PROG} \[admin aborted\]: attempt to delete all revisions"
2316           cd ..
2317           rm -r 1
2318
2319           mkdir 1; cd 1
2320           # Note that -H is an illegal option.
2321           # I suspect that the choice between "illegal" and "invalid"
2322           # depends on the user's environment variables, the phase
2323           # of the moon (weirdness with optind), and who knows what else.
2324           # I've been seeing "illegal"...
2325           dotest_fail basicb-21 "${testcvs} -q admin -H" \
2326 "admin: illegal option -- H
2327 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
2328 "admin: invalid option -- H
2329 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
2330           cd ..
2331           rmdir 1
2332
2333           if $keep; then
2334             echo Keeping ${TESTDIR} and exiting due to --keep
2335             exit 0
2336           fi
2337
2338           rm -rf ${CVSROOT_DIRNAME}/first-dir
2339           rm -rf ${CVSROOT_DIRNAME}/second-dir
2340           rm -f ${CVSROOT_DIRNAME}/topfile,v
2341           ;;
2342
2343         basicc)
2344           # More tests of basic/miscellaneous functionality.
2345           mkdir 1; cd 1
2346           dotest_fail basicc-1 "${testcvs} diff" \
2347 "${PROG} [a-z]*: in directory \.:
2348 ${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
2349           dotest basicc-2 "${testcvs} -q co -l ." ''
2350           mkdir first-dir second-dir
2351           dotest basicc-3 "${testcvs} add first-dir second-dir" \
2352 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
2353 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2354           # Old versions of CVS often didn't create this top-level CVS
2355           # directory in the first place.  I think that maybe the only
2356           # way to get it to work currently is to let CVS create it,
2357           # and then blow it away (don't complain if it does not
2358           # exist).  But that is perfectly legal; people who are used
2359           # to the old behavior especially may be interested.
2360           # FIXME: this test is intended for the TopLevelAdmin=yes case;
2361           # should adjust/move it accordingly.
2362           rm -rf CVS
2363           dotest basicc-4 "echo *" "first-dir second-dir"
2364           dotest basicc-5 "${testcvs} update" \
2365 "${PROG} update: Updating first-dir
2366 ${PROG} update: Updating second-dir" \
2367 "${PROG} update: Updating \.
2368 ${PROG} update: Updating first-dir
2369 ${PROG} update: Updating second-dir"
2370
2371           cd first-dir
2372           dotest basicc-6 "${testcvs} release -d" ""
2373           dotest basicc-7 "test -d ../first-dir" ""
2374           # The Linux 2.2 kernel lets you delete ".".  That's OK either way,
2375           # the point is that CVS must not mess with anything *outside* "."
2376           # the way that CVS 1.10 and older tried to.
2377           dotest basicc-8 "${testcvs} -Q release -d ." \
2378 "" "${PROG} release: deletion of directory \. failed: .*"
2379           dotest basicc-9 "test -d ../second-dir" ""
2380           # For CVS to make a syntactic check for "." wouldn't suffice.
2381           # On Linux 2.2 systems, the cwd may be gone, so we recreate it
2382           # to allow basicc-11 to actually happen 
2383           if test ! -d ../first-dir; then
2384             cd ..
2385             mkdir ./first-dir
2386             cd ./first-dir
2387           fi
2388           dotest basicc-11 "${testcvs} -Q release -d ./." \
2389 "" "${PROG} release: deletion of directory \./\. failed: .*"
2390           dotest basicc-11a "test -d ../second-dir" ""
2391
2392           cd ..
2393           cd ..
2394
2395           mkdir 2; cd 2
2396           dotest basicc-12 "${testcvs} -Q co ." ""
2397           # actual entries can be in either Entries or Entries.log, do
2398           # an update to get them consolidated into Entries
2399           dotest basicc-12a "${testcvs} -Q up" ""
2400           dotest basicc-12b "cat CVS/Entries" \
2401 "D/CVSROOT////
2402 D/first-dir////
2403 D/second-dir////"
2404           dotest basicc-13 "echo *" "CVS CVSROOT first-dir second-dir"
2405           dotest basicc-14 "${testcvs} -Q release first-dir second-dir" ""
2406           # a normal release shouldn't affect the Entries file
2407           dotest basicc-14b "cat CVS/Entries" \
2408 "D/CVSROOT////
2409 D/first-dir////
2410 D/second-dir////"
2411           # FIXCVS: but release -d probably should
2412           dotest basicc-15 "${testcvs} -Q release -d first-dir second-dir" ""
2413           dotest basicc-16 "echo *" "CVS CVSROOT"
2414           dotest basicc-17 "cat CVS/Entries" \
2415 "D/CVSROOT////
2416 D/first-dir////
2417 D/second-dir////"
2418           # FIXCVS: if not, update should notice the missing directories
2419           # and update Entries accordingly
2420           dotest basicc-18 "${testcvs} -Q up" ""
2421           dotest basicc-19 "cat CVS/Entries" \
2422 "D/CVSROOT////
2423 D/first-dir////
2424 D/second-dir////"
2425
2426           cd ..
2427           rm -r 1 2
2428           rm -rf ${CVSROOT_DIRNAME}/first-dir
2429           ;;
2430
2431         basic1)
2432           # first dive - add a files, first singly, then in a group.
2433           mkdir ${CVSROOT_DIRNAME}/first-dir
2434           mkdir basic1; cd basic1
2435           # check out an empty directory
2436           dotest basic1-1 "${testcvs} -q co first-dir" ''
2437
2438           cd first-dir
2439           echo file2 >file2
2440           echo file3 >file3
2441           echo file4 >file4
2442           echo file5 >file5
2443
2444           dotest basic1-14-add-add "${testcvs} add file2 file3 file4 file5" \
2445 "${PROG} add: scheduling file \`file2' for addition
2446 ${PROG} add: scheduling file \`file3' for addition
2447 ${PROG} add: scheduling file \`file4' for addition
2448 ${PROG} add: scheduling file \`file5' for addition
2449 ${PROG} add: use .${PROG} commit. to add these files permanently"
2450           dotest basic1-15-add-add \
2451 "${testcvs} -q update file2 file3 file4 file5" \
2452 "A file2
2453 A file3
2454 A file4
2455 A file5"
2456           dotest basic1-16-add-add "${testcvs} -q update" \
2457 "A file2
2458 A file3
2459 A file4
2460 A file5"
2461           dotest basic1-17-add-add "${testcvs} -q status" \
2462 "===================================================================
2463 File: file2             Status: Locally Added
2464
2465    Working revision:    New file!
2466    Repository revision: No revision control file
2467    Sticky Tag:          (none)
2468    Sticky Date:         (none)
2469    Sticky Options:      (none)
2470
2471 ===================================================================
2472 File: file3             Status: Locally Added
2473
2474    Working revision:    New file!
2475    Repository revision: No revision control file
2476    Sticky Tag:          (none)
2477    Sticky Date:         (none)
2478    Sticky Options:      (none)
2479
2480 ===================================================================
2481 File: file4             Status: Locally Added
2482
2483    Working revision:    New file!
2484    Repository revision: No revision control file
2485    Sticky Tag:          (none)
2486    Sticky Date:         (none)
2487    Sticky Options:      (none)
2488
2489 ===================================================================
2490 File: file5             Status: Locally Added
2491
2492    Working revision:    New file!
2493    Repository revision: No revision control file
2494    Sticky Tag:          (none)
2495    Sticky Date:         (none)
2496    Sticky Options:      (none)"
2497           dotest basic1-18-add-add "${testcvs} -q log" \
2498 "${PROG} log: file2 has been added, but not committed
2499 ${PROG} log: file3 has been added, but not committed
2500 ${PROG} log: file4 has been added, but not committed
2501 ${PROG} log: file5 has been added, but not committed"
2502           cd ..
2503           dotest basic1-21-add-add "${testcvs} -q update" \
2504 "A first-dir/file2
2505 A first-dir/file3
2506 A first-dir/file4
2507 A first-dir/file5"
2508           # FIXCVS?  Shouldn't this read first-dir/file2 instead of file2?
2509           dotest basic1-22-add-add "${testcvs} log first-dir" \
2510 "${PROG} log: Logging first-dir
2511 ${PROG} log: file2 has been added, but not committed
2512 ${PROG} log: file3 has been added, but not committed
2513 ${PROG} log: file4 has been added, but not committed
2514 ${PROG} log: file5 has been added, but not committed"
2515           dotest basic1-23-add-add "${testcvs} status first-dir" \
2516 "${PROG} status: Examining first-dir
2517 ===================================================================
2518 File: file2             Status: Locally Added
2519
2520    Working revision:    New file!
2521    Repository revision: No revision control file
2522    Sticky Tag:          (none)
2523    Sticky Date:         (none)
2524    Sticky Options:      (none)
2525
2526 ===================================================================
2527 File: file3             Status: Locally Added
2528
2529    Working revision:    New file!
2530    Repository revision: No revision control file
2531    Sticky Tag:          (none)
2532    Sticky Date:         (none)
2533    Sticky Options:      (none)
2534
2535 ===================================================================
2536 File: file4             Status: Locally Added
2537
2538    Working revision:    New file!
2539    Repository revision: No revision control file
2540    Sticky Tag:          (none)
2541    Sticky Date:         (none)
2542    Sticky Options:      (none)
2543
2544 ===================================================================
2545 File: file5             Status: Locally Added
2546
2547    Working revision:    New file!
2548    Repository revision: No revision control file
2549    Sticky Tag:          (none)
2550    Sticky Date:         (none)
2551    Sticky Options:      (none)"
2552           dotest basic1-24-add-add "${testcvs} update first-dir" \
2553 "${PROG} update: Updating first-dir
2554 A first-dir/file2
2555 A first-dir/file3
2556 A first-dir/file4
2557 A first-dir/file5"
2558           dotest basic1-27-add-add "${testcvs} co first-dir" \
2559 "${PROG} checkout: Updating first-dir
2560 A first-dir/file2
2561 A first-dir/file3
2562 A first-dir/file4
2563 A first-dir/file5"
2564           cd first-dir
2565           dotest basic1-14-add-ci \
2566 "${testcvs} commit -m test file2 file3 file4 file5" \
2567 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
2568 done
2569 Checking in file2;
2570 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2571 initial revision: 1\.1
2572 done
2573 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
2574 done
2575 Checking in file3;
2576 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
2577 initial revision: 1\.1
2578 done
2579 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
2580 done
2581 Checking in file4;
2582 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
2583 initial revision: 1\.1
2584 done
2585 RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
2586 done
2587 Checking in file5;
2588 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
2589 initial revision: 1\.1
2590 done"
2591           dotest basic1-15-add-ci \
2592 "${testcvs} -q update file2 file3 file4 file5" ''
2593           dotest basic1-16-add-ci "${testcvs} -q update" ''
2594           dotest basic1-17-add-ci "${testcvs} -q status" \
2595 "===================================================================
2596 File: file2             Status: Up-to-date
2597
2598    Working revision:    1\.1.*
2599    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file2,v
2600    Sticky Tag:          (none)
2601    Sticky Date:         (none)
2602    Sticky Options:      (none)
2603
2604 ===================================================================
2605 File: file3             Status: Up-to-date
2606
2607    Working revision:    1\.1.*
2608    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file3,v
2609    Sticky Tag:          (none)
2610    Sticky Date:         (none)
2611    Sticky Options:      (none)
2612
2613 ===================================================================
2614 File: file4             Status: Up-to-date
2615
2616    Working revision:    1\.1.*
2617    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file4,v
2618    Sticky Tag:          (none)
2619    Sticky Date:         (none)
2620    Sticky Options:      (none)
2621
2622 ===================================================================
2623 File: file5             Status: Up-to-date
2624
2625    Working revision:    1\.1.*
2626    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file5,v
2627    Sticky Tag:          (none)
2628    Sticky Date:         (none)
2629    Sticky Options:      (none)"
2630           # The "log" tests and friends probably already test the output 
2631           # from log quite adequately.
2632           # Note: using dotest fails here.  It seems to be related
2633           # to the output being sufficiently large (Red Hat 4.1).
2634           # dotest basic1-18-add-ci "${testcvs} log" "${DOTSTAR}"
2635           if ${testcvs} -q log >>${LOGFILE}; then
2636             pass basic1-18-add-ci
2637           else
2638             pass basic1-18-add-ci
2639           fi
2640           cd ..
2641           dotest basic1-21-add-ci "${testcvs} -q update" ''
2642           # See test basic1-18-add-ci for explanation of non-use of dotest.
2643           if ${testcvs} -q log first-dir >>${LOGFILE}; then
2644             pass basic1-22-add-ci
2645           else
2646             pass basic1-22-add-ci
2647           fi
2648           # At least for the moment I am going to consider 17-add-ci
2649           # an adequate test of the output here.
2650           # See test basic1-18-add-ci for explanation of non-use of dotest.
2651           if ${testcvs} -q status first-dir >>${LOGFILE}; then
2652             pass basic1-23-add-ci
2653           else
2654             pass basic1-23-add-ci
2655           fi
2656           dotest basic1-24-add-ci "${testcvs} -q update first-dir" ''
2657           dotest basic1-27-add-ci "${testcvs} -q co first-dir" ''
2658
2659           cd first-dir
2660           rm file2 file3 file4 file5
2661           dotest basic1-14-rm-rm "${testcvs} rm file2 file3 file4 file5" \
2662 "${PROG} remove: scheduling .file2. for removal
2663 ${PROG} remove: scheduling .file3. for removal
2664 ${PROG} remove: scheduling .file4. for removal
2665 ${PROG} remove: scheduling .file5. for removal
2666 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
2667           # 15-rm-rm was commented out.  Why?
2668           dotest basic1-15-rm-rm \
2669 "${testcvs} -q update file2 file3 file4 file5" \
2670 "R file2
2671 R file3
2672 R file4
2673 R file5"
2674           dotest basic1-16-rm-rm "${testcvs} -q update" \
2675 "R file2
2676 R file3
2677 R file4
2678 R file5"
2679           dotest basic1-17-rm-rm "${testcvs} -q status" \
2680 "===================================================================
2681 File: no file file2             Status: Locally Removed
2682
2683    Working revision:    -1\.1.*
2684    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file2,v
2685    Sticky Tag:          (none)
2686    Sticky Date:         (none)
2687    Sticky Options:      (none)
2688
2689 ===================================================================
2690 File: no file file3             Status: Locally Removed
2691
2692    Working revision:    -1\.1.*
2693    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file3,v
2694    Sticky Tag:          (none)
2695    Sticky Date:         (none)
2696    Sticky Options:      (none)
2697
2698 ===================================================================
2699 File: no file file4             Status: Locally Removed
2700
2701    Working revision:    -1\.1.*
2702    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file4,v
2703    Sticky Tag:          (none)
2704    Sticky Date:         (none)
2705    Sticky Options:      (none)
2706
2707 ===================================================================
2708 File: no file file5             Status: Locally Removed
2709
2710    Working revision:    -1\.1.*
2711    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file5,v
2712    Sticky Tag:          (none)
2713    Sticky Date:         (none)
2714    Sticky Options:      (none)"
2715           # Would be nice to test that real logs appear (with dead state
2716           # and all), either here or someplace like log2 tests.
2717           if ${testcvs} -q log >>${LOGFILE}; then
2718             pass basic1-18-rm-rm
2719           else
2720             fail basic1-18-rm-rm
2721           fi
2722           cd ..
2723           dotest basic1-21-rm-rm "${testcvs} -q update" \
2724 "R first-dir/file2
2725 R first-dir/file3
2726 R first-dir/file4
2727 R first-dir/file5"
2728           if ${testcvs} -q log first-dir >>${LOGFILE}; then
2729             pass basic1-22-rm-rm
2730           else
2731             fail basic1-22-rm-rm
2732           fi
2733           if ${testcvs} -q status first-dir >>${LOGFILE}; then
2734             pass basic1-23-rm-rm
2735           else
2736             fail basic1-23-rm-rm
2737           fi
2738           dotest basic1-24-rm-rm "${testcvs} -q update first-dir" \
2739 "R first-dir/file2
2740 R first-dir/file3
2741 R first-dir/file4
2742 R first-dir/file5"
2743           dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
2744 "R first-dir/file2
2745 R first-dir/file3
2746 R first-dir/file4
2747 R first-dir/file5"
2748           cd first-dir
2749           dotest basic1-14-rm-ci "${testcvs} -q commit -m test" \
2750 "Removing file2;
2751 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2752 new revision: delete; previous revision: 1\.1
2753 done
2754 Removing file3;
2755 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
2756 new revision: delete; previous revision: 1\.1
2757 done
2758 Removing file4;
2759 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
2760 new revision: delete; previous revision: 1\.1
2761 done
2762 Removing file5;
2763 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
2764 new revision: delete; previous revision: 1\.1
2765 done"
2766           dotest basic1-15-rm-ci \
2767 "${testcvs} -q update file2 file3 file4 file5" ''
2768           dotest basic1-16-rm-ci "${testcvs} -q update" ''
2769           dotest basic1-17-rm-ci "${testcvs} -q status" ''
2770           # Would be nice to test that real logs appear (with dead state
2771           # and all), either here or someplace like log2 tests.
2772           if ${testcvs} -q log >>${LOGFILE}; then
2773             pass basic1-18-rm-ci
2774           else
2775             fail basic1-18-rm-ci
2776           fi
2777           cd ..
2778           dotest basic1-21-rm-ci "${testcvs} -q update" ''
2779           if ${testcvs} -q log first-dir >>${LOGFILE}; then
2780             pass basic1-22-rm-ci
2781           else
2782             fail basic1-22-rm-ci
2783           fi
2784           if ${testcvs} -q status first-dir >>${LOGFILE}; then
2785             pass basic1-23-rm-ci
2786           else
2787             fail basic1-23-rm-ci
2788           fi
2789           dotest basic1-24-rm-ci "${testcvs} -q update first-dir" ''
2790           dotest basic1-27-rm-ci "${testcvs} -q co first-dir" ''
2791           cd first-dir
2792           # All the files are removed, so nothing gets tagged.
2793           dotest basic1-28 "${testcvs} -q tag first-dive" ''
2794           cd ..
2795           cd ..
2796
2797           if $keep; then
2798             echo Keeping ${TESTDIR} and exiting due to --keep
2799             exit 0
2800           fi
2801
2802           rm -r basic1
2803           rm -rf ${CVSROOT_DIRNAME}/first-dir
2804           ;;
2805
2806         deep)
2807           # Test the ability to operate on directories nested rather deeply.
2808           mkdir ${CVSROOT_DIRNAME}/first-dir
2809           dotest deep-1 "${testcvs} -q co first-dir" ''
2810           cd first-dir
2811           for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
2812             mkdir $i
2813             dotest deep-2-$i "${testcvs} add $i" \
2814 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1[/dir0-9]* added to the repository"
2815             cd $i
2816             echo file1 >file1
2817             dotest deep-3-$i "${testcvs} add file1" \
2818 "${PROG}"' add: scheduling file `file1'\'' for addition
2819 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
2820           done
2821           cd ../../../../../../../../..
2822           dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
2823 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v
2824 done
2825 Checking in first-dir/dir1/file1;
2826 ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v  <--  file1
2827 initial revision: 1.1
2828 done
2829 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v
2830 done
2831 Checking in first-dir/dir1/dir2/file1;
2832 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v  <--  file1
2833 initial revision: 1.1
2834 done
2835 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v
2836 done
2837 Checking in first-dir/dir1/dir2/dir3/file1;
2838 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v  <--  file1
2839 initial revision: 1.1
2840 done
2841 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v
2842 done
2843 Checking in first-dir/dir1/dir2/dir3/dir4/file1;
2844 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
2845 initial revision: 1.1
2846 done
2847 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
2848 done
2849 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
2850 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
2851 initial revision: 1.1
2852 done
2853 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
2854 done
2855 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
2856 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
2857 initial revision: 1.1
2858 done
2859 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
2860 done
2861 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
2862 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
2863 initial revision: 1.1
2864 done
2865 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
2866 done
2867 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
2868 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
2869 initial revision: 1.1
2870 done
2871 HERE
2872
2873           cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
2874           rm file1
2875           dotest deep-4a0 "${testcvs} rm file1" \
2876 "${PROG} remove: scheduling .file1. for removal
2877 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
2878           dotest deep-4a1 "${testcvs} -q ci -m rm-it" "Removing file1;
2879 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
2880 new revision: delete; previous revision: 1\.1
2881 done"
2882           cd ../../..
2883           dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
2884           # Should be using "test -e" if that is portable enough.
2885           dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
2886
2887           # Test that if we remove the working directory, CVS does not
2888           # recreate it.  (I realize that this behavior is what the
2889           # users expect, but in the longer run we might want to
2890           # re-think it.  The corresponding behavior for a file is that
2891           # CVS *will* recreate it, and we might want to make it so
2892           # that "cvs release -d" is the way to delete the directory
2893           # and have it stay gone -kingdon, Oct1996).
2894           rm -r dir6
2895           dotest deep-4b0a "${testcvs} -q diff" ''
2896           dotest deep-4b0b "${testcvs} -q ci" ''
2897           dotest deep-4b1 "${testcvs} -q update" ''
2898           dotest deep-4b2 "${testcvs} -q update -d -P" \
2899 'U dir6/file1
2900 U dir6/dir7/file1'
2901
2902           # Test what happens if one uses -P when there are files removed
2903           # but not committed.
2904           cd dir6/dir7
2905           dotest deep-rm1 "${testcvs} rm -f file1" \
2906 "${PROG} remove: scheduling .file1. for removal
2907 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
2908           cd ..
2909           dotest deep-rm2 "${testcvs} -q update -d -P" 'R dir7/file1'
2910           dotest deep-rm3 "test -d dir7" ''
2911           dotest deep-rm4 "${testcvs} -q ci -m rm-it" "Removing dir7/file1;
2912 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
2913 new revision: delete; previous revision: 1\.1
2914 done"
2915           dotest deep-rm5 "${testcvs} -q update -d -P" ''
2916           dotest_fail deep-rm6 "test -d dir7" ''
2917
2918           # Test rm -f -R.
2919           cd ../..
2920           dotest deep-rm7 "${testcvs} rm -f -R dir5" \
2921 "${PROG} remove: Removing dir5
2922 ${PROG} remove: scheduling .dir5/file1. for removal
2923 ${PROG} remove: Removing dir5/dir6
2924 ${PROG} remove: scheduling .dir5/dir6/file1. for removal
2925 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
2926           dotest deep-rm8 "${testcvs} -q ci -m rm-it" \
2927 "Removing dir5/file1;
2928 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
2929 new revision: delete; previous revision: 1\.1
2930 done
2931 Removing dir5/dir6/file1;
2932 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
2933 new revision: delete; previous revision: 1\.1
2934 done"
2935           dotest deep-rm9 "${testcvs} -q update -d -P" ''
2936           dotest_fail deep-rm10 "test -d dir5"
2937
2938           cd ../../../../..
2939
2940           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
2941             pass deep-5
2942           else
2943             fail deep-5
2944           fi
2945           rm -rf ${CVSROOT_DIRNAME}/first-dir
2946           ;;
2947
2948         basic2)
2949                 # Test rtag, import, history, various miscellaneous operations
2950
2951                 # NOTE: this section has reached the size and
2952                 # complexity where it is getting to be a good idea to
2953                 # add new tests to a new section rather than
2954                 # continuing to piggyback them onto the tests here.
2955
2956                 # First empty the history file
2957                 rm ${CVSROOT_DIRNAME}/CVSROOT/history
2958                 touch ${CVSROOT_DIRNAME}/CVSROOT/history
2959
2960 ### XXX maybe should use 'cvs imprt -b1 -m new-module first-dir F F1' in an
2961 ### empty directory to do this instead of hacking directly into $CVSROOT
2962                 mkdir ${CVSROOT_DIRNAME}/first-dir
2963                 dotest basic2-1 "${testcvs} -q co first-dir" ''
2964                 for i in first-dir dir1 dir2 ; do
2965                         if test ! -d $i ; then
2966                                 mkdir $i
2967                                 dotest basic2-2-$i "${testcvs} add $i" \
2968 "Directory ${CVSROOT_DIRNAME}/.*/$i added to the repository"
2969                         fi
2970
2971                         cd $i
2972
2973                         for j in file6 file7; do
2974                                 echo $j > $j
2975                         done
2976
2977                         dotest basic2-3-$i "${testcvs} add file6 file7" \
2978 "${PROG} add: scheduling file .file6. for addition
2979 ${PROG} add: scheduling file .file7. for addition
2980 ${PROG} add: use .${PROG} commit. to add these files permanently"
2981
2982                 done
2983                 cd ../../..
2984                 dotest basic2-4 "${testcvs} update first-dir" \
2985 "${PROG} update: Updating first-dir
2986 A first-dir/file6
2987 A first-dir/file7
2988 ${PROG} update: Updating first-dir/dir1
2989 A first-dir/dir1/file6
2990 A first-dir/dir1/file7
2991 ${PROG} update: Updating first-dir/dir1/dir2
2992 A first-dir/dir1/dir2/file6
2993 A first-dir/dir1/dir2/file7"
2994
2995                 # fixme: doesn't work right for added files.
2996                 dotest basic2-5 "${testcvs} log first-dir" \
2997 "${PROG} log: Logging first-dir
2998 ${PROG} log: file6 has been added, but not committed
2999 ${PROG} log: file7 has been added, but not committed
3000 ${PROG} log: Logging first-dir/dir1
3001 ${PROG} log: file6 has been added, but not committed
3002 ${PROG} log: file7 has been added, but not committed
3003 ${PROG} log: Logging first-dir/dir1/dir2
3004 ${PROG} log: file6 has been added, but not committed
3005 ${PROG} log: file7 has been added, but not committed"
3006
3007                 dotest basic2-6 "${testcvs} status first-dir" \
3008 "${PROG} status: Examining first-dir
3009 ===================================================================
3010 File: file6             Status: Locally Added
3011
3012    Working revision:    New file!
3013    Repository revision: No revision control file
3014    Sticky Tag:          (none)
3015    Sticky Date:         (none)
3016    Sticky Options:      (none)
3017
3018 ===================================================================
3019 File: file7             Status: Locally Added
3020
3021    Working revision:    New file!
3022    Repository revision: No revision control file
3023    Sticky Tag:          (none)
3024    Sticky Date:         (none)
3025    Sticky Options:      (none)
3026
3027 ${PROG} status: Examining first-dir/dir1
3028 ===================================================================
3029 File: file6             Status: Locally Added
3030
3031    Working revision:    New file!
3032    Repository revision: No revision control file
3033    Sticky Tag:          (none)
3034    Sticky Date:         (none)
3035    Sticky Options:      (none)
3036
3037 ===================================================================
3038 File: file7             Status: Locally Added
3039
3040    Working revision:    New file!
3041    Repository revision: No revision control file
3042    Sticky Tag:          (none)
3043    Sticky Date:         (none)
3044    Sticky Options:      (none)
3045
3046 ${PROG} status: Examining first-dir/dir1/dir2
3047 ===================================================================
3048 File: file6             Status: Locally Added
3049
3050    Working revision:    New file!
3051    Repository revision: No revision control file
3052    Sticky Tag:          (none)
3053    Sticky Date:         (none)
3054    Sticky Options:      (none)
3055
3056 ===================================================================
3057 File: file7             Status: Locally Added
3058
3059    Working revision:    New file!
3060    Repository revision: No revision control file
3061    Sticky Tag:          (none)
3062    Sticky Date:         (none)
3063    Sticky Options:      (none)"
3064
3065 # XXX why is this commented out???
3066 #               if ${CVS} diff -u first-dir   >> ${LOGFILE} || test $? = 1 ; then
3067 #                   pass 34
3068 #               else
3069 #                   fail 34
3070 #               fi
3071
3072                 dotest basic2-8 "${testcvs} -q ci -m 'second dive' first-dir" \
3073 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
3074 done
3075 Checking in first-dir/file6;
3076 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3077 initial revision: 1\.1
3078 done
3079 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3080 done
3081 Checking in first-dir/file7;
3082 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3083 initial revision: 1\.1
3084 done
3085 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3086 done
3087 Checking in first-dir/dir1/file6;
3088 ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3089 initial revision: 1\.1
3090 done
3091 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3092 done
3093 Checking in first-dir/dir1/file7;
3094 ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3095 initial revision: 1\.1
3096 done
3097 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3098 done
3099 Checking in first-dir/dir1/dir2/file6;
3100 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3101 initial revision: 1\.1
3102 done
3103 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3104 done
3105 Checking in first-dir/dir1/dir2/file7;
3106 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3107 initial revision: 1\.1
3108 done"
3109
3110                 dotest basic2-9 "${testcvs} tag second-dive first-dir" \
3111 "${PROG} tag: Tagging first-dir
3112 T first-dir/file6
3113 T first-dir/file7
3114 ${PROG} tag: Tagging first-dir/dir1
3115 T first-dir/dir1/file6
3116 T first-dir/dir1/file7
3117 ${PROG} tag: Tagging first-dir/dir1/dir2
3118 T first-dir/dir1/dir2/file6
3119 T first-dir/dir1/dir2/file7"
3120
3121                 # third dive - in bunch o' directories, add bunch o' files,
3122                 # delete some, change some.
3123
3124                 for i in first-dir dir1 dir2 ; do
3125                         cd $i
3126
3127                         # modify a file
3128                         echo file6 >>file6
3129
3130                         # delete a file
3131                         rm file7
3132
3133                         dotest basic2-10-$i "${testcvs} rm file7" \
3134 "${PROG} remove: scheduling .file7. for removal
3135 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
3136
3137                         # and add a new file
3138                         echo file14 >file14
3139
3140                         dotest basic2-11-$i "${testcvs} add file14" \
3141 "${PROG} add: scheduling file .file14. for addition
3142 ${PROG} add: use .${PROG} commit. to add this file permanently"
3143                 done
3144
3145                 cd ../../..
3146                 dotest basic2-12 "${testcvs} update first-dir" \
3147 "${PROG} update: Updating first-dir
3148 A first-dir/file14
3149 M first-dir/file6
3150 R first-dir/file7
3151 ${PROG} update: Updating first-dir/dir1
3152 A first-dir/dir1/file14
3153 M first-dir/dir1/file6
3154 R first-dir/dir1/file7
3155 ${PROG} update: Updating first-dir/dir1/dir2
3156 A first-dir/dir1/dir2/file14
3157 M first-dir/dir1/dir2/file6
3158 R first-dir/dir1/dir2/file7"
3159
3160                 # FIXME: doesn't work right for added files
3161                 dotest basic2-13 "${testcvs} log first-dir" \
3162 "${PROG} log: Logging first-dir
3163 ${PROG} log: file14 has been added, but not committed
3164
3165 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
3166 Working file: first-dir/file6
3167 head: 1\.1
3168 branch:
3169 locks: strict
3170 access list:
3171 symbolic names:
3172         second-dive: 1\.1
3173 keyword substitution: kv
3174 total revisions: 1;     selected revisions: 1
3175 description:
3176 ----------------------------
3177 revision 1\.1
3178 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3179 second dive
3180 =============================================================================
3181
3182 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3183 Working file: first-dir/file7
3184 head: 1\.1
3185 branch:
3186 locks: strict
3187 access list:
3188 symbolic names:
3189         second-dive: 1\.1
3190 keyword substitution: kv
3191 total revisions: 1;     selected revisions: 1
3192 description:
3193 ----------------------------
3194 revision 1\.1
3195 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3196 second dive
3197 =============================================================================
3198 ${PROG} log: Logging first-dir/dir1
3199 ${PROG} log: file14 has been added, but not committed
3200
3201 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3202 Working file: first-dir/dir1/file6
3203 head: 1\.1
3204 branch:
3205 locks: strict
3206 access list:
3207 symbolic names:
3208         second-dive: 1\.1
3209 keyword substitution: kv
3210 total revisions: 1;     selected revisions: 1
3211 description:
3212 ----------------------------
3213 revision 1\.1
3214 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3215 second dive
3216 =============================================================================
3217
3218 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3219 Working file: first-dir/dir1/file7
3220 head: 1\.1
3221 branch:
3222 locks: strict
3223 access list:
3224 symbolic names:
3225         second-dive: 1\.1
3226 keyword substitution: kv
3227 total revisions: 1;     selected revisions: 1
3228 description:
3229 ----------------------------
3230 revision 1\.1
3231 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3232 second dive
3233 =============================================================================
3234 ${PROG} log: Logging first-dir/dir1/dir2
3235 ${PROG} log: file14 has been added, but not committed
3236
3237 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3238 Working file: first-dir/dir1/dir2/file6
3239 head: 1\.1
3240 branch:
3241 locks: strict
3242 access list:
3243 symbolic names:
3244         second-dive: 1\.1
3245 keyword substitution: kv
3246 total revisions: 1;     selected revisions: 1
3247 description:
3248 ----------------------------
3249 revision 1\.1
3250 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3251 second dive
3252 =============================================================================
3253
3254 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3255 Working file: first-dir/dir1/dir2/file7
3256 head: 1\.1
3257 branch:
3258 locks: strict
3259 access list:
3260 symbolic names:
3261         second-dive: 1\.1
3262 keyword substitution: kv
3263 total revisions: 1;     selected revisions: 1
3264 description:
3265 ----------------------------
3266 revision 1\.1
3267 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3268 second dive
3269 ============================================================================="
3270
3271                 dotest basic2-14 "${testcvs} status first-dir" \
3272 "${PROG} status: Examining first-dir
3273 ===================================================================
3274 File: file14            Status: Locally Added
3275
3276    Working revision:    New file!
3277    Repository revision: No revision control file
3278    Sticky Tag:          (none)
3279    Sticky Date:         (none)
3280    Sticky Options:      (none)
3281
3282 ===================================================================
3283 File: file6             Status: Locally Modified
3284
3285    Working revision:    1\.1.*
3286    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file6,v
3287    Sticky Tag:          (none)
3288    Sticky Date:         (none)
3289    Sticky Options:      (none)
3290
3291 ===================================================================
3292 File: no file file7             Status: Locally Removed
3293
3294    Working revision:    -1\.1.*
3295    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file7,v
3296    Sticky Tag:          (none)
3297    Sticky Date:         (none)
3298    Sticky Options:      (none)
3299
3300 ${PROG} status: Examining first-dir/dir1
3301 ===================================================================
3302 File: file14            Status: Locally Added
3303
3304    Working revision:    New file!
3305    Repository revision: No revision control file
3306    Sticky Tag:          (none)
3307    Sticky Date:         (none)
3308    Sticky Options:      (none)
3309
3310 ===================================================================
3311 File: file6             Status: Locally Modified
3312
3313    Working revision:    1\.1.*
3314    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3315    Sticky Tag:          (none)
3316    Sticky Date:         (none)
3317    Sticky Options:      (none)
3318
3319 ===================================================================
3320 File: no file file7             Status: Locally Removed
3321
3322    Working revision:    -1\.1.*
3323    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3324    Sticky Tag:          (none)
3325    Sticky Date:         (none)
3326    Sticky Options:      (none)
3327
3328 ${PROG} status: Examining first-dir/dir1/dir2
3329 ===================================================================
3330 File: file14            Status: Locally Added
3331
3332    Working revision:    New file!
3333    Repository revision: No revision control file
3334    Sticky Tag:          (none)
3335    Sticky Date:         (none)
3336    Sticky Options:      (none)
3337
3338 ===================================================================
3339 File: file6             Status: Locally Modified
3340
3341    Working revision:    1\.1.*
3342    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3343    Sticky Tag:          (none)
3344    Sticky Date:         (none)
3345    Sticky Options:      (none)
3346
3347 ===================================================================
3348 File: no file file7             Status: Locally Removed
3349
3350    Working revision:    -1\.1.*
3351    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3352    Sticky Tag:          (none)
3353    Sticky Date:         (none)
3354    Sticky Options:      (none)"
3355
3356 # XXX why is this commented out?
3357 #               if ${CVS} diff -u first-dir  >> ${LOGFILE} || test $? = 1 ; then
3358 #                   pass 42
3359 #               else
3360 #                   fail 42
3361 #               fi
3362
3363                 dotest basic2-16 "${testcvs} ci -m 'third dive' first-dir" \
3364 "${PROG} [a-z]*: Examining first-dir
3365 ${PROG} [a-z]*: Examining first-dir/dir1
3366 ${PROG} [a-z]*: Examining first-dir/dir1/dir2
3367 RCS file: ${CVSROOT_DIRNAME}/first-dir/file14,v
3368 done
3369 Checking in first-dir/file14;
3370 ${CVSROOT_DIRNAME}/first-dir/file14,v  <--  file14
3371 initial revision: 1\.1
3372 done
3373 Checking in first-dir/file6;
3374 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3375 new revision: 1\.2; previous revision: 1\.1
3376 done
3377 Removing first-dir/file7;
3378 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3379 new revision: delete; previous revision: 1\.1
3380 done
3381 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v
3382 done
3383 Checking in first-dir/dir1/file14;
3384 ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v  <--  file14
3385 initial revision: 1\.1
3386 done
3387 Checking in first-dir/dir1/file6;
3388 ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3389 new revision: 1\.2; previous revision: 1\.1
3390 done
3391 Removing first-dir/dir1/file7;
3392 ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3393 new revision: delete; previous revision: 1\.1
3394 done
3395 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v
3396 done
3397 Checking in first-dir/dir1/dir2/file14;
3398 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v  <--  file14
3399 initial revision: 1\.1
3400 done
3401 Checking in first-dir/dir1/dir2/file6;
3402 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3403 new revision: 1\.2; previous revision: 1\.1
3404 done
3405 Removing first-dir/dir1/dir2/file7;
3406 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3407 new revision: delete; previous revision: 1\.1
3408 done"
3409                 dotest basic2-17 "${testcvs} -q update first-dir" ''
3410
3411                 dotest basic2-18 "${testcvs} tag third-dive first-dir" \
3412 "${PROG} tag: Tagging first-dir
3413 T first-dir/file14
3414 T first-dir/file6
3415 ${PROG} tag: Tagging first-dir/dir1
3416 T first-dir/dir1/file14
3417 T first-dir/dir1/file6
3418 ${PROG} tag: Tagging first-dir/dir1/dir2
3419 T first-dir/dir1/dir2/file14
3420 T first-dir/dir1/dir2/file6"
3421
3422                 dotest basic2-19 "echo yes | ${testcvs} release -d first-dir" \
3423 "You have \[0\] altered files in this repository\.
3424 Are you sure you want to release (and delete) directory .first-dir.: "
3425
3426                 # end of third dive
3427                 dotest_fail basic2-20 "test -d first-dir" ""
3428
3429                 # now try some rtags
3430
3431                 # rtag HEADS
3432                 dotest basic2-21 "${testcvs} rtag rtagged-by-head first-dir" \
3433 "${PROG} rtag: Tagging first-dir
3434 ${PROG} rtag: Tagging first-dir/dir1
3435 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3436
3437                 # tag by tag
3438                 dotest basic2-22 "${testcvs} rtag -r rtagged-by-head rtagged-by-tag first-dir" \
3439 "${PROG} rtag: Tagging first-dir
3440 ${PROG} rtag: Tagging first-dir/dir1
3441 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3442
3443                 # tag by revision
3444                 dotest basic2-23 "${testcvs} rtag -r1.1 rtagged-by-revision first-dir" \
3445 "${PROG} rtag: Tagging first-dir
3446 ${PROG} rtag: Tagging first-dir/dir1
3447 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3448
3449                 # rdiff by revision
3450                 dotest basic2-24 "${testcvs} rdiff -r1.1 -rrtagged-by-head first-dir" \
3451 "${PROG} rdiff: Diffing first-dir
3452 Index: first-dir/file6
3453 diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
3454 \*\*\* first-dir/file6:1\.1     ${DATE}
3455 --- first-dir/file6     ${DATE}
3456 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3457 \*\*\* 1 \*\*\*\*
3458 --- 1,2 ----
3459   file6
3460 ${PLUS} file6
3461 Index: first-dir/file7
3462 diff -c first-dir/file7:1\.1 first-dir/file7:removed
3463 \*\*\* first-dir/file7:1.1      ${DATE}
3464 --- first-dir/file7     ${DATE}
3465 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3466 \*\*\* 1 \*\*\*\*
3467 - file7
3468 --- 0 ----
3469 ${PROG} rdiff: Diffing first-dir/dir1
3470 Index: first-dir/dir1/file6
3471 diff -c first-dir/dir1/file6:1\.1 first-dir/dir1/file6:1\.2
3472 \*\*\* first-dir/dir1/file6:1\.1        ${DATE}
3473 --- first-dir/dir1/file6        ${DATE}
3474 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3475 \*\*\* 1 \*\*\*\*
3476 --- 1,2 ----
3477   file6
3478 ${PLUS} file6
3479 Index: first-dir/dir1/file7
3480 diff -c first-dir/dir1/file7:1\.1 first-dir/dir1/file7:removed
3481 \*\*\* first-dir/dir1/file7:1\.1        ${DATE}
3482 --- first-dir/dir1/file7        ${DATE}
3483 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3484 \*\*\* 1 \*\*\*\*
3485 - file7
3486 --- 0 ----
3487 ${PROG} rdiff: Diffing first-dir/dir1/dir2
3488 Index: first-dir/dir1/dir2/file6
3489 diff -c first-dir/dir1/dir2/file6:1\.1 first-dir/dir1/dir2/file6:1\.2
3490 \*\*\* first-dir/dir1/dir2/file6:1\.1   ${DATE}
3491 --- first-dir/dir1/dir2/file6   ${DATE}
3492 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3493 \*\*\* 1 \*\*\*\*
3494 --- 1,2 ----
3495   file6
3496 ${PLUS} file6
3497 Index: first-dir/dir1/dir2/file7
3498 diff -c first-dir/dir1/dir2/file7:1\.1 first-dir/dir1/dir2/file7:removed
3499 \*\*\* first-dir/dir1/dir2/file7:1\.1   ${DATE}
3500 --- first-dir/dir1/dir2/file7   ${DATE}
3501 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3502 \*\*\* 1 \*\*\*\*
3503 - file7
3504 --- 0 ----"
3505                 dotest basic2-24a "${testcvs} rdiff -l -r1.1 -rrtagged-by-head first-dir" \
3506 "${PROG} rdiff: Diffing first-dir
3507 Index: first-dir/file6
3508 diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
3509 \*\*\* first-dir/file6:1\.1     ${DATE}
3510 --- first-dir/file6     ${DATE}
3511 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3512 \*\*\* 1 \*\*\*\*
3513 --- 1,2 ----
3514   file6
3515 ${PLUS} file6
3516 Index: first-dir/file7
3517 diff -c first-dir/file7:1\.1 first-dir/file7:removed
3518 \*\*\* first-dir/file7:1.1      ${DATE}
3519 --- first-dir/file7     ${DATE}
3520 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3521 \*\*\* 1 \*\*\*\*
3522 - file7
3523 --- 0 ----"
3524                 # now export by rtagged-by-head and rtagged-by-tag and compare.
3525                 dotest basic2-25 "${testcvs} export -r rtagged-by-head -d 1dir first-dir" \
3526 "${PROG} export: Updating 1dir
3527 U 1dir/file14
3528 U 1dir/file6
3529 ${PROG} export: Updating 1dir/dir1
3530 U 1dir/dir1/file14
3531 U 1dir/dir1/file6
3532 ${PROG} export: Updating 1dir/dir1/dir2
3533 U 1dir/dir1/dir2/file14
3534 U 1dir/dir1/dir2/file6"
3535                 dotest_fail basic2-25a "test -d 1dir/CVS"
3536                 dotest_fail basic2-25b "test -d 1dir/dir1/CVS"
3537                 dotest_fail basic2-25c "test -d 1dir/dir1/dir2/CVS"
3538
3539                 dotest basic2-26 "${testcvs} export -r rtagged-by-tag first-dir" \
3540 "${PROG} export: Updating first-dir
3541 U first-dir/file14
3542 U first-dir/file6
3543 ${PROG} export: Updating first-dir/dir1
3544 U first-dir/dir1/file14
3545 U first-dir/dir1/file6
3546 ${PROG} export: Updating first-dir/dir1/dir2
3547 U first-dir/dir1/dir2/file14
3548 U first-dir/dir1/dir2/file6"
3549                 dotest_fail basic2-26a "test -d first-dir/CVS"
3550                 dotest_fail basic2-26b "test -d first-dir/dir1/CVS"
3551                 dotest_fail basic2-26c "test -d first-dir/dir1/dir2/CVS"
3552
3553                 dotest basic2-27 "directory_cmp 1dir first-dir"
3554                 rm -r 1dir first-dir
3555
3556                 # checkout by revision vs export by rtagged-by-revision and compare.
3557                 mkdir export-dir
3558                 dotest basic2-28 "${testcvs} export -rrtagged-by-revision -d export-dir first-dir" \
3559 "${PROG} export: Updating export-dir
3560 U export-dir/file14
3561 U export-dir/file6
3562 U export-dir/file7
3563 ${PROG} export: Updating export-dir/dir1
3564 U export-dir/dir1/file14
3565 U export-dir/dir1/file6
3566 U export-dir/dir1/file7
3567 ${PROG} export: Updating export-dir/dir1/dir2
3568 U export-dir/dir1/dir2/file14
3569 U export-dir/dir1/dir2/file6
3570 U export-dir/dir1/dir2/file7"
3571                 dotest_fail basic2-28a "test -d export-dir/CVS"
3572                 dotest_fail basic2-28b "test -d export-dir/dir1/CVS"
3573                 dotest_fail basic2-28c "test -d export-dir/dir1/dir2/CVS"
3574
3575                 dotest basic2-29 "${testcvs} co -r1.1 first-dir" \
3576 "${PROG} checkout: Updating first-dir
3577 U first-dir/file14
3578 U first-dir/file6
3579 U first-dir/file7
3580 ${PROG} checkout: Updating first-dir/dir1
3581 U first-dir/dir1/file14
3582 U first-dir/dir1/file6
3583 U first-dir/dir1/file7
3584 ${PROG} checkout: Updating first-dir/dir1/dir2
3585 U first-dir/dir1/dir2/file14
3586 U first-dir/dir1/dir2/file6
3587 U first-dir/dir1/dir2/file7"
3588
3589                 # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
3590                 mkdir first-dir.cpy ; (cd first-dir ; tar cf - . | (cd ../first-dir.cpy ; tar xf -))
3591
3592                 dotest basic2-30 "directory_cmp first-dir export-dir"
3593
3594                 # interrupt, while we've got a clean 1.1 here, let's import it
3595                 # into a couple of other modules.
3596                 cd export-dir
3597                 dotest_sort basic2-31 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
3598 "
3599
3600 N second-dir/dir1/dir2/file14
3601 N second-dir/dir1/dir2/file6
3602 N second-dir/dir1/dir2/file7
3603 N second-dir/dir1/file14
3604 N second-dir/dir1/file6
3605 N second-dir/dir1/file7
3606 N second-dir/file14
3607 N second-dir/file6
3608 N second-dir/file7
3609 No conflicts created by this import
3610 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1
3611 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1/dir2"
3612                 cd ..
3613
3614                 dotest basic2-32 "${testcvs} export -r HEAD second-dir" \
3615 "${PROG} export: Updating second-dir
3616 U second-dir/file14
3617 U second-dir/file6
3618 U second-dir/file7
3619 ${PROG} export: Updating second-dir/dir1
3620 U second-dir/dir1/file14
3621 U second-dir/dir1/file6
3622 U second-dir/dir1/file7
3623 ${PROG} export: Updating second-dir/dir1/dir2
3624 U second-dir/dir1/dir2/file14
3625 U second-dir/dir1/dir2/file6
3626 U second-dir/dir1/dir2/file7"
3627
3628                 dotest basic2-33 "directory_cmp first-dir second-dir"
3629
3630                 rm -r second-dir
3631
3632                 rm -r export-dir first-dir
3633                 mkdir first-dir
3634                 (cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
3635
3636                 # update the top, cancelling sticky tags, retag, update other copy, compare.
3637                 cd first-dir
3638                 dotest basic2-34 "${testcvs} update -A -l *file*" \
3639 "[UP] file6
3640 ${PROG} update: file7 is no longer in the repository"
3641
3642                 # If we don't delete the tag first, cvs won't retag it.
3643                 # This would appear to be a feature.
3644                 dotest basic2-35 "${testcvs} tag -l -d rtagged-by-revision" \
3645 "${PROG} tag: Untagging \.
3646 D file14
3647 D file6"
3648                 dotest basic2-36 "${testcvs} tag -l rtagged-by-revision" \
3649 "${PROG} tag: Tagging \.
3650 T file14
3651 T file6"
3652
3653                 cd ..
3654                 mv first-dir 1dir
3655                 mv first-dir.cpy first-dir
3656                 cd first-dir
3657
3658                 dotest basic2-37 "${testcvs} -q diff -u" ''
3659
3660                 dotest basic2-38 "${testcvs} update" \
3661 "${PROG} update: Updating .
3662 ${PROG} update: Updating dir1
3663 ${PROG} update: Updating dir1/dir2"
3664
3665                 cd ..
3666
3667                 #### FIXME: is this expected to work???  Need to investigate
3668                 #### and fix or remove the test.
3669 #               dotest basic2-39 "directory_cmp 1dir first-dir"
3670
3671                 rm -r 1dir first-dir
3672
3673                 # Test the cvs history command.
3674
3675                 # The reason that there are two patterns rather than using
3676                 # \(${TESTDIR}\|<remote>\) is that we are trying to
3677                 # make this portable.  Perhaps at some point we should
3678                 # ditch that notion and require GNU expr (or dejagnu or....)
3679                 # since it seems to be so painful.
3680
3681                 # why are there two lines at the end of the local output
3682                 # which don't exist in the remote output?  would seem to be
3683                 # a CVS bug.
3684                 dotest basic2-64 "${testcvs} his -x TOFWUPCGMAR -a" \
3685 "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= ${TESTDIR}/\*
3686 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == ${TESTDIR}
3687 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == ${TESTDIR}
3688 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == ${TESTDIR}
3689 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == ${TESTDIR}
3690 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == ${TESTDIR}
3691 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == ${TESTDIR}
3692 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == ${TESTDIR}
3693 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}
3694 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == ${TESTDIR}
3695 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == ${TESTDIR}
3696 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == ${TESTDIR}
3697 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == ${TESTDIR}
3698 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == ${TESTDIR}
3699 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == ${TESTDIR}
3700 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == ${TESTDIR}
3701 F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= ${TESTDIR}/\*
3702 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
3703 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
3704 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
3705 O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= ${TESTDIR}/\*
3706 U [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}/first-dir
3707 W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == ${TESTDIR}/first-dir" \
3708 "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= <remote>/\*
3709 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == <remote>
3710 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == <remote>
3711 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == <remote>
3712 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == <remote>
3713 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == <remote>
3714 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == <remote>
3715 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == <remote>
3716 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
3717 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == <remote>
3718 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == <remote>
3719 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == <remote>
3720 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == <remote>
3721 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == <remote>
3722 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == <remote>
3723 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == <remote>
3724 F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= <remote>/\*
3725 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
3726 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
3727 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
3728 O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= <remote>/\*
3729 P [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
3730 W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == <remote>"
3731
3732                 rm -rf ${CVSROOT_DIRNAME}/first-dir
3733                 rm -rf ${CVSROOT_DIRNAME}/second-dir
3734                 ;;
3735
3736         parseroot)
3737           mkdir 1; cd 1
3738           # Test odd cases involving CVSROOT.  At the moment, that means we
3739           # are testing roots with '/'s on the end, which CVS should parse off.
3740           CVSROOT_save=${CVSROOT}
3741           CVSROOT="${CVSROOT}/////"
3742           dotest parseroot-1 "${testcvs} -q co CVSROOT/modules" \
3743 "U CVSROOT/modules"
3744           dotest parseroot-2 "${testcvs} -q ci -fmnull-change CVSROOT/modules" \
3745 "Checking in CVSROOT/modules;
3746 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
3747 new revision: 1\.2; previous revision: 1\.1
3748 done
3749 ${PROG} commit: Rebuilding administrative file database"
3750
3751           if $remote; then
3752             # I only test these when testing remote in case CVS was compiled
3753             # without client support.
3754
3755             # logout does not try to contact the server.
3756             CVSROOT=":pserver;proxy=localhost;proxyport=8080:localhost/dev/null"
3757             dotest parseroot-3r "$testcvs -d'$CVSROOT' logout" \
3758 "$PROG logout: WARNING: Ignoring method options found in CVSROOT: \`proxy=localhost;proxyport=8080'\.
3759 $PROG logout: Use CVS version 1\.12\.7 or later to handle method options\.
3760 Logging out of :pserver:$username@localhost:2401/dev/null
3761 $PROG logout: warning: failed to open $HOME/\.cvspass for reading: No such file or directory
3762 $PROG logout: Entry not found\."
3763           fi
3764
3765           if $keep; then
3766                 echo Keeping $TESTDIR and exiting due to --keep
3767                 exit 0
3768           fi
3769
3770           CVSROOT=$CVSROOT_save
3771           cd ..
3772           rm -r 1
3773           ;;
3774
3775         files)
3776           # Test of how we specify files on the command line
3777           # (recurse.c and that sort of thing).  Vaguely similar to
3778           # tests like basic* and deep.  See modules and such tests
3779           # for what happens when we throw in modules and co -d, &c.
3780
3781           # This particular test is fairly carefully crafted, to spot
3782           # one particular issue with remote.
3783           mkdir 1; cd 1
3784           dotest files-1 "${testcvs} -q co -l ." ""
3785           mkdir first-dir
3786           dotest files-2 "${testcvs} add first-dir" \
3787 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
3788           cd first-dir
3789           touch tfile
3790           dotest files-3 "${testcvs} add tfile" \
3791 "${PROG} add: scheduling file .tfile. for addition
3792 ${PROG} add: use .${PROG} commit. to add this file permanently"
3793           dotest files-4 "${testcvs} -q ci -m add" \
3794 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
3795 done
3796 Checking in tfile;
3797 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
3798 initial revision: 1\.1
3799 done"
3800           dotest files-5 "${testcvs} -q tag -b C" "T tfile"
3801           dotest files-6 "${testcvs} -q update -r C" ""
3802           mkdir dir
3803           dotest files-7 "${testcvs} add dir" \
3804 "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository
3805 --> Using per-directory sticky tag .C'"
3806           cd dir
3807           touch .file
3808           dotest files-6 "${testcvs} add .file" \
3809 "${PROG} add: scheduling file .\.file' for addition on branch .C.
3810 ${PROG} add: use .${PROG} commit. to add this file permanently"
3811           mkdir sdir
3812           dotest files-7 "${testcvs} add sdir" \
3813 "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir added to the repository
3814 --> Using per-directory sticky tag .C'"
3815           cd sdir
3816           mkdir ssdir
3817           dotest files-8 "${testcvs} add ssdir" \
3818 "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir added to the repository
3819 --> Using per-directory sticky tag .C'"
3820           cd ssdir
3821           touch .file
3822           dotest files-9 "${testcvs} add .file" \
3823 "${PROG} add: scheduling file .\.file' for addition on branch .C.
3824 ${PROG} add: use .${PROG} commit. to add this file permanently"
3825           cd ../..
3826           dotest files-10 "${testcvs} -q ci -m test" \
3827 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v
3828 done
3829 Checking in \.file;
3830 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3831 new revision: 1\.1\.2\.1; previous revision: 1\.1
3832 done
3833 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v
3834 done
3835 Checking in sdir/ssdir/\.file;
3836 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3837 new revision: 1\.1\.2\.1; previous revision: 1\.1
3838 done"
3839           dotest files-11 \
3840 "${testcvs} commit -m test -f ./.file ./sdir/ssdir/.file" \
3841 "Checking in \.file;
3842 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3843 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
3844 done
3845 Checking in \./sdir/ssdir/\.file;
3846 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3847 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
3848 done"
3849           if $remote; then
3850             # This is a bug, looks like that toplevel_repos cruft in
3851             # client.c is coming back to haunt us.
3852             # May want to think about the whole issue, toplevel_repos
3853             # has always been crufty and trying to patch it up again
3854             # might be a mistake.
3855             dotest_fail files-12 \
3856 "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
3857 "${PROG} commit: Up-to-date check failed for .\.file'
3858 ${PROG} \[commit aborted\]: correct above errors first!"
3859
3860             # Sync up the version numbers so that the rest of the
3861             # tests don't need to expect different numbers based
3862             # local or remote.
3863             dotest files-12-workaround \
3864 "${testcvs} commit -f -m test sdir/ssdir/.file .file" \
3865 "Checking in sdir/ssdir/\.file;
3866 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3867 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3868 done
3869 Checking in \.file;
3870 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3871 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3872 done"
3873           else
3874             dotest files-12 \
3875 "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
3876 "Checking in \./sdir/ssdir/\.file;
3877 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3878 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3879 done
3880 Checking in \.file;
3881 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3882 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3883 done"
3884           fi
3885           dotest files-13 \
3886 "${testcvs} commit -fmtest ./sdir/../sdir/ssdir/..///ssdir/.file" \
3887 "Checking in \./sdir/\.\./sdir/ssdir/\.\.///ssdir/\.file;
3888 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3889 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
3890 done"
3891           if $remote; then
3892             dotest files-14 \
3893 "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
3894 "Checking in \.\./\.\./first-dir/dir/\.file;
3895 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  .file
3896 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
3897 done"
3898           else
3899             dotest files-14 \
3900 "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
3901 "Checking in \.\./\.\./first-dir/dir/\.file;
3902 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3903 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
3904 done"
3905           fi
3906           cd ../../..
3907
3908           rm -r 1
3909           rm -rf ${CVSROOT_DIRNAME}/first-dir
3910           ;;
3911
3912         spacefiles)
3913           # More filename tests, in particular spaces in file names.
3914           # (it might be better to just change a few of the names in
3915           # basica or some other test instead, always good to keep the
3916           # testsuite concise).
3917
3918           mkdir 1; cd 1
3919           dotest spacefiles-1 "${testcvs} -q co -l ." ""
3920           touch ./-c
3921           dotest spacefiles-2 "${testcvs} add -- -c" \
3922 "${PROG} add: scheduling file .-c. for addition
3923 ${PROG} add: use .${PROG} commit. to add this file permanently"
3924           dotest spacefiles-3 "${testcvs} -q ci -m add" \
3925 "RCS file: ${CVSROOT_DIRNAME}/-c,v
3926 done
3927 Checking in -c;
3928 ${CVSROOT_DIRNAME}/-c,v  <--  -c
3929 initial revision: 1\.1
3930 done"
3931           mkdir 'first dir'
3932           dotest spacefiles-4 "${testcvs} add 'first dir'" \
3933 "Directory ${CVSROOT_DIRNAME}/first dir added to the repository"
3934           mkdir ./-b
3935           dotest spacefiles-5 "${testcvs} add -- -b" \
3936 "Directory ${CVSROOT_DIRNAME}/-b added to the repository"
3937           cd 'first dir'
3938           touch 'a file'
3939           dotest spacefiles-6 "${testcvs} add 'a file'" \
3940 "${PROG} add: scheduling file .a file. for addition
3941 ${PROG} add: use .${PROG} commit. to add this file permanently"
3942           dotest spacefiles-7 "${testcvs} -q ci -m add" \
3943 "RCS file: ${CVSROOT_DIRNAME}/first dir/a file,v
3944 done
3945 Checking in a file;
3946 ${CVSROOT_DIRNAME}/first dir/a file,v  <--  a file
3947 initial revision: 1\.1
3948 done"
3949           dotest spacefiles-8 "${testcvs} -q tag new-tag" "T a file"
3950           cd ../..
3951
3952           mkdir 2; cd 2
3953           dotest spacefiles-10 "${testcvs} co -- -b" \
3954 "${PROG} checkout: Updating -b"
3955           dotest spacefiles-11 "${testcvs} -q co -- -c" "U \./-c"
3956           rm ./-c
3957           dotest spacefiles-13 "${testcvs} -q co 'first dir'" \
3958 "U first dir/a file"
3959           cd ..
3960
3961           mkdir 3; cd 3
3962           dotest spacefiles-14 "${testcvs} -q co 'first dir/a file'" \
3963 "U first dir/a file"
3964           cd ..
3965
3966           rm -r 1 2 3
3967           rm -rf "${CVSROOT_DIRNAME}/first dir"
3968           rm -r ${CVSROOT_DIRNAME}/-b
3969           rm -f ${CVSROOT_DIRNAME}/-c,v
3970           ;;
3971
3972         commit-readonly)
3973           mkdir 1; cd 1
3974           module=x
3975
3976           : > junk
3977           dotest commit-readonly-1 "$testcvs -Q import -m . $module X Y" ''
3978           dotest commit-readonly-2 "$testcvs -Q co $module" ''
3979           cd $module
3980
3981           file=m
3982
3983           # Include an rcs keyword to be expanded.
3984           echo '$Id''$' > $file
3985
3986           dotest commit-readonly-3 "$testcvs add $file" \
3987 "${PROG} add: scheduling file .$file. for addition
3988 ${PROG} add: use .${PROG} commit. to add this file permanently"
3989           dotest commit-readonly-4 "$testcvs -Q ci -m . $file" \
3990 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
3991 done
3992 Checking in $file;
3993 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
3994 initial revision: 1\.1
3995 done"
3996
3997           echo line2 >> $file
3998           # Make the file read-only.
3999           chmod a-w $file
4000
4001           dotest commit-readonly-5 "$testcvs -Q ci -m . $file" \
4002 "Checking in $file;
4003 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
4004 new revision: 1\.2; previous revision: 1\.1
4005 done"
4006
4007           cd ../..
4008           rm -rf 1
4009           rm -rf ${CVSROOT_DIRNAME}/$module
4010           ;;
4011
4012         status)
4013                 # This tests for a bug in the status command which failed to
4014                 # notice resolved conflicts.
4015                 mkdir status; cd status
4016                 dotest status-init-1 "${testcvs} -q co -l ." ""
4017                 mkdir first-dir
4018                 dotest status-init-2 "${testcvs} add first-dir" \
4019 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4020                 cd first-dir
4021                 echo a line >tfile
4022                 dotest status-init-3 "${testcvs} add tfile" \
4023 "${PROG} add: scheduling file .tfile. for addition
4024 ${PROG} add: use .${PROG} commit. to add this file permanently"
4025                 dotest status-init-4 "${testcvs} -q ci -m add" \
4026 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
4027 done
4028 Checking in tfile;
4029 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4030 initial revision: 1\.1
4031 done"
4032                 cd ..
4033                 dotest status-init-5 "${testcvs} -q co -dsecond-dir first-dir" \
4034 "U second-dir/tfile"
4035                 cd second-dir
4036                 echo some junk >>tfile
4037                 dotest status-init-6 "${testcvs} -q ci -maline" \
4038 "Checking in tfile;
4039 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4040 new revision: 1\.2; previous revision: 1\.1
4041 done"
4042                 cd ../first-dir
4043                 echo force a conflict >>tfile
4044                 dotest status-init-7 "${testcvs} -q up" \
4045 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
4046 retrieving revision 1\.1
4047 retrieving revision 1\.2
4048 Merging differences between 1\.1 and 1\.2 into tfile
4049 rcsmerge: warning: conflicts during merge
4050 ${PROG} update: conflicts found in tfile
4051 C tfile"
4052
4053                 # Now note our status
4054                 dotest status-1 "${testcvs} status tfile" \
4055 "===================================================================
4056 File: tfile             Status: File had conflicts on merge
4057
4058    Working revision:    1\.2.*
4059    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4060    Sticky Tag:          (none)
4061    Sticky Date:         (none)
4062    Sticky Options:      (none)"
4063
4064                 # touch the file, leaving conflict markers in place
4065                 # and note our status
4066                 touch tfile
4067                 dotest status-2 "${testcvs} status tfile" \
4068 "===================================================================
4069 File: tfile             Status: File had conflicts on merge
4070
4071    Working revision:    1\.2.*
4072    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4073    Sticky Tag:          (none)
4074    Sticky Date:         (none)
4075    Sticky Options:      (none)"
4076
4077                 # resolve the conflict
4078                 echo resolution >tfile
4079                 dotest status-3 "${testcvs} status tfile" \
4080 "===================================================================
4081 File: tfile             Status: Locally Modified
4082
4083    Working revision:    1\.2.*
4084    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4085    Sticky Tag:          (none)
4086    Sticky Date:         (none)
4087    Sticky Options:      (none)"
4088
4089                 # FIXCVS:
4090                 # Update is supposed to re-Register() the file when it
4091                 # finds resolved conflicts:
4092                 dotest status-4 "grep 'Result of merge' CVS/Entries" \
4093 "/tfile/1\.2/Result of merge${PLUS}[a-zA-Z0-9 :]*//"
4094
4095                 cd ..
4096                 mkdir fourth-dir
4097                 dotest status-init-8 "$testcvs add fourth-dir" \
4098 "Directory $CVSROOT_DIRNAME/fourth-dir added to the repository"
4099                 cd fourth-dir
4100                 echo yet another line >t3file
4101                 dotest status-init-9 "$testcvs add t3file" \
4102 "$PROG add: scheduling file .t3file. for addition
4103 $PROG add: use .$PROG commit. to add this file permanently"
4104                 dotest status-init-10 "$testcvs -q ci -m add" \
4105 "RCS file: $CVSROOT_DIRNAME/fourth-dir/t3file,v
4106 done
4107 Checking in t3file;
4108 $CVSROOT_DIRNAME/fourth-dir/t3file,v  <--  t3file
4109 initial revision: 1\.1
4110 done"
4111                 cd ../first-dir
4112                 mkdir third-dir
4113                 dotest status-init-11 "$testcvs add third-dir" \
4114 "Directory $CVSROOT_DIRNAME/first-dir/third-dir added to the repository"
4115                 cd third-dir
4116                 echo another line >t2file
4117                 dotest status-init-12 "$testcvs add t2file" \
4118 "$PROG add: scheduling file .t2file. for addition
4119 $PROG add: use .$PROG commit. to add this file permanently"
4120                 dotest status-init-13 "$testcvs -q ci -m add" \
4121 "RCS file: $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v
4122 done
4123 Checking in t2file;
4124 $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v  <--  t2file
4125 initial revision: 1\.1
4126 done"
4127                 dotest status-5 "$testcvs status ../tfile" \
4128 "===================================================================
4129 File: tfile             Status: Locally Modified
4130
4131    Working revision:    1\.2.*
4132    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/tfile,v
4133    Sticky Tag:          (none)
4134    Sticky Date:         (none)
4135    Sticky Options:      (none)"
4136                 dotest status-6 "$testcvs status ../../fourth-dir/t3file" \
4137 "===================================================================
4138 File: t3file            Status: Up-to-date
4139
4140    Working revision:    1\.1.*
4141    Repository revision: 1\.1    $CVSROOT_DIRNAME/fourth-dir/t3file,v
4142    Sticky Tag:          (none)
4143    Sticky Date:         (none)
4144    Sticky Options:      (none)"
4145
4146                 if $keep; then
4147                         echo Keeping $TESTDIR and exiting due to --keep
4148                         exit 0
4149                 fi
4150
4151                 cd ../../..
4152                 rm -rf status
4153                 rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/fourth-dir
4154                 ;;
4155
4156         rdiff)
4157                 # Test rdiff
4158                 # XXX for now this is just the most essential test...
4159                 cd ${TESTDIR}
4160
4161                 mkdir testimport
4162                 cd testimport
4163                 echo '$''Id$' > foo
4164                 echo '$''Name$' >> foo
4165                 echo '$''Id$' > bar
4166                 echo '$''Name$' >> bar
4167                 dotest_sort rdiff-1 \
4168                   "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
4169 '
4170
4171 N trdiff/bar
4172 N trdiff/foo
4173 No conflicts created by this import'
4174                 dotest rdiff-2 \
4175                   "${testcvs} co -ko trdiff" \
4176 "${PROG} checkout: Updating trdiff
4177 U trdiff/bar
4178 U trdiff/foo"
4179                 cd trdiff
4180                 echo something >> foo
4181                 dotest rdiff-3 \
4182                   "${testcvs} ci -m added-something foo" \
4183 "Checking in foo;
4184 ${CVSROOT_DIRNAME}/trdiff/foo,v  <--  foo
4185 new revision: 1\.2; previous revision: 1\.1
4186 done"
4187                 echo '#ident    "@(#)trdiff:$''Name$:$''Id$"' > new
4188                 echo "new file" >> new
4189                 dotest rdiff-4 \
4190                   "${testcvs} add -m new-file-description new" \
4191 "${PROG} add: scheduling file \`new' for addition
4192 ${PROG} add: use .${PROG} commit. to add this file permanently"
4193                 dotest rdiff-5 \
4194                   "${testcvs} commit -m added-new-file new" \
4195 "RCS file: ${CVSROOT_DIRNAME}/trdiff/new,v
4196 done
4197 Checking in new;
4198 ${CVSROOT_DIRNAME}/trdiff/new,v  <--  new
4199 initial revision: 1\.1
4200 done"
4201                 dotest rdiff-6 \
4202                   "${testcvs} tag local-v0" \
4203 "${PROG} tag: Tagging .
4204 T bar
4205 T foo
4206 T new"
4207                 dotest rdiff-7 \
4208                   "${testcvs} status -v foo" \
4209 "===================================================================
4210 File: foo               Status: Up-to-date
4211
4212    Working revision:    1\.2.*
4213    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/trdiff/foo,v
4214    Sticky Tag:          (none)
4215    Sticky Date:         (none)
4216    Sticky Options:      -ko
4217
4218    Existing Tags:
4219         local-v0                        (revision: 1\.2)
4220         T1                              (revision: 1\.1\.1\.1)
4221         TRDIFF                          (branch: 1\.1\.1)"
4222
4223                 cd ..
4224                 rm -r trdiff
4225
4226                 dotest rdiff-8 \
4227                   "${testcvs} rdiff -r T1 -r local-v0 trdiff" \
4228 "${PROG}"' rdiff: Diffing trdiff
4229 Index: trdiff/foo
4230 diff -c trdiff/foo:1\.1\.1\.1 trdiff/foo:1\.2
4231 \*\*\* trdiff/foo:1\.1\.1\.1    '"${DATE}"'
4232 --- trdiff/foo  '"${DATE}"'
4233 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4234 \*\*\* 1,2 \*\*\*\*
4235 ! \$''Id: foo,v 1\.1\.1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$
4236 ! \$''Name: T1 \$
4237 --- 1,3 ----
4238 ! \$''Id: foo,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
4239 ! \$''Name: local-v0 \$
4240 ! something
4241 Index: trdiff/new
4242 diff -c /dev/null trdiff/new:1\.1
4243 \*\*\* /dev/null        '"${DATE}"'
4244 --- trdiff/new  '"${DATE}"'
4245 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4246 \*\*\* 0 \*\*\*\*
4247 --- 1,2 ----
4248 '"${PLUS}"' #ident      "@(#)trdiff:\$''Name: local-v0 \$:\$''Id: new,v 1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$"
4249 '"${PLUS}"' new file'
4250
4251                 if $keep; then
4252                   echo Keeping ${TESTDIR} and exiting due to --keep
4253                   exit 0
4254                 fi
4255
4256                 cd ..
4257                 rm -r testimport
4258                 rm -rf ${CVSROOT_DIRNAME}/trdiff
4259                 ;;
4260
4261         rdiff-short)
4262           # Test that the short patch behaves as expected
4263           #   1) Added file.
4264           #   2) Removed file.
4265           #   3) Different revision number with no difference.
4266           #   4) Different revision number with changes.
4267           #   5) Against trunk.
4268           #   6) Same revision number (no difference).
4269           mkdir rdiff-short; cd rdiff-short
4270           mkdir abc
4271           dotest rdiff-short-init-1 \
4272 "${testcvs} -q import -I ! -m initial-import abc vendor initial" \
4273 '
4274 No conflicts created by this import'
4275
4276           dotest rdiff-short-init-2 "${testcvs} -q get abc" ''
4277           cd abc
4278           echo "abc" >file1.txt
4279           dotest rdiff-short-init-3 "${testcvs} add file1.txt" \
4280 "${PROG} add: scheduling file .file1\.txt' for addition
4281 ${PROG} add: use .${PROG} commit. to add this file permanently"
4282           dotest rdiff-short-init-4 \
4283 "${testcvs} commit -madd-file1 file1.txt" \
4284 "RCS file: ${CVSROOT_DIRNAME}/abc/file1\.txt,v
4285 done
4286 Checking in file1\.txt;
4287 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4288 initial revision: 1\.1
4289 done"
4290           echo def >>file1.txt
4291           dotest rdiff-short-init-5 \
4292 "${testcvs} commit -mchange-file1 file1.txt" \
4293 "Checking in file1\.txt;
4294 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4295 new revision: 1\.2; previous revision: 1\.1
4296 done"
4297           echo "abc" >file1.txt
4298           dotest rdiff-short-init-6 \
4299 "${testcvs} commit -mrestore-file1-rev1 file1.txt" \
4300 "Checking in file1\.txt;
4301 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4302 new revision: 1\.3; previous revision: 1\.2
4303 done"
4304           dotest rdiff-short-init-7 \
4305 "${testcvs} tag -r 1.1 tag1 file1.txt" \
4306 "T file1\.txt"
4307           dotest rdiff-short-init-8 \
4308 "${testcvs} tag -r 1.2 tag2 file1.txt" \
4309 "T file1\.txt"
4310           dotest rdiff-short-init-9 \
4311 "${testcvs} tag -r 1.3 tag3 file1.txt" \
4312 "T file1\.txt"
4313           echo "abc" >file2.txt
4314           dotest rdiff-short-init-10 \
4315 "${testcvs} add file2.txt" \
4316 "${PROG} add: scheduling file .file2\.txt' for addition
4317 ${PROG} add: use .${PROG} commit. to add this file permanently"
4318           dotest rdiff-add-remove-nodiff-init-11 \
4319 "${testcvs} commit -madd-file2 file2.txt" \
4320 "RCS file: ${CVSROOT_DIRNAME}/abc/file2\.txt,v
4321 done
4322 Checking in file2\.txt;
4323 ${CVSROOT_DIRNAME}/abc/file2\.txt,v  <--  file2\.txt
4324 initial revision: 1\.1
4325 done"
4326           dotest rdiff-short-init-12 \
4327 "${testcvs} tag -r 1.1 tag4 file2.txt" \
4328 "T file2\.txt"
4329           dotest rdiff-short-init-13 \
4330 "${testcvs} tag -r 1.1 tag5 file2.txt" \
4331 "T file2\.txt"
4332           cd ../..
4333           rm -fr rdiff-short
4334
4335           # 3) Different revision number with no difference.
4336           dotest rdiff-short-no-real-change \
4337 "${testcvs} -q rdiff -s -r tag1 -r tag3 abc"
4338
4339           # 4) Different revision number with changes.
4340           dotest rdiff-short-real-change \
4341 "${testcvs} -q rdiff -s -r tag1 -r tag2 abc" \
4342 'File abc/file1.txt changed from revision 1\.1 to 1\.2'
4343
4344           # 1) Added file.
4345           # 2) Removed file.
4346           dotest_sort rdiff-short-remove-add \
4347 "${testcvs} -q rdiff -s -r tag2 -r tag4 abc" \
4348 'File abc/file1\.txt is removed; tag2 revision 1\.2
4349 File abc/file2\.txt is new; tag4 revision 1\.1'
4350
4351           # 6) Same revision number (no difference).
4352           dotest rdiff-short-no-change \
4353 "${testcvs} -q rdiff -s -r tag4 -r tag5 abc"
4354
4355           # 5) Against trunk.
4356           # Check that the messages change when we diff against the trunk
4357           # rather than a tag or date.
4358           dotest rdiff-short-against-trunk-1 \
4359 "${testcvs} -q rdiff -s -rtag4 abc" \
4360 "File abc/file1\.txt is new; current revision 1\.3"
4361
4362           dotest rdiff-short-against-trunk-2 \
4363 "${testcvs} -q rdiff -s -rtag2 abc" \
4364 "File abc/file1\.txt changed from revision 1\.2 to 1\.3
4365 File abc/file2\.txt is new; current revision 1\.1"
4366
4367           rm -rf ${CVSROOT_DIRNAME}/abc
4368           ;;
4369
4370         rdiff2)
4371           # Test for the segv problem reported by James Cribb
4372           # Somewhere to work
4373           mkdir rdiff2; cd rdiff2         
4374           # Create a module "m" with files "foo" and "d/bar"
4375           mkdir m; cd m
4376           echo foo >foo
4377           mkdir d
4378           echo bar >d/bar
4379           dotest_sort  rdiff2-1 \
4380 "${testcvs} -q import -I ! -m initial-import m vendor initial" \
4381 '
4382
4383 N m/d/bar
4384 N m/foo
4385 No conflicts created by this import'
4386
4387           cd ..
4388           rm -r m
4389           
4390           # Remove "foo"
4391           dotest rdiff2-2 "${testcvs} get m" \
4392 "${PROG} checkout: Updating m
4393 U m/foo
4394 ${PROG} checkout: Updating m/d
4395 U m/d/bar"
4396           cd m
4397           dotest rdiff2-3 "${testcvs} rm -f foo" \
4398 "${PROG} remove: scheduling .foo. for removal
4399 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
4400
4401           dotest rdiff2-4 "${testcvs} commit -m Removed foo" \
4402 "Removing foo;
4403 ${CVSROOT_DIRNAME}/m/foo,v  <--  foo
4404 new revision: delete; previous revision: 1\.1\.1\.1
4405 done"
4406           
4407           # Modify "d/bar"
4408           echo foo >d/bar
4409           dotest rdiff2-5 "${testcvs} commit -m Changed d/bar" \
4410 "Checking in d/bar;
4411 ${CVSROOT_DIRNAME}/m/d/bar,v  <--  bar
4412 new revision: 1\.2; previous revision: 1\.1
4413 done"
4414           
4415           # Crash before showing d/bar diffs
4416           dotest_fail rdiff2-6 "${testcvs} rdiff -t m" \
4417 "${PROG} rdiff: Diffing m
4418 ${PROG} rdiff: Diffing m/d
4419 Index: m/d/bar
4420 diff -c m/d/bar:1\.1\.1\.1 m/d/bar:1\.2
4421 \*\*\* m/d/bar:1\.1\.1\.1       ${DATE}
4422 --- m/d/bar     ${DATE}
4423 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4424 \*\*\* 1 \*\*\*\*
4425 ! bar
4426 --- 1 ----
4427 ! foo"
4428           if $keep; then
4429                 echo Keeping ${TESTDIR} and exiting due to --keep
4430                 exit 0
4431           fi
4432           cd ../..
4433           rm -rf rdiff2
4434           rm -rf ${CVSROOT_DIRNAME}/m
4435           ;;
4436
4437         diff)
4438           # Various tests specific to the "cvs diff" command.
4439           # Related tests:
4440           #   death2: -N
4441           #   rcslib: cvs diff and $Name.
4442           #   rdiff: cvs rdiff.
4443           #   diffmerge*: nuts and bolts (stuff within diff library)
4444           mkdir 1; cd 1
4445           dotest diff-1 "${testcvs} -q co -l ." ''
4446           mkdir first-dir
4447           dotest diff-2 "${testcvs} add first-dir" \
4448 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4449           cd first-dir
4450
4451           # diff is anomalous.  Most CVS commands print the "nothing
4452           # known" message (or worse yet, no message in some cases) but
4453           # diff says "I know nothing".  Shrug.
4454           dotest_fail diff-3 "${testcvs} diff xyzpdq" \
4455 "${PROG} diff: I know nothing about xyzpdq"
4456           touch abc
4457           dotest diff-4 "${testcvs} add abc" \
4458 "${PROG} add: scheduling file .abc. for addition
4459 ${PROG} add: use .${PROG} commit. to add this file permanently"
4460           dotest diff-5 "${testcvs} -q ci -mtest" \
4461 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4462 done
4463 Checking in abc;
4464 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4465 initial revision: 1\.1
4466 done"
4467           echo "extern int gethostname ();" >abc
4468           dotest diff-6 "${testcvs} -q ci -mtest" \
4469 "Checking in abc;
4470 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4471 new revision: 1\.2; previous revision: 1\.1
4472 done"
4473           echo "#include <winsock.h>" >abc
4474           # check the behavior of the --ifdef=MACRO option
4475           dotest_fail diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \
4476 "Index: abc
4477 ===================================================================
4478 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4479 retrieving revision 1\.2
4480 diff --ifdef=HAVE_WINSOCK_H -r1\.2 abc
4481 #ifndef HAVE_WINSOCK_H
4482 extern int gethostname ();
4483 #else /\* HAVE_WINSOCK_H \*/
4484 #include <winsock\.h>
4485 #endif /\* HAVE_WINSOCK_H \*/"
4486
4487           if $keep; then
4488             echo Keeping ${TESTDIR} and exiting due to --keep
4489             exit 0
4490           fi
4491
4492           cd ../..
4493           rm -rf ${CVSROOT_DIRNAME}/first-dir
4494           rm -r 1
4495           ;;
4496
4497         diffnl)
4498           # Test handling of 'cvs diff' of files without newlines
4499           mkdir 1; cd 1
4500           dotest diffnl-000 "${testcvs} -q co -l ." ''
4501           mkdir first-dir
4502           dotest diffnl-001 "${testcvs} add first-dir" \
4503 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4504           cd first-dir
4505
4506           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
4507           dotest diffnl-002 "${testcvs} add abc" \
4508 "${PROG} add: scheduling file .abc. for addition
4509 ${PROG} add: use .${PROG} commit. to add this file permanently"
4510           dotest diffnl-003 "${testcvs} -q ci -mtest" \
4511 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4512 done
4513 Checking in abc;
4514 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4515 initial revision: 1\.1
4516 done"
4517
4518           # change to line near EOF
4519           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nsix")}' </dev/null >abc
4520           dotest_fail diffnl-100 "${testcvs} diff abc" \
4521 "Index: abc
4522 ===================================================================
4523 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4524 retrieving revision 1\.1
4525 diff -r1\.1 abc
4526 5d4
4527 < five"
4528           dotest_fail diffnl-101 "${testcvs} diff -u abc" \
4529 "Index: abc
4530 ===================================================================
4531 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4532 retrieving revision 1\.1
4533 diff -u -r1\.1 abc
4534 --- abc ${RFCDATE}      1\.1
4535 +++ abc ${RFCDATE}
4536 @@ -2,5 +2,4 @@
4537  two
4538  three
4539  four
4540 -five
4541  six
4542 \\\\ No newline at end of file"
4543           dotest diffnl-102 "${testcvs} -q ci -mtest abc" \
4544 "Checking in abc;
4545 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4546 new revision: 1\.2; previous revision: 1\.1
4547 done"
4548
4549           # Change to last line
4550           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
4551           dotest_fail diffnl-200 "${testcvs} diff abc" \
4552 "Index: abc
4553 ===================================================================
4554 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4555 retrieving revision 1\.2
4556 diff -r1\.2 abc
4557 5c5
4558 < six
4559 \\\\ No newline at end of file
4560 ---
4561 > seven
4562 \\\\ No newline at end of file"
4563           dotest_fail diffnl-201 "${testcvs} diff -u abc" \
4564 "Index: abc
4565 ===================================================================
4566 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4567 retrieving revision 1\.2
4568 diff -u -r1\.2 abc
4569 --- abc ${RFCDATE}      1\.2
4570 +++ abc ${RFCDATE}
4571 @@ -2,4 +2,4 @@
4572  two
4573  three
4574  four
4575 -six
4576 \\\\ No newline at end of file
4577 +seven
4578 \\\\ No newline at end of file"
4579           dotest diffnl-202 "${testcvs} ci -mtest abc" \
4580 "Checking in abc;
4581 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4582 new revision: 1\.3; previous revision: 1\.2
4583 done"
4584
4585           # Addition of newline
4586           echo "one
4587 two
4588 three
4589 four
4590 seven" > abc
4591           dotest_fail diffnl-300 "${testcvs} diff abc" \
4592 "Index: abc
4593 ===================================================================
4594 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4595 retrieving revision 1\.3
4596 diff -r1\.3 abc
4597 5c5
4598 < seven
4599 \\\\ No newline at end of file
4600 ---
4601 > seven"
4602           dotest_fail diffnl-301 "${testcvs} diff -u abc" \
4603 "Index: abc
4604 ===================================================================
4605 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4606 retrieving revision 1\.3
4607 diff -u -r1\.3 abc
4608 --- abc ${RFCDATE}      1\.3
4609 +++ abc ${RFCDATE}
4610 @@ -2,4 +2,4 @@
4611  two
4612  three
4613  four
4614 -seven
4615 \\\\ No newline at end of file
4616 +seven"
4617           dotest diffnl-302 "${testcvs} ci -mtest abc" \
4618 "Checking in abc;
4619 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4620 new revision: 1\.4; previous revision: 1\.3
4621 done"
4622
4623           # Removal of newline
4624           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
4625           dotest_fail diffnl-400 "${testcvs} diff abc" \
4626 "Index: abc
4627 ===================================================================
4628 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4629 retrieving revision 1\.4
4630 diff -r1\.4 abc
4631 5c5
4632 < seven
4633 ---
4634 > seven
4635 \\\\ No newline at end of file"
4636           dotest_fail diffnl-401 "${testcvs} diff -u abc" \
4637 "Index: abc
4638 ===================================================================
4639 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4640 retrieving revision 1\.4
4641 diff -u -r1\.4 abc
4642 --- abc ${RFCDATE}      1\.4
4643 +++ abc ${RFCDATE}
4644 @@ -2,4 +2,4 @@
4645  two
4646  three
4647  four
4648 -seven
4649 +seven
4650 \\\\ No newline at end of file"
4651         
4652           cd ../..
4653           rm -r 1
4654           rm -rf ${CVSROOT_DIRNAME}/first-dir
4655           ;;
4656
4657         death)
4658                 # next dive.  test death support.
4659
4660                 # NOTE: this section has reached the size and
4661                 # complexity where it is getting to be a good idea to
4662                 # add new death support tests to a new section rather
4663                 # than continuing to piggyback them onto the tests here.
4664
4665                 mkdir  ${CVSROOT_DIRNAME}/first-dir
4666                 if ${CVS} co first-dir  ; then
4667                     pass 65
4668                 else
4669                     fail 65
4670                 fi
4671
4672                 cd first-dir
4673
4674                 # Create a directory with only dead files, to make sure CVS
4675                 # doesn't get confused by it.
4676                 mkdir subdir
4677                 dotest 65a0 "${testcvs} add subdir" \
4678 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
4679                 cd subdir
4680                 echo file in subdir >sfile
4681                 dotest 65a1 "${testcvs} add sfile" \
4682 "${PROG}"' add: scheduling file `sfile'\'' for addition
4683 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
4684                 dotest 65a2 "${testcvs} -q ci -m add-it" \
4685 "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
4686 done
4687 Checking in sfile;
4688 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
4689 initial revision: 1\.1
4690 done"
4691                 rm sfile
4692                 dotest 65a3 "${testcvs} rm sfile" \
4693 "${PROG}"' remove: scheduling `sfile'\'' for removal
4694 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
4695                 dotest 65a4 "${testcvs} -q ci -m remove-it" \
4696 "Removing sfile;
4697 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
4698 new revision: delete; previous revision: 1\.1
4699 done"
4700                 cd ..
4701                 dotest 65a5 "${testcvs} -q update -P" ''
4702                 dotest_fail 65a6 "test -d subdir" ''
4703
4704                 # add a file.
4705                 touch file1
4706                 if ${CVS} add file1  2>> ${LOGFILE}; then
4707                     pass 66
4708                 else
4709                     fail 66
4710                 fi
4711
4712                 # commit
4713                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4714                     pass 67
4715                 else
4716                     fail 67
4717                 fi
4718
4719                 # remove
4720                 rm file1
4721                 if ${CVS} rm file1  2>> ${LOGFILE}; then
4722                     pass 68
4723                 else
4724                     fail 68
4725                 fi
4726
4727                 # commit
4728                 if ${CVS} ci -m test  >>${LOGFILE} ; then
4729                     pass 69
4730                 else
4731                     fail 69
4732                 fi
4733
4734                 dotest_fail 69a0 "test -f file1" ''
4735                 # get the old contents of file1 back
4736                 if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
4737                   pass 69a1
4738                 else
4739                   fail 69a1
4740                 fi
4741                 dotest 69a2 "cat file1" ''
4742
4743                 # create second file
4744                 touch file2
4745                 if ${CVS} add file1 file2  2>> ${LOGFILE}; then
4746                     pass 70
4747                 else
4748                     fail 70
4749                 fi
4750
4751                 # commit
4752                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4753                     pass 71
4754                 else
4755                     fail 71
4756                 fi
4757
4758                 # log
4759                 if ${CVS} log file1  >> ${LOGFILE}; then
4760                     pass 72
4761                 else
4762                     fail 72
4763                 fi
4764
4765                 # file4 will be dead at the time of branching and stay dead.
4766                 echo file4 > file4
4767                 dotest death-file4-add "${testcvs} add file4" \
4768 "${PROG}"' add: scheduling file `file4'\'' for addition
4769 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
4770                 dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
4771 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
4772 done
4773 Checking in file4;
4774 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4775 initial revision: 1\.1
4776 done"
4777                 rm file4
4778                 dotest death-file4-rm "${testcvs} remove file4" \
4779 "${PROG}"' remove: scheduling `file4'\'' for removal
4780 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
4781                 dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
4782 "Removing file4;
4783 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4784 new revision: delete; previous revision: 1\.1
4785 done"
4786
4787                 # Tag the branchpoint.
4788                 dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
4789 T file2'
4790
4791                 # branch1
4792                 if ${CVS} tag -b branch1  ; then
4793                     pass 73
4794                 else
4795                     fail 73
4796                 fi
4797
4798                 # and move to the branch.
4799                 if ${CVS} update -r branch1  ; then
4800                     pass 74
4801                 else
4802                     fail 74
4803                 fi
4804
4805                 dotest_fail death-file4-3 "test -f file4" ''
4806
4807                 # add a file in the branch
4808                 echo line1 from branch1 >> file3
4809                 if ${CVS} add file3  2>> ${LOGFILE}; then
4810                     pass 75
4811                 else
4812                     fail 75
4813                 fi
4814
4815                 # commit
4816                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4817                     pass 76
4818                 else
4819                     fail 76
4820                 fi
4821
4822                 dotest death-76a0 \
4823 "${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
4824 "Index: first-dir/file3
4825 diff -c /dev/null first-dir/file3:1\.1\.2\.1
4826 \*\*\* /dev/null        ${DATE}
4827 --- first-dir/file3     ${DATE}
4828 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4829 \*\*\* 0 \*\*\*\*
4830 --- 1 ----
4831 ${PLUS} line1 from branch1"
4832                 dotest death-76a1 \
4833 "${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
4834 "Index: first-dir/file3
4835 diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
4836 \*\*\* first-dir/file3:1\.1\.2\.1       ${DATE}
4837 --- first-dir/file3     ${DATE}
4838 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4839 \*\*\* 1 \*\*\*\*
4840 - line1 from branch1
4841 --- 0 ----"
4842
4843                 # remove
4844                 rm file3
4845                 if ${CVS} rm file3  2>> ${LOGFILE}; then
4846                     pass 77
4847                 else
4848                     fail 77
4849                 fi
4850
4851                 # commit
4852                 if ${CVS} ci -m test  >>${LOGFILE} ; then
4853                     pass 78
4854                 else
4855                     fail 78
4856                 fi
4857
4858                 # add again
4859                 echo line1 from branch1 >> file3
4860                 if ${CVS} add file3  2>> ${LOGFILE}; then
4861                     pass 79
4862                 else
4863                     fail 79
4864                 fi
4865
4866                 # commit
4867                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4868                     pass 80
4869                 else
4870                     fail 80
4871                 fi
4872
4873                 # change the first file
4874                 echo line2 from branch1 >> file1
4875
4876                 # commit
4877                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4878                     pass 81
4879                 else
4880                     fail 81
4881                 fi
4882
4883                 # remove the second
4884                 rm file2
4885                 if ${CVS} rm file2  2>> ${LOGFILE}; then
4886                     pass 82
4887                 else
4888                     fail 82
4889                 fi
4890
4891                 # commit
4892                 if ${CVS} ci -m test  >>${LOGFILE}; then
4893                     pass 83
4894                 else
4895                     fail 83
4896                 fi
4897
4898                 # back to the trunk.
4899                 if ${CVS} update -A  2>> ${LOGFILE}; then
4900                     pass 84
4901                 else
4902                     fail 84
4903                 fi
4904
4905                 dotest_fail death-file4-4 "test -f file4" ''
4906
4907                 if test -f file3 ; then
4908                     fail 85
4909                 else
4910                     pass 85
4911                 fi
4912
4913                 # join
4914                 dotest 86 "${testcvs} -q update -j branch1" \
4915 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4916 retrieving revision 1\.3
4917 retrieving revision 1\.3\.2\.1
4918 Merging differences between 1\.3 and 1\.3\.2\.1 into file1
4919 ${PROG} update: scheduling file2 for removal
4920 U file3"
4921
4922                 dotest_fail death-file4-5 "test -f file4" ''
4923
4924                 if test -f file3 ; then
4925                     pass 87
4926                 else
4927                     fail 87
4928                 fi
4929
4930                 # Make sure that we joined the correct change to file1
4931                 if echo line2 from branch1 | cmp - file1 >/dev/null; then
4932                     pass 87a
4933                 else
4934                     fail 87a
4935                 fi
4936
4937                 # update
4938                 if ${CVS} update  ; then
4939                     pass 88
4940                 else
4941                     fail 88
4942                 fi
4943
4944                 # commit
4945                 dotest 89 "${testcvs} -q ci -m test" \
4946 "Checking in file1;
4947 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4948 new revision: 1\.4; previous revision: 1\.3
4949 done
4950 Removing file2;
4951 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
4952 new revision: delete; previous revision: 1\.1
4953 done
4954 Checking in file3;
4955 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
4956 new revision: 1\.2; previous revision: 1\.1
4957 done"
4958                 cd ..
4959                 mkdir 2
4960                 cd 2
4961                 dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
4962 U first-dir/file3'
4963                 cd ..
4964                 rm -r 2
4965                 cd first-dir
4966
4967                 # remove first file.
4968                 rm file1
4969                 if ${CVS} rm file1  2>> ${LOGFILE}; then
4970                     pass 90
4971                 else
4972                     fail 90
4973                 fi
4974
4975                 # commit
4976                 if ${CVS} ci -m test  >>${LOGFILE}; then
4977                     pass 91
4978                 else
4979                     fail 91
4980                 fi
4981
4982                 if test -f file1 ; then
4983                     fail 92
4984                 else
4985                     pass 92
4986                 fi
4987
4988                 # typo; try to get to the branch and fail
4989                 dotest_fail 92.1a "${testcvs} update -r brnach1" \
4990                   "${PROG}"' \[update aborted\]: no such tag brnach1'
4991                 # Make sure we are still on the trunk
4992                 if test -f file1 ; then
4993                     fail 92.1b
4994                 else
4995                     pass 92.1b
4996                 fi
4997                 if test -f file3 ; then
4998                     pass 92.1c
4999                 else
5000                     fail 92.1c
5001                 fi
5002
5003                 # back to branch1
5004                 if ${CVS} update -r branch1  2>> ${LOGFILE}; then
5005                     pass 93
5006                 else
5007                     fail 93
5008                 fi
5009
5010                 dotest_fail death-file4-6 "test -f file4" ''
5011
5012                 if test -f file1 ; then
5013                     pass 94
5014                 else
5015                     fail 94
5016                 fi
5017
5018                 # and join
5019                 dotest 95 "${testcvs} -q update -j HEAD" \
5020 "${PROG}"' update: file file1 has been modified, but has been removed in revision HEAD
5021 '"${PROG}"' update: file file3 exists, but has been added in revision HEAD'
5022
5023                 dotest_fail death-file4-7 "test -f file4" ''
5024
5025                 # file2 should not have been recreated.  It was
5026                 # deleted on the branch, and has not been modified on
5027                 # the trunk.  That means that there have been no
5028                 # changes between the greatest common ancestor (the
5029                 # trunk version) and HEAD.
5030                 dotest_fail death-file2-1 "test -f file2" ''
5031
5032                 cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
5033                 ;;
5034
5035         death2)
5036           # More tests of death support.
5037           mkdir ${CVSROOT_DIRNAME}/first-dir
5038           dotest death2-1 "${testcvs} -q co first-dir" ''
5039
5040           cd first-dir
5041
5042           # Add two files on the trunk.
5043           echo "first revision" > file1
5044           echo "file4 first revision" > file4
5045           dotest death2-2 "${testcvs} add file1 file4" \
5046 "${PROG}"' add: scheduling file `file1'\'' for addition
5047 '"${PROG}"' add: scheduling file `file4'\'' for addition
5048 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
5049
5050           dotest death2-3 "${testcvs} -q commit -m add" \
5051 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5052 done
5053 Checking in file1;
5054 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5055 initial revision: 1\.1
5056 done
5057 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5058 done
5059 Checking in file4;
5060 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5061 initial revision: 1\.1
5062 done"
5063
5064           # Make a branch and a non-branch tag.
5065           dotest death2-4 "${testcvs} -q tag -b branch" \
5066 'T file1
5067 T file4'
5068           dotest death2-5 "${testcvs} -q tag tag" \
5069 'T file1
5070 T file4'
5071
5072           # Switch over to the branch.
5073           dotest death2-6 "${testcvs} -q update -r branch" ''
5074
5075           # Delete the file on the branch.
5076           rm file1
5077           dotest death2-7 "${testcvs} rm file1" \
5078 "${PROG} remove: scheduling .file1. for removal
5079 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5080
5081           # Test diff of the removed file before it is committed.
5082           dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
5083 "${PROG} diff: file1 was removed, no comparison available"
5084
5085           dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
5086 "Index: file1
5087 ===================================================================
5088 RCS file: file1
5089 diff -N file1
5090 \*\*\* file1    ${RFCDATE}      [0-9.]*
5091 --- /dev/null   ${RFCDATE_EPOCH}
5092 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5093 \*\*\* 1 \*\*\*\*
5094 - first revision
5095 --- 0 ----"
5096
5097           dotest death2-8 "${testcvs} -q ci -m removed" \
5098 "Removing file1;
5099 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5100 new revision: delete; previous revision: 1\.1
5101 done"
5102
5103           # Test diff of a dead file.
5104           dotest_fail death2-diff-3 \
5105 "${testcvs} -q diff -r1.1 -rbranch -c file1" \
5106 "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
5107 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5108           # and in reverse
5109           dotest_fail death2-diff-3a \
5110 "${testcvs} -q diff -rbranch -r1.1 -c file1" \
5111 "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
5112 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5113
5114           dotest_fail death2-diff-4 \
5115 "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
5116 "Index: file1
5117 ===================================================================
5118 RCS file: file1
5119 diff -N file1
5120 \*\*\* file1    ${RFCDATE}      [0-9.]*
5121 --- /dev/null   ${RFCDATE_EPOCH}
5122 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5123 \*\*\* 1 \*\*\*\*
5124 - first revision
5125 --- 0 ----"
5126           # and in reverse
5127           dotest_fail death2-diff-4a \
5128 "${testcvs} -q diff -rbranch -r1.1 -N -c file1" \
5129 "Index: file1
5130 ===================================================================
5131 RCS file: file1
5132 diff -N file1
5133 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5134 --- file1       ${RFCDATE}      [0-9.]*
5135 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5136 \*\*\* 0 \*\*\*\*
5137 --- 1 ----
5138 + first revision"
5139
5140
5141           dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \
5142 "${PROG} diff: file1 no longer exists, no comparison available"
5143
5144           dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \
5145 "Index: file1
5146 ===================================================================
5147 RCS file: file1
5148 diff -N file1
5149 \*\*\* file1    [-a-zA-Z0-9: ]* [0-9.]*
5150 --- /dev/null   ${RFCDATE_EPOCH}
5151 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5152 \*\*\* 1 \*\*\*\*
5153 - first revision
5154 --- 0 ----"
5155
5156           # Test rdiff of a dead file.
5157           dotest death2-rdiff-1 \
5158 "${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
5159
5160           dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
5161 "Index: first-dir/file1
5162 diff -c first-dir/file1:1\.1 first-dir/file1:removed
5163 \*\*\* first-dir/file1:1\.1     [a-zA-Z0-9: ]*
5164 --- first-dir/file1     [a-zA-Z0-9: ]*
5165 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5166 \*\*\* 1 \*\*\*\*
5167 - first revision
5168 --- 0 ----"
5169
5170           # Readd the file to the branch.
5171           echo "second revision" > file1
5172           dotest death2-9 "${testcvs} add file1" \
5173 "${PROG}"' add: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
5174 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5175
5176           # Test diff of the added file before it is committed.
5177           dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
5178 "${PROG} diff: file1 is a new entry, no comparison available"
5179
5180           dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \
5181 "Index: file1
5182 ===================================================================
5183 RCS file: file1
5184 diff -N file1
5185 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5186 --- file1       ${RFCDATE}
5187 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5188 \*\*\* 0 \*\*\*\*
5189 --- 1 ----
5190 ${PLUS} second revision"
5191
5192           dotest death2-10 "${testcvs} -q commit -m add" \
5193 "Checking in file1;
5194 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5195 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5196 done"
5197
5198           # Delete file4 from the branch
5199           dotest death2-10a "${testcvs} rm -f file4" \
5200 "${PROG} remove: scheduling .file4. for removal
5201 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5202           dotest death2-10b "${testcvs} -q ci -m removed" \
5203 "Removing file4;
5204 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5205 new revision: delete; previous revision: 1\.1
5206 done"
5207
5208           # Back to the trunk.
5209           dotest death2-11 "${testcvs} -q update -A" \
5210 "[UP] file1
5211 U file4"
5212
5213           # Add another file on the trunk.
5214           echo "first revision" > file2
5215           dotest death2-12 "${testcvs} add file2" \
5216 "${PROG}"' add: scheduling file `file2'\'' for addition
5217 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5218           dotest death2-13 "${testcvs} -q commit -m add" \
5219 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5220 done
5221 Checking in file2;
5222 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5223 initial revision: 1\.1
5224 done"
5225
5226           # Modify file4 on the trunk.
5227           echo "new file4 revision" > file4
5228           dotest death2-13a "${testcvs} -q commit -m mod" \
5229 "Checking in file4;
5230 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5231 new revision: 1\.2; previous revision: 1\.1
5232 done"
5233
5234           # Back to the branch.
5235           # The ``no longer in the repository'' message doesn't really
5236           # look right to me, but that's what CVS currently prints for
5237           # this case.
5238           dotest death2-14 "${testcvs} -q update -r branch" \
5239 "[UP] file1
5240 ${PROG} update: file2 is no longer in the repository
5241 ${PROG} update: file4 is no longer in the repository"
5242
5243           # Add a file on the branch with the same name.
5244           echo "branch revision" > file2
5245           dotest death2-15 "${testcvs} add file2" \
5246 "${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
5247 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5248           dotest death2-16 "${testcvs} -q commit -m add" \
5249 "Checking in file2;
5250 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5251 new revision: 1\.1\.2\.1; previous revision: 1\.1
5252 done"
5253
5254           # Add a new file on the branch.
5255           echo "first revision" > file3
5256           dotest death2-17 "${testcvs} add file3" \
5257 "${PROG}"' add: scheduling file `file3'\'' for addition on branch `branch'\''
5258 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5259           dotest death2-18 "${testcvs} -q commit -m add" \
5260 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
5261 done
5262 Checking in file3;
5263 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
5264 new revision: 1\.1\.2\.1; previous revision: 1\.1
5265 done"
5266
5267           # Test diff of a nonexistent tag
5268           dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \
5269 "${PROG} diff: tag tag is not in file file3"
5270
5271           dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \
5272 "Index: file3
5273 ===================================================================
5274 RCS file: file3
5275 diff -N file3
5276 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5277 --- file3       ${RFCDATE}      [0-9.]*
5278 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5279 \*\*\* 0 \*\*\*\*
5280 --- 1 ----
5281 ${PLUS} first revision"
5282
5283           dotest_fail death2-diff-11 "${testcvs} -q diff -rtag -c ." \
5284 "Index: file1
5285 ===================================================================
5286 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5287 retrieving revision 1\.1
5288 retrieving revision 1\.1\.2\.2
5289 diff -c -r1\.1 -r1\.1\.2\.2
5290 \*\*\* file1    ${RFCDATE}      [0-9.]*
5291 --- file1       ${RFCDATE}      [0-9.]*
5292 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5293 \*\*\* 1 \*\*\*\*
5294 ! first revision
5295 --- 1 ----
5296 ! second revision
5297 ${PROG} diff: tag tag is not in file file2
5298 ${PROG} diff: tag tag is not in file file3
5299 ${PROG} diff: file4 no longer exists, no comparison available"
5300
5301           dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \
5302 "Index: file1
5303 ===================================================================
5304 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5305 retrieving revision 1\.1
5306 retrieving revision 1\.1\.2\.2
5307 diff -c -r1\.1 -r1\.1\.2\.2
5308 \*\*\* file1    ${RFCDATE}      [0-9.]*
5309 --- file1       ${RFCDATE}      [0-9.]*
5310 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5311 \*\*\* 1 \*\*\*\*
5312 ! first revision
5313 --- 1 ----
5314 ! second revision
5315 Index: file2
5316 ===================================================================
5317 RCS file: file2
5318 diff -N file2
5319 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5320 --- file2       ${RFCDATE}      [0-9.]*
5321 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5322 \*\*\* 0 \*\*\*\*
5323 --- 1 ----
5324 ${PLUS} branch revision
5325 Index: file3
5326 ===================================================================
5327 RCS file: file3
5328 diff -N file3
5329 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5330 --- file3       ${RFCDATE}      [0-9.]*
5331 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5332 \*\*\* 0 \*\*\*\*
5333 --- 1 ----
5334 ${PLUS} first revision
5335 Index: file4
5336 ===================================================================
5337 RCS file: file4
5338 diff -N file4
5339 \*\*\* file4    ${RFCDATE}      [0-9.]*
5340 --- /dev/null   ${RFCDATE_EPOCH}
5341 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5342 \*\*\* 1 \*\*\*\*
5343 - file4 first revision
5344 --- 0 ----"
5345
5346           # Switch to the nonbranch tag.
5347           dotest death2-19 "${testcvs} -q update -r tag" \
5348 "[UP] file1
5349 ${PROG} update: file2 is no longer in the repository
5350 ${PROG} update: file3 is no longer in the repository
5351 U file4"
5352
5353           dotest_fail death2-20 "test -f file2"
5354
5355           # Make sure diff only reports appropriate files.
5356           dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \
5357 "${PROG} diff: Tag rdiff-tag refers to a dead (removed) revision in file .file1.\.
5358 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5359
5360           dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \
5361 "Index: file1
5362 ===================================================================
5363 RCS file: file1
5364 diff -N file1
5365 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5366 --- file1       ${RFCDATE}      [0-9.]*
5367 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5368 \*\*\* 0 \*\*\*\*
5369 --- 1 ----
5370 ${PLUS} first revision"
5371
5372           # now back to the trunk
5373           dotest death2-21 "${testcvs} -q update -A" \
5374 "U file2
5375 [UP] file4"
5376
5377           # test merging with a dead file
5378           dotest death2-22 "${testcvs} -q co first-dir" \
5379 "U first-dir/file1
5380 U first-dir/file2
5381 U first-dir/file4"
5382
5383           cd first-dir
5384           dotest death2-23 "${testcvs} rm -f file4" \
5385 "${PROG} remove: scheduling .file4. for removal
5386 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5387           dotest death2-24 "${testcvs} -q ci -m removed file4" \
5388 "Removing file4;
5389 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5390 new revision: delete; previous revision: 1\.2
5391 done"
5392           cd ..
5393           echo "new stuff" >file4
5394           dotest_fail death2-25 "${testcvs} up file4" \
5395 "${PROG} update: conflict: file4 is modified but no longer in the repository
5396 C file4"
5397
5398           cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
5399           ;;
5400
5401         rm-update-message)
5402           # FIXME
5403           # local CVS prints a warning message when update notices a missing
5404           # file and client/server CVS doesn't.  These should be identical.
5405           mkdir rm-update-message; cd rm-update-message
5406           mkdir $CVSROOT_DIRNAME/rm-update-message
5407           dotest rm-update-message-setup-1 "$testcvs -q co rm-update-message" ''
5408           cd rm-update-message
5409           file=x
5410           echo >$file
5411           dotest rm-update-message-setup-2 "$testcvs -q add $file" \
5412 "${PROG} add: use .${PROG} commit. to add this file permanently"
5413           dotest rm-update-message-setup-3 "$testcvs -q ci -mcreate $file" \
5414 "RCS file: $CVSROOT_DIRNAME/rm-update-message/$file,v
5415 done
5416 Checking in $file;
5417 $CVSROOT_DIRNAME/rm-update-message/$file,v  <--  $file
5418 initial revision: 1\.1
5419 done"
5420
5421           rm $file
5422           dotest rm-update-message-1 "$testcvs up $file" \
5423 "${PROG} update: warning: $file was lost
5424 U $file"
5425
5426           cd ../..
5427           if $keep; then :; else
5428             rm -rf rm-update-message
5429             rm -rf $CVSROOT_DIRNAME/rm-update-message
5430           fi
5431           ;;
5432
5433         rmadd)
5434           # More tests of adding and removing files.
5435           # In particular ci -r.
5436           # Other ci -r tests:
5437           #   * editor-9: checking in a modified file,
5438           #     where "ci -r" means a branch.
5439           #   * basica-8a1: checking in a modified file with numeric revision.
5440           #   * basica-8a2: likewise.
5441           #   * keywordlog-4: adding a new file with numeric revision.
5442           mkdir 1; cd 1
5443           dotest rmadd-1 "${testcvs} -q co -l ." ''
5444           mkdir first-dir
5445           dotest rmadd-2 "${testcvs} add first-dir" \
5446 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5447           cd first-dir
5448           echo first file1 >file1
5449           dotest rmadd-3 "${testcvs} add file1" \
5450 "${PROG} add: scheduling file .file1. for addition
5451 ${PROG} add: use .${PROG} commit. to add this file permanently"
5452
5453           dotest_fail rmadd-4 "${testcvs} -q ci -r 1.2.2.4 -m add" \
5454 "${PROG} commit: cannot add file .file1' with revision .1\.2\.2\.4'; must be on trunk
5455 ${PROG} \[commit aborted\]: correct above errors first!"
5456           dotest_fail rmadd-5 "${testcvs} -q ci -r 1.2.2 -m add" \
5457 "${PROG} commit: cannot add file .file1' with revision .1\.2\.2'; must be on trunk
5458 ${PROG} \[commit aborted\]: correct above errors first!"
5459           dotest_fail rmadd-6 "${testcvs} -q ci -r mybranch -m add" \
5460 "${PROG} \[commit aborted\]: no such tag mybranch"
5461
5462           # The thing with the trailing periods strikes me as a very
5463           # bizarre behavior, but it would seem to be intentional
5464           # (see commit.c).  It probably could go away....
5465           dotest rmadd-7 "${testcvs} -q ci -r 7.... -m add" \
5466 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5467 done
5468 Checking in file1;
5469 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5470 initial revision: 7\.1
5471 done"
5472           if $remote; then
5473             # I guess remote doesn't set a sticky tag in this case.
5474             # Kind of odd, in the sense that rmadd-24a does set one
5475             # both local and remote.
5476             dotest_fail rmadd-7a "test -f CVS/Tag"
5477             echo T7 >CVS/Tag
5478           else
5479             dotest rmadd-7a "cat CVS/Tag" "T7"
5480           fi
5481
5482           dotest rmadd-8 "${testcvs} -q tag -b mybranch" "T file1"
5483           dotest rmadd-9 "${testcvs} -q tag mynonbranch" "T file1"
5484
5485           touch file2
5486           # The previous "cvs ci -r" set a sticky tag of '7'.  Seems a
5487           # bit odd, and I guess commit.c (findmaxrev) makes '7' sticky
5488           # tags unnecessary (?).  I kind of suspect that it should be
5489           # saying "sticky tag is not a branch" like keywordlog-4b.
5490           # Or something.
5491           dotest rmadd-10 "${testcvs} add file2" \
5492 "${PROG} add: scheduling file .file2. for addition on branch .7'
5493 ${PROG} add: use .${PROG} commit. to add this file permanently"
5494           # As in the previous example, CVS is confused....
5495           dotest rmadd-11 "${testcvs} -q ci -m add" \
5496 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5497 done
5498 Checking in file2;
5499 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5500 initial revision: 7\.1
5501 done"
5502
5503           dotest rmadd-12 "${testcvs} -q update -A" ""
5504           touch file3
5505           dotest rmadd-13 "${testcvs} add file3" \
5506 "${PROG} add: scheduling file .file3. for addition
5507 ${PROG} add: use .${PROG} commit. to add this file permanently"
5508           # Huh?  file2 is not up to date?  Seems buggy to me....
5509           dotest_fail rmadd-14 "${testcvs} -q ci -r mybranch -m add" \
5510 "${PROG} commit: Up-to-date check failed for .file2'
5511 ${PROG} \[commit aborted\]: correct above errors first!"
5512           # Whatever, let's not let file2 distract us....
5513           dotest rmadd-15 "${testcvs} -q ci -r mybranch -m add file3" \
5514 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
5515 done
5516 Checking in file3;
5517 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
5518 new revision: 1\.1\.2\.1; previous revision: 1\.1
5519 done"
5520
5521           touch file4
5522           dotest rmadd-16 "${testcvs} add file4" \
5523 "${PROG} add: scheduling file .file4. for addition
5524 ${PROG} add: use .${PROG} commit. to add this file permanently"
5525           # Same "Up-to-date check" issues as in rmadd-14.
5526           # The "no such tag" thing is due to the fact that we only
5527           # update val-tags when the tag is used (might be more of a
5528           # bug than a feature, I dunno).
5529           dotest_fail rmadd-17 \
5530 "${testcvs} -q ci -r mynonbranch -m add file4" \
5531 "${PROG} \[commit aborted\]: no such tag mynonbranch"
5532           # Try to make CVS write val-tags.
5533           dotest rmadd-18 "${testcvs} -q update -p -r mynonbranch file1" \
5534 "first file1"
5535           # Oops, -p suppresses writing val-tags (probably a questionable
5536           # behavior).
5537           dotest_fail rmadd-19 \
5538 "${testcvs} -q ci -r mynonbranch -m add file4" \
5539 "${PROG} \[commit aborted\]: no such tag mynonbranch"
5540           # Now make CVS write val-tags for real.
5541           dotest rmadd-20 "${testcvs} -q update -r mynonbranch file1" ""
5542           # Oops - CVS isn't distinguishing between a branch tag and
5543           # a non-branch tag.
5544           dotest rmadd-21 \
5545 "${testcvs} -q ci -r mynonbranch -m add file4" \
5546 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v
5547 done
5548 Checking in file4;
5549 ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v  <--  file4
5550 new revision: 1\.1\.2\.1; previous revision: 1\.1
5551 done"
5552
5553           # OK, we add this one in a vanilla way, but then check in
5554           # a modification with ci -r and sniff around for sticky tags.
5555           echo file5 >file5
5556           dotest rmadd-22 "${testcvs} add file5" \
5557 "${PROG} add: scheduling file .file5. for addition
5558 ${PROG} add: use .${PROG} commit. to add this file permanently"
5559           if $remote; then
5560             # Interesting bug (or missing feature) here.  findmaxrev
5561             # gets the major revision from the Entries.  Well, remote
5562             # doesn't send the entries for files which are not involved.
5563             dotest rmadd-23r "${testcvs} -q ci -m add" \
5564 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
5565 done
5566 Checking in file5;
5567 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5568 initial revision: 1\.1
5569 done"
5570             dotest rmadd-23-workaroundr \
5571 "${testcvs} -q ci -r 7 -m bump-it file5" \
5572 "Checking in file5;
5573 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5574 new revision: 7\.1; previous revision: 1\.1
5575 done"
5576           else
5577             dotest rmadd-23 "${testcvs} -q ci -m add" \
5578 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
5579 done
5580 Checking in file5;
5581 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5582 initial revision: 7\.1
5583 done"
5584           fi
5585           echo change it >file5
5586           dotest_fail rmadd-24 "${testcvs} -q ci -r 4.8 -m change file5" \
5587 "Checking in file5;
5588 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5589 ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/file5,v: revision 4\.8 too low; must be higher than 7\.1
5590 ${PROG} commit: could not check in file5"
5591           dotest rmadd-24a "${testcvs} -q ci -r 8.4 -m change file5" \
5592 "Checking in file5;
5593 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5594 new revision: 8\.4; previous revision: 7\.1
5595 done"
5596           # I'm not really sure that a sticky tag make sense here.
5597           # It seems to be longstanding behavior for what that is worth.
5598           dotest rmadd-25 "${testcvs} status file5" \
5599 "===================================================================
5600 File: file5             Status: Up-to-date
5601
5602    Working revision:    8\.4.*
5603    Repository revision: 8\.4    ${CVSROOT_DIRNAME}/first-dir/file5,v
5604    Sticky Tag:          8\.4
5605    Sticky Date:         (none)
5606    Sticky Options:      (none)"
5607
5608           # now try forced revision with recursion
5609           mkdir sub
5610           dotest rmadd-26 "${testcvs} -q add sub" \
5611 "Directory ${CVSROOT_DIRNAME}/first-dir/sub added to the repository"
5612           echo hello >sub/subfile
5613           dotest rmadd-27 "${testcvs} -q add sub/subfile" \
5614 "${PROG} add: use .${PROG} commit. to add this file permanently"
5615
5616           dotest rmadd-28 "${testcvs} -q ci -m. sub" \
5617 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v
5618 done
5619 Checking in sub/subfile;
5620 ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
5621 initial revision: 1\.1
5622 done"
5623
5624           # lose the branch
5625           dotest rmadd-29 "${testcvs} -q up -A" \
5626 "${PROG} update: file3 is no longer in the repository
5627 ${PROG} update: file4 is no longer in the repository"
5628
5629           # -f disables recursion
5630           dotest rmadd-30 "${testcvs} -q ci -f -r9 -m." \
5631 "Checking in file1;
5632 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5633 new revision: 9\.1; previous revision: 7\.1
5634 done
5635 Checking in file2;
5636 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5637 new revision: 9\.1; previous revision: 7\.1
5638 done
5639 Checking in file5;
5640 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5641 new revision: 9\.1; previous revision: 8\.4
5642 done"
5643
5644           # add -R to force recursion
5645           dotest rmadd-31 "${testcvs} -q ci -f -r9 -R -m." \
5646 "Checking in file1;
5647 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5648 new revision: 9\.2; previous revision: 9\.1
5649 done
5650 Checking in file2;
5651 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5652 new revision: 9\.2; previous revision: 9\.1
5653 done
5654 Checking in file5;
5655 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
5656 new revision: 9\.2; previous revision: 9\.1
5657 done
5658 Checking in sub/subfile;
5659 ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
5660 new revision: 9\.1; previous revision: 1\.1
5661 done"
5662
5663           if $remote; then
5664             # as noted above, remote doesn't set a sticky tag
5665             :
5666           else
5667             dotest rmadd-32 "cat CVS/Tag" "T9"
5668             dotest rmadd-33 "cat sub/CVS/Tag" "T9"
5669           fi
5670
5671           cd ../..
5672           rm -r 1
5673           rm -rf ${CVSROOT_DIRNAME}/first-dir
5674           ;;
5675
5676         rmadd2)
5677           # Tests of undoing commits, including in the presence of
5678           # adding and removing files.  See join for a list of -j tests.
5679           mkdir 1; cd 1
5680           dotest rmadd2-1 "${testcvs} -q co -l ." ''
5681           mkdir first-dir
5682           dotest rmadd2-2 "${testcvs} add first-dir" \
5683 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5684           cd first-dir
5685           echo 'initial contents' >file1
5686           dotest rmadd2-3 "${testcvs} add file1" \
5687 "${PROG} add: scheduling file .file1. for addition
5688 ${PROG} add: use .${PROG} commit. to add this file permanently"
5689           dotest rmadd2-4 "${testcvs} -q ci -m add" \
5690 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5691 done
5692 Checking in file1;
5693 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5694 initial revision: 1\.1
5695 done"
5696           dotest rmadd2-4a "${testcvs} -Q tag tagone" ""
5697           dotest rmadd2-5 "${testcvs} rm -f file1" \
5698 "${PROG} remove: scheduling .file1. for removal
5699 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5700           dotest rmadd2-6 "${testcvs} -q ci -m remove" \
5701 "Removing file1;
5702 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5703 new revision: delete; previous revision: 1\.1
5704 done"
5705           dotest rmadd2-7 "${testcvs} -q update -j 1.2 -j 1.1 file1" "U file1"
5706           dotest rmadd2-8 "${testcvs} -q ci -m readd" \
5707 "Checking in file1;
5708 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5709 new revision: 1\.3; previous revision: 1\.2
5710 done"
5711           echo 'new contents' >file1
5712           dotest rmadd2-9 "${testcvs} -q ci -m modify" \
5713 "Checking in file1;
5714 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5715 new revision: 1\.4; previous revision: 1\.3
5716 done"
5717           dotest rmadd2-10 "${testcvs} -q update -j 1.4 -j 1.3 file1" \
5718 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5719 retrieving revision 1\.4
5720 retrieving revision 1\.3
5721 Merging differences between 1\.4 and 1\.3 into file1"
5722           dotest rmadd2-11 "${testcvs} -q ci -m undo" \
5723 "Checking in file1;
5724 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5725 new revision: 1\.5; previous revision: 1\.4
5726 done"
5727           dotest rmadd2-12 "cat file1" "initial contents"
5728           dotest rmadd2-13 "${testcvs} -q update -p -r 1.3" "initial contents"
5729
5730           # Hmm, might be a bit odd that this works even if 1.3 is not
5731           # the head.
5732           dotest rmadd2-14 "${testcvs} -q update -j 1.3 -j 1.2 file1" \
5733 "${PROG} update: scheduling file1 for removal"
5734
5735           # Check that -p can get arbitrary revisions of a removed file
5736           dotest rmadd2-14a "${testcvs} -q update -p" "initial contents"
5737           dotest rmadd2-14b "${testcvs} -q update -p -r 1.5" "initial contents"
5738           dotest rmadd2-14c "${testcvs} -q update -p -r 1.3" "initial contents"
5739
5740           dotest rmadd2-15 "${testcvs} -q ci -m re-remove" \
5741 "Removing file1;
5742 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5743 new revision: delete; previous revision: 1\.5
5744 done"
5745           dotest rmadd2-16 "${testcvs} log -h file1" "
5746 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
5747 Working file: file1
5748 head: 1\.6
5749 branch:
5750 locks: strict
5751 access list:
5752 symbolic names:
5753         tagone: 1\.1
5754 keyword substitution: kv
5755 total revisions: 6
5756 ============================================================================="
5757           dotest rmadd2-17 "${testcvs} status -v file1" \
5758 "===================================================================
5759 File: no file file1             Status: Up-to-date
5760
5761    Working revision:    No entry for file1
5762    Repository revision: 1\.6    ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
5763
5764    Existing Tags:
5765         tagone                          (revision: 1.1)"
5766
5767           cd ../..
5768
5769           rm -r 1
5770           rm -rf ${CVSROOT_DIRNAME}/first-dir
5771           ;;
5772
5773         rmadd3)
5774           # This test demonstrates that CVS notices that file1 exists rather
5775           # that deleting or writing over it after:
5776           #
5777           #   cvs remove -f file1; touch file1; cvs add file1.
5778           #
5779           # According to the manual, this should work for:
5780           #
5781           #   rm file1; cvs remove file1; cvs add file1
5782           #
5783           # but in past version of CVS, new content in file1 would be
5784           # erroneously deleted when file1 reappeared between the remove and
5785           # the add.
5786           #
5787           # Later versions of CVS would refuse to perform the add, but still
5788           # allow a subsequent local commit to erase the file from the
5789           # workspace, possibly losing data.
5790           mkdir 1; cd 1
5791           dotest rmadd3-init1 "${testcvs} -q co -l ." ''
5792           mkdir first-dir
5793           dotest rmadd3-init2 "${testcvs} add first-dir" \
5794 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5795           cd first-dir
5796
5797           echo initial content for file1 >file1
5798           dotest rmadd3-init3 "${testcvs} add file1" \
5799 "${PROG} add: scheduling file \`file1' for addition
5800 ${PROG} add: use '${PROG} commit' to add this file permanently"
5801           dotest rmadd3-init4 "${testcvs} -q ci -m add" \
5802 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5803 done
5804 Checking in file1;
5805 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5806 initial revision: 1\.1
5807 done"
5808
5809           # Here begins the guts of this test, as detailed above.
5810           dotest rmadd3-1 "${testcvs} rm -f file1" \
5811 "${PROG} remove: scheduling \`file1' for removal
5812 ${PROG} remove: use '${PROG} commit' to remove this file permanently"
5813
5814           # Now recreate the file:
5815           echo desired future contents for file1 >file1
5816
5817           # And attempt to resurrect it at the same time:
5818           dotest_fail rmadd3-2 "${testcvs} add file1" \
5819 "${PROG} add: file1 should be removed and is still there (or is back again)"
5820
5821           # Now prove that commit knows that it shouldn't erase files.
5822           dotest_fail rmadd3-3 "${testcvs} -q ci -m." \
5823 "$PROG commit: \`file1' should be removed and is still there (or is back again)
5824 $PROG \[commit aborted\]: correct above errors first!"
5825
5826           # Then these should pass too:
5827           dotest rmadd3-4 "test -f file1"
5828           dotest rmadd3-5 "cat file1" "desired future contents for file1"
5829
5830           if $keep; then
5831             echo Keeping ${TESTDIR} and exiting due to --keep
5832             exit 0
5833           fi
5834
5835           cd ../..
5836           rm -r 1
5837           rm -rf ${CVSROOT_DIRNAME}/first-dir
5838           ;;
5839
5840         resurrection)
5841           # This test tests a few file resurrection scenarios.
5842           mkdir 1; cd 1
5843           dotest resurrection-init1 "$testcvs -q co -l ." ''
5844           mkdir first-dir
5845           dotest resurrection-init2 "$testcvs add first-dir" \
5846 "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
5847           cd first-dir
5848
5849           echo initial content for file1 >file1
5850           dotest resurrection-init3 "$testcvs add file1" \
5851 "$PROG add: scheduling file \`file1' for addition
5852 $PROG add: use '$PROG commit' to add this file permanently"
5853           dotest resurrection-init4 "$testcvs -q ci -m add" \
5854 "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
5855 done
5856 Checking in file1;
5857 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
5858 initial revision: 1\.1
5859 done"
5860
5861           dotest resurrection-init5 "$testcvs -Q rm -f file1"
5862
5863           # The first test is that `cvs add' will resurrect a file before it
5864           # has been committed.
5865           dotest_sort resurrection-1 "$testcvs add file1" \
5866 "U file1
5867 $PROG add: file1, version 1\.1, resurrected"
5868           dotest resurrection-2 "$testcvs -Q diff file1" ""
5869
5870           dotest resurrection-init6 "$testcvs -Q tag -b resurrection"
5871           dotest resurrection-init7 "$testcvs -Q rm -f file1"
5872           dotest resurrection-init8 "$testcvs -Q ci -mrm" \
5873 "Removing file1;
5874 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
5875 new revision: delete; previous revision: 1\.1
5876 done"
5877
5878           # The next test is that CVS will resurrect a committed removal.
5879           dotest_sort resurrection-3 "$testcvs add file1" \
5880 "U file1
5881 $PROG add: Re-adding file \`file1' (in place of dead revision 1\.2)\.
5882 $PROG add: Resurrecting file \`file1' from revision 1\.1\.
5883 $PROG add: use 'cvs commit' to add this file permanently"
5884           dotest resurrection-4 "$testcvs -q diff -r1.1 file1" ""
5885           dotest resurrection-5 "$testcvs -q ci -mreadd" \
5886 "Checking in file1;
5887 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
5888 new revision: 1\.3; previous revision: 1\.2
5889 done"
5890
5891           dotest resurrection-init9 "$testcvs -Q up -rresurrection"
5892           dotest resurrection-init10 "$testcvs -Q rm -f file1"
5893           dotest resurrection-init11 "$testcvs -Q ci -mrm-on-resurrection" \
5894 "Removing file1;
5895 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
5896 new revision: delete; previous revision: 1\.1
5897 done"
5898
5899           # The next test is that CVS will resurrect a committed removal to a
5900           # branch.
5901           dotest_sort resurrection-6 "$testcvs add file1" \
5902 "U file1
5903 $PROG add: Resurrecting file \`file1' from revision 1\.1\.
5904 $PROG add: file \`file1' will be added on branch \`resurrection' from version 1\.1\.2\.1
5905 $PROG add: use 'cvs commit' to add this file permanently"
5906           dotest resurrection-7 "$testcvs -Q diff -r1.1 file1" ""
5907           dotest resurrection-8 "$testcvs -q ci -mreadd" \
5908 "Checking in file1;
5909 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
5910 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5911 done"
5912           if $keep; then
5913             echo Keeping $TESTDIR and exiting due to --keep
5914             exit 0
5915           fi
5916
5917           cd ../..
5918           rm -r 1
5919           rm -rf $CVSROOT_DIRNAME/first-dir
5920           ;;
5921
5922         dirs)
5923           # Tests related to removing and adding directories.
5924           # See also:
5925           #   conflicts (especially dir1 in conflicts-130): What happens if
5926           #     directory exists in repository and a non-CVS-controlled
5927           #     directory in the working directory?
5928           #   conflicts3-15.  More cases, especially where CVS directory
5929           #     exists but without CVS/Repository and friends.
5930           #   conflicts3-22.  Similar to conflicts-130 but there is a file
5931           #     in the directory.
5932           #   dirs2.  Sort of similar to conflicts3-22 but somewhat different.
5933           mkdir imp-dir; cd imp-dir
5934           echo file1 >file1
5935           mkdir sdir
5936           echo sfile >sdir/sfile
5937           dotest_sort dirs-1 \
5938 "${testcvs} import -m import-it dir1 vend rel" "
5939
5940 N dir1/file1
5941 N dir1/sdir/sfile
5942 No conflicts created by this import
5943 ${PROG} import: Importing ${CVSROOT_DIRNAME}/dir1/sdir"
5944           cd ..
5945
5946           mkdir 1; cd 1
5947           dotest dirs-2 "${testcvs} -Q co dir1" ""
5948
5949           # Various CVS administrators are in the habit of removing
5950           # the repository directory for things they don't want any
5951           # more.  I've even been known to do it myself (on rare
5952           # occasions).  Not the usual recommended practice, but we want
5953           # to try to come up with some kind of reasonable/documented/sensible
5954           # behavior.
5955           rm -rf ${CVSROOT_DIRNAME}/dir1/sdir
5956
5957           dotest dirs-3 "${testcvs} update" \
5958 "${PROG} update: Updating dir1
5959 ${PROG} update: Updating dir1/sdir
5960 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
5961 ${PROG} update: skipping directory dir1/sdir"
5962           dotest dirs-3a "${testcvs} update -d" \
5963 "${PROG} update*: Updating dir1
5964 ${PROG} update: Updating dir1/sdir
5965 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
5966 ${PROG} update: skipping directory dir1/sdir"
5967
5968           # If we say "yes", then CVS gives errors about not being able to
5969           # create lock files.
5970           # The fact that it says "skipping directory " rather than
5971           # "skipping directory dir1/sdir" is some kind of bug.
5972           dotest dirs-4 "echo no | ${testcvs} release -d dir1/sdir" \
5973 "${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
5974 ${PROG} update: skipping directory 
5975 You have \[0\] altered files in this repository\.
5976 Are you sure you want to release (and delete) directory .dir1/sdir': .. .release' aborted by user choice."
5977
5978           # OK, if "cvs release" won't help, we'll try it the other way...
5979           rm -r dir1/sdir
5980
5981           dotest dirs-5 "cat dir1/CVS/Entries" \
5982 "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
5983 D/sdir////"
5984           dotest dirs-6 "${testcvs} update" "${PROG} update: Updating dir1"
5985           dotest dirs-7 "cat dir1/CVS/Entries" \
5986 "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
5987 D/sdir////"
5988           dotest dirs-8 "${testcvs} update -d dir1" \
5989 "${PROG} update: Updating dir1"
5990
5991           cd ..
5992
5993           rm -r imp-dir 1
5994
5995           # clean up our repositories
5996           rm -rf ${CVSROOT_DIRNAME}/dir1
5997           ;;
5998
5999         dirs2)
6000           # See "dirs" for a list of tests involving adding and
6001           # removing directories.
6002           mkdir 1; cd 1
6003           dotest dirs2-1 "${testcvs} -q co -l ." ''
6004           mkdir first-dir
6005           dotest dirs2-2 "${testcvs} add first-dir" \
6006 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6007           cd first-dir
6008           mkdir sdir
6009           dotest dirs2-3 "${testcvs} add sdir" \
6010 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
6011           touch sdir/file1
6012           dotest dirs2-4 "${testcvs} add sdir/file1" \
6013 "${PROG} add: scheduling file .sdir/file1. for addition
6014 ${PROG} add: use .${PROG} commit. to add this file permanently"
6015           dotest dirs2-5 "${testcvs} -q ci -m add" \
6016 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v
6017 done
6018 Checking in sdir/file1;
6019 ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
6020 initial revision: 1\.1
6021 done"
6022           rm -r sdir/CVS
6023           if $remote; then
6024             # This is just like conflicts3-23
6025             dotest_fail dirs2-6 "${testcvs} update -d" \
6026 "${QUESTION} sdir
6027 ${PROG} update: Updating \.
6028 ${PROG} update: Updating sdir
6029 ${PROG} update: move away sdir/file1; it is in the way
6030 C sdir/file1"
6031             rm sdir/file1
6032             rm -r sdir/CVS
6033
6034             # This is where things are not just like conflicts3-23
6035             dotest dirs2-7 "${testcvs} update -d" \
6036 "${QUESTION} sdir
6037 ${PROG} update: Updating \.
6038 ${PROG} update: Updating sdir
6039 U sdir/file1"
6040           else
6041             dotest dirs2-6 "${testcvs} update -d" \
6042 "${PROG} update: Updating \.
6043 ${QUESTION} sdir"
6044             rm sdir/file1
6045             dotest dirs2-7 "${testcvs} update -d" \
6046 "${PROG} update: Updating \.
6047 ${QUESTION} sdir"
6048           fi
6049           cd ../..
6050
6051           # Now, the same thing (more or less) on a branch.
6052           mkdir 2; cd 2
6053           dotest dirs2-8 "${testcvs} -q co first-dir" 'U first-dir/sdir/file1'
6054           cd first-dir
6055           dotest dirs2-9 "${testcvs} -q tag -b br" "T sdir/file1"
6056           rm -r sdir/CVS
6057           if $remote; then
6058             # Cute little quirk of val-tags; if we don't recurse into
6059             # the directories where the tag is defined, val-tags won't
6060             # get updated.
6061             dotest_fail dirs2-10 "${testcvs} update -d -r br" \
6062 "${QUESTION} sdir
6063 ${PROG} \[update aborted\]: no such tag br"
6064             dotest dirs2-10ar \
6065 "${testcvs} -q rdiff -u -r 1.1 -r br first-dir/sdir/file1"
6066             dotest_fail dirs2-10-again "${testcvs} update -d -r br" \
6067 "${QUESTION} sdir
6068 ${PROG} update: Updating \.
6069 ${PROG} update: Updating sdir
6070 ${PROG} update: move away sdir/file1; it is in the way
6071 C sdir/file1"
6072           else
6073             dotest_fail dirs2-10 "${testcvs} update -d -r br" \
6074 "${PROG} update: in directory sdir:
6075 ${PROG} \[update aborted\]: there is no version here; do '${PROG} checkout' first"
6076           fi
6077           cd ../..
6078
6079           # OK, the above tests make the situation somewhat harder
6080           # than it might be, in the sense that they actually have a
6081           # file which is alive on the branch we are updating.  Let's
6082           # try it where it is just a directory where all the files
6083           # have been removed.
6084           mkdir 3; cd 3
6085           dotest dirs2-11 "${testcvs} -q co -r br first-dir" \
6086 "U first-dir/sdir/file1"
6087           cd first-dir
6088           # Hmm, this doesn't mention the branch like add does.  That's
6089           # an odd non-orthogonality.
6090           dotest dirs2-12 "${testcvs} rm -f sdir/file1" \
6091 "${PROG} remove: scheduling .sdir/file1. for removal
6092 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
6093           dotest dirs2-13 "${testcvs} -q ci -m remove" \
6094 "Removing sdir/file1;
6095 ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
6096 new revision: delete; previous revision: 1\.1
6097 done"
6098           cd ../../2/first-dir
6099           if $remote; then
6100             dotest dirs2-14 "${testcvs} update -d -r br" \
6101 "${QUESTION} sdir/file1
6102 ${PROG} update: Updating \.
6103 ${PROG} update: Updating sdir"
6104           else
6105             dotest dirs2-14 "${testcvs} update -d -r br" \
6106 "${PROG} update: Updating \.
6107 ${QUESTION} sdir"
6108           fi
6109           cd ../..
6110
6111           rm -r 1 2 3
6112           rm -rf ${CVSROOT_DIRNAME}/first-dir
6113           ;;
6114
6115         branches)
6116           # More branch tests, including branches off of branches
6117           mkdir ${CVSROOT_DIRNAME}/first-dir
6118           dotest branches-1 "${testcvs} -q co first-dir" ''
6119           cd first-dir
6120           echo 1:ancest >file1
6121           echo 2:ancest >file2
6122           echo 3:ancest >file3
6123           echo 4:trunk-1 >file4
6124           dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
6125 "${PROG}"' add: scheduling file `file1'\'' for addition
6126 '"${PROG}"' add: scheduling file `file2'\'' for addition
6127 '"${PROG}"' add: scheduling file `file3'\'' for addition
6128 '"${PROG}"' add: scheduling file `file4'\'' for addition
6129 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
6130           dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
6131           dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
6132 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6133 done
6134 Checking in file1;
6135 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6136 initial revision: 1.1
6137 done
6138 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6139 done
6140 Checking in file2;
6141 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6142 initial revision: 1.1
6143 done
6144 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6145 done
6146 Checking in file3;
6147 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6148 initial revision: 1.1
6149 done
6150 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6151 done
6152 Checking in file4;
6153 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6154 initial revision: 1.1
6155 done
6156 HERE
6157           echo 4:trunk-2 >file4
6158           dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
6159 "Checking in file4;
6160 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6161 new revision: 1\.2; previous revision: 1\.1
6162 done"
6163           # The "cvs log file4" in test branches-14.3 will test that we
6164           # didn't really add the tag.
6165           dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
6166 "T file1
6167 T file2
6168 T file3
6169 T file4"
6170           # Modify this file before branching, to deal with the case where
6171           # someone is hacking along, says "oops, I should be doing this on
6172           # a branch", and only then creates the branch.
6173           echo 1:br1 >file1
6174           dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' tag: Tagging \.
6175 T file1
6176 T file2
6177 T file3
6178 T file4'
6179           dotest branches-5 "${testcvs} update -r br1" \
6180 "${PROG} update: Updating \.
6181 M file1"
6182           echo 2:br1 >file2
6183           echo 4:br1 >file4
6184           dotest branches-6 "${testcvs} -q ci -m modify" \
6185 "Checking in file1;
6186 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6187 new revision: 1\.1\.2\.1; previous revision: 1\.1
6188 done
6189 Checking in file2;
6190 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6191 new revision: 1\.1\.2\.1; previous revision: 1\.1
6192 done
6193 Checking in file4;
6194 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6195 new revision: 1\.2\.2\.1; previous revision: 1\.2
6196 done"
6197           dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
6198 T file2
6199 T file3
6200 T file4'
6201           dotest branches-8 "${testcvs} -q update -r brbr" ''
6202           echo 1:brbr >file1
6203           echo 4:brbr >file4
6204           dotest branches-9 "${testcvs} -q ci -m modify" \
6205 "Checking in file1;
6206 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6207 new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
6208 done
6209 Checking in file4;
6210 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6211 new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
6212 done"
6213           dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
6214 2:br1
6215 3:ancest
6216 4:brbr'
6217           dotest branches-11 "${testcvs} -q update -r br1" \
6218 '[UP] file1
6219 [UP] file4'
6220           dotest branches-12 "cat file1 file2 file3 file4" '1:br1
6221 2:br1
6222 3:ancest
6223 4:br1'
6224           echo 4:br1-2 >file4
6225           dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
6226 "Checking in file4;
6227 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6228 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
6229 done"
6230           dotest branches-13 "${testcvs} -q update -A" '[UP] file1
6231 [UP] file2
6232 [UP] file4'
6233           dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
6234 2:ancest
6235 3:ancest
6236 4:trunk-2'
6237           echo 4:trunk-3 >file4
6238           dotest branches-14.2 \
6239             "${testcvs} -q ci -m trunk-change-after-branch" \
6240 "Checking in file4;
6241 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6242 new revision: 1\.3; previous revision: 1\.2
6243 done"
6244           dotest branches-14.3 "${testcvs} log file4" \
6245 "
6246 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6247 Working file: file4
6248 head: 1\.3
6249 branch:
6250 locks: strict
6251 access list:
6252 symbolic names:
6253         brbr: 1\.2\.2\.1\.0\.2
6254         br1: 1\.2\.0\.2
6255 keyword substitution: kv
6256 total revisions: 6;     selected revisions: 6
6257 description:
6258 ----------------------------
6259 revision 1\.3
6260 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6261 trunk-change-after-branch
6262 ----------------------------
6263 revision 1\.2
6264 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6265 branches:  1\.2\.2;
6266 trunk-before-branch
6267 ----------------------------
6268 revision 1\.1
6269 date: [0-9/: ]*;  author: ${username};  state: Exp;
6270 add-it
6271 ----------------------------
6272 revision 1\.2\.2\.2
6273 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6274 change-on-br1
6275 ----------------------------
6276 revision 1\.2\.2\.1
6277 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6278 branches:  1\.2\.2\.1\.2;
6279 modify
6280 ----------------------------
6281 revision 1\.2\.2\.1\.2\.1
6282 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6283 modify
6284 ============================================================================="
6285           dotest_fail branches-14.4 \
6286             "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
6287 "Index: file4
6288 ===================================================================
6289 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6290 retrieving revision 1\.1
6291 retrieving revision 1\.3
6292 diff -c -r1\.1 -r1\.3
6293 \*\*\* file4    ${RFCDATE}      1\.1
6294 --- file4       ${RFCDATE}      1\.3
6295 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6296 \*\*\* 1 \*\*\*\*
6297 ! 4:trunk-1
6298 --- 1 ----
6299 ! 4:trunk-3"
6300           dotest_fail branches-14.5 \
6301             "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
6302 "Index: file4
6303 ===================================================================
6304 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6305 retrieving revision 1\.1
6306 retrieving revision 1\.2\.2\.1
6307 diff -c -r1\.1 -r1\.2\.2\.1
6308 \*\*\* file4    ${RFCDATE}      1\.1
6309 --- file4       ${RFCDATE}      1\.2\.2\.1
6310 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6311 \*\*\* 1 \*\*\*\*
6312 ! 4:trunk-1
6313 --- 1 ----
6314 ! 4:br1"
6315           dotest branches-15 \
6316             "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
6317             "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6318 retrieving revision 1\.1\.2\.1
6319 retrieving revision 1\.1\.2\.1\.2\.1
6320 Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
6321 rcsmerge: warning: conflicts during merge"
6322           dotest branches-16 "cat file1" '<<<<<<< file1
6323 1:ancest
6324 [=]======
6325 1:brbr
6326 [>]>>>>>> 1\.1\.2\.1\.2\.1'
6327
6328           dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
6329 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6330 done
6331 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6332 done
6333 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6334 done
6335 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6336 done"
6337           cd ..
6338
6339           if $keep; then
6340             echo Keeping ${TESTDIR} and exiting due to --keep
6341             exit 0
6342           fi
6343
6344           rm -rf ${CVSROOT_DIRNAME}/first-dir
6345           rm -r first-dir
6346           ;;
6347
6348         branches2)
6349           # More branch tests.
6350           # Test that when updating a new subdirectory in a directory
6351           # which was checked out on a branch, the new subdirectory is
6352           # created on the appropriate branch.  Test this when joining
6353           # as well.
6354
6355           mkdir ${CVSROOT_DIRNAME}/first-dir
6356           mkdir trunk; cd trunk
6357
6358           # Create a file.
6359           dotest branches2-1 "${testcvs} -q co first-dir"
6360           cd first-dir
6361           echo "file1 first revision" > file1
6362           dotest branches2-2 "${testcvs} add file1" \
6363 "${PROG} add: scheduling file .file1. for addition
6364 ${PROG} add: use .${PROG} commit. to add this file permanently"
6365           dotest branches2-3 "${testcvs} commit -m add file1" \
6366 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6367 done
6368 Checking in file1;
6369 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6370 initial revision: 1\.1
6371 done"
6372
6373           # Tag the file.
6374           dotest branches2-4 "${testcvs} -q tag tag1" 'T file1'
6375
6376           # Make two branches.
6377           dotest branches2-5 "${testcvs} -q rtag -b -r tag1 b1 first-dir" ''
6378           dotest branches2-6 "${testcvs} -q rtag -b -r tag1 b2 first-dir" ''
6379
6380           # Create some files and a subdirectory on branch b1.
6381           cd ../..
6382           mkdir b1; cd b1
6383           dotest branches2-7 "${testcvs} -q co -r b1 first-dir" \
6384 "U first-dir/file1"
6385           cd first-dir
6386           echo "file2 first revision" > file2
6387           dotest branches2-8 "${testcvs} add file2" \
6388 "${PROG}"' add: scheduling file `file2'\'' for addition on branch `b1'\''
6389 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6390           mkdir dir1
6391           dotest branches2-9 "${testcvs} add dir1" \
6392 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository
6393 --> Using per-directory sticky tag "'`'"b1'"
6394           echo "file3 first revision" > dir1/file3
6395           dotest branches2-10 "${testcvs} add dir1/file3" \
6396 "${PROG}"' add: scheduling file `dir1/file3'\'' for addition on branch `b1'\''
6397 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6398           dotest branches2-11 "${testcvs} -q ci -madd ." \
6399 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
6400 done
6401 Checking in file2;
6402 ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
6403 new revision: 1\.1\.2\.1; previous revision: 1\.1
6404 done
6405 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6406 done
6407 Checking in dir1/file3;
6408 ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v  <--  file3
6409 new revision: 1\.1\.2\.1; previous revision: 1\.1
6410 done"
6411
6412           # Check out the second branch, and update the working
6413           # directory to the first branch, to make sure the right
6414           # happens with dir1.
6415           cd ../..
6416           mkdir b2; cd b2
6417           dotest branches2-12 "${testcvs} -q co -r b2 first-dir" \
6418 'U first-dir/file1'
6419           cd first-dir
6420           dotest branches2-13 "${testcvs} update -d -r b1 dir1" \
6421 "${PROG} update: Updating dir1
6422 U dir1/file3"
6423           dotest branches2-14 "${testcvs} -q status" \
6424 "===================================================================
6425 File: file1             Status: Up-to-date
6426
6427    Working revision:    1\.1.*
6428    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
6429    Sticky Tag:          b2 (branch: 1\.1\.4)
6430    Sticky Date:         (none)
6431    Sticky Options:      (none)
6432
6433 ===================================================================
6434 File: file3             Status: Up-to-date
6435
6436    Working revision:    1\.1\.2\.1.*
6437    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6438    Sticky Tag:          b1 (branch: 1\.1\.2)
6439    Sticky Date:         (none)
6440    Sticky Options:      (none)"
6441
6442           # FIXME: Just clobbering the directory like this is a bit
6443           # tacky, although people generally expect it to work.  Maybe
6444           # we should release it instead.  We do it a few other places
6445           # below as well.
6446           rm -r dir1
6447           dotest branches2-15 "${testcvs} update -d -j b1 dir1" \
6448 "${PROG} update: Updating dir1
6449 U dir1/file3"
6450           # FIXCVS: The `No revision control file' stuff seems to be
6451           # CVS's way of telling us that we're adding the file on a
6452           # branch, and the file is not on that branch yet.  This
6453           # should be nicer.
6454           dotest branches2-16 "${testcvs} -q status" \
6455 "===================================================================
6456 File: file1             Status: Up-to-date
6457
6458    Working revision:    1\.1.*
6459    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
6460    Sticky Tag:          b2 (branch: 1\.1\.4)
6461    Sticky Date:         (none)
6462    Sticky Options:      (none)
6463
6464 ===================================================================
6465 File: file3             Status: Locally Added
6466
6467    Working revision:    New file!
6468    Repository revision: No revision control file
6469    Sticky Tag:          b2 - MISSING from RCS file!
6470    Sticky Date:         (none)
6471    Sticky Options:      (none)"
6472
6473           cd ../../trunk/first-dir
6474           dotest branches2-17 "${testcvs} update -d -P dir1" \
6475 "${PROG} update: Updating dir1"
6476           dotest_fail branches2-18 "test -d dir1"
6477           dotest branches2-19 "${testcvs} update -d -P -r b1 dir1" \
6478 "${PROG} update: Updating dir1
6479 U dir1/file3"
6480           dotest branches2-20 "${testcvs} -q status" \
6481 "===================================================================
6482 File: file1             Status: Up-to-date
6483
6484    Working revision:    1\.1.*
6485    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
6486    Sticky Tag:          (none)
6487    Sticky Date:         (none)
6488    Sticky Options:      (none)
6489
6490 ===================================================================
6491 File: file3             Status: Up-to-date
6492
6493    Working revision:    1\.1\.2\.1.*
6494    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6495    Sticky Tag:          b1 (branch: 1\.1\.2)
6496    Sticky Date:         (none)
6497    Sticky Options:      (none)"
6498
6499           rm -r dir1
6500           dotest branches2-21 "${testcvs} update -d -P -j b1 dir1" \
6501 "${PROG} update: Updating dir1
6502 U dir1/file3"
6503           dotest branches2-22 "${testcvs} -q status" \
6504 "===================================================================
6505 File: file1             Status: Up-to-date
6506
6507    Working revision:    1\.1.*
6508    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
6509    Sticky Tag:          (none)
6510    Sticky Date:         (none)
6511    Sticky Options:      (none)
6512
6513 ===================================================================
6514 File: file3             Status: Locally Added
6515
6516    Working revision:    New file!
6517    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6518    Sticky Tag:          (none)
6519    Sticky Date:         (none)
6520    Sticky Options:      (none)"
6521
6522           cd ../..
6523           rm -r b1 b2
6524
6525           # Check out branch b1 twice.  Crate a new directory in one
6526           # working directory, then do a cvs update in the other
6527           # working directory and see if the tags are right.
6528           mkdir b1a
6529           mkdir b1b
6530           cd b1b
6531           dotest branches2-23 "${testcvs} -q co -r b1 first-dir" \
6532 'U first-dir/file1
6533 U first-dir/file2
6534 U first-dir/dir1/file3'
6535           cd ../b1a
6536           dotest branches2-24 "${testcvs} -q co -r b1 first-dir" \
6537 'U first-dir/file1
6538 U first-dir/file2
6539 U first-dir/dir1/file3'
6540           cd first-dir
6541           mkdir dir2
6542           dotest branches2-25 "${testcvs} add dir2" \
6543 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository
6544 --> Using per-directory sticky tag "'`'"b1'"
6545           echo "file4 first revision" > dir2/file4
6546           dotest branches2-26 "${testcvs} add dir2/file4" \
6547 "${PROG}"' add: scheduling file `dir2/file4'\'' for addition on branch `b1'\''
6548 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6549           dotest branches2-27 "${testcvs} -q commit -madd" \
6550 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
6551 done
6552 Checking in dir2/file4;
6553 ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v  <--  file4
6554 new revision: 1\.1\.2\.1; previous revision: 1\.1
6555 done"
6556
6557           cd ../../b1b/first-dir
6558           dotest branches2-28 "${testcvs} update -d dir2" \
6559 "${PROG} update: Updating dir2
6560 U dir2/file4"
6561           cd dir2
6562           dotest branches2-29 "${testcvs} -q status" \
6563 "===================================================================
6564 File: file4             Status: Up-to-date
6565
6566    Working revision:    1\.1\.2\.1.*
6567    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
6568    Sticky Tag:          b1 (branch: 1\.1\.2)
6569    Sticky Date:         (none)
6570    Sticky Options:      (none)"
6571           dotest branches2-30 "cat CVS/Tag" 'Tb1'
6572
6573           # Test update -A on a subdirectory
6574           cd ..
6575           rm -r dir2
6576           dotest branches2-31 "${testcvs} update -A -d dir2" \
6577 "${PROG} update: Updating dir2"
6578           cd dir2
6579           dotest branches2-32 "${testcvs} -q status" ''
6580           dotest_fail branches2-33 "test -f CVS/Tag"
6581
6582           # Add a file on the trunk.
6583           echo "file5 first revision" > file5
6584           dotest branches2-34 "${testcvs} add file5" \
6585 "${PROG}"' add: scheduling file `file5'\'' for addition
6586 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6587           dotest branches2-35 "${testcvs} -q commit -madd" \
6588 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
6589 done
6590 Checking in file5;
6591 ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v  <--  file5
6592 initial revision: 1\.1
6593 done"
6594
6595           cd ../../../trunk/first-dir
6596           dotest branches2-36 "${testcvs} -q update -d dir2" 'U dir2/file5'
6597           cd dir2
6598           dotest branches2-37 "${testcvs} -q status" \
6599 "===================================================================
6600 File: file5             Status: Up-to-date
6601
6602    Working revision:    1\.1.*
6603    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
6604    Sticky Tag:          (none)
6605    Sticky Date:         (none)
6606    Sticky Options:      (none)"
6607           dotest_fail branches2-38 "test -f CVS/status"
6608
6609           cd ../../..
6610           rm -rf ${CVSROOT_DIRNAME}/first-dir
6611           rm -r trunk b1a b1b
6612           ;;
6613
6614         tagc)
6615           # Test the tag -c option.
6616           mkdir 1; cd 1
6617           dotest tagc-1 "${testcvs} -q co -l ." ''
6618           mkdir first-dir
6619           dotest tagc-2 "${testcvs} add first-dir" \
6620 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6621           cd first-dir
6622           touch file1 file2
6623           dotest tagc-3 "${testcvs} add file1 file2" \
6624 "${PROG} add: scheduling file .file1. for addition
6625 ${PROG} add: scheduling file .file2. for addition
6626 ${PROG} add: use .${PROG} commit. to add these files permanently"
6627           dotest tagc-4 "${testcvs} -q ci -m add" \
6628 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6629 done
6630 Checking in file1;
6631 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6632 initial revision: 1\.1
6633 done
6634 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6635 done
6636 Checking in file2;
6637 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6638 initial revision: 1\.1
6639 done"
6640           dotest tagc-5 "${testcvs} -q tag -c tag1" \
6641 "T file1
6642 T file2"
6643           touch file1 file2
6644           dotest tagc-6 "${testcvs} -q tag -c tag2" \
6645 "T file1
6646 T file2"
6647           # Avoid timestamp granularity bugs (FIXME: CVS should be
6648           # doing the sleep, right?).
6649           sleep 1
6650           echo myedit >>file1
6651           dotest tagc-6a "${testcvs} rm -f file2" \
6652 "${PROG} remove: scheduling .file2. for removal
6653 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
6654           touch file3
6655           dotest tagc-6b "${testcvs} add file3" \
6656 "${PROG} add: scheduling file .file3. for addition
6657 ${PROG} add: use .${PROG} commit. to add this file permanently"
6658           dotest_fail tagc-7 "${testcvs} -q tag -c tag3" \
6659 "${PROG} tag: file1 is locally modified
6660 ${PROG} tag: file2 is locally modified
6661 ${PROG} tag: file3 is locally modified
6662 ${PROG} \[tag aborted\]: correct the above errors first!"
6663           cd ../..
6664           mkdir 2
6665           cd 2
6666           dotest tagc-8 "${testcvs} -q co first-dir" \
6667 "U first-dir/file1
6668 U first-dir/file2"
6669           cd ../1/first-dir
6670           dotest tagc-9 "${testcvs} -q ci -m modify" \
6671 "Checking in file1;
6672 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6673 new revision: 1\.2; previous revision: 1\.1
6674 done
6675 Removing file2;
6676 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6677 new revision: delete; previous revision: 1\.1
6678 done
6679 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6680 done
6681 Checking in file3;
6682 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6683 initial revision: 1\.1
6684 done"
6685           cd ../../2/first-dir
6686           dotest tagc-10 "${testcvs} -q tag -c tag4" \
6687 "${PROG} tag: file2 is no longer in the repository
6688 T file1
6689 T file2"
6690           cd ../..
6691
6692           rm -r 1 2
6693           rm -rf ${CVSROOT_DIRNAME}/first-dir
6694           ;;
6695
6696         update-p)
6697           # Make sure `cvs update -p -rT FILE' works from a branch when
6698           # FILE is already on the trunk and is being added to that branch.
6699
6700           mkdir 1; cd 1
6701           module=x
6702
6703           echo > unused-file
6704
6705           # Create the module.
6706           dotest update-p-1 \
6707             "$testcvs -Q import -m. $module X Y" ''
6708
6709           file=F
6710           # Check it out and tag it.
6711           dotest update-p-2 "$testcvs -Q co $module" ''
6712           cd $module
6713           dotest update-p-3 "$testcvs -Q tag -b B" ''
6714           echo v1 > $file
6715           dotest update-p-4 "$testcvs -Q add $file" ''
6716           dotest update-p-5 "$testcvs -Q ci -m. $file" \
6717 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
6718 done
6719 Checking in $file;
6720 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
6721 initial revision: 1\.1
6722 done"
6723           dotest update-p-6 "$testcvs -Q tag T $file" ''
6724           dotest update-p-7 "$testcvs -Q update -rB" ''
6725
6726           # This merge effectively adds file F on branch B.
6727           dotest update-p-8 "$testcvs -Q update -jT" ''
6728
6729           # Before the fix that prompted the addition of this test,
6730           # the following command would fail with this diagnostic:
6731           # cvs update: conflict: F created independently by second party
6732           dotest update-p-9 "$testcvs update -p -rT $file" \
6733 "===================================================================
6734 Checking out $file
6735 RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
6736 VERS: 1\.1
6737 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6738 v1"
6739
6740           # Repeat the above, but with $file removed.
6741           # This exercises a slightly different code path.
6742           rm $file
6743           # Before the fix that prompted the addition of this test,
6744           # the following command would fail with this diagnostic:
6745           # cvs update: warning: new-born F has disappeared
6746           dotest update-p-10 "$testcvs update -p -rT $file" \
6747 "===================================================================
6748 Checking out $file
6749 RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
6750 VERS: 1\.1
6751 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6752 v1"
6753
6754           # Exercise yet another code path:
6755           # the one that involves reviving a `dead' file.
6756           # And a little more, for good measure...
6757           touch new
6758           dotest update-p-a1 "$testcvs -Q add new" ''
6759           dotest update-p-a2 "$testcvs -Q update -p new" ''
6760           dotest update-p-a3 "$testcvs -Q rm -f new" ''
6761
6762           # Both an update -A, *and* the following update are required
6763           # to return to the state of being on the trunk with a $file
6764           # that we can then remove.
6765           dotest update-p-undead-0 "$testcvs update -A" \
6766 "${PROG} update: Updating \.
6767 ${PROG} update: warning: new-born $file has disappeared"
6768           dotest update-p-undead-1 "$testcvs update" \
6769 "${PROG} update: Updating \.
6770 U $file"
6771           dotest update-p-undead-2 "$testcvs -Q update -p -rT $file" v1
6772           dotest update-p-undead-3 "$testcvs -Q rm -f $file" ''
6773           dotest update-p-undead-4 "$testcvs -Q update -p -rT $file" v1
6774           dotest update-p-undead-5 "$testcvs -Q ci -m. $file" \
6775 "Removing $file;
6776 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
6777 new revision: delete; previous revision: 1\.1
6778 done"
6779           dotest update-p-undead-6 "$testcvs -Q update -p -rT $file" v1
6780           echo v2 > $file
6781           dotest update-p-undead-7 "$testcvs -Q update -p -rT $file" v1
6782           dotest update-p-undead-8 "$testcvs add $file" \
6783 "${PROG} add: Re-adding file .$file. (in place of dead revision 1\.2)\.
6784 ${PROG} add: use .${PROG} commit. to add this file permanently"
6785
6786           dotest update-p-undead-9 "$testcvs -Q update -p -rT $file" v1
6787
6788           cd ../..
6789           rm -rf 1
6790           rm -rf ${CVSROOT_DIRNAME}/$module
6791           ;;
6792
6793         tagf)
6794           # More tagging tests, including using tag -F -B to convert a
6795           # branch tag to a regular tag and recovering thereof.
6796
6797           # Setup; check in first-dir/file1
6798           mkdir 1; cd 1
6799           dotest tagf-1 "${testcvs} -q co -l ." ''
6800           mkdir first-dir
6801           dotest tagf-2 "${testcvs} add first-dir" \
6802 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6803           cd first-dir
6804           touch file1 file2
6805           dotest tagf-3 "${testcvs} add file1 file2" \
6806 "${PROG} add: scheduling file .file1. for addition
6807 ${PROG} add: scheduling file .file2. for addition
6808 ${PROG} add: use .${PROG} commit. to add these files permanently"
6809           dotest tagf-4 "${testcvs} -q ci -m add" \
6810 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6811 done
6812 Checking in file1;
6813 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6814 initial revision: 1\.1
6815 done
6816 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6817 done
6818 Checking in file2;
6819 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6820 initial revision: 1\.1
6821 done"
6822
6823           # Now create a branch and commit a revision there.
6824           dotest tagf-5 "${testcvs} -q tag -b br" "T file1
6825 T file2"
6826           dotest tagf-6 "${testcvs} -q update -r br" ""
6827           echo brmod >> file1
6828           echo brmod >> file2
6829           dotest tagf-7 "${testcvs} -q ci -m modify" \
6830 "Checking in file1;
6831 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6832 new revision: 1\.1\.2\.1; previous revision: 1\.1
6833 done
6834 Checking in file2;
6835 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6836 new revision: 1\.1\.2\.1; previous revision: 1\.1
6837 done"
6838           # Here we try to make it a non-branch tag, but will
6839           # succeed in getting only warnings, even with -F 
6840           # because converting a branch tag to non-branch 
6841           # is potentially catastrophic.
6842           dotest tagf-8a "${testcvs} -q tag -F br" \
6843 "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\\.2\.1\.
6844 ${PROG} tag: file2: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\.2\.1\."
6845           # however, if we *really* are sure we want to move a branch tag,
6846           # "-F -B" will do the trick
6847           dotest tagf-8 "${testcvs} -q tag -F -B br" "T file1
6848 T file2"
6849           echo moremod >> file1
6850           echo moremod >> file2
6851           dotest tagf-9 "${testcvs} -q status -v file1" \
6852 "===================================================================
6853 File: file1             Status: Locally Modified
6854
6855    Working revision:    1\.1\.2\.1.*
6856    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/file1,v
6857    Sticky Tag:          br (revision: 1\.1\.2\.1)
6858    Sticky Date:         (none)
6859    Sticky Options:      (none)
6860
6861    Existing Tags:
6862         br                              (revision: 1\.1\.2\.1)"
6863
6864           # Now, how do we recover?
6865           dotest tagf-10 "${testcvs} -q tag -d br" "D file1
6866 D file2"
6867           # This creates a new branch, 1.1.4.  See the code in RCS_magicrev
6868           # which will notice that there is a (non-magic) 1.1.2 and thus
6869           # skip that number.
6870           dotest tagf-11 "${testcvs} -q tag -r 1.1 -b br file1" "T file1"
6871           # Fix it with admin -n (cf admin-18, admin-26-4).
6872           dotest tagf-12 "${testcvs} -q admin -nbr:1.1.2 file2" \
6873 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6874 done"
6875           # Another variation on the file2 test would be to use two working
6876           # directories so that the update -r br would need to
6877           # a merge to get from 1.1.2.1 to the head of the 1.1.2 branch.
6878           dotest tagf-13 "${testcvs} -q update -r br" \
6879 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6880 retrieving revision 1\.1\.2\.1
6881 retrieving revision 1\.1
6882 Merging differences between 1\.1\.2\.1 and 1\.1 into file1
6883 rcsmerge: warning: conflicts during merge
6884 ${PROG} update: conflicts found in file1
6885 C file1
6886 M file2"
6887           # CVS is giving a conflict because we are trying to get back to
6888           # 1.1.4.  I'm not sure why it is a conflict rather than just
6889           # "M file1".
6890           dotest tagf-14 "cat file1" \
6891 "<<<<<<< file1
6892 brmod
6893 moremod
6894 [=]======
6895 [>]>>>>>> 1\.1"
6896           echo resolve >file1
6897           dotest tagf-15 "${testcvs} -q ci -m recovered" \
6898 "Checking in file1;
6899 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6900 new revision: 1\.1\.4\.1; previous revision: 1\.1
6901 done
6902 Checking in file2;
6903 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6904 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
6905 done"
6906           # try accidentally deleting branch tag, "tag -d"
6907           dotest_fail tagf-16 "${testcvs} tag -d br" \
6908 "${PROG} tag: Untagging \.
6909 ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
6910 ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
6911           # try accidentally deleting branch tag, "rtag -d"
6912           dotest_fail tagf-17 "${testcvs} rtag -d br first-dir" \
6913 "${PROG} rtag: Untagging first-dir
6914 ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
6915 ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
6916           # try accidentally converting branch tag to non-branch tag "tag -F"
6917           dotest tagf-18 "${testcvs} tag -r1.1 -F br file1" \
6918 "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\."
6919           # try accidentally converting branch tag to non-branch tag "rtag -F"
6920           dotest tagf-19 "${testcvs} rtag -r1.1 -F br first-dir" \
6921 "${PROG} rtag: Tagging first-dir
6922 ${PROG} rtag: first-dir/file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\.
6923 ${PROG} rtag: first-dir/file2: Not moving branch tag .br. from 1\.1\.2\.2 to 1\.1\."
6924           # create a non-branch tag
6925           dotest tagf-20 "${testcvs} rtag regulartag first-dir" \
6926 "${PROG} rtag: Tagging first-dir"
6927           # try accidentally converting non-branch tag to branch tag (tag -F -B -b)
6928           dotest tagf-21 "${testcvs} tag -F -B -b regulartag file1" \
6929 "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1\.0\.2 due to .-B. option\."
6930           # try accidentally converting non-branch tag to branch rtag (rtag -F -B -b)
6931           dotest tagf-22 "${testcvs} rtag -F -B -b regulartag first-dir" \
6932 "${PROG} rtag: Tagging first-dir
6933 ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.6 due to .-B. option\.
6934 ${PROG} rtag: first-dir/file2: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.4 due to .-B. option\."
6935           # Try accidentally deleting non-branch: (tag -d -B)
6936           dotest_fail tagf-23 "${testcvs} tag -d -B regulartag file1" \
6937 "${PROG} tag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\."
6938           # Try accidentally deleting non-branch: (rtag -d -B)
6939           dotest_fail tagf-24 \
6940                 "${testcvs} rtag -d -B regulartag first-dir" \
6941 "${PROG} rtag: Untagging first-dir
6942 ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\.
6943 ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file2,v. due to .-B. option\."
6944
6945           # the following tests (throught the next commit) keep moving the same
6946           # tag back and forth between 1.1.6 & 1.1.8  in file1 and between
6947           # 1.1.4 and 1.1.6 in file2 since nothing was checked in on some of
6948           # these branches and CVS only tracks branches via tags unless they contain data.
6949
6950           # try intentionally converting non-branch tag to branch tag (tag -F -b)
6951           dotest tagf-25a "${testcvs} tag -F -b regulartag file1" "T file1"
6952           # try intentionally moving a branch tag to a newly created branch (tag -F -b -B)
6953           dotest tagf-25b "${testcvs} tag -F -B -b -r1.1 regulartag file1" \
6954 "T file1"
6955           # try intentionally converting mixed tags to branch tags (rtag -F -b)
6956           dotest tagf-26a "${testcvs} rtag -F -b regulartag first-dir" \
6957 "${PROG} rtag: Tagging first-dir
6958 ${PROG} rtag: first-dir/file1: Not moving branch tag .regulartag. from 1\.1 to 1\.1\.0\.8\."
6959           # try intentionally converting a branch to a new branch tag (rtag -F -b -B)
6960           dotest tagf-26b "${testcvs} rtag -F -B -b -r1.1 regulartag first-dir" \
6961 "${PROG} rtag: Tagging first-dir"
6962           # update to our new branch
6963           dotest tagf-27 "${testcvs} update -r regulartag" \
6964 "${PROG} update: Updating \.
6965 U file1
6966 U file2"
6967           # commit some changes and see that all rev numbers look right
6968           echo changes >> file1
6969           echo changes >> file2
6970           dotest tagf-28 "${testcvs} ci -m changes" \
6971 "${PROG} [a-z]*: Examining \.
6972 Checking in file1;
6973 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6974 new revision: 1\.1\.8\.1; previous revision: 1\.1
6975 done
6976 Checking in file2;
6977 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6978 new revision: 1\.1\.6\.1; previous revision: 1\.1
6979 done"
6980           # try intentional branch to non-branch (tag -F -B)
6981           dotest tagf-29 "${testcvs} tag -F -B -r1.1 regulartag file1" \
6982 "T file1"
6983           # try non-branch to non-branch (tag -F -B)
6984           dotest tagf-29a "${testcvs} tag -F -B -r br regulartag file1" \
6985 "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
6986           # try mixed-branch to non-branch (rtag -F -B )
6987           dotest tagf-29b "${testcvs} rtag -F -B -r br regulartag first-dir" \
6988 "${PROG} rtag: Tagging first-dir
6989 ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
6990           # at this point, regulartag is a regular tag within
6991           # file1 and file2
6992
6993           # try intentional branch to non-branch (rtag -F -B)
6994           dotest tagf-30 "${testcvs} rtag -F -B -r1.1 br first-dir"  \
6995 "${PROG} rtag: Tagging first-dir"
6996           # create a branch tag so we can try to delete it.
6997           dotest tagf-31 "${testcvs} rtag -b brtag first-dir"  \
6998 "${PROG} rtag: Tagging first-dir"
6999         
7000           # try intentinal deletion of branch tag (tag -d -B)
7001           dotest tagf-32 "${testcvs} tag -d -B brtag file1" "D file1"
7002           # try intentinal deletion of branch tag (rtag -d -B)
7003           dotest tagf-33 "${testcvs} rtag -d -B brtag first-dir" \
7004 "${PROG} rtag: Untagging first-dir"
7005
7006           cd ../..
7007
7008           rm -r 1
7009           rm -rf ${CVSROOT_DIRNAME}/first-dir
7010           ;;
7011
7012         rcslib)
7013           # Test librarification of RCS.
7014           # First: test whether `cvs diff' handles $Name expansion
7015           # correctly.  We diff two revisions with their symbolic tags;
7016           # neither tag should be expanded in the output.  Also diff
7017           # one revision with the working copy.
7018
7019           mkdir ${CVSROOT_DIRNAME}/first-dir
7020           dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
7021           cd first-dir
7022           echo "I am the first foo, and my name is $""Name$." > foo.c
7023           dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
7024 "${PROG} add: scheduling file .foo\.c. for addition
7025 ${PROG} add: use .${PROG} commit. to add this file permanently"
7026           dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
7027 "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7028 done
7029 Checking in foo\.c;
7030 ${CVSROOT_DIRNAME}/first-dir/foo.c,v  <--  foo\.c
7031 initial revision: 1\.1
7032 done"
7033           dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
7034           dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
7035 "===================================================================
7036 Checking out foo\.c
7037 RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7038 VERS: 1\.1
7039 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7040 I am the first foo, and my name is \$""Name: first \$\."
7041
7042           echo "I am the second foo, and my name is $""Name$." > foo.c
7043           dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
7044 "Checking in foo\.c;
7045 ${CVSROOT_DIRNAME}/first-dir/foo\.c,v  <--  foo\.c
7046 new revision: 1\.2; previous revision: 1\.1
7047 done"
7048           dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
7049           dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
7050 "===================================================================
7051 Checking out foo\.c
7052 RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7053 VERS: 1\.2
7054 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7055 I am the second foo, and my name is \$""Name: second \$\."
7056
7057         dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
7058 "${PROG} diff: Diffing \.
7059 Index: foo\.c
7060 ===================================================================
7061 RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7062 retrieving revision 1\.1
7063 retrieving revision 1\.2
7064 diff -r1\.1 -r1\.2
7065 1c1
7066 < I am the first foo, and my name is \$""Name:  \$\.
7067 ---
7068 > I am the second foo, and my name is \$""Name:  \$\."
7069
7070           echo "I am the once and future foo, and my name is $""Name$." > foo.c
7071           dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
7072 "${PROG} diff: Diffing \.
7073 Index: foo\.c
7074 ===================================================================
7075 RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7076 retrieving revision 1\.1
7077 diff -r1\.1 foo\.c
7078 1c1
7079 < I am the first foo, and my name is \$""Name:  \$\.
7080 ---
7081 > I am the once and future foo, and my name is \$""Name\$\."
7082
7083           # Test handling of libdiff options.  diff gets quite enough
7084           # of a workout elsewhere in sanity.sh, so we assume that it's
7085           # mostly working properly if it passes all the other tests.
7086           # The main one we want to try is regex handling, since we are
7087           # using CVS's regex matcher and not diff's.
7088
7089           cat >rgx.c <<EOF
7090 test_regex (whiz, bang)
7091 {
7092 foo;
7093 bar;
7094 baz;
7095 grumble;
7096 }
7097 EOF
7098
7099           dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
7100 "${PROG} add: use .${PROG} commit. to add this file permanently"
7101           dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
7102 "RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
7103 done
7104 Checking in rgx\.c;
7105 ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v  <--  rgx\.c
7106 initial revision: 1\.1
7107 done"
7108           cat >rgx.c <<EOF
7109 test_regex (whiz, bang)
7110 {
7111 foo;
7112 bar;
7113 baz;
7114 mumble;
7115 }
7116 EOF
7117           # Use dotest_fail because exit status from `cvs diff' must be 1.
7118           dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.*(' rgx.c" \
7119 "Index: rgx\.c
7120 ===================================================================
7121 RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
7122 retrieving revision 1\.1
7123 diff -c -F\.\*( -r1\.1 rgx\.c
7124 \*\*\* rgx\.c   ${RFCDATE}      1\.1
7125 --- rgx\.c      ${RFCDATE}
7126 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
7127 \*\*\* 3,7 \*\*\*\*
7128   foo;
7129   bar;
7130   baz;
7131 ! grumble;
7132   }
7133 --- 3,7 ----
7134   foo;
7135   bar;
7136   baz;
7137 ! mumble;
7138   }"
7139
7140           # Tests of rcsmerge/diff3.  Merge operations get a good general
7141           # workout elsewhere; we want to make sure that options are still
7142           # handled properly.  Try merging two branches with -kv, to test
7143           # both -j and -k switches.
7144
7145           cd ..
7146
7147           rm -rf ${CVSROOT_DIRNAME}/first-dir
7148           rm -r first-dir
7149
7150           mkdir 1; cd 1
7151           dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
7152           mkdir first-dir
7153           dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
7154 "Directory ${CVSROOT_DIRNAME}.*/first-dir added to the repository"
7155           cd ..; rm -r 1
7156
7157           dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
7158           cd first-dir
7159
7160           echo '$''Revision$' > file1
7161           echo '2' >> file1
7162           echo '3' >> file1
7163           dotest rcslib-merge-4 "${testcvs} -q add file1" \
7164 "${PROG} add: use .${PROG} commit. to add this file permanently"
7165           dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
7166 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7167 done
7168 Checking in file1;
7169 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7170 initial revision: 1\.1
7171 done"
7172           sed -e 's/2/two/' file1 > f; mv f file1
7173           dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
7174 "Checking in file1;
7175 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7176 new revision: 1\.2; previous revision: 1\.1
7177 done"
7178           dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
7179           dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
7180           dotest rcslib-merge-9 "${testcvs} -q status" \
7181 "===================================================================
7182 File: file1             Status: Up-to-date
7183
7184    Working revision:    1\.1.*
7185    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
7186    Sticky Tag:          patch1 (branch: 1\.1\.2)
7187    Sticky Date:         (none)
7188    Sticky Options:      (none)"
7189           dotest rcslib-merge-10 "cat file1" \
7190 '$''Revision: 1\.1 $
7191 2
7192 3'
7193           sed -e 's/3/three/' file1 > f; mv f file1
7194           dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
7195 "Checking in file1;
7196 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7197 new revision: 1\.1\.2\.1; previous revision: 1\.1
7198 done"
7199           dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
7200 "U file1
7201 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7202 retrieving revision 1\.1
7203 retrieving revision 1\.2
7204 Merging differences between 1\.1 and 1\.2 into file1
7205 rcsmerge: warning: conflicts during merge"
7206           dotest rcslib-merge-13 "cat file1" \
7207 "<<<<<<< file1
7208 1\.1\.2\.1
7209 2
7210 three
7211 [=]======
7212 1\.2
7213 two
7214 3
7215 [>]>>>>>> 1\.2"
7216
7217           # Test behavior of symlinks in the repository.
7218           if test -n "$remotehost"; then
7219             # Create the link on the remote system.  This is because Cygwin's
7220             # Windows support creates *.lnk files for Windows.  When creating
7221             # these in an SMB share from UNIX, these links won't work from the
7222             # UNIX side.
7223             dotest rcslib-symlink-1remotehost "${CVS_RSH} $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
7224           else
7225             dotest rcslib-symlink-1 "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
7226           fi
7227           dotest rcslib-symlink-2 "${testcvs} update file2" "U file2"
7228           echo "This is a change" >> file2
7229           dotest rcslib-symlink-3 "${testcvs} ci -m because file2" \
7230 "Checking in file2;
7231 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
7232 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
7233 done"
7234
7235           # Switch as for rcslib-symlink-1
7236           if test -n "$remotehost"; then
7237             dotest rcslib-symlink-4 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
7238 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
7239           else
7240             dotest rcslib-symlink-4 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
7241 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
7242           fi
7243
7244           # CVS was failing to check both the symlink and the file
7245           # for timestamp changes for a while.  Test that.
7246           rm file1
7247           dotest rcslib-symlink-3a "${testcvs} -q up file1" \
7248 "${PROG} update: warning: file1 was lost
7249 U file1"
7250           echo "This is a change" >> file1
7251           dotest rcslib-symlink-3b "${testcvs} ci -m because file1" \
7252 "Checking in file1;
7253 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7254 new revision: 1\.1\.2\.[0-9]*; previous revision: 1\.1\.2\.[0-9]*
7255 done"
7256           dotest rcslib-symlink-3c "${testcvs} update file2" "[UP] file2"
7257
7258           echo some new text >file3
7259           dotest rcslib-symlink-3d "${testcvs} -Q add file3" ''
7260           dotest rcslib-symlink-3e "${testcvs} -Q ci -mtest file3" \
7261 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
7262 done
7263 Checking in file3;
7264 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
7265 new revision: 1\.1\.2\.1; previous revision: 1\.1
7266 done"
7267
7268           rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
7269           # As for rcslib-symlink-1
7270           if test -n "$remotehost"; then
7271             dotest rcslib-symlink-3f "$CVS_RSH $remotehost 'ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
7272           else
7273             dotest rcslib-symlink-3f "ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
7274           fi
7275
7276           dotest rcslib-symlink-3g "${testcvs} update file2" "U file2"
7277
7278           # restore the link to file1 for the following tests
7279           dotest rcslib-symlink-3i "${testcvs} -Q rm -f file3" ''
7280           dotest rcslib-symlink-3j "${testcvs} -Q ci -mwhatever file3" \
7281 "Removing file3;
7282 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
7283 new revision: delete; previous revision: 1\.1\.2\.1
7284 done"
7285           rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
7286           rm -f ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
7287           # As for rcslib-symlink-1
7288           if test -n "$remotehost"; then
7289             dotest rcslib-symlink-3h "$CVS_RSH $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
7290           else
7291             dotest rcslib-symlink-3h "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
7292           fi
7293
7294           # Test 5 reveals a problem with having symlinks in the
7295           # repository.  CVS will try to tag both of the files
7296           # separately.  After processing one, it will do the same
7297           # operation to the other, which is actually the same file,
7298           # so the tag will already be there.  FIXME: do we bother
7299           # changing operations to notice cases like this?  This
7300           # strikes me as a difficult problem.  -Noel
7301           dotest rcslib-symlink-5 "${testcvs} tag the_tag" \
7302 "${PROG} tag: Tagging .
7303 T file1
7304 W file2 : the_tag already exists on version 1.1.2.3 : NOT MOVING tag to version 1.1.2.1"
7305           # As for rcslib-symlink-1
7306           if test -n "$remotehost"; then
7307             dotest rcslib-symlink-6 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
7308 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
7309           else
7310             dotest rcslib-symlink-6 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
7311 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
7312           fi
7313
7314           # Symlinks tend to interact poorly with the Attic.
7315           cd ..
7316           mkdir 2; cd 2
7317           dotest rcslib-symlink-7 "${testcvs} -q co first-dir" \
7318 "U first-dir/file1
7319 U first-dir/file2"
7320           cd first-dir
7321           dotest rcslib-symlink-8 "${testcvs} rm -f file2" \
7322 "${PROG} remove: scheduling .file2. for removal
7323 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
7324           dotest rcslib-symlink-9 "${testcvs} -q ci -m rm-it" \
7325 "Removing file2;
7326 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
7327 new revision: delete; previous revision: 1\.2
7328 done"
7329           # OK, why this message happens twice is relatively clear
7330           # (the check_* and rtag_* calls to start_recursion).
7331           # Why it happens a third time I didn't try to find out.
7332           dotest rcslib-symlink-10 \
7333 "${testcvs} -q rtag -b -r the_tag brtag first-dir" \
7334 "${PROG} rtag: could not read RCS file for file2
7335 ${PROG} rtag: could not read RCS file for first-dir/file2
7336 ${PROG} rtag: could not read RCS file for first-dir/file2"
7337           cd ..
7338
7339           cd ..
7340
7341           if $keep; then
7342             echo Keeping ${TESTDIR} and exiting due to --keep
7343             exit 0
7344           fi
7345
7346           # Must remove the symlink first.  Samba doesn't appear to show
7347           # broken symlink across the SMB share, and rm -rf by itself
7348           # will remove file1,v first and leave file2,v a broken link and the
7349           # rm -rf will fail since it doesn't find file2,v and it still gets
7350           # directory not empty errors removing cvsroot/first-dir.
7351           #
7352           # I'm not sure why I need to do this on $remotehost.  The rm above
7353           # rcslib-symlink-3j works fine, but the next one doesn't unless run
7354           # remotely under Cygwin and using a TESTDIR on a Samba share.
7355           if test -n "$remotehost"; then
7356             $CVS_RSH $remotehost "rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v"
7357           fi
7358           rm -rf ${CVSROOT_DIRNAME}/first-dir
7359           rm -r first-dir 2
7360           ;;
7361
7362         multibranch)
7363           # Test the ability to have several branchpoints coming off the
7364           # same revision.
7365           mkdir ${CVSROOT_DIRNAME}/first-dir
7366           dotest multibranch-1 "${testcvs} -q co first-dir" ''
7367           cd first-dir
7368           echo 1:trunk-1 >file1
7369           dotest multibranch-2 "${testcvs} add file1" \
7370 "${PROG}"' add: scheduling file `file1'\'' for addition
7371 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
7372           dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
7373 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7374 done
7375 Checking in file1;
7376 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7377 initial revision: 1.1
7378 done
7379 HERE
7380           dotest multibranch-4 "${testcvs} tag -b br1" \
7381 "${PROG} tag: Tagging \.
7382 T file1"
7383           dotest multibranch-5 "${testcvs} tag -b br2" \
7384 "${PROG} tag: Tagging \.
7385 T file1"
7386           dotest multibranch-6 "${testcvs} -q update -r br1" ''
7387           echo on-br1 >file1
7388           dotest multibranch-7 "${testcvs} -q ci -m modify-on-br1" \
7389 "Checking in file1;
7390 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7391 new revision: 1\.1\.2\.1; previous revision: 1\.1
7392 done"
7393           dotest multibranch-8 "${testcvs} -q update -r br2" '[UP] file1'
7394           echo br2 adds a line >>file1
7395           dotest multibranch-9 "${testcvs} -q ci -m modify-on-br2" \
7396 "Checking in file1;
7397 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7398 new revision: 1\.1\.4\.1; previous revision: 1\.1
7399 done"
7400           dotest multibranch-10 "${testcvs} -q update -r br1" '[UP] file1'
7401           dotest multibranch-11 "cat file1" 'on-br1'
7402           dotest multibranch-12 "${testcvs} -q update -r br2" '[UP] file1'
7403           dotest multibranch-13 "cat file1" '1:trunk-1
7404 br2 adds a line'
7405
7406           dotest multibranch-14 "${testcvs} log file1" \
7407 "
7408 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7409 Working file: file1
7410 head: 1\.1
7411 branch:
7412 locks: strict
7413 access list:
7414 symbolic names:
7415         br2: 1\.1\.0\.4
7416         br1: 1\.1\.0\.2
7417 keyword substitution: kv
7418 total revisions: 3;     selected revisions: 3
7419 description:
7420 ----------------------------
7421 revision 1\.1
7422 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7423 branches:  1\.1\.2;  1\.1\.4;
7424 add-it
7425 ----------------------------
7426 revision 1\.1\.4\.1
7427 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
7428 modify-on-br2
7429 ----------------------------
7430 revision 1\.1\.2\.1
7431 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
7432 modify-on-br1
7433 ============================================================================="
7434           cd ..
7435
7436           if $keep; then
7437             echo Keeping ${TESTDIR} and exiting due to --keep
7438             exit 0
7439           fi
7440
7441           rm -rf ${CVSROOT_DIRNAME}/first-dir
7442           rm -r first-dir
7443           ;;
7444
7445         import) # test death after import
7446                 # Tests of "cvs import":
7447                 # basic2
7448                 # rdiff  -- imports with keywords
7449                 # import  -- more tests of imports with keywords
7450                 # importb  -- -b option.
7451                 # importc -- bunch o' files in bunch o' directories
7452                 # modules3
7453                 # mflag -- various -m messages
7454                 # ignore  -- import and cvsignore
7455                 # binwrap -- import and -k wrappers
7456                 # info -- imports which are rejected by verifymsg
7457                 # head -- intended to test vendor branches and HEAD,
7458                 #   although it doesn't really do it yet.
7459                 # import-CVS -- refuse to import directories named "CVS".
7460
7461                 # import
7462                 mkdir import-dir ; cd import-dir
7463
7464                 for i in 1 2 3 4 ; do
7465                   echo imported file"$i" > imported-f"$i"
7466                 done
7467
7468                 # This directory should be on the default ignore list,
7469                 # so it shouldn't get imported.
7470                 mkdir RCS
7471                 echo ignore.me >RCS/ignore.me
7472
7473                 echo 'import should not expand $''Id$' >>imported-f2
7474                 cp imported-f2 ../imported-f2-orig.tmp
7475
7476                 dotest_sort import-96 \
7477 "${testcvs} import -m first-import first-dir vendor-branch junk-1_0" \
7478 "
7479
7480 I first-dir/RCS
7481 N first-dir/imported-f1
7482 N first-dir/imported-f2
7483 N first-dir/imported-f3
7484 N first-dir/imported-f4
7485 No conflicts created by this import"
7486
7487                 dotest import-96.5 "cmp ../imported-f2-orig.tmp imported-f2" ''
7488
7489                 cd ..
7490
7491                 # co
7492                 dotest import-97 "${testcvs} -q co first-dir" \
7493 "U first-dir/imported-f1
7494 U first-dir/imported-f2
7495 U first-dir/imported-f3
7496 U first-dir/imported-f4"
7497
7498                 cd first-dir
7499
7500                 for i in 1 2 3 4 ; do
7501                   dotest import-98-$i "test -f imported-f$i" ''
7502                 done
7503                 dotest_fail import-98.5 "test -d RCS" ''
7504
7505                 # remove
7506                 rm imported-f1
7507                 dotest import-99 "${testcvs} rm imported-f1" \
7508 "${PROG}"' remove: scheduling `imported-f1'\'' for removal
7509 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
7510
7511                 # change
7512                 echo local-change >> imported-f2
7513
7514                 # commit
7515                 dotest import-100 "${testcvs} ci -m local-changes" \
7516 "${PROG} [a-z]*: Examining .
7517 Removing imported-f1;
7518 ${CVSROOT_DIRNAME}/first-dir/imported-f1,v  <--  imported-f1
7519 new revision: delete; previous revision: 1\.1\.1\.1
7520 done
7521 Checking in imported-f2;
7522 ${CVSROOT_DIRNAME}/first-dir/imported-f2,v  <--  imported-f2
7523 new revision: 1\.2; previous revision: 1\.1
7524 done"
7525
7526                 # log
7527                 dotest import-101 "${testcvs} log imported-f1" \
7528 "
7529 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/imported-f1,v
7530 Working file: imported-f1
7531 head: 1\.2
7532 branch:
7533 locks: strict
7534 access list:
7535 symbolic names:
7536         junk-1_0: 1\.1\.1\.1
7537         vendor-branch: 1\.1\.1
7538 keyword substitution: kv
7539 total revisions: 3;     selected revisions: 3
7540 description:
7541 ----------------------------
7542 revision 1\.2
7543 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
7544 local-changes
7545 ----------------------------
7546 revision 1\.1
7547 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7548 branches:  1\.1\.1;
7549 Initial revision
7550 ----------------------------
7551 revision 1\.1\.1\.1
7552 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
7553 first-import
7554 ============================================================================="
7555
7556                 # update into the vendor branch.
7557                 dotest import-102 "${testcvs} update -rvendor-branch" \
7558 "${PROG} update: Updating .
7559 [UP] imported-f1
7560 [UP] imported-f2"
7561
7562                 # remove file4 on the vendor branch
7563                 rm imported-f4
7564                 dotest import-103 "${testcvs} rm imported-f4" \
7565 "${PROG}"' remove: scheduling `imported-f4'\'' for removal
7566 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
7567
7568                 # commit
7569                 dotest import-104 \
7570 "${testcvs} ci -m vendor-removed imported-f4" \
7571 "Removing imported-f4;
7572 ${CVSROOT_DIRNAME}/first-dir/imported-f4,v  <--  imported-f4
7573 new revision: delete; previous revision: 1\.1\.1\.1
7574 done"
7575
7576                 # update to main line
7577                 dotest import-105 "${testcvs} -q update -A" \
7578 "${PROG} update: imported-f1 is no longer in the repository
7579 [UP] imported-f2"
7580
7581                 # second import - file4 deliberately unchanged
7582                 cd ../import-dir
7583                 for i in 1 2 3 ; do
7584                   echo rev 2 of file $i >> imported-f"$i"
7585                 done
7586                 cp imported-f2 ../imported-f2-orig.tmp
7587
7588                 dotest_sort import-106 \
7589 "${testcvs} import -m second-import first-dir vendor-branch junk-2_0" \
7590 "
7591
7592
7593  ${PROG} checkout -j<prev_rel_tag> -jjunk-2_0 first-dir
7594 2 conflicts created by this import.
7595 C first-dir/imported-f1
7596 C first-dir/imported-f2
7597 I first-dir/RCS
7598 U first-dir/imported-f3
7599 U first-dir/imported-f4
7600 Use the following command to help the merge:"
7601
7602                 dotest import-106.5 "cmp ../imported-f2-orig.tmp imported-f2" \
7603 ''
7604
7605                 cd ..
7606
7607                 rm imported-f2-orig.tmp
7608
7609                 # co
7610                 dotest import-107 "${testcvs} co first-dir" \
7611 "${PROG} checkout: Updating first-dir
7612 [UP] first-dir/imported-f3
7613 [UP] first-dir/imported-f4"
7614
7615                 cd first-dir
7616
7617                 dotest_fail import-108 "test -f imported-f1" ''
7618
7619                 for i in 2 3 ; do
7620                   dotest import-109-$i "test -f imported-f$i" ''
7621                 done
7622
7623                 # check vendor branch for file4
7624                 dotest import-110 "${testcvs} -q update -rvendor-branch" \
7625 "[UP] imported-f1
7626 [UP] imported-f2"
7627
7628                 dotest import-111 "test -f imported-f4" ''
7629
7630                 # update to main line
7631                 dotest import-112 "${testcvs} -q update -A" \
7632 "${PROG} update: imported-f1 is no longer in the repository
7633 [UP] imported-f2"
7634
7635                 cd ..
7636
7637                 dotest import-113 \
7638 "${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
7639 "${PROG} checkout: file first-dir/imported-f1 does not exist, but is present in revision junk-2_0
7640 RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f2,v
7641 retrieving revision 1\.1\.1\.1
7642 retrieving revision 1\.1\.1\.2
7643 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
7644 rcsmerge: warning: conflicts during merge
7645 first-dir/imported-f3 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.2
7646 first-dir/imported-f4 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.3"
7647
7648                 cd first-dir
7649
7650                 dotest_fail import-114 "test -f imported-f1" ''
7651
7652                 for i in 2 3 ; do
7653                   dotest import-115-$i "test -f imported-f$i" ''
7654                 done
7655
7656                 dotest import-116 'cat imported-f2' \
7657 'imported file2
7658 [<]<<<<<< imported-f2
7659 import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
7660 local-change
7661 [=]======
7662 import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
7663 rev 2 of file 2
7664 [>]>>>>>> 1\.1\.1\.2'
7665
7666                 cd ..
7667                 rm -r first-dir
7668                 rm -rf ${CVSROOT_DIRNAME}/first-dir
7669                 rm -r import-dir
7670                 ;;
7671
7672         importb)
7673           # More cvs import tests, especially -b option.
7674
7675           # OK, first we get some sources from the NetMunger project, and
7676           # import them into the 1.1.1 vendor branch.
7677           mkdir imp-dir
7678           cd imp-dir
7679           echo 'OpenMunger sources' >file1
7680           echo 'OpenMunger sources' >file2
7681           dotest_sort importb-1 \
7682 "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
7683 "
7684
7685 N first-dir/file1
7686 N first-dir/file2
7687 No conflicts created by this import"
7688           cd ..
7689           rm -r imp-dir
7690
7691           # Now we put the sources we get from FreeMunger into 1.1.3
7692           mkdir imp-dir
7693           cd imp-dir
7694           echo 'FreeMunger sources' >file1
7695           echo 'FreeMunger sources' >file2
7696           # Not completely sure how the conflict detection is supposed to
7697           # be working here (haven't really thought about it).
7698           # We use an explicit -d option to test that it is reflected
7699           # in the suggested checkout.
7700           dotest_sort importb-2 \
7701 "${testcvs} -d ${CVSROOT} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
7702 "
7703
7704
7705  ${PROG} -d ${CVSROOT} checkout -j<prev_rel_tag> -jfreemunger-1_0 first-dir
7706 2 conflicts created by this import.
7707 C first-dir/file1
7708 C first-dir/file2
7709 Use the following command to help the merge:"
7710           cd ..
7711           rm -r imp-dir
7712
7713           # Now a test of main branch import (into second-dir, not first-dir).
7714           mkdir imp-dir
7715           cd imp-dir
7716           echo 'my own stuff' >mine1.c
7717           echo 'my own stuff' >mine2.c
7718           dotest_fail importb-3 \
7719 "${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
7720 "${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1"
7721           : when we implement main-branch import, should be \
7722 "N second-dir/mine1\.c
7723 N second-dir/mine2\.c
7724
7725 No conflicts created by this import"
7726           cd ..
7727           rm -r imp-dir
7728
7729           mkdir 1
7730           cd 1
7731           # when we implement main branch import, will want to 
7732           # add "second-dir" here.
7733           dotest importb-4 "${testcvs} -q co first-dir" \
7734 "U first-dir/file1
7735 U first-dir/file2"
7736           cd first-dir
7737           dotest importb-5 "${testcvs} -q log file1" "
7738 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7739 Working file: file1
7740 head: 1\.1
7741 branch: 1\.1\.1
7742 locks: strict
7743 access list:
7744 symbolic names:
7745         freemunger-1_0: 1\.1\.3\.1
7746         freemunger: 1\.1\.3
7747         openmunger-1_0: 1\.1\.1\.1
7748         openmunger: 1\.1\.1
7749 keyword substitution: kv
7750 total revisions: 3;     selected revisions: 3
7751 description:
7752 ----------------------------
7753 revision 1\.1
7754 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7755 branches:  1\.1\.1;  1\.1\.3;
7756 Initial revision
7757 ----------------------------
7758 revision 1\.1\.3\.1
7759 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
7760 add
7761 ----------------------------
7762 revision 1\.1\.1\.1
7763 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
7764 add
7765 ============================================================================="
7766
7767           cd ../..
7768           rm -r 1
7769           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
7770           ;;
7771
7772         importc)
7773           # Test importing a bunch o' files in a bunch o' directories.
7774           # Also the -d option.
7775           mkdir 1; cd 1
7776           mkdir adir bdir cdir
7777           mkdir adir/sub1 adir/sub2
7778           mkdir adir/sub1/ssdir
7779           mkdir bdir/subdir
7780           touch adir/sub1/file1 adir/sub2/file2 adir/sub1/ssdir/ssfile
7781           touch -t 197107040343 bdir/subdir/file1
7782           touch -t 203412251801 cdir/cfile
7783           dotest_sort importc-1 \
7784 "${testcvs} import -d -m import-it first-dir vendor release" \
7785 "
7786
7787 N first-dir/adir/sub1/file1
7788 N first-dir/adir/sub1/ssdir/ssfile
7789 N first-dir/adir/sub2/file2
7790 N first-dir/bdir/subdir/file1
7791 N first-dir/cdir/cfile
7792 No conflicts created by this import
7793 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir
7794 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1
7795 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1/ssdir
7796 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub2
7797 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir
7798 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir/subdir
7799 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/cdir"
7800           cd ..
7801           mkdir 2; cd 2
7802           dotest importc-2 "${testcvs} -q co first-dir" \
7803 "U first-dir/adir/sub1/file1
7804 U first-dir/adir/sub1/ssdir/ssfile
7805 U first-dir/adir/sub2/file2
7806 U first-dir/bdir/subdir/file1
7807 U first-dir/cdir/cfile"
7808           cd first-dir
7809           dotest importc-3 "${testcvs} update adir/sub1" \
7810 "${PROG} update: Updating adir/sub1
7811 ${PROG} update: Updating adir/sub1/ssdir"
7812           dotest importc-4 "${testcvs} update adir/sub1 bdir/subdir" \
7813 "${PROG} update: Updating adir/sub1
7814 ${PROG} update: Updating adir/sub1/ssdir
7815 ${PROG} update: Updating bdir/subdir"
7816
7817           echo modify >>cdir/cfile
7818           dotest importc-5 \
7819 "${testcvs} -q rtag -b -r release wip_test first-dir" ""
7820           dotest importc-6 "${testcvs} -q update -r wip_test" "M cdir/cfile"
7821
7822           # This used to fail in local mode
7823           dotest importc-7 "${testcvs} -q ci -m modify -r wip_test" \
7824 "Checking in cdir/cfile;
7825 ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v  <--  cfile
7826 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
7827 done"
7828
7829           # TODO: should also be testing "import -d" when we update
7830           # an existing file.
7831           dotest importc-8 "${testcvs} -q log cdir/cfile" "
7832 RCS file: ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v
7833 Working file: cdir/cfile
7834 head: 1\.1
7835 branch: 1\.1\.1
7836 locks: strict
7837 access list:
7838 symbolic names:
7839         wip_test: 1\.1\.1\.1\.0\.2
7840         release: 1\.1\.1\.1
7841         vendor: 1\.1\.1
7842 keyword substitution: kv
7843 total revisions: 3;     selected revisions: 3
7844 description:
7845 ----------------------------
7846 revision 1\.1
7847 date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;
7848 branches:  1\.1\.1;
7849 Initial revision
7850 ----------------------------
7851 revision 1\.1\.1\.1
7852 date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
7853 branches:  1\.1\.1\.1\.2;
7854 import-it
7855 ----------------------------
7856 revision 1\.1\.1\.1\.2\.1
7857 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
7858 modify
7859 ============================================================================="
7860
7861           dotest importc-9 "${testcvs} -q log bdir/subdir/file1" "
7862 RCS file: ${CVSROOT_DIRNAME}/first-dir/bdir/subdir/file1,v
7863 Working file: bdir/subdir/file1
7864 head: 1\.1
7865 branch: 1\.1\.1
7866 locks: strict
7867 access list:
7868 symbolic names:
7869         wip_test: 1\.1\.1\.1\.0\.2
7870         release: 1\.1\.1\.1
7871         vendor: 1\.1\.1
7872 keyword substitution: kv
7873 total revisions: 2;     selected revisions: 2
7874 description:
7875 ----------------------------
7876 revision 1\.1
7877 date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;
7878 branches:  1\.1\.1;
7879 Initial revision
7880 ----------------------------
7881 revision 1\.1\.1\.1
7882 date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
7883 import-it
7884 ============================================================================="
7885           cd ..
7886
7887           # Now tests of absolute pathnames and .. as repository directory.
7888           cd ../1
7889           dotest_fail importc-10 \
7890 "${testcvs} import -m imp ../other vendor release2" \
7891 "${PROG} \[[a-z]* aborted\]: directory \.\./other not relative within the repository"
7892           dotest_fail importc-11 \
7893 "${testcvs} import -m imp ${TESTDIR}/other vendor release3" \
7894 "${PROG} \[[a-z]* aborted\]: directory ${TESTDIR}/other not relative within the repository"
7895           dotest_fail importc-12 "test -d ${TESTDIR}/other" ""
7896           cd ..
7897
7898           rm -r 1 2
7899           rm -rf ${CVSROOT_DIRNAME}/first-dir
7900           ;;
7901
7902         import-CVS)
7903           mkdir import-CVS
7904           cd import-CVS
7905           touch file1 file2 file3
7906           dotest_fail import-CVS-1 "$testcvs import CVS vtag rtag" \
7907 "$PROG import: The word \`CVS' is reserved by CVS and may not be used
7908 $PROG \[import aborted\]: as a directory in a path or as a file name\."
7909           mkdir sdir
7910           mkdir sdir/CVS
7911           touch sdir/CVS/file4 sdir/CVS/file5 sdir/file6 sdir/file7
7912           # Calling the imported directory import-CVS is dual purpose in the
7913           # following test.  It makes sure the path test which matched above
7914           # wasn't too strict.
7915           dotest_sort import-CVS-2 \
7916 "$testcvs import -I! -mimport import-CVS vtag rtag" \
7917 "
7918
7919 I import-CVS/sdir/CVS
7920 N import-CVS/file1
7921 N import-CVS/file2
7922 N import-CVS/file3
7923 N import-CVS/sdir/file6
7924 N import-CVS/sdir/file7
7925 No conflicts created by this import
7926 $PROG import: Importing $CVSROOT_DIRNAME/import-CVS/sdir"
7927
7928           if $keep; then
7929             echo Keeping ${TESTDIR} and exiting due to --keep
7930             exit 0
7931           fi
7932
7933           cd ..
7934           rm -r import-CVS
7935           rm -rf $CVSROOT_DIRNAME/import-CVS
7936           ;;
7937
7938         import-after-initial)
7939           # Properly handle the case in which the first version of a
7940           # file is created by a regular cvs add and commit, and there
7941           # is a subsequent cvs import of the same file.  cvs update with
7942           # a date tag must resort to searching the vendor branch only if
7943           # the initial version of the file was created at the same time
7944           # as the initial version on the vendor branch.
7945
7946           mkdir 1; cd 1
7947           module=x
7948
7949           echo > unused-file
7950
7951           # Create the module.
7952           dotest import-after-initial-1 \
7953             "$testcvs -Q import -m. $module X Y" ''
7954
7955           file=m
7956           # Check it out and add a file.
7957           dotest import-after-initial-2 "$testcvs -Q co $module" ''
7958           cd $module
7959           echo original > $file
7960           dotest import-after-initial-3 "${testcvs} -Q add $file" ""
7961           dotest import-after-initial-4 "${testcvs} -Q ci -m. $file" \
7962 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
7963 done
7964 Checking in $file;
7965 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
7966 initial revision: 1\.1
7967 done"
7968
7969           # Delay a little so the following import isn't done in the same
7970           # second as the preceding commit.
7971           sleep 2
7972
7973           # Do the first import of $file *after* $file already has an
7974           # initial version.
7975           mkdir sub
7976           cd sub
7977           echo newer-via-import > $file
7978           dotest import-after-initial-5 \
7979             "$testcvs -Q import -m. $module X Y2" ''
7980           cd ..
7981
7982           # Sleep a second so we're sure to be after the second of the import.
7983           sleep 1
7984
7985           dotest import-after-initial-6 \
7986             "$testcvs -Q update -p -D now $file" 'original'
7987
7988           cd ../..
7989           rm -rf 1
7990           rm -rf ${CVSROOT_DIRNAME}/$module
7991           ;;
7992
7993         branch-after-import)
7994           # Test branching after an import via both cvs tag -b and
7995           # cvs add to verify that the HEAD remains at 1.1.1.1
7996           # This was a FreeBSD bug documented at the URL:
7997           # http://www.freebsd.org/cgi/query-pr.cgi?pr=4033
7998
7999           mkdir branch-after-import
8000           cd branch-after-import
8001
8002           # OK, first we get some sources from the NetMunger project,
8003           # and import them into the 1.1.1 vendor branch.
8004           mkdir imp-dir
8005           cd imp-dir
8006           echo 'OpenMunger sources' >file1
8007           echo 'OpenMunger sources' >file2
8008           dotest_sort branch-after-import-1 \
8009 "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
8010 '
8011
8012 N first-dir/file1
8013 N first-dir/file2
8014 No conflicts created by this import'
8015           cd ..
8016
8017           # Next checkout the new module
8018           dotest branch-after-import-2 \
8019 "${testcvs} -q co first-dir" \
8020 'U first-dir/file1
8021 U first-dir/file2'
8022           cd first-dir
8023           # Branch tag the file1 and cvs add file2,
8024           # the branch should remain the same in both cases
8025           # such that a new import will not require a conflict
8026           # resolution.
8027           dotest branch-after-import-3 \
8028 "${testcvs} tag -b TESTTOTRON file1" \
8029 'T file1'
8030           dotest branch-after-import-4 \
8031 "${testcvs} -q update -r TESTTOTRON" \
8032 "${PROG} update: file2 is no longer in the repository"
8033
8034           cp ../imp-dir/file2 .
8035           dotest branch-after-import-5 \
8036 "${testcvs} add file2" \
8037 "${PROG} add: scheduling file .file2. for addition on branch .TESTTOTRON.
8038 ${PROG} add: use .${PROG} commit. to add this file permanently"
8039
8040           dotest branch-after-import-6 \
8041 "${testcvs} commit -m cvs-add file2" \
8042 "Checking in file2;
8043 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8044 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
8045 done"
8046
8047           if $keep; then
8048             echo Keeping ${TESTDIR} and exiting due to --keep
8049             exit 0
8050           fi
8051
8052           cd ../..
8053           rm -r branch-after-import
8054           rm -rf ${CVSROOT_DIRNAME}/first-dir
8055           ;;
8056
8057         join)
8058           # Test doing joins which involve adding and removing files.
8059           #   Variety of scenarios (see list below), in the context of:
8060           #     * merge changes from T1 to T2 into the main line
8061           #     * merge changes from branch 'branch' into the main line
8062           #     * merge changes from branch 'branch' into branch 'br2'.
8063           # See also binfile2, which does similar things with binary files.
8064           # See also join2, which tests joining (and update -A) on only
8065           # a single file, rather than a directory.
8066           # See also rmadd2, which tests -j cases not involving branches
8067           #   (e.g. undoing a commit)
8068           # See also join3, which tests some cases involving the greatest
8069           # common ancestor.  Here is a list of tests according to branch
8070           # topology:
8071           #
8072           # --->bp---->trunk          too many to mention
8073           #     \----->branch
8074           #
8075           #     /----->branch1
8076           # --->bp---->trunk          multibranch, multibranch2
8077           #     \----->branch2
8078           #
8079           # --->bp1----->bp2---->trunk   join3
8080           #     \->br1   \->br2
8081           #
8082           # --->bp1----->trunk
8083           #     \----bp2---->branch                branches
8084           #          \------>branch-of-branch
8085
8086           # We check merging changes from T1 to T2 into the main line.
8087           # Here are the interesting cases I can think of:
8088           #   1) File added between T1 and T2, not on main line.
8089           #      File should be marked for addition.
8090           #   2) File added between T1 and T2, also added on main line.
8091           #      Conflict.
8092           #   3) File removed between T1 and T2, unchanged on main line.
8093           #      File should be marked for removal.
8094           #   4) File removed between T1 and T2, modified on main line.
8095           #      If mod checked in, file should be marked for removal.
8096           #      If mod still in working directory, conflict.
8097           #   5) File removed between T1 and T2, was never on main line.
8098           #      Nothing should happen.
8099           #   6) File removed between T1 and T2, also removed on main line.
8100           #      Nothing should happen.
8101           #   7) File not added between T1 and T2, added on main line.
8102           #      Nothing should happen.
8103           #   8) File not modified between T1 and T2, removed on main line.
8104           #      Nothing should happen.
8105           #   9) File modified between T1 and T2, removed on main line.
8106           #      Conflict.
8107           #  10) File was never on branch, removed on main line.
8108           #      Nothing should happen.
8109
8110           # We also check merging changes from a branch into the main
8111           # line.  Here are the interesting cases:
8112           #   1) File added on branch, not on main line.
8113           #      File should be marked for addition.
8114           #   2) File added on branch, also added on main line.
8115           #      Conflict.
8116           #   3) File removed on branch, unchanged on main line.
8117           #      File should be marked for removal.
8118           #   4) File removed on branch, modified on main line.
8119           #      Conflict.
8120           #   5) File removed on branch, was never on main line.
8121           #      Nothing should happen.
8122           #   6) File removed on branch, also removed on main line.
8123           #      Nothing should happen.
8124           #   7) File added on main line, not added on branch.
8125           #      Nothing should happen.
8126           #   8) File removed on main line, not modified on branch.
8127           #      Nothing should happen.
8128           #   9) File modified on branch, removed on main line.
8129           #      Conflict.
8130           #  10) File was never on branch, removed on main line.
8131           #      Nothing should happen.
8132
8133           # In the tests below, fileN represents case N in the above
8134           # lists.
8135
8136           mkdir ${CVSROOT_DIRNAME}/first-dir
8137           mkdir 1
8138           cd 1
8139           dotest join-1 "${testcvs} -q co first-dir" ''
8140
8141           cd first-dir
8142
8143           # Add two files.
8144           echo 'first revision of file3' > file3
8145           echo 'first revision of file4' > file4
8146           echo 'first revision of file6' > file6
8147           echo 'first revision of file8' > file8
8148           echo 'first revision of file9' > file9
8149           dotest join-2 "${testcvs} add file3 file4 file6 file8 file9" \
8150 "${PROG}"' add: scheduling file `file3'\'' for addition
8151 '"${PROG}"' add: scheduling file `file4'\'' for addition
8152 '"${PROG}"' add: scheduling file `file6'\'' for addition
8153 '"${PROG}"' add: scheduling file `file8'\'' for addition
8154 '"${PROG}"' add: scheduling file `file9'\'' for addition
8155 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
8156
8157           dotest join-3 "${testcvs} -q commit -m add" \
8158 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
8159 done
8160 Checking in file3;
8161 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
8162 initial revision: 1\.1
8163 done
8164 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
8165 done
8166 Checking in file4;
8167 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8168 initial revision: 1\.1
8169 done
8170 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
8171 done
8172 Checking in file6;
8173 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
8174 initial revision: 1\.1
8175 done
8176 RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
8177 done
8178 Checking in file8;
8179 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
8180 initial revision: 1\.1
8181 done
8182 RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
8183 done
8184 Checking in file9;
8185 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
8186 initial revision: 1\.1
8187 done"
8188
8189           # Make a branch.
8190           dotest join-4 "${testcvs} -q tag -b branch ." \
8191 'T file3
8192 T file4
8193 T file6
8194 T file8
8195 T file9'
8196
8197           # Add file2, file7, and file10, modify file4, and remove
8198           # file6, file8, and file9.
8199           echo 'first revision of file2' > file2
8200           echo 'second revision of file4' > file4
8201           echo 'first revision of file7' > file7
8202           rm file6 file8 file9
8203           echo 'first revision of file10' > file10
8204           dotest join-5 "${testcvs} add file2 file7 file10" \
8205 "${PROG}"' add: scheduling file `file2'\'' for addition
8206 '"${PROG}"' add: scheduling file `file7'\'' for addition
8207 '"${PROG}"' add: scheduling file `file10'\'' for addition
8208 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
8209           dotest join-6 "${testcvs} rm file6 file8 file9" \
8210 "${PROG}"' remove: scheduling `file6'\'' for removal
8211 '"${PROG}"' remove: scheduling `file8'\'' for removal
8212 '"${PROG}"' remove: scheduling `file9'\'' for removal
8213 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
8214           dotest join-7 "${testcvs} -q ci -mx ." \
8215 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
8216 done
8217 Checking in file10;
8218 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
8219 initial revision: 1\.1
8220 done
8221 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8222 done
8223 Checking in file2;
8224 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8225 initial revision: 1\.1
8226 done
8227 Checking in file4;
8228 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8229 new revision: 1\.2; previous revision: 1\.1
8230 done
8231 Removing file6;
8232 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
8233 new revision: delete; previous revision: 1\.1
8234 done
8235 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
8236 done
8237 Checking in file7;
8238 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
8239 initial revision: 1\.1
8240 done
8241 Removing file8;
8242 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
8243 new revision: delete; previous revision: 1\.1
8244 done
8245 Removing file9;
8246 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
8247 new revision: delete; previous revision: 1\.1
8248 done"
8249
8250           # Remove file10
8251           dotest join-7a "${testcvs} rm -f file10" \
8252 "${PROG}"' remove: scheduling `file10'\'' for removal
8253 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
8254           dotest join-7b "${testcvs} -q ci -mx ." \
8255 "Removing file10;
8256 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
8257 new revision: delete; previous revision: 1\.1
8258 done"
8259
8260           # Check out the branch.
8261           cd ../..
8262           mkdir 2
8263           cd 2
8264           dotest join-8 "${testcvs} -q co -r branch first-dir" \
8265 'U first-dir/file3
8266 U first-dir/file4
8267 U first-dir/file6
8268 U first-dir/file8
8269 U first-dir/file9'
8270
8271           cd first-dir
8272
8273           # Modify the files on the branch, so that T1 is not an
8274           # ancestor of the main line, and add file5
8275           echo 'first branch revision of file3' > file3
8276           echo 'first branch revision of file4' > file4
8277           echo 'first branch revision of file5' > file5
8278           echo 'first branch revision of file6' > file6
8279           echo 'first branch revision of file9' > file9
8280           dotest join-9 "${testcvs} add file5" \
8281 "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
8282 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
8283           dotest join-10 "${testcvs} -q ci -mx ." \
8284 "Checking in file3;
8285 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
8286 new revision: 1\.1\.2\.1; previous revision: 1\.1
8287 done
8288 Checking in file4;
8289 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8290 new revision: 1\.1\.2\.1; previous revision: 1\.1
8291 done
8292 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
8293 done
8294 Checking in file5;
8295 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
8296 new revision: 1\.1\.2\.1; previous revision: 1\.1
8297 done
8298 Checking in file6;
8299 ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
8300 new revision: 1\.1\.2\.1; previous revision: 1\.1
8301 done
8302 Checking in file9;
8303 ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
8304 new revision: 1\.1\.2\.1; previous revision: 1\.1
8305 done"
8306
8307           # Tag the current revisions on the branch.
8308           dotest join-11 "${testcvs} -q tag T1 ." \
8309 'T file3
8310 T file4
8311 T file5
8312 T file6
8313 T file8
8314 T file9'
8315
8316           # Add file1 and file2, modify file9, and remove the other files.
8317           echo 'first branch revision of file1' > file1
8318           echo 'first branch revision of file2' > file2
8319           echo 'second branch revision of file9' > file9
8320           rm file3 file4 file5 file6
8321           dotest join-12 "${testcvs} add file1 file2" \
8322 "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
8323 '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
8324 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
8325           dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
8326 "${PROG}"' remove: scheduling `file3'\'' for removal
8327 '"${PROG}"' remove: scheduling `file4'\'' for removal
8328 '"${PROG}"' remove: scheduling `file5'\'' for removal
8329 '"${PROG}"' remove: scheduling `file6'\'' for removal
8330 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
8331           dotest join-14 "${testcvs} -q ci -mx ." \
8332 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
8333 done
8334 Checking in file1;
8335 ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
8336 new revision: 1\.1\.2\.1; previous revision: 1\.1
8337 done
8338 Checking in file2;
8339 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8340 new revision: 1\.1\.2\.1; previous revision: 1\.1
8341 done
8342 Removing file3;
8343 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
8344 new revision: delete; previous revision: 1\.1\.2\.1
8345 done
8346 Removing file4;
8347 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8348 new revision: delete; previous revision: 1\.1\.2\.1
8349 done
8350 Removing file5;
8351 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
8352 new revision: delete; previous revision: 1\.1\.2\.1
8353 done
8354 Removing file6;
8355 ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
8356 new revision: delete; previous revision: 1\.1\.2\.1
8357 done
8358 Checking in file9;
8359 ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
8360 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
8361 done"
8362
8363           # Tag the current revisions on the branch.
8364           dotest join-15 "${testcvs} -q tag T2 ." \
8365 'T file1
8366 T file2
8367 T file8
8368 T file9'
8369
8370           # Do a checkout with a merge.
8371           cd ../..
8372           mkdir 3
8373           cd 3
8374           dotest join-16 "${testcvs} -q co -jT1 -jT2 first-dir" \
8375 'U first-dir/file1
8376 U first-dir/file2
8377 '"${PROG}"' checkout: file first-dir/file2 exists, but has been added in revision T2
8378 U first-dir/file3
8379 '"${PROG}"' checkout: scheduling first-dir/file3 for removal
8380 U first-dir/file4
8381 '"${PROG}"' checkout: scheduling first-dir/file4 for removal
8382 U first-dir/file7
8383 '"${PROG}"' checkout: file first-dir/file9 does not exist, but is present in revision T2'
8384
8385           # Verify that the right changes have been scheduled.
8386           cd first-dir
8387           dotest join-17 "${testcvs} -q update" \
8388 'A file1
8389 R file3
8390 R file4'
8391
8392           # Modify file4 locally, and do an update with a merge.
8393           cd ../../1/first-dir
8394           echo 'third revision of file4' > file4
8395           dotest join-18 "${testcvs} -q update -jT1 -jT2 ." \
8396 'U file1
8397 '"${PROG}"' update: file file2 exists, but has been added in revision T2
8398 '"${PROG}"' update: scheduling file3 for removal
8399 M file4
8400 '"${PROG}"' update: file file4 is locally modified, but has been removed in revision T2
8401 '"${PROG}"' update: file file9 does not exist, but is present in revision T2'
8402
8403           # Verify that the right changes have been scheduled.
8404           dotest join-19 "${testcvs} -q update" \
8405 'A file1
8406 R file3
8407 M file4'
8408
8409           # Do a checkout with a merge from a single revision.
8410
8411           # FIXME: CVS currently gets this wrong.  file2 has been
8412           # added on both the branch and the main line, and so should
8413           # be regarded as a conflict.  However, given the way that
8414           # CVS sets up the RCS file, there is no way to distinguish
8415           # this case from the case of file2 having existed before the
8416           # branch was made.  This could be fixed by reserving
8417           # a revision somewhere, perhaps 1.1, as an always dead
8418           # revision which can be used as the source for files added
8419           # on branches.
8420           cd ../../3
8421           rm -r first-dir
8422           dotest join-20 "${testcvs} -q co -jbranch first-dir" \
8423 "U first-dir/file1
8424 U first-dir/file2
8425 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8426 retrieving revision 1\.1
8427 retrieving revision 1\.1\.2\.1
8428 Merging differences between 1\.1 and 1\.1\.2\.1 into file2
8429 U first-dir/file3
8430 ${PROG} checkout: scheduling first-dir/file3 for removal
8431 U first-dir/file4
8432 ${PROG} checkout: file first-dir/file4 has been modified, but has been removed in revision branch
8433 U first-dir/file7
8434 ${PROG} checkout: file first-dir/file9 does not exist, but is present in revision branch"
8435
8436           # Verify that the right changes have been scheduled.
8437           # The M file2 line is a bug; see above join-20.
8438           cd first-dir
8439           dotest join-21 "${testcvs} -q update" \
8440 'A file1
8441 M file2
8442 R file3'
8443
8444           # Checkout the main line again.
8445           cd ../../1
8446           rm -r first-dir
8447           dotest join-22 "${testcvs} -q co first-dir" \
8448 'U first-dir/file2
8449 U first-dir/file3
8450 U first-dir/file4
8451 U first-dir/file7'
8452
8453           # Modify file4 locally, and do an update with a merge from a
8454           # single revision.
8455           # The file2 handling is a bug; see above join-20.
8456           cd first-dir
8457           echo 'third revision of file4' > file4
8458           dotest join-23 "${testcvs} -q update -jbranch ." \
8459 "U file1
8460 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8461 retrieving revision 1\.1
8462 retrieving revision 1\.1\.2\.1
8463 Merging differences between 1\.1 and 1\.1\.2\.1 into file2
8464 ${PROG} update: scheduling file3 for removal
8465 M file4
8466 ${PROG} update: file file4 is locally modified, but has been removed in revision branch
8467 ${PROG} update: file file9 does not exist, but is present in revision branch"
8468
8469           # Verify that the right changes have been scheduled.
8470           # The M file2 line is a bug; see above join-20
8471           dotest join-24 "${testcvs} -q update" \
8472 'A file1
8473 M file2
8474 R file3
8475 M file4'
8476
8477           cd ..
8478
8479           # Checkout the main line again and make a new branch which we
8480           # merge to.
8481           rm -r first-dir
8482           dotest join-25 "${testcvs} -q co first-dir" \
8483 'U first-dir/file2
8484 U first-dir/file3
8485 U first-dir/file4
8486 U first-dir/file7'
8487           cd first-dir
8488           dotest join-26 "${testcvs} -q tag -b br2" \
8489 "T file2
8490 T file3
8491 T file4
8492 T file7"
8493           dotest join-27 "${testcvs} -q update -r br2" ""
8494           # The handling of file8 and file9 here look fishy to me.  I don't
8495           # see why it should be different from the case where we merge to
8496           # the trunk (e.g. join-23).
8497           dotest join-28 "${testcvs} -q update -j branch" \
8498 "U file1
8499 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8500 retrieving revision 1.1
8501 retrieving revision 1.1.2.1
8502 Merging differences between 1.1 and 1.1.2.1 into file2
8503 ${PROG} update: scheduling file3 for removal
8504 ${PROG} update: file file4 has been modified, but has been removed in revision branch
8505 U file8
8506 U file9"
8507           # Verify that the right changes have been scheduled.
8508           dotest join-29 "${testcvs} -q update" \
8509 "A file1
8510 M file2
8511 R file3
8512 A file8
8513 A file9"
8514
8515           # Checkout the mainline again to try updating and merging between two
8516           # branches in the same step
8517           # this seems a likely scenario - the user finishes up on branch and
8518           # updates to br2 and merges in the same step - and there was a bug
8519           # once that if the file was removed in the update then it wouldn't be
8520           # readded in the merge
8521           cd ..
8522           rm -r first-dir
8523           dotest join-twobranch-1 "${testcvs} -q co -rbranch first-dir" \
8524 'U first-dir/file1
8525 U first-dir/file2
8526 U first-dir/file8
8527 U first-dir/file9'
8528           cd first-dir
8529           dotest join-twobranch-2 "${testcvs} -q update -rbr2 -jbranch" \
8530 "${PROG} update: file1 is no longer in the repository
8531 U file1
8532 U file2
8533 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8534 retrieving revision 1\.1
8535 retrieving revision 1\.1\.2\.1
8536 Merging differences between 1\.1 and 1\.1\.2\.1 into file2
8537 U file3
8538 ${PROG} update: scheduling file3 for removal
8539 U file4
8540 ${PROG} update: file file4 has been modified, but has been removed in revision branch
8541 U file7
8542 ${PROG} update: file8 is no longer in the repository
8543 U file8
8544 ${PROG} update: file9 is no longer in the repository
8545 U file9"
8546           # Verify that the right changes have been scheduled.
8547           dotest join-twobranch-3 "${testcvs} -q update" \
8548 "A file1
8549 M file2
8550 R file3
8551 A file8
8552 A file9"
8553
8554           # Checkout the mainline again to try merging from the trunk
8555           # to a branch.
8556           cd ..
8557           rm -r first-dir
8558           dotest join-30 "${testcvs} -q co first-dir" \
8559 'U first-dir/file2
8560 U first-dir/file3
8561 U first-dir/file4
8562 U first-dir/file7'
8563           cd first-dir
8564
8565           # Tag the current revisions on the trunk.
8566           dotest join-31 "${testcvs} -q tag T3 ." \
8567 'T file2
8568 T file3
8569 T file4
8570 T file7'
8571
8572           # Modify file7.
8573           echo 'second revision of file7' > file7
8574           dotest join-32 "${testcvs} -q ci -mx ." \
8575 "Checking in file7;
8576 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
8577 new revision: 1\.2; previous revision: 1\.1
8578 done"
8579
8580           # And Tag again.
8581           dotest join-33 "${testcvs} -q tag T4 ." \
8582 'T file2
8583 T file3
8584 T file4
8585 T file7'
8586
8587           # Now update branch to T3.
8588           cd ../../2/first-dir
8589           dotest join-34 "${testcvs} -q up -jT3" \
8590 "${PROG} update: file file4 does not exist, but is present in revision T3
8591 U file7"
8592
8593           # Verify that the right changes have been scheduled.
8594           dotest join-35 "${testcvs} -q update" \
8595 'A file7'
8596
8597           # Now update to T4.
8598           # This is probably a bug, although in this particular case it just
8599           # happens to do the right thing; see above join-20.
8600           dotest join-36 "${testcvs} -q up -j T3 -j T4" \
8601 "A file7
8602 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
8603 retrieving revision 1\.1
8604 retrieving revision 1\.2
8605 Merging differences between 1\.1 and 1\.2 into file7"
8606
8607           # Verify that the right changes have been scheduled.
8608           dotest join-37 "${testcvs} -q update" \
8609 'A file7'
8610
8611           cd ../..
8612
8613           rm -r 1 2 3
8614           rm -rf ${CVSROOT_DIRNAME}/first-dir
8615           ;;
8616
8617         join2)
8618           # More joining tests.
8619
8620           # First the usual setup; create a directory first-dir, a file
8621           # first-dir/file1, and a branch br1.
8622           mkdir 1; cd 1
8623           dotest join2-1 "${testcvs} -q co -l ." ''
8624           mkdir first-dir
8625           dotest join2-2 "${testcvs} add first-dir" \
8626 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
8627           cd first-dir
8628           echo 'initial contents of file1' >file1
8629           dotest join2-3 "${testcvs} add file1" \
8630 "${PROG} add: scheduling file .file1. for addition
8631 ${PROG} add: use .${PROG} commit. to add this file permanently"
8632           dotest join2-4 "${testcvs} -q ci -m add" \
8633 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8634 done
8635 Checking in file1;
8636 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8637 initial revision: 1\.1
8638 done"
8639           dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
8640           dotest join2-6 "${testcvs} -q update -r br1" ""
8641           echo 'modify on branch' >>file1
8642           touch bradd
8643           dotest join2-6a "${testcvs} add bradd" \
8644 "${PROG} add: scheduling file .bradd. for addition on branch .br1.
8645 ${PROG} add: use .${PROG} commit. to add this file permanently"
8646           dotest join2-7 "${testcvs} -q ci -m modify" \
8647 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
8648 done
8649 Checking in bradd;
8650 ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v  <--  bradd
8651 new revision: 1\.1\.2\.1; previous revision: 1\.1
8652 done
8653 Checking in file1;
8654 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8655 new revision: 1\.1\.2\.1; previous revision: 1\.1
8656 done"
8657
8658           # Here is the unusual/pathological part.  We switch back to
8659           # the trunk *for file1 only*, not for the whole directory.
8660           dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
8661           dotest join2-9 "${testcvs} -q status file1" \
8662 "===================================================================
8663 File: file1             Status: Up-to-date
8664
8665    Working revision:    1\.1.*
8666    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
8667    Sticky Tag:          (none)
8668    Sticky Date:         (none)
8669    Sticky Options:      (none)"
8670           dotest join2-10 "cat CVS/Tag" "Tbr1"
8671
8672           dotest join2-11 "${testcvs} -q update -j br1 file1" \
8673 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8674 retrieving revision 1\.1
8675 retrieving revision 1\.1\.2\.1
8676 Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
8677           dotest join2-12 "cat file1" "initial contents of file1
8678 modify on branch"
8679           # We should have no sticky tag on file1
8680           dotest join2-13 "${testcvs} -q status file1" \
8681 "===================================================================
8682 File: file1             Status: Locally Modified
8683
8684    Working revision:    1\.1.*
8685    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
8686    Sticky Tag:          (none)
8687    Sticky Date:         (none)
8688    Sticky Options:      (none)"
8689           dotest join2-14 "cat CVS/Tag" "Tbr1"
8690           # And the checkin should go to the trunk
8691           dotest join2-15 "${testcvs} -q ci -m modify file1" \
8692 "Checking in file1;
8693 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8694 new revision: 1\.2; previous revision: 1\.1
8695 done"
8696
8697           # OK, the above is all well and good and has worked for some
8698           # time.  Now try the case where the file had been added on
8699           # the branch.
8700           dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
8701           # The workaround is to update the whole directory.
8702           # The non-circumvented version won't work.  The reason is that
8703           # update removes the entry from CVS/Entries, so of course we get
8704           # the tag from CVS/Tag and not Entries.  I suppose maybe
8705           # we could invent some new format in Entries which would handle
8706           # this, but doing so, and handling it properly throughout
8707           # CVS, would be a lot of work and I'm not sure this case justifies
8708           # it.
8709           dotest join2-17-circumvent "${testcvs} -q update -A" \
8710 "${PROG} update: bradd is no longer in the repository
8711 [UP] file1"
8712 :         dotest join2-17 "${testcvs} -q update -A bradd" \
8713 "${PROG} update: warning: bradd is not (any longer) pertinent"
8714           dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
8715           dotest join2-19 "${testcvs} -q status bradd" \
8716 "===================================================================
8717 File: bradd             Status: Locally Added
8718
8719    Working revision:    New file!
8720    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
8721    Sticky Tag:          (none)
8722    Sticky Date:         (none)
8723    Sticky Options:      (none)"
8724           dotest join2-20 "${testcvs} -q ci -m modify bradd" \
8725 "Checking in bradd;
8726 ${CVSROOT_DIRNAME}/first-dir/bradd,v  <--  bradd
8727 new revision: 1\.2; previous revision: 1\.1
8728 done"
8729
8730           cd ../..
8731           rm -r 1
8732           rm -rf ${CVSROOT_DIRNAME}/first-dir
8733           ;;
8734
8735         join3)
8736           # See "join" for a list of other joining/branching tests.
8737           # First the usual setup; create a directory first-dir, a file
8738           # first-dir/file1, and a branch br1.
8739           mkdir 1; cd 1
8740           dotest join3-1 "${testcvs} -q co -l ." ''
8741           mkdir first-dir
8742           dotest join3-2 "${testcvs} add first-dir" \
8743 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
8744           cd first-dir
8745           echo 'initial contents of file1' >file1
8746           dotest join3-3 "${testcvs} add file1" \
8747 "${PROG} add: scheduling file .file1. for addition
8748 ${PROG} add: use .${PROG} commit. to add this file permanently"
8749           dotest join3-4 "${testcvs} -q ci -m add" \
8750 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8751 done
8752 Checking in file1;
8753 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8754 initial revision: 1\.1
8755 done"
8756           dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
8757           dotest join3-6 "${testcvs} -q update -r br1" ""
8758           echo 'br1:line1' >>file1
8759           dotest join3-7 "${testcvs} -q ci -m modify" \
8760 "Checking in file1;
8761 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8762 new revision: 1\.1\.2\.1; previous revision: 1\.1
8763 done"
8764
8765           # Now back to the trunk for:
8766           # another revision and another branch for file1.
8767           # add file2, which will exist on trunk and br2 but not br1.
8768           dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
8769           echo 'trunk:line1' > file2
8770           dotest join3-8a "${testcvs} add file2" \
8771 "${PROG} add: scheduling file .file2. for addition
8772 ${PROG} add: use .${PROG} commit. to add this file permanently"
8773           echo 'trunk:line1' >>file1
8774           dotest join3-9 "${testcvs} -q ci -m modify" \
8775 "Checking in file1;
8776 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8777 new revision: 1\.2; previous revision: 1\.1
8778 done
8779 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8780 done
8781 Checking in file2;
8782 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8783 initial revision: 1\.1
8784 done"
8785           dotest join3-10 "${testcvs} -q tag -b br2" "T file1
8786 T file2"
8787
8788           # Before we actually have any revision on br2, let's try a join
8789           dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
8790 ${PROG} update: file2 is no longer in the repository"
8791           dotest join3-12 "${testcvs} -q update -j br2" \
8792 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8793 retrieving revision 1\.1
8794 retrieving revision 1\.2
8795 Merging differences between 1\.1 and 1\.2 into file1
8796 rcsmerge: warning: conflicts during merge
8797 U file2"
8798           dotest join3-13 "cat file1" \
8799 "initial contents of file1
8800 [<]<<<<<< file1
8801 br1:line1
8802 [=]======
8803 trunk:line1
8804 [>]>>>>>> 1\.2"
8805           rm file1
8806
8807           # OK, we'll try the same thing with a revision on br2.
8808           dotest join3-14 "${testcvs} -q update -r br2 file1" \
8809 "${PROG} update: warning: file1 was lost
8810 U file1" "U file1"
8811           echo 'br2:line1' >>file1
8812           dotest join3-15 "${testcvs} -q ci -m modify file1" \
8813 "Checking in file1;
8814 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8815 new revision: 1\.2\.2\.1; previous revision: 1\.2
8816 done"
8817
8818           # OK, now we can join br2 to br1
8819           dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
8820           # It may seem odd, to merge a higher branch into a lower
8821           # branch, but in fact CVS defines the ancestor as 1.1
8822           # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
8823           # This seems like a reasonably plausible behavior.
8824           dotest join3-17 "${testcvs} -q update -j br2 file1" \
8825 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8826 retrieving revision 1\.1
8827 retrieving revision 1\.2\.2\.1
8828 Merging differences between 1\.1 and 1\.2\.2\.1 into file1
8829 rcsmerge: warning: conflicts during merge"
8830           dotest join3-18 "cat file1" \
8831 "initial contents of file1
8832 [<]<<<<<< file1
8833 br1:line1
8834 [=]======
8835 trunk:line1
8836 br2:line1
8837 [>]>>>>>> 1\.2\.2\.1"
8838
8839           cd ../..
8840           rm -r 1
8841           rm -rf ${CVSROOT_DIRNAME}/first-dir
8842           ;;
8843
8844         join4)
8845           # Like join, but with local (uncommitted) modifications.
8846
8847           mkdir ${CVSROOT_DIRNAME}/first-dir
8848           mkdir 1
8849           cd 1
8850           dotest join4-1 "${testcvs} -q co first-dir" ''
8851
8852           cd first-dir
8853
8854           # Add two files.
8855           echo 'first revision of file3' > file3
8856           echo 'first revision of file4' > file4
8857           echo 'first revision of file6' > file6
8858           echo 'first revision of file8' > file8
8859           echo 'first revision of file9' > file9
8860           dotest join4-2 "${testcvs} add file3 file4 file6 file8 file9" \
8861 "${PROG}"' add: scheduling file `file3'\'' for addition
8862 '"${PROG}"' add: scheduling file `file4'\'' for addition
8863 '"${PROG}"' add: scheduling file `file6'\'' for addition
8864 '"${PROG}"' add: scheduling file `file8'\'' for addition
8865 '"${PROG}"' add: scheduling file `file9'\'' for addition
8866 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
8867
8868           dotest join4-3 "${testcvs} -q commit -m add" \
8869 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
8870 done
8871 Checking in file3;
8872 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
8873 initial revision: 1\.1
8874 done
8875 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
8876 done
8877 Checking in file4;
8878 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8879 initial revision: 1\.1
8880 done
8881 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
8882 done
8883 Checking in file6;
8884 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
8885 initial revision: 1\.1
8886 done
8887 RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
8888 done
8889 Checking in file8;
8890 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
8891 initial revision: 1\.1
8892 done
8893 RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
8894 done
8895 Checking in file9;
8896 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
8897 initial revision: 1\.1
8898 done"
8899
8900           # Make a branch.
8901           dotest join4-4 "${testcvs} -q tag -b branch ." \
8902 'T file3
8903 T file4
8904 T file6
8905 T file8
8906 T file9'
8907
8908           # Add file10
8909           echo 'first revision of file10' > file10
8910           dotest join4-7a "${testcvs} add file10" \
8911 "${PROG}"' add: scheduling file `file10'\'' for addition
8912 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
8913           dotest join4-7b "${testcvs} -q ci -mx ." \
8914 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
8915 done
8916 Checking in file10;
8917 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
8918 initial revision: 1\.1
8919 done"
8920
8921           # Add file2 and file7, modify file4, and remove
8922           # file6, file8, file9, and file10.
8923           echo 'first revision of file2' > file2
8924           echo 'second revision of file4' > file4
8925           echo 'first revision of file7' > file7
8926           rm file6 file8 file9 file10
8927           dotest join4-5 "${testcvs} add file2 file7" \
8928 "${PROG}"' add: scheduling file `file2'\'' for addition
8929 '"${PROG}"' add: scheduling file `file7'\'' for addition
8930 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
8931           dotest join4-6 "${testcvs} rm file6 file8 file9 file10" \
8932 "${PROG}"' remove: scheduling `file6'\'' for removal
8933 '"${PROG}"' remove: scheduling `file8'\'' for removal
8934 '"${PROG}"' remove: scheduling `file9'\'' for removal
8935 '"${PROG}"' remove: scheduling `file10'\'' for removal
8936 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
8937
8938           # Check out the branch.
8939           cd ../..
8940           mkdir 2
8941           cd 2
8942           dotest join4-8 "${testcvs} -q co -r branch first-dir" \
8943 'U first-dir/file3
8944 U first-dir/file4
8945 U first-dir/file6
8946 U first-dir/file8
8947 U first-dir/file9'
8948
8949           cd first-dir
8950
8951           # Modify the files on the branch, so that T1 is not an
8952           # ancestor of the main line, and add file5
8953           echo 'first branch revision of file3' > file3
8954           echo 'first branch revision of file4' > file4
8955           echo 'first branch revision of file5' > file5
8956           echo 'first branch revision of file6' > file6
8957           echo 'first branch revision of file9' > file9
8958           dotest join4-9 "${testcvs} add file5" \
8959 "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
8960 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
8961           dotest join4-10 "${testcvs} -q ci -mx ." \
8962 "Checking in file3;
8963 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
8964 new revision: 1\.1\.2\.1; previous revision: 1\.1
8965 done
8966 Checking in file4;
8967 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
8968 new revision: 1\.1\.2\.1; previous revision: 1\.1
8969 done
8970 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
8971 done
8972 Checking in file5;
8973 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
8974 new revision: 1\.1\.2\.1; previous revision: 1\.1
8975 done
8976 Checking in file6;
8977 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
8978 new revision: 1\.1\.2\.1; previous revision: 1\.1
8979 done
8980 Checking in file9;
8981 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
8982 new revision: 1\.1\.2\.1; previous revision: 1\.1
8983 done"
8984
8985           # Tag the current revisions on the branch.
8986           dotest join4-11 "${testcvs} -q tag T1 ." \
8987 'T file3
8988 T file4
8989 T file5
8990 T file6
8991 T file8
8992 T file9'
8993
8994           # Add file1 and file2, modify file9, and remove the other files.
8995           echo 'first branch revision of file1' > file1
8996           echo 'first branch revision of file2' > file2
8997           echo 'second branch revision of file9' > file9
8998           rm file3 file4 file5 file6
8999           dotest join4-12 "${testcvs} add file1 file2" \
9000 "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
9001 '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
9002 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9003           dotest join4-13 "${testcvs} rm file3 file4 file5 file6" \
9004 "${PROG}"' remove: scheduling `file3'\'' for removal
9005 '"${PROG}"' remove: scheduling `file4'\'' for removal
9006 '"${PROG}"' remove: scheduling `file5'\'' for removal
9007 '"${PROG}"' remove: scheduling `file6'\'' for removal
9008 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
9009           dotest join4-14 "${testcvs} -q ci -mx ." \
9010 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
9011 done
9012 Checking in file1;
9013 ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
9014 new revision: 1\.1\.2\.1; previous revision: 1\.1
9015 done
9016 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
9017 done
9018 Checking in file2;
9019 ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
9020 new revision: 1\.1\.2\.1; previous revision: 1\.1
9021 done
9022 Removing file3;
9023 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9024 new revision: delete; previous revision: 1\.1\.2\.1
9025 done
9026 Removing file4;
9027 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9028 new revision: delete; previous revision: 1\.1\.2\.1
9029 done
9030 Removing file5;
9031 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9032 new revision: delete; previous revision: 1\.1\.2\.1
9033 done
9034 Removing file6;
9035 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9036 new revision: delete; previous revision: 1\.1\.2\.1
9037 done
9038 Checking in file9;
9039 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9040 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
9041 done"
9042
9043           # Tag the current revisions on the branch.
9044           dotest join4-15 "${testcvs} -q tag T2 ." \
9045 'T file1
9046 T file2
9047 T file8
9048 T file9'
9049
9050           # Modify file4 locally, and do an update with a merge.
9051           cd ../../1/first-dir
9052           echo 'third revision of file4' > file4
9053           dotest join4-18 "${testcvs} -q update -jT1 -jT2 ." \
9054 'U file1
9055 R file10
9056 A file2
9057 '"${PROG}"' update: file file2 exists, but has been added in revision T2
9058 '"${PROG}"' update: scheduling file3 for removal
9059 M file4
9060 '"${PROG}"' update: file file4 is locally modified, but has been removed in revision T2
9061 R file6
9062 A file7
9063 R file8
9064 R file9
9065 '"${PROG}"' update: file file9 does not exist, but is present in revision T2'
9066
9067           # Verify that the right changes have been scheduled.
9068           dotest join4-19 "${testcvs} -q update" \
9069 'A file1
9070 R file10
9071 A file2
9072 R file3
9073 M file4
9074 R file6
9075 A file7
9076 R file8
9077 R file9'
9078
9079           cd ../..
9080
9081           rm -r 1 2
9082           rm -rf ${CVSROOT_DIRNAME}/first-dir
9083           ;;
9084
9085         join5)
9086           # This test verifies that CVS can handle filenames starting with a
9087           # dash (`-') properly.  What used to happen was that CVS handled it
9088           # just fine, until it went to pass them as arguments to the diff
9089           # library, at which point it neglected to pass `--' before the file
9090           # list, causing the diff library to attempt to interpret the file
9091           # name as an argument.
9092           mkdir join5; cd join5
9093           mkdir 1; cd 1
9094           dotest join5-init-1 "${testcvs} -Q co -l ."
9095           mkdir join5
9096           dotest join5-init-2 "${testcvs} -Q add join5"
9097           cd join5
9098           echo "there once was a file from harrisburg" >-file
9099           echo "who's existance it seems was quiteabsurd" >>-file
9100           dotest join5-init-3 "${testcvs} -Q add -- -file"
9101           dotest join5-init-4 "${testcvs} -q ci -minitial" \
9102 "RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
9103 done
9104 Checking in -file;
9105 ${CVSROOT_DIRNAME}/join5/-file,v  <--  -file
9106 initial revision: 1\.1
9107 done"
9108           cd ../..
9109
9110           mkdir 2; cd 2
9111           dotest join5-init-5 "${testcvs} -Q co join5"
9112           cd join5
9113           echo "it tested for free" >>-file
9114           echo "when paid it should be" >>-file
9115           dotest join5-init-4 "${testcvs} -q ci -msecond" \
9116 "Checking in -file;
9117 ${CVSROOT_DIRNAME}/join5/-file,v  <--  -file
9118 new revision: 1\.2; previous revision: 1\.1
9119 done"
9120           cd ../..
9121
9122           cd 1/join5
9123           echo "but maybe it could charge bytheword" >>-file
9124           # This is the test that used to spew complaints from diff3:
9125           dotest join5 "${testcvs} up" \
9126 "${PROG} update: Updating \.
9127 RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
9128 retrieving revision 1\.1
9129 retrieving revision 1\.2
9130 Merging differences between 1\.1 and 1\.2 into -file
9131 rcsmerge: warning: conflicts during merge
9132 ${PROG} update: conflicts found in -file
9133 C -file"
9134           cd ../..
9135
9136           if $keep; then
9137             echo Keeping ${TESTDIR} and exiting due to --keep
9138             exit 0
9139           fi
9140
9141           cd ..
9142           rm -r join5
9143           rm -rf ${CVSROOT_DIRNAME}/join5
9144           ;;
9145
9146         join6)
9147           mkdir join6; cd join6
9148           mkdir 1; cd 1
9149           dotest join6-init-1 "${testcvs} -Q co -l ."
9150           mkdir join6
9151           dotest join6-init-2 "${testcvs} -Q add join6"
9152           cd join6
9153           echo aaa >temp.txt
9154           echo bbb >>temp.txt
9155           echo ccc >>temp.txt
9156           dotest join6-1 "${testcvs} -Q add temp.txt"
9157           dotest join6-2 "${testcvs} -q commit -minitial temp.txt" \
9158 "RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9159 done
9160 Checking in temp\.txt;
9161 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
9162 initial revision: 1\.1
9163 done"
9164           cp temp.txt temp2.txt
9165           echo ddd >>temp.txt
9166           dotest join6-3 "${testcvs} -q commit -madd temp.txt" \
9167 "Checking in temp\.txt;
9168 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
9169 new revision: 1\.2; previous revision: 1\.1
9170 done"
9171
9172           # The case where the merge target is up-to-date and its base revision
9173           # matches the second argument to -j: CVS doesn't bother attempting
9174           # the merge since it already knows that the target contains the
9175           # change.
9176           dotest join6-3.3 "${testcvs} update -j1.1 -j1.2 temp.txt" \
9177 "temp\.txt already contains the differences between 1\.1 and 1\.2"
9178           dotest join6-3.4 "${testcvs} diff temp.txt" ""
9179
9180           # The case where the merge target is modified but already contains
9181           # the change.
9182           echo bbb >temp.txt
9183           echo ccc >>temp.txt
9184           echo ddd >>temp.txt
9185           dotest join6-3.5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
9186 "M temp\.txt
9187 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9188 retrieving revision 1\.1
9189 retrieving revision 1\.2
9190 Merging differences between 1\.1 and 1\.2 into temp\.txt
9191 temp\.txt already contains the differences between 1\.1 and 1\.2"
9192           dotest_fail join6-3.6 "${testcvs} diff temp.txt" \
9193 "Index: temp\.txt
9194 ===================================================================
9195 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9196 retrieving revision 1\.2
9197 diff -r1\.2 temp.txt
9198 1d0
9199 < aaa"
9200
9201           cp temp2.txt temp.txt
9202           dotest_fail join6-4 "${testcvs} diff temp.txt" \
9203 "Index: temp.txt
9204 ===================================================================
9205 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9206 retrieving revision 1\.2
9207 diff -r1\.2 temp\.txt
9208 4d3
9209 < ddd"
9210
9211           dotest join6-5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
9212 "M temp\.txt
9213 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9214 retrieving revision 1\.1
9215 retrieving revision 1\.2
9216 Merging differences between 1\.1 and 1\.2 into temp\.txt"
9217           dotest join6-6 "${testcvs} diff temp.txt" ""
9218           mv temp.txt temp3.txt
9219           dotest join6-7 "sed 's/ddd/dddd/' < temp3.txt > temp.txt" ""
9220           dotest join6-8 "${testcvs} update -j1.1 -j1.2 temp.txt" \
9221 "M temp\.txt
9222 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9223 retrieving revision 1\.1
9224 retrieving revision 1\.2
9225 Merging differences between 1\.1 and 1\.2 into temp\.txt
9226 rcsmerge: warning: conflicts during merge"
9227           dotest_fail join6-9 "${testcvs} diff temp.txt" \
9228 "Index: temp\.txt
9229 ===================================================================
9230 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
9231 retrieving revision 1\.2
9232 diff -r1\.2 temp\.txt
9233 3a4,6
9234 > <<<<<<< temp\.txt
9235 > dddd
9236 > =======
9237 4a8
9238 > >>>>>>> 1\.2"
9239           cp temp2.txt temp.txt
9240           dotest join6-10 "${testcvs} -q ci -m del temp.txt" \
9241 "Checking in temp\.txt;
9242 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
9243 new revision: 1\.3; previous revision: 1\.2
9244 done"
9245           cp temp3.txt temp.txt
9246           dotest_fail join6-11 "${testcvs} diff temp.txt" \
9247 "Index: temp\.txt
9248 ===================================================================
9249 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
9250 retrieving revision 1\.3
9251 diff -r1\.3 temp\.txt
9252 3a4
9253 > ddd"
9254           dotest join6-12 "${testcvs} update -j1.2 -j1.3 temp.txt" \
9255 "M temp\.txt
9256 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
9257 retrieving revision 1\.2
9258 retrieving revision 1\.3
9259 Merging differences between 1\.2 and 1\.3 into temp\.txt"
9260           dotest join6-13 "${testcvs} diff temp.txt" ""
9261
9262           # The case where the merge target wasn't created until after the
9263           # first tag was applied
9264           rm temp2.txt temp3.txt
9265           dotest join6-20 "${testcvs} -q tag -r1.1 t1" \
9266 "T temp.txt"
9267           echo xxx >temp2.txt
9268           dotest join6-21 "${testcvs} -Q add temp2.txt"
9269           dotest join6-22 "${testcvs} -q ci -m." \
9270 "RCS file: ${CVSROOT_DIRNAME}/join6/temp2.txt,v
9271 done
9272 Checking in temp2\.txt;
9273 ${CVSROOT_DIRNAME}/join6/temp2\.txt,v  <--  temp2\.txt
9274 initial revision: 1\.1
9275 done"
9276           dotest join6-23 "${testcvs} -q tag t2" \
9277 "T temp.txt
9278 T temp2.txt"
9279           echo xxx >>temp.txt
9280           dotest join6-24 "${testcvs} -q ci -m." \
9281 "Checking in temp\.txt;
9282 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
9283 new revision: 1\.4; previous revision: 1\.3
9284 done"
9285           dotest join6-25 "${testcvs} -q up -jt1 -jt2" \
9286 "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
9287 retrieving revision 1\.1
9288 retrieving revision 1\.3
9289 Merging differences between 1\.1 and 1\.3 into temp.txt
9290 temp.txt already contains the differences between 1\.1 and 1\.3
9291 temp2.txt already contains the differences between creation and 1\.1"
9292
9293           # Now for my next trick: delete the file, recreate it, and
9294           # try to merge
9295           dotest join6-30 "${testcvs} -q rm -f temp2.txt" \
9296 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
9297           dotest join6-31 "${testcvs} -q ci -m. temp2.txt" \
9298 "Removing temp2\.txt;
9299 ${CVSROOT_DIRNAME}/join6/temp2\.txt,v  <--  temp2\.txt
9300 new revision: delete; previous revision: 1\.1
9301 done"
9302           echo new >temp2.txt
9303           # FIXCVS: Local and remote really shouldn't be different and there
9304           # really shouldn't be two different status lines for temp2.txt
9305           if $remote; then
9306             dotest_fail join6-32 "${testcvs} -q up -jt1 -jt2" \
9307 "? temp2\.txt
9308 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
9309 retrieving revision 1\.1
9310 retrieving revision 1\.3
9311 Merging differences between 1\.1 and 1\.3 into temp.txt
9312 temp.txt already contains the differences between 1\.1 and 1\.3
9313 ${PROG} update: move away \./temp2\.txt; it is in the way
9314 C temp2\.txt"
9315           else
9316             dotest join6-32 "${testcvs} -q up -jt1 -jt2" \
9317 "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
9318 retrieving revision 1\.1
9319 retrieving revision 1\.3
9320 Merging differences between 1\.1 and 1\.3 into temp.txt
9321 temp.txt already contains the differences between 1\.1 and 1\.3
9322 ${PROG} update: use .${PROG} add. to create an entry for temp2\.txt
9323 U temp2\.txt
9324 ? temp2\.txt"
9325           fi
9326
9327           cd ../../..
9328
9329           if $keep; then
9330             echo Keeping ${TESTDIR} and exiting due to --keep
9331             exit 0
9332           fi
9333
9334           rm -r join6
9335           rm -rf ${CVSROOT_DIRNAME}/join6
9336           ;;
9337
9338         join-readonly-conflict)
9339           # Previously, only tests 1 & 11 were being tested.  I added the
9340           # intermediate dotest's to try and diagnose a different failure
9341           #
9342           # Demonstrate that cvs-1.9.29 can fail on 2nd and subsequent
9343           # conflict-evoking join attempts.
9344           # Even with that version of CVS, This test failed only in
9345           # client-server mode, and would have been noticed in normal
9346           # operation only for files that were read-only (either due to
9347           # use of cvs' global -r option, setting the CVSREAD envvar,
9348           # or use of watch lists).
9349           mkdir join-readonly-conflict; cd join-readonly-conflict
9350           dotest join-readonly-conflict-1 "$testcvs -q co -l ." ''
9351           module=join-readonly-conflict
9352           mkdir $module
9353           $testcvs -q add $module >>$LOGFILE 2>&1
9354           cd $module
9355
9356           file=m
9357           echo trunk > $file
9358           dotest join-readonly-conflict-2 "$testcvs -Q add $file" ''
9359
9360           dotest join-readonly-conflict-3 "$testcvs -q ci -m . $file" \
9361 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
9362 done
9363 Checking in $file;
9364 $CVSROOT_DIRNAME/$module/$file,v  <--  $file
9365 initial revision: 1\.1
9366 done"
9367
9368           dotest join-readonly-conflict-4 "$testcvs tag -b B $file" "T $file"
9369           dotest join-readonly-conflict-5 "$testcvs -q update -rB $file" ''
9370           echo branch B > $file
9371           dotest join-readonly-conflict-6 "$testcvs -q ci -m . $file" \
9372 "Checking in $file;
9373 $CVSROOT_DIRNAME/$module/$file,v  <--  $file
9374 new revision: 1\.1\.2\.1; previous revision: 1\.1
9375 done"
9376
9377           rm $file
9378           dotest join-readonly-conflict-7 "$testcvs -Q update -A $file" ''
9379           # Make sure $file is read-only.  This can happen more realistically
9380           # via patch -- which could be used to apply a delta, yet would
9381           # preserve a file's read-only permissions.
9382           echo conflict > $file; chmod u-w $file
9383           dotest join-readonly-conflict-8 "$testcvs update -r B $file" \
9384 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
9385 retrieving revision 1\.1
9386 retrieving revision 1\.1\.2\.1
9387 Merging differences between 1\.1 and 1\.1\.2\.1 into $file
9388 rcsmerge: warning: conflicts during merge
9389 ${PROG} update: conflicts found in $file
9390 C $file"
9391
9392           # restore to the trunk
9393           rm -f $file
9394           dotest join-readonly-conflict-9 "$testcvs -Q update -A $file" ''
9395
9396           # This one would fail because cvs couldn't open the existing
9397           # (and read-only) .# file for writing.
9398           echo conflict > $file
9399
9400           # verify that the backup file is writable
9401           if test -w ".#$file.1.1"; then
9402             fail "join-readonly-conflict-10 : .#$file.1.1 is writable"
9403           else
9404             pass "join-readonly-conflict-10"
9405           fi
9406           dotest join-readonly-conflict-11 "$testcvs update -r B $file" \
9407 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
9408 retrieving revision 1\.1
9409 retrieving revision 1\.1\.2\.1
9410 Merging differences between 1\.1 and 1\.1\.2\.1 into $file
9411 rcsmerge: warning: conflicts during merge
9412 ${PROG} update: conflicts found in $file
9413 C m"
9414
9415           cd ../..
9416           if $keep; then :; else
9417             rm -rf join-readonly-conflict
9418             rm -rf $CVSROOT_DIRNAME/$module
9419           fi
9420           ;;
9421
9422         join-admin)
9423           mkdir 1; cd 1
9424           dotest join-admin-1 "$testcvs -q co -l ." ''
9425           module=x
9426           mkdir $module
9427           $testcvs -q add $module >>$LOGFILE 2>&1
9428           cd $module
9429
9430           # Create a file so applying the first tag works.
9431           echo foo > a
9432           $testcvs -Q add a > /dev/null 2>&1
9433           $testcvs -Q ci -m. a > /dev/null 2>&1
9434
9435           $testcvs -Q tag -b B
9436           $testcvs -Q tag -b M1
9437           echo '$''Id$' > b
9438           $testcvs -Q add b > /dev/null 2>&1
9439           $testcvs -Q ci -m. b > /dev/null 2>&1
9440           $testcvs -Q tag -b M2
9441
9442           $testcvs -Q update -r B
9443           $testcvs -Q update -kk -jM1 -jM2
9444           $testcvs -Q ci -m. b >/dev/null 2>&1
9445
9446           $testcvs -Q update -A
9447
9448           # Verify that the -kk flag from the update did not
9449           # propagate to the repository.
9450           dotest join-admin-1 "$testcvs status b" \
9451 "===================================================================
9452 File: b                 Status: Up-to-date
9453
9454    Working revision:    1\.1.*
9455    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/x/b,v
9456    Sticky Tag:          (none)
9457    Sticky Date:         (none)
9458    Sticky Options:      (none)"
9459
9460           cd ../..
9461           rm -rf 1
9462           rm -rf ${CVSROOT_DIRNAME}/$module
9463           ;;
9464
9465         join-admin-2)
9466           # Show that when a merge (via update -kk -jtag1 -jtag2) first
9467           # removes a file, then modifies another containing an $Id...$ line,
9468           # the resulting file contains the unexpanded `$Id.$' string, as
9469           # -kk requires.
9470           mkdir 1; cd 1
9471           dotest join-admin-2-1 "$testcvs -q co -l ." ''
9472           module=x
9473           mkdir $module
9474           dotest join-admin-2-2 "$testcvs -q add $module" \
9475 "Directory ${CVSROOT_DIRNAME}/x added to the repository"
9476           cd $module
9477
9478           # Create a file so applying the first tag works.
9479           echo '$''Id$' > e0
9480           cp e0 e
9481           dotest join-admin-2-3 "$testcvs -Q add e" ''
9482           dotest join-admin-2-4 "$testcvs -Q ci -m. e" \
9483 "RCS file: ${CVSROOT_DIRNAME}/x/e,v
9484 done
9485 Checking in e;
9486 ${CVSROOT_DIRNAME}/x/e,v  <--  e
9487 initial revision: 1\.1
9488 done"
9489
9490           dotest join-admin-2-5 "$testcvs -Q tag -b T" '' "${QUESTION} e0"
9491           dotest join-admin-2-6 "$testcvs -Q update -r T" '' "${QUESTION} e0"
9492           cp e0 e
9493           dotest join-admin-2-7 "$testcvs -Q ci -m. e" \
9494 "Checking in e;
9495 ${CVSROOT_DIRNAME}/x/e,v  <--  e
9496 new revision: 1\.1\.2\.1; previous revision: 1\.1
9497 done"
9498
9499           dotest join-admin-2-8 "$testcvs -Q update -A" '' "${QUESTION} e0"
9500           dotest join-admin-2-9 "$testcvs -Q tag -b M1" '' "${QUESTION} e0"
9501
9502           echo '$''Id$' > b
9503           dotest join-admin-2-10 "$testcvs -Q add b" ''
9504           cp e0 e
9505           dotest join-admin-2-11 "$testcvs -Q ci -m. b e" \
9506 "RCS file: ${CVSROOT_DIRNAME}/x/b,v
9507 done
9508 Checking in b;
9509 ${CVSROOT_DIRNAME}/x/b,v  <--  b
9510 initial revision: 1\.1
9511 done
9512 Checking in e;
9513 ${CVSROOT_DIRNAME}/x/e,v  <--  e
9514 new revision: 1\.2; previous revision: 1\.1
9515 done"
9516
9517           dotest join-admin-2-12 "$testcvs -Q tag -b M2" '' "${QUESTION} e0"
9518
9519           dotest join-admin-2-13 "$testcvs -Q update -r T" '' "${QUESTION} e0"
9520           dotest join-admin-2-14 "$testcvs update -kk -jM1 -jM2" \
9521 "${PROG} update: Updating .
9522 U b
9523 U e
9524 RCS file: ${CVSROOT_DIRNAME}/x/e,v
9525 retrieving revision 1\.1
9526 retrieving revision 1\.2
9527 Merging differences between 1\.1 and 1\.2 into e
9528 e already contains the differences between 1\.1 and 1\.2
9529 ${QUESTION} e0" \
9530 "${QUESTION} e0
9531 ${PROG} update: Updating .
9532 U b
9533 U e
9534 RCS file: ${CVSROOT_DIRNAME}/x/e,v
9535 retrieving revision 1\.1
9536 retrieving revision 1\.2
9537 Merging differences between 1\.1 and 1\.2 into e
9538 e already contains the differences between 1\.1 and 1\.2"
9539
9540           # Verify that the $Id.$ string is not expanded.
9541           dotest join-admin-2-15 "cat e" '$''Id$'
9542
9543           cd ../..
9544           rm -rf 1
9545           rm -rf ${CVSROOT_DIRNAME}/$module
9546           ;;
9547
9548         join-rm)
9549           # This first half of this test checks that a single-argument merge
9550           # from a branch is capable of removing files.
9551           #
9552           # The second half verifies that an update to another location with an
9553           # uncommitted removal will transfer the destination branch of the
9554           # removal.
9555
9556           module=join-rm
9557           mkdir $module; cd $module
9558
9559           dotest join-rm-init-1 "$testcvs -q co -l ." ''
9560           mkdir $module
9561           dotest join-rm-init-2 "$testcvs -q add $module" \
9562 "Directory $CVSROOT_DIRNAME/$module added to the repository"
9563           cd $module
9564
9565           # add some files.
9566           touch a b c d e f g
9567           dotest join-rm-init-3 "$testcvs -Q add a b c d e f g"
9568           dotest join-rm-init-4 "$testcvs -Q ci -m add-em" \
9569 "RCS file: $CVSROOT_DIRNAME/join-rm/a,v
9570 done
9571 Checking in a;
9572 $CVSROOT_DIRNAME/join-rm/a,v  <--  a
9573 initial revision: 1\.1
9574 done
9575 RCS file: $CVSROOT_DIRNAME/join-rm/b,v
9576 done
9577 Checking in b;
9578 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
9579 initial revision: 1\.1
9580 done
9581 RCS file: $CVSROOT_DIRNAME/join-rm/c,v
9582 done
9583 Checking in c;
9584 $CVSROOT_DIRNAME/join-rm/c,v  <--  c
9585 initial revision: 1\.1
9586 done
9587 RCS file: $CVSROOT_DIRNAME/join-rm/d,v
9588 done
9589 Checking in d;
9590 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
9591 initial revision: 1\.1
9592 done
9593 RCS file: $CVSROOT_DIRNAME/join-rm/e,v
9594 done
9595 Checking in e;
9596 $CVSROOT_DIRNAME/join-rm/e,v  <--  e
9597 initial revision: 1\.1
9598 done
9599 RCS file: $CVSROOT_DIRNAME/join-rm/f,v
9600 done
9601 Checking in f;
9602 $CVSROOT_DIRNAME/join-rm/f,v  <--  f
9603 initial revision: 1\.1
9604 done
9605 RCS file: $CVSROOT_DIRNAME/join-rm/g,v
9606 done
9607 Checking in g;
9608 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
9609 initial revision: 1\.1
9610 done"
9611           
9612           # create the branch and update to it
9613           dotest join-rm-init-5 "$testcvs -Q tag -b br"
9614           dotest join-rm-init-6 "$testcvs -Q up -rbr"
9615
9616           # remove a few files from the branch
9617           dotest join-rm-init-7 "$testcvs -Q rm -f b d g"
9618           dotest join-rm-init-8 "$testcvs -Q ci -mrm" \
9619 "Removing b;
9620 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
9621 new revision: delete; previous revision: 1\.1
9622 done
9623 Removing d;
9624 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
9625 new revision: delete; previous revision: 1\.1
9626 done
9627 Removing g;
9628 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
9629 new revision: delete; previous revision: 1\.1
9630 done"
9631
9632           # update to the trunk
9633           dotest join-rm-init-9 "$testcvs -Q up -A"
9634
9635           # now for the test - try and merge the removals.
9636           dotest join-rm-1 "$testcvs -q up -jbr" \
9637 "$PROG update: scheduling b for removal
9638 $PROG update: scheduling d for removal
9639 $PROG update: scheduling g for removal"
9640
9641           # And make sure the merge took
9642           dotest join-rm-2 "$testcvs -qn up" \
9643 "R b
9644 R d
9645 R g"
9646
9647           dotest join-rm-3 "$testcvs -q ci -m 'save the merge'" \
9648 "Removing b;
9649 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
9650 new revision: delete; previous revision: 1\.1
9651 done
9652 Removing d;
9653 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
9654 new revision: delete; previous revision: 1\.1
9655 done
9656 Removing g;
9657 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
9658 new revision: delete; previous revision: 1\.1
9659 done"
9660
9661           # and verify that it was the head revision which was removed.
9662           dotest join-rm-4 "$testcvs -q log b"  "
9663 RCS file: $CVSROOT_DIRNAME/join-rm/Attic/b,v
9664 Working file: b
9665 head: 1\.2
9666 branch:
9667 locks: strict
9668 access list:
9669 symbolic names:
9670         br: 1\.1\.0\.2
9671 keyword substitution: kv
9672 total revisions: 3;     selected revisions: 3
9673 description:
9674 ----------------------------
9675 revision 1\.2
9676 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
9677 save the merge
9678 ----------------------------
9679 revision 1\.1
9680 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
9681 branches:  1.1.2;
9682 add-em
9683 ----------------------------
9684 revision 1\.1\.2\.1
9685 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
9686 rm
9687 ============================================================================="
9688
9689           # go back to the branch to set up for the second set of tests
9690           dotest join-rm-init-10 "$testcvs -Q up -rbr"
9691           dotest join-rm-init-11 "$testcvs -Q rm -f a"
9692           dotest join-rm-init-12 "$testcvs -Q ci -m rma" \
9693 "Removing a;
9694 $CVSROOT_DIRNAME/join-rm/a,v  <--  a
9695 new revision: delete; previous revision: 1\.1
9696 done"
9697
9698           # now the test: update to the trunk
9699           #
9700           # FIXCVS: This update should merge the removal to the trunk.  It does
9701           # not.
9702           dotest join-rm-5 "$testcvs -q up -A" "U a"
9703
9704           # and verify that there is no sticky tag
9705           dotest join-rm-6 "$testcvs status a" \
9706 "===================================================================
9707 File: a                 Status: Up-to-date
9708
9709    Working revision:    1\.1.*
9710    Repository revision: 1\.1    $CVSROOT_DIRNAME/join-rm/a,v
9711    Sticky Tag:          (none)
9712    Sticky Date:         (none)
9713    Sticky Options:      (none)"
9714
9715           if $keep; then
9716             echo Keeping $TESTDIR and exiting due to --keep
9717             exit 0
9718           fi
9719
9720           cd ../..
9721           rm -rf $CVSROOT_DIRNAME/$module
9722           rm -r $module
9723           ;;
9724
9725         new) # look for stray "no longer pertinent" messages.
9726                 mkdir ${CVSROOT_DIRNAME}/first-dir
9727
9728                 if ${CVS} co first-dir  ; then
9729                     pass 117
9730                 else
9731                     fail 117
9732                 fi
9733
9734                 cd first-dir
9735                 touch a
9736
9737                 if ${CVS} add a  2>>${LOGFILE}; then
9738                     pass 118
9739                 else
9740                     fail 118
9741                 fi
9742
9743                 if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
9744                     pass 119
9745                 else
9746                     fail 119
9747                 fi
9748
9749                 rm a
9750
9751                 if ${CVS} rm a  2>>${LOGFILE}; then
9752                     pass 120
9753                 else
9754                     fail 120
9755                 fi
9756
9757                 if ${CVS} ci -m removed >>${LOGFILE} ; then
9758                     pass 121
9759                 else
9760                     fail 121
9761                 fi
9762
9763                 if ${CVS} update -A  2>&1 | grep longer ; then
9764                     fail 122
9765                 else
9766                     pass 122
9767                 fi
9768
9769                 if ${CVS} update -rHEAD 2>&1 | grep longer ; then
9770                     fail 123
9771                 else
9772                     pass 123
9773                 fi
9774
9775                 cd ..
9776                 rm -r first-dir
9777                 rm -rf ${CVSROOT_DIRNAME}/first-dir
9778                 ;;
9779
9780         newb)
9781           # Test removing a file on a branch and then checking it out.
9782
9783           # We call this "newb" only because it, like the "new" tests,
9784           # has something to do with "no longer pertinent" messages.
9785           # Not necessarily the most brilliant nomenclature.
9786
9787           # Create file 'a'.
9788           mkdir ${CVSROOT_DIRNAME}/first-dir
9789           dotest newb-123a "${testcvs} -q co first-dir" ''
9790           cd first-dir
9791           touch a
9792           dotest newb-123b "${testcvs} add a" \
9793 "${PROG} add: scheduling file .a. for addition
9794 ${PROG} add: use .${PROG} commit. to add this file permanently"
9795           dotest newb-123c "${testcvs} -q ci -m added" \
9796 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
9797 done
9798 Checking in a;
9799 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
9800 initial revision: 1\.1
9801 done"
9802
9803           # Make a branch.
9804           dotest newb-123d "${testcvs} -q tag -b branch" "T a"
9805
9806           # Check out the branch.
9807           cd ..
9808           rm -r first-dir
9809           mkdir 1
9810           cd 1
9811           dotest newb-123e "${testcvs} -q co -r branch first-dir" \
9812 "U first-dir/a"
9813
9814           # Remove 'a' on another copy of the branch.
9815           cd ..
9816           mkdir 2
9817           cd 2
9818           dotest newb-123f "${testcvs} -q co -r branch first-dir" \
9819 "U first-dir/a"
9820           cd first-dir
9821           rm a
9822           dotest newb-123g "${testcvs} rm a" \
9823 "${PROG} remove: scheduling .a. for removal
9824 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
9825           dotest newb-123h "${testcvs} -q ci -m removed" \
9826 "Removing a;
9827 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
9828 new revision: delete; previous revision: 1\.1
9829 done"
9830
9831           # Check out the file on the branch.  This should report
9832           # that the file is not pertinent, but it should not
9833           # say anything else.
9834           cd ..
9835           rm -r first-dir
9836           dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
9837 "${PROG} checkout: warning: first-dir/a is not (any longer) pertinent"
9838
9839           # Update the other copy, and make sure that a is removed.
9840           cd ../1/first-dir
9841           # "Entry Invalid" is a rather strange output here.  Something like
9842           # "Removed in Repository" would make more sense.
9843           dotest newb-123j0 "${testcvs} status a" \
9844 "${PROG} status: a is no longer in the repository
9845 ===================================================================
9846 File: a                 Status: Entry Invalid
9847
9848    Working revision:    1\.1.*
9849    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/a,v
9850    Sticky Tag:          branch (branch: 1\.1\.2)
9851    Sticky Date:         (none)
9852    Sticky Options:      (none)"
9853           dotest newb-123j "${testcvs} -q update" \
9854 "${PROG} update: a is no longer in the repository"
9855
9856           if test -f a; then
9857             fail newb-123k
9858           else
9859             pass newb-123k
9860           fi
9861
9862           cd ../..
9863           rm -r 1 2
9864           rm -rf ${CVSROOT_DIRNAME}/first-dir
9865           ;;
9866
9867         conflicts)
9868                 mkdir ${CVSROOT_DIRNAME}/first-dir
9869
9870                 mkdir 1
9871                 cd 1
9872
9873                 dotest conflicts-124 "${testcvs} -q co first-dir" ''
9874
9875                 cd first-dir
9876                 touch a
9877
9878                 dotest conflicts-125 "${testcvs} add a" \
9879 "${PROG} add: scheduling file .a. for addition
9880 ${PROG} add: use .${PROG} commit. to add this file permanently"
9881                 dotest conflicts-126 "${testcvs} -q ci -m added" \
9882 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
9883 done
9884 Checking in a;
9885 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
9886 initial revision: 1\.1
9887 done"
9888
9889                 cd ../..
9890                 mkdir 2
9891                 cd 2
9892
9893                 dotest conflicts-126.5 "${testcvs} co -p first-dir" \
9894 "${PROG} checkout: Updating first-dir
9895 ===================================================================
9896 Checking out first-dir/a
9897 RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
9898 VERS: 1\.1
9899 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
9900                 if ${CVS} co first-dir ; then
9901                     pass 127
9902                 else
9903                     fail 127
9904                 fi
9905                 cd first-dir
9906                 if test -f a; then
9907                     pass 127a
9908                 else
9909                     fail 127a
9910                 fi
9911
9912                 cd ../../1/first-dir
9913                 echo add a line >>a
9914                 mkdir dir1
9915                 dotest conflicts-127b "${testcvs} add dir1" \
9916 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
9917                 dotest conflicts-128 "${testcvs} -q ci -m changed" \
9918 "Checking in a;
9919 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
9920 new revision: 1\.2; previous revision: 1\.1
9921 done"
9922                 cd ../..
9923
9924                 # Similar to conflicts-126.5, but now the file has nonempty
9925                 # contents.
9926                 mkdir 3
9927                 cd 3
9928                 dotest conflicts-128.5 "${testcvs} co -p -l first-dir" \
9929 "${PROG} checkout: Updating first-dir
9930 ===================================================================
9931 Checking out first-dir/a
9932 RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
9933 VERS: 1\.2
9934 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
9935 add a line"
9936                 cd ..
9937                 rmdir 3
9938
9939                 # Now go over the to the other working directory and
9940                 # start testing conflicts
9941                 cd 2/first-dir
9942                 echo add a conflicting line >>a
9943                 dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
9944 "${PROG}"' commit: Up-to-date check failed for `a'\''
9945 '"${PROG}"' \[commit aborted\]: correct above errors first!'
9946                 mkdir dir1
9947                 mkdir sdir
9948                 dotest conflicts-status-0 "${testcvs} status a" \
9949 "===================================================================
9950 File: a                 Status: Needs Merge
9951
9952    Working revision:    1\.1.*
9953    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
9954    Sticky Tag:          (none)
9955    Sticky Date:         (none)
9956    Sticky Options:      (none)"
9957                 dotest conflicts-129a "${testcvs} -nq update a" \
9958 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
9959 retrieving revision 1\.1
9960 retrieving revision 1\.2
9961 Merging differences between 1\.1 and 1\.2 into a
9962 rcsmerge: warning: conflicts during merge
9963 ${PROG} update: conflicts found in a
9964 C a"
9965                 dotest conflicts-130 "${testcvs} -q update" \
9966 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
9967 retrieving revision 1\.1
9968 retrieving revision 1\.2
9969 Merging differences between 1\.1 and 1\.2 into a
9970 rcsmerge: warning: conflicts during merge
9971 ${PROG} update: conflicts found in a
9972 C a
9973 ${QUESTION} dir1
9974 ${QUESTION} sdir" \
9975 "${QUESTION} dir1
9976 ${QUESTION} sdir
9977 RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
9978 retrieving revision 1\.1
9979 retrieving revision 1\.2
9980 Merging differences between 1\.1 and 1\.2 into a
9981 rcsmerge: warning: conflicts during merge
9982 ${PROG} update: conflicts found in a
9983 C a"
9984                 rmdir dir1 sdir
9985
9986                 dotest conflicts-status-1 "${testcvs} status a" \
9987 "===================================================================
9988 File: a                 Status: File had conflicts on merge
9989
9990    Working revision:    1\.2.*
9991    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
9992    Sticky Tag:          (none)
9993    Sticky Date:         (none)
9994    Sticky Options:      (none)"
9995                 dotest_fail conflicts-131 "${testcvs} -q ci -m try" \
9996 "${PROG} commit: file .a. had a conflict and has not been modified
9997 ${PROG} \[commit aborted\]: correct above errors first!"
9998
9999                 # Try to check in the file with the conflict markers in it.
10000                 # Make sure we detect any one of the three conflict markers
10001                 mv a aa
10002                 grep '^<<<<<<<' aa >a
10003                 dotest conflicts-status-2 "${testcvs} -nq ci -m try a" \
10004 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
10005
10006                 grep '^=======' aa >a
10007                 dotest conflicts-status-3 "${testcvs} -nq ci -m try a" \
10008 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
10009
10010                 grep '^>>>>>>>' aa >a
10011                 dotest conflicts-status-4 "${testcvs} -qn ci -m try a" \
10012 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
10013
10014                 mv aa a
10015                 echo lame attempt at resolving it >>a
10016                 dotest conflicts-status-5 "${testcvs} status a" \
10017 "===================================================================
10018 File: a                 Status: File had conflicts on merge
10019
10020    Working revision:    1\.2.*
10021    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
10022    Sticky Tag:          (none)
10023    Sticky Date:         (none)
10024    Sticky Options:      (none)"
10025                 dotest conflicts-132 "${testcvs} -q ci -m try" \
10026 "${PROG} commit: warning: file .a. seems to still contain conflict indicators
10027 Checking in a;
10028 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10029 new revision: 1\.3; previous revision: 1\.2
10030 done"
10031
10032                 # OK, the user saw the warning (good user), and now
10033                 # resolves it for real.
10034                 echo resolve conflict >a
10035                 dotest conflicts-status-6 "${testcvs} status a" \
10036 "===================================================================
10037 File: a                 Status: Locally Modified
10038
10039    Working revision:    1\.3.*
10040    Repository revision: 1\.3    ${CVSROOT_DIRNAME}/first-dir/a,v
10041    Sticky Tag:          (none)
10042    Sticky Date:         (none)
10043    Sticky Options:      (none)"
10044                 dotest conflicts-133 "${testcvs} -q ci -m resolved" \
10045 "Checking in a;
10046 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10047 new revision: 1\.4; previous revision: 1\.3
10048 done"
10049                 dotest conflicts-status-7 "${testcvs} status a" \
10050 "===================================================================
10051 File: a                 Status: Up-to-date
10052
10053    Working revision:    1\.4.*
10054    Repository revision: 1\.4    ${CVSROOT_DIRNAME}/first-dir/a,v
10055    Sticky Tag:          (none)
10056    Sticky Date:         (none)
10057    Sticky Options:      (none)"
10058
10059                 # Now test that we can add a file in one working directory
10060                 # and have an update in another get it.
10061                 cd ../../1/first-dir
10062                 echo abc >abc
10063                 if ${testcvs} add abc >>${LOGFILE} 2>&1; then
10064                     pass 134
10065                 else
10066                     fail 134
10067                 fi
10068                 if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
10069                     pass 135
10070                 else
10071                     fail 135
10072                 fi
10073                 cd ../../2
10074                 mkdir first-dir/dir1 first-dir/sdir
10075                 dotest conflicts-136 "${testcvs} -q update first-dir" \
10076 '[UP] first-dir/abc
10077 '"${QUESTION}"' first-dir/dir1
10078 '"${QUESTION}"' first-dir/sdir' \
10079 ''"${QUESTION}"' first-dir/dir1
10080 '"${QUESTION}"' first-dir/sdir
10081 [UP] first-dir/abc'
10082                 dotest conflicts-137 'test -f first-dir/abc' ''
10083                 rmdir first-dir/dir1 first-dir/sdir
10084
10085                 # Now test something similar, but in which the parent directory
10086                 # (not the directory in question) has the Entries.Static flag
10087                 # set.
10088                 cd ../1/first-dir
10089                 mkdir subdir
10090                 if ${testcvs} add subdir >>${LOGFILE}; then
10091                     pass 138
10092                 else
10093                     fail 138
10094                 fi
10095                 cd ../..
10096                 mkdir 3
10097                 cd 3
10098                 if ${testcvs} -q co first-dir/abc first-dir/subdir \
10099                     >>${LOGFILE}; then
10100                     pass 139
10101                 else
10102                     fail 139
10103                 fi
10104                 cd ../1/first-dir/subdir
10105                 echo sss >sss
10106                 if ${testcvs} add sss >>${LOGFILE} 2>&1; then
10107                     pass 140
10108                 else
10109                     fail 140
10110                 fi
10111                 if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
10112                     pass 140
10113                 else
10114                     fail 140
10115                 fi
10116                 cd ../../../3/first-dir
10117                 if ${testcvs} -q update >>${LOGFILE}; then
10118                     pass 141
10119                 else
10120                     fail 141
10121                 fi
10122                 if test -f subdir/sss; then
10123                     pass 142
10124                 else
10125                     fail 142
10126                 fi
10127                 cd ../..
10128                 rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
10129                 ;;
10130
10131         conflicts2)
10132           # More conflicts tests; separate from conflicts to keep each
10133           # test a manageable size.
10134           mkdir ${CVSROOT_DIRNAME}/first-dir
10135
10136           mkdir 1
10137           cd 1
10138
10139           dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
10140
10141           cd first-dir
10142           touch a abc
10143
10144           dotest conflicts2-142a2 "${testcvs} add a abc" \
10145 "${PROG} add: scheduling file .a. for addition
10146 ${PROG} add: scheduling file .abc. for addition
10147 ${PROG} add: use .${PROG} commit. to add these files permanently"
10148           dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
10149 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
10150 done
10151 Checking in a;
10152 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10153 initial revision: 1\.1
10154 done
10155 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
10156 done
10157 Checking in abc;
10158 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
10159 initial revision: 1\.1
10160 done"
10161
10162           cd ../..
10163           mkdir 2
10164           cd 2
10165
10166           dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
10167 U first-dir/abc'
10168           cd ..
10169
10170           # BEGIN TESTS USING THE FILE A
10171           # FIXME: would be cleaner to separate them out into their own
10172           # tests; conflicts2 is getting long.
10173           # Now test that if one person modifies and commits a
10174           # file and a second person removes it, it is a
10175           # conflict
10176           cd 1/first-dir
10177           echo modify a >>a
10178           dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
10179 "Checking in a;
10180 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10181 new revision: 1\.2; previous revision: 1\.1
10182 done"
10183           cd ../../2/first-dir
10184           rm a
10185           dotest conflicts2-142b3 "${testcvs} rm a" \
10186 "${PROG} remove: scheduling .a. for removal
10187 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10188           dotest_fail conflicts2-142b4 "${testcvs} -q update" \
10189 "${PROG} update: conflict: removed a was modified by second party
10190 C a"
10191           # Resolve the conflict by deciding not to remove the file
10192           # after all.
10193           dotest_sort conflicts2-142b5 "${testcvs} add a" "U a
10194 ${PROG} add: a, version 1\.1, resurrected"
10195           dotest conflicts2-142b5b1 "$testcvs status a" \
10196 "===================================================================
10197 File: a                 Status: Needs Patch
10198
10199    Working revision:    1\.1.*
10200    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/a,v
10201    Sticky Tag:          (none)
10202    Sticky Date:         (none)
10203    Sticky Options:      (none)"
10204           dotest conflicts2-142b6 "${testcvs} -q update" 'U a'
10205
10206           # Now one level up.
10207           cd ..
10208           dotest conflicts2-142b7 "${testcvs} rm -f first-dir/a" \
10209 "${PROG} remove: scheduling .first-dir/a. for removal
10210 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10211
10212           if $remote; then
10213             # Haven't investigated this one.
10214             dotest_fail conflicts2-142b8r "$testcvs add first-dir/a" \
10215 "${PROG} add: in directory \.:
10216 ${PROG} \[add aborted\]: there is no version here; do '${PROG} checkout' first"
10217             cd first-dir
10218           else
10219             dotest conflicts2-142b8 "${testcvs} add first-dir/a" \
10220 "U first-dir/a
10221 ${PROG} add: first-dir/a, version 1\.2, resurrected"
10222             cd first-dir
10223             # Now recover from the damage that the 142b8 test did.
10224             dotest conflicts2-142b9 "${testcvs} rm -f a" \
10225 "${PROG} remove: scheduling .a. for removal
10226 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10227           fi
10228
10229           dotest_sort conflicts2-142b10 "${testcvs} add a" "U a
10230 ${PROG} add: a, version 1\.2, resurrected"
10231           # As with conflicts2-142b6, check that things are normal again.
10232           dotest conflicts2-142b11 "${testcvs} -q update" ''
10233           cd ../..
10234           # END TESTS USING THE FILE A
10235
10236           # Now test that if one person removes a file and
10237           # commits it, and a second person removes it, is it
10238           # not a conflict.
10239           cd 1/first-dir
10240           rm abc
10241           dotest conflicts2-142c0 "${testcvs} rm abc" \
10242 "${PROG} remove: scheduling .abc. for removal
10243 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10244           dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
10245 "Removing abc;
10246 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
10247 new revision: delete; previous revision: 1\.1
10248 done"
10249           cd ../../2/first-dir
10250           rm abc
10251           dotest conflicts2-142c2 "${testcvs} rm abc" \
10252 "${PROG} remove: scheduling .abc. for removal
10253 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10254           dotest conflicts2-142c3 "${testcvs} update" \
10255 "${PROG} update: Updating \."
10256           cd ../..
10257
10258           # conflicts2-142d*: test that if one party adds a file, and another
10259           # party has a file of the same name, cvs notices
10260           cd 1/first-dir
10261           touch aa.c
10262           echo 'contents unchanged' >same.c
10263           dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
10264 "${PROG} add: scheduling file .aa\.c. for addition
10265 ${PROG} add: scheduling file .same\.c. for addition
10266 ${PROG} add: use .${PROG} commit. to add these files permanently"
10267           dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
10268 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa\.c,v
10269 done
10270 Checking in aa\.c;
10271 ${CVSROOT_DIRNAME}/first-dir/aa\.c,v  <--  aa\.c
10272 initial revision: 1\.1
10273 done
10274 RCS file: ${CVSROOT_DIRNAME}/first-dir/same\.c,v
10275 done
10276 Checking in same\.c;
10277 ${CVSROOT_DIRNAME}/first-dir/same\.c,v  <--  same\.c
10278 initial revision: 1\.1
10279 done"
10280           cd ../../2/first-dir
10281           echo "don't you dare obliterate this text" >aa.c
10282           echo 'contents unchanged' >same.c
10283           # Note the discrepancy between local and remote in the handling
10284           # of same.c.  I kind
10285           # of suspect that the local CVS behavior is the more useful one
10286           # although I do sort of wonder whether we should make people run
10287           # cvs add just to get them in that habit (also, trying to implement
10288           # the local CVS behavior for remote without the cvs add seems 
10289           # pretty difficult).
10290           if $remote; then
10291             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
10292 "${QUESTION} aa\.c
10293 ${QUESTION} same\.c
10294 ${PROG} update: move away \./aa\.c; it is in the way
10295 C aa\.c
10296 ${PROG} update: move away \./same\.c; it is in the way
10297 C same\.c"
10298           else
10299             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
10300 "${PROG} [a-z]*: move away aa\.c; it is in the way
10301 C aa\.c
10302 U same\.c"
10303           fi
10304           dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
10305 "${PROG} status: move away aa\.c; it is in the way
10306 ===================================================================
10307 File: aa\.c                     Status: Unresolved Conflict
10308
10309    Working revision:    No entry for aa\.c
10310    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/aa\.c,v"
10311
10312           # Could also be testing the case in which the cvs add happened
10313           # before the commit by the other user.
10314           # This message seems somewhat bogus.  I mean, parallel development
10315           # means that we get to work in parallel if we choose, right?  And
10316           # then at commit time it would be a conflict.
10317           dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
10318 "${PROG} add: aa.c added independently by second party"
10319
10320           # The user might want to see just what the conflict is.
10321           # Don't bother, diff seems to kind of lose its mind, with or
10322           # without -N.  This is a CVS bug(s).
10323           #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
10324
10325           # Now: "how can the user resolve this conflict", I hear you cry.
10326           # Well, one way is to forget about the file in the working
10327           # directory.
10328           # Since it didn't let us do the add in conflicts2-142d4, there
10329           # is no need to run cvs rm here.
10330           #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
10331           dotest conflicts2-142d6 "rm aa.c" ''
10332           dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
10333           dotest conflicts2-142d8 "cat aa.c" ''
10334
10335           # The other way is to use the version from the working directory
10336           # instead of the version from the repository.  Unfortunately,
10337           # there doesn't seem to be any particularly clear way to do
10338           # this (?).
10339
10340           cd ../..
10341
10342           rm -r 1 2; rm -rf ${CVSROOT_DIRNAME}/first-dir
10343           ;;
10344
10345         conflicts3)
10346           # More tests of conflicts and/or multiple working directories
10347           # in general.
10348
10349           mkdir 1; cd 1
10350           dotest conflicts3-1 "${testcvs} -q co -l ." ''
10351           mkdir first-dir
10352           dotest conflicts3-2 "${testcvs} add first-dir" \
10353 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
10354           cd ..
10355           mkdir 2; cd 2
10356           dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
10357           cd ../1/first-dir
10358           touch file1 file2
10359           dotest conflicts3-4 "${testcvs} add file1 file2" \
10360 "${PROG} add: scheduling file .file1. for addition
10361 ${PROG} add: scheduling file .file2. for addition
10362 ${PROG} add: use .${PROG} commit. to add these files permanently"
10363           dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
10364 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
10365 done
10366 Checking in file1;
10367 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
10368 initial revision: 1\.1
10369 done
10370 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
10371 done
10372 Checking in file2;
10373 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
10374 initial revision: 1\.1
10375 done"
10376           cd ../../2/first-dir
10377           # Check that -n doesn't make CVS lose its mind as it creates
10378           # (or rather, doesn't) a new file.
10379           dotest conflicts3-6 "${testcvs} -nq update" \
10380 "U file1
10381 U file2"
10382           dotest_fail conflicts3-7 "test -f file1" ''
10383           dotest conflicts3-8 "${testcvs} -q update" \
10384 "U file1
10385 U file2"
10386           dotest conflicts3-9 "test -f file2" ''
10387
10388           # OK, now remove two files at once
10389           dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
10390 "${PROG} remove: scheduling .file1. for removal
10391 ${PROG} remove: scheduling .file2. for removal
10392 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
10393           dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
10394 "Removing file1;
10395 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
10396 new revision: delete; previous revision: 1\.1
10397 done
10398 Removing file2;
10399 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
10400 new revision: delete; previous revision: 1\.1
10401 done"
10402           cd ../../1/first-dir
10403           dotest conflicts3-12 "${testcvs} -n -q update" \
10404 "${PROG} update: file1 is no longer in the repository
10405 ${PROG} update: file2 is no longer in the repository"
10406           dotest conflicts3-13 "${testcvs} -q update" \
10407 "${PROG} update: file1 is no longer in the repository
10408 ${PROG} update: file2 is no longer in the repository"
10409
10410           # OK, now add a directory to both working directories
10411           # and see that CVS doesn't lose its mind.
10412           mkdir sdir
10413           dotest conflicts3-14 "${testcvs} add sdir" \
10414 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
10415           touch sdir/sfile
10416           dotest conflicts3-14a "${testcvs} add sdir/sfile" \
10417 "${PROG} add: scheduling file .sdir/sfile. for addition
10418 ${PROG} add: use .${PROG} commit. to add this file permanently"
10419           dotest conflicts3-14b "${testcvs} -q ci -m add" \
10420 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v
10421 done
10422 Checking in sdir/sfile;
10423 ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
10424 initial revision: 1\.1
10425 done"
10426
10427           cd ../../2/first-dir
10428
10429           # Create a CVS directory without the proper administrative
10430           # files in it.  This can happen for example if you hit ^C
10431           # in the middle of a checkout.
10432           mkdir sdir
10433           mkdir sdir/CVS
10434           # OK, in the local case CVS sees that the directory exists
10435           # in the repository and recurses into it.  In the remote case
10436           # CVS can't see the repository and has no way of knowing
10437           # that sdir is even a directory (stat'ing everything would be
10438           # too slow).  The remote behavior makes more sense to me (but
10439           # would this affect other cases?).
10440           if $remote; then
10441             dotest conflicts3-15 "${testcvs} -q update" \
10442 "${QUESTION} sdir"
10443           else
10444             dotest conflicts3-15 "${testcvs} -q update" \
10445 "${QUESTION} sdir
10446 ${PROG} update: ignoring sdir (CVS/Repository missing)"
10447             touch sdir/CVS/Repository
10448             dotest conflicts3-16 "${testcvs} -q update" \
10449 "${QUESTION} sdir
10450 ${PROG} update: ignoring sdir (CVS/Entries missing)"
10451             cd ..
10452             dotest conflicts3-16a "${testcvs} -q update first-dir" \
10453 "${QUESTION} first-dir/sdir
10454 ${PROG} update: ignoring first-dir/sdir (CVS/Entries missing)"
10455             cd first-dir
10456           fi
10457           rm -r sdir
10458
10459           # OK, now the same thing, but the directory doesn't exist
10460           # in the repository.
10461           mkdir newdir
10462           mkdir newdir/CVS
10463           dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
10464           echo "D/newdir////" >> CVS/Entries
10465           dotest conflicts3-18 "${testcvs} -q update" \
10466 "${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
10467           touch newdir/CVS/Repository
10468           dotest conflicts3-19 "${testcvs} -q update" \
10469 "${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
10470           cd ..
10471           dotest conflicts3-20 "${testcvs} -q update first-dir" \
10472 "${PROG} [a-z]*: ignoring first-dir/newdir (CVS/Entries missing)"
10473           cd first-dir
10474           rm -r newdir
10475
10476           # The previous tests have left CVS/Entries in something of a mess.
10477           # While we "should" be able to deal with that (maybe), for now
10478           # we just start over.
10479           cd ..
10480           rm -r first-dir
10481           dotest conflicts3-20a "${testcvs} -q co -l first-dir" ''
10482           cd first-dir
10483
10484           dotest conflicts3-21 "${testcvs} -q update -d sdir" "U sdir/sfile"
10485           rm -r sdir/CVS
10486           dotest conflicts3-22 "${testcvs} -q update" "${QUESTION} sdir"
10487           if $remote; then
10488             dotest_fail conflicts3-23 "${testcvs} -q update -PdA" \
10489 "${QUESTION} sdir
10490 ${PROG} update: move away sdir/sfile; it is in the way
10491 C sdir/sfile"
10492           else
10493             dotest conflicts3-23 "${testcvs} -q update -PdA" \
10494 "${QUESTION} sdir"
10495           fi
10496
10497           # Not that it should really affect much, but let's do the case
10498           # where sfile has been removed.  For example, suppose that sdir
10499           # had been a CVS-controlled directory which was then removed
10500           # by removing each file (and using update -P or some such).  Then
10501           # suppose that the build process creates an sdir directory which
10502           # is not supposed to be under CVS.
10503           rm -r sdir
10504           dotest conflicts3-24 "${testcvs} -q update -d sdir" "U sdir/sfile"
10505           rm sdir/sfile
10506           dotest conflicts3-25 "${testcvs} rm sdir/sfile" \
10507 "${PROG} remove: scheduling .sdir/sfile. for removal
10508 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
10509           dotest conflicts3-26 "${testcvs} ci -m remove sdir/sfile" \
10510 "Removing sdir/sfile;
10511 ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
10512 new revision: delete; previous revision: 1\.1
10513 done"
10514           rm -r sdir/CVS
10515           dotest conflicts3-27 "${testcvs} -q update" "${QUESTION} sdir"
10516           dotest conflicts3-28 "${testcvs} -q update -PdA" \
10517 "${QUESTION} sdir"
10518
10519           cd ../..
10520
10521           rm -r 1 2
10522           rm -rf ${CVSROOT_DIRNAME}/first-dir
10523           ;;
10524
10525         clean)
10526           # Test update -C (overwrite local mods w/ repository copies)
10527           mkdir 1; cd 1
10528           dotest clean-1 "${testcvs} -q co -l ." ''
10529           mkdir first-dir
10530           dotest clean-2 "${testcvs} add first-dir" \
10531 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
10532           cd first-dir
10533           echo "The usual boring test text." > cleanme.txt
10534           dotest clean-3 "${testcvs} add cleanme.txt" \
10535 "${PROG} add: scheduling file .cleanme\.txt. for addition
10536 ${PROG} add: use .${PROG} commit. to add this file permanently"
10537           dotest clean-4 "${testcvs} -q ci -m clean-3" \
10538 "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
10539 done
10540 Checking in cleanme\.txt;
10541 ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
10542 initial revision: 1\.1
10543 done"
10544           # Okay, preparation is done, now test.
10545           # Check that updating an unmodified copy works.
10546           dotest clean-5 "${testcvs} -q update" ''
10547           # Check that updating -C an unmodified copy works.
10548           dotest clean-6 "${testcvs} -q update -C" ''
10549           # Check that updating a modified copy works.
10550           echo "fish" >> cleanme.txt
10551           dotest clean-7 "${testcvs} -q update" 'M cleanme\.txt'
10552           # Check that updating -C a modified copy works.
10553           dotest clean-8 "${testcvs} -q update -C" \
10554 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
10555 U cleanme\.txt"
10556           # And check that the backup copy really was made.
10557           dotest clean-9 "cat .#cleanme.txt.1.1" \
10558 "The usual boring test text\.
10559 fish"
10560
10561           # Do it all again, this time naming the file explicitly.
10562           rm .#cleanme.txt.1.1
10563           dotest clean-10 "${testcvs} -q update cleanme.txt" ''
10564           dotest clean-11 "${testcvs} -q update -C cleanme.txt" ''
10565           echo "bluegill" >> cleanme.txt
10566           dotest clean-12 "${testcvs} -q update cleanme.txt" 'M cleanme\.txt'
10567           dotest clean-13 "${testcvs} -q update -C cleanme.txt" \
10568 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
10569 U cleanme\.txt"
10570           # And check that the backup copy really was made.
10571           dotest clean-14 "cat .#cleanme.txt.1.1" \
10572 "The usual boring test text\.
10573 bluegill"
10574
10575           # Now try with conflicts
10576           cd ..
10577           dotest clean-15 "${testcvs} -q co -d second-dir first-dir" \
10578 'U second-dir/cleanme\.txt'
10579           cd second-dir
10580           echo "conflict test" >> cleanme.txt
10581           dotest clean-16 "${testcvs} -q ci -m." \
10582 "Checking in cleanme\.txt;
10583 ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
10584 new revision: 1\.2; previous revision: 1\.1
10585 done"
10586           cd ../first-dir
10587           echo "fish" >> cleanme.txt
10588           dotest clean-17 "${testcvs} -nq update" \
10589 "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
10590 retrieving revision 1\.1
10591 retrieving revision 1\.2
10592 Merging differences between 1\.1 and 1\.2 into cleanme\.txt
10593 rcsmerge: warning: conflicts during merge
10594 ${PROG} update: conflicts found in cleanme\.txt
10595 C cleanme\.txt"
10596           dotest clean-18 "${testcvs} -q update -C" \
10597 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
10598 U cleanme\.txt"
10599           dotest clean-19 "cat .#cleanme.txt.1.1" \
10600 "The usual boring test text\.
10601 fish"
10602           
10603           # Done.  Clean up.
10604           cd ../..
10605           rm -rf 1
10606           rm -rf ${CVSROOT_DIRNAME}/first-dir
10607           ;;
10608
10609         modules)
10610           # Tests of various ways to define and use modules.
10611           # Roadmap to various modules tests:
10612           # -a:
10613           #   error on incorrect placement: modules
10614           #   error combining with other options: modules2-a*
10615           #   infinite loops: modules148a1.1 - modules148a1.2
10616           #   use to specify a file more than once: modules3
10617           #   use with ! feature: modules4
10618           # regular modules: modules, modules2, cvsadm
10619           # ampersand modules: modules2
10620           # -s: modules.
10621           # -d: modules, modules3, cvsadm
10622           # -i, -o, -u, -e, -t: modules5
10623           # slashes in module names: modules3
10624           # invalid module definitions: modules6
10625
10626           ############################################################
10627           # These tests are to make sure that administrative files get
10628           # rebuilt, regardless of how and where files are checked
10629           # out.
10630           ############################################################
10631           # Check out the whole repository
10632           mkdir 1; cd 1
10633           dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
10634 U CVSROOT/commitinfo
10635 U CVSROOT/config
10636 U CVSROOT/cvswrappers
10637 U CVSROOT/editinfo
10638 U CVSROOT/loginfo
10639 U CVSROOT/modules
10640 U CVSROOT/notify
10641 U CVSROOT/rcsinfo
10642 U CVSROOT/taginfo
10643 U CVSROOT/verifymsg'
10644           echo "# made a change" >>CVSROOT/modules
10645           dotest modules-1d "${testcvs} -q ci -m add-modules" \
10646 "Checking in CVSROOT/modules;
10647 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
10648 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
10649 done
10650 ${PROG} commit: Rebuilding administrative file database"
10651           cd ..
10652           rm -rf 1
10653
10654           ############################################################
10655           # Check out CVSROOT
10656           mkdir 1; cd 1
10657           dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
10658 U CVSROOT/commitinfo
10659 U CVSROOT/config
10660 U CVSROOT/cvswrappers
10661 U CVSROOT/editinfo
10662 U CVSROOT/loginfo
10663 U CVSROOT/modules
10664 U CVSROOT/notify
10665 U CVSROOT/rcsinfo
10666 U CVSROOT/taginfo
10667 U CVSROOT/verifymsg'
10668           echo "# made a change" >>CVSROOT/modules
10669           dotest modules-2d "${testcvs} -q ci -m add-modules" \
10670 "Checking in CVSROOT/modules;
10671 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
10672 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
10673 done
10674 ${PROG} commit: Rebuilding administrative file database"
10675           cd ..
10676           rm -rf 1
10677
10678           ############################################################
10679           # Check out CVSROOT in some other directory
10680           mkdir ${CVSROOT_DIRNAME}/somedir
10681           mkdir 1; cd 1
10682           dotest modules-3 "${testcvs} -q co somedir" ''
10683           cd somedir
10684           dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
10685 U CVSROOT/commitinfo
10686 U CVSROOT/config
10687 U CVSROOT/cvswrappers
10688 U CVSROOT/editinfo
10689 U CVSROOT/loginfo
10690 U CVSROOT/modules
10691 U CVSROOT/notify
10692 U CVSROOT/rcsinfo
10693 U CVSROOT/taginfo
10694 U CVSROOT/verifymsg'
10695           echo "# made a change" >>CVSROOT/modules
10696           dotest modules-3g "${testcvs} -q ci -m add-modules" \
10697 "Checking in CVSROOT/modules;
10698 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
10699 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
10700 done
10701 ${PROG} commit: Rebuilding administrative file database"
10702           cd ../..
10703           rm -rf 1
10704           rm -rf ${CVSROOT_DIRNAME}/somedir
10705           ############################################################
10706           # end rebuild tests
10707           ############################################################
10708
10709
10710           mkdir ${CVSROOT_DIRNAME}/first-dir
10711
10712           mkdir 1
10713           cd 1
10714
10715           dotest modules-143 "${testcvs} -q co first-dir" ""
10716
10717           cd first-dir
10718           mkdir subdir
10719           dotest modules-143a "${testcvs} add subdir" \
10720 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
10721
10722           cd subdir
10723           mkdir ssdir
10724           dotest modules-143b "${testcvs} add ssdir" \
10725 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
10726
10727           touch a b
10728
10729           dotest modules-144 "${testcvs} add a b" \
10730 "${PROG} add: scheduling file .a. for addition
10731 ${PROG} add: scheduling file .b. for addition
10732 ${PROG} add: use .${PROG} commit. to add these files permanently"
10733
10734           dotest modules-145 "${testcvs} ci -m added" \
10735 "${PROG} [a-z]*: Examining .
10736 ${PROG} [a-z]*: Examining ssdir
10737 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
10738 done
10739 Checking in a;
10740 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
10741 initial revision: 1\.1
10742 done
10743 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
10744 done
10745 Checking in b;
10746 ${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
10747 initial revision: 1\.1
10748 done"
10749
10750           cd ..
10751           dotest modules-146 "${testcvs} -q co CVSROOT" \
10752 "U CVSROOT/checkoutlist
10753 U CVSROOT/commitinfo
10754 U CVSROOT/config
10755 U CVSROOT/cvswrappers
10756 U CVSROOT/editinfo
10757 U CVSROOT/loginfo
10758 U CVSROOT/modules
10759 U CVSROOT/notify
10760 U CVSROOT/rcsinfo
10761 U CVSROOT/taginfo
10762 U CVSROOT/verifymsg"
10763
10764           # Here we test that CVS can deal with CVSROOT (whose repository
10765           # is at top level) in the same directory as subdir (whose repository
10766           # is a subdirectory of first-dir).  TODO: Might want to check that
10767           # files can actually get updated in this state.
10768           dotest modules-147 "${testcvs} -q update" ""
10769
10770           cat >CVSROOT/modules <<EOF
10771 realmodule first-dir/subdir a
10772 dirmodule first-dir/subdir
10773 namedmodule -d nameddir first-dir/subdir
10774 aliasmodule -a first-dir/subdir/a
10775 aliasnested -a first-dir/subdir/ssdir
10776 topfiles -a first-dir/file1 first-dir/file2
10777 world -a .
10778 statusmod -s Mungeable
10779 # Check for ability to block infinite loops.
10780 infinitealias -a infinitealias
10781 # Prior to 1.11.12 & 1.12.6, the infinite alias loop check didn't strip
10782 # slashes or work if a module called a module which then called itself
10783 # (A -> A was blocked, but not A -> B -> A or deeper).
10784 infinitealias2 -a infinitealias2/
10785 infinitealias3 -a infinitealias4/
10786 infinitealias4 -a aliasmodule infinitealias5
10787 infinitealias5 -a infinitealias3/
10788 # Options must come before arguments.  It is possible this should
10789 # be relaxed at some point (though the result would be bizarre for
10790 # -a); for now test the current behavior.
10791 bogusalias first-dir/subdir/a -a
10792 EOF
10793           dotest modules-148 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
10794 "Checking in CVSROOT/modules;
10795 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
10796 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
10797 done
10798 ${PROG} commit: Rebuilding administrative file database"
10799
10800           cd ..
10801           # The "statusmod" module contains an error; trying to use it
10802           # will produce "modules file missing directory" I think.
10803           # However, that shouldn't affect the ability of "cvs co -c" or
10804           # "cvs co -s" to do something reasonable with it.
10805           dotest modules-148a0 "${testcvs} co -c" 'aliasmodule  -a first-dir/subdir/a
10806 aliasnested  -a first-dir/subdir/ssdir
10807 bogusalias   first-dir/subdir/a -a
10808 dirmodule    first-dir/subdir
10809 infinitealias -a infinitealias
10810 infinitealias2 -a infinitealias2/
10811 infinitealias3 -a infinitealias4/
10812 infinitealias4 -a aliasmodule infinitealias5
10813 infinitealias5 -a infinitealias3/
10814 namedmodule  -d nameddir first-dir/subdir
10815 realmodule   first-dir/subdir a
10816 statusmod    -s Mungeable
10817 topfiles     -a first-dir/file1 first-dir/file2
10818 world        -a \.'
10819           # There is code in modules.c:save_d which explicitly skips
10820           # modules defined with -a, which is why aliasmodule is not
10821           # listed.
10822           dotest modules-148a1 "${testcvs} co -s" \
10823 'statusmod    Mungeable  
10824 bogusalias   NONE        first-dir/subdir/a -a
10825 dirmodule    NONE        first-dir/subdir
10826 namedmodule  NONE        first-dir/subdir
10827 realmodule   NONE        first-dir/subdir a'
10828
10829           # Check that infinite loops are avoided
10830           dotest modules-148a1.1 "${testcvs} co infinitealias" \
10831 "$PROG checkout: module \`infinitealias' in modules file contains infinite loop" \
10832 "$PROG server: module \`infinitealias' in modules file contains infinite loop
10833 $PROG checkout: module \`infinitealias' in modules file contains infinite loop"
10834           # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
10835           # strip slashes.
10836           dotest modules-148a1.2 "${testcvs} co infinitealias2" \
10837 "$PROG checkout: module \`infinitealias2' in modules file contains infinite loop" \
10838 "$PROG server: module \`infinitealias2' in modules file contains infinite loop
10839 $PROG checkout: module \`infinitealias2' in modules file contains infinite loop"
10840           # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
10841           # notice when A -> B -> A, it only noticed A -> A.
10842           dotest modules-148a1.3 "${testcvs} co infinitealias3/" \
10843 "$PROG checkout: module \`infinitealias3' in modules file contains infinite loop" \
10844 "$PROG server: module \`infinitealias3' in modules file contains infinite loop
10845 $PROG checkout: module \`infinitealias3' in modules file contains infinite loop"
10846
10847           # Test that real modules check out to realmodule/a, not subdir/a.
10848           dotest modules-149a1 "${testcvs} co realmodule" "U realmodule/a"
10849           dotest modules-149a2 "test -d realmodule && test -f realmodule/a" ""
10850           dotest_fail modules-149a3 "test -f realmodule/b" ""
10851           dotest modules-149a4 "${testcvs} -q co realmodule" ""
10852           dotest modules-149a5 "echo yes | ${testcvs} release -d realmodule" \
10853 "You have \[0\] altered files in this repository\.
10854 Are you sure you want to release (and delete) directory .realmodule.: "
10855
10856           dotest_fail modules-149b1 "${testcvs} co realmodule/a" \
10857 "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
10858 "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
10859 '"${PROG}"' \[checkout aborted\]: cannot expand modules'
10860
10861           # Now test the ability to check out a single file from a directory
10862           dotest modules-150c "${testcvs} co dirmodule/a" "U dirmodule/a"
10863           dotest modules-150d "test -d dirmodule && test -f dirmodule/a" ""
10864           dotest_fail modules-150e "test -f dirmodule/b" ""
10865           dotest modules-150f "echo yes | ${testcvs} release -d dirmodule" \
10866 "You have \[0\] altered files in this repository\.
10867 Are you sure you want to release (and delete) directory .dirmodule.: "
10868           # Now test the ability to correctly reject a non-existent filename.
10869           # For maximum studliness we would check that an error message is
10870           # being output.
10871           # We accept a zero exit status because it is what CVS does
10872           # (Dec 95).  Probably the exit status should be nonzero,
10873           # however.
10874           dotest modules-150g1 "${testcvs} co dirmodule/nonexist" \
10875 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared"
10876           # We tolerate the creation of the dirmodule directory, since that
10877           # is what CVS does, not because we view that as preferable to not
10878           # creating it.
10879           dotest_fail modules-150g2 "test -f dirmodule/a || test -f dirmodule/b" ""
10880           rm -r dirmodule
10881
10882           # Now test that a module using -d checks out to the specified
10883           # directory.
10884           dotest modules-150h1 "${testcvs} -q co namedmodule" \
10885 'U nameddir/a
10886 U nameddir/b'
10887           dotest modules-150h2 "test -f nameddir/a && test -f nameddir/b" ""
10888           echo add line >>nameddir/a
10889           dotest modules-150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
10890           rm nameddir/a
10891           dotest modules-150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
10892           dotest modules-150h99 "echo yes | ${testcvs} release -d nameddir" \
10893 "You have \[0\] altered files in this repository\.
10894 Are you sure you want to release (and delete) directory .nameddir.: "
10895
10896           # Now test that alias modules check out to subdir/a, not
10897           # aliasmodule/a.
10898           dotest modules-151 "${testcvs} co aliasmodule" ""
10899           dotest_fail modules-152 "test -d aliasmodule" ""
10900           echo abc >>first-dir/subdir/a
10901           dotest modules-153 "${testcvs} -q co aliasmodule" "M first-dir/subdir/a"
10902
10903           cd ..
10904           rm -r 1
10905
10906           mkdir 2
10907           cd 2
10908           dotest modules-155a0 "${testcvs} co aliasnested" \
10909 "${PROG} checkout: Updating first-dir/subdir/ssdir"
10910           dotest modules-155a1 "test -d first-dir" ''
10911           dotest modules-155a2 "test -d first-dir/subdir" ''
10912           dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
10913           # Test that nothing extraneous got created.
10914           dotest modules-155a4 "ls" "first-dir" \
10915 "CVS
10916 first-dir"
10917           cd ..
10918           rm -r 2
10919
10920           # Test checking out everything.
10921           mkdir 1
10922           cd 1
10923           dotest modules-155b "${testcvs} -q co world" \
10924 "U CVSROOT/${DOTSTAR}
10925 U first-dir/subdir/a
10926 U first-dir/subdir/b"
10927           cd ..
10928           rm -r 1
10929
10930           # Test checking out a module which lists at least two
10931           # specific files twice.  At one time, this failed over
10932           # remote CVS.
10933           mkdir 1
10934           cd 1
10935           dotest modules-155c1 "${testcvs} -q co first-dir" \
10936 "U first-dir/subdir/a
10937 U first-dir/subdir/b"
10938
10939           cd first-dir
10940           echo 'first revision' > file1
10941           echo 'first revision' > file2
10942           dotest modules-155c2 "${testcvs} add file1 file2" \
10943 "${PROG}"' add: scheduling file `file1'\'' for addition
10944 '"${PROG}"' add: scheduling file `file2'\'' for addition
10945 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
10946           dotest modules-155c3 "${testcvs} -q ci -m add-it" \
10947 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
10948 done
10949 Checking in file1;
10950 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
10951 initial revision: 1\.1
10952 done
10953 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
10954 done
10955 Checking in file2;
10956 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
10957 initial revision: 1\.1
10958 done"
10959
10960           cd ..
10961           rm -r first-dir
10962           dotest modules-155c4 "${testcvs} -q co topfiles" \
10963 "U first-dir/file1
10964 U first-dir/file2"
10965           dotest modules-155c5 "${testcvs} -q co topfiles" ""
10966
10967           # Make sure the right thing happens if we remove a file.
10968           cd first-dir
10969           dotest modules-155c6 "${testcvs} -q rm -f file1" \
10970 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
10971           dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
10972 "Removing file1;
10973 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
10974 new revision: delete; previous revision: 1\.1
10975 done"
10976           cd ..
10977           rm -r first-dir
10978           dotest modules-155c8 "${testcvs} -q co topfiles" \
10979 "${PROG} checkout: warning: first-dir/file1 is not (any longer) pertinent
10980 U first-dir/file2"
10981
10982           cd ..
10983           rm -r 1
10984
10985           rm -rf ${CVSROOT_DIRNAME}/first-dir
10986           ;;
10987
10988         modules2)
10989           # More tests of modules, in particular the & feature.
10990           mkdir 1; cd 1
10991           dotest modules2-setup-1 "${testcvs} -q co -l ." ''
10992           mkdir first-dir second-dir third-dir
10993           dotest modules2-setup-2 \
10994 "${testcvs} add first-dir second-dir third-dir" \
10995 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
10996 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository
10997 Directory ${CVSROOT_DIRNAME}/third-dir added to the repository"
10998           cd third-dir
10999           touch file3
11000           dotest modules2-setup-3 "${testcvs} add file3" \
11001 "${PROG} add: scheduling file .file3. for addition
11002 ${PROG} add: use .${PROG} commit. to add this file permanently"
11003           dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
11004 "RCS file: ${CVSROOT_DIRNAME}/third-dir/file3,v
11005 done
11006 Checking in file3;
11007 ${CVSROOT_DIRNAME}/third-dir/file3,v  <--  file3
11008 initial revision: 1\.1
11009 done"
11010           cd ../..
11011           rm -r 1
11012
11013           mkdir 1
11014           cd 1
11015
11016           dotest modules2-1 "${testcvs} -q co CVSROOT/modules" \
11017 'U CVSROOT/modules'
11018           cd CVSROOT
11019           cat >> modules << EOF
11020 ampermodule &first-dir &second-dir
11021 combmodule third-dir file3 &first-dir
11022 ampdirmod -d newdir &first-dir &second-dir
11023 badmod -d newdir
11024 messymod first-dir &messymodchild
11025 messymodchild -d sdir/child second-dir
11026 EOF
11027           # Depending on whether the user also ran the modules test
11028           # we will be checking in revision 1.2 or 1.3.
11029           dotest modules2-2 "${testcvs} -q ci -m add-modules" \
11030 "Checking in modules;
11031 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11032 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11033 done
11034 ${PROG} commit: Rebuilding administrative file database"
11035
11036           cd ..
11037
11038           dotest modules2-3 "${testcvs} -q co ampermodule" ''
11039           dotest modules2-4 "test -d ampermodule/first-dir" ''
11040           dotest modules2-5 "test -d ampermodule/second-dir" ''
11041
11042           # Test ability of cvs release to handle multiple arguments
11043           # See comment at "release" for list of other cvs release tests.
11044           cd ampermodule
11045           if ${testcvs} release -d first-dir second-dir <<EOF >>${LOGFILE}
11046 yes
11047 yes
11048 EOF
11049           then
11050             pass modules2-6
11051           else
11052             fail modules2-6
11053           fi
11054           dotest_fail modules2-7 "test -d first-dir" ''
11055           dotest_fail modules2-8 "test -d second-dir" ''
11056
11057           cd ..
11058
11059           # There used to be a nasty-hack that made CVS skip creation of the
11060           # module dir (in this case ampermodule) when -n was specified
11061           dotest modules2-ampermod-1 "${testcvs} -q co -n ampermodule" ''
11062           dotest modules2-ampermod-2 "test -d ampermodule/first-dir" ''
11063           dotest modules2-ampermod-3 "test -d ampermodule/second-dir" ''
11064
11065           # Test release of a module
11066           if echo yes |${testcvs} release -d ampermodule >>${LOGFILE}; then
11067             pass modules2-ampermod-release-1
11068           else
11069             fail modules2-ampermod-release-1
11070           fi
11071           dotest_fail modules2-ampermod-release-2 "test -d ampermodule" ''
11072
11073           # and the '-n' test again, but in conjunction with '-d'
11074           dotest modules2-ampermod-4 "${testcvs} -q co -n -d newname ampermodule" ''
11075           dotest modules2-ampermod-5 "test -d newname/first-dir" ''
11076           dotest modules2-ampermod-6 "test -d newname/second-dir" ''
11077           rm -rf newname
11078
11079           # Now we create another directory named first-dir and make
11080           # sure that CVS doesn't get them mixed up.
11081           mkdir first-dir
11082           # Note that this message should say "Updating ampermodule/first-dir"
11083           # I suspect.  This is a long-standing behavior/bug....
11084           dotest modules2-9 "${testcvs} co ampermodule" \
11085 "${PROG} checkout: Updating first-dir
11086 ${PROG} checkout: Updating second-dir"
11087           touch ampermodule/first-dir/amper1
11088           cd ampermodule
11089           dotest modules2-10 "${testcvs} add first-dir/amper1" \
11090 "${PROG} add: scheduling file .first-dir/amper1. for addition
11091 ${PROG} add: use .${PROG} commit. to add this file permanently"
11092           cd ..
11093
11094           # As with the "Updating xxx" message, the "U first-dir/amper1"
11095           # message (instead of "U ampermodule/first-dir/amper1") is
11096           # rather fishy.
11097           dotest modules2-12 "${testcvs} co ampermodule" \
11098 "${PROG} checkout: Updating first-dir
11099 A first-dir/amper1
11100 ${PROG} checkout: Updating second-dir"
11101
11102           if $remote; then
11103             dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
11104 "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
11105 done
11106 Checking in ampermodule/first-dir/amper1;
11107 ${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
11108 initial revision: 1\.1
11109 done"
11110           else
11111             # Trying this as above led to a "protocol error" message.
11112             # Work around this bug.
11113             cd ampermodule
11114             dotest modules2-13 "${testcvs} -q ci -m add-it" \
11115 "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
11116 done
11117 Checking in first-dir/amper1;
11118 ${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
11119 initial revision: 1\.1
11120 done"
11121             cd ..
11122           fi
11123           cd ..
11124           rm -r 1
11125
11126           # Now test the "combmodule" module (combining regular modules
11127           # and ampersand modules in the same module definition).
11128           mkdir 1; cd 1
11129           dotest modules2-14 "${testcvs} co combmodule" \
11130 "U combmodule/file3
11131 ${PROG} checkout: Updating first-dir
11132 U first-dir/amper1"
11133           dotest modules2-15 "test -f combmodule/file3" ""
11134           dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
11135           cd combmodule
11136           rm -r first-dir
11137           # At least for now there is no way to tell CVS that
11138           # some files/subdirectories come from one repository directory,
11139           # and others from another.
11140           # This seems like a pretty sensible behavior to me, in the
11141           # sense that first-dir doesn't "really" exist within
11142           # third-dir, so CVS just acts as if there is nothing there
11143           # to do.
11144           dotest modules2-17 "${testcvs} update -d" \
11145 "${PROG} update: Updating \."
11146
11147           cd ..
11148           dotest modules2-18 "${testcvs} -q co combmodule" \
11149 "U first-dir/amper1"
11150           dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
11151           cd ..
11152           rm -r 1
11153
11154           # Now test the "ampdirmod" and "badmod" modules to be sure that
11155           # options work with ampersand modules but don't prevent the
11156           # "missing directory" error message.
11157           mkdir 1; cd 1
11158           dotest modules2-20 "${testcvs} co ampdirmod" \
11159 "${PROG} checkout: Updating first-dir
11160 U first-dir/amper1
11161 ${PROG} checkout: Updating second-dir"
11162           dotest modules2-21 "test -f newdir/first-dir/amper1" ""
11163           dotest modules2-22 "test -d newdir/second-dir" ""
11164           dotest_fail modules2-23 "${testcvs} co badmod" \
11165 "${PROG} checkout: modules file missing directory for module badmod" \
11166 "${PROG} server: modules file missing directory for module badmod
11167 ${PROG} \[checkout aborted\]: cannot expand modules"
11168           cd ..
11169           rm -r 1
11170
11171           # Confirm that a rename with added depth nested in an ampersand
11172           # module works.
11173           mkdir 1; cd 1
11174           dotest modules2-nestedrename-1 "${testcvs} -q co messymod" \
11175 "U messymod/amper1"
11176           dotest modules2-nestedrename-2 "test -d messymod/sdir" ''
11177           dotest modules2-nestedrename-3 "test -d messymod/sdir/CVS" ''
11178           dotest modules2-nestedrename-4 "test -d messymod/sdir/child" ''
11179           dotest modules2-nestedrename-5 "test -d messymod/sdir/child/CVS" ''
11180           cd ..; rm -r 1
11181
11182           # FIXME:  client/server has a bug.  It should be working like a local
11183           # repository in this case, but fails to check out the second module
11184           # in the list when a branch is specified.
11185           mkdir 1; cd 1
11186           dotest modules2-ampertag-setup-1 \
11187 "${testcvs} -Q rtag tag first-dir second-dir third-dir" \
11188 ''
11189           dotest modules2-ampertag-1 "${testcvs} -q co -rtag ampermodule" \
11190 "U first-dir/amper1"
11191           if $remote; then
11192             dotest_fail modules2-ampertag-2 "test -d ampermodule/second-dir" ''
11193             dotest_fail modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
11194           else
11195             dotest modules2-ampertag-2 "test -d ampermodule/second-dir" ''
11196             dotest modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
11197           fi
11198           cd ..; rm -r 1
11199
11200           # Test for tag files when an ampermod is renamed with more path
11201           # elements than it started with.
11202           #
11203           # FIXME: This is currently broken in the remote case, possibly only
11204           # because the messymodchild isn't being checked out at all.
11205           mkdir 1; cd 1
11206 #         dotest modules2-tagfiles-setup-1 \
11207 #"${testcvs} -Q rtag -b branch first-dir second-dir" \
11208 #''
11209           dotest modules2-tagfiles-1 "${testcvs} -q co -rtag messymod" \
11210 "U messymod/amper1"
11211           if $remote; then
11212             dotest_fail modules2-tagfiles-2r "test -d messymod/sdir" ''
11213           else
11214             dotest modules2-tagfiles-2 "cat messymod/sdir/CVS/Tag" 'Ttag'
11215           fi
11216           cd ..; rm -r 1
11217
11218           # Test that CVS gives an error if one combines -a with
11219           # other options.
11220           # Probably would be better to break this out into a separate
11221           # test.  Although it is short, it shares no files/state with
11222           # the rest of the modules2 tests.
11223           mkdir 1; cd 1
11224           dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
11225 'U CVSROOT/modules'
11226           cd CVSROOT
11227           echo 'aliasopt -a -d onedir first-dir' >modules
11228           dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
11229 "Checking in modules;
11230 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11231 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11232 done
11233 ${PROG} commit: Rebuilding administrative file database"
11234           cd ..
11235           dotest_fail modules2-a1 "${testcvs} -q co aliasopt" \
11236 "${PROG} checkout: -a cannot be specified in the modules file along with other options" \
11237 "${PROG} server: -a cannot be specified in the modules file along with other options
11238 ${PROG} \[checkout aborted\]: cannot expand modules"
11239           cd ..;  rm -r 1
11240
11241           # Clean up.
11242           rm -rf ${CVSROOT_DIRNAME}/first-dir
11243           rm -rf ${CVSROOT_DIRNAME}/second-dir
11244           rm -rf ${CVSROOT_DIRNAME}/third-dir
11245           ;;
11246
11247         modules3)
11248           # More tests of modules, in particular what happens if several
11249           # modules point to the same file.
11250
11251           # First just set up a directory first-dir and a file file1 in it.
11252           mkdir 1; cd 1
11253
11254           dotest modules3-0 "${testcvs} -q co -l ." ''
11255           mkdir first-dir
11256           dotest modules3-1 "${testcvs} add first-dir" \
11257 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11258
11259           cd first-dir
11260           echo file1 >file1
11261           dotest modules3-2 "${testcvs} add file1" \
11262 "${PROG} add: scheduling file \`file1' for addition
11263 ${PROG} add: use '${PROG} commit' to add this file permanently"
11264           dotest modules3-3 "${testcvs} -q ci -m add-it" \
11265 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11266 done
11267 Checking in file1;
11268 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11269 initial revision: 1\.1
11270 done"
11271           cd ..
11272
11273           dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
11274 "U CVSROOT${DOTSTAR}"
11275           cd CVSROOT
11276           cat >modules <<EOF
11277 mod1 -a first-dir/file1
11278 bigmod -a mod1 first-dir/file1
11279 namednest -d src/sub/dir first-dir
11280 nestdeeper -d src/sub1/sub2/sub3/dir first-dir
11281 nestshallow -d src/dir second-dir/suba/subb
11282 path/in/modules &mod1
11283 another/path/test -d another/path/test first-dir
11284 EOF
11285           dotest modules3-5 "${testcvs} -q ci -m add-modules" \
11286 "Checking in modules;
11287 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11288 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11289 done
11290 ${PROG} commit: Rebuilding administrative file database"
11291           cd ..
11292
11293           dotest modules3-6 "${testcvs} -q co bigmod" ''
11294           rm -r first-dir
11295           dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
11296           cd ..
11297           rm -r 1
11298
11299           mkdir 1; cd 1
11300           mkdir suba
11301           mkdir suba/subb
11302           # This fails to work remote (it doesn't notice the directories,
11303           # I suppose because they contain no files).  Bummer, especially
11304           # considering this is a documented technique and everything.
11305           dotest modules3-7a \
11306 "${testcvs} import -m add-dirs second-dir tag1 tag2" \
11307 "${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba
11308 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba/subb
11309
11310 No conflicts created by this import" "
11311 No conflicts created by this import"
11312           cd ..; rm -r 1
11313           mkdir 1; cd 1
11314           dotest modules3-7b "${testcvs} co second-dir" \
11315 "${PROG} checkout: Updating second-dir
11316 ${PROG} checkout: Updating second-dir/suba
11317 ${PROG} checkout: Updating second-dir/suba/subb" \
11318 "${PROG} checkout: Updating second-dir"
11319
11320           if $remote; then
11321             cd second-dir
11322             mkdir suba
11323             dotest modules3-7-workaround1 "${testcvs} add suba" \
11324 "Directory ${CVSROOT_DIRNAME}/second-dir/suba added to the repository"
11325             cd suba
11326             mkdir subb
11327             dotest modules3-7-workaround2 "${testcvs} add subb" \
11328 "Directory ${CVSROOT_DIRNAME}/second-dir/suba/subb added to the repository"
11329             cd ../..
11330           fi
11331
11332           cd second-dir/suba/subb
11333           touch fileb
11334           dotest modules3-7c "${testcvs} add fileb" \
11335 "${PROG} add: scheduling file .fileb. for addition
11336 ${PROG} add: use .${PROG} commit. to add this file permanently"
11337           dotest modules3-7d "${testcvs} -q ci -m add-it" \
11338 "RCS file: ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v
11339 done
11340 Checking in fileb;
11341 ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v  <--  fileb
11342 initial revision: 1\.1
11343 done"
11344           cd ../../..
11345           cd ..; rm -r 1
11346
11347           mkdir 1
11348           cd 1
11349           dotest modules3-8 "${testcvs} -q co namednest" \
11350 'U src/sub/dir/file1'
11351           dotest modules3-9 "test -f src/sub/dir/file1" ''
11352           cd ..
11353           rm -r 1
11354
11355           # Try the same thing, but with the directories nested even
11356           # deeper (deeply enough so they are nested more deeply than
11357           # the number of directories from / to ${TESTDIR}).
11358           mkdir 1
11359           cd 1
11360           dotest modules3-10 "${testcvs} -q co nestdeeper" \
11361 'U src/sub1/sub2/sub3/dir/file1'
11362           dotest modules3-11 "test -f src/sub1/sub2/sub3/dir/file1" ''
11363
11364           # While we are doing things like twisted uses of '/' (e.g.
11365           # modules3-12), try this one.
11366           if $remote; then
11367             dotest_fail modules3-11b \
11368 "${testcvs} -q update ${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1" \
11369 "absolute pathname .${TESTDIR}/1/src/sub1/sub2/sub3/dir. illegal for server"
11370           fi # end of remote-only tests
11371
11372           cd ..
11373           rm -r 1
11374
11375           # This one is almost too twisted for words.  The pathname output
11376           # in the message from "co" doesn't include the "path/in/modules",
11377           # but those directories do get created (with no CVSADM except
11378           # in "modules" which has a CVSNULLREPOS).
11379           # I'm not sure anyone is relying on this nonsense or whether we
11380           # need to keep doing it, but it is what CVS currently does...
11381           # Skip it for remote; the remote code has the good sense to
11382           # not deal with it (on the minus side it gives
11383           # "internal error: repository string too short." (CVS 1.9) or
11384           # "warning: server is not creating directories one at a time" (now)
11385           # instead of a real error).
11386           # I'm tempted to just make it a fatal error to have '/' in a
11387           # module name.  But see comments at modules3-16.
11388           if $remote; then :; else
11389             mkdir 1; cd 1
11390             dotest modules3-12 "${testcvs} -q co path/in/modules" \
11391 "U first-dir/file1"
11392             dotest modules3-13 "test -f path/in/modules/first-dir/file1" ''
11393             cd ..; rm -r 1
11394           fi # end of tests skipped for remote
11395
11396           # Now here is where it used to get seriously bogus.
11397           mkdir 1; cd 1
11398           dotest modules3-14 \
11399 "${testcvs} -q rtag tag1 path/in/modules" ''
11400           # CVS used to create this even though rtag should *never* affect
11401           # the directory current when it is called!
11402           dotest_fail modules3-15 "test -d path/in/modules" ''
11403           # Just for trivia's sake, rdiff was not similarly vulnerable
11404           # because it passed 0 for run_module_prog to do_module.
11405           cd ..; rm -r 1
11406
11407           # Some people seem to want this to work.  I still suspect there
11408           # are dark corners in slashes in module names.  This probably wants
11409           # more thought before we start hacking on CVS (one way or the other)
11410           # or documenting this.
11411           mkdir 2; cd 2
11412           dotest modules3-16 "${testcvs} -q co another/path/test" \
11413 "U another/path/test/file1"
11414           dotest modules3-17 "cat another/path/test/file1" 'file1'
11415           cd ..; rm -r 2
11416
11417           rm -rf ${CVSROOT_DIRNAME}/first-dir
11418           rm -rf ${CVSROOT_DIRNAME}/second-dir
11419           ;;
11420
11421         modules4)
11422           # Some tests using the modules file with aliases that
11423           # exclude particular directories.
11424
11425           mkdir 1; cd 1
11426
11427           dotest modules4-1 "${testcvs} -q co -l ." ''
11428           mkdir first-dir
11429           dotest modules4-2 "${testcvs} add first-dir" \
11430 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11431
11432           cd first-dir
11433           mkdir subdir
11434           dotest modules4-3 "${testcvs} add subdir" \
11435 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
11436
11437           echo file1 > file1
11438           dotest modules4-4 "${testcvs} add file1" \
11439 "${PROG}"' add: scheduling file `file1'\'' for addition
11440 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
11441
11442           echo file2 > subdir/file2
11443           dotest modules4-5 "${testcvs} add subdir/file2" \
11444 "${PROG}"' add: scheduling file `subdir/file2'\'' for addition
11445 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
11446
11447           dotest modules4-6 "${testcvs} -q ci -m add-it" \
11448 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11449 done
11450 Checking in file1;
11451 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11452 initial revision: 1\.1
11453 done
11454 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
11455 done
11456 Checking in subdir/file2;
11457 ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v  <--  file2
11458 initial revision: 1\.1
11459 done"
11460
11461           cd ..
11462
11463           dotest modules4-7 "${testcvs} -q update -d CVSROOT" \
11464 "U CVSROOT${DOTSTAR}"
11465           cd CVSROOT
11466           cat >modules <<EOF
11467 all -a first-dir
11468 some -a !first-dir/subdir first-dir
11469 somewhat -a first-dir !first-dir/subdir
11470 EOF
11471           dotest modules4-8 "${testcvs} -q ci -m add-modules" \
11472 "Checking in modules;
11473 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11474 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11475 done
11476 ${PROG} commit: Rebuilding administrative file database"
11477           cd ..
11478
11479           cd ..
11480           mkdir 2; cd 2
11481
11482           dotest modules4-9 "${testcvs} -q co all" \
11483 "U first-dir/file1
11484 U first-dir/subdir/file2"
11485           rm -r first-dir
11486
11487           dotest modules4-10 "${testcvs} -q co some" "U first-dir/file1"
11488           dotest_fail modules4-11 "test -d first-dir/subdir" ''
11489           rm -r first-dir
11490
11491           if $remote; then
11492             # But remote seems to do it the other way.
11493             dotest modules4-11a "${testcvs} -q co somewhat" "U first-dir/file1"
11494             dotest_fail modules4-11b "test -d first-dir/subdir" ''
11495           else
11496             # This is strange behavior, in that the order of the
11497             # "!first-dir/subdir" and "first-dir" matter, and it isn't
11498             # clear that they should.  I suspect it is long-standing
11499             # strange behavior but I haven't verified that.
11500             dotest modules4-11a "${testcvs} -q co somewhat" \
11501 "U first-dir/file1
11502 U first-dir/subdir/file2"
11503           fi
11504           rm -r first-dir
11505
11506           cd ..
11507           rm -r 2
11508
11509           dotest modules4-12 "${testcvs} rtag tag some" \
11510 "${PROG} rtag: Tagging first-dir
11511 ${PROG} rtag: Ignoring first-dir/subdir"
11512
11513           cd 1/first-dir/subdir
11514           dotest modules4-13 "${testcvs} log file2" "
11515 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
11516 Working file: file2
11517 head: 1\.1
11518 branch:
11519 locks: strict
11520 access list:
11521 symbolic names:
11522 keyword substitution: kv
11523 total revisions: 1;     selected revisions: 1
11524 description:
11525 ----------------------------
11526 revision 1\.1
11527 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
11528 add-it
11529 ============================================================================="
11530
11531           cd ../../..
11532           rm -r 1
11533
11534           rm -rf ${CVSROOT_DIRNAME}/first-dir
11535           ;;
11536
11537         modules5)
11538           # Test module programs
11539
11540           mkdir ${CVSROOT_DIRNAME}/first-dir
11541           mkdir 1
11542           cd 1
11543           dotest modules5-1 "${testcvs} -q co first-dir" ""
11544           cd first-dir
11545           mkdir subdir
11546           dotest modules5-2 "${testcvs} add subdir" \
11547 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
11548           cd subdir
11549           mkdir ssdir
11550           dotest modules5-3 "${testcvs} add ssdir" \
11551 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
11552           touch a b
11553           dotest modules5-4 "${testcvs} add a b" \
11554 "${PROG} add: scheduling file .a. for addition
11555 ${PROG} add: scheduling file .b. for addition
11556 ${PROG} add: use .${PROG} commit. to add these files permanently"
11557
11558           dotest modules5-5 "${testcvs} ci -m added" \
11559 "${PROG} [a-z]*: Examining .
11560 ${PROG} [a-z]*: Examining ssdir
11561 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
11562 done
11563 Checking in a;
11564 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
11565 initial revision: 1\.1
11566 done
11567 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
11568 done
11569 Checking in b;
11570 ${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
11571 initial revision: 1\.1
11572 done"
11573
11574           cd ..
11575           dotest modules5-6 "${testcvs} -q co CVSROOT" \
11576 "U CVSROOT/checkoutlist
11577 U CVSROOT/commitinfo
11578 U CVSROOT/config
11579 U CVSROOT/cvswrappers
11580 U CVSROOT/editinfo
11581 U CVSROOT/loginfo
11582 U CVSROOT/modules
11583 U CVSROOT/notify
11584 U CVSROOT/rcsinfo
11585 U CVSROOT/taginfo
11586 U CVSROOT/verifymsg"
11587
11588           # FIXCVS: The sleep in the following script helps avoid out of
11589           # order messages, but we really need to figure out how to fix
11590           # cvs to prevent them in the first place.
11591           for i in checkout export tag; do
11592             cat >> ${CVSROOT_DIRNAME}/$i.sh <<EOF
11593 #! /bin/sh
11594 sleep 1
11595 echo "$i script invoked in \`pwd\`"
11596 echo "args: \$@"
11597 EOF
11598             # Cygwin doesn't set premissions correctly over the Samba share.
11599             if test -n "$remotehost"; then
11600               $CVS_RSH $remotehost "chmod +x ${CVSROOT_DIRNAME}/$i.sh"
11601             else
11602               chmod +x ${CVSROOT_DIRNAME}/$i.sh
11603             fi
11604           done
11605
11606           OPTS="-o${CVSROOT_DIRNAME}/checkout.sh -e ${CVSROOT_DIRNAME}/export.sh -t${CVSROOT_DIRNAME}/tag.sh"
11607           cat >CVSROOT/modules <<EOF
11608 realmodule ${OPTS} first-dir/subdir a
11609 dirmodule ${OPTS} first-dir/subdir
11610 namedmodule -d nameddir ${OPTS} first-dir/subdir
11611 EOF
11612
11613           dotest modules5-7 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
11614 "" \
11615 "Checking in CVSROOT/modules;
11616 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11617 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11618 done
11619 ${PROG} commit: Rebuilding administrative file database"
11620
11621           cd ..
11622           rm -rf first-dir
11623
11624           # Test that real modules check out to realmodule/a, not subdir/a.
11625           if $remote; then
11626             dotest modules5-8 "${testcvs} co realmodule" \
11627 "U realmodule/a
11628 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
11629 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11630 args: realmodule"
11631           else
11632             dotest modules5-8 "${testcvs} co realmodule" \
11633 "U realmodule/a
11634 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
11635 checkout script invoked in ${TESTDIR}/1
11636 args: realmodule"
11637           fi
11638           dotest modules5-9 "test -d realmodule && test -f realmodule/a" ""
11639           dotest_fail modules5-10 "test -f realmodule/b" ""
11640           if $remote; then
11641             dotest modules5-11 "${testcvs} -q co realmodule" \
11642 "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11643 args: realmodule"
11644             dotest modules5-12 "${testcvs} -q update" ''
11645             echo "change" >>realmodule/a
11646             dotest modules5-13 "${testcvs} -q ci -m." \
11647 "Checking in realmodule/a;
11648 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
11649 new revision: 1\.2; previous revision: 1\.1
11650 done"
11651           else
11652             dotest modules5-11 "${testcvs} -q co realmodule" \
11653 "checkout script invoked in ${TESTDIR}/1
11654 args: realmodule"
11655             dotest modules5-12 "${testcvs} -q update" ''
11656             echo "change" >>realmodule/a
11657             dotest modules5-13 "${testcvs} -q ci -m." \
11658 "Checking in realmodule/a;
11659 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
11660 new revision: 1\.2; previous revision: 1\.1
11661 done"
11662           fi
11663           dotest modules5-14 "echo yes | ${testcvs} release -d realmodule" \
11664 "You have \[0\] altered files in this repository\.
11665 Are you sure you want to release (and delete) directory .realmodule.: "
11666           dotest modules5-15 "${testcvs} -q rtag -Dnow MYTAG realmodule" \
11667 "tag script invoked in ${TESTDIR}/1
11668 args: realmodule MYTAG" \
11669 "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11670 args: realmodule MYTAG"
11671           if $remote; then
11672             dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
11673 "U realmodule/a
11674 export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11675 args: realmodule"
11676           else
11677             dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
11678 "U realmodule/a
11679 export script invoked in ${TESTDIR}/1
11680 args: realmodule"
11681           fi
11682           rm -r realmodule
11683
11684           dotest_fail modules5-17 "${testcvs} co realmodule/a" \
11685 "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
11686 "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
11687 '"${PROG}"' \[checkout aborted\]: cannot expand modules'
11688
11689           # Now test the ability to check out a single file from a directory
11690           if $remote; then
11691             dotest modules5-18 "${testcvs} co dirmodule/a" \
11692 "U dirmodule/a
11693 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
11694 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11695 args: dirmodule"
11696           else
11697             dotest modules5-18 "${testcvs} co dirmodule/a" \
11698 "U dirmodule/a
11699 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
11700 checkout script invoked in ${TESTDIR}/1
11701 args: dirmodule"
11702           fi
11703           dotest modules5-19 "test -d dirmodule && test -f dirmodule/a" ""
11704           dotest_fail modules5-20 "test -f dirmodule/b" ""
11705           dotest modules5-21 "echo yes | ${testcvs} release -d dirmodule" \
11706 "You have \[0\] altered files in this repository\.
11707 Are you sure you want to release (and delete) directory .dirmodule.: "
11708
11709           # Now test the ability to correctly reject a non-existent filename.
11710           # For maximum studliness we would check that an error message is
11711           # being output.
11712           # We accept a zero exit status because it is what CVS does
11713           # (Dec 95).  Probably the exit status should be nonzero,
11714           # however.
11715           if $remote; then
11716             dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
11717 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
11718 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
11719 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11720 args: dirmodule"
11721           else
11722             dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
11723 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
11724 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
11725 checkout script invoked in ${TESTDIR}/1
11726 args: dirmodule"
11727           fi
11728           # We tolerate the creation of the dirmodule directory, since that
11729           # is what CVS does, not because we view that as preferable to not
11730           # creating it.
11731           dotest_fail modules5-23 "test -f dirmodule/a || test -f dirmodule/b" ""
11732           rm -r dirmodule
11733
11734           # Now test that a module using -d checks out to the specified
11735           # directory.
11736           if $remote; then
11737             dotest modules5-24 "${testcvs} -q co namedmodule" \
11738 "U nameddir/a
11739 U nameddir/b
11740 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11741 args: nameddir"
11742           else
11743             dotest modules5-24 "${testcvs} -q co namedmodule" \
11744 "U nameddir/a
11745 U nameddir/b
11746 checkout script invoked in ${TESTDIR}/1
11747 args: nameddir"
11748           fi
11749           dotest modules5-25 "test -f nameddir/a && test -f nameddir/b" ""
11750           echo add line >>nameddir/a
11751           # This seems suspicious: when we checkout an existing directory,
11752           # the checkout script gets executed in addition to the update
11753           # script.  Is that by design or accident?
11754           if $remote; then
11755             dotest modules5-26 "${testcvs} -q co namedmodule" \
11756 "M nameddir/a
11757 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11758 args: nameddir"
11759           else
11760             dotest modules5-26 "${testcvs} -q co namedmodule" \
11761 "M nameddir/a
11762 checkout script invoked in ${TESTDIR}/1
11763 args: nameddir"
11764           fi
11765           rm nameddir/a
11766
11767           if $remote; then
11768             dotest modules5-27 "${testcvs} -q co namedmodule" \
11769 "U nameddir/a
11770 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11771 args: nameddir"
11772           else
11773             dotest modules5-27 "${testcvs} -q co namedmodule" \
11774 "U nameddir/a
11775 checkout script invoked in ${TESTDIR}/1
11776 args: nameddir"
11777           fi
11778           dotest modules5-28 "echo yes | ${testcvs} release -d nameddir" \
11779 "You have \[0\] altered files in this repository\.
11780 Are you sure you want to release (and delete) directory .nameddir.: "
11781
11782           # Now try the same tests with -d on command line
11783           # FIXCVS?  The manual says the modules programs get the module name,
11784           # but they really get the directory name.
11785           if $remote; then
11786             dotest modules5-29 "${testcvs} co -d mydir realmodule" \
11787 "U mydir/a
11788 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11789 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11790 args: mydir"
11791           else
11792             dotest modules5-29 "${testcvs} co -d mydir realmodule" \
11793 "U mydir/a
11794 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11795 checkout script invoked in ${TESTDIR}/1
11796 args: mydir"
11797           fi
11798           dotest modules5-30 "test -d mydir && test -f mydir/a" ""
11799           dotest_fail modules5-31 "test -d realmodule || test -f mydir/b" ""
11800           if $remote; then
11801             dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
11802 "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11803 args: mydir"
11804             dotest modules5-33 "${testcvs} -q update" ''
11805             echo "change" >>mydir/a
11806             dotest modules5-34 "${testcvs} -q ci -m." \
11807 "Checking in mydir/a;
11808 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
11809 new revision: 1\.3; previous revision: 1\.2
11810 done"
11811           else
11812             dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
11813 "checkout script invoked in ${TESTDIR}/1
11814 args: mydir"
11815             dotest modules5-33 "${testcvs} -q update" ''
11816             echo "change" >>mydir/a
11817             dotest modules5-34 "${testcvs} -q ci -m." \
11818 "Checking in mydir/a;
11819 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
11820 new revision: 1\.3; previous revision: 1\.2
11821 done"
11822           fi
11823           dotest modules5-35 "echo yes | ${testcvs} release -d mydir" \
11824 "You have \[0\] altered files in this repository\.
11825 Are you sure you want to release (and delete) directory .mydir.: "
11826           if $remote; then
11827             dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
11828 "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11829 args: realmodule MYTAG2"
11830             dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
11831 "U mydir/a
11832 export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11833 args: mydir"
11834           else
11835             dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
11836 "tag script invoked in ${TESTDIR}/1
11837 args: realmodule MYTAG2"
11838             dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
11839 "U mydir/a
11840 export script invoked in ${TESTDIR}/1
11841 args: mydir"
11842           fi
11843           rm -r mydir
11844
11845           # Now test the ability to check out a single file from a directory
11846           if $remote; then
11847             dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
11848 "U mydir/a
11849 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11850 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11851 args: mydir"
11852           else
11853             dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
11854 "U mydir/a
11855 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11856 checkout script invoked in ${TESTDIR}/1
11857 args: mydir"
11858           fi
11859           dotest modules5-39 "test -d mydir && test -f mydir/a" ""
11860           dotest_fail modules5-40 "test -d dirmodule || test -f mydir/b" ""
11861           dotest modules5-41 "echo yes | ${testcvs} release -d mydir" \
11862 "You have \[0\] altered files in this repository\.
11863 Are you sure you want to release (and delete) directory .mydir.: "
11864
11865           # Now test the ability to correctly reject a non-existent filename.
11866           # For maximum studliness we would check that an error message is
11867           # being output.
11868           # We accept a zero exit status because it is what CVS does
11869           # (Dec 95).  Probably the exit status should be nonzero,
11870           # however.
11871           if $remote; then
11872             dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
11873 "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
11874 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11875 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11876 args: mydir"
11877           else
11878             dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
11879 "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
11880 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
11881 checkout script invoked in ${TESTDIR}/1
11882 args: mydir"
11883           fi
11884           # We tolerate the creation of the mydir directory, since that
11885           # is what CVS does, not because we view that as preferable to not
11886           # creating it.
11887           dotest_fail modules5-43 "test -f mydir/a || test -f mydir/b" ""
11888           rm -r mydir
11889
11890           if $remote; then
11891             dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
11892 "U mydir/a
11893 U mydir/b
11894 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11895 args: mydir"
11896           else
11897             dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
11898 "U mydir/a
11899 U mydir/b
11900 checkout script invoked in ${TESTDIR}/1
11901 args: mydir"
11902           fi
11903           dotest modules5-45 "test -f mydir/a && test -f mydir/b" ""
11904           dotest_fail modules5-46 "test -d namedir"
11905           echo add line >>mydir/a
11906           # This seems suspicious: when we checkout an existing directory,
11907           # the checkout script gets executed in addition to the update
11908           # script.  Is that by design or accident?
11909           if $remote; then
11910             dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
11911 "M mydir/a
11912 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11913 args: mydir"
11914           else
11915             dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
11916 "M mydir/a
11917 checkout script invoked in ${TESTDIR}/1
11918 args: mydir"
11919           fi
11920           rm mydir/a
11921
11922           if $remote; then
11923             dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
11924 "U mydir/a
11925 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
11926 args: mydir"
11927           else
11928             dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
11929 "U mydir/a
11930 checkout script invoked in ${TESTDIR}/1
11931 args: mydir"
11932           fi
11933           dotest modules5-49 "echo yes | ${testcvs} release -d mydir" \
11934 "You have \[0\] altered files in this repository\.
11935 Are you sure you want to release (and delete) directory .mydir.: "
11936
11937           cd ..
11938           rm -rf 1 ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/*.sh
11939           ;;
11940
11941         modules6)
11942           #
11943           # Test invalid module definitions
11944           #
11945           # See the header comment for the `modules' test for an index of
11946           # the complete suite of modules tests.
11947           #
11948
11949           #
11950           # There was a bug in CVS through 1.11.1p1 where a bad module name
11951           # would cause the previous line to be parsed as the module
11952           # definition.  This test proves this doesn't happen anymore.
11953           #
11954           mkdir modules6
11955           cd modules6
11956           dotest module6-setup-1 "${testcvs} -Q co CVSROOT" ""
11957           cd CVSROOT
11958           echo "longmodulename who cares" >modules
11959           echo "badname" >>modules
11960           # This test almost isn't setup since it generates the error message
11961           # we are looking for if `-Q' isn't specified, but I want to test the
11962           # filename in the message later.
11963           dotest modules6-setup-2 "${testcvs} -Q ci -mbad-modules" \
11964 "Checking in modules;
11965 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11966 new revision: [0-9.]*; previous revision: [0-9.]*
11967 done
11968 ${PROG} commit: Rebuilding administrative file database"
11969
11970           # Here's where CVS would report not being able to find `lename'
11971           cd ..
11972           dotest_fail modules6-1 "${testcvs} -q co badname" \
11973 "${PROG} checkout: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
11974 ${PROG} checkout: cannot find module .badname. - ignored" \
11975 "${PROG} server: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
11976 ${PROG} server: cannot find module .badname. - ignored
11977 ${PROG} \[checkout aborted\]: cannot expand modules"
11978
11979           # cleanup
11980           cd CVSROOT
11981           echo "# empty modules file" >modules
11982           dotest modules6-cleanup-1 "${testcvs} -Q ci -mempty-modules" \
11983 "Checking in modules;
11984 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11985 new revision: [0-9.]*; previous revision: [0-9.]*
11986 done
11987 ${PROG} commit: Rebuilding administrative file database"
11988           cd ../..
11989
11990           if $keep; then :; else
11991             rm -r modules6
11992           fi
11993           ;;
11994
11995         mkmodules)
11996           # When a file listed in checkoutlist doesn't exist, cvs-1.10.4
11997           # would fail to remove the CVSROOT/.#[0-9]* temporary file it
11998           # creates while mkmodules is in the process of trying to check
11999           # out the missing file.
12000
12001           mkdir 1; cd 1
12002           dotest mkmodules-temp-file-removal-1 "${testcvs} -Q co CVSROOT" ''
12003           cd CVSROOT
12004           echo no-such-file >> checkoutlist
12005           dotest mkmodules-temp-file-removal-2 "${testcvs} -Q ci -m. checkoutlist" \
12006 "Checking in checkoutlist;
12007 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
12008 new revision: 1\.2; previous revision: 1\.1
12009 done
12010 ${PROG} commit: Rebuilding administrative file database"
12011
12012           dotest mkmodules-temp-file-removal-3 "echo $CVSROOT_DIRNAME/CVSROOT/.#[0-9]*" \
12013             "$CVSROOT_DIRNAME/CVSROOT/\.#\[0-9\]\*"
12014
12015           # Versions 1.11.6 & 1.12.1 and earlier of CVS printed most of the
12016           # white space included before error messages in checkoutlist.
12017           echo "no-such-file     Failed to update no-such-file." >checkoutlist
12018           dotest mkmodules-error-message-1 "${testcvs} -Q ci -m. checkoutlist" \
12019 "Checking in checkoutlist;
12020 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
12021 new revision: 1\.3; previous revision: 1\.2
12022 done
12023 ${PROG} commit: Rebuilding administrative file database
12024 ${PROG} commit: Failed to update no-such-file\."
12025
12026           # Versions 1.11.6 & 1.12.1 and earlier of CVS used the error string
12027           # from the checkoutlist file as the format string passed to error()'s
12028           # printf.  Check that this is no longer the case by verifying that
12029           # printf format patterns remain unchanged.
12030           echo "no-such-file     Failed to update %s %lx times because %s happened %d times." >checkoutlist
12031           dotest mkmodules-error-message-2 "${testcvs} -Q ci -m. checkoutlist" \
12032 "Checking in checkoutlist;
12033 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
12034 new revision: 1\.4; previous revision: 1\.3
12035 done
12036 ${PROG} commit: Rebuilding administrative file database
12037 ${PROG} commit: Failed to update %s %lx times because %s happened %d times\."
12038
12039           dotest mkmodules-cleanup-1 "${testcvs} -Q up -pr1.1 checkoutlist >checkoutlist"
12040           dotest mkmodules-cleanup-2 "${testcvs} -Q ci -m. checkoutlist" \
12041 "Checking in checkoutlist;
12042 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
12043 new revision: 1\.5; previous revision: 1\.4
12044 done
12045 ${PROG} commit: Rebuilding administrative file database"
12046
12047           cd ../..
12048           rm -rf 1
12049           ;;
12050
12051         co-d)
12052           # Some tests of various permutations of co-d when directories exist
12053           # and checkouts lengthen.
12054           #
12055           # Interestingly enough, these same tests pass when the directory
12056           # lengthening happens via the modules file.  Go figure.
12057           module=co-d
12058           mkdir $module; cd $module
12059           mkdir top; cd top
12060           dotest co-d-init-1 "$testcvs -Q co -l ."
12061           mkdir $module
12062           dotest co-d-init-2 "$testcvs -Q add $module"
12063           cd $module
12064           echo content >file1
12065           echo different content >file2
12066           dotest co-d-init-3 "$testcvs -Q add file1 file2"
12067           dotest co-d-init-4 "$testcvs -Q ci -madd-em" \
12068 "RCS file: $CVSROOT_DIRNAME/co-d/file1,v
12069 done
12070 Checking in file1;
12071 $CVSROOT_DIRNAME/co-d/file1,v  <--  file1
12072 initial revision: 1\.1
12073 done
12074 RCS file: $CVSROOT_DIRNAME/co-d/file2,v
12075 done
12076 Checking in file2;
12077 $CVSROOT_DIRNAME/co-d/file2,v  <--  file2
12078 initial revision: 1\.1
12079 done"
12080           cd ../..
12081
12082           mkdir 2; cd 2
12083           dotest co-d-1 "$testcvs -q co -d dir $module" \
12084 "U dir/file1
12085 U dir/file2"
12086           dotest co-d-1.2 "cat dir/CVS/Repository" "$module"
12087
12088           # FIXCVS: This should work.  Correct expected result:
12089           #
12090           #"U dir2/sdir/file1
12091           #U dir2/sdir/file2"
12092           dotest_fail co-d-2 "$testcvs -q co -d dir2/sdir $module" \
12093 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir2': No such file or directory"
12094           # FIXCVS:
12095           # dotest co-d-2.2 "cat dir4/CVS/Repository" "CVSROOT/Emptydir"
12096           # dotest co-d-2.3 "cat dir5/CVS/Repository" "$module"
12097
12098           mkdir dir3
12099           dotest co-d-3 "$testcvs -q co -d dir3 $module" \
12100 "U dir3/file1
12101 U dir3/file2"
12102           dotest co-d-3.2 "cat dir3/CVS/Repository" "$module"
12103
12104           if $remote; then
12105             # FIXCVS: As for co-d-2.
12106             mkdir dir4
12107             dotest_fail co-d-4r "$testcvs -q co -d dir4/sdir $module" \
12108 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir4': No such file or directory"
12109
12110             # FIXCVS: As for co-d-2.
12111             mkdir dir5
12112             mkdir dir5/sdir
12113             dotest_fail co-d-5r "$testcvs -q co -d dir5/sdir $module" \
12114 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir5': No such file or directory"
12115           else
12116             mkdir dir4
12117             dotest co-d-4 "$testcvs -q co -d dir4/sdir $module" \
12118 "U dir4/sdir/file1
12119 U dir4/sdir/file2"
12120             # CVS only creates administration directories for directories it
12121             # creates, and the last portion of the path passed to -d
12122             # regardless.
12123             dotest_fail co-d-4.2 "test -d dir4/CVS"
12124             dotest co-d-4.3 "cat dir4/sdir/CVS/Repository" "$module"
12125
12126             mkdir dir5
12127             mkdir dir5/sdir
12128             dotest co-d-5 "$testcvs -q co -d dir5/sdir $module" \
12129 "U dir5/sdir/file1
12130 U dir5/sdir/file2"
12131             # CVS only creates administration directories for directories it
12132             # creates, and the last portion of the path passed to -d
12133             # regardless.
12134             dotest_fail co-d-5.2 "test -d dir5/CVS"
12135             dotest co-d-5.3 "cat dir5/sdir/CVS/Repository" "$module"
12136           fi
12137
12138           # clean up
12139           if $keep; then
12140             echo Keeping ${TESTDIR} and exiting due to --keep
12141             exit 0
12142           fi
12143
12144           cd ../..
12145           rm -rf $CVSROOT_DIRNAME/$module
12146           rm -r $module
12147           ;;
12148
12149         cvsadm)
12150           # These test check the content of CVS' administrative
12151           # files as they are checked out in various configurations.
12152           # (As a side note, I'm not using the "-q" flag in any of
12153           # this code, which should provide some extra checking for
12154           # those messages which don't seem to be checked thoroughly
12155           # anywhere else.)  To do a thorough test, we need to make
12156           # a bunch of modules in various configurations.
12157           #
12158           # <1mod> is a directory at the top level of cvsroot
12159           #    ``foo bar''
12160           # <2mod> is a directory at the second level of cvsroot
12161           #    ``foo bar/baz''
12162           # <1d1mod> is a directory at the top level which is
12163           #   checked out into another directory
12164           #     ``foo -d bar baz''
12165           # <1d2mod> is a directory at the second level which is
12166           #   checked out into another directory
12167           #     ``foo -d bar baz/quux''
12168           # <2d1mod> is a directory at the top level which is
12169           #   checked out into a directory that is two deep
12170           #     ``foo -d bar/baz quux''
12171           # <2d2mod> is a directory at the second level which is
12172           #   checked out into a directory that is two deep
12173           #     ``foo -d bar/baz quux''
12174           #
12175           # The tests do each of these types separately and in twos.
12176           # We also repeat each test -d flag for 1-deep and 2-deep
12177           # directories.
12178           #
12179           # Each test should check the output for the Repository
12180           # file, since that is the one which varies depending on 
12181           # the directory and how it was checked out.
12182           #
12183           # Yes, this is verbose, but at least it's very thorough.
12184
12185           # convenience variables
12186           REP=${CVSROOT}
12187
12188           # First, set TopLevelAdmin=yes so we're sure to get
12189           # top-level CVS directories.
12190           mkdir 1; cd 1
12191           dotest cvsadm-setup-1 "${testcvs} -q co CVSROOT/config" \
12192 "U CVSROOT/config"
12193           cd CVSROOT
12194           echo "TopLevelAdmin=yes" >config
12195           dotest cvsadm-setup-2 "${testcvs} -q ci -m yes-top-level" \
12196 "Checking in config;
12197 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
12198 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12199 done
12200 ${PROG} commit: Rebuilding administrative file database"
12201           cd ../..
12202           rm -r 1
12203
12204           # Second, check out the modules file and edit it.
12205           mkdir 1; cd 1
12206           dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
12207 "U CVSROOT/modules"
12208
12209           # Test CVS/Root once.  Since there is only one part of
12210           # the code which writes CVS/Root files (Create_Admin),
12211           # there is no point in testing this every time.
12212           dotest cvsadm-1a "cat CVS/Root" ${REP}
12213           dotest cvsadm-1b "cat CVS/Repository" "\."
12214           dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
12215           dotest cvsadm-1d "cat CVSROOT/CVS/Repository" "CVSROOT"
12216           # All of the defined module names begin with a number.
12217           # All of the top-level directory names begin with "dir".
12218           # All of the subdirectory names begin with "sub".
12219           # All of the top-level modules begin with "mod".
12220           echo "# Module defs for cvsadm tests" > CVSROOT/modules
12221           echo "1mod mod1" >> CVSROOT/modules
12222           echo "1mod-2 mod1-2" >> CVSROOT/modules
12223           echo "2mod mod2/sub2" >> CVSROOT/modules
12224           echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
12225           echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
12226           echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
12227           echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
12228           echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
12229           echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
12230           echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
12231           echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
12232           echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
12233           dotest cvsadm-1e "${testcvs} ci -m add-modules" \
12234 "${PROG} [a-z]*: Examining .
12235 ${PROG} [a-z]*: Examining CVSROOT
12236 Checking in CVSROOT/modules;
12237 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12238 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12239 done
12240 ${PROG} commit: Rebuilding administrative file database" \
12241 "${PROG} commit: Examining .
12242 ${PROG} commit: Examining CVSROOT"
12243           rm -rf CVS CVSROOT;
12244
12245           # Create the various modules
12246           dotest cvsadm-2 "${testcvs} -q co -l ." ''
12247           mkdir mod1
12248           mkdir mod1-2
12249           mkdir mod2
12250           mkdir mod2/sub2
12251           mkdir mod2-2
12252           mkdir mod2-2/sub2-2
12253           dotest cvsadm-2a "${testcvs} add mod1 mod1-2 mod2 mod2/sub2 mod2-2 mod2-2/sub2-2" \
12254 "Directory ${CVSROOT_DIRNAME}/mod1 added to the repository
12255 Directory ${CVSROOT_DIRNAME}/mod1-2 added to the repository
12256 Directory ${CVSROOT_DIRNAME}/mod2 added to the repository
12257 Directory ${CVSROOT_DIRNAME}/mod2/sub2 added to the repository
12258 Directory ${CVSROOT_DIRNAME}/mod2-2 added to the repository
12259 Directory ${CVSROOT_DIRNAME}/mod2-2/sub2-2 added to the repository"
12260
12261           # Populate the directories for the halibut
12262           echo "file1" > mod1/file1
12263           echo "file1-2" > mod1-2/file1-2
12264           echo "file2" > mod2/sub2/file2
12265           echo "file2-2" > mod2-2/sub2-2/file2-2
12266           dotest cvsadm-2aa "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
12267 "${PROG} add: scheduling file .mod1/file1. for addition
12268 ${PROG} add: scheduling file .mod1-2/file1-2. for addition
12269 ${PROG} add: scheduling file .mod2/sub2/file2. for addition
12270 ${PROG} add: scheduling file .mod2-2/sub2-2/file2-2. for addition
12271 ${PROG} add: use .${PROG} commit. to add these files permanently"
12272
12273           dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
12274 "${PROG} [a-z]*: Examining mod1
12275 ${PROG} [a-z]*: Examining mod1-2
12276 ${PROG} [a-z]*: Examining mod2
12277 ${PROG} [a-z]*: Examining mod2/sub2
12278 ${PROG} [a-z]*: Examining mod2-2
12279 ${PROG} [a-z]*: Examining mod2-2/sub2-2
12280 RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
12281 done
12282 Checking in mod1/file1;
12283 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
12284 initial revision: 1.1
12285 done
12286 RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
12287 done
12288 Checking in mod1-2/file1-2;
12289 ${CVSROOT_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
12290 initial revision: 1.1
12291 done
12292 RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
12293 done
12294 Checking in mod2/sub2/file2;
12295 ${CVSROOT_DIRNAME}/mod2/sub2/file2,v  <--  file2
12296 initial revision: 1.1
12297 done
12298 RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
12299 done
12300 Checking in mod2-2/sub2-2/file2-2;
12301 ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v  <--  file2-2
12302 initial revision: 1.1
12303 done"
12304           # Finished creating the modules -- clean up.
12305           rm -rf CVS mod1 mod1-2 mod2 mod2-2
12306           # Done.
12307
12308           ##################################################
12309           ## Start the dizzying array of possibilities.
12310           ## Begin with each module type separately.
12311           ##################################################
12312           
12313           # Pattern -- after each checkout, first check the top-level
12314           # CVS directory.  Then, check the directories in numerical
12315           # order.
12316
12317           dotest cvsadm-3 "${testcvs} co 1mod" \
12318 "${PROG} checkout: Updating 1mod
12319 U 1mod/file1"
12320           dotest cvsadm-3b "cat CVS/Repository" "\."
12321           dotest cvsadm-3d "cat 1mod/CVS/Repository" "mod1"
12322           rm -rf CVS 1mod
12323
12324           dotest cvsadm-4 "${testcvs} co 2mod" \
12325 "${PROG} checkout: Updating 2mod
12326 U 2mod/file2"
12327           dotest cvsadm-4b "cat CVS/Repository" "\."
12328           dotest cvsadm-4d "cat 2mod/CVS/Repository" "mod2/sub2"
12329           rm -rf CVS 2mod
12330
12331           dotest cvsadm-5 "${testcvs} co 1d1mod" \
12332 "${PROG} checkout: Updating dir1d1
12333 U dir1d1/file1"
12334           dotest cvsadm-5b "cat CVS/Repository" "\."
12335           dotest cvsadm-5d "cat dir1d1/CVS/Repository" "mod1"
12336           rm -rf CVS dir1d1
12337
12338           dotest cvsadm-6 "${testcvs} co 1d2mod" \
12339 "${PROG} checkout: Updating dir1d2
12340 U dir1d2/file2"
12341           dotest cvsadm-6b "cat CVS/Repository" "\."
12342           dotest cvsadm-6d "cat dir1d2/CVS/Repository" "mod2/sub2"
12343           rm -rf CVS dir1d2
12344
12345           dotest cvsadm-7 "${testcvs} co 2d1mod" \
12346 "${PROG} checkout: Updating dir2d1/sub2d1
12347 U dir2d1/sub2d1/file1"
12348           dotest cvsadm-7b "cat CVS/Repository" "\."
12349           dotest cvsadm-7d "cat dir2d1/CVS/Repository" "\."
12350           dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12351           rm -rf CVS dir2d1
12352
12353           dotest cvsadm-8 "${testcvs} co 2d2mod" \
12354 "${PROG} checkout: Updating dir2d2/sub2d2
12355 U dir2d2/sub2d2/file2"
12356           dotest cvsadm-8b "cat CVS/Repository" "\."
12357           dotest cvsadm-8d "cat dir2d2/CVS/Repository" "mod2"
12358           dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12359           rm -rf CVS dir2d2
12360
12361           ##################################################
12362           ## You are in a shell script of twisted little
12363           ## module combination statements, all alike.
12364           ##################################################
12365
12366           ### 1mod
12367           
12368           dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
12369 "${PROG} checkout: Updating 1mod
12370 U 1mod/file1
12371 ${PROG} checkout: Updating 1mod-2
12372 U 1mod-2/file1-2"
12373           # the usual for the top level
12374           dotest cvsadm-9b "cat CVS/Repository" "\."
12375           # the usual for 1mod
12376           dotest cvsadm-9d "cat 1mod/CVS/Repository" "mod1"
12377           # the usual for 1mod copy
12378           dotest cvsadm-9f "cat 1mod-2/CVS/Repository" "mod1-2"
12379           rm -rf CVS 1mod 1mod-2
12380
12381           # 1mod 2mod redmod bluemod
12382           dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
12383 "${PROG} checkout: Updating 1mod
12384 U 1mod/file1
12385 ${PROG} checkout: Updating 2mod
12386 U 2mod/file2"
12387           # the usual for the top level
12388           dotest cvsadm-10b "cat CVS/Repository" "\."
12389           # the usual for 1mod
12390           dotest cvsadm-10d "cat 1mod/CVS/Repository" "mod1"
12391           # the usual for 2dmod
12392           dotest cvsadm-10f "cat 2mod/CVS/Repository" "mod2/sub2"
12393           rm -rf CVS 1mod 2mod
12394
12395           dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
12396 "${PROG} checkout: Updating 1mod
12397 U 1mod/file1
12398 ${PROG} checkout: Updating dir1d1
12399 U dir1d1/file1"
12400           # the usual for the top level
12401           dotest cvsadm-11b "cat CVS/Repository" "\."
12402           # the usual for 1mod
12403           dotest cvsadm-11d "cat 1mod/CVS/Repository" "mod1"
12404           # the usual for 1d1mod
12405           dotest cvsadm-11f "cat dir1d1/CVS/Repository" "mod1"
12406           rm -rf CVS 1mod dir1d1
12407
12408           dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
12409 "${PROG} checkout: Updating 1mod
12410 U 1mod/file1
12411 ${PROG} checkout: Updating dir1d2
12412 U dir1d2/file2"
12413           # the usual for the top level
12414           dotest cvsadm-12b "cat CVS/Repository" "\."
12415           # the usual for 1mod
12416           dotest cvsadm-12d "cat 1mod/CVS/Repository" "mod1"
12417           # the usual for 1d2mod
12418           dotest cvsadm-12f "cat dir1d2/CVS/Repository" "mod2/sub2"
12419           rm -rf CVS 1mod dir1d2
12420
12421           dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
12422 "${PROG} checkout: Updating 1mod
12423 U 1mod/file1
12424 ${PROG} checkout: Updating dir2d1/sub2d1
12425 U dir2d1/sub2d1/file1"
12426           # the usual for the top level
12427           dotest cvsadm-13b "cat CVS/Repository" "\."
12428           # the usual for 1mod
12429           dotest cvsadm-13d "cat 1mod/CVS/Repository" "mod1"
12430           # the usual for 2d1mod
12431           dotest cvsadm-13f "cat dir2d1/CVS/Repository" "\."
12432           dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12433           rm -rf CVS 1mod dir2d1
12434
12435           dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
12436 "${PROG} checkout: Updating 1mod
12437 U 1mod/file1
12438 ${PROG} checkout: Updating dir2d2/sub2d2
12439 U dir2d2/sub2d2/file2"
12440           # the usual for the top level
12441           dotest cvsadm-14b "cat CVS/Repository" "\."
12442           # the usual for 1mod
12443           dotest cvsadm-14d "cat 1mod/CVS/Repository" "mod1"
12444           # the usual for 2d2mod
12445           dotest cvsadm-14f "cat dir2d2/CVS/Repository" "mod2"
12446           dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12447           rm -rf CVS 1mod dir2d2
12448
12449
12450           ### 2mod
12451           
12452           dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
12453 "${PROG} checkout: Updating 2mod
12454 U 2mod/file2
12455 ${PROG} checkout: Updating 2mod-2
12456 U 2mod-2/file2-2"
12457           # the usual for the top level
12458           dotest cvsadm-15b "cat CVS/Repository" "\."
12459           # the usual for 2mod
12460           dotest cvsadm-15d "cat 2mod/CVS/Repository" "mod2/sub2"
12461           # the usual for 2mod copy
12462           dotest cvsadm-15f "cat 2mod-2/CVS/Repository" "mod2-2/sub2-2"
12463           rm -rf CVS 2mod 2mod-2
12464
12465
12466           dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
12467 "${PROG} checkout: Updating 2mod
12468 U 2mod/file2
12469 ${PROG} checkout: Updating dir1d1
12470 U dir1d1/file1"
12471           # the usual for the top level
12472           dotest cvsadm-16b "cat CVS/Repository" "\."
12473           # the usual for 2mod
12474           dotest cvsadm-16d "cat 2mod/CVS/Repository" "mod2/sub2"
12475           # the usual for 1d1mod
12476           dotest cvsadm-16f "cat dir1d1/CVS/Repository" "mod1"
12477           rm -rf CVS 2mod dir1d1
12478
12479           dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
12480 "${PROG} checkout: Updating 2mod
12481 U 2mod/file2
12482 ${PROG} checkout: Updating dir1d2
12483 U dir1d2/file2"
12484           # the usual for the top level
12485           dotest cvsadm-17b "cat CVS/Repository" "\."
12486           # the usual for 2mod
12487           dotest cvsadm-17d "cat 2mod/CVS/Repository" "mod2/sub2"
12488           # the usual for 1d2mod
12489           dotest cvsadm-17f "cat dir1d2/CVS/Repository" "mod2/sub2"
12490           rm -rf CVS 2mod dir1d2
12491
12492           dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
12493 "${PROG} checkout: Updating 2mod
12494 U 2mod/file2
12495 ${PROG} checkout: Updating dir2d1/sub2d1
12496 U dir2d1/sub2d1/file1"
12497           # the usual for the top level
12498           dotest cvsadm-18b "cat CVS/Repository" "\."
12499           # the usual for 2mod
12500           dotest cvsadm-18d "cat 2mod/CVS/Repository" "mod2/sub2"
12501           # the usual for 2d1mod
12502           dotest cvsadm-18f "cat dir2d1/CVS/Repository" "\."
12503           dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12504           rm -rf CVS 2mod dir2d1
12505
12506           dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
12507 "${PROG} checkout: Updating 2mod
12508 U 2mod/file2
12509 ${PROG} checkout: Updating dir2d2/sub2d2
12510 U dir2d2/sub2d2/file2"
12511           # the usual for the top level
12512           dotest cvsadm-19b "cat CVS/Repository" "\."
12513           # the usual for 2mod
12514           dotest cvsadm-19d "cat 2mod/CVS/Repository" "mod2/sub2"
12515           # the usual for 2d2mod
12516           dotest cvsadm-19f "cat dir2d2/CVS/Repository" "mod2"
12517           dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12518           rm -rf CVS 2mod dir2d2
12519
12520
12521           ### 1d1mod
12522
12523           dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
12524 "${PROG} checkout: Updating dir1d1
12525 U dir1d1/file1
12526 ${PROG} checkout: Updating dir1d1-2
12527 U dir1d1-2/file1-2"
12528           # the usual for the top level
12529           dotest cvsadm-20b "cat CVS/Repository" "\."
12530           # the usual for 1d1mod
12531           dotest cvsadm-20d "cat dir1d1/CVS/Repository" "mod1"
12532           # the usual for 1d1mod copy
12533           dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" "mod1-2"
12534           rm -rf CVS dir1d1 dir1d1-2
12535
12536           dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
12537 "${PROG} checkout: Updating dir1d1
12538 U dir1d1/file1
12539 ${PROG} checkout: Updating dir1d2
12540 U dir1d2/file2"
12541           # the usual for the top level
12542           dotest cvsadm-21b "cat CVS/Repository" "\."
12543           # the usual for 1d1mod
12544           dotest cvsadm-21d "cat dir1d1/CVS/Repository" "mod1"
12545           # the usual for 1d2mod
12546           dotest cvsadm-21f "cat dir1d2/CVS/Repository" "mod2/sub2"
12547           rm -rf CVS dir1d1 dir1d2
12548
12549           dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
12550 "${PROG} checkout: Updating dir1d1
12551 U dir1d1/file1
12552 ${PROG} checkout: Updating dir2d1/sub2d1
12553 U dir2d1/sub2d1/file1"
12554           # the usual for the top level
12555           dotest cvsadm-22b "cat CVS/Repository" "\."
12556           # the usual for 1d1mod
12557           dotest cvsadm-22d "cat dir1d1/CVS/Repository" "mod1"
12558           # the usual for 2d1mod
12559           dotest cvsadm-22f "cat dir2d1/CVS/Repository" "\."
12560           dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12561           rm -rf CVS dir1d1 dir2d1
12562
12563           dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
12564 "${PROG} checkout: Updating dir1d1
12565 U dir1d1/file1
12566 ${PROG} checkout: Updating dir2d2/sub2d2
12567 U dir2d2/sub2d2/file2"
12568           # the usual for the top level
12569           dotest cvsadm-23b "cat CVS/Repository" "\."
12570           # the usual for 1d1mod
12571           dotest cvsadm-23d "cat dir1d1/CVS/Repository" "mod1"
12572           # the usual for 2d2mod
12573           dotest cvsadm-23f "cat dir2d2/CVS/Repository" "mod2"
12574           dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12575           rm -rf CVS dir1d1 dir2d2
12576
12577
12578           ### 1d2mod
12579
12580           dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
12581 "${PROG} checkout: Updating dir1d2
12582 U dir1d2/file2
12583 ${PROG} checkout: Updating dir1d2-2
12584 U dir1d2-2/file2-2"
12585           # the usual for the top level
12586           dotest cvsadm-24b "cat CVS/Repository" "\."
12587           # the usual for 1d2mod
12588           dotest cvsadm-24d "cat dir1d2/CVS/Repository" "mod2/sub2"
12589           # the usual for 1d2mod copy
12590           dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
12591           rm -rf CVS dir1d2 dir1d2-2
12592
12593           dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
12594 "${PROG} checkout: Updating dir1d2
12595 U dir1d2/file2
12596 ${PROG} checkout: Updating dir2d1/sub2d1
12597 U dir2d1/sub2d1/file1"
12598           # the usual for the top level
12599           dotest cvsadm-25b "cat CVS/Repository" "\."
12600           # the usual for 1d2mod
12601           dotest cvsadm-25d "cat dir1d2/CVS/Repository" "mod2/sub2"
12602           # the usual for 2d1mod
12603           dotest cvsadm-25f "cat dir2d1/CVS/Repository" "\."
12604           dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12605           rm -rf CVS dir1d2 dir2d1
12606
12607           dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
12608 "${PROG} checkout: Updating dir1d2
12609 U dir1d2/file2
12610 ${PROG} checkout: Updating dir2d2/sub2d2
12611 U dir2d2/sub2d2/file2"
12612           # the usual for the top level
12613           dotest cvsadm-26b "cat CVS/Repository" "\."
12614           # the usual for 1d2mod
12615           dotest cvsadm-26d "cat dir1d2/CVS/Repository" "mod2/sub2"
12616           # the usual for 2d2mod
12617           dotest cvsadm-26f "cat dir2d2/CVS/Repository" "mod2"
12618           dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12619           rm -rf CVS dir1d2 dir2d2
12620
12621
12622           # 2d1mod
12623
12624           dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
12625 "${PROG} checkout: Updating dir2d1/sub2d1
12626 U dir2d1/sub2d1/file1
12627 ${PROG} checkout: Updating dir2d1-2/sub2d1-2
12628 U dir2d1-2/sub2d1-2/file1-2"
12629           # the usual for the top level
12630           dotest cvsadm-27b "cat CVS/Repository" "\."
12631           # the usual for 2d1mod
12632           dotest cvsadm-27d "cat dir2d1/CVS/Repository" "\."
12633           dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12634           # the usual for 2d1mod
12635           dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" "\."
12636           dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" "mod1-2"
12637           rm -rf CVS dir2d1 dir2d1-2
12638
12639           dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
12640 "${PROG} checkout: Updating dir2d1/sub2d1
12641 U dir2d1/sub2d1/file1
12642 ${PROG} checkout: Updating dir2d2/sub2d2
12643 U dir2d2/sub2d2/file2"
12644           # the usual for the top level
12645           dotest cvsadm-28b "cat CVS/Repository" "\."
12646           # the usual for 2d1mod
12647           dotest cvsadm-28d "cat dir2d1/CVS/Repository" "\."
12648           dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
12649           # the usual for 2d2mod
12650           dotest cvsadm-28h "cat dir2d2/CVS/Repository" "mod2"
12651           dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12652           rm -rf CVS dir2d1 dir2d2
12653
12654           
12655           # 2d2mod
12656
12657           dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
12658 "${PROG} checkout: Updating dir2d2/sub2d2
12659 U dir2d2/sub2d2/file2
12660 ${PROG} checkout: Updating dir2d2-2/sub2d2-2
12661 U dir2d2-2/sub2d2-2/file2-2"
12662           # the usual for the top level
12663           dotest cvsadm-29b "cat CVS/Repository" "\."
12664           # the usual for 2d2mod
12665           dotest cvsadm-29d "cat dir2d2/CVS/Repository" "mod2"
12666           dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12667           # the usual for 2d2mod
12668           dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" "mod2-2"
12669           dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
12670 "mod2-2/sub2-2"
12671           rm -rf CVS dir2d2 dir2d2-2
12672
12673           ##################################################
12674           ## And now, all of that again using the "-d" flag
12675           ## on the command line.
12676           ##################################################
12677
12678           dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
12679 "${PROG} checkout: Updating dir
12680 U dir/file1"
12681           dotest cvsadm-1d3b "cat CVS/Repository" "\."
12682           dotest cvsadm-1d3d "cat dir/CVS/Repository" "mod1"
12683           rm -rf CVS dir
12684
12685           dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
12686 "${PROG} checkout: Updating dir
12687 U dir/file2"
12688           dotest cvsadm-1d4b "cat CVS/Repository" "\."
12689           dotest cvsadm-1d4d "cat dir/CVS/Repository" "mod2/sub2"
12690           rm -rf CVS dir
12691
12692           dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
12693 "${PROG} checkout: Updating dir
12694 U dir/file1"
12695           dotest cvsadm-1d5b "cat CVS/Repository" "\."
12696           dotest cvsadm-1d5d "cat dir/CVS/Repository" "mod1"
12697           rm -rf CVS dir
12698
12699           dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
12700 "${PROG} checkout: Updating dir
12701 U dir/file2"
12702           dotest cvsadm-1d6b "cat CVS/Repository" "\."
12703           dotest cvsadm-1d6d "cat dir/CVS/Repository" "mod2/sub2"
12704           rm -rf CVS dir
12705
12706           dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
12707 "${PROG} checkout: Updating dir
12708 U dir/file1"
12709           dotest cvsadm-1d7b "cat CVS/Repository" "\."
12710           dotest cvsadm-1d7d "cat dir/CVS/Repository" "mod1"
12711           rm -rf CVS dir
12712
12713           dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
12714 "${PROG} checkout: Updating dir
12715 U dir/file2"
12716           dotest cvsadm-1d8b "cat CVS/Repository" "\."
12717           dotest cvsadm-1d8d "cat dir/CVS/Repository" "mod2/sub2"
12718           rm -rf CVS dir
12719
12720           ##################################################
12721           ## Los Combonaciones
12722           ##################################################
12723
12724           ### 1mod
12725
12726           dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
12727 "${PROG} checkout: Updating dir/1mod
12728 U dir/1mod/file1
12729 ${PROG} checkout: Updating dir/1mod-2
12730 U dir/1mod-2/file1-2"
12731           # the usual for the top level
12732           dotest cvsadm-1d9b "cat CVS/Repository" "\."
12733           # the usual for the dir level
12734           dotest cvsadm-1d9d "cat dir/CVS/Repository" "\."
12735           # the usual for 1mod
12736           dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" "mod1"
12737           # the usual for 1mod copy
12738           dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" "mod1-2"
12739           rm -rf CVS dir
12740
12741           # 1mod 2mod redmod bluemod
12742           dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
12743 "${PROG} checkout: Updating dir/1mod
12744 U dir/1mod/file1
12745 ${PROG} checkout: Updating dir/2mod
12746 U dir/2mod/file2"
12747           dotest cvsadm-1d10b "cat CVS/Repository" "\."
12748           # the usual for the dir level
12749           dotest cvsadm-1d10d "cat dir/CVS/Repository" "\."
12750           # the usual for 1mod
12751           dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" "mod1"
12752           # the usual for 2dmod
12753           dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" "mod2/sub2"
12754           rm -rf CVS dir
12755
12756           dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
12757 "${PROG} checkout: Updating dir/1mod
12758 U dir/1mod/file1
12759 ${PROG} checkout: Updating dir/dir1d1
12760 U dir/dir1d1/file1"
12761           dotest cvsadm-1d11b "cat CVS/Repository" "\."
12762           # the usual for the dir level
12763           dotest cvsadm-1d11d "cat dir/CVS/Repository" "\."
12764           # the usual for 1mod
12765           dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" "mod1"
12766           # the usual for 1d1mod
12767           dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" "mod1"
12768           rm -rf CVS dir
12769
12770           dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
12771 "${PROG} checkout: Updating dir/1mod
12772 U dir/1mod/file1
12773 ${PROG} checkout: Updating dir/dir1d2
12774 U dir/dir1d2/file2"
12775           dotest cvsadm-1d12b "cat CVS/Repository" "\."
12776           # the usual for the dir level
12777           dotest cvsadm-1d12d "cat dir/CVS/Repository" "\."
12778           # the usual for 1mod
12779           dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" "mod1"
12780           # the usual for 1d2mod
12781           dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12782           rm -rf CVS dir
12783
12784           dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
12785 "${PROG} checkout: Updating dir/1mod
12786 U dir/1mod/file1
12787 ${PROG} checkout: Updating dir/dir2d1/sub2d1
12788 U dir/dir2d1/sub2d1/file1"
12789           dotest cvsadm-1d13b "cat CVS/Repository" "\."
12790           # the usual for the dir level
12791           dotest cvsadm-1d13d "cat dir/CVS/Repository" "\."
12792           # the usual for 1mod
12793           dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" "mod1"
12794           # the usual for 2d1mod
12795           dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" "\."
12796           dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
12797           rm -rf CVS dir
12798
12799           dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
12800 "${PROG} checkout: Updating dir/1mod
12801 U dir/1mod/file1
12802 ${PROG} checkout: Updating dir/dir2d2/sub2d2
12803 U dir/dir2d2/sub2d2/file2"
12804           dotest cvsadm-1d14b "cat CVS/Repository" "\."
12805           # the usual for the dir level
12806           dotest cvsadm-1d14d "cat dir/CVS/Repository" "\."
12807           # the usual for 1mod
12808           dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" "mod1"
12809           # the usual for 2d2mod
12810           dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" "mod2"
12811           dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12812           rm -rf CVS dir
12813
12814
12815           ### 2mod
12816
12817           dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
12818 "${PROG} checkout: Updating dir/2mod
12819 U dir/2mod/file2
12820 ${PROG} checkout: Updating dir/2mod-2
12821 U dir/2mod-2/file2-2"
12822           dotest cvsadm-1d15b "cat CVS/Repository" "\."
12823           # the usual for the dir level
12824           dotest cvsadm-1d15d "cat dir/CVS/Repository" "mod2"
12825           # the usual for 2mod
12826           dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" "mod2/sub2"
12827           # the usual for 2mod copy
12828           dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" "mod2-2/sub2-2"
12829           rm -rf CVS dir
12830
12831           dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
12832 "${PROG} checkout: Updating dir/2mod
12833 U dir/2mod/file2
12834 ${PROG} checkout: Updating dir/dir1d1
12835 U dir/dir1d1/file1"
12836           dotest cvsadm-1d16b "cat CVS/Repository" "\."
12837           # the usual for the dir level
12838           dotest cvsadm-1d16d "cat dir/CVS/Repository" "mod2"
12839           # the usual for 2mod
12840           dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" "mod2/sub2"
12841           # the usual for 1d1mod
12842           dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" "mod1"
12843           rm -rf CVS dir
12844
12845           dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
12846 "${PROG} checkout: Updating dir/2mod
12847 U dir/2mod/file2
12848 ${PROG} checkout: Updating dir/dir1d2
12849 U dir/dir1d2/file2"
12850           dotest cvsadm-1d17b "cat CVS/Repository" "\."
12851           # the usual for the dir level
12852           dotest cvsadm-1d17d "cat dir/CVS/Repository" "mod2"
12853           # the usual for 2mod
12854           dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" "mod2/sub2"
12855           # the usual for 1d2mod
12856           dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12857           rm -rf CVS dir
12858
12859           dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
12860 "${PROG} checkout: Updating dir/2mod
12861 U dir/2mod/file2
12862 ${PROG} checkout: Updating dir/dir2d1/sub2d1
12863 U dir/dir2d1/sub2d1/file1"
12864           dotest cvsadm-1d18b "cat CVS/Repository" "\."
12865           # the usual for the dir level
12866           dotest cvsadm-1d18d "cat dir/CVS/Repository" "mod2"
12867           # the usual for 2mod
12868           dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" "mod2/sub2"
12869           # the usual for 2d1mod
12870           dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" "\."
12871           dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
12872           rm -rf CVS dir
12873
12874           dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
12875 "${PROG} checkout: Updating dir/2mod
12876 U dir/2mod/file2
12877 ${PROG} checkout: Updating dir/dir2d2/sub2d2
12878 U dir/dir2d2/sub2d2/file2"
12879           dotest cvsadm-1d19b "cat CVS/Repository" "\."
12880           # the usual for the dir level
12881           dotest cvsadm-1d19d "cat dir/CVS/Repository" "mod2"
12882           # the usual for 2mod
12883           dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" "mod2/sub2"
12884           # the usual for 2d2mod
12885           dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" "mod2"
12886           dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12887           rm -rf CVS dir
12888
12889
12890           ### 1d1mod
12891
12892           dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
12893 "${PROG} checkout: Updating dir/dir1d1
12894 U dir/dir1d1/file1
12895 ${PROG} checkout: Updating dir/dir1d1-2
12896 U dir/dir1d1-2/file1-2"
12897           dotest cvsadm-1d20b "cat CVS/Repository" "\."
12898           # the usual for the dir level
12899           dotest cvsadm-1d20d "cat dir/CVS/Repository" "\."
12900           # the usual for 1d1mod
12901           dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" "mod1"
12902           # the usual for 1d1mod copy
12903           dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" "mod1-2"
12904           rm -rf CVS dir
12905
12906           dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
12907 "${PROG} checkout: Updating dir/dir1d1
12908 U dir/dir1d1/file1
12909 ${PROG} checkout: Updating dir/dir1d2
12910 U dir/dir1d2/file2"
12911           dotest cvsadm-1d21b "cat CVS/Repository" "\."
12912           # the usual for the dir level
12913           dotest cvsadm-1d21d "cat dir/CVS/Repository" "\."
12914           # the usual for 1d1mod
12915           dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" "mod1"
12916           # the usual for 1d2mod
12917           dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12918           rm -rf CVS dir
12919
12920           dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
12921 "${PROG} checkout: Updating dir/dir1d1
12922 U dir/dir1d1/file1
12923 ${PROG} checkout: Updating dir/dir2d1/sub2d1
12924 U dir/dir2d1/sub2d1/file1"
12925           dotest cvsadm-1d22b "cat CVS/Repository" "\."
12926           # the usual for the dir level
12927           dotest cvsadm-1d22d "cat dir/CVS/Repository" "\."
12928           # the usual for 1d1mod
12929           dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" "mod1"
12930           # the usual for 2d1mod
12931           dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" "\."
12932           dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
12933           rm -rf CVS dir
12934
12935           dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
12936 "${PROG} checkout: Updating dir/dir1d1
12937 U dir/dir1d1/file1
12938 ${PROG} checkout: Updating dir/dir2d2/sub2d2
12939 U dir/dir2d2/sub2d2/file2"
12940           dotest cvsadm-1d23b "cat CVS/Repository" "\."
12941           # the usual for the dir level
12942           dotest cvsadm-1d23d "cat dir/CVS/Repository" "\."
12943           # the usual for 1d1mod
12944           dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" "mod1"
12945           # the usual for 2d2mod
12946           dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" "mod2"
12947           dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12948           rm -rf CVS dir
12949
12950
12951           ### 1d2mod
12952
12953           dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
12954 "${PROG} checkout: Updating dir/dir1d2
12955 U dir/dir1d2/file2
12956 ${PROG} checkout: Updating dir/dir1d2-2
12957 U dir/dir1d2-2/file2-2"
12958           dotest cvsadm-1d24b "cat CVS/Repository" "\."
12959           # the usual for the dir level
12960           dotest cvsadm-1d24d "cat dir/CVS/Repository" "mod2"
12961           # the usual for 1d2mod
12962           dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12963           # the usual for 1d2mod copy
12964           dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
12965           rm -rf CVS dir
12966
12967           dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
12968 "${PROG} checkout: Updating dir/dir1d2
12969 U dir/dir1d2/file2
12970 ${PROG} checkout: Updating dir/dir2d1/sub2d1
12971 U dir/dir2d1/sub2d1/file1"
12972           dotest cvsadm-1d25b "cat CVS/Repository" "\."
12973           # the usual for the dir level
12974           dotest cvsadm-1d25d "cat dir/CVS/Repository" "mod2"
12975           # the usual for 1d2mod
12976           dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12977           # the usual for 2d1mod
12978           dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" "\."
12979           dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
12980           rm -rf CVS dir
12981
12982           dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
12983 "${PROG} checkout: Updating dir/dir1d2
12984 U dir/dir1d2/file2
12985 ${PROG} checkout: Updating dir/dir2d2/sub2d2
12986 U dir/dir2d2/sub2d2/file2"
12987           dotest cvsadm-1d26b "cat CVS/Repository" "\."
12988           # the usual for the dir level
12989           dotest cvsadm-1d26d "cat dir/CVS/Repository" "mod2"
12990           # the usual for 1d2mod
12991           dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
12992           # the usual for 2d2mod
12993           dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" "mod2"
12994           dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
12995           rm -rf CVS dir
12996
12997
12998           # 2d1mod
12999
13000           dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
13001 "${PROG} checkout: Updating dir/dir2d1/sub2d1
13002 U dir/dir2d1/sub2d1/file1
13003 ${PROG} checkout: Updating dir/dir2d1-2/sub2d1-2
13004 U dir/dir2d1-2/sub2d1-2/file1-2"
13005           dotest cvsadm-1d27b "cat CVS/Repository" "\."
13006           # the usual for the dir level
13007           dotest cvsadm-1d27d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
13008           # the usual for 2d1mod
13009           dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" "\."
13010           dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
13011           # the usual for 2d1mod
13012           dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" "\."
13013           dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
13014 "mod1-2"
13015           rm -rf CVS dir
13016
13017           dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
13018 "${PROG} checkout: Updating dir/dir2d1/sub2d1
13019 U dir/dir2d1/sub2d1/file1
13020 ${PROG} checkout: Updating dir/dir2d2/sub2d2
13021 U dir/dir2d2/sub2d2/file2"
13022           dotest cvsadm-1d28b "cat CVS/Repository" "\."
13023           # the usual for the dir level
13024           dotest cvsadm-1d28d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
13025           # the usual for 2d1mod
13026           dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" "\."
13027           dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
13028           # the usual for 2d2mod
13029           dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" "mod2"
13030           dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13031           rm -rf CVS dir
13032
13033           
13034           # 2d2mod
13035
13036           dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
13037 "${PROG} checkout: Updating dir/dir2d2/sub2d2
13038 U dir/dir2d2/sub2d2/file2
13039 ${PROG} checkout: Updating dir/dir2d2-2/sub2d2-2
13040 U dir/dir2d2-2/sub2d2-2/file2-2"
13041           dotest cvsadm-1d29b "cat CVS/Repository" "\."
13042           # the usual for the dir level
13043           dotest cvsadm-1d29d "cat dir/CVS/Repository" "\."
13044           # the usual for 2d2mod
13045           dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" "mod2"
13046           dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13047           # the usual for 2d2mod
13048           dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" "mod2-2"
13049           dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
13050 "mod2-2/sub2-2"
13051           rm -rf CVS dir
13052
13053           ##################################################
13054           ## And now, some of that again using the "-d" flag
13055           ## on the command line, but use a longer path.
13056           ##################################################
13057
13058           dotest_fail cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
13059 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .dir.: No such file or directory"
13060
13061           if $remote; then :; else
13062             # Remote can't handle this, even with the "mkdir dir".
13063             # This was also true of CVS 1.9.
13064
13065             mkdir dir
13066             dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
13067 "${PROG} checkout: Updating dir/dir2
13068 U dir/dir2/file1"
13069             dotest cvsadm-2d3b "cat CVS/Repository" "\."
13070             dotest_fail cvsadm-2d3d "test -f dir/CVS/Repository" ""
13071             dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" "mod1"
13072             rm -rf CVS dir
13073
13074             mkdir dir
13075             dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
13076 "${PROG} checkout: Updating dir/dir2
13077 U dir/dir2/file2"
13078             dotest cvsadm-2d4b "cat CVS/Repository" "\."
13079             dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" "mod2/sub2"
13080             rm -rf CVS dir
13081
13082             mkdir dir
13083             dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
13084 "${PROG} checkout: Updating dir/dir2
13085 U dir/dir2/file1"
13086             dotest cvsadm-2d5b "cat CVS/Repository" "\."
13087             dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" "mod1"
13088             rm -rf CVS dir
13089
13090             mkdir dir
13091             dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
13092 "${PROG} checkout: Updating dir/dir2
13093 U dir/dir2/file2"
13094             dotest cvsadm-2d6b "cat CVS/Repository" "\."
13095             dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" "mod2/sub2"
13096             rm -rf CVS dir
13097
13098             mkdir dir
13099             dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
13100 "${PROG} checkout: Updating dir/dir2
13101 U dir/dir2/file1"
13102             dotest cvsadm-2d7b "cat CVS/Repository" "\."
13103             dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" "mod1"
13104             rm -rf CVS dir
13105
13106             mkdir dir
13107             dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
13108 "${PROG} checkout: Updating dir/dir2
13109 U dir/dir2/file2"
13110             dotest cvsadm-2d8b "cat CVS/Repository" "\."
13111             dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" "mod2/sub2"
13112             rm -rf CVS dir
13113
13114             ##################################################
13115             ## And now, a few of those tests revisited to
13116             ## test the behavior of the -N flag.
13117             ##################################################
13118
13119             dotest cvsadm-N3 "${testcvs} co -N 1mod" \
13120 "${PROG} checkout: Updating 1mod
13121 U 1mod/file1"
13122             dotest cvsadm-N3b "cat CVS/Repository" "\."
13123             dotest cvsadm-N3d "cat 1mod/CVS/Repository" "mod1"
13124             rm -rf CVS 1mod
13125
13126             dotest cvsadm-N4 "${testcvs} co -N 2mod" \
13127 "${PROG} checkout: Updating 2mod
13128 U 2mod/file2"
13129             dotest cvsadm-N4b "cat CVS/Repository" "\."
13130             dotest cvsadm-N4d "cat 2mod/CVS/Repository" "mod2/sub2"
13131             rm -rf CVS 2mod
13132
13133             dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
13134 "${PROG} checkout: Updating dir1d1
13135 U dir1d1/file1"
13136             dotest cvsadm-N5b "cat CVS/Repository" "\."
13137             dotest cvsadm-N5d "cat dir1d1/CVS/Repository" "mod1"
13138             rm -rf CVS dir1d1
13139
13140             dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
13141 "${PROG} checkout: Updating dir1d2
13142 U dir1d2/file2"
13143             dotest cvsadm-N6b "cat CVS/Repository" "\."
13144             dotest cvsadm-N6d "cat dir1d2/CVS/Repository" "mod2/sub2"
13145             rm -rf CVS dir1d2
13146
13147             dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
13148 "${PROG} checkout: Updating dir2d1/sub2d1
13149 U dir2d1/sub2d1/file1"
13150             dotest cvsadm-N7b "cat CVS/Repository" "\."
13151             dotest cvsadm-N7d "cat dir2d1/CVS/Repository" "\."
13152             dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
13153             rm -rf CVS dir2d1
13154
13155             dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
13156 "${PROG} checkout: Updating dir2d2/sub2d2
13157 U dir2d2/sub2d2/file2"
13158             dotest cvsadm-N8b "cat CVS/Repository" "\."
13159             dotest cvsadm-N8d "cat dir2d2/CVS/Repository" "mod2"
13160             dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13161             rm -rf CVS dir2d2
13162
13163             ## the ones in one-deep directories
13164
13165             dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
13166 "${PROG} checkout: Updating dir/1mod
13167 U dir/1mod/file1"
13168             dotest cvsadm-N1d3b "cat CVS/Repository" "\."
13169             dotest cvsadm-N1d3d "cat dir/CVS/Repository" "\."
13170             dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" "mod1"
13171             rm -rf CVS dir
13172
13173             dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
13174 "${PROG} checkout: Updating dir/2mod
13175 U dir/2mod/file2"
13176             dotest cvsadm-N1d4b "cat CVS/Repository" "\."
13177             dotest cvsadm-N1d4d "cat dir/CVS/Repository" "mod2"
13178             dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" "mod2/sub2"
13179             rm -rf CVS dir
13180
13181             dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
13182 "${PROG} checkout: Updating dir/dir1d1
13183 U dir/dir1d1/file1"
13184             dotest cvsadm-N1d5b "cat CVS/Repository" "\."
13185             dotest cvsadm-N1d5d "cat dir/CVS/Repository" "\."
13186             dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" "mod1"
13187             rm -rf CVS dir
13188
13189             dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
13190 "${PROG} checkout: Updating dir/dir1d2
13191 U dir/dir1d2/file2"
13192             dotest cvsadm-N1d6b "cat CVS/Repository" "\."
13193             dotest cvsadm-N1d6d "cat dir/CVS/Repository" "mod2"
13194             dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
13195             rm -rf CVS dir
13196
13197             dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
13198 "${PROG} checkout: Updating dir/dir2d1/sub2d1
13199 U dir/dir2d1/sub2d1/file1"
13200             dotest cvsadm-N1d7b "cat CVS/Repository" "\."
13201             dotest cvsadm-N1d7d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
13202             dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" "\."
13203             dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
13204             rm -rf CVS dir
13205
13206             dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
13207 "${PROG} checkout: Updating dir/dir2d2/sub2d2
13208 U dir/dir2d2/sub2d2/file2"
13209             dotest cvsadm-N1d8b "cat CVS/Repository" "\."
13210             dotest cvsadm-N1d8d "cat dir/CVS/Repository" "\."
13211             dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" "mod2"
13212             dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
13213 "mod2/sub2"
13214             rm -rf CVS dir
13215
13216             ## the ones in two-deep directories
13217
13218             mkdir dir
13219             dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
13220 "${PROG} checkout: Updating dir/dir2/1mod
13221 U dir/dir2/1mod/file1"
13222             dotest cvsadm-N2d3b "cat CVS/Repository" "\."
13223             dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" "\."
13224             dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" "mod1"
13225             rm -rf CVS dir
13226
13227             mkdir dir
13228             dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
13229 "${PROG} checkout: Updating dir/dir2/2mod
13230 U dir/dir2/2mod/file2"
13231             dotest cvsadm-N2d4b "cat CVS/Repository" "\."
13232             dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" "mod2"
13233             dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" "mod2/sub2"
13234             rm -rf CVS dir
13235
13236             mkdir dir
13237             dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
13238 "${PROG} checkout: Updating dir/dir2/dir1d1
13239 U dir/dir2/dir1d1/file1"
13240             dotest cvsadm-N2d5b "cat CVS/Repository" "\."
13241             dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" "\."
13242             dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" "mod1"
13243             rm -rf CVS dir
13244
13245             mkdir dir
13246             dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
13247 "${PROG} checkout: Updating dir/dir2/dir1d2
13248 U dir/dir2/dir1d2/file2"
13249             dotest cvsadm-N2d6b "cat CVS/Repository" "\."
13250             dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" "mod2"
13251             dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" "mod2/sub2"
13252             rm -rf CVS dir
13253
13254             mkdir dir
13255             dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
13256 "${PROG} checkout: Updating dir/dir2/dir2d1/sub2d1
13257 U dir/dir2/dir2d1/sub2d1/file1"
13258             dotest cvsadm-N2d7b "cat CVS/Repository" "\."
13259             dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" "CVSROOT/Emptydir"
13260             dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" "\."
13261             dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
13262 "mod1"
13263             rm -rf CVS dir
13264
13265             mkdir dir
13266             dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
13267 "${PROG} checkout: Updating dir/dir2/dir2d2/sub2d2
13268 U dir/dir2/dir2d2/sub2d2/file2"
13269             dotest cvsadm-N2d8b "cat CVS/Repository" "\."
13270             dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" "\."
13271             dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" "mod2"
13272             dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
13273 "mod2/sub2"
13274             rm -rf CVS dir
13275
13276           fi # end of tests to be skipped for remote
13277
13278           ##################################################
13279           ## That's enough of that, thank you very much.
13280           ##################################################
13281
13282           dotest cvsadm-cleanup-1 "${testcvs} -q co CVSROOT/config" \
13283 "U CVSROOT/config"
13284           cd CVSROOT
13285           echo "# empty file" >config
13286           dotest cvsadm-cleanup-2 "${testcvs} -q ci -m cvsadm-cleanup" \
13287 "Checking in config;
13288 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13289 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13290 done
13291 ${PROG} commit: Rebuilding administrative file database"
13292           cd ..
13293           rm -rf CVSROOT CVS
13294
13295           # remove our junk
13296           cd ..
13297           rm -rf 1
13298           rm -rf ${CVSROOT_DIRNAME}/1mod
13299           rm -rf ${CVSROOT_DIRNAME}/1mod-2
13300           rm -rf ${CVSROOT_DIRNAME}/2mod
13301           rm -rf ${CVSROOT_DIRNAME}/2mod-2
13302           rm -rf ${CVSROOT_DIRNAME}/mod1
13303           rm -rf ${CVSROOT_DIRNAME}/mod1-2
13304           rm -rf ${CVSROOT_DIRNAME}/mod2
13305           rm -rf ${CVSROOT_DIRNAME}/mod2-2
13306           ;;
13307
13308         emptydir)
13309           # Various tests of the Emptydir (CVSNULLREPOS) code.  See also:
13310           #   cvsadm: tests of Emptydir in various module definitions
13311           #   basicb: Test that "Emptydir" is non-special in ordinary contexts
13312
13313           mkdir 1; cd 1
13314           dotest emptydir-1 "${testcvs} co CVSROOT/modules" \
13315 "U CVSROOT/modules"
13316           echo "# Module defs for emptydir tests" > CVSROOT/modules
13317           echo "2d1mod -d dir2d1/sub/sub2d1 mod1" >> CVSROOT/modules
13318           echo "2d1moda -d dir2d1/suba moda/modasub" >> CVSROOT/modules
13319           echo "2d1modb -d dir2d1/suba mod1" >> CVSROOT/modules
13320           echo "comb -a 2d1modb 2d1moda" >> CVSROOT/modules
13321
13322           dotest emptydir-2 "${testcvs} ci -m add-modules" \
13323 "${PROG} [a-z]*: Examining CVSROOT
13324 Checking in CVSROOT/modules;
13325 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
13326 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13327 done
13328 ${PROG} commit: Rebuilding administrative file database" \
13329 "${PROG} commit: Examining CVSROOT"
13330           rm -rf CVS CVSROOT
13331
13332           mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
13333           # Populate.  Not sure we really need to do this.
13334           dotest emptydir-3 "${testcvs} -q co -l ." ""
13335           dotest emptydir-3a "${testcvs} co mod1 moda" \
13336 "${PROG} checkout: Updating mod1
13337 ${PROG} checkout: Updating moda"
13338           echo "file1" > mod1/file1
13339           mkdir moda/modasub
13340           dotest emptydir-3b "${testcvs} add moda/modasub" \
13341 "Directory ${CVSROOT_DIRNAME}/moda/modasub added to the repository"
13342           echo "filea" > moda/modasub/filea
13343           dotest emptydir-4 "${testcvs} add mod1/file1 moda/modasub/filea" \
13344 "${PROG} add: scheduling file .mod1/file1. for addition
13345 ${PROG} add: scheduling file .moda/modasub/filea. for addition
13346 ${PROG} add: use .${PROG} commit. to add these files permanently"
13347           dotest emptydir-5 "${testcvs} -q ci -m yup" \
13348 "RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
13349 done
13350 Checking in mod1/file1;
13351 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
13352 initial revision: 1\.1
13353 done
13354 RCS file: ${CVSROOT_DIRNAME}/moda/modasub/filea,v
13355 done
13356 Checking in moda/modasub/filea;
13357 ${CVSROOT_DIRNAME}/moda/modasub/filea,v  <--  filea
13358 initial revision: 1\.1
13359 done"
13360           rm -rf mod1 moda CVS
13361           # End Populate.
13362
13363           dotest emptydir-6 "${testcvs} co 2d1mod" \
13364 "${PROG} checkout: Updating dir2d1/sub/sub2d1
13365 U dir2d1/sub/sub2d1/file1"
13366           cd dir2d1
13367           touch emptyfile
13368           # It doesn't make any sense to add a file (or do much of anything
13369           # else) in Emptydir; Emptydir is a placeholder indicating that
13370           # the working directory doesn't correspond to anything in
13371           # the repository.
13372           dotest_fail emptydir-7 "${testcvs} add emptyfile" \
13373 "${PROG} \[add aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
13374           mkdir emptydir
13375           dotest_fail emptydir-8 "${testcvs} add emptydir" \
13376 "${PROG} \[[a-z]* aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
13377           cd ..
13378           rm -rf CVS dir2d1
13379
13380           # OK, while we have an Emptydir around, test a few obscure
13381           # things about it.
13382           mkdir edir; cd edir
13383           dotest emptydir-9 "${testcvs} -q co -l CVSROOT" \
13384 "U CVSROOT${DOTSTAR}"
13385           cd CVSROOT
13386           dotest_fail emptydir-10 "test -d Emptydir" ''
13387           # This tests the code in find_dirs which skips Emptydir.
13388           dotest emptydir-11 "${testcvs} -q -n update -d -P" ''
13389           cd ../..
13390           rm -r edir
13391           cd ..
13392
13393           # Now start playing with moda.
13394           mkdir 2; cd 2
13395           dotest emptydir-12 "${testcvs} -q co 2d1moda" \
13396 "U dir2d1/suba/filea"
13397           # OK, this is the crux of the matter.  This used to show "Emptydir",
13398           # but everyone seemed to think it should show "moda".  This
13399           # usually works better, but not always as shown by the following
13400           # test.
13401           dotest emptydir-13 "cat dir2d1/CVS/Repository" "moda"
13402           dotest_fail emptydir-14 "${testcvs} co comb" \
13403 "${PROG} checkout: existing repository ${CVSROOT_DIRNAME}/moda/modasub does not match ${CVSROOT_DIRNAME}/mod1
13404 ${PROG} checkout: ignoring module 2d1modb
13405 ${PROG} checkout: Updating dir2d1/suba"
13406           dotest emptydir-15 "cat dir2d1/CVS/Repository" "moda"
13407           cd ..
13408
13409           # Test the effect of a non-cvs directory already existing with the
13410           # same name as one in the modules file.
13411           mkdir 3; cd 3
13412           mkdir dir2d1
13413           dotest emptydir-16 "${testcvs} co 2d1mod" \
13414 "${PROG} checkout: Updating dir2d1/sub/sub2d1
13415 U dir2d1/sub/sub2d1/file1"
13416           dotest emptydir-17 "test -d dir2d1/CVS"
13417
13418           # clean up
13419           if $keep; then
13420             echo Keeping ${TESTDIR} and exiting due to --keep
13421             exit 0
13422           fi
13423
13424           cd ..
13425           rm -r 1 2 3
13426           rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
13427           # I guess for the moment the convention is going to be
13428           # that we don't need to remove ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
13429           ;;
13430
13431         abspath)
13432         
13433           # These tests test the thituations thin thwitch thoo theck
13434           # things thout twith thabsolute thaths.  Threally.
13435
13436           #
13437           # CHECKOUTS
13438           #
13439
13440           # Create a few modules to use
13441           mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
13442           dotest abspath-1a "${testcvs} co mod1 mod2" \
13443 "${PROG} checkout: Updating mod1
13444 ${PROG} checkout: Updating mod2"
13445
13446           # Populate the module
13447           echo "file1" > mod1/file1
13448           echo "file2" > mod2/file2
13449           cd mod1
13450           dotest abspath-1ba "${testcvs} add file1" \
13451 "${PROG} add: scheduling file .file1. for addition
13452 ${PROG} add: use .${PROG} commit. to add this file permanently"
13453           cd ..
13454           cd mod2
13455           dotest abspath-1bb "${testcvs} add file2" \
13456 "${PROG} add: scheduling file .file2. for addition
13457 ${PROG} add: use .${PROG} commit. to add this file permanently"
13458           cd ..
13459
13460           dotest abspath-1c "${testcvs} ci -m yup mod1 mod2" \
13461 "${PROG} [a-z]*: Examining mod1
13462 ${PROG} [a-z]*: Examining mod2
13463 RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
13464 done
13465 Checking in mod1/file1;
13466 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
13467 initial revision: 1.1
13468 done
13469 RCS file: ${CVSROOT_DIRNAME}/mod2/file2,v
13470 done
13471 Checking in mod2/file2;
13472 ${CVSROOT_DIRNAME}/mod2/file2,v  <--  file2
13473 initial revision: 1.1
13474 done"
13475           # Finished creating the module -- clean up.
13476           rm -rf CVS mod1 mod2
13477           # Done.
13478           
13479           # Try checking out the module in a local directory
13480           if $remote; then
13481             dotest_fail abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
13482 "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/1. illegal for server"
13483             dotest abspath-2a-try2 "${testcvs} co -d 1 mod1" \
13484 "${PROG} checkout: Updating 1
13485 U 1/file1"
13486           else
13487             dotest abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
13488 "${PROG} checkout: Updating ${TESTDIR}/1
13489 U ${TESTDIR}/1/file1"
13490           fi # remote workaround
13491
13492           dotest abspath-2b "cat ${TESTDIR}/1/CVS/Repository" "mod1"
13493
13494           # Done.  Clean up.
13495           rm -rf ${TESTDIR}/1
13496
13497
13498           # Now try in a subdirectory.  We're not covering any more
13499           # code here, but we might catch a future error if someone
13500           # changes the checkout code.
13501
13502           # Note that for the same reason that the shell command
13503           # "touch 1/2/3" requires directories 1 and 1/2 to already
13504           # exist, we expect ${TESTDIR}/1 to already exist.  I believe
13505           # this is the behavior of CVS 1.9 and earlier.
13506           if $remote; then :; else
13507             dotest_fail abspath-3.1 "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
13508 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .${TESTDIR}/1.: No such file or directory"
13509           fi
13510           dotest_fail abspath-3.2 "${testcvs} co -d 1/2 mod1" \
13511 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
13512
13513           mkdir 1
13514
13515           if $remote; then
13516             # The server wants the directory to exist, but that is
13517             # a bug, it should only need to exist on the client side.
13518             # See also cvsadm-2d3.
13519             dotest_fail abspath-3a "${testcvs} co -d 1/2 mod1" \
13520 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
13521             cd 1
13522             dotest abspath-3a-try2 "${testcvs} co -d 2 mod1" \
13523 "${PROG} checkout: Updating 2
13524 U 2/file1"
13525             cd ..
13526             rm -rf 1/CVS
13527           else
13528           dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
13529 "${PROG} checkout: Updating ${TESTDIR}/1/2
13530 U ${TESTDIR}/1/2/file1"
13531           fi # remote workaround
13532           dotest abspath-3b "cat ${TESTDIR}/1/2/CVS/Repository" "mod1"
13533
13534           # For all the same reasons that we want "1" to already
13535           # exist, we don't to mess with it to traverse it, for
13536           # example by creating a CVS directory.
13537
13538           dotest_fail abspath-3c "test -d ${TESTDIR}/1/CVS" ''
13539           # Done.  Clean up.
13540           rm -rf ${TESTDIR}/1
13541
13542
13543           # Now try someplace where we don't have permission.
13544           mkdir ${TESTDIR}/barf
13545           chmod -w ${TESTDIR}/barf
13546             dotest_fail abspath-4r "${testcvs} co -d ${TESTDIR}/barf/sub mod1" \
13547 "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/barf/sub. illegal for server" \
13548 "${PROG} \[checkout aborted\]: cannot make directory sub: Permission denied"
13549           chmod +w ${TESTDIR}/barf
13550           rmdir ${TESTDIR}/barf
13551           # Done.  Nothing to clean up.
13552
13553
13554           # Try checking out two modules into the same directory.
13555           if $remote; then
13556             dotest abspath-5ar "${testcvs} co -d 1 mod1 mod2" \
13557 "${PROG} checkout: Updating 1/mod1
13558 U 1/mod1/file1
13559 ${PROG} checkout: Updating 1/mod2
13560 U 1/mod2/file2"
13561           else
13562             dotest abspath-5a "${testcvs} co -d ${TESTDIR}/1 mod1 mod2" \
13563 "${PROG} checkout: Updating ${TESTDIR}/1/mod1
13564 U ${TESTDIR}/1/mod1/file1
13565 ${PROG} checkout: Updating ${TESTDIR}/1/mod2
13566 U ${TESTDIR}/1/mod2/file2"
13567           fi # end remote workaround
13568           dotest abspath-5b "cat ${TESTDIR}/1/CVS/Repository" "\."
13569           dotest abspath-5c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
13570           dotest abspath-5d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
13571           # Done.  Clean up.
13572           rm -rf ${TESTDIR}/1
13573
13574
13575           # Try checking out the top-level module.
13576           if $remote; then
13577             dotest abspath-6ar "${testcvs} co -d 1 ." \
13578 "${PROG} checkout: Updating 1
13579 ${PROG} checkout: Updating 1/CVSROOT
13580 ${DOTSTAR}
13581 ${PROG} checkout: Updating 1/mod1
13582 U 1/mod1/file1
13583 ${PROG} checkout: Updating 1/mod2
13584 U 1/mod2/file2"
13585           else
13586             dotest abspath-6a "${testcvs} co -d ${TESTDIR}/1 ." \
13587 "${PROG} checkout: Updating ${TESTDIR}/1
13588 ${PROG} checkout: Updating ${TESTDIR}/1/CVSROOT
13589 ${DOTSTAR}
13590 ${PROG} checkout: Updating ${TESTDIR}/1/mod1
13591 U ${TESTDIR}/1/mod1/file1
13592 ${PROG} checkout: Updating ${TESTDIR}/1/mod2
13593 U ${TESTDIR}/1/mod2/file2"
13594           fi # end of remote workaround
13595           dotest abspath-6b "cat ${TESTDIR}/1/CVS/Repository" "\."
13596           dotest abspath-6c "cat ${TESTDIR}/1/CVSROOT/CVS/Repository" "CVSROOT"
13597           dotest abspath-6c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
13598           dotest abspath-6d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
13599           # Done.  Clean up.
13600           rm -rf ${TESTDIR}/1
13601
13602           # Test that an absolute pathname to some other directory
13603           # doesn't mess with the current working directory.
13604           mkdir 1
13605           cd 1
13606           if $remote; then
13607             dotest_fail abspath-7ar "${testcvs} -q co -d ../2 mod2" \
13608 "${PROG} checkout: protocol error: .\.\./2. contains more leading \.\.
13609 ${PROG} \[checkout aborted\]: than the 0 which Max-dotdot specified"
13610             cd ..
13611             dotest abspath-7a-try2r "${testcvs} -q co -d 2 mod2" \
13612 "U 2/file2"
13613             cd 1
13614           else
13615             dotest abspath-7a "${testcvs} -q co -d ${TESTDIR}/2 mod2" \
13616 "U ${TESTDIR}/2/file2"
13617           fi # remote workaround
13618           dotest abspath-7b "ls" ""
13619           dotest abspath-7c "${testcvs} -q co mod1" \
13620 "U mod1/file1"
13621           cd mod1
13622           if $remote; then
13623             cd ../..
13624             dotest abspath-7dr "${testcvs} -q co -d 3 mod2" \
13625 "U 3/file2"
13626             cd 1/mod1
13627           else
13628           dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
13629 "U ${TESTDIR}/3/file2"
13630           fi # remote workaround
13631           dotest abspath-7e "${testcvs} -q update -d" ""
13632           cd ../..
13633           rm -r 1 2 3
13634
13635           #
13636           # FIXME: do other functions here (e.g. update /tmp/foo)
13637           #
13638
13639           # Finished with all tests.  Remove the module.
13640           rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
13641
13642           ;;
13643
13644
13645
13646         abspath2)
13647           # More absolute path checks.  The following used to attempt to create
13648           # directories in /:
13649           #
13650           # $ cvs -d:fork:/cvsroot co /foo
13651           # cvs checkout: warning: cannot make directory CVS in /: Permission denied
13652           # cvs [checkout aborted]: cannot make directory /foo: Permission denied
13653           # $
13654           dotest_fail abspath2-1 "${testcvs} co /foo" \
13655 "$PROG \[checkout aborted\]: Absolute module reference invalid: \`/foo'" \
13656 "$PROG \[server aborted\]: Absolute module reference invalid: \`/foo'
13657 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
13658           ;;
13659
13660
13661
13662         toplevel)
13663           # test the feature that cvs creates a CVS subdir also for
13664           # the toplevel directory
13665
13666           # First set the TopLevelAdmin setting.
13667           mkdir 1; cd 1
13668           dotest toplevel-1a "${testcvs} -q co CVSROOT/config" \
13669 "U CVSROOT/config"
13670           cd CVSROOT
13671           echo "TopLevelAdmin=yes" >config
13672           dotest toplevel-1b "${testcvs} -q ci -m yes-top-level" \
13673 "Checking in config;
13674 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13675 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13676 done
13677 ${PROG} commit: Rebuilding administrative file database"
13678           cd ../..
13679           rm -r 1
13680
13681           mkdir 1; cd 1
13682           dotest toplevel-1 "${testcvs} -q co -l ." ''
13683           mkdir top-dir second-dir
13684           dotest toplevel-2 "${testcvs} add top-dir second-dir" \
13685 "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
13686 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
13687           cd top-dir
13688
13689           touch file1
13690           dotest toplevel-3 "${testcvs} add file1" \
13691 "${PROG} add: scheduling file .file1. for addition
13692 ${PROG} add: use .${PROG} commit. to add this file permanently"
13693           dotest toplevel-4 "${testcvs} -q ci -m add" \
13694 "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
13695 done
13696 Checking in file1;
13697 ${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
13698 initial revision: 1\.1
13699 done"
13700           cd ..
13701
13702           cd second-dir
13703           touch file2
13704           dotest toplevel-3s "${testcvs} add file2" \
13705 "${PROG} add: scheduling file .file2. for addition
13706 ${PROG} add: use .${PROG} commit. to add this file permanently"
13707           dotest toplevel-4s "${testcvs} -q ci -m add" \
13708 "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
13709 done
13710 Checking in file2;
13711 ${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
13712 initial revision: 1\.1
13713 done"
13714
13715           cd ../..
13716           rm -r 1; mkdir 1; cd 1
13717           dotest toplevel-5 "${testcvs} co top-dir" \
13718 "${PROG} checkout: Updating top-dir
13719 U top-dir/file1"
13720
13721           dotest toplevel-6 "${testcvs} update top-dir" \
13722 "${PROG} update: Updating top-dir"
13723           dotest toplevel-7 "${testcvs} update"  \
13724 "${PROG} update: Updating \.
13725 ${PROG} update: Updating top-dir"
13726
13727           dotest toplevel-8 "${testcvs} update -d top-dir" \
13728 "${PROG} update: Updating top-dir"
13729           # There is some sentiment that
13730           #   "${PROG} update: Updating \.
13731           #   ${PROG} update: Updating top-dir"
13732           # is correct but it isn't clear why that would be correct instead
13733           # of the remote CVS behavior (which also updates CVSROOT).
13734           #
13735           # The DOTSTAR matches of a bunch of lines like
13736           # "U CVSROOT/checkoutlist".  Trying to match them more precisely
13737           # seemed to cause trouble.  For example CVSROOT/cvsignore will
13738           # be present or absent depending on whether we ran the "ignore"
13739           # test or not.
13740           dotest toplevel-9 "${testcvs} update -d" \
13741 "${PROG} update: Updating \.
13742 ${PROG} update: Updating CVSROOT
13743 ${DOTSTAR}
13744 ${PROG} update: Updating top-dir"
13745
13746           cd ..
13747           rm -r 1; mkdir 1; cd 1
13748           dotest toplevel-10 "${testcvs} co top-dir" \
13749 "${PROG} checkout: Updating top-dir
13750 U top-dir/file1"
13751
13752           # This tests more or less the same thing, in a particularly
13753           # "real life" example.
13754           dotest toplevel-11 "${testcvs} -q update -d second-dir" \
13755 "U second-dir/file2"
13756
13757           # Now remove the CVS directory (people may do this manually,
13758           # especially if they formed their habits with CVS
13759           # 1.9 and older, which didn't create it.  Or perhaps the working
13760           # directory itself was created with 1.9 or older).
13761           rm -r CVS
13762           # Now set the permissions so we can't recreate it.
13763           if test -n "$remotehost"; then
13764             # Cygwin again.
13765             $CVS_RSH $remotehost "chmod -w $TESTDIR/1"
13766           else
13767             chmod -w ../1
13768           fi
13769           # Now see whether CVS has trouble because it can't create CVS.
13770           # First string is for local, second is for remote.
13771           dotest toplevel-12 "${testcvs} co top-dir" \
13772 "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
13773 ${PROG} checkout: Updating top-dir" \
13774 "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
13775 ${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
13776 ${PROG} checkout: in directory \.:
13777 ${PROG} checkout: cannot open CVS/Entries for reading: No such file or directory
13778 ${PROG} checkout: Updating top-dir"
13779
13780           chmod +w ../1
13781
13782           dotest toplevel-cleanup-1 "${testcvs} -q co CVSROOT/config" \
13783 "U CVSROOT/config"
13784           cd CVSROOT
13785           echo "# empty file" >config
13786           dotest toplevel-cleanup-2 "${testcvs} -q ci -m toplevel-cleanup" \
13787 "Checking in config;
13788 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13789 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13790 done
13791 ${PROG} commit: Rebuilding administrative file database"
13792
13793           cd ../..
13794           rm -r 1
13795           rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
13796           ;;
13797
13798         toplevel2)
13799           # Similar to toplevel, but test the case where TopLevelAdmin=no.
13800
13801           # First set the TopLevelAdmin setting.
13802           mkdir 1; cd 1
13803           dotest toplevel2-1a "${testcvs} -q co CVSROOT/config" \
13804 "U CVSROOT/config"
13805           cd CVSROOT
13806           echo "TopLevelAdmin=no" >config
13807           dotest toplevel2-1b "${testcvs} -q ci -m no-top-level" \
13808 "Checking in config;
13809 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13810 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13811 done
13812 ${PROG} commit: Rebuilding administrative file database"
13813           cd ../..
13814           rm -r 1
13815
13816           # Now set up some directories and subdirectories
13817           mkdir 1; cd 1
13818           dotest toplevel2-1 "${testcvs} -q co -l ." ''
13819           mkdir top-dir second-dir
13820           dotest toplevel2-2 "${testcvs} add top-dir second-dir" \
13821 "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
13822 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
13823           cd top-dir
13824
13825           touch file1
13826           dotest toplevel2-3 "${testcvs} add file1" \
13827 "${PROG} add: scheduling file .file1. for addition
13828 ${PROG} add: use .${PROG} commit. to add this file permanently"
13829           dotest toplevel2-4 "${testcvs} -q ci -m add" \
13830 "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
13831 done
13832 Checking in file1;
13833 ${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
13834 initial revision: 1\.1
13835 done"
13836           cd ..
13837
13838           cd second-dir
13839           touch file2
13840           dotest toplevel2-3s "${testcvs} add file2" \
13841 "${PROG} add: scheduling file .file2. for addition
13842 ${PROG} add: use .${PROG} commit. to add this file permanently"
13843           dotest toplevel2-4s "${testcvs} -q ci -m add" \
13844 "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
13845 done
13846 Checking in file2;
13847 ${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
13848 initial revision: 1\.1
13849 done"
13850
13851           cd ../..
13852           rm -r 1; mkdir 1; cd 1
13853           dotest toplevel2-5 "${testcvs} co top-dir" \
13854 "${PROG} checkout: Updating top-dir
13855 U top-dir/file1"
13856
13857           dotest toplevel2-6 "${testcvs} update top-dir" \
13858 "${PROG} update: Updating top-dir"
13859           dotest toplevel2-7 "${testcvs} update"  \
13860 "${PROG} update: Updating top-dir"
13861
13862           dotest toplevel2-8 "${testcvs} update -d top-dir" \
13863 "${PROG} update: Updating top-dir"
13864           # Contrast this with toplevel-9, which has TopLevelAdmin=yes.
13865           dotest toplevel2-9 "${testcvs} update -d" \
13866 "${PROG} update: Updating top-dir"
13867
13868           cd ..
13869           rm -r 1; mkdir 1; cd 1
13870           dotest toplevel2-10 "${testcvs} co top-dir" \
13871 "${PROG} checkout: Updating top-dir
13872 U top-dir/file1"
13873           # This tests more or less the same thing, in a particularly
13874           # "real life" example.  With TopLevelAdmin=yes, this command
13875           # would give us second-dir and CVSROOT directories too.
13876           dotest toplevel2-11 "${testcvs} -q update -d" ""
13877
13878           dotest toplevel2-cleanup-1 "${testcvs} -q co CVSROOT/config" \
13879 "U CVSROOT/config"
13880           cd CVSROOT
13881           echo "# empty file" >config
13882           dotest toplevel2-cleanup-2 "${testcvs} -q ci -m toplevel2-cleanup" \
13883 "Checking in config;
13884 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13885 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13886 done
13887 ${PROG} commit: Rebuilding administrative file database"
13888           cd ../..
13889           rm -r 1
13890           rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
13891           ;;
13892
13893
13894
13895         rstar-toplevel)
13896           # FIXCVS:
13897           # This test confirms a bug that exists in the r* commands currently
13898           # when run against the top-level project.
13899           #
13900           # The assertion failure is something like:
13901           # do_recursion: Assertion \`strstr (repository, \"/\./\") == ((void \*)0)' failed\..*"
13902           dotest_fail rstar-toplevel-1 "$testcvs rlog ." \
13903 "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
13904
13905           if $keep; then
13906             echo Keeping ${TESTDIR} and exiting due to --keep
13907             exit 0
13908           fi
13909         ;;
13910
13911
13912
13913         trailingslashes)
13914           # Some tests of CVS's reactions to path specifications containing
13915           # trailing slashes.
13916           mkdir trailingslashes; cd trailingslashes
13917           dotest trailingslashes-init-1 "$testcvs -Q co -ldt ."
13918           dotest trailingslashes-init-2 "$testcvs -Q co -dt2 ."
13919           cd t
13920           echo "Ahh'll be baaack." >topfile
13921           dotest trailingslashes-init-3 "$testcvs -Q add topfile"
13922           dotest trailingslashes-init-4 "$testcvs -Q ci -mto-top" \
13923 "RCS file: $CVSROOT_DIRNAME/topfile,v
13924 done
13925 Checking in topfile;
13926 $CVSROOT_DIRNAME/topfile,v  <--  topfile
13927 initial revision: 1\.1
13928 done"
13929
13930           # First, demonstrate the usual case.
13931           cd ../t2
13932           dotest trailingslashes-1 "$testcvs -q up CVSROOT"
13933           dotest_fail trailingslashes-1a "test -f topfile"
13934
13935           # FIXCVS:
13936           # Now the one that fails in remote mode.
13937           # This highlights one of the failure cases mentioned in TODO item
13938           # #205.
13939           if $remote; then
13940                   dotest trailingslashes-2 "$testcvs -q up CVSROOT/" \
13941 "U topfile"
13942                   dotest trailingslashes-2a "test -f topfile"
13943           else
13944                   dotest trailingslashes-2 "$testcvs -q up CVSROOT/"
13945                   dotest_fail trailingslashes-2a "test -f topfile"
13946           fi
13947
13948           if $keep; then
13949             echo Keeping $TESTDIR and exiting due to --keep
13950             exit 0
13951           fi
13952
13953           cd ../..
13954           rm -rf trailingslashes $CVSROOT_DIRNAME/topfile,v
13955           ;;
13956
13957
13958
13959         checkout_repository)
13960           dotest_fail checkout_repository-1 \
13961 "${testcvs} co -d ${CVSROOT_DIRNAME} CVSROOT" \
13962 "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
13963 "${PROG} \[checkout aborted\]: absolute pathname \`${CVSROOT_DIRNAME}' illegal for server"
13964
13965           # The behavior of the client/server test below should be correct.
13966           # The CVS client currently has no way of knowing that the client and
13967           # server are the same machine and thus skips the $CVSROOT checks.
13968           # I think checking for this case in CVS would be bloat since this
13969           # should be a fairly rare occurance.
13970           cd ${CVSROOT_DIRNAME}
13971           dotest_fail checkout_repository-2 "${testcvs} co CVSROOT" \
13972 "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
13973 "${PROG} checkout: Updating CVSROOT
13974 ${PROG} checkout: move away CVSROOT/checkoutlist; it is in the way
13975 C CVSROOT/checkoutlist
13976 ${PROG} checkout: move away CVSROOT/commitinfo; it is in the way
13977 C CVSROOT/commitinfo
13978 ${PROG} checkout: move away CVSROOT/config; it is in the way
13979 C CVSROOT/config
13980 ${PROG} checkout: move away CVSROOT/cvswrappers; it is in the way
13981 C CVSROOT/cvswrappers
13982 ${PROG} checkout: move away CVSROOT/editinfo; it is in the way
13983 C CVSROOT/editinfo
13984 ${PROG} checkout: move away CVSROOT/loginfo; it is in the way
13985 C CVSROOT/loginfo
13986 ${PROG} checkout: move away CVSROOT/modules; it is in the way
13987 C CVSROOT/modules
13988 ${PROG} checkout: move away CVSROOT/notify; it is in the way
13989 C CVSROOT/notify
13990 ${PROG} checkout: move away CVSROOT/rcsinfo; it is in the way
13991 C CVSROOT/rcsinfo
13992 ${PROG} checkout: move away CVSROOT/taginfo; it is in the way
13993 C CVSROOT/taginfo
13994 ${PROG} checkout: move away CVSROOT/verifymsg; it is in the way
13995 C CVSROOT/verifymsg"
13996
13997           dotest checkout_repository-3 \
13998 "${testcvs} co -p CVSROOT/modules >/dev/null" \
13999 "===================================================================
14000 Checking out CVSROOT/modules
14001 RCS:  ${CVSROOT_DIRNAME}/CVSROOT/modules,v
14002 VERS: 1\.[0-9]*
14003 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
14004           cd ${TESTDIR}
14005           ;;
14006
14007         mflag)
14008           for message in '' ' ' '       
14009            ' '                  test' ; do
14010             # Set up
14011             mkdir a-dir; cd a-dir
14012             # Test handling of -m during import
14013             echo testa >>test
14014             if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
14015                 pass 156
14016             else
14017                 fail 156
14018             fi
14019             # Must import twice since the first time uses inline code that
14020             # avoids RCS call.
14021             echo testb >>test
14022             if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
14023                 pass 157
14024             else
14025                 fail 157
14026             fi
14027             # Test handling of -m during ci
14028             cd ..; rm -r a-dir
14029             if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
14030                 pass 158
14031             else
14032                 fail 158
14033             fi
14034             cd a-dir
14035             echo testc >>test
14036             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
14037                 pass 159
14038             else
14039                 fail 159
14040             fi
14041             # Test handling of -m during rm/ci
14042             rm test;
14043             if ${testcvs} rm test >>${LOGFILE} 2>&1; then
14044                 pass 160
14045             else
14046                 fail 160
14047             fi
14048             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
14049                 pass 161
14050             else
14051                 fail 161
14052             fi
14053             # Clean up
14054             cd ..
14055             rm -r a-dir
14056             rm -rf ${CVSROOT_DIRNAME}/a-dir
14057           done
14058           ;;
14059
14060         editor)
14061           # More tests of log messages, in this case the ability to
14062           # run an external editor.
14063           # TODO:
14064           #   * also test $EDITOR, $CVSEDITOR, &c.
14065           #   * test what happens if up-to-date check fails.
14066
14067           # Our "editor" puts "x" at the start of each line, so we
14068           # can see the "CVS:" lines.
14069           cat >${TESTDIR}/editme <<EOF
14070 #!${TESTSHELL}
14071 sleep 1
14072 sed <\$1 -e 's/^/x/' >${TESTDIR}/edit.new
14073 mv ${TESTDIR}/edit.new \$1
14074 exit 0
14075 EOF
14076           chmod +x ${TESTDIR}/editme
14077
14078           mkdir 1; cd 1
14079           dotest editor-1 "${testcvs} -q co -l ." ''
14080           mkdir first-dir
14081           dotest editor-2 "${testcvs} add first-dir" \
14082 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
14083           cd first-dir
14084           touch file1 file2
14085           dotest editor-3 "${testcvs} add file1 file2" \
14086 "${PROG} add: scheduling file .file1. for addition
14087 ${PROG} add: scheduling file .file2. for addition
14088 ${PROG} add: use .${PROG} commit. to add these files permanently"
14089           dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
14090 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14091 done
14092 Checking in file1;
14093 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14094 initial revision: 1\.1
14095 done
14096 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
14097 done
14098 Checking in file2;
14099 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
14100 initial revision: 1\.1
14101 done"
14102           dotest editor-5 "${testcvs} -q tag -b br" "T file1
14103 T file2"
14104           dotest editor-6 "${testcvs} -q update -r br" ''
14105           echo modify >>file1
14106           dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
14107 "Checking in file1;
14108 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14109 new revision: 1\.1\.2\.1; previous revision: 1\.1
14110 done"
14111           # OK, now we want to make sure "ci -r" puts in the branch
14112           # where appropriate.  Note that we can check in on the branch
14113           # without being on the branch, because there is not a revision
14114           # already on the branch.  If there were a revision on the branch,
14115           # CVS would correctly give an up-to-date check failed.
14116           dotest editor-8 "${testcvs} -q update -A" "U file1"
14117           echo add a line >>file2
14118           dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
14119 "Checking in file2;
14120 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
14121 new revision: 1\.1\.2\.1; previous revision: 1\.1
14122 done"
14123
14124           dotest editor-log-file1 "${testcvs} log -N file1" "
14125 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14126 Working file: file1
14127 head: 1\.1
14128 branch:
14129 locks: strict
14130 access list:
14131 keyword substitution: kv
14132 total revisions: 2;     selected revisions: 2
14133 description:
14134 ----------------------------
14135 revision 1\.1
14136 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
14137 branches:  1\.1\.2;
14138 xCVS: ----------------------------------------------------------------------
14139 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14140 xCVS:
14141 xCVS: Committing in .
14142 xCVS:
14143 xCVS: Added Files:
14144 xCVS:   file1 file2
14145 xCVS: ----------------------------------------------------------------------
14146 ----------------------------
14147 revision 1\.1\.2\.1
14148 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
14149 xCVS: ----------------------------------------------------------------------
14150 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14151 xCVS:
14152 xCVS: Committing in .
14153 xCVS:
14154 xCVS: Modified Files:
14155 xCVS:  Tag: br
14156 xCVS:   file1
14157 xCVS: ----------------------------------------------------------------------
14158 ============================================================================="
14159
14160           # The only difference between the two expect strings is the
14161           # presence or absence of "Committing in ." for 1.1.2.1.
14162           dotest editor-log-file2 "${testcvs} log -N file2" "
14163 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
14164 Working file: file2
14165 head: 1\.1
14166 branch:
14167 locks: strict
14168 access list:
14169 keyword substitution: kv
14170 total revisions: 2;     selected revisions: 2
14171 description:
14172 ----------------------------
14173 revision 1\.1
14174 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
14175 branches:  1\.1\.2;
14176 xCVS: ----------------------------------------------------------------------
14177 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14178 xCVS:
14179 xCVS: Committing in .
14180 xCVS:
14181 xCVS: Added Files:
14182 xCVS:   file1 file2
14183 xCVS: ----------------------------------------------------------------------
14184 ----------------------------
14185 revision 1\.1\.2\.1
14186 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
14187 xCVS: ----------------------------------------------------------------------
14188 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14189 xCVS:
14190 xCVS: Modified Files:
14191 xCVS:  Tag: br
14192 xCVS:   file2
14193 xCVS: ----------------------------------------------------------------------
14194 =============================================================================" "
14195 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
14196 Working file: file2
14197 head: 1\.1
14198 branch:
14199 locks: strict
14200 access list:
14201 keyword substitution: kv
14202 total revisions: 2;     selected revisions: 2
14203 description:
14204 ----------------------------
14205 revision 1\.1
14206 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
14207 branches:  1\.1\.2;
14208 xCVS: ----------------------------------------------------------------------
14209 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14210 xCVS:
14211 xCVS: Committing in .
14212 xCVS:
14213 xCVS: Added Files:
14214 xCVS:   file1 file2
14215 xCVS: ----------------------------------------------------------------------
14216 ----------------------------
14217 revision 1\.1\.2\.1
14218 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
14219 xCVS: ----------------------------------------------------------------------
14220 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
14221 xCVS:
14222 xCVS: Committing in .
14223 xCVS:
14224 xCVS: Modified Files:
14225 xCVS:  Tag: br
14226 xCVS:   file2
14227 xCVS: ----------------------------------------------------------------------
14228 ============================================================================="
14229
14230           # Test CVS's response to an unchanged log message
14231           cat >${TESTDIR}/editme <<EOF
14232 #!${TESTSHELL}
14233 sleep 1
14234 exit 0
14235 EOF
14236           chmod +x ${TESTDIR}/editme
14237           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
14238 "
14239 Log message unchanged or not specified
14240 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
14241 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
14242
14243           # Test CVS's response to an empty log message
14244           cat >${TESTDIR}/editme <<EOF
14245 #!${TESTSHELL}
14246 sleep 1
14247 cat /dev/null >\$1
14248 exit 0
14249 EOF
14250           chmod +x ${TESTDIR}/editme
14251           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
14252 "
14253 Log message unchanged or not specified
14254 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
14255 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
14256
14257           # Test CVS's response to a log message with one blank line
14258           cat >${TESTDIR}/editme <<EOF
14259 #!${TESTSHELL}
14260 sleep 1
14261 echo >\$1
14262 exit 0
14263 EOF
14264           chmod +x ${TESTDIR}/editme
14265           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
14266 "
14267 Log message unchanged or not specified
14268 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
14269 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
14270
14271           # Test CVS's response to a log message with only comments
14272           cat >${TESTDIR}/editme <<EOF
14273 #!${TESTSHELL}
14274 sleep 1
14275 cat \$1 >${TESTDIR}/edit.new
14276 mv ${TESTDIR}/edit.new \$1
14277 exit 0
14278 EOF
14279           chmod +x ${TESTDIR}/editme
14280           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
14281 "
14282 Log message unchanged or not specified
14283 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
14284 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
14285
14286           # Test CVS's response to a log message that is zero bytes
14287           # in length. This caused core dumps in cvs 1.11.5 on Solaris
14288           # hosts.
14289           cd ..
14290           dotest editor-emptylog-continue-1 "${testcvs} -q co CVSROOT/loginfo" \
14291 "U CVSROOT/loginfo"
14292
14293           cd CVSROOT
14294           echo 'DEFAULT (echo Start-Log;cat;echo End-Log) >> \$CVSROOT/CVSROOT/commitlog' > loginfo
14295           dotest editor-emptylog-continue-2 "${testcvs} commit -m add loginfo" \
14296 "Checking in loginfo;
14297 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
14298 new revision: 1\.2; previous revision: 1\.1
14299 done
14300 ${PROG} commit: Rebuilding administrative file database"
14301
14302           cd ../first-dir
14303           cat >${TESTDIR}/editme <<EOF
14304 #!${TESTSHELL}
14305 sleep 1
14306 cp /dev/null \$1
14307 exit 1
14308 EOF
14309           chmod +x ${TESTDIR}/editme
14310           dotest editor-emptylog-continue-3 "echo c |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
14311 "${PROG} [a-z]*: warning: editor session failed
14312
14313 Log message unchanged or not specified
14314 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
14315 Action: (continue) Checking in file1;
14316 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14317 new revision: 1\.2; previous revision: 1\.1
14318 done"
14319           # The loginfo Log message should be an empty line and not "(null)"
14320           # which is what some fprintf() implementations do with "%s"
14321           # format and a NULL pointer...
14322           if $remote; then
14323             dotest editor-emptylog-continue-4r \
14324 "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
14325 "Start-Log
14326 Update of ${CVSROOT_DIRNAME}/first-dir
14327 In directory ${hostname}:${TMPDIR}/cvs-serv[0-9a-z]*
14328
14329 Modified Files:
14330         file1 
14331 Log Message:
14332
14333 End-Log"
14334           else
14335             dotest editor-emptylog-continue-4 \
14336 "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
14337 "Start-Log
14338 Update of ${CVSROOT_DIRNAME}/first-dir
14339 In directory ${hostname}:${TESTDIR}/1/first-dir
14340
14341 Modified Files:
14342         file1 
14343 Log Message:
14344
14345 End-Log"
14346          fi
14347           # There should have an empty log message at this point
14348           dotest editor-emptylog-continue-5 "${testcvs} log -N -r1.2 file1" \
14349 "
14350 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14351 Working file: file1
14352 head: 1\.2
14353 branch:
14354 locks: strict
14355 access list:
14356 keyword substitution: kv
14357 total revisions: 3;     selected revisions: 1
14358 description:
14359 ----------------------------
14360 revision 1\.2
14361 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: +0 -0
14362 \*\*\* empty log message \*\*\*
14363 ============================================================================="
14364
14365           # clean up
14366           if $keep; then
14367             echo Keeping ${TESTDIR} and exiting due to --keep
14368             exit 0
14369           fi
14370
14371           # restore the default loginfo script
14372           rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v \
14373                 ${CVSROOT_DIRNAME}/CVSROOT/loginfo \
14374                 ${CVSROOT_DIRNAME}/CVSROOT/commitlog
14375           dotest editor-emptylog-continue-cleanup-1 "${testcvs} init" ''
14376
14377           cd ../..
14378           rm -r 1
14379           rm ${TESTDIR}/editme
14380           rm -rf ${CVSROOT_DIRNAME}/first-dir
14381           ;;
14382
14383         errmsg1)
14384           mkdir ${CVSROOT_DIRNAME}/1dir
14385           mkdir 1
14386           cd 1
14387           if ${testcvs} -q co 1dir; then
14388               pass 162
14389           else
14390               fail 162
14391           fi
14392           cd 1dir
14393           touch foo
14394           if ${testcvs} add foo 2>>${LOGFILE}; then
14395               pass 163
14396           else
14397               fail 163
14398           fi
14399           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
14400               pass 164
14401           else
14402               fail 164
14403           fi
14404           cd ../..
14405           mkdir 2
14406           cd 2
14407           if ${testcvs} -q co 1dir >>${LOGFILE}; then
14408               pass 165
14409           else
14410               fail 165
14411           fi
14412           chmod a-w 1dir
14413           cd ../1/1dir
14414           rm foo;
14415           if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
14416               pass 166
14417           else
14418               fail 166
14419           fi
14420           if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
14421               pass 167
14422           else
14423               fail 167
14424           fi
14425
14426           cd ../../2/1dir
14427           # The second case in the local and remote versions of errmsg1-168
14428           # below happens on Cygwin under Windows, where write privileges
14429           # aren't enforced properly.
14430           if $remote; then
14431             dotest errmsg1-168r "${testcvs} -q update" \
14432 "${PROG} update: foo is no longer in the repository
14433 ${PROG} update: unable to remove \./foo: Permission denied" \
14434 "${PROG} update: foo is no longer in the repository"
14435           else
14436             dotest errmsg1-168 "${testcvs} -q update" \
14437 "${PROG} update: foo is no longer in the repository
14438 ${PROG} update: unable to remove foo: Permission denied" \
14439 "${PROG} update: foo is no longer in the repository"
14440           fi
14441
14442           cd ..
14443           chmod u+w 1dir
14444           cd ..
14445           rm -r 1 2
14446           rm -rf ${CVSROOT_DIRNAME}/1dir
14447           ;;
14448
14449         errmsg2)
14450           # More tests of various miscellaneous error handling,
14451           # and cvs add behavior in general.
14452           # See also test basicb-4a, concerning "cvs ci CVS".
14453           # Too many tests to mention test the simple cases of
14454           # adding files and directories.
14455           # Test basicb-2a10 tests cvs -n add.
14456
14457           # First the usual setup; create a directory first-dir.
14458           mkdir 1; cd 1
14459           dotest errmsg2-1 "${testcvs} -q co -l ." ''
14460           mkdir first-dir
14461           dotest errmsg2-2 "${testcvs} add first-dir" \
14462 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
14463           cd first-dir
14464           dotest_fail errmsg2-3 "${testcvs} add CVS" \
14465 "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
14466           touch file1
14467           # For the most part add returns a failure exitstatus if
14468           # there are any errors, even if the remaining files are
14469           # processed without incident.  The "cannot add
14470           # special file" message fits this pattern, at
14471           # least currently.
14472           dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
14473 "${PROG} add: cannot add special file .CVS.; skipping
14474 ${PROG} add: scheduling file .file1. for addition
14475 ${PROG} add: use .${PROG} commit. to add this file permanently"
14476           # I'm not sure these tests completely convey the various strange
14477           # behaviors that CVS had before it specially checked for "." and
14478           # "..".  Suffice it to say that these are unlikely to work right
14479           # without a special case.
14480           dotest_fail errmsg2-5 "${testcvs} add ." \
14481 "${PROG} [a-z]*: cannot add special file .\..; skipping"
14482           dotest_fail errmsg2-6 "${testcvs} add .." \
14483 "${PROG} [a-z]*: cannot add special file .\.\..; skipping"
14484           # Make sure that none of the error messages left droppings
14485           # which interfere with normal operation.
14486           dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
14487 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14488 done
14489 Checking in file1;
14490 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14491 initial revision: 1\.1
14492 done"
14493           mkdir sdir
14494           cd ..
14495           dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
14496 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
14497           # while we're here... check commit with no CVS directory
14498           dotest_fail errmsg2-8a "${testcvs} -q ci first-dir nonexistant" \
14499 "${PROG} [a-z]*: nothing known about .nonexistant'
14500 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
14501           dotest_fail errmsg2-8b "${testcvs} -q ci nonexistant first-dir" \
14502 "${PROG} [a-z]*: nothing known about .nonexistant'
14503 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
14504           dotest errmsg2-8c "${testcvs} -q ci first-dir" ""
14505
14506           cd first-dir
14507
14508           touch file10
14509           mkdir sdir10
14510           dotest errmsg2-10 "${testcvs} add file10 sdir10" \
14511 "${PROG} add: scheduling file .file10. for addition
14512 Directory ${CVSROOT_DIRNAME}/first-dir/sdir10 added to the repository
14513 ${PROG} add: use .${PROG} commit. to add this file permanently"
14514           dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
14515 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
14516 done
14517 Checking in file10;
14518 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
14519 initial revision: 1\.1
14520 done"
14521           # Try to see that there are no droppings left by
14522           # any of the previous tests.
14523           dotest errmsg2-12 "${testcvs} -q update" ""
14524
14525           # Now test adding files with '/' in the name, both one level
14526           # down and more than one level down.
14527           cd ..
14528           mkdir first-dir/sdir10/ssdir
14529           dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
14530 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir added to the repository"
14531
14532           touch first-dir/sdir10/ssdir/ssfile
14533           dotest errmsg2-14 \
14534             "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
14535 "${PROG} add: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
14536 ${PROG} add: use .${PROG} commit. to add this file permanently"
14537           touch first-dir/file15
14538           dotest errmsg2-15 "${testcvs} add first-dir/file15" \
14539 "${PROG} add: scheduling file .first-dir/file15. for addition
14540 ${PROG} add: use .${PROG} commit. to add this file permanently"
14541
14542           # Now the case where we try to give it a directory which is not
14543           # under CVS control.
14544           mkdir bogus-dir
14545           touch bogus-dir/file16
14546           # The first message, from local CVS, is nice.  The second one
14547           # is not nice; would be good to fix remote CVS to give a clearer
14548           # message (e.g. the one from local CVS).  But at least it is an
14549           # error message.
14550           dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
14551 "${PROG} add: in directory bogus-dir:
14552 ${PROG} \[add aborted\]: there is no version here; do .${PROG} checkout. first" \
14553 "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
14554 ${PROG} \[add aborted\]: no repository"
14555           rm -r bogus-dir
14556
14557           # One error condition we don't test for is trying to add a file
14558           # or directory which already is there.
14559
14560           dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
14561 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file15,v
14562 done
14563 Checking in first-dir/file15;
14564 ${CVSROOT_DIRNAME}/first-dir/file15,v  <--  file15
14565 initial revision: 1\.1
14566 done
14567 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v
14568 done
14569 Checking in first-dir/sdir10/ssdir/ssfile;
14570 ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v  <--  ssfile
14571 initial revision: 1\.1
14572 done"
14573           dotest errmsg2-18 "${testcvs} -Q tag test" ''
14574
14575           # trying to import the repository
14576
14577           if $remote; then :; else
14578             cd ${CVSROOT_DIRNAME}
14579             dotest_fail errmsg2-20 "${testcvs} import -mtest . A B" \
14580 "${PROG} \[import aborted\]: attempt to import the repository"
14581             dotest_fail errmsg2-21 "${testcvs} import -mtest first-dir A B" \
14582 "${PROG} \[import aborted\]: attempt to import the repository"
14583           fi
14584
14585           cd ..
14586           rm -r 1
14587           rm -rf ${CVSROOT_DIRNAME}/first-dir
14588           ;;
14589
14590         adderrmsg)
14591           # Test some of the error messages the 'add' command can return and
14592           # their reactions to '-q'.
14593
14594           # First the usual setup; create a directory first-dir.
14595           mkdir 1; cd 1
14596           dotest adderrmsg-init1 "${testcvs} -q co -l ." ''
14597           mkdir adderrmsg-dir
14598           dotest adderrmsg-init2 "${testcvs} add adderrmsg-dir" \
14599 "Directory ${CVSROOT_DIRNAME}/adderrmsg-dir added to the repository"
14600           cd adderrmsg-dir
14601
14602           # try to add the admin dir
14603           dotest_fail adderrmsg-1 "${testcvs} add CVS" \
14604 "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
14605           # might not want to see this message when you 'cvs add *'
14606           dotest_fail adderrmsg-2 "${testcvs} -q add CVS" ""
14607
14608           # to test some other messages
14609           touch file1
14610           dotest adderrmsg-3 "${testcvs} add file1" \
14611 "${PROG} add: scheduling file .file1. for addition
14612 ${PROG} add: use .${PROG} commit. to add this file permanently"
14613
14614           # add it twice
14615           dotest_fail adderrmsg-4 "${testcvs} add file1" \
14616 "${PROG} add: file1 has already been entered"
14617           dotest_fail adderrmsg-5 "${testcvs} -q add file1" ""
14618
14619           dotest adderrmsg-6 "${testcvs} -q ci -madd" \
14620 "RCS file: ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v
14621 done
14622 Checking in file1;
14623 ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v  <--  file1
14624 initial revision: 1\.1
14625 done"
14626
14627           # file in Entries & repository
14628           dotest_fail adderrmsg-7 "${testcvs} add file1" \
14629 "${PROG} add: file1 already exists, with version number 1\.1"
14630           dotest_fail adderrmsg-8 "${testcvs} -q add file1" ""
14631
14632           # clean up
14633           cd ../..
14634           if $keep; then :; else
14635               rm -r 1
14636               rm -rf ${CVSROOT_DIRNAME}/adderrmsg-dir
14637           fi
14638           ;;
14639
14640         opterrmsg)
14641           # Test some option parsing error messages
14642
14643           # No init is necessary since these error messages are printed b4
14644           # CVS looks for a sandbox or repository
14645
14646           # -z used to accept non-numeric arguments.  This bit someone who
14647           # attempted `cvs -z -n up' when the -n was read as the argument to
14648           # -z.
14649           dotest_fail opterrmsg-1 "${testcvs} -z -n up" \
14650 "${PROG}: gzip compression level must be between 0 and 9"
14651
14652           # Some general -z checks
14653           dotest_fail opterrmsg-2 "${testcvs} -z -1 up" \
14654 "${PROG}: gzip compression level must be between 0 and 9"
14655           dotest_fail opterrmsg-3 "${testcvs} -z10 up" \
14656 "${PROG}: gzip compression level must be between 0 and 9"
14657           ;;
14658
14659         devcom)
14660           mkdir ${CVSROOT_DIRNAME}/first-dir
14661           mkdir 1
14662           cd 1
14663           dotest devcom-1 "${testcvs} -q co first-dir"
14664
14665           cd first-dir
14666           echo abb >abb
14667           dotest devcom-2 "${testcvs} add abb" \
14668 "$PROG add: scheduling file \`abb' for addition
14669 $PROG add: use '$PROG commit' to add this file permanently"
14670
14671           dotest devcom-3 "${testcvs} -q ci -m added" \
14672 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abb,v
14673 done
14674 Checking in abb;
14675 ${CVSROOT_DIRNAME}/first-dir/abb,v  <--  abb
14676 initial revision: 1\.1
14677 done"
14678
14679           dotest_fail devcom-4 "${testcvs} watch" "Usage${DOTSTAR}"
14680
14681           dotest devcom-5 "${testcvs} watch on"
14682
14683           echo abc >abc
14684           dotest devcom-6 "${testcvs} add abc" \
14685 "$PROG add: scheduling file \`abc' for addition
14686 $PROG add: use '$PROG commit' to add this file permanently"
14687
14688           dotest devcom-7 "${testcvs} -q ci -m added" \
14689 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
14690 done
14691 Checking in abc;
14692 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
14693 initial revision: 1\.1
14694 done"
14695
14696           cd ../..
14697           mkdir 2
14698           cd 2
14699
14700           dotest devcom-8 "${testcvs} -q co first-dir" \
14701 "U first-dir/abb
14702 U first-dir/abc"
14703
14704           cd first-dir
14705           dotest_fail devcom-9 "test -w abb"
14706           dotest_fail devcom-9 "test -w abc"
14707
14708           dotest devcom-10 "${testcvs} editors" ""
14709
14710           dotest devcom-11 "${testcvs} edit abb"
14711
14712           # Here we test for the traditional ISO C ctime() date format.
14713           # We assume the C locale; I guess that works provided we set
14714           # LC_ALL at the start of this script but whether these
14715           # strings should vary based on locale does not strike me as
14716           # self-evident.
14717           dotest devcom-12 "${testcvs} editors" \
14718 "abb    ${username}     [SMTWF][uoehra][neduit] [JFAMSOND][aepuco][nbrylgptvc] [0-9 ][0-9] [0-9:]* [0-9][0-9][0-9][0-9] GMT     [-a-zA-Z_.0-9]* ${TESTDIR}/2/first-dir"
14719
14720           echo aaaa >>abb
14721           dotest devcom-13 "${testcvs} ci -m modify abb" \
14722 "Checking in abb;
14723 ${CVSROOT_DIRNAME}/first-dir/abb,v  <--  abb
14724 new revision: 1\.2; previous revision: 1\.1
14725 done"
14726
14727           # Unedit of a file not being edited should be a noop.
14728           dotest devcom-14 "${testcvs} unedit abb" ''
14729
14730           dotest devcom-15 "${testcvs} editors" ""
14731
14732           dotest_fail devcom-16 "test -w abb"
14733
14734           dotest devcom-17 "${testcvs} edit abc"
14735
14736           # Unedit of an unmodified file.
14737           dotest devcom-18 "${testcvs} unedit abc"
14738           dotest devcom-19 "${testcvs} edit abc"
14739
14740           echo changedabc >abc
14741           # Try to unedit a modified file; cvs should ask for confirmation
14742           dotest devcom-20 "echo no | ${testcvs} unedit abc" \
14743 "abc has been modified; revert changes? "
14744
14745           dotest devcom-21 "echo changedabc | cmp - abc"
14746
14747           # OK, now confirm the unedit
14748           dotest devcom-22 "echo yes | ${testcvs} unedit abc" \
14749 "abc has been modified; revert changes? "
14750
14751           dotest devcom-23 "echo abc | cmp - abc"
14752
14753           dotest devcom-24 "${testcvs} watchers" ''
14754
14755           # FIXME: This probably should be an error message instead
14756           # of silently succeeding and printing nothing.
14757           dotest devcom-a-nonexist "${testcvs} watchers nonexist" ''
14758
14759           dotest devcom-a1 "${testcvs} watch add" ''
14760           dotest devcom-a2 "${testcvs} watchers" \
14761 "abb    ${username}     edit    unedit  commit
14762 abc     ${username}     edit    unedit  commit"
14763           dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
14764           dotest devcom-a4 "${testcvs} watchers abb" \
14765 "abb    ${username}     edit    commit"
14766
14767           # Check tagging and checking out while we have a CVS
14768           # directory in the repository.
14769           dotest devcom-t0 "${testcvs} -q tag tag" \
14770 'T abb
14771 T abc'
14772           cd ../..
14773           mkdir 3
14774           cd 3
14775
14776           # Test commented out because the bug it tests for is not fixed
14777           # The error is:
14778           # cvs watchers: cannot open CVS/Entries for reading: No such file or directory
14779           # cvs: ../../work/ccvs/src/fileattr.c:75: fileattr_read: Assertion `fileattr_stored_repos != ((void *)0)' failed.
14780 :         dotest devcom-t-nonexist "${testcvs} watchers nonexist" fixme
14781
14782           dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
14783 'U first-dir/abb'
14784           cd ..
14785           # Since first-dir/abb is readonly, use -f.
14786           rm -rf 3
14787
14788           # Test checking out the directory rather than the file.
14789           mkdir 3
14790           cd 3
14791           dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
14792 'U first-dir/abb
14793 U first-dir/abc'
14794           cd ..
14795           # Since the files are readonly, use -f.
14796           rm -rf 3
14797
14798           # Now do it again, after removing the val-tags file created
14799           # by devcom-t1 to force CVS to search the repository
14800           # containing CVS directories.
14801           rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags
14802           mkdir 3
14803           cd 3
14804           dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
14805 'U first-dir/abb
14806 U first-dir/abc'
14807           cd ..
14808           # Since the files are readonly, use -f.
14809           rm -rf 3
14810
14811           # Now remove all the file attributes
14812           cd 2/first-dir
14813           dotest devcom-b0 "${testcvs} watch off" ''
14814           dotest devcom-b1 "${testcvs} watch remove" ''
14815           # Test that CVS 1.6 and earlier can handle the repository.
14816           dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
14817
14818           # Now test watching just some, not all, files.
14819           dotest devcom-some0 "${testcvs} watch on abc" ''
14820           cd ../..
14821           mkdir 3
14822           cd 3
14823           dotest devcom-some1 "${testcvs} -q co first-dir" 'U first-dir/abb
14824 U first-dir/abc'
14825           dotest devcom-some2 "test -w first-dir/abb" ''
14826           dotest_fail devcom-some3 "test -w first-dir/abc" ''
14827           cd ..
14828
14829           if $keep; then
14830             echo Keeping ${TESTDIR} and exiting due to --keep
14831             exit 0
14832           fi
14833
14834           # Use -f because of the readonly files.
14835           rm -rf 1 2 3
14836           rm -rf ${CVSROOT_DIRNAME}/first-dir
14837           ;;
14838
14839         devcom2)
14840           # More watch tests, most notably setting watches on
14841           # files in various different states.
14842           mkdir ${CVSROOT_DIRNAME}/first-dir
14843           mkdir 1
14844           cd 1
14845           dotest devcom2-1 "${testcvs} -q co first-dir" ''
14846           cd first-dir
14847
14848           # This should probably be an error; setting a watch on a totally
14849           # unknown file is more likely to be a typo than intentional.
14850           # But that isn't the currently implemented behavior.
14851           dotest devcom2-2 "${testcvs} watch on w1" ''
14852
14853           touch w1 w2 w3 nw1
14854           dotest devcom2-3 "${testcvs} add w1 w2 w3 nw1" "${DOTSTAR}"
14855           # Letting the user set the watch here probably can be considered
14856           # a feature--although it leads to a few potentially strange
14857           # consequences like one user can set the watch and another actually
14858           # adds the file.
14859           dotest devcom2-4 "${testcvs} watch on w2" ''
14860           dotest devcom2-5 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
14861
14862           # Note that this test differs in a subtle way from devcom-some0;
14863           # in devcom-some0 the watch is creating a new fileattr file, and
14864           # here we are modifying an existing one.
14865           dotest devcom2-6 "${testcvs} watch on w3" ''
14866
14867           # Now test that all the watches got set on the correct files
14868           # FIXME: CVS should have a way to report whether watches are
14869           # set, I think.  The "check it out and see if it read-only" is
14870           # sort of OK, but is complicated by CVSREAD and doesn't help
14871           # if the file is added and not yet committed or some such.
14872           # Probably "cvs status" should report "watch: on" if watch is on
14873           # (and nothing if watch is off, so existing behavior is preserved).
14874           cd ../..
14875           mkdir 2
14876           cd 2
14877           dotest devcom2-7 "${testcvs} -q co first-dir" 'U first-dir/nw1
14878 U first-dir/w1
14879 U first-dir/w2
14880 U first-dir/w3'
14881           dotest devcom2-8 "test -w first-dir/nw1" ''
14882           dotest_fail devcom2-9 "test -w first-dir/w1" ''
14883           dotest_fail devcom2-10 "test -w first-dir/w2" ''
14884           dotest_fail devcom2-11 "test -w first-dir/w3" ''
14885
14886           cd first-dir
14887           # OK, now we want to try files in various states with cvs edit.
14888           dotest devcom2-12 "${testcvs} edit w4" \
14889 "${PROG} edit: no such file w4; ignored"
14890           # Try the same thing with a per-directory watch set.
14891           dotest devcom2-13 "${testcvs} watch on" ''
14892           dotest devcom2-14 "${testcvs} edit w5" \
14893 "${PROG} edit: no such file w5; ignored"
14894           dotest devcom2-15 "${testcvs} editors" ''
14895           dotest devcom2-16 "${testcvs} editors w4" ''
14896           # Make sure there are no droppings lying around
14897           dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
14898 "Fw1    _watched=
14899 Fw2     _watched=
14900 Fw3     _watched=
14901 Fnw1    _watched=
14902 D       _watched="
14903           cd ..
14904
14905           # Do a little error testing
14906           dotest devcom2-18 "${testcvs} -q co -d first+dir first-dir" \
14907 "U first${PLUS}dir/nw1
14908 U first${PLUS}dir/w1
14909 U first${PLUS}dir/w2
14910 U first${PLUS}dir/w3"
14911           cd first+dir
14912           dotest_fail devcom2-19 "${testcvs} edit" \
14913 "${PROG} \[[a-z]* aborted\]: current directory (${TESTDIR}/2/first${PLUS}dir) contains an invalid character (${PLUS},>;=\\\\t\\\\n)"
14914
14915           # Make sure there are no droppings lying around
14916           dotest devcom2-20 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
14917 "Fw1    _watched=
14918 Fw2     _watched=
14919 Fw3     _watched=
14920 Fnw1    _watched=
14921 D       _watched="
14922
14923           cd ../..
14924
14925           # Use -f because of the readonly files.
14926           rm -rf 1 2
14927           rm -rf ${CVSROOT_DIRNAME}/first-dir
14928           ;;
14929
14930         devcom3)
14931           # More watch tests, most notably handling of features designed
14932           # for future expansion.
14933           mkdir ${CVSROOT_DIRNAME}/first-dir
14934           mkdir 1
14935           cd 1
14936           dotest devcom3-1 "${testcvs} -q co first-dir" ''
14937           cd first-dir
14938
14939           touch w1 w2
14940           dotest devcom3-2 "${testcvs} add w1 w2" "${DOTSTAR}"
14941           dotest devcom3-3 "${testcvs} watch on w1 w2" ''
14942           dotest devcom3-4 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
14943
14944           # OK, since we are about to delve into CVS's internals, make
14945           # sure that we seem to be correct about how they work.
14946           dotest devcom3-5 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
14947 "Fw1    _watched=
14948 Fw2     _watched="
14949           # Now write a few more lines, just as if we were a newer version
14950           # of CVS implementing some new feature.
14951           cat <<'EOF' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
14952 Enew    line    here
14953 G@#$^!@#=&
14954 EOF
14955           # Now get CVS to write to the fileattr file....
14956           dotest devcom3-6 "${testcvs} watch off w1" ''
14957           # ...and make sure that it hasn't clobbered our new lines.
14958           # Note that writing these lines in another order would be OK
14959           # too.
14960           dotest devcom3-7 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
14961 "Fw2    _watched=
14962 G@#..!@#=&
14963 Enew    line    here"
14964
14965           # See what CVS does when a file name is duplicated.  The
14966           # behavior of all versions of CVS since file attributes were
14967           # implemented is that it nukes the duplications.  This seems
14968           # reasonable enough, although it means it isn't clear how
14969           # useful duplicates would be for purposes of future
14970           # expansion.  But in the interests of keeping behaviors
14971           # predictable, might as well test for it, I guess.
14972           echo 'Fw2     duplicate=' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
14973           dotest devcom3-8 "${testcvs} watch on w1" ''
14974           dotest devcom3-9 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
14975 "Fw2    _watched=
14976 Fw1     _watched=
14977 Enew    line    here
14978 G@#..!@#=&"
14979
14980           # Now test disconnected "cvs edit" and the format of the 
14981           # CVS/Notify file.
14982           if $remote; then
14983             CVS_SERVER_save=${CVS_SERVER}
14984             CVS_SERVER=${TESTDIR}/cvs-none; export CVS_SERVER
14985
14986             # The ${DOTSTAR} below matches the exact CVS server error message,
14987             # which in :fork: mode is:
14988             # "$PROG \[edit aborted\]: cannot exec $TESTDIR/cvs-none: ${DOTSTAR}",
14989             # but which is:
14990             # "bash2: line 1: $TESTDIR/cvs-none: No such file or directory"
14991             # when testing across an :ext:/ssh link to my Linux 2.4 box.
14992             #
14993             # I can't even test for the second part of the error message,
14994             # from the client, which varies more consistently, usually either
14995             # "end of file from server" (if the process doing the exec exits
14996             # before the parent gets around to sending data to it) or
14997             # "received broken pipe signal" (if it is the other way around),
14998             # since HP-UX fails to output it.
14999             dotest_fail devcom3-9ar "${testcvs} edit w1 2>/dev/null"
15000             dotest devcom3-9br "test -w w1" ""
15001             dotest devcom3-9cr "cat CVS/Notify" \
15002 "Ew1    [SMTWF][uoehra][neduit] [JFAMSOND][aepuco][nbrylgptvc] [0-9 ][0-9] [0-9:]* [0-9][0-9][0-9][0-9] GMT     [-a-zA-Z_.0-9]* ${TESTDIR}/1/first-dir  EUC"
15003             CVS_SERVER=${CVS_SERVER_save}; export CVS_SERVER
15004             dotest devcom3-9dr "${testcvs} -q update" ""
15005             dotest_fail devcom3-9er "test -f CVS/Notify" ""
15006             dotest devcom3-9fr "${testcvs} watchers w1" \
15007 "w1     ${username}     tedit   tunedit tcommit"
15008             dotest devcom3-9gr "${testcvs} unedit w1" ""
15009             dotest devcom3-9hr "${testcvs} watchers w1" ""
15010           fi
15011
15012           cd ../..
15013           # OK, now change the tab to a space, and see that CVS gives
15014           # a reasonable error (this is database corruption but CVS should
15015           # not lose its mind).
15016           sed -e 's/Fw2 /Fw2 /' <${CVSROOT_DIRNAME}/first-dir/CVS/fileattr \
15017             >${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new
15018           mv ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new \
15019             ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
15020           mkdir 2; cd 2
15021           dotest_fail devcom3-10 "${testcvs} -Q co ." \
15022 "${PROG} \[checkout aborted\]: file attribute database corruption: tab missing in ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr"
15023           cd ..
15024
15025           # Use -f because of the readonly files.
15026           rm -rf 1 2
15027           rm -rf ${CVSROOT_DIRNAME}/first-dir
15028           ;;
15029
15030         watch4)
15031           # More watch tests, including adding directories.
15032           mkdir 1; cd 1
15033           dotest watch4-0a "${testcvs} -q co -l ." ''
15034           mkdir first-dir
15035           dotest watch4-0b "${testcvs} add first-dir" \
15036 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15037
15038           cd first-dir
15039           dotest watch4-1 "${testcvs} watch on" ''
15040           # This is just like the 173 test
15041           touch file1
15042           dotest watch4-2 "${testcvs} add file1" \
15043 "${PROG} add: scheduling file .file1. for addition
15044 ${PROG} add: use .${PROG} commit. to add this file permanently"
15045           dotest watch4-3 "${testcvs} -q ci -m add" \
15046 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15047 done
15048 Checking in file1;
15049 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15050 initial revision: 1\.1
15051 done"
15052           # Now test the analogous behavior for directories.
15053           mkdir subdir
15054           dotest watch4-4 "${testcvs} add subdir" \
15055 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
15056           cd subdir
15057           touch sfile
15058           dotest watch4-5 "${testcvs} add sfile" \
15059 "${PROG} add: scheduling file .sfile. for addition
15060 ${PROG} add: use .${PROG} commit. to add this file permanently"
15061           dotest watch4-6 "${testcvs} -q ci -m add" \
15062 "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
15063 done
15064 Checking in sfile;
15065 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
15066 initial revision: 1\.1
15067 done"
15068           cd ../../..
15069           mkdir 2; cd 2
15070           dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
15071 U first-dir/subdir/sfile"
15072           dotest_fail watch4-8 "test -w first-dir/file1" ''
15073           dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
15074           cd first-dir
15075           dotest watch4-10 "${testcvs} edit file1" ''
15076           echo 'edited in 2' >file1
15077           cd ../..
15078
15079           cd 1/first-dir
15080           dotest watch4-11 "${testcvs} edit file1" ''
15081           echo 'edited in 1' >file1
15082           dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
15083 "Checking in file1;
15084 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15085 new revision: 1\.2; previous revision: 1\.1
15086 done"
15087           cd ../..
15088           cd 2/first-dir
15089           dotest watch4-13 "${testcvs} -q update" \
15090 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15091 retrieving revision 1\.1
15092 retrieving revision 1\.2
15093 Merging differences between 1\.1 and 1\.2 into file1
15094 rcsmerge: warning: conflicts during merge
15095 ${PROG} update: conflicts found in file1
15096 C file1"
15097           if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
15098             pass watch4-14
15099           else
15100             fail watch4-15
15101           fi
15102           # This could plausibly be defined to either go back to the revision
15103           # which was cvs edit'd (the status quo), or back to revision 1.2
15104           # (that is, the merge could update CVS/Base/file1).  We pick the
15105           # former because it is easier to implement, not because we have
15106           # thought much about which is better.
15107           dotest watch4-16 "cat file1" ''
15108           # Make sure CVS really thinks we are at 1.1.
15109           dotest watch4-17 "${testcvs} -q update" "U file1"
15110           dotest watch4-18 "cat file1" "edited in 1"
15111           cd ../..
15112
15113           # As a sanity check, make sure we are in the right place.
15114           dotest watch4-cleanup-1 "test -d 1" ''
15115           dotest watch4-cleanup-1 "test -d 2" ''
15116           # Specify -f because of the readonly files.
15117           rm -rf 1 2
15118           rm -rf ${CVSROOT_DIRNAME}/first-dir
15119           ;;
15120
15121         watch5)
15122           # This test was designed to catch a problem in server
15123           # mode where an 'cvs edit'd file disappeared from the
15124           # CVS/Base directory when 'cvs status' or 'cvs update'
15125           # was called on the file after the file was touched.
15126           #
15127           # This test is still here to prevent the bug from
15128           # being reintroduced.
15129           #
15130           # The rationale for having CVS/Base stay around is that
15131           # CVS/Base should be there if "cvs edit" has been run (this
15132           # may be helpful as a "cvs editors" analogue, it is
15133           # client-side and based on working directory not username;
15134           # but more importantly, it isn't clear why a "cvs status"
15135           # would act like an unedit, and even if it does, it would
15136           # need to make the file read-only again).
15137
15138           mkdir watch5; cd watch5
15139           dotest watch5-0a "${testcvs} -q co -l ." ''
15140           mkdir first-dir
15141           dotest watch5-0b "${testcvs} add first-dir" \
15142 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15143
15144           cd first-dir
15145           dotest watch5-1 "${testcvs} watch on" ''
15146           # This is just like the 173 test
15147           touch file1
15148           dotest watch5-2 "${testcvs} add file1" \
15149 "${PROG} add: scheduling file .file1. for addition
15150 ${PROG} add: use .${PROG} commit. to add this file permanently"
15151           dotest watch5-3 "${testcvs} -q ci -m add" \
15152 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15153 done
15154 Checking in file1;
15155 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15156 initial revision: 1\.1
15157 done"
15158           dotest watch5-4 "${testcvs} edit file1" ''
15159           dotest watch5-5 "test -f CVS/Base/file1" ''
15160           if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
15161                 pass watch5-6
15162           else
15163                 fail watch5-6
15164           fi
15165           dotest watch5-7 "test -f CVS/Base/file1" ''
15166
15167           # Here's where the file used to dissappear
15168           touch file1
15169           if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
15170                 pass watch5-8
15171           else
15172                 fail watch5-8
15173           fi
15174           dotest watch5-10 "test -f CVS/Base/file1" ''
15175
15176           # Make sure update won't remove the file either
15177           touch file1
15178           dotest watch5-11 "${testcvs} -q up" ''
15179           dotest watch5-12 "test -f CVS/Base/file1" ''
15180
15181           cd ../..
15182           rm -r watch5
15183           rm -rf ${CVSROOT_DIRNAME}/first-dir
15184           ;;
15185
15186         unedit-without-baserev)
15187           mkdir 1; cd 1
15188           module=x
15189
15190           file=m
15191           echo foo > $file
15192           dotest unedit-without-baserev-1 \
15193             "$testcvs -Q import -m . $module X Y" ''
15194           dotest unedit-without-baserev-2 "$testcvs -Q co $module" ''
15195           cd $module
15196
15197           dotest unedit-without-baserev-3 "$testcvs -Q edit $file" ''
15198
15199           echo add a line >> $file
15200           rm -f CVS/Baserev
15201
15202           # This will fail on most systems.
15203           echo "yes" | dotest unedit-without-baserev-4 "${testcvs} -Q unedit $file" \
15204 "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
15205 ${PROG} unedit: run update to complete the unedit"
15206
15207           # SunOS4.1.4 systems make it this far, but with a corrupted
15208           # CVS/Entries file.  Demonstrate the corruption!
15209           dotest unedit-without-baserev-5 "cat CVS/Entries" \
15210             "/$file/1\.1\.1\.1/${DOTSTAR}"
15211
15212           dotest unedit-without-baserev-6 "${testcvs} -q update" \
15213 "${PROG} update: warning: m was lost
15214 U m"
15215
15216           # OK, those were the easy cases.  Now tackle the hard one
15217           # (the reason that CVS/Baserev was invented rather than just
15218           # getting the revision from CVS/Entries).  This is very
15219           # similar to watch4-10 through watch4-18 but with Baserev
15220           # missing.
15221           cd ../..
15222           mkdir 2; cd 2
15223           dotest unedit-without-baserev-7 "${testcvs} -Q co x" ''
15224           cd x
15225
15226           dotest unedit-without-baserev-10 "${testcvs} edit m" ''
15227           echo 'edited in 2' >m
15228           cd ../..
15229
15230           cd 1/x
15231           dotest unedit-without-baserev-11 "${testcvs} edit m" ''
15232           echo 'edited in 1' >m
15233           dotest unedit-without-baserev-12 "${testcvs} -q ci -m edit-in-1" \
15234 "Checking in m;
15235 ${CVSROOT_DIRNAME}/x/m,v  <--  m
15236 new revision: 1\.2; previous revision: 1\.1
15237 done"
15238           cd ../..
15239           cd 2/x
15240           dotest unedit-without-baserev-13 "${testcvs} -q update" \
15241 "RCS file: ${CVSROOT_DIRNAME}/x/m,v
15242 retrieving revision 1\.1\.1\.1
15243 retrieving revision 1\.2
15244 Merging differences between 1\.1\.1\.1 and 1\.2 into m
15245 rcsmerge: warning: conflicts during merge
15246 ${PROG} update: conflicts found in m
15247 C m"
15248           rm CVS/Baserev
15249           dotest unedit-without-baserev-14 "echo yes | ${testcvs} unedit m" \
15250 "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
15251 ${PROG} unedit: run update to complete the unedit"
15252           dotest unedit-without-baserev-15 "${testcvs} -q update" \
15253 "${PROG} update: warning: m was lost
15254 U m"
15255           # The following tests are kind of degenerate compared with
15256           # watch4-16 through watch4-18 but might as well make sure that
15257           # nothing seriously wrong has happened to the working directory.
15258           dotest unedit-without-baserev-16 "cat m" 'edited in 1'
15259           # Make sure CVS really thinks we are at 1.2.
15260           dotest unedit-without-baserev-17 "${testcvs} -q update" ""
15261           dotest unedit-without-baserev-18 "cat m" "edited in 1"
15262
15263           cd ../..
15264           rm -rf 1
15265           rm -r 2
15266           rm -rf ${CVSROOT_DIRNAME}/$module
15267           ;;
15268
15269         ignore)
15270           # On Windows, we can't check out CVSROOT, because the case
15271           # insensitivity means that this conflicts with cvsroot.
15272           mkdir ignore
15273           cd ignore
15274
15275           dotest ignore-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
15276           cd CVSROOT
15277           echo rootig.c >cvsignore
15278           dotest ignore-2 "${testcvs} add cvsignore" \
15279 "${PROG}"' add: scheduling file `cvsignore'"'"' for addition
15280 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
15281
15282           # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
15283           # Accept either.
15284           dotest ignore-3 " ${testcvs} ci -m added" \
15285 "${PROG} [a-z]*: Examining \.
15286 RCS file: ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v
15287 done
15288 Checking in cvsignore;
15289 ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v  <--  cvsignore
15290 initial revision: 1\.1
15291 done
15292 ${PROG} commit: Rebuilding administrative file database"
15293
15294           cd ..
15295           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
15296               pass ignore-4
15297           else
15298               fail ignore-4
15299           fi
15300
15301           # CVS looks at the home dir from getpwuid, not HOME (is that correct
15302           # behavior?), so this is hard to test and we won't try.
15303           # echo foobar.c >${HOME}/.cvsignore
15304           CVSIGNORE=envig.c; export CVSIGNORE
15305           mkdir dir-to-import
15306           cd dir-to-import
15307           touch foobar.c bar.c rootig.c defig.o envig.c optig.c
15308           # We use sort because we can't predict the order in which
15309           # the files will be listed.
15310           dotest_sort ignore-5 "${testcvs} import -m m -I optig.c ignore/first-dir tag1 tag2" \
15311 '
15312
15313 I ignore/first-dir/defig.o
15314 I ignore/first-dir/envig.c
15315 I ignore/first-dir/optig.c
15316 I ignore/first-dir/rootig.c
15317 N ignore/first-dir/bar.c
15318 N ignore/first-dir/foobar.c
15319 No conflicts created by this import'
15320           dotest_sort ignore-6 "${testcvs} import -m m -I ! ignore/second-dir tag3 tag4" \
15321 '
15322
15323 N ignore/second-dir/bar.c
15324 N ignore/second-dir/defig.o
15325 N ignore/second-dir/envig.c
15326 N ignore/second-dir/foobar.c
15327 N ignore/second-dir/optig.c
15328 N ignore/second-dir/rootig.c
15329 No conflicts created by this import'
15330           cd ..
15331           rm -r dir-to-import
15332
15333           mkdir 1
15334           cd 1
15335           dotest ignore-7 "${testcvs} -q co -dsecond-dir ignore/second-dir" \
15336 'U second-dir/bar.c
15337 U second-dir/defig.o
15338 U second-dir/envig.c
15339 U second-dir/foobar.c
15340 U second-dir/optig.c
15341 U second-dir/rootig.c'
15342           dotest ignore-8 "${testcvs} -q co -dfirst-dir ignore/first-dir" 'U first-dir/bar.c
15343 U first-dir/foobar.c'
15344           cd first-dir
15345           touch rootig.c defig.o envig.c optig.c notig.c
15346           dotest ignore-9 "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
15347           # The fact that CVS requires us to specify -I CVS here strikes me
15348           # as a bug.
15349           dotest_sort ignore-10 "${testcvs} -q update -I ! -I CVS" \
15350 "${QUESTION} defig.o
15351 ${QUESTION} envig.c
15352 ${QUESTION} notig.c
15353 ${QUESTION} optig.c
15354 ${QUESTION} rootig.c"
15355
15356           # Now test that commands other than update also print "? notig.c"
15357           # where appropriate.  Only test this for remote, because local
15358           # CVS only prints it on update.
15359           rm optig.c
15360           if $remote; then
15361             dotest ignore-11r "${testcvs} -q diff" "${QUESTION} notig.c"
15362
15363             # Force the server to be contacted.  Ugh.  Having CVS
15364             # contact the server for the sole purpose of checking
15365             # the CVSROOT/cvsignore file does not seem like such a
15366             # good idea, so I imagine this will continue to be
15367             # necessary.  Oh well, at least we test CVS's ablity to
15368             # handle a file with a modified timestamp but unmodified
15369             # contents.
15370             touch bar.c
15371
15372             dotest ignore-11r "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
15373           fi
15374
15375           # now test .cvsignore files
15376           cd ..
15377           echo notig.c >first-dir/.cvsignore
15378           echo foobar.c >second-dir/.cvsignore
15379           touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
15380           dotest_sort ignore-12 "${testcvs} -qn update" \
15381 "${QUESTION} first-dir/.cvsignore
15382 ${QUESTION} second-dir/.cvsignore
15383 ${QUESTION} second-dir/notig.c"
15384           dotest_sort ignore-13 "${testcvs} -qn update -I! -I CVS" \
15385 "${QUESTION} first-dir/.cvsignore
15386 ${QUESTION} first-dir/defig.o
15387 ${QUESTION} first-dir/envig.c
15388 ${QUESTION} first-dir/rootig.c
15389 ${QUESTION} second-dir/.cvsignore
15390 ${QUESTION} second-dir/notig.c"
15391
15392           echo yes | dotest ignore-14 "${testcvs} release -d first-dir" \
15393 "${QUESTION} \.cvsignore
15394 You have \[0\] altered files in this repository.
15395 Are you sure you want to release (and delete) directory .first-dir': "
15396
15397           echo add a line >>second-dir/foobar.c
15398           rm second-dir/notig.c second-dir/.cvsignore
15399           echo yes | dotest ignore-15 "${testcvs} release -d second-dir" \
15400 "M foobar.c
15401 You have \[1\] altered files in this repository.
15402 Are you sure you want to release (and delete) directory .second-dir': "
15403
15404           cd ../..
15405           if $keep; then :; else
15406             rm -r ignore
15407             rm -rf ${CVSROOT_DIRNAME}/ignore
15408           fi
15409           ;;
15410
15411         ignore-on-branch)
15412           # Test that CVS _doesn't_ ignore files on branches because they were
15413           # added to the trunk.
15414           mkdir ignore-on-branch; cd ignore-on-branch
15415           mkdir $CVSROOT_DIRNAME/ignore-on-branch
15416
15417           # create file1 & file2 on trunk
15418           dotest ignore-on-branch-setup-1 "$testcvs -q co -dsetup ignore-on-branch" ''
15419           cd setup
15420           echo file1 >file1 
15421           dotest ignore-on-branch-setup-2 "$testcvs -q add file1" \
15422 "${PROG} add: use .${PROG} commit. to add this file permanently"
15423           dotest ignore-on-branch-setup-3 "$testcvs -q ci -mfile1 file1" \
15424 "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file1,v
15425 done
15426 Checking in file1;
15427 $CVSROOT_DIRNAME/ignore-on-branch/file1,v  <--  file1
15428 initial revision: 1\.1
15429 done"
15430           dotest ignore-on-branch-setup-4 "$testcvs -q tag -b branch" 'T file1'
15431           echo file2 >file2 
15432           dotest ignore-on-branch-setup-5 "$testcvs -q add file2" \
15433 "${PROG} add: use .${PROG} commit. to add this file permanently"
15434           dotest ignore-on-branch-setup-6 "$testcvs -q ci -mtrunk file2" \
15435 "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file2,v
15436 done
15437 Checking in file2;
15438 $CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
15439 initial revision: 1\.1
15440 done"
15441
15442           cd ..
15443
15444           # Check out branch.
15445           #
15446           # - This was the original failure case - file2 would not be flagged
15447           #   with a '?'
15448           dotest ignore-on-branch-1 "$testcvs -q co -rbranch ignore-on-branch" \
15449 'U ignore-on-branch/file1'
15450           cd ignore-on-branch
15451           echo file2 on branch >file2 
15452           dotest ignore-on-branch-2 "$testcvs -nq update" '? file2'
15453
15454           # Now set up for a join.  One of the original fixes for this would
15455           # print out a 'U' and a '?' during a join which added a file.
15456           if $remote; then
15457             dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" \
15458 '? file2
15459 T file1'
15460           else
15461             dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" 'T file1'
15462           fi
15463           dotest ignore-on-branch-4 "$testcvs -q add file2" \
15464 "${PROG} add: use .${PROG} commit. to add this file permanently"
15465           dotest ignore-on-branch-5 "$testcvs -q ci -mbranch file2" \
15466 "Checking in file2;
15467 $CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
15468 new revision: 1\.1\.2\.1; previous revision: 1\.1
15469 done"
15470           dotest ignore-on-branch-6 "$testcvs -q up -rbranch2" \
15471 "${PROG} update: file2 is no longer in the repository"
15472           dotest ignore-on-branch-7 "$testcvs -q up -jbranch" 'U file2'
15473
15474           cd ../..
15475           if $keep; then :; else
15476             rm -r ignore-on-branch
15477             rm -rf $CVSROOT_DIRNAME/ignore-on-branch
15478           fi
15479           ;;
15480
15481         binfiles)
15482           # Test cvs's ability to handle binary files.
15483           # List of binary file tests:
15484           #   * conflicts, "cvs admin": binfiles
15485           #   * branching and joining: binfiles2
15486           #   * adding and removing files: binfiles3
15487           #   * -k wrappers: binwrap, binwrap2, binwrap3
15488           #   * "cvs import" and wrappers: binwrap, binwrap2, binwrap3
15489           #   * -k option to "cvs import": none yet, as far as I know.
15490           mkdir ${CVSROOT_DIRNAME}/first-dir
15491           mkdir 1; cd 1
15492           dotest binfiles-1 "${testcvs} -q co first-dir" ''
15493           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
15494             </dev/null | ${TR} '@' '\000' >binfile.dat
15495           cat binfile.dat binfile.dat >binfile2.dat
15496           cd first-dir
15497           cp ../binfile.dat binfile
15498           dotest binfiles-2 "${testcvs} add -kb binfile" \
15499 "${PROG}"' add: scheduling file `binfile'\'' for addition
15500 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
15501           dotest binfiles-3 "${testcvs} -q ci -m add-it" \
15502 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
15503 done
15504 Checking in binfile;
15505 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
15506 initial revision: 1\.1
15507 done"
15508           cd ../..
15509           mkdir 2; cd 2
15510           dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
15511           cd first-dir
15512           dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
15513           # Testing that sticky options is -kb is the closest thing we have
15514           # to testing that binary files work right on non-unix machines
15515           # (until there is automated testing for such machines, of course).
15516           dotest binfiles-5.5 "${testcvs} status binfile" \
15517 "===================================================================
15518 File: binfile           Status: Up-to-date
15519
15520    Working revision:    1\.1.*
15521    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15522    Sticky Tag:          (none)
15523    Sticky Date:         (none)
15524    Sticky Options:      -kb"
15525
15526           # Test whether the default options from the RCS file are
15527           # also used when operating on files instead of whole
15528           # directories
15529           cd ../..
15530           mkdir 3; cd 3
15531           dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
15532 'U first-dir/binfile'
15533           cd first-dir
15534           dotest binfiles-5.5b1 "${testcvs} status binfile" \
15535 "===================================================================
15536 File: binfile           Status: Up-to-date
15537
15538    Working revision:    1\.1.*
15539    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15540    Sticky Tag:          (none)
15541    Sticky Date:         (none)
15542    Sticky Options:      -kb"
15543           cd ../..
15544           rm -r 3
15545           cd 2/first-dir
15546
15547           cp ../../1/binfile2.dat binfile
15548           dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
15549 "Checking in binfile;
15550 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
15551 new revision: 1\.2; previous revision: 1\.1
15552 done"
15553           cd ../../1/first-dir
15554           dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
15555           dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
15556
15557           # Now test handling of conflicts with binary files.
15558           cp ../binfile.dat binfile
15559           dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
15560 "Checking in binfile;
15561 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
15562 new revision: 1\.3; previous revision: 1\.2
15563 done"
15564           cd ../../2/first-dir
15565           echo 'edits in dir 2' >binfile
15566           dotest binfiles-con1 "${testcvs} -q update" \
15567 "U binfile
15568 ${PROG} update: nonmergeable file needs merge
15569 ${PROG} update: revision 1\.3 from repository is now in binfile
15570 ${PROG} update: file from working directory is now in \.#binfile\.1\.2
15571 C binfile"
15572           dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
15573           dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
15574
15575           cp ../../1/binfile2.dat binfile
15576           dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
15577 "Checking in binfile;
15578 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
15579 new revision: 1\.4; previous revision: 1\.3
15580 done"
15581           cd ../../1/first-dir
15582           dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
15583
15584           dotest binfiles-9 "${testcvs} -q update -A" ''
15585           dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
15586           dotest binfiles-11 "${testcvs} -q update" ''
15587           dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
15588           dotest binfiles-13 "${testcvs} -q update -A" ''
15589
15590           cd ../..
15591
15592           mkdir 3
15593           cd 3
15594           dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
15595 'U first-dir/binfile'
15596           cd first-dir
15597           dotest binfiles-13a1 "${testcvs} status binfile" \
15598 "===================================================================
15599 File: binfile           Status: Up-to-date
15600
15601    Working revision:    1\.4.*
15602    Repository revision: 1\.4    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15603    Sticky Tag:          HEAD (revision: 1\.4)
15604    Sticky Date:         (none)
15605    Sticky Options:      -kb"
15606           cd ../..
15607           rm -r 3
15608
15609           cd 2/first-dir
15610           echo 'this file is $''RCSfile$' >binfile
15611           dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
15612 "Checking in binfile;
15613 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
15614 new revision: 1\.5; previous revision: 1\.4
15615 done"
15616           dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
15617           # See binfiles-5.5 for discussion of -kb.
15618           dotest binfiles-14c "${testcvs} status binfile" \
15619 "===================================================================
15620 File: binfile           Status: Up-to-date
15621
15622    Working revision:    1\.5.*
15623    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15624    Sticky Tag:          (none)
15625    Sticky Date:         (none)
15626    Sticky Options:      -kb"
15627           dotest binfiles-14d "${testcvs} admin -kv binfile" \
15628 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
15629 done"
15630           # cvs admin doesn't change the checked-out file or its sticky
15631           # kopts.  There probably should be a way which does (but
15632           # what if the file is modified?  And do we try to version
15633           # control the kopt setting?)
15634           dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
15635           dotest binfiles-14f "${testcvs} status binfile" \
15636 "===================================================================
15637 File: binfile           Status: Up-to-date
15638
15639    Working revision:    1\.5.*
15640    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15641    Sticky Tag:          (none)
15642    Sticky Date:         (none)
15643    Sticky Options:      -kb"
15644           dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
15645           dotest binfiles-14h "cat binfile" 'this file is binfile,v'
15646           dotest binfiles-14i "${testcvs} status binfile" \
15647 "===================================================================
15648 File: binfile           Status: Up-to-date
15649
15650    Working revision:    1\.5.*
15651    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
15652    Sticky Tag:          (none)
15653    Sticky Date:         (none)
15654    Sticky Options:      -kv"
15655
15656           # Do sticky options work when used with 'cvs update'?
15657           echo "Not a binary file." > nibfile
15658           dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
15659 "${PROG} add: use .${PROG} commit. to add this file permanently"
15660           dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
15661             "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
15662 done
15663 Checking in nibfile;
15664 ${CVSROOT_DIRNAME}/first-dir/nibfile,v  <--  nibfile
15665 initial revision: 1\.1
15666 done"
15667           dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
15668             '[UP] nibfile'
15669           dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
15670 "===================================================================
15671 File: nibfile           Status: Up-to-date
15672
15673    Working revision:    1\.1.*
15674    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
15675    Sticky Tag:          (none)
15676    Sticky Date:         (none)
15677    Sticky Options:      -kb"
15678
15679           # Now test that -A can clear the sticky option.
15680           dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
15681 "[UP] nibfile"
15682           dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
15683 "===================================================================
15684 File: nibfile           Status: Up-to-date
15685
15686    Working revision:    1\.1.*
15687    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
15688    Sticky Tag:          (none)
15689    Sticky Date:         (none)
15690    Sticky Options:      (none)"
15691           dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
15692 "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
15693 done"
15694           dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
15695           dotest binfiles-17 "${testcvs} -q status nibfile" \
15696 "===================================================================
15697 File: nibfile           Status: Up-to-date
15698
15699    Working revision:    1\.1.*
15700    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
15701    Sticky Tag:          (none)
15702    Sticky Date:         (none)
15703    Sticky Options:      -kb"
15704
15705           dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
15706 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
15707 deleting revision 1\.5
15708 deleting revision 1\.4
15709 done"
15710           dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
15711 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
15712 deleting revision 1\.2
15713 deleting revision 1\.1
15714 done"
15715           dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
15716 RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
15717 Working file: binfile
15718 head: 1\.3
15719 branch:
15720 locks: strict
15721 access list:
15722 keyword substitution: v
15723 total revisions: 1
15724 ============================================================================="
15725
15726           # Check that the contents were right.  This isn't the hard case
15727           # (in which RCS_delete_revs does a diff), but might as well.
15728           dotest binfiles-o4 "${testcvs} -q update binfile" "U binfile"
15729           dotest binfiles-o5 "cmp binfile ../../1/binfile.dat" ""
15730
15731           cd ../..
15732           rm -rf ${CVSROOT_DIRNAME}/first-dir
15733           rm -r 1
15734           rm -r 2
15735           ;;
15736
15737         binfiles2)
15738           # Test cvs's ability to handle binary files, particularly branching
15739           # and joining.  The key thing we are worrying about is that CVS
15740           # doesn't print "cannot merge binary files" or some such, in 
15741           # situations where no merging is required.
15742           # See also "join" which does this with non-binary files.
15743           #
15744           # Cases (we are merging from the branch to the trunk):
15745           # binfile.dat) File added on branch, not on trunk.
15746           #      File should be marked for addition.
15747           # brmod) File modified on branch, not on trunk.
15748           #      File should be copied over to trunk (no merging is needed).
15749           # brmod-trmod) File modified on branch, also on trunk.
15750           #      This is a conflict.  Present the user with both files and
15751           #      let them figure it out.
15752           # brmod-wdmod) File modified on branch, not modified in the trunk
15753           #      repository, but modified in the (trunk) working directory.
15754           #      This is also a conflict.
15755
15756           mkdir ${CVSROOT_DIRNAME}/first-dir
15757           mkdir 1; cd 1
15758           dotest binfiles2-1 "${testcvs} -q co first-dir" ''
15759           cd first-dir
15760
15761           # The most important thing here is that binfile, binfile2, &c
15762           # each be distinct from each other.  We also make sure to include
15763           # a few likely end-of-line patterns to make sure nothing is
15764           # being munged as if in text mode.
15765           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
15766             </dev/null | ${TR} '@' '\000' >../binfile
15767           cat ../binfile ../binfile >../binfile2
15768           cat ../binfile2 ../binfile >../binfile3
15769
15770           # FIXCVS: unless a branch has at least one file on it,
15771           # tag_check_valid won't know it exists.  So if brmod didn't
15772           # exist, we would have to invent it.
15773           cp ../binfile brmod
15774           cp ../binfile brmod-trmod
15775           cp ../binfile brmod-wdmod
15776           dotest binfiles2-1a \
15777 "${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
15778 "${PROG} add: scheduling file .brmod. for addition
15779 ${PROG} add: scheduling file .brmod-trmod. for addition
15780 ${PROG} add: scheduling file .brmod-wdmod. for addition
15781 ${PROG} add: use .${PROG} commit. to add these files permanently"
15782           dotest binfiles2-1b "${testcvs} -q ci -m add" \
15783 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
15784 done
15785 Checking in brmod;
15786 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
15787 initial revision: 1\.1
15788 done
15789 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
15790 done
15791 Checking in brmod-trmod;
15792 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
15793 initial revision: 1\.1
15794 done
15795 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
15796 done
15797 Checking in brmod-wdmod;
15798 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
15799 initial revision: 1\.1
15800 done"
15801           dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
15802 T brmod-trmod
15803 T brmod-wdmod'
15804           dotest binfiles2-3 "${testcvs} -q update -r br" ''
15805           cp ../binfile binfile.dat
15806           dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
15807 "${PROG} add: scheduling file .binfile\.dat. for addition on branch .br.
15808 ${PROG} add: use .${PROG} commit. to add this file permanently"
15809           cp ../binfile2 brmod
15810           cp ../binfile2 brmod-trmod
15811           cp ../binfile2 brmod-wdmod
15812           dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
15813 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v
15814 done
15815 Checking in binfile\.dat;
15816 ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v  <--  binfile\.dat
15817 new revision: 1\.1\.2\.1; previous revision: 1\.1
15818 done
15819 Checking in brmod;
15820 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
15821 new revision: 1\.1\.2\.1; previous revision: 1\.1
15822 done
15823 Checking in brmod-trmod;
15824 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
15825 new revision: 1\.1\.2\.1; previous revision: 1\.1
15826 done
15827 Checking in brmod-wdmod;
15828 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
15829 new revision: 1\.1\.2\.1; previous revision: 1\.1
15830 done"
15831           dotest binfiles2-6 "${testcvs} -q update -A" \
15832 "${PROG} update: binfile\.dat is no longer in the repository
15833 [UP] brmod
15834 [UP] brmod-trmod
15835 [UP] brmod-wdmod"
15836           dotest_fail binfiles2-7 "test -f binfile.dat" ''
15837           dotest binfiles2-7-brmod "cmp ../binfile brmod"
15838           cp ../binfile3 brmod-trmod
15839           dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
15840 "Checking in brmod-trmod;
15841 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
15842 new revision: 1\.2; previous revision: 1\.1
15843 done"
15844           cp ../binfile3 brmod-wdmod
15845
15846           dotest binfiles2-8 "${testcvs} -q update -j br" \
15847 "U binfile\.dat
15848 U brmod
15849 ${PROG} update: nonmergeable file needs merge
15850 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
15851 ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
15852 C brmod-trmod
15853 M brmod-wdmod
15854 ${PROG} update: nonmergeable file needs merge
15855 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
15856 ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
15857 C brmod-wdmod"
15858
15859           dotest binfiles2-9 "cmp ../binfile binfile.dat"
15860           dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
15861           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
15862           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
15863           dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
15864           dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
15865
15866           # Test that everything was properly scheduled.
15867           dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
15868 "Checking in binfile\.dat;
15869 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
15870 new revision: 1\.2; previous revision: 1\.1
15871 done
15872 Checking in brmod;
15873 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
15874 new revision: 1\.2; previous revision: 1\.1
15875 done
15876 Checking in brmod-trmod;
15877 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
15878 new revision: 1\.3; previous revision: 1\.2
15879 done
15880 Checking in brmod-wdmod;
15881 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
15882 new revision: 1\.2; previous revision: 1\.1
15883 done"
15884
15885           dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
15886 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
15887 deleting revision 1\.2
15888 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v: can't remove branch point 1\.1
15889 ${PROG} admin: RCS file for .brmod-trmod. not modified\."
15890           dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
15891 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
15892 deleting revision 1\.1\.2\.1
15893 done"
15894           dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
15895 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
15896 deleting revision 1\.2
15897 deleting revision 1\.1
15898 done"
15899           dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
15900 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
15901 Working file: brmod-trmod
15902 head: 1\.3
15903 branch:
15904 locks: strict
15905 access list:
15906 keyword substitution: b
15907 total revisions: 1;     selected revisions: 1
15908 description:
15909 ----------------------------
15910 revision 1\.3
15911 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15912 checkin
15913 ============================================================================="
15914           cd ..
15915           cd ..
15916
15917           rm -rf ${CVSROOT_DIRNAME}/first-dir
15918           rm -r 1
15919           ;;
15920
15921         binfiles3)
15922           # More binary file tests, especially removing, adding, &c.
15923           # See "binfiles" for a list of binary file tests.
15924           mkdir ${CVSROOT_DIRNAME}/first-dir
15925           mkdir 1; cd 1
15926           dotest binfiles3-1 "${testcvs} -q co first-dir" ''
15927           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
15928             </dev/null | ${TR} '@' '\000' >binfile.dat
15929           cd first-dir
15930           echo hello >file1
15931           dotest binfiles3-2 "${testcvs} add file1" \
15932 "${PROG} add: scheduling file .file1. for addition
15933 ${PROG} add: use .${PROG} commit. to add this file permanently"
15934           dotest binfiles3-3 "${testcvs} -q ci -m add-it" \
15935 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15936 done
15937 Checking in file1;
15938 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15939 initial revision: 1\.1
15940 done"
15941           rm file1
15942           dotest binfiles3-4 "${testcvs} rm file1" \
15943 "${PROG} remove: scheduling .file1. for removal
15944 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
15945           dotest binfiles3-5 "${testcvs} -q ci -m remove-it" \
15946 "Removing file1;
15947 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15948 new revision: delete; previous revision: 1\.1
15949 done"
15950           cp ../binfile.dat file1
15951           dotest binfiles3-6 "${testcvs} add -kb file1" \
15952 "${PROG} add: Re-adding file .file1. (in place of dead revision 1\.2)\.
15953 ${PROG} add: use .${PROG} commit. to add this file permanently"
15954           # The idea behind this test is to make sure that the file
15955           # gets opened in binary mode to send to "cvs ci".
15956           dotest binfiles3-6a "cat CVS/Entries" \
15957 "/file1/0/[A-Za-z0-9 :]*/-kb/
15958 D"
15959           # TODO: This just tests the case where the old keyword
15960           # expansion mode is the default (RCS_getexpand == NULL
15961           # in checkaddfile()); should also test the case in which
15962           # we are changing it from one non-default value to another.
15963           dotest binfiles3-7 "${testcvs} -q ci -m readd-it" \
15964 "${PROG} commit: changing keyword expansion mode to -kb
15965 Checking in file1;
15966 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15967 new revision: 1\.3; previous revision: 1\.2
15968 done"
15969           dotest binfiles3-8 "${testcvs} -q log -h -N file1" "
15970 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15971 Working file: file1
15972 head: 1\.3
15973 branch:
15974 locks: strict
15975 access list:
15976 keyword substitution: b
15977 total revisions: 3
15978 ============================================================================="
15979
15980           # OK, now test admin -o on a binary file.  See "admin"
15981           # test for a more complete list of admin -o tests.
15982           cp ${TESTDIR}/1/binfile.dat ${TESTDIR}/1/binfile4.dat
15983           echo '%%$$##@@!!jjiiuull' | ${TR} j '\000' >>${TESTDIR}/1/binfile4.dat
15984           cp ${TESTDIR}/1/binfile4.dat ${TESTDIR}/1/binfile5.dat
15985           echo 'aawwee%$$##@@!!jjil' | ${TR} w '\000' >>${TESTDIR}/1/binfile5.dat
15986
15987           cp ../binfile4.dat file1
15988           dotest binfiles3-9 "${testcvs} -q ci -m change" \
15989 "Checking in file1;
15990 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15991 new revision: 1\.4; previous revision: 1\.3
15992 done"
15993           cp ../binfile5.dat file1
15994           dotest binfiles3-10 "${testcvs} -q ci -m change" \
15995 "Checking in file1;
15996 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15997 new revision: 1\.5; previous revision: 1\.4
15998 done"
15999           dotest binfiles3-11 "${testcvs} admin -o 1.3::1.5 file1" \
16000 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16001 deleting revision 1\.4
16002 done"
16003           dotest binfiles3-12 "${testcvs} -q update -r 1.3 file1" "U file1"
16004           dotest binfiles3-13 "cmp file1 ${TESTDIR}/1/binfile.dat" ""
16005
16006           cd ../..
16007           rm -r 1
16008           rm -rf ${CVSROOT_DIRNAME}/first-dir
16009           ;;
16010
16011         mcopy)
16012           # See comment at "mwrap" test for list of other wrappers tests.
16013           # Test cvs's ability to handle nonmergeable files specified with
16014           # -m 'COPY' in wrappers.  Similar to the binfiles2 test,
16015           # which tests the same thing for binary files
16016           # (which are non-mergeable in the same sense).
16017           #
16018           # Cases (we are merging from the branch to the trunk):
16019           # brmod) File modified on branch, not on trunk.
16020           #      File should be copied over to trunk (no merging is needed).
16021           # brmod-trmod) File modified on branch, also on trunk.
16022           #      This is a conflict.  Present the user with both files and
16023           #      let them figure it out.
16024           # brmod-wdmod) File modified on branch, not modified in the trunk
16025           #      repository, but modified in the (trunk) working directory.
16026           #      This is also a conflict.
16027
16028           # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
16029           # (see wrap_send).  So skip these tests for remote.
16030           if $remote; then :; else
16031
16032             mkdir ${CVSROOT_DIRNAME}/first-dir
16033             mkdir 1; cd 1
16034             dotest mcopy-1 "${testcvs} -q co first-dir" ''
16035             cd first-dir
16036
16037             # FIXCVS: unless a branch has at least one file on it,
16038             # tag_check_valid won't know it exists.  So if brmod didn't
16039             # exist, we would have to invent it.
16040             echo 'brmod initial contents' >brmod
16041             echo 'brmod-trmod initial contents' >brmod-trmod
16042             echo 'brmod-wdmod initial contents' >brmod-wdmod
16043             echo "* -m 'COPY'" >.cvswrappers
16044             dotest mcopy-1a \
16045 "${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
16046 "${PROG} add: scheduling file .\.cvswrappers. for addition
16047 ${PROG} add: scheduling file .brmod. for addition
16048 ${PROG} add: scheduling file .brmod-trmod. for addition
16049 ${PROG} add: scheduling file .brmod-wdmod. for addition
16050 ${PROG} add: use .${PROG} commit. to add these files permanently"
16051             dotest mcopy-1b "${testcvs} -q ci -m add" \
16052 "RCS file: ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v
16053 done
16054 Checking in \.cvswrappers;
16055 ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v  <--  \.cvswrappers
16056 initial revision: 1\.1
16057 done
16058 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
16059 done
16060 Checking in brmod;
16061 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
16062 initial revision: 1\.1
16063 done
16064 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
16065 done
16066 Checking in brmod-trmod;
16067 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
16068 initial revision: 1\.1
16069 done
16070 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
16071 done
16072 Checking in brmod-wdmod;
16073 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
16074 initial revision: 1\.1
16075 done"
16076
16077             # NOTE: .cvswrappers files are broken (see comment in
16078             # src/wrapper.c).  So doing everything via the environment
16079             # variable is a workaround.  Better would be to test them
16080             # both.
16081             CVSWRAPPERS="* -m 'COPY'"
16082             export CVSWRAPPERS
16083             dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
16084 T brmod
16085 T brmod-trmod
16086 T brmod-wdmod'
16087             dotest mcopy-3 "${testcvs} -q update -r br" ''
16088             echo 'modify brmod on br' >brmod
16089             echo 'modify brmod-trmod on br' >brmod-trmod
16090             echo 'modify brmod-wdmod on br' >brmod-wdmod
16091             dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
16092 "Checking in brmod;
16093 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
16094 new revision: 1\.1\.2\.1; previous revision: 1\.1
16095 done
16096 Checking in brmod-trmod;
16097 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
16098 new revision: 1\.1\.2\.1; previous revision: 1\.1
16099 done
16100 Checking in brmod-wdmod;
16101 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
16102 new revision: 1\.1\.2\.1; previous revision: 1\.1
16103 done"
16104             dotest mcopy-6 "${testcvs} -q update -A" \
16105 "[UP] brmod
16106 [UP] brmod-trmod
16107 [UP] brmod-wdmod"
16108             dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
16109 "brmod initial contents
16110 brmod-trmod initial contents
16111 brmod-wdmod initial contents"
16112
16113             echo 'modify brmod-trmod again on trunk' >brmod-trmod
16114             dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
16115 "Checking in brmod-trmod;
16116 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
16117 new revision: 1\.2; previous revision: 1\.1
16118 done"
16119             echo 'modify brmod-wdmod in working dir' >brmod-wdmod
16120
16121             dotest mcopy-8 "${testcvs} -q update -j br" \
16122 "U brmod
16123 ${PROG} update: nonmergeable file needs merge
16124 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
16125 ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
16126 C brmod-trmod
16127 M brmod-wdmod
16128 ${PROG} update: nonmergeable file needs merge
16129 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
16130 ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
16131 C brmod-wdmod"
16132
16133             dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
16134 "modify brmod on br
16135 modify brmod-trmod on br
16136 modify brmod-wdmod on br"
16137             dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
16138 "modify brmod-trmod again on trunk
16139 modify brmod-wdmod in working dir"
16140
16141             # Test that everything was properly scheduled.
16142             dotest mcopy-10 "${testcvs} -q ci -m checkin" \
16143 "Checking in brmod;
16144 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
16145 new revision: 1\.2; previous revision: 1\.1
16146 done
16147 Checking in brmod-trmod;
16148 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
16149 new revision: 1\.3; previous revision: 1\.2
16150 done
16151 Checking in brmod-wdmod;
16152 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
16153 new revision: 1\.2; previous revision: 1\.1
16154 done"
16155             cd ..
16156             cd ..
16157
16158             rm -rf ${CVSROOT_DIRNAME}/first-dir
16159             rm -r 1
16160             unset CVSWRAPPERS
16161
16162           fi # end of tests to be skipped for remote
16163
16164           ;;
16165
16166         binwrap)
16167           # Test the ability to specify binary-ness based on file name.
16168           # See "mwrap" for a list of other wrappers tests.
16169
16170           mkdir dir-to-import
16171           cd dir-to-import
16172           touch foo.c foo.exe
16173
16174           # While we're here, test for rejection of duplicate tag names.
16175           dotest_fail binwrap-0 \
16176             "${testcvs} import -m msg -I ! first-dir dup dup" \
16177 "${PROG} \[[a-z]* aborted\]: tag .dup. was specified more than once"
16178
16179           if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
16180               first-dir tag1 tag2 >>${LOGFILE}; then
16181             pass binwrap-1
16182           else
16183             fail binwrap-1
16184           fi
16185           cd ..
16186           rm -r dir-to-import
16187           dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
16188 U first-dir/foo.exe'
16189           dotest binwrap-3 "${testcvs} -q status first-dir" \
16190 "===================================================================
16191 File: foo\.c                    Status: Up-to-date
16192
16193    Working revision:    1\.1\.1\.1.*
16194    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
16195    Sticky Tag:          (none)
16196    Sticky Date:         (none)
16197    Sticky Options:      (none)
16198
16199 ===================================================================
16200 File: foo\.exe                  Status: Up-to-date
16201
16202    Working revision:    1\.1\.1\.1.*
16203    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
16204    Sticky Tag:          (none)
16205    Sticky Date:         (none)
16206    Sticky Options:      -kb"
16207           rm -r first-dir
16208           rm -rf ${CVSROOT_DIRNAME}/first-dir
16209           ;;
16210
16211         binwrap2)
16212           # Test the ability to specify binary-ness based on file name.
16213           # See "mwrap" for a list of other wrappers tests.
16214
16215           mkdir dir-to-import
16216           cd dir-to-import
16217           touch foo.c foo.exe
16218
16219           # Specify that all files are binary except *.c.
16220           # The order seems to matter, with the earlier rules taking
16221           # precedence.  I'm not sure whether that is good or not,
16222           # but it is the current behavior.
16223           if ${testcvs} import -m message -I ! \
16224               -W "*.c -k 'o'" -W "* -k 'b'" \
16225               first-dir tag1 tag2 >>${LOGFILE}; then
16226             pass binwrap2-1
16227           else
16228             fail binwrap2-1
16229           fi
16230           cd ..
16231           rm -r dir-to-import
16232           dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
16233 U first-dir/foo.exe'
16234           dotest binwrap2-3 "${testcvs} -q status first-dir" \
16235 "===================================================================
16236 File: foo\.c                    Status: Up-to-date
16237
16238    Working revision:    1\.1\.1\.1.*
16239    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
16240    Sticky Tag:          (none)
16241    Sticky Date:         (none)
16242    Sticky Options:      -ko
16243
16244 ===================================================================
16245 File: foo\.exe                  Status: Up-to-date
16246
16247    Working revision:    1\.1\.1\.1.*
16248    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
16249    Sticky Tag:          (none)
16250    Sticky Date:         (none)
16251    Sticky Options:      -kb"
16252           rm -r first-dir
16253           rm -rf ${CVSROOT_DIRNAME}/first-dir
16254           ;;
16255
16256         binwrap3)
16257           # Test communication of file-specified -k wrappers between
16258           # client and server, in `import':
16259           #
16260           #   1. Set up a directory tree, populate it with files.
16261           #   2. Give each directory a different .cvswrappers file. 
16262           #   3. Give the server its own .cvswrappers file.
16263           #   4. Import the whole tree, see if the right files got set
16264           #      to binary.
16265           #
16266           # The tree has a top ("0th") level, and two subdirs, sub1/
16267           # and sub2/; sub2/ contains directory subsub/.  Every
16268           # directory has a .cvswrappers file as well as regular
16269           # files.
16270           #
16271           # In the file names, "foo-b.*" should end up binary, and
16272           # "foo-t.*" should end up text.  Don't worry about the two
16273           # letter extensions; they're just there to help me keep
16274           # things straight.
16275           #
16276           # Here's the directory tree:
16277           #
16278           # ./
16279           #    .cvswrappers
16280           #    foo-b.c0
16281           #    foo-b.sb
16282           #    foo-t.c1
16283           #    foo-t.st
16284           #
16285           #    sub1/             sub2/
16286           #      .cvswrappers      .cvswrappers
16287           #      foo-b.c1          foo-b.sb
16288           #      foo-b.sb          foo-b.st
16289           #      foo-t.c0          foo-t.c0
16290           #      foo-t.st          foo-t.c1
16291           #                        foo-t.c2
16292           #                        foo-t.c3
16293           #
16294           #                        subsub/
16295           #                          .cvswrappers
16296           #                          foo-b.c3
16297           #                          foo-b.sb
16298           #                          foo-t.c0
16299           #                          foo-t.c1
16300           #                          foo-t.c2
16301           #                          foo-t.st
16302
16303           binwrap3_line1="This is a test file "
16304           binwrap3_line2="containing little of use "
16305           binwrap3_line3="except this non-haiku"
16306
16307           binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
16308
16309           cd ${TESTDIR}
16310
16311           # On Windows, we can't check out CVSROOT, because the case
16312           # insensitivity means that this conflicts with cvsroot.
16313           mkdir wnt
16314           cd wnt
16315
16316           mkdir binwrap3 # the 0th dir
16317           mkdir binwrap3/sub1
16318           mkdir binwrap3/sub2
16319           mkdir binwrap3/sub2/subsub
16320           
16321           echo "bar*" > binwrap3/.cvswrappers
16322           echo "*.c0 -k 'b'" >> binwrap3/.cvswrappers
16323           echo "whatever -k 'b'" >> binwrap3/.cvswrappers
16324           echo ${binwrap3_text} > binwrap3/foo-b.c0
16325           echo ${binwrap3_text} > binwrap3/bar-t.c0
16326           echo ${binwrap3_text} > binwrap3/foo-b.sb
16327           echo ${binwrap3_text} > binwrap3/foo-t.sb
16328           echo ${binwrap3_text} > binwrap3/foo-t.c1
16329           echo ${binwrap3_text} > binwrap3/foo-t.st
16330
16331           echo "bar* -k 'kv'" > binwrap3/sub1/.cvswrappers
16332           echo "*.c1 -k 'b'" >> binwrap3/sub1/.cvswrappers
16333           echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
16334           echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
16335           echo ${binwrap3_text} > binwrap3/sub1/bar-t.c1
16336           echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
16337           echo ${binwrap3_text} > binwrap3/sub1/foo-t.sb
16338           echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
16339           echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
16340
16341           echo "bar*" > binwrap3/sub2/.cvswrappers
16342           echo "*.st -k 'b'" >> binwrap3/sub2/.cvswrappers
16343           echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
16344           echo ${binwrap3_text} > binwrap3/sub2/foo-t.sb
16345           echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
16346           echo ${binwrap3_text} > binwrap3/sub2/bar-t.st
16347           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
16348           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
16349           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
16350           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
16351
16352           echo "bar* -k 'kv'" > binwrap3/sub2/subsub/.cvswrappers
16353           echo "*.c3 -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
16354           echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
16355           echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
16356           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
16357           echo ${binwrap3_text} > binwrap3/sub2/subsub/bar-t.c3
16358           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
16359           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.sb
16360           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
16361           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
16362           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
16363           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
16364
16365           # Now set up CVSROOT/cvswrappers, the easy way:
16366           dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
16367           cd CVSROOT
16368           # This destroys anything currently in cvswrappers, but
16369           # presumably other tests will take care of it themselves if
16370           # they use cvswrappers:
16371           echo "foo-t.sb" > cvswrappers
16372           echo "foo*.sb  -k 'b'" >> cvswrappers
16373           dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
16374 "Checking in cvswrappers;
16375 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
16376 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16377 done
16378 ${PROG} commit: Rebuilding administrative file database"
16379           cd ..
16380
16381           # Avoid environmental interference
16382           CVSWRAPPERS_save=${CVSWRAPPERS}
16383           unset CVSWRAPPERS
16384
16385           # Do the import
16386           cd binwrap3
16387           # Not importing .cvswrappers tests whether the client is really
16388           # letting the server know "honestly" whether the file is binary,
16389           # rather than just letting the server see the .cvswrappers file.
16390           dotest binwrap3-2a \
16391 "${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
16392 "[NI] ${DOTSTAR}"
16393
16394           # OK, now test "cvs add".
16395           cd ..
16396           rm -r binwrap3
16397           dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
16398           cd binwrap3
16399           cd sub2
16400           echo "*.newbin -k 'b'" > .cvswrappers
16401           echo .cvswrappers >.cvsignore
16402           echo .cvsignore >>.cvsignore
16403           touch file1.newbin file1.txt
16404           dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
16405 "${PROG} add: scheduling file .file1\.newbin. for addition
16406 ${PROG} add: scheduling file .file1\.txt. for addition
16407 ${PROG} add: use .${PROG} commit. to add these files permanently"
16408           dotest binwrap3-2d "${testcvs} -q ci -m add" \
16409 "RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v
16410 done
16411 Checking in file1\.newbin;
16412 ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v  <--  file1\.newbin
16413 initial revision: 1\.1
16414 done
16415 RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v
16416 done
16417 Checking in file1\.txt;
16418 ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v  <--  file1\.txt
16419 initial revision: 1\.1
16420 done"
16421           cd ..
16422
16423           # Now check out the module and see which files are binary.
16424           cd ..
16425           rm -r binwrap3
16426           dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
16427           cd binwrap3
16428
16429           # Running "cvs status" and matching output is too
16430           # error-prone, too likely to falsely fail.  Instead, we'll
16431           # just grep the Entries lines:
16432
16433           dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
16434                  "/foo-b.c0/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16435
16436           dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
16437                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16438
16439           dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
16440                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
16441
16442           dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
16443                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
16444
16445           dotest binwrap3-top5 "grep foo-t.sb ./CVS/Entries" \
16446                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
16447
16448           dotest binwrap3-top6 "grep bar-t.c0 ./CVS/Entries" \
16449                  "/bar-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
16450
16451           dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
16452                  "/foo-b.c1/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16453
16454           dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
16455                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16456
16457           dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
16458                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
16459
16460           dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
16461                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
16462
16463           dotest binwrap3-sub1-5 "grep foo-t.sb sub1/CVS/Entries" \
16464                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
16465
16466           dotest binwrap3-sub1-6 "grep bar-t.c1 sub1/CVS/Entries" \
16467                  "/bar-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
16468
16469           dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
16470                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16471
16472           dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
16473                  "/foo-b.st/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16474
16475           dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
16476                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
16477
16478           dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
16479                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
16480
16481           dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
16482                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
16483
16484           dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
16485                  "/foo-t.c3/1.1.1.1/[A-Za-z0-9  :]*//"
16486
16487           dotest binwrap3-sub2-7 "grep foo-t.sb sub2/CVS/Entries" \
16488                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
16489
16490           dotest binwrap3-sub2-8 "grep bar-t.st sub2/CVS/Entries" \
16491                  "/bar-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
16492
16493           dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
16494                  "/foo-b.c3/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16495
16496           dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
16497                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
16498
16499           dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
16500                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
16501
16502           dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
16503                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
16504
16505           dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
16506                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
16507
16508           dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
16509                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
16510
16511           dotest binwrap3-subsub7 "grep foo-t.sb sub2/subsub/CVS/Entries" \
16512                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
16513
16514           dotest binwrap3-subsub8 "grep bar-t.c3 sub2/subsub/CVS/Entries" \
16515                  "/bar-t.c3/1.1.1.1/[A-Za-z0-9  :]*//"
16516
16517           dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
16518             "/file1.newbin/1.1/[A-Za-z0-9       :]*/-kb/"
16519           dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
16520             "/file1.txt/1.1/[A-Za-z0-9  :]*//"
16521
16522           # Restore and clean up
16523           cd ..
16524           rm -r binwrap3 CVSROOT
16525           cd ..
16526           rm -r wnt
16527           rm -rf ${CVSROOT_DIRNAME}/binwrap3
16528           CVSWRAPPERS=${CVSWRAPPERS_save}
16529           ;; 
16530
16531         mwrap)
16532           # Tests of various wrappers features:
16533           # -m 'COPY' and cvs update: mwrap
16534           # -m 'COPY' and joining: mcopy
16535           # -k: binwrap, binwrap2
16536           # -t/-f: hasn't been written yet.
16537           # 
16538           # Tests of different ways of specifying wrappers:
16539           # CVSROOT/cvswrappers: mwrap
16540           # -W: binwrap, binwrap2
16541           # .cvswrappers in working directory, local: mcopy
16542           # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
16543           # CVSWRAPPERS environment variable: mcopy
16544
16545           # This test is similar to binfiles-con1; -m 'COPY' specifies
16546           # non-mergeableness the same way that -kb does.
16547
16548           # On Windows, we can't check out CVSROOT, because the case
16549           # insensitivity means that this conflicts with cvsroot.
16550           mkdir wnt
16551           cd wnt
16552
16553           dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
16554           cd CVSROOT
16555           echo "* -m 'COPY'" >>cvswrappers
16556           dotest mwrap-c2 "${testcvs} -q ci -m wrapper-mod" \
16557 "Checking in cvswrappers;
16558 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
16559 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16560 done
16561 ${PROG} commit: Rebuilding administrative file database"
16562           cd ..
16563           mkdir m1; cd m1
16564           dotest mwrap-1 "${testcvs} -q co -l ." ''
16565           mkdir first-dir
16566           dotest mwrap-2 "${testcvs} add first-dir" \
16567 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16568           cd first-dir
16569           touch aa
16570           dotest mwrap-3 "${testcvs} add aa" \
16571 "${PROG} add: scheduling file .aa. for addition
16572 ${PROG} add: use .${PROG} commit. to add this file permanently"
16573           dotest mwrap-4 "${testcvs} -q ci -m add" \
16574 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
16575 done
16576 Checking in aa;
16577 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16578 initial revision: 1\.1
16579 done"
16580           cd ../..
16581           mkdir m2; cd m2
16582           dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
16583           cd first-dir
16584           echo "changed in m2" >aa
16585           dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
16586 "Checking in aa;
16587 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16588 new revision: 1\.2; previous revision: 1\.1
16589 done"
16590           cd ../..
16591           cd m1/first-dir
16592           echo "changed in m1" >aa
16593           if $remote; then
16594             # The tagged text code swallows up "U aa" but isn't yet up to
16595             # trying to figure out how it interacts with the "C aa" and
16596             # other stuff.  The whole deal of having both is pretty iffy.
16597             dotest mwrap-7 "${testcvs} -nq update" \
16598 "${PROG} update: nonmergeable file needs merge
16599 ${PROG} update: revision 1\.2 from repository is now in aa
16600 ${PROG} update: file from working directory is now in \.#aa\.1\.1
16601 C aa
16602 U aa"
16603           else
16604             dotest mwrap-7 "${testcvs} -nq update" \
16605 "U aa
16606 ${PROG} update: nonmergeable file needs merge
16607 ${PROG} update: revision 1\.2 from repository is now in aa
16608 ${PROG} update: file from working directory is now in \.#aa\.1\.1
16609 C aa"
16610           fi
16611           dotest mwrap-8 "${testcvs} -q update" \
16612 "U aa
16613 ${PROG} update: nonmergeable file needs merge
16614 ${PROG} update: revision 1\.2 from repository is now in aa
16615 ${PROG} update: file from working directory is now in \.#aa\.1\.1
16616 C aa"
16617           dotest mwrap-9 "cat aa" "changed in m2"
16618           dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
16619           cd ../..
16620           cd CVSROOT
16621           echo '# comment out' >cvswrappers
16622           dotest mwrap-ce "${testcvs} -q ci -m wrapper-mod" \
16623 "Checking in cvswrappers;
16624 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
16625 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16626 done
16627 ${PROG} commit: Rebuilding administrative file database"
16628           cd ..
16629           rm -r CVSROOT
16630           rm -r m1 m2
16631           cd ..
16632           rm -r wnt
16633           rm -rf ${CVSROOT_DIRNAME}/first-dir
16634           ;;
16635
16636         info)
16637           # Administrative file tests.
16638           # Here is a list of where each administrative file is tested:
16639           # loginfo: info
16640           # modules: modules, modules2, modules3
16641           # cvsignore: ignore
16642           # verifymsg: info
16643           # cvswrappers: mwrap
16644           # taginfo: taginfo
16645           # config: config
16646
16647           # On Windows, we can't check out CVSROOT, because the case
16648           # insensitivity means that this conflicts with cvsroot.
16649           mkdir wnt
16650           cd wnt
16651
16652           dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
16653           cd CVSROOT
16654           rm -f $TESTDIR/testlog $TESTDIR/testlog2
16655           echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
16656           # The following cases test the format string substitution
16657           echo "ALL echo %{sVv} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
16658           echo "ALL echo %{v} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
16659           echo "ALL echo %s >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
16660           echo "ALL echo %{V}AX >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
16661           echo "first-dir echo %sux >>$TESTDIR/testlog2; cat >/dev/null" \
16662             >> loginfo
16663
16664           # Might be nice to move this to crerepos tests; it should
16665           # work to create a loginfo file if you didn't create one
16666           # with "cvs init".
16667           : dotest info-2 "${testcvs} add loginfo" \
16668 "${PROG}"' add: scheduling file `loginfo'"'"' for addition
16669 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
16670
16671           dotest info-3 "${testcvs} -q ci -m new-loginfo" \
16672 "Checking in loginfo;
16673 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
16674 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16675 done
16676 ${PROG} commit: Rebuilding administrative file database"
16677           cd ..
16678
16679           mkdir ${CVSROOT_DIRNAME}/first-dir
16680           dotest info-5 "${testcvs} -q co first-dir" ''
16681           cd first-dir
16682           touch file1
16683           dotest info-6 "${testcvs} add file1" \
16684 "${PROG}"' add: scheduling file `file1'\'' for addition
16685 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
16686           echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
16687           dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
16688 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16689 done
16690 Checking in file1;
16691 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16692 initial revision: 1\.1
16693 done
16694 ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
16695           echo line0 >>file1
16696           dotest info-6b "${testcvs} -q -sOTHER=foo ci -m mod-it" \
16697 "Checking in file1;
16698 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16699 new revision: 1\.2; previous revision: 1\.1
16700 done
16701 ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
16702           echo line1 >>file1
16703           dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
16704 "Checking in file1;
16705 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16706 new revision: 1\.3; previous revision: 1\.2
16707 done"
16708           cd ..
16709           dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${CVSROOT_DIRNAME}="
16710           dotest info-10 "cat $TESTDIR/testlog2" \
16711 'first-dir file1,NONE,1.1
16712 first-dir 1.1
16713 first-dir file1
16714 first-dir NONEAX
16715 first-dir file1ux
16716 first-dir file1,1.1,1.2
16717 first-dir 1.2
16718 first-dir file1
16719 first-dir 1.1AX
16720 first-dir file1ux
16721 first-dir file1,1.2,1.3
16722 first-dir 1.3
16723 first-dir file1
16724 first-dir 1.2AX
16725 first-dir file1ux'
16726
16727           cd CVSROOT
16728           echo '# do nothing' >loginfo
16729           dotest info-11 "${testcvs} -q -s ZEE=garbage ci -m nuke-loginfo" \
16730 "Checking in loginfo;
16731 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
16732 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16733 done
16734 ${PROG} commit: Rebuilding administrative file database"
16735
16736           # Now test verifymsg
16737           cat >${TESTDIR}/vscript <<EOF
16738 #!${TESTSHELL}
16739 if sed 1q < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
16740     exit 0
16741 elif sed 1q < \$1 | grep '^BugId:[ ]*new$' > /dev/null; then
16742     echo A new bugid was found. >> \$1
16743     exit 0
16744 else
16745     echo "No BugId found."
16746     sleep 1
16747     exit 1
16748 fi
16749 EOF
16750           cat >${TESTDIR}/vscript2 <<EOF
16751 #!${TESTSHELL}
16752 if test -f CVS/Repository; then
16753         repo=\`cat CVS/Repository\`
16754 else
16755         repo=\`pwd\`
16756 fi
16757 echo \$repo
16758 if echo "\$repo" |grep yet-another/ >/dev/null 2>&1; then
16759         exit 1
16760 else
16761         exit 0
16762 fi
16763 EOF
16764           # Grumble, grumble, mumble, search for "Cygwin".
16765           if test -n "$remotehost"; then
16766             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/vscript*"
16767           else
16768             chmod +x ${TESTDIR}/vscript*
16769           fi
16770           echo "^first-dir/yet-another\\(/\\|\$\\) ${TESTDIR}/vscript2" >>verifymsg
16771           echo "^first-dir\\(/\\|\$\\) ${TESTDIR}/vscript" >>verifymsg
16772           echo "^missing-script\$ ${TESTDIR}/bogus" >>verifymsg
16773           echo "^missing-var\$ ${TESTDIR}/vscript \${=Bogus}" >>verifymsg
16774           # first test the directory independant verifymsg
16775           dotest info-v1 "${testcvs} -q ci -m add-verification" \
16776 "Checking in verifymsg;
16777 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
16778 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16779 done
16780 ${PROG} commit: Rebuilding administrative file database"
16781
16782           cd ../first-dir
16783           echo line2 >>file1
16784           dotest_fail info-v2 "${testcvs} -q ci -m bogus" \
16785 "No BugId found\.
16786 ${PROG} \[commit aborted\]: Message verification failed"
16787
16788           cat >${TESTDIR}/comment.tmp <<EOF
16789 BugId: 42
16790 and many more lines after it
16791 EOF
16792           dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
16793 "Checking in file1;
16794 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16795 new revision: 1\.4; previous revision: 1\.3
16796 done"
16797           rm ${TESTDIR}/comment.tmp
16798
16799           cd ..
16800           mkdir another-dir
16801           cd another-dir
16802           touch file2
16803           dotest_fail info-v4 \
16804             "${testcvs} import -m bogus first-dir/another x y" \
16805 "No BugId found\.
16806 ${PROG} \[import aborted\]: Message verification failed"
16807
16808           # now verify that directory dependent verifymsgs work
16809           dotest info-v5 \
16810             "${testcvs} import -m bogus first-dir/yet-another x y" \
16811 "${TESTDIR}/wnt/another-dir
16812 N first-dir/yet-another/file2
16813
16814 No conflicts created by this import" \
16815 "${CVSROOT_DIRNAME}/first-dir/yet-another
16816 N first-dir/yet-another/file2
16817
16818 No conflicts created by this import"
16819
16820           # FIXMECVS
16821           #
16822           # note that in the local case the error message is the same as
16823           # info-v5
16824           #
16825           # This means that the verifymsg scripts cannot reliably and
16826           # consistantly obtain information on which directory is being
16827           # committed to.  Thus it is currently useless for them to be
16828           # running in every dir.  They should either be run once or
16829           # directory information should be passed.
16830           if $remote; then
16831             dotest_fail info-v6r \
16832               "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
16833 "${CVSROOT_DIRNAME}/first-dir/yet-another/and-another
16834 ${PROG} \[import aborted\]: Message verification failed"
16835           else
16836             dotest info-v6 \
16837               "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
16838 "${TESTDIR}/wnt/another-dir
16839 N first-dir/yet-another/and-another/file2
16840
16841 No conflicts created by this import"
16842           fi
16843
16844           # check that errors invoking the script cause verification failure
16845           #
16846           # The second text below occurs on Cygwin, where I assume execvp
16847           # does not return to let CVS print the error message when its
16848           # argument does not exist.
16849           dotest_fail info-v7 "${testcvs} import -m bogus missing-script x y" \
16850 "${PROG} import: cannot exec ${TESTDIR}/bogus: No such file or directory
16851 ${PROG} \[import aborted\]: Message verification failed" \
16852 "${PROG} \[import aborted\]: Message verification failed"
16853
16854           dotest_fail info-v8 "${testcvs} import -m bogus missing-var x y" \
16855 "${PROG} import: verifymsg:25: no such user variable \${=Bogus}
16856 ${PROG} \[import aborted\]: Message verification failed"
16857
16858           rm file2
16859           cd ..
16860           rmdir another-dir
16861
16862           cd CVSROOT
16863           echo "RereadLogAfterVerify=always" >>config
16864           dotest info-rereadlog-1 "${testcvs} -q ci -m add-RereadLogAfterVerify=always" \
16865 "Checking in config;
16866 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16867 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16868 done
16869 ${PROG} commit: Rebuilding administrative file database"
16870           cd ../first-dir
16871           echo line3 >>file1
16872           cat >${TESTDIR}/comment.tmp <<EOF
16873 BugId: new
16874 See what happens next.
16875 EOF
16876           dotest info-reread-2 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
16877 "Checking in file1;
16878 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16879 new revision: 1\.5; previous revision: 1\.4
16880 done"
16881           dotest info-reread-3 "${testcvs} -q log -N -r1.5 file1" "
16882 .*
16883 BugId: new
16884 See what happens next.
16885 A new bugid was found.
16886 ============================================================================="
16887
16888           cd ../CVSROOT
16889           grep -v "RereadLogAfterVerify" config > config.new
16890           mv config.new config
16891           echo "RereadLogAfterVerify=stat" >>config
16892           dotest info-reread-4 "${testcvs} -q ci -m add-RereadLogAfterVerify=stat" \
16893 "Checking in config;
16894 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16895 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16896 done
16897 ${PROG} commit: Rebuilding administrative file database"
16898           cd ../first-dir
16899           echo line4 >>file1
16900           cat >${TESTDIR}/comment.tmp <<EOF
16901 BugId: new
16902 See what happens next with stat.
16903 EOF
16904           dotest info-reread-5 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
16905 "Checking in file1;
16906 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16907 new revision: 1\.6; previous revision: 1\.5
16908 done"
16909           dotest info-reread-6 "${testcvs} -q log -N -r1.6 file1" "
16910 .*
16911 BugId: new
16912 See what happens next with stat.
16913 A new bugid was found.
16914 ============================================================================="
16915
16916           cd ../CVSROOT
16917           grep -v "RereadLogAfterVerify" config > config.new
16918           mv config.new config
16919           echo "RereadLogAfterVerify=never" >>config
16920           dotest info-reread-7 "${testcvs} -q ci -m add-RereadLogAfterVerify=never" \
16921 "Checking in config;
16922 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16923 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16924 done
16925 ${PROG} commit: Rebuilding administrative file database"
16926           cd ../first-dir
16927           echo line5 >>file1
16928           cat >${TESTDIR}/comment.tmp <<EOF
16929 BugId: new
16930 See what happens next.
16931 EOF
16932           dotest info-reread-8 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
16933 "Checking in file1;
16934 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16935 new revision: 1\.7; previous revision: 1\.6
16936 done"
16937           dotest info-reread-6 "${testcvs} -q log -N -r1.7 file1" "
16938 .*
16939 BugId: new
16940 See what happens next.
16941 ============================================================================="
16942
16943           cd ../CVSROOT
16944           echo 'DEFAULT false' >verifymsg
16945           echo 'DEFAULT true' >>verifymsg
16946           echo '# defaults' >config
16947           dotest info-multdef "${testcvs} -q ci -m multdef" \
16948 "Checking in config;
16949 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16950 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16951 done
16952 Checking in verifymsg;
16953 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
16954 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16955 done
16956 ${PROG} commit: Rebuilding administrative file database"
16957
16958           cd ../CVSROOT
16959           echo '# do nothing' >verifymsg
16960           dotest info-cleanup-verifymsg "${testcvs} -q ci -m nuke-verifymsg" \
16961 "${PROG} commit: Multiple .DEFAULT. lines (1 and 2) in verifymsg file
16962 Checking in verifymsg;
16963 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
16964 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16965 done
16966 ${PROG} commit: Rebuilding administrative file database"
16967           rm ${TESTDIR}/vscript*
16968           cd ..
16969
16970           dotest_fail info-cleanup-0 "${testcvs} -n release -d CVSROOT" \
16971 "${PROG} \[release aborted\]: cannot run command ${DOTSTAR}"
16972
16973           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
16974             pass info-cleanup
16975           else
16976             fail info-cleanup
16977           fi
16978           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
16979             pass info-cleanup-2
16980           else
16981             fail info-cleanup-2
16982           fi
16983           cd ..
16984           rm -r wnt
16985           rm $HOME/.cvsrc
16986           rm -rf ${CVSROOT_DIRNAME}/first-dir
16987           ;;
16988
16989         taginfo)
16990           # Tests of the CVSROOT/taginfo file.  See the comment at the
16991           # "info" tests for a full list of administrative file tests.
16992
16993           # Tests to add:
16994           #   -F to move
16995
16996           mkdir 1; cd 1
16997           dotest taginfo-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
16998           cd CVSROOT
16999           cat >${TESTDIR}/1/loggit <<EOF
17000 #!${TESTSHELL}
17001 if test "\$1" = rejectme; then
17002   exit 1
17003 else
17004   echo "\$@" >>${TESTDIR}/1/taglog
17005   exit 0
17006 fi
17007 EOF
17008           # #^@&!^@ Cygwin.
17009           if test -n "$remotehost"; then
17010             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/1/loggit"
17011           else
17012             chmod +x ${TESTDIR}/1/loggit
17013           fi
17014           echo "ALL ${TESTDIR}/1/loggit" >taginfo
17015           dotest taginfo-2 "${testcvs} -q ci -m check-in-taginfo" \
17016 "Checking in taginfo;
17017 ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
17018 new revision: 1\.2; previous revision: 1\.1
17019 done
17020 ${PROG} commit: Rebuilding administrative file database"
17021           cd ..
17022
17023           # taginfo-3 used to rely on the top-level CVS directory
17024           # being created to add "first-dir" to the repository.  Since
17025           # that won't happen anymore, we create the directory in the
17026           # repository.
17027           mkdir ${CVSROOT_DIRNAME}/first-dir
17028           dotest taginfo-3 "${testcvs} -q co first-dir" ''
17029
17030           cd first-dir
17031           echo first >file1
17032           dotest taginfo-4 "${testcvs} add file1" \
17033 "${PROG} add: scheduling file .file1. for addition
17034 ${PROG} add: use .${PROG} commit. to add this file permanently"
17035           dotest taginfo-5 "${testcvs} -q ci -m add-it" \
17036 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17037 done
17038 Checking in file1;
17039 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17040 initial revision: 1\.1
17041 done"
17042           dotest taginfo-6 "${testcvs} -q tag tag1" "T file1"
17043           dotest taginfo-7 "${testcvs} -q tag -b br" "T file1"
17044           dotest taginfo-8 "${testcvs} -q update -r br" ""
17045           echo add text on branch >>file1
17046           dotest taginfo-9 "${testcvs} -q ci -m modify-on-br" \
17047 "Checking in file1;
17048 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17049 new revision: 1\.1\.2\.1; previous revision: 1\.1
17050 done"
17051           dotest taginfo-10 "${testcvs} -q tag -F -c brtag" "T file1"
17052
17053           dotest_fail taginfo-11 "${testcvs} -q tag rejectme" \
17054 "${PROG} tag: Pre-tag check failed
17055 ${PROG} \[tag aborted\]: correct the above errors first!"
17056
17057           # When we are using taginfo to allow/disallow, it would be
17058           # convenient to be able to use "cvs -n tag" to test whether
17059           # the allow/disallow functionality is working as expected.
17060           dotest taginfo-12 "${testcvs} -nq tag rejectme" "T file1"
17061
17062           # But when taginfo is used for logging, it is a pain for -n
17063           # to call taginfo, since taginfo doesn't know whether -n was
17064           # specified or not.
17065           dotest taginfo-13 "${testcvs} -nq tag would-be-tag" "T file1"
17066
17067           # Deleting: the cases are basically either the tag existed,
17068           # or it didn't exist.
17069           dotest taginfo-14 "${testcvs} -q tag -d tag1" "D file1"
17070           dotest taginfo-15 "${testcvs} -q tag -d tag1" ""
17071
17072           # Likewise with rtag.
17073           dotest taginfo-16 "${testcvs} -q rtag tag1 first-dir" ""
17074           dotest taginfo-17 "${testcvs} -q rtag -d tag1 first-dir" ""
17075           dotest taginfo-18 "${testcvs} -q rtag -d tag1 first-dir" ""
17076
17077           # The "br" example should be passing 1.1.2 or 1.1.0.2.
17078           # But it turns out that is very hard to implement, since
17079           # check_fileproc doesn't know what branch number it will
17080           # get.  Probably the whole thing should be re-architected
17081           # so that taginfo only allows/denies tagging, and a new
17082           # hook, which is done from tag_fileproc, does logging.
17083           # That would solve this, some more subtle races, and also
17084           # the fact that it is nice for users to run "-n tag foo" to
17085           # see whether a tag would be allowed.  Failing that,
17086           # I suppose passing "1.1.branch" or "branch" for "br"
17087           # would be an improvement.
17088           dotest taginfo-examine "cat ${TESTDIR}/1/taglog" \
17089 "tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
17090 br add ${CVSROOT_DIRNAME}/first-dir file1 1.1
17091 brtag mov ${CVSROOT_DIRNAME}/first-dir file1 1.1.2.1
17092 tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
17093 tag1 del ${CVSROOT_DIRNAME}/first-dir
17094 tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
17095 tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
17096 tag1 del ${CVSROOT_DIRNAME}/first-dir"
17097
17098           cd ..
17099           cd CVSROOT
17100           echo '# Keep life simple' > taginfo
17101           dotest taginfo-cleanup-1 "${testcvs} -q ci -m check-in-taginfo" \
17102 "Checking in taginfo;
17103 ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
17104 new revision: 1\.3; previous revision: 1\.2
17105 done
17106 ${PROG} commit: Rebuilding administrative file database"
17107           cd ..
17108           cd ..
17109           rm -r 1
17110           rm -rf ${CVSROOT_DIRNAME}/first-dir
17111           ;;
17112
17113         config)
17114           # Tests of the CVSROOT/config file.  See the comment at the
17115           # "info" tests for a full list of administrative file tests.
17116
17117           # On Windows, we can't check out CVSROOT, because the case
17118           # insensitivity means that this conflicts with cvsroot.
17119           mkdir wnt
17120           cd wnt
17121
17122           dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
17123           cd CVSROOT
17124           echo 'bogus line' >config
17125           # We can't rely on specific revisions, since other tests
17126           # might need to modify CVSROOT/config
17127           dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
17128 "Checking in config;
17129 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
17130 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
17131 done
17132 ${PROG} commit: Rebuilding administrative file database"
17133           echo 'BogusOption=yes' >config
17134           dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
17135 "${PROG} [a-z]*: syntax error in ${CVSROOT_DIRNAME}/CVSROOT/config: line 'bogus line' is missing '='
17136 Checking in config;
17137 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
17138 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
17139 done
17140 ${PROG} commit: Rebuilding administrative file database"
17141           echo '# No config is a good config' > config
17142           dotest config-5 "${testcvs} -q ci -m change-to-comment" \
17143 "${PROG} [a-z]*: ${CVSROOT_DIRNAME}/CVSROOT/config: unrecognized keyword 'BogusOption'
17144 Checking in config;
17145 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
17146 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
17147 done
17148 ${PROG} commit: Rebuilding administrative file database"
17149           dotest config-6 "${testcvs} -q update" ''
17150
17151           cd ..
17152           rm -r CVSROOT
17153           cd ..
17154           rm -r wnt
17155           ;;
17156
17157         serverpatch)
17158           # Test remote CVS handling of unpatchable files.  This isn't
17159           # much of a test for local CVS.
17160           # We test this with some keyword expansion games, but the situation
17161           # also arises if the user modifies the file while CVS is running.
17162           mkdir ${CVSROOT_DIRNAME}/first-dir
17163           mkdir 1
17164           cd 1
17165           dotest serverpatch-1 "${testcvs} -q co first-dir" ''
17166
17167           cd first-dir
17168
17169           # Add a file with an RCS keyword.
17170           echo '$''Name$' > file1
17171           echo '1' >> file1
17172           dotest serverpatch-2 "${testcvs} add file1" \
17173 "${PROG}"' add: scheduling file `file1'\'' for addition
17174 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
17175
17176           dotest serverpatch-3 "${testcvs} -q commit -m add" \
17177 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17178 done
17179 Checking in file1;
17180 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17181 initial revision: 1\.1
17182 done"
17183
17184           # Tag the file.
17185           dotest serverpatch-4 "${testcvs} -q tag tag file1" 'T file1'
17186
17187           # Check out a tagged copy of the file.
17188           cd ../..
17189           mkdir 2
17190           cd 2
17191           dotest serverpatch-5 "${testcvs} -q co -r tag first-dir" \
17192 'U first-dir/file1'
17193
17194           # Remove the tag.  This will leave the tag string in the
17195           # expansion of the Name keyword.
17196           dotest serverpatch-6 "${testcvs} -q update -A first-dir" ''
17197
17198           # Modify and check in the first copy.
17199           cd ../1/first-dir
17200           echo '2' >> file1
17201           dotest serverpatch-7 "${testcvs} -q ci -mx file1" \
17202 "Checking in file1;
17203 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17204 new revision: 1\.2; previous revision: 1\.1
17205 done"
17206
17207           # Now update the second copy.  When using remote CVS, the
17208           # patch will fail, forcing the file to be refetched.
17209           cd ../../2/first-dir
17210           dotest serverpatch-8 "${testcvs} -q update" \
17211 'U file1' \
17212 "P file1
17213 ${PROG} update: checksum failure after patch to \./file1; will refetch
17214 ${PROG} client: refetching unpatchable files
17215 ${PROG} update: warning: file1 was lost
17216 U file1"
17217
17218           cd ../..
17219           rm -r 1 2
17220           rm -rf ${CVSROOT_DIRNAME}/first-dir
17221           ;;
17222
17223         log)
17224           # Test selecting revisions with cvs log.
17225           # See also log2 tests for more tests.
17226           # See also branches-14.3 for logging with a branch off of a branch.
17227           # See also multibranch-14 for logging with several branches off the
17228           #   same branchpoint.
17229           # Tests of each option to cvs log:
17230           #   -h: admin-19a-log
17231           #   -N: log, log2, admin-19a-log
17232           #   -b, -r: log
17233           #   -d: logopt, rcs
17234           #   -s: logopt, rcs3
17235           #   -R: logopt, rcs3
17236           #   -w, -t: not tested yet (TODO)
17237
17238           # Check in a file with a few revisions and branches.
17239           mkdir ${CVSROOT_DIRNAME}/first-dir
17240           dotest log-1 "${testcvs} -q co first-dir" ''
17241           cd first-dir
17242           echo 'first revision' > file1
17243           echo 'first revision' > file2
17244           dotest log-2 "${testcvs} add file1 file2" \
17245 "${PROG} add: scheduling file .file1. for addition
17246 ${PROG} add: scheduling file .file2. for addition
17247 ${PROG} add: use .${PROG} commit. to add these files permanently"
17248
17249           # While we're at it, check multi-line comments, input from file,
17250           # and trailing whitespace trimming
17251           echo 'line 1     '     >${TESTDIR}/comment.tmp
17252           echo '     '          >>${TESTDIR}/comment.tmp
17253           echo 'line 2  '       >>${TESTDIR}/comment.tmp
17254           echo '        '       >>${TESTDIR}/comment.tmp
17255           echo '          '     >>${TESTDIR}/comment.tmp
17256           dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
17257 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17258 done
17259 Checking in file1;
17260 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17261 initial revision: 1\.1
17262 done
17263 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
17264 done
17265 Checking in file2;
17266 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
17267 initial revision: 1\.1
17268 done"
17269           rm -f ${TESTDIR}/comment.tmp
17270
17271           echo 'second revision' > file1
17272           echo 'second revision' > file2
17273           dotest log-4 "${testcvs} -q ci -m2 file1 file2" \
17274 "Checking in file1;
17275 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17276 new revision: 1\.2; previous revision: 1\.1
17277 done
17278 Checking in file2;
17279 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
17280 new revision: 1\.2; previous revision: 1\.1
17281 done"
17282
17283           dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
17284           dotest log-5a "${testcvs} -q tag tag1 file2" 'T file2'
17285
17286           echo 'third revision' > file1
17287           echo 'third revision' > file2
17288           dotest log-6 "${testcvs} -q ci -m3 file1 file2" \
17289 "Checking in file1;
17290 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17291 new revision: 1\.3; previous revision: 1\.2
17292 done
17293 Checking in file2;
17294 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
17295 new revision: 1\.3; previous revision: 1\.2
17296 done"
17297
17298           dotest log-6a "${testcvs} -q tag tag2 file2" 'T file2'
17299
17300           dotest log-7 "${testcvs} -q update -r branch" \
17301 "[UP] file1
17302 ${PROG} update: file2 is no longer in the repository"
17303
17304           echo 'first branch revision' > file1
17305           dotest log-8 "${testcvs} -q ci -m1b file1" \
17306 "Checking in file1;
17307 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17308 new revision: 1\.2\.2\.1; previous revision: 1\.2
17309 done"
17310
17311           dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
17312
17313           echo 'second branch revision' > file1
17314           dotest log-10 "${testcvs} -q ci -m2b file1" \
17315 "Checking in file1;
17316 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17317 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
17318 done"
17319
17320           # Set up a bunch of shell variables to make the later tests
17321           # easier to describe.=
17322           log_header1="
17323 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17324 Working file: file1
17325 head: 1\.3
17326 branch:
17327 locks: strict
17328 access list:"
17329           rlog_header1="
17330 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17331 head: 1\.3
17332 branch:
17333 locks: strict
17334 access list:"
17335           log_tags1='symbolic names:
17336         tag: 1\.2\.2\.1
17337         branch: 1\.2\.0\.2'
17338           log_keyword='keyword substitution: kv'
17339           log_dash='----------------------------
17340 revision'
17341           log_date="date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;"
17342           log_lines="  lines: ${PLUS}1 -1"
17343           log_rev1="${log_dash} 1\.1
17344 ${log_date}
17345 line 1
17346
17347 line 2"
17348           log_rev2="${log_dash} 1\.2
17349 ${log_date}${log_lines}
17350 branches:  1\.2\.2;
17351 2"
17352           log_rev3="${log_dash} 1\.3
17353 ${log_date}${log_lines}
17354 3"
17355           log_rev1b="${log_dash} 1\.2\.2\.1
17356 ${log_date}${log_lines}
17357 1b"
17358           log_rev2b="${log_dash} 1\.2\.2\.2
17359 ${log_date}${log_lines}
17360 2b"
17361           log_trailer='============================================================================='
17362
17363           # Now, finally, test the log output.
17364
17365           dotest log-11 "${testcvs} log file1" \
17366 "${log_header1}
17367 ${log_tags1}
17368 ${log_keyword}
17369 total revisions: 5;     selected revisions: 5
17370 description:
17371 ${log_rev3}
17372 ${log_rev2}
17373 ${log_rev1}
17374 ${log_rev2b}
17375 ${log_rev1b}
17376 ${log_trailer}"
17377
17378           dotest log-12 "${testcvs} log -N file1" \
17379 "${log_header1}
17380 ${log_keyword}
17381 total revisions: 5;     selected revisions: 5
17382 description:
17383 ${log_rev3}
17384 ${log_rev2}
17385 ${log_rev1}
17386 ${log_rev2b}
17387 ${log_rev1b}
17388 ${log_trailer}"
17389
17390           dotest log-13 "${testcvs} log -b file1" \
17391 "${log_header1}
17392 ${log_tags1}
17393 ${log_keyword}
17394 total revisions: 5;     selected revisions: 3
17395 description:
17396 ${log_rev3}
17397 ${log_rev2}
17398 ${log_rev1}
17399 ${log_trailer}"
17400
17401           dotest log-14 "${testcvs} log -r file1" \
17402 "${log_header1}
17403 ${log_tags1}
17404 ${log_keyword}
17405 total revisions: 5;     selected revisions: 1
17406 description:
17407 ${log_rev3}
17408 ${log_trailer}"
17409
17410           dotest log-14a "${testcvs} log -rHEAD file1" \
17411 "${log_header1}
17412 ${log_tags1}
17413 ${log_keyword}
17414 total revisions: 5;     selected revisions: 1
17415 description:
17416 ${log_rev3}
17417 ${log_trailer}"
17418
17419           # The user might not realize that "-r" must not take a space.
17420           # In the error message, HEAD is a file name, not a tag name (which
17421           # might be confusing itself).
17422           dotest_fail log-14b "${testcvs} log -r HEAD file1" \
17423 "${PROG} log: nothing known about HEAD
17424 ${log_header1}
17425 ${log_tags1}
17426 ${log_keyword}
17427 total revisions: 5;     selected revisions: 1
17428 description:
17429 ${log_rev3}
17430 ${log_trailer}"
17431
17432 #         Check that unusual syntax works correctly.
17433
17434           dotest log-14c "${testcvs} log -r: file1" \
17435 "${log_header1}
17436 ${log_tags1}
17437 ${log_keyword}
17438 total revisions: 5;     selected revisions: 1
17439 description:
17440 ${log_rev3}
17441 ${log_trailer}"
17442           dotest log-14d "${testcvs} log -r, file1" \
17443 "${log_header1}
17444 ${log_tags1}
17445 ${log_keyword}
17446 total revisions: 5;     selected revisions: 1
17447 description:
17448 ${log_rev3}
17449 ${log_trailer}"
17450           dotest log-14e "${testcvs} log -r. file1" \
17451 "${log_header1}
17452 ${log_tags1}
17453 ${log_keyword}
17454 total revisions: 5;     selected revisions: 1
17455 description:
17456 ${log_rev3}
17457 ${log_trailer}"
17458           dotest log-14f "${testcvs} log -r:: file1" \
17459 "${log_header1}
17460 ${log_tags1}
17461 ${log_keyword}
17462 total revisions: 5;     selected revisions: 0
17463 description:
17464 ${log_trailer}"
17465
17466           dotest log-15 "${testcvs} log -r1.2 file1" \
17467 "${log_header1}
17468 ${log_tags1}
17469 ${log_keyword}
17470 total revisions: 5;     selected revisions: 1
17471 description:
17472 ${log_rev2}
17473 ${log_trailer}"
17474
17475           dotest log-16 "${testcvs} log -r1.2.2 file1" \
17476 "${log_header1}
17477 ${log_tags1}
17478 ${log_keyword}
17479 total revisions: 5;     selected revisions: 2
17480 description:
17481 ${log_rev2b}
17482 ${log_rev1b}
17483 ${log_trailer}"
17484
17485           # This test would fail with the old invocation of rlog, but it
17486           # works with the builtin log support.
17487           dotest log-17 "${testcvs} log -rbranch file1" \
17488 "${log_header1}
17489 ${log_tags1}
17490 ${log_keyword}
17491 total revisions: 5;     selected revisions: 2
17492 description:
17493 ${log_rev2b}
17494 ${log_rev1b}
17495 ${log_trailer}"
17496
17497           dotest log-18 "${testcvs} log -r1.2.2. file1" \
17498 "${log_header1}
17499 ${log_tags1}
17500 ${log_keyword}
17501 total revisions: 5;     selected revisions: 1
17502 description:
17503 ${log_rev2b}
17504 ${log_trailer}"
17505
17506           # Multiple -r options are undocumented; see comments in
17507           # cvs.texinfo about whether they should be deprecated.
17508           dotest log-18a "${testcvs} log -r1.2.2.2 -r1.3:1.3 file1" \
17509 "${log_header1}
17510 ${log_tags1}
17511 ${log_keyword}
17512 total revisions: 5;     selected revisions: 2
17513 description:
17514 ${log_rev3}
17515 ${log_rev2b}
17516 ${log_trailer}"
17517
17518           # This test would fail with the old invocation of rlog, but it
17519           # works with the builtin log support.
17520           dotest log-19 "${testcvs} log -rbranch. file1" \
17521 "${log_header1}
17522 ${log_tags1}
17523 ${log_keyword}
17524 total revisions: 5;     selected revisions: 1
17525 description:
17526 ${log_rev2b}
17527 ${log_trailer}"
17528
17529           dotest log-20 "${testcvs} log -r1.2: file1" \
17530 "${log_header1}
17531 ${log_tags1}
17532 ${log_keyword}
17533 total revisions: 5;     selected revisions: 2
17534 description:
17535 ${log_rev3}
17536 ${log_rev2}
17537 ${log_trailer}"
17538
17539           dotest log-20a "${testcvs} log -r1.2:: file1" \
17540 "${log_header1}
17541 ${log_tags1}
17542 ${log_keyword}
17543 total revisions: 5;     selected revisions: 1
17544 description:
17545 ${log_rev3}
17546 ${log_trailer}"
17547
17548           dotest log-21 "${testcvs} log -r:1.2 file1" \
17549 "${log_header1}
17550 ${log_tags1}
17551 ${log_keyword}
17552 total revisions: 5;     selected revisions: 2
17553 description:
17554 ${log_rev2}
17555 ${log_rev1}
17556 ${log_trailer}"
17557
17558           dotest log-21a "${testcvs} log -r::1.2 file1" \
17559 "${log_header1}
17560 ${log_tags1}
17561 ${log_keyword}
17562 total revisions: 5;     selected revisions: 2
17563 description:
17564 ${log_rev2}
17565 ${log_rev1}
17566 ${log_trailer}"
17567
17568           dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
17569 "${log_header1}
17570 ${log_tags1}
17571 ${log_keyword}
17572 total revisions: 5;     selected revisions: 2
17573 description:
17574 ${log_rev2}
17575 ${log_rev1}
17576 ${log_trailer}"
17577
17578           dotest log-22a "${testcvs} log -r1.1::1.2 file1" \
17579 "${log_header1}
17580 ${log_tags1}
17581 ${log_keyword}
17582 total revisions: 5;     selected revisions: 1
17583 description:
17584 ${log_rev2}
17585 ${log_trailer}"
17586
17587           dotest log-22b "${testcvs} log -r1.1::1.3 file1" \
17588 "${log_header1}
17589 ${log_tags1}
17590 ${log_keyword}
17591 total revisions: 5;     selected revisions: 2
17592 description:
17593 ${log_rev3}
17594 ${log_rev2}
17595 ${log_trailer}"
17596
17597           # Now the same tests but with rlog
17598
17599           dotest log-r11 "${testcvs} rlog first-dir/file1" \
17600 "${rlog_header1}
17601 ${log_tags1}
17602 ${log_keyword}
17603 total revisions: 5;     selected revisions: 5
17604 description:
17605 ${log_rev3}
17606 ${log_rev2}
17607 ${log_rev1}
17608 ${log_rev2b}
17609 ${log_rev1b}
17610 ${log_trailer}"
17611
17612           dotest log-r12 "${testcvs} rlog -N first-dir/file1" \
17613 "${rlog_header1}
17614 ${log_keyword}
17615 total revisions: 5;     selected revisions: 5
17616 description:
17617 ${log_rev3}
17618 ${log_rev2}
17619 ${log_rev1}
17620 ${log_rev2b}
17621 ${log_rev1b}
17622 ${log_trailer}"
17623
17624           dotest log-r13 "${testcvs} rlog -b first-dir/file1" \
17625 "${rlog_header1}
17626 ${log_tags1}
17627 ${log_keyword}
17628 total revisions: 5;     selected revisions: 3
17629 description:
17630 ${log_rev3}
17631 ${log_rev2}
17632 ${log_rev1}
17633 ${log_trailer}"
17634
17635           dotest log-r14 "${testcvs} rlog -r first-dir/file1" \
17636 "${rlog_header1}
17637 ${log_tags1}
17638 ${log_keyword}
17639 total revisions: 5;     selected revisions: 1
17640 description:
17641 ${log_rev3}
17642 ${log_trailer}"
17643
17644           dotest log-r14a "${testcvs} rlog -rHEAD first-dir/file1" \
17645 "${rlog_header1}
17646 ${log_tags1}
17647 ${log_keyword}
17648 total revisions: 5;     selected revisions: 1
17649 description:
17650 ${log_rev3}
17651 ${log_trailer}"
17652
17653           dotest_fail log-r14b "${testcvs} rlog -r HEAD first-dir/file1" \
17654 "${PROG} rlog: cannot find module .HEAD. - ignored
17655 ${rlog_header1}
17656 ${log_tags1}
17657 ${log_keyword}
17658 total revisions: 5;     selected revisions: 1
17659 description:
17660 ${log_rev3}
17661 ${log_trailer}"
17662
17663           dotest log-r14c "${testcvs} rlog -r: first-dir/file1" \
17664 "${rlog_header1}
17665 ${log_tags1}
17666 ${log_keyword}
17667 total revisions: 5;     selected revisions: 1
17668 description:
17669 ${log_rev3}
17670 ${log_trailer}"
17671           dotest log-r14d "${testcvs} rlog -r, first-dir/file1" \
17672 "${rlog_header1}
17673 ${log_tags1}
17674 ${log_keyword}
17675 total revisions: 5;     selected revisions: 1
17676 description:
17677 ${log_rev3}
17678 ${log_trailer}"
17679           dotest log-r14e "${testcvs} rlog -r. first-dir/file1" \
17680 "${rlog_header1}
17681 ${log_tags1}
17682 ${log_keyword}
17683 total revisions: 5;     selected revisions: 1
17684 description:
17685 ${log_rev3}
17686 ${log_trailer}"
17687           dotest log-r14f "${testcvs} rlog -r:: first-dir/file1" \
17688 "${rlog_header1}
17689 ${log_tags1}
17690 ${log_keyword}
17691 total revisions: 5;     selected revisions: 0
17692 description:
17693 ${log_trailer}"
17694
17695           dotest log-r15 "${testcvs} rlog -r1.2 first-dir/file1" \
17696 "${rlog_header1}
17697 ${log_tags1}
17698 ${log_keyword}
17699 total revisions: 5;     selected revisions: 1
17700 description:
17701 ${log_rev2}
17702 ${log_trailer}"
17703
17704           dotest log-r16 "${testcvs} rlog -r1.2.2 first-dir/file1" \
17705 "${rlog_header1}
17706 ${log_tags1}
17707 ${log_keyword}
17708 total revisions: 5;     selected revisions: 2
17709 description:
17710 ${log_rev2b}
17711 ${log_rev1b}
17712 ${log_trailer}"
17713
17714           dotest log-r17 "${testcvs} rlog -rbranch first-dir/file1" \
17715 "${rlog_header1}
17716 ${log_tags1}
17717 ${log_keyword}
17718 total revisions: 5;     selected revisions: 2
17719 description:
17720 ${log_rev2b}
17721 ${log_rev1b}
17722 ${log_trailer}"
17723
17724           dotest log-r18 "${testcvs} rlog -r1.2.2. first-dir/file1" \
17725 "${rlog_header1}
17726 ${log_tags1}
17727 ${log_keyword}
17728 total revisions: 5;     selected revisions: 1
17729 description:
17730 ${log_rev2b}
17731 ${log_trailer}"
17732
17733           dotest log-r18a "${testcvs} rlog -r1.2.2.2 -r1.3:1.3 first-dir/file1" \
17734 "${rlog_header1}
17735 ${log_tags1}
17736 ${log_keyword}
17737 total revisions: 5;     selected revisions: 2
17738 description:
17739 ${log_rev3}
17740 ${log_rev2b}
17741 ${log_trailer}"
17742
17743           dotest log-r19 "${testcvs} rlog -rbranch. first-dir/file1" \
17744 "${rlog_header1}
17745 ${log_tags1}
17746 ${log_keyword}
17747 total revisions: 5;     selected revisions: 1
17748 description:
17749 ${log_rev2b}
17750 ${log_trailer}"
17751
17752           dotest log-r20 "${testcvs} rlog -r1.2: first-dir/file1" \
17753 "${rlog_header1}
17754 ${log_tags1}
17755 ${log_keyword}
17756 total revisions: 5;     selected revisions: 2
17757 description:
17758 ${log_rev3}
17759 ${log_rev2}
17760 ${log_trailer}"
17761
17762           dotest log-r20a "${testcvs} rlog -r1.2:: first-dir/file1" \
17763 "${rlog_header1}
17764 ${log_tags1}
17765 ${log_keyword}
17766 total revisions: 5;     selected revisions: 1
17767 description:
17768 ${log_rev3}
17769 ${log_trailer}"
17770
17771           dotest log-r21 "${testcvs} rlog -r:1.2 first-dir/file1" \
17772 "${rlog_header1}
17773 ${log_tags1}
17774 ${log_keyword}
17775 total revisions: 5;     selected revisions: 2
17776 description:
17777 ${log_rev2}
17778 ${log_rev1}
17779 ${log_trailer}"
17780
17781           dotest log-r21a "${testcvs} rlog -r::1.2 first-dir/file1" \
17782 "${rlog_header1}
17783 ${log_tags1}
17784 ${log_keyword}
17785 total revisions: 5;     selected revisions: 2
17786 description:
17787 ${log_rev2}
17788 ${log_rev1}
17789 ${log_trailer}"
17790
17791           dotest log-r22 "${testcvs} rlog -r1.1:1.2 first-dir/file1" \
17792 "${rlog_header1}
17793 ${log_tags1}
17794 ${log_keyword}
17795 total revisions: 5;     selected revisions: 2
17796 description:
17797 ${log_rev2}
17798 ${log_rev1}
17799 ${log_trailer}"
17800
17801           dotest log-r22a "${testcvs} rlog -r1.1::1.2 first-dir/file1" \
17802 "${rlog_header1}
17803 ${log_tags1}
17804 ${log_keyword}
17805 total revisions: 5;     selected revisions: 1
17806 description:
17807 ${log_rev2}
17808 ${log_trailer}"
17809
17810           dotest log-r22b "${testcvs} rlog -r1.1::1.3 first-dir/file1" \
17811 "${rlog_header1}
17812 ${log_tags1}
17813 ${log_keyword}
17814 total revisions: 5;     selected revisions: 2
17815 description:
17816 ${log_rev3}
17817 ${log_rev2}
17818 ${log_trailer}"
17819
17820           # Test when head is dead
17821
17822           dotest log-d0 "${testcvs} -q up -A" \
17823 "[UP] file1
17824 U file2"
17825           dotest log-d1 "${testcvs} -q rm -f file1" \
17826 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
17827           dotest log-d2 "${testcvs} -q ci -m4" \
17828 "Removing file1;
17829 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17830 new revision: delete; previous revision: 1\.3
17831 done"
17832
17833           log_header1="
17834 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
17835 Working file: file1
17836 head: 1\.4
17837 branch:
17838 locks: strict
17839 access list:"
17840           rlog_header1="
17841 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
17842 head: 1\.4
17843 branch:
17844 locks: strict
17845 access list:"
17846           log_header2="
17847 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
17848 Working file: file2
17849 head: 1\.3
17850 branch:
17851 locks: strict
17852 access list:"
17853           rlog_header2="
17854 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
17855 head: 1\.3
17856 branch:
17857 locks: strict
17858 access list:"
17859           log_tags2='symbolic names:
17860         tag2: 1\.3
17861         tag1: 1\.2'
17862           log_rev4="${log_dash} 1\.4
17863 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
17864 4"
17865           log_rev22="${log_dash} 1\.2
17866 ${log_date}${log_lines}
17867 2"
17868
17869           dotest log-d3 "${testcvs} log -rbranch file1" \
17870 "${log_header1}
17871 ${log_tags1}
17872 ${log_keyword}
17873 total revisions: 6;     selected revisions: 2
17874 description:
17875 ${log_rev2b}
17876 ${log_rev1b}
17877 ${log_trailer}"
17878           dotest log-rd3 "${testcvs} rlog -rbranch first-dir/file1" \
17879 "${rlog_header1}
17880 ${log_tags1}
17881 ${log_keyword}
17882 total revisions: 6;     selected revisions: 2
17883 description:
17884 ${log_rev2b}
17885 ${log_rev1b}
17886 ${log_trailer}"
17887           dotest log-d4 "${testcvs} -q log -rbranch" \
17888 "${log_header1}
17889 ${log_tags1}
17890 ${log_keyword}
17891 total revisions: 6;     selected revisions: 2
17892 description:
17893 ${log_rev2b}
17894 ${log_rev1b}
17895 ${log_trailer}
17896 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17897 ${log_header2}
17898 ${log_tags2}
17899 ${log_keyword}
17900 total revisions: 3;     selected revisions: 0
17901 description:
17902 ${log_trailer}"
17903           dotest log-d4a "${testcvs} -q log -t -rbranch" \
17904 "${log_header1}
17905 ${log_tags1}
17906 ${log_keyword}
17907 total revisions: 6
17908 description:
17909 ${log_trailer}
17910 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17911 ${log_header2}
17912 ${log_tags2}
17913 ${log_keyword}
17914 total revisions: 3
17915 description:
17916 ${log_trailer}"
17917           dotest log-d4b "${testcvs} -q log -tS -rbranch" \
17918 "${log_header1}
17919 ${log_tags1}
17920 ${log_keyword}
17921 total revisions: 6;     selected revisions: 2
17922 description:
17923 ${log_trailer}
17924 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
17925           dotest log-d4c "${testcvs} -q log -h -rbranch" \
17926 "${log_header1}
17927 ${log_tags1}
17928 ${log_keyword}
17929 total revisions: 6
17930 ${log_trailer}
17931 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17932 ${log_header2}
17933 ${log_tags2}
17934 ${log_keyword}
17935 total revisions: 3
17936 ${log_trailer}"
17937           dotest log-d4d "${testcvs} -q log -hS -rbranch" \
17938 "${log_header1}
17939 ${log_tags1}
17940 ${log_keyword}
17941 total revisions: 6;     selected revisions: 2
17942 ${log_trailer}
17943 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
17944           dotest log-d4e "${testcvs} -q log -R -rbranch" \
17945 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
17946 ${CVSROOT_DIRNAME}/first-dir/file2,v"
17947           dotest log-d4f "${testcvs} -q log -R -S -rbranch" \
17948 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
17949 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
17950           dotest log-rd4 "${testcvs} -q rlog -rbranch first-dir" \
17951 "${rlog_header1}
17952 ${log_tags1}
17953 ${log_keyword}
17954 total revisions: 6;     selected revisions: 2
17955 description:
17956 ${log_rev2b}
17957 ${log_rev1b}
17958 ${log_trailer}
17959 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17960 ${rlog_header2}
17961 ${log_tags2}
17962 ${log_keyword}
17963 total revisions: 3;     selected revisions: 0
17964 description:
17965 ${log_trailer}"
17966           dotest log-rd4a "${testcvs} -q rlog -t -rbranch first-dir" \
17967 "${rlog_header1}
17968 ${log_tags1}
17969 ${log_keyword}
17970 total revisions: 6
17971 description:
17972 ${log_trailer}
17973 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17974 ${rlog_header2}
17975 ${log_tags2}
17976 ${log_keyword}
17977 total revisions: 3
17978 description:
17979 ${log_trailer}"
17980           dotest log-rd4b "${testcvs} -q rlog -St -rbranch first-dir" \
17981 "${rlog_header1}
17982 ${log_tags1}
17983 ${log_keyword}
17984 total revisions: 6;     selected revisions: 2
17985 description:
17986 ${log_trailer}
17987 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
17988           dotest log-rd4c "${testcvs} -q rlog -h -rbranch first-dir" \
17989 "${rlog_header1}
17990 ${log_tags1}
17991 ${log_keyword}
17992 total revisions: 6
17993 ${log_trailer}
17994 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
17995 ${rlog_header2}
17996 ${log_tags2}
17997 ${log_keyword}
17998 total revisions: 3
17999 ${log_trailer}"
18000           dotest log-rd4d "${testcvs} -q rlog -Sh -rbranch first-dir" \
18001 "${rlog_header1}
18002 ${log_tags1}
18003 ${log_keyword}
18004 total revisions: 6;     selected revisions: 2
18005 ${log_trailer}
18006 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
18007           dotest log-rd4e "${testcvs} -q rlog -R -rbranch first-dir" \
18008 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
18009 ${CVSROOT_DIRNAME}/first-dir/file2,v"
18010           dotest log-rd4f "${testcvs} -q rlog -R -S -rbranch first-dir" \
18011 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
18012 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
18013           dotest log-d5 "${testcvs} log -r1.2.2.1:1.2.2.2 file1" \
18014 "${log_header1}
18015 ${log_tags1}
18016 ${log_keyword}
18017 total revisions: 6;     selected revisions: 2
18018 description:
18019 ${log_rev2b}
18020 ${log_rev1b}
18021 ${log_trailer}"
18022           dotest log-rd5 "${testcvs} rlog -r1.2.2.1:1.2.2.2 first-dir/file1" \
18023 "${rlog_header1}
18024 ${log_tags1}
18025 ${log_keyword}
18026 total revisions: 6;     selected revisions: 2
18027 description:
18028 ${log_rev2b}
18029 ${log_rev1b}
18030 ${log_trailer}"
18031           dotest log-d6 "${testcvs} -q log -r1.2.2.1:1.2.2.2" \
18032 "${log_header1}
18033 ${log_tags1}
18034 ${log_keyword}
18035 total revisions: 6;     selected revisions: 2
18036 description:
18037 ${log_rev2b}
18038 ${log_rev1b}
18039 ${log_trailer}
18040 ${log_header2}
18041 ${log_tags2}
18042 ${log_keyword}
18043 total revisions: 3;     selected revisions: 0
18044 description:
18045 ${log_trailer}"
18046           dotest log-rd6 "${testcvs} -q rlog -r1.2.2.1:1.2.2.2 first-dir" \
18047 "${rlog_header1}
18048 ${log_tags1}
18049 ${log_keyword}
18050 total revisions: 6;     selected revisions: 2
18051 description:
18052 ${log_rev2b}
18053 ${log_rev1b}
18054 ${log_trailer}
18055 ${rlog_header2}
18056 ${log_tags2}
18057 ${log_keyword}
18058 total revisions: 3;     selected revisions: 0
18059 description:
18060 ${log_trailer}"
18061           dotest log-d7 "${testcvs} log -r1.2:1.3 file1" \
18062 "${log_header1}
18063 ${log_tags1}
18064 ${log_keyword}
18065 total revisions: 6;     selected revisions: 2
18066 description:
18067 ${log_rev3}
18068 ${log_rev2}
18069 ${log_trailer}"
18070           dotest log-rd7 "${testcvs} -q rlog -r1.2:1.3 first-dir/file1" \
18071 "${rlog_header1}
18072 ${log_tags1}
18073 ${log_keyword}
18074 total revisions: 6;     selected revisions: 2
18075 description:
18076 ${log_rev3}
18077 ${log_rev2}
18078 ${log_trailer}"
18079           dotest log-d8 "${testcvs} -q log -rtag1:tag2" \
18080 "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18081 ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18082 ${log_header1}
18083 ${log_tags1}
18084 ${log_keyword}
18085 total revisions: 6;     selected revisions: 0
18086 description:
18087 ${log_trailer}
18088 ${log_header2}
18089 ${log_tags2}
18090 ${log_keyword}
18091 total revisions: 3;     selected revisions: 2
18092 description:
18093 ${log_rev3}
18094 ${log_rev22}
18095 ${log_trailer}"
18096           dotest log-d8a "${testcvs} -q log -rtag1:tag2 -S" \
18097 "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18098 ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18099 ${log_header2}
18100 ${log_tags2}
18101 ${log_keyword}
18102 total revisions: 3;     selected revisions: 2
18103 description:
18104 ${log_rev3}
18105 ${log_rev22}
18106 ${log_trailer}"
18107           dotest log-rd8 "${testcvs} -q rlog -rtag1:tag2 first-dir" \
18108 "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18109 ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18110 ${rlog_header1}
18111 ${log_tags1}
18112 ${log_keyword}
18113 total revisions: 6;     selected revisions: 0
18114 description:
18115 ${log_trailer}
18116 ${rlog_header2}
18117 ${log_tags2}
18118 ${log_keyword}
18119 total revisions: 3;     selected revisions: 2
18120 description:
18121 ${log_rev3}
18122 ${log_rev22}
18123 ${log_trailer}"
18124           dotest log-rd8a "${testcvs} -q rlog -rtag1:tag2 -S first-dir" \
18125 "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18126 ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
18127 ${rlog_header2}
18128 ${log_tags2}
18129 ${log_keyword}
18130 total revisions: 3;     selected revisions: 2
18131 description:
18132 ${log_rev3}
18133 ${log_rev22}
18134 ${log_trailer}"
18135
18136           dotest log-d99 "${testcvs} -q up -rbranch" \
18137 "[UP] file1
18138 ${PROG} update: file2 is no longer in the repository"
18139
18140           # Now test outdating revisions
18141
18142           dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
18143 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
18144 done"
18145           dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
18146 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
18147 done"
18148           dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
18149 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
18150 deleting revision 1\.2\.2\.2
18151 done"
18152           dotest log-o3 "${testcvs} log file1" \
18153 "${log_header1}
18154 ${log_tags1}
18155 ${log_keyword}
18156 total revisions: 5;     selected revisions: 5
18157 description:
18158 ${log_rev4}
18159 ${log_rev3}
18160 ${log_rev2}
18161 ${log_rev1}
18162 ${log_rev1b}
18163 ${log_trailer}"
18164           dotest log-ro3 "${testcvs} rlog first-dir/file1" \
18165 "${rlog_header1}
18166 ${log_tags1}
18167 ${log_keyword}
18168 total revisions: 5;     selected revisions: 5
18169 description:
18170 ${log_rev4}
18171 ${log_rev3}
18172 ${log_rev2}
18173 ${log_rev1}
18174 ${log_rev1b}
18175 ${log_trailer}"
18176           dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
18177 "first branch revision"
18178
18179           cd ..
18180           rm -r first-dir
18181           rm -rf ${CVSROOT_DIRNAME}/first-dir
18182           ;;
18183
18184         log2)
18185           # More "cvs log" tests, for example the file description.
18186
18187           # Check in a file
18188           mkdir ${CVSROOT_DIRNAME}/first-dir
18189           dotest log2-1 "${testcvs} -q co first-dir" ''
18190           cd first-dir
18191           echo 'first revision' > file1
18192           dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
18193 "${PROG}"' add: scheduling file `file1'\'' for addition
18194 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
18195           dotest log2-3 "${testcvs} -q commit -m 1" \
18196 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18197 done
18198 Checking in file1;
18199 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18200 initial revision: 1\.1
18201 done"
18202           # Setting the file description with add -m doesn't yet work
18203           # client/server, so skip log2-4 for remote.
18204           if $remote; then :; else
18205
18206             dotest log2-4 "${testcvs} log -N file1" "
18207 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18208 Working file: file1
18209 head: 1\.1
18210 branch:
18211 locks: strict
18212 access list:
18213 keyword substitution: kv
18214 total revisions: 1;     selected revisions: 1
18215 description:
18216 file1-is-for-testing
18217 ----------------------------
18218 revision 1\.1
18219 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18220 1
18221 ============================================================================="
18222
18223           fi # end of tests skipped for remote
18224
18225           dotest log2-5 "${testcvs} admin -t-change-description file1" \
18226 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18227 done"
18228           dotest log2-6 "${testcvs} log -N file1" "
18229 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18230 Working file: file1
18231 head: 1\.1
18232 branch:
18233 locks: strict
18234 access list:
18235 keyword substitution: kv
18236 total revisions: 1;     selected revisions: 1
18237 description:
18238 change-description
18239 ----------------------------
18240 revision 1\.1
18241 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18242 1
18243 ============================================================================="
18244
18245           echo 'longer description' >${TESTDIR}/descrip
18246           echo 'with two lines' >>${TESTDIR}/descrip
18247           dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
18248 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18249 done"
18250           dotest_fail log2-7a "${testcvs} admin -t${TESTDIR}/nonexist file1" \
18251 "${PROG} \[[a-z]* aborted\]: can't stat ${TESTDIR}/nonexist: No such file or directory"
18252           dotest log2-8 "${testcvs} log -N file1" "
18253 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18254 Working file: file1
18255 head: 1\.1
18256 branch:
18257 locks: strict
18258 access list:
18259 keyword substitution: kv
18260 total revisions: 1;     selected revisions: 1
18261 description:
18262 longer description
18263 with two lines
18264 ----------------------------
18265 revision 1\.1
18266 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18267 1
18268 ============================================================================="
18269
18270           # TODO: `cvs admin -t "my message" file1' is a request to
18271           # read the message from stdin and to operate on two files.
18272           # Should test that there is an error because "my message"
18273           # doesn't exist.
18274
18275           dotest log2-9 "echo change from stdin | ${testcvs} admin -t -q file1" ""
18276           dotest log2-10 "${testcvs} log -N file1" "
18277 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18278 Working file: file1
18279 head: 1\.1
18280 branch:
18281 locks: strict
18282 access list:
18283 keyword substitution: kv
18284 total revisions: 1;     selected revisions: 1
18285 description:
18286 change from stdin
18287 ----------------------------
18288 revision 1\.1
18289 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18290 1
18291 ============================================================================="
18292
18293           cd ..
18294           rm ${TESTDIR}/descrip
18295           rm -r first-dir
18296           rm -rf ${CVSROOT_DIRNAME}/first-dir
18297
18298           ;;
18299
18300         logopt)
18301           # Some tests of log.c's option parsing and such things.
18302           mkdir 1; cd 1
18303           dotest logopt-1 "${testcvs} -q co -l ." ''
18304           mkdir first-dir
18305           dotest logopt-2 "${testcvs} add first-dir" \
18306 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18307           cd first-dir
18308           echo hi >file1
18309           dotest logopt-3 "${testcvs} add file1" \
18310 "${PROG} add: scheduling file .file1. for addition
18311 ${PROG} add: use .${PROG} commit. to add this file permanently"
18312           dotest logopt-4 "${testcvs} -q ci -m add file1" \
18313 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18314 done
18315 Checking in file1;
18316 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18317 initial revision: 1\.1
18318 done"
18319           cd ..
18320
18321           dotest logopt-5 "${testcvs} log -R -d 2038-01-01" \
18322 "${PROG} log: Logging \.
18323 ${PROG} log: Logging first-dir
18324 ${CVSROOT_DIRNAME}/first-dir/file1,v"
18325           dotest logopt-6 "${testcvs} log -d 2038-01-01 -R" \
18326 "${PROG} log: Logging \.
18327 ${PROG} log: Logging first-dir
18328 ${CVSROOT_DIRNAME}/first-dir/file1,v"
18329           dotest logopt-6a "${testcvs} log -Rd 2038-01-01" \
18330 "${PROG} log: Logging \.
18331 ${PROG} log: Logging first-dir
18332 ${CVSROOT_DIRNAME}/first-dir/file1,v"
18333           dotest logopt-7 "${testcvs} log -s Exp -R" \
18334 "${PROG} log: Logging \.
18335 ${PROG} log: Logging first-dir
18336 ${CVSROOT_DIRNAME}/first-dir/file1,v"
18337
18338           cd ..
18339           rm -r 1
18340           rm -rf ${CVSROOT_DIRNAME}/first-dir
18341           ;;
18342
18343         ann)
18344           # Tests of "cvs annotate".  See also:
18345           #   basica-10  A simple annotate test
18346           #   rcs        Annotate and the year 2000
18347           #   keywordlog Annotate and $Log.
18348           mkdir 1; cd 1
18349           dotest ann-1 "${testcvs} -q co -l ." ''
18350           mkdir first-dir
18351           dotest ann-2 "${testcvs} add first-dir" \
18352 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18353           cd first-dir
18354           cat >file1 <<EOF
18355 this
18356 is
18357 the
18358 ancestral
18359 file
18360 EOF
18361           dotest ann-3 "${testcvs} add file1" \
18362 "${PROG} add: scheduling file .file1. for addition
18363 ${PROG} add: use .${PROG} commit. to add this file permanently"
18364           dotest ann-4 "${testcvs} -q ci -m add file1" \
18365 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18366 done
18367 Checking in file1;
18368 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18369 initial revision: 1\.1
18370 done"
18371           cat >file1 <<EOF
18372 this
18373 is
18374 a
18375 file
18376
18377 with
18378 a
18379 blank
18380 line
18381 EOF
18382           dotest ann-5 "${testcvs} -q ci -m modify file1" \
18383 "Checking in file1;
18384 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18385 new revision: 1\.2; previous revision: 1\.1
18386 done"
18387           dotest ann-6 "${testcvs} -q tag -b br" "T file1"
18388           cat >file1 <<EOF
18389 this
18390 is
18391 a
18392 trunk file
18393
18394 with
18395 a
18396 blank
18397 line
18398 EOF
18399           dotest ann-7 "${testcvs} -q ci -m modify file1" \
18400 "Checking in file1;
18401 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18402 new revision: 1\.3; previous revision: 1\.2
18403 done"
18404           dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
18405           cat >file1 <<EOF
18406 this
18407 is
18408 a
18409 file
18410
18411 with
18412 a
18413 blank
18414 line
18415 and some
18416 branched content
18417 EOF
18418           dotest ann-9 "${testcvs} -q ci -m modify" \
18419 "Checking in file1;
18420 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18421 new revision: 1\.2\.2\.1; previous revision: 1\.2
18422 done"
18423           # Note that this annotates the trunk despite the presence
18424           # of a sticky tag in the current directory.  This is
18425           # fairly bogus, but it is the longstanding behavior for
18426           # whatever that is worth.
18427           dotest ann-10 "${testcvs} ann" \
18428 "
18429 Annotations for file1
18430 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18431 1\.1          (${username} *[0-9a-zA-Z-]*): this
18432 1\.1          (${username} *[0-9a-zA-Z-]*): is
18433 1\.2          (${username} *[0-9a-zA-Z-]*): a
18434 1\.3          (${username} *[0-9a-zA-Z-]*): trunk file
18435 1\.2          (${username} *[0-9a-zA-Z-]*): 
18436 1\.2          (${username} *[0-9a-zA-Z-]*): with
18437 1\.2          (${username} *[0-9a-zA-Z-]*): a
18438 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18439 1\.2          (${username} *[0-9a-zA-Z-]*): line"
18440           dotest ann-11 "${testcvs} ann -r br" \
18441 "
18442 Annotations for file1
18443 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18444 1\.1          (${username} *[0-9a-zA-Z-]*): this
18445 1\.1          (${username} *[0-9a-zA-Z-]*): is
18446 1\.2          (${username} *[0-9a-zA-Z-]*): a
18447 1\.1          (${username} *[0-9a-zA-Z-]*): file
18448 1\.2          (${username} *[0-9a-zA-Z-]*): 
18449 1\.2          (${username} *[0-9a-zA-Z-]*): with
18450 1\.2          (${username} *[0-9a-zA-Z-]*): a
18451 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18452 1\.2          (${username} *[0-9a-zA-Z-]*): line
18453 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
18454 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
18455           # FIXCVS: shouldn't "-r 1.2.0.2" be the same as "-r br"?
18456           dotest ann-12 "${testcvs} ann -r 1.2.0.2 file1" ""
18457           dotest ann-13 "${testcvs} ann -r 1.2.2 file1" \
18458 "
18459 Annotations for file1
18460 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18461 1\.1          (${username} *[0-9a-zA-Z-]*): this
18462 1\.1          (${username} *[0-9a-zA-Z-]*): is
18463 1\.2          (${username} *[0-9a-zA-Z-]*): a
18464 1\.1          (${username} *[0-9a-zA-Z-]*): file
18465 1\.2          (${username} *[0-9a-zA-Z-]*): 
18466 1\.2          (${username} *[0-9a-zA-Z-]*): with
18467 1\.2          (${username} *[0-9a-zA-Z-]*): a
18468 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18469 1\.2          (${username} *[0-9a-zA-Z-]*): line
18470 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
18471 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
18472           dotest_fail ann-14 "${testcvs} ann -r bill-clintons-chastity file1" \
18473 "${PROG} \[annotate aborted\]: no such tag bill-clintons-chastity"
18474
18475           # Now get rid of the working directory and test rannotate
18476
18477           cd ../..
18478           rm -r 1
18479           dotest ann-r10 "${testcvs} rann first-dir" \
18480 "
18481 Annotations for first-dir/file1
18482 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18483 1\.1          (${username} *[0-9a-zA-Z-]*): this
18484 1\.1          (${username} *[0-9a-zA-Z-]*): is
18485 1\.2          (${username} *[0-9a-zA-Z-]*): a
18486 1\.3          (${username} *[0-9a-zA-Z-]*): trunk file
18487 1\.2          (${username} *[0-9a-zA-Z-]*): 
18488 1\.2          (${username} *[0-9a-zA-Z-]*): with
18489 1\.2          (${username} *[0-9a-zA-Z-]*): a
18490 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18491 1\.2          (${username} *[0-9a-zA-Z-]*): line"
18492           dotest ann-r11 "${testcvs} rann -r br first-dir" \
18493 "
18494 Annotations for first-dir/file1
18495 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18496 1\.1          (${username} *[0-9a-zA-Z-]*): this
18497 1\.1          (${username} *[0-9a-zA-Z-]*): is
18498 1\.2          (${username} *[0-9a-zA-Z-]*): a
18499 1\.1          (${username} *[0-9a-zA-Z-]*): file
18500 1\.2          (${username} *[0-9a-zA-Z-]*): 
18501 1\.2          (${username} *[0-9a-zA-Z-]*): with
18502 1\.2          (${username} *[0-9a-zA-Z-]*): a
18503 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18504 1\.2          (${username} *[0-9a-zA-Z-]*): line
18505 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
18506 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
18507           dotest ann-r12 "${testcvs} rann -r 1.2.0.2 first-dir/file1" ""
18508           dotest ann-r13 "${testcvs} rann -r 1.2.2 first-dir/file1" \
18509 "
18510 Annotations for first-dir/file1
18511 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18512 1\.1          (${username} *[0-9a-zA-Z-]*): this
18513 1\.1          (${username} *[0-9a-zA-Z-]*): is
18514 1\.2          (${username} *[0-9a-zA-Z-]*): a
18515 1\.1          (${username} *[0-9a-zA-Z-]*): file
18516 1\.2          (${username} *[0-9a-zA-Z-]*): 
18517 1\.2          (${username} *[0-9a-zA-Z-]*): with
18518 1\.2          (${username} *[0-9a-zA-Z-]*): a
18519 1\.2          (${username} *[0-9a-zA-Z-]*): blank
18520 1\.2          (${username} *[0-9a-zA-Z-]*): line
18521 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
18522 1\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
18523           dotest_fail ann-r14 "${testcvs} rann -r bill-clintons-chastity first-dir/file1" \
18524 "${PROG} \[rannotate aborted\]: no such tag bill-clintons-chastity"
18525
18526           rm -rf ${CVSROOT_DIRNAME}/first-dir
18527           ;;
18528
18529         ann-id)
18530           # Demonstrate that cvs-1.9.28.1 improperly expands rcs keywords in
18531           # the output of `cvs annotate' -- it uses values from the previous
18532           # delta.  In this case, `1.1' instead of `1.2', even though it puts
18533           # the proper version number on the prefix to each line of output.
18534           mkdir 1; cd 1
18535           dotest ann-id-1 "${testcvs} -q co -l ." ''
18536           module=x
18537           mkdir $module
18538           dotest ann-id-2 "${testcvs} add $module" \
18539 "Directory ${CVSROOT_DIRNAME}/$module added to the repository"
18540           cd $module
18541
18542           file=m
18543           echo '$Id''$' > $file
18544
18545           dotest ann-id-3 "$testcvs add $file" \
18546 "${PROG} add: scheduling file .$file. for addition
18547 ${PROG} add: use .${PROG} commit. to add this file permanently"
18548           dotest ann-id-4 "$testcvs -Q ci -m . $file" \
18549 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
18550 done
18551 Checking in $file;
18552 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
18553 initial revision: 1\.1
18554 done"
18555
18556           echo line2 >> $file
18557           dotest ann-id-5 "$testcvs -Q ci -m . $file" \
18558 "Checking in $file;
18559 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
18560 new revision: 1\.2; previous revision: 1\.1
18561 done"
18562
18563           # The version number after $file,v should be `1.2'.
18564           # 1.9.28.1 puts `1.1' there.
18565           dotest ann-id-6 "$testcvs -Q ann $file" \
18566 "
18567 Annotations for $file
18568 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18569 1.2          ($username *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'"
18570 1.2          ($username *[0-9a-zA-Z-]*): line2"
18571
18572           cd ../..
18573           rm -rf 1
18574           rm -rf ${CVSROOT_DIRNAME}/$module
18575           ;;
18576
18577         crerepos)
18578           # Various tests relating to creating repositories, operating
18579           # on repositories created with old versions of CVS, etc.
18580
18581           CVS_SERVER_save=$CVS_SERVER
18582
18583           # Because this test is all about -d options and such, it
18584           # at least to some extent needs to be different for remote vs.
18585           # local.
18586           if $remote; then
18587
18588             # For remote, just create the repository.  We don't yet do
18589             # the various other tests above for remote but that should be
18590             # changed.
18591             mkdir crerepos
18592             mkdir crerepos/CVSROOT
18593
18594             # Use :ext: rather than :fork:.  Most of the tests use :fork:,
18595             # so we want to make sure that we test :ext: _somewhere_.
18596
18597             # Maybe a bit dubious in the sense that people need to
18598             # have rsh working to run the tests, but at least it
18599             # isn't inetd :-).  Might want to think harder about this -
18600             # maybe try :ext:, and if it fails, print a (single, nice)
18601             # message and fall back to :fork:.  Maybe testing :ext:
18602             # with our own CVS_RSH rather than worrying about a system one
18603             # would do the trick.
18604
18605                # Make sure server ignores real ${HOME}/.cvsrc:
18606             cat >$TESTDIR/cvs-setHome <<EOF
18607 #!/bin/sh
18608 HOME=$HOME
18609 export HOME
18610 exec $CVS_SERVER_save "\$@"
18611 EOF
18612             chmod a+x $TESTDIR/cvs-setHome
18613
18614             # Note that we set CVS_SERVER at the beginning.
18615             CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER
18616
18617             if test -n "$remotehost"; then
18618                 CREREPOS_ROOT=:ext:$remotehost${TESTDIR}/crerepos
18619             else
18620                 CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos
18621             fi
18622
18623             # If we're going to do remote testing, make sure 'rsh' works first.
18624             host="`hostname`"
18625             if test "x`${CVS_RSH} $host -n 'echo hi'`" != "xhi"; then
18626                 echo "ERROR: cannot test remote CVS, because \`${CVS_RSH} $host' fails." >&2
18627                 exit 1
18628             fi
18629
18630           else
18631
18632             # First, if the repository doesn't exist at all...
18633             dotest_fail crerepos-1 \
18634 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
18635 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
18636             mkdir crerepos
18637
18638             # The repository exists but CVSROOT doesn't.
18639             dotest_fail crerepos-2 \
18640 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
18641 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
18642             mkdir crerepos/CVSROOT
18643
18644             # Checkout of nonexistent module
18645             dotest_fail crerepos-3 \
18646 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
18647 "${PROG} checkout: cannot find module .cvs-sanity. - ignored"
18648
18649             # Now test that CVS works correctly without a modules file
18650             # or any of that other stuff.  In particular, it *must*
18651             # function if administrative files added to CVS recently (since
18652             # CVS 1.3) do not exist, because the repository might have
18653             # been created with an old version of CVS.
18654             mkdir 1; cd 1
18655             dotest crerepos-4 \
18656 "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
18657 ''
18658             if echo yes | \
18659 ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
18660               pass crerepos-5
18661             else
18662               fail crerepos-5
18663             fi
18664             rm -rf CVS
18665             cd ..
18666             # The directory 1 should be empty
18667             dotest crerepos-6 "rmdir 1"
18668
18669             CREREPOS_ROOT=${TESTDIR}/crerepos
18670
18671           fi
18672
18673           if $remote; then
18674             # Test that CVS rejects a relative path in CVSROOT.
18675             mkdir 1; cd 1
18676             # Note that having the client reject the pathname (as :fork:
18677             # does), does _not_ test for the bugs we are trying to catch
18678             # here.  The point is that malicious clients might send all
18679             # manner of things and the server better protect itself.
18680             dotest_fail crerepos-6a-r \
18681 "${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
18682 "${PROG} [a-z]*: CVSROOT may only specify a positive, non-zero, integer port (not .\.\..)\.
18683 ${PROG} [a-z]*: Perhaps you entered a relative pathname${QUESTION}
18684 ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:\.\./crerepos.\."
18685             cd ..
18686             rm -r 1
18687
18688             mkdir 1; cd 1
18689             dotest_fail crerepos-6b-r \
18690 "${testcvs} -d :ext:`hostname`:crerepos init" \
18691 "${PROG} [a-z]*: CVSROOT requires a path spec:
18692 ${PROG} [a-z]*: :(gserver|kserver|pserver):\[\[user\]\[:password\]@\]host\[:\[port\]\]/path
18693 ${PROG} [a-z]*: \[:(ext|server):\]\[\[user\]@\]host\[:\]/path
18694 ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:crerepos.\."
18695             cd ..
18696             rm -r 1
18697           else # local
18698             # Test that CVS rejects a relative path in CVSROOT.
18699
18700             mkdir 1; cd 1
18701             # Set CVS_RSH=false since ocassionally (e.g. when CVS_RSH=ssh on
18702             # some systems) some rsh implementations will block because they
18703             # can look up '..' and want to ask the user about the unknown host
18704             # key or somesuch.  Which error message we get depends on whether
18705             # false finishes running before we try to talk to it or not.
18706             dotest_fail crerepos-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \
18707 "${PROG} \[checkout aborted\]: end of file from server (consult above messages if any)" \
18708 "${PROG} \[checkout aborted\]: received broken pipe signal"
18709             cd ..
18710             rm -r 1
18711
18712             mkdir 1; cd 1
18713             dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
18714 "${PROG} init: CVSROOT must be an absolute pathname (not .crerepos.)
18715 ${PROG} init: when using local access method\.
18716 ${PROG} \[init aborted\]: Bad CVSROOT: .crerepos.\."
18717             cd ..
18718             rm -r 1
18719           fi # end of tests to be skipped for remote
18720
18721           # CVS better not create a history file--if the administrator 
18722           # doesn't need it and wants to save on disk space, they just
18723           # delete it.
18724           dotest_fail crerepos-7 \
18725 "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
18726
18727           # Now test mixing repositories.  This kind of thing tends to
18728           # happen accidentally when people work with several repositories.
18729           mkdir 1; cd 1
18730           dotest crerepos-8 "${testcvs} -q co -l ." ''
18731           mkdir first-dir
18732           dotest crerepos-9 "${testcvs} add first-dir" \
18733 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18734           cd first-dir
18735           touch file1
18736           dotest crerepos-10 "${testcvs} add file1" \
18737 "${PROG} add: scheduling file .file1. for addition
18738 ${PROG} add: use .${PROG} commit. to add this file permanently"
18739           dotest crerepos-11 "${testcvs} -q ci -m add-it" \
18740 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18741 done
18742 Checking in file1;
18743 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18744 initial revision: 1\.1
18745 done"
18746           cd ../..
18747           rm -r 1
18748
18749           mkdir 1; cd 1
18750           dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
18751           mkdir crerepos-dir
18752           dotest crerepos-13 "${testcvs} add crerepos-dir" \
18753 "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
18754           cd crerepos-dir
18755           touch cfile
18756           dotest crerepos-14 "${testcvs} add cfile" \
18757 "${PROG} add: scheduling file .cfile. for addition
18758 ${PROG} add: use .${PROG} commit. to add this file permanently"
18759           dotest crerepos-15 "${testcvs} -q ci -m add-it" \
18760 "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
18761 done
18762 Checking in cfile;
18763 ${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
18764 initial revision: 1\.1
18765 done"
18766           cd ../..
18767           rm -r 1
18768
18769           mkdir 1; cd 1
18770           dotest crerepos-16 "${testcvs} co first-dir" \
18771 "${PROG} checkout: Updating first-dir
18772 U first-dir/file1"
18773           dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
18774 "${PROG} checkout: Updating crerepos-dir
18775 U crerepos-dir/cfile"
18776           dotest crerepos-18 "${testcvs} update" \
18777 "${PROG} update: Updating first-dir
18778 ${PROG} update: Updating crerepos-dir"
18779
18780           cd ..
18781
18782           CVS_SERVER=$CVS_SERVER_save; export CVS_SERVER
18783
18784           if $keep; then
18785             echo Keeping ${TESTDIR} and exiting due to --keep
18786             exit 0
18787           fi
18788
18789           rm -f $TESTDIR/cvs-setHome
18790           rm -r 1
18791           rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
18792           ;;
18793
18794
18795
18796         rcs)
18797           # Test ability to import an RCS file.  Note that this format
18798           # is fixed--files written by RCS5, and other software which
18799           # implements this format, will be out there "forever" and
18800           # CVS must always be able to import such files.
18801
18802           # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
18803
18804           mkdir ${CVSROOT_DIRNAME}/first-dir
18805
18806           # Currently the way to import an RCS file is to copy it
18807           # directly into the repository.
18808           #
18809           # This file was written by RCS 5.7, and then the dates were
18810           # hacked so that we test year 2000 stuff.  Note also that
18811           # "author" names are just strings, as far as importing
18812           # RCS files is concerned--they need not correspond to user
18813           # IDs on any particular system.
18814           #
18815           # I also tried writing a file with the RCS supplied with
18816           # HPUX A.09.05.  According to "man rcsintro" this is
18817           # "Revision Number: 3.0; Release Date: 83/05/11".  There
18818           # were a few minor differences like whitespace but at least
18819           # in simple cases like this everything else seemed the same
18820           # as the file written by RCS 5.7 (so I won't try to make it
18821           # a separate test case).
18822
18823           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
18824 head    1.3;
18825 access;
18826 symbols;
18827 locks; strict;
18828 comment @# @;
18829
18830
18831 1.3
18832 date    2000.11.24.15.58.37;    author kingdon; state Exp;
18833 branches;
18834 next    1.2;
18835
18836 1.2
18837 date    96.11.24.15.57.41;      author kingdon; state Exp;
18838 branches;
18839 next    1.1;
18840
18841 1.1
18842 date    96.11.24.15.56.05;      author kingdon; state Exp;
18843 branches;
18844 next    ;
18845
18846
18847 desc
18848 @file1 is for testing CVS
18849 @
18850
18851
18852 1.3
18853 log
18854 @delete second line; modify twelfth line
18855 @
18856 text
18857 @This is the first line
18858 This is the third line
18859 This is the fourth line
18860 This is the fifth line
18861 This is the sixth line
18862 This is the seventh line
18863 This is the eighth line
18864 This is the ninth line
18865 This is the tenth line
18866 This is the eleventh line
18867 This is the twelfth line (and what a line it is)
18868 This is the thirteenth line
18869 @
18870
18871
18872 1.2
18873 log
18874 @add more lines
18875 @
18876 text
18877 @a1 1
18878 This is the second line
18879 d11 1
18880 a11 1
18881 This is the twelfth line
18882 @
18883
18884
18885 1.1
18886 log
18887 @add file1
18888 @
18889 text
18890 @d2 12
18891 @
18892 EOF
18893           dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
18894           cd first-dir
18895           dotest rcs-2 "${testcvs} -q log" "
18896 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18897 Working file: file1
18898 head: 1\.3
18899 branch:
18900 locks: strict
18901 access list:
18902 symbolic names:
18903 keyword substitution: kv
18904 total revisions: 3;     selected revisions: 3
18905 description:
18906 file1 is for testing CVS
18907 ----------------------------
18908 revision 1\.3
18909 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
18910 delete second line; modify twelfth line
18911 ----------------------------
18912 revision 1\.2
18913 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
18914 add more lines
18915 ----------------------------
18916 revision 1\.1
18917 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
18918 add file1
18919 ============================================================================="
18920
18921           # Note that the dates here are chosen so that (a) we test
18922           # at least one date after 2000, (b) we will notice if the
18923           # month and day are getting mixed up with each other.
18924           # TODO: also test that year isn't getting mixed up with month
18925           # or day, for example 01-02-03.
18926
18927           # ISO8601 format.  There are many, many, other variations
18928           # specified by ISO8601 which we should be testing too.
18929           dotest rcs-3 "${testcvs} -q log -d '1996-12-11<'" "
18930 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18931 Working file: file1
18932 head: 1\.3
18933 branch:
18934 locks: strict
18935 access list:
18936 symbolic names:
18937 keyword substitution: kv
18938 total revisions: 3;     selected revisions: 1
18939 description:
18940 file1 is for testing CVS
18941 ----------------------------
18942 revision 1\.3
18943 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
18944 delete second line; modify twelfth line
18945 ============================================================================="
18946
18947           # RFC822 format (as amended by RFC1123).
18948           dotest rcs-4 "${testcvs} -q log -d '<3 Apr 2000 00:00'" \
18949 "
18950 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18951 Working file: file1
18952 head: 1\.3
18953 branch:
18954 locks: strict
18955 access list:
18956 symbolic names:
18957 keyword substitution: kv
18958 total revisions: 3;     selected revisions: 2
18959 description:
18960 file1 is for testing CVS
18961 ----------------------------
18962 revision 1\.2
18963 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
18964 add more lines
18965 ----------------------------
18966 revision 1\.1
18967 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
18968 add file1
18969 ============================================================================="
18970
18971           # Intended behavior for "cvs annotate" is that it displays the
18972           # last two digits of the year.  Make sure it does that rather
18973           # than some bogosity like "100".
18974           dotest rcs-4a "${testcvs} annotate file1" \
18975 "
18976 Annotations for file1
18977 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18978 1\.1          (kingdon  24-Nov-96): This is the first line
18979 1\.2          (kingdon  24-Nov-96): This is the third line
18980 1\.2          (kingdon  24-Nov-96): This is the fourth line
18981 1\.2          (kingdon  24-Nov-96): This is the fifth line
18982 1\.2          (kingdon  24-Nov-96): This is the sixth line
18983 1\.2          (kingdon  24-Nov-96): This is the seventh line
18984 1\.2          (kingdon  24-Nov-96): This is the eighth line
18985 1\.2          (kingdon  24-Nov-96): This is the ninth line
18986 1\.2          (kingdon  24-Nov-96): This is the tenth line
18987 1\.2          (kingdon  24-Nov-96): This is the eleventh line
18988 1\.3          (kingdon  24-Nov-00): This is the twelfth line (and what a line it is)
18989 1\.2          (kingdon  24-Nov-96): This is the thirteenth line"
18990
18991           # Probably should split this test into two at this point (file1
18992           # above this line and file2 below), as the two share little
18993           # data/setup.
18994
18995           # OK, here is another one.  This one was written by hand based on
18996           # doc/RCSFILES and friends.  One subtle point is that none of
18997           # the lines end with newlines; that is a feature which we
18998           # should be testing.
18999           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
19000 head                            1.5                 ;
19001      branch        1.2.6;
19002 access ;
19003 symbols branch:1.2.6;
19004 locks;
19005 testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
19006 1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
19007 1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
19008 1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
19009 1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
19010 1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
19011 1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
19012 desc @@
19013 1.5 log @@ newphrase1; newphrase2 42; text @head revision@
19014 1.4 log @@ text @d1 1
19015 a1 1
19016 new year revision@
19017 1.3 log @@ text @d1 1
19018 a1 1
19019 old year revision@
19020 1.2 log @@ text @d1 1
19021 a1 1
19022 mid revision@ 1.1
19023
19024 log           @@ text @d1 1
19025 a1 1
19026 start revision@
19027 1.2.6.1 log @@ text @d1 1
19028 a1 1
19029 branch revision@
19030 EOF
19031           # ' Match the single quote in above here doc -- for font-lock mode.
19032
19033           # First test the default branch.
19034           dotest rcs-5 "${testcvs} -q update file2" "U file2"
19035           dotest rcs-6 "cat file2" "branch revision"
19036
19037           # Check in a revision on the branch to force CVS to
19038           # interpret every revision in the file.
19039           dotest rcs-6a "${testcvs} -q update -r branch file2" ""
19040           echo "next branch revision" > file2
19041           dotest rcs-6b "${testcvs} -q ci -m mod file2" \
19042 "Checking in file2;
19043 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
19044 new revision: 1\.2\.6\.2; previous revision: 1\.2\.6\.1
19045 done"
19046
19047           # Now get rid of the default branch, it will get in the way.
19048           dotest rcs-7 "${testcvs} admin -b file2" \
19049 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19050 done"
19051           # But we do want to make sure that "cvs admin" leaves the newphrases
19052           # in the file.
19053           # The extra whitespace regexps are for the RCS library, which does
19054           # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
19055           dotest rcs-8 \
19056 "grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
19057 "testofanewphrase[       ][     ]*@without newphrase we'd have trouble extending @@ all@[        ]*;"
19058           # The easiest way to test for newphrases in deltas and deltatexts
19059           # is to just look at the whole file, I guess.
19060           dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
19061 "head   1\.5;
19062 access;
19063 symbols
19064         branch:1.2.6;
19065 locks;
19066
19067 testofanewphrase        @without newphrase we'd have trouble extending @@ all@;
19068
19069 1\.5
19070 date    71\.01\.01\.01\.00\.00; author joe;     state bogus;
19071 branches;
19072 next    1\.4;
19073
19074 1\.4
19075 date    71\.01\.01\.00\.00\.05; author joe;     state bogus;
19076 branches;
19077 next    1\.3;
19078
19079 1\.3
19080 date    70\.12\.31\.15\.00\.05; author joe;     state bogus;
19081 branches;
19082 next    1\.2;
19083
19084 1\.2
19085 date    70\.12\.31\.12\.15\.05; author me;      state bogus;
19086 branches
19087         1\.2\.6\.1;
19088 next    1\.1;
19089
19090 1\.1
19091 date    70\.12\.31\.11\.00\.05; author joe;     state bogus;
19092 branches;
19093 next    ;
19094 newph   ;
19095
19096 1\.2\.6\.1
19097 date    71\.01\.01\.08\.00\.05; author joe;     state Exp;
19098 branches;
19099 next    1\.2\.6\.2;
19100
19101 1\.2\.6\.2
19102 date    [0-9.]*;        author ${username};     state Exp;
19103 branches;
19104 next    ;
19105
19106
19107 desc
19108 @@
19109
19110
19111 1\.5
19112 log
19113 @@
19114 newphrase1      ;
19115 newphrase2      42;
19116 text
19117 @head revision@
19118
19119
19120 1\.4
19121 log
19122 @@
19123 text
19124 @d1 1
19125 a1 1
19126 new year revision@
19127
19128
19129 1\.3
19130 log
19131 @@
19132 text
19133 @d1 1
19134 a1 1
19135 old year revision@
19136
19137
19138 1\.2
19139 log
19140 @@
19141 text
19142 @d1 1
19143 a1 1
19144 mid revision@
19145
19146
19147 1\.1
19148 log
19149 @@
19150 text
19151 @d1 1
19152 a1 1
19153 start revision@
19154
19155
19156 1\.2\.6\.1
19157 log
19158 @@
19159 text
19160 @d1 1
19161 a1 1
19162 branch revision@
19163
19164
19165 1\.2\.6\.2
19166 log
19167 @mod
19168 @
19169 text
19170 @d1 1
19171 a1 1
19172 next branch revision
19173 @"
19174
19175           dotest rcs-9 "${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2" \
19176 "start revision"
19177
19178           dotest rcs-10 "${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2" \
19179 "mid revision"
19180
19181           dotest rcs-11 "${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2" \
19182 "new year revision"
19183
19184           # Same test as rcs-10, but with am/pm.
19185           dotest rcs-12 "${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2" \
19186 "mid revision"
19187
19188           # Same test as rcs-11, but with am/pm.
19189           dotest rcs-13 "${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2" \
19190 "new year revision"
19191
19192           # OK, now make sure cvs log doesn't have any trouble with the
19193           # newphrases and such.
19194           dotest rcs-14 "${testcvs} -q log file2" "
19195 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19196 Working file: file2
19197 head: 1\.5
19198 branch:
19199 locks:
19200 access list:
19201 symbolic names:
19202         branch: 1\.2\.6
19203 keyword substitution: kv
19204 total revisions: 7;     selected revisions: 7
19205 description:
19206 ----------------------------
19207 revision 1\.5
19208 date: 1971/01/01 01:00:00;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
19209 \*\*\* empty log message \*\*\*
19210 ----------------------------
19211 revision 1\.4
19212 date: 1971/01/01 00:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
19213 \*\*\* empty log message \*\*\*
19214 ----------------------------
19215 revision 1\.3
19216 date: 1970/12/31 15:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
19217 \*\*\* empty log message \*\*\*
19218 ----------------------------
19219 revision 1\.2
19220 date: 1970/12/31 12:15:05;  author: me;  state: bogus;  lines: ${PLUS}1 -1
19221 branches:  1\.2\.6;
19222 \*\*\* empty log message \*\*\*
19223 ----------------------------
19224 revision 1\.1
19225 date: 1970/12/31 11:00:05;  author: joe;  state: bogus;
19226 \*\*\* empty log message \*\*\*
19227 ----------------------------
19228 revision 1\.2\.6\.2
19229 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
19230 mod
19231 ----------------------------
19232 revision 1\.2\.6\.1
19233 date: 1971/01/01 08:00:05;  author: joe;  state: Exp;  lines: ${PLUS}1 -1
19234 \*\*\* empty log message \*\*\*
19235 ============================================================================="
19236           # Now test each date format for "cvs log -d".
19237           # Earlier than 1971-01-01
19238           dotest rcs-15 "${testcvs} -q log -d '<1971-01-01 00:00 GMT' file2 \
19239             | grep revision" \
19240 "total revisions: 7;    selected revisions: 3
19241 revision 1\.3
19242 revision 1\.2
19243 revision 1\.1"
19244           # Later than 1971-01-01
19245           dotest rcs-16 "${testcvs} -q log -d '1971-01-01 00:00 GMT<' file2 \
19246             | grep revision" \
19247 "total revisions: 7;    selected revisions: 4
19248 revision 1\.5
19249 revision 1\.4
19250 revision 1\.2\.6\.2
19251 revision 1\.2\.6\.1"
19252           # Alternate syntaxes for later and earlier; multiple -d options
19253           dotest rcs-17 "${testcvs} -q log -d '>1971-01-01 00:00 GMT' \
19254             -d '1970-12-31 12:15 GMT>' file2 | grep revision" \
19255 "total revisions: 7;    selected revisions: 5
19256 revision 1\.5
19257 revision 1\.4
19258 revision 1\.1
19259 revision 1\.2\.6\.2
19260 revision 1\.2\.6\.1"
19261           # Range, and single date
19262           dotest rcs-18 "${testcvs} -q log -d '1970-12-31 11:30 GMT' \
19263             -d '1971-01-01 00:00:05 GMT<1971-01-01 01:00:01 GMT' \
19264             file2 | grep revision" \
19265 "total revisions: 7;    selected revisions: 2
19266 revision 1\.5
19267 revision 1\.1"
19268           # Alternate range syntax; equality
19269           dotest rcs-19 "${testcvs} -q log \
19270             -d '1971-01-01 01:00:01 GMT>=1971-01-01 00:00:05 GMT' \
19271             file2 | grep revision" \
19272 "total revisions: 7;    selected revisions: 2
19273 revision 1\.5
19274 revision 1\.4"
19275
19276           cd ..
19277
19278           rm -r first-dir
19279           rm -rf ${CVSROOT_DIRNAME}/first-dir
19280           ;;
19281
19282         rcs2)
19283           # More date tests.  Might as well do this as a separate
19284           # test from "rcs", so that we don't need to perturb the
19285           # "written by RCS 5.7" RCS file.
19286           mkdir ${CVSROOT_DIRNAME}/first-dir
19287           # Significance of various dates:
19288           # * At least one Y2K standard refers to recognizing 9 Sep 1999
19289           #   (as an example of a pre-2000 date, I guess).
19290           # * At least one Y2K standard refers to recognizing 1 Jan 2001
19291           #   (as an example of a post-2000 date, I guess).
19292           # * Many Y2K standards refer to 2000 being a leap year.
19293           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
19294 head 1.7; access; symbols; locks; strict;
19295 1.7 date 2004.08.31.01.01.01; author sue; state; branches; next 1.6;
19296 1.6 date 2004.02.29.01.01.01; author sue; state; branches; next 1.5;
19297 1.5 date 2003.02.28.01.01.01; author sue; state; branches; next 1.4;
19298 1.4 date 2001.01.01.01.01.01; author sue; state; branches; next 1.3;
19299 1.3 date 2000.02.29.01.01.01; author sue; state; branches; next 1.2;
19300 1.2 date 99.09.09.01.01.01; author sue; state; branches; next 1.1;
19301 1.1 date 98.09.10.01.01.01; author sue; state; branches; next;
19302 desc @a test file@
19303 1.7 log @@ text @head revision@
19304 1.6 log @@ text @d1 1
19305 a1 1
19306 2004 was a great year for leaping@
19307 1.5 log @@ text @d1 1
19308 a1 1
19309 2003 wasn't@
19310 1.4 log @@ text @d1 1
19311 a1 1
19312 two year hiatus@
19313 1.3 log @@ text @d1 1
19314 a1 1
19315 2000 is also a good year for leaping@
19316 1.2 log @@ text @d1 1
19317 a1 1
19318 Tonight we're going to party like it's a certain year@
19319 1.1 log @@ text @d1 1
19320 a1 1
19321 Need to start somewhere@
19322 EOF
19323           # ' Match the 3rd single quote in the here doc -- for font-lock mode.
19324
19325           dotest rcs2-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
19326           cd first-dir
19327
19328           # 9 Sep 1999
19329           dotest rcs2-2 "${testcvs} -q update -p -D '1999-09-09 11:30 UT' file1" \
19330 "Tonight we're going to party like it's a certain year"
19331           # 1 Jan 2001.
19332           dotest rcs2-3 "${testcvs} -q update -p -D '2001-01-01 11:30 UT' file1" \
19333 "two year hiatus"
19334           # 29 Feb 2000
19335           dotest rcs2-4 "${testcvs} -q update -p -D '2000-02-29 11:30 UT' file1" \
19336 "2000 is also a good year for leaping"
19337           # 29 Feb 2003 is invalid
19338           dotest_fail rcs2-5 "${testcvs} -q update -p -D '2003-02-29 11:30 UT' file1" \
19339 "${PROG} \[[a-z]* aborted\]: Can't parse date/time: 2003-02-29 11:30 UT"
19340
19341           dotest rcs2-6 "${testcvs} -q update -p -D 2007-01-07 file1" \
19342 "head revision"
19343           # This assumes that the clock of the machine running the tests
19344           # is set to at least the year 1998 or so.  There don't seem
19345           # to be a lot of ways to test the relative date code (short
19346           # of something like LD_LIBRARY_PRELOAD'ing in our own
19347           # getttimeofday, or hacking the CVS source with testing
19348           # features, which always seems to be problematic since then
19349           # someone feels like documenting them and things go downhill
19350           # from there).
19351           # 
19352           # These tests can be expected to fail 3 times every 400 years
19353           # starting Feb. 29, 2096 (because 8 years from that date would
19354           # be Feb. 29, 2100, which is an invalid date -- 2100 isn't a
19355           # leap year because it's divisible by 100 but not by 400).
19356
19357           dotest rcs2-7 "${testcvs} -q update -p -D '96 months' file1" \
19358 "head revision"
19359           dotest rcs2-8 "${testcvs} -q update -p -D '8 years' file1" \
19360 "head revision"
19361
19362           cd ..
19363           rm -r first-dir
19364           rm -rf ${CVSROOT_DIRNAME}/first-dir
19365           ;;
19366
19367         rcs3)
19368           # More RCS file tests, in particular at least some of the
19369           # error handling issues.
19370           mkdir ${CVSROOT_DIRNAME}/first-dir
19371           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
19372 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
19373 ; author jeremiah ;state ;  branches; next;desc@@1.1log@@text@head@
19374 EOF
19375           mkdir 1; cd 1
19376           # CVS requires whitespace between "desc" and its value.
19377           # The rcsfile(5) manpage doesn't really seem to answer the
19378           # question one way or the other (it has a grammar but almost
19379           # nothing about lexical analysis).
19380           dotest_fail rcs3-1 "${testcvs} -q co first-dir" \
19381 "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
19382           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
19383 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
19384 ; author jeremiah ;state ;  branches; next;desc @@1.1log@@text@head@
19385 EOF
19386           # Whitespace issues, likewise.
19387           dotest_fail rcs3-2 "${testcvs} -q co first-dir" \
19388 "${PROG} \[checkout aborted\]: unexpected '.x6c' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
19389           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
19390 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
19391 ; author jeremiah ;state ;  branches; next;desc @@1.1 log@@text@head@
19392 EOF
19393           # Charming array of different messages for similar
19394           # whitespace issues (depending on where the whitespace is).
19395           dotest_fail rcs3-3 "${testcvs} -q co first-dir" \
19396 "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
19397           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
19398 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
19399 ; author jeremiah ;state ;  branches; next;desc @@1.1 log @@text @head@
19400 EOF
19401           dotest rcs3-4 "${testcvs} -q co first-dir" 'U first-dir/file1'
19402
19403           # Ouch, didn't expect this one.  FIXCVS.  Or maybe just remove
19404           # the feature, if this is a -s problem?
19405           dotest_fail rcs3-5 "${testcvs} log -s nostate first-dir/file1" \
19406 "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
19407           cd first-dir
19408           dotest_fail rcs3-5a "${testcvs} log -s nostate file1" \
19409 "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
19410           cd ..
19411
19412           # See remote code above for rationale for cd.
19413           cd first-dir
19414           dotest rcs3-6 "${testcvs} log -R file1" \
19415 "${CVSROOT_DIRNAME}/first-dir/file1,v"
19416
19417           # OK, now put an extraneous '\0' at the end.
19418           ${AWK} </dev/null 'BEGIN { printf "@%c", 10 }' | ${TR} '@' '\000' \
19419             >>${CVSROOT_DIRNAME}/first-dir/file1,v
19420           dotest_fail rcs3-7 "${testcvs} log -s nostate file1" \
19421 "${PROG} \[log aborted\]: unexpected '.x0' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
19422
19423           cd ../..
19424           rm -r 1
19425           rm -rf ${CVSROOT_DIRNAME}/first-dir
19426           ;;
19427
19428         rcs4)
19429           # Fix a bug that shows up when checking out files by date with the
19430           # "-D date" command line option.  There is code in the original to
19431           # handle a special case.  If the date search finds revision 1.1 it
19432           # is supposed to check whether revision 1.1.1.1 has the same date
19433           # stamp, which would indicate that the file was originally brought
19434           # in with "cvs import".  In that case it is supposed to return the
19435           # vendor branch version 1.1.1.1.
19436           # 
19437           # However, there is a bug in the code. It actually compares
19438           # the date of revision 1.1 for equality with the date given
19439           # on the command line -- clearly wrong. This commit fixes
19440           # the coding bug.
19441           # 
19442           # There is an additional bug which is _not_ fixed yet. 
19443           # The date comparison should not be a strict
19444           # equality test. It should allow a fudge factor of, say, 2-3
19445           # seconds. Old versions of CVS created the two revisions
19446           # with two separate invocations of the RCS "ci" command. We
19447           # have many old files in the tree in which the dates of
19448           # revisions 1.1 and 1.1.1.1 differ by 1 second.
19449
19450           mkdir rcs4
19451           cd rcs4
19452
19453           mkdir imp-dir
19454           cd imp-dir
19455           echo 'OpenMunger sources' >file1
19456
19457           # choose a time in the past to demonstrate the problem
19458           TZ=GMT touch -t 200012010123 file1
19459
19460           dotest_sort rcs4-1 \
19461 "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_0" \
19462 '
19463
19464 N rcs4-dir/file1
19465 No conflicts created by this import'
19466           echo 'OpenMunger sources release 1.1 extras' >>file1
19467           TZ=GMT touch -t 200112011234 file1
19468           dotest_sort rcs4-2 \
19469 "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_1" \
19470 '
19471
19472 No conflicts created by this import
19473 U rcs4-dir/file1'
19474           cd ..
19475           # Next checkout the new module
19476           dotest rcs4-3 \
19477 "${testcvs} -q co rcs4-dir" \
19478 'U rcs4-dir/file1'
19479           cd rcs4-dir
19480           echo 'local change' >> file1
19481
19482           # commit a local change
19483           dotest rcs4-4 \
19484 "${testcvs} -q commit -m hack file1" \
19485 "Checking in file1;
19486 ${CVSROOT_DIRNAME}/rcs4-dir/file1,v  <--  file1
19487 new revision: 1\.2; previous revision: 1\.1
19488 done"
19489           # now see if we get version 1.1 or 1.1.1.1 when we ask for
19490           # a checkout by time... it really should be 1.1.1.1 as
19491           # that was indeed the version that was visible at the target
19492           # time.
19493           dotest rcs4-5 \
19494 "${testcvs} -q update -D 'October 1, 2001 UTC' file1" \
19495 '[UP] file1'
19496           dotest rcs4-6 \
19497 "${testcvs} -q status file1" \
19498 '===================================================================
19499 File: file1             Status: Up-to-date
19500
19501    Working revision:    1\.1\.1\.1.*
19502    Repository revision: 1\.1\.1\.1      '${CVSROOT_DIRNAME}'/rcs4-dir/file1,v
19503    Sticky Tag:          (none)
19504    Sticky Date:         2001\.10\.01\.00\.00\.00
19505    Sticky Options:      (none)'
19506
19507           if $keep; then
19508             echo Keeping ${TESTDIR} and exiting due to --keep
19509             exit 0
19510           fi
19511
19512           cd ../..
19513           rm -r rcs4
19514           rm -rf ${CVSROOT_DIRNAME}/rcs4-dir
19515           ;;
19516
19517         lockfiles)
19518           # Tests of CVS lock files.
19519           # TODO-maybe: Add a test where we arrange for a loginfo
19520           # script (or some such) to ensure that locks are in place
19521           # so then we can see how they are behaving.
19522
19523           mkdir 1; cd 1
19524           mkdir sdir
19525           mkdir sdir/ssdir
19526           echo file >sdir/ssdir/file1
19527           dotest lockfiles-1 \
19528 "${testcvs} -Q import -m import-it first-dir bar baz" ""
19529           cd ..
19530
19531           mkdir 2; cd 2
19532           dotest lockfiles-2 "${testcvs} -q co first-dir" \
19533 "U first-dir/sdir/ssdir/file1"
19534           dotest lockfiles-3 "${testcvs} -Q co CVSROOT" ""
19535           cd CVSROOT
19536           echo "LockDir=${TESTDIR}/locks" >config
19537           dotest lockfiles-4 "${testcvs} -q ci -m config-it" \
19538 "Checking in config;
19539 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
19540 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
19541 done
19542 ${PROG} commit: Rebuilding administrative file database"
19543           cd ../first-dir/sdir/ssdir
19544           # The error message appears twice because Lock_Cleanup only
19545           # stops recursing after the first attempt.
19546           dotest_fail lockfiles-5 "${testcvs} -q update" \
19547 "${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory
19548 ${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory"
19549           mkdir ${TESTDIR}/locks
19550           # Grumble, mumble.  Cygwin.
19551           if test -n "$remotehost"; then
19552             $CVS_RSH $remotehost "chmod u=rwx,g=r,o= ${TESTDIR}/locks"
19553           else
19554             chmod u=rwx,g=r,o= ${TESTDIR}/locks
19555           fi
19556           umask 0077
19557           CVSUMASK=0077; export CVSUMASK
19558           dotest lockfiles-6 "${testcvs} -q update" ""
19559           # TODO: should also be testing that CVS continues to honor the
19560           # umask and CVSUMASK normally.  In the case of the umask, CVS
19561           # doesn't seem to use it for much (although it perhaps should).
19562           dotest lockfiles-7 "ls ${TESTDIR}/locks/first-dir/sdir/ssdir" ""
19563
19564           # The policy is that when CVS creates new lock directories, they
19565           # inherit the permissions from the parent directory.  CVSUMASK
19566           # isn't right, because typically the reason for LockDir is to
19567           # use a different set of permissions.
19568           #
19569           # Bah!  Cygwin!
19570           if test -n "$remotehost"; then
19571             dotest lockfiles-7a "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir'" \
19572 "drwxr-----.*first-dir"
19573             dotest lockfiles-7b "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir'" \
19574 "drwxr-----.*first-dir/sdir/ssdir"
19575           else
19576             dotest lockfiles-7a "ls -ld ${TESTDIR}/locks/first-dir" \
19577 "drwxr-----.*first-dir"
19578             dotest lockfiles-7b "ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir" \
19579 "drwxr-----.*first-dir/sdir/ssdir"
19580           fi
19581
19582           cd ../../..
19583           dotest lockfiles-8 "${testcvs} -q update" ""
19584           dotest lockfiles-9 "${testcvs} -q co -l ." ""
19585
19586           cd CVSROOT
19587           echo "# nobody here but us comments" >config
19588           dotest lockfiles-cleanup-1 "${testcvs} -q ci -m config-it" \
19589 "Checking in config;
19590 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
19591 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
19592 done
19593 ${PROG} commit: Rebuilding administrative file database"
19594           cd ../..
19595           # Perhaps should restore the umask and CVSUMASK to what they
19596           # were before.  But the other tests "should" not care about them...
19597           umask 0077
19598           unset CVSUMASK
19599           rm -r ${TESTDIR}/locks
19600           rm -r 1 2
19601           rm -rf ${CVSROOT_DIRNAME}/first-dir
19602           ;;
19603
19604         backuprecover)
19605           # Tests to make sure we get the expected behavior
19606           # when we recover a repository from an old backup
19607           #
19608           # Details:
19609           #   Backup will be older than some developer's workspaces
19610           #     This means the first attempt at an update will fail
19611           #     The workaround for this is to replace the CVS
19612           #       directories with those from a "new" checkout from
19613           #       the recovered repository.  Due to this, multiple
19614           #       merges should cause conflicts (the same data
19615           #       will be merged more than once).
19616           #     A workspace updated before the date of the recovered
19617           #       copy will not need any extra attention
19618           #
19619           # Note that backuprecover-15 is probably a failure case
19620           #   If nobody else had a more recent update, the data would be lost
19621           #     permanently
19622           #   Granted, the developer should have been notified not to do this
19623           #     by now, but still...
19624           #
19625           mkdir backuprecover; cd backuprecover
19626           mkdir 1; cd 1
19627           dotest backuprecover-1 "${testcvs} -q co -l ." ''
19628           mkdir first-dir
19629           dotest backuprecover-2 "${testcvs} add first-dir" \
19630 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
19631           cd first-dir
19632           mkdir dir
19633           dotest backuprecover-3 "${testcvs} add dir" \
19634 "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository"
19635           touch file1 dir/file2
19636           dotest backuprecover-4 "${testcvs} -q add file1 dir/file2" \
19637 "${PROG} add: use .${PROG} commit. to add these files permanently"
19638           dotest backuprecover-5 "${testcvs} -q ci -mtest" \
19639 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19640 done
19641 Checking in file1;
19642 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19643 initial revision: 1\.1
19644 done
19645 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
19646 done
19647 Checking in dir/file2;
19648 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19649 initial revision: 1\.1
19650 done"
19651           echo "Line one" >>file1
19652           echo "  is the place" >>file1
19653           echo "    we like to begin" >>file1
19654           echo "Anything else" >>file1
19655           echo "  looks like" >>file1
19656           echo "    a sin" >>file1
19657           echo "File 2" >>dir/file2
19658           echo "  is the place" >>dir/file2
19659           echo "    the rest of it goes"  >>dir/file2
19660           echo "Why I don't use" >>dir/file2
19661           echo "  something like 'foo'" >>dir/file2
19662           echo "    God only knows" >>dir/file2
19663           dotest backuprecover-6 "${testcvs} -q ci -mtest" \
19664 "Checking in file1;
19665 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19666 new revision: 1\.2; previous revision: 1\.1
19667 done
19668 Checking in dir/file2;
19669 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19670 new revision: 1\.2; previous revision: 1\.1
19671 done"
19672
19673           # Simulate the lazy developer
19674           # (he did some work but didn't check it in...)
19675           cd ../..
19676           mkdir 2; cd 2
19677           dotest backuprecover-7 "${testcvs} -Q co first-dir" ''
19678           cd first-dir
19679           sed -e "s/looks like/just looks like/" file1 >tmp; mv tmp file1
19680           sed -e "s/don't use/don't just use/" dir/file2 >tmp; mv tmp dir/file2
19681
19682           # developer 1 is on a roll
19683           cd ../../1/first-dir
19684           echo "I need some more words" >>file1
19685           echo "  to fill up this space" >>file1
19686           echo "    anything else would be a disgrace" >>file1
19687           echo "My rhymes cross many boundries" >>dir/file2
19688           echo "  this time it's files" >>dir/file2
19689           echo "    a word that fits here would be something like dials" >>dir/file2
19690           dotest backuprecover-8 "${testcvs} -q ci -mtest" \
19691 "Checking in file1;
19692 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19693 new revision: 1\.3; previous revision: 1\.2
19694 done
19695 Checking in dir/file2;
19696 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19697 new revision: 1\.3; previous revision: 1\.2
19698 done"
19699
19700           # Save a backup copy
19701           cp -r ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/backup
19702
19703           # Simulate developer 3
19704           cd ../..
19705           mkdir 3; cd 3
19706           dotest backuprecover-9a "${testcvs} -Q co first-dir" ''
19707           cd first-dir
19708           echo >>file1
19709           echo >>dir/file2
19710           echo "Developer 1 makes very lame rhymes" >>file1
19711           echo "  I think he should quit and become a mime" >>file1
19712           echo "What the %*^# kind of rhyme crosses a boundry?" >>dir/file2
19713           echo "  I think you should quit and get a job in the foundry" >>dir/file2
19714           dotest backuprecover-9b "${testcvs} -q ci -mtest" \
19715 "Checking in file1;
19716 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19717 new revision: 1\.4; previous revision: 1\.3
19718 done
19719 Checking in dir/file2;
19720 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19721 new revision: 1\.4; previous revision: 1\.3
19722 done"
19723
19724           # Developer 4 so we can simulate a conflict later...
19725           cd ../..
19726           mkdir 4; cd 4
19727           dotest backuprecover-10 "${testcvs} -Q co first-dir" ''
19728           cd first-dir
19729           sed -e "s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
19730
19731           # And back to developer 1
19732           cd ../../1/first-dir
19733           dotest backuprecover-11 "${testcvs} -Q update" ''
19734           echo >>file1
19735           echo >>dir/file2
19736           echo "Oh yeah, well rhyme this" >>file1
19737           echo "  developer three" >>file1
19738           echo "    you want opposition" >>file1
19739           echo "      you found some in me!" >>file1
19740           echo "I'll give you mimes" >>dir/file2
19741           echo "  and foundries galore!"  >>dir/file2
19742           echo "    your head will spin" >>dir/file2
19743           echo "      once you find what's in store!" >>dir/file2
19744           dotest backuprecover-12 "${testcvs} -q ci -mtest" \
19745 "Checking in file1;
19746 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19747 new revision: 1\.5; previous revision: 1\.4
19748 done
19749 Checking in dir/file2;
19750 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19751 new revision: 1\.5; previous revision: 1\.4
19752 done"
19753
19754           # developer 3'll do a bit of work that never gets checked in
19755           cd ../../3/first-dir
19756           dotest backuprecover-13 "${testcvs} -Q update" ''
19757           sed -e "s/very/some extremely/" file1 >tmp; mv tmp file1
19758           dotest backuprecover-14 "${testcvs} -q ci -mtest" \
19759 "Checking in file1;
19760 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19761 new revision: 1\.6; previous revision: 1\.5
19762 done"
19763           echo >>file1
19764           echo "Tee hee hee hee" >>file1
19765           echo >>dir/file2
19766           echo "Find what's in store?" >>dir/file2
19767           echo "  Oh, I'm so sure!" >>dir/file2
19768           echo "    You've got an ill, and I have the cure!"  >>dir/file2
19769
19770           # Slag the original and restore it a few revisions back
19771           rm -rf ${CVSROOT_DIRNAME}/first-dir
19772           mv ${CVSROOT_DIRNAME}/backup ${CVSROOT_DIRNAME}/first-dir
19773
19774           # Have developer 1 try an update and lose some data
19775           #
19776           # Feel free to imagine the horrific scream of despair
19777           cd ../../1/first-dir
19778           dotest backuprecover-15 "${testcvs} update" \
19779 "${PROG} update: Updating .
19780 U file1
19781 ${PROG} update: Updating dir
19782 U dir/file2"
19783
19784           # Developer 3 tries the same thing (he has an office)
19785           # but fails without losing data since all of his files have
19786           # uncommitted changes
19787           cd ../../3/first-dir
19788           dotest_fail backuprecover-16 "${testcvs} update" \
19789 "${PROG} update: Updating \.
19790 ${PROG} \[update aborted\]: could not find desired version 1\.6 in ${CVSROOT_DIRNAME}/first-dir/file1,v"
19791
19792           # create our workspace fixin' script
19793           cd ../..
19794           echo \
19795 "#!/bin/sh
19796
19797 # This script will copy the CVS database dirs from the checked out
19798 # version of a newly recovered repository and replace the CVS
19799 # database dirs in a workspace with later revisions than those in the
19800 # recovered repository
19801 cd repos-first-dir
19802 DATADIRS=\`find . -name CVS -print\`
19803 cd ../first-dir
19804 find . -name CVS -print | xargs rm -rf
19805 for file in \${DATADIRS}; do
19806         cp -r ../repos-first-dir/\${file} \${file}
19807 done" >fixit
19808
19809           # We only need to fix the workspaces of developers 3 and 4
19810           # (1 lost all her data and 2 has an update date from
19811           # before the date the backup was made)
19812           cd 3
19813           dotest backuprecover-17 \
19814                 "${testcvs} -Q co -d repos-first-dir first-dir" ''
19815           cd ../4
19816           dotest backuprecover-18 \
19817                 "${testcvs} -Q co -d repos-first-dir first-dir" ''
19818           sh ../fixit
19819           cd ../3; sh ../fixit
19820
19821           # (re)commit developer 3's stuff
19822           cd first-dir
19823           dotest backuprecover-19 "${testcvs} -q ci -mrecover/merge" \
19824 "Checking in file1;
19825 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19826 new revision: 1\.4; previous revision: 1\.3
19827 done
19828 Checking in dir/file2;
19829 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19830 new revision: 1\.4; previous revision: 1\.3
19831 done"
19832
19833           # and we should get a conflict on developer 4's stuff
19834           cd ../../4/first-dir
19835           dotest backuprecover-20 "${testcvs} update" \
19836 "${PROG} update: Updating \.
19837 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19838 retrieving revision 1\.3
19839 retrieving revision 1\.4
19840 Merging differences between 1\.3 and 1\.4 into file1
19841 rcsmerge: warning: conflicts during merge
19842 ${PROG} update: conflicts found in file1
19843 C file1
19844 ${PROG} update: Updating dir
19845 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
19846 retrieving revision 1\.3
19847 retrieving revision 1\.4
19848 Merging differences between 1\.3 and 1\.4 into file2
19849 rcsmerge: warning: conflicts during merge
19850 ${PROG} update: conflicts found in dir/file2
19851 C dir/file2"
19852           sed -e \
19853 "/^<<<<<<</,/^=======/d
19854 /^>>>>>>>/d" file1 >tmp; mv tmp file1
19855           sed -e \
19856 "/^<<<<<<</,/^=======/d
19857 /^>>>>>>>/d
19858 s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
19859           dotest backuprecover-21 "${testcvs} -q ci -mrecover/merge" \
19860 "Checking in dir/file2;
19861 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19862 new revision: 1\.5; previous revision: 1\.4
19863 done"
19864
19865           # go back and commit developer 2's stuff to prove it can still be done
19866           cd ../../2/first-dir
19867           dotest backuprecover-22 "${testcvs} -Q update" \
19868 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19869 retrieving revision 1\.2
19870 retrieving revision 1\.4
19871 Merging differences between 1\.2 and 1\.4 into file1
19872 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
19873 retrieving revision 1\.2
19874 retrieving revision 1\.5
19875 Merging differences between 1\.2 and 1\.5 into file2"
19876           dotest backuprecover-23 "${testcvs} -q ci -mtest" \
19877 "Checking in file1;
19878 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19879 new revision: 1\.5; previous revision: 1\.4
19880 done
19881 Checking in dir/file2;
19882 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
19883 new revision: 1\.6; previous revision: 1\.5
19884 done"
19885
19886           # and restore the data to developer 1
19887           cd ../../1/first-dir
19888           dotest backuprecover-24 "${testcvs} -Q update" ''
19889
19890           cd ../../..
19891           rm -r backuprecover
19892           rm -rf ${CVSROOT_DIRNAME}/first-dir
19893           ;;
19894
19895         history)
19896           # CVSROOT/history tests:
19897           # history: various "cvs history" invocations
19898           # basic2: Generating the CVSROOT/history file via CVS commands.
19899
19900           # Put in some data for the history file (discarding what was
19901           # there before).  Note that this file format is fixed; the
19902           # user may wish to analyze data from a previous version of
19903           # CVS.  If we phase out this format, it should be done
19904           # slowly and carefully.
19905           cat >${CVSROOT_DIRNAME}/CVSROOT/history <<EOF
19906 O3395c677|anonymous|<remote>/*0|ccvs||ccvs
19907 O3396c677|anonymous|<remote>/src|ccvs||src
19908 O3397c677|kingdon|<remote>/*0|ccvs||ccvs
19909 M339cafae|nk|<remote>|ccvs/src|1.229|sanity.sh
19910 M339cafff|anonymous|<remote>|ccvs/src|1.23|Makefile
19911 M339dc339|kingdon|~/work/*0|ccvs/src|1.231|sanity.sh
19912 W33a6eada|anonymous|<remote>*4|ccvs/emx||Makefile.in
19913 C3b235f50|kingdon|<remote>|ccvs/emx|1.3|README
19914 M3b23af50|kingdon|~/work/*0|ccvs/doc|1.281|cvs.texinfo
19915 EOF
19916           dotest history-1 "${testcvs} history -e -a" \
19917 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs     =ccvs= <remote>/\*
19918 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs     =src=  <remote>/\*
19919 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
19920 W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
19921 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs     =ccvs= <remote>/\*
19922 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
19923 C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
19924 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc
19925 M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity\.sh   ccvs/src == <remote>"
19926
19927           dotest history-2 "${testcvs} history -e -a -D '10 Jun 1997 13:00 UT'" \
19928 "W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
19929 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
19930 C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
19931 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
19932
19933           dotest history-3 "${testcvs} history -e -a -D '10 Jun 2001 13:00 UT'" \
19934 "M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
19935
19936           dotest history-4 "${testcvs} history -ac sanity.sh" \
19937 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
19938 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
19939
19940           dotest history-5 "${testcvs} history -a -xCGUWAMR README sanity.sh" \
19941 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
19942 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
19943 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
19944
19945           dotest history-6 "${testcvs} history -xCGUWAMR -a -f README -f sanity.sh" \
19946 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
19947 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
19948 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
19949
19950           dotest history-7 "${testcvs} history -xCGUWAMR -a -f sanity.sh README" \
19951 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
19952 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
19953 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
19954
19955           dotest history-8 "${testcvs} history -ca -D '1970-01-01 00:00 UT'" \
19956 "M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity.sh   ccvs/src == <remote>
19957 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
19958 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src
19959 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc"
19960
19961           dotest history-9 "${testcvs} history -acl" \
19962 "M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
19963 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
19964 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
19965
19966           dotest history-10 "${testcvs} history -lca -D '1970-01-01 00:00 UT'" \
19967 "M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
19968 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
19969 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
19970
19971           dotest history-11 "${testcvs} history -aw" \
19972 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
19973 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
19974 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
19975
19976           dotest history-12 "${testcvs} history -aw -D'1970-01-01 00:00 UT'" \
19977 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
19978 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
19979 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
19980           ;;
19981
19982         big)
19983
19984           # Test ability to operate on big files.  Intention is to
19985           # test various realloc'ing code in RCS_deltas, rcsgetkey,
19986           # etc.  "big" is currently defined to be 1000 lines (64000
19987           # bytes), which in terms of files that users will use is not
19988           # large, merely average, but my reasoning is that this
19989           # should be big enough to make sure realloc'ing is going on
19990           # and that raising it a lot would start to stress resources
19991           # on machines which run the tests, without any significant
19992           # benefit.
19993
19994           mkdir ${CVSROOT_DIRNAME}/first-dir
19995           dotest big-1 "${testcvs} -q co first-dir" ''
19996           cd first-dir
19997           for i in 0 1 2 3 4 5 6 7 8 9; do
19998             for j in 0 1 2 3 4 5 6 7 8 9; do
19999               for k in 0 1 2 3 4 5 6 7 8 9; do
20000                 echo \
20001 "This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
20002               done
20003             done
20004           done
20005           dotest big-2 "${testcvs} add file1" \
20006 "${PROG} add: scheduling file .file1. for addition
20007 ${PROG} add: use .${PROG} commit. to add this file permanently"
20008           dotest big-3 "${testcvs} -q ci -m add" \
20009 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20010 done
20011 Checking in file1;
20012 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20013 initial revision: 1\.1
20014 done"
20015           cd ..
20016           mkdir 2
20017           cd 2
20018           dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
20019           cd ../first-dir
20020           echo "add a line to the end" >>file1
20021           dotest big-5 "${testcvs} -q ci -m modify" \
20022 "Checking in file1;
20023 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20024 new revision: 1\.2; previous revision: 1\.1
20025 done"
20026           cd ../2/first-dir
20027           # The idea here is particularly to test the Rcs-diff response
20028           # and the reallocing thereof, for remote.
20029           dotest big-6 "${testcvs} -q update" "[UP] file1"
20030           cd ../..
20031
20032           if $keep; then
20033             echo Keeping ${TESTDIR} and exiting due to --keep
20034             exit 0
20035           fi
20036
20037           rm -r first-dir 2
20038           rm -rf ${CVSROOT_DIRNAME}/first-dir
20039           ;;
20040
20041         modes)
20042           # Test repository permissions (CVSUMASK and so on).
20043           # Although the tests in this section "cheat" by testing
20044           # repository permissions, which are sort of not a user-visible
20045           # sort of thing, the modes do have user-visible consequences,
20046           # such as whether a second user can check out the files.  But
20047           # it would be awkward to test the consequences, so we don't.
20048
20049           # Solaris /bin/sh doesn't support export -n.  I'm not sure
20050           # what we can do about this, other than hope that whoever
20051           # is running the tests doesn't have CVSUMASK set.
20052           #export -n CVSUMASK # if unset, defaults to 002
20053
20054           umask 077
20055           mkdir 1; cd 1
20056           dotest modes-1 "${testcvs} -q co -l ." ''
20057           mkdir first-dir
20058           dotest modes-2 "${testcvs} add first-dir" \
20059 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20060           cd first-dir
20061           touch aa
20062           dotest modes-3 "${testcvs} add aa" \
20063 "${PROG} add: scheduling file .aa. for addition
20064 ${PROG} add: use .${PROG} commit. to add this file permanently"
20065           dotest modes-4 "${testcvs} -q ci -m add" \
20066 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
20067 done
20068 Checking in aa;
20069 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20070 initial revision: 1\.1
20071 done"
20072           # Yawn.  Cygwin.
20073           if test -n "$remotehost"; then
20074             dotest modes-5remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
20075 "-r--r--r-- .*"
20076           else
20077             dotest modes-5 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
20078 "-r--r--r-- .*"
20079           fi
20080
20081           # Test for whether we can set the execute bit.
20082           chmod +x aa
20083           echo change it >>aa
20084           dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
20085 "Checking in aa;
20086 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20087 new revision: 1\.2; previous revision: 1\.1
20088 done"
20089           # If CVS let us update the execute bit, it would be set here.
20090           # But it doesn't, and as far as I know that is longstanding
20091           # CVS behavior.
20092           #
20093           # Yeah, yeah.  Search for "Cygwin".
20094           if test -n "$remotehost"; then
20095             dotest modes-7remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
20096 "-r--r--r-- .*"
20097           else
20098             dotest modes-7 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
20099 "-r--r--r-- .*"
20100           fi
20101
20102           # OK, now manually change the modes and see what happens.
20103           #
20104           # Cygwin, already.
20105           if test -n "$remotehost"; then
20106             $CVS_RSH $remotehost "chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v"
20107           else
20108             chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v
20109           fi
20110           echo second line >>aa
20111           dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
20112 "Checking in aa;
20113 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20114 new revision: 1\.3; previous revision: 1\.2
20115 done"
20116           # Cygwin.
20117           if test -n "$remotehost"; then
20118             dotest modes-7bremotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
20119 "-r--r----- .*"
20120           else
20121             dotest modes-7b "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
20122 "-r--r----- .*"
20123           fi
20124
20125           CVSUMASK=007
20126           export CVSUMASK
20127           touch ab
20128           # Might as well test the execute bit too.
20129           chmod +x ab
20130           dotest modes-8 "${testcvs} add ab" \
20131 "${PROG} add: scheduling file .ab. for addition
20132 ${PROG} add: use .${PROG} commit. to add this file permanently"
20133           dotest modes-9 "${testcvs} -q ci -m add" \
20134 "RCS file: ${CVSROOT_DIRNAME}/first-dir/ab,v
20135 done
20136 Checking in ab;
20137 ${CVSROOT_DIRNAME}/first-dir/ab,v  <--  ab
20138 initial revision: 1\.1
20139 done"
20140           if $remote; then
20141             # The problem here is that the CVSUMASK environment variable
20142             # needs to be set on the server (e.g. .bashrc).  This is, of
20143             # course, bogus, but that is the way it is currently.
20144             if test -n "$remotehost"; then
20145               dotest modes-10remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v'" \
20146 "-r--r--r--.*"
20147             else
20148               dotest modes-10r "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
20149 "-r-xr-x---.*" "-r-xr-xr-x.*"
20150             fi
20151           else
20152             dotest modes-10 "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
20153 "-r-xr-x---.*"
20154           fi
20155
20156           # OK, now add a file on a branch.  Check that the mode gets
20157           # set the same way (it is a different code path in CVS).
20158           dotest modes-11 "${testcvs} -q tag -b br" 'T aa
20159 T ab'
20160           dotest modes-12 "${testcvs} -q update -r br" ''
20161           touch ac
20162           dotest modes-13 "${testcvs} add ac" \
20163 "${PROG} add: scheduling file .ac. for addition on branch .br.
20164 ${PROG} add: use .${PROG} commit. to add this file permanently"
20165           # Not sure it really makes sense to refer to a "previous revision"
20166           # when we are just now adding the file; as far as I know
20167           # that is longstanding CVS behavior, for what it's worth.
20168           dotest modes-14 "${testcvs} -q ci -m add" \
20169 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v
20170 done
20171 Checking in ac;
20172 ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v  <--  ac
20173 new revision: 1\.1\.2\.1; previous revision: 1\.1
20174 done"
20175           if $remote; then
20176             # The problem here is that the CVSUMASK environment variable
20177             # needs to be set on the server (e.g. .bashrc).  This is, of
20178             # course, bogus, but that is the way it is currently.  The
20179             # first match is for the :ext: method (where the CVSUMASK
20180             # won't be set), while the second is for the :fork: method
20181             # (where it will be).
20182             if test -n "$remotehost"; then
20183               dotest modes-15r \
20184 "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v'" \
20185 "-r--r--r--.*"
20186             else
20187               dotest modes-15r \
20188 "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
20189 "-r--r--r--.*" "-r--r-----.*"
20190             fi
20191           else
20192             dotest modes-15 \
20193 "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
20194 "-r--r-----.*"
20195           fi
20196
20197           cd ../..
20198           rm -r 1
20199           rm -rf ${CVSROOT_DIRNAME}/first-dir
20200           # Perhaps should restore the umask and CVSUMASK.  But the other
20201           # tests "should" not care about them...
20202           ;;
20203
20204         modes2)
20205           # More tests of file permissions in the working directory
20206           # and that sort of thing.
20207
20208           # The usual setup, file first-dir/aa with two revisions.
20209           mkdir 1; cd 1
20210           dotest modes2-1 "${testcvs} -q co -l ." ''
20211           mkdir first-dir
20212           dotest modes2-2 "${testcvs} add first-dir" \
20213 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20214           cd first-dir
20215           touch aa
20216           dotest modes2-3 "${testcvs} add aa" \
20217 "${PROG} add: scheduling file .aa. for addition
20218 ${PROG} add: use .${PROG} commit. to add this file permanently"
20219           dotest modes2-4 "${testcvs} -q ci -m add" \
20220 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
20221 done
20222 Checking in aa;
20223 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20224 initial revision: 1\.1
20225 done"
20226           echo "more money" >> aa
20227           dotest modes2-5 "${testcvs} -q ci -m add" \
20228 "Checking in aa;
20229 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20230 new revision: 1\.2; previous revision: 1\.1
20231 done"
20232
20233           # OK, here is the test.  The idea is to see what
20234           # No_Difference does if it can't open the file.
20235           # If we don't change the st_mtime, CVS doesn't even try to read
20236           # the file.  Note that some versions of "touch" require that we
20237           # do this while the file is still writable.
20238           touch aa
20239           chmod a= aa
20240           # Don't try this when permissions are broken, as with Cygwin.
20241           if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then :; else
20242             dotest_fail modes2-6 "${testcvs} -q update -r 1.1 aa" \
20243 "${PROG} \[update aborted\]: cannot open file aa for comparing: Permission denied" \
20244 "${PROG} \[update aborted\]: reading aa: Permission denied"
20245           fi
20246
20247           chmod u+rwx aa
20248           cd ../..
20249           rm -r 1
20250           rm -rf ${CVSROOT_DIRNAME}/first-dir
20251           ;;
20252
20253         modes3)
20254           # Repository permissions.  Particularly, what happens if we
20255           # can't read/write in the repository.
20256           # TODO: the case where we can access the repository, just not
20257           # the attic (may that one can remain a fatal error, seems less
20258           # useful for access control).
20259           mkdir 1; cd 1
20260           dotest modes3-1 "${testcvs} -q co -l ." ''
20261           mkdir first-dir second-dir
20262           dotest modes3-2 "${testcvs} add first-dir second-dir" \
20263 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
20264 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
20265           touch first-dir/aa second-dir/ab
20266           dotest modes3-3 "${testcvs} add first-dir/aa second-dir/ab" \
20267 "${PROG} add: scheduling file .first-dir/aa. for addition
20268 ${PROG} add: scheduling file .second-dir/ab. for addition
20269 ${PROG} add: use .${PROG} commit. to add these files permanently"
20270           dotest modes3-4 "${testcvs} -q ci -m add" \
20271 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
20272 done
20273 Checking in first-dir/aa;
20274 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20275 initial revision: 1\.1
20276 done
20277 RCS file: ${CVSROOT_DIRNAME}/second-dir/ab,v
20278 done
20279 Checking in second-dir/ab;
20280 ${CVSROOT_DIRNAME}/second-dir/ab,v  <--  ab
20281 initial revision: 1\.1
20282 done"
20283           if test -n "$remotehost"; then
20284             $CVS_RSH $remotehost "chmod a= ${CVSROOT_DIRNAME}/first-dir"
20285           else
20286             chmod a= ${CVSROOT_DIRNAME}/first-dir
20287           fi
20288           if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then
20289             # Avoid this test under Cygwin since permissions work differently
20290             # there.
20291             #
20292             # This test also gets avoided under Mac OS X since the system `ls'
20293             # is broken and exits with a 0 status despite the permission
20294             # denied error.
20295             if test -n "$remotehost"; then
20296               cygwin_hack=false
20297             else
20298               cygwin_hack=:
20299             fi
20300           else
20301             cygwin_hack=false
20302           fi
20303
20304           cd $TESTDIR/1
20305           if $cygwin_hack; then :; else
20306             dotest modes3-5 "${testcvs} update" \
20307 "${PROG} update: Updating \.
20308 ${PROG} update: Updating first-dir
20309 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
20310 ${PROG} update: skipping directory first-dir
20311 ${PROG} update: Updating second-dir"
20312           fi
20313
20314           # OK, I can see why one might say the above case could be a
20315           # fatal error, because normally users without access to first-dir
20316           # won't have it in their working directory.  But the next
20317           # one is more of a problem if it is fatal.
20318           #
20319           # The second text string below is for Cygwin again, and again it
20320           # should really be XFAIL under Cygwin, but for now deal with the
20321           # passing opendir by accepting the alternate string.
20322           rm -r first-dir
20323           dotest modes3-6 "${testcvs} update -dP" \
20324 "${PROG} update: Updating .
20325 ${PROG} update: Updating CVSROOT
20326 U ${DOTSTAR}
20327 ${PROG} update: Updating first-dir
20328 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
20329 ${PROG} update: skipping directory first-dir
20330 ${PROG} update: Updating second-dir" \
20331 "${PROG} update: Updating .
20332 ${PROG} update: Updating CVSROOT
20333 U ${DOTSTAR}
20334 ${PROG} update: Updating first-dir
20335 ${PROG} update: Updating second-dir"
20336
20337           cd ..
20338           rm -r 1
20339           chmod u+rwx ${CVSROOT_DIRNAME}/first-dir
20340           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
20341           ;;
20342
20343         stamps)
20344           # Test timestamps.
20345           mkdir 1; cd 1
20346           dotest stamps-1 "${testcvs} -q co -l ." ''
20347           mkdir first-dir
20348           dotest stamps-2 "${testcvs} add first-dir" \
20349 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20350           cd first-dir
20351           touch aa
20352           echo '$''Id$' >kw
20353           # Cygwin, *cough*, puts the year in the time column until the minute
20354           # is no longer the current minute.  Sleep 60 seconds to avoid this
20355           # problem.
20356           sleep 60
20357           ls -l aa >${TESTDIR}/1/stamp.aa.touch
20358           ls -l kw >${TESTDIR}/1/stamp.kw.touch
20359           # "sleep 1" would suffice if we could assume ls --full-time, but
20360           # that is as far as I know unique to GNU ls.  Is there some POSIX.2
20361           # way to get the timestamp of a file, including the seconds?
20362           sleep 60
20363           dotest stamps-3 "${testcvs} add aa kw" \
20364 "${PROG} add: scheduling file .aa. for addition
20365 ${PROG} add: scheduling file .kw. for addition
20366 ${PROG} add: use .${PROG} commit. to add these files permanently"
20367           ls -l aa >${TESTDIR}/1/stamp.aa.add
20368           ls -l kw >${TESTDIR}/1/stamp.kw.add
20369           # "cvs add" should not muck with the timestamp.
20370           dotest stamps-4aa \
20371 "cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
20372           dotest stamps-4kw \
20373 "cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
20374           sleep 60
20375           dotest stamps-5 "${testcvs} -q ci -m add" \
20376 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
20377 done
20378 Checking in aa;
20379 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20380 initial revision: 1\.1
20381 done
20382 RCS file: ${CVSROOT_DIRNAME}/first-dir/kw,v
20383 done
20384 Checking in kw;
20385 ${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
20386 initial revision: 1\.1
20387 done"
20388           # Cygwin, *cough*, puts the year in the time column until the minute
20389           # is no longer the current minute.  Sleep 60 seconds to avoid this
20390           # problem.
20391           sleep 60
20392           ls -l aa >${TESTDIR}/1/stamp.aa.ci
20393           ls -l kw >${TESTDIR}/1/stamp.kw.ci
20394           # If there are no keywords, "cvs ci" leaves the timestamp alone
20395           # If there are, it sets the timestamp to the date of the commit.
20396           # I'm not sure how logical this is, but it is intentional.
20397           # If we wanted to get fancy we would make sure the time as
20398           # reported in "cvs log kw" matched stamp.kw.ci.  But that would
20399           # be a lot of work.
20400           dotest stamps-6aa \
20401             "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
20402           if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
20403           then
20404             fail stamps-6kw
20405           else
20406             pass stamps-6kw
20407           fi
20408           cd ../..
20409           sleep 60
20410           mkdir 2
20411           cd 2
20412           dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
20413 U first-dir/kw"
20414           cd first-dir
20415           ls -l aa >${TESTDIR}/1/stamp.aa.get
20416           ls -l kw >${TESTDIR}/1/stamp.kw.get
20417           # On checkout, CVS should set the timestamp to the date that the
20418           # file was committed.  Could check that the time as reported in
20419           # "cvs log aa" matches stamp.aa.get, but that would be a lot of
20420           # work.
20421           if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
20422           then
20423             fail stamps-8aa
20424           else
20425             pass stamps-8aa
20426           fi
20427           dotest stamps-8kw \
20428             "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
20429
20430           # Now we want to see what "cvs update" does.
20431           sleep 60
20432           echo add a line >>aa
20433           echo add a line >>kw
20434           dotest stamps-9 "${testcvs} -q ci -m change-them" \
20435 "Checking in aa;
20436 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
20437 new revision: 1\.2; previous revision: 1\.1
20438 done
20439 Checking in kw;
20440 ${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
20441 new revision: 1\.2; previous revision: 1\.1
20442 done"
20443           
20444           # Cygwin, *cough*, puts the year in the time column until the minute
20445           # is no longer the current minute.  Sleep 60 seconds to avoid this
20446           # problem.
20447           sleep 60
20448           ls -l aa >${TESTDIR}/1/stamp.aa.ci2
20449           ls -l kw >${TESTDIR}/1/stamp.kw.ci2
20450           cd ../..
20451           cd 1/first-dir
20452           sleep 60
20453           dotest stamps-10 "${testcvs} -q update" '[UP] aa
20454 [UP] kw'
20455           # this doesn't serve any function other than being able to
20456           # look at it manually, as we have no machinery for dates being
20457           # newer or older than other dates.
20458           date >${TESTDIR}/1/stamp.debug.update
20459           ls -l aa >${TESTDIR}/1/stamp.aa.update
20460           ls -l kw >${TESTDIR}/1/stamp.kw.update
20461           # stamp.aa.update and stamp.kw.update should both be approximately
20462           # the same as stamp.debug.update.  Perhaps we could be testing
20463           # this in a more fancy fashion by "touch stamp.before" before
20464           # stamps-10, "touch stamp.after" after, and then using ls -t
20465           # to check them.  But for now we just make sure that the *.update
20466           # stamps differ from the *.ci2 ones.
20467           # As for the rationale, this is so that if one updates and gets
20468           # a new revision, then "make" will be sure to regard those files
20469           # as newer than .o files which may be sitting around.
20470           if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
20471              >/dev/null
20472           then
20473             fail stamps-11aa
20474           else
20475             pass stamps-11aa
20476           fi
20477           if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
20478              >/dev/null
20479           then
20480             fail stamps-11kw
20481           else
20482             pass stamps-11kw
20483           fi
20484
20485           cd ../..
20486
20487           if $keep; then
20488             echo Keeping ${TESTDIR} and exiting due to --keep
20489             exit 0
20490           fi
20491
20492           rm -r 1 2
20493           rm -rf ${CVSROOT_DIRNAME}/first-dir
20494           ;;
20495
20496         perms)
20497           # short cut around checking out and committing CVSROOT
20498           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20499           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
20500           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20501
20502           mkdir 1; cd 1
20503           dotest perms-1 "${testcvs} -q co -l ." ''
20504           mkdir first-dir
20505           dotest perms-2 "${testcvs} add first-dir" \
20506 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20507           cd first-dir
20508
20509           touch foo
20510           chmod 431 foo
20511           dotest perms-3 "${testcvs} add foo" \
20512 "${PROG} add: scheduling file .foo. for addition
20513 ${PROG} add: use .${PROG} commit. to add this file permanently"
20514           dotest perms-4 "${testcvs} -q ci -m ''" \
20515 "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo,v
20516 done
20517 Checking in foo;
20518 ${CVSROOT_DIRNAME}/first-dir/foo,v  <--  foo
20519 initial revision: 1\.1
20520 done"
20521
20522           # Test checking out files with different permissions.
20523           cd ../..
20524           mkdir 2; cd 2
20525           dotest perms-5 "${testcvs} -q co first-dir" "U first-dir/foo"
20526           cd first-dir
20527           if $remote; then :; else
20528             # PreservePermissions not yet implemented for remote.
20529             dotest perms-6 "ls -l foo" "-r---wx--x .* foo"
20530           fi
20531
20532           cd ../..
20533           rm -rf 1 2
20534           rm -rf ${CVSROOT_DIRNAME}/first-dir
20535
20536           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20537           touch ${CVSROOT_DIRNAME}/CVSROOT/config
20538           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20539           ;;
20540
20541         symlinks)
20542           # short cut around checking out and committing CVSROOT
20543           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20544           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
20545           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20546
20547           mkdir 1; cd 1
20548           dotest symlinks-1 "${testcvs} -q co -l ." ''
20549           mkdir first-dir
20550           dotest symlinks-2 "${testcvs} add first-dir" \
20551 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20552           cd first-dir
20553
20554           dotest symlinks-2.1 "ln -s ${TESTDIR}/fumble slink" ""
20555           dotest symlinks-3 "${testcvs} add slink" \
20556 "${PROG} add: scheduling file .slink. for addition
20557 ${PROG} add: use .${PROG} commit. to add this file permanently"
20558           if $remote; then
20559             # Remote doesn't implement PreservePermissions, and in its
20560             # absence the correct behavior is to follow the symlink.
20561             dotest_fail symlinks-4r "${testcvs} -q ci -m ''" \
20562 "${PROG} \[commit aborted\]: reading slink: No such file or directory"
20563           else
20564             dotest symlinks-4 "${testcvs} -q ci -m ''" \
20565 "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
20566 done
20567 Checking in slink;
20568 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
20569 initial revision: 1\.1
20570 done"
20571
20572             # Test checking out symbolic links.
20573             cd ../..
20574             mkdir 2; cd 2
20575             dotest symlinks-5 "${testcvs} -q co first-dir" "U first-dir/slink"
20576             cd first-dir
20577             dotest symlinks-6 "ls -l slink" \
20578 "l[rwx\-]* .* slink -> ${TESTDIR}/fumble"
20579           fi
20580
20581           cd ../..
20582           rm -rf 1 2
20583           rm -rf ${CVSROOT_DIRNAME}/first-dir
20584
20585           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20586           touch ${CVSROOT_DIRNAME}/CVSROOT/config
20587           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20588           ;;
20589
20590         symlinks2)
20591           # Symlinks in working directory without PreservePermissions.
20592           # Also see: symlinks: with PreservePermissions
20593           # rcslib-symlink-*: symlinks in repository.
20594           mkdir 1; cd 1
20595           dotest symlinks2-1 "${testcvs} -q co -l ." ''
20596           mkdir first-dir
20597           dotest symlinks2-2 "${testcvs} add first-dir" \
20598 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20599           cd first-dir
20600           echo nonsymlink > slink
20601           dotest symlinks2-3 "${testcvs} add slink" \
20602 "${PROG} add: scheduling file .slink. for addition
20603 ${PROG} add: use .${PROG} commit. to add this file permanently"
20604           dotest symlinks2-4 "${testcvs} -q ci -m ''" \
20605 "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
20606 done
20607 Checking in slink;
20608 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
20609 initial revision: 1\.1
20610 done"
20611           rm slink
20612           # Choose name cvslog.* so it is in default ignore list.
20613           echo second file >cvslog.file2
20614           dotest symlinks2-5 "ln -s cvslog.file2 slink" ""
20615           dotest symlinks2-6 "${testcvs} -q ci -m linkify" \
20616 "Checking in slink;
20617 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
20618 new revision: 1\.2; previous revision: 1\.1
20619 done"
20620           dotest symlinks2-7 "${testcvs} -q update -r 1.1 slink" "[UP] slink"
20621           dotest symlinks2-8 "cat slink" "nonsymlink"
20622           dotest symlinks2-9 "ls -l slink" "-[-rwx]* .* slink"
20623           cd ../..
20624
20625           rm -rf 1
20626           rm -rf ${CVSROOT_DIRNAME}/first-dir
20627           ;;
20628
20629         hardlinks)
20630           # short cut around checking out and committing CVSROOT
20631           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20632           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
20633           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20634
20635           mkdir 1; cd 1
20636           dotest hardlinks-1 "${testcvs} -q co -l ." ''
20637           mkdir first-dir
20638           dotest hardlinks-2 "${testcvs} add first-dir" \
20639 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20640           cd first-dir
20641
20642           # Make up some ugly filenames, to test that they get
20643           # encoded properly in the delta nodes.  Note that `dotest' screws
20644           # up if some arguments have embedded spaces.
20645           if touch aaaa
20646           then
20647             pass hardlinks-2.1
20648           else
20649             fail hardlinks-2.1
20650           fi
20651
20652           if ln aaaa b.b.b.b
20653           then
20654             pass hardlinks-2.2
20655           else
20656             fail hardlinks-2.2
20657           fi
20658
20659           if ln aaaa 'dd dd dd'
20660           then
20661             pass hardlinks-2.3
20662           else
20663             fail hardlinks-2.3
20664           fi
20665
20666           dotest hardlinks-3 "${testcvs} add [abd]*" \
20667 "${PROG} add: scheduling file .aaaa. for addition
20668 ${PROG} add: scheduling file .b\.b\.b\.b. for addition
20669 ${PROG} add: scheduling file .dd dd dd. for addition
20670 ${PROG} add: use .${PROG} commit. to add these files permanently"
20671           dotest hardlinks-4 "${testcvs} -q ci -m ''" \
20672 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaaa,v
20673 done
20674 Checking in aaaa;
20675 ${CVSROOT_DIRNAME}/first-dir/aaaa,v  <--  aaaa
20676 initial revision: 1\.1
20677 done
20678 RCS file: ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v
20679 done
20680 Checking in b\.b\.b\.b;
20681 ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v  <--  b\.b\.b\.b
20682 initial revision: 1\.1
20683 done
20684 RCS file: ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v
20685 done
20686 Checking in dd dd dd;
20687 ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v  <--  dd dd dd
20688 initial revision: 1\.1
20689 done"
20690           # Test checking out hardlinked files.
20691           cd ../..
20692           mkdir 2; cd 2
20693           if $remote; then
20694             # Remote does not implement PreservePermissions.
20695             dotest hardlinks-5r "${testcvs} -q co first-dir" \
20696 "U first-dir/aaaa
20697 U first-dir/b\.b\.b\.b
20698 U first-dir/dd dd dd"
20699             cd first-dir
20700             dotest hardlinks-6r "ls -l [abd]*" \
20701 "-[rwx\-]* *1 .* aaaa
20702 -[rwx\-]* *1 .* b\.b\.b\.b
20703 -[rwx\-]* *1 .* dd dd dd"
20704           else
20705             dotest hardlinks-5 "${testcvs} -q co first-dir" \
20706 "U first-dir/aaaa
20707 U first-dir/b\.b\.b\.b
20708 U first-dir/dd dd dd"
20709             cd first-dir
20710             # To make sure that the files are properly hardlinked, it
20711             # would be nice to do `ls -i' and make sure all the inodes
20712             # match.  But I think that would require expr to support
20713             # tagged regexps, and I don't think we can rely on that.
20714             # So instead we just see that each file has the right
20715             # number of links. -twp
20716             dotest hardlinks-6 "ls -l [abd]*" \
20717 "-[rwx\-]* *3 .* aaaa
20718 -[rwx\-]* *3 .* b\.b\.b\.b
20719 -[rwx\-]* *3 .* dd dd dd"
20720           fi
20721
20722           cd ../..
20723           rm -rf 1 2
20724           rm -rf ${CVSROOT_DIRNAME}/first-dir
20725
20726           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
20727           touch ${CVSROOT_DIRNAME}/CVSROOT/config
20728           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
20729           ;;
20730
20731         sticky)
20732           # More tests of sticky tags, particularly non-branch sticky tags.
20733           # See many tests (e.g. multibranch) for ordinary sticky tag
20734           # operations such as adding files on branches.
20735           # See "head" test for interaction between stick tags and HEAD.
20736           mkdir 1; cd 1
20737           dotest sticky-1 "${testcvs} -q co -l ." ''
20738           mkdir first-dir
20739           dotest sticky-2 "${testcvs} add first-dir" \
20740 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20741           cd first-dir
20742
20743           touch file1
20744           dotest sticky-3 "${testcvs} add file1" \
20745 "${PROG} add: scheduling file .file1. for addition
20746 ${PROG} add: use .${PROG} commit. to add this file permanently"
20747           dotest sticky-4 "${testcvs} -q ci -m add" \
20748 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20749 done
20750 Checking in file1;
20751 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20752 initial revision: 1\.1
20753 done"
20754           dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
20755           echo add a line >>file1
20756           dotest sticky-6 "${testcvs} -q ci -m modify" \
20757 "Checking in file1;
20758 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20759 new revision: 1\.2; previous revision: 1\.1
20760 done"
20761           dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
20762           dotest sticky-8 "cat file1" ''
20763           dotest sticky-9 "${testcvs} -q update" ''
20764           dotest sticky-10 "cat file1" ''
20765           touch file2
20766           dotest_fail sticky-11 "${testcvs} add file2" \
20767 "${PROG} add: cannot add file on non-branch tag tag1"
20768           dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
20769 ${QUESTION} file2" "${QUESTION} file2
20770 [UP] file1"
20771           dotest sticky-13 "${testcvs} add file2" \
20772 "${PROG} add: scheduling file .file2. for addition
20773 ${PROG} add: use .${PROG} commit. to add this file permanently"
20774           dotest sticky-14 "${testcvs} -q ci -m add" \
20775 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
20776 done
20777 Checking in file2;
20778 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
20779 initial revision: 1\.1
20780 done"
20781
20782           # Now back to tag1
20783           dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
20784 ${PROG} update: file2 is no longer in the repository"
20785
20786           rm file1
20787           dotest sticky-16 "${testcvs} rm file1" \
20788 "${PROG} remove: scheduling .file1. for removal
20789 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
20790           # Hmm, this command seems to silently remove the tag from
20791           # the file.  This appears to be intentional.
20792           # The silently part especially strikes me as odd, though.
20793           dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
20794           dotest sticky-18 "${testcvs} -q update -A" "U file1
20795 U file2"
20796           dotest sticky-19 "${testcvs} -q update -r tag1" \
20797 "${PROG} update: file1 is no longer in the repository
20798 ${PROG} update: file2 is no longer in the repository"
20799           dotest sticky-20 "${testcvs} -q update -A" "U file1
20800 U file2"
20801
20802           # Now try with a numeric revision.
20803           dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
20804           dotest sticky-22 "${testcvs} rm -f file1" \
20805 "${PROG} remove: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
20806           # The old behavior was that remove allowed this and then commit
20807           # gave an error, which was somewhat hard to clear.  I mean, you
20808           # could get into a long elaborate discussion of this being a
20809           # conflict and two ways to resolve it, but I don't really see
20810           # why CVS should have a concept of conflict that arises, not from
20811           # parallel development, but from CVS's own sticky tags.
20812
20813           # Ditto with a sticky date.
20814           #
20815           # I'm kind of surprised that the "file1 was lost" doesn't crop
20816           # up elsewhere in the testsuite.  It is a long-standing
20817           # discrepency between local and remote CVS and should probably
20818           # be cleaned up at some point.
20819           dotest sticky-23 "${testcvs} -q update -Dnow file1" \
20820 "${PROG} update: warning: file1 was lost
20821 U file1" "U file1"
20822           dotest sticky-24 "${testcvs} rm -f file1" \
20823 "${PROG} remove: cannot remove file .file1. which has a sticky date of .[0-9.]*."
20824
20825           dotest sticky-25 "${testcvs} -q update -A" \
20826 "${PROG} update: warning: file1 was lost
20827 U file1" "U file1"
20828
20829           cd ../..
20830           rm -r 1
20831           rm -rf ${CVSROOT_DIRNAME}/first-dir
20832           ;;
20833
20834         keyword)
20835           # Test keyword expansion.
20836           # Various other tests relate to our ability to correctly
20837           # set the keyword expansion mode.
20838           # "binfiles" tests "cvs admin -k".
20839           # "binfiles" and "binfiles2" test "cvs add -k".
20840           # "rdiff" tests "cvs co -k".
20841           # "binfiles" (and this test) test "cvs update -k".
20842           # "binwrap" tests setting the mode from wrappers.
20843           # "keyword2" tests "cvs update -kk -j" with text and binary files
20844           # I don't think any test is testing "cvs import -k".
20845           # Other keyword expansion tests:
20846           #   keywordlog - $Log.
20847           mkdir 1; cd 1
20848           dotest keyword-1 "${testcvs} -q co -l ." ''
20849           mkdir first-dir
20850           dotest keyword-2 "${testcvs} add first-dir" \
20851 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20852           cd first-dir
20853
20854           echo '$''Author$' > file1
20855           echo '$''Date$' >> file1
20856           echo '$''Header$' >> file1
20857           echo '$''Id$' >> file1
20858           echo '$''Locker$' >> file1
20859           echo '$''Name$' >> file1
20860           echo '$''RCSfile$' >> file1
20861           echo '$''Revision$' >> file1
20862           echo '$''Source$' >> file1
20863           echo '$''State$' >> file1
20864           echo '$''Nonkey$' >> file1
20865           # Omit the trailing dollar sign
20866           echo '$''Date' >> file1
20867           # Put two keywords on one line
20868           echo '$''State$' '$''State$' >> file1
20869           # Use a header for Log
20870           echo 'xx $''Log$' >> file1
20871
20872           dotest keyword-3 "${testcvs} add file1" \
20873 "${PROG} add: scheduling file .file1. for addition
20874 ${PROG} add: use .${PROG} commit. to add this file permanently"
20875           dotest keyword-4 "${testcvs} -q ci -m add" \
20876 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20877 done
20878 Checking in file1;
20879 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20880 initial revision: 1\.1
20881 done"
20882           dotest keyword-5 "cat file1" \
20883 '\$'"Author: ${username} "'\$'"
20884 "'\$'"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] "'\$'"
20885 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
20886 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
20887 "'\$'"Locker:  "'\$'"
20888 "'\$'"Name:  "'\$'"
20889 "'\$'"RCSfile: file1,v "'\$'"
20890 "'\$'"Revision: 1\.1 "'\$'"
20891 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
20892 "'\$'"State: Exp "'\$'"
20893 "'\$'"Nonkey"'\$'"
20894 "'\$'"Date
20895 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
20896 xx "'\$'"Log: file1,v "'\$'"
20897 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
20898 xx add
20899 xx"
20900
20901           # Use cvs admin to lock the RCS file in order to check -kkvl
20902           # vs. -kkv.  CVS does not normally lock RCS files, but some
20903           # people use cvs admin to enforce reserved checkouts.
20904           dotest keyword-6 "${testcvs} admin -l file1" \
20905 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20906 1\.1 locked
20907 done"
20908
20909           dotest keyword-7 "${testcvs} update -kkv file1" "U file1"
20910           dotest keyword-8 "cat file1" \
20911 '\$'"Author: ${username} "'\$'"
20912 "'\$'"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] "'\$'"
20913 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
20914 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
20915 "'\$'"Locker:  "'\$'"
20916 "'\$'"Name:  "'\$'"
20917 "'\$'"RCSfile: file1,v "'\$'"
20918 "'\$'"Revision: 1\.1 "'\$'"
20919 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
20920 "'\$'"State: Exp "'\$'"
20921 "'\$'"Nonkey"'\$'"
20922 "'\$'"Date
20923 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
20924 xx "'\$'"Log: file1,v "'\$'"
20925 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
20926 xx add
20927 xx"
20928
20929           dotest keyword-9 "${testcvs} update -kkvl file1" "U file1"
20930           dotest keyword-10 "cat file1" \
20931 '\$'"Author: ${username} "'\$'"
20932 "'\$'"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] "'\$'"
20933 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
20934 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
20935 "'\$'"Locker: ${username} "'\$'"
20936 "'\$'"Name:  "'\$'"
20937 "'\$'"RCSfile: file1,v "'\$'"
20938 "'\$'"Revision: 1\.1 "'\$'"
20939 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
20940 "'\$'"State: Exp "'\$'"
20941 "'\$'"Nonkey"'\$'"
20942 "'\$'"Date
20943 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
20944 xx "'\$'"Log: file1,v "'\$'"
20945 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
20946 xx add
20947 xx"
20948
20949           dotest keyword-11 "${testcvs} update -kk file1" "U file1"
20950           dotest keyword-12 "cat file1" \
20951 '\$'"Author"'\$'"
20952 "'\$'"Date"'\$'"
20953 "'\$'"Header"'\$'"
20954 "'\$'"Id"'\$'"
20955 "'\$'"Locker"'\$'"
20956 "'\$'"Name"'\$'"
20957 "'\$'"RCSfile"'\$'"
20958 "'\$'"Revision"'\$'"
20959 "'\$'"Source"'\$'"
20960 "'\$'"State"'\$'"
20961 "'\$'"Nonkey"'\$'"
20962 "'\$'"Date
20963 "'\$'"State"'\$'" "'\$'"State"'\$'"
20964 xx "'\$'"Log"'\$'"
20965 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
20966 xx add
20967 xx"
20968
20969           dotest keyword-13 "${testcvs} update -kv file1" "U file1"
20970           dotest keyword-14 "cat file1" \
20971 "${username}
20972 [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]
20973 ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
20974 file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
20975
20976
20977 file1,v
20978 1\.1
20979 ${CVSROOT_DIRNAME}/first-dir/file1,v
20980 Exp
20981 "'\$'"Nonkey"'\$'"
20982 "'\$'"Date
20983 Exp Exp
20984 xx file1,v
20985 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
20986 xx add
20987 xx"
20988
20989           dotest keyword-15 "${testcvs} update -ko file1" "U file1"
20990           dotest keyword-16 "cat file1" \
20991 '\$'"Author"'\$'"
20992 "'\$'"Date"'\$'"
20993 "'\$'"Header"'\$'"
20994 "'\$'"Id"'\$'"
20995 "'\$'"Locker"'\$'"
20996 "'\$'"Name"'\$'"
20997 "'\$'"RCSfile"'\$'"
20998 "'\$'"Revision"'\$'"
20999 "'\$'"Source"'\$'"
21000 "'\$'"State"'\$'"
21001 "'\$'"Nonkey"'\$'"
21002 "'\$'"Date
21003 "'\$'"State"'\$'" "'\$'"State"'\$'"
21004 xx "'\$'"Log"'\$'
21005
21006           # Test the Name keyword.  First go back to normal expansion.
21007
21008           dotest keyword-17 "${testcvs} update -A file1" "U file1"
21009
21010           echo '$''Name$' > file1
21011           dotest keyword-18 "${testcvs} ci -m modify file1" \
21012 "Checking in file1;
21013 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21014 new revision: 1\.2; previous revision: 1\.1
21015 done"
21016           dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
21017           echo "change" >> file1
21018           dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
21019 "Checking in file1;
21020 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21021 new revision: 1\.3; previous revision: 1\.2
21022 done"
21023           # FIXCVS - These unpatchable files are happening because the tag
21024           # associated with the current base version of the file in the
21025           # sandbox is not available in these cases.  See the note in the
21026           # patch_file function in update.c.
21027           dotest keyword-21 "${testcvs} -q update -r tag1" "U file1" \
21028 "P file1
21029 ${PROG} update: checksum failure after patch to \./file1; will refetch
21030 ${PROG} client: refetching unpatchable files
21031 ${PROG} update: warning: file1 was lost
21032 U file1"
21033
21034           dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$'
21035
21036           if $remote; then
21037             # Like serverpatch-8.  Not sure there is anything much we
21038             # can or should do about this.
21039             dotest keyword-23r "${testcvs} update -A file1" "P file1
21040 ${PROG} update: checksum failure after patch to \./file1; will refetch
21041 ${PROG} client: refetching unpatchable files
21042 ${PROG} update: warning: file1 was lost
21043 U file1"
21044           else
21045             dotest keyword-23 "${testcvs} update -A file1" "[UP] file1"
21046           fi
21047           dotest keyword-24 "cat file1" '\$'"Name:  "'\$'"
21048 change"
21049
21050           cd ../..
21051           rm -r 1
21052           rm -rf ${CVSROOT_DIRNAME}/first-dir
21053           ;;
21054
21055         keywordlog)
21056           # Test the Log keyword.
21057           mkdir 1; cd 1
21058           dotest keywordlog-1 "${testcvs} -q co -l ." ''
21059           mkdir first-dir
21060           dotest keywordlog-2 "${testcvs} add first-dir" \
21061 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21062           cd first-dir
21063           echo initial >file1
21064           dotest keywordlog-3 "${testcvs} add file1" \
21065 "${PROG} add: scheduling file .file1. for addition
21066 ${PROG} add: use .${PROG} commit. to add this file permanently"
21067
21068           # See "rmadd" for a list of other tests of cvs ci -r.
21069           dotest keywordlog-4 "${testcvs} -q ci -r 1.3 -m add file1" \
21070 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21071 done
21072 Checking in file1;
21073 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21074 initial revision: 1\.3
21075 done"
21076
21077           cd ../..
21078           mkdir 2; cd 2
21079           dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
21080           cd ../1/first-dir
21081
21082           echo 'xx $''Log$' >> file1
21083           cat >${TESTDIR}/comment.tmp <<EOF
21084 First log line
21085 Second log line
21086 EOF
21087           # As with rmadd-25, "cvs ci -r" sets a sticky tag.
21088           dotest_fail keywordlog-4b \
21089 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
21090 "${PROG} commit: sticky tag .1\.3. for file .file1. is not a branch
21091 ${PROG} \[commit aborted\]: correct above errors first!"
21092           dotest keywordlog-4c "${testcvs} -q update -A" "M file1"
21093
21094           dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
21095 "Checking in file1;
21096 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21097 new revision: 1\.4; previous revision: 1\.3
21098 done"
21099           rm -f ${TESTDIR}/comment.tmp
21100           dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
21101           dotest keywordlog-7 "cat file1" \
21102 "initial
21103 xx "'\$'"Log: file1,v "'\$'"
21104 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21105 xx First log line
21106 xx Second log line
21107 xx"
21108
21109           cd ../../2/first-dir
21110           dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
21111           dotest keywordlog-9 "cat file1" \
21112 "initial
21113 xx "'\$'"Log: file1,v "'\$'"
21114 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21115 xx First log line
21116 xx Second log line
21117 xx"
21118           cd ../../1/first-dir
21119
21120           echo "change" >> file1
21121           dotest keywordlog-10 "${testcvs} ci -m modify file1" \
21122 "Checking in file1;
21123 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21124 new revision: 1\.5; previous revision: 1\.4
21125 done"
21126           dotest keywordlog-11 "cat file1" \
21127 "initial
21128 xx "'\$'"Log: file1,v "'\$'"
21129 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
21130 xx modify
21131 xx
21132 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21133 xx First log line
21134 xx Second log line
21135 xx
21136 change"
21137
21138           cd ../../2/first-dir
21139           dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
21140           dotest keywordlog-13 "cat file1" \
21141 "initial
21142 xx "'\$'"Log: file1,v "'\$'"
21143 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
21144 xx modify
21145 xx
21146 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21147 xx First log line
21148 xx Second log line
21149 xx
21150 change"
21151
21152           cd ../../1/first-dir
21153           dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
21154           echo br-change >>file1
21155           dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
21156 "Checking in file1;
21157 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21158 new revision: 1\.4\.2\.1; previous revision: 1\.4
21159 done"
21160           dotest keywordlog-16 "cat file1" \
21161 "initial
21162 xx "'\$'"Log: file1,v "'\$'"
21163 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
21164 xx br-modify
21165 xx
21166 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21167 xx First log line
21168 xx Second log line
21169 xx
21170 br-change"
21171           cd ../../2/first-dir
21172           dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
21173           dotest keywordlog-18 "cat file1" \
21174 "initial
21175 xx "'\$'"Log: file1,v "'\$'"
21176 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
21177 xx br-modify
21178 xx
21179 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21180 xx First log line
21181 xx Second log line
21182 xx
21183 br-change"
21184           cd ../..
21185           dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
21186 "initial
21187 xx "'\$'"Log: file1,v "'\$'"
21188 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
21189 xx br-modify
21190 xx
21191 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21192 xx First log line
21193 xx Second log line
21194 xx
21195 br-change"
21196           dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
21197 "initial
21198 xx "'\$'"Log: file1,v "'\$'"
21199 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
21200 xx modify
21201 xx
21202 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21203 xx First log line
21204 xx Second log line
21205 xx
21206 change"
21207           dotest keywordlog-21 "${testcvs} -q co -p -r 1.4 first-dir/file1" \
21208 "initial
21209 xx "'\$'"Log: file1,v "'\$'"
21210 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21211 xx First log line
21212 xx Second log line
21213 xx"
21214
21215           cd 2/first-dir
21216           # OK, the basic rule for keyword expansion is that it
21217           # happens on checkout.  And the rule for annotate is that
21218           # it annotates a checked-in revision, rather than a checked-out
21219           # file.  So, although it is kind of confusing that the latest
21220           # revision does not appear in the annotated output, and the
21221           # annotated output does not quite match what you'd get with
21222           # update or checkout, the behavior is more or less logical.
21223           # The same issue occurs with annotate and other keywords,
21224           # I think, although it is particularly noticeable for $Log.
21225           dotest keywordlog-22 "${testcvs} ann -r br file1" \
21226 "
21227 Annotations for file1
21228 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21229 1\.3          (${username} *[0-9a-zA-Z-]*): initial
21230 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
21231 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21232 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx First log line
21233 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx Second log line
21234 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx
21235 1\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): br-change"
21236           dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \
21237 "
21238 Annotations for file1
21239 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21240 1\.3          (${username} *[0-9a-zA-Z-]*): initial
21241 1\.5          (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
21242 1\.5          (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21243 1\.5          (${username} *[0-9a-zA-Z-]*): xx First log line
21244 1\.5          (${username} *[0-9a-zA-Z-]*): xx Second log line
21245 1\.5          (${username} *[0-9a-zA-Z-]*): xx
21246 1\.5          (${username} *[0-9a-zA-Z-]*): change"
21247           cd ../..
21248
21249           #
21250           # test the operation of 'admin -o' in conjunction with keywords
21251           # (especially Log - this used to munge the RCS file for all time)
21252           #
21253
21254           dotest keywordlog-24 \
21255 "${testcvs} admin -oHEAD 1/first-dir/file1" \
21256 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21257 deleting revision 1\.5
21258 done"
21259
21260           dotest keywordlog-25 \
21261 "${testcvs} -q co -p first-dir/file1" \
21262 "initial
21263 xx "'\$'"Log: file1,v "'\$'"
21264 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
21265 xx First log line
21266 xx Second log line
21267 xx"
21268
21269           if $keep; then
21270             echo Keeping ${TESTDIR} and exiting due to --keep
21271             exit 0
21272           fi
21273
21274           rm -r 1 2
21275           rm -rf ${CVSROOT_DIRNAME}/first-dir
21276           ;;
21277
21278         keywordname)
21279           # Test the Name keyword.
21280           # See the keyword test for a descriptions of some other tests that
21281           # test keyword expansion modes.
21282           mkdir keywordname; cd keywordname
21283           mkdir 1; cd 1
21284           dotest keywordname-init-1 "${testcvs} -q co -l ." ''
21285           mkdir first-dir
21286           dotest keywordname-init-2 "${testcvs} add first-dir" \
21287 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21288           cd first-dir
21289
21290           echo '$'"Name$" >file1
21291           echo '$'"Name$" >file2
21292           dotest keywordname-init-3 "${testcvs} add file1 file2" \
21293 "${PROG} add: scheduling file .file1. for addition
21294 ${PROG} add: scheduling file .file2. for addition
21295 ${PROG} add: use .${PROG} commit. to add these files permanently"
21296
21297           # See "rmadd" for a list of other tests of cvs ci -r.
21298           dotest keywordname-init-4 "${testcvs} -q ci -r 1.3 -m add" \
21299 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21300 done
21301 Checking in file1;
21302 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21303 initial revision: 1\.3
21304 done
21305 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
21306 done
21307 Checking in file2;
21308 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
21309 initial revision: 1\.3
21310 done"
21311
21312           dotest keywordname-init-6 "${testcvs} -q up -A"
21313           dotest keywordname-init-7 "${testcvs} -q tag -b br" \
21314 "T file1
21315 T file2"
21316
21317           echo new data >>file1
21318           dotest keywordname-init-8 "${testcvs} -q ci -mchange" \
21319 "Checking in file1;
21320 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21321 new revision: 1\.4; previous revision: 1\.3
21322 done"
21323
21324           # First check out a branch.
21325           #
21326           # There used to be a bug where static tags would be substituted for
21327           # Name keywords but not branch tags.
21328           #
21329           # FIXCVS - BUG
21330           # Why shouldn't the non-update case not cause a substitution?
21331           # An update -kk or -A will unsub and sub keywords without updates
21332           # being required.
21333           # FIXCVS - see note above keyword-21
21334           dotest keywordname-update-1 "${testcvs} -q up -rbr" "U file1" \
21335 "P file1
21336 ${PROG} update: checksum failure after patch to \./file1; will refetch
21337 ${PROG} client: refetching unpatchable files
21338 ${PROG} update: warning: file1 was lost
21339 U file1"
21340           dotest keywordname-update-2 "cat file1" '\$'"Name: br "'\$'
21341           dotest keywordname-update-3 "cat file2" '\$'"Name:  "'\$'
21342
21343           # Now verify that updating to the trunk leaves no substitution for
21344           # $Name
21345           dotest keywordname-update-4 "${testcvs} -q tag firsttag" \
21346 "T file1
21347 T file2"
21348           # FIXCVS - see note above keyword-21
21349           dotest keywordname-update-5 "${testcvs} -q up -A" "U file1" \
21350 "P file1
21351 ${PROG} update: checksum failure after patch to \./file1; will refetch
21352 ${PROG} client: refetching unpatchable files
21353 ${PROG} update: warning: file1 was lost
21354 U file1"
21355           dotest keywordname-update-6 "cat file1" \
21356 '\$'"Name:  "'\$'"
21357 new data"
21358           dotest keywordname-update-7 "cat file2" '\$'"Name:  "'\$'
21359
21360           # But updating to a static tag does cause a substitution
21361           # FIXCVS - see same note above
21362           dotest keywordname-update-8 "${testcvs} -q up -rfirsttag" "U file1" \
21363 "P file1
21364 ${PROG} update: checksum failure after patch to \./file1; will refetch
21365 ${PROG} client: refetching unpatchable files
21366 ${PROG} update: warning: file1 was lost
21367 U file1"
21368           dotest keywordname-update-9 "cat file1" '\$'"Name: firsttag "'\$'
21369           dotest keywordname-update-10 "cat file2" '\$'"Name:  "'\$'
21370
21371           # And reverify the trunk update when the change is actually removed.
21372           dotest keywordname-update-11 "${testcvs} -q up -A" "[UP] file1" \
21373 "P file1
21374 ${PROG} update: checksum failure after patch to ./file1; will refetch
21375 ${PROG} client: refetching unpatchable files
21376 ${PROG} update: warning: file1 was lost
21377 U file1"
21378           dotest keywordname-update-12 "cat file1" \
21379 '\$'"Name:  "'\$'"
21380 new data"
21381           dotest keywordname-update-13 "cat file2" '\$'"Name:  "'\$'
21382
21383           cd ../..
21384
21385           # now verify that a fresh checkout substitutes all the $Name fields
21386           mkdir 2; cd 2
21387           dotest keywordname-checkout-1 \
21388 "${testcvs} -q co -rfirsttag first-dir" \
21389 "U first-dir/file1
21390 U first-dir/file2"
21391           cd first-dir
21392           dotest keywordname-checkout-2 "cat file1" '\$'"Name: firsttag "'\$'
21393           dotest keywordname-checkout-3 "cat file2" '\$'"Name: firsttag "'\$'
21394
21395           cd ../..
21396
21397           if $keep; then
21398             echo Keeping ${TESTDIR} and exiting due to --keep
21399             exit 0
21400           fi
21401
21402           cd ..
21403           rm -r keywordname
21404           rm -rf ${CVSROOT_DIRNAME}/first-dir
21405           ;;
21406
21407         keyword2)
21408           # Test merging on files with keywords:
21409           #   without -kk
21410           #   with -kk
21411           #     on text files
21412           #     on binary files
21413           # Note:  This test assumes that CVS has already passed the binfiles
21414           #    test sequence
21415           # Note2:  We are testing positive on binary corruption here
21416           #    we probably really DON'T want to 'cvs update -kk' a binary file...
21417           mkdir 1; cd 1
21418           dotest keyword2-1 "${testcvs} -q co -l ." ''
21419           mkdir first-dir
21420           dotest keyword2-2 "${testcvs} add first-dir" \
21421 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21422           cd first-dir
21423
21424           echo '$''Revision$' >> file1
21425           echo "I" >>file1
21426           echo "like" >>file1
21427           echo "long" >>file1
21428           echo "files!" >>file1
21429           echo "" >>file1
21430           echo "a test line for our times" >>file1
21431           echo "" >>file1
21432           echo "They" >>file1
21433           echo "make" >>file1
21434           echo "diff" >>file1
21435           echo "look like it" >>file1
21436           echo "did a much better" >>file1
21437           echo "job." >>file1
21438           dotest keyword2-3 "${testcvs} add file1" \
21439 "${PROG} add: scheduling file .file1. for addition
21440 ${PROG} add: use .${PROG} commit. to add this file permanently"
21441
21442           ${AWK} 'BEGIN { printf "%c%c%c%sRevision: 1.1 $@%c%c", \
21443             2, 10, 137, "$", 13, 10 }' \
21444             </dev/null | ${TR} '@' '\000' >../binfile.dat
21445           cp ../binfile.dat .
21446           dotest keyword2-5 "${testcvs} add -kb binfile.dat" \
21447 "${PROG} add: scheduling file .binfile\.dat. for addition
21448 ${PROG} add: use .${PROG} commit. to add this file permanently"
21449
21450           dotest keyword2-6 "${testcvs} -q ci -m add" \
21451 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
21452 done
21453 Checking in binfile\.dat;
21454 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
21455 initial revision: 1\.1
21456 done
21457 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21458 done
21459 Checking in file1;
21460 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21461 initial revision: 1\.1
21462 done"
21463
21464           dotest keyword2-7 "${testcvs} -q tag -b branch" \
21465 "T binfile\.dat
21466 T file1"
21467
21468           sed -e 's/our/the best of and the worst of/' file1 >f; mv f file1
21469           dotest keyword2-8 "${testcvs} -q ci -m change" \
21470 "Checking in file1;
21471 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21472 new revision: 1\.2; previous revision: 1\.1
21473 done"
21474
21475           dotest keyword2-9 "${testcvs} -q update -r branch" '[UP] file1'
21476
21477           echo "what else do we have?" >>file1
21478           dotest keyword2-10 "${testcvs} -q ci -m change" \
21479 "Checking in file1;
21480 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21481 new revision: 1\.1\.2\.1; previous revision: 1\.1
21482 done"
21483
21484           # Okay, first a conflict in file1 - should be okay with binfile.dat
21485           dotest keyword2-11 "${testcvs} -q update -A -j branch" \
21486 "U file1
21487 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21488 retrieving revision 1\.1
21489 retrieving revision 1\.1\.2\.1
21490 Merging differences between 1\.1 and 1\.1\.2\.1 into file1
21491 rcsmerge: warning: conflicts during merge"
21492
21493           dotest_fail keyword2-12 "${testcvs} diff file1" \
21494 "Index: file1
21495 ===================================================================
21496 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21497 retrieving revision 1\.2
21498 diff -r1\.2 file1
21499 0a1
21500 > <<<<<<< file1
21501 1a3,5
21502 > =======
21503 > \\\$""Revision: 1\.1\.2\.1 \\\$
21504 > >>>>>>> 1\.1\.2\.1
21505 14a19
21506 > what else do we have${QUESTION}"
21507
21508           # Here's the problem... shouldn't -kk a binary file...
21509           rm file1
21510           dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \
21511 "U binfile\.dat
21512 ${PROG} update: warning: file1 was lost
21513 U file1
21514 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21515 retrieving revision 1\.1
21516 retrieving revision 1\.1\.2\.1
21517 Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
21518
21519           # binfile won't get checked in, but it is now corrupt and could
21520           # have been checked in if it had changed on the branch...
21521           dotest keyword2-14 "${testcvs} -q ci -m change" \
21522 "Checking in file1;
21523 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21524 new revision: 1\.3; previous revision: 1\.2
21525 done"
21526
21527           dotest_fail keyword2-15 "cmp binfile.dat ../binfile.dat" \
21528 "binfile\.dat \.\./binfile\.dat differ: char 13, line 2"
21529
21530           # Okay, restore everything and make CVS try and merge a binary file...
21531           dotest keyword2-16 "${testcvs} -q update -A" \
21532 "[UP] binfile.dat
21533 [UP] file1"
21534           dotest keyword2-17 "${testcvs} -q tag -b branch2" \
21535 "T binfile\.dat
21536 T file1"
21537           dotest keyword2-18 "${testcvs} -q update -r branch2" ''
21538
21539           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
21540             </dev/null | ${TR} '@' '\000' >>binfile.dat
21541           dotest keyword2-19 "${testcvs} -q ci -m badbadbad" \
21542 "Checking in binfile\.dat;
21543 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
21544 new revision: 1\.1\.4\.1; previous revision: 1\.1
21545 done"
21546           dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \
21547 "U binfile\.dat
21548 RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
21549 retrieving revision 1\.1
21550 retrieving revision 1\.1\.4\.1
21551 Merging differences between 1\.1 and 1\.1\.4\.1 into binfile\.dat
21552 U file1"
21553
21554           # Yep, it's broke, 'cept for that gal in Hodunk who uses -kk
21555           # so that some files only merge when she says so.  Time to clean up...
21556           cd ../..
21557           rm -r 1
21558           rm -rf ${CVSROOT_DIRNAME}/first-dir
21559           ;;
21560
21561         head)
21562           # Testing handling of the HEAD special tag.
21563           # There are many cases involving added and removed files
21564           # which we don't yet try to deal with.
21565           # TODO: We also could be paying much closer attention to
21566           # "head of the trunk" versus "head of the default branch".
21567           # That is what "cvs import" is doing here (but I didn't really
21568           # fully follow through on writing the tests for that case).
21569           mkdir imp-dir
21570           cd imp-dir
21571           echo 'imported contents' >file1
21572           # It may seem like we don't do much with file2, but do note that
21573           # the "cvs diff" invocations do also diff file2 (and come up empty).
21574           echo 'imported contents' >file2
21575           dotest_sort head-1 "${testcvs} import -m add first-dir tag1 tag2" \
21576 "
21577
21578 N first-dir/file1
21579 N first-dir/file2
21580 No conflicts created by this import"
21581           cd ..
21582           rm -r imp-dir
21583           mkdir 1
21584           cd 1
21585           dotest head-2 "${testcvs} -q co first-dir" \
21586 "U first-dir/file1
21587 U first-dir/file2"
21588           cd first-dir
21589           echo 'add a line on trunk' >> file1
21590           dotest head-3 "${testcvs} -q ci -m modify" \
21591 "Checking in file1;
21592 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21593 new revision: 1\.2; previous revision: 1\.1
21594 done"
21595           dotest head-4 "${testcvs} -q tag trunktag" "T file1
21596 T file2"
21597           echo 'add a line on trunk after trunktag' >> file1
21598           dotest head-5 "${testcvs} -q ci -m modify" \
21599 "Checking in file1;
21600 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21601 new revision: 1\.3; previous revision: 1\.2
21602 done"
21603           dotest head-6 "${testcvs} -q tag -b br1" "T file1
21604 T file2"
21605           dotest head-7 "${testcvs} -q update -r br1" ""
21606           echo 'modify on branch' >>file1
21607           dotest head-8 "${testcvs} -q ci -m modify" \
21608 "Checking in file1;
21609 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21610 new revision: 1\.3\.2\.1; previous revision: 1\.3
21611 done"
21612           dotest head-9 "${testcvs} -q tag brtag" "T file1
21613 T file2"
21614           echo 'modify on branch after brtag' >>file1
21615           dotest head-10 "${testcvs} -q ci -m modify" \
21616 "Checking in file1;
21617 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21618 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
21619 done"
21620           # With no sticky tags, HEAD is the head of the trunk.
21621           dotest head-trunk-setup "${testcvs} -q update -A" "[UP] file1"
21622           dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
21623 "imported contents
21624 add a line on trunk
21625 add a line on trunk after trunktag"
21626           # and diff thinks so too.  Case (a) from the comment in
21627           # cvs.texinfo (Common options).
21628           dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
21629 "Index: file1
21630 ===================================================================
21631 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21632 retrieving revision 1\.3
21633 retrieving revision 1\.3\.2\.2
21634 diff -c -r1\.3 -r1\.3\.2\.2
21635 \*\*\* file1    ${RFCDATE}      1\.3
21636 --- file1       ${RFCDATE}      1\.3\.2\.2
21637 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21638 \*\*\* 1,3 \*\*\*\*
21639 --- 1,5 ----
21640   imported contents
21641   add a line on trunk
21642   add a line on trunk after trunktag
21643 ${PLUS} modify on branch
21644 ${PLUS} modify on branch after brtag"
21645
21646           # With a branch sticky tag, HEAD is the head of the trunk.
21647           dotest head-br1-setup "${testcvs} -q update -r br1" "[UP] file1"
21648           dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
21649 "imported contents
21650 add a line on trunk
21651 add a line on trunk after trunktag"
21652           # But diff thinks that HEAD is "br1".  Case (b) from cvs.texinfo.
21653           # Probably people are relying on it.
21654           dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
21655
21656           # With a nonbranch sticky tag on a branch,
21657           # HEAD is the head of the trunk
21658           dotest head-brtag-setup "${testcvs} -q update -r brtag" "[UP] file1"
21659           dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
21660 "imported contents
21661 add a line on trunk
21662 add a line on trunk after trunktag"
21663
21664           # CVS 1.9 and older thought that HEAD is "brtag" (this was
21665           # noted as "strange, maybe accidental").  But "br1" makes a
21666           # whole lot more sense.
21667           dotest head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
21668
21669           # With a nonbranch sticky tag on the trunk, HEAD is the head
21670           # of the trunk, I think.
21671           dotest head-trunktag-setup "${testcvs} -q update -r trunktag" \
21672 "[UP] file1"
21673           dotest head-trunktag-check "cat file1" "imported contents
21674 add a line on trunk"
21675           dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
21676 "imported contents
21677 add a line on trunk
21678 add a line on trunk after trunktag"
21679           # Like head-brtag-diff, there is a non-branch sticky tag.
21680           dotest_fail head-trunktag-diff \
21681             "${testcvs} -q diff -c -r HEAD -r br1" \
21682 "Index: file1
21683 ===================================================================
21684 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21685 retrieving revision 1\.3
21686 retrieving revision 1\.3\.2\.2
21687 diff -c -r1\.3 -r1\.3\.2\.2
21688 \*\*\* file1    ${RFCDATE}      1\.3
21689 --- file1       ${RFCDATE}      1\.3\.2\.2
21690 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21691 \*\*\* 1,3 \*\*\*\*
21692 --- 1,5 ----
21693   imported contents
21694   add a line on trunk
21695   add a line on trunk after trunktag
21696 ${PLUS} modify on branch
21697 ${PLUS} modify on branch after brtag"
21698
21699           # Also might test what happens if we setup with update -r
21700           # HEAD.  In general, if sticky tags matter, does the
21701           # behavior of "update -r <foo>" (without -p) depend on the
21702           # sticky tags before or after the update?
21703
21704           # Note that we are testing both the case where this deletes
21705           # a revision (file1) and the case where it does not (file2)
21706           dotest_fail head-o0a "${testcvs} admin -o ::br1" \
21707 "${PROG} admin: Administrating \.
21708 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21709 ${PROG} admin: cannot remove revision 1\.3\.2\.1 because it has tags
21710 ${PROG} admin: RCS file for .file1. not modified\.
21711 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
21712 done"
21713           dotest head-o0b "${testcvs} tag -d brtag" \
21714 "${PROG} tag: Untagging \.
21715 D file1
21716 D file2"
21717           dotest head-o1 "${testcvs} admin -o ::br1" \
21718 "${PROG} admin: Administrating \.
21719 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21720 deleting revision 1\.3\.2\.1
21721 done
21722 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
21723 done"
21724           cd ../..
21725           rm -r 1
21726           rm -rf ${CVSROOT_DIRNAME}/first-dir
21727           ;;
21728
21729         tagdate)
21730           # Test combining -r and -D.
21731           #
21732           # Note that this is not a complete test.  It relies on the fact
21733           # that update, checkout and export have a LOT of shared code.
21734           # Notice:
21735           #     1)  checkout is never tested at all with -r -D
21736           #     2)  update never uses an argument to '-D' besides 'now'
21737           #             (this test does not provide enough data to prove
21738           #             that 'cvs update' with both a '-r' and a '-D'
21739           #             specified does not ignore '-D': a 'cvs up
21740           #             -r<branch> -Dnow' and a 'cvs up -r<branch>'
21741           #             should specify the same file revision).
21742           #     3)  export uses '-r<branch> -D<when there was a different
21743           #             revision>', hopefully completing this behavior test
21744           #             for checkout and update as well.
21745           #
21746           mkdir 1; cd 1
21747           dotest tagdate-1 "${testcvs} -q co -l ." ''
21748           mkdir first-dir
21749           dotest tagdate-2 "${testcvs} add first-dir" \
21750 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21751           cd first-dir
21752
21753           echo trunk-1 >file1
21754           dotest tagdate-3 "${testcvs} add file1" \
21755 "${PROG} add: scheduling file .file1. for addition
21756 ${PROG} add: use .${PROG} commit. to add this file permanently"
21757           dotest tagdate-4 "${testcvs} -q ci -m add" \
21758 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21759 done
21760 Checking in file1;
21761 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21762 initial revision: 1\.1
21763 done"
21764           dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
21765           dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
21766           echo trunk-2 >file1
21767           dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
21768 "Checking in file1;
21769 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21770 new revision: 1\.2; previous revision: 1\.1
21771 done"
21772           # We are testing -r -D where br1 is a (magic) branch without
21773           # any revisions.  First the case where br2 doesn't have any
21774           # revisions either:
21775           dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
21776           dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
21777           echo br2-1 >file1
21778           dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
21779 "Checking in file1;
21780 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21781 new revision: 1\.1\.4\.1; previous revision: 1\.1
21782 done"
21783
21784           # Then the case where br2 does have revisions:
21785           dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
21786
21787           # For some reason, doing this on a branch seems to be relevant.
21788           dotest_fail tagdate-12 "${testcvs} -q update -j:yesterday" \
21789 "${PROG} \[update aborted\]: argument to join may not contain a date specifier without a tag"
21790           # And check export
21791
21792           # Wish some shorter sleep interval would suffice, but I need to
21793           # guarantee that the point in time specified by the argument to -D
21794           # in tagdate-14 and tagdate-16
21795           # falls in the space of time between commits to br2 and I
21796           # figure 60 seconds is probably a large enough range to
21797           # account for most network file system delays and such...
21798           # as it stands, it takes between 1 and 2 seconds between
21799           # calling CVS on my machine and the -D argument being used to
21800           # recall the file revision and this timing will certainly vary
21801           # by several seconds between machines - dependant on CPUspeeds,
21802           # I/O speeds, load, etc.
21803           sleep 60
21804
21805           echo br2-2 >file1
21806           dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \
21807 "Checking in file1;
21808 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21809 new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1
21810 done"
21811           cd ../..
21812           mkdir 2; cd 
21813           dotest tagdate-14 "${testcvs} -q export -r br2 -D'1 minute ago' first-dir" \
21814 "[UP] first-dir/file1"
21815           dotest tagdate-15 "cat first-dir/file1" "br2-1"
21816
21817           # Now for annotate
21818           cd ../1/first-dir
21819           dotest tagdate-16 "${testcvs} annotate -rbr2 -D'1 minute ago'" \
21820 "
21821 Annotations for file1
21822 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21823 1\.1\.4\.1      (${username} *[0-9a-zA-Z-]*): br2-1"
21824
21825           dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \
21826 "
21827 Annotations for file1
21828 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
21829 1\.1\.4\.2      (${username} *[0-9a-zA-Z-]*): br2-2"
21830
21831           if $keep; then
21832             echo Keeping ${TESTDIR} and exiting due to --keep
21833             exit 0
21834           fi
21835
21836           cd ../..
21837           rm -r 1 2
21838           rm -rf ${CVSROOT_DIRNAME}/first-dir
21839           ;;
21840
21841         multibranch2)
21842           # Commit the first delta on branch A when there is an older
21843           # branch, B, that already has a delta.  A and B come from the
21844           # same branch point.  Then verify that branches A and B are
21845           # in the right order.
21846           mkdir 1; cd 1
21847           dotest multibranch2-1 "${testcvs} -q co -l ." ''
21848           mkdir first-dir
21849           dotest multibranch2-2 "${testcvs} add first-dir" \
21850 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21851           cd first-dir
21852
21853           echo trunk-1 >file1
21854           echo trunk-1 >file2
21855           dotest multibranch2-3 "${testcvs} add file1 file2" \
21856 "${PROG} add: scheduling file .file1. for addition
21857 ${PROG} add: scheduling file .file2. for addition
21858 ${PROG} add: use .${PROG} commit. to add these files permanently"
21859           dotest multibranch2-4 "${testcvs} -q ci -m add" \
21860 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21861 done
21862 Checking in file1;
21863 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21864 initial revision: 1\.1
21865 done
21866 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
21867 done
21868 Checking in file2;
21869 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
21870 initial revision: 1\.1
21871 done"
21872           dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1
21873 T file2"
21874           dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1
21875 T file2"
21876
21877           dotest multibranch2-7 "${testcvs} -q update -r B" ''
21878           echo branch-B >file1
21879           echo branch-B >file2
21880           dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
21881 "Checking in file1;
21882 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21883 new revision: 1\.1\.4\.1; previous revision: 1\.1
21884 done
21885 Checking in file2;
21886 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
21887 new revision: 1\.1\.4\.1; previous revision: 1\.1
21888 done"
21889
21890           dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1
21891 [UP] file2'
21892           echo branch-A >file1
21893           # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
21894           dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
21895 "Checking in file1;
21896 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21897 new revision: 1\.1\.2\.1; previous revision: 1\.1
21898 done"
21899
21900           dotest multibranch2-11 "${testcvs} -q log file1" \
21901 "
21902 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21903 Working file: file1
21904 head: 1\.1
21905 branch:
21906 locks: strict
21907 access list:
21908 symbolic names:
21909         B: 1\.1\.0\.4
21910         A: 1\.1\.0\.2
21911 keyword substitution: kv
21912 total revisions: 3;     selected revisions: 3
21913 description:
21914 ----------------------------
21915 revision 1\.1
21916 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
21917 branches:  1\.1\.2;  1\.1\.4;
21918 add
21919 ----------------------------
21920 revision 1\.1\.4\.1
21921 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
21922 modify-on-B
21923 ----------------------------
21924 revision 1\.1\.2\.1
21925 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
21926 modify-on-A
21927 ============================================================================="
21928
21929           # This one is more concise.
21930           dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \
21931 "
21932 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21933 Working file: file1
21934 head: 1\.1
21935 branch:
21936 locks: strict
21937 access list:
21938 symbolic names:
21939         B: 1\.1\.0\.4
21940         A: 1\.1\.0\.2
21941 keyword substitution: kv
21942 total revisions: 3;     selected revisions: 1
21943 description:
21944 ----------------------------
21945 revision 1\.1
21946 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
21947 branches:  1\.1\.2;  1\.1\.4;
21948 add
21949 ============================================================================="
21950
21951           # OK, try very much the same thing except we run update -j to
21952           # bring the changes from B to A.  Probably tests many of the
21953           # same code paths but might as well keep it separate, I guess.
21954
21955           dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1
21956 [UP] file2"
21957           dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \
21958 "[UP] file2
21959 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
21960 retrieving revision 1.1
21961 retrieving revision 1.1.4.1
21962 Merging differences between 1.1 and 1.1.4.1 into file2"
21963           dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \
21964 "Checking in file2;
21965 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
21966 new revision: 1\.1\.2\.1; previous revision: 1\.1
21967 done"
21968           cd ../..
21969           rm -r 1
21970           rm -rf ${CVSROOT_DIRNAME}/first-dir
21971           ;;
21972
21973         tag8k)
21974           # In cvs-1.9.27, there is a bug that can cause an abort.
21975           # It happens when you commit a change to a ,v file that has
21976           # just the right amount of tag/branch info to align one of the
21977           # semicolons in the branch info to be on a 8k-byte boundary.
21978           # The result: rcsbuf_getkey got an abort.  This failure doesn't
21979           # corrupt the ,v file -- that would be really serious.  But it
21980           # does leave stale write locks that have to be removed manually.
21981
21982           mkdir 1
21983           cd 1
21984
21985           module=x
21986
21987           : > junk
21988           dotest tag8k-1 "$testcvs -Q import -m . $module X Y" ''
21989           dotest tag8k-2 "$testcvs -Q co $module" ''
21990           cd $module
21991
21992           file=m
21993           : > $file
21994           dotest tag8k-3 "$testcvs add $file" \
21995 "${PROG} add: scheduling file .$file. for addition
21996 ${PROG} add: use .${PROG} commit. to add this file permanently"
21997           dotest tag8k-4 "$testcvs -Q ci -m . $file" \
21998 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
21999 done
22000 Checking in $file;
22001 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
22002 initial revision: 1\.1
22003 done"
22004
22005           # It seems there have to be at least two versions.
22006           echo a > $file
22007           dotest tag8k-5 "$testcvs -Q ci -m . $file" \
22008 "Checking in $file;
22009 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
22010 new revision: 1\.2; previous revision: 1\.1
22011 done"
22012
22013           # Add just under 8K worth of tags.
22014           t=TAG---------------------------------------------------------------------
22015           t=$t$t
22016           t=$t$t$t$t$t
22017           # Now $t is 720 bytes long.
22018
22019           # Apply some tags with that long prefix.
22020           dotest tag8k-6  "$testcvs -Q tag $t-0 $file" ''
22021           dotest tag8k-7  "$testcvs -Q tag $t-1 $file" ''
22022           dotest tag8k-8  "$testcvs -Q tag $t-2 $file" ''
22023           dotest tag8k-9  "$testcvs -Q tag $t-3 $file" ''
22024           dotest tag8k-10 "$testcvs -Q tag $t-4 $file" ''
22025           dotest tag8k-11 "$testcvs -Q tag $t-5 $file" ''
22026           dotest tag8k-12 "$testcvs -Q tag $t-6 $file" ''
22027           dotest tag8k-13 "$testcvs -Q tag $t-7 $file" ''
22028           dotest tag8k-14 "$testcvs -Q tag $t-8 $file" ''
22029           dotest tag8k-15 "$testcvs -Q tag $t-9 $file" ''
22030           dotest tag8k-16 "$testcvs -Q tag $t-a $file" ''
22031
22032           # Extract the author value.
22033           name=`sed -n 's/.*;   author \([^;]*\);.*/\1/p' ${CVSROOT_DIRNAME}/$module/$file,v|sed 1q`
22034
22035           # Form a suffix string of length (16 - length($name)).
22036           # CAREFUL: this will lose if $name is longer than 16.
22037           sed_pattern=`echo $name|sed s/././g`
22038           suffix=`echo 1234567890123456|sed s/$sed_pattern//`
22039
22040           # Add a final tag with length chosen so that it will push the
22041           # offset of the `;' in the 2nd occurrence of `;\tauthor' in the
22042           # ,v file to exactly 8192.
22043           dotest tag8k-17 "$testcvs -Q tag "x8bytes-$suffix" $file" ''
22044
22045           # This commit would fail with 1.9.27.
22046           echo a >> $file
22047           dotest tag8k-18 "$testcvs -Q ci -m . $file" \
22048 "Checking in $file;
22049 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
22050 new revision: 1\.3; previous revision: 1\.2
22051 done"
22052           cd ../..
22053           rm -r 1
22054           rm -rf ${CVSROOT_DIRNAME}/$module
22055           ;;
22056
22057
22058         admin)
22059           # More "cvs admin" tests.
22060           # The basicb-21 test tests rejecting an illegal option.
22061           # For -l and -u, see "reserved" and "keyword" tests.
22062           # "binfiles" test has a test of "cvs admin -k".
22063           # "log2" test has tests of -t and -q options to cvs admin.
22064           # "rcs" tests -b option also.
22065           # For -o, see:
22066           #   admin-22-o1 through admin-23 (various cases not involving ::)
22067           #   binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
22068           #   basicb-o* (attempt to delete all revisions)
22069           #   basica-o1 through basica-o3 (basic :: usage)
22070           #   head-o1 (::branch, where this deletes a revision or is noop)
22071           #   branches-o1 (::branch, similar, with different branch topology)
22072           #   log-o1 (1.3.2.1::)
22073           #   binfiles-o1 (1.3:: and ::1.3; binary files)
22074           #   binfiles3-9 (binary files)
22075           #   Also could be testing:
22076           #     1.3.2.6::1.3.2.8
22077           #     1.3.2.6::1.3.2
22078           #     1.3.2.1::1.3.2.6
22079           #     1.3::1.3.2.6 (error?  or synonym for ::1.3.2.6?)
22080           # -n: admin, tagf tests.
22081
22082           mkdir 1; cd 1
22083           dotest admin-1 "${testcvs} -q co -l ." ''
22084           mkdir first-dir
22085           dotest admin-2 "${testcvs} add first-dir" \
22086 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22087           cd first-dir
22088
22089           dotest_fail admin-3 "${testcvs} -q admin -i file1" \
22090 "${PROG} admin: the -i option to admin is not supported
22091 ${PROG} admin: run add or import to create an RCS file
22092 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
22093           dotest_fail admin-4 "${testcvs} -q log file1" \
22094 "${PROG} log: nothing known about file1"
22095           dotest_fail admin-4a "${testcvs} -q admin file1" \
22096 "${PROG} admin: nothing known about file1"
22097
22098           # Set up some files, file2 a plain one and file1 with a revision
22099           # on a branch.
22100           touch file1 file2
22101           dotest admin-5 "${testcvs} add file1 file2" \
22102 "${PROG} add: scheduling file .file1. for addition
22103 ${PROG} add: scheduling file .file2. for addition
22104 ${PROG} add: use .${PROG} commit. to add these files permanently"
22105           dotest admin-6 "${testcvs} -q ci -m add" \
22106 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22107 done
22108 Checking in file1;
22109 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22110 initial revision: 1\.1
22111 done
22112 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22113 done
22114 Checking in file2;
22115 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22116 initial revision: 1\.1
22117 done"
22118           dotest admin-7 "${testcvs} -q tag -b br" "T file1
22119 T file2"
22120           dotest admin-8 "${testcvs} -q update -r br" ""
22121           echo 'add a line on the branch' >> file1
22122           echo 'add a file on the branch' >> file3
22123           dotest admin-9a "${testcvs} -q add file3" \
22124 "${PROG} add: use .${PROG} commit. to add this file permanently"
22125           dotest admin-9b "${testcvs} -q ci -m modify-on-branch" \
22126 "Checking in file1;
22127 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22128 new revision: 1\.1\.2\.1; previous revision: 1\.1
22129 done
22130 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
22131 done
22132 Checking in file3;
22133 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
22134 new revision: 1\.1\.2\.1; previous revision: 1\.1
22135 done"
22136           dotest admin-10 "${testcvs} -q update -A" \
22137 "U file1
22138 ${PROG} update: file3 is no longer in the repository"
22139
22140           # Check that we can administer files in the repository that
22141           # aren't in the working directory.
22142           dotest admin-10-1 "${testcvs} admin ." \
22143 "${PROG} admin: Administrating .
22144 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22145 done
22146 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22147 done"
22148           dotest admin-10-2 "${testcvs} -q admin file3" \
22149 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
22150 done"
22151
22152           # Try to recurse with a numeric revision arg.
22153           # If we wanted to comprehensive about this, we would also test
22154           # this for -l, -u, and all the different -o syntaxes.
22155           dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
22156 "${PROG} [a-z]*: while processing more than one file:
22157 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
22158           dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
22159 "${PROG} [a-z]*: while processing more than one file:
22160 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
22161
22162           # try a bad symbolic revision
22163           dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \
22164 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22165 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: Symbolic name BOGUS is undefined.
22166 ${PROG} admin: RCS file for .file1. not modified\.
22167 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22168 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name BOGUS is undefined.
22169 ${PROG} admin: RCS file for .file2. not modified\."
22170
22171           # Note that -s option applies to the new default branch, not
22172           # the old one.
22173           # Also note that the implementation of -a via "rcs" requires
22174           # no space between -a and the argument.  However, we expect
22175           # to change that once CVS parses options.
22176           dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
22177 -b1.1.2 -cxx -U -sfoo file1" \
22178 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22179 done"
22180           dotest admin-11a "${testcvs} log -N file1" "
22181 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22182 Working file: file1
22183 head: 1\.1
22184 branch: 1\.1\.2
22185 locks:
22186 access list:
22187         foo
22188         bar
22189         baz
22190 keyword substitution: kv
22191 total revisions: 2;     selected revisions: 2
22192 description:
22193 ----------------------------
22194 revision 1\.1
22195 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22196 branches:  1\.1\.2;
22197 add
22198 ----------------------------
22199 revision 1\.1\.2\.1
22200 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
22201 modify-on-branch
22202 ============================================================================="
22203           dotest admin-12 "${testcvs} -q admin -bbr file1" \
22204 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22205 done"
22206           dotest admin-12a "${testcvs} log -N file1" "
22207 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22208 Working file: file1
22209 head: 1\.1
22210 branch: 1\.1\.2
22211 locks:
22212 access list:
22213         foo
22214         bar
22215         baz
22216 keyword substitution: kv
22217 total revisions: 2;     selected revisions: 2
22218 description:
22219 ----------------------------
22220 revision 1\.1
22221 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22222 branches:  1\.1\.2;
22223 add
22224 ----------------------------
22225 revision 1\.1\.2\.1
22226 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
22227 modify-on-branch
22228 ============================================================================="
22229
22230           # "cvs log" doesn't print the comment leader.  RCS 5.7 will print
22231           # the comment leader only if one specifies "-V4" to rlog.  So it
22232           # seems like the only way to test it is by looking at the RCS file
22233           # directly.  This also serves as a test of exporting RCS files
22234           # (analogous to the import tests in "rcs").
22235           # Rather than try to write a rigorous check for whether the
22236           # file CVS exports is legal, we just write a simpler
22237           # test for what CVS actually exports, and figure we can revise
22238           # the check as needed (within the confines of the RCS5 format as
22239           # documented in RCSFILES).
22240           # Note that we must accept either 2 or 4 digit year.
22241           dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
22242 "head   1\.1;
22243 branch  1\.1\.2;
22244 access
22245         foo
22246         bar
22247         baz;
22248 symbols
22249         br:1\.1\.0\.2;
22250 locks;
22251 comment @xx@;
22252
22253
22254 1\.1
22255 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;
22256 branches
22257         1\.1\.2\.1;
22258 next    ;
22259
22260 1\.1\.2\.1
22261 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;
22262 branches;
22263 next    ;
22264
22265
22266 desc
22267 @@
22268
22269
22270 1\.1
22271 log
22272 @add
22273 @
22274 text
22275 @@
22276
22277
22278 1\.1\.2\.1
22279 log
22280 @modify-on-branch
22281 @
22282 text
22283 @a0 1
22284 add a line on the branch
22285 @"
22286           dotest_fail admin-14-1 "${testcvs} -q admin \
22287 -m1.1.1.1:changed-bogus-log-message file2" \
22288 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22289 cvs admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision 1\.1\.1\.1
22290 cvs admin: RCS file for .file2. not modified."
22291           dotest admin-14-2 "${testcvs} -q log file2" "
22292 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22293 Working file: file2
22294 head: 1\.1
22295 branch:
22296 locks: strict
22297 access list:
22298 symbolic names:
22299         br: 1\.1\.0\.2
22300 keyword substitution: kv
22301 total revisions: 1;     selected revisions: 1
22302 description:
22303 ----------------------------
22304 revision 1\.1
22305 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22306 add
22307 ============================================================================="
22308
22309           dotest admin-14-3 "${testcvs} -q admin -aauth3 -aauth2,foo \
22310 -soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
22311 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22312 done"
22313           dotest admin-15 "${testcvs} -q log file2" "
22314 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22315 Working file: file2
22316 head: 1\.1
22317 branch:
22318 locks: strict
22319 access list:
22320         auth3
22321         auth2
22322         foo
22323 symbolic names:
22324         tagone: 1\.1
22325         br: 1\.1\.0\.2
22326 keyword substitution: kv
22327 total revisions: 1;     selected revisions: 1
22328 description:
22329 ----------------------------
22330 revision 1\.1
22331 date: [0-9/]* [0-9:]*;  author: ${username};  state: oneone;
22332 changed-log-message
22333 ============================================================================="
22334
22335           dotest admin-16 "${testcvs} -q admin \
22336 -A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
22337 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22338 done"
22339           dotest admin-17 "${testcvs} -q log file1" "
22340 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22341 Working file: file1
22342 head: 1\.1
22343 branch:
22344 locks: strict
22345 access list:
22346         foo
22347         bar
22348         baz
22349         auth3
22350         auth2
22351 symbolic names:
22352         br: 1\.1
22353 keyword substitution: kv
22354 total revisions: 2;     selected revisions: 2
22355 description:
22356 ----------------------------
22357 revision 1\.1
22358 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22359 branches:  1\.1\.2;
22360 add
22361 ----------------------------
22362 revision 1\.1\.2\.1
22363 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
22364 modify-on-branch
22365 ============================================================================="
22366
22367           dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
22368 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22369 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: symbolic name br already bound to 1\.1
22370 ${PROG} admin: RCS file for .file1. not modified\."
22371           dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
22372 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22373 done"
22374           dotest admin-20 "${testcvs} -q log file1" "
22375 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22376 Working file: file1
22377 head: 1\.1
22378 branch:
22379 locks: strict
22380 access list:
22381         foo
22382         auth2
22383 symbolic names:
22384 keyword substitution: kv
22385 total revisions: 2;     selected revisions: 2
22386 description:
22387 ----------------------------
22388 revision 1\.1
22389 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22390 branches:  1\.1\.2;
22391 add
22392 ----------------------------
22393 revision 1.1.2.1
22394 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
22395 modify-on-branch
22396 ============================================================================="
22397
22398           # OK, this is starting to get ridiculous, in terms of
22399           # testing a feature (access lists) which doesn't do anything
22400           # useful, but what about nonexistent files and
22401           # relative pathnames in admin -A?
22402           dotest_fail admin-19a-nonexist \
22403 "${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
22404 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22405 ${PROG} admin: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
22406 ${PROG} \[admin aborted\]: cannot continue"
22407
22408           # In the remote case, we are cd'd off into the temp directory
22409           # and so these tests give "No such file or directory" errors.
22410           if $remote; then :; else
22411             dotest admin-19a-admin "${testcvs} -q admin -A../../cvsroot/first-dir/file2,v file1" \
22412 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22413 done"
22414             dotest admin-19a-log "${testcvs} -q log -h -N file1" "
22415 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22416 Working file: file1
22417 head: 1\.1
22418 branch:
22419 locks: strict
22420 access list:
22421         foo
22422         auth2
22423         auth3
22424 keyword substitution: kv
22425 total revisions: 2
22426 ============================================================================="
22427           fi # end of tests skipped for remote
22428
22429           # Now test that plain -e works right.
22430           dotest admin-19a-2 "${testcvs} -q admin -e file1" \
22431 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22432 done"
22433           dotest admin-19a-3 "${testcvs} -q log -h -N file1" "
22434 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22435 Working file: file1
22436 head: 1\.1
22437 branch:
22438 locks: strict
22439 access list:
22440 keyword substitution: kv
22441 total revisions: 2
22442 ============================================================================="
22443
22444           # Put the access list back, to avoid special cases later.
22445           dotest admin-19a-4 "${testcvs} -q admin -afoo,auth2 file1" \
22446 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22447 done"
22448
22449           # Add another revision to file2, so we can delete one.
22450           echo 'add a line' >> file2
22451           dotest admin-21 "${testcvs} -q ci -m modify file2" \
22452 "Checking in file2;
22453 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22454 new revision: 1\.2; previous revision: 1\.1
22455 done"
22456           dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
22457 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22458 deleting revision 1\.1
22459 done"
22460           # Test admin -o.  More variants that we could be testing:
22461           # * REV: [on branch]
22462           # * REV1:REV2 [deleting whole branch]
22463           # * high branch numbers (e.g. 1.2.2.3.2.3)
22464           # ... and probably others.  See RCS_delete_revs for ideas.
22465
22466           echo first rev > aaa
22467           dotest admin-22-o1 "${testcvs} add aaa" \
22468 "${PROG} add: scheduling file .aaa. for addition
22469 ${PROG} add: use .${PROG} commit. to add this file permanently"
22470           dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
22471 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22472 done
22473 Checking in aaa;
22474 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22475 initial revision: 1\.1
22476 done"
22477           echo second rev >> aaa
22478           dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
22479 "Checking in aaa;
22480 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22481 new revision: 1\.2; previous revision: 1\.1
22482 done"
22483           echo third rev >> aaa
22484           dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
22485 "Checking in aaa;
22486 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22487 new revision: 1\.3; previous revision: 1\.2
22488 done"
22489           echo fourth rev >> aaa
22490           dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
22491 "Checking in aaa;
22492 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22493 new revision: 1\.4; previous revision: 1\.3
22494 done"
22495           echo fifth rev >>aaa
22496           dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
22497 "Checking in aaa;
22498 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22499 new revision: 1\.5; previous revision: 1\.4
22500 done"
22501           echo sixth rev >> aaa
22502           dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
22503 "Checking in aaa;
22504 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22505 new revision: 1\.6; previous revision: 1\.5
22506 done"
22507           dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
22508 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22509 1\.6 locked
22510 done"
22511           dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
22512 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22513 Working file: aaa
22514 head: 1\.6
22515 branch:
22516 locks: strict
22517         ${username}: 1\.6
22518 access list:
22519 symbolic names:
22520 keyword substitution: kv
22521 total revisions: 6;     selected revisions: 1
22522 description:
22523 ----------------------------
22524 revision 1\.6   locked by: ${username};
22525 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22526 sixth
22527 ============================================================================="
22528           dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
22529 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22530 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove locked revision 1\.6
22531 ${PROG} admin: RCS file for .aaa. not modified\."
22532           dotest admin-22-o11 "${testcvs} admin -u aaa" \
22533 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22534 1\.6 unlocked
22535 done"
22536           dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
22537 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22538 deleting revision 1\.6
22539 deleting revision 1\.5
22540 done"
22541           dotest admin-22-o13 "${testcvs} log aaa" "
22542 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22543 Working file: aaa
22544 head: 1\.4
22545 branch:
22546 locks: strict
22547 access list:
22548 symbolic names:
22549 keyword substitution: kv
22550 total revisions: 4;     selected revisions: 4
22551 description:
22552 ----------------------------
22553 revision 1\.4
22554 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22555 fourth
22556 ----------------------------
22557 revision 1\.3
22558 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22559 third
22560 ----------------------------
22561 revision 1\.2
22562 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22563 second
22564 ----------------------------
22565 revision 1\.1
22566 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22567 first
22568 ============================================================================="
22569
22570           dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
22571           dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
22572           echo new branch rev >> aaa
22573           dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
22574 "Checking in aaa;
22575 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22576 new revision: 1\.3\.2\.1; previous revision: 1\.3
22577 done"
22578           dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
22579 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22580 deleting revision 1\.4
22581 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove branch point 1\.3
22582 ${PROG} admin: RCS file for .aaa. not modified\."
22583           dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
22584 "===================================================================
22585 Checking out aaa
22586 RCS:  ${CVSROOT_DIRNAME}/first-dir/aaa,v
22587 VERS: 1\.4
22588 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
22589 first rev
22590 second rev
22591 third rev
22592 fourth rev"
22593           echo second branch rev >> aaa
22594           dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
22595 "Checking in aaa;
22596 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22597 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
22598 done"
22599           echo third branch rev >> aaa
22600           dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
22601 "Checking in aaa;
22602 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22603 new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
22604 done"
22605           echo fourth branch rev >> aaa
22606           dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
22607 "Checking in aaa;
22608 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
22609 new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
22610 done"
22611           dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
22612 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22613 deleting revision 1\.3\.2\.1
22614 deleting revision 1\.3\.2\.2
22615 deleting revision 1\.3\.2\.3
22616 done"
22617           dotest admin-22-o23 "${testcvs} log aaa" "
22618 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22619 Working file: aaa
22620 head: 1\.4
22621 branch:
22622 locks: strict
22623 access list:
22624 symbolic names:
22625         br1: 1\.3\.0\.2
22626 keyword substitution: kv
22627 total revisions: 5;     selected revisions: 5
22628 description:
22629 ----------------------------
22630 revision 1\.4
22631 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22632 fourth
22633 ----------------------------
22634 revision 1\.3
22635 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22636 branches:  1\.3\.2;
22637 third
22638 ----------------------------
22639 revision 1\.2
22640 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22641 second
22642 ----------------------------
22643 revision 1\.1
22644 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22645 first
22646 ----------------------------
22647 revision 1\.3\.2\.4
22648 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
22649 branch-four
22650 ============================================================================="
22651
22652           dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
22653 "first rev
22654 second rev
22655 third rev
22656 new branch rev
22657 second branch rev
22658 third branch rev
22659 fourth branch rev"
22660
22661           # The bit here about how there is a "tagone" tag pointing to
22662           # a nonexistent revision is documented by rcs.  I dunno, I
22663           # wonder whether the "cvs admin -o" should give a warning in
22664           # this case.
22665           dotest admin-23 "${testcvs} -q log file2" "
22666 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22667 Working file: file2
22668 head: 1\.2
22669 branch:
22670 locks: strict
22671 access list:
22672         auth3
22673         auth2
22674         foo
22675 symbolic names:
22676         tagone: 1\.1
22677         br: 1\.1\.0\.2
22678 keyword substitution: kv
22679 total revisions: 1;     selected revisions: 1
22680 description:
22681 ----------------------------
22682 revision 1\.2
22683 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22684 modify
22685 ============================================================================="
22686
22687           dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
22688 "head   1\.1;
22689 access
22690         foo
22691         auth2;
22692 symbols;
22693 locks; strict;
22694 comment @xx@;
22695
22696
22697 1\.1
22698 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;
22699 branches
22700         1\.1\.2\.1;
22701 next    ;
22702
22703 1\.1\.2\.1
22704 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;
22705 branches;
22706 next    ;
22707
22708
22709 desc
22710 @@
22711
22712
22713 1\.1
22714 log
22715 @add
22716 @
22717 text
22718 @@
22719
22720
22721 1\.1\.2\.1
22722 log
22723 @modify-on-branch
22724 @
22725 text
22726 @a0 1
22727 add a line on the branch
22728 @"
22729
22730           # Tests of cvs admin -n.  Make use of the results of
22731           # admin-1 through admin-25.
22732           # FIXME: We probably shouldn't make use of those results;
22733           # this test is way too long as it is.
22734
22735           # tagtwo should be a revision
22736           #
22737           dotest admin-26-1 "${testcvs} admin -ntagtwo:tagone file2" \
22738 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22739 done"
22740           
22741           # br1 should be a branch
22742           #
22743           dotest admin-26-2 "${testcvs} admin -nbr1:br file2" \
22744 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22745 done"
22746           
22747           # Attach some tags using RCS versions
22748           #
22749           dotest admin-26-3 "${testcvs} admin -ntagthree:1.1 file2" \
22750 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22751 done"
22752
22753           dotest admin-26-4 "${testcvs} admin -nbr2:1.1.2 file2"  \
22754 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22755 done"
22756
22757           dotest admin-26-5 "${testcvs} admin -nbr4:1.1.0.2 file2"  \
22758 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22759 done"
22760           
22761           # Check results so far
22762           #
22763           dotest admin-26-6 "${testcvs} status -v file2" \
22764 "===================================================================
22765 File: file2             Status: Up-to-date
22766
22767    Working revision:    1\.2.*
22768    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file2,v
22769    Sticky Tag:          (none)
22770    Sticky Date:         (none)
22771    Sticky Options:      (none)
22772
22773    Existing Tags:
22774         br4                             (branch: 1\.1\.2)
22775         br2                             (branch: 1\.1\.2)
22776         tagthree                        (revision: 1\.1)
22777         br1                             (branch: 1\.1\.2)
22778         tagtwo                          (revision: 1\.1)
22779         tagone                          (revision: 1\.1)
22780         br                              (branch: 1\.1\.2)"
22781
22782           
22783           # Add a couple more revisions
22784           #
22785           echo "nuthr_line" >> file2
22786           dotest admin-27-1 "${testcvs} commit -m nuthr_line file2"  \
22787 "Checking in file2;
22788 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22789 new revision: 1\.3; previous revision: 1\.2
22790 done"
22791
22792           echo "yet_another" >> file2
22793           dotest admin-27-2 "${testcvs} commit -m yet_another file2"  \
22794 "Checking in file2;
22795 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22796 new revision: 1\.4; previous revision: 1\.3
22797 done"
22798           
22799           # Fail trying to reattach existing tag with -n
22800           #
22801           dotest admin-27-3 "${testcvs} admin -ntagfour:1.1 file2"  \
22802 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22803 done"
22804
22805           dotest_fail admin-27-4 "${testcvs} admin -ntagfour:1.3 file2"  \
22806 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22807 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: symbolic name tagfour already bound to 1\.1
22808 ${PROG} admin: RCS file for .file2. not modified\."
22809           
22810           # Succeed at reattaching existing tag, using -N
22811           #
22812           dotest admin-27-5 "${testcvs} admin -Ntagfour:1.3 file2"  \
22813 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22814 done"
22815           
22816           # Fail on some bogus operations
22817           # Try to attach to nonexistant tag
22818           #
22819           dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \
22820 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22821 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision tagfive is undefined\.
22822 ${PROG} admin: RCS file for .file2. not modified\."
22823           
22824           # Try a some nonexisting numeric target tags
22825           #
22826           dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2"  \
22827 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22828 ${PROG} \[admin aborted\]: revision .2\.1. does not exist"
22829
22830           dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2"  \
22831 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22832 ${PROG} \[admin aborted\]: revision .2\.1\.2. does not exist"
22833           
22834           # Try some invalid targets
22835           #
22836           dotest_fail admin-28-4 "${testcvs} admin -ntagnine:1.a.2 file2"  \
22837 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22838 ${PROG} \[admin aborted\]: tag .1\.a\.2. must start with a letter"
22839
22840           # Confirm that a missing tag is not a fatal error.
22841           dotest admin-28-5.1 "${testcvs} -Q tag BO+GUS file1" ''
22842           dotest_fail admin-28-5.2 "${testcvs} admin -ntagten:BO+GUS file2 file1"  \
22843 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22844 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision BO${PLUS}GUS is undefined\.
22845 ${PROG} admin: RCS file for .file2. not modified\.
22846 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22847 done"
22848
22849           dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2"  \
22850 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22851 ${PROG} \[admin aborted\]: tag .q\.werty. must not contain the characters ..*"
22852
22853           # Verify the archive
22854           #
22855           dotest admin-29 "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
22856 "head   1\.4;
22857 access
22858         auth3
22859         auth2
22860         foo;
22861 symbols
22862         tagfour:1\.3
22863         br4:1\.1\.0\.2
22864         br2:1\.1\.0\.2
22865         tagthree:1\.1
22866         br1:1\.1\.0\.2
22867         tagtwo:1\.1
22868         tagone:1\.1
22869         br:1\.1\.0\.2;
22870 locks; strict;
22871 comment @# @;
22872
22873
22874 1\.4
22875 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;
22876 branches;
22877 next    1\.3;
22878
22879 1\.3
22880 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;
22881 branches;
22882 next    1\.2;
22883
22884 1\.2
22885 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;
22886 branches;
22887 next    ;
22888
22889
22890 desc
22891 @@
22892
22893
22894 1\.4
22895 log
22896 @yet_another
22897 @
22898 text
22899 @add a line
22900 nuthr_line
22901 yet_another
22902 @
22903
22904
22905 1\.3
22906 log
22907 @nuthr_line
22908 @
22909 text
22910 @d3 1
22911 @
22912
22913
22914 1\.2
22915 log
22916 @modify
22917 @
22918 text
22919 @d2 1
22920 @"
22921
22922           dotest_fail admin-30 "${testcvs} admin -mbr:another-log-message \
22923 file2 aaa file3" \
22924 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22925 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision br: 1\.1
22926 ${PROG} admin: RCS file for .file2. not modified.
22927 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22928 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: no such revision br
22929 ${PROG} admin: RCS file for .aaa. not modified.
22930 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
22931 done"
22932           dotest admin-31 "${testcvs} log" \
22933 "${PROG} log: Logging \.
22934
22935 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
22936 Working file: aaa
22937 head: 1\.4
22938 branch:
22939 locks: strict
22940 access list:
22941 symbolic names:
22942         br1: 1\.3\.0\.2
22943 keyword substitution: kv
22944 total revisions: 5;     selected revisions: 5
22945 description:
22946 ----------------------------
22947 revision 1\.4
22948 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22949 fourth
22950 ----------------------------
22951 revision 1\.3
22952 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22953 branches:  1\.3\.2;
22954 third
22955 ----------------------------
22956 revision 1\.2
22957 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
22958 second
22959 ----------------------------
22960 revision 1\.1
22961 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22962 first
22963 ----------------------------
22964 revision 1\.3\.2\.4
22965 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
22966 branch-four
22967 =============================================================================
22968
22969 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22970 Working file: file1
22971 head: 1\.1
22972 branch:
22973 locks: strict
22974 access list:
22975         foo
22976         auth2
22977 symbolic names:
22978         tagten: 1\.1
22979         BO${PLUS}GUS: 1\.1
22980 keyword substitution: kv
22981 total revisions: 2;     selected revisions: 2
22982 description:
22983 ----------------------------
22984 revision 1\.1
22985 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
22986 branches:  1\.1\.2;
22987 add
22988 ----------------------------
22989 revision 1\.1\.2\.1
22990 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
22991 modify-on-branch
22992 =============================================================================
22993
22994 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22995 Working file: file2
22996 head: 1\.4
22997 branch:
22998 locks: strict
22999 access list:
23000         auth3
23001         auth2
23002         foo
23003 symbolic names:
23004         tagfour: 1\.3
23005         br4: 1\.1\.0\.2
23006         br2: 1\.1\.0\.2
23007         tagthree: 1\.1
23008         br1: 1\.1\.0\.2
23009         tagtwo: 1\.1
23010         tagone: 1\.1
23011         br: 1\.1\.0\.2
23012 keyword substitution: kv
23013 total revisions: 3;     selected revisions: 3
23014 description:
23015 ----------------------------
23016 revision 1\.4
23017 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
23018 yet_another
23019 ----------------------------
23020 revision 1\.3
23021 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
23022 nuthr_line
23023 ----------------------------
23024 revision 1\.2
23025 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
23026 modify
23027 =============================================================================
23028
23029 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
23030 Working file: file3
23031 head: 1\.1
23032 branch:
23033 locks: strict
23034 access list:
23035 symbolic names:
23036         br: 1\.1\.0\.2
23037 keyword substitution: kv
23038 total revisions: 2;     selected revisions: 2
23039 description:
23040 ----------------------------
23041 revision 1\.1
23042 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;
23043 branches:  1\.1\.2;
23044 file file3 was initially added on branch br\.
23045 ----------------------------
23046 revision 1\.1\.2\.1
23047 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
23048 another-log-message
23049 ============================================================================="
23050
23051           cd ../..
23052           if $keep; then
23053             echo Keeping ${TESTDIR} and exiting due to --keep
23054             exit 0
23055           fi
23056           # clean up our after ourselves
23057           rm -r 1
23058           rm -rf ${CVSROOT_DIRNAME}/first-dir
23059           ;;
23060
23061         reserved)
23062           # Tests of reserved checkouts.  Eventually this will test
23063           # rcslock.pl (or equivalent) and all kinds of stuff.  Right
23064           # now it just does some very basic checks on cvs admin -u
23065           # and cvs admin -l.
23066           # Also should test locking on a branch (and making sure that
23067           # locks from one branch don't get mixed up with those from
23068           # another.  Both the case where one of the branches is the
23069           # main branch, and in which neither one is).
23070           # See also test keyword, which tests that keywords and -kkvl
23071           # do the right thing in the presence of locks.
23072
23073           # The usual setup, directory first-dir containing file file1.
23074           mkdir 1; cd 1
23075           dotest reserved-1 "${testcvs} -q co -l ." ''
23076           mkdir first-dir
23077           dotest reserved-2 "${testcvs} add first-dir" \
23078 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23079           cd first-dir
23080           touch file1
23081           dotest reserved-3 "${testcvs} add file1" \
23082 "${PROG} add: scheduling file .file1. for addition
23083 ${PROG} add: use .${PROG} commit. to add this file permanently"
23084           dotest reserved-4 "${testcvs} -q ci -m add" \
23085 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23086 done
23087 Checking in file1;
23088 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23089 initial revision: 1\.1
23090 done"
23091
23092           dotest reserved-5 "${testcvs} -q admin -l file1" \
23093 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23094 1\.1 locked
23095 done"
23096           dotest reserved-6 "${testcvs} log -N file1" "
23097 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23098 Working file: file1
23099 head: 1\.1
23100 branch:
23101 locks: strict
23102         ${username}: 1\.1
23103 access list:
23104 keyword substitution: kv
23105 total revisions: 1;     selected revisions: 1
23106 description:
23107 ----------------------------
23108 revision 1\.1   locked by: ${username};
23109 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
23110 add
23111 ============================================================================="
23112
23113           # Note that this just tests the owner of the lock giving
23114           # it up.  It doesn't test breaking a lock.
23115           dotest reserved-7 "${testcvs} -q admin -u file1" \
23116 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23117 1\.1 unlocked
23118 done"
23119
23120           dotest reserved-8 "${testcvs} log -N file1" "
23121 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23122 Working file: file1
23123 head: 1\.1
23124 branch:
23125 locks: strict
23126 access list:
23127 keyword substitution: kv
23128 total revisions: 1;     selected revisions: 1
23129 description:
23130 ----------------------------
23131 revision 1\.1
23132 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
23133 add
23134 ============================================================================="
23135
23136           # rcslock.pl tests.  Of course, the point isn't to test
23137           # rcslock.pl from the distribution but equivalent
23138           # functionality (for example, many sites may have an old
23139           # rcslock.pl).  The functionality of this hook falls
23140           # short of the real rcslock.pl though.
23141           # Note that we can use rlog or look at the RCS file directly,
23142           # but we can't use "cvs log" because "cvs commit" has a lock.
23143
23144           cat >${TESTDIR}/lockme <<EOF
23145 #!${TESTSHELL}
23146 line=\`grep <\$1/\$2,v 'locks ${author}:1\.[0-9];'\`
23147 if test -z "\$line"; then
23148   # It isn't locked
23149   exit 0
23150 else
23151   user=\`echo \$line | sed -e 's/locks \\(${author}\\):[0-9.]*;.*/\\1/'\`
23152   version=\`echo \$line | sed -e 's/locks ${author}:\\([0-9.]*\\);.*/\\1/'\`
23153   echo "\$user has file a-lock locked for version  \$version" >&2
23154   exit 1
23155 fi
23156 EOF
23157           # Cygwin.  Blaaarg.
23158           if test -n "$remotehost"; then
23159             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/lockme"
23160           else
23161             chmod +x ${TESTDIR}/lockme
23162           fi
23163
23164           echo stuff > a-lock
23165           dotest reserved-9 "${testcvs} add a-lock" \
23166 "${PROG} add: scheduling file .a-lock. for addition
23167 ${PROG} add: use .${PROG} commit. to add this file permanently"
23168           dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
23169 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23170 done
23171 Checking in a-lock;
23172 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
23173 initial revision: 1\.1
23174 done"
23175           # FIXME: the contents of CVSROOT fluctuate a lot
23176           # here. Maybe the expect pattern should just
23177           # confirm that commitinfo is one of the files checked out,
23178           # but for now we just check that CVS exited with success.
23179           cd ..
23180           if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
23181             pass reserved-11
23182           else
23183             fail reserved-11
23184           fi
23185           cd CVSROOT
23186           echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
23187           dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
23188 "Checking in commitinfo;
23189 ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
23190 new revision: 1\.2; previous revision: 1\.1
23191 done
23192 ${PROG} commit: Rebuilding administrative file database"
23193           cd ..; cd first-dir
23194
23195           # Simulate (approximately) what a-lock would look like
23196           # if someone else had locked revision 1.1.
23197           sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
23198           # Cygwin.
23199           if test -n "$remotehost"; then
23200             $CVS_RSH $remotehost "chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
23201           else
23202             chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23203           fi
23204           dotest reserved-13 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
23205           # Cygwin.  Blah.
23206           if test -n "$remotehost"; then
23207             $CVS_RSH $remotehost "chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
23208           else
23209             chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23210           fi
23211           echo more stuff >> a-lock
23212           dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
23213 "fred has file a-lock locked for version  1\.1
23214 ${PROG} commit: Pre-commit check failed
23215 ${PROG} \[commit aborted\]: correct above errors first!"
23216           # OK, now test "cvs admin -l" in the case where someone
23217           # else has the file locked.
23218           dotest_fail reserved-13c "${testcvs} admin -l a-lock" \
23219 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23220 ${PROG} \[admin aborted\]: Revision 1\.1 is already locked by fred"
23221
23222           dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
23223 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23224 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/a-lock,v: revision 1\.1 locked by fred; breaking lock
23225 1\.1 unlocked
23226 done"
23227           dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
23228 "Checking in a-lock;
23229 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
23230 new revision: 1\.2; previous revision: 1\.1
23231 done"
23232
23233           # Now test for a bug involving branches and locks
23234           sed -e 's/locks; strict;/locks fred:1.2; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
23235           chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23236           dotest reserved-16 \
23237 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v" ""
23238           chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
23239           dotest reserved-17 "${testcvs} -q tag -b br a-lock" "T a-lock"
23240           dotest reserved-18 "${testcvs} -q update -r br a-lock" ""
23241           echo edit it >>a-lock
23242           dotest reserved-19 "${testcvs} -q ci -m modify a-lock" \
23243 "Checking in a-lock;
23244 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
23245 new revision: 1\.2\.2\.1; previous revision: 1\.2
23246 done"
23247
23248           # undo commitinfo changes
23249           cd ../CVSROOT
23250           echo '# vanilla commitinfo' >commitinfo
23251           dotest reserved-cleanup-1 "${testcvs} -q ci -m back commitinfo" \
23252 "Checking in commitinfo;
23253 ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
23254 new revision: 1\.3; previous revision: 1\.2
23255 done
23256 ${PROG} commit: Rebuilding administrative file database"
23257           cd ..; rm -r CVSROOT; cd first-dir
23258
23259           cd ../..
23260           rm -r 1
23261           rm ${TESTDIR}/lockme
23262           rm -rf ${CVSROOT_DIRNAME}/first-dir
23263           ;;
23264
23265         diffmerge1)
23266           # Make sure CVS can merge correctly in circumstances where it
23267           # used to mess up (due to a bug which existed in diffutils 2.7
23268           # and 2.6, but not 2.5, and which has been fixed in CVS's diff
23269           # lib by Paul Eggert, bless his bitty heart).
23270
23271           # This first test involves two working copies, "mine" and
23272           # "yours", checked out from the same repository at the same
23273           # time.  In yours, you remove some text from the end of the
23274           # file and check it in; meanwhile, "me" has commented out some
23275           # lines earlier in the file, and I go to check it in right
23276           # after you checked yours in.  CVS naturally tells me the file
23277           # is not up-to-date, so I run cvs update, but it updates
23278           # incorrectly, leaving in the lines of text you just deleted.
23279           # Bad!  I'm in too much of a hurry to actually look at the
23280           # file, so I check it in and go home, and so your changes have
23281           # been lost.  Later you discover this, and you suspect me of
23282           # deliberately sabotaging your work, so you let all the air
23283           # out of my tires.  Only after a series of expensive lawsuits
23284           # and countersuits do we discover that this was all CVS's
23285           # fault.
23286           #
23287           # Luckily, this problem has been fixed now, as our test will
23288           # handily confirm, no doubt:
23289
23290           # First make a repository containing the original text:
23291
23292           # We should be here anyway, but cd to it just in case:
23293           cd ${TESTDIR}
23294
23295           mkdir diffmerge1
23296           cd diffmerge1
23297
23298           # These are the files we both start out with:
23299           mkdir import
23300           cd import
23301           diffmerge_create_older_files
23302
23303           dotest diffmerge1_import \
23304             "${testcvs} import -m import diffmerge1 tag1 tag2" \
23305             "${DOTSTAR}No conflicts created by this import"
23306           cd ..
23307
23308           # Check out two working copies, one for "you" and one for
23309           # "me".  If no branch is used and cvs detects that only one
23310           # of the two people made changes, then cvs does not run the
23311           # merge algorithm.  But if a branch is used, then cvs does run
23312           # the merge algorithm (even in this case of only one of the two
23313           # people having made changes).  CVS used to have a bug in this
23314           # case.  Therefore, it is important to test this case by
23315           # using a branch:
23316           ${testcvs} rtag     -b tag diffmerge1 >/dev/null 2>&1
23317           ${testcvs} checkout -r tag diffmerge1 >/dev/null 2>&1
23318           mv diffmerge1 yours
23319           ${testcvs} checkout diffmerge1 >/dev/null 2>&1
23320           mv diffmerge1 mine
23321
23322           # In your working copy, you'll make changes, and
23323           # then check in your changes before I check in mine:
23324           cd yours
23325           diffmerge_create_your_files
23326           dotest diffmerge1_yours "${testcvs} -q ci -m yours" \
23327 "Checking in testcase01;
23328 ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v  <--  testcase01
23329 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23330 done
23331 Checking in testcase02;
23332 ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v  <--  testcase02
23333 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23334 done
23335 Checking in testcase03;
23336 ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v  <--  testcase03
23337 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23338 done
23339 Checking in testcase04;
23340 ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v  <--  testcase04
23341 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23342 done
23343 Checking in testcase05;
23344 ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v  <--  testcase05
23345 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23346 done
23347 Checking in testcase06;
23348 ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v  <--  testcase06
23349 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23350 done
23351 Checking in testcase07;
23352 ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v  <--  testcase07
23353 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23354 done
23355 Checking in testcase08;
23356 ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v  <--  testcase08
23357 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23358 done
23359 Checking in testcase09;
23360 ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v  <--  testcase09
23361 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23362 done
23363 Checking in testcase10;
23364 ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v  <--  testcase10
23365 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
23366 done"
23367
23368           # Change my copy.  Then I
23369           # update, after both my modifications and your checkin:
23370           cd ../mine
23371           diffmerge_create_my_files
23372           dotest diffmerge1_mine "${testcvs} -q update -j tag" \
23373 "M testcase01
23374 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v
23375 retrieving revision 1\.1\.1\.1
23376 retrieving revision 1\.1\.1\.1\.2\.1
23377 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase01
23378 M testcase02
23379 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v
23380 retrieving revision 1\.1\.1\.1
23381 retrieving revision 1\.1\.1\.1\.2\.1
23382 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase02
23383 M testcase03
23384 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v
23385 retrieving revision 1\.1\.1\.1
23386 retrieving revision 1\.1\.1\.1\.2\.1
23387 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase03
23388 M testcase04
23389 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v
23390 retrieving revision 1\.1\.1\.1
23391 retrieving revision 1\.1\.1\.1\.2\.1
23392 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase04
23393 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v
23394 retrieving revision 1\.1\.1\.1
23395 retrieving revision 1\.1\.1\.1\.2\.1
23396 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase05
23397 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v
23398 retrieving revision 1\.1\.1\.1
23399 retrieving revision 1\.1\.1\.1\.2\.1
23400 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase06
23401 M testcase07
23402 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v
23403 retrieving revision 1\.1\.1\.1
23404 retrieving revision 1\.1\.1\.1\.2\.1
23405 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase07
23406 testcase07 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1
23407 M testcase08
23408 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
23409 retrieving revision 1\.1\.1\.1
23410 retrieving revision 1\.1\.1\.1\.2\.1
23411 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase08
23412 M testcase09
23413 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v
23414 retrieving revision 1\.1\.1\.1
23415 retrieving revision 1\.1\.1\.1\.2\.1
23416 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase09
23417 M testcase10
23418 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v
23419 retrieving revision 1\.1\.1\.1
23420 retrieving revision 1\.1\.1\.1\.2\.1
23421 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase10"
23422
23423           # So if your changes didn't make it into my working copy, or
23424           # in any case if the files do not look like the final text
23425           # in the files in directory comp_me, then the test flunks:
23426           cd ..
23427           mkdir comp_me
23428           cd comp_me
23429           diffmerge_create_expected_files
23430           cd ..
23431           rm mine/.#*
23432
23433           # If you have GNU's version of diff, you may try
23434           # uncommenting the following line which will give more
23435           # fine-grained information about how cvs differed from the
23436           # correct result:
23437           #dotest diffmerge1_cmp "diff -u --recursive --exclude=CVS comp_me mine" ''
23438           dotest diffmerge1_cmp "directory_cmp comp_me mine"
23439
23440           # Clean up after ourselves:
23441           cd ..
23442           if $keep; then :; else
23443             rm -rf diffmerge1 ${CVSROOT_DIRNAME}/diffmerge1
23444           fi
23445           ;;
23446
23447         diffmerge2)
23448
23449           # FIXME: This test should be rewritten to be much more concise.
23450           # It currently weighs in at something like 600 lines, but the
23451           # same thing could probably be tested in more like 50-100 lines.
23452           mkdir diffmerge2
23453
23454           # This tests for another diffmerge bug reported by Martin
23455           # Tomes; actually, his bug was probably caused by an initial
23456           # fix for the bug in test diffmerge1, and likely wasn't ever
23457           # a problem in CVS as long as one was using a normal
23458           # distribution of diff or a version of CVS that has the diff
23459           # lib in it. 
23460           #
23461           # Nevertheless, once burned twice cautious, so we test for his
23462           # bug here.
23463           #
23464           # Here is his report, more or less verbatim:
23465           # ------------------------------------------
23466           #
23467           # Put the attached file (sgrid.h,v) into your repository
23468           # somewhere, check out the module and do this:
23469           #
23470           # cvs update -j Review_Phase_2_Enhancements sgrid.h
23471           # cvs diff -r Review_V1p3 sgrid.h
23472           #
23473           # As there have been no changes made on the trunk there
23474           # should be no differences, however this is output:
23475           #
23476           # % cvs diff -r Review_V1p3 sgrid.h
23477           # Index: sgrid.h
23478           # ===================================================================
23479           # RCS file: /usr/local/repository/play/fred/sgrid.h,v
23480           # retrieving revision 1.1.2.1
23481           # diff -r1.1.2.1 sgrid.h
23482           # 178a179,184
23483           # > /*--------------------------------------------------------------
23484           # > INLINE FUNCTION    :    HORIZONTALLINES
23485           # > NOTES              :    Description at the end of the file
23486           # > ----------------------------------------------------------------*/
23487           # >         uint16 horizontalLines( void );
23488           # >
23489           #
23490           # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
23491           # differences to sgrid.h version 1.1 and got the correct result
23492           # so it looks like the built in patch is faulty.
23493           # -------------------------------------------------------------------
23494           #
23495           # This is the RCS file, sgrid.h,v, that he sent:
23496
23497           echo "head    1.1;
23498 access;
23499 symbols
23500         Review_V1p3:1.1.2.1
23501         Review_V1p3C:1.1.2.1
23502         Review_1p3A:1.1.2.1
23503         Review_V1p3A:1.1.2.1
23504         Review_Phase_2_Enhancements:1.1.0.2
23505         Review_V1p2:1.1
23506         Review_V1p2B:1.1
23507         Review_V1p2A:1.1
23508         Review_V1p1:1.1
23509         Review_1p1:1.1;
23510 locks; strict;
23511 comment @ * @;
23512
23513
23514 1.1
23515 date    97.04.02.11.20.05;      author colinl;  state Exp;
23516 branches
23517         1.1.2.1;
23518 next    ;
23519
23520 1.1.2.1
23521 date    97.06.09.10.00.07;      author colinl;  state Exp;
23522 branches;
23523 next    ;
23524
23525
23526 desc
23527 @@
23528
23529
23530 1.1
23531 log
23532 @Project:     DEV1175
23533 DCN:
23534 Tested By:   Colin Law
23535 Reviewed By:
23536 Reason for Change: Initial Revision of all files
23537
23538 Design Change Details:
23539
23540 Implications:
23541 @
23542 text
23543 @/* \$""Header:   L:/gpanels/dis/sgrid.h_v   1.1.1.0   24 Jan 1996 14:59:20   PAULT  \$ */
23544 /*
23545  * \$""Log:   L:/gpanels/dis/sgrid.h_v  \$
23546  * 
23547  *    Rev 1.1.1.0   24 Jan 1996 14:59:20   PAULT
23548  * Branched
23549  * 
23550  *    Rev 1.1   24 Jan 1996 12:09:52   PAULT
23551  * Consolidated 4100 code merged to trunk
23552  * 
23553  *    Rev 1.0.2.0   01 Jun 1995 14:18:58   DAVEH
23554  * Branched
23555  * 
23556  *    Rev 1.0   19 Apr 1995 16:32:48   COLINL
23557  * Initial revision.
23558 */
23559 /*****************************************************************************
23560 FILE        :   SGRID.H
23561 VERSION     :   2.1
23562 AUTHOR      :   Dave Hartley
23563 SYSTEM      :   Borland C++
23564 DESCRIPTION :   The declaration of the scrolling grid class
23565                   
23566 *****************************************************************************/
23567 #if !defined(__SGRID_H)
23568 #define __SGRID_H
23569
23570 #if !defined(__SCROLL_H)
23571 #include <scroll.h>
23572 #endif
23573
23574 #if !defined(__GKI_H)
23575 #include \"gki.h\"
23576 #endif
23577
23578 #if defined PRINTING_SUPPORT
23579 class Printer;
23580 #endif
23581
23582 /*****************************************************************************
23583 CLASS      :    ScrollingGrid   
23584 DESCRIPTION:    This class inherits from a grid and a scrollable, and
23585                 can therefore use all the PUBLIC services provided by these
23586                 classes. A description of these can be found in
23587                 GRID.H and SCROLL.H.
23588                 A scrolling grid is a set of horizontal and vertical lines
23589                 that scroll and continually update to provide a complete grid
23590
23591 *****************************************************************************/
23592
23593 class ScrollingGrid : public Scrollable
23594 {
23595     public:
23596 #if defined _WINDOWS
23597 /*---------------------------------------------------------------------------
23598 FUNCTION    :   CONSTRUCTOR
23599 DESCRIPTION :   sets up the details of the grid, ready for painting
23600 ARGUMENTS   :   name  : sgColour
23601                         - the colour of the grid
23602                         sgLineType
23603                         - the syle of line
23604                         sgHorizontalTotal
23605                         - the total number of horizontal grid lines
23606                         verticalSpacingMin
23607                         - the min distance between the vertical grid lines
23608                           on the scrolling axis
23609                         currentTimestamp
23610                         - timestamp value now
23611                         ticksPerSecond
23612                         - number of timestamp ticks per second
23613                         ticksPerPixel
23614                         - number of timestamp ticks per pixel required
23615                       
23616 RETURN      :   None
23617 NOTES       :   
23618 ---------------------------------------------------------------------------*/
23619         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, 
23620             uint16 sgHorizontalTotal, 
23621             uint16 verticalSpacingMin, uint32 currentTimestamp, 
23622             uint16 ticksPerSecond, uint32 ticksPerPixel );
23623 #else
23624 /*---------------------------------------------------------------------------
23625 FUNCTION    :   CONSTRUCTOR
23626 DESCRIPTION :   sets up the details of the grid, ready for painting
23627 ARGUMENTS   :   name  : sgColour
23628                         - the colour of the grid
23629                         sgLineType
23630                         - the syle of line
23631                         sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
23632                         - the total number of horizontal grid lines
23633                         sgVerticalSpacing
23634                         - the distance between the vertical grid lines
23635                         on the scrolling axis
23636                       
23637 RETURN      :   None
23638 NOTES       :   If the caller does not get the total grid lines value, synced
23639                 with the overall size of the viewport, the spacing between
23640                 grid lines will not be consistent.
23641
23642 ---------------------------------------------------------------------------*/
23643         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
23644                      , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
23645 #endif
23646 /*---------------------------------------------------------------------------
23647 FUNCTION    :   DESTRUCTOR
23648 DESCRIPTION :   tidies it all up
23649 ARGUMENTS   :   name  :      
23650                       
23651 RETURN      :   None
23652 NOTES       : 
23653 ---------------------------------------------------------------------------*/
23654         ~ScrollingGrid( void );
23655
23656 /*---------------------------------------------------------------------------
23657 FUNCTION    :   ATTACH
23658 DESCRIPTION :   This service overloads the base class service, as it does
23659                 additional work at the time of attachment.
23660
23661 ARGUMENTS   :   name  : tDrawingArea
23662                         - the scrolled viewport to attach this trend to
23663                       
23664 RETURN      :   None
23665 NOTES       :
23666 ---------------------------------------------------------------------------*/
23667         void attach( SViewport *tDrawingArea );
23668
23669 #if defined _WINDOWS
23670 /*---------------------------------------------------------------------------
23671 FUNCTION    :   calculateVerticalSpacing
23672 DESCRIPTION :   determines optimum spacing along time axis
23673 ARGUMENTS   :   
23674 RETURN      :   None
23675 NOTES       : 
23676 ---------------------------------------------------------------------------*/
23677         void calculateVerticalSpacing();
23678
23679 /*---------------------------------------------------------------------------
23680 FUNCTION    :   gridSpacingTicks
23681 DESCRIPTION :   Provides the grid spacing in the time axis in ticks
23682 ARGUMENTS   :   
23683 RETURN      :   Number of ticks
23684 NOTES       : 
23685 ---------------------------------------------------------------------------*/
23686         uint32 gridSpacingTicks();
23687
23688 #endif
23689
23690 /*---------------------------------------------------------------------------
23691 INLINE FUNCTION    :    HORIZONTALLINES
23692 NOTES              :    Description at the end of the file
23693 ---------------------------------------------------------------------------*/
23694         uint16 horizontalLines( void );
23695
23696 #if defined _WINDOWS
23697 // In Windows the OnDraw() function replaces paint()
23698 /*---------------------------------------------------------------------------
23699 FUNCTION    :   ScrollingGrid OnDraw   
23700 DESCRIPTION :   Paints the given area of the grid.
23701                 Pure virtual
23702 ARGUMENTS   :   pDC     pointer to the device context to use for display
23703                         Note that the device context operates in the coords
23704                         of the window owning the viewport
23705 RETURN      :   None
23706 NOTES       : 
23707 ---------------------------------------------------------------------------*/
23708         virtual void OnDraw( CDC *pDC );
23709
23710 #else   // not Windows            
23711
23712 /*---------------------------------------------------------------------------
23713 FUNCTION    :   PAINT
23714 DESCRIPTION :   This extends the standard grid paint method to paint the
23715                 viewport relative to its current position. 
23716                 
23717 ARGUMENTS   :   name  :      
23718                       
23719 RETURN      :   None
23720 NOTES       : 
23721 ---------------------------------------------------------------------------*/
23722         void paint( void );
23723 #endif
23724
23725 /*---------------------------------------------------------------------------
23726 FUNCTION    :   P A I N T   T E X T   M A R K E R S 
23727 DESCRIPTION :   this service allow the text markers to be painted seperatley
23728                 from the grid lines
23729
23730 ARGUMENTS   :   name : 
23731                                                                           
23732 RETURN      :   None
23733 NOTES       : 
23734 ---------------------------------------------------------------------------*/
23735         void paintTextMarkers();
23736
23737 #if defined PRINTING_SUPPORT
23738 /*---------------------------------------------------------------------------
23739 FUNCTION    :   P R I N T 
23740 DESCRIPTION :   This print service prints a grid marker ( being either a
23741                 timestamp or a date, IF there is one at the plot position
23742                 given
23743
23744 ARGUMENTS   :   name :
23745                         displayPosition
23746                         - Where in the log to look to see if there is an
23747                           entry to print
23748
23749                         - printerPtr
23750                           the printer to print to
23751                                                                           
23752 RETURN      :   None
23753 NOTES       : 
23754 ---------------------------------------------------------------------------*/
23755         void print( uint16 currentPrintPos, Printer *printerPtr );
23756 #endif
23757
23758 /*---------------------------------------------------------------------------
23759 FUNCTION    :   S E T  D R I V E  D I R E C T I O N
23760 DESCRIPTION :   Sets direction for update and scrolling forwards or backwards
23761 ARGUMENTS   :   direction  - required direction
23762 RETURN      :   None
23763 NOTES       : 
23764 ---------------------------------------------------------------------------*/
23765         void setDriveDirection( ScrollDirection direction );
23766
23767 /*---------------------------------------------------------------------------
23768 FUNCTION    :   S E T U P 
23769 DESCRIPTION :   service that will setup the grid prior to a paint
23770
23771 ARGUMENTS   :   name :
23772                         - newTimestamp
23773                             
23774
23775                         - newTimeBase
23776                         the number of ticks that represent a plot point on
23777                         the trendgraph. 
23778                                                                           
23779 RETURN      :   None
23780 NOTES       : 
23781 ---------------------------------------------------------------------------*/
23782         void setup( uint32 newTimestamp, uint32 newTimeBase );
23783
23784 #if defined PRINTING_SUPPORT
23785 /*---------------------------------------------------------------------------
23786 FUNCTION    :   S E T U P   F O R   P R I N T   
23787 DESCRIPTION :   This service iis to be called prior to printing. It allows
23788                 the grid to prepare its markers ready for the print
23789                 commands
23790
23791 ARGUMENTS   :   name : 
23792                                                                           
23793 RETURN      :   None
23794 NOTES       : 
23795 ---------------------------------------------------------------------------*/
23796         void setupForPrint();
23797 #endif
23798
23799 /*---------------------------------------------------------------------------
23800 FUNCTION    :   UPDATE
23801 DESCRIPTION :   When this service is called it will calculate what needs to
23802                 be painted and fill in the display again.
23803
23804 ARGUMENTS   :   name  :     timeStamp
23805                             - the reference time of this update.
23806                       
23807 RETURN      :   None
23808 NOTES       : 
23809 ---------------------------------------------------------------------------*/
23810         void update( uint32 timeStamp );
23811
23812 /*---------------------------------------------------------------------------
23813 FUNCTION    :   U P D A T E   B U F F E R
23814 DESCRIPTION :   When a display update is not required, use this method. It
23815                 updates the internal data ready for a call to paint that
23816                 will then show the grid in the right position
23817
23818 ARGUMENTS   :   name  :      
23819                       
23820 RETURN      :   None
23821 NOTES       : 
23822 ---------------------------------------------------------------------------*/
23823         void updateBuffer( void );
23824
23825     private:
23826
23827 /*---------------------------------------------------------------------------
23828 FUNCTION    :   M A K E   G R I D   M A R K E R 
23829 DESCRIPTION :   service that perpares a string for display. The string will
23830                 either be a short date, or short time. this is determined
23831                 by the current setting of the dateMarker flag
23832
23833 ARGUMENTS   :   name :  timestampVal
23834                         - the value to convert
23835                         
23836                         storePtr
23837                         - the place to put the string
23838
23839 RETURN      :   None
23840 NOTES       : 
23841 ---------------------------------------------------------------------------*/
23842         void makeGridMarker( uint32 timestampVal, char *storePtr );
23843             
23844 /*---------------------------------------------------------------------------
23845 FUNCTION    :   P A I N T   G R I D   M A R K E R 
23846 DESCRIPTION :   given a position will put the string on the display
23847
23848 ARGUMENTS   :   name :
23849                         yPos
23850                         - were it goes on the Y-axis
23851
23852                         gridMarkerPtr
23853                         - what it is
23854                                                                           
23855 RETURN      :   None
23856 NOTES       : 
23857 ---------------------------------------------------------------------------*/
23858         void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
23859
23860 #if defined _WINDOWS
23861 /*---------------------------------------------------------------------------
23862 FUNCTION    :   PAINTHORIZONTALLINES
23863 DESCRIPTION :   responsible for painting the grids horizontal lines 
23864 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
23865                                 in viewport coords
23866                 pDC             pointer to device context to use
23867                       
23868 RETURN      : None
23869 NOTES       :
23870 ---------------------------------------------------------------------------*/
23871         void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
23872 #else
23873 /*---------------------------------------------------------------------------
23874 FUNCTION    :   PAINTHORIZONTALLINES
23875 DESCRIPTION :   responsible for painting the grids horizontal lines 
23876 ARGUMENTS   : name: xStart
23877                     - the starting X co-ordinate for the horizontal line
23878                     xEnd
23879                     - the ending X co-ordinate for the horizontal line
23880                       
23881 RETURN      : None
23882 NOTES       : Remember lines are drawn from origin. The origin in a
23883               horizontal viewport will be the top.    
23884 ---------------------------------------------------------------------------*/
23885         void paintHorizontalLines( uint16 xStart, uint16 xEnd );
23886 #endif
23887
23888 #if defined _WINDOWS
23889 /*---------------------------------------------------------------------------
23890 FUNCTION    :   PAINTVERTICALLINES
23891 DESCRIPTION :   responsible for painting the grids vertical lines 
23892 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
23893                                 in viewport coords
23894                 offset          offset from rhs that rightmost line would be 
23895                                 drawn if rectangle included whole viewport
23896                 pDC             pointer to device context to use
23897 RETURN      : None
23898 NOTES       : 
23899 ---------------------------------------------------------------------------*/
23900         void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
23901             CDC* pDC );
23902 #else
23903 /*---------------------------------------------------------------------------
23904 FUNCTION    :   PAINTVERTICALLINES
23905 DESCRIPTION :   responsible for painting the grids vertical lines 
23906 ARGUMENTS   : name  :   yStart
23907                         - the starting Y co-ordinate for the vertical line
23908                         yEnd
23909                         - the ending Y co-ordinate for the vertical line
23910                         offset
23911                         - a starting point offset that determines at what X
23912                         position the first line will be drawn
23913
23914                       
23915 RETURN      : None
23916 NOTES       : 
23917 ---------------------------------------------------------------------------*/
23918         void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
23919 #endif
23920
23921 #if defined _WINDOWS
23922 /*---------------------------------------------------------------------------
23923 FUNCTION    :   PAINTVERTICALLINE
23924 DESCRIPTION :   paints one line at the position specified, and length
23925 ARGUMENTS   :   name  : yStart
23926                         - the starting point on the y axis for the line
23927                         yEnd
23928                         - the end point on the y axis for the line
23929                         xPosition
23930                         - The horizontal offset from the start of the viewport
23931                 pDC             pointer to device context to use
23932                       
23933 RETURN      :   None
23934 NOTES       :   There is not an equivalent horizontal method as yet. This
23935                 is a seperate method because the service is useful to a
23936                 derivation of this class
23937 ---------------------------------------------------------------------------*/
23938         void paintVerticalLine( uint16 yStart, uint16 yEnd
23939                               , uint16 xPosition, CDC *pDC );
23940 #else
23941 /*---------------------------------------------------------------------------
23942 FUNCTION    :   PAINTVERTICALLINE
23943 DESCRIPTION :   paints one line at the position specified, and length
23944 ARGUMENTS   :   name  : yStart
23945                         - the starting point on the y axis for the line
23946                         yEnd
23947                         - the end point on the y axis for the line
23948                         xPosition
23949                         - The horizontal offset from the start of the viewport
23950                       
23951 RETURN      :   None
23952 NOTES       :   There is not an equivalent horizontal method as yet. This
23953                 is a seperate method because the service is useful to a
23954                 derivation of this class
23955 ---------------------------------------------------------------------------*/
23956         void paintVerticalLine( uint16 yStart, uint16 yEnd
23957                               , uint16 xPosition );
23958 #endif
23959
23960 /*---------------------------------------------------------------------------
23961 INLINE FUNCTION    :    VERTICALSPACING
23962 NOTES              :    Description at the end of the file
23963 ---------------------------------------------------------------------------*/
23964         uint16 verticalSpacing( void );
23965
23966
23967         // Position in viewport that we are now writing to if going forwards
23968         // Note that if this is greater than viewport length then we have
23969         // just scrolled and value must be adjusted before use.
23970         sint16 forwardsOutputPosition;
23971         
23972         // Position in viewport that we are now writing to if going backwards
23973         // Note that if this is less than zero then we have
23974         // just scrolled and value must be adjusted before use.
23975         sint16 backwardsOutputPosition;
23976
23977         // position in grid cycle of forwards output position.
23978         // if zero then it is time to output a grid line
23979         sint16 forwardsIntervalCount;
23980
23981         // position in grid cycle of forwards output position.
23982         // if zero then it is time to output a grid line
23983         sint16 backwardsIntervalCount;
23984         
23985         uint32  lastUpdateTimestamp;
23986         uint32  timeBase;       // ticks per pixel
23987         uint16  currentOutputPosition;
23988         uint16  gridTimestampSpacing;
23989         uint16  intervalCount;
23990         uint16  horizontalTotal;
23991         uint16  vSpacing;
23992 #if defined PRINTING_SUPPORT
23993         uint16  numberOfGridMarkersPrinted;
23994 #endif
23995         bool    firstTime;       // indicates first time through
23996         bool    dateMarker;
23997
23998         GkiLineType lineType;
23999         GkiColour   gridColour;
24000
24001     #if defined _WINDOWS
24002         uint16 ticksPerSec;     // number of time ticks per second
24003         uint16 vSpacingMin;     // minimum pixels per division along time axis 
24004         CPen *pPen;             // the pen to use for drawing in windows
24005     #endif
24006
24007 };
24008
24009
24010 /*****************************************************************************
24011                         I N L I N E   F U N C T I O N S   
24012 *****************************************************************************/
24013
24014 /*---------------------------------------------------------------------------
24015 FUNCTION    :   HORIZONTALLINES
24016 DESCRIPTION :   supplies the number of horizontal lines in the grid
24017 ARGUMENTS   :   name  :      
24018                       
24019 RETURN      :   
24020 NOTES       : 
24021 ---------------------------------------------------------------------------*/
24022 inline uint16 ScrollingGrid::horizontalLines( void )
24023 {
24024     return( horizontalTotal );
24025 }
24026 /*---------------------------------------------------------------------------
24027 FUNCTION    :   VERTICALSPACING
24028 DESCRIPTION :   returns the distance between adjacent vertical lines
24029 ARGUMENTS   :   name  :      
24030                       
24031 RETURN      :   None
24032 NOTES       : 
24033 ---------------------------------------------------------------------------*/
24034 inline uint16 ScrollingGrid::verticalSpacing( void )
24035 {
24036     return( vSpacing );
24037 }
24038
24039 #endif
24040 @
24041
24042
24043 1.1.2.1
24044 log
24045 @DEV1194:DS4    Provision of major and minor grid lines
24046 @
24047 text
24048 @d1 1
24049 a1 1
24050 /* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
24051 d3 1
24052 a3 12
24053  * \$""Log: sgrid.h,v \$
24054  * Revision 1.1  1997/04/02 11:20:05  colinl
24055  * Project:     DEV1175
24056  * DCN:
24057  * Tested By:   Colin Law
24058  * Reviewed By:
24059  * Reason for Change: Initial Revision of all files
24060  *
24061  * Design Change Details:
24062  *
24063  * Implications:
24064  *
24065 d58 6
24066 a63 5
24067 ARGUMENTS   :   name  : majorColour         colour for major grid lines
24068                         minorColour         colour for minor grid lines
24069                         sgLineType          line type for minor grid lines
24070                         yMajorGridLines     number of major y lines on grid
24071                         yMinorGridLines     number of major y lines on grid
24072 d77 2
24073 a78 3
24074         ScrollingGrid( GkiColour majorColour, GkiColour minorColour, 
24075             GkiLineType sgLineType, 
24076             uint16 yMajorGridLines, uint16 yMinorGridLines,
24077 a137 17
24078 FUNCTION    :   DrawHorizontalGridLines
24079
24080 DESCRIPTION :   Draws major or minor grid lines
24081 ARGUMENTS   :   pDC         device context
24082                 pPen        pen to use
24083                 numLines    total lines required
24084                 yLow, yHigh, xLow, xHigh   rectangle to draw in
24085                 yMax        max y value
24086 RETURN      :   None
24087 NOTES       :   
24088 ---------------------------------------------------------------------------*/
24089         void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, 
24090             uint16 numLines,
24091             uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, 
24092             uint16 yMax );
24093
24094 /*---------------------------------------------------------------------------
24095 d148 6
24096 d448 1
24097 a448 2
24098         uint16  m_yMajorGridLines;
24099         uint16  m_yMinorGridLines;
24100 d456 2
24101 a457 3
24102         GkiLineType lineType;    // line type for minor grid lines
24103         GkiColour   m_majorColour;
24104         GkiColour   m_minorColour;
24105 d462 1
24106 a462 2
24107         CPen *pMajorPen;        // pen to use for drawing major grid lines
24108         CPen *pMinorPen;        // pen to use for drawing minor grid lines
24109 d472 12
24110 @" > diffmerge2/sgrid.h,v
24111
24112           # We have to put the RCS file in the repository by hand for
24113           # this test:
24114           mkdir ${CVSROOT_DIRNAME}/diffmerge2
24115           cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
24116           rm -rf diffmerge2
24117           dotest diffmerge2_co \
24118             "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
24119           cd diffmerge2
24120           dotest diffmerge2_update \
24121             "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
24122             "${DOTSTAR}erging ${DOTSTAR}"
24123           # This is the one that counts -- there should be no output:
24124           dotest diffmerge2_diff \
24125             "${testcvs} diff -r Review_V1p3 sgrid.h" ''
24126
24127           cd ..
24128           rm -rf diffmerge2
24129           rm -rf ${CVSROOT_DIRNAME}/diffmerge2
24130           ;;
24131
24132         release)
24133           # Tests of "cvs release", particularly multiple arguments.
24134           # Other CVS release tests:
24135           #   info-cleanup-0 for "cvs -n release".
24136           #   ignore-193 for the text of the question that cvs release asks.
24137           #     Also for interactions with cvsignore.
24138           #   basicc: "-d .", global -Q, no arguments (is a noop),
24139           #     "cvs release" without -d, multiple arguments.
24140           #   dirs-4: repository directory has been deleted.
24141           #   modules2-6: multiple arguments.
24142
24143           # First the usual setup; create a directory first-dir.
24144           mkdir 1; cd 1
24145           dotest release-1 "${testcvs} -q co -l ." ''
24146           mkdir first-dir
24147           dotest release-2 "${testcvs} add first-dir" \
24148 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
24149           cd first-dir
24150           mkdir dir1
24151           dotest release-3 "${testcvs} add dir1" \
24152 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
24153           mkdir dir2
24154           dotest release-4 "${testcvs} add dir2" \
24155 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository"
24156           cd dir2
24157           mkdir dir3
24158           dotest release-5 "${testcvs} add dir3" \
24159 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
24160
24161           cd ../..
24162           dotest release-6 "${testcvs} release -d first-dir/dir2/dir3 first-dir/dir1" \
24163 "You have .0. altered files in this repository.
24164 Are you sure you want to release (and delete) directory .first-dir/dir2/dir3.: \
24165 You have .0. altered files in this repository.
24166 Are you sure you want to release (and delete) directory .first-dir/dir1.: " <<EOF
24167 yes
24168 yes
24169 EOF
24170           dotest_fail release-7 "test -d first-dir/dir1" ''
24171           dotest_fail release-8 "test -d first-dir/dir2/dir3" ''
24172           dotest release-9 "${testcvs} update" \
24173 "${PROG} update: Updating \.
24174 ${PROG} update: Updating first-dir
24175 ${PROG} update: Updating first-dir/dir2"
24176
24177           cd first-dir
24178           mkdir dir1
24179           dotest release-10 "${testcvs} add dir1" \
24180 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
24181           cd dir2
24182           mkdir dir3
24183           dotest release-11 "${testcvs} add dir3" \
24184 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
24185
24186           cd ../..
24187           dotest release-12 "${testcvs} release first-dir/dir2/dir3 first-dir/dir1" \
24188 "You have .0. altered files in this repository.
24189 Are you sure you want to release directory .first-dir/dir2/dir3.: .. .release. aborted by user choice.
24190 You have .0. altered files in this repository.
24191 Are you sure you want to release directory .first-dir/dir1.: " <<EOF
24192 no
24193 yes
24194 EOF
24195           dotest release-13 "${testcvs} release first-dir/dir2/dir3 first-dir/dir2" \
24196 "You have .0. altered files in this repository.
24197 Are you sure you want to release directory .first-dir/dir2/dir3.: \
24198 You have .0. altered files in this repository.
24199 Are you sure you want to release directory .first-dir/dir2.: " <<EOF
24200 yes
24201 yes
24202 EOF
24203           dotest release-14 "test -d first-dir/dir1" ''
24204           dotest release-15 "test -d first-dir/dir2/dir3" ''
24205           rm -rf first-dir/dir1 first-dir/dir2
24206
24207           dotest release-16 "${testcvs} update" \
24208 "${PROG} update: Updating \.
24209 ${PROG} update: Updating first-dir"
24210
24211           # Check to make sure release isn't overwriting a
24212           # CVS/Entries file in the current directory (using data
24213           # from the released directory).
24214
24215           # cvs 1.11 (remote) fails on release-21 (a message about
24216           # chdir into the removed directory), although it seemingly
24217           # unedits and removes the directory correctly.  If
24218           # you manually continue, it then fails on release-22 do
24219           # to the messed up CVS/Entries file from release-21.
24220           cd first-dir
24221           mkdir second-dir
24222           dotest release-18 "$testcvs add second-dir" \
24223 "Directory $CVSROOT_DIRNAME/first-dir/second-dir added to the repository"
24224
24225           cd second-dir
24226           touch file1
24227           dotest release-19 "$testcvs -Q add file1"
24228           dotest release-20 '$testcvs -q ci -m add' \
24229 "RCS file: $CVSROOT_DIRNAME/first-dir/second-dir/file1,v
24230 done
24231 Checking in file1;
24232 $CVSROOT_DIRNAME/first-dir/second-dir/file1,v  <--  file1
24233 initial revision: 1\.1
24234 done"
24235           dotest release-21 "$testcvs edit file1"
24236           cd ..
24237           dotest release-22 "echo yes | $testcvs release -d second-dir" \
24238 "You have \[0\] altered files in this repository.
24239 Are you sure you want to release (and delete) directory \`second-dir': "
24240           dotest release-23 "$testcvs -q update -d" "U second-dir/file1"
24241           dotest release-24 "$testcvs edit"
24242
24243           cd ../..
24244           rm -rf 1 $CVSROOT_DIRNAME/first-dir
24245           ;;
24246
24247
24248
24249         recase)
24250           #
24251           # Some tests of behavior which broke at one time or another when run
24252           # from case insensitive clients against case sensitive servers.
24253           #
24254           # These tests are namned according to the following convention:
24255           #
24256           #   ci        Client (sandbox filesystem) case Insensitive
24257           #   cs        Client (sandbox filesystem) case Sensitive
24258           #   si        Server (repository filesystem) case Insensitive
24259           #   ss        Server (repository filesystem) case Sensitive
24260           #
24261
24262           mkdir 1; cd 1
24263
24264           # First, we will expect different results for a few of these tests
24265           # based on whether the repository is on a case sensitive filesystem
24266           # or not and whether the sandbox is on a case sensitive filesystem or
24267           # not, so determine which cases we are dealing with:
24268           echo file >file
24269           echo FiLe >FiLe
24270           if cmp file FiLe >/dev/null; then
24271             client_sensitive=false
24272           else
24273             client_sensitive=:
24274           fi
24275           if test -n "$remotehost"; then
24276             $CVS_RSH $remotehost 'echo file >file'
24277             $CVS_RSH $remotehost 'echo FiLe >FiLe'
24278             if $CVS_RSH $remotehost 'cmp file FiLe >/dev/null'; then
24279               server_sensitive=false
24280             else
24281               server_sensitive=:
24282             fi
24283           else
24284             server_sensitive=$client_sensitive
24285           fi
24286
24287           # The first test (recase-1 & recase-2) is for a remove of a file then
24288           # a readd in a different case.
24289           mkdir $CVSROOT_DIRNAME/first-dir
24290           dotest recase-init-1 "$testcvs -Q co first-dir"       
24291           cd first-dir
24292
24293           echo this file has no content >file
24294           dotest recase-init-2 "$testcvs -Q add file"
24295           dotest recase-init-3 "$testcvs -Q ci -madd" \
24296 "RCS file: $CVSROOT_DIRNAME/first-dir/file,v
24297 done
24298 Checking in file;
24299 $CVSROOT_DIRNAME/first-dir/file,v  <--  file
24300 initial revision: 1\.1
24301 done"
24302           dotest recase-init-4 "$testcvs -Q tag first"
24303
24304           # Now remove the file.
24305           dotest recase-init-5 "$testcvs -Q rm -f file"
24306           dotest recase-init-6 "$testcvs -Q ci -mrm" \
24307 "Removing file;
24308 $CVSROOT_DIRNAME/first-dir/file,v  <--  file
24309 new revision: delete; previous revision: 1\.1
24310 done"
24311
24312           # Now the test - readd in a different case.
24313           echo this file needs some content >FiLe
24314           if $server_sensitive; then
24315             dotest recase-1ss "$testcvs add FiLe" \
24316 "$PROG add: scheduling file \`FiLe' for addition
24317 $PROG add: use '$PROG commit' to add this file permanently"
24318             dotest recase-2ss "$testcvs -q ci -mrecase" \
24319 "RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24320 done
24321 Checking in FiLe;
24322 $CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
24323 initial revision: 1\.1
24324 done"
24325           else # server insensitive
24326             dotest recase-1si "$testcvs add FiLe" \
24327 "$PROG add: Re-adding file \`FiLe' (in place of dead revision 1\.2)\.
24328 $PROG add: use '$PROG commit' to add this file permanently"
24329             dotest recase-2si "$testcvs -q ci -mrecase" \
24330 "Checking in FiLe;
24331 $CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
24332 new revision: 1\.3; previous revision: 1\.2
24333 done"
24334           fi
24335
24336           # Now verify that a checkout will still work
24337           cd ../..
24338           mkdir 2; cd 2
24339           dotest recase-3 "$testcvs -q co first-dir" \
24340 "U first-dir/FiLe"
24341
24342           cd first-dir
24343           # Prove that we can still get status and log information on
24344           # conflicting case files (1 in Attic, one in parent).
24345           if $remote; then
24346             if $client_sensitive; then
24347               file=file
24348               fIlE=fIlE
24349             else # client insensitive
24350               # Because FiLe is present on a case insensitive client, it is the
24351               # only one ever found and queried or altered.
24352               file=FiLe
24353               fIlE=FiLe
24354             fi
24355           else # ! $remote
24356             file=file
24357             fIlE=fIlE
24358           fi
24359           if $server_sensitive; then
24360             if $client_sensitive; then
24361               # Client finds Entry only for FiLe.  Others returned by server.
24362               dotest recase-4sscs "$testcvs status file" \
24363 "===================================================================
24364 File: no file file              Status: Up-to-date
24365
24366    Working revision:    No entry for file
24367    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/Attic/file,v"
24368               dotest recase-5sscs "$testcvs log file" \
24369 "
24370 RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
24371 Working file: file
24372 head: 1\.2
24373 branch:
24374 locks: strict
24375 access list:
24376 symbolic names:
24377         first: 1\.1
24378 keyword substitution: kv
24379 total revisions: 2;     selected revisions: 2
24380 description:
24381 ----------------------------
24382 revision 1\.2
24383 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
24384 rm
24385 ----------------------------
24386 revision 1\.1
24387 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24388 add
24389 ============================================================================="
24390               dotest recase-6sscs "$testcvs status FiLe" \
24391 "===================================================================
24392 File: FiLe              Status: Up-to-date
24393
24394    Working revision:    1\.1.*
24395    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24396    Sticky Tag:          (none)
24397    Sticky Date:         (none)
24398    Sticky Options:      (none)"
24399               dotest recase-7sscs "$testcvs log FiLe" \
24400 "
24401 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24402 Working file: FiLe
24403 head: 1\.1
24404 branch:
24405 locks: strict
24406 access list:
24407 symbolic names:
24408 keyword substitution: kv
24409 total revisions: 1;     selected revisions: 1
24410 description:
24411 ----------------------------
24412 revision 1\.1
24413 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24414 recase
24415 ============================================================================="
24416             else # server sensitive && client insensitive
24417               # Client finds same Entry for file & FiLe.
24418               dotest recase-4ssci "$testcvs status file" \
24419 "===================================================================
24420 File: FiLe              Status: Up-to-date
24421
24422    Working revision:    1\.1.*
24423    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24424    Sticky Tag:          (none)
24425    Sticky Date:         (none)
24426    Sticky Options:      (none)"
24427               dotest recase-5ssci "$testcvs log file" \
24428 "
24429 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24430 Working file: FiLe
24431 head: 1\.1
24432 branch:
24433 locks: strict
24434 access list:
24435 symbolic names:
24436 keyword substitution: kv
24437 total revisions: 1;     selected revisions: 1
24438 description:
24439 ----------------------------
24440 revision 1\.1
24441 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24442 recase
24443 ============================================================================="
24444               dotest recase-6ss "$testcvs status FiLe" \
24445 "===================================================================
24446 File: FiLe              Status: Up-to-date
24447
24448    Working revision:    1\.1.*
24449    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24450    Sticky Tag:          (none)
24451    Sticky Date:         (none)
24452    Sticky Options:      (none)"
24453               dotest recase-7ss "$testcvs log FiLe" \
24454 "
24455 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24456 Working file: FiLe
24457 head: 1\.1
24458 branch:
24459 locks: strict
24460 access list:
24461 symbolic names:
24462 keyword substitution: kv
24463 total revisions: 1;     selected revisions: 1
24464 description:
24465 ----------------------------
24466 revision 1\.1
24467 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24468 recase
24469 ============================================================================="
24470             fi
24471           else # server insensitive
24472             # There is only one archive when the server is insensitive, but the
24473             # printed file/archive name can vary.
24474             dotest recase-4si "$testcvs status file" \
24475 "===================================================================
24476 File: $file                     Status: Up-to-date
24477
24478    Working revision:    1\.3.*
24479    Repository revision: 1\.3    $CVSROOT_DIRNAME/first-dir/$file,v
24480    Sticky Tag:          (none)
24481    Sticky Date:         (none)
24482    Sticky Options:      (none)"
24483             dotest recase-5si "$testcvs log file" \
24484 "
24485 RCS file: $CVSROOT_DIRNAME/first-dir/$file,v
24486 Working file: $file
24487 head: 1\.3
24488 branch:
24489 locks: strict
24490 access list:
24491 symbolic names:
24492         first: 1\.1
24493 keyword substitution: kv
24494 total revisions: 3;     selected revisions: 3
24495 description:
24496 ----------------------------
24497 revision 1\.3
24498 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
24499 recase
24500 ----------------------------
24501 revision 1\.2
24502 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
24503 rm
24504 ----------------------------
24505 revision 1\.1
24506 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24507 add
24508 ============================================================================="
24509             dotest recase-6si "$testcvs status FiLe" \
24510 "===================================================================
24511 File: FiLe              Status: Up-to-date
24512
24513    Working revision:    1\.3.*
24514    Repository revision: 1\.3    $CVSROOT_DIRNAME/first-dir/FiLe,v
24515    Sticky Tag:          (none)
24516    Sticky Date:         (none)
24517    Sticky Options:      (none)"
24518             dotest recase-7si "$testcvs log FiLe" \
24519 "
24520 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24521 Working file: FiLe
24522 head: 1\.3
24523 branch:
24524 locks: strict
24525 access list:
24526 symbolic names:
24527         first: 1\.1
24528 keyword substitution: kv
24529 total revisions: 3;     selected revisions: 3
24530 description:
24531 ----------------------------
24532 revision 1\.3
24533 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
24534 recase
24535 ----------------------------
24536 revision 1\.2
24537 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
24538 rm
24539 ----------------------------
24540 revision 1\.1
24541 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24542 add
24543 ============================================================================="
24544           fi
24545
24546           # And when the file does not exist on the client, we go with the
24547           # client Entries match.
24548           if $client_sensitive && $server_sensitive; then
24549             dotest recase-8sscs "$testcvs status fIlE" \
24550 "$PROG status: nothing known about fIlE
24551 ===================================================================
24552 File: no file fIlE              Status: Unknown
24553
24554    Working revision:    No entry for fIlE
24555    Repository revision: No revision control file"
24556           else # !$client_sensitive || !$server_sensitive
24557             dotest recase-8anyi "$testcvs status fIlE" \
24558 "===================================================================
24559 File: $fIlE                     Status: Up-to-date
24560
24561    Working revision:    1\.[0-9]*.*
24562    Repository revision: 1\.[0-9]*       $CVSROOT_DIRNAME/first-dir/$fIlE,v
24563    Sticky Tag:          (none)
24564    Sticky Date:         (none)
24565    Sticky Options:      (none)"
24566           fi
24567
24568           # and an update
24569           if $server_sensitive; then
24570             dotest recase-9ss "$testcvs -q up -rfirst" \
24571 "$PROG update: FiLe is no longer in the repository
24572 U file"
24573
24574             if $client_sensitive; then
24575               dotest recase-10sscs "$testcvs -q up -A" \
24576 "U FiLe
24577 $PROG update: file is no longer in the repository"
24578             else # client insensitive
24579               # FIXCVS: This should remove the offending file first.
24580               dotest_fail recase-10ssci "$testcvs -q up -A" \
24581 "$PROG update: move away \./FiLe; it is in the way
24582 C FiLe
24583 $PROG update: file is no longer in the repository"
24584
24585               cd ..
24586               rm -r first-dir
24587               dotest recase-11ssci "$testcvs -q co first-dir" \
24588 "U first-dir/FiLe"
24589               cd first-dir
24590             fi
24591
24592             #
24593             # See what happens when cased names clash.
24594             #
24595
24596             # Copy the archive
24597             if test -n "$remotehost"; then
24598               $CVS_RSH $remotehost "cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
24599                 $CVSROOT_DIRNAME/first-dir/FILE,v"
24600             else
24601               cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
24602                 $CVSROOT_DIRNAME/first-dir/FILE,v
24603             fi
24604
24605             if $client_sensitive; then
24606               dotest recase-12sscs "$testcvs -q up" "U FILE"
24607             else # client insensitive
24608               dotest_fail recase-12ssci "$testcvs -q up" \
24609 "$PROG update: move away \./FILE; it is in the way
24610 C FILE"
24611             fi
24612           else # server insensitive
24613             dotest recase-9si "$testcvs -q up -rfirst" "U FiLe"
24614             dotest recase-10si "$testcvs -q up -A" "U FiLe"
24615           fi
24616
24617           # Prove that we can still get status and log information on
24618           # conflicting case files (1 in Attic, two in parent).
24619           if $server_sensitive; then
24620             if $client_sensitive; then
24621               # Client finds Entry only for FiLe.  Others returned by server.
24622               dotest recase-13sscs "$testcvs status file" \
24623 "===================================================================
24624 File: no file file              Status: Up-to-date
24625
24626    Working revision:    No entry for file
24627    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/Attic/file,v"
24628             dotest recase-14sscs "$testcvs log file" \
24629 "
24630 RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
24631 Working file: file
24632 head: 1\.2
24633 branch:
24634 locks: strict
24635 access list:
24636 symbolic names:
24637         first: 1\.1
24638 keyword substitution: kv
24639 total revisions: 2;     selected revisions: 2
24640 description:
24641 ----------------------------
24642 revision 1\.2
24643 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
24644 rm
24645 ----------------------------
24646 revision 1\.1
24647 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24648 add
24649 ============================================================================="
24650             dotest recase-15sscs "$testcvs status FiLe" \
24651 "===================================================================
24652 File: FiLe              Status: Up-to-date
24653
24654    Working revision:    1\.1.*
24655    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24656    Sticky Tag:          (none)
24657    Sticky Date:         (none)
24658    Sticky Options:      (none)"
24659               dotest recase-16sscs "$testcvs log FiLe" \
24660 "
24661 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24662 Working file: FiLe
24663 head: 1\.1
24664 branch:
24665 locks: strict
24666 access list:
24667 symbolic names:
24668 keyword substitution: kv
24669 total revisions: 1;     selected revisions: 1
24670 description:
24671 ----------------------------
24672 revision 1\.1
24673 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24674 recase
24675 ============================================================================="
24676               dotest recase-17sscs "$testcvs status FILE" \
24677 "===================================================================
24678 File: FILE              Status: Up-to-date
24679
24680    Working revision:    1.1.*
24681    Repository revision: 1.1     ${CVSROOT_DIRNAME}/first-dir/FILE,v
24682    Sticky Tag:          (none)
24683    Sticky Date:         (none)
24684    Sticky Options:      (none)"
24685               dotest recase-18sscs "$testcvs log FILE" \
24686 "
24687 RCS file: $CVSROOT_DIRNAME/first-dir/FILE,v
24688 Working file: FILE
24689 head: 1\.1
24690 branch:
24691 locks: strict
24692 access list:
24693 symbolic names:
24694 keyword substitution: kv
24695 total revisions: 1;     selected revisions: 1
24696 description:
24697 ----------------------------
24698 revision 1\.1
24699 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24700 recase
24701 ============================================================================="
24702             else # $server_sensitive && !$client_sensitive
24703               # Client finds same Entry for file & FiLe.
24704               dotest recase-13ssci "$testcvs status file" \
24705 "===================================================================
24706 File: FiLe              Status: Up-to-date
24707
24708    Working revision:    1\.1.*
24709    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24710    Sticky Tag:          (none)
24711    Sticky Date:         (none)
24712    Sticky Options:      (none)"
24713               dotest recase-16ssci "$testcvs log FiLe" \
24714 "
24715 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24716 Working file: FiLe
24717 head: 1\.1
24718 branch:
24719 locks: strict
24720 access list:
24721 symbolic names:
24722 keyword substitution: kv
24723 total revisions: 1;     selected revisions: 1
24724 description:
24725 ----------------------------
24726 revision 1\.1
24727 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24728 recase
24729 ============================================================================="
24730               dotest recase-17ssci "$testcvs status FILE" \
24731 "===================================================================
24732 File: FiLe              Status: Up-to-date
24733
24734    Working revision:    1\.1.*
24735    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
24736    Sticky Tag:          (none)
24737    Sticky Date:         (none)
24738    Sticky Options:      (none)"
24739               dotest recase-18ssci "$testcvs log FILE" \
24740 "
24741 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
24742 Working file: FiLe
24743 head: 1\.1
24744 branch:
24745 locks: strict
24746 access list:
24747 symbolic names:
24748 keyword substitution: kv
24749 total revisions: 1;     selected revisions: 1
24750 description:
24751 ----------------------------
24752 revision 1\.1
24753 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24754 recase
24755 ============================================================================="
24756             fi
24757           else # !$server_sensitive
24758             # Skip these when the server is case insensitive - nothing
24759             # has changed since recase-[4-7]si
24760             :
24761           fi
24762
24763           if $client_sensitive && $server_sensitive; then
24764             dotest recase-19sscs "$testcvs status fIlE" \
24765 "$PROG status: nothing known about fIlE
24766 ===================================================================
24767 File: no file fIlE              Status: Unknown
24768
24769    Working revision:    No entry for fIlE
24770    Repository revision: No revision control file"
24771           else # !$client_sensitive || !$server_sensitive
24772             dotest recase-19anyi "$testcvs status fIlE" \
24773 "===================================================================
24774 File: $fIlE                     Status: Up-to-date
24775
24776    Working revision:    1\.[0-9]*.*
24777    Repository revision: 1\.[0-9]*       $CVSROOT_DIRNAME/first-dir/$fIlE,v
24778    Sticky Tag:          (none)
24779    Sticky Date:         (none)
24780    Sticky Options:      (none)"
24781           fi
24782
24783           # And last but not least, prove that a checkout is still possible.
24784           cd ../..
24785           mkdir 3; cd 3
24786           if $server_sensitive; then
24787             if $client_sensitive; then
24788               dotest recase-20sscs "$testcvs -q co first-dir" \
24789 "U first-dir/FILE
24790 U first-dir/FiLe"
24791             else # $server_senstive && !$client_sensitive
24792               dotest_fail recase-20ssci "$testcvs -q co first-dir" \
24793 "U first-dir/FILE
24794 $PROG checkout: move away first-dir/FiLe; it is in the way
24795 C first-dir/FiLe"
24796             fi
24797           else # !$server_sensitive
24798             # Skip these since nothing has changed.
24799             :
24800           fi
24801
24802           if $keep; then
24803             echo Keeping ${TESTDIR} and exiting due to --keep
24804             exit 0
24805           fi
24806
24807           cd ..
24808           rm -r 1 2 3
24809           if $server_sensitive && test -n "$remotehost"; then
24810             # It is necessary to remove one of the case-conflicted files before
24811             # recursively removing the rest under Cygwin on a Samba share or
24812             # Samba returns a permission denied error due to its case
24813             # confusion.
24814             $CVS_RSH $remotehost "rm -f $CVSROOT_DIRNAME/first-dir/FILE,v"
24815           fi
24816           rm -rf $CVSROOT_DIRNAME/first-dir
24817           ;;
24818
24819
24820
24821         multiroot)
24822           #
24823           # set up two repositories
24824           #
24825
24826           CVSROOT1_DIRNAME=${TESTDIR}/root1
24827           CVSROOT2_DIRNAME=${TESTDIR}/root2
24828           CVSROOT1=`newroot $CVSROOT1_DIRNAME`
24829           CVSROOT2=`newroot $CVSROOT2_DIRNAME`
24830           testcvs1="${testcvs} -d ${CVSROOT1}"
24831           testcvs2="${testcvs} -d ${CVSROOT2}"
24832
24833           dotest multiroot-setup-1 "mkdir ${CVSROOT1_DIRNAME} ${CVSROOT2_DIRNAME}" ""
24834           dotest multiroot-setup-2 "${testcvs1} init" ""
24835           dotest multiroot-setup-3 "${testcvs2} init" ""
24836
24837           #
24838           # create some directories in root1
24839           #
24840           mkdir 1; cd 1
24841           dotest multiroot-setup-4 "${testcvs1} co -l ." \
24842 "${PROG} checkout: Updating ."
24843           mkdir mod1-1 mod1-2
24844           dotest multiroot-setup-5 "${testcvs1} add mod1-1 mod1-2" \
24845 "Directory ${CVSROOT1_DIRNAME}/mod1-1 added to the repository
24846 Directory ${CVSROOT1_DIRNAME}/mod1-2 added to the repository"
24847           echo file1-1 > mod1-1/file1-1
24848           echo file1-2 > mod1-2/file1-2
24849           dotest multiroot-setup-6 "${testcvs1} add mod1-1/file1-1 mod1-2/file1-2" \
24850 "${PROG} add: scheduling file .mod1-1/file1-1. for addition
24851 ${PROG} add: scheduling file .mod1-2/file1-2. for addition
24852 ${PROG} add: use .${PROG} commit. to add these files permanently"
24853           dotest multiroot-setup-7 "${testcvs1} commit -m is" \
24854 "${PROG} [a-z]*: Examining \.
24855 ${PROG} [a-z]*: Examining mod1-1
24856 ${PROG} [a-z]*: Examining mod1-2
24857 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
24858 done
24859 Checking in mod1-1/file1-1;
24860 ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v  <--  file1-1
24861 initial revision: 1.1
24862 done
24863 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
24864 done
24865 Checking in mod1-2/file1-2;
24866 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
24867 initial revision: 1.1
24868 done"
24869           cd ..
24870           rm -rf 1
24871
24872           #
24873           # create some directories in root2
24874           #
24875           mkdir 1; cd 1
24876           dotest multiroot-setup-8 "${testcvs2} co -l ." \
24877 "${PROG} checkout: Updating ."
24878           mkdir mod2-1 mod2-2
24879           dotest multiroot-setup-9 "${testcvs2} add mod2-1 mod2-2" \
24880 "Directory ${CVSROOT2_DIRNAME}/mod2-1 added to the repository
24881 Directory ${CVSROOT2_DIRNAME}/mod2-2 added to the repository"
24882           echo file2-1 > mod2-1/file2-1
24883           echo file2-2 > mod2-2/file2-2
24884           dotest multiroot-setup-6 "${testcvs2} add mod2-1/file2-1 mod2-2/file2-2" \
24885 "${PROG} add: scheduling file .mod2-1/file2-1. for addition
24886 ${PROG} add: scheduling file .mod2-2/file2-2. for addition
24887 ${PROG} add: use .${PROG} commit. to add these files permanently"
24888           dotest multiroot-setup-10 "${testcvs2} commit -m anyone" \
24889 "${PROG} [a-z]*: Examining \.
24890 ${PROG} [a-z]*: Examining mod2-1
24891 ${PROG} [a-z]*: Examining mod2-2
24892 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
24893 done
24894 Checking in mod2-1/file2-1;
24895 ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v  <--  file2-1
24896 initial revision: 1.1
24897 done
24898 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
24899 done
24900 Checking in mod2-2/file2-2;
24901 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v  <--  file2-2
24902 initial revision: 1.1
24903 done"
24904           cd ..
24905           rm -rf 1
24906
24907           # check out a few directories, from simple/shallow to
24908           # complex/deep
24909           mkdir 1; cd 1
24910
24911           # OK, this case is kind of weird.  If we just run things from
24912           # here, without CVS/Root, then CVS will contact the server
24913           # mentioned in CVSROOT (which is irrelevant) which will print
24914           # some messages.  Our workaround is to make sure we have a
24915           # CVS/Root file at top level.  In the future, it is possible
24916           # the best behavior will be to extend the existing behavior
24917           # ("being called from a directory without CVS administration
24918           # has always meant to process each of the sub-dirs") to also
24919           # do that if there is no CVSROOT, CVS/Root, or -d at top level.
24920           # 
24921           # The local case could stumble through the tests without creating
24922           # the top-level CVS/Root, but we create it for local and for
24923           # remote to reduce special cases later in the test.
24924           dotest multiroot-workaround "${testcvs1} -q co -l ." ""
24925
24926           dotest multiroot-setup-11 "${testcvs1} co mod1-1 mod1-2" \
24927 "${PROG} checkout: Updating mod1-1
24928 U mod1-1/file1-1
24929 ${PROG} checkout: Updating mod1-2
24930 U mod1-2/file1-2"
24931           dotest multiroot-setup-12 "${testcvs2} co mod2-1 mod2-2" \
24932 "${PROG} checkout: Updating mod2-1
24933 U mod2-1/file2-1
24934 ${PROG} checkout: Updating mod2-2
24935 U mod2-2/file2-2"
24936           cd mod1-2
24937           dotest multiroot-setup-13 "${testcvs2} co mod2-2" \
24938 "${PROG} checkout: Updating mod2-2
24939 U mod2-2/file2-2"
24940           cd ..
24941           cd mod2-2
24942           dotest multiroot-setup-14 "${testcvs1} co mod1-2" \
24943 "${PROG} checkout: Updating mod1-2
24944 U mod1-2/file1-2"
24945           cd ..
24946
24947           #
24948           # Make sure that the Root and Repository files contain the
24949           # correct information.
24950           #
24951           dotest multiroot-cvsadm-1a "cat mod1-1/CVS/Root" "${CVSROOT1}"
24952           dotest multiroot-cvsadm-1b "cat mod1-1/CVS/Repository" "mod1-1"
24953           dotest multiroot-cvsadm-2a "cat mod2-1/CVS/Root" "${CVSROOT2}"
24954           dotest multiroot-cvsadm-2b "cat mod2-1/CVS/Repository" "mod2-1"
24955           dotest multiroot-cvsadm-3a "cat mod1-2/CVS/Root" "${CVSROOT1}"
24956           dotest multiroot-cvsadm-3b "cat mod1-2/CVS/Repository" "mod1-2"
24957           dotest multiroot-cvsadm-3c "cat mod1-2/mod2-2/CVS/Root" "${CVSROOT2}"
24958           dotest multiroot-cvsadm-3d "cat mod1-2/mod2-2/CVS/Repository" "mod2-2"
24959           dotest multiroot-cvsadm-4a "cat mod2-2/CVS/Root" "${CVSROOT2}"
24960           dotest multiroot-cvsadm-4b "cat mod2-2/CVS/Repository" "mod2-2"
24961           dotest multiroot-cvsadm-4c "cat mod2-2/mod1-2/CVS/Root" "${CVSROOT1}"
24962           dotest multiroot-cvsadm-4d "cat mod2-2/mod1-2/CVS/Repository" "mod1-2"
24963
24964           #
24965           # Start testing various cvs commands.  Begin with commands
24966           # without extra arguments (e.g. "cvs update", "cvs diff",
24967           # etc.
24968           #
24969
24970           # Do at least one command with both CVSROOTs to make sure
24971           # that there's not some kind of unexpected dependency on the
24972           # choice of which CVSROOT is specified on the command line.
24973
24974           dotest multiroot-update-1a "${testcvs1} update" \
24975 "${PROG} update: Updating \.
24976 ${PROG} update: Updating mod1-1
24977 ${PROG} update: Updating mod1-2
24978 ${PROG} update: Updating mod1-2/mod2-2
24979 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
24980 ${PROG} update: skipping directory mod1-2/mod2-2
24981 ${PROG} update: Updating mod2-1
24982 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-1: No such file or directory
24983 ${PROG} update: skipping directory mod2-1
24984 ${PROG} update: Updating mod2-2
24985 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
24986 ${PROG} update: skipping directory mod2-2"
24987
24988           # Same deal but with -d ${CVSROOT2}.
24989           dotest multiroot-update-1b "${testcvs2} update" \
24990 "${PROG} update: Updating \.
24991 ${PROG} update: Updating mod1-1
24992 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-1: No such file or directory
24993 ${PROG} update: skipping directory mod1-1
24994 ${PROG} update: Updating mod1-2
24995 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
24996 ${PROG} update: skipping directory mod1-2
24997 ${PROG} update: Updating mod2-1
24998 ${PROG} update: Updating mod2-2
24999 ${PROG} update: Updating mod2-2/mod1-2
25000 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
25001 ${PROG} update: skipping directory mod2-2/mod1-2"
25002
25003           # modify all files and do a diff
25004
25005           echo bobby >> mod1-1/file1-1
25006           echo brown >> mod1-2/file1-2
25007           echo goes >> mod2-1/file2-1
25008           echo down >> mod2-2/file2-2
25009
25010           dotest_fail multiroot-diff-1 "${testcvs} diff" \
25011 "${PROG} diff: Diffing \.
25012 ${PROG} diff: Diffing mod1-1
25013 Index: mod1-1/file1-1
25014 ===================================================================
25015 RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
25016 retrieving revision 1\.1
25017 diff -r1\.1 file1-1
25018 1a2
25019 > bobby
25020 ${PROG} diff: Diffing mod1-2
25021 Index: mod1-2/file1-2
25022 ===================================================================
25023 RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
25024 retrieving revision 1\.1
25025 diff -r1\.1 file1-2
25026 1a2
25027 > brown
25028 ${PROG} diff: Diffing mod2-2/mod1-2
25029 ${PROG} diff: Diffing mod1-2/mod2-2
25030 ${PROG} diff: Diffing mod2-1
25031 Index: mod2-1/file2-1
25032 ===================================================================
25033 RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
25034 retrieving revision 1\.1
25035 diff -r1\.1 file2-1
25036 1a2
25037 > goes
25038 ${PROG} diff: Diffing mod2-2
25039 Index: mod2-2/file2-2
25040 ===================================================================
25041 RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
25042 retrieving revision 1\.1
25043 diff -r1\.1 file2-2
25044 1a2
25045 > down" \
25046 "${PROG} diff: Diffing \.
25047 ${PROG} diff: Diffing mod1-1
25048 Index: mod1-1/file1-1
25049 ===================================================================
25050 RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
25051 retrieving revision 1\.1
25052 diff -r1\.1 file1-1
25053 1a2
25054 > bobby
25055 ${PROG} diff: Diffing mod1-2
25056 Index: mod1-2/file1-2
25057 ===================================================================
25058 RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
25059 retrieving revision 1\.1
25060 diff -r1\.1 file1-2
25061 1a2
25062 > brown
25063 ${PROG} diff: Diffing mod2-2
25064 ${PROG} diff: Diffing mod2-2/mod1-2
25065 ${PROG} diff: Diffing mod1-2
25066 ${PROG} diff: Diffing mod1-2/mod2-2
25067 ${PROG} diff: Diffing mod2-1
25068 Index: mod2-1/file2-1
25069 ===================================================================
25070 RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
25071 retrieving revision 1\.1
25072 diff -r1\.1 file2-1
25073 1a2
25074 > goes
25075 ${PROG} diff: Diffing mod2-2
25076 Index: mod2-2/file2-2
25077 ===================================================================
25078 RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
25079 retrieving revision 1\.1
25080 diff -r1\.1 file2-2
25081 1a2
25082 > down"
25083
25084           dotest multiroot-commit-1 "${testcvs} commit -m actually" \
25085 "${PROG} [a-z]*: Examining \.
25086 ${PROG} [a-z]*: Examining mod1-1
25087 ${PROG} [a-z]*: Examining mod1-2
25088 ${PROG} [a-z]*: Examining mod2-2/mod1-2
25089 Checking in mod1-1/file1-1;
25090 ${TESTDIR}/root1/mod1-1/file1-1,v  <--  file1-1
25091 new revision: 1.2; previous revision: 1.1
25092 done
25093 Checking in mod1-2/file1-2;
25094 ${TESTDIR}/root1/mod1-2/file1-2,v  <--  file1-2
25095 new revision: 1.2; previous revision: 1.1
25096 done
25097 ${PROG} [a-z]*: Examining mod1-2/mod2-2
25098 ${PROG} [a-z]*: Examining mod2-1
25099 ${PROG} [a-z]*: Examining mod2-2
25100 Checking in mod2-1/file2-1;
25101 ${TESTDIR}/root2/mod2-1/file2-1,v  <--  file2-1
25102 new revision: 1.2; previous revision: 1.1
25103 done
25104 Checking in mod2-2/file2-2;
25105 ${TESTDIR}/root2/mod2-2/file2-2,v  <--  file2-2
25106 new revision: 1.2; previous revision: 1.1
25107 done"
25108
25109           dotest multiroot-update-2 "${testcvs} update" \
25110 "${PROG} update: Updating \.
25111 ${PROG} [a-z]*: Updating mod1-1
25112 ${PROG} [a-z]*: Updating mod1-2
25113 ${PROG} [a-z]*: Updating mod2-2/mod1-2
25114 U mod2-2/mod1-2/file1-2
25115 ${PROG} [a-z]*: Updating mod1-2/mod2-2
25116 U mod1-2/mod2-2/file2-2
25117 ${PROG} update: Updating mod2-1
25118 ${PROG} update: Updating mod2-2" \
25119 "${PROG} update: Updating \.
25120 ${PROG} update: Updating mod1-1
25121 ${PROG} update: Updating mod1-2
25122 ${PROG} update: Updating mod2-2
25123 ${PROG} update: Updating mod2-2/mod1-2
25124 P mod2-2/mod1-2/file1-2
25125 ${PROG} update: Updating mod1-2
25126 ${PROG} update: Updating mod1-2/mod2-2
25127 P mod1-2/mod2-2/file2-2
25128 ${PROG} update: Updating mod2-1
25129 ${PROG} update: Updating mod2-2"
25130
25131           dotest multiroot-tag-1 "${testcvs} tag cattle" \
25132 "${PROG} tag: Tagging \.
25133 ${PROG} tag: Tagging mod1-1
25134 T mod1-1/file1-1
25135 ${PROG} tag: Tagging mod1-2
25136 T mod1-2/file1-2
25137 ${PROG} tag: Tagging mod2-2/mod1-2
25138 ${PROG} tag: Tagging mod1-2/mod2-2
25139 T mod1-2/mod2-2/file2-2
25140 ${PROG} tag: Tagging mod2-1
25141 T mod2-1/file2-1
25142 ${PROG} tag: Tagging mod2-2" \
25143 "${PROG} tag: Tagging \.
25144 ${PROG} tag: Tagging mod1-1
25145 T mod1-1/file1-1
25146 ${PROG} tag: Tagging mod1-2
25147 T mod1-2/file1-2
25148 ${PROG} tag: Tagging mod2-2
25149 ${PROG} tag: Tagging mod2-2/mod1-2
25150 ${PROG} tag: Tagging mod1-2
25151 ${PROG} tag: Tagging mod1-2/mod2-2
25152 T mod1-2/mod2-2/file2-2
25153 ${PROG} tag: Tagging mod2-1
25154 T mod2-1/file2-1
25155 ${PROG} tag: Tagging mod2-2"
25156
25157           echo anotherfile1-1 > mod1-1/anotherfile1-1
25158           echo anotherfile2-1 > mod2-1/anotherfile2-1
25159           echo anotherfile1-2 > mod2-2/mod1-2/anotherfile1-2
25160           echo anotherfile2-2 > mod1-2/mod2-2/anotherfile2-2
25161
25162           if $remote; then
25163             cd mod1-1
25164             dotest multiroot-add-1ar "${testcvs} add anotherfile1-1" \
25165 "${PROG} add: scheduling file .anotherfile1-1. for addition
25166 ${PROG} add: use .${PROG} commit. to add this file permanently"
25167             cd ../mod2-1
25168             dotest multiroot-add-1br "${testcvs} add anotherfile2-1" \
25169 "${PROG} add: scheduling file .anotherfile2-1. for addition
25170 ${PROG} add: use .${PROG} commit. to add this file permanently"
25171             cd ../mod2-2/mod1-2
25172             dotest multiroot-add-1cr "${testcvs} add anotherfile1-2" \
25173 "${PROG} add: scheduling file .anotherfile1-2. for addition
25174 ${PROG} add: use .${PROG} commit. to add this file permanently"
25175             cd ../../mod1-2/mod2-2
25176             dotest multiroot-add-1dr "${testcvs} add anotherfile2-2" \
25177 "${PROG} add: scheduling file .anotherfile2-2. for addition
25178 ${PROG} add: use .${PROG} commit. to add this file permanently"
25179             cd ../..
25180           else
25181             dotest multiroot-add-1 "${testcvs} add mod1-1/anotherfile1-1 mod2-1/anotherfile2-1 mod2-2/mod1-2/anotherfile1-2 mod1-2/mod2-2/anotherfile2-2" \
25182 "${PROG} add: scheduling file .mod1-1/anotherfile1-1. for addition
25183 ${PROG} add: scheduling file .mod2-1/anotherfile2-1. for addition
25184 ${PROG} add: scheduling file .mod2-2/mod1-2/anotherfile1-2. for addition
25185 ${PROG} add: scheduling file .mod1-2/mod2-2/anotherfile2-2. for addition
25186 ${PROG} add: use .${PROG} commit. to add these files permanently"
25187           fi
25188
25189           dotest multiroot-status-1 "${testcvs} status -v" \
25190 "${PROG} status: Examining \.
25191 ${PROG} status: Examining mod1-1
25192 ===================================================================
25193 File: anotherfile1-1    Status: Locally Added
25194
25195    Working revision:    New file!
25196    Repository revision: No revision control file
25197    Sticky Tag:          (none)
25198    Sticky Date:         (none)
25199    Sticky Options:      (none)
25200
25201 ===================================================================
25202 File: file1-1           Status: Up-to-date
25203
25204    Working revision:    1\.2.*
25205    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
25206    Sticky Tag:          (none)
25207    Sticky Date:         (none)
25208    Sticky Options:      (none)
25209
25210    Existing Tags:
25211         cattle                          (revision: 1\.2)
25212
25213 ${PROG} status: Examining mod1-2
25214 ===================================================================
25215 File: file1-2           Status: Up-to-date
25216
25217    Working revision:    1\.2.*
25218    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25219    Sticky Tag:          (none)
25220    Sticky Date:         (none)
25221    Sticky Options:      (none)
25222
25223    Existing Tags:
25224         cattle                          (revision: 1\.2)
25225
25226 ${PROG} status: Examining mod2-2/mod1-2
25227 ===================================================================
25228 File: anotherfile1-2    Status: Locally Added
25229
25230    Working revision:    New file!
25231    Repository revision: No revision control file
25232    Sticky Tag:          (none)
25233    Sticky Date:         (none)
25234    Sticky Options:      (none)
25235
25236 ===================================================================
25237 File: file1-2           Status: Up-to-date
25238
25239    Working revision:    1\.2.*
25240    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25241    Sticky Tag:          (none)
25242    Sticky Date:         (none)
25243    Sticky Options:      (none)
25244
25245    Existing Tags:
25246         cattle                          (revision: 1\.2)
25247
25248 ${PROG} status: Examining mod1-2/mod2-2
25249 ===================================================================
25250 File: anotherfile2-2    Status: Locally Added
25251
25252    Working revision:    New file!
25253    Repository revision: No revision control file
25254    Sticky Tag:          (none)
25255    Sticky Date:         (none)
25256    Sticky Options:      (none)
25257
25258 ===================================================================
25259 File: file2-2           Status: Up-to-date
25260
25261    Working revision:    1\.2.*
25262    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25263    Sticky Tag:          (none)
25264    Sticky Date:         (none)
25265    Sticky Options:      (none)
25266
25267    Existing Tags:
25268         cattle                          (revision: 1\.2)
25269
25270 ${PROG} status: Examining mod2-1
25271 ===================================================================
25272 File: anotherfile2-1    Status: Locally Added
25273
25274    Working revision:    New file!
25275    Repository revision: No revision control file
25276    Sticky Tag:          (none)
25277    Sticky Date:         (none)
25278    Sticky Options:      (none)
25279
25280 ===================================================================
25281 File: file2-1           Status: Up-to-date
25282
25283    Working revision:    1\.2.*
25284    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
25285    Sticky Tag:          (none)
25286    Sticky Date:         (none)
25287    Sticky Options:      (none)
25288
25289    Existing Tags:
25290         cattle                          (revision: 1\.2)
25291
25292 ${PROG} status: Examining mod2-2
25293 ===================================================================
25294 File: file2-2           Status: Up-to-date
25295
25296    Working revision:    1\.2.*
25297    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25298    Sticky Tag:          (none)
25299    Sticky Date:         (none)
25300    Sticky Options:      (none)
25301
25302    Existing Tags:
25303         cattle                          (revision: 1\.2)" \
25304 "${PROG} status: Examining \.
25305 ${PROG} status: Examining mod1-1
25306 ===================================================================
25307 File: anotherfile1-1    Status: Locally Added
25308
25309    Working revision:    New file!
25310    Repository revision: No revision control file
25311    Sticky Tag:          (none)
25312    Sticky Date:         (none)
25313    Sticky Options:      (none)
25314
25315 ===================================================================
25316 File: file1-1           Status: Up-to-date
25317
25318    Working revision:    1\.2.*
25319    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
25320    Sticky Tag:          (none)
25321    Sticky Date:         (none)
25322    Sticky Options:      (none)
25323
25324    Existing Tags:
25325         cattle                          (revision: 1\.2)
25326
25327 ${PROG} status: Examining mod1-2
25328 ===================================================================
25329 File: file1-2           Status: Up-to-date
25330
25331    Working revision:    1\.2.*
25332    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25333    Sticky Tag:          (none)
25334    Sticky Date:         (none)
25335    Sticky Options:      (none)
25336
25337    Existing Tags:
25338         cattle                          (revision: 1\.2)
25339
25340 ${PROG} status: Examining mod2-2
25341 ${PROG} status: Examining mod2-2/mod1-2
25342 ===================================================================
25343 File: anotherfile1-2    Status: Locally Added
25344
25345    Working revision:    New file!
25346    Repository revision: No revision control file
25347    Sticky Tag:          (none)
25348    Sticky Date:         (none)
25349    Sticky Options:      (none)
25350
25351 ===================================================================
25352 File: file1-2           Status: Up-to-date
25353
25354    Working revision:    1\.2.*
25355    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25356    Sticky Tag:          (none)
25357    Sticky Date:         (none)
25358    Sticky Options:      (none)
25359
25360    Existing Tags:
25361         cattle                          (revision: 1\.2)
25362
25363 ${PROG} status: Examining mod1-2
25364 ${PROG} status: Examining mod1-2/mod2-2
25365 ===================================================================
25366 File: anotherfile2-2    Status: Locally Added
25367
25368    Working revision:    New file!
25369    Repository revision: No revision control file
25370    Sticky Tag:          (none)
25371    Sticky Date:         (none)
25372    Sticky Options:      (none)
25373
25374 ===================================================================
25375 File: file2-2           Status: Up-to-date
25376
25377    Working revision:    1\.2.*
25378    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25379    Sticky Tag:          (none)
25380    Sticky Date:         (none)
25381    Sticky Options:      (none)
25382
25383    Existing Tags:
25384         cattle                          (revision: 1\.2)
25385
25386 ${PROG} status: Examining mod2-1
25387 ===================================================================
25388 File: anotherfile2-1    Status: Locally Added
25389
25390    Working revision:    New file!
25391    Repository revision: No revision control file
25392    Sticky Tag:          (none)
25393    Sticky Date:         (none)
25394    Sticky Options:      (none)
25395
25396 ===================================================================
25397 File: file2-1           Status: Up-to-date
25398
25399    Working revision:    1\.2.*
25400    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
25401    Sticky Tag:          (none)
25402    Sticky Date:         (none)
25403    Sticky Options:      (none)
25404
25405    Existing Tags:
25406         cattle                          (revision: 1\.2)
25407
25408 ${PROG} status: Examining mod2-2
25409 ===================================================================
25410 File: file2-2           Status: Up-to-date
25411
25412    Working revision:    1\.2.*
25413    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25414    Sticky Tag:          (none)
25415    Sticky Date:         (none)
25416    Sticky Options:      (none)
25417
25418    Existing Tags:
25419         cattle                          (revision: 1\.2)"
25420
25421           dotest multiroot-commit-2 "${testcvs} commit -m reading" \
25422 "${PROG} [a-z]*: Examining \.
25423 ${PROG} [a-z]*: Examining mod1-1
25424 ${PROG} [a-z]*: Examining mod1-2
25425 ${PROG} [a-z]*: Examining mod2-2/mod1-2
25426 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
25427 done
25428 Checking in mod1-1/anotherfile1-1;
25429 ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v  <--  anotherfile1-1
25430 initial revision: 1\.1
25431 done
25432 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
25433 done
25434 Checking in mod2-2/mod1-2/anotherfile1-2;
25435 ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v  <--  anotherfile1-2
25436 initial revision: 1\.1
25437 done
25438 ${PROG} [a-z]*: Examining mod1-2/mod2-2
25439 ${PROG} [a-z]*: Examining mod2-1
25440 ${PROG} [a-z]*: Examining mod2-2
25441 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
25442 done
25443 Checking in mod1-2/mod2-2/anotherfile2-2;
25444 ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v  <--  anotherfile2-2
25445 initial revision: 1\.1
25446 done
25447 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
25448 done
25449 Checking in mod2-1/anotherfile2-1;
25450 ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v  <--  anotherfile2-1
25451 initial revision: 1\.1
25452 done"
25453
25454           dotest multiroot-update-3 "${testcvs} update" \
25455 "${PROG} update: Updating \.
25456 ${PROG} [a-z]*: Updating mod1-1
25457 ${PROG} [a-z]*: Updating mod1-2
25458 U mod1-2/anotherfile1-2
25459 ${PROG} [a-z]*: Updating mod2-2/mod1-2
25460 ${PROG} [a-z]*: Updating mod1-2/mod2-2
25461 ${PROG} [a-z]*: Updating mod2-1
25462 ${PROG} [a-z]*: Updating mod2-2
25463 U mod2-2/anotherfile2-2" \
25464 "${PROG} update: Updating \.
25465 ${PROG} update: Updating mod1-1
25466 ${PROG} update: Updating mod1-2
25467 U mod1-2/anotherfile1-2
25468 ${PROG} update: Updating mod2-2
25469 ${PROG} update: Updating mod2-2/mod1-2
25470 ${PROG} update: Updating mod1-2
25471 ${PROG} update: Updating mod1-2/mod2-2
25472 ${PROG} update: Updating mod2-1
25473 ${PROG} update: Updating mod2-2
25474 U mod2-2/anotherfile2-2"
25475
25476           dotest multiroot-log-1 "${testcvs} log" \
25477 "${PROG} log: Logging \.
25478 ${PROG} log: Logging mod1-1
25479
25480 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
25481 Working file: mod1-1/anotherfile1-1
25482 head: 1\.1
25483 branch:
25484 locks: strict
25485 access list:
25486 symbolic names:
25487 keyword substitution: kv
25488 total revisions: 1;     selected revisions: 1
25489 description:
25490 ----------------------------
25491 revision 1\.1
25492 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25493 reading
25494 =============================================================================
25495
25496 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
25497 Working file: mod1-1/file1-1
25498 head: 1\.2
25499 branch:
25500 locks: strict
25501 access list:
25502 symbolic names:
25503         cattle: 1\.2
25504 keyword substitution: kv
25505 total revisions: 2;     selected revisions: 2
25506 description:
25507 ----------------------------
25508 revision 1\.2
25509 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25510 actually
25511 ----------------------------
25512 revision 1\.1
25513 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25514 is
25515 =============================================================================
25516 ${PROG} log: Logging mod1-2
25517
25518 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
25519 Working file: mod1-2/anotherfile1-2
25520 head: 1\.1
25521 branch:
25522 locks: strict
25523 access list:
25524 symbolic names:
25525 keyword substitution: kv
25526 total revisions: 1;     selected revisions: 1
25527 description:
25528 ----------------------------
25529 revision 1\.1
25530 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25531 reading
25532 =============================================================================
25533
25534 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25535 Working file: mod1-2/file1-2
25536 head: 1\.2
25537 branch:
25538 locks: strict
25539 access list:
25540 symbolic names:
25541         cattle: 1\.2
25542 keyword substitution: kv
25543 total revisions: 2;     selected revisions: 2
25544 description:
25545 ----------------------------
25546 revision 1\.2
25547 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25548 actually
25549 ----------------------------
25550 revision 1\.1
25551 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25552 is
25553 =============================================================================
25554 ${PROG} log: Logging mod2-2/mod1-2
25555
25556 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
25557 Working file: mod2-2/mod1-2/anotherfile1-2
25558 head: 1\.1
25559 branch:
25560 locks: strict
25561 access list:
25562 symbolic names:
25563 keyword substitution: kv
25564 total revisions: 1;     selected revisions: 1
25565 description:
25566 ----------------------------
25567 revision 1\.1
25568 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25569 reading
25570 =============================================================================
25571
25572 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25573 Working file: mod2-2/mod1-2/file1-2
25574 head: 1\.2
25575 branch:
25576 locks: strict
25577 access list:
25578 symbolic names:
25579         cattle: 1\.2
25580 keyword substitution: kv
25581 total revisions: 2;     selected revisions: 2
25582 description:
25583 ----------------------------
25584 revision 1\.2
25585 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25586 actually
25587 ----------------------------
25588 revision 1\.1
25589 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25590 is
25591 =============================================================================
25592 ${PROG} log: Logging mod1-2/mod2-2
25593
25594 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
25595 Working file: mod1-2/mod2-2/anotherfile2-2
25596 head: 1\.1
25597 branch:
25598 locks: strict
25599 access list:
25600 symbolic names:
25601 keyword substitution: kv
25602 total revisions: 1;     selected revisions: 1
25603 description:
25604 ----------------------------
25605 revision 1\.1
25606 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25607 reading
25608 =============================================================================
25609
25610 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25611 Working file: mod1-2/mod2-2/file2-2
25612 head: 1\.2
25613 branch:
25614 locks: strict
25615 access list:
25616 symbolic names:
25617         cattle: 1\.2
25618 keyword substitution: kv
25619 total revisions: 2;     selected revisions: 2
25620 description:
25621 ----------------------------
25622 revision 1\.2
25623 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25624 actually
25625 ----------------------------
25626 revision 1\.1
25627 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25628 anyone
25629 =============================================================================
25630 ${PROG} log: Logging mod2-1
25631
25632 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
25633 Working file: mod2-1/anotherfile2-1
25634 head: 1\.1
25635 branch:
25636 locks: strict
25637 access list:
25638 symbolic names:
25639 keyword substitution: kv
25640 total revisions: 1;     selected revisions: 1
25641 description:
25642 ----------------------------
25643 revision 1\.1
25644 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25645 reading
25646 =============================================================================
25647
25648 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
25649 Working file: mod2-1/file2-1
25650 head: 1\.2
25651 branch:
25652 locks: strict
25653 access list:
25654 symbolic names:
25655         cattle: 1\.2
25656 keyword substitution: kv
25657 total revisions: 2;     selected revisions: 2
25658 description:
25659 ----------------------------
25660 revision 1\.2
25661 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25662 actually
25663 ----------------------------
25664 revision 1\.1
25665 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25666 anyone
25667 =============================================================================
25668 ${PROG} log: Logging mod2-2
25669
25670 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
25671 Working file: mod2-2/anotherfile2-2
25672 head: 1\.1
25673 branch:
25674 locks: strict
25675 access list:
25676 symbolic names:
25677 keyword substitution: kv
25678 total revisions: 1;     selected revisions: 1
25679 description:
25680 ----------------------------
25681 revision 1\.1
25682 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25683 reading
25684 =============================================================================
25685
25686 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25687 Working file: mod2-2/file2-2
25688 head: 1\.2
25689 branch:
25690 locks: strict
25691 access list:
25692 symbolic names:
25693         cattle: 1\.2
25694 keyword substitution: kv
25695 total revisions: 2;     selected revisions: 2
25696 description:
25697 ----------------------------
25698 revision 1\.2
25699 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25700 actually
25701 ----------------------------
25702 revision 1\.1
25703 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25704 anyone
25705 =============================================================================" \
25706 "${PROG} log: Logging \.
25707 ${PROG} log: Logging mod1-1
25708
25709 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
25710 Working file: mod1-1/anotherfile1-1
25711 head: 1\.1
25712 branch:
25713 locks: strict
25714 access list:
25715 symbolic names:
25716 keyword substitution: kv
25717 total revisions: 1;     selected revisions: 1
25718 description:
25719 ----------------------------
25720 revision 1\.1
25721 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25722 reading
25723 =============================================================================
25724
25725 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
25726 Working file: mod1-1/file1-1
25727 head: 1\.2
25728 branch:
25729 locks: strict
25730 access list:
25731 symbolic names:
25732         cattle: 1\.2
25733 keyword substitution: kv
25734 total revisions: 2;     selected revisions: 2
25735 description:
25736 ----------------------------
25737 revision 1\.2
25738 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25739 actually
25740 ----------------------------
25741 revision 1\.1
25742 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25743 is
25744 =============================================================================
25745 ${PROG} log: Logging mod1-2
25746
25747 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
25748 Working file: mod1-2/anotherfile1-2
25749 head: 1\.1
25750 branch:
25751 locks: strict
25752 access list:
25753 symbolic names:
25754 keyword substitution: kv
25755 total revisions: 1;     selected revisions: 1
25756 description:
25757 ----------------------------
25758 revision 1\.1
25759 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25760 reading
25761 =============================================================================
25762
25763 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25764 Working file: mod1-2/file1-2
25765 head: 1\.2
25766 branch:
25767 locks: strict
25768 access list:
25769 symbolic names:
25770         cattle: 1\.2
25771 keyword substitution: kv
25772 total revisions: 2;     selected revisions: 2
25773 description:
25774 ----------------------------
25775 revision 1\.2
25776 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25777 actually
25778 ----------------------------
25779 revision 1\.1
25780 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25781 is
25782 =============================================================================
25783 ${PROG} log: Logging mod2-2
25784 ${PROG} log: Logging mod2-2/mod1-2
25785
25786 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
25787 Working file: mod2-2/mod1-2/anotherfile1-2
25788 head: 1\.1
25789 branch:
25790 locks: strict
25791 access list:
25792 symbolic names:
25793 keyword substitution: kv
25794 total revisions: 1;     selected revisions: 1
25795 description:
25796 ----------------------------
25797 revision 1\.1
25798 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25799 reading
25800 =============================================================================
25801
25802 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
25803 Working file: mod2-2/mod1-2/file1-2
25804 head: 1\.2
25805 branch:
25806 locks: strict
25807 access list:
25808 symbolic names:
25809         cattle: 1\.2
25810 keyword substitution: kv
25811 total revisions: 2;     selected revisions: 2
25812 description:
25813 ----------------------------
25814 revision 1\.2
25815 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25816 actually
25817 ----------------------------
25818 revision 1\.1
25819 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25820 is
25821 =============================================================================
25822 ${PROG} log: Logging mod1-2
25823 ${PROG} log: Logging mod1-2/mod2-2
25824
25825 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
25826 Working file: mod1-2/mod2-2/anotherfile2-2
25827 head: 1\.1
25828 branch:
25829 locks: strict
25830 access list:
25831 symbolic names:
25832 keyword substitution: kv
25833 total revisions: 1;     selected revisions: 1
25834 description:
25835 ----------------------------
25836 revision 1\.1
25837 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25838 reading
25839 =============================================================================
25840
25841 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25842 Working file: mod1-2/mod2-2/file2-2
25843 head: 1\.2
25844 branch:
25845 locks: strict
25846 access list:
25847 symbolic names:
25848         cattle: 1\.2
25849 keyword substitution: kv
25850 total revisions: 2;     selected revisions: 2
25851 description:
25852 ----------------------------
25853 revision 1\.2
25854 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25855 actually
25856 ----------------------------
25857 revision 1\.1
25858 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25859 anyone
25860 =============================================================================
25861 ${PROG} log: Logging mod2-1
25862
25863 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
25864 Working file: mod2-1/anotherfile2-1
25865 head: 1\.1
25866 branch:
25867 locks: strict
25868 access list:
25869 symbolic names:
25870 keyword substitution: kv
25871 total revisions: 1;     selected revisions: 1
25872 description:
25873 ----------------------------
25874 revision 1\.1
25875 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25876 reading
25877 =============================================================================
25878
25879 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
25880 Working file: mod2-1/file2-1
25881 head: 1\.2
25882 branch:
25883 locks: strict
25884 access list:
25885 symbolic names:
25886         cattle: 1\.2
25887 keyword substitution: kv
25888 total revisions: 2;     selected revisions: 2
25889 description:
25890 ----------------------------
25891 revision 1\.2
25892 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25893 actually
25894 ----------------------------
25895 revision 1\.1
25896 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25897 anyone
25898 =============================================================================
25899 ${PROG} log: Logging mod2-2
25900
25901 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
25902 Working file: mod2-2/anotherfile2-2
25903 head: 1\.1
25904 branch:
25905 locks: strict
25906 access list:
25907 symbolic names:
25908 keyword substitution: kv
25909 total revisions: 1;     selected revisions: 1
25910 description:
25911 ----------------------------
25912 revision 1\.1
25913 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25914 reading
25915 =============================================================================
25916
25917 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
25918 Working file: mod2-2/file2-2
25919 head: 1\.2
25920 branch:
25921 locks: strict
25922 access list:
25923 symbolic names:
25924         cattle: 1\.2
25925 keyword substitution: kv
25926 total revisions: 2;     selected revisions: 2
25927 description:
25928 ----------------------------
25929 revision 1\.2
25930 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25931 actually
25932 ----------------------------
25933 revision 1\.1
25934 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25935 anyone
25936 ============================================================================="
25937
25938
25939           # After the simple cases, let's execute some commands which
25940           # refer to parts of our checked-out tree (e.g. "cvs update
25941           # mod1-1 mod2-2")
25942
25943           if $keep; then
25944             echo Keeping ${TESTDIR} and exiting due to --keep
25945             exit 0
25946           fi
25947
25948           # clean up after ourselves
25949           cd ..
25950           rm -r 1
25951
25952           # clean up our repositories
25953           rm -rf root1 root2
25954           ;;
25955
25956         multiroot2)
25957           # More multiroot tests.  In particular, nested directories.
25958
25959           CVSROOT1_DIRNAME=${TESTDIR}/root1
25960           CVSROOT2_DIRNAME=${TESTDIR}/root2
25961           CVSROOT1=`newroot $CVSROOT1_DIRNAME`
25962           CVSROOT2=`newroot $CVSROOT2_DIRNAME`
25963
25964           dotest multiroot2-1 "${testcvs} -d ${CVSROOT1} init" ""
25965           dotest multiroot2-2 "${testcvs} -d ${CVSROOT2} init" ""
25966
25967           mkdir imp-dir; cd imp-dir
25968           echo file1 >file1
25969           mkdir sdir
25970           echo sfile >sdir/sfile
25971           mkdir sdir/ssdir
25972           echo ssfile >sdir/ssdir/ssfile
25973           dotest_sort multiroot2-3 \
25974 "${testcvs} -d ${CVSROOT1} import -m import-to-root1 dir1 vend rel" "
25975
25976 N dir1/file1
25977 N dir1/sdir/sfile
25978 N dir1/sdir/ssdir/ssfile
25979 No conflicts created by this import
25980 ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir
25981 ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir/ssdir"
25982           cd sdir
25983           dotest_sort multiroot2-4 \
25984 "${testcvs} -d ${CVSROOT2} import -m import-to-root2 sdir vend2 rel2" "
25985
25986 N sdir/sfile
25987 N sdir/ssdir/ssfile
25988 No conflicts created by this import
25989 ${PROG} import: Importing ${TESTDIR}/root2/sdir/ssdir"
25990           cd ../..
25991
25992           mkdir 1; cd 1
25993           # Get TopLevelAdmin-like behavior.
25994           dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co -l ."
25995           dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co dir1" \
25996 "U dir1/file1
25997 U dir1/sdir/sfile
25998 U dir1/sdir/ssdir/ssfile"
25999           cd dir1
26000           dotest multiroot2-6 "${testcvs} -Q release -d sdir" ""
26001           dotest multiroot2-7 "${testcvs} -d ${CVSROOT2} -q co sdir" \
26002 "U sdir/sfile
26003 U sdir/ssdir/ssfile"
26004           cd ..
26005           # This has one subtle effect - it deals with Entries.Log
26006           # so that the next test doesn't get trace messages for
26007           # Entries.Log
26008           dotest multiroot2-8 "${testcvs} update" \
26009 "${PROG} update: Updating \.
26010 ${PROG} update: Updating dir1
26011 ${PROG} update: Updating dir1/sdir
26012 ${PROG} update: Updating dir1/sdir/ssdir" \
26013 "${PROG} update: Updating \.
26014 ${PROG} update: Updating dir1
26015 ${PROG} update: Updating dir1
26016 ${PROG} update: Updating dir1/sdir
26017 ${PROG} update: Updating dir1/sdir/ssdir"
26018           # Two reasons we don't run this on the server: (1) the server
26019           # also prints some trace messages, and (2) the server trace
26020           # messages are subject to out-of-order bugs (this one is hard
26021           # to work around).
26022           if $remote; then :; else
26023             dotest multiroot2-9a "${testcvs} -t update" \
26024 " *-> main loop with CVSROOT=${TESTDIR}/root1
26025 ${PROG} update: Updating \.
26026  *-> Reader_Lock(${TESTDIR}/root1)
26027  *-> Lock_Cleanup()
26028 ${PROG} update: Updating dir1
26029  *-> Reader_Lock(${TESTDIR}/root1/dir1)
26030  *-> Lock_Cleanup()
26031  *-> main loop with CVSROOT=${TESTDIR}/root2
26032 ${PROG} update: Updating dir1/sdir
26033  *-> Reader_Lock(${TESTDIR}/root2/sdir)
26034  *-> Lock_Cleanup()
26035 ${PROG} update: Updating dir1/sdir/ssdir
26036  *-> Reader_Lock(${TESTDIR}/root2/sdir/ssdir)
26037  *-> Lock_Cleanup()
26038  *-> Lock_Cleanup()"
26039           fi
26040
26041           dotest multiroot2-9 "${testcvs} -q tag tag1" \
26042 "T dir1/file1
26043 T dir1/sdir/sfile
26044 T dir1/sdir/ssdir/ssfile"
26045           echo "change it" >>dir1/file1
26046           echo "change him too" >>dir1/sdir/sfile
26047           dotest multiroot2-10 "${testcvs} -q ci -m modify" \
26048 "Checking in dir1/file1;
26049 ${TESTDIR}/root1/dir1/file1,v  <--  file1
26050 new revision: 1\.2; previous revision: 1\.1
26051 done
26052 Checking in dir1/sdir/sfile;
26053 ${TESTDIR}/root2/sdir/sfile,v  <--  sfile
26054 new revision: 1\.2; previous revision: 1\.1
26055 done"
26056           dotest multiroot2-11 "${testcvs} -q tag tag2" \
26057 "T dir1/file1
26058 T dir1/sdir/sfile
26059 T dir1/sdir/ssdir/ssfile"
26060           dotest_fail multiroot2-12 \
26061 "${testcvs} -q diff -u -r tag1 -r tag2" \
26062 "Index: dir1/file1
26063 ===================================================================
26064 RCS file: ${TESTDIR}/root1/dir1/file1,v
26065 retrieving revision 1\.1\.1\.1
26066 retrieving revision 1\.2
26067 diff -u -r1\.1\.1\.1 -r1\.2
26068 --- dir1/file1  ${RFCDATE}      1\.1\.1\.1
26069 ${PLUS}${PLUS}${PLUS} dir1/file1        ${RFCDATE}      1\.2
26070 @@ -1 ${PLUS}1,2 @@
26071  file1
26072 ${PLUS}change it
26073 Index: dir1/sdir/sfile
26074 ===================================================================
26075 RCS file: ${TESTDIR}/root2/sdir/sfile,v
26076 retrieving revision 1\.1\.1\.1
26077 retrieving revision 1\.2
26078 diff -u -r1\.1\.1\.1 -r1\.2
26079 --- dir1/sdir/sfile     ${RFCDATE}      1\.1\.1\.1
26080 ${PLUS}${PLUS}${PLUS} dir1/sdir/sfile   ${RFCDATE}      1\.2
26081 @@ -1 ${PLUS}1,2 @@
26082  sfile
26083 ${PLUS}change him too"
26084
26085           if $keep; then
26086             echo Keeping ${TESTDIR} and exiting due to --keep
26087             exit 0
26088           fi
26089
26090           # clean up after ourselves
26091           cd ..
26092           rm -r imp-dir 1
26093
26094           # clean up our repositories
26095           rm -rf root1 root2
26096           ;;
26097
26098         multiroot3)
26099           # More multiroot tests.  Directories are side-by-side, not nested.
26100           # Not drastically different from multiroot but it covers somewhat
26101           # different stuff.
26102
26103           CVSROOT1=`newroot ${TESTDIR}/root1`
26104           CVSROOT2=`newroot ${TESTDIR}/root2`
26105
26106           mkdir 1; cd 1
26107           dotest multiroot3-1 "${testcvs} -d ${CVSROOT1} init" ""
26108           dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
26109           mkdir dir1
26110           dotest multiroot3-3 "${testcvs} add dir1" \
26111 "Directory ${TESTDIR}/root1/dir1 added to the repository"
26112           dotest multiroot3-4 "${testcvs} -d ${CVSROOT2} init" ""
26113           rm -r CVS
26114           dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
26115           mkdir dir2
26116
26117           # OK, the problem is that CVS/Entries doesn't look quite right,
26118           # I suppose because of the "rm -r".
26119           # For local this fixes it up.
26120           dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
26121           if $remote; then
26122             # For remote that doesn't do it.  Use the quick and dirty fix.
26123             echo "D/dir1////" >CVS/Entries
26124             echo "D/dir2////" >>CVS/Entries
26125           fi
26126
26127           dotest multiroot3-7 "${testcvs} add dir2" \
26128 "Directory ${TESTDIR}/root2/dir2 added to the repository"
26129
26130           touch dir1/file1 dir2/file2
26131           if $remote; then
26132             # Trying to add them both in one command doesn't work,
26133             # because add.c doesn't do multiroot (it doesn't use recurse.c).
26134             # Furthermore, it can't deal with the parent directory
26135             # having a different root from the child, hence the cd.
26136             cd dir1
26137             dotest multiroot3-8 "${testcvs} add file1" \
26138 "${PROG} add: scheduling file .file1. for addition
26139 ${PROG} add: use .${PROG} commit. to add this file permanently"
26140             cd ..
26141             dotest multiroot3-8a "${testcvs} add dir2/file2" \
26142 "${PROG} add: scheduling file .dir2/file2. for addition
26143 ${PROG} add: use .${PROG} commit. to add this file permanently"
26144           else
26145             dotest multiroot3-8 "${testcvs} add dir1/file1 dir2/file2" \
26146 "${PROG} add: scheduling file .dir1/file1. for addition
26147 ${PROG} add: scheduling file .dir2/file2. for addition
26148 ${PROG} add: use .${PROG} commit. to add these files permanently"
26149           fi
26150
26151           dotest multiroot3-9 "${testcvs} -q ci -m add-them" \
26152 "RCS file: ${TESTDIR}/root2/dir2/file2,v
26153 done
26154 Checking in dir2/file2;
26155 ${TESTDIR}/root2/dir2/file2,v  <--  file2
26156 initial revision: 1\.1
26157 done
26158 RCS file: ${TESTDIR}/root1/dir1/file1,v
26159 done
26160 Checking in dir1/file1;
26161 ${TESTDIR}/root1/dir1/file1,v  <--  file1
26162 initial revision: 1\.1
26163 done"
26164
26165           # That this is an error is good - we are asking CVS to do
26166           # something which doesn't make sense.
26167           dotest_fail multiroot3-10 \
26168 "${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
26169 "${PROG} diff: failed to create lock directory for .${TESTDIR}/root1/dir2' (${TESTDIR}/root1/dir2/#cvs.lock): No such file or directory
26170 ${PROG} diff: failed to obtain dir lock in repository .${TESTDIR}/root1/dir2'
26171 ${PROG} \[diff aborted\]: read lock failed - giving up"
26172
26173           # This one is supposed to work.
26174           dotest multiroot3-11 "${testcvs} -q diff dir1/file1 dir2/file2" ""
26175
26176           # make sure we can't access across repositories
26177           mkdir 1a
26178           cd 1a
26179           dotest_fail multiroot3-12 \
26180 "$testcvs -d $CVSROOT1 -q co ../root2/dir2" \
26181 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
26182 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
26183 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26184           dotest_fail multiroot3-13 \
26185 "$testcvs -d $CVSROOT2 -q co ../root1/dir1" \
26186 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\." \
26187 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\.
26188 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26189           dotest_fail multiroot3-14 \
26190 "$testcvs -d $CVSROOT1 -q co ./../root2/dir2" \
26191 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\." \
26192 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\.
26193 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26194           dotest_fail multiroot3-15 \
26195 "$testcvs -d $CVSROOT2 -q co ./../root1/dir1" \
26196 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
26197 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
26198 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26199           dotest_fail multiroot3-16 \
26200 "$testcvs -d $CVSROOT1 -q co -p ../root2/dir2" \
26201 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
26202 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
26203 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26204           dotest_fail multiroot3-17 \
26205 "$testcvs -d $CVSROOT1 -q co -p ./../root1/dir1" \
26206 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
26207 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
26208 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
26209
26210           if $keep; then
26211             echo Keeping $TESTDIR and exiting due to --keep
26212             exit 0
26213           fi
26214
26215           cd ../..
26216
26217           rm -r 1
26218           rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
26219           unset CVSROOT1
26220           unset CVSROOT2
26221           ;;
26222
26223         multiroot4)
26224           # More multiroot tests, in particular we have two roots with
26225           # similarly-named directories and we try to see that CVS can
26226           # keep them separate.
26227
26228           CVSROOT1=`newroot ${TESTDIR}/root1`
26229           CVSROOT2=`newroot ${TESTDIR}/root2`
26230
26231           mkdir 1; cd 1
26232           dotest multiroot4-1 "${testcvs} -d ${CVSROOT1} init" ""
26233           dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
26234           mkdir dircom
26235           dotest multiroot4-3 "${testcvs} add dircom" \
26236 "Directory ${TESTDIR}/root1/dircom added to the repository"
26237           cd dircom
26238           touch file1
26239           dotest multiroot4-4 "${testcvs} add file1" \
26240 "${PROG} add: scheduling file .file1. for addition
26241 ${PROG} add: use .${PROG} commit. to add this file permanently"
26242           dotest multiroot4-5 "${testcvs} -q ci -m add" \
26243 "RCS file: ${TESTDIR}/root1/dircom/file1,v
26244 done
26245 Checking in file1;
26246 ${TESTDIR}/root1/dircom/file1,v  <--  file1
26247 initial revision: 1\.1
26248 done"
26249           cd ../..
26250           mkdir 2; cd 2
26251           dotest multiroot4-6 "${testcvs} -d ${CVSROOT2} init" ""
26252           dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
26253           mkdir dircom
26254           dotest multiroot4-8 "${testcvs} add dircom" \
26255 "Directory ${TESTDIR}/root2/dircom added to the repository"
26256           cd dircom
26257           touch file2
26258           dotest multiroot4-9 "${testcvs} add file2" \
26259 "${PROG} add: scheduling file .file2. for addition
26260 ${PROG} add: use .${PROG} commit. to add this file permanently"
26261           dotest multiroot4-10 "${testcvs} -q ci -m add" \
26262 "RCS file: ${TESTDIR}/root2/dircom/file2,v
26263 done
26264 Checking in file2;
26265 ${TESTDIR}/root2/dircom/file2,v  <--  file2
26266 initial revision: 1\.1
26267 done"
26268
26269           cd ../..
26270           cd 1/dircom
26271           # This may look contrived; the real world example which inspired
26272           # it was that a user was changing from local to remote.  Cases
26273           # like switching servers (among those mounting the same
26274           # repository) and so on would also look the same.
26275           mkdir sdir2
26276           dotest multiroot4-11 "${testcvs} -d ${CVSROOT2} add sdir2" \
26277 "Directory ${TESTDIR}/root2/dircom/sdir2 added to the repository"
26278
26279           dotest multiroot4-12 "${testcvs} -q update" ""
26280           cd ..
26281           dotest multiroot4-13 "${testcvs} -q update dircom" ""
26282           cd ..
26283
26284           rm -r 1 2
26285           rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
26286           unset CVSROOT1
26287           unset CVSROOT2
26288           ;;
26289
26290         rmroot)
26291           # When the Entries/Root file is removed from an existing
26292           # workspace, CVS should assume $CVSROOT instead
26293           #
26294           # Right now only checking that CVS exits normally on an
26295           # update once CVS/Root is deleted
26296           #
26297           # There was a time when this would core dump when run in
26298           # client/server mode
26299
26300           mkdir 1; cd 1
26301           dotest rmroot-setup-1 "${testcvs} -q co -l ." ''
26302           mkdir first-dir
26303           dotest rmroot-setup-2 "${testcvs} add first-dir" \
26304 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
26305           cd first-dir
26306           touch file1 file2
26307           dotest rmroot-setup-3 "${testcvs} add file1 file2" \
26308 "${PROG} add: scheduling file .file1. for addition
26309 ${PROG} add: scheduling file .file2. for addition
26310 ${PROG} add: use .${PROG} commit. to add these files permanently"
26311           dotest rmroot-setup-4 "${testcvs} -q commit -minit" \
26312 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
26313 done
26314 Checking in file1;
26315 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
26316 initial revision: 1\.1
26317 done
26318 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
26319 done
26320 Checking in file2;
26321 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
26322 initial revision: 1\.1
26323 done"
26324           rm CVS/Root
26325           dotest rmroot-1 "${testcvs} -q update" ''
26326
26327           cd ../..
26328           rm -rf 1
26329           ;;
26330
26331         reposmv)
26332           # More tests of repositories and specifying them.
26333           # Similar to crerepos but that test is probably getting big
26334           # enough.
26335           CVSROOT1=`newroot ${TESTDIR}/root1`
26336           CVSROOT_MOVED=`newroot ${TESTDIR}/root-moved`
26337
26338           dotest reposmv-setup-1 "${testcvs} -d ${CVSROOT1} init" ""
26339           mkdir imp-dir; cd imp-dir
26340           echo file1 >file1
26341           dotest reposmv-setup-2 \
26342 "${testcvs} -d ${CVSROOT1} import -m add dir1 vendor release" \
26343 "N dir1/file1
26344
26345 No conflicts created by this import"
26346           cd ..
26347
26348           mkdir 1; cd 1
26349           dotest reposmv-1 "${testcvs} -d ${CVSROOT1} -Q co dir1" ""
26350           mv ${TESTDIR}/root1 ${TESTDIR}/root-moved
26351           cd dir1
26352
26353           # If we didn't have a relative repository, get one now.
26354           dotest reposmv-1a "cat CVS/Repository" \
26355 "${TESTDIR}/root1/dir1" "dir1"
26356           echo dir1 >CVS/Repository
26357
26358           # There were some duplicated warnings and such; only test
26359           # for the part of the error message which makes sense.
26360           # Bug: "skipping directory " without filename.
26361           if $remote; then
26362             dotest_fail reposmv-2r "${testcvs} update" \
26363 "Cannot access ${TESTDIR}/root1/CVSROOT
26364 No such file or directory"
26365           else
26366             dotest reposmv-2 "${testcvs} update" "${DOTSTAR}
26367 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
26368 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1: No such file or directory
26369 ${PROG} update: skipping directory "
26370           fi
26371
26372           # CVS/Root overrides $CVSROOT
26373           if $remote; then
26374             CVSROOT_save=${CVSROOT}
26375             CVSROOT=:fork:${TESTDIR}/root-moved; export CVSROOT
26376             dotest_fail reposmv-3r "${testcvs} update" \
26377 "Cannot access ${TESTDIR}/root1/CVSROOT
26378 No such file or directory"
26379             CVSROOT=${CVSROOT_save}; export CVSROOT
26380           else
26381             CVSROOT_save=${CVSROOT}
26382             CVSROOT=${TESTDIR}/root-moved; export CVSROOT
26383             dotest reposmv-3 "${testcvs} update" \
26384 "${DOTSTAR}
26385 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
26386 ${PROG} update: Updating \.
26387 ${DOTSTAR}"
26388             CVSROOT=${CVSROOT_save}; export CVSROOT
26389           fi
26390
26391           if $remote; then
26392             CVSROOT_save=${CVSROOT}
26393             CVSROOT=:fork:${TESTDIR}/root-none; export CVSROOT
26394             dotest_fail reposmv-4 "${testcvs} update" \
26395 "Cannot access ${TESTDIR}/root1/CVSROOT
26396 No such file or directory"
26397             CVSROOT=${CVSROOT_save}; export CVSROOT
26398           else
26399             # CVS/Root doesn't seem to quite completely override $CVSROOT
26400             # Bug?  Not necessarily a big deal if it only affects error
26401             # messages.
26402             CVSROOT_save=${CVSROOT}
26403             CVSROOT=${TESTDIR}/root-none; export CVSROOT
26404             dotest_fail reposmv-4 "${testcvs} update" \
26405 "${PROG} update: in directory \.:
26406 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
26407 ${PROG} \[update aborted\]: ${TESTDIR}/root-none/CVSROOT: No such file or directory"
26408             CVSROOT=${CVSROOT_save}; export CVSROOT
26409           fi
26410
26411           # -d overrides CVS/Root
26412           # 
26413           # Oddly enough, with CVS 1.10 I think this didn't work for
26414           # local (that is, it would appear that CVS/Root would not
26415           # get used, but would produce an error if it didn't exist).
26416           dotest reposmv-5 "${testcvs} -d ${CVSROOT_MOVED} update" \
26417 "${PROG} update: Updating \."
26418
26419           # TODO: could also test various other things, like what if the
26420           # user removes CVS/Root (which is legit).  Or another set of
26421           # tests would be if both repositories exist but we want to make
26422           # sure that CVS is using the correct one.
26423
26424           cd ../..
26425           rm -r imp-dir 1
26426           rm -rf root1 root2
26427           unset CVSROOT1
26428           ;;
26429
26430         pserver)
26431           # Test basic pserver functionality.
26432           if $remote; then
26433             # First set SystemAuth=no.  Not really necessary, I don't
26434             # think, but somehow it seems like the clean thing for
26435             # the testsuite.
26436             mkdir 1; cd 1
26437             dotest pserver-1 "${testcvs} -Q co CVSROOT" ""
26438             cd CVSROOT
26439             echo "SystemAuth=no" >config
26440             dotest pserver-2 "${testcvs} -q ci -m config-it" \
26441 "Checking in config;
26442 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
26443 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
26444 done
26445 ${PROG} commit: Rebuilding administrative file database"
26446             cat >${CVSROOT_DIRNAME}/CVSROOT/passwd <<EOF
26447 testme:q6WV9d2t848B2:$username
26448 dontroot:q6WV9d2t848B2:root
26449 anonymous::$username
26450 $username:
26451 willfail:   :whocares
26452 EOF
26453             dotest_fail pserver-3 "${testcvs} pserver" \
26454 "error 0 Server configuration missing --allow-root in inetd.conf" <<EOF
26455 BEGIN AUTH REQUEST
26456 ${CVSROOT_DIRNAME}
26457 testme
26458 Ay::'d
26459 END AUTH REQUEST
26460 EOF
26461
26462             # Confirm that not sending a newline during auth cannot constitute
26463             # a denial-of-service attack.  This assumes that PATH_MAX is less
26464             # than 65536 bytes.  If PATH_MAX is larger than 65535 bytes, this
26465             # test could hang indefinitely.
26466             ${AWK} 'BEGIN { printf "0123456789abcdef" }' </dev/null >garbageseg
26467             echo "BEGIN AUTH REQUEST" >garbageinput
26468             i=0
26469             while test $i -lt 64; do
26470               cat <garbageseg >>garbageseg2
26471               i=`expr $i + 1`
26472             done
26473             i=0
26474             while test $i -lt 64; do
26475               cat <garbageseg2 >>garbageinput
26476               i=`expr $i + 1`
26477             done
26478             dotest_fail pserver-auth-no-dos \
26479 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26480 "${PROG} \\[pserver aborted\\]: Maximum line length exceeded during authentication\." <garbageinput
26481             unset i
26482             rm garbageseg garbageseg2 garbageinput
26483
26484             # Sending the Root and noop before waiting for the
26485             # "I LOVE YOU" is bogus, but hopefully we can get
26486             # away with it.
26487             dotest pserver-4 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26488 "${DOTSTAR} LOVE YOU
26489 ok" <<EOF
26490 BEGIN AUTH REQUEST
26491 ${CVSROOT_DIRNAME}
26492 testme
26493 Ay::'d
26494 END AUTH REQUEST
26495 Root ${CVSROOT_DIRNAME}
26496 noop
26497 EOF
26498
26499             dotest_fail pserver-4.2 \
26500 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26501 "error 0: root not allowed" <<EOF
26502 BEGIN AUTH REQUEST
26503 ${CVSROOT_DIRNAME}
26504 dontroot
26505 Ay::'d
26506 END AUTH REQUEST
26507 EOF
26508
26509             dotest pserver-5 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26510 "${DOTSTAR} LOVE YOU
26511 E Protocol error: Root says \"${TESTDIR}/1\" but pserver says \"${CVSROOT_DIRNAME}\"
26512 error  " <<EOF
26513 BEGIN AUTH REQUEST
26514 ${CVSROOT_DIRNAME}
26515 testme
26516 Ay::'d
26517 END AUTH REQUEST
26518 Root ${TESTDIR}/1
26519 noop
26520 EOF
26521
26522             dotest pserver-5a "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26523 "${DOTSTAR} LOVE YOU
26524 E Protocol error: init says \"${TESTDIR}/2\" but pserver says \"${CVSROOT_DIRNAME}\"
26525 error  " <<EOF
26526 BEGIN AUTH REQUEST
26527 ${CVSROOT_DIRNAME}
26528 testme
26529 Ay::'d
26530 END AUTH REQUEST
26531 init ${TESTDIR}/2
26532 EOF
26533             dotest_fail pserver-5b "test -d ${TESTDIR}/2" ''
26534
26535             dotest pserver-5c "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26536 "${DOTSTAR} LOVE YOU
26537 E init xxx must be an absolute pathname
26538 error  " <<EOF
26539 BEGIN AUTH REQUEST
26540 ${CVSROOT_DIRNAME}
26541 testme
26542 Ay::'d
26543 END AUTH REQUEST
26544 init xxx
26545 EOF
26546             dotest_fail pserver-5d "test -d xxx" ''
26547
26548             dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26549 "I HATE YOU" <<EOF
26550 BEGIN AUTH REQUEST
26551 ${CVSROOT_DIRNAME}
26552 testme
26553 Ay::'d^b?hd
26554 END AUTH REQUEST
26555 EOF
26556
26557             dotest_fail pserver-7 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26558 "I HATE YOU" <<EOF
26559 BEGIN VERIFICATION REQUEST
26560 ${CVSROOT_DIRNAME}
26561 testme
26562 Ay::'d^b?hd
26563 END VERIFICATION REQUEST
26564 EOF
26565
26566             dotest pserver-8 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26567 "${DOTSTAR} LOVE YOU" <<EOF
26568 BEGIN VERIFICATION REQUEST
26569 ${CVSROOT_DIRNAME}
26570 testme
26571 Ay::'d
26572 END VERIFICATION REQUEST
26573 EOF
26574
26575 # Tests pserver-9 through pserver-13 are about empty passwords
26576
26577             # Test empty password (both sides) for aliased user
26578             dotest pserver-9 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26579 "${DOTSTAR} LOVE YOU" <<EOF
26580 BEGIN AUTH REQUEST
26581 ${CVSROOT_DIRNAME}
26582 anonymous
26583 A
26584 END AUTH REQUEST
26585 EOF
26586
26587             # Test empty password (server side only) for aliased user
26588             dotest pserver-10 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26589 "${DOTSTAR} LOVE YOU" <<EOF
26590 BEGIN AUTH REQUEST
26591 ${CVSROOT_DIRNAME}
26592 anonymous
26593 Aanythingwouldworkhereittrulydoesnotmatter
26594 END AUTH REQUEST
26595 EOF
26596
26597             # Test empty (both sides) password for non-aliased user
26598             dotest pserver-11 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26599 "${DOTSTAR} LOVE YOU" <<EOF
26600 BEGIN AUTH REQUEST
26601 ${CVSROOT_DIRNAME}
26602 ${username}
26603 A
26604 END AUTH REQUEST
26605 EOF
26606
26607             # Test empty (server side only) password for non-aliased user
26608             dotest pserver-12 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26609 "${DOTSTAR} LOVE YOU" <<EOF
26610 BEGIN AUTH REQUEST
26611 ${CVSROOT_DIRNAME}
26612 ${username}
26613 Anypasswordwouldworkwhynotthisonethen
26614 END AUTH REQUEST
26615 EOF
26616
26617             # Test failure of whitespace password
26618             dotest_fail pserver-13 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26619 "${DOTSTAR} HATE YOU" <<EOF
26620 BEGIN AUTH REQUEST
26621 ${CVSROOT_DIRNAME}
26622 willfail
26623 Amquiteunabletocomeupwithinterestingpasswordsanymore
26624 END AUTH REQUEST
26625 EOF
26626
26627             # The following tests are for read-only access
26628
26629             # Check that readers can only read, everyone else can write
26630
26631             cat >${CVSROOT_DIRNAME}/CVSROOT/readers <<EOF
26632 anonymous
26633 EOF
26634
26635             dotest pserver-14 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26636 "${DOTSTAR} LOVE YOU
26637 M Concurrent Versions System (CVS) .*
26638 ok" <<EOF
26639 BEGIN AUTH REQUEST
26640 ${CVSROOT_DIRNAME}
26641 anonymous
26642 Ay::'d
26643 END AUTH REQUEST
26644 Root ${CVSROOT_DIRNAME}
26645 version
26646 EOF
26647
26648             dotest pserver-15 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26649 "${DOTSTAR} LOVE YOU
26650 E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
26651 error  " <<EOF
26652 BEGIN AUTH REQUEST
26653 ${CVSROOT_DIRNAME}
26654 anonymous
26655 Ay::'d
26656 END AUTH REQUEST
26657 init ${CVSROOT_DIRNAME}
26658 EOF
26659
26660             dotest pserver-16 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26661 "${DOTSTAR} LOVE YOU
26662 M Concurrent Versions System (CVS) .*
26663 ok" <<EOF
26664 BEGIN AUTH REQUEST
26665 ${CVSROOT_DIRNAME}
26666 testme
26667 Ay::'d
26668 END AUTH REQUEST
26669 Root ${CVSROOT_DIRNAME}
26670 version
26671 EOF
26672
26673             dotest pserver-17 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26674 "${DOTSTAR} LOVE YOU
26675 ok" <<EOF
26676 BEGIN AUTH REQUEST
26677 ${CVSROOT_DIRNAME}
26678 testme
26679 Ay::'d
26680 END AUTH REQUEST
26681 init ${CVSROOT_DIRNAME}
26682 EOF
26683
26684             dotest pserver-18 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26685 "${DOTSTAR} LOVE YOU
26686 M Concurrent Versions System (CVS) .*
26687 ok" <<EOF
26688 BEGIN AUTH REQUEST
26689 ${CVSROOT_DIRNAME}
26690 ${username}
26691 Ay::'d
26692 END AUTH REQUEST
26693 Root ${CVSROOT_DIRNAME}
26694 version
26695 EOF
26696
26697             dotest pserver-19 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26698 "${DOTSTAR} LOVE YOU
26699 ok" <<EOF
26700 BEGIN AUTH REQUEST
26701 ${CVSROOT_DIRNAME}
26702 ${username}
26703 Anything
26704 END AUTH REQUEST
26705 init ${CVSROOT_DIRNAME}
26706 EOF
26707
26708             # Check that writers can write, everyone else can only read
26709             # even if not listed in readers
26710
26711             cat >${CVSROOT_DIRNAME}/CVSROOT/writers <<EOF
26712 testme
26713 EOF
26714
26715             dotest pserver-20 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26716 "${DOTSTAR} LOVE YOU
26717 M Concurrent Versions System (CVS) .*
26718 ok" <<EOF
26719 BEGIN AUTH REQUEST
26720 ${CVSROOT_DIRNAME}
26721 anonymous
26722 Ay::'d
26723 END AUTH REQUEST
26724 Root ${CVSROOT_DIRNAME}
26725 version
26726 EOF
26727
26728             dotest pserver-21 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26729 "${DOTSTAR} LOVE YOU
26730 E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
26731 error  " <<EOF
26732 BEGIN AUTH REQUEST
26733 ${CVSROOT_DIRNAME}
26734 anonymous
26735 Ay::'d
26736 END AUTH REQUEST
26737 init ${CVSROOT_DIRNAME}
26738 EOF
26739
26740             dotest pserver-22 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26741 "${DOTSTAR} LOVE YOU
26742 M Concurrent Versions System (CVS) .*
26743 ok" <<EOF
26744 BEGIN AUTH REQUEST
26745 ${CVSROOT_DIRNAME}
26746 testme
26747 Ay::'d
26748 END AUTH REQUEST
26749 Root ${CVSROOT_DIRNAME}
26750 version
26751 EOF
26752
26753             dotest pserver-23 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26754 "${DOTSTAR} LOVE YOU
26755 ok" <<EOF
26756 BEGIN AUTH REQUEST
26757 ${CVSROOT_DIRNAME}
26758 testme
26759 Ay::'d
26760 END AUTH REQUEST
26761 init ${CVSROOT_DIRNAME}
26762 EOF
26763
26764             dotest pserver-24 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26765 "${DOTSTAR} LOVE YOU
26766 M Concurrent Versions System (CVS) .*
26767 ok" <<EOF
26768 BEGIN AUTH REQUEST
26769 ${CVSROOT_DIRNAME}
26770 ${username}
26771 Ay::'d
26772 END AUTH REQUEST
26773 Root ${CVSROOT_DIRNAME}
26774 version
26775 EOF
26776
26777             dotest pserver-25 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26778 "${DOTSTAR} LOVE YOU
26779 E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
26780 error  " <<EOF
26781 BEGIN AUTH REQUEST
26782 ${CVSROOT_DIRNAME}
26783 ${username}
26784 Anything
26785 END AUTH REQUEST
26786 init ${CVSROOT_DIRNAME}
26787 EOF
26788
26789             # Should work the same without readers
26790
26791             rm ${CVSROOT_DIRNAME}/CVSROOT/readers
26792
26793             dotest pserver-26 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26794 "${DOTSTAR} LOVE YOU
26795 M Concurrent Versions System (CVS) .*
26796 ok" <<EOF
26797 BEGIN AUTH REQUEST
26798 ${CVSROOT_DIRNAME}
26799 anonymous
26800 Ay::'d
26801 END AUTH REQUEST
26802 Root ${CVSROOT_DIRNAME}
26803 version
26804 EOF
26805
26806             dotest pserver-27 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26807 "${DOTSTAR} LOVE YOU
26808 E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
26809 error  " <<EOF
26810 BEGIN AUTH REQUEST
26811 ${CVSROOT_DIRNAME}
26812 anonymous
26813 Ay::'d
26814 END AUTH REQUEST
26815 init ${CVSROOT_DIRNAME}
26816 EOF
26817
26818             dotest pserver-28 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26819 "${DOTSTAR} LOVE YOU
26820 M Concurrent Versions System (CVS) .*
26821 ok" <<EOF
26822 BEGIN AUTH REQUEST
26823 ${CVSROOT_DIRNAME}
26824 testme
26825 Ay::'d
26826 END AUTH REQUEST
26827 Root ${CVSROOT_DIRNAME}
26828 version
26829 EOF
26830
26831             dotest pserver-29 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26832 "${DOTSTAR} LOVE YOU
26833 ok" <<EOF
26834 BEGIN AUTH REQUEST
26835 ${CVSROOT_DIRNAME}
26836 testme
26837 Ay::'d
26838 END AUTH REQUEST
26839 init ${CVSROOT_DIRNAME}
26840 EOF
26841
26842             dotest pserver-30 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26843 "${DOTSTAR} LOVE YOU
26844 M Concurrent Versions System (CVS) .*
26845 ok" <<EOF
26846 BEGIN AUTH REQUEST
26847 ${CVSROOT_DIRNAME}
26848 ${username}
26849 Ay::'d
26850 END AUTH REQUEST
26851 Root ${CVSROOT_DIRNAME}
26852 version
26853 EOF
26854
26855             dotest pserver-31 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
26856 "${DOTSTAR} LOVE YOU
26857 E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
26858 error  " <<EOF
26859 BEGIN AUTH REQUEST
26860 ${CVSROOT_DIRNAME}
26861 ${username}
26862 Anything
26863 END AUTH REQUEST
26864 init ${CVSROOT_DIRNAME}
26865 EOF
26866
26867             # pserver used to try and print from the NULL pointer 
26868             # in this error message in this case
26869             dotest_fail pserver-bufinit "${testcvs} pserver" \
26870 "${PROG} \[pserver aborted\]: bad auth protocol start: EOF" </dev/null
26871
26872             # Clean up.
26873             echo "# comments only" >config
26874             dotest pserver-cleanup-1 "${testcvs} -q ci -m config-it" \
26875 "Checking in config;
26876 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
26877 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
26878 done
26879 ${PROG} commit: Rebuilding administrative file database"
26880             cd ../..
26881             rm -r 1
26882             rm ${CVSROOT_DIRNAME}/CVSROOT/passwd ${CVSROOT_DIRNAME}/CVSROOT/writers
26883           fi # skip the whole thing for local
26884           ;;
26885
26886         server)
26887           # Some tests of the server (independent of the client).
26888           if $remote; then
26889             dotest server-1 "${testcvs} server" \
26890 "E Protocol error: Root request missing
26891 error  " <<EOF
26892 Directory bogus
26893 mumble/bar
26894 update
26895 EOF
26896
26897             # Could also test for relative pathnames here (so that crerepos-6a
26898             # and crerepos-6b can use :fork:).
26899             dotest server-2 "${testcvs} server" "ok" <<EOF
26900 Set OTHER=variable
26901 Set MYENV=env-value
26902 init ${TESTDIR}/crerepos
26903 EOF
26904             dotest server-3 "test -d ${TESTDIR}/crerepos/CVSROOT" ""
26905
26906             # Now some tests of gzip-file-contents (used by jCVS).
26907             ${AWK} 'BEGIN { \
26908 printf "%c%c%c%c%c%c.6%c%c+I-.%c%c%c%c5%c;%c%c%c%c", \
26909 31, 139, 8, 64, 5, 7, 64, 3, 225, 2, 64, 198, 185, 5, 64, 64, 64}' \
26910               </dev/null | ${TR} '\100' '\000' >gzipped.dat
26911             # Note that the CVS client sends "-b 1.1.1", and this
26912             # test doesn't.  But the server also defaults to that.
26913             cat <<EOF >session.dat
26914 Root ${TESTDIR}/crerepos
26915 UseUnchanged
26916 gzip-file-contents 3
26917 Argument -m
26918 Argument msg
26919 Argumentx 
26920 Argument dir1
26921 Argument tag1
26922 Argument tag2
26923 Directory .
26924 ${TESTDIR}/crerepos
26925 Modified file1
26926 u=rw,g=r,o=r
26927 z25
26928 EOF
26929             cat gzipped.dat >>session.dat
26930             echo import >>session.dat
26931             dotest server-4 "${testcvs} server" \
26932 "M N dir1/file1
26933
26934 M No conflicts created by this import
26935
26936 ok" <session.dat
26937             dotest server-5 \
26938 "${testcvs} -q -d ${TESTDIR}/crerepos co -p dir1/file1" "test"
26939
26940             # OK, here are some notify tests.
26941             dotest server-6 "${testcvs} server" \
26942 "Notified \./
26943 ${TESTDIR}/crerepos/dir1/file1
26944 ok" <<EOF
26945 Root ${TESTDIR}/crerepos
26946 Directory .
26947 ${TESTDIR}/crerepos/dir1
26948 Notify file1
26949 E       Fri May  7 13:21:09 1999 GMT    myhost  some-work-dir   EUC
26950 noop
26951 EOF
26952             # Sending the second "noop" before waiting for the output
26953             # from the first is bogus but hopefully we can get away
26954             # with it.
26955             dotest server-7 "${testcvs} server" \
26956 "Notified \./
26957 ${TESTDIR}/crerepos/dir1/file1
26958 ok
26959 Notified \./
26960 ${TESTDIR}/crerepos/dir1/file1
26961 ok" <<EOF
26962 Root ${TESTDIR}/crerepos
26963 Directory .
26964 ${TESTDIR}/crerepos/dir1
26965 Notify file1
26966 E       Fri May  7 13:21:09 1999 GMT    myhost  some-work-dir   EUC
26967 noop
26968 Notify file1
26969 E       The 57th day of Discord in the YOLD 3165        myhost  some-work-dir   EUC
26970 noop
26971 EOF
26972
26973             # OK, now test a few error conditions.
26974             # FIXCVS: should give "error" and no "Notified", like server-9
26975             dotest server-8 "${testcvs} server" \
26976 "E ${PROG} server: invalid character in editor value
26977 Notified \./
26978 ${TESTDIR}/crerepos/dir1/file1
26979 ok" <<EOF
26980 Root ${TESTDIR}/crerepos
26981 Directory .
26982 ${TESTDIR}/crerepos/dir1
26983 Notify file1
26984 E       Setting Orange, the 52th day of Discord in the YOLD 3165        myhost  some-work-dir   EUC
26985 noop
26986 EOF
26987
26988             dotest server-9 "${testcvs} server" \
26989 "E Protocol error; misformed Notify request
26990 error  " <<EOF
26991 Root ${TESTDIR}/crerepos
26992 Directory .
26993 ${TESTDIR}/crerepos/dir1
26994 Notify file1
26995 E       Setting Orange+57th day of Discord      myhost  some-work-dir   EUC
26996 noop
26997 EOF
26998
26999             # First demonstrate an interesting quirk in the protocol.
27000             # The "watchers" request selects the files to operate based
27001             # on files which exist in the working directory.  So if we
27002             # don't send "Entry" or the like, it won't do anything.
27003             # Wants to be documented in cvsclient.texi...
27004             dotest server-10 "${testcvs} server" "ok" <<EOF
27005 Root ${TESTDIR}/crerepos
27006 Directory .
27007 ${TESTDIR}/crerepos/dir1
27008 watchers
27009 EOF
27010             # See if "watchers" and "editors" display the right thing.
27011             dotest server-11 "${testcvs} server" \
27012 "M file1        ${username}     tedit   tunedit tcommit
27013 ok" <<EOF
27014 Root ${TESTDIR}/crerepos
27015 Directory .
27016 ${TESTDIR}/crerepos/dir1
27017 Entry /file1/1.1////
27018 watchers
27019 EOF
27020             dotest server-12 "${testcvs} server" \
27021 "M file1        ${username}     The 57th day of Discord in the YOLD 3165        myhost  some-work-dir
27022 ok" <<EOF
27023 Root ${TESTDIR}/crerepos
27024 Directory .
27025 ${TESTDIR}/crerepos/dir1
27026 Entry /file1/1.1////
27027 editors
27028 EOF
27029
27030             # Now do an unedit.
27031             dotest server-13 "${testcvs} server" \
27032 "Notified \./
27033 ${TESTDIR}/crerepos/dir1/file1
27034 ok" <<EOF
27035 Root ${TESTDIR}/crerepos
27036 Directory .
27037 ${TESTDIR}/crerepos/dir1
27038 Notify file1
27039 U       7 May 1999 15:00 GMT    myhost  some-work-dir   EUC
27040 noop
27041 EOF
27042
27043             # Now try "watchers" and "editors" again.
27044             dotest server-14 "${testcvs} server" "ok" <<EOF
27045 Root ${TESTDIR}/crerepos
27046 Directory .
27047 ${TESTDIR}/crerepos/dir1
27048 watchers
27049 EOF
27050             dotest server-15 "${testcvs} server" "ok" <<EOF
27051 Root ${TESTDIR}/crerepos
27052 Directory .
27053 ${TESTDIR}/crerepos/dir1
27054 editors
27055 EOF
27056
27057             # Test that the global `-l' option is ignored nonfatally.
27058             dotest server-16 "${testcvs} server" \
27059 "E cvs server: WARNING: global \`-l' option ignored\.
27060 ok" <<EOF
27061 Global_option -l
27062 noop
27063 EOF
27064
27065             # There used to be some exploits based on malformed Entry requests
27066             dotest server-17 "$testcvs server" \
27067 "E protocol error: Malformed Entry
27068 error  " <<EOF
27069 Root $TESTDIR/crerepos
27070 Directory .
27071 $TESTDIR/crerepos/dir1
27072 Entry X/file1/1.1////
27073 noop
27074 EOF
27075
27076             dotest server-18 "$testcvs server" \
27077 "E protocol error: Malformed Entry
27078 error  " <<EOF
27079 Root $TESTDIR/crerepos
27080 Directory .
27081 $TESTDIR/crerepos/dir1
27082 Entry /CC/CC/CC
27083 noop
27084 EOF
27085
27086             if $keep; then
27087               echo Keeping ${TESTDIR} and exiting due to --keep
27088               exit 0
27089             fi
27090
27091             rm -rf ${TESTDIR}/crerepos
27092             rm gzipped.dat session.dat
27093           fi # skip the whole thing for local
27094           ;;
27095
27096         server2)
27097           # More server tests, in particular testing that various
27098           # possible security holes are plugged.
27099           if $remote; then
27100             dotest server2-1 "${testcvs} server" \
27101 "E protocol error: directory '${CVSROOT_DIRNAME}/\.\./dir1' not within root '${CVSROOT_DIRNAME}'
27102 error  " <<EOF
27103 Root ${CVSROOT_DIRNAME}
27104 Directory .
27105 ${CVSROOT_DIRNAME}/../dir1
27106 noop
27107 EOF
27108
27109             dotest server2-2 "${testcvs} server" \
27110 "E protocol error: directory '${CVSROOT_DIRNAME}dir1' not within root '${CVSROOT_DIRNAME}'
27111 error  " <<EOF
27112 Root ${CVSROOT_DIRNAME}
27113 Directory .
27114 ${CVSROOT_DIRNAME}dir1
27115 noop
27116 EOF
27117
27118             dotest 2-3 "${testcvs} server" \
27119 "E protocol error: directory '${TESTDIR}' not within root '${CVSROOT_DIRNAME}'
27120 error  " <<EOF
27121 Root ${CVSROOT_DIRNAME}
27122 Directory .
27123 ${TESTDIR}
27124 noop
27125 EOF
27126
27127             # OK, now a few tests for the rule that one cannot pass a
27128             # filename containing a slash to Modified, Is-modified,
27129             # Notify, Questionable, or Unchanged.  For completeness
27130             # we'd try them all.  For lazyness/conciseness we don't.
27131             dotest server2-4 "${testcvs} server" \
27132 "E protocol error: directory 'foo/bar' not within current directory
27133 error  " <<EOF
27134 Root ${CVSROOT_DIRNAME}
27135 Directory .
27136 ${CVSROOT_DIRNAME}
27137 Unchanged foo/bar
27138 noop
27139 EOF
27140           fi
27141           ;;
27142
27143         client)
27144           # Some tests of the client (independent of the server).
27145           if $remote; then
27146             cat >${TESTDIR}/serveme <<EOF
27147 #!${TESTSHELL}
27148 # This is admittedly a bit cheezy, in the sense that we make lots
27149 # of assumptions about what the client is going to send us.
27150 # We don't mention Repository, because current clients don't require it.
27151 # Sending these at our own pace, rather than waiting for the client to
27152 # make the requests, is bogus, but hopefully we can get away with it.
27153 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27154 echo "ok"
27155 echo "M special message"
27156 echo "Created first-dir/"
27157 echo "${CVSROOT_DIRNAME}/first-dir/file1"
27158 echo "/file1/1.1///"
27159 echo "u=rw,g=rw,o=rw"
27160 echo "4"
27161 echo "xyz"
27162 echo "ok"
27163 cat >/dev/null
27164 EOF
27165             # Cygwin.  Pthffffffffft!
27166             if test -n "$remotehost"; then
27167               $CVS_RSH $remotehost "chmod +x ${TESTDIR}/serveme"
27168             else
27169               chmod +x ${TESTDIR}/serveme
27170             fi
27171             save_CVS_SERVER=$CVS_SERVER
27172             CVS_SERVER=${TESTDIR}/serveme; export CVS_SERVER
27173             mkdir 1; cd 1
27174             dotest_fail client-1 "${testcvs} -q co first-dir" \
27175 "${PROG} \[checkout aborted\]: This server does not support the global -q option${DOTSTAR}"
27176             dotest client-2 "${testcvs} co first-dir" "special message"
27177
27178             cat >${TESTDIR}/serveme <<EOF
27179 #!${TESTSHELL}
27180 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27181 echo "ok"
27182 echo "M merge-it"
27183 echo "Copy-file ./"
27184 echo "${CVSROOT_DIRNAME}/first-dir/file1"
27185 echo "${TESTDIR}/bogus/.#file1.1.1"
27186 echo "Merged ./"
27187 echo "${CVSROOT_DIRNAME}/first-dir/file1"
27188 echo "/file1/1.2///"
27189 echo "u=rw,g=rw,o=rw"
27190 echo "4"
27191 echo "abd"
27192 echo "ok"
27193 cat >/dev/null
27194 EOF
27195             cd first-dir
27196             mkdir ${TESTDIR}/bogus
27197             # The ${DOTSTAR} is to match a potential "broken pipe" if the
27198             # client exits before the server script sends everything
27199             dotest_fail client-3 "${testcvs} update" "merge-it
27200 ${PROG} \[update aborted\]: protocol error: Copy-file tried to specify director${DOTSTAR}"
27201             cat >${TESTDIR}/serveme <<EOF
27202 #!${TESTSHELL}
27203 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27204 echo "ok"
27205 echo "M merge-it"
27206 echo "Copy-file ./"
27207 echo "${CVSROOT_DIRNAME}/first-dir/file1"
27208 echo ".#file1.1.1"
27209 echo "Merged ./"
27210 echo "${CVSROOT_DIRNAME}/first-dir/file1"
27211 echo "/file1/1.2///"
27212 echo "u=rw,g=rw,o=rw"
27213 echo "4"
27214 echo "abc"
27215 echo "ok"
27216 cat >/dev/null
27217 EOF
27218             dotest client-4 "${testcvs} update" "merge-it"
27219             dotest client-5 "cat .#file1.1.1" "xyz"
27220             dotest client-6 "cat CVS/Entries" "/file1/1.2/[A-Za-z0-9 :]*//
27221 D"
27222             dotest client-7 "cat file1" "abc"
27223
27224             cat >${TESTDIR}/serveme <<EOF
27225 #!${TESTSHELL}
27226 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27227 echo "ok"
27228 echo "M OK, whatever"
27229 echo "ok"
27230 cat >${TESTDIR}/client.tmp
27231 EOF
27232             chmod u=rw,go= file1
27233             # By specifying the time zone in local time, we don't
27234             # know exactly how that will translate to GMT.
27235             dotest client-8 "${testcvs} update -D 99-10-04" "OK, whatever"
27236             # String 2 below is Cygwin again - ptoooey.
27237             dotest client-9 "cat ${TESTDIR}/client.tmp" \
27238 "Root ${CVSROOT_DIRNAME}
27239 Valid-responses [-a-zA-Z ]*
27240 valid-requests
27241 Argument -D
27242 Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
27243 Argument --
27244 Directory \.
27245 ${CVSROOT_DIRNAME}/first-dir
27246 Entry /file1/1\.2///
27247 Modified file1
27248 u=rw,g=,o=
27249 4
27250 abc
27251 update" \
27252 "Root ${CVSROOT_DIRNAME}
27253 Valid-responses [-a-zA-Z ]*
27254 valid-requests
27255 Argument -D
27256 Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
27257 Argument --
27258 Directory \.
27259 ${CVSROOT_DIRNAME}/first-dir
27260 Entry /file1/1\.2///
27261 Modified file1
27262 u=rw,g=r,o=r
27263 4
27264 abc
27265 update"
27266
27267             # The following test tests what was a potential client update in
27268             # CVS versions 1.11.14 and CVS versions 1.12.6 and earlier.  This
27269             # exploit would allow a trojan server to create arbitrary files,
27270             # anywhere the user had write permissions, even outside of the
27271             # user's sandbox.
27272             cat >$HOME/.bashrc <<EOF
27273 #!$TESTSHELL
27274 # This is where login scripts would usually be
27275 # stored.
27276 EOF
27277             cat >$TESTDIR/serveme <<EOF
27278 #!$TESTSHELL
27279 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27280 echo "ok"
27281 echo "Rcs-diff $HOME/"
27282 echo "$HOME/.bashrc"
27283 echo "/.bashrc/73.50///"
27284 echo "u=rw,g=rw,o=rw"
27285 echo "20"
27286 echo "a1 1"
27287 echo "echo 'gotcha!'"
27288 echo "ok"
27289 cat >/dev/null
27290 EOF
27291             
27292             # If I don't run the following sleep between the above cat and
27293             # the following calls to dotest, sometimes the serveme file isn't
27294             # completely written yet by the time CVS tries to execute it,
27295             # causing the shell to intermittantly report syntax errors (usually
27296             # early EOF).  There's probably a new race condition here, but this
27297             # works.
27298             #
27299             # Incidentally, I can reproduce this behavior with Linux 2.4.20 and
27300             # Bash 2.05 or Bash 2.05b.
27301             sleep 1
27302             dotest_fail client-10 "$testcvs update" \
27303 "$PROG update: Server attempted to update a file via an invalid pathname:
27304 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
27305
27306             # A second try at a client exploit.  This one never actually
27307             # failed in the past, but I thought it wouldn't hurt to add a test.
27308             cat >$TESTDIR/serveme <<EOF
27309 #!$TESTSHELL
27310 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27311 echo "ok"
27312 echo "Rcs-diff ./"
27313 echo "$HOME/.bashrc"
27314 echo "/.bashrc/73.50///"
27315 echo "u=rw,g=rw,o=rw"
27316 echo "20"
27317 echo "a1 1"
27318 echo "echo 'gotcha!'"
27319 echo "ok"
27320 cat >/dev/null
27321 EOF
27322             sleep 1
27323             dotest_fail client-11 "$testcvs update" \
27324 "$PROG \[update aborted\]: patch original file \./\.bashrc does not exist"
27325
27326             # A third try at a client exploit.  This one did used to fail like
27327             # client-10.
27328             cat >$TESTDIR/serveme <<EOF
27329 #!$TESTSHELL
27330 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27331 echo "ok"
27332 echo "Rcs-diff ../../home/"
27333 echo "../../.bashrc"
27334 echo "/.bashrc/73.50///"
27335 echo "u=rw,g=rw,o=rw"
27336 echo "20"
27337 echo "a1 1"
27338 echo "echo 'gotcha!'"
27339 echo "ok"
27340 cat >/dev/null
27341 EOF
27342             sleep 1
27343             dotest_fail client-12 "$testcvs update" \
27344 "$PROG update: Server attempted to update a file via an invalid pathname:
27345 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
27346
27347             # Try the same exploit using the Created response.
27348             cat >$TESTDIR/serveme <<EOF
27349 #!$TESTSHELL
27350 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27351 echo "ok"
27352 echo "Created $HOME/"
27353 echo "$HOME/.bashrc"
27354 echo "/.bashrc/73.50///"
27355 echo "u=rw,g=rw,o=rw"
27356 echo "26"
27357 echo "#! /bin/sh"
27358 echo "echo 'gotcha!'"
27359 echo "ok"
27360 cat >/dev/null
27361 EOF
27362             sleep 1
27363             dotest_fail client-13 "$testcvs update" \
27364 "$PROG update: Server attempted to update a file via an invalid pathname:
27365 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
27366
27367             # Now try using the Update-existing response
27368             cat >$TESTDIR/serveme <<EOF
27369 #!$TESTSHELL
27370 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27371 echo "ok"
27372 echo "Update-existing ../../home/"
27373 echo "../../home/.bashrc"
27374 echo "/.bashrc/73.50///"
27375 echo "u=rw,g=rw,o=rw"
27376 echo "26"
27377 echo "#! /bin/sh"
27378 echo "echo 'gotcha!'"
27379 echo "ok"
27380 cat >/dev/null
27381 EOF
27382             sleep 1
27383             dotest_fail client-14 "$testcvs update" \
27384 "$PROG update: Server attempted to update a file via an invalid pathname:
27385 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
27386
27387             # Try the same exploit using the Merged response.
27388             cat >$TESTDIR/serveme <<EOF
27389 #!$TESTSHELL
27390 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27391 echo "ok"
27392 echo "Merged $HOME/"
27393 echo "$HOME/.bashrc"
27394 echo "/.bashrc/73.50///"
27395 echo "u=rw,g=rw,o=rw"
27396 echo "26"
27397 echo "#! /bin/sh"
27398 echo "echo 'gotcha!'"
27399 echo "ok"
27400 cat >/dev/null
27401 EOF
27402             sleep 1
27403             dotest_fail client-15 "$testcvs update" \
27404 "$PROG update: Server attempted to update a file via an invalid pathname:
27405 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
27406
27407             # Now try using the Updated response
27408             cat >$TESTDIR/serveme <<EOF
27409 #!$TESTSHELL
27410 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27411 echo "ok"
27412 echo "Updated ../../home/"
27413 echo "../../home/.bashrc"
27414 echo "/.bashrc/73.50///"
27415 echo "u=rw,g=rw,o=rw"
27416 echo "26"
27417 echo "#! /bin/sh"
27418 echo "echo 'gotcha!'"
27419 echo "ok"
27420 cat >/dev/null
27421 EOF
27422             sleep 1
27423             dotest_fail client-16 "$testcvs update" \
27424 "$PROG update: Server attempted to update a file via an invalid pathname:
27425 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
27426
27427             # Try the same exploit using the Copy-file response.
27428             # As far as I know, Copy-file was never exploitable either.
27429             cat >$TESTDIR/serveme <<EOF
27430 #!$TESTSHELL
27431 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
27432 echo "ok"
27433 echo "Created ."
27434 echo "./innocuous"
27435 echo "/innocuous/73.50///"
27436 echo "u=rw,g=rw,o=rw"
27437 echo "26"
27438 echo "#! /bin/sh"
27439 echo "echo 'gotcha!'"
27440 echo "Copy-file ."
27441 echo "./innocuous"
27442 echo "$HOME/innocuous"
27443 echo "ok"
27444 cat >/dev/null
27445 EOF
27446             sleep 1
27447             dotest_fail client-18 "$testcvs update" \
27448 "$PROG \[update aborted\]: protocol error: Copy-file tried to specify directory"
27449
27450             # And verify that none of the exploits was successful.
27451             dotest client-19 "cat $HOME/.bashrc" \
27452 "#!$TESTSHELL
27453 # This is where login scripts would usually be
27454 # stored\."
27455
27456             if $keep; then
27457               echo Keeping ${TESTDIR} and exiting due to --keep
27458               exit 0
27459             fi
27460
27461             cd ../..
27462             rm -r 1
27463             rmdir ${TESTDIR}/bogus
27464             rm $TESTDIR/serveme $HOME/.bashrc
27465             CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
27466           fi # skip the whole thing for local
27467           ;;
27468
27469         dottedroot)
27470           # Check that a CVSROOT with a "." in the name will work.
27471           CVSROOT_save=${CVSROOT}
27472           CVSROOT_DIRNAME_save=${CVSROOT_DIRNAME}
27473           CVSROOT_DIRNAME=${TESTDIR}/cvs.root
27474           CVSROOT=`newroot ${CVSROOT_DIRNAME}`
27475
27476           dotest dottedroot-init-1 "${testcvs} init" ""
27477           mkdir dir1
27478           mkdir dir1/dir2
27479           echo version1 >dir1/dir2/file1
27480           cd dir1
27481           dotest dottedroot-1 "${testcvs} import -m '' module1 AUTHOR INITIAL" \
27482 "${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/module1/dir2
27483 N module1/dir2/file1
27484
27485 No conflicts created by this import"
27486           cd ..
27487
27488           # This is the test that used to cause an assertion failure
27489           # in recurse.c:do_recursion().
27490           dotest dottedroot-2 "${testcvs} co -rINITIAL module1" \
27491 "${PROG} [a-z]*: Updating module1
27492 ${PROG} [a-z]*: Updating module1/dir2
27493 U module1/dir2/file1"
27494
27495             if $keep; then
27496               echo Keeping ${TESTDIR} and exiting due to --keep
27497               exit 0
27498             fi
27499
27500           rm -rf ${CVSROOT_DIRNAME}
27501           rm -r dir1 module1
27502           CVSROOT_DIRNAME=${CVSROOT_DIRNAME_save}
27503           CVSROOT=${CVSROOT_save}
27504           ;;
27505  
27506         fork)
27507           # Test that the server defaults to the correct executable in :fork:
27508           # mode.  See the note in the TODO at the end of this file about this.
27509           #
27510           # This test and client should be left after all other references to
27511           # CVS_SERVER are removed from this script.
27512           #
27513           # The client series of tests already tests that CVS_SERVER is
27514           # working, but that test might be better here.
27515           if $remote; then
27516             mkdir fork; cd fork
27517             save_CVS_SERVER=$CVS_SERVER
27518             unset CVS_SERVER
27519             # So looking through $PATH for cvs won't work...
27520             echo "echo junk" >cvs
27521             chmod a+x cvs
27522             save_PATH=$PATH; PATH=.:$PATH
27523             dotest fork-1 "$testcvs -d:fork:$CVSROOT_DIRNAME version" \
27524 'Client: \(.*\)
27525 Server: \1'
27526             CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
27527             unset save_CVS_SERVER
27528             PATH=$save_PATH; unset save_PATH
27529             cd ..
27530
27531             if $keep; then
27532               echo Keeping ${TESTDIR} and exiting due to --keep
27533               exit 0
27534             fi
27535           fi
27536           ;;
27537
27538         commit-add-missing)
27539           # Make sure that a commit fails when a `cvs add'ed file has
27540           # been removed from the working directory.
27541
27542           mkdir 1; cd 1
27543           module=c-a-m
27544           echo > unused-file
27545           dotest commit-add-missing-1 \
27546             "$testcvs -Q import -m. $module X Y" ''
27547
27548           file=F
27549           # Check it out and tag it.
27550           dotest commit-add-missing-2 "$testcvs -Q co $module" ''
27551           cd $module
27552           dotest commit-add-missing-3 "$testcvs -Q tag -b B" ''
27553           echo v1 > $file
27554           dotest commit-add-missing-4 "$testcvs -Q add $file" ''
27555           rm -f $file
27556           dotest_fail commit-add-missing-5 "$testcvs -Q ci -m. $file" \
27557 "${PROG} commit: Up-to-date check failed for .$file'
27558 ${PROG} \[commit aborted\]: correct above errors first!"
27559
27560           cd ../..
27561           rm -rf 1
27562           rm -rf ${CVSROOT_DIRNAME}/$module
27563           ;;
27564
27565         commit-d)
27566           # Check that top-level commits work when CVS/Root
27567           # is overridden by cvs -d.
27568
27569           mkdir -p 1/subdir; cd 1
27570           touch file1 subdir/file2
27571           dotest commit-d-1 "$testcvs -Q import -m. c-d-c X Y" ""
27572           dotest commit-d-2 "$testcvs -Q co c-d-c" ""
27573           cd c-d-c
27574           echo change >>file1; echo another change >>subdir/file2
27575           # Changing working root, then override with -d
27576           echo nosuchhost:/cvs > CVS/Root
27577           dotest commit-d-3 "$testcvs -Q -d $CVSROOT commit -m." \
27578 "Checking in file1;
27579 ${CVSROOT_DIRNAME}/c-d-c/file1,v  <--  file1
27580 new revision: 1.2; previous revision: 1.1
27581 done
27582 Checking in subdir/file2;
27583 ${CVSROOT_DIRNAME}/c-d-c/subdir/file2,v  <--  file2
27584 new revision: 1.2; previous revision: 1.1
27585 done"
27586           cd ../..
27587           rm -rf 1 cvsroot/c-d-c
27588           ;;
27589
27590         *)
27591            echo $what is not the name of a test -- ignored
27592            ;;
27593         esac
27594
27595     # Sanity check sanity.sh.  :)
27596     #
27597     # Test our exit directory so that tests that exit in an incorrect directory
27598     # are noticed during single test runs.
27599     if test "x$TESTDIR" != "x`pwd`"; then
27600             fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')"
27601     fi
27602
27603     # Test our temp directory for cvs-serv* directories and cvsXXXXXX temp
27604     # files.  We would like to not leave any behind.
27605     if $remote && ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
27606         # A true value means ls found files/directories with these names.
27607         # Give the server some time to finish, then retry.
27608         sleep 1
27609         if ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
27610             fail "Found cvs-serv* directories in $TMPDIR."
27611         fi
27612     fi
27613     if ls $TMPDIR/cvs?????? >/dev/null 2>&1; then
27614         # A true value means ls found files/directories with these names.
27615         fail "Found cvsXXXXXX temp files in $TMPDIR."
27616     fi
27617
27618 done # The big loop
27619
27620 echo "OK, all tests completed."
27621
27622 # TODO:
27623 # * Test `cvs update -d foo' (where foo does not exist).
27624 # * Test `cvs update foo bar' (where foo and bar are both from the
27625 #   same directory in the repository).  Suppose one is a branch--make
27626 #   sure that both directories get updated with the respective correct
27627 #   thing.
27628 # * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
27629 #   foo/.././../bar foo/../bar etc.
27630 # * Test all flags in modules file.
27631 #   Test that ciprog gets run both on checkin in that directory, or a
27632 #     higher-level checkin which recurses into it.
27633 # * Test operations on a directory that contains other directories but has
27634 #   no files of its own.
27635 # * -t global option
27636 # * cvs rm followed by cvs add or vice versa (with no checkin in between).
27637 # * cvs rm twice (should be a nice error message).
27638 # * -P option to checkout--(a) refrains from checking out new empty dirs,
27639 #   (b) prunes empty dirs already there.
27640 # * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
27641 #   gives an appropriate error (e.g.
27642 #     Cannot access ${TESTDIR}/non-existent/CVSROOT
27643 #     No such file or directory).
27644 #   (like basica-9, but for remote).
27645 # * Test ability to send notifications in response to watches.  (currently
27646 #   hard to test because CVS doesn't send notifications if username is the
27647 #   same).
27648 # * Test the contents of adm files other than Root and Repository.
27649 #   Entries seems the next most important thing.
27650 # * Test the following compatibility issues:
27651 #   - The filler fields in "D" entries in CVS/Entries get preserved
27652 #     (per cvs.texinfo).
27653 #   - Unrecognized entry types in CVS/Entries get ignored (looks like
27654 #     this needs to be documented in cvs.texinfo, but is not)
27655 #   - Test that unrecognized files in CVS directories (e.g. CVS/Foobar)
27656 #     are ignored (per cvs.texinfo).
27657 #   - Test 'cvs history' with symlinks in the path to the working directory.
27658 #   - Remove most of the CVS_SERVER stuff after a reasonable amount of time.
27659 #     The "fork" & "client" series of tests should be left.  4/2/00, CVS
27660 #     1.11.0.1 was altered so that it would default to program_name (set from
27661 #     argv[0]) rather than "cvs", but I'd like this script to work on legacy
27662 #     versions of CVS for awhile.
27663 #   - Testsuite doesn't work with usernames over eight characters in length.
27664 #     Fix it.
27665 # End of TODO list.
27666
27667 # Exit if keep set
27668 if $keep; then
27669   echo "Keeping ${TESTDIR} and exiting due to -k (keep) option."
27670   exit 0
27671 fi
27672
27673 # Remove the test directory, but first change out of it.
27674 cd `dirname ${TESTDIR}`
27675 rm -rf ${TESTDIR}
27676
27677 # end of sanity.sh