]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/cvs/src/sanity.sh
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / cvs / src / sanity.sh
1 #! /bin/sh
2 :
3 #       sanity.sh -- a growing testsuite for cvs.
4 #
5 # The copyright notice said: "Copyright (C) 1992, 1993 Cygnus Support"
6 # I'm not adding new copyright notices for new years as our recent 
7 # practice has been to include copying terms without copyright notices.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # Original Author: K. Richard Pixley
20
21 # usage:
22 usage ()
23 {
24     echo "Usage: `basename $0` --help"
25     echo "Usage: `basename $0` [-eklrv] [-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 "-e|--skipfail Treat tests that would otherwise be nonfatally skipped"
40     echo "              for reasons like missing tools as failures, exiting"
41     echo "              with an error message.  Also treat warnings as"
42     echo "              failures."
43     echo "-f FROM-TEST  Run TESTS-TO-RUN, skipping all tests in the list before"
44     echo "              FROM-TEST."
45     echo "-h HOSTNAME   Use :ext:HOSTNAME to run remote tests rather than"
46     echo "              :fork:.  Implies --remote and assumes that \$TESTDIR"
47     echo "              resolves to the same directory on both the client and"
48     echo "              the server."
49     echo "-k|--keep     Try to keep directories created by individual tests"
50     echo "              around, exiting after the first test which supports"
51     echo "              --keep."
52     echo "-l|--link-root"
53     echo "              Test CVS using a symlink to a real CVSROOT."
54     echo "-r|--remote   Test remote instead of local cvs."
55     echo "-v|--verbose  List test names as they are executed."
56     echo
57     echo "CVS-TO-TEST   The path to the CVS executable to be tested."
58     echo "TESTS-TO-RUN  The names of the tests to run (defaults to all tests)."
59     exit 2
60 }
61
62 # See TODO list at end of file.
63
64 # required to make this script work properly.
65 unset CVSREAD
66
67 # This will cause malloc to run slower but should also catch some common errors
68 # when CVS is linked with glibc 2.x.
69 MALLOC_CHECK_=2; export MALLOC_CHECK_
70
71 # We want to invoke a predictable set of i18n behaviors, not whatever
72 # the user running this script might have set.
73 # In particular:
74 #   'sort' and tabs and spaces (LC_COLLATE).
75 #   Messages from getopt (LC_MESSAGES) (in the future, CVS itself might 
76 #     also alter its messages based on LC_MESSAGES).
77 LANG=C
78 export LANG
79 LC_ALL=C
80 export LC_ALL
81
82
83 #
84 # Initialize the test counts.
85 #
86 passed=0
87 skipped=0
88 warnings=0
89
90
91
92 #
93 # read our options
94 #
95 unset fromtest
96 unset remotehost
97 keep=false
98 linkroot=false
99 remote=false
100 skipfail=false
101 verbose=false
102 while getopts ef:h:Hklrv-: option ; do
103     # convert the long opts to short opts
104     if test x$option = x-;  then
105         case "$OPTARG" in
106             [hH]|[hH][eE]|[hH][eE][lL]|[hH][eE][lL][pP])
107                 option=H;
108                 OPTARG=
109                 ;;
110             [kK]|[kK][eE]|[kK][eE][eE]|[kK][eE][eE][pP])
111                 option=k;
112                 OPTARG=
113                 ;;
114             l|li|lin|link|link-|link-r]|link-ro|link-roo|link-root)
115                 option=l;
116                 OPTARG=
117                 ;;
118             [rR]|[rR][eE]|[rR][eE][mM]|[rR][eE][mM][oO]|[rR][eE][mM][oO][tT]|[rR][eE][mM][oO][tT][eE])
119                 option=k;
120                 OPTARG=
121                 ;;
122             s|sk|ski|skip|skipf|skipfa|skipfai|skipfail)
123                 option=e
124                 OPTARG=
125                 ;;
126             v|ve|ver|verb|verbo|verbos|verbose)
127                 option=v
128                 OPTARG=
129                 ;;
130             *)
131                 option=\?
132                 OPTARG=
133         esac
134     fi
135     case "$option" in
136         e)
137             skipfail=:
138             ;;
139         f)
140             fromtest="$OPTARG"
141             ;;
142         h)
143             # Set a remotehost to run the remote tests on via :ext:
144             # Implies `-r' and assumes that $TESTDIR resolves to the same
145             # directory on the client and the server.
146             remotehost="$OPTARG"
147             remote=:
148             ;;
149         H)
150             exit_help
151             ;;
152         k)
153             # The -k (keep) option will eventually cause all the tests to
154             # leave around the contents of the /tmp directory; right now only
155             # some implement it.  Not originally intended to be useful with
156             # more than one test, but this should work if each test uses a
157             # uniquely named dir (use the name of the test).
158             keep=:
159             ;;
160         l)
161             linkroot=:
162             ;;
163         r)
164             remote=:
165             ;;
166         v)
167             verbose=:
168             ;;
169         \?)
170             exit_usage
171             ;;
172     esac
173 done
174
175 # boot the arguments we used above
176 while test $OPTIND -gt 1 ; do
177     shift
178     OPTIND=`expr $OPTIND - 1`
179 done
180
181 # Use full path for CVS executable, so that CVS_SERVER gets set properly
182 # for remote.
183 case $1 in
184 "")
185   exit_usage
186   ;;
187 /*)
188   testcvs=$1
189   ;;
190 *)
191   testcvs=`pwd`/$1
192   ;;
193 esac
194 shift
195
196 # If $remotehost is set, warn if $TESTDIR isn't since we are pretty sure
197 # that its default value of `/tmp/cvs-sanity' will not resolve to the same
198 # directory on two different machines.
199 if test -n "$remotehost" && test -z "$TESTDIR"; then
200     echo "WARNING: CVS server hostname is set and \$TESTDIR is not.  If" >&2
201     echo "$remotehost is not the local machine, then it is unlikely that" >&2
202     echo "the default value assigned to \$TESTDIR will resolve to the same" >&2
203     echo "directory on both this client and the CVS server." >&2
204 fi
205
206
207
208 ###
209 ### GUTS
210 ###
211
212 # "debugger"
213 #set -x
214
215 echo 'This test should produce no other output than this message, and a final "OK".'
216 echo '(Note that the test can take an hour or more to run and periodically stops'
217 echo 'for as long as one minute.  Do not assume there is a problem just because'
218 echo 'nothing seems to happen for a long time.  If you cannot live without'
219 echo 'running status, use the -v option or try the command:'
220 echo "\`tail -f check.log' from another window.)"
221
222 # Regexp to match what CVS will call itself in output that it prints.
223 # FIXME: we don't properly quote this--if the name contains . we'll
224 # just spuriously match a few things; if the name contains other regexp
225 # special characters we are probably in big trouble.
226 PROG=`basename ${testcvs}`
227
228 # Match the hostname
229 hostname="[-_.a-zA-Z0-9]*"
230
231 # Regexp to match the name of a temporary file (from cvs_temp_name).
232 # This appears in certain diff output.
233 tempname="[-a-zA-Z0-9/.%_]*"
234
235 # Regexp to match a date in RFC822 format (as amended by RFC1123).
236 RFCDATE="[a-zA-Z0-9 ][a-zA-Z0-9 ]* [0-9:][0-9:]* -0000"
237 RFCDATE_EPOCH="1 Jan 1970 00:00:00 -0000"
238
239 # Regexp to match a date in standard Unix format as used by rdiff
240 # FIXCVS: There's no reason for rdiff to use a different date format
241 # than diff does
242 DATE="[a-zA-Z]* [a-zA-Z]* [ 1-3][0-9] [0-9:]* [0-9]*"
243
244 # Which directories should Which and find_tool search for executables?
245 SEARCHPATH=$PATH:/usr/local/bin:/usr/contrib/bin:/usr/contrib:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin:/sw/bin:/usr/pkg/bin
246
247 # Do not assume that `type -p cmd` is portable
248 # Usage: Which [-a] [-x|-f|-r] prog [$SEARCHPATH:/with/directories:/to/search]
249 Which() {
250   # Optional first argument for file type, defaults to -x.
251   # Second argument is the file or directory to be found.
252   # Third argument is the PATH to search.
253   # By default, print only the first file that matches,
254   # -a will cause all matches to be printed.
255   notevery=:
256   if [ "x$1" = "x-a" ]; then notevery=false; shift; fi
257   case "$1" in
258     -*) t=$1; shift ;;
259     *) t=-x ;;
260   esac
261   case "$1" in
262     # FIXME: Someday this may need to be fixed
263     # to deal better with C:\some\path\to\ssh values...
264     /*) test $t $1 && echo $1 ;;
265     *) for d in `IFS=:; echo ${2-$SEARCHPATH}`
266        do
267          test $t $d/$1 && { echo $d/$1; if $notevery; then break; fi; }
268        done
269        ;;
270   esac
271 }
272
273
274 # On cygwin32, we may not have /bin/sh.
275 if test -r /bin/sh; then
276   TESTSHELL="/bin/sh"
277 else
278   TESTSHELL=`Which -f sh`
279   if test ! -r "$TESTSHELL"; then
280     TESTSHELL="/bin/sh"
281   fi
282 fi
283
284 # FIXME: try things (what things? checkins?) without -m.
285 #
286 # Some of these tests are written to expect -Q.  But testing with
287 # -Q is kind of bogus, it is not the way users actually use CVS (usually).
288 # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
289 # and then they've obviously got to do something with the output....
290 #
291 CVS="${testcvs} -Q"
292
293 LOGFILE=`pwd`/check.log
294
295 # Save the previous log in case the person running the tests decides
296 # they want to look at it.  The extension ".plog" is chosen for consistency
297 # with dejagnu.
298 if test -f check.log; then
299         mv check.log check.plog
300 fi
301
302 # Create the log file so check.log can be tailed almost immediately after
303 # this script is started.  Otherwise it can take up to a minute or two before
304 # the log file gets created when $remotehost is specified on some systems,
305 # which makes for a lot of failed `tail -f' attempts.
306 touch check.log
307
308 # Workaround any X11Forwarding by ssh. Otherwise this text:
309 #   Warning: No xauth data; using fake authentication data for X11 forwarding.
310 # has been known to end up in the test results below
311 # causing the test to fail.
312 [ -n "$DISPLAY" ] && unset DISPLAY
313   
314 # The default value of /tmp/cvs-sanity for TESTDIR is dubious,
315 # because it loses if two people/scripts try to run the tests
316 # at the same time.  Some possible solutions:
317 # 1.  Use /tmp/cvs-test$$.  One disadvantage is that the old
318 #     cvs-test* directories would pile up, because they wouldn't
319 #     necessarily get removed.
320 # 2.  Have everyone/everything running the testsuite set
321 #     TESTDIR to some appropriate directory.
322 # 3.  Have the default value of TESTDIR be some variation of
323 #     `pwd`/cvs-sanity.  The biggest problem here is that we have
324 #     been fairly careful to test that CVS prints in messages the
325 #     actual pathnames that we pass to it, rather than a different
326 #     pathname for the same directory, as may come out of `pwd`.
327 #     So this would be lost if everything was `pwd`-based.  I suppose
328 #     if we wanted to get baroque we could start making symlinks
329 #     to ensure the two are different.
330 : ${CVS_RSH=rsh}; export CVS_RSH
331 if test -n "$remotehost"; then
332         # We need to set $tmp on the server since $TMPDIR is compared against
333         # messages generated by the server.
334         tmp=`$CVS_RSH $remotehost 'cd /tmp; /bin/pwd || pwd' 2>/dev/null`
335         if test $? != 0; then
336             echo "$CVS_RSH $remotehost failed." >&2
337             exit 1
338         fi
339 else
340         tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null`
341 fi
342
343 # Now:
344 #       1) Set TESTDIR if it's not set already
345 #       2) Remove any old test remnants
346 #       3) Create $TESTDIR
347 #       4) Normalize TESTDIR with `cd && (/bin/pwd || pwd)`
348 #          (This will match CVS output later)
349 : ${TESTDIR=$tmp/cvs-sanity}
350 # clean any old remnants (we need the chmod because some tests make
351 # directories read-only)
352 if test -d ${TESTDIR}; then
353     chmod -R a+wx ${TESTDIR}
354     rm -rf ${TESTDIR}
355 fi
356 # These exits are important.  The first time I tried this, if the `mkdir && cd`
357 # failed then the build directory would get blown away.  Some people probably
358 # wouldn't appreciate that.
359 mkdir ${TESTDIR} || exit 1
360 cd ${TESTDIR} || exit 1
361 # Ensure $TESTDIR is absolute
362 if echo "${TESTDIR}" |grep '^[^/]'; then
363     # Don't resolve this unless we have to.  This keeps symlinks intact.  This
364     # is important at least when testing using -h $remotehost, because the same
365     # value for $TESTDIR must resolve to the same directory on the client and
366     # the server and we likely used Samba, and possibly symlinks, to do this.
367     TESTDIR=`(/bin/pwd || pwd) 2>/dev/null`
368 fi
369
370 if test -z "${TESTDIR}" || echo "${TESTDIR}" |grep '^[^/]'; then
371     echo "Unable to resolve TESTDIR to an absolute directory." >&2
372     exit 1
373 fi
374 cd ${TESTDIR}
375
376 # Now set $TMPDIR if the user hasn't overridden it.
377 #
378 # We use a $TMPDIR under $TESTDIR by default so that two tests may be run at
379 # the same time without bumping heads without requiring the user to specify
380 # more than $TESTDIR.  See the test for leftover cvs-serv* directories near the
381 # end of this script at the end of "The big loop".
382 : ${TMPDIR=$TESTDIR/tmp}
383 export TMPDIR
384 if test -d $TMPDIR; then :; else
385     mkdir $TMPDIR
386 fi
387
388 # Make sure various tools work the way we expect, or try to find
389 # versions that do.
390 : ${AWK=awk}
391 : ${EXPR=expr}
392 : ${ID=id}
393 : ${TR=tr}
394
395 # Keep track of tools that are found, but do NOT work as we hope
396 # in order to avoid them in future
397 badtools=
398 set_bad_tool ()
399 {
400    badtools=$badtools:$1
401 }
402 is_bad_tool ()
403 {
404    case ":$badtools:" in *:$1:*) return 0 ;; *) return 1 ; esac
405 }
406
407 version_test ()
408 {
409   vercmd=$1
410   verbad=:
411   if RES=`$vercmd --version </dev/null 2>&1`; then
412     if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
413       echo "$RES"
414       verbad=false
415     fi
416   fi
417   if $verbad; then
418     echo "The command \`$vercmd' does not support the --version option."
419   fi
420   # It does not really matter that --version is not supported
421   return 0
422 }
423
424 # Try to find a tool that satisfies all of the tests.
425 # Usage: list:of:colon:separated:alternatives test1 test2 test3 test4...
426 # Example: find_tool awk:gawk:nawk awk_tooltest1 awk_tooltest2
427 find_tool ()
428 {
429   default_TOOL=$1
430   echo find_tool: ${1+"$@"} >>$LOGFILE
431   cmds="`IFS=:; echo $1`"; shift; tooltests="${1+$@}"
432   if test -z "$tooltests"; then tooltests=version_test; fi
433   clist=; for cmd in $cmds; do clist="$clist `Which -a $cmd`"; done
434   # Make sure the default tool is just the first real command name
435   for default_TOOL in $clist `IFS=:; echo $default_TOOL`; do break; done
436   TOOL=""
437   for trytool in $clist ; do
438     pass=:
439     for tooltest in $tooltests; do
440       result=`eval $tooltest $trytool`
441       rc=$?
442       echo "Running $tooltest $trytool" >>$LOGFILE
443       if test -n "$result"; then
444         echo "$result" >>$LOGFILE
445       fi
446       if test "$rc" = "0"; then
447         echo "PASS: $tooltest $trytool" >>$LOGFILE
448       elif test "$rc" = "77"; then
449         echo "MARGINAL: $tooltest $trytool; rc=$rc" >>$LOGFILE
450         TOOL=$trytool
451         pass=false
452       else
453         set_bad_tool $trytool
454         echo "FAIL: $tooltest $trytool; rc=$rc" >>$LOGFILE
455         pass=false
456       fi
457     done
458     if $pass; then
459       echo $trytool
460       return 0
461     fi
462   done
463   if test -n "$TOOL"; then
464     echo "Notice: The default version of \`$default_TOOL' is defective." >>$LOGFILE
465     echo "using \`$TOOL' and hoping for the best." >>$LOGFILE
466     echo "Notice: The default version of \`$default_TOOL' is defective." >&2
467     echo "using \`$TOOL' and hoping for the best." >&2
468     echo $TOOL
469   else
470     echo $default_TOOL
471   fi
472 }  
473
474 id_tool_test ()
475 {
476   id=$1
477   if $id -u >/dev/null 2>&1 && $id -un >/dev/null 2>&1; then
478     return 0
479   else
480     echo "Running these tests requires an \`id' program that understands the"
481     echo "-u and -n flags.  Make sure that such an id (GNU, or many but not"
482     echo "all vendor-supplied versions) is in your path."
483     return 1
484   fi
485 }
486
487 ID=`find_tool id version_test id_tool_test`
488 echo "Using ID=$ID" >>$LOGFILE
489
490 # You can't run CVS as root; print a nice error message here instead
491 # of somewhere later, after making a mess.
492 for pass in false :; do
493   case "`$ID -u 2>/dev/null`" in
494     "0")
495       echo "Test suite does not work correctly when run as root" >&2
496       exit 1
497       ;;
498
499     *)
500       break
501       ;;
502   esac
503 done
504
505 # Cause NextStep 3.3 users to lose in a more graceful fashion.
506 expr_tooltest1 ()
507 {
508 expr=$1
509 if $expr 'abc
510 def' : 'abc
511 def' >/dev/null; then
512   # good, it works
513   return 0
514 else
515   echo 'Running these tests requires an "expr" program that can handle'
516   echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but'
517   echo 'not all vendor-supplied versions) is in your path.'
518   return 1
519 fi
520 }
521
522 # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
523 # if we can't find a GNU expr to ease their troubles...
524 expr_tooltest2 ()
525 {
526 expr=$1
527 if $expr 'a
528 b' : 'a
529 c' >/dev/null; then
530   echo 'WARNING: you are using a version of expr that does not correctly'
531   echo 'match multi-line patterns.  Some tests may spuriously pass or fail.'
532   echo 'You may wish to make sure GNU expr is in your path.'
533   return 1
534 else
535   return 0
536 fi
537 }
538
539 expr_create_bar ()
540 {
541 echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo
542 cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
543 cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo
544 cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
545 rm -f ${TESTDIR}/foo
546 }
547
548 expr_tooltest3 ()
549 {
550 expr=$1
551 # More SunOS lossage...
552 test ! -f ${TESTDIR}/bar && expr_create_bar
553 if $expr "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then
554   : good, it works
555 else
556   echo 'WARNING: you are using a version of expr that does not correctly'
557   echo 'match large patterns.  Some tests may spuriously pass or fail.'
558   echo 'You may wish to make sure GNU expr is in your path.'
559   return 1
560 fi
561 if $expr "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then
562   echo 'WARNING: you are using a version of expr that does not correctly'
563   echo 'match large patterns.  Some tests may spuriously pass or fail.'
564   echo 'You may wish to make sure GNU expr is in your path.'
565   return 1
566 fi
567 # good, it works
568 return 0
569 }
570
571 # That we should have to do this is total bogosity, but GNU expr
572 # version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix
573 # (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
574 # next release of GNU expr after 1.12 (but we still have to cater to the old
575 # ones for some time because they are in many linux distributions).
576 ENDANCHOR="$"
577 expr_set_ENDANCHOR ()
578 {
579 expr=$1
580 ENDANCHOR="$"
581 if $expr 'abc
582 def' : 'abc$' >/dev/null; then
583   ENDANCHOR='\'\'
584    echo "Notice: An ENDANCHOR of dollar does not work."
585    echo "Using a workaround for GNU expr versions 1.9.4 thru 1.12"
586 fi
587 return 0
588 }
589
590 # Work around another GNU expr (version 1.10-1.12) bug/incompatibility.
591 # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
592 # Note that the workaround is not a complete equivalent of .* because
593 # the first parenthesized expression in the regexp must match something
594 # in order for expr to return a successful exit status.
595 # Rumor has it this will be fixed in the
596 # next release of GNU expr after 1.12 (but we still have to cater to the old
597 # ones for some time because they are in many linux distributions).
598 DOTSTAR='.*'
599 expr_set_DOTSTAR ()
600 {
601 expr=$1
602 DOTSTAR='.*'
603 if $expr 'abc
604 def' : "a${DOTSTAR}f" >/dev/null; then
605   : good, it works
606 else
607   DOTSTAR='\(.\|
608 \)*'
609   echo "Notice: DOTSTAR changed from sane \`.*' value to \`$DOTSTAR\`"
610   echo "to workaround GNU expr version 1.10 thru 1.12 bug where \`.'"
611   echo "does not match a newline."
612 fi
613 return 0
614 }
615
616 # Now that we have DOTSTAR, make sure it works with big matches
617 expr_tooltest_DOTSTAR ()
618 {
619 expr=$1
620 test ! -f ${TESTDIR}/bar && expr_create_bar
621 if $expr "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then
622   # good, it works
623   return 0
624 else
625   echo 'WARNING: you are using a version of expr that does not correctly'
626   echo 'match large patterns.  Some tests may spuriously pass or fail.'
627   echo 'You may wish to make sure GNU expr is in your path.'
628   return 77
629 fi
630 }
631
632 # FreeBSD 5.2 and 6.1 support 'expr [-e] expression' 
633 # They get confused unless '--' is used before the expressions
634 # when those expressions begin with a '-' character, such as the
635 # output of an ls -l command. The EXPR_COMPAT environment variable may
636 # be used to go back to the non-POSIX behavior as an alternative.
637 # (GNU expr appears to accept the '--' argument and work correctly or
638 # not have it and still get the results we want.)
639 exprDASHDASH='false'
640 expr_set_DASHDASH ()
641 {
642 expr=$1
643 exprDASHDASH='false'
644 # Not POSIX, but works on a lot of expr versions.
645 if $expr "-rw-rw-r--" : "-rw-rw-r--" >/dev/null 2>&1; then
646   # good, it works
647   return 0
648 else
649   # Do things in the POSIX manner.
650   if $expr -- "-rw-rw-r--" : "-rw-rw-r--" >/dev/null 2>&1; then
651     exprDASHDASH=':'
652     return 0
653   else
654     echo 'WARNING: Your $expr does not correctly handle'
655     echo 'leading "-" characters in regular expressions to'
656     echo 'be matched. You may wish to see if there is an'
657     echo 'environment variable or other setting to allow'
658     echo 'POSIX functionality to be enabled.'
659     return 77
660   fi
661 fi
662 }
663
664
665 EXPR=`find_tool ${EXPR}:gexpr \
666   version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \
667 expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR`
668
669 # Set the ENDANCHOR and DOTSTAR for the chosen expr version.
670 expr_set_ENDANCHOR ${EXPR} >/dev/null
671 expr_tooltest_DOTSTAR ${EXPR} >/dev/null
672
673 # Is $EXPR a POSIX or non-POSIX implementation
674 # with regard to command-line arguments?
675 expr_set_DASHDASH ${EXPR}
676 $exprDASHDASH && EXPR="$EXPR --"
677
678 echo "Using EXPR=$EXPR" >>$LOGFILE
679 echo "Using ENDANCHOR=$ENDANCHOR" >>$LOGFILE
680 echo "Using DOTSTAR=$DOTSTAR" >>$LOGFILE
681
682 # Cleanup
683 rm -f ${TESTDIR}/bar
684
685 # Work around yet another GNU expr (version 1.10) bug/incompatibility.
686 # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
687 # it is not.  I doubt that POSIX allows us to use \+ and assume it means
688 # (non-special) +, so here is another workaround
689 # Rumor has it this will be fixed in the
690 # next release of GNU expr after 1.12 (but we still have to cater to the old
691 # ones for some time because they are in many linux distributions).
692 PLUS='+'
693 if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
694   : good, it works
695 else
696   PLUS='\+'
697 fi
698
699 # Likewise, for ?
700 QUESTION='?'
701 if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
702   : good, it works
703 else
704   QUESTION='\?'
705 fi
706
707 # Now test the username to make sure it contains only valid characters
708 username=`$ID -un`
709 if $EXPR "${username}" : "${username}" >/dev/null; then
710   : good, it works
711 else
712   echo "Test suite does not work correctly when run by a username" >&2
713   echo "containing regular expression meta-characters." >&2
714   exit 1
715 fi
716
717 # Only 8 characters of $username appear in some output.
718 if test `echo $username |wc -c` -gt 8; then
719   username8=`echo $username |sed 's/^\(........\).*/\1/'`
720 else
721   username8=$username
722 fi
723
724 # Rarely, we need to match any username, not just the name of the user
725 # running this test.
726 #
727 # I'm not really sure what characters should be here.  a-zA-Z obviously.
728 # People complained when 0-9 were not allowed in usernames.  Other than that
729 # I'm not sure.
730 anyusername="[-a-zA-Z0-9][-a-zA-Z0-9]*"
731
732 # now make sure that tr works on NULs
733 tr_tooltest1 ()
734 {
735 tr=$1
736 if $EXPR `echo "123" | $tr '2' '\0'` : "123" >/dev/null 2>&1; then
737   echo 'Warning: you are using a version of tr which does not correctly'
738   echo 'handle NUL bytes.  Some tests may spuriously pass or fail.'
739   echo 'You may wish to make sure GNU tr is in your path.'
740   return 77
741 fi
742 # good, it works
743 return 0
744 }
745
746 TR=`find_tool ${TR}:gtr version_test tr_tooltest1`
747 echo "Using TR=$TR" >>$LOGFILE
748
749 # Awk testing
750
751 awk_tooltest1 ()
752 {
753 awk=$1
754 $awk 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
755 if $EXPR "`cat abc`" : \
756 'one
757 two
758 three
759 four
760 five
761 six'; then
762   rm abc
763   return 0
764 else
765   rm abc
766   echo "Notice: awk BEGIN clause or printf is not be working properly."
767   return 1
768 fi
769 }
770
771 # Format item %c check
772 awk_tooltest2 ()
773 {
774 awk=$1
775 $awk 'BEGIN { printf "%c%c%c", 2, 3, 4 }' </dev/null \
776   | ${TR} '\002\003\004' '123' >abc
777 if $EXPR "`cat abc`" : "123" ; then
778   : good, found it
779 else
780   echo "Notice: awk format %c string may not be working properly."
781   rm abc
782   return 77
783 fi
784 rm abc
785 return 0
786 }
787
788 AWK=`find_tool gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2`
789 echo "Using AWK=$AWK" >>$LOGFILE
790
791 # Test that $1 works as a remote shell.  If so, set $host, $CVS_RSH, &
792 # $save_CVS_RSH to match and return 0.  Otherwise, set $skipreason and return
793 # 77.
794 depends_on_rsh ()
795 {
796   host=${remotehost-"`hostname`"}
797   result=`$1 $host 'echo test'`
798   rc=$?
799   if test $? != 0 || test "x$result" != "xtest"; then
800     skipreason="\`$1 $host' failed rc=$rc result=$result"
801     return 77
802   fi
803
804   save_CVS_RSH=$CVS_RSH
805   CVS_RSH=$1; export CVS_RSH
806   return 0
807 }
808
809 # Find a usable SSH.  When a usable ssh is found, set $host, $CVS_RSH, and
810 # $save_CVS_RSH and return 0.  Otherwise, set $skipreason and return 77.
811 depends_on_ssh ()
812 {
813   case "$CVS_RSH" in
814     *ssh*|*putty*)
815       tryssh=`Which $CVS_RSH`
816       if [ ! -n "$tryssh" ]; then
817         skipreason="Unable to find CVS_RSH=$CVS_RSH executable"
818         return 77
819       elif [ ! -x "$tryssh" ]; then
820         skipreason="Unable to execute $tryssh program"
821         return 77
822       fi
823       ;;
824     *)
825       # Look in the user's PATH for "ssh"
826       tryssh=`Which ssh`
827       if test ! -r "$tryssh"; then
828         skipreason="Unable to find ssh program"
829         return 77
830       fi
831       ;;
832   esac
833
834   depends_on_rsh "$tryssh"
835   return $?
836 }
837
838 pass ()
839 {
840   echo "PASS: $1" >>${LOGFILE}
841   passed=`expr $passed + 1`
842 }
843
844 # Like skip(), but don't fail when $skipfail is set.
845 skip_always ()
846 {
847   echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
848   skipped=`expr $skipped + 1`
849 }
850
851 skip ()
852 {
853   if $skipfail; then
854     fail "$1${2+ ($2)}"
855   else
856     echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
857   fi
858   skipped=`expr $skipped + 1`
859 }
860
861 warn ()
862 {
863   if $skipfail; then
864     fail "$1${2+ ($2)}"
865   else
866     echo "WARNING: $1${2+ ($2)}" >>$LOGFILE
867   fi
868   warnings=`expr $warnings + 1`
869 }
870
871 # Convenience function for skipping tests run only in local mode.
872 localonly ()
873 {
874   skip_always $1 "only tested in local mode"
875 }
876
877 fail ()
878 {
879   echo "FAIL: $1" | tee -a ${LOGFILE}
880   echo "*** Please see the \`TESTS' and \`check.log' files for more information." >&2
881   # This way the tester can go and see what remnants were left
882   exit 1
883 }
884
885 verify_tmp_empty ()
886 {
887   # Test our temp directory for cvs-serv* directories and cvsXXXXXX temp
888   # files.  We would like to not leave any behind.
889   if $remote && ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
890     # A true value means ls found files/directories with these names.
891     # Give the server some time to finish, then retry.
892     sleep 1
893     if ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
894       warn "$1" "Found cvs-serv* directories in $TMPDIR."
895       # The above will exit if $skipfail
896       rm -rf $TMPDIR/cvs-serv*
897     fi
898   fi
899   if ls $TMPDIR/cvs?????? >/dev/null 2>&1; then
900     # A true value means ls found files/directories with these names.
901     warn "$1" "Found cvsXXXXXX temp files in $TMPDIR."
902     # The above will exit if $skipfail
903     rm -f ls $TMPDIR/cvs??????
904   fi
905 }
906
907 # Restore changes to CVSROOT admin files.
908 restore_adm ()
909 {
910     rm -rf $CVSROOT_DIRNAME/CVSROOT
911     cp -Rp $TESTDIR/CVSROOT.save $CVSROOT_DIRNAME/CVSROOT
912 }
913
914 # See dotest and dotest_fail for explanation (this is the parts
915 # of the implementation common to the two).
916 dotest_internal ()
917 {
918   if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$3${ENDANCHOR}" >/dev/null; then
919     # Why, I hear you ask, do we write this to the logfile
920     # even when the test passes?  The reason is that the test
921     # may give us the regexp which we were supposed to match,
922     # but sometimes it may be useful to look at the exact
923     # text which was output.  For example, suppose one wants
924     # to grep for a particular warning, and make _sure_ that
925     # CVS never hits it (even in cases where the tests might
926     # match it with .*).  Or suppose one wants to see the exact
927     # date format output in a certain case (where the test will
928     # surely use a somewhat non-specific pattern).
929     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
930     pass "$1"
931     verify_tmp_empty "$1"
932   # expr can't distinguish between "zero characters matched" and "no match",
933   # so special-case it.
934   elif test -z "$3" && test ! -s ${TESTDIR}/dotest.tmp; then
935     pass "$1"
936     verify_tmp_empty "$1"
937   elif test x"$4" != x; then
938     if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$4${ENDANCHOR}" >/dev/null; then
939       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
940       pass "$1"
941       verify_tmp_empty "$1"
942     else
943       echo "** expected: " >>${LOGFILE}
944       echo "$3" >>${LOGFILE}
945       echo "$3" > ${TESTDIR}/dotest.ex1
946       echo "** or: " >>${LOGFILE}
947       echo "$4" >>${LOGFILE}
948       echo "$4" > ${TESTDIR}/dotest.ex2
949       echo "** got: " >>${LOGFILE}
950       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
951       fail "$1"
952     fi
953   else
954     echo "** expected: " >>${LOGFILE}
955     echo "$3" >>${LOGFILE}
956     echo "$3" > ${TESTDIR}/dotest.exp
957     echo "** got: " >>${LOGFILE}
958     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
959     fail "$1"
960   fi
961 }
962
963 dotest_all_in_one ()
964 {
965   if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
966          "`cat ${TESTDIR}/dotest.exp`" >/dev/null; then
967     return 0
968   fi
969   return 1
970 }
971
972 # WARNING: this won't work with REs that match newlines....
973 #
974 dotest_line_by_line ()
975 {
976   line=1
977   while [ $line -le `wc -l <${TESTDIR}/dotest.tmp` ] ; do
978     if $EXPR "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" : \
979        "`sed -n ${line}p ${TESTDIR}/dotest.exp`" >/dev/null; then
980       :
981     elif test -z "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" &&
982        test -z "`sed -n ${line}p ${TESTDIR}/dotest.exp`"; then
983       :
984     else
985       echo "Line $line:" >> ${LOGFILE}
986       echo "**** expected: " >>${LOGFILE}
987       sed -n ${line}p ${TESTDIR}/dotest.exp >>${LOGFILE}
988       echo "**** got: " >>${LOGFILE}
989       sed -n ${line}p ${TESTDIR}/dotest.tmp >>${LOGFILE}
990       unset line
991       return 1
992     fi
993     line=`expr $line + 1`
994   done
995   unset line
996   return 0
997 }
998
999 # If you are having trouble telling which line of a multi-line
1000 # expression is not being matched, replace calls to dotest_internal()
1001 # with calls to this function:
1002 #
1003 dotest_internal_debug ()
1004 {
1005   if test -z "$3"; then
1006     if test -s ${TESTDIR}/dotest.tmp; then
1007       echo "** expected: " >>${LOGFILE}
1008       echo "$3" >>${LOGFILE}
1009       echo "$3" > ${TESTDIR}/dotest.exp
1010       rm -f ${TESTDIR}/dotest.ex2
1011       echo "** got: " >>${LOGFILE}
1012       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1013       fail "$1"
1014     else
1015       pass "$1"
1016       verify_tmp_empty "$1"
1017     fi
1018   else
1019     echo "$3" > ${TESTDIR}/dotest.exp
1020     if dotest_line_by_line "$1" "$2"; then
1021       pass "$1"
1022       verify_tmp_empty "$1"
1023     else
1024       if test x"$4" != x; then
1025         mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1
1026         echo "$4" > ${TESTDIR}/dotest.exp
1027         if dotest_line_by_line "$1" "$2"; then
1028           pass "$1"
1029           verify_tmp_empty "$1"
1030         else
1031           mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2
1032           echo "** expected: " >>${LOGFILE}
1033           echo "$3" >>${LOGFILE}
1034           echo "** or: " >>${LOGFILE}
1035           echo "$4" >>${LOGFILE}
1036           echo "** got: " >>${LOGFILE}
1037           cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1038           fail "$1"
1039         fi
1040       else
1041         echo "** expected: " >>${LOGFILE}
1042         echo "$3" >>${LOGFILE}
1043         echo "** got: " >>${LOGFILE}
1044         cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1045         fail "$1"
1046       fi
1047     fi
1048   fi
1049 }
1050
1051 # Usage:
1052 #  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
1053 # TESTNAME is the name used in the log to identify the test.
1054 # COMMAND is the command to run; for the test to pass, it exits with
1055 # exitstatus zero.
1056 # OUTPUT is a regexp which is compared against the output (stdout and
1057 # stderr combined) from the test.  It is anchored to the start and end
1058 # of the output, so should start or end with ".*" if that is what is desired.
1059 # Trailing newlines are stripped from the command's actual output before
1060 # matching against OUTPUT.
1061 # If OUTPUT2 is specified and the output matches it, then it is also
1062 # a pass (partial workaround for the fact that some versions of expr
1063 # lack \|).
1064 dotest ()
1065 {
1066   rm -f ${TESTDIR}/dotest.ex? 2>&1
1067   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
1068   status=$?
1069   if test "$status" != 0; then
1070     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1071     echo "exit status was $status" >>${LOGFILE}
1072     fail "$1"
1073   fi
1074   dotest_internal "$@"
1075 }
1076
1077 # Like dotest except only 2 args and result must exactly match stdin
1078 dotest_lit ()
1079 {
1080   rm -f ${TESTDIR}/dotest.ex? 2>&1
1081   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
1082   status=$?
1083   if test "$status" != 0; then
1084     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1085     echo "exit status was $status" >>${LOGFILE}
1086     fail "$1"
1087   fi
1088   cat >${TESTDIR}/dotest.exp
1089   if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
1090     pass "$1"
1091     verify_tmp_empty "$1"
1092   else
1093     echo "** expected: " >>${LOGFILE}
1094     cat ${TESTDIR}/dotest.exp >>${LOGFILE}
1095     echo "** got: " >>${LOGFILE}
1096     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1097     fail "$1"
1098   fi
1099 }
1100
1101 # Like dotest except exitstatus should be nonzero.
1102 dotest_fail ()
1103 {
1104   rm -f ${TESTDIR}/dotest.ex? 2>&1
1105   eval "$2" >${TESTDIR}/dotest.tmp 2>&1
1106   status=$?
1107   if test "$status" = 0; then
1108     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
1109     echo "exit status was $status" >>${LOGFILE}
1110     fail "$1"
1111   fi
1112   dotest_internal "$@"
1113 }
1114
1115 # Like dotest except output is sorted.
1116 dotest_sort ()
1117 {
1118   rm -f ${TESTDIR}/dotest.ex? 2>&1
1119   eval "$2" >${TESTDIR}/dotest.tmp1 2>&1
1120   status=$?
1121   if test "$status" != 0; then
1122     cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
1123     echo "exit status was $status" >>${LOGFILE}
1124     fail "$1"
1125   fi
1126   ${TR} '       ' ' ' < ${TESTDIR}/dotest.tmp1 | sort > ${TESTDIR}/dotest.tmp
1127   dotest_internal "$@"
1128 }
1129
1130 # A function for fetching the timestamp of a revison of a file
1131 getrlogdate () {
1132     ${testcvs} -n rlog -N ${1+"$@"} |
1133     while read token value; do
1134         case "$token" in
1135         date:)
1136             echo $value | sed "s,;.*,,"
1137             break;
1138             ;;
1139         esac
1140     done
1141 }
1142
1143 # Avoid picking up any stray .cvsrc, etc., from the user running the tests
1144 mkdir home
1145 HOME=${TESTDIR}/home; export HOME
1146
1147 # Make sure this variable is not defined to anything that would
1148 # change the format of rcs dates.  Otherwise people using e.g.,
1149 # RCSINIT=-zLT get lots of spurious failures.
1150 RCSINIT=; export RCSINIT
1151
1152 # Remaining arguments are the names of tests to run.
1153 #
1154 # The testsuite is broken up into (hopefully manageably-sized)
1155 # independently runnable tests, so that one can quickly get a result
1156 # from a cvs or testsuite change, and to facilitate understanding the
1157 # tests.
1158
1159 if test x"$*" = x; then
1160         # Basic/miscellaneous functionality
1161         tests="version basica basicb basicc basic1 deep basic2"
1162         tests="${tests} parseroot parseroot2 files spacefiles commit-readonly"
1163         tests="${tests} commit-add-missing"
1164         tests="$tests add-restricted"
1165         tests="${tests} status"
1166         # Branching, tagging, removing, adding, multiple directories
1167         tests="${tests} rdiff rdiff-short"
1168         tests="${tests} rdiff2 diff diffnl death death2 death-rtag"
1169         tests="${tests} rm-update-message rmadd rmadd2 rmadd3 resurrection"
1170         tests="${tests} dirs dirs2 branches branches2 tagc tagf "
1171         tests="${tests} tag-log tag-space"
1172         tests="${tests} rcslib multibranch import importb importc import-CVS"
1173         tests="$tests import-quirks"
1174         tests="${tests} update-p import-after-initial branch-after-import"
1175         tests="${tests} join join2 join3 join4 join5 join6 join7 join8 join9"
1176         tests="${tests} join-readonly-conflict join-admin join-admin-2"
1177         tests="${tests} join-rm"
1178         tests="${tests} new newb conflicts conflicts2 conflicts3 conflicts4"
1179         tests="${tests} clean"
1180         # Checking out various places (modules, checkout -d, &c)
1181         tests="${tests} modules modules2 modules3 modules4 modules5 modules6"
1182         tests="${tests} modules7 mkmodules co-d"
1183         tests="${tests} cvsadm emptydir abspath abspath2 toplevel toplevel2"
1184         tests="${tests} rstar-toplevel trailingslashes checkout_repository"
1185         # Log messages, error messages.
1186         tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg opterrmsg"
1187         # Watches, binary files, history browsing, &c.
1188         tests="${tests} devcom devcom2 devcom3 watch4 watch5 watch6"
1189         tests="${tests} unedit-without-baserev"
1190         tests="${tests} ignore ignore-on-branch binfiles binfiles2 binfiles3"
1191         tests="${tests} mcopy binwrap binwrap2"
1192         tests="${tests} binwrap3 mwrap info taginfo config"
1193         tests="${tests} serverpatch log log2 logopt ann ann-id"
1194         # Repository Storage (RCS file format, CVS lock files, creating
1195         # a repository without "cvs init", &c).
1196         tests="${tests} crerepos crerepos-extssh rcs rcs2 rcs3 rcs4 rcs5 rcs6"
1197         tests="$tests lockfiles backuprecover"
1198         tests="${tests} sshstdio"
1199         # More history browsing, &c.
1200         tests="${tests} history"
1201         tests="${tests} big modes modes2 modes3 stamps"
1202         # PreservePermissions stuff: permissions, symlinks et al.
1203         # tests="${tests} perms symlinks symlinks2 hardlinks"
1204         # More tag and branch tests, keywords.
1205         tests="${tests} sticky keyword keywordlog keywordname keyword2"
1206         tests="${tests} head tagdate multibranch2 tag8k"
1207         # "cvs admin", reserved checkouts.
1208         tests="${tests} admin reserved"
1209         # Nuts and bolts of diffing/merging (diff library, &c)
1210         tests="${tests} diffmerge1 diffmerge2"
1211         # Release of multiple directories
1212         tests="${tests} release"
1213         tests="${tests} recase"
1214         # Multiple root directories and low-level protocol tests.
1215         tests="${tests} multiroot multiroot2 multiroot3 multiroot4"
1216         tests="$tests rmroot reposmv pserver server server2 server3"
1217         tests="$tests client client2"
1218         tests="${tests} dottedroot fork commit-d"
1219 else
1220         tests="$*"
1221 fi
1222
1223 # Now check the -f argument for validity.
1224 if test -n "$fromtest"; then
1225         # Don't allow spaces - they are our delimiters in tests
1226         count=0
1227         for sub in $fromtest; do
1228           count=`expr $count + 1`
1229         done
1230         if test $count != 1; then
1231                 echo "No such test \`$fromtest'." >&2
1232                 exit 2
1233         fi
1234         # make sure it is in $tests
1235         case " $tests " in
1236                 *" $fromtest "*)
1237                         ;;
1238                 *)
1239                         echo "No such test \`$fromtest'." >&2
1240                         exit 2
1241                         ;;
1242         esac
1243 fi
1244
1245
1246
1247 # a simple function to compare directory contents
1248 #
1249 # Returns: 0 for same, 1 for different
1250 #
1251 directory_cmp ()
1252 {
1253         OLDPWD=`pwd`
1254         DIR_1=$1
1255         DIR_2=$2
1256
1257         cd $DIR_1
1258         find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d1
1259
1260         # go back where we were to avoid symlink hell...
1261         cd $OLDPWD
1262         cd $DIR_2
1263         find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d2
1264
1265         if diff $TESTDIR/dc$$d1 $TESTDIR/dc$$d2 >/dev/null 2>&1
1266         then
1267                 :
1268         else
1269                 return 1
1270         fi
1271         cd $OLDPWD
1272         while read a
1273         do
1274                 if test -f $DIR_1/"$a" ; then
1275                         cmp -s $DIR_1/"$a" $DIR_2/"$a"
1276                         if test $? -ne 0 ; then
1277                                 return 1
1278                         fi
1279                 fi
1280         done < $TESTDIR/dc$$d1
1281         rm -f $TESTDIR/dc$$*
1282         return 0
1283 }
1284
1285
1286
1287 #
1288 # The following 4 functions are used by the diffmerge1 test case.  They set up,
1289 # respectively, the four versions of the files necessary:
1290 #
1291 #       1.  Ancestor revisions.
1292 #       2.  "Your" changes.
1293 #       3.  "My" changes.
1294 #       4.  Expected merge result.
1295 #
1296
1297 # Create ancestor revisions for diffmerge1
1298 diffmerge_create_older_files() {
1299           # This test case was supplied by Noah Friedman:
1300           cat >testcase01 <<EOF
1301 // Button.java
1302
1303 package random.application;
1304
1305 import random.util.*;
1306
1307 public class Button
1308 {
1309   /* Instantiates a Button with origin (0, 0) and zero width and height.
1310    * You must call an initializer method to properly initialize the Button.
1311    */
1312   public Button ()
1313   {
1314     super ();
1315
1316     _titleColor = Color.black;
1317     _disabledTitleColor = Color.gray;
1318     _titleFont = Font.defaultFont ();
1319   }
1320
1321   /* Convenience constructor for instantiating a Button with
1322    * bounds x, y, width, and height.  Equivalent to
1323    *     foo = new Button ();
1324    *     foo.init (x, y, width, height);
1325    */
1326   public Button (int x, int y, int width, int height)
1327   {
1328     this ();
1329     init (x, y, width, height);
1330   }
1331 }
1332 EOF
1333
1334           # This test case was supplied by Jacob Burckhardt:
1335           cat >testcase02 <<EOF
1336 a
1337 a
1338 a
1339 a
1340 a
1341 EOF
1342
1343           # This test case was supplied by Karl Tomlinson who also wrote the
1344           # patch which lets CVS correctly handle this and several other cases:
1345           cat >testcase03 <<EOF
1346 x
1347 s
1348 a
1349 b
1350 s
1351 y
1352 EOF
1353
1354           # This test case was supplied by Karl Tomlinson:
1355           cat >testcase04 <<EOF
1356 s
1357 x
1358 m
1359 m
1360 x
1361 s
1362 v
1363 s
1364 x
1365 m
1366 m
1367 x
1368 s
1369 EOF
1370
1371           # This test case was supplied by Karl Tomlinson:
1372           cat >testcase05 <<EOF
1373 s
1374 x
1375 m
1376 m
1377 x
1378 x
1379 x
1380 x
1381 x
1382 x
1383 x
1384 x
1385 x
1386 x
1387 s
1388 s
1389 s
1390 s
1391 s
1392 s
1393 s
1394 s
1395 s
1396 s
1397 v
1398 EOF
1399
1400           # This test case was supplied by Jacob Burckhardt:
1401           cat >testcase06 <<EOF
1402 g
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414 i
1415 EOF
1416
1417           # This test is supposed to verify that the horizon lines are the same
1418           # for both 2-way diffs, but unfortunately, it does not fail with the
1419           # old version of cvs.  However, Karl Tomlinson still thought it would
1420           # be good to test it anyway:
1421           cat >testcase07 <<EOF
1422 h
1423 f
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433 g
1434 r
1435
1436
1437
1438 i
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449 i
1450 EOF
1451
1452           # This test case was supplied by Jacob Burckhardt:
1453           cat >testcase08 <<EOF
1454 Both changes move this line to the end of the file.
1455
1456 no
1457 changes
1458 here
1459
1460 First change will delete this line.
1461
1462 First change will also delete this line.
1463
1464     no
1465     changes
1466     here
1467
1468 Second change will change it here.
1469
1470         no
1471         changes
1472         here
1473 EOF
1474
1475           # This test case was supplied by Jacob Burckhardt.  Note that I do not
1476           # think cvs has ever failed with this case, but I include it anyway,
1477           # since I think it is a hard case.  It is hard because Peter Miller's
1478           # fmerge utility fails on it:
1479           cat >testcase09 <<EOF
1480 m
1481 a
1482 {
1483 }
1484 b
1485 {
1486 }
1487 EOF
1488
1489           # This test case was supplied by Martin Dorey and simplified by Jacob
1490           # Burckhardt:
1491           cat >testcase10 <<EOF
1492
1493     petRpY ( MtatRk );
1494     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1495
1496     MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1497     OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1498
1499     Bloke_GttpfIRte_MtpeaL ( &acI );
1500 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1501 {
1502     fV ( Y < 16 )
1503     {
1504         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1505                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1506                                 jfle_Uecopd_MfJe_fY_Mectopk,
1507                                 nRVVep ) );
1508     }
1509     elke
1510     {
1511         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1512                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1513                                 jfle_Uecopd_MfJe_fY_Mectopk,
1514                                 nRVVep ) );
1515     }
1516
1517 }
1518
1519
1520 /****************************************************************************
1521 *                                                                           *
1522 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1523 *                                                                           *
1524 ****************************************************************************/
1525
1526 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1527 {
1528 MTGTXM MtatRk = Zy;
1529
1530     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1531
1532     petRpY ( MtatRk );
1533
1534 }
1535     HfkQipfte ( waYdle,                 /*  waYdle                         */
1536                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1537                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1538                 0,                      /*  MRrepVlRoRk KfxoYfkL           */
1539                 beYgtz                  /*  nEtek to Apfte                 */
1540               );
1541
1542     petRpY ( Zy );
1543 }
1544 EOF
1545 }
1546
1547 # Create "your" revisions for diffmerge1
1548 diffmerge_create_your_files() {
1549           # remove the Button() method
1550           cat >testcase01 <<\EOF
1551 // Button.java
1552
1553 package random.application;
1554
1555 import random.util.*;
1556
1557 public class Button
1558 {
1559   /* Instantiates a Button with origin (0, 0) and zero width and height.
1560    * You must call an initializer method to properly initialize the Button.
1561    */
1562   public Button ()
1563   {
1564     super ();
1565
1566     _titleColor = Color.black;
1567     _disabledTitleColor = Color.gray;
1568     _titleFont = Font.defaultFont ();
1569   }
1570 }
1571 EOF
1572
1573           cat >testcase02 <<\EOF
1574 y
1575 a
1576 a
1577 a
1578 a
1579 EOF
1580
1581           cat >testcase03 <<\EOF
1582 x
1583 s
1584 a
1585 b
1586 s
1587 b
1588 s
1589 y
1590 EOF
1591
1592           cat >testcase04 <<\EOF
1593 s
1594 m
1595 s
1596 v
1597 s
1598 m
1599 s
1600 EOF
1601
1602           cat >testcase05 <<\EOF
1603 v
1604 s
1605 m
1606 s
1607 s
1608 s
1609 s
1610 s
1611 s
1612 s
1613 s
1614 s
1615 s
1616 v
1617 EOF
1618
1619           # Test case 6 and test case 7 both use the same input files, but they
1620           # order the input files differently.  In one case, a certain file is
1621           # used as the older file, but in the other test case, that same file
1622           # is used as the file which has changes.  I could have put echo
1623           # commands here, but since the echo lines would be the same as those
1624           # in the previous function, I decided to save space and avoid repeating
1625           # several lines of code.  Instead, I merely swap the files:
1626           mv testcase07 tmp
1627           mv testcase06 testcase07
1628           mv tmp testcase06
1629
1630           # Make the date newer so that cvs thinks that the files are changed:
1631           touch testcase06 testcase07
1632
1633           cat >testcase08 <<\EOF
1634 no
1635 changes
1636 here
1637
1638 First change has now added this in.
1639
1640     no
1641     changes
1642     here
1643
1644 Second change will change it here.
1645
1646         no
1647         changes
1648         here
1649
1650 Both changes move this line to the end of the file.
1651 EOF
1652
1653           cat >testcase09 <<\EOF
1654
1655 m
1656 a
1657 {
1658 }
1659 b
1660 {
1661 }
1662 c
1663 {
1664 }
1665 EOF
1666
1667           cat >testcase10 <<\EOF
1668
1669     fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
1670
1671     petRpY ( MtatRk );
1672     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1673
1674     fV ( jfle_Uecopd_KRLIep < 16 )
1675     {
1676         MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
1677     }
1678     elke
1679     {
1680         MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
1681         fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1682
1683         MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1684         OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1685
1686     Bloke_GttpfIRte_MtpeaL ( &acI );
1687 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1688 {
1689 MTGTXM MtatRk = Zy;
1690
1691     fV ( Y < 16 )
1692     {
1693         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1694                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1695                                 jfle_Uecopd_MfJe_fY_Mectopk,
1696                                 nRVVep ) );
1697     }
1698     elke
1699     {
1700         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1701                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1702                                 jfle_Uecopd_MfJe_fY_Mectopk,
1703                                 nRVVep ) );
1704     }
1705
1706     petRpY ( MtatRk );
1707
1708 }
1709
1710
1711 /****************************************************************************
1712 *                                                                           *
1713 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1714 *                                                                           *
1715 ****************************************************************************/
1716
1717 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1718 {
1719 MTGTXM MtatRk = Zy;
1720
1721     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1722
1723     petRpY ( MtatRk );
1724
1725 }
1726     HfkQipfte ( waYdle,                 /*  waYdle                         */
1727                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1728                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1729                 0,                      /*  MRrepVlRoRk KfxoYfkL           */
1730                 beYgtz                  /*  nEtek to Apfte                 */
1731               );
1732
1733     petRpY ( Zy );
1734 }
1735
1736 EOF
1737 }
1738
1739 # Create "my" revisions for diffmerge1
1740 diffmerge_create_my_files() {
1741           # My working copy still has the Button() method, but I
1742           # comment out some code at the top of the class.
1743           cat >testcase01 <<\EOF
1744 // Button.java
1745
1746 package random.application;
1747
1748 import random.util.*;
1749
1750 public class Button
1751 {
1752   /* Instantiates a Button with origin (0, 0) and zero width and height.
1753    * You must call an initializer method to properly initialize the Button.
1754    */
1755   public Button ()
1756   {
1757     super ();
1758
1759     // _titleColor = Color.black;
1760     // _disabledTitleColor = Color.gray;
1761     // _titleFont = Font.defaultFont ();
1762   }
1763
1764   /* Convenience constructor for instantiating a Button with
1765    * bounds x, y, width, and height.  Equivalent to
1766    *     foo = new Button ();
1767    *     foo.init (x, y, width, height);
1768    */
1769   public Button (int x, int y, int width, int height)
1770   {
1771     this ();
1772     init (x, y, width, height);
1773   }
1774 }
1775 EOF
1776
1777           cat >testcase02 <<\EOF
1778 a
1779 a
1780 a
1781 a
1782 m
1783 EOF
1784
1785           cat >testcase03 <<\EOF
1786 x
1787 s
1788 c
1789 s
1790 b
1791 s
1792 y
1793 EOF
1794
1795           cat >testcase04 <<\EOF
1796 v
1797 s
1798 x
1799 m
1800 m
1801 x
1802 s
1803 v
1804 s
1805 x
1806 m
1807 m
1808 x
1809 s
1810 v
1811 EOF
1812
1813           # Note that in test case 5, there are no changes in the "mine"
1814           # section, which explains why there is no command here which writes to
1815           # file testcase05.
1816
1817           # no changes for testcase06
1818
1819           # The two branches make the same changes:
1820           cp ../yours/testcase07 .
1821
1822           cat >testcase08 <<\EOF
1823 no
1824 changes
1825 here
1826
1827 First change will delete this line.
1828
1829 First change will also delete this line.
1830
1831     no
1832     changes
1833     here
1834
1835 Second change has now changed it here.
1836
1837         no
1838         changes
1839         here
1840
1841 Both changes move this line to the end of the file.
1842 EOF
1843
1844           cat >testcase09 <<\EOF
1845 m
1846 a
1847 {
1848 }
1849 b
1850 {
1851 }
1852 c
1853 {
1854 }
1855 EOF
1856
1857           cat >testcase10 <<\EOF
1858
1859     petRpY ( MtatRk );
1860     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1861
1862     MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1863     OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1864
1865     Bloke_GttpfIRte_MtpeaL ( &acI );
1866 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1867 {
1868     fV ( Y < 16 )
1869     {
1870         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1871                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
1872                                 jfle_Uecopd_MfJe_fY_Mectopk,
1873                                 nRVVep ) );
1874     }
1875     elke
1876     {
1877         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1878                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1879                                 jfle_Uecopd_MfJe_fY_Mectopk,
1880                                 nRVVep ) );
1881     }
1882
1883 }
1884
1885
1886 /****************************************************************************
1887 *                                                                           *
1888 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1889 *                                                                           *
1890 ****************************************************************************/
1891
1892 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1893 {
1894 MTGTXM MtatRk = Zy;
1895
1896     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1897
1898     petRpY ( MtatRk );
1899
1900 }
1901     HfkQipfte ( waYdle,                 /*  waYdle                         */
1902                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1903                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1904                 beYgtz                  /*  nEtek to Apfte                 */
1905               );
1906
1907     petRpY ( Zy );
1908 }
1909
1910 EOF
1911 }
1912
1913 # Create expected results of merge for diffmerge1
1914 diffmerge_create_expected_files() {
1915           cat >testcase01 <<\EOF
1916 // Button.java
1917
1918 package random.application;
1919
1920 import random.util.*;
1921
1922 public class Button
1923 {
1924   /* Instantiates a Button with origin (0, 0) and zero width and height.
1925    * You must call an initializer method to properly initialize the Button.
1926    */
1927   public Button ()
1928   {
1929     super ();
1930
1931     // _titleColor = Color.black;
1932     // _disabledTitleColor = Color.gray;
1933     // _titleFont = Font.defaultFont ();
1934   }
1935 }
1936 EOF
1937
1938           cat >testcase02 <<\EOF
1939 y
1940 a
1941 a
1942 a
1943 m
1944 EOF
1945
1946           cat >testcase03 <<\EOF
1947 x
1948 s
1949 c
1950 s
1951 b
1952 s
1953 b
1954 s
1955 y
1956 EOF
1957
1958           cat >testcase04 <<\EOF
1959 v
1960 s
1961 m
1962 s
1963 v
1964 s
1965 m
1966 s
1967 v
1968 EOF
1969
1970           # Since there are no changes in the "mine" section, just take exactly
1971           # the version in the "yours" section:
1972           cp ../yours/testcase05 .
1973
1974           cp ../yours/testcase06 .
1975
1976           # Since the two branches make the same changes, the result should be
1977           # the same as both branches.  Here, I happen to pick yours to copy from,
1978           # but I could have also picked mine, since the source of the copy is
1979           # the same in either case.  However, the mine has already been
1980           # altered by the update command, so don't use it.  Instead, use the
1981           # yours section which has not had an update on it and so is unchanged:
1982           cp ../yours/testcase07 .
1983
1984           cat >testcase08 <<\EOF
1985 no
1986 changes
1987 here
1988
1989 First change has now added this in.
1990
1991     no
1992     changes
1993     here
1994
1995 Second change has now changed it here.
1996
1997         no
1998         changes
1999         here
2000
2001 Both changes move this line to the end of the file.
2002 EOF
2003
2004           cat >testcase09 <<\EOF
2005
2006 m
2007 a
2008 {
2009 }
2010 b
2011 {
2012 }
2013 c
2014 {
2015 }
2016 EOF
2017
2018           cat >testcase10 <<\EOF
2019
2020     fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
2021
2022     petRpY ( MtatRk );
2023     fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
2024
2025     fV ( jfle_Uecopd_KRLIep < 16 )
2026     {
2027         MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
2028     }
2029     elke
2030     {
2031         MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
2032         fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
2033
2034         MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
2035         OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
2036
2037     Bloke_GttpfIRte_MtpeaL ( &acI );
2038 MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
2039 {
2040 MTGTXM MtatRk = Zy;
2041
2042     fV ( Y < 16 )
2043     {
2044         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
2045                                                       Y * jfle_Uecopd_MfJe_fY_Mectopk,
2046                                 jfle_Uecopd_MfJe_fY_Mectopk,
2047                                 nRVVep ) );
2048     }
2049     elke
2050     {
2051         petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
2052                                                  ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
2053                                 jfle_Uecopd_MfJe_fY_Mectopk,
2054                                 nRVVep ) );
2055     }
2056
2057     petRpY ( MtatRk );
2058
2059 }
2060
2061
2062 /****************************************************************************
2063 *                                                                           *
2064 *   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
2065 *                                                                           *
2066 ****************************************************************************/
2067
2068 MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
2069 {
2070 MTGTXM MtatRk = Zy;
2071
2072     MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
2073
2074     petRpY ( MtatRk );
2075
2076 }
2077     HfkQipfte ( waYdle,                 /*  waYdle                         */
2078                 waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
2079                 (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
2080                 beYgtz                  /*  nEtek to Apfte                 */
2081               );
2082
2083     petRpY ( Zy );
2084 }
2085
2086 EOF
2087 }
2088
2089
2090
2091 # Echo a new CVSROOT based on $1, $remote, and $remotehost
2092 newroot() {
2093   if $remote; then
2094     if test -n "$remotehost"; then
2095       echo :ext:$remotehost$1
2096     else
2097       echo :fork:$1
2098     fi
2099   else
2100     echo $1
2101   fi
2102 }
2103
2104
2105
2106 # Set up CVSROOT (the crerepos tests will test operating without CVSROOT set).
2107 #
2108 # Currently we test :fork: and :ext: (see crerepos test).  There is a
2109 # known difference between the two in modes-15 (see comments there).
2110 #
2111 # :ext: can be tested against a remote machine if:
2112 #
2113 #    1. $remotehost is set using the `-h' option to this script.
2114 #    2. ${CVS_RSH=rsh} $remotehost works.
2115 #    3. The path to $TESTDIR is the same on both machines (symlinks are okay)
2116 #    4. The path to $testcvs is the same on both machines (symlinks are okay)
2117 #       or $CVS_SERVER is overridden in this script's environment to point to
2118 #       a working CVS exectuable on the remote machine.
2119 #
2120 # Testing :pserver: would be hard (inetd issues).  (How about using tcpserver
2121 # and some high port number?  DRP)
2122
2123 # Allow CVS_SERVER to be overridden.  This facilitates constructs like
2124 # testing a local case-insensitive client against a remote case
2125 # sensitive server and visa versa.
2126 : ${CVS_SERVER=$testcvs}; export CVS_SERVER
2127
2128 # Use a name which will be different than CVSROOT on case insensitive
2129 # filesystems (e.g., HFS+)
2130 CVSROOTDIR=cvsrootdir
2131 if $linkroot; then
2132     mkdir ${TESTDIR}/realcvsroot
2133     ln -s realcvsroot ${TESTDIR}/${CVSROOTDIR}
2134 fi
2135 CVSROOT_DIRNAME=${TESTDIR}/${CVSROOTDIR}
2136 CVSROOT=`newroot $CVSROOT_DIRNAME`; export CVSROOT
2137
2138
2139
2140 ###
2141 ### Init the repository.
2142 ###
2143 dotest init-1 "$testcvs -d$CVSROOT_DIRNAME init"
2144
2145 # Copy the admin files for restore_adm.
2146 cp -Rp $CVSROOT_DIRNAME/CVSROOT $TESTDIR/CVSROOT.save
2147
2148
2149
2150 ###
2151 ### The tests
2152 ###
2153 if $remote; then
2154         localonly init-2
2155         localonly init-3
2156 else
2157         dotest init-2 "$testcvs init"
2158         dotest_fail init-3 "$testcvs -d $CVSROOT/sdir init" \
2159 "$PROG \[init aborted\]: Cannot initialize repository under existing CVSROOT: \`$CVSROOT_DIRNAME'"
2160 fi
2161
2162
2163
2164 ### The big loop
2165 for what in $tests; do
2166         if test -n "$fromtest" ; then
2167             if test $fromtest = $what ; then
2168                 unset fromtest
2169             else
2170                 continue
2171             fi
2172         fi
2173
2174         if $verbose; then
2175             echo "$what:"
2176         fi
2177
2178         case $what in
2179
2180         version)
2181           # We've had cases where the version command started dumping core,
2182           # so we might as well test it
2183           dotest version-1 "${testcvs} --version" \
2184 '
2185 Concurrent Versions System (CVS) [0-9.]*.*
2186
2187 Copyright (C) [0-9]* Free Software Foundation, Inc.
2188
2189 Senior active maintainers include Larry Jones, Derek R. Price,
2190 and Mark D. Baushke.  Please see the AUTHORS and README files from the CVS
2191 distribution kit for a complete list of contributors and copyrights.
2192
2193 CVS may be copied only under the terms of the GNU General Public License,
2194 a copy of which can be found with the CVS distribution kit.
2195
2196 Specify the --help option for further information about CVS'
2197
2198           if $remote; then
2199                 dotest version-2r "${testcvs} version" \
2200 'Client: Concurrent Versions System (CVS) [0-9p.]* (client/server)
2201 Server: Concurrent Versions System (CVS) [0-9p.]* (client/server)'
2202           else
2203                 dotest version-2 "${testcvs} version" \
2204 'Concurrent Versions System (CVS) [0-9.]*.*'
2205           fi
2206           ;;
2207
2208         basica)
2209           # Similar in spirit to some of the basic1, and basic2
2210           # tests, but hopefully a lot faster.  Also tests operating on
2211           # files two directories down *without* operating on the parent dirs.
2212
2213           # Tests basica-0a and basica-0b provide the equivalent of the:
2214           #    mkdir ${CVSROOT_DIRNAME}/first-dir
2215           # used by many of the tests.  It is "more official" in the sense
2216           # that is does everything through CVS; the reason most of the
2217           # tests don't use it is mostly historical.
2218           mkdir 1; cd 1
2219           dotest basica-0a "${testcvs} -q co -l ." ''
2220           mkdir first-dir
2221           dotest basica-0b "${testcvs} add first-dir" \
2222 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
2223           cd ..
2224           rm -r 1
2225
2226           dotest basica-1 "${testcvs} -q co first-dir" ''
2227           cd first-dir
2228
2229           # Test a few operations, to ensure they gracefully do
2230           # nothing in an empty directory.
2231           dotest basica-1a0 "${testcvs} -q update" ''
2232           dotest basica-1a1 "${testcvs} -q diff -c" ''
2233           dotest basica-1a2 "${testcvs} -q status" ''
2234           dotest basica-1a3 "${testcvs} -q update ." ''
2235           dotest basica-1a4 "${testcvs} -q update ./" ''
2236
2237           mkdir sdir
2238           # Remote CVS gives the "cannot open CVS/Entries" error, which is
2239           # clearly a bug, but not a simple one to fix.
2240           dotest basica-1a10 "${testcvs} -n add sdir" \
2241 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository" \
2242 "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
2243 Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
2244           dotest_fail basica-1a11 \
2245             "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
2246           dotest basica-2 "${testcvs} add sdir" \
2247 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
2248           cd sdir
2249           mkdir ssdir
2250           dotest basica-3 "${testcvs} add ssdir" \
2251 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir added to the repository"
2252           cd ssdir
2253           echo ssfile >ssfile
2254
2255           # Trying to commit it without a "cvs add" should be an error.
2256           # The "use `cvs add' to create an entry" message is the one
2257           # that I consider to be more correct, but local cvs prints the
2258           # "nothing known" message and noone has gotten around to fixing it.
2259           dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
2260 "${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
2261 ${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
2262 "${PROG}"' [a-z]*: nothing known about `ssfile'\''
2263 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
2264
2265           dotest basica-4 "${testcvs} add ssfile" \
2266 "${PROG}"' add: scheduling file `ssfile'\'' for addition
2267 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
2268           dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
2269 "${PROG} tag: nothing known about ssfile
2270 ${PROG} "'\[tag aborted\]: correct the above errors first!'
2271           cd ../..
2272           dotest basica-5 "${testcvs} -q ci -m add-it" \
2273 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2274 done
2275 Checking in sdir/ssdir/ssfile;
2276 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2277 initial revision: 1\.1
2278 done"
2279           dotest_fail basica-5a \
2280             "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
2281 "${PROG} tag: Attempt to add reserved tag name BASE
2282 ${PROG} \[tag aborted\]: failed to set tag BASE to revision 1\.1 in ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v"
2283           dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
2284 'T sdir/ssdir/ssfile'
2285
2286           dotest basica-6 "${testcvs} -q update" ''
2287           echo "ssfile line 2" >>sdir/ssdir/ssfile
2288           dotest_fail basica-6.2 "${testcvs} -q diff -c" \
2289 "Index: sdir/ssdir/ssfile
2290 ===================================================================
2291 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2292 retrieving revision 1\.1
2293 diff -c -r1\.1 ssfile
2294 \*\*\* sdir/ssdir/ssfile        ${RFCDATE}      1\.1
2295 --- sdir/ssdir/ssfile   ${RFCDATE}
2296 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2297 \*\*\* 1 \*\*\*\*
2298 --- 1,2 ----
2299   ssfile
2300 ${PLUS} ssfile line 2"
2301           dotest_fail basica-6.3 "${testcvs} -q diff -c -rBASE" \
2302 "Index: sdir/ssdir/ssfile
2303 ===================================================================
2304 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2305 retrieving revision 1\.1
2306 diff -c -r1\.1 ssfile
2307 \*\*\* sdir/ssdir/ssfile        ${RFCDATE}      1\.1
2308 --- sdir/ssdir/ssfile   ${RFCDATE}
2309 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2310 \*\*\* 1 \*\*\*\*
2311 --- 1,2 ----
2312   ssfile
2313 ${PLUS} ssfile line 2"
2314           dotest_fail basica-6.4 "${testcvs} -q diff -c -rBASE -C3isacrowd" \
2315 "Index: sdir/ssdir/ssfile
2316 ===================================================================
2317 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2318 retrieving revision 1\.1
2319 diff -c -C 3isacrowd -r1\.1 ssfile
2320 ${PROG} diff: invalid context length argument"
2321           dotest basica-7 "${testcvs} -q ci -m modify-it" \
2322 "Checking in sdir/ssdir/ssfile;
2323 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2324 new revision: 1\.2; previous revision: 1\.1
2325 done"
2326           dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
2327 "${PROG}"' [a-z]*: nothing known about `nonexist'\''
2328 '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
2329           dotest basica-8 "${testcvs} -q update ." ''
2330
2331           # Test the -f option to ci
2332           cd sdir/ssdir
2333           dotest basica-8a0 "${testcvs} -q ci -m not-modified ssfile" ''
2334           dotest basica-8a "${testcvs} -q ci -f -m force-it" \
2335 "Checking in ssfile;
2336 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2337 new revision: 1\.3; previous revision: 1\.2
2338 done"
2339           dotest basica-8a1 "${testcvs} -q ci -m bump-it -r 2.0" \
2340 "Checking in ssfile;
2341 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2342 new revision: 2\.0; previous revision: 1\.3
2343 done"
2344           dotest basica-8a1a "${testcvs} -q ci -m bump-it -r 2.9" \
2345 "Checking in ssfile;
2346 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2347 new revision: 2\.9; previous revision: 2\.0
2348 done"
2349           # Test string-based revion number increment rollover
2350           dotest basica-8a1b "${testcvs} -q ci -m bump-it -f -r 2" \
2351 "Checking in ssfile;
2352 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2353 new revision: 2\.10; previous revision: 2\.9
2354 done"
2355           dotest basica-8a1c "${testcvs} -q ci -m bump-it -r 2.99" \
2356 "Checking in ssfile;
2357 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2358 new revision: 2\.99; previous revision: 2\.10
2359 done"
2360           # Test string-based revion number increment rollover
2361           dotest basica-8a1d "${testcvs} -q ci -m bump-it -f -r 2" \
2362 "Checking in ssfile;
2363 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2364 new revision: 2\.100; previous revision: 2\.99
2365 done"
2366           dotest basica-8a1e "${testcvs} -q ci -m bump-it -r 2.1099" \
2367 "Checking in ssfile;
2368 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2369 new revision: 2\.1099; previous revision: 2\.100
2370 done"
2371           # Test string-based revion number increment rollover
2372           dotest basica-8a1f "${testcvs} -q ci -m bump-it -f -r 2" \
2373 "Checking in ssfile;
2374 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2375 new revision: 2\.1100; previous revision: 2\.1099
2376 done"
2377           # -f should not be necessary, but it should be harmless.
2378           # Also test the "-r 3" (rather than "-r 3.0") usage.
2379           dotest basica-8a2 "${testcvs} -q ci -m bump-it -f -r 3" \
2380 "Checking in ssfile;
2381 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2382 new revision: 3\.1; previous revision: 2\.1100
2383 done"
2384
2385           # Test using -r to create a branch
2386           dotest_fail basica-8a3 "${testcvs} -q ci -m bogus -r 3.0.0" \
2387 "Checking in ssfile;
2388 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2389 ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: can't find branch point 3\.0
2390 ${PROG} commit: could not check in ssfile"
2391           dotest basica-8a4 "${testcvs} -q ci -m valid -r 3.1.2" \
2392 "Checking in ssfile;
2393 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2394 new revision: 3\.1\.2\.1; previous revision: 3\.1
2395 done"
2396
2397           # Verify that this file remains unchanged since up -A should not
2398           # change the contents here.
2399           cp ssfile $TESTDIR/ssfile.sav
2400           # now get rid of the sticky tag and go back to the trunk
2401           dotest basica-8a5 "$testcvs -q up -A ./" '[UP] ssfile'
2402           dotest basica-8a6 "cmp ssfile $TESTDIR/ssfile.sav"
2403           rm $TESTDIR/ssfile.sav
2404
2405           cd ../..
2406           dotest basica-8b "${testcvs} -q diff -r1.2 -r1.3"
2407           dotest basica-8b1 "${testcvs} -q diff -r1.2 -r1.3 -C 3isacrowd"
2408
2409           # The .* here will normally be "No such file or directory",
2410           # but if memory serves some systems (AIX?) have a different message.
2411 :         dotest_fail basica-9 \
2412             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
2413 "${PROG}: cannot access cvs root ${TESTDIR}/nonexist: .*"
2414           dotest_fail basica-9 \
2415             "${testcvs} -q -d ${TESTDIR}/nonexist update" \
2416 "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/nonexist/CVSROOT: .*"
2417
2418           dotest basica-10 "${testcvs} annotate" \
2419 '
2420 Annotations for sdir/ssdir/ssfile
2421 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
2422 1\.1          .'"$username8"' *[0-9a-zA-Z-]*.: ssfile
2423 1\.2          .'"$username8"' *[0-9a-zA-Z-]*.: ssfile line 2'
2424
2425           # Test resurrecting with strange revision numbers
2426           cd sdir/ssdir
2427           dotest basica-r1 "${testcvs} rm -f ssfile" \
2428 "${PROG} remove: scheduling .ssfile. for removal
2429 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
2430           dotest basica-r2 "${testcvs} -q ci -m remove" \
2431 "Removing ssfile;
2432 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2433 new revision: delete; previous revision: 3\.1
2434 done"
2435           dotest basica-r3 "${testcvs} -q up -p -r 3.1 ./ssfile >ssfile" ""
2436           dotest basica-r4 "${testcvs} add ssfile" \
2437 "${PROG} add: Re-adding file .ssfile. (in place of dead revision 3\.2)\.
2438 ${PROG} add: use .${PROG} commit. to add this file permanently"
2439           dotest basica-r5 "${testcvs} -q ci -m resurrect" \
2440 "Checking in ssfile;
2441 ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2442 new revision: 3\.3; previous revision: 3\.2
2443 done"
2444           cd ../..
2445
2446           # As long as we have a file with a few revisions, test
2447           # a few "cvs admin -o" invocations.
2448           cd sdir/ssdir
2449           dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
2450 "${PROG} [a-z]*: while processing more than one file:
2451 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
2452           dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
2453 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2454 done"
2455           dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
2456 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2457 done"
2458           dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
2459 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2460 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
2461 ${PROG} admin: RCS file for .ssfile. not modified\."
2462           dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
2463 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2464 done"
2465           dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
2466 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2467 deleting revision 3\.3
2468 deleting revision 3\.2
2469 done"
2470           dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
2471 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2472 done"
2473           dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
2474 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2475 deleting revision 2\.1100
2476 deleting revision 2\.1099
2477 deleting revision 2\.100
2478 deleting revision 2\.99
2479 deleting revision 2\.10
2480 deleting revision 2\.9
2481 deleting revision 2\.0
2482 deleting revision 1\.3
2483 done"
2484           dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
2485 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2486 deleting revision 2\.1100
2487 deleting revision 2\.1099
2488 deleting revision 2\.100
2489 deleting revision 2\.99
2490 deleting revision 2\.10
2491 deleting revision 2\.9
2492 deleting revision 2\.0
2493 deleting revision 1\.3
2494 done"
2495           dotest basica-o6a "${testcvs} admin -o 3.1.2: ssfile" \
2496 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2497 deleting revision 3\.1\.2\.1
2498 done"
2499           dotest basica-o7 "${testcvs} log -N ssfile" "
2500 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2501 Working file: ssfile
2502 head: 3\.1
2503 branch:
2504 locks: strict
2505 access list:
2506 keyword substitution: kv
2507 total revisions: 3;     selected revisions: 3
2508 description:
2509 ----------------------------
2510 revision 3\.1
2511 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
2512 bump-it
2513 ----------------------------
2514 revision 1\.2
2515 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
2516 modify-it
2517 ----------------------------
2518 revision 1\.1
2519 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2520 add-it
2521 ============================================================================="
2522           dotest basica-o8 "${testcvs} -q update -p -r 1.1 ./ssfile" "ssfile"
2523           cd ../..
2524
2525           cd ..
2526
2527           rm -rf ${CVSROOT_DIRNAME}/first-dir
2528           rm -r first-dir
2529           ;;
2530
2531         basicb)
2532           # More basic tests, including non-branch tags and co -d.
2533           mkdir 1; cd 1
2534           dotest basicb-0a "${testcvs} -q co -l ." ''
2535           touch topfile
2536           dotest basicb-0b "${testcvs} add topfile" \
2537 "${PROG} add: scheduling file .topfile. for addition
2538 ${PROG} add: use .${PROG} commit. to add this file permanently"
2539           dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
2540 "RCS file: ${CVSROOT_DIRNAME}/topfile,v
2541 done
2542 Checking in topfile;
2543 ${CVSROOT_DIRNAME}/topfile,v  <--  topfile
2544 initial revision: 1\.1
2545 done"
2546           cd ..
2547           rm -r 1
2548           mkdir 2; cd 2
2549           dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
2550           # Now test the ability to run checkout on an existing working
2551           # directory without having it lose its mind.  I don't know
2552           # whether this is tested elsewhere in sanity.sh.  A more elaborate
2553           # test might also have modified files, make sure it works if
2554           # the modules file was modified to add new directories to the
2555           # module, and such.
2556           dotest basicb-0d0 "${testcvs} -q co -l ." ""
2557           mkdir first-dir
2558           dotest basicb-0e "${testcvs} add first-dir" \
2559 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
2560           cd ..
2561           rm -r 2
2562
2563           dotest basicb-1 "${testcvs} -q co first-dir" ''
2564
2565           # The top-level CVS directory is not created by default.
2566           # I'm leaving basicb-1a and basicb-1b untouched, mostly, in
2567           # case we decide that the default should be reversed...
2568
2569           dotest_fail basicb-1a "test -d CVS" ''
2570
2571           dotest basicb-1c "cat first-dir/CVS/Repository" "first-dir"
2572
2573           cd first-dir
2574           # Note that the name Emptydir is chosen to test that CVS just
2575           # treats it like any other directory name.  It should be
2576           # special only when it is directly in $CVSROOT/CVSROOT.
2577           mkdir Emptydir sdir2
2578           dotest basicb-2 "${testcvs} add Emptydir sdir2" \
2579 "Directory ${CVSROOT_DIRNAME}/first-dir/Emptydir added to the repository
2580 Directory ${CVSROOT_DIRNAME}/first-dir/sdir2 added to the repository"
2581           cd Emptydir
2582           echo sfile1 starts >sfile1
2583           dotest basicb-2a10 "${testcvs} -n add sfile1" \
2584 "${PROG} add: scheduling file .sfile1. for addition
2585 ${PROG} add: use .${PROG} commit. to add this file permanently"
2586           dotest basicb-2a11 "${testcvs} status sfile1" \
2587 "${PROG} status: use .${PROG} add. to create an entry for sfile1
2588 ===================================================================
2589 File: sfile1            Status: Unknown
2590
2591    Working revision:    No entry for sfile1
2592    Repository revision: No revision control file"
2593           dotest basicb-3 "${testcvs} add sfile1" \
2594 "${PROG} add: scheduling file .sfile1. for addition
2595 ${PROG} add: use .${PROG} commit. to add this file permanently"
2596           dotest basicb-3a1 "${testcvs} status sfile1" \
2597 "===================================================================
2598 File: sfile1            Status: Locally Added
2599
2600    Working revision:    New file!
2601    Repository revision: No revision control file
2602    Sticky Tag:          (none)
2603    Sticky Date:         (none)
2604    Sticky Options:      (none)"
2605
2606           cd ../sdir2
2607           echo sfile2 starts >sfile2
2608           dotest basicb-4 "${testcvs} add sfile2" \
2609 "${PROG} add: scheduling file .sfile2. for addition
2610 ${PROG} add: use .${PROG} commit. to add this file permanently"
2611           dotest basicb-4a "${testcvs} -q ci CVS" \
2612 "${PROG} [a-z]*: warning: directory CVS specified in argument
2613 ${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
2614           cd ..
2615           dotest basicb-5 "${testcvs} -q ci -m add" \
2616 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v
2617 done
2618 Checking in Emptydir/sfile1;
2619 ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
2620 initial revision: 1\.1
2621 done
2622 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2623 done
2624 Checking in sdir2/sfile2;
2625 ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2626 initial revision: 1\.1
2627 done"
2628           echo sfile1 develops >Emptydir/sfile1
2629           dotest basicb-6 "${testcvs} -q ci -m modify" \
2630 "Checking in Emptydir/sfile1;
2631 ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
2632 new revision: 1\.2; previous revision: 1\.1
2633 done"
2634           dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
2635 T sdir2/sfile2'
2636           echo not in time for release-1 >sdir2/sfile2
2637           dotest basicb-8 "${testcvs} -q ci -m modify-2" \
2638 "Checking in sdir2/sfile2;
2639 ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2640 new revision: 1\.2; previous revision: 1\.1
2641 done"
2642           # See if CVS can correctly notice when an invalid numeric
2643           # revision is specified.
2644           # Commented out until we get around to fixing CVS
2645 :         dotest basicb-8a0 "${testcvs} diff -r 1.5 -r 1.7 sfile2" 'error msg'
2646           cd ..
2647
2648           # Test that we recurse into the correct directory when checking
2649           # for existing files, even if co -d is in use.
2650           touch first-dir/extra
2651           dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
2652 'U first-dir1/Emptydir/sfile1
2653 U first-dir1/sdir2/sfile2'
2654           rm -r first-dir1
2655
2656           rm -r first-dir
2657
2658           # FIXME? basicb-9 used to check things out like this:
2659           #   U newdir/Emptydir/sfile1
2660           #   U newdir/sdir2/sfile2
2661           # but that's difficult to do.  The whole "shorten" thing
2662           # is pretty bogus, because it will break on things
2663           # like "cvs co foo/bar baz/quux".  Unless there's some
2664           # pretty detailed expansion and analysis of the command-line
2665           # arguments, we shouldn't do "shorten" stuff at all.
2666
2667           dotest basicb-9 \
2668 "${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
2669 'U newdir/first-dir/Emptydir/sfile1
2670 U newdir/first-dir/sdir2/sfile2'
2671
2672           # basicb-9a and basicb-9b: see note about basicb-1a
2673
2674           dotest_fail basicb-9a "test -d CVS" ''
2675
2676           dotest basicb-9c "cat newdir/CVS/Repository" "\."
2677           dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
2678 "${CVSROOT_DIRNAME}/first-dir" \
2679 "first-dir"
2680           dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
2681 "${CVSROOT_DIRNAME}/first-dir/Emptydir" \
2682 "first-dir/Emptydir"
2683           dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
2684 "${CVSROOT_DIRNAME}/first-dir/sdir2" \
2685 "first-dir/sdir2"
2686
2687           dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
2688 "sfile1 develops
2689 sfile2 starts"
2690
2691           rm -r newdir
2692
2693           # Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
2694           # seem to deal with it...
2695           if false; then
2696           dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
2697 "U sub1/sub2/Emptydir/sfile1
2698 U sub1/sub2/sdir2/sfile2"
2699           cd sub1
2700           dotest basicb-12 "${testcvs} -q update ./." ''
2701           touch xx
2702           dotest basicb-13 "${testcvs} add xx" fixme
2703           cd ..
2704           rm -r sub1
2705           # to test: sub1/sub2/sub3
2706           fi # end of tests commented out.
2707
2708           # Create a second directory.
2709           mkdir 1
2710           cd 1
2711           dotest basicb-14 "${testcvs} -q co -l ." 'U topfile'
2712           mkdir second-dir
2713           dotest basicb-15 "${testcvs} add second-dir" \
2714 "Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2715           cd second-dir
2716           touch aa
2717           dotest basicb-16 "${testcvs} add aa" \
2718 "${PROG} add: scheduling file .aa. for addition
2719 ${PROG} add: use .${PROG} commit. to add this file permanently"
2720           dotest basicb-17 "${testcvs} -q ci -m add" \
2721 "RCS file: ${CVSROOT_DIRNAME}/second-dir/aa,v
2722 done
2723 Checking in aa;
2724 ${CVSROOT_DIRNAME}/second-dir/aa,v  <--  aa
2725 initial revision: 1\.1
2726 done"
2727           cd ..
2728
2729           # Try to remove all revisions in a file.
2730           dotest_fail basicb-o1 "${testcvs} admin -o1.1 topfile" \
2731 "RCS file: ${CVSROOT_DIRNAME}/topfile,v
2732 deleting revision 1\.1
2733 ${PROG} \[admin aborted\]: attempt to delete all revisions"
2734           dotest basicb-o2 "${testcvs} -q update -d first-dir" \
2735 "U first-dir/Emptydir/sfile1
2736 U first-dir/sdir2/sfile2"
2737           dotest_fail basicb-o3 \
2738 "${testcvs} admin -o1.1:1.2 first-dir/sdir2/sfile2" \
2739 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2740 deleting revision 1\.2
2741 deleting revision 1\.1
2742 ${PROG} \[admin aborted\]: attempt to delete all revisions"
2743           cd ..
2744           rm -r 1
2745
2746           mkdir 1; cd 1
2747           # Note that -H is an illegal option.
2748           # I suspect that the choice between "illegal" and "invalid"
2749           # depends on the user's environment variables, the phase
2750           # of the moon (weirdness with optind), and who knows what else.
2751           # I've been seeing "illegal"...
2752           dotest_fail basicb-21 "${testcvs} -q admin -H" \
2753 "admin: illegal option -- H
2754 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
2755 "admin: invalid option -- H
2756 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
2757           cd ..
2758           rmdir 1
2759
2760           if $keep; then
2761             echo Keeping ${TESTDIR} and exiting due to --keep
2762             exit 0
2763           fi
2764
2765           rm -rf ${CVSROOT_DIRNAME}/first-dir
2766           rm -rf ${CVSROOT_DIRNAME}/second-dir
2767           rm -f ${CVSROOT_DIRNAME}/topfile,v
2768           ;;
2769
2770         basicc)
2771           # More tests of basic/miscellaneous functionality.
2772           mkdir 1; cd 1
2773           dotest_fail basicc-1 "${testcvs} diff" \
2774 "${PROG} [a-z]*: in directory \.:
2775 ${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
2776           dotest basicc-2 "${testcvs} -q co -l ." ''
2777           mkdir first-dir second-dir
2778           dotest basicc-3 "${testcvs} add first-dir second-dir" \
2779 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
2780 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2781           # Old versions of CVS often didn't create this top-level CVS
2782           # directory in the first place.  I think that maybe the only
2783           # way to get it to work currently is to let CVS create it,
2784           # and then blow it away (don't complain if it does not
2785           # exist).  But that is perfectly legal; people who are used
2786           # to the old behavior especially may be interested.
2787           # FIXME: this test is intended for the TopLevelAdmin=yes case;
2788           # should adjust/move it accordingly.
2789           rm -rf CVS
2790           dotest basicc-4 "echo *" "first-dir second-dir"
2791           dotest basicc-5 "${testcvs} update" \
2792 "${PROG} update: Updating first-dir
2793 ${PROG} update: Updating second-dir" \
2794 "${PROG} update: Updating \.
2795 ${PROG} update: Updating first-dir
2796 ${PROG} update: Updating second-dir"
2797
2798           cd first-dir
2799           dotest basicc-6 "${testcvs} release -d" ""
2800           dotest basicc-7 "test -d ../first-dir" ""
2801           # The Linux 2.2 kernel lets you delete ".".  That's OK either way,
2802           # the point is that CVS must not mess with anything *outside* "."
2803           # the way that CVS 1.10 and older tried to.
2804           dotest basicc-8 "${testcvs} -Q release -d ." \
2805 "" "${PROG} release: deletion of directory \. failed: .*"
2806           dotest basicc-9 "test -d ../second-dir" ""
2807           # For CVS to make a syntactic check for "." wouldn't suffice.
2808           # On Linux 2.2 systems, the cwd may be gone, so we recreate it
2809           # to allow basicc-11 to actually happen 
2810           if test ! -d ../first-dir; then
2811             # Apparently `cd ..' doesn't work with Linux 2.2 & Bash 2.05b.
2812             cd $TESTDIR/1
2813             mkdir ./first-dir
2814             cd ./first-dir
2815           fi
2816           dotest basicc-11 "${testcvs} -Q release -d ./." \
2817 "" "${PROG} release: deletion of directory \./\. failed: .*"
2818           dotest basicc-11a "test -d ../second-dir" ""
2819
2820           cd ../..
2821
2822           mkdir 2; cd 2
2823           dotest basicc-12 "${testcvs} -Q co ." ""
2824           # actual entries can be in either Entries or Entries.log, do
2825           # an update to get them consolidated into Entries
2826           dotest basicc-12a "${testcvs} -Q up" ""
2827           dotest basicc-12b "cat CVS/Entries" \
2828 "D/CVSROOT////
2829 D/first-dir////
2830 D/second-dir////"
2831           dotest basicc-13 "echo *" "CVS CVSROOT first-dir second-dir"
2832           dotest basicc-14 "${testcvs} -Q release first-dir second-dir" ""
2833           # a normal release shouldn't affect the Entries file
2834           dotest basicc-14b "cat CVS/Entries" \
2835 "D/CVSROOT////
2836 D/first-dir////
2837 D/second-dir////"
2838           # FIXCVS: but release -d probably should
2839           dotest basicc-15 "${testcvs} -Q release -d first-dir second-dir" ""
2840           dotest basicc-16 "echo *" "CVS CVSROOT"
2841           dotest basicc-17 "cat CVS/Entries" \
2842 "D/CVSROOT////
2843 D/first-dir////
2844 D/second-dir////"
2845           # FIXCVS: if not, update should notice the missing directories
2846           # and update Entries accordingly
2847           dotest basicc-18 "${testcvs} -Q up" ""
2848           dotest basicc-19 "cat CVS/Entries" \
2849 "D/CVSROOT////
2850 D/first-dir////
2851 D/second-dir////"
2852
2853           cd ..
2854           rm -r 1 2
2855           rm -rf ${CVSROOT_DIRNAME}/first-dir
2856           ;;
2857
2858         basic1)
2859           # first dive - add a files, first singly, then in a group.
2860           mkdir ${CVSROOT_DIRNAME}/first-dir
2861           mkdir basic1; cd basic1
2862           # check out an empty directory
2863           dotest basic1-1 "${testcvs} -q co first-dir" ''
2864
2865           cd first-dir
2866           echo file2 >file2
2867           echo file3 >file3
2868           echo file4 >file4
2869           echo file5 >file5
2870
2871           dotest basic1-14-add-add "${testcvs} add file2 file3 file4 file5" \
2872 "${PROG} add: scheduling file \`file2' for addition
2873 ${PROG} add: scheduling file \`file3' for addition
2874 ${PROG} add: scheduling file \`file4' for addition
2875 ${PROG} add: scheduling file \`file5' for addition
2876 ${PROG} add: use .${PROG} commit. to add these files permanently"
2877           dotest basic1-15-add-add \
2878 "${testcvs} -q update file2 file3 file4 file5" \
2879 "A file2
2880 A file3
2881 A file4
2882 A file5"
2883           dotest basic1-16-add-add "${testcvs} -q update" \
2884 "A file2
2885 A file3
2886 A file4
2887 A file5"
2888           dotest basic1-17-add-add "${testcvs} -q status" \
2889 "===================================================================
2890 File: file2             Status: Locally Added
2891
2892    Working revision:    New file!
2893    Repository revision: No revision control file
2894    Sticky Tag:          (none)
2895    Sticky Date:         (none)
2896    Sticky Options:      (none)
2897
2898 ===================================================================
2899 File: file3             Status: Locally Added
2900
2901    Working revision:    New file!
2902    Repository revision: No revision control file
2903    Sticky Tag:          (none)
2904    Sticky Date:         (none)
2905    Sticky Options:      (none)
2906
2907 ===================================================================
2908 File: file4             Status: Locally Added
2909
2910    Working revision:    New file!
2911    Repository revision: No revision control file
2912    Sticky Tag:          (none)
2913    Sticky Date:         (none)
2914    Sticky Options:      (none)
2915
2916 ===================================================================
2917 File: file5             Status: Locally Added
2918
2919    Working revision:    New file!
2920    Repository revision: No revision control file
2921    Sticky Tag:          (none)
2922    Sticky Date:         (none)
2923    Sticky Options:      (none)"
2924           dotest basic1-18-add-add "${testcvs} -q log" \
2925 "${PROG} log: file2 has been added, but not committed
2926 ${PROG} log: file3 has been added, but not committed
2927 ${PROG} log: file4 has been added, but not committed
2928 ${PROG} log: file5 has been added, but not committed"
2929           cd ..
2930           dotest basic1-21-add-add "${testcvs} -q update" \
2931 "A first-dir/file2
2932 A first-dir/file3
2933 A first-dir/file4
2934 A first-dir/file5"
2935           # FIXCVS?  Shouldn't this read first-dir/file2 instead of file2?
2936           dotest basic1-22-add-add "${testcvs} log first-dir" \
2937 "${PROG} log: Logging first-dir
2938 ${PROG} log: file2 has been added, but not committed
2939 ${PROG} log: file3 has been added, but not committed
2940 ${PROG} log: file4 has been added, but not committed
2941 ${PROG} log: file5 has been added, but not committed"
2942           dotest basic1-23-add-add "${testcvs} status first-dir" \
2943 "${PROG} status: Examining first-dir
2944 ===================================================================
2945 File: file2             Status: Locally Added
2946
2947    Working revision:    New file!
2948    Repository revision: No revision control file
2949    Sticky Tag:          (none)
2950    Sticky Date:         (none)
2951    Sticky Options:      (none)
2952
2953 ===================================================================
2954 File: file3             Status: Locally Added
2955
2956    Working revision:    New file!
2957    Repository revision: No revision control file
2958    Sticky Tag:          (none)
2959    Sticky Date:         (none)
2960    Sticky Options:      (none)
2961
2962 ===================================================================
2963 File: file4             Status: Locally Added
2964
2965    Working revision:    New file!
2966    Repository revision: No revision control file
2967    Sticky Tag:          (none)
2968    Sticky Date:         (none)
2969    Sticky Options:      (none)
2970
2971 ===================================================================
2972 File: file5             Status: Locally Added
2973
2974    Working revision:    New file!
2975    Repository revision: No revision control file
2976    Sticky Tag:          (none)
2977    Sticky Date:         (none)
2978    Sticky Options:      (none)"
2979           dotest basic1-24-add-add "${testcvs} update first-dir" \
2980 "${PROG} update: Updating first-dir
2981 A first-dir/file2
2982 A first-dir/file3
2983 A first-dir/file4
2984 A first-dir/file5"
2985           dotest basic1-27-add-add "${testcvs} co first-dir" \
2986 "${PROG} checkout: Updating first-dir
2987 A first-dir/file2
2988 A first-dir/file3
2989 A first-dir/file4
2990 A first-dir/file5"
2991           cd first-dir
2992           dotest basic1-14-add-ci \
2993 "${testcvs} commit -m test file2 file3 file4 file5" \
2994 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
2995 done
2996 Checking in file2;
2997 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2998 initial revision: 1\.1
2999 done
3000 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
3001 done
3002 Checking in file3;
3003 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
3004 initial revision: 1\.1
3005 done
3006 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
3007 done
3008 Checking in file4;
3009 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
3010 initial revision: 1\.1
3011 done
3012 RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
3013 done
3014 Checking in file5;
3015 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
3016 initial revision: 1\.1
3017 done"
3018           dotest basic1-15-add-ci \
3019 "${testcvs} -q update file2 file3 file4 file5" ''
3020           dotest basic1-16-add-ci "${testcvs} -q update" ''
3021           dotest basic1-17-add-ci "${testcvs} -q status" \
3022 "===================================================================
3023 File: file2             Status: Up-to-date
3024
3025    Working revision:    1\.1.*
3026    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file2,v
3027    Sticky Tag:          (none)
3028    Sticky Date:         (none)
3029    Sticky Options:      (none)
3030
3031 ===================================================================
3032 File: file3             Status: Up-to-date
3033
3034    Working revision:    1\.1.*
3035    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file3,v
3036    Sticky Tag:          (none)
3037    Sticky Date:         (none)
3038    Sticky Options:      (none)
3039
3040 ===================================================================
3041 File: file4             Status: Up-to-date
3042
3043    Working revision:    1\.1.*
3044    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file4,v
3045    Sticky Tag:          (none)
3046    Sticky Date:         (none)
3047    Sticky Options:      (none)
3048
3049 ===================================================================
3050 File: file5             Status: Up-to-date
3051
3052    Working revision:    1\.1.*
3053    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file5,v
3054    Sticky Tag:          (none)
3055    Sticky Date:         (none)
3056    Sticky Options:      (none)"
3057           # The "log" tests and friends probably already test the output 
3058           # from log quite adequately.
3059           # Note: using dotest fails here.  It seems to be related
3060           # to the output being sufficiently large (Red Hat 4.1).
3061           # dotest basic1-18-add-ci "${testcvs} log" "${DOTSTAR}"
3062           if ${testcvs} -q log >>${LOGFILE}; then
3063             pass basic1-18-add-ci
3064           else
3065             pass basic1-18-add-ci
3066           fi
3067           cd ..
3068           dotest basic1-21-add-ci "${testcvs} -q update" ''
3069           # See test basic1-18-add-ci for explanation of non-use of dotest.
3070           if ${testcvs} -q log first-dir >>${LOGFILE}; then
3071             pass basic1-22-add-ci
3072           else
3073             pass basic1-22-add-ci
3074           fi
3075           # At least for the moment I am going to consider 17-add-ci
3076           # an adequate test of the output here.
3077           # See test basic1-18-add-ci for explanation of non-use of dotest.
3078           if ${testcvs} -q status first-dir >>${LOGFILE}; then
3079             pass basic1-23-add-ci
3080           else
3081             pass basic1-23-add-ci
3082           fi
3083           dotest basic1-24-add-ci "${testcvs} -q update first-dir" ''
3084           dotest basic1-27-add-ci "${testcvs} -q co first-dir" ''
3085
3086           cd first-dir
3087           rm file2 file3 file4 file5
3088           dotest basic1-14-rm-rm "${testcvs} rm file2 file3 file4 file5" \
3089 "${PROG} remove: scheduling .file2. for removal
3090 ${PROG} remove: scheduling .file3. for removal
3091 ${PROG} remove: scheduling .file4. for removal
3092 ${PROG} remove: scheduling .file5. for removal
3093 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
3094           # 15-rm-rm was commented out.  Why?
3095           dotest basic1-15-rm-rm \
3096 "${testcvs} -q update file2 file3 file4 file5" \
3097 "R file2
3098 R file3
3099 R file4
3100 R file5"
3101           dotest basic1-16-rm-rm "${testcvs} -q update" \
3102 "R file2
3103 R file3
3104 R file4
3105 R file5"
3106           dotest basic1-17-rm-rm "${testcvs} -q status" \
3107 "===================================================================
3108 File: no file file2             Status: Locally Removed
3109
3110    Working revision:    -1\.1.*
3111    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file2,v
3112    Sticky Tag:          (none)
3113    Sticky Date:         (none)
3114    Sticky Options:      (none)
3115
3116 ===================================================================
3117 File: no file file3             Status: Locally Removed
3118
3119    Working revision:    -1\.1.*
3120    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file3,v
3121    Sticky Tag:          (none)
3122    Sticky Date:         (none)
3123    Sticky Options:      (none)
3124
3125 ===================================================================
3126 File: no file file4             Status: Locally Removed
3127
3128    Working revision:    -1\.1.*
3129    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file4,v
3130    Sticky Tag:          (none)
3131    Sticky Date:         (none)
3132    Sticky Options:      (none)
3133
3134 ===================================================================
3135 File: no file file5             Status: Locally Removed
3136
3137    Working revision:    -1\.1.*
3138    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file5,v
3139    Sticky Tag:          (none)
3140    Sticky Date:         (none)
3141    Sticky Options:      (none)"
3142           # Would be nice to test that real logs appear (with dead state
3143           # and all), either here or someplace like log2 tests.
3144           if ${testcvs} -q log >>${LOGFILE}; then
3145             pass basic1-18-rm-rm
3146           else
3147             fail basic1-18-rm-rm
3148           fi
3149           cd ..
3150           dotest basic1-21-rm-rm "${testcvs} -q update" \
3151 "R first-dir/file2
3152 R first-dir/file3
3153 R first-dir/file4
3154 R first-dir/file5"
3155           if ${testcvs} -q log first-dir >>${LOGFILE}; then
3156             pass basic1-22-rm-rm
3157           else
3158             fail basic1-22-rm-rm
3159           fi
3160           if ${testcvs} -q status first-dir >>${LOGFILE}; then
3161             pass basic1-23-rm-rm
3162           else
3163             fail basic1-23-rm-rm
3164           fi
3165           dotest basic1-24-rm-rm "${testcvs} -q update first-dir" \
3166 "R first-dir/file2
3167 R first-dir/file3
3168 R first-dir/file4
3169 R first-dir/file5"
3170           dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
3171 "R first-dir/file2
3172 R first-dir/file3
3173 R first-dir/file4
3174 R first-dir/file5"
3175           cd first-dir
3176           dotest basic1-14-rm-ci "${testcvs} -q commit -m test" \
3177 "Removing file2;
3178 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
3179 new revision: delete; previous revision: 1\.1
3180 done
3181 Removing file3;
3182 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
3183 new revision: delete; previous revision: 1\.1
3184 done
3185 Removing file4;
3186 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
3187 new revision: delete; previous revision: 1\.1
3188 done
3189 Removing file5;
3190 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
3191 new revision: delete; previous revision: 1\.1
3192 done"
3193           dotest basic1-15-rm-ci \
3194 "${testcvs} -q update file2 file3 file4 file5" ''
3195           dotest basic1-16-rm-ci "${testcvs} -q update" ''
3196           dotest basic1-17-rm-ci "${testcvs} -q status" ''
3197           # Would be nice to test that real logs appear (with dead state
3198           # and all), either here or someplace like log2 tests.
3199           if ${testcvs} -q log >>${LOGFILE}; then
3200             pass basic1-18-rm-ci
3201           else
3202             fail basic1-18-rm-ci
3203           fi
3204           cd ..
3205           dotest basic1-21-rm-ci "${testcvs} -q update" ''
3206           if ${testcvs} -q log first-dir >>${LOGFILE}; then
3207             pass basic1-22-rm-ci
3208           else
3209             fail basic1-22-rm-ci
3210           fi
3211           if ${testcvs} -q status first-dir >>${LOGFILE}; then
3212             pass basic1-23-rm-ci
3213           else
3214             fail basic1-23-rm-ci
3215           fi
3216           dotest basic1-24-rm-ci "${testcvs} -q update first-dir" ''
3217           dotest basic1-27-rm-ci "${testcvs} -q co first-dir" ''
3218           cd first-dir
3219           # All the files are removed, so nothing gets tagged.
3220           dotest basic1-28 "${testcvs} -q tag first-dive" ''
3221           cd ..
3222           cd ..
3223
3224           if $keep; then
3225             echo Keeping ${TESTDIR} and exiting due to --keep
3226             exit 0
3227           fi
3228
3229           rm -r basic1
3230           rm -rf ${CVSROOT_DIRNAME}/first-dir
3231           ;;
3232
3233         deep)
3234           # Test the ability to operate on directories nested rather deeply.
3235           mkdir ${CVSROOT_DIRNAME}/first-dir
3236           dotest deep-1 "${testcvs} -q co first-dir" ''
3237           cd first-dir
3238           for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
3239             mkdir $i
3240             dotest deep-2-$i "${testcvs} add $i" \
3241 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1[/dir0-9]* added to the repository"
3242             cd $i
3243             echo file1 >file1
3244             dotest deep-3-$i "${testcvs} add file1" \
3245 "${PROG}"' add: scheduling file `file1'\'' for addition
3246 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
3247           done
3248           cd ../../../../../../../../..
3249           dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
3250 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v
3251 done
3252 Checking in first-dir/dir1/file1;
3253 ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v  <--  file1
3254 initial revision: 1.1
3255 done
3256 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v
3257 done
3258 Checking in first-dir/dir1/dir2/file1;
3259 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v  <--  file1
3260 initial revision: 1.1
3261 done
3262 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v
3263 done
3264 Checking in first-dir/dir1/dir2/dir3/file1;
3265 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v  <--  file1
3266 initial revision: 1.1
3267 done
3268 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v
3269 done
3270 Checking in first-dir/dir1/dir2/dir3/dir4/file1;
3271 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
3272 initial revision: 1.1
3273 done
3274 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
3275 done
3276 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
3277 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
3278 initial revision: 1.1
3279 done
3280 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
3281 done
3282 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
3283 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
3284 initial revision: 1.1
3285 done
3286 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
3287 done
3288 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
3289 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
3290 initial revision: 1.1
3291 done
3292 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
3293 done
3294 Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
3295 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
3296 initial revision: 1.1
3297 done
3298 HERE
3299
3300           cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
3301           rm file1
3302           dotest deep-4a0 "${testcvs} rm file1" \
3303 "${PROG} remove: scheduling .file1. for removal
3304 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
3305           dotest deep-4a1 "${testcvs} -q ci -m rm-it" "Removing file1;
3306 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
3307 new revision: delete; previous revision: 1\.1
3308 done"
3309           cd ../../..
3310           dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
3311           # Should be using "test -e" if that is portable enough.
3312           dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
3313
3314           # Test that if we remove the working directory, CVS does not
3315           # recreate it.  (I realize that this behavior is what the
3316           # users expect, but in the longer run we might want to
3317           # re-think it.  The corresponding behavior for a file is that
3318           # CVS *will* recreate it, and we might want to make it so
3319           # that "cvs release -d" is the way to delete the directory
3320           # and have it stay gone -kingdon, Oct1996).
3321           rm -r dir6
3322           dotest deep-4b0a "${testcvs} -q diff" ''
3323           dotest deep-4b0b "${testcvs} -q ci" ''
3324           dotest deep-4b1 "${testcvs} -q update" ''
3325           dotest deep-4b2 "${testcvs} -q update -d -P" \
3326 'U dir6/file1
3327 U dir6/dir7/file1'
3328
3329           # Test what happens if one uses -P when there are files removed
3330           # but not committed.
3331           cd dir6/dir7
3332           dotest deep-rm1 "${testcvs} rm -f file1" \
3333 "${PROG} remove: scheduling .file1. for removal
3334 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
3335           cd ..
3336           dotest deep-rm2 "${testcvs} -q update -d -P" 'R dir7/file1'
3337           dotest deep-rm3 "test -d dir7" ''
3338           dotest deep-rm4 "${testcvs} -q ci -m rm-it" "Removing dir7/file1;
3339 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
3340 new revision: delete; previous revision: 1\.1
3341 done"
3342           dotest deep-rm5 "${testcvs} -q update -d -P" ''
3343           dotest_fail deep-rm6 "test -d dir7" ''
3344
3345           # Test rm -f -R.
3346           cd ../..
3347           dotest deep-rm7 "${testcvs} rm -f -R dir5" \
3348 "${PROG} remove: Removing dir5
3349 ${PROG} remove: scheduling .dir5/file1. for removal
3350 ${PROG} remove: Removing dir5/dir6
3351 ${PROG} remove: scheduling .dir5/dir6/file1. for removal
3352 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
3353           dotest deep-rm8 "${testcvs} -q ci -m rm-it" \
3354 "Removing dir5/file1;
3355 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
3356 new revision: delete; previous revision: 1\.1
3357 done
3358 Removing dir5/dir6/file1;
3359 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
3360 new revision: delete; previous revision: 1\.1
3361 done"
3362           dotest deep-rm9 "${testcvs} -q update -d -P" ''
3363           dotest_fail deep-rm10 "test -d dir5"
3364
3365           cd ../../../../..
3366
3367           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
3368             pass deep-5
3369           else
3370             fail deep-5
3371           fi
3372           rm -rf ${CVSROOT_DIRNAME}/first-dir
3373           ;;
3374
3375         basic2)
3376                 # Test rtag, import, history, various miscellaneous operations
3377
3378                 # NOTE: this section has reached the size and
3379                 # complexity where it is getting to be a good idea to
3380                 # add new tests to a new section rather than
3381                 # continuing to piggyback them onto the tests here.
3382
3383                 # First empty the history file
3384                 rm ${CVSROOT_DIRNAME}/CVSROOT/history
3385                 touch ${CVSROOT_DIRNAME}/CVSROOT/history
3386
3387 ### XXX maybe should use 'cvs imprt -b1 -m new-module first-dir F F1' in an
3388 ### empty directory to do this instead of hacking directly into $CVSROOT
3389                 mkdir ${CVSROOT_DIRNAME}/first-dir
3390                 dotest basic2-1 "${testcvs} -q co first-dir" ''
3391                 for i in first-dir dir1 dir2 ; do
3392                         if test ! -d $i ; then
3393                                 mkdir $i
3394                                 dotest basic2-2-$i "${testcvs} add $i" \
3395 "Directory ${CVSROOT_DIRNAME}/.*/$i added to the repository"
3396                         fi
3397
3398                         cd $i
3399
3400                         for j in file6 file7; do
3401                                 echo $j > $j
3402                         done
3403
3404                         dotest basic2-3-$i "${testcvs} add file6 file7" \
3405 "${PROG} add: scheduling file .file6. for addition
3406 ${PROG} add: scheduling file .file7. for addition
3407 ${PROG} add: use .${PROG} commit. to add these files permanently"
3408
3409                 done
3410                 cd ../../..
3411                 dotest basic2-4 "${testcvs} update first-dir" \
3412 "${PROG} update: Updating first-dir
3413 A first-dir/file6
3414 A first-dir/file7
3415 ${PROG} update: Updating first-dir/dir1
3416 A first-dir/dir1/file6
3417 A first-dir/dir1/file7
3418 ${PROG} update: Updating first-dir/dir1/dir2
3419 A first-dir/dir1/dir2/file6
3420 A first-dir/dir1/dir2/file7"
3421
3422                 # fixme: doesn't work right for added files.
3423                 dotest basic2-5 "${testcvs} log first-dir" \
3424 "${PROG} log: Logging first-dir
3425 ${PROG} log: file6 has been added, but not committed
3426 ${PROG} log: file7 has been added, but not committed
3427 ${PROG} log: Logging first-dir/dir1
3428 ${PROG} log: file6 has been added, but not committed
3429 ${PROG} log: file7 has been added, but not committed
3430 ${PROG} log: Logging first-dir/dir1/dir2
3431 ${PROG} log: file6 has been added, but not committed
3432 ${PROG} log: file7 has been added, but not committed"
3433
3434                 dotest basic2-6 "${testcvs} status first-dir" \
3435 "${PROG} status: Examining first-dir
3436 ===================================================================
3437 File: file6             Status: Locally Added
3438
3439    Working revision:    New file!
3440    Repository revision: No revision control file
3441    Sticky Tag:          (none)
3442    Sticky Date:         (none)
3443    Sticky Options:      (none)
3444
3445 ===================================================================
3446 File: file7             Status: Locally Added
3447
3448    Working revision:    New file!
3449    Repository revision: No revision control file
3450    Sticky Tag:          (none)
3451    Sticky Date:         (none)
3452    Sticky Options:      (none)
3453
3454 ${PROG} status: Examining first-dir/dir1
3455 ===================================================================
3456 File: file6             Status: Locally Added
3457
3458    Working revision:    New file!
3459    Repository revision: No revision control file
3460    Sticky Tag:          (none)
3461    Sticky Date:         (none)
3462    Sticky Options:      (none)
3463
3464 ===================================================================
3465 File: file7             Status: Locally Added
3466
3467    Working revision:    New file!
3468    Repository revision: No revision control file
3469    Sticky Tag:          (none)
3470    Sticky Date:         (none)
3471    Sticky Options:      (none)
3472
3473 ${PROG} status: Examining first-dir/dir1/dir2
3474 ===================================================================
3475 File: file6             Status: Locally Added
3476
3477    Working revision:    New file!
3478    Repository revision: No revision control file
3479    Sticky Tag:          (none)
3480    Sticky Date:         (none)
3481    Sticky Options:      (none)
3482
3483 ===================================================================
3484 File: file7             Status: Locally Added
3485
3486    Working revision:    New file!
3487    Repository revision: No revision control file
3488    Sticky Tag:          (none)
3489    Sticky Date:         (none)
3490    Sticky Options:      (none)"
3491
3492 # XXX why is this commented out???
3493 #               if ${CVS} diff -u first-dir   >> ${LOGFILE} || test $? = 1 ; then
3494 #                   pass 34
3495 #               else
3496 #                   fail 34
3497 #               fi
3498
3499                 dotest basic2-8 "${testcvs} -q ci -m 'second dive' first-dir" \
3500 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
3501 done
3502 Checking in first-dir/file6;
3503 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3504 initial revision: 1\.1
3505 done
3506 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3507 done
3508 Checking in first-dir/file7;
3509 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3510 initial revision: 1\.1
3511 done
3512 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3513 done
3514 Checking in first-dir/dir1/file6;
3515 ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3516 initial revision: 1\.1
3517 done
3518 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3519 done
3520 Checking in first-dir/dir1/file7;
3521 ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3522 initial revision: 1\.1
3523 done
3524 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3525 done
3526 Checking in first-dir/dir1/dir2/file6;
3527 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3528 initial revision: 1\.1
3529 done
3530 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3531 done
3532 Checking in first-dir/dir1/dir2/file7;
3533 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3534 initial revision: 1\.1
3535 done"
3536
3537                 dotest basic2-9 "${testcvs} tag second-dive first-dir" \
3538 "${PROG} tag: Tagging first-dir
3539 T first-dir/file6
3540 T first-dir/file7
3541 ${PROG} tag: Tagging first-dir/dir1
3542 T first-dir/dir1/file6
3543 T first-dir/dir1/file7
3544 ${PROG} tag: Tagging first-dir/dir1/dir2
3545 T first-dir/dir1/dir2/file6
3546 T first-dir/dir1/dir2/file7"
3547
3548                 # third dive - in bunch o' directories, add bunch o' files,
3549                 # delete some, change some.
3550
3551                 for i in first-dir dir1 dir2 ; do
3552                         cd $i
3553
3554                         # modify a file
3555                         echo file6 >>file6
3556
3557                         # delete a file
3558                         rm file7
3559
3560                         dotest basic2-10-$i "${testcvs} rm file7" \
3561 "${PROG} remove: scheduling .file7. for removal
3562 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
3563
3564                         # and add a new file
3565                         echo file14 >file14
3566
3567                         dotest basic2-11-$i "${testcvs} add file14" \
3568 "${PROG} add: scheduling file .file14. for addition
3569 ${PROG} add: use .${PROG} commit. to add this file permanently"
3570                 done
3571
3572                 cd ../../..
3573                 dotest basic2-12 "${testcvs} update first-dir" \
3574 "${PROG} update: Updating first-dir
3575 A first-dir/file14
3576 M first-dir/file6
3577 R first-dir/file7
3578 ${PROG} update: Updating first-dir/dir1
3579 A first-dir/dir1/file14
3580 M first-dir/dir1/file6
3581 R first-dir/dir1/file7
3582 ${PROG} update: Updating first-dir/dir1/dir2
3583 A first-dir/dir1/dir2/file14
3584 M first-dir/dir1/dir2/file6
3585 R first-dir/dir1/dir2/file7"
3586
3587                 # FIXME: doesn't work right for added files
3588                 dotest basic2-13 "${testcvs} log first-dir" \
3589 "${PROG} log: Logging first-dir
3590 ${PROG} log: file14 has been added, but not committed
3591
3592 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
3593 Working file: first-dir/file6
3594 head: 1\.1
3595 branch:
3596 locks: strict
3597 access list:
3598 symbolic names:
3599         second-dive: 1\.1
3600 keyword substitution: kv
3601 total revisions: 1;     selected revisions: 1
3602 description:
3603 ----------------------------
3604 revision 1\.1
3605 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3606 second dive
3607 =============================================================================
3608
3609 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3610 Working file: first-dir/file7
3611 head: 1\.1
3612 branch:
3613 locks: strict
3614 access list:
3615 symbolic names:
3616         second-dive: 1\.1
3617 keyword substitution: kv
3618 total revisions: 1;     selected revisions: 1
3619 description:
3620 ----------------------------
3621 revision 1\.1
3622 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3623 second dive
3624 =============================================================================
3625 ${PROG} log: Logging first-dir/dir1
3626 ${PROG} log: file14 has been added, but not committed
3627
3628 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3629 Working file: first-dir/dir1/file6
3630 head: 1\.1
3631 branch:
3632 locks: strict
3633 access list:
3634 symbolic names:
3635         second-dive: 1\.1
3636 keyword substitution: kv
3637 total revisions: 1;     selected revisions: 1
3638 description:
3639 ----------------------------
3640 revision 1\.1
3641 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3642 second dive
3643 =============================================================================
3644
3645 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3646 Working file: first-dir/dir1/file7
3647 head: 1\.1
3648 branch:
3649 locks: strict
3650 access list:
3651 symbolic names:
3652         second-dive: 1\.1
3653 keyword substitution: kv
3654 total revisions: 1;     selected revisions: 1
3655 description:
3656 ----------------------------
3657 revision 1\.1
3658 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3659 second dive
3660 =============================================================================
3661 ${PROG} log: Logging first-dir/dir1/dir2
3662 ${PROG} log: file14 has been added, but not committed
3663
3664 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3665 Working file: first-dir/dir1/dir2/file6
3666 head: 1\.1
3667 branch:
3668 locks: strict
3669 access list:
3670 symbolic names:
3671         second-dive: 1\.1
3672 keyword substitution: kv
3673 total revisions: 1;     selected revisions: 1
3674 description:
3675 ----------------------------
3676 revision 1\.1
3677 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3678 second dive
3679 =============================================================================
3680
3681 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3682 Working file: first-dir/dir1/dir2/file7
3683 head: 1\.1
3684 branch:
3685 locks: strict
3686 access list:
3687 symbolic names:
3688         second-dive: 1\.1
3689 keyword substitution: kv
3690 total revisions: 1;     selected revisions: 1
3691 description:
3692 ----------------------------
3693 revision 1\.1
3694 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3695 second dive
3696 ============================================================================="
3697
3698                 dotest basic2-14 "${testcvs} status first-dir" \
3699 "${PROG} status: Examining first-dir
3700 ===================================================================
3701 File: file14            Status: Locally Added
3702
3703    Working revision:    New file!
3704    Repository revision: No revision control file
3705    Sticky Tag:          (none)
3706    Sticky Date:         (none)
3707    Sticky Options:      (none)
3708
3709 ===================================================================
3710 File: file6             Status: Locally Modified
3711
3712    Working revision:    1\.1.*
3713    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file6,v
3714    Sticky Tag:          (none)
3715    Sticky Date:         (none)
3716    Sticky Options:      (none)
3717
3718 ===================================================================
3719 File: no file file7             Status: Locally Removed
3720
3721    Working revision:    -1\.1.*
3722    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file7,v
3723    Sticky Tag:          (none)
3724    Sticky Date:         (none)
3725    Sticky Options:      (none)
3726
3727 ${PROG} status: Examining first-dir/dir1
3728 ===================================================================
3729 File: file14            Status: Locally Added
3730
3731    Working revision:    New file!
3732    Repository revision: No revision control file
3733    Sticky Tag:          (none)
3734    Sticky Date:         (none)
3735    Sticky Options:      (none)
3736
3737 ===================================================================
3738 File: file6             Status: Locally Modified
3739
3740    Working revision:    1\.1.*
3741    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3742    Sticky Tag:          (none)
3743    Sticky Date:         (none)
3744    Sticky Options:      (none)
3745
3746 ===================================================================
3747 File: no file file7             Status: Locally Removed
3748
3749    Working revision:    -1\.1.*
3750    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3751    Sticky Tag:          (none)
3752    Sticky Date:         (none)
3753    Sticky Options:      (none)
3754
3755 ${PROG} status: Examining first-dir/dir1/dir2
3756 ===================================================================
3757 File: file14            Status: Locally Added
3758
3759    Working revision:    New file!
3760    Repository revision: No revision control file
3761    Sticky Tag:          (none)
3762    Sticky Date:         (none)
3763    Sticky Options:      (none)
3764
3765 ===================================================================
3766 File: file6             Status: Locally Modified
3767
3768    Working revision:    1\.1.*
3769    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3770    Sticky Tag:          (none)
3771    Sticky Date:         (none)
3772    Sticky Options:      (none)
3773
3774 ===================================================================
3775 File: no file file7             Status: Locally Removed
3776
3777    Working revision:    -1\.1.*
3778    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3779    Sticky Tag:          (none)
3780    Sticky Date:         (none)
3781    Sticky Options:      (none)"
3782
3783 # XXX why is this commented out?
3784 #               if ${CVS} diff -u first-dir  >> ${LOGFILE} || test $? = 1 ; then
3785 #                   pass 42
3786 #               else
3787 #                   fail 42
3788 #               fi
3789
3790                 dotest basic2-16 "${testcvs} ci -m 'third dive' first-dir" \
3791 "${PROG} [a-z]*: Examining first-dir
3792 ${PROG} [a-z]*: Examining first-dir/dir1
3793 ${PROG} [a-z]*: Examining first-dir/dir1/dir2
3794 RCS file: ${CVSROOT_DIRNAME}/first-dir/file14,v
3795 done
3796 Checking in first-dir/file14;
3797 ${CVSROOT_DIRNAME}/first-dir/file14,v  <--  file14
3798 initial revision: 1\.1
3799 done
3800 Checking in first-dir/file6;
3801 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3802 new revision: 1\.2; previous revision: 1\.1
3803 done
3804 Removing first-dir/file7;
3805 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3806 new revision: delete; previous revision: 1\.1
3807 done
3808 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v
3809 done
3810 Checking in first-dir/dir1/file14;
3811 ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v  <--  file14
3812 initial revision: 1\.1
3813 done
3814 Checking in first-dir/dir1/file6;
3815 ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3816 new revision: 1\.2; previous revision: 1\.1
3817 done
3818 Removing first-dir/dir1/file7;
3819 ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3820 new revision: delete; previous revision: 1\.1
3821 done
3822 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v
3823 done
3824 Checking in first-dir/dir1/dir2/file14;
3825 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v  <--  file14
3826 initial revision: 1\.1
3827 done
3828 Checking in first-dir/dir1/dir2/file6;
3829 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3830 new revision: 1\.2; previous revision: 1\.1
3831 done
3832 Removing first-dir/dir1/dir2/file7;
3833 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3834 new revision: delete; previous revision: 1\.1
3835 done"
3836                 dotest basic2-17 "${testcvs} -q update first-dir" ''
3837
3838                 dotest basic2-18 "${testcvs} tag third-dive first-dir" \
3839 "${PROG} tag: Tagging first-dir
3840 T first-dir/file14
3841 T first-dir/file6
3842 ${PROG} tag: Tagging first-dir/dir1
3843 T first-dir/dir1/file14
3844 T first-dir/dir1/file6
3845 ${PROG} tag: Tagging first-dir/dir1/dir2
3846 T first-dir/dir1/dir2/file14
3847 T first-dir/dir1/dir2/file6"
3848
3849                 dotest basic2-19 "echo yes | ${testcvs} release -d first-dir" \
3850 "You have \[0\] altered files in this repository\.
3851 Are you sure you want to release (and delete) directory .first-dir.: "
3852
3853                 # end of third dive
3854                 dotest_fail basic2-20 "test -d first-dir" ""
3855
3856                 # now try some rtags
3857
3858                 # rtag HEADS
3859                 dotest basic2-21 "${testcvs} rtag rtagged-by-head first-dir" \
3860 "${PROG} rtag: Tagging first-dir
3861 ${PROG} rtag: Tagging first-dir/dir1
3862 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3863                 # The next test used to cause an assert failure
3864                 # something like:
3865                 # cvs: ./recurse.c:667: do_recursion: Assertion `repository != ((void *)0)' failed.
3866                 dotest basic2-21b "${testcvs} co -p -r rtagged-by-head first-dir/file6" \
3867 "===================================================================
3868 Checking out first-dir/file6
3869 RCS:  $CVSROOT_DIRNAME/first-dir/file6,v
3870 VERS: 1\.2
3871 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3872 file6
3873 file6"
3874                 # tag by tag
3875                 dotest basic2-22 "${testcvs} rtag -r rtagged-by-head rtagged-by-tag first-dir" \
3876 "${PROG} rtag: Tagging first-dir
3877 ${PROG} rtag: Tagging first-dir/dir1
3878 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3879
3880                 # tag by revision
3881                 dotest basic2-23 "${testcvs} rtag -r1.1 rtagged-by-revision first-dir" \
3882 "${PROG} rtag: Tagging first-dir
3883 ${PROG} rtag: Tagging first-dir/dir1
3884 ${PROG} rtag: Tagging first-dir/dir1/dir2"
3885
3886                 # rdiff by revision
3887                 dotest basic2-24 "${testcvs} rdiff -r1.1 -rrtagged-by-head first-dir" \
3888 "${PROG} rdiff: Diffing first-dir
3889 Index: first-dir/file6
3890 diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
3891 \*\*\* first-dir/file6:1\.1     ${DATE}
3892 --- first-dir/file6     ${DATE}
3893 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3894 \*\*\* 1 \*\*\*\*
3895 --- 1,2 ----
3896   file6
3897 ${PLUS} file6
3898 Index: first-dir/file7
3899 diff -c first-dir/file7:1\.1 first-dir/file7:removed
3900 \*\*\* first-dir/file7:1.1      ${DATE}
3901 --- first-dir/file7     ${DATE}
3902 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3903 \*\*\* 1 \*\*\*\*
3904 - file7
3905 --- 0 ----
3906 ${PROG} rdiff: Diffing first-dir/dir1
3907 Index: first-dir/dir1/file6
3908 diff -c first-dir/dir1/file6:1\.1 first-dir/dir1/file6:1\.2
3909 \*\*\* first-dir/dir1/file6:1\.1        ${DATE}
3910 --- first-dir/dir1/file6        ${DATE}
3911 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3912 \*\*\* 1 \*\*\*\*
3913 --- 1,2 ----
3914   file6
3915 ${PLUS} file6
3916 Index: first-dir/dir1/file7
3917 diff -c first-dir/dir1/file7:1\.1 first-dir/dir1/file7:removed
3918 \*\*\* first-dir/dir1/file7:1\.1        ${DATE}
3919 --- first-dir/dir1/file7        ${DATE}
3920 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3921 \*\*\* 1 \*\*\*\*
3922 - file7
3923 --- 0 ----
3924 ${PROG} rdiff: Diffing first-dir/dir1/dir2
3925 Index: first-dir/dir1/dir2/file6
3926 diff -c first-dir/dir1/dir2/file6:1\.1 first-dir/dir1/dir2/file6:1\.2
3927 \*\*\* first-dir/dir1/dir2/file6:1\.1   ${DATE}
3928 --- first-dir/dir1/dir2/file6   ${DATE}
3929 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3930 \*\*\* 1 \*\*\*\*
3931 --- 1,2 ----
3932   file6
3933 ${PLUS} file6
3934 Index: first-dir/dir1/dir2/file7
3935 diff -c first-dir/dir1/dir2/file7:1\.1 first-dir/dir1/dir2/file7:removed
3936 \*\*\* first-dir/dir1/dir2/file7:1\.1   ${DATE}
3937 --- first-dir/dir1/dir2/file7   ${DATE}
3938 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3939 \*\*\* 1 \*\*\*\*
3940 - file7
3941 --- 0 ----"
3942                 dotest basic2-24a "${testcvs} rdiff -l -r1.1 -rrtagged-by-head first-dir" \
3943 "${PROG} rdiff: Diffing first-dir
3944 Index: first-dir/file6
3945 diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
3946 \*\*\* first-dir/file6:1\.1     ${DATE}
3947 --- first-dir/file6     ${DATE}
3948 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3949 \*\*\* 1 \*\*\*\*
3950 --- 1,2 ----
3951   file6
3952 ${PLUS} file6
3953 Index: first-dir/file7
3954 diff -c first-dir/file7:1\.1 first-dir/file7:removed
3955 \*\*\* first-dir/file7:1.1      ${DATE}
3956 --- first-dir/file7     ${DATE}
3957 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3958 \*\*\* 1 \*\*\*\*
3959 - file7
3960 --- 0 ----"
3961                 # now export by rtagged-by-head and rtagged-by-tag and compare.
3962                 dotest basic2-25 "${testcvs} export -r rtagged-by-head -d 1dir first-dir" \
3963 "${PROG} export: Updating 1dir
3964 U 1dir/file14
3965 U 1dir/file6
3966 ${PROG} export: Updating 1dir/dir1
3967 U 1dir/dir1/file14
3968 U 1dir/dir1/file6
3969 ${PROG} export: Updating 1dir/dir1/dir2
3970 U 1dir/dir1/dir2/file14
3971 U 1dir/dir1/dir2/file6"
3972                 dotest_fail basic2-25a "test -d 1dir/CVS"
3973                 dotest_fail basic2-25b "test -d 1dir/dir1/CVS"
3974                 dotest_fail basic2-25c "test -d 1dir/dir1/dir2/CVS"
3975
3976                 dotest basic2-26 "${testcvs} export -r rtagged-by-tag first-dir" \
3977 "${PROG} export: Updating first-dir
3978 U first-dir/file14
3979 U first-dir/file6
3980 ${PROG} export: Updating first-dir/dir1
3981 U first-dir/dir1/file14
3982 U first-dir/dir1/file6
3983 ${PROG} export: Updating first-dir/dir1/dir2
3984 U first-dir/dir1/dir2/file14
3985 U first-dir/dir1/dir2/file6"
3986                 dotest_fail basic2-26a "test -d first-dir/CVS"
3987                 dotest_fail basic2-26b "test -d first-dir/dir1/CVS"
3988                 dotest_fail basic2-26c "test -d first-dir/dir1/dir2/CVS"
3989
3990                 dotest basic2-27 "directory_cmp 1dir first-dir"
3991                 rm -r 1dir first-dir
3992
3993                 # checkout by revision vs export by rtagged-by-revision and compare.
3994                 mkdir export-dir
3995                 dotest basic2-28 "${testcvs} export -rrtagged-by-revision -d export-dir first-dir" \
3996 "${PROG} export: Updating export-dir
3997 U export-dir/file14
3998 U export-dir/file6
3999 U export-dir/file7
4000 ${PROG} export: Updating export-dir/dir1
4001 U export-dir/dir1/file14
4002 U export-dir/dir1/file6
4003 U export-dir/dir1/file7
4004 ${PROG} export: Updating export-dir/dir1/dir2
4005 U export-dir/dir1/dir2/file14
4006 U export-dir/dir1/dir2/file6
4007 U export-dir/dir1/dir2/file7"
4008                 dotest_fail basic2-28a "test -d export-dir/CVS"
4009                 dotest_fail basic2-28b "test -d export-dir/dir1/CVS"
4010                 dotest_fail basic2-28c "test -d export-dir/dir1/dir2/CVS"
4011
4012                 dotest basic2-29 "${testcvs} co -r1.1 first-dir" \
4013 "${PROG} checkout: Updating first-dir
4014 U first-dir/file14
4015 U first-dir/file6
4016 U first-dir/file7
4017 ${PROG} checkout: Updating first-dir/dir1
4018 U first-dir/dir1/file14
4019 U first-dir/dir1/file6
4020 U first-dir/dir1/file7
4021 ${PROG} checkout: Updating first-dir/dir1/dir2
4022 U first-dir/dir1/dir2/file14
4023 U first-dir/dir1/dir2/file6
4024 U first-dir/dir1/dir2/file7"
4025
4026                 # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
4027                 mkdir first-dir.cpy ; (cd first-dir ; tar cf - . | (cd ../first-dir.cpy ; tar xf -))
4028
4029                 dotest basic2-30 "directory_cmp first-dir export-dir"
4030
4031                 # interrupt, while we've got a clean 1.1 here, let's import it
4032                 # into a couple of other modules.
4033                 cd export-dir
4034                 dotest_sort basic2-31 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
4035 "
4036
4037 N second-dir/dir1/dir2/file14
4038 N second-dir/dir1/dir2/file6
4039 N second-dir/dir1/dir2/file7
4040 N second-dir/dir1/file14
4041 N second-dir/dir1/file6
4042 N second-dir/dir1/file7
4043 N second-dir/file14
4044 N second-dir/file6
4045 N second-dir/file7
4046 No conflicts created by this import
4047 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1
4048 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1/dir2"
4049                 cd ..
4050
4051                 dotest basic2-32 "${testcvs} export -r HEAD second-dir" \
4052 "${PROG} export: Updating second-dir
4053 U second-dir/file14
4054 U second-dir/file6
4055 U second-dir/file7
4056 ${PROG} export: Updating second-dir/dir1
4057 U second-dir/dir1/file14
4058 U second-dir/dir1/file6
4059 U second-dir/dir1/file7
4060 ${PROG} export: Updating second-dir/dir1/dir2
4061 U second-dir/dir1/dir2/file14
4062 U second-dir/dir1/dir2/file6
4063 U second-dir/dir1/dir2/file7"
4064
4065                 dotest basic2-33 "directory_cmp first-dir second-dir"
4066
4067                 rm -r second-dir
4068
4069                 rm -r export-dir first-dir
4070                 mkdir first-dir
4071                 (cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
4072
4073                 # update the top, cancelling sticky tags, retag, update other copy, compare.
4074                 cd first-dir
4075                 dotest basic2-34 "${testcvs} update -A -l *file*" \
4076 "[UP] file6
4077 ${PROG} update: file7 is no longer in the repository"
4078
4079                 # If we don't delete the tag first, cvs won't retag it.
4080                 # This would appear to be a feature.
4081                 dotest basic2-35 "${testcvs} tag -l -d rtagged-by-revision" \
4082 "${PROG} tag: Untagging \.
4083 D file14
4084 D file6"
4085                 dotest basic2-36 "${testcvs} tag -l rtagged-by-revision" \
4086 "${PROG} tag: Tagging \.
4087 T file14
4088 T file6"
4089
4090                 cd ..
4091                 mv first-dir 1dir
4092                 mv first-dir.cpy first-dir
4093                 cd first-dir
4094
4095                 dotest basic2-37 "${testcvs} -q diff -u" ''
4096
4097                 dotest basic2-38 "${testcvs} update" \
4098 "${PROG} update: Updating .
4099 ${PROG} update: Updating dir1
4100 ${PROG} update: Updating dir1/dir2"
4101
4102                 cd ..
4103
4104                 #### FIXME: is this expected to work???  Need to investigate
4105                 #### and fix or remove the test.
4106 #               dotest basic2-39 "directory_cmp 1dir first-dir"
4107
4108                 rm -r 1dir first-dir
4109
4110                 # Test the cvs history command.
4111
4112                 # The reason that there are two patterns rather than using
4113                 # \(${TESTDIR}\|<remote>\) is that we are trying to
4114                 # make this portable.  Perhaps at some point we should
4115                 # ditch that notion and require GNU expr (or dejagnu or....)
4116                 # since it seems to be so painful.
4117
4118                 # why are there two lines at the end of the local output
4119                 # which don't exist in the remote output?  would seem to be
4120                 # a CVS bug.
4121                 dotest basic2-64 "${testcvs} his -x TOFWUPCGMAR -a" \
4122 "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= ${TESTDIR}/\*
4123 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == ${TESTDIR}
4124 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == ${TESTDIR}
4125 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == ${TESTDIR}
4126 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == ${TESTDIR}
4127 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == ${TESTDIR}
4128 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == ${TESTDIR}
4129 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == ${TESTDIR}
4130 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}
4131 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == ${TESTDIR}
4132 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == ${TESTDIR}
4133 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == ${TESTDIR}
4134 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == ${TESTDIR}
4135 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == ${TESTDIR}
4136 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == ${TESTDIR}
4137 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == ${TESTDIR}
4138 F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= ${TESTDIR}/\*
4139 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
4140 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
4141 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
4142 O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= ${TESTDIR}/\*
4143 U [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}/first-dir
4144 W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == ${TESTDIR}/first-dir" \
4145 "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= <remote>/\*
4146 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == <remote>
4147 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == <remote>
4148 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == <remote>
4149 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == <remote>
4150 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == <remote>
4151 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == <remote>
4152 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == <remote>
4153 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
4154 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == <remote>
4155 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == <remote>
4156 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == <remote>
4157 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == <remote>
4158 A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == <remote>
4159 M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == <remote>
4160 R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == <remote>
4161 F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= <remote>/\*
4162 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
4163 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
4164 T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
4165 O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= <remote>/\*
4166 P [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
4167 W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == <remote>"
4168
4169                 rm -rf ${CVSROOT_DIRNAME}/first-dir
4170                 rm -rf ${CVSROOT_DIRNAME}/second-dir
4171                 ;;
4172
4173         parseroot)
4174           mkdir 1; cd 1
4175           # Test odd cases involving CVSROOT.  At the moment, that means we
4176           # are testing roots with '/'s on the end, which CVS should parse off.
4177           CVSROOT_save=${CVSROOT}
4178           CVSROOT="${CVSROOT}/////"
4179           dotest parseroot-1 "${testcvs} -q co CVSROOT/modules" \
4180 "U CVSROOT/modules"
4181           dotest parseroot-2 "${testcvs} -q ci -fmnull-change CVSROOT/modules" \
4182 "Checking in CVSROOT/modules;
4183 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
4184 new revision: 1\.2; previous revision: 1\.1
4185 done
4186 ${PROG} commit: Rebuilding administrative file database"
4187
4188           if $remote; then
4189             # I only test these when testing remote in case CVS was compiled
4190             # without client support.
4191
4192             # logout does not try to contact the server.
4193             CVSROOT=":pserver;proxy=localhost;proxyport=8080:localhost/dev/null"
4194             dotest parseroot-3r "$testcvs -d'$CVSROOT' logout" \
4195 "$PROG logout: WARNING: Ignoring method options found in CVSROOT: \`proxy=localhost;proxyport=8080'\.
4196 $PROG logout: Use CVS version 1\.12\.7 or later to handle method options\.
4197 Logging out of :pserver:$username@localhost:2401/dev/null
4198 $PROG logout: warning: failed to open $HOME/\.cvspass for reading: No such file or directory
4199 $PROG logout: Entry not found\."
4200           fi
4201
4202           if $keep; then
4203                 echo Keeping $TESTDIR and exiting due to --keep
4204                 exit 0
4205           fi
4206
4207           CVSROOT=$CVSROOT_save
4208           cd ..
4209           rm -r 1
4210           ;;
4211
4212
4213
4214         files)
4215           # Test of how we specify files on the command line
4216           # (recurse.c and that sort of thing).  Vaguely similar to
4217           # tests like basic* and deep.  See modules and such tests
4218           # for what happens when we throw in modules and co -d, &c.
4219
4220           # This particular test is fairly carefully crafted, to spot
4221           # one particular issue with remote.
4222           mkdir 1; cd 1
4223           dotest files-1 "${testcvs} -q co -l ." ""
4224           mkdir first-dir
4225           dotest files-2 "${testcvs} add first-dir" \
4226 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4227           cd first-dir
4228           touch tfile
4229           dotest files-3 "${testcvs} add tfile" \
4230 "${PROG} add: scheduling file .tfile. for addition
4231 ${PROG} add: use .${PROG} commit. to add this file permanently"
4232           dotest files-4 "${testcvs} -q ci -m add" \
4233 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
4234 done
4235 Checking in tfile;
4236 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4237 initial revision: 1\.1
4238 done"
4239           dotest files-5 "${testcvs} -q tag -b C" "T tfile"
4240           dotest files-6 "$testcvs -q update -r C" "U tfile"
4241           mkdir dir
4242           dotest files-7 "${testcvs} add dir" \
4243 "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository
4244 --> Using per-directory sticky tag .C'"
4245           cd dir
4246           touch .file
4247           dotest files-6 "${testcvs} add .file" \
4248 "${PROG} add: scheduling file .\.file' for addition on branch .C.
4249 ${PROG} add: use .${PROG} commit. to add this file permanently"
4250           mkdir sdir
4251           dotest files-7 "${testcvs} add sdir" \
4252 "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir added to the repository
4253 --> Using per-directory sticky tag .C'"
4254           cd sdir
4255           mkdir ssdir
4256           dotest files-8 "${testcvs} add ssdir" \
4257 "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir added to the repository
4258 --> Using per-directory sticky tag .C'"
4259           cd ssdir
4260           touch .file
4261           dotest files-9 "${testcvs} add .file" \
4262 "${PROG} add: scheduling file .\.file' for addition on branch .C.
4263 ${PROG} add: use .${PROG} commit. to add this file permanently"
4264           cd ../..
4265           dotest files-10 "${testcvs} -q ci -m test" \
4266 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v
4267 done
4268 Checking in \.file;
4269 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4270 new revision: 1\.1\.2\.1; previous revision: 1\.1
4271 done
4272 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v
4273 done
4274 Checking in sdir/ssdir/\.file;
4275 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4276 new revision: 1\.1\.2\.1; previous revision: 1\.1
4277 done"
4278           dotest files-11 \
4279 "${testcvs} commit -m test -f ./.file ./sdir/ssdir/.file" \
4280 "Checking in \.file;
4281 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4282 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
4283 done
4284 Checking in \./sdir/ssdir/\.file;
4285 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4286 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
4287 done"
4288           if $remote; then
4289             # FIXCVS:
4290             # This is a bug, looks like that toplevel_repos cruft in
4291             # client.c is coming back to haunt us.
4292             # May want to think about the whole issue, toplevel_repos
4293             # has always been crufty and trying to patch it up again
4294             # might be a mistake.
4295             dotest files-12 \
4296 "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
4297 "Checking in \./sdir/ssdir/\.file;
4298 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4299 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4300 done"
4301
4302             # Sync up the version numbers so that the rest of the
4303             # tests don't need to expect different numbers based
4304             # local or remote.
4305             dotest files-12-workaround \
4306 "${testcvs} commit -f -m test .file" \
4307 "Checking in \.file;
4308 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4309 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4310 done"
4311           else
4312             dotest files-12 \
4313 "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
4314 "Checking in \./sdir/ssdir/\.file;
4315 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4316 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4317 done
4318 Checking in \.file;
4319 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4320 new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4321 done"
4322           fi
4323           dotest files-13 \
4324 "${testcvs} commit -fmtest ./sdir/../sdir/ssdir/..///ssdir/.file" \
4325 "Checking in \./sdir/\.\./sdir/ssdir/\.\.///ssdir/\.file;
4326 ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4327 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4328 done"
4329           if $remote; then
4330             dotest files-14 \
4331 "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
4332 "Checking in \.\./\.\./first-dir/dir/\.file;
4333 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  .file
4334 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4335 done"
4336           else
4337             dotest files-14 \
4338 "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
4339 "Checking in \.\./\.\./first-dir/dir/\.file;
4340 ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4341 new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4342 done"
4343           fi
4344           cd ../../..
4345
4346           rm -r 1
4347           rm -rf ${CVSROOT_DIRNAME}/first-dir
4348           ;;
4349
4350         spacefiles)
4351           # More filename tests, in particular spaces in file names.
4352           # (it might be better to just change a few of the names in
4353           # basica or some other test instead, always good to keep the
4354           # testsuite concise).
4355
4356           mkdir 1; cd 1
4357           dotest spacefiles-1 "${testcvs} -q co -l ." ""
4358           touch ./-c
4359           dotest spacefiles-2 "${testcvs} add -- -c" \
4360 "${PROG} add: scheduling file .-c. for addition
4361 ${PROG} add: use .${PROG} commit. to add this file permanently"
4362           dotest spacefiles-3 "${testcvs} -q ci -m add" \
4363 "RCS file: ${CVSROOT_DIRNAME}/-c,v
4364 done
4365 Checking in -c;
4366 ${CVSROOT_DIRNAME}/-c,v  <--  -c
4367 initial revision: 1\.1
4368 done"
4369           mkdir 'first dir'
4370           dotest spacefiles-4 "${testcvs} add 'first dir'" \
4371 "Directory ${CVSROOT_DIRNAME}/first dir added to the repository"
4372           mkdir ./-b
4373           dotest spacefiles-5 "${testcvs} add -- -b" \
4374 "Directory ${CVSROOT_DIRNAME}/-b added to the repository"
4375           cd 'first dir'
4376           touch 'a file'
4377           dotest spacefiles-6 "${testcvs} add 'a file'" \
4378 "${PROG} add: scheduling file .a file. for addition
4379 ${PROG} add: use .${PROG} commit. to add this file permanently"
4380           dotest spacefiles-7 "${testcvs} -q ci -m add" \
4381 "RCS file: ${CVSROOT_DIRNAME}/first dir/a file,v
4382 done
4383 Checking in a file;
4384 ${CVSROOT_DIRNAME}/first dir/a file,v  <--  a file
4385 initial revision: 1\.1
4386 done"
4387           dotest spacefiles-8 "${testcvs} -q tag new-tag" "T a file"
4388           cd ../..
4389
4390           mkdir 2; cd 2
4391           dotest spacefiles-10 "${testcvs} co -- -b" \
4392 "${PROG} checkout: Updating -b"
4393           dotest spacefiles-11 "${testcvs} -q co -- -c" "U \./-c"
4394           rm ./-c
4395           dotest spacefiles-13 "${testcvs} -q co 'first dir'" \
4396 "U first dir/a file"
4397           cd ..
4398
4399           mkdir 3; cd 3
4400           dotest spacefiles-14 "${testcvs} -q co 'first dir/a file'" \
4401 "U first dir/a file"
4402           cd ..
4403
4404           rm -r 1 2 3
4405           rm -rf "${CVSROOT_DIRNAME}/first dir"
4406           rm -r ${CVSROOT_DIRNAME}/-b
4407           rm -f ${CVSROOT_DIRNAME}/-c,v
4408           ;;
4409
4410         commit-readonly)
4411           mkdir 1; cd 1
4412           module=x
4413
4414           : > junk
4415           dotest commit-readonly-1 "$testcvs -Q import -m . $module X Y" ''
4416           dotest commit-readonly-2 "$testcvs -Q co $module" ''
4417           cd $module
4418
4419           file=m
4420
4421           # Include an rcs keyword to be expanded.
4422           echo '$Id''$' > $file
4423
4424           dotest commit-readonly-3 "$testcvs add $file" \
4425 "${PROG} add: scheduling file .$file. for addition
4426 ${PROG} add: use .${PROG} commit. to add this file permanently"
4427           dotest commit-readonly-4 "$testcvs -Q ci -m . $file" \
4428 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
4429 done
4430 Checking in $file;
4431 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
4432 initial revision: 1\.1
4433 done"
4434
4435           echo line2 >> $file
4436           # Make the file read-only.
4437           chmod a-w $file
4438
4439           dotest commit-readonly-5 "$testcvs -Q ci -m . $file" \
4440 "Checking in $file;
4441 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
4442 new revision: 1\.2; previous revision: 1\.1
4443 done"
4444
4445           cd ../..
4446           rm -rf 1
4447           rm -rf ${CVSROOT_DIRNAME}/$module
4448           ;;
4449
4450         status)
4451                 # This tests for a bug in the status command which failed to
4452                 # notice resolved conflicts.
4453                 mkdir status; cd status
4454                 dotest status-init-1 "${testcvs} -q co -l ." ""
4455                 mkdir first-dir
4456                 dotest status-init-2 "${testcvs} add first-dir" \
4457 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4458                 cd first-dir
4459                 echo a line >tfile
4460                 dotest status-init-3 "${testcvs} add tfile" \
4461 "${PROG} add: scheduling file .tfile. for addition
4462 ${PROG} add: use .${PROG} commit. to add this file permanently"
4463                 dotest status-init-4 "${testcvs} -q ci -m add" \
4464 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
4465 done
4466 Checking in tfile;
4467 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4468 initial revision: 1\.1
4469 done"
4470                 cd ..
4471                 dotest status-init-5 "${testcvs} -q co -dsecond-dir first-dir" \
4472 "U second-dir/tfile"
4473                 cd second-dir
4474                 echo some junk >>tfile
4475                 dotest status-init-6 "${testcvs} -q ci -maline" \
4476 "Checking in tfile;
4477 ${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4478 new revision: 1\.2; previous revision: 1\.1
4479 done"
4480                 cd ../first-dir
4481                 echo force a conflict >>tfile
4482                 dotest status-init-7 "${testcvs} -q up" \
4483 "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
4484 retrieving revision 1\.1
4485 retrieving revision 1\.2
4486 Merging differences between 1\.1 and 1\.2 into tfile
4487 rcsmerge: warning: conflicts during merge
4488 ${PROG} update: conflicts found in tfile
4489 C tfile"
4490
4491                 # Now note our status
4492                 dotest status-1 "${testcvs} status tfile" \
4493 "===================================================================
4494 File: tfile             Status: Unresolved Conflict
4495
4496    Working revision:    1\.2.*
4497    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4498    Sticky Tag:          (none)
4499    Sticky Date:         (none)
4500    Sticky Options:      (none)"
4501
4502                 # touch the file, leaving conflict markers in place
4503                 # and note our status
4504                 touch tfile
4505                 dotest status-2 "${testcvs} status tfile" \
4506 "===================================================================
4507 File: tfile             Status: File had conflicts on merge
4508
4509    Working revision:    1\.2.*
4510    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4511    Sticky Tag:          (none)
4512    Sticky Date:         (none)
4513    Sticky Options:      (none)"
4514
4515                 # resolve the conflict
4516                 echo resolution >tfile
4517                 dotest status-3 "${testcvs} status tfile" \
4518 "===================================================================
4519 File: tfile             Status: Locally Modified
4520
4521    Working revision:    1\.2.*
4522    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4523    Sticky Tag:          (none)
4524    Sticky Date:         (none)
4525    Sticky Options:      (none)"
4526
4527                 # Check that there are no problems just using CVS/Root too.
4528                 save_CVSROOT=$CVSROOT
4529                 unset CVSROOT
4530                 dotest status-3a "${testcvs} status tfile" \
4531 "===================================================================
4532 File: tfile             Status: Locally Modified
4533
4534    Working revision:    1\.2.*
4535    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/tfile,v
4536    Sticky Tag:          (none)
4537    Sticky Date:         (none)
4538    Sticky Options:      (none)"
4539                 CVSROOT=$save_CVSROOT
4540                 export CVSROOT
4541
4542                 # FIXCVS:
4543                 # Update is supposed to re-Register() the file when it
4544                 # finds resolved conflicts:
4545                 dotest status-4 "grep 'Result of merge' CVS/Entries" \
4546 "/tfile/1\.2/Result of merge${PLUS}[a-zA-Z0-9 :]*//"
4547
4548                 cd ..
4549                 mkdir fourth-dir
4550                 dotest status-init-8 "$testcvs add fourth-dir" \
4551 "Directory $CVSROOT_DIRNAME/fourth-dir added to the repository"
4552                 cd fourth-dir
4553                 echo yet another line >t3file
4554                 dotest status-init-9 "$testcvs add t3file" \
4555 "$PROG add: scheduling file .t3file. for addition
4556 $PROG add: use .$PROG commit. to add this file permanently"
4557                 dotest status-init-10 "$testcvs -q ci -m add" \
4558 "RCS file: $CVSROOT_DIRNAME/fourth-dir/t3file,v
4559 done
4560 Checking in t3file;
4561 $CVSROOT_DIRNAME/fourth-dir/t3file,v  <--  t3file
4562 initial revision: 1\.1
4563 done"
4564                 cd ../first-dir
4565                 mkdir third-dir
4566                 dotest status-init-11 "$testcvs add third-dir" \
4567 "Directory $CVSROOT_DIRNAME/first-dir/third-dir added to the repository"
4568                 cd third-dir
4569                 echo another line >t2file
4570                 dotest status-init-12 "$testcvs add t2file" \
4571 "$PROG add: scheduling file .t2file. for addition
4572 $PROG add: use .$PROG commit. to add this file permanently"
4573                 dotest status-init-13 "$testcvs -q ci -m add" \
4574 "RCS file: $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v
4575 done
4576 Checking in t2file;
4577 $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v  <--  t2file
4578 initial revision: 1\.1
4579 done"
4580                 dotest status-5 "$testcvs status ../tfile" \
4581 "===================================================================
4582 File: tfile             Status: Locally Modified
4583
4584    Working revision:    1\.2.*
4585    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/tfile,v
4586    Sticky Tag:          (none)
4587    Sticky Date:         (none)
4588    Sticky Options:      (none)"
4589                 dotest status-6 "$testcvs status ../../fourth-dir/t3file" \
4590 "===================================================================
4591 File: t3file            Status: Up-to-date
4592
4593    Working revision:    1\.1.*
4594    Repository revision: 1\.1    $CVSROOT_DIRNAME/fourth-dir/t3file,v
4595    Sticky Tag:          (none)
4596    Sticky Date:         (none)
4597    Sticky Options:      (none)"
4598
4599                 if $keep; then
4600                         echo Keeping $TESTDIR and exiting due to --keep
4601                         exit 0
4602                 fi
4603
4604                 cd ../../..
4605                 rm -rf status
4606                 rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/fourth-dir
4607                 ;;
4608
4609         rdiff)
4610                 # Test rdiff
4611                 # XXX for now this is just the most essential test...
4612                 cd ${TESTDIR}
4613
4614                 mkdir testimport
4615                 cd testimport
4616                 echo '$''Id$' > foo
4617                 echo '$''Name$' >> foo
4618                 echo '$''Id$' > bar
4619                 echo '$''Name$' >> bar
4620                 dotest_sort rdiff-1 \
4621                   "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
4622 '
4623
4624 N trdiff/bar
4625 N trdiff/foo
4626 No conflicts created by this import'
4627                 dotest rdiff-2 \
4628                   "${testcvs} co -ko trdiff" \
4629 "${PROG} checkout: Updating trdiff
4630 U trdiff/bar
4631 U trdiff/foo"
4632                 cd trdiff
4633                 echo something >> foo
4634                 dotest rdiff-3 \
4635                   "${testcvs} ci -m added-something foo" \
4636 "Checking in foo;
4637 ${CVSROOT_DIRNAME}/trdiff/foo,v  <--  foo
4638 new revision: 1\.2; previous revision: 1\.1
4639 done"
4640                 echo '#ident    "@(#)trdiff:$''Name$:$''Id$"' > new
4641                 echo "new file" >> new
4642                 dotest rdiff-4 \
4643                   "${testcvs} add -m new-file-description new" \
4644 "${PROG} add: scheduling file \`new' for addition
4645 ${PROG} add: use .${PROG} commit. to add this file permanently"
4646                 dotest rdiff-5 \
4647                   "${testcvs} commit -m added-new-file new" \
4648 "RCS file: ${CVSROOT_DIRNAME}/trdiff/new,v
4649 done
4650 Checking in new;
4651 ${CVSROOT_DIRNAME}/trdiff/new,v  <--  new
4652 initial revision: 1\.1
4653 done"
4654                 dotest rdiff-6 \
4655                   "${testcvs} tag local-v0" \
4656 "${PROG} tag: Tagging .
4657 T bar
4658 T foo
4659 T new"
4660                 dotest rdiff-7 \
4661                   "${testcvs} status -v foo" \
4662 "===================================================================
4663 File: foo               Status: Up-to-date
4664
4665    Working revision:    1\.2.*
4666    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/trdiff/foo,v
4667    Sticky Tag:          (none)
4668    Sticky Date:         (none)
4669    Sticky Options:      -ko
4670
4671    Existing Tags:
4672         local-v0                        (revision: 1\.2)
4673         T1                              (revision: 1\.1\.1\.1)
4674         TRDIFF                          (branch: 1\.1\.1)"
4675
4676                 cd ..
4677                 rm -r trdiff
4678
4679                 dotest rdiff-8 \
4680                   "${testcvs} rdiff -r T1 -r local-v0 trdiff" \
4681 "${PROG}"' rdiff: Diffing trdiff
4682 Index: trdiff/foo
4683 diff -c trdiff/foo:1\.1\.1\.1 trdiff/foo:1\.2
4684 \*\*\* trdiff/foo:1\.1\.1\.1    '"${DATE}"'
4685 --- trdiff/foo  '"${DATE}"'
4686 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4687 \*\*\* 1,2 \*\*\*\*
4688 ! \$''Id: foo,v 1\.1\.1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$
4689 ! \$''Name: T1 \$
4690 --- 1,3 ----
4691 ! \$''Id: foo,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
4692 ! \$''Name: local-v0 \$
4693 ! something
4694 Index: trdiff/new
4695 diff -c /dev/null trdiff/new:1\.1
4696 \*\*\* /dev/null        '"${DATE}"'
4697 --- trdiff/new  '"${DATE}"'
4698 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4699 \*\*\* 0 \*\*\*\*
4700 --- 1,2 ----
4701 '"${PLUS}"' #ident      "@(#)trdiff:\$''Name: local-v0 \$:\$''Id: new,v 1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$"
4702 '"${PLUS}"' new file'
4703
4704                 if $keep; then
4705                   echo Keeping ${TESTDIR} and exiting due to --keep
4706                   exit 0
4707                 fi
4708
4709                 cd ..
4710                 rm -r testimport
4711                 rm -rf ${CVSROOT_DIRNAME}/trdiff
4712                 ;;
4713
4714         rdiff-short)
4715           # Test that the short patch behaves as expected
4716           #   1) Added file.
4717           #   2) Removed file.
4718           #   3) Different revision number with no difference.
4719           #   4) Different revision number with changes.
4720           #   5) Against trunk.
4721           #   6) Same revision number (no difference).
4722           mkdir rdiff-short; cd rdiff-short
4723           mkdir abc
4724           dotest rdiff-short-init-1 \
4725 "${testcvs} -q import -I ! -m initial-import abc vendor initial" \
4726 '
4727 No conflicts created by this import'
4728
4729           dotest rdiff-short-init-2 "${testcvs} -q get abc" ''
4730           cd abc
4731           echo "abc" >file1.txt
4732           dotest rdiff-short-init-3 "${testcvs} add file1.txt" \
4733 "${PROG} add: scheduling file .file1\.txt' for addition
4734 ${PROG} add: use .${PROG} commit. to add this file permanently"
4735           dotest rdiff-short-init-4 \
4736 "${testcvs} commit -madd-file1 file1.txt" \
4737 "RCS file: ${CVSROOT_DIRNAME}/abc/file1\.txt,v
4738 done
4739 Checking in file1\.txt;
4740 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4741 initial revision: 1\.1
4742 done"
4743           echo def >>file1.txt
4744           dotest rdiff-short-init-5 \
4745 "${testcvs} commit -mchange-file1 file1.txt" \
4746 "Checking in file1\.txt;
4747 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4748 new revision: 1\.2; previous revision: 1\.1
4749 done"
4750           echo "abc" >file1.txt
4751           dotest rdiff-short-init-6 \
4752 "${testcvs} commit -mrestore-file1-rev1 file1.txt" \
4753 "Checking in file1\.txt;
4754 ${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4755 new revision: 1\.3; previous revision: 1\.2
4756 done"
4757           dotest rdiff-short-init-7 \
4758 "${testcvs} tag -r 1.1 tag1 file1.txt" \
4759 "T file1\.txt"
4760           dotest rdiff-short-init-8 \
4761 "${testcvs} tag -r 1.2 tag2 file1.txt" \
4762 "T file1\.txt"
4763           dotest rdiff-short-init-9 \
4764 "${testcvs} tag -r 1.3 tag3 file1.txt" \
4765 "T file1\.txt"
4766           echo "abc" >file2.txt
4767           dotest rdiff-short-init-10 \
4768 "${testcvs} add file2.txt" \
4769 "${PROG} add: scheduling file .file2\.txt' for addition
4770 ${PROG} add: use .${PROG} commit. to add this file permanently"
4771           dotest rdiff-add-remove-nodiff-init-11 \
4772 "${testcvs} commit -madd-file2 file2.txt" \
4773 "RCS file: ${CVSROOT_DIRNAME}/abc/file2\.txt,v
4774 done
4775 Checking in file2\.txt;
4776 ${CVSROOT_DIRNAME}/abc/file2\.txt,v  <--  file2\.txt
4777 initial revision: 1\.1
4778 done"
4779           dotest rdiff-short-init-12 \
4780 "${testcvs} tag -r 1.1 tag4 file2.txt" \
4781 "T file2\.txt"
4782           dotest rdiff-short-init-13 \
4783 "${testcvs} tag -r 1.1 tag5 file2.txt" \
4784 "T file2\.txt"
4785           cd ../..
4786           rm -fr rdiff-short
4787
4788           # 3) Different revision number with no difference.
4789           dotest rdiff-short-no-real-change \
4790 "${testcvs} -q rdiff -s -r tag1 -r tag3 abc"
4791
4792           # 4) Different revision number with changes.
4793           dotest rdiff-short-real-change \
4794 "${testcvs} -q rdiff -s -r tag1 -r tag2 abc" \
4795 'File abc/file1.txt changed from revision 1\.1 to 1\.2'
4796
4797           # 1) Added file.
4798           # 2) Removed file.
4799           dotest_sort rdiff-short-remove-add \
4800 "${testcvs} -q rdiff -s -r tag2 -r tag4 abc" \
4801 'File abc/file1\.txt is removed; tag2 revision 1\.2
4802 File abc/file2\.txt is new; tag4 revision 1\.1'
4803
4804           # 6) Same revision number (no difference).
4805           dotest rdiff-short-no-change \
4806 "${testcvs} -q rdiff -s -r tag4 -r tag5 abc"
4807
4808           # 5) Against trunk.
4809           # Check that the messages change when we diff against the trunk
4810           # rather than a tag or date.
4811           dotest rdiff-short-against-trunk-1 \
4812 "${testcvs} -q rdiff -s -rtag4 abc" \
4813 "File abc/file1\.txt is new; current revision 1\.3"
4814
4815           dotest rdiff-short-against-trunk-2 \
4816 "${testcvs} -q rdiff -s -rtag2 abc" \
4817 "File abc/file1\.txt changed from revision 1\.2 to 1\.3
4818 File abc/file2\.txt is new; current revision 1\.1"
4819
4820           rm -rf ${CVSROOT_DIRNAME}/abc
4821           ;;
4822
4823         rdiff2)
4824           # Test for the segv problem reported by James Cribb
4825           # Somewhere to work
4826           mkdir rdiff2; cd rdiff2         
4827           # Create a module "m" with files "foo" and "d/bar"
4828           mkdir m; cd m
4829           echo foo >foo
4830           mkdir d
4831           echo bar >d/bar
4832           dotest_sort  rdiff2-1 \
4833 "${testcvs} -q import -I ! -m initial-import m vendor initial" \
4834 '
4835
4836 N m/d/bar
4837 N m/foo
4838 No conflicts created by this import'
4839
4840           cd ..
4841           rm -r m
4842           
4843           # Remove "foo"
4844           dotest rdiff2-2 "${testcvs} get m" \
4845 "${PROG} checkout: Updating m
4846 U m/foo
4847 ${PROG} checkout: Updating m/d
4848 U m/d/bar"
4849           cd m
4850           dotest rdiff2-3 "${testcvs} rm -f foo" \
4851 "${PROG} remove: scheduling .foo. for removal
4852 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
4853
4854           dotest rdiff2-4 "${testcvs} commit -m Removed foo" \
4855 "Removing foo;
4856 ${CVSROOT_DIRNAME}/m/foo,v  <--  foo
4857 new revision: delete; previous revision: 1\.1\.1\.1
4858 done"
4859           
4860           # Modify "d/bar"
4861           echo foo >d/bar
4862           dotest rdiff2-5 "${testcvs} commit -m Changed d/bar" \
4863 "Checking in d/bar;
4864 ${CVSROOT_DIRNAME}/m/d/bar,v  <--  bar
4865 new revision: 1\.2; previous revision: 1\.1
4866 done"
4867           
4868           # Crash before showing d/bar diffs
4869           dotest_fail rdiff2-6 "${testcvs} rdiff -t m" \
4870 "${PROG} rdiff: Diffing m
4871 ${PROG} rdiff: Diffing m/d
4872 Index: m/d/bar
4873 diff -c m/d/bar:1\.1\.1\.1 m/d/bar:1\.2
4874 \*\*\* m/d/bar:1\.1\.1\.1       ${DATE}
4875 --- m/d/bar     ${DATE}
4876 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4877 \*\*\* 1 \*\*\*\*
4878 ! bar
4879 --- 1 ----
4880 ! foo"
4881           if $keep; then
4882                 echo Keeping ${TESTDIR} and exiting due to --keep
4883                 exit 0
4884           fi
4885           cd ../..
4886           rm -rf rdiff2
4887           rm -rf ${CVSROOT_DIRNAME}/m
4888           ;;
4889
4890         diff)
4891           # Various tests specific to the "cvs diff" command.
4892           # Related tests:
4893           #   death2: -N
4894           #   rcslib: cvs diff and $Name.
4895           #   rdiff: cvs rdiff.
4896           #   diffmerge*: nuts and bolts (stuff within diff library)
4897           mkdir 1; cd 1
4898           dotest diff-1 "${testcvs} -q co -l ." ''
4899           mkdir first-dir
4900           dotest diff-2 "${testcvs} add first-dir" \
4901 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4902           cd first-dir
4903
4904           # diff is anomalous.  Most CVS commands print the "nothing
4905           # known" message (or worse yet, no message in some cases) but
4906           # diff says "I know nothing".  Shrug.
4907           dotest_fail diff-3 "${testcvs} diff xyzpdq" \
4908 "${PROG} diff: I know nothing about xyzpdq"
4909           touch abc
4910           dotest diff-4 "${testcvs} add abc" \
4911 "${PROG} add: scheduling file .abc. for addition
4912 ${PROG} add: use .${PROG} commit. to add this file permanently"
4913           dotest diff-5 "${testcvs} -q ci -mtest" \
4914 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4915 done
4916 Checking in abc;
4917 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4918 initial revision: 1\.1
4919 done"
4920           echo "extern int gethostname ();" >abc
4921           dotest diff-6 "${testcvs} -q ci -mtest" \
4922 "Checking in abc;
4923 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4924 new revision: 1\.2; previous revision: 1\.1
4925 done"
4926           echo "#include <winsock.h>" >abc
4927           # check the behavior of the --ifdef=MACRO option
4928           dotest_fail diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \
4929 "Index: abc
4930 ===================================================================
4931 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4932 retrieving revision 1\.2
4933 diff --ifdef HAVE_WINSOCK_H -r1\.2 abc
4934 #ifndef HAVE_WINSOCK_H
4935 extern int gethostname ();
4936 #else /\* HAVE_WINSOCK_H \*/
4937 #include <winsock\.h>
4938 #endif /\* HAVE_WINSOCK_H \*/"
4939
4940           if $keep; then
4941             echo Keeping ${TESTDIR} and exiting due to --keep
4942             exit 0
4943           fi
4944
4945           cd ../..
4946           rm -rf ${CVSROOT_DIRNAME}/first-dir
4947           rm -r 1
4948           ;;
4949
4950         diffnl)
4951           # Test handling of 'cvs diff' of files without newlines
4952           mkdir 1; cd 1
4953           dotest diffnl-000 "${testcvs} -q co -l ." ''
4954           mkdir first-dir
4955           dotest diffnl-001 "${testcvs} add first-dir" \
4956 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4957           cd first-dir
4958
4959           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
4960           dotest diffnl-002 "${testcvs} add abc" \
4961 "${PROG} add: scheduling file .abc. for addition
4962 ${PROG} add: use .${PROG} commit. to add this file permanently"
4963           dotest diffnl-003 "${testcvs} -q ci -mtest" \
4964 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4965 done
4966 Checking in abc;
4967 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4968 initial revision: 1\.1
4969 done"
4970
4971           # change to line near EOF
4972           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nsix")}' </dev/null >abc
4973           dotest_fail diffnl-100 "${testcvs} diff abc" \
4974 "Index: abc
4975 ===================================================================
4976 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4977 retrieving revision 1\.1
4978 diff -r1\.1 abc
4979 5d4
4980 < five"
4981           dotest_fail diffnl-101 "${testcvs} diff -u abc" \
4982 "Index: abc
4983 ===================================================================
4984 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4985 retrieving revision 1\.1
4986 diff -u -r1\.1 abc
4987 --- abc ${RFCDATE}      1\.1
4988 +++ abc ${RFCDATE}
4989 @@ -2,5 +2,4 @@
4990  two
4991  three
4992  four
4993 -five
4994  six
4995 \\\\ No newline at end of file"
4996           dotest diffnl-102 "${testcvs} -q ci -mtest abc" \
4997 "Checking in abc;
4998 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4999 new revision: 1\.2; previous revision: 1\.1
5000 done"
5001
5002           # Change to last line
5003           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
5004           dotest_fail diffnl-200 "${testcvs} diff abc" \
5005 "Index: abc
5006 ===================================================================
5007 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5008 retrieving revision 1\.2
5009 diff -r1\.2 abc
5010 5c5
5011 < six
5012 \\\\ No newline at end of file
5013 ---
5014 > seven
5015 \\\\ No newline at end of file"
5016           dotest_fail diffnl-201 "${testcvs} diff -u abc" \
5017 "Index: abc
5018 ===================================================================
5019 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5020 retrieving revision 1\.2
5021 diff -u -r1\.2 abc
5022 --- abc ${RFCDATE}      1\.2
5023 +++ abc ${RFCDATE}
5024 @@ -2,4 +2,4 @@
5025  two
5026  three
5027  four
5028 -six
5029 \\\\ No newline at end of file
5030 +seven
5031 \\\\ No newline at end of file"
5032           dotest diffnl-202 "${testcvs} ci -mtest abc" \
5033 "Checking in abc;
5034 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
5035 new revision: 1\.3; previous revision: 1\.2
5036 done"
5037
5038           # Addition of newline
5039           echo "one
5040 two
5041 three
5042 four
5043 seven" > abc
5044           dotest_fail diffnl-300 "${testcvs} diff abc" \
5045 "Index: abc
5046 ===================================================================
5047 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5048 retrieving revision 1\.3
5049 diff -r1\.3 abc
5050 5c5
5051 < seven
5052 \\\\ No newline at end of file
5053 ---
5054 > seven"
5055           dotest_fail diffnl-301 "${testcvs} diff -u abc" \
5056 "Index: abc
5057 ===================================================================
5058 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5059 retrieving revision 1\.3
5060 diff -u -r1\.3 abc
5061 --- abc ${RFCDATE}      1\.3
5062 +++ abc ${RFCDATE}
5063 @@ -2,4 +2,4 @@
5064  two
5065  three
5066  four
5067 -seven
5068 \\\\ No newline at end of file
5069 +seven"
5070           dotest diffnl-302 "${testcvs} ci -mtest abc" \
5071 "Checking in abc;
5072 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
5073 new revision: 1\.4; previous revision: 1\.3
5074 done"
5075
5076           # Removal of newline
5077           ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
5078           dotest_fail diffnl-400 "${testcvs} diff abc" \
5079 "Index: abc
5080 ===================================================================
5081 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5082 retrieving revision 1\.4
5083 diff -r1\.4 abc
5084 5c5
5085 < seven
5086 ---
5087 > seven
5088 \\\\ No newline at end of file"
5089           dotest_fail diffnl-401 "${testcvs} diff -u abc" \
5090 "Index: abc
5091 ===================================================================
5092 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5093 retrieving revision 1\.4
5094 diff -u -r1\.4 abc
5095 --- abc ${RFCDATE}      1\.4
5096 +++ abc ${RFCDATE}
5097 @@ -2,4 +2,4 @@
5098  two
5099  three
5100  four
5101 -seven
5102 +seven
5103 \\\\ No newline at end of file"
5104         
5105           cd ../..
5106           rm -r 1
5107           rm -rf ${CVSROOT_DIRNAME}/first-dir
5108           ;;
5109
5110         death)
5111                 # next dive.  test death support.
5112
5113                 # NOTE: this section has reached the size and
5114                 # complexity where it is getting to be a good idea to
5115                 # add new death support tests to a new section rather
5116                 # than continuing to piggyback them onto the tests here.
5117
5118                 mkdir  ${CVSROOT_DIRNAME}/first-dir
5119                 if ${CVS} co first-dir  ; then
5120                     pass 65
5121                 else
5122                     fail 65
5123                 fi
5124
5125                 cd first-dir
5126
5127                 # Create a directory with only dead files, to make sure CVS
5128                 # doesn't get confused by it.
5129                 mkdir subdir
5130                 dotest 65a0 "${testcvs} add subdir" \
5131 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
5132                 cd subdir
5133                 echo file in subdir >sfile
5134                 dotest 65a1 "${testcvs} add sfile" \
5135 "${PROG}"' add: scheduling file `sfile'\'' for addition
5136 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5137                 dotest 65a2 "${testcvs} -q ci -m add-it" \
5138 "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
5139 done
5140 Checking in sfile;
5141 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
5142 initial revision: 1\.1
5143 done"
5144                 rm sfile
5145                 dotest 65a3 "${testcvs} rm sfile" \
5146 "${PROG}"' remove: scheduling `sfile'\'' for removal
5147 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
5148                 dotest 65a4 "${testcvs} -q ci -m remove-it" \
5149 "Removing sfile;
5150 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
5151 new revision: delete; previous revision: 1\.1
5152 done"
5153                 cd ..
5154                 dotest 65a5 "${testcvs} -q update -P" ''
5155                 dotest_fail 65a6 "test -d subdir" ''
5156
5157                 # add a file.
5158                 touch file1
5159                 if ${CVS} add file1  2>> ${LOGFILE}; then
5160                     pass 66
5161                 else
5162                     fail 66
5163                 fi
5164
5165                 # commit
5166                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
5167                     pass 67
5168                 else
5169                     fail 67
5170                 fi
5171
5172                 # remove
5173                 rm file1
5174                 if ${CVS} rm file1  2>> ${LOGFILE}; then
5175                     pass 68
5176                 else
5177                     fail 68
5178                 fi
5179
5180                 # commit
5181                 if ${CVS} ci -m test  >>${LOGFILE} ; then
5182                     pass 69
5183                 else
5184                     fail 69
5185                 fi
5186
5187                 dotest_fail 69a0 "test -f file1" ''
5188                 # get the old contents of file1 back
5189                 if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
5190                   pass 69a1
5191                 else
5192                   fail 69a1
5193                 fi
5194                 dotest 69a2 "cat file1" ''
5195
5196                 # create second file
5197                 touch file2
5198                 if ${CVS} add file1 file2  2>> ${LOGFILE}; then
5199                     pass 70
5200                 else
5201                     fail 70
5202                 fi
5203
5204                 # commit
5205                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
5206                     pass 71
5207                 else
5208                     fail 71
5209                 fi
5210
5211                 # log
5212                 if ${CVS} log file1  >> ${LOGFILE}; then
5213                     pass 72
5214                 else
5215                     fail 72
5216                 fi
5217
5218                 # file4 will be dead at the time of branching and stay dead.
5219                 echo file4 > file4
5220                 dotest death-file4-add "${testcvs} add file4" \
5221 "${PROG}"' add: scheduling file `file4'\'' for addition
5222 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5223                 dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
5224 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5225 done
5226 Checking in file4;
5227 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5228 initial revision: 1\.1
5229 done"
5230                 rm file4
5231                 dotest death-file4-rm "${testcvs} remove file4" \
5232 "${PROG}"' remove: scheduling `file4'\'' for removal
5233 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
5234                 dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
5235 "Removing file4;
5236 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5237 new revision: delete; previous revision: 1\.1
5238 done"
5239
5240                 # Tag the branchpoint.
5241                 dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
5242 T file2'
5243
5244                 # branch1
5245                 if ${CVS} tag -b branch1  ; then
5246                     pass 73
5247                 else
5248                     fail 73
5249                 fi
5250
5251                 # and move to the branch.
5252                 if ${CVS} update -r branch1  ; then
5253                     pass 74
5254                 else
5255                     fail 74
5256                 fi
5257
5258                 dotest_fail death-file4-3 "test -f file4" ''
5259
5260                 # add a file in the branch
5261                 echo line1 from branch1 >> file3
5262                 if ${CVS} add file3  2>> ${LOGFILE}; then
5263                     pass 75
5264                 else
5265                     fail 75
5266                 fi
5267
5268                 # commit
5269                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
5270                     pass 76
5271                 else
5272                     fail 76
5273                 fi
5274
5275                 dotest death-76a0 \
5276 "${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
5277 "Index: first-dir/file3
5278 diff -c /dev/null first-dir/file3:1\.1\.2\.1
5279 \*\*\* /dev/null        ${DATE}
5280 --- first-dir/file3     ${DATE}
5281 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5282 \*\*\* 0 \*\*\*\*
5283 --- 1 ----
5284 ${PLUS} line1 from branch1"
5285                 dotest death-76a1 \
5286 "${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
5287 "Index: first-dir/file3
5288 diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
5289 \*\*\* first-dir/file3:1\.1\.2\.1       ${DATE}
5290 --- first-dir/file3     ${DATE}
5291 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5292 \*\*\* 1 \*\*\*\*
5293 - line1 from branch1
5294 --- 0 ----"
5295
5296                 # remove
5297                 rm file3
5298                 if ${CVS} rm file3  2>> ${LOGFILE}; then
5299                     pass 77
5300                 else
5301                     fail 77
5302                 fi
5303
5304                 # commit
5305                 if ${CVS} ci -m test  >>${LOGFILE} ; then
5306                     pass 78
5307                 else
5308                     fail 78
5309                 fi
5310
5311                 # add again
5312                 echo line1 from branch1 >> file3
5313                 if ${CVS} add file3  2>> ${LOGFILE}; then
5314                     pass 79
5315                 else
5316                     fail 79
5317                 fi
5318
5319                 # commit
5320                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
5321                     pass 80
5322                 else
5323                     fail 80
5324                 fi
5325
5326                 # change the first file
5327                 echo line2 from branch1 >> file1
5328
5329                 # commit
5330                 if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
5331                     pass 81
5332                 else
5333                     fail 81
5334                 fi
5335
5336                 # remove the second
5337                 rm file2
5338                 if ${CVS} rm file2  2>> ${LOGFILE}; then
5339                     pass 82
5340                 else
5341                     fail 82
5342                 fi
5343
5344                 # commit
5345                 if ${CVS} ci -m test  >>${LOGFILE}; then
5346                     pass 83
5347                 else
5348                     fail 83
5349                 fi
5350
5351                 # back to the trunk.
5352                 if ${CVS} update -A  2>> ${LOGFILE}; then
5353                     pass 84
5354                 else
5355                     fail 84
5356                 fi
5357
5358                 dotest_fail death-file4-4 "test -f file4" ''
5359
5360                 if test -f file3 ; then
5361                     fail 85
5362                 else
5363                     pass 85
5364                 fi
5365
5366                 # join
5367                 dotest 86 "${testcvs} -q update -j branch1" \
5368 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5369 retrieving revision 1\.3
5370 retrieving revision 1\.3\.2\.1
5371 Merging differences between 1\.3 and 1\.3\.2\.1 into file1
5372 ${PROG} update: scheduling file2 for removal
5373 U file3"
5374
5375                 dotest_fail death-file4-5 "test -f file4" ''
5376
5377                 if test -f file3 ; then
5378                     pass 87
5379                 else
5380                     fail 87
5381                 fi
5382
5383                 # Make sure that we joined the correct change to file1
5384                 if echo line2 from branch1 | cmp - file1 >/dev/null; then
5385                     pass 87a
5386                 else
5387                     fail 87a
5388                 fi
5389
5390                 # update
5391                 if ${CVS} update  ; then
5392                     pass 88
5393                 else
5394                     fail 88
5395                 fi
5396
5397                 # commit
5398                 dotest 89 "${testcvs} -q ci -m test" \
5399 "Checking in file1;
5400 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5401 new revision: 1\.4; previous revision: 1\.3
5402 done
5403 Removing file2;
5404 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5405 new revision: delete; previous revision: 1\.1
5406 done
5407 Checking in file3;
5408 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
5409 new revision: 1\.2; previous revision: 1\.1
5410 done"
5411                 cd ..
5412                 mkdir 2
5413                 cd 2
5414                 dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
5415 U first-dir/file3'
5416                 cd ..
5417                 rm -r 2
5418                 cd first-dir
5419
5420                 # remove first file.
5421                 rm file1
5422                 if ${CVS} rm file1  2>> ${LOGFILE}; then
5423                     pass 90
5424                 else
5425                     fail 90
5426                 fi
5427
5428                 # commit
5429                 if ${CVS} ci -m test  >>${LOGFILE}; then
5430                     pass 91
5431                 else
5432                     fail 91
5433                 fi
5434
5435                 if test -f file1 ; then
5436                     fail 92
5437                 else
5438                     pass 92
5439                 fi
5440
5441                 # typo; try to get to the branch and fail
5442                 dotest_fail 92.1a "${testcvs} update -r brnach1" \
5443                   "${PROG}"' \[update aborted\]: no such tag brnach1'
5444                 # Make sure we are still on the trunk
5445                 if test -f file1 ; then
5446                     fail 92.1b
5447                 else
5448                     pass 92.1b
5449                 fi
5450                 if test -f file3 ; then
5451                     pass 92.1c
5452                 else
5453                     fail 92.1c
5454                 fi
5455
5456                 # back to branch1
5457                 if ${CVS} update -r branch1  2>> ${LOGFILE}; then
5458                     pass 93
5459                 else
5460                     fail 93
5461                 fi
5462
5463                 dotest_fail death-file4-6 "test -f file4" ''
5464
5465                 if test -f file1 ; then
5466                     pass 94
5467                 else
5468                     fail 94
5469                 fi
5470
5471                 # and join
5472                 dotest 95 "$testcvs -q update -j HEAD" \
5473 "$PROG update: file file1 has been removed in revision HEAD, but the destination is incompatibly modified
5474 C file1
5475 $PROG update: file file3 exists, but has been added in revision HEAD"
5476
5477                 dotest_fail death-file4-7 "test -f file4" ''
5478
5479                 # file2 should not have been recreated.  It was
5480                 # deleted on the branch, and has not been modified on
5481                 # the trunk.  That means that there have been no
5482                 # changes between the greatest common ancestor (the
5483                 # trunk version) and HEAD.
5484                 dotest_fail death-file2-1 "test -f file2" ''
5485
5486                 cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
5487                 ;;
5488
5489         death2)
5490           # More tests of death support.
5491           mkdir ${CVSROOT_DIRNAME}/first-dir
5492           dotest death2-1 "${testcvs} -q co first-dir" ''
5493
5494           cd first-dir
5495
5496           # Add two files on the trunk.
5497           echo "first revision" > file1
5498           echo "file4 first revision" > file4
5499           dotest death2-2 "${testcvs} add file1 file4" \
5500 "${PROG}"' add: scheduling file `file1'\'' for addition
5501 '"${PROG}"' add: scheduling file `file4'\'' for addition
5502 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
5503
5504           dotest death2-3 "${testcvs} -q commit -m add" \
5505 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5506 done
5507 Checking in file1;
5508 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5509 initial revision: 1\.1
5510 done
5511 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5512 done
5513 Checking in file4;
5514 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5515 initial revision: 1\.1
5516 done"
5517
5518           # Make a branch and a non-branch tag.
5519           dotest death2-4 "${testcvs} -q tag -b branch" \
5520 'T file1
5521 T file4'
5522           dotest death2-5 "${testcvs} -q tag tag" \
5523 'T file1
5524 T file4'
5525
5526           # Switch over to the branch.
5527           dotest death2-6 "$testcvs -q update -r branch" \
5528 '[UP] file1
5529 [UP] file4'
5530
5531           # Delete the file on the branch.
5532           rm file1
5533           dotest death2-7 "${testcvs} rm file1" \
5534 "${PROG} remove: scheduling .file1. for removal
5535 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5536
5537           # Test diff of the removed file before it is committed.
5538           dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
5539 "${PROG} diff: file1 was removed, no comparison available"
5540
5541           dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
5542 "Index: file1
5543 ===================================================================
5544 RCS file: file1
5545 diff -N file1
5546 \*\*\* file1    ${RFCDATE}      [0-9.]*
5547 --- /dev/null   ${RFCDATE_EPOCH}
5548 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5549 \*\*\* 1 \*\*\*\*
5550 - first revision
5551 --- 0 ----"
5552
5553           dotest death2-8 "${testcvs} -q ci -m removed" \
5554 "Removing file1;
5555 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5556 new revision: delete; previous revision: 1\.1
5557 done"
5558
5559           # Test diff of a dead file.
5560           dotest_fail death2-diff-3 \
5561 "${testcvs} -q diff -r1.1 -rbranch -c file1" \
5562 "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
5563 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5564           # and in reverse
5565           dotest_fail death2-diff-3a \
5566 "${testcvs} -q diff -rbranch -r1.1 -c file1" \
5567 "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
5568 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5569
5570           dotest_fail death2-diff-4 \
5571 "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
5572 "Index: file1
5573 ===================================================================
5574 RCS file: file1
5575 diff -N file1
5576 \*\*\* file1    ${RFCDATE}      [0-9.]*
5577 --- /dev/null   ${RFCDATE_EPOCH}
5578 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5579 \*\*\* 1 \*\*\*\*
5580 - first revision
5581 --- 0 ----"
5582           # and in reverse
5583           dotest_fail death2-diff-4a \
5584 "${testcvs} -q diff -rbranch -r1.1 -N -c file1" \
5585 "Index: file1
5586 ===================================================================
5587 RCS file: file1
5588 diff -N file1
5589 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5590 --- file1       ${RFCDATE}      [0-9.]*
5591 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5592 \*\*\* 0 \*\*\*\*
5593 --- 1 ----
5594 + first revision"
5595
5596
5597           dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \
5598 "${PROG} diff: file1 no longer exists, no comparison available"
5599
5600           dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \
5601 "Index: file1
5602 ===================================================================
5603 RCS file: file1
5604 diff -N file1
5605 \*\*\* file1    [-a-zA-Z0-9: ]* [0-9.]*
5606 --- /dev/null   ${RFCDATE_EPOCH}
5607 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5608 \*\*\* 1 \*\*\*\*
5609 - first revision
5610 --- 0 ----"
5611
5612           # Test rdiff of a dead file.
5613           dotest death2-rdiff-1 \
5614 "${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
5615
5616           dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
5617 "Index: first-dir/file1
5618 diff -c first-dir/file1:1\.1 first-dir/file1:removed
5619 \*\*\* first-dir/file1:1\.1     [a-zA-Z0-9: ]*
5620 --- first-dir/file1     [a-zA-Z0-9: ]*
5621 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5622 \*\*\* 1 \*\*\*\*
5623 - first revision
5624 --- 0 ----"
5625
5626           # Readd the file to the branch.
5627           echo "second revision" > file1
5628           dotest death2-9 "${testcvs} add file1" \
5629 "${PROG}"' add: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
5630 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5631
5632           # Test diff of the added file before it is committed.
5633           dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
5634 "${PROG} diff: file1 is a new entry, no comparison available"
5635
5636           dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \
5637 "Index: file1
5638 ===================================================================
5639 RCS file: file1
5640 diff -N file1
5641 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5642 --- file1       ${RFCDATE}
5643 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5644 \*\*\* 0 \*\*\*\*
5645 --- 1 ----
5646 ${PLUS} second revision"
5647
5648           dotest death2-10 "${testcvs} -q commit -m add" \
5649 "Checking in file1;
5650 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5651 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5652 done"
5653
5654           # Delete file4 from the branch
5655           dotest death2-10a "${testcvs} rm -f file4" \
5656 "${PROG} remove: scheduling .file4. for removal
5657 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5658           dotest death2-10b "${testcvs} -q ci -m removed" \
5659 "Removing file4;
5660 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5661 new revision: delete; previous revision: 1\.1
5662 done"
5663
5664           # Back to the trunk.
5665           dotest death2-11 "${testcvs} -q update -A" \
5666 "[UP] file1
5667 U file4"
5668
5669           # Add another file on the trunk.
5670           echo "first revision" > file2
5671           dotest death2-12 "${testcvs} add file2" \
5672 "${PROG}"' add: scheduling file `file2'\'' for addition
5673 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5674           dotest death2-13 "${testcvs} -q commit -m add" \
5675 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5676 done
5677 Checking in file2;
5678 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5679 initial revision: 1\.1
5680 done"
5681
5682           # Modify file4 on the trunk.
5683           echo "new file4 revision" > file4
5684           dotest death2-13a "${testcvs} -q commit -m mod" \
5685 "Checking in file4;
5686 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5687 new revision: 1\.2; previous revision: 1\.1
5688 done"
5689
5690           # Back to the branch.
5691           # The ``no longer in the repository'' message doesn't really
5692           # look right to me, but that's what CVS currently prints for
5693           # this case.
5694           dotest death2-14 "${testcvs} -q update -r branch" \
5695 "[UP] file1
5696 ${PROG} update: file2 is no longer in the repository
5697 ${PROG} update: file4 is no longer in the repository"
5698
5699           # Add a file on the branch with the same name.
5700           echo "branch revision" > file2
5701           dotest death2-15 "${testcvs} add file2" \
5702 "${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
5703 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5704           dotest death2-16 "${testcvs} -q commit -m add" \
5705 "Checking in file2;
5706 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5707 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5708 done"
5709
5710           # Add a new file on the branch.
5711           echo "first revision" > file3
5712           dotest death2-17 "${testcvs} add file3" \
5713 "${PROG}"' add: scheduling file `file3'\'' for addition on branch `branch'\''
5714 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
5715           dotest death2-18 "${testcvs} -q commit -m add" \
5716 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
5717 done
5718 Checking in file3;
5719 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
5720 new revision: 1\.1\.2\.1; previous revision: 1\.1
5721 done"
5722
5723           # Test diff of a nonexistent tag
5724           dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \
5725 "${PROG} diff: tag tag is not in file file3"
5726
5727           dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \
5728 "Index: file3
5729 ===================================================================
5730 RCS file: file3
5731 diff -N file3
5732 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5733 --- file3       ${RFCDATE}      [0-9.]*
5734 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5735 \*\*\* 0 \*\*\*\*
5736 --- 1 ----
5737 ${PLUS} first revision"
5738
5739           dotest_fail death2-diff-11 "${testcvs} -q diff -rtag -c ." \
5740 "Index: file1
5741 ===================================================================
5742 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5743 retrieving revision 1\.1
5744 retrieving revision 1\.1\.2\.2
5745 diff -c -r1\.1 -r1\.1\.2\.2
5746 \*\*\* file1    ${RFCDATE}      [0-9.]*
5747 --- file1       ${RFCDATE}      [0-9.]*
5748 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5749 \*\*\* 1 \*\*\*\*
5750 ! first revision
5751 --- 1 ----
5752 ! second revision
5753 ${PROG} diff: tag tag is not in file file2
5754 ${PROG} diff: tag tag is not in file file3
5755 ${PROG} diff: file4 no longer exists, no comparison available"
5756
5757           dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \
5758 "Index: file1
5759 ===================================================================
5760 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5761 retrieving revision 1\.1
5762 retrieving revision 1\.1\.2\.2
5763 diff -c -r1\.1 -r1\.1\.2\.2
5764 \*\*\* file1    ${RFCDATE}      [0-9.]*
5765 --- file1       ${RFCDATE}      [0-9.]*
5766 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5767 \*\*\* 1 \*\*\*\*
5768 ! first revision
5769 --- 1 ----
5770 ! second revision
5771 Index: file2
5772 ===================================================================
5773 RCS file: file2
5774 diff -N file2
5775 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5776 --- file2       ${RFCDATE}      [0-9.]*
5777 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5778 \*\*\* 0 \*\*\*\*
5779 --- 1 ----
5780 ${PLUS} branch revision
5781 Index: file3
5782 ===================================================================
5783 RCS file: file3
5784 diff -N file3
5785 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5786 --- file3       ${RFCDATE}      [0-9.]*
5787 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5788 \*\*\* 0 \*\*\*\*
5789 --- 1 ----
5790 ${PLUS} first revision
5791 Index: file4
5792 ===================================================================
5793 RCS file: file4
5794 diff -N file4
5795 \*\*\* file4    ${RFCDATE}      [0-9.]*
5796 --- /dev/null   ${RFCDATE_EPOCH}
5797 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5798 \*\*\* 1 \*\*\*\*
5799 - file4 first revision
5800 --- 0 ----"
5801
5802           # Switch to the nonbranch tag.
5803           dotest death2-19 "${testcvs} -q update -r tag" \
5804 "[UP] file1
5805 ${PROG} update: file2 is no longer in the repository
5806 ${PROG} update: file3 is no longer in the repository
5807 U file4"
5808
5809           dotest_fail death2-20 "test -f file2"
5810
5811           # Make sure diff only reports appropriate files.
5812           dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \
5813 "${PROG} diff: Tag rdiff-tag refers to a dead (removed) revision in file .file1.\.
5814 ${PROG} diff: No comparison available\.  Pass .-N. to .${PROG} diff.${QUESTION}"
5815
5816           dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \
5817 "Index: file1
5818 ===================================================================
5819 RCS file: file1
5820 diff -N file1
5821 \*\*\* /dev/null        ${RFCDATE_EPOCH}
5822 --- file1       ${RFCDATE}      [0-9.]*
5823 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5824 \*\*\* 0 \*\*\*\*
5825 --- 1 ----
5826 ${PLUS} first revision"
5827
5828           # now back to the trunk
5829           dotest death2-21 "$testcvs -q update -A" \
5830 '[UP] file1
5831 U file2
5832 U file4'
5833
5834           # test merging with a dead file
5835           dotest death2-22 "${testcvs} -q co first-dir" \
5836 "U first-dir/file1
5837 U first-dir/file2
5838 U first-dir/file4"
5839
5840           cd first-dir
5841           dotest death2-23 "${testcvs} rm -f file4" \
5842 "${PROG} remove: scheduling .file4. for removal
5843 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
5844           dotest death2-24 "${testcvs} -q ci -m removed file4" \
5845 "Removing file4;
5846 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5847 new revision: delete; previous revision: 1\.2
5848 done"
5849           cd ..
5850           echo "new stuff" >file4
5851           dotest_fail death2-25 "${testcvs} up file4" \
5852 "${PROG} update: conflict: file4 is modified but no longer in the repository
5853 C file4"
5854
5855           cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
5856           ;;
5857
5858
5859
5860         death-rtag)
5861           # This documents a bug in CVS that prevents rtag from tagging files
5862           # in the Attic.
5863           mkdir $CVSROOT_DIRNAME/death-rtag
5864           dotest death-rtag-init-1 "$testcvs -Q co death-rtag"
5865           cd death-rtag
5866           echo "This is the file foo" > foo
5867           echo "This is the file bar" > bar
5868           dotest death-rtag-init-2 "$testcvs -Q add foo bar"
5869           dotest death-rtag-init-3 "$testcvs -Q ci -m 'Add foo and bar.'" \
5870 "RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v
5871 done
5872 Checking in bar;
5873 $CVSROOT_DIRNAME/death-rtag/bar,v  <--  bar
5874 initial revision: 1\.[0-9]*
5875 done
5876 RCS file: $CVSROOT_DIRNAME/death-rtag/foo,v
5877 done
5878 Checking in foo;
5879 $CVSROOT_DIRNAME/death-rtag/foo,v  <--  foo
5880 initial revision: 1\.[0-9]*
5881 done"
5882           dotest death-rtag-init-5 "$testcvs -Q tag -b mybranch"
5883
5884           dotest death-rtag-1 "$testcvs -q rtag -rmybranch willtag death-rtag"
5885           dotest death-rtag-2 "$testcvs -Q rm -f foo"
5886           dotest death-rtag-3 "$testcvs -Q ci -m 'Remove foo.'" \
5887 "Removing foo;
5888 $CVSROOT_DIRNAME/death-rtag/foo,v  <--  foo
5889 new revision: delete; previous revision: 1\.[0-9]*
5890 done"
5891           # commit something on the branch so that the moving tag is visible.
5892           dotest death-rtag-3.2 "$testcvs -Q up -rmybranch"
5893           echo some branch content >>foo
5894           echo some branch content >>bar
5895           dotest death-rtag-3.3 "$testcvs -Q ci -m 'Change foo.'" \
5896 "Checking in bar;
5897 $CVSROOT_DIRNAME/death-rtag/bar,v  <--  bar
5898 new revision: 1\.1\.2\.1; previous revision: 1\.1
5899 done
5900 Checking in foo;
5901 $CVSROOT_DIRNAME/death-rtag/Attic/foo,v  <--  foo
5902 new revision: 1\.1\.2\.1; previous revision: 1\.1
5903 done"
5904           dotest death-rtag-3.4 \
5905 "$testcvs -q rtag -rmybranch wontmove death-rtag"
5906           dotest death-rtag-3.5 "$testcvs -q rtag -F wontmove death-rtag"
5907
5908           cd ..
5909           # Removing -f below avoids this bug.
5910           dotest death-rtag-4 "$testcvs -q rtag -frmybranch wonttag death-rtag"
5911
5912           # When the bug existed, `wonttag' would not have been present in
5913           # foo,v.
5914           #
5915           # A second bug prevented `wontmove' from moving from the branch to
5916           # the dead revision on the trunk (death-rtag-3.4 & death-rtag-3.5).
5917           dotest death-rtag-5 "$testcvs -q rlog death-rtag" \
5918 "
5919 RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v
5920 head: 1.[0-9]*
5921 branch:
5922 locks: strict
5923 access list:
5924 symbolic names:
5925         wonttag: 1\.1\.2\.1
5926         wontmove: 1\.1
5927         willtag: 1\.1
5928         mybranch: 1\.1.0\.2
5929 keyword substitution: kv
5930 $DOTSTAR
5931 RCS file: $CVSROOT_DIRNAME/death-rtag/Attic/foo,v
5932 head: 1.[0-9]*
5933 branch:
5934 locks: strict
5935 access list:
5936 symbolic names:
5937         wonttag: 1\.1\.2\.1
5938         wontmove: 1\.2
5939         willtag: 1\.1
5940         mybranch: 1\.1.0\.2
5941 keyword substitution: kv
5942 $DOTSTAR"
5943
5944           if $keep; then
5945             echo Keeping $TESTDIR and exiting due to --keep
5946             exit 0
5947           fi
5948
5949           rm -r death-rtag
5950           rm -rf $CVSROOT_DIRNAME/death-rtag
5951           ;;
5952
5953
5954
5955         rm-update-message)
5956           # FIXME
5957           # local CVS prints a warning message when update notices a missing
5958           # file and client/server CVS doesn't.  These should be identical.
5959           mkdir rm-update-message; cd rm-update-message
5960           mkdir $CVSROOT_DIRNAME/rm-update-message
5961           dotest rm-update-message-setup-1 "$testcvs -q co rm-update-message" ''
5962           cd rm-update-message
5963           file=x
5964           echo >$file
5965           dotest rm-update-message-setup-2 "$testcvs -q add $file" \
5966 "${PROG} add: use .${PROG} commit. to add this file permanently"
5967           dotest rm-update-message-setup-3 "$testcvs -q ci -mcreate $file" \
5968 "RCS file: $CVSROOT_DIRNAME/rm-update-message/$file,v
5969 done
5970 Checking in $file;
5971 $CVSROOT_DIRNAME/rm-update-message/$file,v  <--  $file
5972 initial revision: 1\.1
5973 done"
5974
5975           rm $file
5976           dotest rm-update-message-1 "$testcvs up $file" \
5977 "${PROG} update: warning: $file was lost
5978 U $file"
5979
5980           cd ../..
5981           if $keep; then :; else
5982             rm -rf rm-update-message
5983             rm -rf $CVSROOT_DIRNAME/rm-update-message
5984           fi
5985           ;;
5986
5987         rmadd)
5988           # More tests of adding and removing files.
5989           # In particular ci -r.
5990           # Other ci -r tests:
5991           #   * editor-9: checking in a modified file,
5992           #     where "ci -r" means a branch.
5993           #   * basica-8a1: checking in a modified file with numeric revision.
5994           #   * basica-8a2: likewise.
5995           #   * keywordlog-4: adding a new file with numeric revision.
5996           mkdir 1; cd 1
5997           dotest rmadd-1 "${testcvs} -q co -l ." ''
5998           mkdir first-dir
5999           dotest rmadd-2 "${testcvs} add first-dir" \
6000 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6001           cd first-dir
6002           echo first file1 >file1
6003           dotest rmadd-3 "${testcvs} add file1" \
6004 "${PROG} add: scheduling file .file1. for addition
6005 ${PROG} add: use .${PROG} commit. to add this file permanently"
6006
6007           dotest_fail rmadd-4 "${testcvs} -q ci -r 1.2.2.4 -m add" \
6008 "${PROG} commit: cannot add file .file1' with revision .1\.2\.2\.4'; must be on trunk
6009 ${PROG} \[commit aborted\]: correct above errors first!"
6010           dotest_fail rmadd-5 "${testcvs} -q ci -r 1.2.2 -m add" \
6011 "${PROG} commit: cannot add file .file1' with revision .1\.2\.2'; must be on trunk
6012 ${PROG} \[commit aborted\]: correct above errors first!"
6013           dotest_fail rmadd-6 "${testcvs} -q ci -r mybranch -m add" \
6014 "${PROG} \[commit aborted\]: no such tag mybranch"
6015
6016           # The thing with the trailing periods strikes me as a very
6017           # bizarre behavior, but it would seem to be intentional
6018           # (see commit.c).  It probably could go away....
6019           dotest rmadd-7 "${testcvs} -q ci -r 7.... -m add" \
6020 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6021 done
6022 Checking in file1;
6023 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6024 initial revision: 7\.1
6025 done"
6026           if $remote; then
6027             # I guess remote doesn't set a sticky tag in this case.
6028             # Kind of odd, in the sense that rmadd-24a does set one
6029             # both local and remote.
6030             dotest_fail rmadd-7a "test -f CVS/Tag"
6031             echo T7 >CVS/Tag
6032           else
6033             dotest rmadd-7a "cat CVS/Tag" "T7"
6034           fi
6035
6036           dotest rmadd-8 "${testcvs} -q tag -b mybranch" "T file1"
6037           dotest rmadd-9 "${testcvs} -q tag mynonbranch" "T file1"
6038
6039           touch file2
6040           # The previous "cvs ci -r" set a sticky tag of '7'.  Seems a
6041           # bit odd, and I guess commit.c (findmaxrev) makes '7' sticky
6042           # tags unnecessary (?).  I kind of suspect that it should be
6043           # saying "sticky tag is not a branch" like keywordlog-4b.
6044           # Or something.
6045           dotest rmadd-10 "${testcvs} add file2" \
6046 "${PROG} add: scheduling file .file2. for addition on branch .7'
6047 ${PROG} add: use .${PROG} commit. to add this file permanently"
6048           # As in the previous example, CVS is confused....
6049           dotest rmadd-11 "${testcvs} -q ci -m add" \
6050 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6051 done
6052 Checking in file2;
6053 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6054 initial revision: 7\.1
6055 done"
6056
6057           dotest rmadd-12 "${testcvs} -q update -A" ""
6058           touch file3
6059           dotest rmadd-13 "${testcvs} add file3" \
6060 "${PROG} add: scheduling file .file3. for addition
6061 ${PROG} add: use .${PROG} commit. to add this file permanently"
6062           # Huh?  file2 is not up to date?  Seems buggy to me....
6063           dotest_fail rmadd-14 "${testcvs} -q ci -r mybranch -m add" \
6064 "${PROG} commit: Up-to-date check failed for .file2'
6065 ${PROG} \[commit aborted\]: correct above errors first!"
6066           # Whatever, let's not let file2 distract us....
6067           dotest rmadd-15 "${testcvs} -q ci -r mybranch -m add file3" \
6068 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
6069 done
6070 Checking in file3;
6071 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
6072 new revision: 1\.1\.2\.1; previous revision: 1\.1
6073 done"
6074
6075           touch file4
6076           dotest rmadd-16 "${testcvs} add file4" \
6077 "${PROG} add: scheduling file .file4. for addition
6078 ${PROG} add: use .${PROG} commit. to add this file permanently"
6079           # Same "Up-to-date check" issues as in rmadd-14.
6080           # The "no such tag" thing is due to the fact that we only
6081           # update val-tags when the tag is used (might be more of a
6082           # bug than a feature, I dunno).
6083           dotest_fail rmadd-17 \
6084 "${testcvs} -q ci -r mynonbranch -m add file4" \
6085 "${PROG} \[commit aborted\]: no such tag mynonbranch"
6086           # Try to make CVS write val-tags.
6087           dotest rmadd-18 "${testcvs} -q update -p -r mynonbranch file1" \
6088 "first file1"
6089           # Oops, -p suppresses writing val-tags (probably a questionable
6090           # behavior).
6091           dotest_fail rmadd-19 \
6092 "${testcvs} -q ci -r mynonbranch -m add file4" \
6093 "${PROG} \[commit aborted\]: no such tag mynonbranch"
6094           # Now make CVS write val-tags for real.
6095           dotest rmadd-20 "$testcvs -q update -r mynonbranch file1" '[UP] file1'
6096           # Oops - CVS isn't distinguishing between a branch tag and
6097           # a non-branch tag.
6098           dotest rmadd-21 \
6099 "${testcvs} -q ci -r mynonbranch -m add file4" \
6100 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v
6101 done
6102 Checking in file4;
6103 ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v  <--  file4
6104 new revision: 1\.1\.2\.1; previous revision: 1\.1
6105 done"
6106
6107           # OK, we add this one in a vanilla way, but then check in
6108           # a modification with ci -r and sniff around for sticky tags.
6109           echo file5 >file5
6110           dotest rmadd-22 "${testcvs} add file5" \
6111 "${PROG} add: scheduling file .file5. for addition
6112 ${PROG} add: use .${PROG} commit. to add this file permanently"
6113           if $remote; then
6114             # Interesting bug (or missing feature) here.  findmaxrev
6115             # gets the major revision from the Entries.  Well, remote
6116             # doesn't send the entries for files which are not involved.
6117             dotest rmadd-23r "${testcvs} -q ci -m add" \
6118 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
6119 done
6120 Checking in file5;
6121 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6122 initial revision: 1\.1
6123 done"
6124             dotest rmadd-23-workaroundr \
6125 "${testcvs} -q ci -r 7 -m bump-it file5" \
6126 "Checking in file5;
6127 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6128 new revision: 7\.1; previous revision: 1\.1
6129 done"
6130           else
6131             dotest rmadd-23 "${testcvs} -q ci -m add" \
6132 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
6133 done
6134 Checking in file5;
6135 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6136 initial revision: 7\.1
6137 done"
6138           fi
6139           echo change it >file5
6140           dotest_fail rmadd-24 "${testcvs} -q ci -r 4.8 -m change file5" \
6141 "Checking in file5;
6142 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6143 ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/file5,v: revision 4\.8 too low; must be higher than 7\.1
6144 ${PROG} commit: could not check in file5"
6145           dotest rmadd-24a "${testcvs} -q ci -r 8.4 -m change file5" \
6146 "Checking in file5;
6147 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6148 new revision: 8\.4; previous revision: 7\.1
6149 done"
6150           # I'm not really sure that a sticky tag make sense here.
6151           # It seems to be longstanding behavior for what that is worth.
6152           dotest rmadd-25 "${testcvs} status file5" \
6153 "===================================================================
6154 File: file5             Status: Up-to-date
6155
6156    Working revision:    8\.4.*
6157    Repository revision: 8\.4    ${CVSROOT_DIRNAME}/first-dir/file5,v
6158    Sticky Tag:          8\.4
6159    Sticky Date:         (none)
6160    Sticky Options:      (none)"
6161
6162           # now try forced revision with recursion
6163           mkdir sub
6164           dotest rmadd-26 "${testcvs} -q add sub" \
6165 "Directory ${CVSROOT_DIRNAME}/first-dir/sub added to the repository"
6166           echo hello >sub/subfile
6167           dotest rmadd-27 "${testcvs} -q add sub/subfile" \
6168 "${PROG} add: use .${PROG} commit. to add this file permanently"
6169
6170           dotest rmadd-28 "${testcvs} -q ci -m. sub" \
6171 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v
6172 done
6173 Checking in sub/subfile;
6174 ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
6175 initial revision: 1\.1
6176 done"
6177
6178           # lose the branch
6179           dotest rmadd-29 "$testcvs -q up -A" \
6180 "[UP] file1
6181 $PROG update: file3 is no longer in the repository
6182 $PROG update: file4 is no longer in the repository"
6183
6184           # -f disables recursion
6185           dotest rmadd-30 "${testcvs} -q ci -f -r9 -m." \
6186 "Checking in file1;
6187 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6188 new revision: 9\.1; previous revision: 7\.1
6189 done
6190 Checking in file2;
6191 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6192 new revision: 9\.1; previous revision: 7\.1
6193 done
6194 Checking in file5;
6195 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6196 new revision: 9\.1; previous revision: 8\.4
6197 done"
6198
6199           # add -R to force recursion
6200           dotest rmadd-31 "${testcvs} -q ci -f -r9 -R -m." \
6201 "Checking in file1;
6202 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6203 new revision: 9\.2; previous revision: 9\.1
6204 done
6205 Checking in file2;
6206 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6207 new revision: 9\.2; previous revision: 9\.1
6208 done
6209 Checking in file5;
6210 ${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6211 new revision: 9\.2; previous revision: 9\.1
6212 done
6213 Checking in sub/subfile;
6214 ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
6215 new revision: 9\.1; previous revision: 1\.1
6216 done"
6217
6218           if $remote; then
6219             # as noted above, remote doesn't set a sticky tag
6220             :
6221           else
6222             dotest rmadd-32 "cat CVS/Tag" "T9"
6223             dotest rmadd-33 "cat sub/CVS/Tag" "T9"
6224           fi
6225
6226           cd ../..
6227           rm -r 1
6228           rm -rf ${CVSROOT_DIRNAME}/first-dir
6229           ;;
6230
6231         rmadd2)
6232           # Tests of undoing commits, including in the presence of
6233           # adding and removing files.  See join for a list of -j tests.
6234           mkdir 1; cd 1
6235           dotest rmadd2-1 "${testcvs} -q co -l ." ''
6236           mkdir first-dir
6237           dotest rmadd2-2 "${testcvs} add first-dir" \
6238 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6239           cd first-dir
6240           echo 'initial contents' >file1
6241           dotest rmadd2-3 "${testcvs} add file1" \
6242 "${PROG} add: scheduling file .file1. for addition
6243 ${PROG} add: use .${PROG} commit. to add this file permanently"
6244           dotest rmadd2-4 "${testcvs} -q ci -m add" \
6245 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6246 done
6247 Checking in file1;
6248 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6249 initial revision: 1\.1
6250 done"
6251           dotest rmadd2-4a "${testcvs} -Q tag tagone" ""
6252           dotest rmadd2-5 "${testcvs} rm -f file1" \
6253 "${PROG} remove: scheduling .file1. for removal
6254 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
6255           dotest rmadd2-6 "${testcvs} -q ci -m remove" \
6256 "Removing file1;
6257 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6258 new revision: delete; previous revision: 1\.1
6259 done"
6260           dotest rmadd2-7 "${testcvs} -q update -j 1.2 -j 1.1 file1" "U file1"
6261           dotest rmadd2-8 "${testcvs} -q ci -m readd" \
6262 "Checking in file1;
6263 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6264 new revision: 1\.3; previous revision: 1\.2
6265 done"
6266           echo 'new contents' >file1
6267           dotest rmadd2-9 "${testcvs} -q ci -m modify" \
6268 "Checking in file1;
6269 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6270 new revision: 1\.4; previous revision: 1\.3
6271 done"
6272           dotest rmadd2-10 "${testcvs} -q update -j 1.4 -j 1.3 file1" \
6273 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6274 retrieving revision 1\.4
6275 retrieving revision 1\.3
6276 Merging differences between 1\.4 and 1\.3 into file1"
6277           dotest rmadd2-11 "${testcvs} -q ci -m undo" \
6278 "Checking in file1;
6279 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6280 new revision: 1\.5; previous revision: 1\.4
6281 done"
6282           dotest rmadd2-12 "cat file1" "initial contents"
6283           dotest rmadd2-13 "${testcvs} -q update -p -r 1.3" "initial contents"
6284
6285           # Hmm, might be a bit odd that this works even if 1.3 is not
6286           # the head.
6287           dotest rmadd2-14 "${testcvs} -q update -j 1.3 -j 1.2 file1" \
6288 "${PROG} update: scheduling file1 for removal"
6289
6290           # Check that -p can get arbitrary revisions of a removed file
6291           dotest rmadd2-14a "${testcvs} -q update -p" "initial contents"
6292           dotest rmadd2-14b "${testcvs} -q update -p -r 1.5" "initial contents"
6293           dotest rmadd2-14c "${testcvs} -q update -p -r 1.3" "initial contents"
6294
6295           dotest rmadd2-15 "${testcvs} -q ci -m re-remove" \
6296 "Removing file1;
6297 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6298 new revision: delete; previous revision: 1\.5
6299 done"
6300           dotest rmadd2-16 "${testcvs} log -h file1" "
6301 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
6302 Working file: file1
6303 head: 1\.6
6304 branch:
6305 locks: strict
6306 access list:
6307 symbolic names:
6308         tagone: 1\.1
6309 keyword substitution: kv
6310 total revisions: 6
6311 ============================================================================="
6312           dotest rmadd2-17 "${testcvs} status -v file1" \
6313 "===================================================================
6314 File: no file file1             Status: Up-to-date
6315
6316    Working revision:    No entry for file1
6317    Repository revision: 1\.6    ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
6318
6319    Existing Tags:
6320         tagone                          (revision: 1.1)"
6321
6322           cd ../..
6323
6324           rm -r 1
6325           rm -rf ${CVSROOT_DIRNAME}/first-dir
6326           ;;
6327
6328         rmadd3)
6329           # This test demonstrates that CVS notices that file1 exists rather
6330           # that deleting or writing over it after:
6331           #
6332           #   cvs remove -f file1; touch file1; cvs add file1.
6333           #
6334           # According to the manual, this should work for:
6335           #
6336           #   rm file1; cvs remove file1; cvs add file1
6337           #
6338           # but in past version of CVS, new content in file1 would be
6339           # erroneously deleted when file1 reappeared between the remove and
6340           # the add.
6341           #
6342           # Later versions of CVS would refuse to perform the add, but still
6343           # allow a subsequent local commit to erase the file from the
6344           # workspace, possibly losing data.
6345           mkdir 1; cd 1
6346           dotest rmadd3-init1 "${testcvs} -q co -l ." ''
6347           mkdir first-dir
6348           dotest rmadd3-init2 "${testcvs} add first-dir" \
6349 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6350           cd first-dir
6351
6352           echo initial content for file1 >file1
6353           dotest rmadd3-init3 "${testcvs} add file1" \
6354 "${PROG} add: scheduling file \`file1' for addition
6355 ${PROG} add: use '${PROG} commit' to add this file permanently"
6356           dotest rmadd3-init4 "${testcvs} -q ci -m add" \
6357 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6358 done
6359 Checking in file1;
6360 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6361 initial revision: 1\.1
6362 done"
6363
6364           # Here begins the guts of this test, as detailed above.
6365           dotest rmadd3-1 "${testcvs} rm -f file1" \
6366 "${PROG} remove: scheduling \`file1' for removal
6367 ${PROG} remove: use '${PROG} commit' to remove this file permanently"
6368
6369           # Now recreate the file:
6370           echo desired future contents for file1 >file1
6371
6372           # And attempt to resurrect it at the same time:
6373           dotest_fail rmadd3-2 "${testcvs} add file1" \
6374 "${PROG} add: file1 should be removed and is still there (or is back again)"
6375
6376           # Now prove that commit knows that it shouldn't erase files.
6377           dotest_fail rmadd3-3 "${testcvs} -q ci -m." \
6378 "$PROG commit: \`file1' should be removed and is still there (or is back again)
6379 $PROG \[commit aborted\]: correct above errors first!"
6380
6381           # Then these should pass too:
6382           dotest rmadd3-4 "test -f file1"
6383           dotest rmadd3-5 "cat file1" "desired future contents for file1"
6384
6385           if $keep; then
6386             echo Keeping ${TESTDIR} and exiting due to --keep
6387             exit 0
6388           fi
6389
6390           cd ../..
6391           rm -r 1
6392           rm -rf ${CVSROOT_DIRNAME}/first-dir
6393           ;;
6394
6395         resurrection)
6396           # This test tests a few file resurrection scenarios.
6397           mkdir 1; cd 1
6398           dotest resurrection-init1 "$testcvs -q co -l ." ''
6399           mkdir first-dir
6400           dotest resurrection-init2 "$testcvs add first-dir" \
6401 "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
6402           cd first-dir
6403
6404           echo initial content for file1 >file1
6405           dotest resurrection-init3 "$testcvs add file1" \
6406 "$PROG add: scheduling file \`file1' for addition
6407 $PROG add: use '$PROG commit' to add this file permanently"
6408           dotest resurrection-init4 "$testcvs -q ci -m add" \
6409 "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
6410 done
6411 Checking in file1;
6412 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6413 initial revision: 1\.1
6414 done"
6415
6416           dotest resurrection-init5 "$testcvs -Q rm -f file1"
6417
6418           # The first test is that `cvs add' will resurrect a file before its
6419           # removal has been committed.
6420           dotest_sort resurrection-1 "$testcvs add file1" \
6421 "U file1
6422 $PROG add: file1, version 1\.1, resurrected"
6423           dotest resurrection-2 "$testcvs -Q diff file1" ""
6424
6425           dotest resurrection-init6 "$testcvs -Q tag -b resurrection"
6426           dotest resurrection-init7 "$testcvs -Q rm -f file1"
6427           dotest resurrection-init8 "$testcvs -Q ci -mrm" \
6428 "Removing file1;
6429 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6430 new revision: delete; previous revision: 1\.1
6431 done"
6432
6433           # The next test is that CVS will resurrect a committed removal.
6434           dotest_sort resurrection-3 "$testcvs add file1" \
6435 "U file1
6436 $PROG add: Re-adding file \`file1' (in place of dead revision 1\.2)\.
6437 $PROG add: Resurrecting file \`file1' from revision 1\.1\.
6438 $PROG add: use 'cvs commit' to add this file permanently"
6439           dotest resurrection-4 "$testcvs -q diff -r1.1 file1" ""
6440           dotest resurrection-5 "$testcvs -q ci -mreadd" \
6441 "Checking in file1;
6442 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6443 new revision: 1\.3; previous revision: 1\.2
6444 done"
6445
6446           dotest resurrection-init9 "$testcvs -Q up -rresurrection"
6447           dotest resurrection-init10 "$testcvs -Q rm -f file1"
6448           dotest resurrection-init11 "$testcvs -Q ci -mrm-on-resurrection" \
6449 "Removing file1;
6450 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6451 new revision: delete; previous revision: 1\.1
6452 done"
6453
6454           # The next test is that CVS will resurrect a committed removal to a
6455           # branch.
6456           dotest_sort resurrection-6 "$testcvs add file1" \
6457 "U file1
6458 $PROG add: Resurrecting file \`file1' from revision 1\.1\.
6459 $PROG add: file \`file1' will be added on branch \`resurrection' from version 1\.1\.2\.1
6460 $PROG add: use 'cvs commit' to add this file permanently"
6461           dotest resurrection-7 "$testcvs -Q diff -r1.1 file1" ""
6462           dotest resurrection-8 "$testcvs -q ci -mreadd" \
6463 "Checking in file1;
6464 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6465 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
6466 done"
6467
6468           # The next few tests verify that an attempted resurrection of a file
6469           # with no previous revision on the trunk fails.
6470           touch file2
6471           dotest resurrection-9 "$testcvs -Q add file2"
6472           dotest resurrection-10 "$testcvs -Q ci -mnew-file2" \
6473 "RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file2,v
6474 done
6475 Checking in file2;
6476 $CVSROOT_DIRNAME/first-dir/Attic/file2,v  <--  file2
6477 new revision: 1\.1\.2\.1; previous revision: 1\.1
6478 done"
6479           dotest resurrection-11 "$testcvs -Q up -A"
6480
6481           # This command once caused an assertion failure.
6482           dotest resurrection-12 "$testcvs add file2" \
6483 "$PROG add: File \`file2' has no previous revision to resurrect\."
6484
6485           if $keep; then
6486             echo Keeping $TESTDIR and exiting due to --keep
6487             exit 0
6488           fi
6489
6490           cd ../..
6491           rm -r 1
6492           rm -rf $CVSROOT_DIRNAME/first-dir
6493           ;;
6494
6495         dirs)
6496           # Tests related to removing and adding directories.
6497           # See also:
6498           #   conflicts (especially dir1 in conflicts-130): What happens if
6499           #     directory exists in repository and a non-CVS-controlled
6500           #     directory in the working directory?
6501           #   conflicts3-15.  More cases, especially where CVS directory
6502           #     exists but without CVS/Repository and friends.
6503           #   conflicts3-22.  Similar to conflicts-130 but there is a file
6504           #     in the directory.
6505           #   dirs2.  Sort of similar to conflicts3-22 but somewhat different.
6506           mkdir imp-dir; cd imp-dir
6507           echo file1 >file1
6508           mkdir sdir
6509           echo sfile >sdir/sfile
6510           dotest_sort dirs-1 \
6511 "${testcvs} import -m import-it dir1 vend rel" "
6512
6513 N dir1/file1
6514 N dir1/sdir/sfile
6515 No conflicts created by this import
6516 ${PROG} import: Importing ${CVSROOT_DIRNAME}/dir1/sdir"
6517           cd ..
6518
6519           mkdir 1; cd 1
6520           dotest dirs-2 "${testcvs} -Q co dir1" ""
6521
6522           # Various CVS administrators are in the habit of removing
6523           # the repository directory for things they don't want any
6524           # more.  I've even been known to do it myself (on rare
6525           # occasions).  Not the usual recommended practice, but we want
6526           # to try to come up with some kind of reasonable/documented/sensible
6527           # behavior.
6528           rm -rf ${CVSROOT_DIRNAME}/dir1/sdir
6529
6530           dotest dirs-3 "${testcvs} update" \
6531 "${PROG} update: Updating dir1
6532 ${PROG} update: Updating dir1/sdir
6533 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
6534 ${PROG} update: skipping directory dir1/sdir"
6535           dotest dirs-3a "${testcvs} update -d" \
6536 "${PROG} update*: Updating dir1
6537 ${PROG} update: Updating dir1/sdir
6538 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
6539 ${PROG} update: skipping directory dir1/sdir"
6540
6541           # If we say "yes", then CVS gives errors about not being able to
6542           # create lock files.
6543           # The fact that it says "skipping directory " rather than
6544           # "skipping directory dir1/sdir" is some kind of bug.
6545           dotest dirs-4 "echo no | ${testcvs} release -d dir1/sdir" \
6546 "${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
6547 ${PROG} update: skipping directory 
6548 You have \[0\] altered files in this repository\.
6549 Are you sure you want to release (and delete) directory .dir1/sdir': .. .release' aborted by user choice."
6550
6551           # OK, if "cvs release" won't help, we'll try it the other way...
6552           rm -r dir1/sdir
6553
6554           dotest dirs-5 "cat dir1/CVS/Entries" \
6555 "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
6556 D/sdir////"
6557           dotest dirs-6 "${testcvs} update" "${PROG} update: Updating dir1"
6558           dotest dirs-7 "cat dir1/CVS/Entries" \
6559 "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
6560 D/sdir////"
6561           dotest dirs-8 "${testcvs} update -d dir1" \
6562 "${PROG} update: Updating dir1"
6563
6564           cd ..
6565
6566           rm -r imp-dir 1
6567
6568           # clean up our repositories
6569           rm -rf ${CVSROOT_DIRNAME}/dir1
6570           ;;
6571
6572         dirs2)
6573           # See "dirs" for a list of tests involving adding and
6574           # removing directories.
6575           mkdir 1; cd 1
6576           dotest dirs2-1 "${testcvs} -q co -l ." ''
6577           mkdir first-dir
6578           dotest dirs2-2 "${testcvs} add first-dir" \
6579 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
6580           cd first-dir
6581           mkdir sdir
6582           dotest dirs2-3 "${testcvs} add sdir" \
6583 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
6584           touch sdir/file1
6585           dotest dirs2-4 "${testcvs} add sdir/file1" \
6586 "${PROG} add: scheduling file .sdir/file1. for addition
6587 ${PROG} add: use .${PROG} commit. to add this file permanently"
6588           dotest dirs2-5 "${testcvs} -q ci -m add" \
6589 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v
6590 done
6591 Checking in sdir/file1;
6592 ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
6593 initial revision: 1\.1
6594 done"
6595           rm -r sdir/CVS
6596           if $remote; then
6597             # This is just like conflicts3-23
6598             dotest_fail dirs2-6 "${testcvs} update -d" \
6599 "${QUESTION} sdir
6600 ${PROG} update: Updating \.
6601 ${PROG} update: Updating sdir
6602 ${PROG} update: move away sdir/file1; it is in the way
6603 C sdir/file1"
6604             rm sdir/file1
6605             rm -r sdir/CVS
6606
6607             # This is where things are not just like conflicts3-23
6608             dotest dirs2-7 "${testcvs} update -d" \
6609 "${QUESTION} sdir
6610 ${PROG} update: Updating \.
6611 ${PROG} update: Updating sdir
6612 U sdir/file1"
6613           else
6614             dotest dirs2-6 "${testcvs} update -d" \
6615 "${PROG} update: Updating \.
6616 ${QUESTION} sdir"
6617             rm sdir/file1
6618             dotest dirs2-7 "${testcvs} update -d" \
6619 "${PROG} update: Updating \.
6620 ${QUESTION} sdir"
6621           fi
6622           cd ../..
6623
6624           # Now, the same thing (more or less) on a branch.
6625           mkdir 2; cd 2
6626           dotest dirs2-8 "${testcvs} -q co first-dir" 'U first-dir/sdir/file1'
6627           cd first-dir
6628           dotest dirs2-9 "${testcvs} -q tag -b br" "T sdir/file1"
6629           rm -r sdir/CVS
6630           if $remote; then
6631             # Cute little quirk of val-tags; if we don't recurse into
6632             # the directories where the tag is defined, val-tags won't
6633             # get updated.
6634             dotest_fail dirs2-10 "${testcvs} update -d -r br" \
6635 "${QUESTION} sdir
6636 ${PROG} \[update aborted\]: no such tag br"
6637             dotest dirs2-10ar \
6638 "${testcvs} -q rdiff -u -r 1.1 -r br first-dir/sdir/file1"
6639             dotest_fail dirs2-10-again "${testcvs} update -d -r br" \
6640 "${QUESTION} sdir
6641 ${PROG} update: Updating \.
6642 ${PROG} update: Updating sdir
6643 ${PROG} update: move away sdir/file1; it is in the way
6644 C sdir/file1"
6645           else
6646             dotest_fail dirs2-10 "${testcvs} update -d -r br" \
6647 "${PROG} update: in directory sdir:
6648 ${PROG} \[update aborted\]: there is no version here; do '${PROG} checkout' first"
6649           fi
6650           cd ../..
6651
6652           # OK, the above tests make the situation somewhat harder
6653           # than it might be, in the sense that they actually have a
6654           # file which is alive on the branch we are updating.  Let's
6655           # try it where it is just a directory where all the files
6656           # have been removed.
6657           mkdir 3; cd 3
6658           dotest dirs2-11 "${testcvs} -q co -r br first-dir" \
6659 "U first-dir/sdir/file1"
6660           cd first-dir
6661           # Hmm, this doesn't mention the branch like add does.  That's
6662           # an odd non-orthogonality.
6663           dotest dirs2-12 "${testcvs} rm -f sdir/file1" \
6664 "${PROG} remove: scheduling .sdir/file1. for removal
6665 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
6666           dotest dirs2-13 "${testcvs} -q ci -m remove" \
6667 "Removing sdir/file1;
6668 ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
6669 new revision: delete; previous revision: 1\.1
6670 done"
6671           cd ../../2/first-dir
6672           if $remote; then
6673             dotest dirs2-14 "${testcvs} update -d -r br" \
6674 "${QUESTION} sdir/file1
6675 ${PROG} update: Updating \.
6676 ${PROG} update: Updating sdir"
6677           else
6678             dotest dirs2-14 "${testcvs} update -d -r br" \
6679 "${PROG} update: Updating \.
6680 ${QUESTION} sdir"
6681           fi
6682           cd ../..
6683
6684           rm -r 1 2 3
6685           rm -rf ${CVSROOT_DIRNAME}/first-dir
6686           ;;
6687
6688         branches)
6689           # More branch tests, including branches off of branches
6690           mkdir ${CVSROOT_DIRNAME}/first-dir
6691           dotest branches-1 "${testcvs} -q co first-dir" ''
6692           cd first-dir
6693           echo 1:ancest >file1
6694           echo 2:ancest >file2
6695           echo 3:ancest >file3
6696           echo 4:trunk-1 >file4
6697           dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
6698 "${PROG}"' add: scheduling file `file1'\'' for addition
6699 '"${PROG}"' add: scheduling file `file2'\'' for addition
6700 '"${PROG}"' add: scheduling file `file3'\'' for addition
6701 '"${PROG}"' add: scheduling file `file4'\'' for addition
6702 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
6703           dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
6704           dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
6705 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6706 done
6707 Checking in file1;
6708 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6709 initial revision: 1.1
6710 done
6711 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6712 done
6713 Checking in file2;
6714 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6715 initial revision: 1.1
6716 done
6717 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6718 done
6719 Checking in file3;
6720 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6721 initial revision: 1.1
6722 done
6723 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6724 done
6725 Checking in file4;
6726 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6727 initial revision: 1.1
6728 done
6729 HERE
6730           echo 4:trunk-2 >file4
6731           dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
6732 "Checking in file4;
6733 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6734 new revision: 1\.2; previous revision: 1\.1
6735 done"
6736           # The "cvs log file4" in test branches-14.3 will test that we
6737           # didn't really add the tag.
6738           dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
6739 "T file1
6740 T file2
6741 T file3
6742 T file4"
6743           # Modify this file before branching, to deal with the case where
6744           # someone is hacking along, says "oops, I should be doing this on
6745           # a branch", and only then creates the branch.
6746           echo 1:br1 >file1
6747           dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' tag: Tagging \.
6748 T file1
6749 T file2
6750 T file3
6751 T file4'
6752           dotest branches-5 "$testcvs update -r br1" \
6753 "$PROG update: Updating \.
6754 M file1
6755 [UP] file2
6756 [UP] file3
6757 [UP] file4"
6758           echo 2:br1 >file2
6759           echo 4:br1 >file4
6760           dotest branches-6 "${testcvs} -q ci -m modify" \
6761 "Checking in file1;
6762 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6763 new revision: 1\.1\.2\.1; previous revision: 1\.1
6764 done
6765 Checking in file2;
6766 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6767 new revision: 1\.1\.2\.1; previous revision: 1\.1
6768 done
6769 Checking in file4;
6770 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6771 new revision: 1\.2\.2\.1; previous revision: 1\.2
6772 done"
6773           dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
6774 T file2
6775 T file3
6776 T file4'
6777           dotest branches-8 "$testcvs -q update -r brbr" \
6778 '[UP] file1
6779 [UP] file2
6780 [UP] file3
6781 [UP] file4'
6782           echo 1:brbr >file1
6783           echo 4:brbr >file4
6784           dotest branches-9 "${testcvs} -q ci -m modify" \
6785 "Checking in file1;
6786 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6787 new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
6788 done
6789 Checking in file4;
6790 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6791 new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
6792 done"
6793           dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
6794 2:br1
6795 3:ancest
6796 4:brbr'
6797           dotest branches-11 "$testcvs -q update -r br1" \
6798 'U file1
6799 [UP] file2
6800 [UP] file3
6801 U file4'
6802           dotest branches-12 "cat file1 file2 file3 file4" '1:br1
6803 2:br1
6804 3:ancest
6805 4:br1'
6806           echo 4:br1-2 >file4
6807           dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
6808 "Checking in file4;
6809 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6810 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
6811 done"
6812           dotest branches-13 "${testcvs} -q update -A" \
6813 'U file1
6814 U file2
6815 [UP] file3
6816 U file4'
6817           dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
6818 2:ancest
6819 3:ancest
6820 4:trunk-2'
6821           echo 4:trunk-3 >file4
6822           dotest branches-14.2 \
6823             "${testcvs} -q ci -m trunk-change-after-branch" \
6824 "Checking in file4;
6825 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6826 new revision: 1\.3; previous revision: 1\.2
6827 done"
6828           dotest branches-14.3 "${testcvs} log file4" \
6829 "
6830 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6831 Working file: file4
6832 head: 1\.3
6833 branch:
6834 locks: strict
6835 access list:
6836 symbolic names:
6837         brbr: 1\.2\.2\.1\.0\.2
6838         br1: 1\.2\.0\.2
6839 keyword substitution: kv
6840 total revisions: 6;     selected revisions: 6
6841 description:
6842 ----------------------------
6843 revision 1\.3
6844 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6845 trunk-change-after-branch
6846 ----------------------------
6847 revision 1\.2
6848 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6849 branches:  1\.2\.2;
6850 trunk-before-branch
6851 ----------------------------
6852 revision 1\.1
6853 date: [0-9/: ]*;  author: ${username};  state: Exp;
6854 add-it
6855 ----------------------------
6856 revision 1\.2\.2\.2
6857 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6858 change-on-br1
6859 ----------------------------
6860 revision 1\.2\.2\.1
6861 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6862 branches:  1\.2\.2\.1\.2;
6863 modify
6864 ----------------------------
6865 revision 1\.2\.2\.1\.2\.1
6866 date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6867 modify
6868 ============================================================================="
6869           dotest_fail branches-14.4 \
6870             "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
6871 "Index: file4
6872 ===================================================================
6873 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6874 retrieving revision 1\.1
6875 retrieving revision 1\.3
6876 diff -c -r1\.1 -r1\.3
6877 \*\*\* file4    ${RFCDATE}      1\.1
6878 --- file4       ${RFCDATE}      1\.3
6879 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6880 \*\*\* 1 \*\*\*\*
6881 ! 4:trunk-1
6882 --- 1 ----
6883 ! 4:trunk-3"
6884           dotest_fail branches-14.5 \
6885             "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
6886 "Index: file4
6887 ===================================================================
6888 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6889 retrieving revision 1\.1
6890 retrieving revision 1\.2\.2\.1
6891 diff -c -r1\.1 -r1\.2\.2\.1
6892 \*\*\* file4    ${RFCDATE}      1\.1
6893 --- file4       ${RFCDATE}      1\.2\.2\.1
6894 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
6895 \*\*\* 1 \*\*\*\*
6896 ! 4:trunk-1
6897 --- 1 ----
6898 ! 4:br1"
6899           dotest branches-15 \
6900             "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
6901             "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6902 retrieving revision 1\.1\.2\.1
6903 retrieving revision 1\.1\.2\.1\.2\.1
6904 Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
6905 rcsmerge: warning: conflicts during merge"
6906           dotest branches-16 "cat file1" '<<<<<<< file1
6907 1:ancest
6908 [=]======
6909 1:brbr
6910 [>]>>>>>> 1\.1\.2\.1\.2\.1'
6911
6912           dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
6913 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6914 done
6915 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6916 done
6917 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6918 done
6919 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6920 done"
6921           cd ..
6922
6923           if $keep; then
6924             echo Keeping ${TESTDIR} and exiting due to --keep
6925             exit 0
6926           fi
6927
6928           rm -rf ${CVSROOT_DIRNAME}/first-dir
6929           rm -r first-dir
6930           ;;
6931
6932         branches2)
6933           # More branch tests.
6934           # Test that when updating a new subdirectory in a directory
6935           # which was checked out on a branch, the new subdirectory is
6936           # created on the appropriate branch.  Test this when joining
6937           # as well.
6938
6939           mkdir ${CVSROOT_DIRNAME}/first-dir
6940           mkdir trunk; cd trunk
6941
6942           # Create a file.
6943           dotest branches2-1 "${testcvs} -q co first-dir"
6944           cd first-dir
6945           echo "file1 first revision" > file1
6946           dotest branches2-2 "${testcvs} add file1" \
6947 "${PROG} add: scheduling file .file1. for addition
6948 ${PROG} add: use .${PROG} commit. to add this file permanently"
6949           dotest branches2-3 "${testcvs} commit -m add file1" \
6950 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6951 done
6952 Checking in file1;
6953 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6954 initial revision: 1\.1
6955 done"
6956
6957           # Tag the file.
6958           dotest branches2-4 "${testcvs} -q tag tag1" 'T file1'
6959
6960           # Make two branches.
6961           dotest branches2-5 "${testcvs} -q rtag -b -r tag1 b1 first-dir" ''
6962           dotest branches2-6 "${testcvs} -q rtag -b -r tag1 b2 first-dir" ''
6963
6964           # Create some files and a subdirectory on branch b1.
6965           cd ../..
6966           mkdir b1; cd b1
6967           dotest branches2-7 "${testcvs} -q co -r b1 first-dir" \
6968 "U first-dir/file1"
6969           cd first-dir
6970           echo "file2 first revision" > file2
6971           dotest branches2-8 "${testcvs} add file2" \
6972 "${PROG}"' add: scheduling file `file2'\'' for addition on branch `b1'\''
6973 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6974           mkdir dir1
6975           dotest branches2-9 "${testcvs} add dir1" \
6976 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository
6977 --> Using per-directory sticky tag "'`'"b1'"
6978           echo "file3 first revision" > dir1/file3
6979           dotest branches2-10 "${testcvs} add dir1/file3" \
6980 "${PROG}"' add: scheduling file `dir1/file3'\'' for addition on branch `b1'\''
6981 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
6982           dotest branches2-11 "${testcvs} -q ci -madd ." \
6983 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
6984 done
6985 Checking in file2;
6986 ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
6987 new revision: 1\.1\.2\.1; previous revision: 1\.1
6988 done
6989 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6990 done
6991 Checking in dir1/file3;
6992 ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v  <--  file3
6993 new revision: 1\.1\.2\.1; previous revision: 1\.1
6994 done"
6995
6996           # Check out the second branch, and update the working
6997           # directory to the first branch, to make sure the right
6998           # happens with dir1.
6999           cd ../..
7000           mkdir b2; cd b2
7001           dotest branches2-12 "${testcvs} -q co -r b2 first-dir" \
7002 'U first-dir/file1'
7003           cd first-dir
7004           dotest branches2-13 "${testcvs} update -d -r b1 dir1" \
7005 "${PROG} update: Updating dir1
7006 U dir1/file3"
7007           dotest branches2-14 "${testcvs} -q status" \
7008 "===================================================================
7009 File: file1             Status: Up-to-date
7010
7011    Working revision:    1\.1.*
7012    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
7013    Sticky Tag:          b2 (branch: 1\.1\.4)
7014    Sticky Date:         (none)
7015    Sticky Options:      (none)
7016
7017 ===================================================================
7018 File: file3             Status: Up-to-date
7019
7020    Working revision:    1\.1\.2\.1.*
7021    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
7022    Sticky Tag:          b1 (branch: 1\.1\.2)
7023    Sticky Date:         (none)
7024    Sticky Options:      (none)"
7025
7026           # FIXME: Just clobbering the directory like this is a bit
7027           # tacky, although people generally expect it to work.  Maybe
7028           # we should release it instead.  We do it a few other places
7029           # below as well.
7030           rm -r dir1
7031           dotest branches2-15 "${testcvs} update -d -j b1 dir1" \
7032 "${PROG} update: Updating dir1
7033 U dir1/file3"
7034           # FIXCVS: The `No revision control file' stuff seems to be
7035           # CVS's way of telling us that we're adding the file on a
7036           # branch, and the file is not on that branch yet.  This
7037           # should be nicer.
7038           dotest branches2-16 "${testcvs} -q status" \
7039 "===================================================================
7040 File: file1             Status: Up-to-date
7041
7042    Working revision:    1\.1.*
7043    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
7044    Sticky Tag:          b2 (branch: 1\.1\.4)
7045    Sticky Date:         (none)
7046    Sticky Options:      (none)
7047
7048 ===================================================================
7049 File: file3             Status: Locally Added
7050
7051    Working revision:    New file!
7052    Repository revision: No revision control file
7053    Sticky Tag:          b2 - MISSING from RCS file!
7054    Sticky Date:         (none)
7055    Sticky Options:      (none)"
7056
7057           cd ../../trunk/first-dir
7058           dotest branches2-17 "${testcvs} update -d -P dir1" \
7059 "${PROG} update: Updating dir1"
7060           dotest_fail branches2-18 "test -d dir1"
7061           dotest branches2-19 "${testcvs} update -d -P -r b1 dir1" \
7062 "${PROG} update: Updating dir1
7063 U dir1/file3"
7064           dotest branches2-20 "${testcvs} -q status" \
7065 "===================================================================
7066 File: file1             Status: Up-to-date
7067
7068    Working revision:    1\.1.*
7069    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
7070    Sticky Tag:          (none)
7071    Sticky Date:         (none)
7072    Sticky Options:      (none)
7073
7074 ===================================================================
7075 File: file3             Status: Up-to-date
7076
7077    Working revision:    1\.1\.2\.1.*
7078    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
7079    Sticky Tag:          b1 (branch: 1\.1\.2)
7080    Sticky Date:         (none)
7081    Sticky Options:      (none)"
7082
7083           rm -r dir1
7084           dotest branches2-21 "${testcvs} update -d -P -j b1 dir1" \
7085 "${PROG} update: Updating dir1
7086 U dir1/file3"
7087           dotest branches2-22 "${testcvs} -q status" \
7088 "===================================================================
7089 File: file1             Status: Up-to-date
7090
7091    Working revision:    1\.1.*
7092    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
7093    Sticky Tag:          (none)
7094    Sticky Date:         (none)
7095    Sticky Options:      (none)
7096
7097 ===================================================================
7098 File: file3             Status: Locally Added
7099
7100    Working revision:    New file!
7101    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
7102    Sticky Tag:          (none)
7103    Sticky Date:         (none)
7104    Sticky Options:      (none)"
7105
7106           cd ../..
7107           rm -r b1 b2
7108
7109           # Check out branch b1 twice.  Crate a new directory in one
7110           # working directory, then do a cvs update in the other
7111           # working directory and see if the tags are right.
7112           mkdir b1a
7113           mkdir b1b
7114           cd b1b
7115           dotest branches2-23 "${testcvs} -q co -r b1 first-dir" \
7116 'U first-dir/file1
7117 U first-dir/file2
7118 U first-dir/dir1/file3'
7119           cd ../b1a
7120           dotest branches2-24 "${testcvs} -q co -r b1 first-dir" \
7121 'U first-dir/file1
7122 U first-dir/file2
7123 U first-dir/dir1/file3'
7124           cd first-dir
7125           mkdir dir2
7126           dotest branches2-25 "${testcvs} add dir2" \
7127 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository
7128 --> Using per-directory sticky tag "'`'"b1'"
7129           echo "file4 first revision" > dir2/file4
7130           dotest branches2-26 "${testcvs} add dir2/file4" \
7131 "${PROG}"' add: scheduling file `dir2/file4'\'' for addition on branch `b1'\''
7132 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
7133           dotest branches2-27 "${testcvs} -q commit -madd" \
7134 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
7135 done
7136 Checking in dir2/file4;
7137 ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v  <--  file4
7138 new revision: 1\.1\.2\.1; previous revision: 1\.1
7139 done"
7140
7141           cd ../../b1b/first-dir
7142           dotest branches2-28 "${testcvs} update -d dir2" \
7143 "${PROG} update: Updating dir2
7144 U dir2/file4"
7145           cd dir2
7146           dotest branches2-29 "${testcvs} -q status" \
7147 "===================================================================
7148 File: file4             Status: Up-to-date
7149
7150    Working revision:    1\.1\.2\.1.*
7151    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
7152    Sticky Tag:          b1 (branch: 1\.1\.2)
7153    Sticky Date:         (none)
7154    Sticky Options:      (none)"
7155           dotest branches2-30 "cat CVS/Tag" 'Tb1'
7156
7157           # Test update -A on a subdirectory
7158           cd ..
7159           rm -r dir2
7160           dotest branches2-31 "${testcvs} update -A -d dir2" \
7161 "${PROG} update: Updating dir2"
7162           cd dir2
7163           dotest branches2-32 "${testcvs} -q status" ''
7164           dotest_fail branches2-33 "test -f CVS/Tag"
7165
7166           # Add a file on the trunk.
7167           echo "file5 first revision" > file5
7168           dotest branches2-34 "${testcvs} add file5" \
7169 "${PROG}"' add: scheduling file `file5'\'' for addition
7170 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
7171           dotest branches2-35 "${testcvs} -q commit -madd" \
7172 "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
7173 done
7174 Checking in file5;
7175 ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v  <--  file5
7176 initial revision: 1\.1
7177 done"
7178
7179           cd ../../../trunk/first-dir
7180           dotest branches2-36 "${testcvs} -q update -d dir2" 'U dir2/file5'
7181           cd dir2
7182           dotest branches2-37 "${testcvs} -q status" \
7183 "===================================================================
7184 File: file5             Status: Up-to-date
7185
7186    Working revision:    1\.1.*
7187    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
7188    Sticky Tag:          (none)
7189    Sticky Date:         (none)
7190    Sticky Options:      (none)"
7191           dotest_fail branches2-38 "test -f CVS/status"
7192
7193           cd ../../..
7194           rm -rf ${CVSROOT_DIRNAME}/first-dir
7195           rm -r trunk b1a b1b
7196           ;;
7197
7198         tagc)
7199           # Test the tag -c option.
7200           mkdir 1; cd 1
7201           dotest tagc-1 "${testcvs} -q co -l ." ''
7202           mkdir first-dir
7203           dotest tagc-2 "${testcvs} add first-dir" \
7204 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
7205           cd first-dir
7206           touch file1 file2
7207           dotest tagc-3 "${testcvs} add file1 file2" \
7208 "${PROG} add: scheduling file .file1. for addition
7209 ${PROG} add: scheduling file .file2. for addition
7210 ${PROG} add: use .${PROG} commit. to add these files permanently"
7211           dotest tagc-4 "${testcvs} -q ci -m add" \
7212 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7213 done
7214 Checking in file1;
7215 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7216 initial revision: 1\.1
7217 done
7218 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7219 done
7220 Checking in file2;
7221 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7222 initial revision: 1\.1
7223 done"
7224           dotest tagc-5 "${testcvs} -q tag -c tag1" \
7225 "T file1
7226 T file2"
7227           touch file1 file2
7228           dotest tagc-6 "${testcvs} -q tag -c tag2" \
7229 "T file1
7230 T file2"
7231           # Avoid timestamp granularity bugs (FIXME: CVS should be
7232           # doing the sleep, right?).
7233           sleep 1
7234           echo myedit >>file1
7235           dotest tagc-6a "${testcvs} rm -f file2" \
7236 "${PROG} remove: scheduling .file2. for removal
7237 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
7238           touch file3
7239           dotest tagc-6b "${testcvs} add file3" \
7240 "${PROG} add: scheduling file .file3. for addition
7241 ${PROG} add: use .${PROG} commit. to add this file permanently"
7242           dotest_fail tagc-7 "${testcvs} -q tag -c tag3" \
7243 "${PROG} tag: file1 is locally modified
7244 ${PROG} tag: file2 is locally modified
7245 ${PROG} tag: file3 is locally modified
7246 ${PROG} \[tag aborted\]: correct the above errors first!"
7247           cd ../..
7248           mkdir 2
7249           cd 2
7250           dotest tagc-8 "${testcvs} -q co first-dir" \
7251 "U first-dir/file1
7252 U first-dir/file2"
7253           cd ../1/first-dir
7254           dotest tagc-9 "${testcvs} -q ci -m modify" \
7255 "Checking in file1;
7256 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7257 new revision: 1\.2; previous revision: 1\.1
7258 done
7259 Removing file2;
7260 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7261 new revision: delete; previous revision: 1\.1
7262 done
7263 RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
7264 done
7265 Checking in file3;
7266 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
7267 initial revision: 1\.1
7268 done"
7269           cd ../../2/first-dir
7270           dotest tagc-10 "${testcvs} -q tag -c tag4" \
7271 "${PROG} tag: file2 is no longer in the repository
7272 T file1
7273 T file2"
7274           cd ../..
7275
7276           rm -r 1 2
7277           rm -rf ${CVSROOT_DIRNAME}/first-dir
7278           ;;
7279
7280         update-p)
7281           # Make sure `cvs update -p -rT FILE' works from a branch when
7282           # FILE is already on the trunk and is being added to that branch.
7283
7284           mkdir 1; cd 1
7285           module=x
7286
7287           echo > unused-file
7288
7289           # Create the module.
7290           dotest update-p-1 \
7291             "$testcvs -Q import -m. $module X Y" ''
7292
7293           file=F
7294           # Check it out and tag it.
7295           dotest update-p-2 "$testcvs -Q co $module" ''
7296           cd $module
7297           dotest update-p-3 "$testcvs -Q tag -b B" ''
7298           echo v1 > $file
7299           dotest update-p-4 "$testcvs -Q add $file" ''
7300           dotest update-p-5 "$testcvs -Q ci -m. $file" \
7301 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
7302 done
7303 Checking in $file;
7304 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
7305 initial revision: 1\.1
7306 done"
7307           dotest update-p-6 "$testcvs -Q tag T $file" ''
7308           dotest update-p-7 "$testcvs -Q update -rB" ''
7309
7310           # This merge effectively adds file F on branch B.
7311           dotest update-p-8 "$testcvs -Q update -jT" ''
7312
7313           # Before the fix that prompted the addition of this test,
7314           # the following command would fail with this diagnostic:
7315           # cvs update: conflict: F created independently by second party
7316           dotest update-p-9 "$testcvs update -p -rT $file" \
7317 "===================================================================
7318 Checking out $file
7319 RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
7320 VERS: 1\.1
7321 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7322 v1"
7323
7324           # Repeat the above, but with $file removed.
7325           # This exercises a slightly different code path.
7326           rm $file
7327           # Before the fix that prompted the addition of this test,
7328           # the following command would fail with this diagnostic:
7329           # cvs update: warning: new-born F has disappeared
7330           dotest update-p-10 "$testcvs update -p -rT $file" \
7331 "===================================================================
7332 Checking out $file
7333 RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
7334 VERS: 1\.1
7335 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7336 v1"
7337
7338           # Exercise yet another code path:
7339           # the one that involves reviving a `dead' file.
7340           # And a little more, for good measure...
7341           touch new
7342           dotest update-p-a1 "$testcvs -Q add new" ''
7343           dotest update-p-a2 "$testcvs -Q update -p new" ''
7344           dotest update-p-a3 "$testcvs -Q rm -f new" ''
7345
7346           # Both an update -A, *and* the following update are required
7347           # to return to the state of being on the trunk with a $file
7348           # that we can then remove.
7349           dotest update-p-undead-0 "$testcvs update -A" \
7350 "$PROG update: Updating \.
7351 $PROG update: warning: new-born $file has disappeared
7352 [UP] unused-file"
7353           dotest update-p-undead-1 "$testcvs update" \
7354 "${PROG} update: Updating \.
7355 U $file"
7356           dotest update-p-undead-2 "$testcvs -Q update -p -rT $file" v1
7357           dotest update-p-undead-3 "$testcvs -Q rm -f $file" ''
7358           dotest update-p-undead-4 "$testcvs -Q update -p -rT $file" v1
7359           dotest update-p-undead-5 "$testcvs -Q ci -m. $file" \
7360 "Removing $file;
7361 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
7362 new revision: delete; previous revision: 1\.1
7363 done"
7364           dotest update-p-undead-6 "$testcvs -Q update -p -rT $file" v1
7365           echo v2 > $file
7366           dotest update-p-undead-7 "$testcvs -Q update -p -rT $file" v1
7367           dotest update-p-undead-8 "$testcvs add $file" \
7368 "${PROG} add: Re-adding file .$file. (in place of dead revision 1\.2)\.
7369 ${PROG} add: use .${PROG} commit. to add this file permanently"
7370
7371           dotest update-p-undead-9 "$testcvs -Q update -p -rT $file" v1
7372
7373           cd ../..
7374           rm -rf 1
7375           rm -rf ${CVSROOT_DIRNAME}/$module
7376           ;;
7377
7378         tagf)
7379           # More tagging tests, including using tag -F -B to convert a
7380           # branch tag to a regular tag and recovering thereof.
7381
7382           # Setup; check in first-dir/file1
7383           mkdir 1; cd 1
7384           dotest tagf-1 "${testcvs} -q co -l ." ''
7385           mkdir first-dir
7386           dotest tagf-2 "${testcvs} add first-dir" \
7387 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
7388           cd first-dir
7389           touch file1 file2
7390           dotest tagf-3 "${testcvs} add file1 file2" \
7391 "${PROG} add: scheduling file .file1. for addition
7392 ${PROG} add: scheduling file .file2. for addition
7393 ${PROG} add: use .${PROG} commit. to add these files permanently"
7394           dotest tagf-4 "${testcvs} -q ci -m add" \
7395 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7396 done
7397 Checking in file1;
7398 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7399 initial revision: 1\.1
7400 done
7401 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7402 done
7403 Checking in file2;
7404 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7405 initial revision: 1\.1
7406 done"
7407
7408           # Now create a branch and commit a revision there.
7409           dotest tagf-5 "${testcvs} -q tag -b br" "T file1
7410 T file2"
7411           dotest tagf-6 "$testcvs -q update -r br" \
7412 'U file1
7413 U file2'
7414           echo brmod >> file1
7415           echo brmod >> file2
7416           dotest tagf-7 "${testcvs} -q ci -m modify" \
7417 "Checking in file1;
7418 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7419 new revision: 1\.1\.2\.1; previous revision: 1\.1
7420 done
7421 Checking in file2;
7422 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7423 new revision: 1\.1\.2\.1; previous revision: 1\.1
7424 done"
7425           # Here we try to make it a non-branch tag, but will
7426           # succeed in getting only warnings, even with -F 
7427           # because converting a branch tag to non-branch 
7428           # is potentially catastrophic.
7429           dotest tagf-8a "${testcvs} -q tag -F br" \
7430 "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\\.2\.1\.
7431 ${PROG} tag: file2: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\.2\.1\."
7432           # however, if we *really* are sure we want to move a branch tag,
7433           # "-F -B" will do the trick
7434           dotest tagf-8 "${testcvs} -q tag -F -B br" "T file1
7435 T file2"
7436           echo moremod >> file1
7437           echo moremod >> file2
7438           dotest tagf-9 "${testcvs} -q status -v file1" \
7439 "===================================================================
7440 File: file1             Status: Locally Modified
7441
7442    Working revision:    1\.1\.2\.1.*
7443    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/file1,v
7444    Sticky Tag:          br (revision: 1\.1\.2\.1)
7445    Sticky Date:         (none)
7446    Sticky Options:      (none)
7447
7448    Existing Tags:
7449         br                              (revision: 1\.1\.2\.1)"
7450
7451           # Now, how do we recover?
7452           dotest tagf-10 "${testcvs} -q tag -d br" "D file1
7453 D file2"
7454           # This creates a new branch, 1.1.4.  See the code in RCS_magicrev
7455           # which will notice that there is a (non-magic) 1.1.2 and thus
7456           # skip that number.
7457           dotest tagf-11 "${testcvs} -q tag -r 1.1 -b br file1" "T file1"
7458           # Fix it with admin -n (cf admin-18, admin-26-4).
7459           dotest tagf-12 "${testcvs} -q admin -nbr:1.1.2 file2" \
7460 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7461 done"
7462           # Another variation on the file2 test would be to use two working
7463           # directories so that the update -r br would need to
7464           # a merge to get from 1.1.2.1 to the head of the 1.1.2 branch.
7465           dotest tagf-13 "${testcvs} -q update -r br" \
7466 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7467 retrieving revision 1\.1\.2\.1
7468 retrieving revision 1\.1
7469 Merging differences between 1\.1\.2\.1 and 1\.1 into file1
7470 rcsmerge: warning: conflicts during merge
7471 ${PROG} update: conflicts found in file1
7472 C file1
7473 M file2"
7474           # CVS is giving a conflict because we are trying to get back to
7475           # 1.1.4.  I'm not sure why it is a conflict rather than just
7476           # "M file1".
7477           dotest tagf-14 "cat file1" \
7478 "<<<<<<< file1
7479 brmod
7480 moremod
7481 [=]======
7482 [>]>>>>>> 1\.1"
7483           echo resolve >file1
7484           dotest tagf-15 "${testcvs} -q ci -m recovered" \
7485 "Checking in file1;
7486 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7487 new revision: 1\.1\.4\.1; previous revision: 1\.1
7488 done
7489 Checking in file2;
7490 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7491 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
7492 done"
7493           # try accidentally deleting branch tag, "tag -d"
7494           dotest_fail tagf-16 "${testcvs} tag -d br" \
7495 "${PROG} tag: Untagging \.
7496 ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
7497 ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
7498           # try accidentally deleting branch tag, "rtag -d"
7499           dotest_fail tagf-17 "${testcvs} rtag -d br first-dir" \
7500 "${PROG} rtag: Untagging first-dir
7501 ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
7502 ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
7503           # try accidentally converting branch tag to non-branch tag "tag -F"
7504           dotest tagf-18 "${testcvs} tag -r1.1 -F br file1" \
7505 "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\."
7506           # try accidentally converting branch tag to non-branch tag "rtag -F"
7507           dotest tagf-19 "${testcvs} rtag -r1.1 -F br first-dir" \
7508 "${PROG} rtag: Tagging first-dir
7509 ${PROG} rtag: first-dir/file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\.
7510 ${PROG} rtag: first-dir/file2: Not moving branch tag .br. from 1\.1\.2\.2 to 1\.1\."
7511           # create a non-branch tag
7512           dotest tagf-20 "${testcvs} rtag regulartag first-dir" \
7513 "${PROG} rtag: Tagging first-dir"
7514           # try accidentally converting non-branch tag to branch tag (tag -F -B -b)
7515           dotest tagf-21 "${testcvs} tag -F -B -b regulartag file1" \
7516 "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1\.0\.2 due to .-B. option\."
7517           # try accidentally converting non-branch tag to branch rtag (rtag -F -B -b)
7518           dotest tagf-22 "${testcvs} rtag -F -B -b regulartag first-dir" \
7519 "${PROG} rtag: Tagging first-dir
7520 ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.6 due to .-B. option\.
7521 ${PROG} rtag: first-dir/file2: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.4 due to .-B. option\."
7522           # Try accidentally deleting non-branch: (tag -d -B)
7523           dotest_fail tagf-23 "${testcvs} tag -d -B regulartag file1" \
7524 "${PROG} tag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\."
7525           # Try accidentally deleting non-branch: (rtag -d -B)
7526           dotest_fail tagf-24 \
7527                 "${testcvs} rtag -d -B regulartag first-dir" \
7528 "${PROG} rtag: Untagging first-dir
7529 ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\.
7530 ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file2,v. due to .-B. option\."
7531
7532           # the following tests (throught the next commit) keep moving the same
7533           # tag back and forth between 1.1.6 & 1.1.8  in file1 and between
7534           # 1.1.4 and 1.1.6 in file2 since nothing was checked in on some of
7535           # these branches and CVS only tracks branches via tags unless they contain data.
7536
7537           # try intentionally converting non-branch tag to branch tag (tag -F -b)
7538           dotest tagf-25a "${testcvs} tag -F -b regulartag file1" "T file1"
7539           # try intentionally moving a branch tag to a newly created branch (tag -F -b -B)
7540           dotest tagf-25b "${testcvs} tag -F -B -b -r1.1 regulartag file1" \
7541 "T file1"
7542           # try intentionally converting mixed tags to branch tags (rtag -F -b)
7543           dotest tagf-26a "${testcvs} rtag -F -b regulartag first-dir" \
7544 "${PROG} rtag: Tagging first-dir
7545 ${PROG} rtag: first-dir/file1: Not moving branch tag .regulartag. from 1\.1 to 1\.1\.0\.8\."
7546           # try intentionally converting a branch to a new branch tag (rtag -F -b -B)
7547           dotest tagf-26b "${testcvs} rtag -F -B -b -r1.1 regulartag first-dir" \
7548 "${PROG} rtag: Tagging first-dir"
7549           # update to our new branch
7550           dotest tagf-27 "${testcvs} update -r regulartag" \
7551 "${PROG} update: Updating \.
7552 U file1
7553 U file2"
7554           # commit some changes and see that all rev numbers look right
7555           echo changes >> file1
7556           echo changes >> file2
7557           dotest tagf-28 "${testcvs} ci -m changes" \
7558 "${PROG} [a-z]*: Examining \.
7559 Checking in file1;
7560 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7561 new revision: 1\.1\.8\.1; previous revision: 1\.1
7562 done
7563 Checking in file2;
7564 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7565 new revision: 1\.1\.6\.1; previous revision: 1\.1
7566 done"
7567           # try intentional branch to non-branch (tag -F -B)
7568           dotest tagf-29 "${testcvs} tag -F -B -r1.1 regulartag file1" \
7569 "T file1"
7570           # try non-branch to non-branch (tag -F -B)
7571           dotest tagf-29a "${testcvs} tag -F -B -r br regulartag file1" \
7572 "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
7573           # try mixed-branch to non-branch (rtag -F -B )
7574           dotest tagf-29b "${testcvs} rtag -F -B -r br regulartag first-dir" \
7575 "${PROG} rtag: Tagging first-dir
7576 ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
7577           # at this point, regulartag is a regular tag within
7578           # file1 and file2
7579
7580           # try intentional branch to non-branch (rtag -F -B)
7581           dotest tagf-30 "${testcvs} rtag -F -B -r1.1 br first-dir"  \
7582 "${PROG} rtag: Tagging first-dir"
7583           # create a branch tag so we can try to delete it.
7584           dotest tagf-31 "${testcvs} rtag -b brtag first-dir"  \
7585 "${PROG} rtag: Tagging first-dir"
7586         
7587           # try intentinal deletion of branch tag (tag -d -B)
7588           dotest tagf-32 "${testcvs} tag -d -B brtag file1" "D file1"
7589           # try intentinal deletion of branch tag (rtag -d -B)
7590           dotest tagf-33 "${testcvs} rtag -d -B brtag first-dir" \
7591 "${PROG} rtag: Untagging first-dir"
7592
7593           cd ../..
7594
7595           rm -r 1
7596           rm -rf ${CVSROOT_DIRNAME}/first-dir
7597           ;;
7598
7599         tag-log)
7600           # Test log output for tags
7601           mkdir 1; cd 1
7602           dotest tag-log-init-1 "$testcvs -q co -l ."
7603           mkdir first-dir
7604           dotest tag-log-init-2 "$testcvs add first-dir" \
7605 "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
7606           cd first-dir
7607           touch file1
7608           dotest tag-log-init-3 "$testcvs add file1" \
7609 "${PROG}"' add: scheduling file `file1'\'' for addition
7610 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
7611           dotest tag-log-init-4 "$testcvs -Q ci -m add" \
7612 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7613 done
7614 Checking in file1;
7615 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7616 initial revision: 1\.1
7617 done"
7618
7619           dotest tag-log-1 "$testcvs -Q tag mytag file1" ''
7620           dotest tag-log-2 "$testcvs log -N file1" \
7621 "
7622 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7623 Working file: file1
7624 head: 1\.1
7625 branch:
7626 locks: strict
7627 access list:
7628 keyword substitution: kv
7629 total revisions: 1;     selected revisions: 1
7630 description:
7631 ----------------------------
7632 revision 1\.1
7633 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7634 add
7635 ============================================================================="
7636           dotest tag-log-3 "$testcvs log -N -n file1" \
7637 "
7638 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7639 Working file: file1
7640 head: 1\.1
7641 branch:
7642 locks: strict
7643 access list:
7644 symbolic names:
7645         mytag: 1\.1
7646 keyword substitution: kv
7647 total revisions: 1;     selected revisions: 1
7648 description:
7649 ----------------------------
7650 revision 1\.1
7651 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7652 add
7653 ============================================================================="
7654           dotest tag-log-4 "$testcvs log file1" \
7655 "
7656 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7657 Working file: file1
7658 head: 1\.1
7659 branch:
7660 locks: strict
7661 access list:
7662 symbolic names:
7663         mytag: 1\.1
7664 keyword substitution: kv
7665 total revisions: 1;     selected revisions: 1
7666 description:
7667 ----------------------------
7668 revision 1\.1
7669 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7670 add
7671 ============================================================================="
7672           dotest tag-log-5 "$testcvs log -n file1" \
7673 "
7674 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7675 Working file: file1
7676 head: 1\.1
7677 branch:
7678 locks: strict
7679 access list:
7680 symbolic names:
7681         mytag: 1\.1
7682 keyword substitution: kv
7683 total revisions: 1;     selected revisions: 1
7684 description:
7685 ----------------------------
7686 revision 1\.1
7687 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7688 add
7689 ============================================================================="
7690
7691           cd ../..
7692           rm -fr 1
7693           rm -rf ${CVSROOT_DIRNAME}/first-dir
7694           ;;
7695
7696         tag-space)
7697           # Test tags with spaces in the names.
7698           #
7699           # Prior to releases 1.11.18 & 1.12.10, some commands used with
7700           # tags with spaces in the names could hang CVS.
7701
7702           # Setup; check in first-dir/file1
7703           mkdir 1; cd 1
7704           dotest tag-space-init-1 "$testcvs -q co -l ."
7705           mkdir first-dir
7706           dotest tag-space-init-2 "$testcvs add first-dir" \
7707 "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
7708           cd first-dir
7709           touch file1
7710           dotest tag-space-init-3 "$testcvs add file1" \
7711 "$PROG add: scheduling file \`file1' for addition
7712 $PROG add: use '$PROG commit' to add this file permanently"
7713           dotest tag-space-init-4 "$testcvs -Q ci -m add" \
7714 "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
7715 done
7716 Checking in file1;
7717 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
7718 initial revision: 1\.1
7719 done"
7720
7721           # Reportedly, the following two tags make it past WinCVS.
7722           dotest_fail tag-space-1 "$testcvs tag ' spacetag '" \
7723 "$PROG \[tag aborted\]: tag \` spacetag ' must start with a letter"
7724           dotest_fail tag-space-2 "$testcvs tag 'spacetag '" \
7725 "$PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters"
7726
7727           if $remote; then
7728             # Verify that this isn't a client check.
7729             dotest tag-space-3 "$testcvs server" \
7730 "E $PROG \[tag aborted\]: tag \` spacetag ' must start with a letter
7731 error  " <<EOF
7732 Root $CVSROOT_DIRNAME
7733 UseUnchanged
7734 Argument --
7735 Argument  spacetag 
7736 Directory .
7737 $CVSROOT_DIRNAME/first-dir
7738 Entry /file1/1.1///
7739 Unchanged file1
7740 tag
7741 EOF
7742
7743             dotest tag-space-4 "$testcvs server" \
7744 "E $PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters
7745 error  " <<EOF
7746 Root $CVSROOT_DIRNAME
7747 UseUnchanged
7748 Argument --
7749 Argument spacetag 
7750 Directory .
7751 $CVSROOT_DIRNAME/first-dir
7752 Entry /file1/1.1///
7753 Unchanged file1
7754 tag
7755 EOF
7756           fi # $remote
7757
7758           # Any number of normal tags and branches were handled correctly.
7759           dotest tag-space-5 "$testcvs -Q tag t1"
7760           dotest tag-space-5b "$testcvs -Q tag t2"
7761           dotest tag-space-5c "$testcvs -Q tag -b b1"
7762
7763           cd ../..
7764           mkdir 2; cd 2
7765
7766           # But once a vendor branch exists, it's all over.
7767           mkdir project; cd project
7768           touch file1
7769           dotest tag-space-init-4 \
7770 "$testcvs -Q import -mimport second-dir VENDOR RELEASE"
7771
7772           cd ..
7773
7774           dotest_fail tag-space-6 "$testcvs -Q co -r ' spacetag ' first-dir" \
7775 "$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter"
7776
7777           # But when any files were imported, this test hung prior to CVS
7778           # versions 1.11.18 & 1.12.10.
7779           dotest_fail tag-space-7 "$testcvs -Q co -r ' spacetag ' second-dir" \
7780 "$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter"
7781
7782           if $remote; then
7783             # I based the client input in the next two tests on actual input
7784             # from WinCVS 1.2.
7785             dotest tag-space-8 "$testcvs server" \
7786 "E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter
7787 error  " <<EOF
7788 Root $CVSROOT_DIRNAME
7789 Argument -P
7790 Argument -r
7791 Argument  spacetag 
7792 Argument first-dir
7793 Directory .
7794 $CVSROOT_DIRNAME
7795 co
7796 EOF
7797
7798             # Verify the test is not on the client side.
7799             dotest tag-space-9 "$testcvs server" \
7800 "E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter
7801 error  " <<EOF
7802 Root $CVSROOT_DIRNAME
7803 Argument -P
7804 Argument -r
7805 Argument  spacetag 
7806 Argument second-dir
7807 Directory .
7808 $CVSROOT_DIRNAME
7809 co
7810 EOF
7811           fi # $remote
7812
7813           dotest tag-space-10 "$testcvs -Q co second-dir"
7814           cd second-dir
7815
7816           # This test would also hang.
7817           dotest_fail tag-space-11 "$testcvs -Q up -r ' spacetag '" \
7818 "$PROG \[update aborted\]: tag \` spacetag ' must start with a letter"
7819
7820           if $remote; then
7821             dotest tag-space-12 "$testcvs server" \
7822 "E $PROG \[update aborted\]: tag \` spacetag ' must start with a letter
7823 error  " <<EOF
7824 Root $CVSROOT_DIRNAME
7825 Argument -r
7826 Argument  spacetag 
7827 Argument -u
7828 Argument --
7829 Directory .
7830 $CVSROOT_DIRNAME
7831 Unchanged file1
7832 update
7833 EOF
7834           fi # $remote
7835
7836           # I'm skipping tests for other commands that may have had the same
7837           # problem.  Hopefully, if a new issue arises, one of the above tests
7838           # will catch the problem.
7839
7840           if $keep; then
7841             echo Keeping $TESTDIR and exiting due to --keep
7842             exit 0
7843           fi
7844
7845           cd ../..
7846           rm -r 1 2
7847           rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir
7848           ;;
7849
7850         rcslib)
7851           # Test librarification of RCS.
7852           # First: test whether `cvs diff' handles $Name expansion
7853           # correctly.  We diff two revisions with their symbolic tags;
7854           # neither tag should be expanded in the output.  Also diff
7855           # one revision with the working copy.
7856
7857           mkdir ${CVSROOT_DIRNAME}/first-dir
7858           dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
7859           cd first-dir
7860           echo "I am the first foo, and my name is $""Name$." > foo.c
7861           dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
7862 "${PROG} add: scheduling file .foo\.c. for addition
7863 ${PROG} add: use .${PROG} commit. to add this file permanently"
7864           dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
7865 "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7866 done
7867 Checking in foo\.c;
7868 ${CVSROOT_DIRNAME}/first-dir/foo.c,v  <--  foo\.c
7869 initial revision: 1\.1
7870 done"
7871           dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
7872           dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
7873 "===================================================================
7874 Checking out foo\.c
7875 RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7876 VERS: 1\.1
7877 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7878 I am the first foo, and my name is \$""Name: first \$\."
7879
7880           echo "I am the second foo, and my name is $""Name$." > foo.c
7881           dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
7882 "Checking in foo\.c;
7883 ${CVSROOT_DIRNAME}/first-dir/foo\.c,v  <--  foo\.c
7884 new revision: 1\.2; previous revision: 1\.1
7885 done"
7886           dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
7887           dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
7888 "===================================================================
7889 Checking out foo\.c
7890 RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7891 VERS: 1\.2
7892 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7893 I am the second foo, and my name is \$""Name: second \$\."
7894
7895         dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
7896 "${PROG} diff: Diffing \.
7897 Index: foo\.c
7898 ===================================================================
7899 RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7900 retrieving revision 1\.1
7901 retrieving revision 1\.2
7902 diff -r1\.1 -r1\.2
7903 1c1
7904 < I am the first foo, and my name is \$""Name:  \$\.
7905 ---
7906 > I am the second foo, and my name is \$""Name:  \$\."
7907
7908           echo "I am the once and future foo, and my name is $""Name$." > foo.c
7909           dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
7910 "${PROG} diff: Diffing \.
7911 Index: foo\.c
7912 ===================================================================
7913 RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7914 retrieving revision 1\.1
7915 diff -r1\.1 foo\.c
7916 1c1
7917 < I am the first foo, and my name is \$""Name:  \$\.
7918 ---
7919 > I am the once and future foo, and my name is \$""Name\$\."
7920
7921           # Test handling of libdiff options.  diff gets quite enough
7922           # of a workout elsewhere in sanity.sh, so we assume that it's
7923           # mostly working properly if it passes all the other tests.
7924           # The main one we want to try is regex handling, since we are
7925           # using CVS's regex matcher and not diff's.
7926
7927           cat >rgx.c <<EOF
7928 test_regex (whiz, bang)
7929 {
7930 foo;
7931 bar;
7932 baz;
7933 grumble;
7934 }
7935 EOF
7936
7937           dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
7938 "${PROG} add: use .${PROG} commit. to add this file permanently"
7939           dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
7940 "RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
7941 done
7942 Checking in rgx\.c;
7943 ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v  <--  rgx\.c
7944 initial revision: 1\.1
7945 done"
7946           cat >rgx.c <<EOF
7947 test_regex (whiz, bang)
7948 {
7949 foo;
7950 bar;
7951 baz;
7952 mumble;
7953 }
7954 EOF
7955           # Use dotest_fail because exit status from `cvs diff' must be 1.
7956           dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.* (' rgx.c" \
7957 "Index: rgx\.c
7958 ===================================================================
7959 RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
7960 retrieving revision 1\.1
7961 diff -c -F \.\* ( -r1\.1 rgx\.c
7962 \*\*\* rgx\.c   ${RFCDATE}      1\.1
7963 --- rgx\.c      ${RFCDATE}
7964 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
7965 \*\*\* 3,7 \*\*\*\*
7966   foo;
7967   bar;
7968   baz;
7969 ! grumble;
7970   }
7971 --- 3,7 ----
7972   foo;
7973   bar;
7974   baz;
7975 ! mumble;
7976   }"
7977
7978           # Tests of rcsmerge/diff3.  Merge operations get a good general
7979           # workout elsewhere; we want to make sure that options are still
7980           # handled properly.  Try merging two branches with -kv, to test
7981           # both -j and -k switches.
7982
7983           cd ..
7984
7985           rm -rf ${CVSROOT_DIRNAME}/first-dir
7986           rm -r first-dir
7987
7988           mkdir 1; cd 1
7989           dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
7990           mkdir first-dir
7991           dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
7992 "Directory ${CVSROOT_DIRNAME}.*/first-dir added to the repository"
7993           cd ..; rm -r 1
7994
7995           dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
7996           cd first-dir
7997
7998           echo '$''Revision$' > file1
7999           echo '2' >> file1
8000           echo '3' >> file1
8001           dotest rcslib-merge-4 "${testcvs} -q add file1" \
8002 "${PROG} add: use .${PROG} commit. to add this file permanently"
8003           dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
8004 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8005 done
8006 Checking in file1;
8007 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8008 initial revision: 1\.1
8009 done"
8010           sed -e 's/2/two/' file1 > f; mv f file1
8011           dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
8012 "Checking in file1;
8013 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8014 new revision: 1\.2; previous revision: 1\.1
8015 done"
8016           dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
8017           dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
8018           dotest rcslib-merge-9 "${testcvs} -q status" \
8019 "===================================================================
8020 File: file1             Status: Up-to-date
8021
8022    Working revision:    1\.1.*
8023    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
8024    Sticky Tag:          patch1 (branch: 1\.1\.2)
8025    Sticky Date:         (none)
8026    Sticky Options:      (none)"
8027           dotest rcslib-merge-10 "cat file1" \
8028 '$''Revision: 1\.1 $
8029 2
8030 3'
8031           sed -e 's/3/three/' file1 > f; mv f file1
8032           dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
8033 "Checking in file1;
8034 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8035 new revision: 1\.1\.2\.1; previous revision: 1\.1
8036 done"
8037           dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
8038 "U file1
8039 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8040 retrieving revision 1\.1
8041 retrieving revision 1\.2
8042 Merging differences between 1\.1 and 1\.2 into file1
8043 rcsmerge: warning: conflicts during merge"
8044           dotest rcslib-merge-13 "cat file1" \
8045 "<<<<<<< file1
8046 1\.1\.2\.1
8047 2
8048 three
8049 [=]======
8050 1\.2
8051 two
8052 3
8053 [>]>>>>>> 1\.2"
8054
8055           # Test behavior of symlinks in the repository.
8056           if test -n "$remotehost"; then
8057             # Create the link on the remote system.  This is because Cygwin's
8058             # Windows support creates *.lnk files for Windows.  When creating
8059             # these in an SMB share from UNIX, these links won't work from the
8060             # UNIX side.
8061             dotest rcslib-symlink-1remotehost "${CVS_RSH} $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
8062           else
8063             dotest rcslib-symlink-1 "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
8064           fi
8065           dotest rcslib-symlink-2 "${testcvs} update file2" "U file2"
8066           echo "This is a change" >> file2
8067           dotest rcslib-symlink-3 "${testcvs} ci -m because file2" \
8068 "Checking in file2;
8069 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
8070 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
8071 done"
8072
8073           # Switch as for rcslib-symlink-1
8074           if test -n "$remotehost"; then
8075             dotest rcslib-symlink-4 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
8076 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
8077           else
8078             dotest rcslib-symlink-4 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
8079 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
8080           fi
8081
8082           # CVS was failing to check both the symlink and the file
8083           # for timestamp changes for a while.  Test that.
8084           rm file1
8085           dotest rcslib-symlink-3a "${testcvs} -q up file1" \
8086 "${PROG} update: warning: file1 was lost
8087 U file1"
8088           echo "This is a change" >> file1
8089           dotest rcslib-symlink-3b "${testcvs} ci -m because file1" \
8090 "Checking in file1;
8091 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8092 new revision: 1\.1\.2\.[0-9]*; previous revision: 1\.1\.2\.[0-9]*
8093 done"
8094           dotest rcslib-symlink-3c "${testcvs} update file2" "[UP] file2"
8095
8096           echo some new text >file3
8097           dotest rcslib-symlink-3d "${testcvs} -Q add file3" ''
8098           dotest rcslib-symlink-3e "${testcvs} -Q ci -mtest file3" \
8099 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
8100 done
8101 Checking in file3;
8102 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
8103 new revision: 1\.1\.2\.1; previous revision: 1\.1
8104 done"
8105
8106           rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
8107           # As for rcslib-symlink-1
8108           if test -n "$remotehost"; then
8109             dotest rcslib-symlink-3f "$CVS_RSH $remotehost 'ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
8110           else
8111             dotest rcslib-symlink-3f "ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
8112           fi
8113
8114           dotest rcslib-symlink-3g "${testcvs} update file2" "U file2"
8115
8116           # restore the link to file1 for the following tests
8117           dotest rcslib-symlink-3i "${testcvs} -Q rm -f file3" ''
8118           dotest rcslib-symlink-3j "${testcvs} -Q ci -mwhatever file3" \
8119 "Removing file3;
8120 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
8121 new revision: delete; previous revision: 1\.1\.2\.1
8122 done"
8123           rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
8124           rm -f ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
8125           # As for rcslib-symlink-1
8126           if test -n "$remotehost"; then
8127             dotest rcslib-symlink-3h "$CVS_RSH $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
8128           else
8129             dotest rcslib-symlink-3h "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
8130           fi
8131
8132           # Test 5 reveals a problem with having symlinks in the
8133           # repository.  CVS will try to tag both of the files
8134           # separately.  After processing one, it will do the same
8135           # operation to the other, which is actually the same file,
8136           # so the tag will already be there.  FIXME: do we bother
8137           # changing operations to notice cases like this?  This
8138           # strikes me as a difficult problem.  -Noel
8139           dotest rcslib-symlink-5 "${testcvs} tag the_tag" \
8140 "${PROG} tag: Tagging .
8141 T file1
8142 W file2 : the_tag already exists on version 1.1.2.3 : NOT MOVING tag to version 1.1.2.1"
8143           # As for rcslib-symlink-1
8144           if test -n "$remotehost"; then
8145             dotest rcslib-symlink-6 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
8146 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
8147           else
8148             dotest rcslib-symlink-6 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
8149 ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
8150           fi
8151
8152           # Symlinks tend to interact poorly with the Attic.
8153           cd ..
8154           mkdir 2; cd 2
8155           dotest rcslib-symlink-7 "${testcvs} -q co first-dir" \
8156 "U first-dir/file1
8157 U first-dir/file2"
8158           cd first-dir
8159           dotest rcslib-symlink-8 "${testcvs} rm -f file2" \
8160 "${PROG} remove: scheduling .file2. for removal
8161 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
8162           dotest rcslib-symlink-9 "${testcvs} -q ci -m rm-it" \
8163 "Removing file2;
8164 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
8165 new revision: delete; previous revision: 1\.2
8166 done"
8167           # OK, why this message happens twice is relatively clear
8168           # (the check_* and rtag_* calls to start_recursion).
8169           # Why it happens a third time I didn't try to find out.
8170           dotest rcslib-symlink-10 \
8171 "${testcvs} -q rtag -b -r the_tag brtag first-dir" \
8172 "${PROG} rtag: could not read RCS file for file2
8173 ${PROG} rtag: could not read RCS file for first-dir/file2
8174 ${PROG} rtag: could not read RCS file for first-dir/file2"
8175
8176           # Restore file1 for the next test.
8177           dotest rcslib-long-symlink-init-1 "$testcvs -Q up -A"
8178           dotest rcslib-long-symlink-init-2 "$testcvs -Q add file1"
8179           dotest rcslib-long-symlink-init-3 "$testcvs -Q ci -mback" \
8180 "Checking in file1;
8181 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
8182 new revision: 1\.4; previous revision: 1\.3
8183 done"
8184
8185           cd ../..  # $TESTDIR
8186
8187           # CVS has a hard-coded default link path size of 127 characters.
8188           # Make sure it knows how to exceed that.
8189           longpath=$CVSROOT_DIRNAME
8190           count=0
8191           while test $count -lt 10; do
8192             count=`expr $count + 1`
8193             longpath=$longpath/123456789012345678901234567890
8194             mkdir $longpath
8195           done
8196           cp $CVSROOT_DIRNAME/first-dir/file1,v $longpath
8197           mkdir $CVSROOT_DIRNAME/second-dir
8198
8199           # Switch as for rcslib-symlink-1
8200           if test -n "$remotehost"; then
8201             dotest rcslib-long-symlink-1rh \
8202 "$CVS_RSH $remotehost 'ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v'"
8203           else
8204             dotest rcslib-long-symlink-1 \
8205 "ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v"
8206           fi
8207
8208           dotest rcslib-long-symlink-2 "$testcvs co second-dir" \
8209 "$PROG checkout: Updating second-dir
8210 U second-dir/fileX"
8211
8212           cd second-dir
8213           echo change-it >>fileX
8214
8215           # Writes actually cause symlinks to be resolved.
8216           dotest rcslib-long-symlink-3 "$testcvs -q ci -mwrite-it" \
8217 "Checking in fileX;
8218 $CVSROOT_DIRNAME/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/file1,v  <--  fileX
8219 new revision: 1\.5; previous revision: 1\.4
8220 done"
8221
8222           if $keep; then
8223             echo Keeping ${TESTDIR} and exiting due to --keep
8224             exit 0
8225           fi
8226
8227           cd ..
8228           # Must remove the symlink first.  Samba doesn't appear to show
8229           # broken symlink across the SMB share, and rm -rf by itself
8230           # will remove file1,v first and leave file2,v a broken link and the
8231           # rm -rf will fail since it doesn't find file2,v and it still gets
8232           # directory not empty errors removing cvsroot/first-dir.
8233           #
8234           # I'm not sure why I need to do this on $remotehost.  The rm above
8235           # rcslib-symlink-3j works fine, but the next one doesn't unless run
8236           # remotely under Cygwin and using a TESTDIR on a Samba share.
8237           if test -n "$remotehost"; then
8238             $CVS_RSH $remotehost \
8239 "rm -f $CVSROOT_DIRNAME/first-dir/file2,v $CVSROOT_DIRNAME/second-dir/fileX,v"
8240           fi
8241           rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir \
8242                  $CVSROOT_DIRNAME/123456789012345678901234567890
8243           rm -r first-dir second-dir 2
8244           ;;
8245
8246         multibranch)
8247           # Test the ability to have several branchpoints coming off the
8248           # same revision.
8249           mkdir ${CVSROOT_DIRNAME}/first-dir
8250           dotest multibranch-1 "${testcvs} -q co first-dir" ''
8251           cd first-dir
8252           echo 1:trunk-1 >file1
8253           dotest multibranch-2 "${testcvs} add file1" \
8254 "${PROG}"' add: scheduling file `file1'\'' for addition
8255 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
8256           dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
8257 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8258 done
8259 Checking in file1;
8260 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8261 initial revision: 1.1
8262 done
8263 HERE
8264           dotest multibranch-4 "${testcvs} tag -b br1" \
8265 "${PROG} tag: Tagging \.
8266 T file1"
8267           dotest multibranch-5 "${testcvs} tag -b br2" \
8268 "${PROG} tag: Tagging \.
8269 T file1"
8270           dotest multibranch-6 "$testcvs -q update -r br1" '[UP] file1'
8271           echo on-br1 >file1
8272           dotest multibranch-7 "${testcvs} -q ci -m modify-on-br1" \
8273 "Checking in file1;
8274 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8275 new revision: 1\.1\.2\.1; previous revision: 1\.1
8276 done"
8277           dotest multibranch-8 "${testcvs} -q update -r br2" '[UP] file1'
8278           echo br2 adds a line >>file1
8279           dotest multibranch-9 "${testcvs} -q ci -m modify-on-br2" \
8280 "Checking in file1;
8281 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8282 new revision: 1\.1\.4\.1; previous revision: 1\.1
8283 done"
8284           dotest multibranch-10 "${testcvs} -q update -r br1" '[UP] file1'
8285           dotest multibranch-11 "cat file1" 'on-br1'
8286           dotest multibranch-12 "${testcvs} -q update -r br2" '[UP] file1'
8287           dotest multibranch-13 "cat file1" '1:trunk-1
8288 br2 adds a line'
8289
8290           dotest multibranch-14 "${testcvs} log file1" \
8291 "
8292 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8293 Working file: file1
8294 head: 1\.1
8295 branch:
8296 locks: strict
8297 access list:
8298 symbolic names:
8299         br2: 1\.1\.0\.4
8300         br1: 1\.1\.0\.2
8301 keyword substitution: kv
8302 total revisions: 3;     selected revisions: 3
8303 description:
8304 ----------------------------
8305 revision 1\.1
8306 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8307 branches:  1\.1\.2;  1\.1\.4;
8308 add-it
8309 ----------------------------
8310 revision 1\.1\.4\.1
8311 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
8312 modify-on-br2
8313 ----------------------------
8314 revision 1\.1\.2\.1
8315 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
8316 modify-on-br1
8317 ============================================================================="
8318           cd ..
8319
8320           if $keep; then
8321             echo Keeping ${TESTDIR} and exiting due to --keep
8322             exit 0
8323           fi
8324
8325           rm -rf ${CVSROOT_DIRNAME}/first-dir
8326           rm -r first-dir
8327           ;;
8328
8329         import) # test death after import
8330                 # Tests of "cvs import":
8331                 # basic2
8332                 # rdiff  -- imports with keywords
8333                 # import  -- more tests of imports with keywords
8334                 # importb  -- -b option.
8335                 # importc -- bunch o' files in bunch o' directories
8336                 # modules3
8337                 # mflag -- various -m messages
8338                 # ignore  -- import and cvsignore
8339                 # binwrap -- import and -k wrappers
8340                 # info -- imports which are rejected by verifymsg
8341                 # head -- intended to test vendor branches and HEAD,
8342                 #   although it doesn't really do it yet.
8343                 # import-CVS -- refuse to import directories named "CVS".
8344                 # import-quirks -- short tests of import quirks.
8345
8346                 # import
8347                 mkdir import-dir ; cd import-dir
8348
8349                 for i in 1 2 3 4 ; do
8350                   echo imported file"$i" > imported-f"$i"
8351                 done
8352
8353                 # This directory should be on the default ignore list,
8354                 # so it shouldn't get imported.
8355                 mkdir RCS
8356                 echo ignore.me >RCS/ignore.me
8357
8358                 echo 'import should not expand $''Id$' >>imported-f2
8359                 cp imported-f2 ../imported-f2-orig.tmp
8360
8361                 dotest_sort import-96 \
8362 "${testcvs} import -m first-import first-dir vendor-branch junk-1_0" \
8363 "
8364
8365 I first-dir/RCS
8366 N first-dir/imported-f1
8367 N first-dir/imported-f2
8368 N first-dir/imported-f3
8369 N first-dir/imported-f4
8370 No conflicts created by this import"
8371
8372                 dotest import-96.5 "cmp ../imported-f2-orig.tmp imported-f2" ''
8373
8374                 cd ..
8375
8376                 # co
8377                 dotest import-97 "${testcvs} -q co first-dir" \
8378 "U first-dir/imported-f1
8379 U first-dir/imported-f2
8380 U first-dir/imported-f3
8381 U first-dir/imported-f4"
8382
8383                 cd first-dir
8384
8385                 for i in 1 2 3 4 ; do
8386                   dotest import-98-$i "test -f imported-f$i" ''
8387                 done
8388                 dotest_fail import-98.5 "test -d RCS" ''
8389
8390                 # remove
8391                 rm imported-f1
8392                 dotest import-99 "${testcvs} rm imported-f1" \
8393 "${PROG}"' remove: scheduling `imported-f1'\'' for removal
8394 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
8395
8396                 # change
8397                 echo local-change >> imported-f2
8398
8399                 # commit
8400                 dotest import-100 "${testcvs} ci -m local-changes" \
8401 "${PROG} [a-z]*: Examining .
8402 Removing imported-f1;
8403 ${CVSROOT_DIRNAME}/first-dir/imported-f1,v  <--  imported-f1
8404 new revision: delete; previous revision: 1\.1\.1\.1
8405 done
8406 Checking in imported-f2;
8407 ${CVSROOT_DIRNAME}/first-dir/imported-f2,v  <--  imported-f2
8408 new revision: 1\.2; previous revision: 1\.1
8409 done"
8410
8411                 # log
8412                 dotest import-101 "${testcvs} log imported-f1" \
8413 "
8414 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/imported-f1,v
8415 Working file: imported-f1
8416 head: 1\.2
8417 branch:
8418 locks: strict
8419 access list:
8420 symbolic names:
8421         junk-1_0: 1\.1\.1\.1
8422         vendor-branch: 1\.1\.1
8423 keyword substitution: kv
8424 total revisions: 3;     selected revisions: 3
8425 description:
8426 ----------------------------
8427 revision 1\.2
8428 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
8429 local-changes
8430 ----------------------------
8431 revision 1\.1
8432 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8433 branches:  1\.1\.1;
8434 Initial revision
8435 ----------------------------
8436 revision 1\.1\.1\.1
8437 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8438 first-import
8439 ============================================================================="
8440
8441                 # update into the vendor branch.
8442                 dotest import-102 "$testcvs update -rvendor-branch" \
8443 "$PROG update: Updating .
8444 U imported-f1
8445 [UP] imported-f2
8446 [UP] imported-f3
8447 [UP] imported-f4"
8448
8449                 # remove file4 on the vendor branch
8450                 rm imported-f4
8451                 dotest import-103 "${testcvs} rm imported-f4" \
8452 "${PROG}"' remove: scheduling `imported-f4'\'' for removal
8453 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
8454
8455                 # commit
8456                 dotest import-104 \
8457 "${testcvs} ci -m vendor-removed imported-f4" \
8458 "Removing imported-f4;
8459 ${CVSROOT_DIRNAME}/first-dir/imported-f4,v  <--  imported-f4
8460 new revision: delete; previous revision: 1\.1\.1\.1
8461 done"
8462
8463                 # update to main line
8464                 dotest import-105 "$testcvs -q update -A" \
8465 "$PROG update: imported-f1 is no longer in the repository
8466 [UP] imported-f2
8467 [UP] imported-f3"
8468
8469                 # second import - file4 deliberately unchanged
8470                 cd ../import-dir
8471                 for i in 1 2 3 ; do
8472                   echo rev 2 of file $i >> imported-f"$i"
8473                 done
8474                 cp imported-f2 ../imported-f2-orig.tmp
8475
8476                 dotest_sort import-106 \
8477 "${testcvs} import -m second-import first-dir vendor-branch junk-2_0" \
8478 "
8479
8480
8481  ${PROG} checkout -j<prev_rel_tag> -jjunk-2_0 first-dir
8482 2 conflicts created by this import.
8483 C first-dir/imported-f1
8484 C first-dir/imported-f2
8485 I first-dir/RCS
8486 U first-dir/imported-f3
8487 U first-dir/imported-f4
8488 Use the following command to help the merge:"
8489
8490                 dotest import-106.5 "cmp ../imported-f2-orig.tmp imported-f2" \
8491 ''
8492
8493                 cd ..
8494
8495                 rm imported-f2-orig.tmp
8496
8497                 # co
8498                 dotest import-107 "${testcvs} co first-dir" \
8499 "${PROG} checkout: Updating first-dir
8500 [UP] first-dir/imported-f3
8501 [UP] first-dir/imported-f4"
8502
8503                 cd first-dir
8504
8505                 dotest_fail import-108 "test -f imported-f1" ''
8506
8507                 for i in 2 3 ; do
8508                   dotest import-109-$i "test -f imported-f$i" ''
8509                 done
8510
8511                 # check vendor branch for file4
8512                 dotest import-110 "$testcvs -q update -rvendor-branch" \
8513 'U imported-f1
8514 [UP] imported-f2
8515 [UP] imported-f3
8516 [UP] imported-f4'
8517
8518                 dotest import-111 "test -f imported-f4" ''
8519
8520                 # update to main line
8521                 dotest import-112 "$testcvs -q update -A" \
8522 "$PROG update: imported-f1 is no longer in the repository
8523 [UP] imported-f2
8524 [UP] imported-f3
8525 [UP] imported-f4"
8526
8527                 cd ..
8528
8529                 dotest import-113 \
8530 "${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
8531 "${PROG} checkout: file first-dir/imported-f1 does not exist, but is present in revision junk-2_0
8532 RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f2,v
8533 retrieving revision 1\.1\.1\.1
8534 retrieving revision 1\.1\.1\.2
8535 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
8536 rcsmerge: warning: conflicts during merge
8537 first-dir/imported-f3 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.2
8538 first-dir/imported-f4 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.3"
8539
8540                 cd first-dir
8541
8542                 dotest_fail import-114 "test -f imported-f1" ''
8543
8544                 for i in 2 3 ; do
8545                   dotest import-115-$i "test -f imported-f$i" ''
8546                 done
8547
8548                 dotest import-116 'cat imported-f2' \
8549 'imported file2
8550 [<]<<<<<< imported-f2
8551 import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
8552 local-change
8553 [=]======
8554 import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
8555 rev 2 of file 2
8556 [>]>>>>>> 1\.1\.1\.2'
8557
8558                 cd ..
8559                 rm -r first-dir
8560                 rm -rf ${CVSROOT_DIRNAME}/first-dir
8561                 rm -r import-dir
8562                 ;;
8563
8564         importb)
8565           # More cvs import tests, especially -b option.
8566
8567           # OK, first we get some sources from the NetMunger project, and
8568           # import them into the 1.1.1 vendor branch.
8569           mkdir imp-dir
8570           cd imp-dir
8571           echo 'OpenMunger sources' >file1
8572           echo 'OpenMunger sources' >file2
8573           dotest_sort importb-1 \
8574 "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
8575 "
8576
8577 N first-dir/file1
8578 N first-dir/file2
8579 No conflicts created by this import"
8580           cd ..
8581           rm -r imp-dir
8582
8583           # Now we put the sources we get from FreeMunger into 1.1.3
8584           mkdir imp-dir
8585           cd imp-dir
8586           echo 'FreeMunger sources' >file1
8587           echo 'FreeMunger sources' >file2
8588           # Not completely sure how the conflict detection is supposed to
8589           # be working here (haven't really thought about it).
8590           # We use an explicit -d option to test that it is reflected
8591           # in the suggested checkout.
8592           dotest_sort importb-2 \
8593 "${testcvs} -d ${CVSROOT} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
8594 "
8595
8596
8597  ${PROG} -d ${CVSROOT} checkout -j<prev_rel_tag> -jfreemunger-1_0 first-dir
8598 2 conflicts created by this import.
8599 C first-dir/file1
8600 C first-dir/file2
8601 Use the following command to help the merge:"
8602           cd ..
8603           rm -r imp-dir
8604
8605           # Now a test of main branch import (into second-dir, not first-dir).
8606           mkdir imp-dir
8607           cd imp-dir
8608           echo 'my own stuff' >mine1.c
8609           echo 'my own stuff' >mine2.c
8610           dotest_fail importb-3 \
8611 "${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
8612 "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
8613 supported by import, not \`1'\.  For example: \`1\.1\.1'\."
8614           : when we implement main-branch import, should be \
8615 "N second-dir/mine1\.c
8616 N second-dir/mine2\.c
8617
8618 No conflicts created by this import"
8619           cd ..
8620           rm -r imp-dir
8621
8622           mkdir 1
8623           cd 1
8624           # when we implement main branch import, will want to 
8625           # add "second-dir" here.
8626           dotest importb-4 "${testcvs} -q co first-dir" \
8627 "U first-dir/file1
8628 U first-dir/file2"
8629           cd first-dir
8630           dotest importb-5 "${testcvs} -q log file1" "
8631 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8632 Working file: file1
8633 head: 1\.1
8634 branch: 1\.1\.1
8635 locks: strict
8636 access list:
8637 symbolic names:
8638         freemunger-1_0: 1\.1\.3\.1
8639         freemunger: 1\.1\.3
8640         openmunger-1_0: 1\.1\.1\.1
8641         openmunger: 1\.1\.1
8642 keyword substitution: kv
8643 total revisions: 3;     selected revisions: 3
8644 description:
8645 ----------------------------
8646 revision 1\.1
8647 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8648 branches:  1\.1\.1;  1\.1\.3;
8649 Initial revision
8650 ----------------------------
8651 revision 1\.1\.3\.1
8652 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
8653 add
8654 ----------------------------
8655 revision 1\.1\.1\.1
8656 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8657 add
8658 ============================================================================="
8659
8660           cd ../..
8661           rm -r 1
8662           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
8663           ;;
8664
8665         importc)
8666           # Test importing a bunch o' files in a bunch o' directories.
8667           # Also the -d option.
8668           mkdir 1; cd 1
8669           mkdir adir bdir cdir
8670           mkdir adir/sub1 adir/sub2
8671           mkdir adir/sub1/ssdir
8672           mkdir bdir/subdir
8673           touch adir/sub1/file1 adir/sub2/file2 adir/sub1/ssdir/ssfile
8674           touch -t 197107040343 bdir/subdir/file1
8675           touch -t 203412251801 cdir/cfile
8676           dotest_sort importc-1 \
8677 "${testcvs} import -d -m import-it first-dir vendor release" \
8678 "
8679
8680 N first-dir/adir/sub1/file1
8681 N first-dir/adir/sub1/ssdir/ssfile
8682 N first-dir/adir/sub2/file2
8683 N first-dir/bdir/subdir/file1
8684 N first-dir/cdir/cfile
8685 No conflicts created by this import
8686 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir
8687 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1
8688 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1/ssdir
8689 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub2
8690 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir
8691 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir/subdir
8692 ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/cdir"
8693           cd ..
8694           mkdir 2; cd 2
8695           dotest importc-2 "${testcvs} -q co first-dir" \
8696 "U first-dir/adir/sub1/file1
8697 U first-dir/adir/sub1/ssdir/ssfile
8698 U first-dir/adir/sub2/file2
8699 U first-dir/bdir/subdir/file1
8700 U first-dir/cdir/cfile"
8701           cd first-dir
8702           dotest importc-3 "${testcvs} update adir/sub1" \
8703 "${PROG} update: Updating adir/sub1
8704 ${PROG} update: Updating adir/sub1/ssdir"
8705           dotest importc-4 "${testcvs} update adir/sub1 bdir/subdir" \
8706 "${PROG} update: Updating adir/sub1
8707 ${PROG} update: Updating adir/sub1/ssdir
8708 ${PROG} update: Updating bdir/subdir"
8709
8710           echo modify >>cdir/cfile
8711           dotest importc-5 \
8712 "${testcvs} -q rtag -b -r release wip_test first-dir" ""
8713           dotest importc-6 "$testcvs -q update -r wip_test" \
8714 'U adir/sub1/file1
8715 U adir/sub1/ssdir/ssfile
8716 U adir/sub2/file2
8717 U bdir/subdir/file1
8718 M cdir/cfile'
8719
8720           # This used to fail in local mode
8721           dotest importc-7 "${testcvs} -q ci -m modify -r wip_test" \
8722 "Checking in cdir/cfile;
8723 ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v  <--  cfile
8724 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
8725 done"
8726
8727           # TODO: should also be testing "import -d" when we update
8728           # an existing file.
8729           dotest importc-8 "${testcvs} -q log cdir/cfile" "
8730 RCS file: ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v
8731 Working file: cdir/cfile
8732 head: 1\.1
8733 branch: 1\.1\.1
8734 locks: strict
8735 access list:
8736 symbolic names:
8737         wip_test: 1\.1\.1\.1\.0\.2
8738         release: 1\.1\.1\.1
8739         vendor: 1\.1\.1
8740 keyword substitution: kv
8741 total revisions: 3;     selected revisions: 3
8742 description:
8743 ----------------------------
8744 revision 1\.1
8745 date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;
8746 branches:  1\.1\.1;
8747 Initial revision
8748 ----------------------------
8749 revision 1\.1\.1\.1
8750 date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8751 branches:  1\.1\.1\.1\.2;
8752 import-it
8753 ----------------------------
8754 revision 1\.1\.1\.1\.2\.1
8755 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
8756 modify
8757 ============================================================================="
8758
8759           dotest importc-9 "${testcvs} -q log bdir/subdir/file1" "
8760 RCS file: ${CVSROOT_DIRNAME}/first-dir/bdir/subdir/file1,v
8761 Working file: bdir/subdir/file1
8762 head: 1\.1
8763 branch: 1\.1\.1
8764 locks: strict
8765 access list:
8766 symbolic names:
8767         wip_test: 1\.1\.1\.1\.0\.2
8768         release: 1\.1\.1\.1
8769         vendor: 1\.1\.1
8770 keyword substitution: kv
8771 total revisions: 2;     selected revisions: 2
8772 description:
8773 ----------------------------
8774 revision 1\.1
8775 date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;
8776 branches:  1\.1\.1;
8777 Initial revision
8778 ----------------------------
8779 revision 1\.1\.1\.1
8780 date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8781 import-it
8782 ============================================================================="
8783           cd ..
8784
8785           # Now tests of absolute pathnames and .. as repository directory.
8786           cd ../1
8787           dotest_fail importc-10 \
8788 "${testcvs} import -m imp ../other vendor release2" \
8789 "${PROG} \[[a-z]* aborted\]: directory \.\./other not relative within the repository"
8790           dotest_fail importc-11 \
8791 "${testcvs} import -m imp ${TESTDIR}/other vendor release3" \
8792 "${PROG} \[[a-z]* aborted\]: directory ${TESTDIR}/other not relative within the repository"
8793           dotest_fail importc-12 "test -d ${TESTDIR}/other" ""
8794           cd ..
8795
8796           rm -r 1 2
8797           rm -rf ${CVSROOT_DIRNAME}/first-dir
8798           ;;
8799
8800         import-CVS)
8801           mkdir import-CVS
8802           cd import-CVS
8803           touch file1 file2 file3
8804           dotest_fail import-CVS-1 "$testcvs import -mimport CVS vtag rtag" \
8805 "$PROG import: The word \`CVS' is reserved by CVS and may not be used
8806 $PROG \[import aborted\]: as a directory in a path or as a file name\."
8807           dotest_fail import-CVS-1b \
8808 "$testcvs import -mimport CVS-/CVS vtag rtag" \
8809 "$PROG import: The word \`CVS' is reserved by CVS and may not be used
8810 $PROG \[import aborted\]: as a directory in a path or as a file name\."
8811           mkdir sdir
8812           mkdir sdir/CVS
8813           touch CVS sdir/CVS/file4 sdir/CVS/file5 sdir/file6 sdir/file7
8814           # Calling the imported directory import-CVS is dual purpose in the
8815           # following test.  It makes sure the path test which matched above
8816           # wasn't too strict.
8817           dotest_sort import-CVS-2 \
8818 "$testcvs import -I! -mimport import-CVS vtag rtag" \
8819 "
8820
8821 I import-CVS/CVS
8822 I import-CVS/sdir/CVS
8823 N import-CVS/file1
8824 N import-CVS/file2
8825 N import-CVS/file3
8826 N import-CVS/sdir/file6
8827 N import-CVS/sdir/file7
8828 No conflicts created by this import
8829 $PROG import: Importing $CVSROOT_DIRNAME/import-CVS/sdir"
8830
8831           if $keep; then
8832             echo Keeping ${TESTDIR} and exiting due to --keep
8833             exit 0
8834           fi
8835
8836           cd ..
8837           rm -r import-CVS
8838           rm -rf $CVSROOT_DIRNAME/import-CVS
8839           ;;
8840
8841
8842
8843         import-quirks)
8844           # Short tests of quirky import behavior.
8845           #
8846           # For a list of other import tests with short descriptions, see the
8847           # comment header of the "import" test.
8848           mkdir import-quirks
8849           cd import-quirks
8850           touch file1 file2 file3
8851
8852           # CVS prior to 1.11.18 and 1.12.10 used to happily import to
8853           # "branch 1.1", creating RCS archives with revisions like,
8854           # "1.1..1".  That double-dot is *not* a typo.
8855           dotest_fail import-quirks-1 \
8856 "$testcvs import -b1.1. -mbad-bad-bad import-quirks VB RT" \
8857 "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
8858 supported by import, not \`1\.1\.'\.  For example: \`1\.1\.1'\."
8859
8860           dotest_fail import-quirks-2 \
8861 "$testcvs import -b1.1.1.. -mbad-bad-bad import-quirks VB RT" \
8862 "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
8863 supported by import, not \`1\.1\.1\.\.'\.  For example: \`1\.1\.1'\."
8864
8865           # Try a few odd numbers.  This is hardly comprehensive.
8866           dotest_sort import-quirks-2 \
8867 "$testcvs import -b10.10.101 -mthis-ones-ok import-quirks-2 VB RT" \
8868 "
8869
8870 N import-quirks-2/file1
8871 N import-quirks-2/file2
8872 N import-quirks-2/file3
8873 No conflicts created by this import"
8874
8875           dotest_sort import-quirks-3 \
8876 "$testcvs import -b2345678901.2345678901.2345678901 -mthis-ones-ok import-quirks-3 VB RT" \
8877 "
8878
8879 N import-quirks-3/file1
8880 N import-quirks-3/file2
8881 N import-quirks-3/file3
8882 No conflicts created by this import"
8883
8884           dotest_sort import-quirks-4 \
8885 "$testcvs import -b1.1.2 -mthis-ones-ok import-quirks-4 VB RT" \
8886 "
8887
8888 N import-quirks-4/file1
8889 N import-quirks-4/file2
8890 N import-quirks-4/file3
8891 No conflicts created by this import"
8892
8893           if $keep; then
8894             echo Keeping $TESTDIR and exiting due to --keep
8895             exit 0
8896           fi
8897
8898           cd ..
8899           rm -r import-quirks
8900           rm -rf $CVSROOT_DIRNAME/import-quirks-2 \
8901                  $CVSROOT_DIRNAME/import-quirks-3 \
8902                  $CVSROOT_DIRNAME/import-quirks-4
8903           ;;
8904
8905
8906
8907         import-after-initial)
8908           # Properly handle the case in which the first version of a
8909           # file is created by a regular cvs add and commit, and there
8910           # is a subsequent cvs import of the same file.  cvs update with
8911           # a date tag must resort to searching the vendor branch only if
8912           # the initial version of the file was created at the same time
8913           # as the initial version on the vendor branch.
8914
8915           mkdir 1; cd 1
8916           module=x
8917
8918           echo > unused-file
8919
8920           # Create the module.
8921           dotest import-after-initial-1 \
8922             "$testcvs -Q import -m. $module X Y" ''
8923
8924           file=m
8925           # Check it out and add a file.
8926           dotest import-after-initial-2 "$testcvs -Q co $module" ''
8927           cd $module
8928           echo original > $file
8929           dotest import-after-initial-3 "${testcvs} -Q add $file" ""
8930           dotest import-after-initial-4 "${testcvs} -Q ci -m. $file" \
8931 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
8932 done
8933 Checking in $file;
8934 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
8935 initial revision: 1\.1
8936 done"
8937
8938           # Delay a little so the following import isn't done in the same
8939           # second as the preceding commit.
8940           sleep 2
8941
8942           # Do the first import of $file *after* $file already has an
8943           # initial version.
8944           mkdir sub
8945           cd sub
8946           echo newer-via-import > $file
8947           dotest import-after-initial-5 \
8948             "$testcvs -Q import -m. $module X Y2" ''
8949           cd ..
8950
8951           # Sleep a second so we're sure to be after the second of the import.
8952           sleep 1
8953
8954           dotest import-after-initial-6 \
8955             "$testcvs -Q update -p -D now $file" 'original'
8956
8957           cd ../..
8958           rm -rf 1
8959           rm -rf ${CVSROOT_DIRNAME}/$module
8960           ;;
8961
8962         branch-after-import)
8963           # Test branching after an import via both cvs tag -b and
8964           # cvs add to verify that the HEAD remains at 1.1.1.1
8965           # This was a FreeBSD bug documented at the URL:
8966           # http://www.freebsd.org/cgi/query-pr.cgi?pr=4033
8967
8968           mkdir branch-after-import
8969           cd branch-after-import
8970
8971           # OK, first we get some sources from the NetMunger project,
8972           # and import them into the 1.1.1 vendor branch.
8973           mkdir imp-dir
8974           cd imp-dir
8975           echo 'OpenMunger sources' >file1
8976           echo 'OpenMunger sources' >file2
8977           dotest_sort branch-after-import-1 \
8978 "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
8979 '
8980
8981 N first-dir/file1
8982 N first-dir/file2
8983 No conflicts created by this import'
8984           cd ..
8985
8986           # Next checkout the new module
8987           dotest branch-after-import-2 \
8988 "${testcvs} -q co first-dir" \
8989 'U first-dir/file1
8990 U first-dir/file2'
8991           cd first-dir
8992           # Branch tag the file1 and cvs add file2,
8993           # the branch should remain the same in both cases
8994           # such that a new import will not require a conflict
8995           # resolution.
8996           dotest branch-after-import-3 \
8997 "${testcvs} tag -b TESTTOTRON file1" \
8998 'T file1'
8999           dotest branch-after-import-4 \
9000 "$testcvs -q update -r TESTTOTRON" \
9001 "[UP] file1
9002 $PROG update: file2 is no longer in the repository"
9003
9004           cp ../imp-dir/file2 .
9005           dotest branch-after-import-5 \
9006 "${testcvs} add file2" \
9007 "${PROG} add: scheduling file .file2. for addition on branch .TESTTOTRON.
9008 ${PROG} add: use .${PROG} commit. to add this file permanently"
9009
9010           dotest branch-after-import-6 \
9011 "${testcvs} commit -m cvs-add file2" \
9012 "Checking in file2;
9013 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9014 new revision: 1\.1\.1\.1\.2\.2; previous revision: 1\.1\.1\.1\.2\.1
9015 done"
9016
9017           if $keep; then
9018             echo Keeping ${TESTDIR} and exiting due to --keep
9019             exit 0
9020           fi
9021
9022           cd ../..
9023           rm -r branch-after-import
9024           rm -rf ${CVSROOT_DIRNAME}/first-dir
9025           ;;
9026
9027         join)
9028           # Test doing joins which involve adding and removing files.
9029           #   Variety of scenarios (see list below), in the context of:
9030           #     * merge changes from T1 to T2 into the main line
9031           #     * merge changes from branch 'branch' into the main line
9032           #     * merge changes from branch 'branch' into branch 'br2'.
9033           # See also binfile2, which does similar things with binary files.
9034           # See also join2, which tests joining (and update -A) on only
9035           # a single file, rather than a directory.
9036           # See also rmadd2, which tests -j cases not involving branches
9037           #   (e.g. undoing a commit)
9038           # See also join3, which tests some cases involving the greatest
9039           # common ancestor.  Here is a list of tests according to branch
9040           # topology:
9041           #
9042           # --->bp---->trunk          too many to mention
9043           #     \----->branch
9044           #
9045           #     /----->branch1
9046           # --->bp---->trunk          multibranch, multibranch2
9047           #     \----->branch2
9048           #
9049           # --->bp1----->bp2---->trunk   join3
9050           #     \->br1   \->br2
9051           #
9052           # --->bp1----->trunk
9053           #     \----bp2---->branch                branches
9054           #          \------>branch-of-branch
9055
9056           # We check merging changes from T1 to T2 into the main line.
9057           # Here are the interesting cases I can think of:
9058           #   1) File added between T1 and T2, not on main line.
9059           #      File should be marked for addition.
9060           #   2) File added between T1 and T2, also added on main line.
9061           #      Conflict.
9062           #   3) File removed between T1 and T2, unchanged on main line.
9063           #      File should be marked for removal.
9064           #   4) File removed between T1 and T2, modified on main line.
9065           #      If mod checked in, file should be marked for removal.
9066           #      If mod still in working directory, conflict.
9067           #   5) File removed between T1 and T2, was never on main line.
9068           #      Nothing should happen.
9069           #   6) File removed between T1 and T2, also removed on main line.
9070           #      Nothing should happen.
9071           #   7) File not added between T1 and T2, added on main line.
9072           #      Nothing should happen.
9073           #   8) File not modified between T1 and T2, removed on main line.
9074           #      Nothing should happen.
9075           #   9) File modified between T1 and T2, removed on main line.
9076           #      Conflict.
9077           #  10) File was never on branch, removed on main line.
9078           #      Nothing should happen.
9079
9080           # We also check merging changes from a branch into the main
9081           # line.  Here are the interesting cases:
9082           #   1) File added on branch, not on main line.
9083           #      File should be marked for addition.
9084           #   2) File added on branch, also added on main line.
9085           #      Conflict.
9086           #   3) File removed on branch, unchanged on main line.
9087           #      File should be marked for removal.
9088           #   4) File removed on branch, modified on main line.
9089           #      Conflict.
9090           #   5) File removed on branch, was never on main line.
9091           #      Nothing should happen.
9092           #   6) File removed on branch, also removed on main line.
9093           #      Nothing should happen.
9094           #   7) File added on main line, not added on branch.
9095           #      Nothing should happen.
9096           #   8) File removed on main line, not modified on branch.
9097           #      Nothing should happen.
9098           #   9) File modified on branch, removed on main line.
9099           #      Conflict.
9100           #  10) File was never on branch, removed on main line.
9101           #      Nothing should happen.
9102
9103           # In the tests below, fileN represents case N in the above
9104           # lists.
9105
9106           mkdir ${CVSROOT_DIRNAME}/first-dir
9107           mkdir 1
9108           cd 1
9109           dotest join-1 "${testcvs} -q co first-dir" ''
9110
9111           cd first-dir
9112
9113           # Add two files.
9114           echo 'first revision of file3' > file3
9115           echo 'first revision of file4' > file4
9116           echo 'first revision of file6' > file6
9117           echo 'first revision of file8' > file8
9118           echo 'first revision of file9' > file9
9119           dotest join-2 "${testcvs} add file3 file4 file6 file8 file9" \
9120 "${PROG}"' add: scheduling file `file3'\'' for addition
9121 '"${PROG}"' add: scheduling file `file4'\'' for addition
9122 '"${PROG}"' add: scheduling file `file6'\'' for addition
9123 '"${PROG}"' add: scheduling file `file8'\'' for addition
9124 '"${PROG}"' add: scheduling file `file9'\'' for addition
9125 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9126
9127           dotest join-3 "${testcvs} -q commit -m add" \
9128 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
9129 done
9130 Checking in file3;
9131 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9132 initial revision: 1\.1
9133 done
9134 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
9135 done
9136 Checking in file4;
9137 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9138 initial revision: 1\.1
9139 done
9140 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
9141 done
9142 Checking in file6;
9143 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9144 initial revision: 1\.1
9145 done
9146 RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
9147 done
9148 Checking in file8;
9149 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9150 initial revision: 1\.1
9151 done
9152 RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
9153 done
9154 Checking in file9;
9155 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9156 initial revision: 1\.1
9157 done"
9158
9159           # Make a branch.
9160           dotest join-4 "${testcvs} -q tag -b branch ." \
9161 'T file3
9162 T file4
9163 T file6
9164 T file8
9165 T file9'
9166
9167           # Add file2, file7, and file10, modify file4, and remove
9168           # file6, file8, and file9.
9169           echo 'first revision of file2' > file2
9170           echo 'second revision of file4' > file4
9171           echo 'first revision of file7' > file7
9172           rm file6 file8 file9
9173           echo 'first revision of file10' > file10
9174           dotest join-5 "${testcvs} add file2 file7 file10" \
9175 "${PROG}"' add: scheduling file `file2'\'' for addition
9176 '"${PROG}"' add: scheduling file `file7'\'' for addition
9177 '"${PROG}"' add: scheduling file `file10'\'' for addition
9178 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9179           dotest join-6 "${testcvs} rm file6 file8 file9" \
9180 "${PROG}"' remove: scheduling `file6'\'' for removal
9181 '"${PROG}"' remove: scheduling `file8'\'' for removal
9182 '"${PROG}"' remove: scheduling `file9'\'' for removal
9183 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
9184           dotest join-7 "${testcvs} -q ci -mx ." \
9185 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
9186 done
9187 Checking in file10;
9188 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
9189 initial revision: 1\.1
9190 done
9191 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
9192 done
9193 Checking in file2;
9194 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9195 initial revision: 1\.1
9196 done
9197 Checking in file4;
9198 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9199 new revision: 1\.2; previous revision: 1\.1
9200 done
9201 Removing file6;
9202 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9203 new revision: delete; previous revision: 1\.1
9204 done
9205 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
9206 done
9207 Checking in file7;
9208 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
9209 initial revision: 1\.1
9210 done
9211 Removing file8;
9212 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9213 new revision: delete; previous revision: 1\.1
9214 done
9215 Removing file9;
9216 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9217 new revision: delete; previous revision: 1\.1
9218 done"
9219
9220           # Remove file10
9221           dotest join-7a "${testcvs} rm -f file10" \
9222 "${PROG}"' remove: scheduling `file10'\'' for removal
9223 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
9224           dotest join-7b "${testcvs} -q ci -mx ." \
9225 "Removing file10;
9226 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
9227 new revision: delete; previous revision: 1\.1
9228 done"
9229
9230           # Check out the branch.
9231           cd ../..
9232           mkdir 2
9233           cd 2
9234           dotest join-8 "${testcvs} -q co -r branch first-dir" \
9235 'U first-dir/file3
9236 U first-dir/file4
9237 U first-dir/file6
9238 U first-dir/file8
9239 U first-dir/file9'
9240
9241           cd first-dir
9242
9243           # Modify the files on the branch, so that T1 is not an
9244           # ancestor of the main line, and add file5
9245           echo 'first branch revision of file3' > file3
9246           echo 'first branch revision of file4' > file4
9247           echo 'first branch revision of file5' > file5
9248           echo 'first branch revision of file6' > file6
9249           echo 'first branch revision of file9' > file9
9250           dotest join-9 "${testcvs} add file5" \
9251 "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
9252 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
9253           dotest join-10 "${testcvs} -q ci -mx ." \
9254 "Checking in file3;
9255 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9256 new revision: 1\.1\.2\.1; previous revision: 1\.1
9257 done
9258 Checking in file4;
9259 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9260 new revision: 1\.1\.2\.1; previous revision: 1\.1
9261 done
9262 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
9263 done
9264 Checking in file5;
9265 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9266 new revision: 1\.1\.2\.1; previous revision: 1\.1
9267 done
9268 Checking in file6;
9269 ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
9270 new revision: 1\.1\.2\.1; previous revision: 1\.1
9271 done
9272 Checking in file9;
9273 ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
9274 new revision: 1\.1\.2\.1; previous revision: 1\.1
9275 done"
9276
9277           # Tag the current revisions on the branch.
9278           dotest join-11 "${testcvs} -q tag T1 ." \
9279 'T file3
9280 T file4
9281 T file5
9282 T file6
9283 T file8
9284 T file9'
9285
9286           # Add file1 and file2, modify file9, and remove the other files.
9287           echo 'first branch revision of file1' > file1
9288           echo 'first branch revision of file2' > file2
9289           echo 'second branch revision of file9' > file9
9290           rm file3 file4 file5 file6
9291           dotest join-12 "${testcvs} add file1 file2" \
9292 "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
9293 '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
9294 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9295           dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
9296 "${PROG}"' remove: scheduling `file3'\'' for removal
9297 '"${PROG}"' remove: scheduling `file4'\'' for removal
9298 '"${PROG}"' remove: scheduling `file5'\'' for removal
9299 '"${PROG}"' remove: scheduling `file6'\'' for removal
9300 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
9301           dotest join-14 "${testcvs} -q ci -mx ." \
9302 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
9303 done
9304 Checking in file1;
9305 ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
9306 new revision: 1\.1\.2\.1; previous revision: 1\.1
9307 done
9308 Checking in file2;
9309 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9310 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
9311 done
9312 Removing file3;
9313 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9314 new revision: delete; previous revision: 1\.1\.2\.1
9315 done
9316 Removing file4;
9317 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9318 new revision: delete; previous revision: 1\.1\.2\.1
9319 done
9320 Removing file5;
9321 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9322 new revision: delete; previous revision: 1\.1\.2\.1
9323 done
9324 Removing file6;
9325 ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
9326 new revision: delete; previous revision: 1\.1\.2\.1
9327 done
9328 Checking in file9;
9329 ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
9330 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
9331 done"
9332
9333           # Tag the current revisions on the branch.
9334           dotest join-15 "${testcvs} -q tag T2 ." \
9335 'T file1
9336 T file2
9337 T file8
9338 T file9'
9339
9340           # Do a checkout with a merge.
9341           cd ../..
9342           mkdir 3
9343           cd 3
9344           dotest join-16 "$testcvs -q co -jT1 -jT2 first-dir" \
9345 "U first-dir/file1
9346 U first-dir/file2
9347 $PROG checkout: file first-dir/file2 exists, but has been added in revision T2
9348 U first-dir/file3
9349 $PROG checkout: scheduling first-dir/file3 for removal
9350 U first-dir/file4
9351 $PROG checkout: file first-dir/file4 has been removed in revision T2, but the destination is incompatibly modified
9352 C first-dir/file4
9353 U first-dir/file7
9354 $PROG checkout: file first-dir/file9 does not exist, but is present in revision T2"
9355
9356           # Verify that the right changes have been scheduled.
9357           cd first-dir
9358           dotest_fail join-17 "$testcvs -q update" \
9359 'A file1
9360 R file3
9361 C file4'
9362
9363           # Modify file4 locally, and do an update with a merge.
9364           cd ../../1/first-dir
9365           echo 'third revision of file4' > file4
9366           dotest join-18 "$testcvs -q update -jT1 -jT2 ." \
9367 "U file1
9368 $PROG update: file file2 exists, but has been added in revision T2
9369 $PROG update: scheduling file3 for removal
9370 M file4
9371 $PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
9372 C file4
9373 $PROG update: file file9 does not exist, but is present in revision T2"
9374
9375           # Verify that the right changes have been scheduled.
9376           dotest_fail join-19 "$testcvs -q update" \
9377 'A file1
9378 R file3
9379 C file4'
9380
9381           # Do a checkout with a merge from a single revision.
9382
9383           # FIXME: CVS currently gets this wrong.  file2 has been
9384           # added on both the branch and the main line, and so should
9385           # be regarded as a conflict.  However, given the way that
9386           # CVS sets up the RCS file, there is no way to distinguish
9387           # this case from the case of file2 having existed before the
9388           # branch was made.  This could be fixed by reserving
9389           # a revision somewhere, perhaps 1.1, as an always dead
9390           # revision which can be used as the source for files added
9391           # on branches.
9392           cd ../../3
9393           rm -r first-dir
9394           dotest join-20 "$testcvs -q co -jbranch first-dir" \
9395 "U first-dir/file1
9396 U first-dir/file2
9397 RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9398 retrieving revision 1\.1
9399 retrieving revision 1\.1\.2\.2
9400 Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9401 U first-dir/file3
9402 $PROG checkout: scheduling first-dir/file3 for removal
9403 U first-dir/file4
9404 $PROG checkout: file first-dir/file4 has been removed in revision branch, but the destination is incompatibly modified
9405 C first-dir/file4
9406 U first-dir/file7
9407 $PROG checkout: file first-dir/file9 does not exist, but is present in revision branch"
9408
9409           # Verify that the right changes have been scheduled.
9410           # The M file2 line is a bug; see above join-20.
9411           cd first-dir
9412           dotest_fail join-21 "$testcvs -q update" \
9413 'A file1
9414 M file2
9415 R file3
9416 C file4'
9417
9418           # Checkout the main line again.
9419           cd ../../1
9420           rm -r first-dir
9421           dotest join-22 "${testcvs} -q co first-dir" \
9422 'U first-dir/file2
9423 U first-dir/file3
9424 U first-dir/file4
9425 U first-dir/file7'
9426
9427           # Modify file4 locally, and do an update with a merge from a
9428           # single revision.
9429           # The file2 handling is a bug; see above join-20.
9430           cd first-dir
9431           echo 'third revision of file4' > file4
9432           dotest join-23 "$testcvs -q update -jbranch ." \
9433 "U file1
9434 RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9435 retrieving revision 1\.1
9436 retrieving revision 1\.1\.2\.2
9437 Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9438 $PROG update: scheduling file3 for removal
9439 M file4
9440 $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
9441 C file4
9442 $PROG update: file file9 does not exist, but is present in revision branch"
9443
9444           # Verify that the right changes have been scheduled.
9445           # The M file2 line is a bug; see above join-20
9446           dotest_fail join-24 "$testcvs -q update" \
9447 'A file1
9448 M file2
9449 R file3
9450 C file4'
9451
9452           cd ..
9453
9454           # Checkout the main line again and make a new branch which we
9455           # merge to.
9456           rm -r first-dir
9457           dotest join-25 "${testcvs} -q co first-dir" \
9458 'U first-dir/file2
9459 U first-dir/file3
9460 U first-dir/file4
9461 U first-dir/file7'
9462           cd first-dir
9463           dotest join-26 "${testcvs} -q tag -b br2" \
9464 "T file2
9465 T file3
9466 T file4
9467 T file7"
9468           dotest join-27 "$testcvs -q update -r br2" \
9469 '[UP] file2
9470 [UP] file3
9471 [UP] file4
9472 [UP] file7'
9473           # The handling of file8 and file9 here look fishy to me.  I don't
9474           # see why it should be different from the case where we merge to
9475           # the trunk (e.g. join-23).
9476           dotest join-28 "$testcvs -q update -j branch" \
9477 "U file1
9478 RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9479 retrieving revision 1\.1
9480 retrieving revision 1\.1\.2\.2
9481 Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9482 $PROG update: scheduling file3 for removal
9483 $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
9484 C file4
9485 U file8
9486 U file9"
9487           # Verify that the right changes have been scheduled.
9488           dotest_fail join-29 "$testcvs -q update" \
9489 "A file1
9490 M file2
9491 R file3
9492 C file4
9493 A file8
9494 A file9"
9495
9496           # Checkout the mainline again to try updating and merging between two
9497           # branches in the same step
9498           # this seems a likely scenario - the user finishes up on branch and
9499           # updates to br2 and merges in the same step - and there was a bug
9500           # once that if the file was removed in the update then it wouldn't be
9501           # readded in the merge
9502           cd ..
9503           rm -rf first-dir
9504           dotest join-twobranch-1 "${testcvs} -q co -rbranch first-dir" \
9505 'U first-dir/file1
9506 U first-dir/file2
9507 U first-dir/file8
9508 U first-dir/file9'
9509           cd first-dir
9510           dotest join-twobranch-2 "$testcvs -q update -rbr2 -jbranch" \
9511 "$PROG update: file1 is no longer in the repository
9512 U file1
9513 U file2
9514 RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9515 retrieving revision 1\.1
9516 retrieving revision 1\.1\.2\.2
9517 Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9518 U file3
9519 $PROG update: scheduling file3 for removal
9520 U file4
9521 $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
9522 C file4
9523 U file7
9524 $PROG update: file8 is no longer in the repository
9525 U file8
9526 $PROG update: file9 is no longer in the repository
9527 U file9"
9528           # Verify that the right changes have been scheduled.
9529           dotest_fail join-twobranch-3 "$testcvs -q update" \
9530 "A file1
9531 M file2
9532 R file3
9533 C file4
9534 A file8
9535 A file9"
9536
9537           # Checkout the mainline again to try merging from the trunk
9538           # to a branch.
9539           cd ..
9540           rm -r first-dir
9541           dotest join-30 "${testcvs} -q co first-dir" \
9542 'U first-dir/file2
9543 U first-dir/file3
9544 U first-dir/file4
9545 U first-dir/file7'
9546           cd first-dir
9547
9548           # Tag the current revisions on the trunk.
9549           dotest join-31 "${testcvs} -q tag T3 ." \
9550 'T file2
9551 T file3
9552 T file4
9553 T file7'
9554
9555           # Modify file7.
9556           echo 'second revision of file7' > file7
9557           dotest join-32 "${testcvs} -q ci -mx ." \
9558 "Checking in file7;
9559 ${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
9560 new revision: 1\.2; previous revision: 1\.1
9561 done"
9562
9563           # And Tag again.
9564           dotest join-33 "${testcvs} -q tag T4 ." \
9565 'T file2
9566 T file3
9567 T file4
9568 T file7'
9569
9570           # Now update branch to T3.
9571           cd ../../2/first-dir
9572           dotest join-34 "${testcvs} -q up -jT3" \
9573 "${PROG} update: file file4 does not exist, but is present in revision T3
9574 U file7"
9575
9576           # Verify that the right changes have been scheduled.
9577           dotest join-35 "${testcvs} -q update" \
9578 'A file7'
9579
9580           # Now update to T4.
9581           # This is probably a bug, although in this particular case it just
9582           # happens to do the right thing; see above join-20.
9583           dotest join-36 "${testcvs} -q up -j T3 -j T4" \
9584 "A file7
9585 RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
9586 retrieving revision 1\.1
9587 retrieving revision 1\.2
9588 Merging differences between 1\.1 and 1\.2 into file7"
9589
9590           # Verify that the right changes have been scheduled.
9591           dotest join-37 "${testcvs} -q update" \
9592 'A file7'
9593
9594           cd ../..
9595
9596           rm -r 1 2 3
9597           rm -rf ${CVSROOT_DIRNAME}/first-dir
9598           ;;
9599
9600         join2)
9601           # More joining tests.
9602
9603           # First the usual setup; create a directory first-dir, a file
9604           # first-dir/file1, and a branch br1.
9605           mkdir 1; cd 1
9606           dotest join2-1 "${testcvs} -q co -l ." ''
9607           mkdir first-dir
9608           dotest join2-2 "${testcvs} add first-dir" \
9609 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
9610           cd first-dir
9611           echo 'initial contents of file1' >file1
9612           dotest join2-3 "${testcvs} add file1" \
9613 "${PROG} add: scheduling file .file1. for addition
9614 ${PROG} add: use .${PROG} commit. to add this file permanently"
9615           dotest join2-4 "${testcvs} -q ci -m add" \
9616 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9617 done
9618 Checking in file1;
9619 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9620 initial revision: 1\.1
9621 done"
9622           dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
9623           dotest join2-6 "$testcvs -q update -r br1" '[UP] file1'
9624           echo 'modify on branch' >>file1
9625           touch bradd
9626           dotest join2-6a "${testcvs} add bradd" \
9627 "${PROG} add: scheduling file .bradd. for addition on branch .br1.
9628 ${PROG} add: use .${PROG} commit. to add this file permanently"
9629           dotest join2-7 "${testcvs} -q ci -m modify" \
9630 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
9631 done
9632 Checking in bradd;
9633 ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v  <--  bradd
9634 new revision: 1\.1\.2\.1; previous revision: 1\.1
9635 done
9636 Checking in file1;
9637 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9638 new revision: 1\.1\.2\.1; previous revision: 1\.1
9639 done"
9640
9641           # Here is the unusual/pathological part.  We switch back to
9642           # the trunk *for file1 only*, not for the whole directory.
9643           dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
9644           dotest join2-9 "${testcvs} -q status file1" \
9645 "===================================================================
9646 File: file1             Status: Up-to-date
9647
9648    Working revision:    1\.1.*
9649    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
9650    Sticky Tag:          (none)
9651    Sticky Date:         (none)
9652    Sticky Options:      (none)"
9653           dotest join2-10 "cat CVS/Tag" "Tbr1"
9654
9655           dotest join2-11 "${testcvs} -q update -j br1 file1" \
9656 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9657 retrieving revision 1\.1
9658 retrieving revision 1\.1\.2\.1
9659 Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
9660           dotest join2-12 "cat file1" "initial contents of file1
9661 modify on branch"
9662           # We should have no sticky tag on file1
9663           dotest join2-13 "${testcvs} -q status file1" \
9664 "===================================================================
9665 File: file1             Status: Locally Modified
9666
9667    Working revision:    1\.1.*
9668    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
9669    Sticky Tag:          (none)
9670    Sticky Date:         (none)
9671    Sticky Options:      (none)"
9672           dotest join2-14 "cat CVS/Tag" "Tbr1"
9673           # And the checkin should go to the trunk
9674           dotest join2-15 "${testcvs} -q ci -m modify file1" \
9675 "Checking in file1;
9676 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9677 new revision: 1\.2; previous revision: 1\.1
9678 done"
9679
9680           # OK, the above is all well and good and has worked for some
9681           # time.  Now try the case where the file had been added on
9682           # the branch.
9683           dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
9684           # The workaround is to update the whole directory.
9685           # The non-circumvented version won't work.  The reason is that
9686           # update removes the entry from CVS/Entries, so of course we get
9687           # the tag from CVS/Tag and not Entries.  I suppose maybe
9688           # we could invent some new format in Entries which would handle
9689           # this, but doing so, and handling it properly throughout
9690           # CVS, would be a lot of work and I'm not sure this case justifies
9691           # it.
9692           dotest join2-17-circumvent "${testcvs} -q update -A" \
9693 "${PROG} update: bradd is no longer in the repository
9694 [UP] file1"
9695 :         dotest join2-17 "${testcvs} -q update -A bradd" \
9696 "${PROG} update: warning: bradd is not (any longer) pertinent"
9697           dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
9698           dotest join2-19 "${testcvs} -q status bradd" \
9699 "===================================================================
9700 File: bradd             Status: Locally Added
9701
9702    Working revision:    New file!
9703    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
9704    Sticky Tag:          (none)
9705    Sticky Date:         (none)
9706    Sticky Options:      (none)"
9707           dotest join2-20 "${testcvs} -q ci -m modify bradd" \
9708 "Checking in bradd;
9709 ${CVSROOT_DIRNAME}/first-dir/bradd,v  <--  bradd
9710 new revision: 1\.2; previous revision: 1\.1
9711 done"
9712
9713           cd ../..
9714           rm -r 1
9715           rm -rf ${CVSROOT_DIRNAME}/first-dir
9716           ;;
9717
9718         join3)
9719           # See "join" for a list of other joining/branching tests.
9720           # First the usual setup; create a directory first-dir, a file
9721           # first-dir/file1, and a branch br1.
9722           mkdir 1; cd 1
9723           dotest join3-1 "${testcvs} -q co -l ." ''
9724           mkdir first-dir
9725           dotest join3-2 "${testcvs} add first-dir" \
9726 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
9727           cd first-dir
9728           echo 'initial contents of file1' >file1
9729           dotest join3-3 "${testcvs} add file1" \
9730 "${PROG} add: scheduling file .file1. for addition
9731 ${PROG} add: use .${PROG} commit. to add this file permanently"
9732           dotest join3-4 "${testcvs} -q ci -m add" \
9733 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9734 done
9735 Checking in file1;
9736 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9737 initial revision: 1\.1
9738 done"
9739           dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
9740           dotest join3-6 "$testcvs -q update -r br1" '[UP] file1'
9741           echo 'br1:line1' >>file1
9742           dotest join3-7 "${testcvs} -q ci -m modify" \
9743 "Checking in file1;
9744 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9745 new revision: 1\.1\.2\.1; previous revision: 1\.1
9746 done"
9747
9748           # Now back to the trunk for:
9749           # another revision and another branch for file1.
9750           # add file2, which will exist on trunk and br2 but not br1.
9751           dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
9752           echo 'trunk:line1' > file2
9753           dotest join3-8a "${testcvs} add file2" \
9754 "${PROG} add: scheduling file .file2. for addition
9755 ${PROG} add: use .${PROG} commit. to add this file permanently"
9756           echo 'trunk:line1' >>file1
9757           dotest join3-9 "${testcvs} -q ci -m modify" \
9758 "Checking in file1;
9759 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9760 new revision: 1\.2; previous revision: 1\.1
9761 done
9762 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
9763 done
9764 Checking in file2;
9765 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9766 initial revision: 1\.1
9767 done"
9768           dotest join3-10 "${testcvs} -q tag -b br2" "T file1
9769 T file2"
9770
9771           # Before we actually have any revision on br2, let's try a join
9772           dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
9773 ${PROG} update: file2 is no longer in the repository"
9774           dotest join3-12 "${testcvs} -q update -j br2" \
9775 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9776 retrieving revision 1\.1
9777 retrieving revision 1\.2
9778 Merging differences between 1\.1 and 1\.2 into file1
9779 rcsmerge: warning: conflicts during merge
9780 U file2"
9781           dotest join3-13 "cat file1" \
9782 "initial contents of file1
9783 [<]<<<<<< file1
9784 br1:line1
9785 [=]======
9786 trunk:line1
9787 [>]>>>>>> 1\.2"
9788           rm file1
9789
9790           # OK, we'll try the same thing with a revision on br2.
9791           dotest join3-14 "${testcvs} -q update -r br2 file1" \
9792 "${PROG} update: warning: file1 was lost
9793 U file1" "U file1"
9794           echo 'br2:line1' >>file1
9795           dotest join3-15 "${testcvs} -q ci -m modify file1" \
9796 "Checking in file1;
9797 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9798 new revision: 1\.2\.2\.1; previous revision: 1\.2
9799 done"
9800
9801           # OK, now we can join br2 to br1
9802           dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
9803           # It may seem odd, to merge a higher branch into a lower
9804           # branch, but in fact CVS defines the ancestor as 1.1
9805           # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
9806           # This seems like a reasonably plausible behavior.
9807           dotest join3-17 "${testcvs} -q update -j br2 file1" \
9808 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9809 retrieving revision 1\.1
9810 retrieving revision 1\.2\.2\.1
9811 Merging differences between 1\.1 and 1\.2\.2\.1 into file1
9812 rcsmerge: warning: conflicts during merge"
9813           dotest join3-18 "cat file1" \
9814 "initial contents of file1
9815 [<]<<<<<< file1
9816 br1:line1
9817 [=]======
9818 trunk:line1
9819 br2:line1
9820 [>]>>>>>> 1\.2\.2\.1"
9821
9822           cd ../..
9823           rm -r 1
9824           rm -rf ${CVSROOT_DIRNAME}/first-dir
9825           ;;
9826
9827         join4)
9828           # Like join, but with local (uncommitted) modifications.
9829
9830           mkdir ${CVSROOT_DIRNAME}/first-dir
9831           mkdir 1
9832           cd 1
9833           dotest join4-1 "${testcvs} -q co first-dir" ''
9834
9835           cd first-dir
9836
9837           # Add two files.
9838           echo 'first revision of file3' > file3
9839           echo 'first revision of file4' > file4
9840           echo 'first revision of file6' > file6
9841           echo 'first revision of file8' > file8
9842           echo 'first revision of file9' > file9
9843           dotest join4-2 "${testcvs} add file3 file4 file6 file8 file9" \
9844 "${PROG}"' add: scheduling file `file3'\'' for addition
9845 '"${PROG}"' add: scheduling file `file4'\'' for addition
9846 '"${PROG}"' add: scheduling file `file6'\'' for addition
9847 '"${PROG}"' add: scheduling file `file8'\'' for addition
9848 '"${PROG}"' add: scheduling file `file9'\'' for addition
9849 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9850
9851           dotest join4-3 "${testcvs} -q commit -m add" \
9852 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
9853 done
9854 Checking in file3;
9855 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9856 initial revision: 1\.1
9857 done
9858 RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
9859 done
9860 Checking in file4;
9861 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9862 initial revision: 1\.1
9863 done
9864 RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
9865 done
9866 Checking in file6;
9867 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9868 initial revision: 1\.1
9869 done
9870 RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
9871 done
9872 Checking in file8;
9873 ${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9874 initial revision: 1\.1
9875 done
9876 RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
9877 done
9878 Checking in file9;
9879 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9880 initial revision: 1\.1
9881 done"
9882
9883           # Make a branch.
9884           dotest join4-4 "${testcvs} -q tag -b branch ." \
9885 'T file3
9886 T file4
9887 T file6
9888 T file8
9889 T file9'
9890
9891           # Add file10
9892           echo 'first revision of file10' > file10
9893           dotest join4-7a "${testcvs} add file10" \
9894 "${PROG}"' add: scheduling file `file10'\'' for addition
9895 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
9896           dotest join4-7b "${testcvs} -q ci -mx ." \
9897 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
9898 done
9899 Checking in file10;
9900 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
9901 initial revision: 1\.1
9902 done"
9903
9904           # Add file2 and file7, modify file4, and remove
9905           # file6, file8, file9, and file10.
9906           echo 'first revision of file2' > file2
9907           echo 'second revision of file4' > file4
9908           echo 'first revision of file7' > file7
9909           rm file6 file8 file9 file10
9910           dotest join4-5 "${testcvs} add file2 file7" \
9911 "${PROG}"' add: scheduling file `file2'\'' for addition
9912 '"${PROG}"' add: scheduling file `file7'\'' for addition
9913 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9914           dotest join4-6 "${testcvs} rm file6 file8 file9 file10" \
9915 "${PROG}"' remove: scheduling `file6'\'' for removal
9916 '"${PROG}"' remove: scheduling `file8'\'' for removal
9917 '"${PROG}"' remove: scheduling `file9'\'' for removal
9918 '"${PROG}"' remove: scheduling `file10'\'' for removal
9919 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
9920
9921           # Check out the branch.
9922           cd ../..
9923           mkdir 2
9924           cd 2
9925           dotest join4-8 "${testcvs} -q co -r branch first-dir" \
9926 'U first-dir/file3
9927 U first-dir/file4
9928 U first-dir/file6
9929 U first-dir/file8
9930 U first-dir/file9'
9931
9932           cd first-dir
9933
9934           # Modify the files on the branch, so that T1 is not an
9935           # ancestor of the main line, and add file5
9936           echo 'first branch revision of file3' > file3
9937           echo 'first branch revision of file4' > file4
9938           echo 'first branch revision of file5' > file5
9939           echo 'first branch revision of file6' > file6
9940           echo 'first branch revision of file9' > file9
9941           dotest join4-9 "${testcvs} add file5" \
9942 "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
9943 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
9944           dotest join4-10 "${testcvs} -q ci -mx ." \
9945 "Checking in file3;
9946 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9947 new revision: 1\.1\.2\.1; previous revision: 1\.1
9948 done
9949 Checking in file4;
9950 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9951 new revision: 1\.1\.2\.1; previous revision: 1\.1
9952 done
9953 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
9954 done
9955 Checking in file5;
9956 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9957 new revision: 1\.1\.2\.1; previous revision: 1\.1
9958 done
9959 Checking in file6;
9960 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9961 new revision: 1\.1\.2\.1; previous revision: 1\.1
9962 done
9963 Checking in file9;
9964 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9965 new revision: 1\.1\.2\.1; previous revision: 1\.1
9966 done"
9967
9968           # Tag the current revisions on the branch.
9969           dotest join4-11 "${testcvs} -q tag T1 ." \
9970 'T file3
9971 T file4
9972 T file5
9973 T file6
9974 T file8
9975 T file9'
9976
9977           # Add file1 and file2, modify file9, and remove the other files.
9978           echo 'first branch revision of file1' > file1
9979           echo 'first branch revision of file2' > file2
9980           echo 'second branch revision of file9' > file9
9981           rm file3 file4 file5 file6
9982           dotest join4-12 "${testcvs} add file1 file2" \
9983 "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
9984 '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
9985 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
9986           dotest join4-13 "${testcvs} rm file3 file4 file5 file6" \
9987 "${PROG}"' remove: scheduling `file3'\'' for removal
9988 '"${PROG}"' remove: scheduling `file4'\'' for removal
9989 '"${PROG}"' remove: scheduling `file5'\'' for removal
9990 '"${PROG}"' remove: scheduling `file6'\'' for removal
9991 '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
9992           dotest join4-14 "${testcvs} -q ci -mx ." \
9993 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
9994 done
9995 Checking in file1;
9996 ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
9997 new revision: 1\.1\.2\.1; previous revision: 1\.1
9998 done
9999 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
10000 done
10001 Checking in file2;
10002 ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
10003 new revision: 1\.1\.2\.1; previous revision: 1\.1
10004 done
10005 Removing file3;
10006 ${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
10007 new revision: delete; previous revision: 1\.1\.2\.1
10008 done
10009 Removing file4;
10010 ${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
10011 new revision: delete; previous revision: 1\.1\.2\.1
10012 done
10013 Removing file5;
10014 ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
10015 new revision: delete; previous revision: 1\.1\.2\.1
10016 done
10017 Removing file6;
10018 ${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
10019 new revision: delete; previous revision: 1\.1\.2\.1
10020 done
10021 Checking in file9;
10022 ${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
10023 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
10024 done"
10025
10026           # Tag the current revisions on the branch.
10027           dotest join4-15 "${testcvs} -q tag T2 ." \
10028 'T file1
10029 T file2
10030 T file8
10031 T file9'
10032
10033           # Modify file4 locally, and do an update with a merge.
10034           cd ../../1/first-dir
10035           echo 'third revision of file4' > file4
10036           dotest join4-18 "$testcvs -q update -jT1 -jT2 ." \
10037 "U file1
10038 R file10
10039 A file2
10040 $PROG update: file file2 exists, but has been added in revision T2
10041 $PROG update: scheduling file3 for removal
10042 M file4
10043 $PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
10044 C file4
10045 R file6
10046 A file7
10047 R file8
10048 R file9
10049 $PROG update: file file9 does not exist, but is present in revision T2"
10050
10051           # Verify that the right changes have been scheduled.
10052           dotest_fail join4-19 "${testcvs} -q update" \
10053 'A file1
10054 R file10
10055 A file2
10056 R file3
10057 C file4
10058 R file6
10059 A file7
10060 R file8
10061 R file9'
10062
10063           cd ../..
10064
10065           rm -r 1 2
10066           rm -rf ${CVSROOT_DIRNAME}/first-dir
10067           ;;
10068
10069         join5)
10070           # This test verifies that CVS can handle filenames starting with a
10071           # dash (`-') properly.  What used to happen was that CVS handled it
10072           # just fine, until it went to pass them as arguments to the diff
10073           # library, at which point it neglected to pass `--' before the file
10074           # list, causing the diff library to attempt to interpret the file
10075           # name as an argument.
10076           mkdir join5; cd join5
10077           mkdir 1; cd 1
10078           dotest join5-init-1 "${testcvs} -Q co -l ."
10079           mkdir join5
10080           dotest join5-init-2 "${testcvs} -Q add join5"
10081           cd join5
10082           echo "there once was a file from harrisburg" >-file
10083           echo "who's existance it seems was quiteabsurd" >>-file
10084           dotest join5-init-3 "${testcvs} -Q add -- -file"
10085           dotest join5-init-4 "${testcvs} -q ci -minitial" \
10086 "RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
10087 done
10088 Checking in -file;
10089 ${CVSROOT_DIRNAME}/join5/-file,v  <--  -file
10090 initial revision: 1\.1
10091 done"
10092           cd ../..
10093
10094           mkdir 2; cd 2
10095           dotest join5-init-5 "${testcvs} -Q co join5"
10096           cd join5
10097           echo "it tested for free" >>-file
10098           echo "when paid it should be" >>-file
10099           dotest join5-init-4 "${testcvs} -q ci -msecond" \
10100 "Checking in -file;
10101 ${CVSROOT_DIRNAME}/join5/-file,v  <--  -file
10102 new revision: 1\.2; previous revision: 1\.1
10103 done"
10104           cd ../..
10105
10106           cd 1/join5
10107           echo "but maybe it could charge bytheword" >>-file
10108           # This is the test that used to spew complaints from diff3:
10109           dotest join5 "${testcvs} up" \
10110 "${PROG} update: Updating \.
10111 RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
10112 retrieving revision 1\.1
10113 retrieving revision 1\.2
10114 Merging differences between 1\.1 and 1\.2 into -file
10115 rcsmerge: warning: conflicts during merge
10116 ${PROG} update: conflicts found in -file
10117 C -file"
10118           cd ../..
10119
10120           if $keep; then
10121             echo Keeping ${TESTDIR} and exiting due to --keep
10122             exit 0
10123           fi
10124
10125           cd ..
10126           rm -r join5
10127           rm -rf ${CVSROOT_DIRNAME}/join5
10128           ;;
10129
10130         join6)
10131           mkdir join6; cd join6
10132           mkdir 1; cd 1
10133           dotest join6-init-1 "${testcvs} -Q co -l ."
10134           mkdir join6
10135           dotest join6-init-2 "${testcvs} -Q add join6"
10136           cd join6
10137           echo aaa >temp.txt
10138           echo bbb >>temp.txt
10139           echo ccc >>temp.txt
10140           dotest join6-1 "${testcvs} -Q add temp.txt"
10141           dotest join6-2 "${testcvs} -q commit -minitial temp.txt" \
10142 "RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10143 done
10144 Checking in temp\.txt;
10145 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
10146 initial revision: 1\.1
10147 done"
10148           cp temp.txt temp2.txt
10149           echo ddd >>temp.txt
10150           dotest join6-3 "${testcvs} -q commit -madd temp.txt" \
10151 "Checking in temp\.txt;
10152 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
10153 new revision: 1\.2; previous revision: 1\.1
10154 done"
10155
10156           # The case where the merge target is up-to-date and its base revision
10157           # matches the second argument to -j: CVS doesn't bother attempting
10158           # the merge since it already knows that the target contains the
10159           # change.
10160           dotest join6-3.3 "${testcvs} update -j1.1 -j1.2 temp.txt" \
10161 "temp\.txt already contains the differences between 1\.1 and 1\.2"
10162           dotest join6-3.4 "${testcvs} diff temp.txt" ""
10163
10164           # The case where the merge target is modified but already contains
10165           # the change.
10166           echo bbb >temp.txt
10167           echo ccc >>temp.txt
10168           echo ddd >>temp.txt
10169           dotest join6-3.5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
10170 "M temp\.txt
10171 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10172 retrieving revision 1\.1
10173 retrieving revision 1\.2
10174 Merging differences between 1\.1 and 1\.2 into temp\.txt
10175 temp\.txt already contains the differences between 1\.1 and 1\.2"
10176           dotest_fail join6-3.6 "${testcvs} diff temp.txt" \
10177 "Index: temp\.txt
10178 ===================================================================
10179 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10180 retrieving revision 1\.2
10181 diff -r1\.2 temp.txt
10182 1d0
10183 < aaa"
10184
10185           cp temp2.txt temp.txt
10186           dotest_fail join6-4 "${testcvs} diff temp.txt" \
10187 "Index: temp.txt
10188 ===================================================================
10189 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10190 retrieving revision 1\.2
10191 diff -r1\.2 temp\.txt
10192 4d3
10193 < ddd"
10194
10195           dotest join6-5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
10196 "M temp\.txt
10197 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10198 retrieving revision 1\.1
10199 retrieving revision 1\.2
10200 Merging differences between 1\.1 and 1\.2 into temp\.txt"
10201           dotest join6-6 "${testcvs} diff temp.txt" ""
10202           mv temp.txt temp3.txt
10203           dotest join6-7 "sed 's/ddd/dddd/' < temp3.txt > temp.txt" ""
10204           dotest join6-8 "${testcvs} update -j1.1 -j1.2 temp.txt" \
10205 "M temp\.txt
10206 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10207 retrieving revision 1\.1
10208 retrieving revision 1\.2
10209 Merging differences between 1\.1 and 1\.2 into temp\.txt
10210 rcsmerge: warning: conflicts during merge"
10211           dotest_fail join6-9 "${testcvs} diff temp.txt" \
10212 "Index: temp\.txt
10213 ===================================================================
10214 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10215 retrieving revision 1\.2
10216 diff -r1\.2 temp\.txt
10217 3a4,6
10218 > <<<<<<< temp\.txt
10219 > dddd
10220 > =======
10221 4a8
10222 > >>>>>>> 1\.2"
10223           cp temp2.txt temp.txt
10224           dotest join6-10 "${testcvs} -q ci -m del temp.txt" \
10225 "Checking in temp\.txt;
10226 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
10227 new revision: 1\.3; previous revision: 1\.2
10228 done"
10229           cp temp3.txt temp.txt
10230           dotest_fail join6-11 "${testcvs} diff temp.txt" \
10231 "Index: temp\.txt
10232 ===================================================================
10233 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10234 retrieving revision 1\.3
10235 diff -r1\.3 temp\.txt
10236 3a4
10237 > ddd"
10238           dotest join6-12 "${testcvs} update -j1.2 -j1.3 temp.txt" \
10239 "M temp\.txt
10240 RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10241 retrieving revision 1\.2
10242 retrieving revision 1\.3
10243 Merging differences between 1\.2 and 1\.3 into temp\.txt"
10244           dotest join6-13 "${testcvs} diff temp.txt" ""
10245
10246           # The case where the merge target wasn't created until after the
10247           # first tag was applied
10248           rm temp2.txt temp3.txt
10249           dotest join6-20 "${testcvs} -q tag -r1.1 t1" \
10250 "T temp.txt"
10251           echo xxx >temp2.txt
10252           dotest join6-21 "${testcvs} -Q add temp2.txt"
10253           dotest join6-22 "${testcvs} -q ci -m." \
10254 "RCS file: ${CVSROOT_DIRNAME}/join6/temp2.txt,v
10255 done
10256 Checking in temp2\.txt;
10257 ${CVSROOT_DIRNAME}/join6/temp2\.txt,v  <--  temp2\.txt
10258 initial revision: 1\.1
10259 done"
10260           dotest join6-23 "${testcvs} -q tag t2" \
10261 "T temp.txt
10262 T temp2.txt"
10263           echo xxx >>temp.txt
10264           dotest join6-24 "${testcvs} -q ci -m." \
10265 "Checking in temp\.txt;
10266 ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
10267 new revision: 1\.4; previous revision: 1\.3
10268 done"
10269           dotest join6-25 "${testcvs} -q up -jt1 -jt2" \
10270 "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10271 retrieving revision 1\.1
10272 retrieving revision 1\.3
10273 Merging differences between 1\.1 and 1\.3 into temp.txt
10274 temp.txt already contains the differences between 1\.1 and 1\.3
10275 temp2.txt already contains the differences between creation and 1\.1"
10276
10277           # Now for my next trick: delete the file, recreate it, and
10278           # try to merge
10279           dotest join6-30 "${testcvs} -q rm -f temp2.txt" \
10280 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
10281           dotest join6-31 "${testcvs} -q ci -m. temp2.txt" \
10282 "Removing temp2\.txt;
10283 ${CVSROOT_DIRNAME}/join6/temp2\.txt,v  <--  temp2\.txt
10284 new revision: delete; previous revision: 1\.1
10285 done"
10286           echo new >temp2.txt
10287           # FIXCVS: Local and remote really shouldn't be different and there
10288           # really shouldn't be two different status lines for temp2.txt
10289           if $remote; then
10290             dotest_fail join6-32 "${testcvs} -q up -jt1 -jt2" \
10291 "? temp2\.txt
10292 RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10293 retrieving revision 1\.1
10294 retrieving revision 1\.3
10295 Merging differences between 1\.1 and 1\.3 into temp.txt
10296 temp.txt already contains the differences between 1\.1 and 1\.3
10297 ${PROG} update: move away \./temp2\.txt; it is in the way
10298 C temp2\.txt"
10299           else
10300             dotest join6-32 "${testcvs} -q up -jt1 -jt2" \
10301 "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10302 retrieving revision 1\.1
10303 retrieving revision 1\.3
10304 Merging differences between 1\.1 and 1\.3 into temp.txt
10305 temp.txt already contains the differences between 1\.1 and 1\.3
10306 ${PROG} update: use .${PROG} add. to create an entry for temp2\.txt
10307 U temp2\.txt
10308 ? temp2\.txt"
10309           fi
10310
10311           cd ../../..
10312
10313           if $keep; then
10314             echo Keeping ${TESTDIR} and exiting due to --keep
10315             exit 0
10316           fi
10317
10318           rm -r join6
10319           rm -rf ${CVSROOT_DIRNAME}/join6
10320           ;;
10321
10322         join7)
10323           # This test deals with joins that happen with the -n switch
10324           mkdir join7; cd join7
10325           mkdir impdir; cd impdir
10326           echo aaa >temp.txt
10327           echo bbb >>temp.txt
10328           echo ccc >>temp.txt
10329           dotest join7-1 \
10330 "${testcvs} -Q import -minitial join7 vendor vers-1" \
10331 ""
10332           cd ..
10333           dotest join7-2 "${testcvs} -Q co join7" ""
10334           cd join7
10335           echo ddd >> temp.txt
10336           dotest join7-3 "${testcvs} -Q ci -madded-line temp.txt" \
10337 "Checking in temp.txt;
10338 $CVSROOT_DIRNAME/join7/temp.txt,v  <--  temp.txt
10339 new revision: 1\.2; previous revision: 1\.1
10340 done"
10341           cd ../impdir
10342           echo aaaa >temp.txt
10343           echo bbbb >>temp.txt
10344           echo ccc >>temp.txt
10345           echo eee >>temp.txt
10346           dotest join7-4 \
10347 "${testcvs} -Q import -minitial join7 vendor vers-2" \
10348 ""
10349           cd ../join7
10350           dotest join7-5 \
10351 "${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \
10352 "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
10353 retrieving revision 1\.1\.1\.1
10354 retrieving revision 1\.1\.1\.2
10355 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10356 rcsmerge: warning: conflicts during merge"
10357           touch temp.txt
10358           dotest join7-6 "${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \
10359 "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
10360 retrieving revision 1\.1\.1\.1
10361 retrieving revision 1\.1\.1\.2
10362 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10363 rcsmerge: warning: conflicts during merge" \
10364 "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
10365 retrieving revision 1\.1\.1\.1
10366 retrieving revision 1\.1\.1\.2
10367 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10368 rcsmerge: warning: conflicts during merge"
10369
10370           if $keep; then
10371             echo Keeping ${TESTDIR} and exiting due to --keep
10372             exit 0
10373           fi
10374
10375           cd ../..
10376           rm -r join7
10377           rm -rf $CVSROOT_DIRNAME/join7
10378           ;;
10379
10380
10381
10382         join8)
10383           # In this test case, we have 2 projects, one called "pvcs" and one
10384           # called "project".  The "pvcs" project has modified the file, while
10385           # the "project" project has caused a deletion.  When "project" is
10386           # merged into "pvcs", we expect CVS to detect a conflict.
10387           mkdir join8; cd join8
10388           mkdir combine
10389           mkdir base
10390           mkdir pvcs
10391           mkdir project
10392        
10393           echo "aaa" >base/file.txt
10394           echo "bbb" >pvcs/file.txt
10395           echo "ccc" >project/xxx.txt
10396        
10397           cd base
10398           dotest join8-1 \
10399 "$testcvs import -b 1.1.101 -ko -m 'base import' join8 base base-1" \
10400 "N join8/file\.txt
10401
10402 No conflicts created by this import"
10403        
10404           cd ../pvcs
10405           dotest join8-2 \
10406 "$testcvs import -b 1.1.201 -ko -m 'pvcs import' join8 pvcs pvcs-1" \
10407 "C join8/file\.txt
10408
10409 1 conflicts created by this import.
10410 Use the following command to help the merge:
10411
10412         $PROG checkout -j<prev_rel_tag> -jpvcs-1 join8"
10413
10414           cd ../project
10415           dotest join8-3 \
10416 "$testcvs import -b 1.1.301 -ko -m 'project import' join8 project project-1" \
10417 "N join8/xxx\.txt
10418
10419 No conflicts created by this import"
10420
10421           cd ..
10422           dotest join8-4 \
10423 "$testcvs checkout -r pvcs-1 -j base-1 -j project-1 -d combine join8" \
10424 "$PROG checkout: Updating combine
10425 U combine/file\.txt
10426 $PROG checkout: file combine/file\.txt has been removed in revision project-1, but the destination is incompatibly modified
10427 C combine/file.txt
10428 U combine/xxx\.txt"
10429
10430           dotest join8-5 \
10431 "$testcvs -Q up -pr base-1 combine/file.txt >combine/file.txt"
10432
10433           dotest join8-6 \
10434 "$testcvs up -j base-1 -j project-1 combine" \
10435 "$PROG update: Updating combine
10436 M combine/file\.txt
10437 $PROG update: scheduling combine/file\.txt for removal
10438 A combine/xxx\.txt
10439 $PROG update: file combine/xxx\.txt exists, but has been added in revision project-1"
10440           cd ..
10441        
10442           if $keep; then
10443             echo Keeping $TESTDIR and exiting due to --keep
10444                    exit 0
10445           fi
10446        
10447           rm -r join8
10448           rm -rf $CVSROOT_DIRNAME/join8
10449           ;;
10450
10451
10452
10453         join9)
10454           # In this test case, we have 2 projects, one called "pvcs" and one
10455           # called "project".  The "pvcs" project has not modified the file,
10456           # while the "project" project has caused a deletion.  When "project"
10457           # is merged into "pvcs", we expect CVS to remove the file without
10458           # fuss, as there is no conflict.
10459           mkdir join9; cd join9
10460           mkdir combine
10461           mkdir base
10462           mkdir pvcs
10463           mkdir project
10464        
10465           echo "aaa" >base/file.txt
10466           echo "aaa" >pvcs/file.txt
10467           echo "ccc" >project/xxx.txt
10468        
10469           cd base
10470           dotest join9-1 \
10471 "$testcvs import -b 1.1.101 -ko -m 'base import' join9 base base-1" \
10472 "N join9/file\.txt
10473
10474 No conflicts created by this import"
10475
10476           cd ../pvcs
10477           dotest join9-2 \
10478 "$testcvs import -b 1.1.201 -ko -m 'pvcs import' join9 pvcs pvcs-1" \
10479 "C join9/file\.txt
10480
10481 1 conflicts created by this import.
10482 Use the following command to help the merge:
10483
10484         $PROG checkout -j<prev_rel_tag> -jpvcs-1 join9"
10485
10486           cd ../project
10487           dotest join9-3 \
10488 "$testcvs import -b 1.1.301 -ko -m 'project import' join9 project project-1" \
10489 "N join9/xxx\.txt
10490
10491 No conflicts created by this import"
10492
10493           cd ..
10494           dotest join9-4 \
10495 "$testcvs checkout -r pvcs-1 -j base-1 -j project-1 -d combine join9" \
10496 "$PROG checkout: Updating combine
10497 U combine/file\.txt
10498 $PROG checkout: scheduling combine/file\.txt for removal
10499 U combine/xxx\.txt"
10500
10501           cd ..
10502
10503           if $keep; then
10504             echo Keeping $TESTDIR and exiting due to --keep
10505                    exit 0
10506           fi
10507
10508           rm -r join9
10509           rm -rf $CVSROOT_DIRNAME/join9
10510          ;;
10511
10512
10513
10514         join-readonly-conflict)
10515           # Previously, only tests 1 & 11 were being tested.  I added the
10516           # intermediate dotest's to try and diagnose a different failure
10517           #
10518           # Demonstrate that cvs-1.9.29 can fail on 2nd and subsequent
10519           # conflict-evoking join attempts.
10520           # Even with that version of CVS, This test failed only in
10521           # client-server mode, and would have been noticed in normal
10522           # operation only for files that were read-only (either due to
10523           # use of cvs' global -r option, setting the CVSREAD envvar,
10524           # or use of watch lists).
10525           mkdir join-readonly-conflict; cd join-readonly-conflict
10526           dotest join-readonly-conflict-1 "$testcvs -q co -l ." ''
10527           module=join-readonly-conflict
10528           mkdir $module
10529           $testcvs -q add $module >>$LOGFILE 2>&1
10530           cd $module
10531
10532           file=m
10533           echo trunk > $file
10534           dotest join-readonly-conflict-2 "$testcvs -Q add $file" ''
10535
10536           dotest join-readonly-conflict-3 "$testcvs -q ci -m . $file" \
10537 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
10538 done
10539 Checking in $file;
10540 $CVSROOT_DIRNAME/$module/$file,v  <--  $file
10541 initial revision: 1\.1
10542 done"
10543
10544           dotest join-readonly-conflict-4 "$testcvs tag -b B $file" "T $file"
10545           dotest join-readonly-conflict-5 "$testcvs -q update -rB $file" \
10546 "[UP] $file"
10547           echo branch B > $file
10548           dotest join-readonly-conflict-6 "$testcvs -q ci -m . $file" \
10549 "Checking in $file;
10550 $CVSROOT_DIRNAME/$module/$file,v  <--  $file
10551 new revision: 1\.1\.2\.1; previous revision: 1\.1
10552 done"
10553
10554           rm $file
10555           dotest join-readonly-conflict-7 "$testcvs -Q update -A $file" ''
10556           # Make sure $file is read-only.  This can happen more realistically
10557           # via patch -- which could be used to apply a delta, yet would
10558           # preserve a file's read-only permissions.
10559           echo conflict > $file; chmod u-w $file
10560           dotest join-readonly-conflict-8 "$testcvs update -r B $file" \
10561 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
10562 retrieving revision 1\.1
10563 retrieving revision 1\.1\.2\.1
10564 Merging differences between 1\.1 and 1\.1\.2\.1 into $file
10565 rcsmerge: warning: conflicts during merge
10566 ${PROG} update: conflicts found in $file
10567 C $file"
10568
10569           # restore to the trunk
10570           rm -f $file
10571           dotest join-readonly-conflict-9 "$testcvs -Q update -A $file" ''
10572
10573           # This one would fail because cvs couldn't open the existing
10574           # (and read-only) .# file for writing.
10575           echo conflict > $file
10576
10577           # verify that the backup file is not writable
10578           if test -w ".#$file.1.1"; then
10579             fail "join-readonly-conflict-10 : .#$file.1.1 is writable"
10580           else
10581             pass "join-readonly-conflict-10"
10582           fi
10583           dotest join-readonly-conflict-11 "$testcvs update -r B $file" \
10584 "RCS file: $CVSROOT_DIRNAME/$module/$file,v
10585 retrieving revision 1\.1
10586 retrieving revision 1\.1\.2\.1
10587 Merging differences between 1\.1 and 1\.1\.2\.1 into $file
10588 rcsmerge: warning: conflicts during merge
10589 ${PROG} update: conflicts found in $file
10590 C m"
10591
10592           cd ../..
10593           if $keep; then :; else
10594             rm -rf join-readonly-conflict
10595             rm -rf $CVSROOT_DIRNAME/$module
10596           fi
10597           ;;
10598
10599         join-admin)
10600           mkdir 1; cd 1
10601           dotest join-admin-1 "$testcvs -q co -l ." ''
10602           module=x
10603           mkdir $module
10604           $testcvs -q add $module >>$LOGFILE 2>&1
10605           cd $module
10606
10607           # Create a file so applying the first tag works.
10608           echo foo > a
10609           $testcvs -Q add a > /dev/null 2>&1
10610           $testcvs -Q ci -m. a > /dev/null 2>&1
10611
10612           $testcvs -Q tag -b B
10613           $testcvs -Q tag -b M1
10614           echo '$''Id$' > b
10615           $testcvs -Q add b > /dev/null 2>&1
10616           $testcvs -Q ci -m. b > /dev/null 2>&1
10617           $testcvs -Q tag -b M2
10618
10619           $testcvs -Q update -r B
10620           $testcvs -Q update -kk -jM1 -jM2
10621           $testcvs -Q ci -m. b >/dev/null 2>&1
10622
10623           $testcvs -Q update -A
10624
10625           # Verify that the -kk flag from the update did not
10626           # propagate to the repository.
10627           dotest join-admin-1 "$testcvs status b" \
10628 "===================================================================
10629 File: b                 Status: Up-to-date
10630
10631    Working revision:    1\.1.*
10632    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/x/b,v
10633    Sticky Tag:          (none)
10634    Sticky Date:         (none)
10635    Sticky Options:      (none)"
10636
10637           cd ../..
10638           rm -rf 1
10639           rm -rf ${CVSROOT_DIRNAME}/$module
10640           ;;
10641
10642         join-admin-2)
10643           # Show that when a merge (via update -kk -jtag1 -jtag2) first
10644           # removes a file, then modifies another containing an $Id...$ line,
10645           # the resulting file contains the unexpanded `$Id.$' string, as
10646           # -kk requires.
10647           mkdir 1; cd 1
10648           dotest join-admin-2-1 "$testcvs -q co -l ." ''
10649           module=x
10650           mkdir $module
10651           dotest join-admin-2-2 "$testcvs -q add $module" \
10652 "Directory ${CVSROOT_DIRNAME}/x added to the repository"
10653           cd $module
10654
10655           # Create a file so applying the first tag works.
10656           echo '$''Id$' > e0
10657           cp e0 e
10658           dotest join-admin-2-3 "$testcvs -Q add e" ''
10659           dotest join-admin-2-4 "$testcvs -Q ci -m. e" \
10660 "RCS file: ${CVSROOT_DIRNAME}/x/e,v
10661 done
10662 Checking in e;
10663 ${CVSROOT_DIRNAME}/x/e,v  <--  e
10664 initial revision: 1\.1
10665 done"
10666
10667           dotest join-admin-2-5 "$testcvs -Q tag -b T" '' "${QUESTION} e0"
10668           dotest join-admin-2-6 "$testcvs -Q update -r T" '' "${QUESTION} e0"
10669           cp e0 e
10670           dotest join-admin-2-7 "$testcvs -Q ci -m. e" \
10671 "Checking in e;
10672 ${CVSROOT_DIRNAME}/x/e,v  <--  e
10673 new revision: 1\.1\.2\.1; previous revision: 1\.1
10674 done"
10675
10676           dotest join-admin-2-8 "$testcvs -Q update -A" '' "${QUESTION} e0"
10677           dotest join-admin-2-9 "$testcvs -Q tag -b M1" '' "${QUESTION} e0"
10678
10679           echo '$''Id$' > b
10680           dotest join-admin-2-10 "$testcvs -Q add b" ''
10681           cp e0 e
10682           dotest join-admin-2-11 "$testcvs -Q ci -m. b e" \
10683 "RCS file: ${CVSROOT_DIRNAME}/x/b,v
10684 done
10685 Checking in b;
10686 ${CVSROOT_DIRNAME}/x/b,v  <--  b
10687 initial revision: 1\.1
10688 done
10689 Checking in e;
10690 ${CVSROOT_DIRNAME}/x/e,v  <--  e
10691 new revision: 1\.2; previous revision: 1\.1
10692 done"
10693
10694           dotest join-admin-2-12 "$testcvs -Q tag -b M2" '' "${QUESTION} e0"
10695
10696           dotest join-admin-2-13 "$testcvs -Q update -r T" '' "${QUESTION} e0"
10697           dotest join-admin-2-14 "$testcvs update -kk -jM1 -jM2" \
10698 "${PROG} update: Updating .
10699 U b
10700 U e
10701 RCS file: ${CVSROOT_DIRNAME}/x/e,v
10702 retrieving revision 1\.1
10703 retrieving revision 1\.2
10704 Merging differences between 1\.1 and 1\.2 into e
10705 e already contains the differences between 1\.1 and 1\.2
10706 ${QUESTION} e0" \
10707 "${QUESTION} e0
10708 ${PROG} update: Updating .
10709 U b
10710 U e
10711 RCS file: ${CVSROOT_DIRNAME}/x/e,v
10712 retrieving revision 1\.1
10713 retrieving revision 1\.2
10714 Merging differences between 1\.1 and 1\.2 into e
10715 e already contains the differences between 1\.1 and 1\.2"
10716
10717           # Verify that the $Id.$ string is not expanded.
10718           dotest join-admin-2-15 "cat e" '$''Id$'
10719
10720           cd ../..
10721           rm -rf 1
10722           rm -rf ${CVSROOT_DIRNAME}/$module
10723           ;;
10724
10725         join-rm)
10726           # This first half of this test checks that a single-argument merge
10727           # from a branch is capable of removing files.
10728           #
10729           # The second half verifies that an update to another location with an
10730           # uncommitted removal will transfer the destination branch of the
10731           # removal.
10732
10733           module=join-rm
10734           mkdir $module; cd $module
10735
10736           dotest join-rm-init-1 "$testcvs -q co -l ." ''
10737           mkdir $module
10738           dotest join-rm-init-2 "$testcvs -q add $module" \
10739 "Directory $CVSROOT_DIRNAME/$module added to the repository"
10740           cd $module
10741
10742           # add some files.
10743           touch a b c d e f g
10744           dotest join-rm-init-3 "$testcvs -Q add a b c d e f g"
10745           dotest join-rm-init-4 "$testcvs -Q ci -m add-em" \
10746 "RCS file: $CVSROOT_DIRNAME/join-rm/a,v
10747 done
10748 Checking in a;
10749 $CVSROOT_DIRNAME/join-rm/a,v  <--  a
10750 initial revision: 1\.1
10751 done
10752 RCS file: $CVSROOT_DIRNAME/join-rm/b,v
10753 done
10754 Checking in b;
10755 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
10756 initial revision: 1\.1
10757 done
10758 RCS file: $CVSROOT_DIRNAME/join-rm/c,v
10759 done
10760 Checking in c;
10761 $CVSROOT_DIRNAME/join-rm/c,v  <--  c
10762 initial revision: 1\.1
10763 done
10764 RCS file: $CVSROOT_DIRNAME/join-rm/d,v
10765 done
10766 Checking in d;
10767 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
10768 initial revision: 1\.1
10769 done
10770 RCS file: $CVSROOT_DIRNAME/join-rm/e,v
10771 done
10772 Checking in e;
10773 $CVSROOT_DIRNAME/join-rm/e,v  <--  e
10774 initial revision: 1\.1
10775 done
10776 RCS file: $CVSROOT_DIRNAME/join-rm/f,v
10777 done
10778 Checking in f;
10779 $CVSROOT_DIRNAME/join-rm/f,v  <--  f
10780 initial revision: 1\.1
10781 done
10782 RCS file: $CVSROOT_DIRNAME/join-rm/g,v
10783 done
10784 Checking in g;
10785 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
10786 initial revision: 1\.1
10787 done"
10788           
10789           # create the branch and update to it
10790           dotest join-rm-init-5 "$testcvs -Q tag -b br"
10791           dotest join-rm-init-6 "$testcvs -Q up -rbr"
10792
10793           # remove a few files from the branch
10794           dotest join-rm-init-7 "$testcvs -Q rm -f b d g"
10795           dotest join-rm-init-8 "$testcvs -Q ci -mrm" \
10796 "Removing b;
10797 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
10798 new revision: delete; previous revision: 1\.1
10799 done
10800 Removing d;
10801 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
10802 new revision: delete; previous revision: 1\.1
10803 done
10804 Removing g;
10805 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
10806 new revision: delete; previous revision: 1\.1
10807 done"
10808
10809           # update to the trunk
10810           dotest join-rm-init-9 "$testcvs -Q up -A"
10811
10812           # now for the test - try and merge the removals.
10813           dotest join-rm-1 "$testcvs -q up -jbr" \
10814 "$PROG update: scheduling b for removal
10815 $PROG update: scheduling d for removal
10816 $PROG update: scheduling g for removal"
10817
10818           # And make sure the merge took
10819           dotest join-rm-2 "$testcvs -qn up" \
10820 "R b
10821 R d
10822 R g"
10823
10824           dotest join-rm-3 "$testcvs -q ci -m 'save the merge'" \
10825 "Removing b;
10826 $CVSROOT_DIRNAME/join-rm/b,v  <--  b
10827 new revision: delete; previous revision: 1\.1
10828 done
10829 Removing d;
10830 $CVSROOT_DIRNAME/join-rm/d,v  <--  d
10831 new revision: delete; previous revision: 1\.1
10832 done
10833 Removing g;
10834 $CVSROOT_DIRNAME/join-rm/g,v  <--  g
10835 new revision: delete; previous revision: 1\.1
10836 done"
10837
10838           # and verify that it was the head revision which was removed.
10839           dotest join-rm-4 "$testcvs -q log b"  "
10840 RCS file: $CVSROOT_DIRNAME/join-rm/Attic/b,v
10841 Working file: b
10842 head: 1\.2
10843 branch:
10844 locks: strict
10845 access list:
10846 symbolic names:
10847         br: 1\.1\.0\.2
10848 keyword substitution: kv
10849 total revisions: 3;     selected revisions: 3
10850 description:
10851 ----------------------------
10852 revision 1\.2
10853 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
10854 save the merge
10855 ----------------------------
10856 revision 1\.1
10857 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
10858 branches:  1.1.2;
10859 add-em
10860 ----------------------------
10861 revision 1\.1\.2\.1
10862 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
10863 rm
10864 ============================================================================="
10865
10866           # go back to the branch to set up for the second set of tests
10867           dotest join-rm-init-10 "$testcvs -Q up -rbr"
10868           dotest join-rm-init-11 "$testcvs -Q rm -f a"
10869           dotest join-rm-init-12 "$testcvs -Q ci -m rma" \
10870 "Removing a;
10871 $CVSROOT_DIRNAME/join-rm/a,v  <--  a
10872 new revision: delete; previous revision: 1\.1
10873 done"
10874
10875           # now the test: update to the trunk
10876           #
10877           # FIXCVS: This update should merge the removal to the trunk.  It does
10878           # not.
10879           dotest join-rm-5 "$testcvs -q up -A" \
10880 'U a
10881 U c
10882 U e
10883 U f'
10884
10885           # and verify that there is no sticky tag
10886           dotest join-rm-6 "$testcvs status a" \
10887 "===================================================================
10888 File: a                 Status: Up-to-date
10889
10890    Working revision:    1\.1.*
10891    Repository revision: 1\.1    $CVSROOT_DIRNAME/join-rm/a,v
10892    Sticky Tag:          (none)
10893    Sticky Date:         (none)
10894    Sticky Options:      (none)"
10895
10896           if $keep; then
10897             echo Keeping $TESTDIR and exiting due to --keep
10898             exit 0
10899           fi
10900
10901           cd ../..
10902           rm -rf $CVSROOT_DIRNAME/$module
10903           rm -r $module
10904           ;;
10905
10906         new) # look for stray "no longer pertinent" messages.
10907                 mkdir ${CVSROOT_DIRNAME}/first-dir
10908
10909                 if ${CVS} co first-dir  ; then
10910                     pass 117
10911                 else
10912                     fail 117
10913                 fi
10914
10915                 cd first-dir
10916                 touch a
10917
10918                 if ${CVS} add a  2>>${LOGFILE}; then
10919                     pass 118
10920                 else
10921                     fail 118
10922                 fi
10923
10924                 if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
10925                     pass 119
10926                 else
10927                     fail 119
10928                 fi
10929
10930                 rm a
10931
10932                 if ${CVS} rm a  2>>${LOGFILE}; then
10933                     pass 120
10934                 else
10935                     fail 120
10936                 fi
10937
10938                 if ${CVS} ci -m removed >>${LOGFILE} ; then
10939                     pass 121
10940                 else
10941                     fail 121
10942                 fi
10943
10944                 if ${CVS} update -A  2>&1 | grep longer ; then
10945                     fail 122
10946                 else
10947                     pass 122
10948                 fi
10949
10950                 if ${CVS} update -rHEAD 2>&1 | grep longer ; then
10951                     fail 123
10952                 else
10953                     pass 123
10954                 fi
10955
10956                 cd ..
10957                 rm -r first-dir
10958                 rm -rf ${CVSROOT_DIRNAME}/first-dir
10959                 ;;
10960
10961         newb)
10962           # Test removing a file on a branch and then checking it out.
10963
10964           # We call this "newb" only because it, like the "new" tests,
10965           # has something to do with "no longer pertinent" messages.
10966           # Not necessarily the most brilliant nomenclature.
10967
10968           # Create file 'a'.
10969           mkdir ${CVSROOT_DIRNAME}/first-dir
10970           dotest newb-123a "${testcvs} -q co first-dir" ''
10971           cd first-dir
10972           touch a
10973           dotest newb-123b "${testcvs} add a" \
10974 "${PROG} add: scheduling file .a. for addition
10975 ${PROG} add: use .${PROG} commit. to add this file permanently"
10976           dotest newb-123c "${testcvs} -q ci -m added" \
10977 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
10978 done
10979 Checking in a;
10980 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10981 initial revision: 1\.1
10982 done"
10983
10984           # Make a branch.
10985           dotest newb-123d "${testcvs} -q tag -b branch" "T a"
10986
10987           # Check out the branch.
10988           cd ..
10989           rm -r first-dir
10990           mkdir 1
10991           cd 1
10992           dotest newb-123e "${testcvs} -q co -r branch first-dir" \
10993 "U first-dir/a"
10994
10995           # Remove 'a' on another copy of the branch.
10996           cd ..
10997           mkdir 2
10998           cd 2
10999           dotest newb-123f "${testcvs} -q co -r branch first-dir" \
11000 "U first-dir/a"
11001           cd first-dir
11002           rm a
11003           dotest newb-123g "${testcvs} rm a" \
11004 "${PROG} remove: scheduling .a. for removal
11005 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11006           dotest newb-123h "${testcvs} -q ci -m removed" \
11007 "Removing a;
11008 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11009 new revision: delete; previous revision: 1\.1
11010 done"
11011
11012           # Check out the file on the branch.  This should report
11013           # that the file is not pertinent, but it should not
11014           # say anything else.
11015           cd ..
11016           rm -r first-dir
11017           dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
11018 "${PROG} checkout: warning: first-dir/a is not (any longer) pertinent"
11019
11020           # Update the other copy, and make sure that a is removed.
11021           cd ../1/first-dir
11022           # "Entry Invalid" is a rather strange output here.  Something like
11023           # "Removed in Repository" would make more sense.
11024           dotest newb-123j0 "${testcvs} status a" \
11025 "${PROG} status: a is no longer in the repository
11026 ===================================================================
11027 File: a                 Status: Entry Invalid
11028
11029    Working revision:    1\.1.*
11030    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/a,v
11031    Sticky Tag:          branch (branch: 1\.1\.2)
11032    Sticky Date:         (none)
11033    Sticky Options:      (none)"
11034           dotest newb-123j "${testcvs} -q update" \
11035 "${PROG} update: a is no longer in the repository"
11036
11037           if test -f a; then
11038             fail newb-123k
11039           else
11040             pass newb-123k
11041           fi
11042
11043           cd ../..
11044           rm -r 1 2
11045           rm -rf ${CVSROOT_DIRNAME}/first-dir
11046           ;;
11047
11048         conflicts)
11049                 mkdir ${CVSROOT_DIRNAME}/first-dir
11050
11051                 mkdir 1
11052                 cd 1
11053
11054                 dotest conflicts-124 "${testcvs} -q co first-dir" ''
11055
11056                 cd first-dir
11057                 touch a
11058
11059                 dotest conflicts-125 "${testcvs} add a" \
11060 "${PROG} add: scheduling file .a. for addition
11061 ${PROG} add: use .${PROG} commit. to add this file permanently"
11062                 dotest conflicts-126 "${testcvs} -q ci -m added" \
11063 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11064 done
11065 Checking in a;
11066 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11067 initial revision: 1\.1
11068 done"
11069
11070                 cd ../..
11071                 mkdir 2
11072                 cd 2
11073
11074                 dotest conflicts-126.5 "${testcvs} co -p first-dir" \
11075 "${PROG} checkout: Updating first-dir
11076 ===================================================================
11077 Checking out first-dir/a
11078 RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
11079 VERS: 1\.1
11080 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
11081                 if ${CVS} co first-dir ; then
11082                     pass 127
11083                 else
11084                     fail 127
11085                 fi
11086                 cd first-dir
11087                 if test -f a; then
11088                     pass 127a
11089                 else
11090                     fail 127a
11091                 fi
11092
11093                 cd ../../1/first-dir
11094                 echo add a line >>a
11095                 mkdir dir1
11096                 dotest conflicts-127b "${testcvs} add dir1" \
11097 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
11098                 dotest conflicts-128 "${testcvs} -q ci -m changed" \
11099 "Checking in a;
11100 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11101 new revision: 1\.2; previous revision: 1\.1
11102 done"
11103                 cd ../..
11104
11105                 # Similar to conflicts-126.5, but now the file has nonempty
11106                 # contents.
11107                 mkdir 3
11108                 cd 3
11109                 dotest conflicts-128.5 "${testcvs} co -p -l first-dir" \
11110 "${PROG} checkout: Updating first-dir
11111 ===================================================================
11112 Checking out first-dir/a
11113 RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
11114 VERS: 1\.2
11115 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
11116 add a line"
11117                 cd ..
11118                 rmdir 3
11119
11120                 # Now go over the to the other working directory and
11121                 # start testing conflicts
11122                 cd 2/first-dir
11123                 echo add a conflicting line >>a
11124                 dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
11125 "${PROG}"' commit: Up-to-date check failed for `a'\''
11126 '"${PROG}"' \[commit aborted\]: correct above errors first!'
11127                 mkdir dir1
11128                 mkdir sdir
11129                 dotest conflicts-status-0 "${testcvs} status a" \
11130 "===================================================================
11131 File: a                 Status: Needs Merge
11132
11133    Working revision:    1\.1.*
11134    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
11135    Sticky Tag:          (none)
11136    Sticky Date:         (none)
11137    Sticky Options:      (none)"
11138                 dotest conflicts-129a "${testcvs} -nq update a" \
11139 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11140 retrieving revision 1\.1
11141 retrieving revision 1\.2
11142 Merging differences between 1\.1 and 1\.2 into a
11143 rcsmerge: warning: conflicts during merge
11144 ${PROG} update: conflicts found in a
11145 C a"
11146                 dotest conflicts-130 "${testcvs} -q update" \
11147 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11148 retrieving revision 1\.1
11149 retrieving revision 1\.2
11150 Merging differences between 1\.1 and 1\.2 into a
11151 rcsmerge: warning: conflicts during merge
11152 ${PROG} update: conflicts found in a
11153 C a
11154 ${QUESTION} dir1
11155 ${QUESTION} sdir" \
11156 "${QUESTION} dir1
11157 ${QUESTION} sdir
11158 RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11159 retrieving revision 1\.1
11160 retrieving revision 1\.2
11161 Merging differences between 1\.1 and 1\.2 into a
11162 rcsmerge: warning: conflicts during merge
11163 ${PROG} update: conflicts found in a
11164 C a"
11165                 rmdir dir1 sdir
11166
11167                 dotest conflicts-status-1 "${testcvs} status a" \
11168 "===================================================================
11169 File: a                 Status: Unresolved Conflict
11170
11171    Working revision:    1\.2.*
11172    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
11173    Sticky Tag:          (none)
11174    Sticky Date:         (none)
11175    Sticky Options:      (none)"
11176                 dotest_fail conflicts-131 "${testcvs} -q ci -m try" \
11177 "${PROG} commit: file .a. had a conflict and has not been modified
11178 ${PROG} \[commit aborted\]: correct above errors first!"
11179
11180                 # Try to check in the file with the conflict markers in it.
11181                 # Make sure we detect any one of the three conflict markers
11182                 mv a aa
11183                 grep '^<<<<<<<' aa >a
11184                 dotest conflicts-status-2 "${testcvs} -nq ci -m try a" \
11185 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
11186
11187                 grep '^=======' aa >a
11188                 dotest conflicts-status-3 "${testcvs} -nq ci -m try a" \
11189 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
11190
11191                 grep '^>>>>>>>' aa >a
11192                 dotest conflicts-status-4 "${testcvs} -qn ci -m try a" \
11193 "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
11194
11195                 mv aa a
11196                 echo lame attempt at resolving it >>a
11197                 dotest conflicts-status-5 "${testcvs} status a" \
11198 "===================================================================
11199 File: a                 Status: File had conflicts on merge
11200
11201    Working revision:    1\.2.*
11202    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/a,v
11203    Sticky Tag:          (none)
11204    Sticky Date:         (none)
11205    Sticky Options:      (none)"
11206                 dotest conflicts-132 "${testcvs} -q ci -m try" \
11207 "${PROG} commit: warning: file .a. seems to still contain conflict indicators
11208 Checking in a;
11209 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11210 new revision: 1\.3; previous revision: 1\.2
11211 done"
11212
11213                 # OK, the user saw the warning (good user), and now
11214                 # resolves it for real.
11215                 echo resolve conflict >a
11216                 dotest conflicts-status-6 "${testcvs} status a" \
11217 "===================================================================
11218 File: a                 Status: Locally Modified
11219
11220    Working revision:    1\.3.*
11221    Repository revision: 1\.3    ${CVSROOT_DIRNAME}/first-dir/a,v
11222    Sticky Tag:          (none)
11223    Sticky Date:         (none)
11224    Sticky Options:      (none)"
11225                 dotest conflicts-133 "${testcvs} -q ci -m resolved" \
11226 "Checking in a;
11227 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11228 new revision: 1\.4; previous revision: 1\.3
11229 done"
11230                 dotest conflicts-status-7 "${testcvs} status a" \
11231 "===================================================================
11232 File: a                 Status: Up-to-date
11233
11234    Working revision:    1\.4.*
11235    Repository revision: 1\.4    ${CVSROOT_DIRNAME}/first-dir/a,v
11236    Sticky Tag:          (none)
11237    Sticky Date:         (none)
11238    Sticky Options:      (none)"
11239
11240                 # Now test that we can add a file in one working directory
11241                 # and have an update in another get it.
11242                 cd ../../1/first-dir
11243                 echo abc >abc
11244                 if ${testcvs} add abc >>${LOGFILE} 2>&1; then
11245                     pass 134
11246                 else
11247                     fail 134
11248                 fi
11249                 if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
11250                     pass 135
11251                 else
11252                     fail 135
11253                 fi
11254                 cd ../../2
11255                 mkdir first-dir/dir1 first-dir/sdir
11256                 dotest conflicts-136 "${testcvs} -q update first-dir" \
11257 '[UP] first-dir/abc
11258 '"${QUESTION}"' first-dir/dir1
11259 '"${QUESTION}"' first-dir/sdir' \
11260 ''"${QUESTION}"' first-dir/dir1
11261 '"${QUESTION}"' first-dir/sdir
11262 [UP] first-dir/abc'
11263                 dotest conflicts-137 'test -f first-dir/abc' ''
11264                 rmdir first-dir/dir1 first-dir/sdir
11265
11266                 # Now test something similar, but in which the parent directory
11267                 # (not the directory in question) has the Entries.Static flag
11268                 # set.
11269                 cd ../1/first-dir
11270                 mkdir subdir
11271                 if ${testcvs} add subdir >>${LOGFILE}; then
11272                     pass 138
11273                 else
11274                     fail 138
11275                 fi
11276                 cd ../..
11277                 mkdir 3
11278                 cd 3
11279                 if ${testcvs} -q co first-dir/abc first-dir/subdir \
11280                     >>${LOGFILE}; then
11281                     pass 139
11282                 else
11283                     fail 139
11284                 fi
11285                 cd ../1/first-dir/subdir
11286                 echo sss >sss
11287                 if ${testcvs} add sss >>${LOGFILE} 2>&1; then
11288                     pass 140
11289                 else
11290                     fail 140
11291                 fi
11292                 if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
11293                     pass 140
11294                 else
11295                     fail 140
11296                 fi
11297                 cd ../../../3/first-dir
11298                 if ${testcvs} -q update >>${LOGFILE}; then
11299                     pass 141
11300                 else
11301                     fail 141
11302                 fi
11303                 if test -f subdir/sss; then
11304                     pass 142
11305                 else
11306                     fail 142
11307                 fi
11308                 cd ../..
11309                 rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
11310                 ;;
11311
11312         conflicts2)
11313           # More conflicts tests; separate from conflicts to keep each
11314           # test a manageable size.
11315           mkdir ${CVSROOT_DIRNAME}/first-dir
11316
11317           mkdir 1
11318           cd 1
11319
11320           dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
11321
11322           cd first-dir
11323           touch a abc
11324
11325           dotest conflicts2-142a2 "${testcvs} add a abc" \
11326 "${PROG} add: scheduling file .a. for addition
11327 ${PROG} add: scheduling file .abc. for addition
11328 ${PROG} add: use .${PROG} commit. to add these files permanently"
11329           dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
11330 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11331 done
11332 Checking in a;
11333 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11334 initial revision: 1\.1
11335 done
11336 RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
11337 done
11338 Checking in abc;
11339 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
11340 initial revision: 1\.1
11341 done"
11342
11343           cd ../..
11344           mkdir 2
11345           cd 2
11346
11347           dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
11348 U first-dir/abc'
11349           cd ..
11350
11351           # BEGIN TESTS USING THE FILE A
11352           # FIXME: would be cleaner to separate them out into their own
11353           # tests; conflicts2 is getting long.
11354           # Now test that if one person modifies and commits a
11355           # file and a second person removes it, it is a
11356           # conflict
11357           cd 1/first-dir
11358           echo modify a >>a
11359           dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
11360 "Checking in a;
11361 ${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11362 new revision: 1\.2; previous revision: 1\.1
11363 done"
11364           cd ../../2/first-dir
11365           rm a
11366           dotest conflicts2-142b3 "${testcvs} rm a" \
11367 "${PROG} remove: scheduling .a. for removal
11368 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11369           dotest_fail conflicts2-142b4 "${testcvs} -q update" \
11370 "${PROG} update: conflict: removed a was modified by second party
11371 C a"
11372           # Resolve the conflict by deciding not to remove the file
11373           # after all.
11374           dotest_sort conflicts2-142b5 "${testcvs} add a" "U a
11375 ${PROG} add: a, version 1\.1, resurrected"
11376           dotest conflicts2-142b5b1 "$testcvs status a" \
11377 "===================================================================
11378 File: a                 Status: Needs Patch
11379
11380    Working revision:    1\.1.*
11381    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/a,v
11382    Sticky Tag:          (none)
11383    Sticky Date:         (none)
11384    Sticky Options:      (none)"
11385           dotest conflicts2-142b6 "${testcvs} -q update" 'U a'
11386
11387           # Now one level up.
11388           cd ..
11389           dotest conflicts2-142b7 "${testcvs} rm -f first-dir/a" \
11390 "${PROG} remove: scheduling .first-dir/a. for removal
11391 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11392
11393           if $remote; then
11394             # Haven't investigated this one.
11395             dotest_fail conflicts2-142b8r "$testcvs add first-dir/a" \
11396 "${PROG} add: in directory \.:
11397 ${PROG} \[add aborted\]: there is no version here; do '${PROG} checkout' first"
11398             cd first-dir
11399           else
11400             dotest conflicts2-142b8 "${testcvs} add first-dir/a" \
11401 "U first-dir/a
11402 ${PROG} add: first-dir/a, version 1\.2, resurrected"
11403             cd first-dir
11404             # Now recover from the damage that the 142b8 test did.
11405             dotest conflicts2-142b9 "${testcvs} rm -f a" \
11406 "${PROG} remove: scheduling .a. for removal
11407 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11408           fi
11409
11410           dotest_sort conflicts2-142b10 "${testcvs} add a" "U a
11411 ${PROG} add: a, version 1\.2, resurrected"
11412           # As with conflicts2-142b6, check that things are normal again.
11413           dotest conflicts2-142b11 "${testcvs} -q update" ''
11414           cd ../..
11415           # END TESTS USING THE FILE A
11416
11417           # Now test that if one person removes a file and
11418           # commits it, and a second person removes it, is it
11419           # not a conflict.
11420           cd 1/first-dir
11421           rm abc
11422           dotest conflicts2-142c0 "${testcvs} rm abc" \
11423 "${PROG} remove: scheduling .abc. for removal
11424 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11425           dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
11426 "Removing abc;
11427 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
11428 new revision: delete; previous revision: 1\.1
11429 done"
11430           cd ../../2/first-dir
11431           rm abc
11432           dotest conflicts2-142c2 "${testcvs} rm abc" \
11433 "${PROG} remove: scheduling .abc. for removal
11434 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11435           dotest conflicts2-142c3 "${testcvs} update" \
11436 "${PROG} update: Updating \."
11437           cd ../..
11438
11439           # conflicts2-142d*: test that if one party adds a file, and another
11440           # party has a file of the same name, cvs notices
11441           cd 1/first-dir
11442           touch aa.c
11443           echo 'contents unchanged' >same.c
11444           dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
11445 "${PROG} add: scheduling file .aa\.c. for addition
11446 ${PROG} add: scheduling file .same\.c. for addition
11447 ${PROG} add: use .${PROG} commit. to add these files permanently"
11448           dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
11449 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa\.c,v
11450 done
11451 Checking in aa\.c;
11452 ${CVSROOT_DIRNAME}/first-dir/aa\.c,v  <--  aa\.c
11453 initial revision: 1\.1
11454 done
11455 RCS file: ${CVSROOT_DIRNAME}/first-dir/same\.c,v
11456 done
11457 Checking in same\.c;
11458 ${CVSROOT_DIRNAME}/first-dir/same\.c,v  <--  same\.c
11459 initial revision: 1\.1
11460 done"
11461           cd ../../2/first-dir
11462           echo "don't you dare obliterate this text" >aa.c
11463           echo 'contents unchanged' >same.c
11464           # Note the discrepancy between local and remote in the handling
11465           # of same.c.  I kind
11466           # of suspect that the local CVS behavior is the more useful one
11467           # although I do sort of wonder whether we should make people run
11468           # cvs add just to get them in that habit (also, trying to implement
11469           # the local CVS behavior for remote without the cvs add seems 
11470           # pretty difficult).
11471           if $remote; then
11472             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
11473 "${QUESTION} aa\.c
11474 ${QUESTION} same\.c
11475 ${PROG} update: move away \./aa\.c; it is in the way
11476 C aa\.c
11477 ${PROG} update: move away \./same\.c; it is in the way
11478 C same\.c"
11479           else
11480             dotest_fail conflicts2-142d2 "${testcvs} -q update" \
11481 "${PROG} [a-z]*: move away aa\.c; it is in the way
11482 C aa\.c
11483 U same\.c"
11484           fi
11485           dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
11486 "${PROG} status: move away aa\.c; it is in the way
11487 ===================================================================
11488 File: aa\.c                     Status: Unresolved Conflict
11489
11490    Working revision:    No entry for aa\.c
11491    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/aa\.c,v"
11492
11493           # Could also be testing the case in which the cvs add happened
11494           # before the commit by the other user.
11495           # This message seems somewhat bogus.  I mean, parallel development
11496           # means that we get to work in parallel if we choose, right?  And
11497           # then at commit time it would be a conflict.
11498           dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
11499 "${PROG} add: aa.c added independently by second party"
11500
11501           # The user might want to see just what the conflict is.
11502           # Don't bother, diff seems to kind of lose its mind, with or
11503           # without -N.  This is a CVS bug(s).
11504           #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
11505
11506           # Now: "how can the user resolve this conflict", I hear you cry.
11507           # Well, one way is to forget about the file in the working
11508           # directory.
11509           # Since it didn't let us do the add in conflicts2-142d4, there
11510           # is no need to run cvs rm here.
11511           #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
11512           dotest conflicts2-142d6 "rm aa.c" ''
11513           dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
11514           dotest conflicts2-142d8 "cat aa.c" ''
11515
11516           # The other way is to use the version from the working directory
11517           # instead of the version from the repository.  Unfortunately,
11518           # there doesn't seem to be any particularly clear way to do
11519           # this (?).
11520
11521           cd ../..
11522
11523           rm -r 1 2; rm -rf ${CVSROOT_DIRNAME}/first-dir
11524           ;;
11525
11526         conflicts3)
11527           # More tests of conflicts and/or multiple working directories
11528           # in general.
11529
11530           mkdir 1; cd 1
11531           dotest conflicts3-1 "${testcvs} -q co -l ." ''
11532           mkdir first-dir
11533           dotest conflicts3-2 "${testcvs} add first-dir" \
11534 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11535           cd ..
11536           mkdir 2; cd 2
11537           dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
11538           cd ../1/first-dir
11539           touch file1 file2
11540           dotest conflicts3-4 "${testcvs} add file1 file2" \
11541 "${PROG} add: scheduling file .file1. for addition
11542 ${PROG} add: scheduling file .file2. for addition
11543 ${PROG} add: use .${PROG} commit. to add these files permanently"
11544           dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
11545 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11546 done
11547 Checking in file1;
11548 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11549 initial revision: 1\.1
11550 done
11551 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
11552 done
11553 Checking in file2;
11554 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11555 initial revision: 1\.1
11556 done"
11557           cd ../../2/first-dir
11558           # Check that -n doesn't make CVS lose its mind as it creates
11559           # (or rather, doesn't) a new file.
11560           dotest conflicts3-6 "${testcvs} -nq update" \
11561 "U file1
11562 U file2"
11563           dotest_fail conflicts3-7 "test -f file1" ''
11564           dotest conflicts3-8 "${testcvs} -q update" \
11565 "U file1
11566 U file2"
11567           dotest conflicts3-9 "test -f file2" ''
11568
11569           # OK, now remove two files at once
11570           dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
11571 "${PROG} remove: scheduling .file1. for removal
11572 ${PROG} remove: scheduling .file2. for removal
11573 ${PROG} remove: use .${PROG} commit. to remove these files permanently"
11574           dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
11575 "Removing file1;
11576 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11577 new revision: delete; previous revision: 1\.1
11578 done
11579 Removing file2;
11580 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11581 new revision: delete; previous revision: 1\.1
11582 done"
11583           cd ../../1/first-dir
11584           dotest conflicts3-12 "${testcvs} -n -q update" \
11585 "${PROG} update: file1 is no longer in the repository
11586 ${PROG} update: file2 is no longer in the repository"
11587           dotest conflicts3-13 "${testcvs} -q update" \
11588 "${PROG} update: file1 is no longer in the repository
11589 ${PROG} update: file2 is no longer in the repository"
11590
11591           # OK, now add a directory to both working directories
11592           # and see that CVS doesn't lose its mind.
11593           mkdir sdir
11594           dotest conflicts3-14 "${testcvs} add sdir" \
11595 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
11596           touch sdir/sfile
11597           dotest conflicts3-14a "${testcvs} add sdir/sfile" \
11598 "${PROG} add: scheduling file .sdir/sfile. for addition
11599 ${PROG} add: use .${PROG} commit. to add this file permanently"
11600           dotest conflicts3-14b "${testcvs} -q ci -m add" \
11601 "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v
11602 done
11603 Checking in sdir/sfile;
11604 ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
11605 initial revision: 1\.1
11606 done"
11607
11608           cd ../../2/first-dir
11609
11610           # Create a CVS directory without the proper administrative
11611           # files in it.  This can happen for example if you hit ^C
11612           # in the middle of a checkout.
11613           mkdir sdir
11614           mkdir sdir/CVS
11615           # OK, in the local case CVS sees that the directory exists
11616           # in the repository and recurses into it.  In the remote case
11617           # CVS can't see the repository and has no way of knowing
11618           # that sdir is even a directory (stat'ing everything would be
11619           # too slow).  The remote behavior makes more sense to me (but
11620           # would this affect other cases?).
11621           if $remote; then
11622             dotest conflicts3-15 "${testcvs} -q update" \
11623 "${QUESTION} sdir"
11624           else
11625             dotest conflicts3-15 "${testcvs} -q update" \
11626 "${QUESTION} sdir
11627 ${PROG} update: ignoring sdir (CVS/Repository missing)"
11628             touch sdir/CVS/Repository
11629             dotest conflicts3-16 "${testcvs} -q update" \
11630 "${QUESTION} sdir
11631 ${PROG} update: ignoring sdir (CVS/Entries missing)"
11632             cd ..
11633             dotest conflicts3-16a "${testcvs} -q update first-dir" \
11634 "${QUESTION} first-dir/sdir
11635 ${PROG} update: ignoring first-dir/sdir (CVS/Entries missing)"
11636             cd first-dir
11637           fi
11638           rm -r sdir
11639
11640           # OK, now the same thing, but the directory doesn't exist
11641           # in the repository.
11642           mkdir newdir
11643           mkdir newdir/CVS
11644           dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
11645           echo "D/newdir////" >> CVS/Entries
11646           dotest conflicts3-18 "${testcvs} -q update" \
11647 "${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
11648           touch newdir/CVS/Repository
11649           dotest conflicts3-19 "${testcvs} -q update" \
11650 "${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
11651           cd ..
11652           dotest conflicts3-20 "${testcvs} -q update first-dir" \
11653 "${PROG} [a-z]*: ignoring first-dir/newdir (CVS/Entries missing)"
11654           cd first-dir
11655           rm -r newdir
11656
11657           # The previous tests have left CVS/Entries in something of a mess.
11658           # While we "should" be able to deal with that (maybe), for now
11659           # we just start over.
11660           cd ..
11661           rm -r first-dir
11662           dotest conflicts3-20a "${testcvs} -q co -l first-dir" ''
11663           cd first-dir
11664
11665           dotest conflicts3-21 "${testcvs} -q update -d sdir" "U sdir/sfile"
11666           rm -r sdir/CVS
11667           dotest conflicts3-22 "${testcvs} -q update" "${QUESTION} sdir"
11668           if $remote; then
11669             dotest_fail conflicts3-23 "${testcvs} -q update -PdA" \
11670 "${QUESTION} sdir
11671 ${PROG} update: move away sdir/sfile; it is in the way
11672 C sdir/sfile"
11673           else
11674             dotest conflicts3-23 "${testcvs} -q update -PdA" \
11675 "${QUESTION} sdir"
11676           fi
11677
11678           # Not that it should really affect much, but let's do the case
11679           # where sfile has been removed.  For example, suppose that sdir
11680           # had been a CVS-controlled directory which was then removed
11681           # by removing each file (and using update -P or some such).  Then
11682           # suppose that the build process creates an sdir directory which
11683           # is not supposed to be under CVS.
11684           rm -r sdir
11685           dotest conflicts3-24 "${testcvs} -q update -d sdir" "U sdir/sfile"
11686           rm sdir/sfile
11687           dotest conflicts3-25 "${testcvs} rm sdir/sfile" \
11688 "${PROG} remove: scheduling .sdir/sfile. for removal
11689 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
11690           dotest conflicts3-26 "${testcvs} ci -m remove sdir/sfile" \
11691 "Removing sdir/sfile;
11692 ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
11693 new revision: delete; previous revision: 1\.1
11694 done"
11695           rm -r sdir/CVS
11696           dotest conflicts3-27 "${testcvs} -q update" "${QUESTION} sdir"
11697           dotest conflicts3-28 "${testcvs} -q update -PdA" \
11698 "${QUESTION} sdir"
11699
11700           cd ../..
11701
11702           rm -r 1 2
11703           rm -rf ${CVSROOT_DIRNAME}/first-dir
11704           ;;
11705
11706         conflicts4)
11707           mkdir conflicts4; cd conflicts4
11708           mkdir 1; cd 1
11709           dotest conflicts4-1 "$testcvs -q co -l ."
11710           mkdir first-dir
11711           dotest conflicts4-2 "${testcvs} add first-dir" \
11712 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11713           cd ..
11714           mkdir 2; cd 2
11715           dotest conflicts4-3 "${testcvs} -q co -l first-dir" ''
11716           cd ../1/first-dir
11717           echo baseline >file1
11718           dotest conflicts4-4 "${testcvs} -q add file1" \
11719 "$PROG add: use .$PROG commit. to add this file permanently"
11720           dotest conflicts4-5 "${testcvs} -q ci -m add-it" \
11721 "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
11722 done
11723 Checking in file1;
11724 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
11725 initial revision: 1\.1
11726 done"
11727           cd ../../2/first-dir
11728           dotest conflicts4-6 "${testcvs} -q update" "U file1"
11729           # Make a local change
11730           echo wibble2 >> file1
11731           dotest conflicts4-7 "${testcvs} -q ci -m update2" \
11732 "Checking in file1;
11733 $CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
11734 new revision: 1\.2; previous revision: 1\.1
11735 done"
11736           cd ../../1/first-dir
11737           echo wibble1 >>file1
11738           dotest conflicts4-8 "${testcvs} -Q update" \
11739 "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
11740 retrieving revision 1\.1
11741 retrieving revision 1\.2
11742 Merging differences between 1\.1 and 1\.2 into file1
11743 rcsmerge: warning: conflicts during merge
11744 cvs update: conflicts found in file1"
11745           dotest_fail conflicts4-9 "${testcvs} -q update" \
11746 "C file1"
11747
11748           if $remote; then
11749             cat >$TESTDIR/conflicts4/serveme <<EOF
11750 #!$TESTSHELL
11751 # This is admittedly a bit cheezy, in the sense that we make lots
11752 # of assumptions about what the client is going to send us.
11753 # We don't mention Repository, because current clients don't require it.
11754 # Sending these at our own pace, rather than waiting for the client to
11755 # make the requests, is bogus, but hopefully we can get away with it.
11756 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option"
11757 echo "ok"
11758 echo "MT text C "
11759 echo "MT fname file1"
11760 echo "MT newline"
11761 echo "error  "
11762 cat >$TESTDIR/conflicts4/client.out
11763 EOF
11764             # Cygwin.  Pthffffffffft!
11765             if test -n "$remotehost"; then
11766               $CVS_RSH $remotehost "chmod +x $TESTDIR/conflicts4/serveme"
11767             else
11768               chmod +x $TESTDIR/conflicts4/serveme
11769             fi
11770             save_CVS_SERVER=$CVS_SERVER
11771             CVS_SERVER=$TESTDIR/conflicts4/serveme; export CVS_SERVER
11772             dotest_fail conflicts4-10r "$testcvs -q up" "C file1"
11773             dotest conflicts4-11r "cat $TESTDIR/conflicts4/client.out" \
11774 "$DOTSTAR
11775 Argument --
11776 Directory .
11777 $CVSROOT_DIRNAME/first-dir
11778 Entry /file1/1.2/$PLUS=//
11779 Modified file1
11780 u=.*,g=.*,o=.*
11781 59
11782 baseline
11783 ""<<<<<<< file1
11784 wibble1
11785 ""=======
11786 wibble2
11787 "">>>>>>> 1.2
11788 update"
11789
11790             cat >$TESTDIR/conflicts4/serveme <<EOF
11791 #!$TESTSHELL
11792 # This is admittedly a bit cheezy, in the sense that we make lots
11793 # of assumptions about what the client is going to send us.
11794 # We don't mention Repository, because current clients don't require it.
11795 # Sending these at our own pace, rather than waiting for the client to
11796 # make the requests, is bogus, but hopefully we can get away with it.
11797 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option Empty-conflicts"
11798 echo "ok"
11799 echo "MT text C "
11800 echo "MT fname file1"
11801 echo "MT newline"
11802 echo "error  "
11803 cat >$TESTDIR/conflicts4/client.out
11804 EOF
11805
11806             dotest_fail conflicts4-12r "$testcvs -q up" "C file1"
11807             dotest conflicts4-13r "cat $TESTDIR/conflicts4/client.out" \
11808 "$DOTSTAR
11809 Argument --
11810 Directory .
11811 $CVSROOT_DIRNAME/first-dir
11812 Entry /file1/1.2/$PLUS=//
11813 Unchanged file1
11814 update"
11815
11816             CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER
11817           fi
11818
11819           if $keep; then
11820             echo Keeping $TESTDIR and exiting due to --keep
11821             exit 0
11822           fi
11823
11824           cd ../../..
11825           rm -rf conflicts4
11826           rm -rf $CVSROOT_DIRNAME/first-dir
11827           ;;
11828
11829         clean)
11830           # Test update -C (overwrite local mods w/ repository copies)
11831           mkdir 1; cd 1
11832           dotest clean-1 "${testcvs} -q co -l ." ''
11833           mkdir first-dir
11834           dotest clean-2 "${testcvs} add first-dir" \
11835 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11836           cd first-dir
11837           echo "The usual boring test text." > cleanme.txt
11838           dotest clean-3 "${testcvs} add cleanme.txt" \
11839 "${PROG} add: scheduling file .cleanme\.txt. for addition
11840 ${PROG} add: use .${PROG} commit. to add this file permanently"
11841           dotest clean-4 "${testcvs} -q ci -m clean-3" \
11842 "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
11843 done
11844 Checking in cleanme\.txt;
11845 ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
11846 initial revision: 1\.1
11847 done"
11848           # Okay, preparation is done, now test.
11849           # Check that updating an unmodified copy works.
11850           dotest clean-5 "${testcvs} -q update" ''
11851           # Check that updating -C an unmodified copy works.
11852           dotest clean-6 "${testcvs} -q update -C" ''
11853           # Check that updating a modified copy works.
11854           echo "fish" >> cleanme.txt
11855           dotest clean-7 "${testcvs} -q update" 'M cleanme\.txt'
11856           # Check that updating -C a modified copy works.
11857           dotest clean-8 "${testcvs} -q update -C" \
11858 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
11859 U cleanme\.txt"
11860           # And check that the backup copy really was made.
11861           dotest clean-9 "cat .#cleanme.txt.1.1" \
11862 "The usual boring test text\.
11863 fish"
11864
11865           # Do it all again, this time naming the file explicitly.
11866           rm .#cleanme.txt.1.1
11867           dotest clean-10 "${testcvs} -q update cleanme.txt" ''
11868           dotest clean-11 "${testcvs} -q update -C cleanme.txt" ''
11869           echo "bluegill" >> cleanme.txt
11870           dotest clean-12 "${testcvs} -q update cleanme.txt" 'M cleanme\.txt'
11871           dotest clean-13 "${testcvs} -q update -C cleanme.txt" \
11872 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
11873 U cleanme\.txt"
11874           # And check that the backup copy really was made.
11875           dotest clean-14 "cat .#cleanme.txt.1.1" \
11876 "The usual boring test text\.
11877 bluegill"
11878
11879           # Now try with conflicts
11880           cd ..
11881           dotest clean-15 "${testcvs} -q co -d second-dir first-dir" \
11882 'U second-dir/cleanme\.txt'
11883           cd second-dir
11884           echo "conflict test" >> cleanme.txt
11885           dotest clean-16 "${testcvs} -q ci -m." \
11886 "Checking in cleanme\.txt;
11887 ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
11888 new revision: 1\.2; previous revision: 1\.1
11889 done"
11890           cd ../first-dir
11891           echo "fish" >> cleanme.txt
11892           dotest clean-17 "${testcvs} -nq update" \
11893 "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
11894 retrieving revision 1\.1
11895 retrieving revision 1\.2
11896 Merging differences between 1\.1 and 1\.2 into cleanme\.txt
11897 rcsmerge: warning: conflicts during merge
11898 ${PROG} update: conflicts found in cleanme\.txt
11899 C cleanme\.txt"
11900           dotest clean-18 "${testcvs} -q update -C" \
11901 "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
11902 U cleanme\.txt"
11903           dotest clean-19 "cat .#cleanme.txt.1.1" \
11904 "The usual boring test text\.
11905 fish"
11906           
11907           # Done.  Clean up.
11908           cd ../..
11909           rm -rf 1
11910           rm -rf ${CVSROOT_DIRNAME}/first-dir
11911           ;;
11912
11913         modules)
11914           # Tests of various ways to define and use modules.
11915           # Roadmap to various modules tests:
11916           # -a:
11917           #   error on incorrect placement: modules
11918           #   error combining with other options: modules2-a*
11919           #   infinite loops: modules148a1.1 - modules148a1.2
11920           #   use to specify a file more than once: modules3
11921           #   use with ! feature: modules4
11922           # regular modules: modules, modules2, cvsadm
11923           # ampersand modules: modules2
11924           # -s: modules.
11925           # -d: modules, modules3, cvsadm
11926           # -i, -o, -u, -e, -t: modules5
11927           # slashes in module names: modules3
11928           # invalid module definitions: modules6
11929
11930           ############################################################
11931           # These tests are to make sure that administrative files get
11932           # rebuilt, regardless of how and where files are checked
11933           # out.
11934           ############################################################
11935           # Check out the whole repository
11936           mkdir 1; cd 1
11937           dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
11938 U CVSROOT/commitinfo
11939 U CVSROOT/config
11940 U CVSROOT/cvswrappers
11941 U CVSROOT/editinfo
11942 U CVSROOT/loginfo
11943 U CVSROOT/modules
11944 U CVSROOT/notify
11945 U CVSROOT/rcsinfo
11946 U CVSROOT/taginfo
11947 U CVSROOT/verifymsg'
11948           echo "# made a change" >>CVSROOT/modules
11949           dotest modules-1d "${testcvs} -q ci -m add-modules" \
11950 "Checking in CVSROOT/modules;
11951 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11952 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11953 done
11954 ${PROG} commit: Rebuilding administrative file database"
11955           cd ..
11956           rm -rf 1
11957
11958           ############################################################
11959           # Check out CVSROOT
11960           mkdir 1; cd 1
11961           dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
11962 U CVSROOT/commitinfo
11963 U CVSROOT/config
11964 U CVSROOT/cvswrappers
11965 U CVSROOT/editinfo
11966 U CVSROOT/loginfo
11967 U CVSROOT/modules
11968 U CVSROOT/notify
11969 U CVSROOT/rcsinfo
11970 U CVSROOT/taginfo
11971 U CVSROOT/verifymsg'
11972           echo "# made a change" >>CVSROOT/modules
11973           dotest modules-2d "${testcvs} -q ci -m add-modules" \
11974 "Checking in CVSROOT/modules;
11975 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11976 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11977 done
11978 ${PROG} commit: Rebuilding administrative file database"
11979           cd ..
11980           rm -rf 1
11981
11982           ############################################################
11983           # Check out CVSROOT in some other directory
11984           mkdir ${CVSROOT_DIRNAME}/somedir
11985           mkdir 1; cd 1
11986           dotest modules-3 "${testcvs} -q co somedir" ''
11987           cd somedir
11988           dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
11989 U CVSROOT/commitinfo
11990 U CVSROOT/config
11991 U CVSROOT/cvswrappers
11992 U CVSROOT/editinfo
11993 U CVSROOT/loginfo
11994 U CVSROOT/modules
11995 U CVSROOT/notify
11996 U CVSROOT/rcsinfo
11997 U CVSROOT/taginfo
11998 U CVSROOT/verifymsg'
11999           echo "# made a change" >>CVSROOT/modules
12000           dotest modules-3g "${testcvs} -q ci -m add-modules" \
12001 "Checking in CVSROOT/modules;
12002 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12003 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12004 done
12005 ${PROG} commit: Rebuilding administrative file database"
12006           cd ../..
12007           rm -rf 1
12008           rm -rf ${CVSROOT_DIRNAME}/somedir
12009           ############################################################
12010           # end rebuild tests
12011           ############################################################
12012
12013
12014           mkdir ${CVSROOT_DIRNAME}/first-dir
12015
12016           mkdir 1
12017           cd 1
12018
12019           dotest modules-143 "${testcvs} -q co first-dir" ""
12020
12021           cd first-dir
12022           mkdir subdir
12023           dotest modules-143a "${testcvs} add subdir" \
12024 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
12025
12026           cd subdir
12027           mkdir ssdir
12028           dotest modules-143b "${testcvs} add ssdir" \
12029 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
12030
12031           touch a b
12032
12033           dotest modules-144 "${testcvs} add a b" \
12034 "${PROG} add: scheduling file .a. for addition
12035 ${PROG} add: scheduling file .b. for addition
12036 ${PROG} add: use .${PROG} commit. to add these files permanently"
12037
12038           dotest modules-145 "${testcvs} ci -m added" \
12039 "${PROG} [a-z]*: Examining .
12040 ${PROG} [a-z]*: Examining ssdir
12041 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
12042 done
12043 Checking in a;
12044 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
12045 initial revision: 1\.1
12046 done
12047 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
12048 done
12049 Checking in b;
12050 ${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
12051 initial revision: 1\.1
12052 done"
12053
12054           cd ..
12055           dotest modules-146 "${testcvs} -q co CVSROOT" \
12056 "U CVSROOT/checkoutlist
12057 U CVSROOT/commitinfo
12058 U CVSROOT/config
12059 U CVSROOT/cvswrappers
12060 U CVSROOT/editinfo
12061 U CVSROOT/loginfo
12062 U CVSROOT/modules
12063 U CVSROOT/notify
12064 U CVSROOT/rcsinfo
12065 U CVSROOT/taginfo
12066 U CVSROOT/verifymsg"
12067
12068           # Here we test that CVS can deal with CVSROOT (whose repository
12069           # is at top level) in the same directory as subdir (whose repository
12070           # is a subdirectory of first-dir).  TODO: Might want to check that
12071           # files can actually get updated in this state.
12072           dotest modules-147 "${testcvs} -q update" ""
12073
12074           cat >CVSROOT/modules <<EOF
12075 realmodule first-dir/subdir a
12076 dirmodule first-dir/subdir
12077 namedmodule -d nameddir first-dir/subdir
12078 aliasmodule -a first-dir/subdir/a
12079 aliasnested -a first-dir/subdir/ssdir
12080 topfiles -a first-dir/file1 first-dir/file2
12081 world -a .
12082 statusmod -s Mungeable
12083 # Check for ability to block infinite loops.
12084 infinitealias -a infinitealias
12085 # Prior to 1.11.12 & 1.12.6, the infinite alias loop check didn't strip
12086 # slashes or work if a module called a module which then called itself
12087 # (A -> A was blocked, but not A -> B -> A or deeper).
12088 infinitealias2 -a infinitealias2/
12089 infinitealias3 -a infinitealias4/
12090 infinitealias4 -a aliasmodule infinitealias5
12091 infinitealias5 -a infinitealias3/
12092 # Options must come before arguments.  It is possible this should
12093 # be relaxed at some point (though the result would be bizarre for
12094 # -a); for now test the current behavior.
12095 bogusalias first-dir/subdir/a -a
12096 EOF
12097           dotest modules-148 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
12098 "Checking in CVSROOT/modules;
12099 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12100 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12101 done
12102 ${PROG} commit: Rebuilding administrative file database"
12103
12104           cd ..
12105           # The "statusmod" module contains an error; trying to use it
12106           # will produce "modules file missing directory" I think.
12107           # However, that shouldn't affect the ability of "cvs co -c" or
12108           # "cvs co -s" to do something reasonable with it.
12109           dotest modules-148a0 "${testcvs} co -c" 'aliasmodule  -a first-dir/subdir/a
12110 aliasnested  -a first-dir/subdir/ssdir
12111 bogusalias   first-dir/subdir/a -a
12112 dirmodule    first-dir/subdir
12113 infinitealias -a infinitealias
12114 infinitealias2 -a infinitealias2/
12115 infinitealias3 -a infinitealias4/
12116 infinitealias4 -a aliasmodule infinitealias5
12117 infinitealias5 -a infinitealias3/
12118 namedmodule  -d nameddir first-dir/subdir
12119 realmodule   first-dir/subdir a
12120 statusmod    -s Mungeable
12121 topfiles     -a first-dir/file1 first-dir/file2
12122 world        -a \.'
12123           # There is code in modules.c:save_d which explicitly skips
12124           # modules defined with -a, which is why aliasmodule is not
12125           # listed.
12126           dotest modules-148a1 "${testcvs} co -s" \
12127 'statusmod    Mungeable  
12128 bogusalias   NONE        first-dir/subdir/a -a
12129 dirmodule    NONE        first-dir/subdir
12130 namedmodule  NONE        first-dir/subdir
12131 realmodule   NONE        first-dir/subdir a'
12132
12133           # Check that infinite loops are avoided
12134           dotest modules-148a1.1 "${testcvs} co infinitealias" \
12135 "$PROG checkout: module \`infinitealias' in modules file contains infinite loop" \
12136 "$PROG server: module \`infinitealias' in modules file contains infinite loop
12137 $PROG checkout: module \`infinitealias' in modules file contains infinite loop"
12138           # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
12139           # strip slashes.
12140           dotest modules-148a1.2 "${testcvs} co infinitealias2" \
12141 "$PROG checkout: module \`infinitealias2' in modules file contains infinite loop" \
12142 "$PROG server: module \`infinitealias2' in modules file contains infinite loop
12143 $PROG checkout: module \`infinitealias2' in modules file contains infinite loop"
12144           # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
12145           # notice when A -> B -> A, it only noticed A -> A.
12146           dotest modules-148a1.3 "${testcvs} co infinitealias3/" \
12147 "$PROG checkout: module \`infinitealias3' in modules file contains infinite loop" \
12148 "$PROG server: module \`infinitealias3' in modules file contains infinite loop
12149 $PROG checkout: module \`infinitealias3' in modules file contains infinite loop"
12150
12151           # Test that real modules check out to realmodule/a, not subdir/a.
12152           dotest modules-149a1 "${testcvs} co realmodule" "U realmodule/a"
12153           dotest modules-149a2 "test -d realmodule && test -f realmodule/a" ""
12154           dotest_fail modules-149a3 "test -f realmodule/b" ""
12155           dotest modules-149a4 "${testcvs} -q co realmodule" ""
12156           dotest modules-149a5 "echo yes | ${testcvs} release -d realmodule" \
12157 "You have \[0\] altered files in this repository\.
12158 Are you sure you want to release (and delete) directory .realmodule.: "
12159
12160           dotest_fail modules-149b1 "${testcvs} co realmodule/a" \
12161 "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
12162 "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
12163 '"${PROG}"' \[checkout aborted\]: cannot expand modules'
12164
12165           # Now test the ability to check out a single file from a directory
12166           dotest modules-150c "${testcvs} co dirmodule/a" "U dirmodule/a"
12167           dotest modules-150d "test -d dirmodule && test -f dirmodule/a" ""
12168           dotest_fail modules-150e "test -f dirmodule/b" ""
12169           dotest modules-150f "echo yes | ${testcvs} release -d dirmodule" \
12170 "You have \[0\] altered files in this repository\.
12171 Are you sure you want to release (and delete) directory .dirmodule.: "
12172           # Now test the ability to correctly reject a non-existent filename.
12173           # For maximum studliness we would check that an error message is
12174           # being output.
12175           # We accept a zero exit status because it is what CVS does
12176           # (Dec 95).  Probably the exit status should be nonzero,
12177           # however.
12178           dotest modules-150g1 "${testcvs} co dirmodule/nonexist" \
12179 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared"
12180           # We tolerate the creation of the dirmodule directory, since that
12181           # is what CVS does, not because we view that as preferable to not
12182           # creating it.
12183           dotest_fail modules-150g2 "test -f dirmodule/a || test -f dirmodule/b" ""
12184           rm -r dirmodule
12185
12186           # Now test that a module using -d checks out to the specified
12187           # directory.
12188           dotest modules-150h1 "${testcvs} -q co namedmodule" \
12189 'U nameddir/a
12190 U nameddir/b'
12191           dotest modules-150h2 "test -f nameddir/a && test -f nameddir/b" ""
12192           echo add line >>nameddir/a
12193           dotest modules-150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
12194           rm nameddir/a
12195           dotest modules-150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
12196           dotest modules-150h99 "echo yes | ${testcvs} release -d nameddir" \
12197 "You have \[0\] altered files in this repository\.
12198 Are you sure you want to release (and delete) directory .nameddir.: "
12199
12200           # Now test that alias modules check out to subdir/a, not
12201           # aliasmodule/a.
12202           dotest modules-151 "${testcvs} co aliasmodule" ""
12203           dotest_fail modules-152 "test -d aliasmodule" ""
12204           echo abc >>first-dir/subdir/a
12205           dotest modules-153 "${testcvs} -q co aliasmodule" "M first-dir/subdir/a"
12206
12207           cd ..
12208           rm -r 1
12209
12210           mkdir 2
12211           cd 2
12212           dotest modules-155a0 "${testcvs} co aliasnested" \
12213 "${PROG} checkout: Updating first-dir/subdir/ssdir"
12214           dotest modules-155a1 "test -d first-dir" ''
12215           dotest modules-155a2 "test -d first-dir/subdir" ''
12216           dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
12217           # Test that nothing extraneous got created.
12218           dotest modules-155a4 "ls" "first-dir" \
12219 "CVS
12220 first-dir"
12221           cd ..
12222           rm -r 2
12223
12224           # Test checking out everything.
12225           mkdir 1
12226           cd 1
12227           dotest modules-155b "${testcvs} -q co world" \
12228 "U CVSROOT/${DOTSTAR}
12229 U first-dir/subdir/a
12230 U first-dir/subdir/b"
12231           cd ..
12232           rm -r 1
12233
12234           # Test checking out a module which lists at least two
12235           # specific files twice.  At one time, this failed over
12236           # remote CVS.
12237           mkdir 1
12238           cd 1
12239           dotest modules-155c1 "${testcvs} -q co first-dir" \
12240 "U first-dir/subdir/a
12241 U first-dir/subdir/b"
12242
12243           cd first-dir
12244           echo 'first revision' > file1
12245           echo 'first revision' > file2
12246           dotest modules-155c2 "${testcvs} add file1 file2" \
12247 "${PROG}"' add: scheduling file `file1'\'' for addition
12248 '"${PROG}"' add: scheduling file `file2'\'' for addition
12249 '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
12250           dotest modules-155c3 "${testcvs} -q ci -m add-it" \
12251 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12252 done
12253 Checking in file1;
12254 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12255 initial revision: 1\.1
12256 done
12257 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
12258 done
12259 Checking in file2;
12260 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
12261 initial revision: 1\.1
12262 done"
12263
12264           cd ..
12265           rm -r first-dir
12266           dotest modules-155c4 "${testcvs} -q co topfiles" \
12267 "U first-dir/file1
12268 U first-dir/file2"
12269           dotest modules-155c5 "${testcvs} -q co topfiles" ""
12270
12271           # Make sure the right thing happens if we remove a file.
12272           cd first-dir
12273           dotest modules-155c6 "${testcvs} -q rm -f file1" \
12274 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
12275           dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
12276 "Removing file1;
12277 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12278 new revision: delete; previous revision: 1\.1
12279 done"
12280           cd ..
12281           rm -r first-dir
12282           dotest modules-155c8 "${testcvs} -q co topfiles" \
12283 "${PROG} checkout: warning: first-dir/file1 is not (any longer) pertinent
12284 U first-dir/file2"
12285
12286           cd ..
12287           rm -r 1
12288
12289           rm -rf ${CVSROOT_DIRNAME}/first-dir
12290           ;;
12291
12292         modules2)
12293           # More tests of modules, in particular the & feature.
12294           mkdir 1; cd 1
12295           dotest modules2-setup-1 "${testcvs} -q co -l ." ''
12296           mkdir first-dir second-dir third-dir
12297           dotest modules2-setup-2 \
12298 "${testcvs} add first-dir second-dir third-dir" \
12299 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
12300 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository
12301 Directory ${CVSROOT_DIRNAME}/third-dir added to the repository"
12302           cd third-dir
12303           touch file3
12304           dotest modules2-setup-3 "${testcvs} add file3" \
12305 "${PROG} add: scheduling file .file3. for addition
12306 ${PROG} add: use .${PROG} commit. to add this file permanently"
12307           dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
12308 "RCS file: ${CVSROOT_DIRNAME}/third-dir/file3,v
12309 done
12310 Checking in file3;
12311 ${CVSROOT_DIRNAME}/third-dir/file3,v  <--  file3
12312 initial revision: 1\.1
12313 done"
12314           cd ../..
12315           rm -r 1
12316
12317           mkdir 1
12318           cd 1
12319
12320           dotest modules2-1 "${testcvs} -q co CVSROOT/modules" \
12321 'U CVSROOT/modules'
12322           cd CVSROOT
12323           cat >> modules << EOF
12324 ampermodule &first-dir &second-dir
12325 combmodule third-dir file3 &first-dir
12326 ampdirmod -d newdir &first-dir &second-dir
12327 badmod -d newdir
12328 messymod first-dir &messymodchild
12329 messymodchild -d sdir/child second-dir
12330 EOF
12331           # Depending on whether the user also ran the modules test
12332           # we will be checking in revision 1.2 or 1.3.
12333           dotest modules2-2 "${testcvs} -q ci -m add-modules" \
12334 "Checking in modules;
12335 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12336 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12337 done
12338 ${PROG} commit: Rebuilding administrative file database"
12339
12340           cd ..
12341
12342           dotest modules2-3 "${testcvs} -q co ampermodule" ''
12343           dotest modules2-4 "test -d ampermodule/first-dir" ''
12344           dotest modules2-5 "test -d ampermodule/second-dir" ''
12345
12346           # Test ability of cvs release to handle multiple arguments
12347           # See comment at "release" for list of other cvs release tests.
12348           cd ampermodule
12349           if ${testcvs} release -d first-dir second-dir <<EOF >>${LOGFILE}
12350 yes
12351 yes
12352 EOF
12353           then
12354             pass modules2-6
12355           else
12356             fail modules2-6
12357           fi
12358           dotest_fail modules2-7 "test -d first-dir" ''
12359           dotest_fail modules2-8 "test -d second-dir" ''
12360
12361           cd ..
12362
12363           # There used to be a nasty-hack that made CVS skip creation of the
12364           # module dir (in this case ampermodule) when -n was specified
12365           dotest modules2-ampermod-1 "${testcvs} -q co -n ampermodule" ''
12366           dotest modules2-ampermod-2 "test -d ampermodule/first-dir" ''
12367           dotest modules2-ampermod-3 "test -d ampermodule/second-dir" ''
12368
12369           # Test release of a module
12370           if echo yes |${testcvs} release -d ampermodule >>${LOGFILE}; then
12371             pass modules2-ampermod-release-1
12372           else
12373             fail modules2-ampermod-release-1
12374           fi
12375           dotest_fail modules2-ampermod-release-2 "test -d ampermodule" ''
12376
12377           # and the '-n' test again, but in conjunction with '-d'
12378           dotest modules2-ampermod-4 "${testcvs} -q co -n -d newname ampermodule" ''
12379           dotest modules2-ampermod-5 "test -d newname/first-dir" ''
12380           dotest modules2-ampermod-6 "test -d newname/second-dir" ''
12381           rm -rf newname
12382
12383           # Now we create another directory named first-dir and make
12384           # sure that CVS doesn't get them mixed up.
12385           mkdir first-dir
12386           # Note that this message should say "Updating ampermodule/first-dir"
12387           # I suspect.  This is a long-standing behavior/bug....
12388           dotest modules2-9 "${testcvs} co ampermodule" \
12389 "${PROG} checkout: Updating first-dir
12390 ${PROG} checkout: Updating second-dir"
12391           touch ampermodule/first-dir/amper1
12392           cd ampermodule
12393           dotest modules2-10 "${testcvs} add first-dir/amper1" \
12394 "${PROG} add: scheduling file .first-dir/amper1. for addition
12395 ${PROG} add: use .${PROG} commit. to add this file permanently"
12396           cd ..
12397
12398           # As with the "Updating xxx" message, the "U first-dir/amper1"
12399           # message (instead of "U ampermodule/first-dir/amper1") is
12400           # rather fishy.
12401           dotest modules2-12 "${testcvs} co ampermodule" \
12402 "${PROG} checkout: Updating first-dir
12403 A first-dir/amper1
12404 ${PROG} checkout: Updating second-dir"
12405
12406           if $remote; then
12407             dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
12408 "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
12409 done
12410 Checking in ampermodule/first-dir/amper1;
12411 ${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
12412 initial revision: 1\.1
12413 done"
12414           else
12415             # Trying this as above led to a "protocol error" message.
12416             # Work around this bug.
12417             cd ampermodule
12418             dotest modules2-13 "${testcvs} -q ci -m add-it" \
12419 "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
12420 done
12421 Checking in first-dir/amper1;
12422 ${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
12423 initial revision: 1\.1
12424 done"
12425             cd ..
12426           fi
12427           cd ..
12428           rm -r 1
12429
12430           # Now test the "combmodule" module (combining regular modules
12431           # and ampersand modules in the same module definition).
12432           mkdir 1; cd 1
12433           dotest modules2-14 "${testcvs} co combmodule" \
12434 "U combmodule/file3
12435 ${PROG} checkout: Updating first-dir
12436 U first-dir/amper1"
12437           dotest modules2-15 "test -f combmodule/file3" ""
12438           dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
12439           cd combmodule
12440           rm -r first-dir
12441           # At least for now there is no way to tell CVS that
12442           # some files/subdirectories come from one repository directory,
12443           # and others from another.
12444           # This seems like a pretty sensible behavior to me, in the
12445           # sense that first-dir doesn't "really" exist within
12446           # third-dir, so CVS just acts as if there is nothing there
12447           # to do.
12448           dotest modules2-17 "${testcvs} update -d" \
12449 "${PROG} update: Updating \."
12450
12451           cd ..
12452           dotest modules2-18 "${testcvs} -q co combmodule" \
12453 "U first-dir/amper1"
12454           dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
12455           cd ..
12456           rm -r 1
12457
12458           # Now test the "ampdirmod" and "badmod" modules to be sure that
12459           # options work with ampersand modules but don't prevent the
12460           # "missing directory" error message.
12461           mkdir 1; cd 1
12462           dotest modules2-20 "${testcvs} co ampdirmod" \
12463 "${PROG} checkout: Updating first-dir
12464 U first-dir/amper1
12465 ${PROG} checkout: Updating second-dir"
12466           dotest modules2-21 "test -f newdir/first-dir/amper1" ""
12467           dotest modules2-22 "test -d newdir/second-dir" ""
12468           dotest_fail modules2-23 "${testcvs} co badmod" \
12469 "${PROG} checkout: modules file missing directory for module badmod" \
12470 "${PROG} server: modules file missing directory for module badmod
12471 ${PROG} \[checkout aborted\]: cannot expand modules"
12472           cd ..
12473           rm -r 1
12474
12475           # Confirm that a rename with added depth nested in an ampersand
12476           # module works.
12477           mkdir 1; cd 1
12478           dotest modules2-nestedrename-1 "${testcvs} -q co messymod" \
12479 "U messymod/amper1"
12480           dotest modules2-nestedrename-2 "test -d messymod/sdir" ''
12481           dotest modules2-nestedrename-3 "test -d messymod/sdir/CVS" ''
12482           dotest modules2-nestedrename-4 "test -d messymod/sdir/child" ''
12483           dotest modules2-nestedrename-5 "test -d messymod/sdir/child/CVS" ''
12484           cd ..; rm -r 1
12485
12486           # FIXME:  client/server has a bug.  It should be working like a local
12487           # repository in this case, but fails to check out the second module
12488           # in the list when a branch is specified.
12489           mkdir 1; cd 1
12490           dotest modules2-ampertag-setup-1 \
12491 "${testcvs} -Q rtag tag first-dir second-dir third-dir" \
12492 ''
12493           dotest modules2-ampertag-1 "${testcvs} -q co -rtag ampermodule" \
12494 "U first-dir/amper1"
12495           if $remote; then
12496             dotest_fail modules2-ampertag-2 "test -d ampermodule/second-dir" ''
12497             dotest_fail modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
12498           else
12499             dotest modules2-ampertag-2 "test -d ampermodule/second-dir" ''
12500             dotest modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
12501           fi
12502           cd ..; rm -r 1
12503
12504           # Test for tag files when an ampermod is renamed with more path
12505           # elements than it started with.
12506           #
12507           # FIXME: This is currently broken in the remote case, possibly only
12508           # because the messymodchild isn't being checked out at all.
12509           mkdir 1; cd 1
12510 #         dotest modules2-tagfiles-setup-1 \
12511 #"${testcvs} -Q rtag -b branch first-dir second-dir" \
12512 #''
12513           dotest modules2-tagfiles-1 "${testcvs} -q co -rtag messymod" \
12514 "U messymod/amper1"
12515           if $remote; then
12516             dotest_fail modules2-tagfiles-2r "test -d messymod/sdir" ''
12517           else
12518             dotest modules2-tagfiles-2 "cat messymod/sdir/CVS/Tag" 'Ttag'
12519           fi
12520           cd ..; rm -r 1
12521
12522           # Test that CVS gives an error if one combines -a with
12523           # other options.
12524           # Probably would be better to break this out into a separate
12525           # test.  Although it is short, it shares no files/state with
12526           # the rest of the modules2 tests.
12527           mkdir 1; cd 1
12528           dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
12529 'U CVSROOT/modules'
12530           cd CVSROOT
12531           echo 'aliasopt -a -d onedir first-dir' >modules
12532           dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
12533 "Checking in modules;
12534 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12535 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12536 done
12537 ${PROG} commit: Rebuilding administrative file database"
12538           cd ..
12539           dotest_fail modules2-a1 "${testcvs} -q co aliasopt" \
12540 "${PROG} checkout: -a cannot be specified in the modules file along with other options" \
12541 "${PROG} server: -a cannot be specified in the modules file along with other options
12542 ${PROG} \[checkout aborted\]: cannot expand modules"
12543           cd ..;  rm -r 1
12544
12545           # Clean up.
12546           rm -rf ${CVSROOT_DIRNAME}/first-dir
12547           rm -rf ${CVSROOT_DIRNAME}/second-dir
12548           rm -rf ${CVSROOT_DIRNAME}/third-dir
12549           ;;
12550
12551         modules3)
12552           # More tests of modules, in particular what happens if several
12553           # modules point to the same file.
12554
12555           # First just set up a directory first-dir and a file file1 in it.
12556           mkdir 1; cd 1
12557
12558           dotest modules3-0 "${testcvs} -q co -l ." ''
12559           mkdir first-dir
12560           dotest modules3-1 "${testcvs} add first-dir" \
12561 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
12562
12563           cd first-dir
12564           echo file1 >file1
12565           dotest modules3-2 "${testcvs} add file1" \
12566 "${PROG} add: scheduling file \`file1' for addition
12567 ${PROG} add: use '${PROG} commit' to add this file permanently"
12568           dotest modules3-3 "${testcvs} -q ci -m add-it" \
12569 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12570 done
12571 Checking in file1;
12572 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12573 initial revision: 1\.1
12574 done"
12575           cd ..
12576
12577           dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
12578 "U CVSROOT${DOTSTAR}"
12579           cd CVSROOT
12580           cat >modules <<EOF
12581 mod1 -a first-dir/file1
12582 bigmod -a mod1 first-dir/file1
12583 namednest -d src/sub/dir first-dir
12584 nestdeeper -d src/sub1/sub2/sub3/dir first-dir
12585 nestshallow -d src/dir second-dir/suba/subb
12586 path/in/modules &mod1
12587 another/path/test -d another/path/test first-dir
12588 EOF
12589           dotest modules3-5 "${testcvs} -q ci -m add-modules" \
12590 "Checking in modules;
12591 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12592 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12593 done
12594 ${PROG} commit: Rebuilding administrative file database"
12595           cd ..
12596
12597           dotest modules3-6 "${testcvs} -q co bigmod" ''
12598           rm -r first-dir
12599           dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
12600           cd ..
12601           rm -r 1
12602
12603           mkdir 1; cd 1
12604           mkdir suba
12605           mkdir suba/subb
12606           # This fails to work remote (it doesn't notice the directories,
12607           # I suppose because they contain no files).  Bummer, especially
12608           # considering this is a documented technique and everything.
12609           dotest modules3-7a \
12610 "${testcvs} import -m add-dirs second-dir tag1 tag2" \
12611 "${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba
12612 ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba/subb
12613
12614 No conflicts created by this import" "
12615 No conflicts created by this import"
12616           cd ..; rm -r 1
12617           mkdir 1; cd 1
12618           dotest modules3-7b "${testcvs} co second-dir" \
12619 "${PROG} checkout: Updating second-dir
12620 ${PROG} checkout: Updating second-dir/suba
12621 ${PROG} checkout: Updating second-dir/suba/subb" \
12622 "${PROG} checkout: Updating second-dir"
12623
12624           if $remote; then
12625             cd second-dir
12626             mkdir suba
12627             dotest modules3-7-workaround1 "${testcvs} add suba" \
12628 "Directory ${CVSROOT_DIRNAME}/second-dir/suba added to the repository"
12629             cd suba
12630             mkdir subb
12631             dotest modules3-7-workaround2 "${testcvs} add subb" \
12632 "Directory ${CVSROOT_DIRNAME}/second-dir/suba/subb added to the repository"
12633             cd ../..
12634           fi
12635
12636           cd second-dir/suba/subb
12637           touch fileb
12638           dotest modules3-7c "${testcvs} add fileb" \
12639 "${PROG} add: scheduling file .fileb. for addition
12640 ${PROG} add: use .${PROG} commit. to add this file permanently"
12641           dotest modules3-7d "${testcvs} -q ci -m add-it" \
12642 "RCS file: ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v
12643 done
12644 Checking in fileb;
12645 ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v  <--  fileb
12646 initial revision: 1\.1
12647 done"
12648           cd ../../..
12649           cd ..; rm -r 1
12650
12651           mkdir 1
12652           cd 1
12653           dotest modules3-8 "${testcvs} -q co namednest" \
12654 'U src/sub/dir/file1'
12655           dotest modules3-9 "test -f src/sub/dir/file1" ''
12656           cd ..
12657           rm -r 1
12658
12659           # Try the same thing, but with the directories nested even
12660           # deeper (deeply enough so they are nested more deeply than
12661           # the number of directories from / to ${TESTDIR}).
12662           mkdir 1
12663           cd 1
12664           dotest modules3-10 "${testcvs} -q co nestdeeper" \
12665 'U src/sub1/sub2/sub3/dir/file1'
12666           dotest modules3-11 "test -f src/sub1/sub2/sub3/dir/file1" ''
12667
12668           # While we are doing things like twisted uses of '/' (e.g.
12669           # modules3-12), try this one.
12670           if $remote; then
12671             dotest_fail modules3-11b \
12672 "${testcvs} -q update ${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1" \
12673 "absolute pathname .${TESTDIR}/1/src/sub1/sub2/sub3/dir. illegal for server"
12674           fi # end of remote-only tests
12675
12676           cd ..
12677           rm -r 1
12678
12679           # This one is almost too twisted for words.  The pathname output
12680           # in the message from "co" doesn't include the "path/in/modules",
12681           # but those directories do get created (with no CVSADM except
12682           # in "modules" which has a CVSNULLREPOS).
12683           # I'm not sure anyone is relying on this nonsense or whether we
12684           # need to keep doing it, but it is what CVS currently does...
12685           # Skip it for remote; the remote code has the good sense to
12686           # not deal with it (on the minus side it gives
12687           # "internal error: repository string too short." (CVS 1.9) or
12688           # "warning: server is not creating directories one at a time" (now)
12689           # instead of a real error).
12690           # I'm tempted to just make it a fatal error to have '/' in a
12691           # module name.  But see comments at modules3-16.
12692           if $remote; then :; else
12693             mkdir 1; cd 1
12694             dotest modules3-12 "${testcvs} -q co path/in/modules" \
12695 "U first-dir/file1"
12696             dotest modules3-13 "test -f path/in/modules/first-dir/file1" ''
12697             cd ..; rm -r 1
12698           fi # end of tests skipped for remote
12699
12700           # Now here is where it used to get seriously bogus.
12701           mkdir 1; cd 1
12702           dotest modules3-14 \
12703 "${testcvs} -q rtag tag1 path/in/modules" ''
12704           # CVS used to create this even though rtag should *never* affect
12705           # the directory current when it is called!
12706           dotest_fail modules3-15 "test -d path/in/modules" ''
12707           # Just for trivia's sake, rdiff was not similarly vulnerable
12708           # because it passed 0 for run_module_prog to do_module.
12709           cd ..; rm -r 1
12710
12711           # Some people seem to want this to work.  I still suspect there
12712           # are dark corners in slashes in module names.  This probably wants
12713           # more thought before we start hacking on CVS (one way or the other)
12714           # or documenting this.
12715           mkdir 2; cd 2
12716           dotest modules3-16 "${testcvs} -q co another/path/test" \
12717 "U another/path/test/file1"
12718           dotest modules3-17 "cat another/path/test/file1" 'file1'
12719           cd ..; rm -r 2
12720
12721           rm -rf ${CVSROOT_DIRNAME}/first-dir
12722           rm -rf ${CVSROOT_DIRNAME}/second-dir
12723           ;;
12724
12725         modules4)
12726           # Some tests using the modules file with aliases that
12727           # exclude particular directories.
12728
12729           mkdir 1; cd 1
12730
12731           dotest modules4-1 "${testcvs} -q co -l ." ''
12732           mkdir first-dir
12733           dotest modules4-2 "${testcvs} add first-dir" \
12734 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
12735
12736           cd first-dir
12737           mkdir subdir subdir_long
12738           dotest modules4-3 "${testcvs} add subdir subdir_long" \
12739 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository
12740 Directory ${CVSROOT_DIRNAME}/first-dir/subdir_long added to the repository"
12741
12742           echo file1 > file1
12743           dotest modules4-4 "${testcvs} add file1" \
12744 "${PROG}"' add: scheduling file `file1'\'' for addition
12745 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
12746
12747           echo file2 > subdir/file2
12748           dotest modules4-5 "${testcvs} add subdir/file2" \
12749 "${PROG}"' add: scheduling file `subdir/file2'\'' for addition
12750 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
12751
12752           echo file3 > subdir_long/file3
12753           dotest modules4-6 "${testcvs} add subdir_long/file3" \
12754 "${PROG}"' add: scheduling file `subdir_long/file3'\'' for addition
12755 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
12756
12757           dotest modules4-7 "${testcvs} -q ci -m add-it" \
12758 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12759 done
12760 Checking in file1;
12761 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12762 initial revision: 1\.1
12763 done
12764 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
12765 done
12766 Checking in subdir/file2;
12767 ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v  <--  file2
12768 initial revision: 1\.1
12769 done
12770 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v
12771 done
12772 Checking in subdir_long/file3;
12773 ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v  <--  file3
12774 initial revision: 1\.1
12775 done"
12776
12777           cd ..
12778
12779           dotest modules4-8 "${testcvs} -q update -d CVSROOT" \
12780 "U CVSROOT${DOTSTAR}"
12781           cd CVSROOT
12782           cat >modules <<EOF
12783 all -a first-dir
12784 some -a !first-dir/subdir first-dir
12785 other -a !first-dir/subdir !first-dir/subdir_long first-dir
12786 somewhat -a first-dir !first-dir/subdir
12787 EOF
12788           dotest modules4-9 "${testcvs} -q ci -m add-modules" \
12789 "Checking in modules;
12790 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12791 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12792 done
12793 ${PROG} commit: Rebuilding administrative file database"
12794           cd ..
12795
12796           cd ..
12797           mkdir 2; cd 2
12798
12799           dotest modules4-10 "${testcvs} -q co all" \
12800 "U first-dir/file1
12801 U first-dir/subdir/file2
12802 U first-dir/subdir_long/file3"
12803           rm -r first-dir
12804
12805           dotest modules4-11 "${testcvs} -q co some" \
12806 "U first-dir/file1
12807 U first-dir/subdir_long/file3"
12808           dotest_fail modules4-12 "test -d first-dir/subdir" ''
12809           dotest modules4-13 "test -d first-dir/subdir_long" ''
12810           rm -r first-dir
12811
12812           if $remote; then
12813             # But remote seems to do it the other way.
12814             dotest modules4-14r-1 "${testcvs} -q co somewhat" \
12815 "U first-dir/file1
12816 U first-dir/subdir_long/file3"
12817             dotest_fail modules4-14r-2 "test -d first-dir/subdir" ''
12818             dotest modules4-14r-3 "test -d first-dir/subdir_long" ''
12819           else
12820             # This is strange behavior, in that the order of the
12821             # "!first-dir/subdir" and "first-dir" matter, and it isn't
12822             # clear that they should.  I suspect it is long-standing
12823             # strange behavior but I haven't verified that.
12824             dotest modules4-14-1 "${testcvs} -q co somewhat" \
12825 "U first-dir/file1
12826 U first-dir/subdir/file2
12827 U first-dir/subdir_long/file3"
12828             dotest modules4-14-2 "test -d first-dir/subdir" ''
12829             dotest modules4-14-3 "test -d first-dir/subdir_long" ''
12830           fi
12831           rm -r first-dir
12832
12833           dotest modules4-15 "${testcvs} -q co other" \
12834 "U first-dir/file1"
12835           dotest_fail modules4-16 "test -d first-dir/subdir" ''
12836           dotest_fail modules4-17 "test -d first-dir/subdir_long" ''
12837           rm -r first-dir
12838
12839           cd ..
12840           rm -r 2
12841
12842           dotest modules4-18 "${testcvs} rtag tag some" \
12843 "${PROG} rtag: Tagging first-dir
12844 ${PROG} rtag: Ignoring first-dir/subdir
12845 ${PROG} rtag: Tagging first-dir/subdir_long"
12846
12847           cd 1/first-dir/subdir
12848           dotest modules4-19 "${testcvs} log file2" "
12849 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
12850 Working file: file2
12851 head: 1\.1
12852 branch:
12853 locks: strict
12854 access list:
12855 symbolic names:
12856 keyword substitution: kv
12857 total revisions: 1;     selected revisions: 1
12858 description:
12859 ----------------------------
12860 revision 1\.1
12861 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
12862 add-it
12863 ============================================================================="
12864
12865           if $keep; then
12866             echo Keeping $TESTDIR and exiting due to --keep
12867             exit 0
12868           fi
12869
12870           cd ../../..
12871           rm -r 1
12872
12873           rm -rf ${CVSROOT_DIRNAME}/first-dir
12874           ;;
12875
12876         modules5)
12877           # Test module programs
12878
12879           mkdir ${CVSROOT_DIRNAME}/first-dir
12880           mkdir 1
12881           cd 1
12882           dotest modules5-1 "${testcvs} -q co first-dir" ""
12883           cd first-dir
12884           mkdir subdir
12885           dotest modules5-2 "${testcvs} add subdir" \
12886 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
12887           cd subdir
12888           mkdir ssdir
12889           dotest modules5-3 "${testcvs} add ssdir" \
12890 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
12891           touch a b
12892           dotest modules5-4 "${testcvs} add a b" \
12893 "${PROG} add: scheduling file .a. for addition
12894 ${PROG} add: scheduling file .b. for addition
12895 ${PROG} add: use .${PROG} commit. to add these files permanently"
12896
12897           dotest modules5-5 "${testcvs} ci -m added" \
12898 "${PROG} [a-z]*: Examining .
12899 ${PROG} [a-z]*: Examining ssdir
12900 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
12901 done
12902 Checking in a;
12903 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
12904 initial revision: 1\.1
12905 done
12906 RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
12907 done
12908 Checking in b;
12909 ${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
12910 initial revision: 1\.1
12911 done"
12912
12913           cd ..
12914           dotest modules5-6 "${testcvs} -q co CVSROOT" \
12915 "U CVSROOT/checkoutlist
12916 U CVSROOT/commitinfo
12917 U CVSROOT/config
12918 U CVSROOT/cvswrappers
12919 U CVSROOT/editinfo
12920 U CVSROOT/loginfo
12921 U CVSROOT/modules
12922 U CVSROOT/notify
12923 U CVSROOT/rcsinfo
12924 U CVSROOT/taginfo
12925 U CVSROOT/verifymsg"
12926
12927           # FIXCVS: The sleep in the following script helps avoid out of
12928           # order messages, but we really need to figure out how to fix
12929           # cvs to prevent them in the first place.
12930           for i in checkout export tag; do
12931             cat >> ${CVSROOT_DIRNAME}/$i.sh <<EOF
12932 #! /bin/sh
12933 sleep 1
12934 echo "$i script invoked in \`pwd\`"
12935 echo "args: \$@"
12936 EOF
12937             # Cygwin doesn't set premissions correctly over the Samba share.
12938             if test -n "$remotehost"; then
12939               $CVS_RSH $remotehost "chmod +x ${CVSROOT_DIRNAME}/$i.sh"
12940             else
12941               chmod +x ${CVSROOT_DIRNAME}/$i.sh
12942             fi
12943           done
12944
12945           OPTS="-o${CVSROOT_DIRNAME}/checkout.sh -e ${CVSROOT_DIRNAME}/export.sh -t${CVSROOT_DIRNAME}/tag.sh"
12946           cat >CVSROOT/modules <<EOF
12947 realmodule ${OPTS} first-dir/subdir a
12948 dirmodule ${OPTS} first-dir/subdir
12949 namedmodule -d nameddir ${OPTS} first-dir/subdir
12950 EOF
12951
12952           dotest modules5-7 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
12953 "" \
12954 "Checking in CVSROOT/modules;
12955 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12956 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12957 done
12958 ${PROG} commit: Rebuilding administrative file database"
12959
12960           cd ..
12961           rm -rf first-dir
12962
12963           # Test that real modules check out to realmodule/a, not subdir/a.
12964           if $remote; then
12965             # FIXCVS?
12966             # Mac OSX 10.3 (Darwin ppc-osx1 5.5) fails here when $TMPDIR
12967             # contains a symlink (it does not fail the local modules5-8).
12968             # Since no other platforms are exhibiting the same problem, I
12969             # suspect an issue with OSX and fork() or the like dereferencing
12970             # the symlink, but it is possible it is something that could be
12971             # fixed or worked around in CVS.
12972             dotest modules5-8r "$testcvs co realmodule" \
12973 "U realmodule/a
12974 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
12975 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
12976 args: realmodule"
12977           else
12978             dotest modules5-8 "${testcvs} co realmodule" \
12979 "U realmodule/a
12980 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
12981 checkout script invoked in ${TESTDIR}/1
12982 args: realmodule"
12983           fi
12984           dotest modules5-9 "test -d realmodule && test -f realmodule/a" ""
12985           dotest_fail modules5-10 "test -f realmodule/b" ""
12986           if $remote; then
12987             dotest modules5-11 "${testcvs} -q co realmodule" \
12988 "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
12989 args: realmodule"
12990             dotest modules5-12 "${testcvs} -q update" ''
12991             echo "change" >>realmodule/a
12992             dotest modules5-13 "${testcvs} -q ci -m." \
12993 "Checking in realmodule/a;
12994 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
12995 new revision: 1\.2; previous revision: 1\.1
12996 done"
12997           else
12998             dotest modules5-11 "${testcvs} -q co realmodule" \
12999 "checkout script invoked in ${TESTDIR}/1
13000 args: realmodule"
13001             dotest modules5-12 "${testcvs} -q update" ''
13002             echo "change" >>realmodule/a
13003             dotest modules5-13 "${testcvs} -q ci -m." \
13004 "Checking in realmodule/a;
13005 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
13006 new revision: 1\.2; previous revision: 1\.1
13007 done"
13008           fi
13009           dotest modules5-14 "echo yes | ${testcvs} release -d realmodule" \
13010 "You have \[0\] altered files in this repository\.
13011 Are you sure you want to release (and delete) directory .realmodule.: "
13012           dotest modules5-15 "${testcvs} -q rtag -Dnow MYTAG realmodule" \
13013 "tag script invoked in ${TESTDIR}/1
13014 args: realmodule MYTAG" \
13015 "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13016 args: realmodule MYTAG"
13017           if $remote; then
13018             dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
13019 "U realmodule/a
13020 export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13021 args: realmodule"
13022           else
13023             dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
13024 "U realmodule/a
13025 export script invoked in ${TESTDIR}/1
13026 args: realmodule"
13027           fi
13028           rm -r realmodule
13029
13030           dotest_fail modules5-17 "${testcvs} co realmodule/a" \
13031 "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
13032 "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
13033 '"${PROG}"' \[checkout aborted\]: cannot expand modules'
13034
13035           # Now test the ability to check out a single file from a directory
13036           if $remote; then
13037             dotest modules5-18 "${testcvs} co dirmodule/a" \
13038 "U dirmodule/a
13039 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
13040 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13041 args: dirmodule"
13042           else
13043             dotest modules5-18 "${testcvs} co dirmodule/a" \
13044 "U dirmodule/a
13045 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
13046 checkout script invoked in ${TESTDIR}/1
13047 args: dirmodule"
13048           fi
13049           dotest modules5-19 "test -d dirmodule && test -f dirmodule/a" ""
13050           dotest_fail modules5-20 "test -f dirmodule/b" ""
13051           dotest modules5-21 "echo yes | ${testcvs} release -d dirmodule" \
13052 "You have \[0\] altered files in this repository\.
13053 Are you sure you want to release (and delete) directory .dirmodule.: "
13054
13055           # Now test the ability to correctly reject a non-existent filename.
13056           # For maximum studliness we would check that an error message is
13057           # being output.
13058           # We accept a zero exit status because it is what CVS does
13059           # (Dec 95).  Probably the exit status should be nonzero,
13060           # however.
13061           if $remote; then
13062             dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
13063 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
13064 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
13065 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13066 args: dirmodule"
13067           else
13068             dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
13069 "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
13070 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
13071 checkout script invoked in ${TESTDIR}/1
13072 args: dirmodule"
13073           fi
13074           # We tolerate the creation of the dirmodule directory, since that
13075           # is what CVS does, not because we view that as preferable to not
13076           # creating it.
13077           dotest_fail modules5-23 "test -f dirmodule/a || test -f dirmodule/b" ""
13078           rm -r dirmodule
13079
13080           # Now test that a module using -d checks out to the specified
13081           # directory.
13082           if $remote; then
13083             dotest modules5-24 "${testcvs} -q co namedmodule" \
13084 "U nameddir/a
13085 U nameddir/b
13086 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13087 args: nameddir"
13088           else
13089             dotest modules5-24 "${testcvs} -q co namedmodule" \
13090 "U nameddir/a
13091 U nameddir/b
13092 checkout script invoked in ${TESTDIR}/1
13093 args: nameddir"
13094           fi
13095           dotest modules5-25 "test -f nameddir/a && test -f nameddir/b" ""
13096           echo add line >>nameddir/a
13097           # This seems suspicious: when we checkout an existing directory,
13098           # the checkout script gets executed in addition to the update
13099           # script.  Is that by design or accident?
13100           if $remote; then
13101             dotest modules5-26 "${testcvs} -q co namedmodule" \
13102 "M nameddir/a
13103 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13104 args: nameddir"
13105           else
13106             dotest modules5-26 "${testcvs} -q co namedmodule" \
13107 "M nameddir/a
13108 checkout script invoked in ${TESTDIR}/1
13109 args: nameddir"
13110           fi
13111           rm nameddir/a
13112
13113           if $remote; then
13114             dotest modules5-27 "${testcvs} -q co namedmodule" \
13115 "U nameddir/a
13116 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13117 args: nameddir"
13118           else
13119             dotest modules5-27 "${testcvs} -q co namedmodule" \
13120 "U nameddir/a
13121 checkout script invoked in ${TESTDIR}/1
13122 args: nameddir"
13123           fi
13124           dotest modules5-28 "echo yes | ${testcvs} release -d nameddir" \
13125 "You have \[0\] altered files in this repository\.
13126 Are you sure you want to release (and delete) directory .nameddir.: "
13127
13128           # Now try the same tests with -d on command line
13129           # FIXCVS?  The manual says the modules programs get the module name,
13130           # but they really get the directory name.
13131           if $remote; then
13132             dotest modules5-29 "${testcvs} co -d mydir realmodule" \
13133 "U mydir/a
13134 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13135 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13136 args: mydir"
13137           else
13138             dotest modules5-29 "${testcvs} co -d mydir realmodule" \
13139 "U mydir/a
13140 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13141 checkout script invoked in ${TESTDIR}/1
13142 args: mydir"
13143           fi
13144           dotest modules5-30 "test -d mydir && test -f mydir/a" ""
13145           dotest_fail modules5-31 "test -d realmodule || test -f mydir/b" ""
13146           if $remote; then
13147             dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
13148 "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13149 args: mydir"
13150             dotest modules5-33 "${testcvs} -q update" ''
13151             echo "change" >>mydir/a
13152             dotest modules5-34 "${testcvs} -q ci -m." \
13153 "Checking in mydir/a;
13154 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
13155 new revision: 1\.3; previous revision: 1\.2
13156 done"
13157           else
13158             dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
13159 "checkout script invoked in ${TESTDIR}/1
13160 args: mydir"
13161             dotest modules5-33 "${testcvs} -q update" ''
13162             echo "change" >>mydir/a
13163             dotest modules5-34 "${testcvs} -q ci -m." \
13164 "Checking in mydir/a;
13165 ${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
13166 new revision: 1\.3; previous revision: 1\.2
13167 done"
13168           fi
13169           dotest modules5-35 "echo yes | ${testcvs} release -d mydir" \
13170 "You have \[0\] altered files in this repository\.
13171 Are you sure you want to release (and delete) directory .mydir.: "
13172           if $remote; then
13173             dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
13174 "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13175 args: realmodule MYTAG2"
13176             dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
13177 "U mydir/a
13178 export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13179 args: mydir"
13180           else
13181             dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
13182 "tag script invoked in ${TESTDIR}/1
13183 args: realmodule MYTAG2"
13184             dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
13185 "U mydir/a
13186 export script invoked in ${TESTDIR}/1
13187 args: mydir"
13188           fi
13189           rm -r mydir
13190
13191           # Now test the ability to check out a single file from a directory
13192           if $remote; then
13193             dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
13194 "U mydir/a
13195 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13196 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13197 args: mydir"
13198           else
13199             dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
13200 "U mydir/a
13201 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13202 checkout script invoked in ${TESTDIR}/1
13203 args: mydir"
13204           fi
13205           dotest modules5-39 "test -d mydir && test -f mydir/a" ""
13206           dotest_fail modules5-40 "test -d dirmodule || test -f mydir/b" ""
13207           dotest modules5-41 "echo yes | ${testcvs} release -d mydir" \
13208 "You have \[0\] altered files in this repository\.
13209 Are you sure you want to release (and delete) directory .mydir.: "
13210
13211           # Now test the ability to correctly reject a non-existent filename.
13212           # For maximum studliness we would check that an error message is
13213           # being output.
13214           # We accept a zero exit status because it is what CVS does
13215           # (Dec 95).  Probably the exit status should be nonzero,
13216           # however.
13217           if $remote; then
13218             dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
13219 "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
13220 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13221 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13222 args: mydir"
13223           else
13224             dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
13225 "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
13226 ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
13227 checkout script invoked in ${TESTDIR}/1
13228 args: mydir"
13229           fi
13230           # We tolerate the creation of the mydir directory, since that
13231           # is what CVS does, not because we view that as preferable to not
13232           # creating it.
13233           dotest_fail modules5-43 "test -f mydir/a || test -f mydir/b" ""
13234           rm -r mydir
13235
13236           if $remote; then
13237             dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
13238 "U mydir/a
13239 U mydir/b
13240 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13241 args: mydir"
13242           else
13243             dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
13244 "U mydir/a
13245 U mydir/b
13246 checkout script invoked in ${TESTDIR}/1
13247 args: mydir"
13248           fi
13249           dotest modules5-45 "test -f mydir/a && test -f mydir/b" ""
13250           dotest_fail modules5-46 "test -d namedir"
13251           echo add line >>mydir/a
13252           # This seems suspicious: when we checkout an existing directory,
13253           # the checkout script gets executed in addition to the update
13254           # script.  Is that by design or accident?
13255           if $remote; then
13256             dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
13257 "M mydir/a
13258 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13259 args: mydir"
13260           else
13261             dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
13262 "M mydir/a
13263 checkout script invoked in ${TESTDIR}/1
13264 args: mydir"
13265           fi
13266           rm mydir/a
13267
13268           if $remote; then
13269             dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
13270 "U mydir/a
13271 checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13272 args: mydir"
13273           else
13274             dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
13275 "U mydir/a
13276 checkout script invoked in ${TESTDIR}/1
13277 args: mydir"
13278           fi
13279           dotest modules5-49 "echo yes | ${testcvs} release -d mydir" \
13280 "You have \[0\] altered files in this repository\.
13281 Are you sure you want to release (and delete) directory .mydir.: "
13282
13283           cd ..
13284           rm -rf 1 ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/*.sh
13285           ;;
13286
13287         modules6)
13288           #
13289           # Test invalid module definitions
13290           #
13291           # See the header comment for the `modules' test for an index of
13292           # the complete suite of modules tests.
13293           #
13294
13295           #
13296           # There was a bug in CVS through 1.11.1p1 where a bad module name
13297           # would cause the previous line to be parsed as the module
13298           # definition.  This test proves this doesn't happen anymore.
13299           #
13300           mkdir modules6
13301           cd modules6
13302           dotest module6-setup-1 "${testcvs} -Q co CVSROOT" ""
13303           cd CVSROOT
13304           echo "longmodulename who cares" >modules
13305           echo "badname" >>modules
13306           # This test almost isn't setup since it generates the error message
13307           # we are looking for if `-Q' isn't specified, but I want to test the
13308           # filename in the message later.
13309           dotest modules6-setup-2 "${testcvs} -Q ci -mbad-modules" \
13310 "Checking in modules;
13311 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
13312 new revision: [0-9.]*; previous revision: [0-9.]*
13313 done
13314 ${PROG} commit: Rebuilding administrative file database"
13315
13316           # Here's where CVS would report not being able to find `lename'
13317           cd ..
13318           dotest_fail modules6-1 "${testcvs} -q co badname" \
13319 "${PROG} checkout: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
13320 ${PROG} checkout: cannot find module .badname. - ignored" \
13321 "${PROG} server: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
13322 ${PROG} server: cannot find module .badname. - ignored
13323 ${PROG} \[checkout aborted\]: cannot expand modules"
13324
13325           # cleanup
13326           cd CVSROOT
13327           echo "# empty modules file" >modules
13328           dotest modules6-cleanup-1 "${testcvs} -Q ci -mempty-modules" \
13329 "Checking in modules;
13330 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
13331 new revision: [0-9.]*; previous revision: [0-9.]*
13332 done
13333 ${PROG} commit: Rebuilding administrative file database"
13334           cd ../..
13335
13336           if $keep; then :; else
13337             rm -r modules6
13338           fi
13339           ;;
13340
13341
13342
13343         modules7)
13344           #
13345           # Test tag problems vs an empty CVSROOT/val-tags file
13346           #
13347           # See the header comment for the `modules' test for an index of
13348           # the complete suite of modules tests.
13349           #
13350           mkdir modules7
13351           cd modules7
13352           dotest modules7-1 "$testcvs -Q co -d top ."
13353           cd top
13354           mkdir zero one
13355           dotest modules7-2 "$testcvs -Q add zero one"
13356           cd one
13357           echo 'file1 contents' > file1
13358           dotest modules7-2 "$testcvs -Q add file1"
13359           dotest modules7-3 "$testcvs -Q ci -mnew file1" \
13360 "RCS file: $CVSROOT_DIRNAME/one/file1,v
13361 done
13362 Checking in file1;
13363 $CVSROOT_DIRNAME/one/file1,v  <--  file1
13364 initial revision: 1\.1
13365 done"
13366           dotest modules7-4 "$testcvs -Q tag mytag file1"
13367           cd ../CVSROOT
13368           echo 'all -a zero one' > modules
13369           dotest modules7-5 "$testcvs -Q ci -mall-module" \
13370 "Checking in modules;
13371 $CVSROOT_DIRNAME/CVSROOT/modules,v  <--  modules
13372 new revision: [0-9.]*; previous revision: [0-9.]*
13373 done
13374 $PROG commit: Rebuilding administrative file database"
13375           cd ../..
13376           mkdir myexport
13377           cd myexport
13378           # FIXCVS: The export should NOT be aborted here
13379           dotest_fail modules7-6 "$testcvs export -rmytag all" \
13380 "$PROG \[export aborted\]: no such tag mytag"
13381           cd ..
13382           rm -fr myexport
13383           mkdir myexport
13384           cd myexport
13385           # FIXCVS: Workaround is to have mytag listed in val-tags
13386           echo 'mytag y' > $CVSROOT_DIRNAME/CVSROOT/val-tags
13387           dotest modules7-7 "$testcvs export -rmytag all" \
13388 "$PROG export: Updating zero
13389 $PROG export: Updating one
13390 U one/file1"
13391           dotest modules7-8 'cat one/file1' 'file1 contents'
13392
13393           if $keep; then
13394             echo Keeping $TESTDIR and exiting due to --keep
13395             exit 0
13396           fi
13397
13398           # cleanup
13399           cd ../top/CVSROOT
13400           echo "# empty modules file" >modules
13401           dotest modules7-cleanup-1 "$testcvs -Q ci -mempty-modules" \
13402 "Checking in modules;
13403 $CVSROOT_DIRNAME/CVSROOT/modules,v  <--  modules
13404 new revision: [0-9.]*; previous revision: [0-9.]*
13405 done
13406 $PROG commit: Rebuilding administrative file database"
13407           cd ../../..
13408           rm -fr modules7
13409           rm -rf $CVSROOT_DIRNAME/zero $CVSROOT_DIRNAME/one
13410           ;;
13411
13412
13413         mkmodules)
13414           # When a file listed in checkoutlist doesn't exist, cvs-1.10.4
13415           # would fail to remove the CVSROOT/.#[0-9]* temporary file it
13416           # creates while mkmodules is in the process of trying to check
13417           # out the missing file.
13418
13419           mkdir 1; cd 1
13420           dotest mkmodules-temp-file-removal-1 "${testcvs} -Q co CVSROOT" ''
13421           cd CVSROOT
13422           echo no-such-file >> checkoutlist
13423           dotest mkmodules-temp-file-removal-2 "${testcvs} -Q ci -m. checkoutlist" \
13424 "Checking in checkoutlist;
13425 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
13426 new revision: 1\.2; previous revision: 1\.1
13427 done
13428 ${PROG} commit: Rebuilding administrative file database"
13429
13430           dotest mkmodules-temp-file-removal-3 "echo $CVSROOT_DIRNAME/CVSROOT/.#[0-9]*" \
13431             "$CVSROOT_DIRNAME/CVSROOT/\.#\[0-9\]\*"
13432
13433           # Versions 1.11.6 & 1.12.1 and earlier of CVS printed most of the
13434           # white space included before error messages in checkoutlist.
13435           echo "no-such-file     Failed to update no-such-file." >checkoutlist
13436           dotest mkmodules-error-message-1 "${testcvs} -Q ci -m. checkoutlist" \
13437 "Checking in checkoutlist;
13438 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
13439 new revision: 1\.3; previous revision: 1\.2
13440 done
13441 ${PROG} commit: Rebuilding administrative file database
13442 ${PROG} commit: Failed to update no-such-file\."
13443
13444           # Versions 1.11.6 & 1.12.1 and earlier of CVS used the error string
13445           # from the checkoutlist file as the format string passed to error()'s
13446           # printf.  Check that this is no longer the case by verifying that
13447           # printf format patterns remain unchanged.
13448           echo "no-such-file     Failed to update %s %lx times because %s happened %d times." >checkoutlist
13449           dotest mkmodules-error-message-2 "${testcvs} -Q ci -m. checkoutlist" \
13450 "Checking in checkoutlist;
13451 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
13452 new revision: 1\.4; previous revision: 1\.3
13453 done
13454 ${PROG} commit: Rebuilding administrative file database
13455 ${PROG} commit: Failed to update %s %lx times because %s happened %d times\."
13456
13457           dotest mkmodules-cleanup-1 "${testcvs} -Q up -pr1.1 checkoutlist >checkoutlist"
13458           dotest mkmodules-cleanup-2 "${testcvs} -Q ci -m. checkoutlist" \
13459 "Checking in checkoutlist;
13460 $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
13461 new revision: 1\.5; previous revision: 1\.4
13462 done
13463 ${PROG} commit: Rebuilding administrative file database"
13464
13465           cd ../..
13466           rm -rf 1
13467           ;;
13468
13469         co-d)
13470           # Some tests of various permutations of co-d when directories exist
13471           # and checkouts lengthen.
13472           #
13473           # Interestingly enough, these same tests pass when the directory
13474           # lengthening happens via the modules file.  Go figure.
13475           module=co-d
13476           mkdir $module; cd $module
13477           mkdir top; cd top
13478           dotest co-d-init-1 "$testcvs -Q co -l ."
13479           mkdir $module
13480           dotest co-d-init-2 "$testcvs -Q add $module"
13481           cd $module
13482           echo content >file1
13483           echo different content >file2
13484           dotest co-d-init-3 "$testcvs -Q add file1 file2"
13485           dotest co-d-init-4 "$testcvs -Q ci -madd-em" \
13486 "RCS file: $CVSROOT_DIRNAME/co-d/file1,v
13487 done
13488 Checking in file1;
13489 $CVSROOT_DIRNAME/co-d/file1,v  <--  file1
13490 initial revision: 1\.1
13491 done
13492 RCS file: $CVSROOT_DIRNAME/co-d/file2,v
13493 done
13494 Checking in file2;
13495 $CVSROOT_DIRNAME/co-d/file2,v  <--  file2
13496 initial revision: 1\.1
13497 done"
13498           cd ../..
13499
13500           mkdir 2; cd 2
13501           dotest co-d-1 "$testcvs -q co -d dir $module" \
13502 "U dir/file1
13503 U dir/file2"
13504           dotest co-d-1.2 "cat dir/CVS/Repository" "$module"
13505
13506           # FIXCVS: This should work.  Correct expected result:
13507           #
13508           #"U dir2/sdir/file1
13509           #U dir2/sdir/file2"
13510           dotest_fail co-d-2 "$testcvs -q co -d dir2/sdir $module" \
13511 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir2': No such file or directory"
13512           # FIXCVS:
13513           # dotest co-d-2.2 "cat dir4/CVS/Repository" "CVSROOT/Emptydir"
13514           # dotest co-d-2.3 "cat dir5/CVS/Repository" "$module"
13515
13516           mkdir dir3
13517           dotest co-d-3 "$testcvs -q co -d dir3 $module" \
13518 "U dir3/file1
13519 U dir3/file2"
13520           dotest co-d-3.2 "cat dir3/CVS/Repository" "$module"
13521
13522           if $remote; then
13523             # FIXCVS: As for co-d-2.
13524             mkdir dir4
13525             dotest_fail co-d-4r "$testcvs -q co -d dir4/sdir $module" \
13526 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir4': No such file or directory"
13527
13528             # FIXCVS: As for co-d-2.
13529             mkdir dir5
13530             mkdir dir5/sdir
13531             dotest_fail co-d-5r "$testcvs -q co -d dir5/sdir $module" \
13532 "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir5': No such file or directory"
13533           else
13534             mkdir dir4
13535             dotest co-d-4 "$testcvs -q co -d dir4/sdir $module" \
13536 "U dir4/sdir/file1
13537 U dir4/sdir/file2"
13538             # CVS only creates administration directories for directories it
13539             # creates, and the last portion of the path passed to -d
13540             # regardless.
13541             dotest_fail co-d-4.2 "test -d dir4/CVS"
13542             dotest co-d-4.3 "cat dir4/sdir/CVS/Repository" "$module"
13543
13544             mkdir dir5
13545             mkdir dir5/sdir
13546             dotest co-d-5 "$testcvs -q co -d dir5/sdir $module" \
13547 "U dir5/sdir/file1
13548 U dir5/sdir/file2"
13549             # CVS only creates administration directories for directories it
13550             # creates, and the last portion of the path passed to -d
13551             # regardless.
13552             dotest_fail co-d-5.2 "test -d dir5/CVS"
13553             dotest co-d-5.3 "cat dir5/sdir/CVS/Repository" "$module"
13554           fi
13555
13556           # clean up
13557           if $keep; then
13558             echo Keeping ${TESTDIR} and exiting due to --keep
13559             exit 0
13560           fi
13561
13562           cd ../..
13563           rm -rf $CVSROOT_DIRNAME/$module
13564           rm -r $module
13565           ;;
13566
13567         cvsadm)
13568           # These test check the content of CVS' administrative
13569           # files as they are checked out in various configurations.
13570           # (As a side note, I'm not using the "-q" flag in any of
13571           # this code, which should provide some extra checking for
13572           # those messages which don't seem to be checked thoroughly
13573           # anywhere else.)  To do a thorough test, we need to make
13574           # a bunch of modules in various configurations.
13575           #
13576           # <1mod> is a directory at the top level of cvsroot
13577           #    ``foo bar''
13578           # <2mod> is a directory at the second level of cvsroot
13579           #    ``foo bar/baz''
13580           # <1d1mod> is a directory at the top level which is
13581           #   checked out into another directory
13582           #     ``foo -d bar baz''
13583           # <1d2mod> is a directory at the second level which is
13584           #   checked out into another directory
13585           #     ``foo -d bar baz/quux''
13586           # <2d1mod> is a directory at the top level which is
13587           #   checked out into a directory that is two deep
13588           #     ``foo -d bar/baz quux''
13589           # <2d2mod> is a directory at the second level which is
13590           #   checked out into a directory that is two deep
13591           #     ``foo -d bar/baz quux''
13592           #
13593           # The tests do each of these types separately and in twos.
13594           # We also repeat each test -d flag for 1-deep and 2-deep
13595           # directories.
13596           #
13597           # Each test should check the output for the Repository
13598           # file, since that is the one which varies depending on 
13599           # the directory and how it was checked out.
13600           #
13601           # Yes, this is verbose, but at least it's very thorough.
13602
13603           # convenience variables
13604           REP=${CVSROOT}
13605
13606           # First, set TopLevelAdmin=yes so we're sure to get
13607           # top-level CVS directories.
13608           mkdir 1; cd 1
13609           dotest cvsadm-setup-1 "${testcvs} -q co CVSROOT/config" \
13610 "U CVSROOT/config"
13611           cd CVSROOT
13612           echo "TopLevelAdmin=yes" >config
13613           dotest cvsadm-setup-2 "${testcvs} -q ci -m yes-top-level" \
13614 "Checking in config;
13615 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
13616 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13617 done
13618 ${PROG} commit: Rebuilding administrative file database"
13619           cd ../..
13620           rm -r 1
13621
13622           # Second, check out the modules file and edit it.
13623           mkdir 1; cd 1
13624           dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
13625 "U CVSROOT/modules"
13626
13627           # Test CVS/Root once.  Since there is only one part of
13628           # the code which writes CVS/Root files (Create_Admin),
13629           # there is no point in testing this every time.
13630           dotest cvsadm-1a "cat CVS/Root" ${REP}
13631           dotest cvsadm-1b "cat CVS/Repository" "\."
13632           dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
13633           dotest cvsadm-1d "cat CVSROOT/CVS/Repository" "CVSROOT"
13634           # All of the defined module names begin with a number.
13635           # All of the top-level directory names begin with "dir".
13636           # All of the subdirectory names begin with "sub".
13637           # All of the top-level modules begin with "mod".
13638           echo "# Module defs for cvsadm tests" > CVSROOT/modules
13639           echo "1mod mod1" >> CVSROOT/modules
13640           echo "1mod-2 mod1-2" >> CVSROOT/modules
13641           echo "2mod mod2/sub2" >> CVSROOT/modules
13642           echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
13643           echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
13644           echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
13645           echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
13646           echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
13647           echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
13648           echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
13649           echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
13650           echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
13651           dotest cvsadm-1e "${testcvs} ci -m add-modules" \
13652 "${PROG} [a-z]*: Examining .
13653 ${PROG} [a-z]*: Examining CVSROOT
13654 Checking in CVSROOT/modules;
13655 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
13656 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13657 done
13658 ${PROG} commit: Rebuilding administrative file database" \
13659 "${PROG} commit: Examining .
13660 ${PROG} commit: Examining CVSROOT"
13661           rm -rf CVS CVSROOT;
13662
13663           # Create the various modules
13664           dotest cvsadm-2 "${testcvs} -q co -l ." ''
13665           mkdir mod1
13666           mkdir mod1-2
13667           mkdir mod2
13668           mkdir mod2/sub2
13669           mkdir mod2-2
13670           mkdir mod2-2/sub2-2
13671           dotest cvsadm-2a "${testcvs} add mod1 mod1-2 mod2 mod2/sub2 mod2-2 mod2-2/sub2-2" \
13672 "Directory ${CVSROOT_DIRNAME}/mod1 added to the repository
13673 Directory ${CVSROOT_DIRNAME}/mod1-2 added to the repository
13674 Directory ${CVSROOT_DIRNAME}/mod2 added to the repository
13675 Directory ${CVSROOT_DIRNAME}/mod2/sub2 added to the repository
13676 Directory ${CVSROOT_DIRNAME}/mod2-2 added to the repository
13677 Directory ${CVSROOT_DIRNAME}/mod2-2/sub2-2 added to the repository"
13678
13679           # Populate the directories for the halibut
13680           echo "file1" > mod1/file1
13681           echo "file1-2" > mod1-2/file1-2
13682           echo "file2" > mod2/sub2/file2
13683           echo "file2-2" > mod2-2/sub2-2/file2-2
13684           dotest cvsadm-2aa "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
13685 "${PROG} add: scheduling file .mod1/file1. for addition
13686 ${PROG} add: scheduling file .mod1-2/file1-2. for addition
13687 ${PROG} add: scheduling file .mod2/sub2/file2. for addition
13688 ${PROG} add: scheduling file .mod2-2/sub2-2/file2-2. for addition
13689 ${PROG} add: use .${PROG} commit. to add these files permanently"
13690
13691           dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
13692 "${PROG} [a-z]*: Examining mod1
13693 ${PROG} [a-z]*: Examining mod1-2
13694 ${PROG} [a-z]*: Examining mod2
13695 ${PROG} [a-z]*: Examining mod2/sub2
13696 ${PROG} [a-z]*: Examining mod2-2
13697 ${PROG} [a-z]*: Examining mod2-2/sub2-2
13698 RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
13699 done
13700 Checking in mod1/file1;
13701 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
13702 initial revision: 1.1
13703 done
13704 RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
13705 done
13706 Checking in mod1-2/file1-2;
13707 ${CVSROOT_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
13708 initial revision: 1.1
13709 done
13710 RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
13711 done
13712 Checking in mod2/sub2/file2;
13713 ${CVSROOT_DIRNAME}/mod2/sub2/file2,v  <--  file2
13714 initial revision: 1.1
13715 done
13716 RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
13717 done
13718 Checking in mod2-2/sub2-2/file2-2;
13719 ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v  <--  file2-2
13720 initial revision: 1.1
13721 done"
13722           # Finished creating the modules -- clean up.
13723           rm -rf CVS mod1 mod1-2 mod2 mod2-2
13724           # Done.
13725
13726           ##################################################
13727           ## Start the dizzying array of possibilities.
13728           ## Begin with each module type separately.
13729           ##################################################
13730           
13731           # Pattern -- after each checkout, first check the top-level
13732           # CVS directory.  Then, check the directories in numerical
13733           # order.
13734
13735           dotest cvsadm-3 "${testcvs} co 1mod" \
13736 "${PROG} checkout: Updating 1mod
13737 U 1mod/file1"
13738           dotest cvsadm-3b "cat CVS/Repository" "\."
13739           dotest cvsadm-3d "cat 1mod/CVS/Repository" "mod1"
13740           rm -rf CVS 1mod
13741
13742           dotest cvsadm-4 "${testcvs} co 2mod" \
13743 "${PROG} checkout: Updating 2mod
13744 U 2mod/file2"
13745           dotest cvsadm-4b "cat CVS/Repository" "\."
13746           dotest cvsadm-4d "cat 2mod/CVS/Repository" "mod2/sub2"
13747           rm -rf CVS 2mod
13748
13749           dotest cvsadm-5 "${testcvs} co 1d1mod" \
13750 "${PROG} checkout: Updating dir1d1
13751 U dir1d1/file1"
13752           dotest cvsadm-5b "cat CVS/Repository" "\."
13753           dotest cvsadm-5d "cat dir1d1/CVS/Repository" "mod1"
13754           rm -rf CVS dir1d1
13755
13756           dotest cvsadm-6 "${testcvs} co 1d2mod" \
13757 "${PROG} checkout: Updating dir1d2
13758 U dir1d2/file2"
13759           dotest cvsadm-6b "cat CVS/Repository" "\."
13760           dotest cvsadm-6d "cat dir1d2/CVS/Repository" "mod2/sub2"
13761           rm -rf CVS dir1d2
13762
13763           dotest cvsadm-7 "${testcvs} co 2d1mod" \
13764 "${PROG} checkout: Updating dir2d1/sub2d1
13765 U dir2d1/sub2d1/file1"
13766           dotest cvsadm-7b "cat CVS/Repository" "\."
13767           dotest cvsadm-7d "cat dir2d1/CVS/Repository" "\."
13768           dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
13769           rm -rf CVS dir2d1
13770
13771           dotest cvsadm-8 "${testcvs} co 2d2mod" \
13772 "${PROG} checkout: Updating dir2d2/sub2d2
13773 U dir2d2/sub2d2/file2"
13774           dotest cvsadm-8b "cat CVS/Repository" "\."
13775           dotest cvsadm-8d "cat dir2d2/CVS/Repository" "mod2"
13776           dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13777           rm -rf CVS dir2d2
13778
13779           ##################################################
13780           ## You are in a shell script of twisted little
13781           ## module combination statements, all alike.
13782           ##################################################
13783
13784           ### 1mod
13785           
13786           dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
13787 "${PROG} checkout: Updating 1mod
13788 U 1mod/file1
13789 ${PROG} checkout: Updating 1mod-2
13790 U 1mod-2/file1-2"
13791           # the usual for the top level
13792           dotest cvsadm-9b "cat CVS/Repository" "\."
13793           # the usual for 1mod
13794           dotest cvsadm-9d "cat 1mod/CVS/Repository" "mod1"
13795           # the usual for 1mod copy
13796           dotest cvsadm-9f "cat 1mod-2/CVS/Repository" "mod1-2"
13797           rm -rf CVS 1mod 1mod-2
13798
13799           # 1mod 2mod redmod bluemod
13800           dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
13801 "${PROG} checkout: Updating 1mod
13802 U 1mod/file1
13803 ${PROG} checkout: Updating 2mod
13804 U 2mod/file2"
13805           # the usual for the top level
13806           dotest cvsadm-10b "cat CVS/Repository" "\."
13807           # the usual for 1mod
13808           dotest cvsadm-10d "cat 1mod/CVS/Repository" "mod1"
13809           # the usual for 2dmod
13810           dotest cvsadm-10f "cat 2mod/CVS/Repository" "mod2/sub2"
13811           rm -rf CVS 1mod 2mod
13812
13813           dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
13814 "${PROG} checkout: Updating 1mod
13815 U 1mod/file1
13816 ${PROG} checkout: Updating dir1d1
13817 U dir1d1/file1"
13818           # the usual for the top level
13819           dotest cvsadm-11b "cat CVS/Repository" "\."
13820           # the usual for 1mod
13821           dotest cvsadm-11d "cat 1mod/CVS/Repository" "mod1"
13822           # the usual for 1d1mod
13823           dotest cvsadm-11f "cat dir1d1/CVS/Repository" "mod1"
13824           rm -rf CVS 1mod dir1d1
13825
13826           dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
13827 "${PROG} checkout: Updating 1mod
13828 U 1mod/file1
13829 ${PROG} checkout: Updating dir1d2
13830 U dir1d2/file2"
13831           # the usual for the top level
13832           dotest cvsadm-12b "cat CVS/Repository" "\."
13833           # the usual for 1mod
13834           dotest cvsadm-12d "cat 1mod/CVS/Repository" "mod1"
13835           # the usual for 1d2mod
13836           dotest cvsadm-12f "cat dir1d2/CVS/Repository" "mod2/sub2"
13837           rm -rf CVS 1mod dir1d2
13838
13839           dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
13840 "${PROG} checkout: Updating 1mod
13841 U 1mod/file1
13842 ${PROG} checkout: Updating dir2d1/sub2d1
13843 U dir2d1/sub2d1/file1"
13844           # the usual for the top level
13845           dotest cvsadm-13b "cat CVS/Repository" "\."
13846           # the usual for 1mod
13847           dotest cvsadm-13d "cat 1mod/CVS/Repository" "mod1"
13848           # the usual for 2d1mod
13849           dotest cvsadm-13f "cat dir2d1/CVS/Repository" "\."
13850           dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
13851           rm -rf CVS 1mod dir2d1
13852
13853           dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
13854 "${PROG} checkout: Updating 1mod
13855 U 1mod/file1
13856 ${PROG} checkout: Updating dir2d2/sub2d2
13857 U dir2d2/sub2d2/file2"
13858           # the usual for the top level
13859           dotest cvsadm-14b "cat CVS/Repository" "\."
13860           # the usual for 1mod
13861           dotest cvsadm-14d "cat 1mod/CVS/Repository" "mod1"
13862           # the usual for 2d2mod
13863           dotest cvsadm-14f "cat dir2d2/CVS/Repository" "mod2"
13864           dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13865           rm -rf CVS 1mod dir2d2
13866
13867
13868           ### 2mod
13869           
13870           dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
13871 "${PROG} checkout: Updating 2mod
13872 U 2mod/file2
13873 ${PROG} checkout: Updating 2mod-2
13874 U 2mod-2/file2-2"
13875           # the usual for the top level
13876           dotest cvsadm-15b "cat CVS/Repository" "\."
13877           # the usual for 2mod
13878           dotest cvsadm-15d "cat 2mod/CVS/Repository" "mod2/sub2"
13879           # the usual for 2mod copy
13880           dotest cvsadm-15f "cat 2mod-2/CVS/Repository" "mod2-2/sub2-2"
13881           rm -rf CVS 2mod 2mod-2
13882
13883
13884           dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
13885 "${PROG} checkout: Updating 2mod
13886 U 2mod/file2
13887 ${PROG} checkout: Updating dir1d1
13888 U dir1d1/file1"
13889           # the usual for the top level
13890           dotest cvsadm-16b "cat CVS/Repository" "\."
13891           # the usual for 2mod
13892           dotest cvsadm-16d "cat 2mod/CVS/Repository" "mod2/sub2"
13893           # the usual for 1d1mod
13894           dotest cvsadm-16f "cat dir1d1/CVS/Repository" "mod1"
13895           rm -rf CVS 2mod dir1d1
13896
13897           dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
13898 "${PROG} checkout: Updating 2mod
13899 U 2mod/file2
13900 ${PROG} checkout: Updating dir1d2
13901 U dir1d2/file2"
13902           # the usual for the top level
13903           dotest cvsadm-17b "cat CVS/Repository" "\."
13904           # the usual for 2mod
13905           dotest cvsadm-17d "cat 2mod/CVS/Repository" "mod2/sub2"
13906           # the usual for 1d2mod
13907           dotest cvsadm-17f "cat dir1d2/CVS/Repository" "mod2/sub2"
13908           rm -rf CVS 2mod dir1d2
13909
13910           dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
13911 "${PROG} checkout: Updating 2mod
13912 U 2mod/file2
13913 ${PROG} checkout: Updating dir2d1/sub2d1
13914 U dir2d1/sub2d1/file1"
13915           # the usual for the top level
13916           dotest cvsadm-18b "cat CVS/Repository" "\."
13917           # the usual for 2mod
13918           dotest cvsadm-18d "cat 2mod/CVS/Repository" "mod2/sub2"
13919           # the usual for 2d1mod
13920           dotest cvsadm-18f "cat dir2d1/CVS/Repository" "\."
13921           dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
13922           rm -rf CVS 2mod dir2d1
13923
13924           dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
13925 "${PROG} checkout: Updating 2mod
13926 U 2mod/file2
13927 ${PROG} checkout: Updating dir2d2/sub2d2
13928 U dir2d2/sub2d2/file2"
13929           # the usual for the top level
13930           dotest cvsadm-19b "cat CVS/Repository" "\."
13931           # the usual for 2mod
13932           dotest cvsadm-19d "cat 2mod/CVS/Repository" "mod2/sub2"
13933           # the usual for 2d2mod
13934           dotest cvsadm-19f "cat dir2d2/CVS/Repository" "mod2"
13935           dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13936           rm -rf CVS 2mod dir2d2
13937
13938
13939           ### 1d1mod
13940
13941           dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
13942 "${PROG} checkout: Updating dir1d1
13943 U dir1d1/file1
13944 ${PROG} checkout: Updating dir1d1-2
13945 U dir1d1-2/file1-2"
13946           # the usual for the top level
13947           dotest cvsadm-20b "cat CVS/Repository" "\."
13948           # the usual for 1d1mod
13949           dotest cvsadm-20d "cat dir1d1/CVS/Repository" "mod1"
13950           # the usual for 1d1mod copy
13951           dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" "mod1-2"
13952           rm -rf CVS dir1d1 dir1d1-2
13953
13954           dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
13955 "${PROG} checkout: Updating dir1d1
13956 U dir1d1/file1
13957 ${PROG} checkout: Updating dir1d2
13958 U dir1d2/file2"
13959           # the usual for the top level
13960           dotest cvsadm-21b "cat CVS/Repository" "\."
13961           # the usual for 1d1mod
13962           dotest cvsadm-21d "cat dir1d1/CVS/Repository" "mod1"
13963           # the usual for 1d2mod
13964           dotest cvsadm-21f "cat dir1d2/CVS/Repository" "mod2/sub2"
13965           rm -rf CVS dir1d1 dir1d2
13966
13967           dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
13968 "${PROG} checkout: Updating dir1d1
13969 U dir1d1/file1
13970 ${PROG} checkout: Updating dir2d1/sub2d1
13971 U dir2d1/sub2d1/file1"
13972           # the usual for the top level
13973           dotest cvsadm-22b "cat CVS/Repository" "\."
13974           # the usual for 1d1mod
13975           dotest cvsadm-22d "cat dir1d1/CVS/Repository" "mod1"
13976           # the usual for 2d1mod
13977           dotest cvsadm-22f "cat dir2d1/CVS/Repository" "\."
13978           dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
13979           rm -rf CVS dir1d1 dir2d1
13980
13981           dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
13982 "${PROG} checkout: Updating dir1d1
13983 U dir1d1/file1
13984 ${PROG} checkout: Updating dir2d2/sub2d2
13985 U dir2d2/sub2d2/file2"
13986           # the usual for the top level
13987           dotest cvsadm-23b "cat CVS/Repository" "\."
13988           # the usual for 1d1mod
13989           dotest cvsadm-23d "cat dir1d1/CVS/Repository" "mod1"
13990           # the usual for 2d2mod
13991           dotest cvsadm-23f "cat dir2d2/CVS/Repository" "mod2"
13992           dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
13993           rm -rf CVS dir1d1 dir2d2
13994
13995
13996           ### 1d2mod
13997
13998           dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
13999 "${PROG} checkout: Updating dir1d2
14000 U dir1d2/file2
14001 ${PROG} checkout: Updating dir1d2-2
14002 U dir1d2-2/file2-2"
14003           # the usual for the top level
14004           dotest cvsadm-24b "cat CVS/Repository" "\."
14005           # the usual for 1d2mod
14006           dotest cvsadm-24d "cat dir1d2/CVS/Repository" "mod2/sub2"
14007           # the usual for 1d2mod copy
14008           dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
14009           rm -rf CVS dir1d2 dir1d2-2
14010
14011           dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
14012 "${PROG} checkout: Updating dir1d2
14013 U dir1d2/file2
14014 ${PROG} checkout: Updating dir2d1/sub2d1
14015 U dir2d1/sub2d1/file1"
14016           # the usual for the top level
14017           dotest cvsadm-25b "cat CVS/Repository" "\."
14018           # the usual for 1d2mod
14019           dotest cvsadm-25d "cat dir1d2/CVS/Repository" "mod2/sub2"
14020           # the usual for 2d1mod
14021           dotest cvsadm-25f "cat dir2d1/CVS/Repository" "\."
14022           dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
14023           rm -rf CVS dir1d2 dir2d1
14024
14025           dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
14026 "${PROG} checkout: Updating dir1d2
14027 U dir1d2/file2
14028 ${PROG} checkout: Updating dir2d2/sub2d2
14029 U dir2d2/sub2d2/file2"
14030           # the usual for the top level
14031           dotest cvsadm-26b "cat CVS/Repository" "\."
14032           # the usual for 1d2mod
14033           dotest cvsadm-26d "cat dir1d2/CVS/Repository" "mod2/sub2"
14034           # the usual for 2d2mod
14035           dotest cvsadm-26f "cat dir2d2/CVS/Repository" "mod2"
14036           dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14037           rm -rf CVS dir1d2 dir2d2
14038
14039
14040           # 2d1mod
14041
14042           dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
14043 "${PROG} checkout: Updating dir2d1/sub2d1
14044 U dir2d1/sub2d1/file1
14045 ${PROG} checkout: Updating dir2d1-2/sub2d1-2
14046 U dir2d1-2/sub2d1-2/file1-2"
14047           # the usual for the top level
14048           dotest cvsadm-27b "cat CVS/Repository" "\."
14049           # the usual for 2d1mod
14050           dotest cvsadm-27d "cat dir2d1/CVS/Repository" "\."
14051           dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
14052           # the usual for 2d1mod
14053           dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" "\."
14054           dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" "mod1-2"
14055           rm -rf CVS dir2d1 dir2d1-2
14056
14057           dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
14058 "${PROG} checkout: Updating dir2d1/sub2d1
14059 U dir2d1/sub2d1/file1
14060 ${PROG} checkout: Updating dir2d2/sub2d2
14061 U dir2d2/sub2d2/file2"
14062           # the usual for the top level
14063           dotest cvsadm-28b "cat CVS/Repository" "\."
14064           # the usual for 2d1mod
14065           dotest cvsadm-28d "cat dir2d1/CVS/Repository" "\."
14066           dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
14067           # the usual for 2d2mod
14068           dotest cvsadm-28h "cat dir2d2/CVS/Repository" "mod2"
14069           dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14070           rm -rf CVS dir2d1 dir2d2
14071
14072           
14073           # 2d2mod
14074
14075           dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
14076 "${PROG} checkout: Updating dir2d2/sub2d2
14077 U dir2d2/sub2d2/file2
14078 ${PROG} checkout: Updating dir2d2-2/sub2d2-2
14079 U dir2d2-2/sub2d2-2/file2-2"
14080           # the usual for the top level
14081           dotest cvsadm-29b "cat CVS/Repository" "\."
14082           # the usual for 2d2mod
14083           dotest cvsadm-29d "cat dir2d2/CVS/Repository" "mod2"
14084           dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14085           # the usual for 2d2mod
14086           dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" "mod2-2"
14087           dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
14088 "mod2-2/sub2-2"
14089           rm -rf CVS dir2d2 dir2d2-2
14090
14091           ##################################################
14092           ## And now, all of that again using the "-d" flag
14093           ## on the command line.
14094           ##################################################
14095
14096           dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
14097 "${PROG} checkout: Updating dir
14098 U dir/file1"
14099           dotest cvsadm-1d3b "cat CVS/Repository" "\."
14100           dotest cvsadm-1d3d "cat dir/CVS/Repository" "mod1"
14101           rm -rf CVS dir
14102
14103           dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
14104 "${PROG} checkout: Updating dir
14105 U dir/file2"
14106           dotest cvsadm-1d4b "cat CVS/Repository" "\."
14107           dotest cvsadm-1d4d "cat dir/CVS/Repository" "mod2/sub2"
14108           rm -rf CVS dir
14109
14110           dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
14111 "${PROG} checkout: Updating dir
14112 U dir/file1"
14113           dotest cvsadm-1d5b "cat CVS/Repository" "\."
14114           dotest cvsadm-1d5d "cat dir/CVS/Repository" "mod1"
14115           rm -rf CVS dir
14116
14117           dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
14118 "${PROG} checkout: Updating dir
14119 U dir/file2"
14120           dotest cvsadm-1d6b "cat CVS/Repository" "\."
14121           dotest cvsadm-1d6d "cat dir/CVS/Repository" "mod2/sub2"
14122           rm -rf CVS dir
14123
14124           dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
14125 "${PROG} checkout: Updating dir
14126 U dir/file1"
14127           dotest cvsadm-1d7b "cat CVS/Repository" "\."
14128           dotest cvsadm-1d7d "cat dir/CVS/Repository" "mod1"
14129           rm -rf CVS dir
14130
14131           dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
14132 "${PROG} checkout: Updating dir
14133 U dir/file2"
14134           dotest cvsadm-1d8b "cat CVS/Repository" "\."
14135           dotest cvsadm-1d8d "cat dir/CVS/Repository" "mod2/sub2"
14136           rm -rf CVS dir
14137
14138           ##################################################
14139           ## Los Combonaciones
14140           ##################################################
14141
14142           ### 1mod
14143
14144           dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
14145 "${PROG} checkout: Updating dir/1mod
14146 U dir/1mod/file1
14147 ${PROG} checkout: Updating dir/1mod-2
14148 U dir/1mod-2/file1-2"
14149           # the usual for the top level
14150           dotest cvsadm-1d9b "cat CVS/Repository" "\."
14151           # the usual for the dir level
14152           dotest cvsadm-1d9d "cat dir/CVS/Repository" "\."
14153           # the usual for 1mod
14154           dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" "mod1"
14155           # the usual for 1mod copy
14156           dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" "mod1-2"
14157           rm -rf CVS dir
14158
14159           # 1mod 2mod redmod bluemod
14160           dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
14161 "${PROG} checkout: Updating dir/1mod
14162 U dir/1mod/file1
14163 ${PROG} checkout: Updating dir/2mod
14164 U dir/2mod/file2"
14165           dotest cvsadm-1d10b "cat CVS/Repository" "\."
14166           # the usual for the dir level
14167           dotest cvsadm-1d10d "cat dir/CVS/Repository" "\."
14168           # the usual for 1mod
14169           dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" "mod1"
14170           # the usual for 2dmod
14171           dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" "mod2/sub2"
14172           rm -rf CVS dir
14173
14174           dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
14175 "${PROG} checkout: Updating dir/1mod
14176 U dir/1mod/file1
14177 ${PROG} checkout: Updating dir/dir1d1
14178 U dir/dir1d1/file1"
14179           dotest cvsadm-1d11b "cat CVS/Repository" "\."
14180           # the usual for the dir level
14181           dotest cvsadm-1d11d "cat dir/CVS/Repository" "\."
14182           # the usual for 1mod
14183           dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" "mod1"
14184           # the usual for 1d1mod
14185           dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" "mod1"
14186           rm -rf CVS dir
14187
14188           dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
14189 "${PROG} checkout: Updating dir/1mod
14190 U dir/1mod/file1
14191 ${PROG} checkout: Updating dir/dir1d2
14192 U dir/dir1d2/file2"
14193           dotest cvsadm-1d12b "cat CVS/Repository" "\."
14194           # the usual for the dir level
14195           dotest cvsadm-1d12d "cat dir/CVS/Repository" "\."
14196           # the usual for 1mod
14197           dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" "mod1"
14198           # the usual for 1d2mod
14199           dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14200           rm -rf CVS dir
14201
14202           dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
14203 "${PROG} checkout: Updating dir/1mod
14204 U dir/1mod/file1
14205 ${PROG} checkout: Updating dir/dir2d1/sub2d1
14206 U dir/dir2d1/sub2d1/file1"
14207           dotest cvsadm-1d13b "cat CVS/Repository" "\."
14208           # the usual for the dir level
14209           dotest cvsadm-1d13d "cat dir/CVS/Repository" "\."
14210           # the usual for 1mod
14211           dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" "mod1"
14212           # the usual for 2d1mod
14213           dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" "\."
14214           dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14215           rm -rf CVS dir
14216
14217           dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
14218 "${PROG} checkout: Updating dir/1mod
14219 U dir/1mod/file1
14220 ${PROG} checkout: Updating dir/dir2d2/sub2d2
14221 U dir/dir2d2/sub2d2/file2"
14222           dotest cvsadm-1d14b "cat CVS/Repository" "\."
14223           # the usual for the dir level
14224           dotest cvsadm-1d14d "cat dir/CVS/Repository" "\."
14225           # the usual for 1mod
14226           dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" "mod1"
14227           # the usual for 2d2mod
14228           dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" "mod2"
14229           dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14230           rm -rf CVS dir
14231
14232
14233           ### 2mod
14234
14235           dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
14236 "${PROG} checkout: Updating dir/2mod
14237 U dir/2mod/file2
14238 ${PROG} checkout: Updating dir/2mod-2
14239 U dir/2mod-2/file2-2"
14240           dotest cvsadm-1d15b "cat CVS/Repository" "\."
14241           # the usual for the dir level
14242           dotest cvsadm-1d15d "cat dir/CVS/Repository" "mod2"
14243           # the usual for 2mod
14244           dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14245           # the usual for 2mod copy
14246           dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" "mod2-2/sub2-2"
14247           rm -rf CVS dir
14248
14249           dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
14250 "${PROG} checkout: Updating dir/2mod
14251 U dir/2mod/file2
14252 ${PROG} checkout: Updating dir/dir1d1
14253 U dir/dir1d1/file1"
14254           dotest cvsadm-1d16b "cat CVS/Repository" "\."
14255           # the usual for the dir level
14256           dotest cvsadm-1d16d "cat dir/CVS/Repository" "mod2"
14257           # the usual for 2mod
14258           dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14259           # the usual for 1d1mod
14260           dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" "mod1"
14261           rm -rf CVS dir
14262
14263           dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
14264 "${PROG} checkout: Updating dir/2mod
14265 U dir/2mod/file2
14266 ${PROG} checkout: Updating dir/dir1d2
14267 U dir/dir1d2/file2"
14268           dotest cvsadm-1d17b "cat CVS/Repository" "\."
14269           # the usual for the dir level
14270           dotest cvsadm-1d17d "cat dir/CVS/Repository" "mod2"
14271           # the usual for 2mod
14272           dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14273           # the usual for 1d2mod
14274           dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14275           rm -rf CVS dir
14276
14277           dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
14278 "${PROG} checkout: Updating dir/2mod
14279 U dir/2mod/file2
14280 ${PROG} checkout: Updating dir/dir2d1/sub2d1
14281 U dir/dir2d1/sub2d1/file1"
14282           dotest cvsadm-1d18b "cat CVS/Repository" "\."
14283           # the usual for the dir level
14284           dotest cvsadm-1d18d "cat dir/CVS/Repository" "mod2"
14285           # the usual for 2mod
14286           dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14287           # the usual for 2d1mod
14288           dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" "\."
14289           dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14290           rm -rf CVS dir
14291
14292           dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
14293 "${PROG} checkout: Updating dir/2mod
14294 U dir/2mod/file2
14295 ${PROG} checkout: Updating dir/dir2d2/sub2d2
14296 U dir/dir2d2/sub2d2/file2"
14297           dotest cvsadm-1d19b "cat CVS/Repository" "\."
14298           # the usual for the dir level
14299           dotest cvsadm-1d19d "cat dir/CVS/Repository" "mod2"
14300           # the usual for 2mod
14301           dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14302           # the usual for 2d2mod
14303           dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" "mod2"
14304           dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14305           rm -rf CVS dir
14306
14307
14308           ### 1d1mod
14309
14310           dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
14311 "${PROG} checkout: Updating dir/dir1d1
14312 U dir/dir1d1/file1
14313 ${PROG} checkout: Updating dir/dir1d1-2
14314 U dir/dir1d1-2/file1-2"
14315           dotest cvsadm-1d20b "cat CVS/Repository" "\."
14316           # the usual for the dir level
14317           dotest cvsadm-1d20d "cat dir/CVS/Repository" "\."
14318           # the usual for 1d1mod
14319           dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" "mod1"
14320           # the usual for 1d1mod copy
14321           dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" "mod1-2"
14322           rm -rf CVS dir
14323
14324           dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
14325 "${PROG} checkout: Updating dir/dir1d1
14326 U dir/dir1d1/file1
14327 ${PROG} checkout: Updating dir/dir1d2
14328 U dir/dir1d2/file2"
14329           dotest cvsadm-1d21b "cat CVS/Repository" "\."
14330           # the usual for the dir level
14331           dotest cvsadm-1d21d "cat dir/CVS/Repository" "\."
14332           # the usual for 1d1mod
14333           dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" "mod1"
14334           # the usual for 1d2mod
14335           dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14336           rm -rf CVS dir
14337
14338           dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
14339 "${PROG} checkout: Updating dir/dir1d1
14340 U dir/dir1d1/file1
14341 ${PROG} checkout: Updating dir/dir2d1/sub2d1
14342 U dir/dir2d1/sub2d1/file1"
14343           dotest cvsadm-1d22b "cat CVS/Repository" "\."
14344           # the usual for the dir level
14345           dotest cvsadm-1d22d "cat dir/CVS/Repository" "\."
14346           # the usual for 1d1mod
14347           dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" "mod1"
14348           # the usual for 2d1mod
14349           dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" "\."
14350           dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14351           rm -rf CVS dir
14352
14353           dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
14354 "${PROG} checkout: Updating dir/dir1d1
14355 U dir/dir1d1/file1
14356 ${PROG} checkout: Updating dir/dir2d2/sub2d2
14357 U dir/dir2d2/sub2d2/file2"
14358           dotest cvsadm-1d23b "cat CVS/Repository" "\."
14359           # the usual for the dir level
14360           dotest cvsadm-1d23d "cat dir/CVS/Repository" "\."
14361           # the usual for 1d1mod
14362           dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" "mod1"
14363           # the usual for 2d2mod
14364           dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" "mod2"
14365           dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14366           rm -rf CVS dir
14367
14368
14369           ### 1d2mod
14370
14371           dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
14372 "${PROG} checkout: Updating dir/dir1d2
14373 U dir/dir1d2/file2
14374 ${PROG} checkout: Updating dir/dir1d2-2
14375 U dir/dir1d2-2/file2-2"
14376           dotest cvsadm-1d24b "cat CVS/Repository" "\."
14377           # the usual for the dir level
14378           dotest cvsadm-1d24d "cat dir/CVS/Repository" "mod2"
14379           # the usual for 1d2mod
14380           dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14381           # the usual for 1d2mod copy
14382           dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
14383           rm -rf CVS dir
14384
14385           dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
14386 "${PROG} checkout: Updating dir/dir1d2
14387 U dir/dir1d2/file2
14388 ${PROG} checkout: Updating dir/dir2d1/sub2d1
14389 U dir/dir2d1/sub2d1/file1"
14390           dotest cvsadm-1d25b "cat CVS/Repository" "\."
14391           # the usual for the dir level
14392           dotest cvsadm-1d25d "cat dir/CVS/Repository" "mod2"
14393           # the usual for 1d2mod
14394           dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14395           # the usual for 2d1mod
14396           dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" "\."
14397           dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14398           rm -rf CVS dir
14399
14400           dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
14401 "${PROG} checkout: Updating dir/dir1d2
14402 U dir/dir1d2/file2
14403 ${PROG} checkout: Updating dir/dir2d2/sub2d2
14404 U dir/dir2d2/sub2d2/file2"
14405           dotest cvsadm-1d26b "cat CVS/Repository" "\."
14406           # the usual for the dir level
14407           dotest cvsadm-1d26d "cat dir/CVS/Repository" "mod2"
14408           # the usual for 1d2mod
14409           dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14410           # the usual for 2d2mod
14411           dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" "mod2"
14412           dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14413           rm -rf CVS dir
14414
14415
14416           # 2d1mod
14417
14418           dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
14419 "${PROG} checkout: Updating dir/dir2d1/sub2d1
14420 U dir/dir2d1/sub2d1/file1
14421 ${PROG} checkout: Updating dir/dir2d1-2/sub2d1-2
14422 U dir/dir2d1-2/sub2d1-2/file1-2"
14423           dotest cvsadm-1d27b "cat CVS/Repository" "\."
14424           # the usual for the dir level
14425           dotest cvsadm-1d27d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
14426           # the usual for 2d1mod
14427           dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" "\."
14428           dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14429           # the usual for 2d1mod
14430           dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" "\."
14431           dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
14432 "mod1-2"
14433           rm -rf CVS dir
14434
14435           dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
14436 "${PROG} checkout: Updating dir/dir2d1/sub2d1
14437 U dir/dir2d1/sub2d1/file1
14438 ${PROG} checkout: Updating dir/dir2d2/sub2d2
14439 U dir/dir2d2/sub2d2/file2"
14440           dotest cvsadm-1d28b "cat CVS/Repository" "\."
14441           # the usual for the dir level
14442           dotest cvsadm-1d28d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
14443           # the usual for 2d1mod
14444           dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" "\."
14445           dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14446           # the usual for 2d2mod
14447           dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" "mod2"
14448           dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14449           rm -rf CVS dir
14450
14451           
14452           # 2d2mod
14453
14454           dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
14455 "${PROG} checkout: Updating dir/dir2d2/sub2d2
14456 U dir/dir2d2/sub2d2/file2
14457 ${PROG} checkout: Updating dir/dir2d2-2/sub2d2-2
14458 U dir/dir2d2-2/sub2d2-2/file2-2"
14459           dotest cvsadm-1d29b "cat CVS/Repository" "\."
14460           # the usual for the dir level
14461           dotest cvsadm-1d29d "cat dir/CVS/Repository" "\."
14462           # the usual for 2d2mod
14463           dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" "mod2"
14464           dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14465           # the usual for 2d2mod
14466           dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" "mod2-2"
14467           dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
14468 "mod2-2/sub2-2"
14469           rm -rf CVS dir
14470
14471           ##################################################
14472           ## And now, some of that again using the "-d" flag
14473           ## on the command line, but use a longer path.
14474           ##################################################
14475
14476           dotest_fail cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
14477 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .dir.: No such file or directory"
14478
14479           if $remote; then :; else
14480             # Remote can't handle this, even with the "mkdir dir".
14481             # This was also true of CVS 1.9.
14482
14483             mkdir dir
14484             dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
14485 "${PROG} checkout: Updating dir/dir2
14486 U dir/dir2/file1"
14487             dotest cvsadm-2d3b "cat CVS/Repository" "\."
14488             dotest_fail cvsadm-2d3d "test -f dir/CVS/Repository" ""
14489             dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" "mod1"
14490             rm -rf CVS dir
14491
14492             mkdir dir
14493             dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
14494 "${PROG} checkout: Updating dir/dir2
14495 U dir/dir2/file2"
14496             dotest cvsadm-2d4b "cat CVS/Repository" "\."
14497             dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" "mod2/sub2"
14498             rm -rf CVS dir
14499
14500             mkdir dir
14501             dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
14502 "${PROG} checkout: Updating dir/dir2
14503 U dir/dir2/file1"
14504             dotest cvsadm-2d5b "cat CVS/Repository" "\."
14505             dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" "mod1"
14506             rm -rf CVS dir
14507
14508             mkdir dir
14509             dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
14510 "${PROG} checkout: Updating dir/dir2
14511 U dir/dir2/file2"
14512             dotest cvsadm-2d6b "cat CVS/Repository" "\."
14513             dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" "mod2/sub2"
14514             rm -rf CVS dir
14515
14516             mkdir dir
14517             dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
14518 "${PROG} checkout: Updating dir/dir2
14519 U dir/dir2/file1"
14520             dotest cvsadm-2d7b "cat CVS/Repository" "\."
14521             dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" "mod1"
14522             rm -rf CVS dir
14523
14524             mkdir dir
14525             dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
14526 "${PROG} checkout: Updating dir/dir2
14527 U dir/dir2/file2"
14528             dotest cvsadm-2d8b "cat CVS/Repository" "\."
14529             dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" "mod2/sub2"
14530             rm -rf CVS dir
14531
14532             ##################################################
14533             ## And now, a few of those tests revisited to
14534             ## test the behavior of the -N flag.
14535             ##################################################
14536
14537             dotest cvsadm-N3 "${testcvs} co -N 1mod" \
14538 "${PROG} checkout: Updating 1mod
14539 U 1mod/file1"
14540             dotest cvsadm-N3b "cat CVS/Repository" "\."
14541             dotest cvsadm-N3d "cat 1mod/CVS/Repository" "mod1"
14542             rm -rf CVS 1mod
14543
14544             dotest cvsadm-N4 "${testcvs} co -N 2mod" \
14545 "${PROG} checkout: Updating 2mod
14546 U 2mod/file2"
14547             dotest cvsadm-N4b "cat CVS/Repository" "\."
14548             dotest cvsadm-N4d "cat 2mod/CVS/Repository" "mod2/sub2"
14549             rm -rf CVS 2mod
14550
14551             dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
14552 "${PROG} checkout: Updating dir1d1
14553 U dir1d1/file1"
14554             dotest cvsadm-N5b "cat CVS/Repository" "\."
14555             dotest cvsadm-N5d "cat dir1d1/CVS/Repository" "mod1"
14556             rm -rf CVS dir1d1
14557
14558             dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
14559 "${PROG} checkout: Updating dir1d2
14560 U dir1d2/file2"
14561             dotest cvsadm-N6b "cat CVS/Repository" "\."
14562             dotest cvsadm-N6d "cat dir1d2/CVS/Repository" "mod2/sub2"
14563             rm -rf CVS dir1d2
14564
14565             dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
14566 "${PROG} checkout: Updating dir2d1/sub2d1
14567 U dir2d1/sub2d1/file1"
14568             dotest cvsadm-N7b "cat CVS/Repository" "\."
14569             dotest cvsadm-N7d "cat dir2d1/CVS/Repository" "\."
14570             dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
14571             rm -rf CVS dir2d1
14572
14573             dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
14574 "${PROG} checkout: Updating dir2d2/sub2d2
14575 U dir2d2/sub2d2/file2"
14576             dotest cvsadm-N8b "cat CVS/Repository" "\."
14577             dotest cvsadm-N8d "cat dir2d2/CVS/Repository" "mod2"
14578             dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
14579             rm -rf CVS dir2d2
14580
14581             ## the ones in one-deep directories
14582
14583             dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
14584 "${PROG} checkout: Updating dir/1mod
14585 U dir/1mod/file1"
14586             dotest cvsadm-N1d3b "cat CVS/Repository" "\."
14587             dotest cvsadm-N1d3d "cat dir/CVS/Repository" "\."
14588             dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" "mod1"
14589             rm -rf CVS dir
14590
14591             dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
14592 "${PROG} checkout: Updating dir/2mod
14593 U dir/2mod/file2"
14594             dotest cvsadm-N1d4b "cat CVS/Repository" "\."
14595             dotest cvsadm-N1d4d "cat dir/CVS/Repository" "mod2"
14596             dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" "mod2/sub2"
14597             rm -rf CVS dir
14598
14599             dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
14600 "${PROG} checkout: Updating dir/dir1d1
14601 U dir/dir1d1/file1"
14602             dotest cvsadm-N1d5b "cat CVS/Repository" "\."
14603             dotest cvsadm-N1d5d "cat dir/CVS/Repository" "\."
14604             dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" "mod1"
14605             rm -rf CVS dir
14606
14607             dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
14608 "${PROG} checkout: Updating dir/dir1d2
14609 U dir/dir1d2/file2"
14610             dotest cvsadm-N1d6b "cat CVS/Repository" "\."
14611             dotest cvsadm-N1d6d "cat dir/CVS/Repository" "mod2"
14612             dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
14613             rm -rf CVS dir
14614
14615             dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
14616 "${PROG} checkout: Updating dir/dir2d1/sub2d1
14617 U dir/dir2d1/sub2d1/file1"
14618             dotest cvsadm-N1d7b "cat CVS/Repository" "\."
14619             dotest cvsadm-N1d7d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
14620             dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" "\."
14621             dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
14622             rm -rf CVS dir
14623
14624             dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
14625 "${PROG} checkout: Updating dir/dir2d2/sub2d2
14626 U dir/dir2d2/sub2d2/file2"
14627             dotest cvsadm-N1d8b "cat CVS/Repository" "\."
14628             dotest cvsadm-N1d8d "cat dir/CVS/Repository" "\."
14629             dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" "mod2"
14630             dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
14631 "mod2/sub2"
14632             rm -rf CVS dir
14633
14634             ## the ones in two-deep directories
14635
14636             mkdir dir
14637             dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
14638 "${PROG} checkout: Updating dir/dir2/1mod
14639 U dir/dir2/1mod/file1"
14640             dotest cvsadm-N2d3b "cat CVS/Repository" "\."
14641             dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" "\."
14642             dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" "mod1"
14643             rm -rf CVS dir
14644
14645             mkdir dir
14646             dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
14647 "${PROG} checkout: Updating dir/dir2/2mod
14648 U dir/dir2/2mod/file2"
14649             dotest cvsadm-N2d4b "cat CVS/Repository" "\."
14650             dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" "mod2"
14651             dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" "mod2/sub2"
14652             rm -rf CVS dir
14653
14654             mkdir dir
14655             dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
14656 "${PROG} checkout: Updating dir/dir2/dir1d1
14657 U dir/dir2/dir1d1/file1"
14658             dotest cvsadm-N2d5b "cat CVS/Repository" "\."
14659             dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" "\."
14660             dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" "mod1"
14661             rm -rf CVS dir
14662
14663             mkdir dir
14664             dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
14665 "${PROG} checkout: Updating dir/dir2/dir1d2
14666 U dir/dir2/dir1d2/file2"
14667             dotest cvsadm-N2d6b "cat CVS/Repository" "\."
14668             dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" "mod2"
14669             dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" "mod2/sub2"
14670             rm -rf CVS dir
14671
14672             mkdir dir
14673             dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
14674 "${PROG} checkout: Updating dir/dir2/dir2d1/sub2d1
14675 U dir/dir2/dir2d1/sub2d1/file1"
14676             dotest cvsadm-N2d7b "cat CVS/Repository" "\."
14677             dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" "CVSROOT/Emptydir"
14678             dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" "\."
14679             dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
14680 "mod1"
14681             rm -rf CVS dir
14682
14683             mkdir dir
14684             dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
14685 "${PROG} checkout: Updating dir/dir2/dir2d2/sub2d2
14686 U dir/dir2/dir2d2/sub2d2/file2"
14687             dotest cvsadm-N2d8b "cat CVS/Repository" "\."
14688             dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" "\."
14689             dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" "mod2"
14690             dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
14691 "mod2/sub2"
14692             rm -rf CVS dir
14693
14694           fi # end of tests to be skipped for remote
14695
14696           ##################################################
14697           ## That's enough of that, thank you very much.
14698           ##################################################
14699
14700           dotest cvsadm-cleanup-1 "${testcvs} -q co CVSROOT/config" \
14701 "U CVSROOT/config"
14702           cd CVSROOT
14703           echo "# empty file" >config
14704           dotest cvsadm-cleanup-2 "${testcvs} -q ci -m cvsadm-cleanup" \
14705 "Checking in config;
14706 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
14707 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14708 done
14709 ${PROG} commit: Rebuilding administrative file database"
14710           cd ..
14711           rm -rf CVSROOT CVS
14712
14713           # remove our junk
14714           cd ..
14715           rm -rf 1
14716           rm -rf ${CVSROOT_DIRNAME}/1mod
14717           rm -rf ${CVSROOT_DIRNAME}/1mod-2
14718           rm -rf ${CVSROOT_DIRNAME}/2mod
14719           rm -rf ${CVSROOT_DIRNAME}/2mod-2
14720           rm -rf ${CVSROOT_DIRNAME}/mod1
14721           rm -rf ${CVSROOT_DIRNAME}/mod1-2
14722           rm -rf ${CVSROOT_DIRNAME}/mod2
14723           rm -rf ${CVSROOT_DIRNAME}/mod2-2
14724           ;;
14725
14726         emptydir)
14727           # Various tests of the Emptydir (CVSNULLREPOS) code.  See also:
14728           #   cvsadm: tests of Emptydir in various module definitions
14729           #   basicb: Test that "Emptydir" is non-special in ordinary contexts
14730
14731           mkdir 1; cd 1
14732           dotest emptydir-1 "${testcvs} co CVSROOT/modules" \
14733 "U CVSROOT/modules"
14734           echo "# Module defs for emptydir tests" > CVSROOT/modules
14735           echo "2d1mod -d dir2d1/sub/sub2d1 mod1" >> CVSROOT/modules
14736           echo "2d1moda -d dir2d1/suba moda/modasub" >> CVSROOT/modules
14737           echo "2d1modb -d dir2d1/suba mod1" >> CVSROOT/modules
14738           echo "comb -a 2d1modb 2d1moda" >> CVSROOT/modules
14739
14740           dotest emptydir-2 "${testcvs} ci -m add-modules" \
14741 "${PROG} [a-z]*: Examining CVSROOT
14742 Checking in CVSROOT/modules;
14743 ${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
14744 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14745 done
14746 ${PROG} commit: Rebuilding administrative file database" \
14747 "${PROG} commit: Examining CVSROOT"
14748           rm -rf CVS CVSROOT
14749
14750           mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
14751           # Populate.  Not sure we really need to do this.
14752           dotest emptydir-3 "${testcvs} -q co -l ." ""
14753           dotest emptydir-3a "${testcvs} co mod1 moda" \
14754 "${PROG} checkout: Updating mod1
14755 ${PROG} checkout: Updating moda"
14756           echo "file1" > mod1/file1
14757           mkdir moda/modasub
14758           dotest emptydir-3b "${testcvs} add moda/modasub" \
14759 "Directory ${CVSROOT_DIRNAME}/moda/modasub added to the repository"
14760           echo "filea" > moda/modasub/filea
14761           dotest emptydir-4 "${testcvs} add mod1/file1 moda/modasub/filea" \
14762 "${PROG} add: scheduling file .mod1/file1. for addition
14763 ${PROG} add: scheduling file .moda/modasub/filea. for addition
14764 ${PROG} add: use .${PROG} commit. to add these files permanently"
14765           dotest emptydir-5 "${testcvs} -q ci -m yup" \
14766 "RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
14767 done
14768 Checking in mod1/file1;
14769 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
14770 initial revision: 1\.1
14771 done
14772 RCS file: ${CVSROOT_DIRNAME}/moda/modasub/filea,v
14773 done
14774 Checking in moda/modasub/filea;
14775 ${CVSROOT_DIRNAME}/moda/modasub/filea,v  <--  filea
14776 initial revision: 1\.1
14777 done"
14778           rm -rf mod1 moda CVS
14779           # End Populate.
14780
14781           dotest emptydir-6 "${testcvs} co 2d1mod" \
14782 "${PROG} checkout: Updating dir2d1/sub/sub2d1
14783 U dir2d1/sub/sub2d1/file1"
14784           cd dir2d1
14785           touch emptyfile
14786           # It doesn't make any sense to add a file (or do much of anything
14787           # else) in Emptydir; Emptydir is a placeholder indicating that
14788           # the working directory doesn't correspond to anything in
14789           # the repository.
14790           dotest_fail emptydir-7 "${testcvs} add emptyfile" \
14791 "${PROG} \[add aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
14792           mkdir emptydir
14793           dotest_fail emptydir-8 "${testcvs} add emptydir" \
14794 "${PROG} \[[a-z]* aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
14795           cd ..
14796           rm -rf CVS dir2d1
14797
14798           # OK, while we have an Emptydir around, test a few obscure
14799           # things about it.
14800           mkdir edir; cd edir
14801           dotest emptydir-9 "${testcvs} -q co -l CVSROOT" \
14802 "U CVSROOT${DOTSTAR}"
14803           cd CVSROOT
14804           dotest_fail emptydir-10 "test -d Emptydir" ''
14805           # This tests the code in find_dirs which skips Emptydir.
14806           dotest emptydir-11 "${testcvs} -q -n update -d -P" ''
14807           cd ../..
14808           rm -r edir
14809           cd ..
14810
14811           # Now start playing with moda.
14812           mkdir 2; cd 2
14813           dotest emptydir-12 "${testcvs} -q co 2d1moda" \
14814 "U dir2d1/suba/filea"
14815           # OK, this is the crux of the matter.  This used to show "Emptydir",
14816           # but everyone seemed to think it should show "moda".  This
14817           # usually works better, but not always as shown by the following
14818           # test.
14819           dotest emptydir-13 "cat dir2d1/CVS/Repository" "moda"
14820           dotest_fail emptydir-14 "${testcvs} co comb" \
14821 "${PROG} checkout: existing repository ${CVSROOT_DIRNAME}/moda/modasub does not match ${CVSROOT_DIRNAME}/mod1
14822 ${PROG} checkout: ignoring module 2d1modb
14823 ${PROG} checkout: Updating dir2d1/suba"
14824           dotest emptydir-15 "cat dir2d1/CVS/Repository" "moda"
14825           cd ..
14826
14827           # Test the effect of a non-cvs directory already existing with the
14828           # same name as one in the modules file.
14829           mkdir 3; cd 3
14830           mkdir dir2d1
14831           dotest emptydir-16 "${testcvs} co 2d1mod" \
14832 "${PROG} checkout: Updating dir2d1/sub/sub2d1
14833 U dir2d1/sub/sub2d1/file1"
14834           dotest emptydir-17 "test -d dir2d1/CVS"
14835
14836           # clean up
14837           if $keep; then
14838             echo Keeping ${TESTDIR} and exiting due to --keep
14839             exit 0
14840           fi
14841
14842           cd ..
14843           rm -r 1 2 3
14844           rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
14845           # I guess for the moment the convention is going to be
14846           # that we don't need to remove ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
14847           ;;
14848
14849         abspath)
14850         
14851           # These tests test the thituations thin thwitch thoo theck
14852           # things thout twith thabsolute thaths.  Threally.
14853
14854           #
14855           # CHECKOUTS
14856           #
14857
14858           # Create a few modules to use
14859           mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
14860           dotest abspath-1a "${testcvs} co mod1 mod2" \
14861 "${PROG} checkout: Updating mod1
14862 ${PROG} checkout: Updating mod2"
14863
14864           # Populate the module
14865           echo "file1" > mod1/file1
14866           echo "file2" > mod2/file2
14867           cd mod1
14868           dotest abspath-1ba "${testcvs} add file1" \
14869 "${PROG} add: scheduling file .file1. for addition
14870 ${PROG} add: use .${PROG} commit. to add this file permanently"
14871           cd ..
14872           cd mod2
14873           dotest abspath-1bb "${testcvs} add file2" \
14874 "${PROG} add: scheduling file .file2. for addition
14875 ${PROG} add: use .${PROG} commit. to add this file permanently"
14876           cd ..
14877
14878           dotest abspath-1c "${testcvs} ci -m yup mod1 mod2" \
14879 "${PROG} [a-z]*: Examining mod1
14880 ${PROG} [a-z]*: Examining mod2
14881 RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
14882 done
14883 Checking in mod1/file1;
14884 ${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
14885 initial revision: 1.1
14886 done
14887 RCS file: ${CVSROOT_DIRNAME}/mod2/file2,v
14888 done
14889 Checking in mod2/file2;
14890 ${CVSROOT_DIRNAME}/mod2/file2,v  <--  file2
14891 initial revision: 1.1
14892 done"
14893           # Finished creating the module -- clean up.
14894           rm -rf CVS mod1 mod2
14895           # Done.
14896           
14897           # Try checking out the module in a local directory
14898           if $remote; then
14899             dotest_fail abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
14900 "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/1. illegal for server"
14901             dotest abspath-2a-try2 "${testcvs} co -d 1 mod1" \
14902 "${PROG} checkout: Updating 1
14903 U 1/file1"
14904           else
14905             dotest abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
14906 "${PROG} checkout: Updating ${TESTDIR}/1
14907 U ${TESTDIR}/1/file1"
14908           fi # remote workaround
14909
14910           dotest abspath-2b "cat ${TESTDIR}/1/CVS/Repository" "mod1"
14911
14912           # Done.  Clean up.
14913           rm -rf ${TESTDIR}/1
14914
14915
14916           # Now try in a subdirectory.  We're not covering any more
14917           # code here, but we might catch a future error if someone
14918           # changes the checkout code.
14919
14920           # Note that for the same reason that the shell command
14921           # "touch 1/2/3" requires directories 1 and 1/2 to already
14922           # exist, we expect ${TESTDIR}/1 to already exist.  I believe
14923           # this is the behavior of CVS 1.9 and earlier.
14924           if $remote; then :; else
14925             dotest_fail abspath-3.1 "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
14926 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .${TESTDIR}/1.: No such file or directory"
14927           fi
14928           dotest_fail abspath-3.2 "${testcvs} co -d 1/2 mod1" \
14929 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
14930
14931           mkdir 1
14932
14933           if $remote; then
14934             # The server wants the directory to exist, but that is
14935             # a bug, it should only need to exist on the client side.
14936             # See also cvsadm-2d3.
14937             dotest_fail abspath-3a "${testcvs} co -d 1/2 mod1" \
14938 "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
14939             cd 1
14940             dotest abspath-3a-try2 "${testcvs} co -d 2 mod1" \
14941 "${PROG} checkout: Updating 2
14942 U 2/file1"
14943             cd ..
14944             rm -rf 1/CVS
14945           else
14946           dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
14947 "${PROG} checkout: Updating ${TESTDIR}/1/2
14948 U ${TESTDIR}/1/2/file1"
14949           fi # remote workaround
14950           dotest abspath-3b "cat ${TESTDIR}/1/2/CVS/Repository" "mod1"
14951
14952           # For all the same reasons that we want "1" to already
14953           # exist, we don't to mess with it to traverse it, for
14954           # example by creating a CVS directory.
14955
14956           dotest_fail abspath-3c "test -d ${TESTDIR}/1/CVS" ''
14957           # Done.  Clean up.
14958           rm -rf ${TESTDIR}/1
14959
14960
14961           # Now try someplace where we don't have permission.
14962           mkdir ${TESTDIR}/barf
14963           chmod -w ${TESTDIR}/barf
14964             dotest_fail abspath-4r "${testcvs} co -d ${TESTDIR}/barf/sub mod1" \
14965 "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/barf/sub. illegal for server" \
14966 "${PROG} \[checkout aborted\]: cannot make directory sub: Permission denied"
14967           chmod +w ${TESTDIR}/barf
14968           rmdir ${TESTDIR}/barf
14969           # Done.  Nothing to clean up.
14970
14971
14972           # Try checking out two modules into the same directory.
14973           if $remote; then
14974             dotest abspath-5ar "${testcvs} co -d 1 mod1 mod2" \
14975 "${PROG} checkout: Updating 1/mod1
14976 U 1/mod1/file1
14977 ${PROG} checkout: Updating 1/mod2
14978 U 1/mod2/file2"
14979           else
14980             dotest abspath-5a "${testcvs} co -d ${TESTDIR}/1 mod1 mod2" \
14981 "${PROG} checkout: Updating ${TESTDIR}/1/mod1
14982 U ${TESTDIR}/1/mod1/file1
14983 ${PROG} checkout: Updating ${TESTDIR}/1/mod2
14984 U ${TESTDIR}/1/mod2/file2"
14985           fi # end remote workaround
14986           dotest abspath-5b "cat ${TESTDIR}/1/CVS/Repository" "\."
14987           dotest abspath-5c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
14988           dotest abspath-5d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
14989           # Done.  Clean up.
14990           rm -rf ${TESTDIR}/1
14991
14992
14993           # Try checking out the top-level module.
14994           if $remote; then
14995             dotest abspath-6ar "${testcvs} co -d 1 ." \
14996 "${PROG} checkout: Updating 1
14997 ${PROG} checkout: Updating 1/CVSROOT
14998 ${DOTSTAR}
14999 ${PROG} checkout: Updating 1/mod1
15000 U 1/mod1/file1
15001 ${PROG} checkout: Updating 1/mod2
15002 U 1/mod2/file2"
15003           else
15004             dotest abspath-6a "${testcvs} co -d ${TESTDIR}/1 ." \
15005 "${PROG} checkout: Updating ${TESTDIR}/1
15006 ${PROG} checkout: Updating ${TESTDIR}/1/CVSROOT
15007 ${DOTSTAR}
15008 ${PROG} checkout: Updating ${TESTDIR}/1/mod1
15009 U ${TESTDIR}/1/mod1/file1
15010 ${PROG} checkout: Updating ${TESTDIR}/1/mod2
15011 U ${TESTDIR}/1/mod2/file2"
15012           fi # end of remote workaround
15013           dotest abspath-6b "cat ${TESTDIR}/1/CVS/Repository" "\."
15014           dotest abspath-6c "cat ${TESTDIR}/1/CVSROOT/CVS/Repository" "CVSROOT"
15015           dotest abspath-6c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
15016           dotest abspath-6d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
15017           # Done.  Clean up.
15018           rm -rf ${TESTDIR}/1
15019
15020           # Test that an absolute pathname to some other directory
15021           # doesn't mess with the current working directory.
15022           mkdir 1
15023           cd 1
15024           if $remote; then
15025             dotest_fail abspath-7ar "${testcvs} -q co -d ../2 mod2" \
15026 "${PROG} checkout: protocol error: .\.\./2. contains more leading \.\.
15027 ${PROG} \[checkout aborted\]: than the 0 which Max-dotdot specified"
15028             cd ..
15029             dotest abspath-7a-try2r "${testcvs} -q co -d 2 mod2" \
15030 "U 2/file2"
15031             cd 1
15032           else
15033             dotest abspath-7a "${testcvs} -q co -d ${TESTDIR}/2 mod2" \
15034 "U ${TESTDIR}/2/file2"
15035           fi # remote workaround
15036           dotest abspath-7b "ls" ""
15037           dotest abspath-7c "${testcvs} -q co mod1" \
15038 "U mod1/file1"
15039           cd mod1
15040           if $remote; then
15041             cd ../..
15042             dotest abspath-7dr "${testcvs} -q co -d 3 mod2" \
15043 "U 3/file2"
15044             cd 1/mod1
15045           else
15046           dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
15047 "U ${TESTDIR}/3/file2"
15048           fi # remote workaround
15049           dotest abspath-7e "${testcvs} -q update -d" ""
15050           cd ../..
15051           rm -r 1 2 3
15052
15053           #
15054           # FIXME: do other functions here (e.g. update /tmp/foo)
15055           #
15056
15057           # Finished with all tests.  Remove the module.
15058           rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
15059
15060           ;;
15061
15062
15063
15064         abspath2)
15065           # More absolute path checks.  The following used to attempt to create
15066           # directories in /:
15067           #
15068           # $ cvs -d:fork:/cvsroot co /foo
15069           # cvs checkout: warning: cannot make directory CVS in /: Permission denied
15070           # cvs [checkout aborted]: cannot make directory /foo: Permission denied
15071           # $
15072           #
15073           # The -z9 in this test also checks for an old server bug where the
15074           # server would block indefinitely attempting to read an EOF from the
15075           # client in the compression buffer shutdown routine.
15076           dotest_fail abspath2-1 "$testcvs -z9 co /foo" \
15077 "$PROG \[checkout aborted\]: Absolute module reference invalid: \`/foo'" \
15078 "$PROG \[server aborted\]: Absolute module reference invalid: \`/foo'
15079 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
15080           ;;
15081
15082
15083
15084         toplevel)
15085           # test the feature that cvs creates a CVS subdir also for
15086           # the toplevel directory
15087
15088           # First set the TopLevelAdmin setting.
15089           mkdir 1; cd 1
15090           dotest toplevel-1a "${testcvs} -q co CVSROOT/config" \
15091 "U CVSROOT/config"
15092           cd CVSROOT
15093           echo "TopLevelAdmin=yes" >config
15094           dotest toplevel-1b "${testcvs} -q ci -m yes-top-level" \
15095 "Checking in config;
15096 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
15097 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15098 done
15099 ${PROG} commit: Rebuilding administrative file database"
15100           cd ../..
15101           rm -r 1
15102
15103           mkdir 1; cd 1
15104           dotest toplevel-1 "${testcvs} -q co -l ." ''
15105           mkdir top-dir second-dir
15106           dotest toplevel-2 "${testcvs} add top-dir second-dir" \
15107 "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
15108 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
15109           cd top-dir
15110
15111           touch file1
15112           dotest toplevel-3 "${testcvs} add file1" \
15113 "${PROG} add: scheduling file .file1. for addition
15114 ${PROG} add: use .${PROG} commit. to add this file permanently"
15115           dotest toplevel-4 "${testcvs} -q ci -m add" \
15116 "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
15117 done
15118 Checking in file1;
15119 ${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
15120 initial revision: 1\.1
15121 done"
15122           cd ..
15123
15124           cd second-dir
15125           touch file2
15126           dotest toplevel-3s "${testcvs} add file2" \
15127 "${PROG} add: scheduling file .file2. for addition
15128 ${PROG} add: use .${PROG} commit. to add this file permanently"
15129           dotest toplevel-4s "${testcvs} -q ci -m add" \
15130 "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
15131 done
15132 Checking in file2;
15133 ${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
15134 initial revision: 1\.1
15135 done"
15136
15137           cd ../..
15138           rm -r 1; mkdir 1; cd 1
15139           dotest toplevel-5 "${testcvs} co top-dir" \
15140 "${PROG} checkout: Updating top-dir
15141 U top-dir/file1"
15142
15143           dotest toplevel-6 "${testcvs} update top-dir" \
15144 "${PROG} update: Updating top-dir"
15145           dotest toplevel-7 "${testcvs} update"  \
15146 "${PROG} update: Updating \.
15147 ${PROG} update: Updating top-dir"
15148
15149           dotest toplevel-8 "${testcvs} update -d top-dir" \
15150 "${PROG} update: Updating top-dir"
15151           # There is some sentiment that
15152           #   "${PROG} update: Updating \.
15153           #   ${PROG} update: Updating top-dir"
15154           # is correct but it isn't clear why that would be correct instead
15155           # of the remote CVS behavior (which also updates CVSROOT).
15156           #
15157           # The DOTSTAR matches of a bunch of lines like
15158           # "U CVSROOT/checkoutlist".  Trying to match them more precisely
15159           # seemed to cause trouble.  For example CVSROOT/cvsignore will
15160           # be present or absent depending on whether we ran the "ignore"
15161           # test or not.
15162           dotest toplevel-9 "${testcvs} update -d" \
15163 "${PROG} update: Updating \.
15164 ${PROG} update: Updating CVSROOT
15165 ${DOTSTAR}
15166 ${PROG} update: Updating top-dir"
15167
15168           cd ..
15169           rm -r 1; mkdir 1; cd 1
15170           dotest toplevel-10 "${testcvs} co top-dir" \
15171 "${PROG} checkout: Updating top-dir
15172 U top-dir/file1"
15173
15174           # This tests more or less the same thing, in a particularly
15175           # "real life" example.
15176           dotest toplevel-11 "${testcvs} -q update -d second-dir" \
15177 "U second-dir/file2"
15178
15179           # Now remove the CVS directory (people may do this manually,
15180           # especially if they formed their habits with CVS
15181           # 1.9 and older, which didn't create it.  Or perhaps the working
15182           # directory itself was created with 1.9 or older).
15183           rm -r CVS
15184           # Now set the permissions so we can't recreate it.
15185           if test -n "$remotehost"; then
15186             # Cygwin again.
15187             $CVS_RSH $remotehost "chmod -w $TESTDIR/1"
15188           else
15189             chmod -w ../1
15190           fi
15191           # Now see whether CVS has trouble because it can't create CVS.
15192           # First string is for local, second is for remote.
15193           dotest toplevel-12 "${testcvs} co top-dir" \
15194 "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
15195 ${PROG} checkout: Updating top-dir" \
15196 "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
15197 ${PROG} checkout: in directory \.:
15198 ${PROG} checkout: cannot open CVS/Entries for reading: No such file or directory
15199 ${PROG} checkout: Updating top-dir"
15200
15201           chmod +w ../1
15202
15203           dotest toplevel-cleanup-1 "${testcvs} -q co CVSROOT/config" \
15204 "U CVSROOT/config"
15205           cd CVSROOT
15206           echo "# empty file" >config
15207           dotest toplevel-cleanup-2 "${testcvs} -q ci -m toplevel-cleanup" \
15208 "Checking in config;
15209 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
15210 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15211 done
15212 ${PROG} commit: Rebuilding administrative file database"
15213
15214           cd ../..
15215           rm -r 1
15216           rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
15217           ;;
15218
15219         toplevel2)
15220           # Similar to toplevel, but test the case where TopLevelAdmin=no.
15221
15222           # First set the TopLevelAdmin setting.
15223           mkdir 1; cd 1
15224           dotest toplevel2-1a "${testcvs} -q co CVSROOT/config" \
15225 "U CVSROOT/config"
15226           cd CVSROOT
15227           echo "TopLevelAdmin=no" >config
15228           dotest toplevel2-1b "${testcvs} -q ci -m no-top-level" \
15229 "Checking in config;
15230 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
15231 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15232 done
15233 ${PROG} commit: Rebuilding administrative file database"
15234           cd ../..
15235           rm -r 1
15236
15237           # Now set up some directories and subdirectories
15238           mkdir 1; cd 1
15239           dotest toplevel2-1 "${testcvs} -q co -l ." ''
15240           mkdir top-dir second-dir
15241           dotest toplevel2-2 "${testcvs} add top-dir second-dir" \
15242 "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
15243 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
15244           cd top-dir
15245
15246           touch file1
15247           dotest toplevel2-3 "${testcvs} add file1" \
15248 "${PROG} add: scheduling file .file1. for addition
15249 ${PROG} add: use .${PROG} commit. to add this file permanently"
15250           dotest toplevel2-4 "${testcvs} -q ci -m add" \
15251 "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
15252 done
15253 Checking in file1;
15254 ${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
15255 initial revision: 1\.1
15256 done"
15257           cd ..
15258
15259           cd second-dir
15260           touch file2
15261           dotest toplevel2-3s "${testcvs} add file2" \
15262 "${PROG} add: scheduling file .file2. for addition
15263 ${PROG} add: use .${PROG} commit. to add this file permanently"
15264           dotest toplevel2-4s "${testcvs} -q ci -m add" \
15265 "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
15266 done
15267 Checking in file2;
15268 ${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
15269 initial revision: 1\.1
15270 done"
15271
15272           cd ../..
15273           rm -r 1; mkdir 1; cd 1
15274           dotest toplevel2-5 "${testcvs} co top-dir" \
15275 "${PROG} checkout: Updating top-dir
15276 U top-dir/file1"
15277
15278           dotest toplevel2-6 "${testcvs} update top-dir" \
15279 "${PROG} update: Updating top-dir"
15280           dotest toplevel2-7 "${testcvs} update"  \
15281 "${PROG} update: Updating top-dir"
15282
15283           dotest toplevel2-8 "${testcvs} update -d top-dir" \
15284 "${PROG} update: Updating top-dir"
15285           # Contrast this with toplevel-9, which has TopLevelAdmin=yes.
15286           dotest toplevel2-9 "${testcvs} update -d" \
15287 "${PROG} update: Updating top-dir"
15288
15289           cd ..
15290           rm -r 1; mkdir 1; cd 1
15291           dotest toplevel2-10 "${testcvs} co top-dir" \
15292 "${PROG} checkout: Updating top-dir
15293 U top-dir/file1"
15294           # This tests more or less the same thing, in a particularly
15295           # "real life" example.  With TopLevelAdmin=yes, this command
15296           # would give us second-dir and CVSROOT directories too.
15297           dotest toplevel2-11 "${testcvs} -q update -d" ""
15298
15299           dotest toplevel2-cleanup-1 "${testcvs} -q co CVSROOT/config" \
15300 "U CVSROOT/config"
15301           cd CVSROOT
15302           echo "# empty file" >config
15303           dotest toplevel2-cleanup-2 "${testcvs} -q ci -m toplevel2-cleanup" \
15304 "Checking in config;
15305 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
15306 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15307 done
15308 ${PROG} commit: Rebuilding administrative file database"
15309           cd ../..
15310           rm -r 1
15311           rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
15312           ;;
15313
15314
15315
15316         rstar-toplevel)
15317           # This test used to confirm a bug that existed in the r* commands
15318           # run against the top-level project prior to CVS 1.11.18 & 1.12.10.
15319           #
15320           # The assertion failure was something like:
15321           # do_recursion: Assertion \`strstr (repository, \"/\./\") == ((void \*)0)' failed\..*"
15322           dotest rstar-toplevel-1 "$testcvs -q rlog ." \
15323 "
15324 RCS file: $CVSROOT_DIRNAME/CVSROOT$DOTSTAR"
15325
15326           if $keep; then
15327             echo Keeping ${TESTDIR} and exiting due to --keep
15328             exit 0
15329           fi
15330         ;;
15331
15332
15333
15334         trailingslashes)
15335           # Some tests of CVS's reactions to path specifications containing
15336           # trailing slashes.
15337           mkdir trailingslashes; cd trailingslashes
15338           dotest trailingslashes-init-1 "$testcvs -Q co -ldt ."
15339           dotest trailingslashes-init-2 "$testcvs -Q co -dt2 ."
15340           cd t
15341           echo "Ahh'll be baaack." >topfile
15342           dotest trailingslashes-init-3 "$testcvs -Q add topfile"
15343           dotest trailingslashes-init-4 "$testcvs -Q ci -mto-top" \
15344 "RCS file: $CVSROOT_DIRNAME/topfile,v
15345 done
15346 Checking in topfile;
15347 $CVSROOT_DIRNAME/topfile,v  <--  topfile
15348 initial revision: 1\.1
15349 done"
15350
15351           # First, demonstrate the usual case.
15352           cd ../t2
15353           dotest trailingslashes-1 "$testcvs -q up CVSROOT"
15354           dotest_fail trailingslashes-1a "test -f topfile"
15355
15356           # Now the one that used to fail in remote mode prior to 1.11.24
15357           # & 1.12.14.  Formerly TODO item #205.
15358           dotest trailingslashes-2 "$testcvs -q up CVSROOT/"
15359           dotest_fail trailingslashes-2a "test -f topfile"
15360
15361           if $keep; then
15362             echo Keeping $TESTDIR and exiting due to --keep
15363             exit 0
15364           fi
15365
15366           cd ../..
15367           rm -rf trailingslashes $CVSROOT_DIRNAME/topfile,v
15368           ;;
15369
15370
15371
15372         checkout_repository)
15373           dotest_fail checkout_repository-1 \
15374 "${testcvs} co -d ${CVSROOT_DIRNAME} CVSROOT" \
15375 "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
15376 "${PROG} \[checkout aborted\]: absolute pathname \`${CVSROOT_DIRNAME}' illegal for server"
15377
15378           # The behavior of the client/server test below should be correct.
15379           # The CVS client currently has no way of knowing that the client and
15380           # server are the same machine and thus skips the $CVSROOT checks.
15381           # I think checking for this case in CVS would be bloat since this
15382           # should be a fairly rare occurance.
15383           cd ${CVSROOT_DIRNAME}
15384           dotest_fail checkout_repository-2 "${testcvs} co CVSROOT" \
15385 "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
15386 "${PROG} checkout: Updating CVSROOT
15387 ${PROG} checkout: move away CVSROOT/checkoutlist; it is in the way
15388 C CVSROOT/checkoutlist
15389 ${PROG} checkout: move away CVSROOT/commitinfo; it is in the way
15390 C CVSROOT/commitinfo
15391 ${PROG} checkout: move away CVSROOT/config; it is in the way
15392 C CVSROOT/config
15393 ${PROG} checkout: move away CVSROOT/cvswrappers; it is in the way
15394 C CVSROOT/cvswrappers
15395 ${PROG} checkout: move away CVSROOT/editinfo; it is in the way
15396 C CVSROOT/editinfo
15397 ${PROG} checkout: move away CVSROOT/loginfo; it is in the way
15398 C CVSROOT/loginfo
15399 ${PROG} checkout: move away CVSROOT/modules; it is in the way
15400 C CVSROOT/modules
15401 ${PROG} checkout: move away CVSROOT/notify; it is in the way
15402 C CVSROOT/notify
15403 ${PROG} checkout: move away CVSROOT/rcsinfo; it is in the way
15404 C CVSROOT/rcsinfo
15405 ${PROG} checkout: move away CVSROOT/taginfo; it is in the way
15406 C CVSROOT/taginfo
15407 ${PROG} checkout: move away CVSROOT/verifymsg; it is in the way
15408 C CVSROOT/verifymsg"
15409
15410           dotest checkout_repository-3 \
15411 "${testcvs} co -p CVSROOT/modules >/dev/null" \
15412 "===================================================================
15413 Checking out CVSROOT/modules
15414 RCS:  ${CVSROOT_DIRNAME}/CVSROOT/modules,v
15415 VERS: 1\.[0-9]*
15416 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
15417           cd ${TESTDIR}
15418           ;;
15419
15420         mflag)
15421           for message in '' ' ' '       
15422            ' '                  test' ; do
15423             # Set up
15424             mkdir a-dir; cd a-dir
15425             # Test handling of -m during import
15426             echo testa >>test
15427             if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
15428                 pass 156
15429             else
15430                 fail 156
15431             fi
15432             # Must import twice since the first time uses inline code that
15433             # avoids RCS call.
15434             echo testb >>test
15435             if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
15436                 pass 157
15437             else
15438                 fail 157
15439             fi
15440             # Test handling of -m during ci
15441             cd ..; rm -r a-dir
15442             if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
15443                 pass 158
15444             else
15445                 fail 158
15446             fi
15447             cd a-dir
15448             echo testc >>test
15449             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
15450                 pass 159
15451             else
15452                 fail 159
15453             fi
15454             # Test handling of -m during rm/ci
15455             rm test;
15456             if ${testcvs} rm test >>${LOGFILE} 2>&1; then
15457                 pass 160
15458             else
15459                 fail 160
15460             fi
15461             if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
15462                 pass 161
15463             else
15464                 fail 161
15465             fi
15466             # Clean up
15467             cd ..
15468             rm -r a-dir
15469             rm -rf ${CVSROOT_DIRNAME}/a-dir
15470           done
15471           ;;
15472
15473         editor)
15474           # More tests of log messages, in this case the ability to
15475           # run an external editor.
15476           # TODO:
15477           #   * also test $EDITOR, $CVSEDITOR, &c.
15478           #   * test what happens if up-to-date check fails.
15479
15480           # Our "editor" puts "x" at the start of each line, so we
15481           # can see the "CVS:" lines.
15482           cat >${TESTDIR}/editme <<EOF
15483 #!${TESTSHELL}
15484 sleep 1
15485 sed <\$1 -e 's/^/x/' >${TESTDIR}/edit.new
15486 mv ${TESTDIR}/edit.new \$1
15487 exit 0
15488 EOF
15489           chmod +x ${TESTDIR}/editme
15490
15491           mkdir 1; cd 1
15492           dotest editor-1 "${testcvs} -q co -l ." ''
15493           mkdir first-dir
15494           dotest editor-2 "${testcvs} add first-dir" \
15495 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15496           cd first-dir
15497           touch file1 file2
15498           dotest editor-3 "${testcvs} add file1 file2" \
15499 "${PROG} add: scheduling file .file1. for addition
15500 ${PROG} add: scheduling file .file2. for addition
15501 ${PROG} add: use .${PROG} commit. to add these files permanently"
15502           dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
15503 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15504 done
15505 Checking in file1;
15506 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15507 initial revision: 1\.1
15508 done
15509 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15510 done
15511 Checking in file2;
15512 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
15513 initial revision: 1\.1
15514 done"
15515           dotest editor-5 "${testcvs} -q tag -b br" "T file1
15516 T file2"
15517           dotest editor-6 "$testcvs -q update -r br" \
15518 'U file1
15519 U file2'
15520           echo modify >>file1
15521           dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
15522 "Checking in file1;
15523 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15524 new revision: 1\.1\.2\.1; previous revision: 1\.1
15525 done"
15526           # OK, now we want to make sure "ci -r" puts in the branch
15527           # where appropriate.  Note that we can check in on the branch
15528           # without being on the branch, because there is not a revision
15529           # already on the branch.  If there were a revision on the branch,
15530           # CVS would correctly give an up-to-date check failed.
15531           dotest editor-8 "$testcvs -q update -A" \
15532 'U file1
15533 U file2'
15534           echo add a line >>file2
15535           dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
15536 "Checking in file2;
15537 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
15538 new revision: 1\.1\.2\.1; previous revision: 1\.1
15539 done"
15540
15541           dotest editor-log-file1 "${testcvs} log -N file1" "
15542 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15543 Working file: file1
15544 head: 1\.1
15545 branch:
15546 locks: strict
15547 access list:
15548 keyword substitution: kv
15549 total revisions: 2;     selected revisions: 2
15550 description:
15551 ----------------------------
15552 revision 1\.1
15553 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15554 branches:  1\.1\.2;
15555 xCVS: ----------------------------------------------------------------------
15556 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15557 xCVS:
15558 xCVS: Committing in .
15559 xCVS:
15560 xCVS: Added Files:
15561 xCVS:   file1 file2
15562 xCVS: ----------------------------------------------------------------------
15563 ----------------------------
15564 revision 1\.1\.2\.1
15565 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15566 xCVS: ----------------------------------------------------------------------
15567 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15568 xCVS:
15569 xCVS: Committing in .
15570 xCVS:
15571 xCVS: Modified Files:
15572 xCVS:  Tag: br
15573 xCVS:   file1
15574 xCVS: ----------------------------------------------------------------------
15575 ============================================================================="
15576
15577           # The only difference between the two expect strings is the
15578           # presence or absence of "Committing in ." for 1.1.2.1.
15579           dotest editor-log-file2 "${testcvs} log -N file2" "
15580 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15581 Working file: file2
15582 head: 1\.1
15583 branch:
15584 locks: strict
15585 access list:
15586 keyword substitution: kv
15587 total revisions: 2;     selected revisions: 2
15588 description:
15589 ----------------------------
15590 revision 1\.1
15591 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15592 branches:  1\.1\.2;
15593 xCVS: ----------------------------------------------------------------------
15594 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15595 xCVS:
15596 xCVS: Committing in .
15597 xCVS:
15598 xCVS: Added Files:
15599 xCVS:   file1 file2
15600 xCVS: ----------------------------------------------------------------------
15601 ----------------------------
15602 revision 1\.1\.2\.1
15603 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15604 xCVS: ----------------------------------------------------------------------
15605 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15606 xCVS:
15607 xCVS: Modified Files:
15608 xCVS:  Tag: br
15609 xCVS:   file2
15610 xCVS: ----------------------------------------------------------------------
15611 =============================================================================" "
15612 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15613 Working file: file2
15614 head: 1\.1
15615 branch:
15616 locks: strict
15617 access list:
15618 keyword substitution: kv
15619 total revisions: 2;     selected revisions: 2
15620 description:
15621 ----------------------------
15622 revision 1\.1
15623 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15624 branches:  1\.1\.2;
15625 xCVS: ----------------------------------------------------------------------
15626 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15627 xCVS:
15628 xCVS: Committing in .
15629 xCVS:
15630 xCVS: Added Files:
15631 xCVS:   file1 file2
15632 xCVS: ----------------------------------------------------------------------
15633 ----------------------------
15634 revision 1\.1\.2\.1
15635 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15636 xCVS: ----------------------------------------------------------------------
15637 xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15638 xCVS:
15639 xCVS: Committing in .
15640 xCVS:
15641 xCVS: Modified Files:
15642 xCVS:  Tag: br
15643 xCVS:   file2
15644 xCVS: ----------------------------------------------------------------------
15645 ============================================================================="
15646
15647           # Test CVS's response to an unchanged log message
15648           cat >${TESTDIR}/editme <<EOF
15649 #!${TESTSHELL}
15650 sleep 1
15651 exit 0
15652 EOF
15653           chmod +x ${TESTDIR}/editme
15654           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15655 "
15656 Log message unchanged or not specified
15657 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15658 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
15659
15660           # Test CVS's response to an empty log message
15661           cat >${TESTDIR}/editme <<EOF
15662 #!${TESTSHELL}
15663 sleep 1
15664 cat /dev/null >\$1
15665 exit 0
15666 EOF
15667           chmod +x ${TESTDIR}/editme
15668           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15669 "
15670 Log message unchanged or not specified
15671 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15672 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
15673
15674           # Test CVS's response to a log message with one blank line
15675           cat >${TESTDIR}/editme <<EOF
15676 #!${TESTSHELL}
15677 sleep 1
15678 echo >\$1
15679 exit 0
15680 EOF
15681           chmod +x ${TESTDIR}/editme
15682           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15683 "
15684 Log message unchanged or not specified
15685 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15686 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
15687
15688           # Test CVS's response to a log message with only comments
15689           cat >${TESTDIR}/editme <<EOF
15690 #!${TESTSHELL}
15691 sleep 1
15692 cat \$1 >${TESTDIR}/edit.new
15693 mv ${TESTDIR}/edit.new \$1
15694 exit 0
15695 EOF
15696           chmod +x ${TESTDIR}/editme
15697           dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15698 "
15699 Log message unchanged or not specified
15700 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15701 Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
15702
15703           # Test CVS's response to a log message that is zero bytes
15704           # in length. This caused core dumps in cvs 1.11.5 on Solaris
15705           # hosts.
15706           cd ..
15707           dotest editor-emptylog-continue-1 "${testcvs} -q co CVSROOT/loginfo" \
15708 "U CVSROOT/loginfo"
15709
15710           cd CVSROOT
15711           echo 'DEFAULT (echo Start-Log;cat;echo End-Log) >> \$CVSROOT/CVSROOT/commitlog' > loginfo
15712           dotest editor-emptylog-continue-2 "${testcvs} commit -m add loginfo" \
15713 "Checking in loginfo;
15714 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
15715 new revision: 1\.2; previous revision: 1\.1
15716 done
15717 ${PROG} commit: Rebuilding administrative file database"
15718
15719           cd ../first-dir
15720           cat >${TESTDIR}/editme <<EOF
15721 #!${TESTSHELL}
15722 sleep 1
15723 cp /dev/null \$1
15724 exit 1
15725 EOF
15726           chmod +x ${TESTDIR}/editme
15727           dotest editor-emptylog-continue-3 "echo c |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15728 "${PROG} [a-z]*: warning: editor session failed
15729
15730 Log message unchanged or not specified
15731 a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15732 Action: (continue) Checking in file1;
15733 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15734 new revision: 1\.2; previous revision: 1\.1
15735 done"
15736           # The loginfo Log message should be an empty line and not "(null)"
15737           # which is what some fprintf() implementations do with "%s"
15738           # format and a NULL pointer...
15739           if $remote; then
15740             dotest editor-emptylog-continue-4r \
15741 "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
15742 "Start-Log
15743 Update of ${CVSROOT_DIRNAME}/first-dir
15744 In directory ${hostname}:${TMPDIR}/cvs-serv[0-9a-z]*
15745
15746 Modified Files:
15747         file1 
15748 Log Message:
15749
15750 End-Log"
15751           else
15752             dotest editor-emptylog-continue-4 \
15753 "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
15754 "Start-Log
15755 Update of ${CVSROOT_DIRNAME}/first-dir
15756 In directory ${hostname}:${TESTDIR}/1/first-dir
15757
15758 Modified Files:
15759         file1 
15760 Log Message:
15761
15762 End-Log"
15763          fi
15764           # There should have an empty log message at this point
15765           dotest editor-emptylog-continue-5 "${testcvs} log -N -r1.2 file1" \
15766 "
15767 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15768 Working file: file1
15769 head: 1\.2
15770 branch:
15771 locks: strict
15772 access list:
15773 keyword substitution: kv
15774 total revisions: 3;     selected revisions: 1
15775 description:
15776 ----------------------------
15777 revision 1\.2
15778 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: +0 -0
15779 \*\*\* empty log message \*\*\*
15780 ============================================================================="
15781
15782           # clean up
15783           if $keep; then
15784             echo Keeping ${TESTDIR} and exiting due to --keep
15785             exit 0
15786           fi
15787
15788           restore_adm
15789           cd ../..
15790           rm -r 1
15791           rm ${TESTDIR}/editme
15792           rm -rf ${CVSROOT_DIRNAME}/first-dir
15793           ;;
15794
15795         errmsg1)
15796           mkdir ${CVSROOT_DIRNAME}/1dir
15797           mkdir 1
15798           cd 1
15799           if ${testcvs} -q co 1dir; then
15800               pass 162
15801           else
15802               fail 162
15803           fi
15804           cd 1dir
15805           touch foo
15806           if ${testcvs} add foo 2>>${LOGFILE}; then
15807               pass 163
15808           else
15809               fail 163
15810           fi
15811           if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
15812               pass 164
15813           else
15814               fail 164
15815           fi
15816           cd ../..
15817           mkdir 2
15818           cd 2
15819           if ${testcvs} -q co 1dir >>${LOGFILE}; then
15820               pass 165
15821           else
15822               fail 165
15823           fi
15824           chmod a-w 1dir
15825           cd ../1/1dir
15826           rm foo;
15827           if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
15828               pass 166
15829           else
15830               fail 166
15831           fi
15832           if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
15833               pass 167
15834           else
15835               fail 167
15836           fi
15837
15838           cd ../../2/1dir
15839           # The second case in the local and remote versions of errmsg1-168
15840           # below happens on Cygwin under Windows, where write privileges
15841           # aren't enforced properly.
15842           if $remote; then
15843             dotest errmsg1-168r "${testcvs} -q update" \
15844 "${PROG} update: foo is no longer in the repository
15845 ${PROG} update: unable to remove \./foo: Permission denied" \
15846 "${PROG} update: foo is no longer in the repository"
15847           else
15848             dotest errmsg1-168 "${testcvs} -q update" \
15849 "${PROG} update: foo is no longer in the repository
15850 ${PROG} update: unable to remove foo: Permission denied" \
15851 "${PROG} update: foo is no longer in the repository"
15852           fi
15853
15854           cd ..
15855           chmod u+w 1dir
15856           cd ..
15857           rm -r 1 2
15858           rm -rf ${CVSROOT_DIRNAME}/1dir
15859           ;;
15860
15861         errmsg2)
15862           # More tests of various miscellaneous error handling,
15863           # and cvs add behavior in general.
15864           # See also test basicb-4a, concerning "cvs ci CVS".
15865           # Too many tests to mention test the simple cases of
15866           # adding files and directories.
15867           # Test basicb-2a10 tests cvs -n add.
15868
15869           # First the usual setup; create a directory first-dir.
15870           mkdir 1; cd 1
15871           dotest errmsg2-1 "${testcvs} -q co -l ." ''
15872           mkdir first-dir
15873           dotest errmsg2-2 "${testcvs} add first-dir" \
15874 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15875           cd first-dir
15876           dotest_fail errmsg2-3 "${testcvs} add CVS" \
15877 "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
15878           touch file1
15879           # For the most part add returns a failure exitstatus if
15880           # there are any errors, even if the remaining files are
15881           # processed without incident.  The "cannot add
15882           # special file" message fits this pattern, at
15883           # least currently.
15884           dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
15885 "${PROG} add: cannot add special file .CVS.; skipping
15886 ${PROG} add: scheduling file .file1. for addition
15887 ${PROG} add: use .${PROG} commit. to add this file permanently"
15888           # I'm not sure these tests completely convey the various strange
15889           # behaviors that CVS had before it specially checked for "." and
15890           # "..".  Suffice it to say that these are unlikely to work right
15891           # without a special case.
15892           dotest_fail errmsg2-5 "${testcvs} add ." \
15893 "${PROG} [a-z]*: cannot add special file .\..; skipping"
15894           dotest_fail errmsg2-6 "${testcvs} add .." \
15895 "${PROG} [a-z]*: cannot add special file .\.\..; skipping"
15896           # Make sure that none of the error messages left droppings
15897           # which interfere with normal operation.
15898           dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
15899 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15900 done
15901 Checking in file1;
15902 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15903 initial revision: 1\.1
15904 done"
15905           mkdir sdir
15906           cd ..
15907           dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
15908 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
15909           # while we're here... check commit with no CVS directory
15910           dotest_fail errmsg2-8a "${testcvs} -q ci first-dir nonexistant" \
15911 "${PROG} [a-z]*: nothing known about .nonexistant'
15912 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
15913           dotest_fail errmsg2-8b "${testcvs} -q ci nonexistant first-dir" \
15914 "${PROG} [a-z]*: nothing known about .nonexistant'
15915 ${PROG} \[[a-z]* aborted\]: correct above errors first!"
15916           dotest errmsg2-8c "${testcvs} -q ci first-dir" ""
15917
15918           cd first-dir
15919
15920           touch file10
15921           mkdir sdir10
15922           dotest errmsg2-10 "${testcvs} add file10 sdir10" \
15923 "${PROG} add: scheduling file .file10. for addition
15924 Directory ${CVSROOT_DIRNAME}/first-dir/sdir10 added to the repository
15925 ${PROG} add: use .${PROG} commit. to add this file permanently"
15926           dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
15927 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
15928 done
15929 Checking in file10;
15930 ${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
15931 initial revision: 1\.1
15932 done"
15933           # Try to see that there are no droppings left by
15934           # any of the previous tests.
15935           dotest errmsg2-12 "${testcvs} -q update" ""
15936
15937           # Now test adding files with '/' in the name, both one level
15938           # down and more than one level down.
15939           cd ..
15940           mkdir first-dir/sdir10/ssdir
15941           dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
15942 "Directory ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir added to the repository"
15943
15944           touch first-dir/sdir10/ssdir/ssfile
15945           dotest errmsg2-14 \
15946             "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
15947 "${PROG} add: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
15948 ${PROG} add: use .${PROG} commit. to add this file permanently"
15949           touch first-dir/file15
15950           dotest errmsg2-15 "${testcvs} add first-dir/file15" \
15951 "${PROG} add: scheduling file .first-dir/file15. for addition
15952 ${PROG} add: use .${PROG} commit. to add this file permanently"
15953
15954           # Now the case where we try to give it a directory which is not
15955           # under CVS control.
15956           mkdir bogus-dir
15957           touch bogus-dir/file16
15958           # The first message, from local CVS, is nice.  The second one
15959           # is not nice; would be good to fix remote CVS to give a clearer
15960           # message (e.g. the one from local CVS).  But at least it is an
15961           # error message.
15962           dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
15963 "${PROG} add: in directory bogus-dir:
15964 ${PROG} \[add aborted\]: there is no version here; do .${PROG} checkout. first" \
15965 "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
15966 ${PROG} \[add aborted\]: no repository"
15967           rm -r bogus-dir
15968
15969           # One error condition we don't test for is trying to add a file
15970           # or directory which already is there.
15971
15972           dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
15973 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file15,v
15974 done
15975 Checking in first-dir/file15;
15976 ${CVSROOT_DIRNAME}/first-dir/file15,v  <--  file15
15977 initial revision: 1\.1
15978 done
15979 RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v
15980 done
15981 Checking in first-dir/sdir10/ssdir/ssfile;
15982 ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v  <--  ssfile
15983 initial revision: 1\.1
15984 done"
15985           dotest errmsg2-18 "${testcvs} -Q tag test" ''
15986
15987           # trying to import the repository
15988
15989           if $remote; then :; else
15990             cd ${CVSROOT_DIRNAME}
15991             dotest_fail errmsg2-20 "${testcvs} import -mtest . A B" \
15992 "${PROG} \[import aborted\]: attempt to import the repository"
15993             dotest_fail errmsg2-21 "${testcvs} import -mtest first-dir A B" \
15994 "${PROG} \[import aborted\]: attempt to import the repository"
15995           fi
15996
15997           cd ..
15998           rm -r 1
15999           rm -rf ${CVSROOT_DIRNAME}/first-dir
16000           ;;
16001
16002         adderrmsg)
16003           # Test some of the error messages the 'add' command can return and
16004           # their reactions to '-q'.
16005
16006           # First the usual setup; create a directory first-dir.
16007           mkdir 1; cd 1
16008           dotest adderrmsg-init1 "${testcvs} -q co -l ." ''
16009           mkdir adderrmsg-dir
16010           dotest adderrmsg-init2 "${testcvs} add adderrmsg-dir" \
16011 "Directory ${CVSROOT_DIRNAME}/adderrmsg-dir added to the repository"
16012           cd adderrmsg-dir
16013
16014           # try to add the admin dir
16015           dotest_fail adderrmsg-1 "${testcvs} add CVS" \
16016 "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
16017           # might not want to see this message when you 'cvs add *'
16018           dotest_fail adderrmsg-2 "${testcvs} -q add CVS" ""
16019
16020           # to test some other messages
16021           touch file1
16022           dotest adderrmsg-3 "${testcvs} add file1" \
16023 "${PROG} add: scheduling file .file1. for addition
16024 ${PROG} add: use .${PROG} commit. to add this file permanently"
16025
16026           # add it twice
16027           dotest_fail adderrmsg-4 "${testcvs} add file1" \
16028 "${PROG} add: file1 has already been entered"
16029           dotest_fail adderrmsg-5 "${testcvs} -q add file1" ""
16030
16031           dotest adderrmsg-6 "${testcvs} -q ci -madd" \
16032 "RCS file: ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v
16033 done
16034 Checking in file1;
16035 ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v  <--  file1
16036 initial revision: 1\.1
16037 done"
16038
16039           # file in Entries & repository
16040           dotest_fail adderrmsg-7 "${testcvs} add file1" \
16041 "${PROG} add: file1 already exists, with version number 1\.1"
16042           dotest_fail adderrmsg-8 "${testcvs} -q add file1" ""
16043
16044           # clean up
16045           cd ../..
16046           if $keep; then :; else
16047               rm -r 1
16048               rm -rf ${CVSROOT_DIRNAME}/adderrmsg-dir
16049           fi
16050           ;;
16051
16052         opterrmsg)
16053           # Test some option parsing error messages
16054
16055           # No init is necessary since these error messages are printed b4
16056           # CVS looks for a sandbox or repository
16057
16058           # -z used to accept non-numeric arguments.  This bit someone who
16059           # attempted `cvs -z -n up' when the -n was read as the argument to
16060           # -z.
16061           dotest_fail opterrmsg-1 "${testcvs} -z -n up" \
16062 "${PROG}: gzip compression level must be between 0 and 9"
16063
16064           # Some general -z checks
16065           dotest_fail opterrmsg-2 "${testcvs} -z -1 up" \
16066 "${PROG}: gzip compression level must be between 0 and 9"
16067           dotest_fail opterrmsg-3 "${testcvs} -z10 up" \
16068 "${PROG}: gzip compression level must be between 0 and 9"
16069           ;;
16070
16071         devcom)
16072           mkdir ${CVSROOT_DIRNAME}/first-dir
16073           mkdir 1
16074           cd 1
16075           dotest devcom-1 "${testcvs} -q co first-dir"
16076
16077           cd first-dir
16078           echo abb >abb
16079           dotest devcom-2 "${testcvs} add abb" \
16080 "$PROG add: scheduling file \`abb' for addition
16081 $PROG add: use '$PROG commit' to add this file permanently"
16082
16083           dotest devcom-3 "${testcvs} -q ci -m added" \
16084 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abb,v
16085 done
16086 Checking in abb;
16087 ${CVSROOT_DIRNAME}/first-dir/abb,v  <--  abb
16088 initial revision: 1\.1
16089 done"
16090
16091           dotest_fail devcom-4 "${testcvs} watch" "Usage${DOTSTAR}"
16092
16093           dotest devcom-5 "${testcvs} watch on"
16094
16095           echo abc >abc
16096           dotest devcom-6 "${testcvs} add abc" \
16097 "$PROG add: scheduling file \`abc' for addition
16098 $PROG add: use '$PROG commit' to add this file permanently"
16099
16100           dotest devcom-7 "${testcvs} -q ci -m added" \
16101 "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
16102 done
16103 Checking in abc;
16104 ${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
16105 initial revision: 1\.1
16106 done"
16107
16108           cd ../..
16109           mkdir 2
16110           cd 2
16111
16112           dotest devcom-8 "${testcvs} -q co first-dir" \
16113 "U first-dir/abb
16114 U first-dir/abc"
16115
16116           cd first-dir
16117           dotest_fail devcom-9 "test -w abb"
16118           dotest_fail devcom-9 "test -w abc"
16119
16120           dotest devcom-10 "${testcvs} editors" ""
16121
16122           dotest devcom-11 "${testcvs} edit abb"
16123
16124           # Here we test for the traditional ISO C ctime() date format.
16125           # We assume the C locale; I guess that works provided we set
16126           # LC_ALL at the start of this script but whether these
16127           # strings should vary based on locale does not strike me as
16128           # self-evident.
16129           dotest devcom-12 "${testcvs} editors" \
16130 "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"
16131
16132           echo aaaa >>abb
16133           dotest devcom-13 "${testcvs} ci -m modify abb" \
16134 "Checking in abb;
16135 ${CVSROOT_DIRNAME}/first-dir/abb,v  <--  abb
16136 new revision: 1\.2; previous revision: 1\.1
16137 done"
16138
16139           # Unedit of a file not being edited should be a noop.
16140           dotest devcom-14 "${testcvs} unedit abb" ''
16141
16142           dotest devcom-15 "${testcvs} editors" ""
16143
16144           dotest_fail devcom-16 "test -w abb"
16145
16146           dotest devcom-17 "${testcvs} edit abc"
16147
16148           # Unedit of an unmodified file.
16149           dotest devcom-18 "${testcvs} unedit abc"
16150           dotest devcom-19 "${testcvs} edit abc"
16151
16152           echo changedabc >abc
16153           # Try to unedit a modified file; cvs should ask for confirmation
16154           dotest devcom-20 "echo no | ${testcvs} unedit abc" \
16155 "abc has been modified; revert changes? "
16156
16157           dotest devcom-21 "echo changedabc | cmp - abc"
16158
16159           # OK, now confirm the unedit
16160           dotest devcom-22 "echo yes | ${testcvs} unedit abc" \
16161 "abc has been modified; revert changes? "
16162
16163           dotest devcom-23 "echo abc | cmp - abc"
16164
16165           dotest devcom-24 "${testcvs} watchers" ''
16166
16167           # FIXME: This probably should be an error message instead
16168           # of silently succeeding and printing nothing.
16169           dotest devcom-a-nonexist "${testcvs} watchers nonexist" ''
16170
16171           dotest devcom-a1 "${testcvs} watch add" ''
16172           dotest devcom-a2 "${testcvs} watchers" \
16173 "abb    ${username}     edit    unedit  commit
16174 abc     ${username}     edit    unedit  commit"
16175           dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
16176           dotest devcom-a4 "${testcvs} watchers abb" \
16177 "abb    ${username}     edit    commit"
16178
16179           # Check tagging and checking out while we have a CVS
16180           # directory in the repository.
16181           dotest devcom-t0 "${testcvs} -q tag tag" \
16182 'T abb
16183 T abc'
16184           cd ../..
16185           mkdir 3
16186           cd 3
16187
16188           # Test commented out because the bug it tests for is not fixed
16189           # The error is:
16190           # cvs watchers: cannot open CVS/Entries for reading: No such file or directory
16191           # cvs: ../../work/ccvs/src/fileattr.c:75: fileattr_read: Assertion `fileattr_stored_repos != ((void *)0)' failed.
16192 :         dotest devcom-t-nonexist "${testcvs} watchers nonexist" fixme
16193
16194           dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
16195 'U first-dir/abb'
16196           cd ..
16197           # Since first-dir/abb is readonly, use -f.
16198           rm -rf 3
16199
16200           # Test checking out the directory rather than the file.
16201           mkdir 3
16202           cd 3
16203           dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
16204 'U first-dir/abb
16205 U first-dir/abc'
16206           cd ..
16207           # Since the files are readonly, use -f.
16208           rm -rf 3
16209
16210           # Now do it again, after removing the val-tags file created
16211           # by devcom-t1 to force CVS to search the repository
16212           # containing CVS directories.
16213           rm -f ${CVSROOT_DIRNAME}/CVSROOT/val-tags
16214           mkdir 3
16215           cd 3
16216           dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
16217 'U first-dir/abb
16218 U first-dir/abc'
16219           cd ..
16220           # Since the files are readonly, use -f.
16221           rm -rf 3
16222
16223           # Now remove all the file attributes
16224           cd 2/first-dir
16225           dotest devcom-b0 "${testcvs} watch off" ''
16226           dotest devcom-b1 "${testcvs} watch remove" ''
16227           # Test that CVS 1.6 and earlier can handle the repository.
16228           dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
16229
16230           # Now test watching just some, not all, files.
16231           dotest devcom-some0 "${testcvs} watch on abc" ''
16232           cd ../..
16233           mkdir 3
16234           cd 3
16235           dotest devcom-some1 "${testcvs} -q co first-dir" 'U first-dir/abb
16236 U first-dir/abc'
16237           dotest devcom-some2 "test -w first-dir/abb" ''
16238           dotest_fail devcom-some3 "test -w first-dir/abc" ''
16239           cd ..
16240
16241           if $keep; then
16242             echo Keeping ${TESTDIR} and exiting due to --keep
16243             exit 0
16244           fi
16245
16246           # Use -f because of the readonly files.
16247           rm -rf 1 2 3
16248           rm -rf ${CVSROOT_DIRNAME}/first-dir
16249           ;;
16250
16251         devcom2)
16252           # More watch tests, most notably setting watches on
16253           # files in various different states.
16254           mkdir ${CVSROOT_DIRNAME}/first-dir
16255           mkdir 1
16256           cd 1
16257           dotest devcom2-1 "${testcvs} -q co first-dir" ''
16258           cd first-dir
16259
16260           # This should probably be an error; setting a watch on a totally
16261           # unknown file is more likely to be a typo than intentional.
16262           # But that isn't the currently implemented behavior.
16263           dotest devcom2-2 "${testcvs} watch on w1" ''
16264
16265           touch w1 w2 w3 nw1
16266           dotest devcom2-3 "${testcvs} add w1 w2 w3 nw1" "${DOTSTAR}"
16267           # Letting the user set the watch here probably can be considered
16268           # a feature--although it leads to a few potentially strange
16269           # consequences like one user can set the watch and another actually
16270           # adds the file.
16271           dotest devcom2-4 "${testcvs} watch on w2" ''
16272           dotest devcom2-5 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
16273
16274           # Note that this test differs in a subtle way from devcom-some0;
16275           # in devcom-some0 the watch is creating a new fileattr file, and
16276           # here we are modifying an existing one.
16277           dotest devcom2-6 "${testcvs} watch on w3" ''
16278
16279           # Now test that all the watches got set on the correct files
16280           # FIXME: CVS should have a way to report whether watches are
16281           # set, I think.  The "check it out and see if it read-only" is
16282           # sort of OK, but is complicated by CVSREAD and doesn't help
16283           # if the file is added and not yet committed or some such.
16284           # Probably "cvs status" should report "watch: on" if watch is on
16285           # (and nothing if watch is off, so existing behavior is preserved).
16286           cd ../..
16287           mkdir 2
16288           cd 2
16289           dotest devcom2-7 "${testcvs} -q co first-dir" 'U first-dir/nw1
16290 U first-dir/w1
16291 U first-dir/w2
16292 U first-dir/w3'
16293           dotest devcom2-8 "test -w first-dir/nw1" ''
16294           dotest_fail devcom2-9 "test -w first-dir/w1" ''
16295           dotest_fail devcom2-10 "test -w first-dir/w2" ''
16296           dotest_fail devcom2-11 "test -w first-dir/w3" ''
16297
16298           cd first-dir
16299           # OK, now we want to try files in various states with cvs edit.
16300           dotest devcom2-12 "${testcvs} edit w4" \
16301 "${PROG} edit: no such file w4; ignored"
16302           # Try the same thing with a per-directory watch set.
16303           dotest devcom2-13 "${testcvs} watch on" ''
16304           dotest devcom2-14 "${testcvs} edit w5" \
16305 "${PROG} edit: no such file w5; ignored"
16306           dotest devcom2-15 "${testcvs} editors" ''
16307           dotest devcom2-16 "${testcvs} editors w4" ''
16308           # Make sure there are no droppings lying around
16309           dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
16310 "Fw1    _watched=
16311 Fw2     _watched=
16312 Fw3     _watched=
16313 Fnw1    _watched=
16314 D       _watched="
16315           cd ..
16316
16317           # Do a little error testing
16318           dotest devcom2-18 "${testcvs} -q co -d first+dir first-dir" \
16319 "U first${PLUS}dir/nw1
16320 U first${PLUS}dir/w1
16321 U first${PLUS}dir/w2
16322 U first${PLUS}dir/w3"
16323           cd first+dir
16324           dotest_fail devcom2-19 "${testcvs} edit" \
16325 "${PROG} \[[a-z]* aborted\]: current directory (${TESTDIR}/2/first${PLUS}dir) contains an invalid character (${PLUS},>;=\\\\t\\\\n)"
16326
16327           # Make sure there are no droppings lying around
16328           dotest devcom2-20 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
16329 "Fw1    _watched=
16330 Fw2     _watched=
16331 Fw3     _watched=
16332 Fnw1    _watched=
16333 D       _watched="
16334
16335           cd ../..
16336
16337           # Use -f because of the readonly files.
16338           rm -rf 1 2
16339           rm -rf ${CVSROOT_DIRNAME}/first-dir
16340           ;;
16341
16342         devcom3)
16343           # More watch tests, most notably handling of features designed
16344           # for future expansion.
16345           mkdir ${CVSROOT_DIRNAME}/first-dir
16346           mkdir 1
16347           cd 1
16348           dotest devcom3-1 "${testcvs} -q co first-dir" ''
16349           cd first-dir
16350
16351           touch w1 w2
16352           dotest devcom3-2 "${testcvs} add w1 w2" "${DOTSTAR}"
16353           dotest devcom3-3 "${testcvs} watch on w1 w2" ''
16354           dotest devcom3-4 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
16355
16356           # OK, since we are about to delve into CVS's internals, make
16357           # sure that we seem to be correct about how they work.
16358           dotest devcom3-5 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
16359 "Fw1    _watched=
16360 Fw2     _watched="
16361           # Now write a few more lines, just as if we were a newer version
16362           # of CVS implementing some new feature.
16363           cat <<'EOF' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
16364 Enew    line    here
16365 G@#$^!@#=&
16366 EOF
16367           # Now get CVS to write to the fileattr file....
16368           dotest devcom3-6 "${testcvs} watch off w1" ''
16369           # ...and make sure that it hasn't clobbered our new lines.
16370           # Note that writing these lines in another order would be OK
16371           # too.
16372           dotest devcom3-7 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
16373 "Fw2    _watched=
16374 G@#..!@#=&
16375 Enew    line    here"
16376
16377           # See what CVS does when a file name is duplicated.  The
16378           # behavior of all versions of CVS since file attributes were
16379           # implemented is that it nukes the duplications.  This seems
16380           # reasonable enough, although it means it isn't clear how
16381           # useful duplicates would be for purposes of future
16382           # expansion.  But in the interests of keeping behaviors
16383           # predictable, might as well test for it, I guess.
16384           echo 'Fw2     duplicate=' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
16385           dotest devcom3-8 "${testcvs} watch on w1" ''
16386           dotest devcom3-9 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
16387 "Fw2    _watched=
16388 Fw1     _watched=
16389 Enew    line    here
16390 G@#..!@#=&"
16391
16392           # Now test disconnected "cvs edit" and the format of the 
16393           # CVS/Notify file.
16394           if $remote; then
16395             CVS_SERVER_save=${CVS_SERVER}
16396             CVS_SERVER=${TESTDIR}/cvs-none; export CVS_SERVER
16397
16398             # The ${DOTSTAR} below matches the exact CVS server error message,
16399             # which in :fork: mode is:
16400             # "$PROG \[edit aborted\]: cannot exec $TESTDIR/cvs-none: ${DOTSTAR}",
16401             # but which is:
16402             # "bash2: line 1: $TESTDIR/cvs-none: No such file or directory"
16403             # when testing across an :ext:/ssh link to my Linux 2.4 box.
16404             #
16405             # I can't even test for the second part of the error message,
16406             # from the client, which varies more consistently, usually either
16407             # "end of file from server" (if the process doing the exec exits
16408             # before the parent gets around to sending data to it) or
16409             # "received broken pipe signal" (if it is the other way around),
16410             # since HP-UX fails to output it.
16411             dotest_fail devcom3-9ar "${testcvs} edit w1 2>/dev/null"
16412             dotest devcom3-9br "test -w w1" ""
16413             dotest devcom3-9cr "cat CVS/Notify" \
16414 "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"
16415             CVS_SERVER=${CVS_SERVER_save}; export CVS_SERVER
16416             dotest devcom3-9dr "${testcvs} -q update" ""
16417             dotest_fail devcom3-9er "test -f CVS/Notify" ""
16418             dotest devcom3-9fr "${testcvs} watchers w1" \
16419 "w1     ${username}     tedit   tunedit tcommit"
16420             dotest devcom3-9gr "${testcvs} unedit w1" ""
16421             dotest devcom3-9hr "${testcvs} watchers w1" ""
16422           fi
16423
16424           cd ../..
16425           # OK, now change the tab to a space, and see that CVS gives
16426           # a reasonable error (this is database corruption but CVS should
16427           # not lose its mind).
16428           sed -e 's/Fw2 /Fw2 /' <${CVSROOT_DIRNAME}/first-dir/CVS/fileattr \
16429             >${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new
16430           mv ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new \
16431             ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
16432           mkdir 2; cd 2
16433           dotest_fail devcom3-10 "${testcvs} -Q co ." \
16434 "${PROG} \[checkout aborted\]: file attribute database corruption: tab missing in ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr"
16435           cd ..
16436
16437           # Use -f because of the readonly files.
16438           rm -rf 1 2
16439           rm -rf ${CVSROOT_DIRNAME}/first-dir
16440           ;;
16441
16442         watch4)
16443           # More watch tests, including adding directories.
16444           mkdir 1; cd 1
16445           dotest watch4-0a "${testcvs} -q co -l ." ''
16446           mkdir first-dir
16447           dotest watch4-0b "${testcvs} add first-dir" \
16448 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16449
16450           cd first-dir
16451           dotest watch4-1 "${testcvs} watch on" ''
16452           # This is just like the 173 test
16453           touch file1
16454           dotest watch4-2 "${testcvs} add file1" \
16455 "${PROG} add: scheduling file .file1. for addition
16456 ${PROG} add: use .${PROG} commit. to add this file permanently"
16457           dotest watch4-3 "${testcvs} -q ci -m add" \
16458 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16459 done
16460 Checking in file1;
16461 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16462 initial revision: 1\.1
16463 done"
16464           # Now test the analogous behavior for directories.
16465           mkdir subdir
16466           dotest watch4-4 "${testcvs} add subdir" \
16467 "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
16468           cd subdir
16469           touch sfile
16470           dotest watch4-5 "${testcvs} add sfile" \
16471 "${PROG} add: scheduling file .sfile. for addition
16472 ${PROG} add: use .${PROG} commit. to add this file permanently"
16473           dotest watch4-6 "${testcvs} -q ci -m add" \
16474 "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
16475 done
16476 Checking in sfile;
16477 ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
16478 initial revision: 1\.1
16479 done"
16480           cd ../../..
16481           mkdir 2; cd 2
16482           dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
16483 U first-dir/subdir/sfile"
16484           dotest_fail watch4-8 "test -w first-dir/file1" ''
16485           dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
16486           cd first-dir
16487           dotest watch4-10 "${testcvs} edit file1" ''
16488           echo 'edited in 2' >file1
16489           cd ../..
16490
16491           cd 1/first-dir
16492           dotest watch4-11 "${testcvs} edit file1" ''
16493           echo 'edited in 1' >file1
16494           dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
16495 "Checking in file1;
16496 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16497 new revision: 1\.2; previous revision: 1\.1
16498 done"
16499           cd ../..
16500           cd 2/first-dir
16501           dotest watch4-13 "${testcvs} -q update" \
16502 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16503 retrieving revision 1\.1
16504 retrieving revision 1\.2
16505 Merging differences between 1\.1 and 1\.2 into file1
16506 rcsmerge: warning: conflicts during merge
16507 ${PROG} update: conflicts found in file1
16508 C file1"
16509           if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
16510             pass watch4-14
16511           else
16512             fail watch4-15
16513           fi
16514           # This could plausibly be defined to either go back to the revision
16515           # which was cvs edit'd (the status quo), or back to revision 1.2
16516           # (that is, the merge could update CVS/Base/file1).  We pick the
16517           # former because it is easier to implement, not because we have
16518           # thought much about which is better.
16519           dotest watch4-16 "cat file1" ''
16520           # Make sure CVS really thinks we are at 1.1.
16521           dotest watch4-17 "${testcvs} -q update" "U file1"
16522           dotest watch4-18 "cat file1" "edited in 1"
16523           cd ../..
16524
16525           # As a sanity check, make sure we are in the right place.
16526           dotest watch4-cleanup-1 "test -d 1" ''
16527           dotest watch4-cleanup-1 "test -d 2" ''
16528           # Specify -f because of the readonly files.
16529           rm -rf 1 2
16530           rm -rf ${CVSROOT_DIRNAME}/first-dir
16531           ;;
16532
16533         watch5)
16534           # This test was designed to catch a problem in server
16535           # mode where an 'cvs edit'd file disappeared from the
16536           # CVS/Base directory when 'cvs status' or 'cvs update'
16537           # was called on the file after the file was touched.
16538           #
16539           # This test is still here to prevent the bug from
16540           # being reintroduced.
16541           #
16542           # The rationale for having CVS/Base stay around is that
16543           # CVS/Base should be there if "cvs edit" has been run (this
16544           # may be helpful as a "cvs editors" analogue, it is
16545           # client-side and based on working directory not username;
16546           # but more importantly, it isn't clear why a "cvs status"
16547           # would act like an unedit, and even if it does, it would
16548           # need to make the file read-only again).
16549
16550           mkdir watch5; cd watch5
16551           dotest watch5-0a "${testcvs} -q co -l ." ''
16552           mkdir first-dir
16553           dotest watch5-0b "${testcvs} add first-dir" \
16554 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16555
16556           cd first-dir
16557           dotest watch5-1 "${testcvs} watch on" ''
16558           # This is just like the 173 test
16559           touch file1
16560           dotest watch5-2 "${testcvs} add file1" \
16561 "${PROG} add: scheduling file .file1. for addition
16562 ${PROG} add: use .${PROG} commit. to add this file permanently"
16563           dotest watch5-3 "${testcvs} -q ci -m add" \
16564 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16565 done
16566 Checking in file1;
16567 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16568 initial revision: 1\.1
16569 done"
16570           dotest watch5-4 "${testcvs} edit file1" ''
16571           dotest watch5-5 "test -f CVS/Base/file1" ''
16572           if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
16573                 pass watch5-6
16574           else
16575                 fail watch5-6
16576           fi
16577           dotest watch5-7 "test -f CVS/Base/file1" ''
16578
16579           # Here's where the file used to dissappear
16580           touch file1
16581           if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
16582                 pass watch5-8
16583           else
16584                 fail watch5-8
16585           fi
16586           dotest watch5-10 "test -f CVS/Base/file1" ''
16587
16588           # Make sure update won't remove the file either
16589           touch file1
16590           dotest watch5-11 "${testcvs} -q up" ''
16591           dotest watch5-12 "test -f CVS/Base/file1" ''
16592
16593           cd ../..
16594           rm -r watch5
16595           rm -rf ${CVSROOT_DIRNAME}/first-dir
16596           ;;
16597
16598
16599
16600         watch6)
16601           # Check that `cvs watch on' does not reset the fileattr file.
16602           mkdir watch6; cd watch6
16603
16604           dotest watch6-setup-1 "$testcvs -Q co -ldtop ."
16605           cd top
16606           mkdir watch6
16607           dotest watch6-setup-2 "$testcvs -Q add watch6"
16608
16609           cd ..
16610           dotest watch6-setup-3 "$testcvs -Q co watch6"
16611           cd watch6
16612
16613           mkdir subdir
16614           dotest watch6-setup-4 "$testcvs -Q add subdir"
16615           cd subdir
16616
16617           # START watch add/remove sequence
16618           dotest watch6-1 "$testcvs -Q watch add"
16619           dotest watch6-2 \
16620 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16621
16622           dotest watch6-3 "$testcvs watch on"
16623           dotest watch6-4 \
16624 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16625           dotest watch6-5 \
16626 "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16627
16628           dotest watch6-6 "$testcvs watch off"
16629           dotest watch6-7 \
16630 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16631           dotest_fail watch6-8 \
16632 "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16633
16634           dotest watch6-9 "$testcvs watch remove"
16635           dotest_fail watch6-10 \
16636 "test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS"
16637           dotest_fail watch6-11 \
16638 "test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr"
16639           # END watch add/remove sequence
16640
16641           echo Hi there >afile
16642           dotest watch6-12 "$testcvs -Q add afile"
16643           dotest watch6-13 "$testcvs ci -m 'A file' afile" \
16644 "RCS file: $CVSROOT_DIRNAME/watch6/subdir/afile,v
16645 done
16646 Checking in afile;
16647 $CVSROOT_DIRNAME/watch6/subdir/afile,v  <--  afile
16648 initial revision: 1\.1
16649 done"
16650
16651           # START watch add/remove sequence
16652           dotest watch6-14 "$testcvs -Q watch add"
16653           dotest watch6-15 \
16654 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16655
16656           dotest watch6-16 "$testcvs watch on"
16657           dotest watch6-17 \
16658 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16659           dotest watch6-18 \
16660 "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16661
16662           dotest watch6-19 "$testcvs watch off"
16663           dotest watch6-20 \
16664 "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16665           dotest_fail watch6-21 \
16666 "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
16667
16668           dotest watch6-22 "$testcvs watch remove"
16669           dotest_fail watch6-23 \
16670 "test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS"
16671           dotest_fail watch6-24 \
16672 "test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr"
16673           # END watch add/remove sequence
16674
16675           if $keep; then
16676             echo Keeping $TESTDIR and exiting due to --keep
16677             exit 0
16678           fi
16679           cd ../../..
16680           rm -r watch6
16681           rm -rf $CVSROOT_DIRNAME/watch6
16682           ;;
16683
16684
16685
16686         unedit-without-baserev)
16687           mkdir 1; cd 1
16688           module=x
16689
16690           file=m
16691           echo foo > $file
16692           dotest unedit-without-baserev-1 \
16693             "$testcvs -Q import -m . $module X Y" ''
16694           dotest unedit-without-baserev-2 "$testcvs -Q co $module" ''
16695           cd $module
16696
16697           dotest unedit-without-baserev-3 "$testcvs -Q edit $file" ''
16698
16699           echo add a line >> $file
16700           rm -f CVS/Baserev
16701
16702           # This will fail on most systems.
16703           echo "yes" | dotest unedit-without-baserev-4 "${testcvs} -Q unedit $file" \
16704 "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
16705 ${PROG} unedit: run update to complete the unedit"
16706
16707           # SunOS4.1.4 systems make it this far, but with a corrupted
16708           # CVS/Entries file.  Demonstrate the corruption!
16709           dotest unedit-without-baserev-5 "cat CVS/Entries" \
16710             "/$file/1\.1\.1\.1/${DOTSTAR}"
16711
16712           dotest unedit-without-baserev-6 "${testcvs} -q update" \
16713 "${PROG} update: warning: m was lost
16714 U m"
16715
16716           # OK, those were the easy cases.  Now tackle the hard one
16717           # (the reason that CVS/Baserev was invented rather than just
16718           # getting the revision from CVS/Entries).  This is very
16719           # similar to watch4-10 through watch4-18 but with Baserev
16720           # missing.
16721           cd ../..
16722           mkdir 2; cd 2
16723           dotest unedit-without-baserev-7 "${testcvs} -Q co x" ''
16724           cd x
16725
16726           dotest unedit-without-baserev-10 "${testcvs} edit m" ''
16727           echo 'edited in 2' >m
16728           cd ../..
16729
16730           cd 1/x
16731           dotest unedit-without-baserev-11 "${testcvs} edit m" ''
16732           echo 'edited in 1' >m
16733           dotest unedit-without-baserev-12 "${testcvs} -q ci -m edit-in-1" \
16734 "Checking in m;
16735 ${CVSROOT_DIRNAME}/x/m,v  <--  m
16736 new revision: 1\.2; previous revision: 1\.1
16737 done"
16738           cd ../..
16739           cd 2/x
16740           dotest unedit-without-baserev-13 "${testcvs} -q update" \
16741 "RCS file: ${CVSROOT_DIRNAME}/x/m,v
16742 retrieving revision 1\.1\.1\.1
16743 retrieving revision 1\.2
16744 Merging differences between 1\.1\.1\.1 and 1\.2 into m
16745 rcsmerge: warning: conflicts during merge
16746 ${PROG} update: conflicts found in m
16747 C m"
16748           rm CVS/Baserev
16749           dotest unedit-without-baserev-14 "echo yes | ${testcvs} unedit m" \
16750 "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
16751 ${PROG} unedit: run update to complete the unedit"
16752           dotest unedit-without-baserev-15 "${testcvs} -q update" \
16753 "${PROG} update: warning: m was lost
16754 U m"
16755           # The following tests are kind of degenerate compared with
16756           # watch4-16 through watch4-18 but might as well make sure that
16757           # nothing seriously wrong has happened to the working directory.
16758           dotest unedit-without-baserev-16 "cat m" 'edited in 1'
16759           # Make sure CVS really thinks we are at 1.2.
16760           dotest unedit-without-baserev-17 "${testcvs} -q update" ""
16761           dotest unedit-without-baserev-18 "cat m" "edited in 1"
16762
16763           cd ../..
16764           rm -rf 1
16765           rm -r 2
16766           rm -rf ${CVSROOT_DIRNAME}/$module
16767           ;;
16768
16769         ignore)
16770           # On Windows, we can't check out CVSROOT, because the case
16771           # insensitivity means that this conflicts with cvsroot.
16772           mkdir ignore
16773           cd ignore
16774
16775           dotest ignore-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
16776           cd CVSROOT
16777           echo rootig.c >cvsignore
16778           dotest ignore-2 "${testcvs} add cvsignore" \
16779 "${PROG}"' add: scheduling file `cvsignore'"'"' for addition
16780 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
16781
16782           # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
16783           # Accept either.
16784           dotest ignore-3 " ${testcvs} ci -m added" \
16785 "${PROG} [a-z]*: Examining \.
16786 RCS file: ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v
16787 done
16788 Checking in cvsignore;
16789 ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v  <--  cvsignore
16790 initial revision: 1\.1
16791 done
16792 ${PROG} commit: Rebuilding administrative file database"
16793
16794           cd ..
16795           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
16796               pass ignore-4
16797           else
16798               fail ignore-4
16799           fi
16800
16801           # CVS looks at the home dir from getpwuid, not HOME (is that correct
16802           # behavior?), so this is hard to test and we won't try.
16803           # echo foobar.c >${HOME}/.cvsignore
16804           CVSIGNORE=envig.c; export CVSIGNORE
16805           mkdir dir-to-import
16806           cd dir-to-import
16807           touch foobar.c bar.c rootig.c defig.o envig.c optig.c
16808           # We use sort because we can't predict the order in which
16809           # the files will be listed.
16810           dotest_sort ignore-5 "${testcvs} import -m m -I optig.c ignore/first-dir tag1 tag2" \
16811 '
16812
16813 I ignore/first-dir/defig.o
16814 I ignore/first-dir/envig.c
16815 I ignore/first-dir/optig.c
16816 I ignore/first-dir/rootig.c
16817 N ignore/first-dir/bar.c
16818 N ignore/first-dir/foobar.c
16819 No conflicts created by this import'
16820           dotest_sort ignore-6 "${testcvs} import -m m -I ! ignore/second-dir tag3 tag4" \
16821 '
16822
16823 N ignore/second-dir/bar.c
16824 N ignore/second-dir/defig.o
16825 N ignore/second-dir/envig.c
16826 N ignore/second-dir/foobar.c
16827 N ignore/second-dir/optig.c
16828 N ignore/second-dir/rootig.c
16829 No conflicts created by this import'
16830           cd ..
16831           rm -r dir-to-import
16832
16833           mkdir 1
16834           cd 1
16835           dotest ignore-7 "${testcvs} -q co -dsecond-dir ignore/second-dir" \
16836 'U second-dir/bar.c
16837 U second-dir/defig.o
16838 U second-dir/envig.c
16839 U second-dir/foobar.c
16840 U second-dir/optig.c
16841 U second-dir/rootig.c'
16842           dotest ignore-8 "${testcvs} -q co -dfirst-dir ignore/first-dir" 'U first-dir/bar.c
16843 U first-dir/foobar.c'
16844           cd first-dir
16845           touch rootig.c defig.o envig.c optig.c notig.c
16846           dotest ignore-9 "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
16847           # The fact that CVS requires us to specify -I CVS here strikes me
16848           # as a bug.
16849           dotest_sort ignore-10 "${testcvs} -q update -I ! -I CVS" \
16850 "${QUESTION} defig.o
16851 ${QUESTION} envig.c
16852 ${QUESTION} notig.c
16853 ${QUESTION} optig.c
16854 ${QUESTION} rootig.c"
16855
16856           # Now test that commands other than update also print "? notig.c"
16857           # where appropriate.  Only test this for remote, because local
16858           # CVS only prints it on update.
16859           rm optig.c
16860           if $remote; then
16861             dotest ignore-11r "${testcvs} -q diff" "${QUESTION} notig.c"
16862
16863             # Force the server to be contacted.  Ugh.  Having CVS
16864             # contact the server for the sole purpose of checking
16865             # the CVSROOT/cvsignore file does not seem like such a
16866             # good idea, so I imagine this will continue to be
16867             # necessary.  Oh well, at least we test CVS's ablity to
16868             # handle a file with a modified timestamp but unmodified
16869             # contents.
16870             touch bar.c
16871
16872             dotest ignore-11r "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
16873           fi
16874
16875           # now test .cvsignore files
16876           cd ..
16877           echo notig.c >first-dir/.cvsignore
16878           echo foobar.c >second-dir/.cvsignore
16879           touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
16880           dotest_sort ignore-12 "${testcvs} -qn update" \
16881 "${QUESTION} first-dir/.cvsignore
16882 ${QUESTION} second-dir/.cvsignore
16883 ${QUESTION} second-dir/notig.c"
16884           dotest_sort ignore-13 "${testcvs} -qn update -I! -I CVS" \
16885 "${QUESTION} first-dir/.cvsignore
16886 ${QUESTION} first-dir/defig.o
16887 ${QUESTION} first-dir/envig.c
16888 ${QUESTION} first-dir/rootig.c
16889 ${QUESTION} second-dir/.cvsignore
16890 ${QUESTION} second-dir/notig.c"
16891
16892           echo yes | dotest ignore-14 "${testcvs} release -d first-dir" \
16893 "${QUESTION} \.cvsignore
16894 You have \[0\] altered files in this repository.
16895 Are you sure you want to release (and delete) directory .first-dir': "
16896
16897           echo add a line >>second-dir/foobar.c
16898           rm second-dir/notig.c second-dir/.cvsignore
16899           echo yes | dotest ignore-15 "${testcvs} release -d second-dir" \
16900 "M foobar.c
16901 You have \[1\] altered files in this repository.
16902 Are you sure you want to release (and delete) directory .second-dir': "
16903
16904           cd ../..
16905           if $keep; then :; else
16906             rm -r ignore
16907             rm -rf ${CVSROOT_DIRNAME}/ignore
16908           fi
16909           ;;
16910
16911         ignore-on-branch)
16912           # Test that CVS _doesn't_ ignore files on branches because they were
16913           # added to the trunk.
16914           mkdir ignore-on-branch; cd ignore-on-branch
16915           mkdir $CVSROOT_DIRNAME/ignore-on-branch
16916
16917           # create file1 & file2 on trunk
16918           dotest ignore-on-branch-setup-1 "$testcvs -q co -dsetup ignore-on-branch" ''
16919           cd setup
16920           echo file1 >file1 
16921           dotest ignore-on-branch-setup-2 "$testcvs -q add file1" \
16922 "${PROG} add: use .${PROG} commit. to add this file permanently"
16923           dotest ignore-on-branch-setup-3 "$testcvs -q ci -mfile1 file1" \
16924 "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file1,v
16925 done
16926 Checking in file1;
16927 $CVSROOT_DIRNAME/ignore-on-branch/file1,v  <--  file1
16928 initial revision: 1\.1
16929 done"
16930           dotest ignore-on-branch-setup-4 "$testcvs -q tag -b branch" 'T file1'
16931           echo file2 >file2 
16932           dotest ignore-on-branch-setup-5 "$testcvs -q add file2" \
16933 "${PROG} add: use .${PROG} commit. to add this file permanently"
16934           dotest ignore-on-branch-setup-6 "$testcvs -q ci -mtrunk file2" \
16935 "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file2,v
16936 done
16937 Checking in file2;
16938 $CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
16939 initial revision: 1\.1
16940 done"
16941
16942           cd ..
16943
16944           # Check out branch.
16945           #
16946           # - This was the original failure case - file2 would not be flagged
16947           #   with a '?'
16948           dotest ignore-on-branch-1 "$testcvs -q co -rbranch ignore-on-branch" \
16949 'U ignore-on-branch/file1'
16950           cd ignore-on-branch
16951           echo file2 on branch >file2 
16952           dotest ignore-on-branch-2 "$testcvs -nq update" '? file2'
16953
16954           # Now set up for a join.  One of the original fixes for this would
16955           # print out a 'U' and a '?' during a join which added a file.
16956           if $remote; then
16957             dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" \
16958 '? file2
16959 T file1'
16960           else
16961             dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" 'T file1'
16962           fi
16963           dotest ignore-on-branch-4 "$testcvs -q add file2" \
16964 "${PROG} add: use .${PROG} commit. to add this file permanently"
16965           dotest ignore-on-branch-5 "$testcvs -q ci -mbranch file2" \
16966 "Checking in file2;
16967 $CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
16968 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
16969 done"
16970           dotest ignore-on-branch-6 "$testcvs -q up -rbranch2" \
16971 "[UP] file1
16972 $PROG update: file2 is no longer in the repository"
16973           dotest ignore-on-branch-7 "$testcvs -q up -jbranch" 'U file2'
16974
16975           cd ../..
16976           if $keep; then :; else
16977             rm -r ignore-on-branch
16978             rm -rf $CVSROOT_DIRNAME/ignore-on-branch
16979           fi
16980           ;;
16981
16982         binfiles)
16983           # Test cvs's ability to handle binary files.
16984           # List of binary file tests:
16985           #   * conflicts, "cvs admin": binfiles
16986           #   * branching and joining: binfiles2
16987           #   * adding and removing files: binfiles3
16988           #   * -k wrappers: binwrap, binwrap2, binwrap3
16989           #   * "cvs import" and wrappers: binwrap, binwrap2, binwrap3
16990           #   * -k option to "cvs import": none yet, as far as I know.
16991           mkdir ${CVSROOT_DIRNAME}/first-dir
16992           mkdir 1; cd 1
16993           dotest binfiles-1 "${testcvs} -q co first-dir" ''
16994           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
16995             </dev/null | ${TR} '@' '\000' >binfile.dat
16996           cat binfile.dat binfile.dat >binfile2.dat
16997           cd first-dir
16998           cp ../binfile.dat binfile
16999           dotest binfiles-2 "${testcvs} add -kb binfile" \
17000 "${PROG}"' add: scheduling file `binfile'\'' for addition
17001 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
17002           dotest binfiles-3 "${testcvs} -q ci -m add-it" \
17003 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17004 done
17005 Checking in binfile;
17006 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17007 initial revision: 1\.1
17008 done"
17009           cd ../..
17010           mkdir 2; cd 2
17011           dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
17012           cd first-dir
17013           dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
17014           # Testing that sticky options is -kb is the closest thing we have
17015           # to testing that binary files work right on non-unix machines
17016           # (until there is automated testing for such machines, of course).
17017           dotest binfiles-5.5 "${testcvs} status binfile" \
17018 "===================================================================
17019 File: binfile           Status: Up-to-date
17020
17021    Working revision:    1\.1.*
17022    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17023    Sticky Tag:          (none)
17024    Sticky Date:         (none)
17025    Sticky Options:      -kb"
17026
17027           # Test that "-kk" does not override "-kb"
17028           cd ../..
17029           mkdir 2a; cd 2a
17030           dotest binfiles-5.5a0 "${testcvs} -q co -kk first-dir" 'U first-dir/binfile'
17031           cd first-dir
17032           # Testing that sticky options is -kb is the closest thing we have
17033           # to testing that binary files work right on non-unix machines
17034           # (until there is automated testing for such machines, of course).
17035           dotest binfiles-5.5a1 "${testcvs} status binfile" \
17036 "===================================================================
17037 File: binfile           Status: Up-to-date
17038
17039    Working revision:    1\.1.*
17040    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17041    Sticky Tag:          (none)
17042    Sticky Date:         (none)
17043    Sticky Options:      -kb"
17044
17045           # Test whether the default options from the RCS file are
17046           # also used when operating on files instead of whole
17047           # directories
17048           cd ../..
17049           mkdir 3; cd 3
17050           dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
17051 'U first-dir/binfile'
17052           cd first-dir
17053           dotest binfiles-5.5b1 "${testcvs} status binfile" \
17054 "===================================================================
17055 File: binfile           Status: Up-to-date
17056
17057    Working revision:    1\.1.*
17058    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17059    Sticky Tag:          (none)
17060    Sticky Date:         (none)
17061    Sticky Options:      -kb"
17062           cd ../..
17063           rm -r 3
17064           # test that "-kk" does not override "-kb"
17065           mkdir 3; cd 3
17066           dotest binfiles-5.5c0 "${testcvs} -q co -kk first-dir/binfile" \
17067 'U first-dir/binfile'
17068           cd first-dir
17069           dotest binfiles-5.5c1 "${testcvs} status binfile" \
17070 "===================================================================
17071 File: binfile           Status: Up-to-date
17072
17073    Working revision:    1\.1.*
17074    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17075    Sticky Tag:          (none)
17076    Sticky Date:         (none)
17077    Sticky Options:      -kb"
17078           cd ../..
17079           rm -r 3
17080           cd 2/first-dir
17081
17082           cp ../../1/binfile2.dat binfile
17083           dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
17084 "Checking in binfile;
17085 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17086 new revision: 1\.2; previous revision: 1\.1
17087 done"
17088           cd ../../1/first-dir
17089           dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
17090           dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
17091
17092           # Now test handling of conflicts with binary files.
17093           cp ../binfile.dat binfile
17094           dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
17095 "Checking in binfile;
17096 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17097 new revision: 1\.3; previous revision: 1\.2
17098 done"
17099           cd ../../2/first-dir
17100           echo 'edits in dir 2' >binfile
17101           dotest binfiles-con1 "${testcvs} -q update" \
17102 "$PROG update: nonmergeable file needs merge
17103 ${PROG} update: revision 1\.3 from repository is now in binfile
17104 ${PROG} update: file from working directory is now in \.#binfile\.1\.2
17105 C binfile"
17106
17107           dotest_fail binfiles-con1b "$testcvs -q up" "C binfile"
17108
17109           dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
17110           dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
17111
17112           cp ../../1/binfile2.dat binfile
17113           dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
17114 "Checking in binfile;
17115 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17116 new revision: 1\.4; previous revision: 1\.3
17117 done"
17118           cd ../../1/first-dir
17119           dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
17120
17121           dotest binfiles-9 "${testcvs} -q update -A" ''
17122           # "-kk" no longer does anything with "-kb"
17123           dotest binfiles-10 "${testcvs} -q update -kk" ''
17124           dotest binfiles-11 "${testcvs} -q update" ''
17125           # "-kk" no longer does anything with "-kb"
17126           dotest binfiles-12 "${testcvs} -q update -A" ''
17127           dotest binfiles-13 "${testcvs} -q update -A" ''
17128
17129           cd ../..
17130
17131           mkdir 3
17132           cd 3
17133           dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
17134 'U first-dir/binfile'
17135           cd first-dir
17136           dotest binfiles-13a1 "${testcvs} status binfile" \
17137 "===================================================================
17138 File: binfile           Status: Up-to-date
17139
17140    Working revision:    1\.4.*
17141    Repository revision: 1\.4    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17142    Sticky Tag:          HEAD (revision: 1\.4)
17143    Sticky Date:         (none)
17144    Sticky Options:      -kb"
17145           cd ../..
17146           rm -r 3
17147
17148           cd 2/first-dir
17149           echo 'this file is $''RCSfile$' >binfile
17150           dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
17151 "Checking in binfile;
17152 ${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17153 new revision: 1\.5; previous revision: 1\.4
17154 done"
17155           dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
17156           # See binfiles-5.5 for discussion of -kb.
17157           dotest binfiles-14c "${testcvs} status binfile" \
17158 "===================================================================
17159 File: binfile           Status: Up-to-date
17160
17161    Working revision:    1\.5.*
17162    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17163    Sticky Tag:          (none)
17164    Sticky Date:         (none)
17165    Sticky Options:      -kb"
17166           dotest binfiles-14d "${testcvs} admin -kv binfile" \
17167 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17168 done"
17169           # cvs admin doesn't change the checked-out file or its sticky
17170           # kopts.  There probably should be a way which does (but
17171           # what if the file is modified?  And do we try to version
17172           # control the kopt setting?)
17173           dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
17174           dotest binfiles-14f "${testcvs} status binfile" \
17175 "===================================================================
17176 File: binfile           Status: Up-to-date
17177
17178    Working revision:    1\.5.*
17179    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17180    Sticky Tag:          (none)
17181    Sticky Date:         (none)
17182    Sticky Options:      -kb"
17183           dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
17184           dotest binfiles-14h "cat binfile" 'this file is binfile,v'
17185           dotest binfiles-14i "${testcvs} status binfile" \
17186 "===================================================================
17187 File: binfile           Status: Up-to-date
17188
17189    Working revision:    1\.5.*
17190    Repository revision: 1\.5    ${CVSROOT_DIRNAME}/first-dir/binfile,v
17191    Sticky Tag:          (none)
17192    Sticky Date:         (none)
17193    Sticky Options:      -kv"
17194
17195           # Do sticky options work when used with 'cvs update'?
17196           echo "Not a binary file." > nibfile
17197           dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
17198 "${PROG} add: use .${PROG} commit. to add this file permanently"
17199           dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
17200             "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
17201 done
17202 Checking in nibfile;
17203 ${CVSROOT_DIRNAME}/first-dir/nibfile,v  <--  nibfile
17204 initial revision: 1\.1
17205 done"
17206           dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
17207             '[UP] nibfile'
17208           dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
17209 "===================================================================
17210 File: nibfile           Status: Up-to-date
17211
17212    Working revision:    1\.1.*
17213    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
17214    Sticky Tag:          (none)
17215    Sticky Date:         (none)
17216    Sticky Options:      -kb"
17217
17218           # Now test that -A can clear the sticky option.
17219           dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
17220 "[UP] nibfile"
17221           dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
17222 "===================================================================
17223 File: nibfile           Status: Up-to-date
17224
17225    Working revision:    1\.1.*
17226    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
17227    Sticky Tag:          (none)
17228    Sticky Date:         (none)
17229    Sticky Options:      (none)"
17230           dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
17231 "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
17232 done"
17233           dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
17234           dotest binfiles-17 "${testcvs} -q status nibfile" \
17235 "===================================================================
17236 File: nibfile           Status: Up-to-date
17237
17238    Working revision:    1\.1.*
17239    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/nibfile,v
17240    Sticky Tag:          (none)
17241    Sticky Date:         (none)
17242    Sticky Options:      -kb"
17243
17244           dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
17245 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17246 deleting revision 1\.5
17247 deleting revision 1\.4
17248 done"
17249           dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
17250 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17251 deleting revision 1\.2
17252 deleting revision 1\.1
17253 done"
17254           dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
17255 RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17256 Working file: binfile
17257 head: 1\.3
17258 branch:
17259 locks: strict
17260 access list:
17261 keyword substitution: v
17262 total revisions: 1
17263 ============================================================================="
17264
17265           # Check that the contents were right.  This isn't the hard case
17266           # (in which RCS_delete_revs does a diff), but might as well.
17267           dotest binfiles-o4 "${testcvs} -q update binfile" "U binfile"
17268           dotest binfiles-o5 "cmp binfile ../../1/binfile.dat" ""
17269
17270           cd ../..
17271           rm -rf ${CVSROOT_DIRNAME}/first-dir
17272           rm -r 1
17273           rm -r 2
17274           ;;
17275
17276         binfiles2)
17277           # Test cvs's ability to handle binary files, particularly branching
17278           # and joining.  The key thing we are worrying about is that CVS
17279           # doesn't print "cannot merge binary files" or some such, in 
17280           # situations where no merging is required.
17281           # See also "join" which does this with non-binary files.
17282           #
17283           # Cases (we are merging from the branch to the trunk):
17284           # binfile.dat) File added on branch, not on trunk.
17285           #      File should be marked for addition.
17286           # brmod) File modified on branch, not on trunk.
17287           #      File should be copied over to trunk (no merging is needed).
17288           # brmod-trmod) File modified on branch, also on trunk.
17289           #      This is a conflict.  Present the user with both files and
17290           #      let them figure it out.
17291           # brmod-wdmod) File modified on branch, not modified in the trunk
17292           #      repository, but modified in the (trunk) working directory.
17293           #      This is also a conflict.
17294
17295           mkdir ${CVSROOT_DIRNAME}/first-dir
17296           mkdir 1; cd 1
17297           dotest binfiles2-1 "${testcvs} -q co first-dir" ''
17298           cd first-dir
17299
17300           # The most important thing here is that binfile, binfile2, &c
17301           # each be distinct from each other.  We also make sure to include
17302           # a few likely end-of-line patterns to make sure nothing is
17303           # being munged as if in text mode.
17304           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
17305             </dev/null | ${TR} '@' '\000' >../binfile
17306           cat ../binfile ../binfile >../binfile2
17307           cat ../binfile2 ../binfile >../binfile3
17308
17309           # FIXCVS: unless a branch has at least one file on it,
17310           # tag_check_valid won't know it exists.  So if brmod didn't
17311           # exist, we would have to invent it.
17312           cp ../binfile brmod
17313           cp ../binfile brmod-trmod
17314           cp ../binfile brmod-wdmod
17315           dotest binfiles2-1a \
17316 "${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
17317 "${PROG} add: scheduling file .brmod. for addition
17318 ${PROG} add: scheduling file .brmod-trmod. for addition
17319 ${PROG} add: scheduling file .brmod-wdmod. for addition
17320 ${PROG} add: use .${PROG} commit. to add these files permanently"
17321           dotest binfiles2-1b "${testcvs} -q ci -m add" \
17322 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
17323 done
17324 Checking in brmod;
17325 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17326 initial revision: 1\.1
17327 done
17328 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17329 done
17330 Checking in brmod-trmod;
17331 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17332 initial revision: 1\.1
17333 done
17334 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
17335 done
17336 Checking in brmod-wdmod;
17337 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17338 initial revision: 1\.1
17339 done"
17340           dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
17341 T brmod-trmod
17342 T brmod-wdmod'
17343           dotest binfiles2-3 "$testcvs -q update -r br" \
17344 'U brmod
17345 U brmod-trmod
17346 U brmod-wdmod'
17347           cp ../binfile binfile.dat
17348           dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
17349 "${PROG} add: scheduling file .binfile\.dat. for addition on branch .br.
17350 ${PROG} add: use .${PROG} commit. to add this file permanently"
17351           cp ../binfile2 brmod
17352           cp ../binfile2 brmod-trmod
17353           cp ../binfile2 brmod-wdmod
17354           dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
17355 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v
17356 done
17357 Checking in binfile\.dat;
17358 ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v  <--  binfile\.dat
17359 new revision: 1\.1\.2\.1; previous revision: 1\.1
17360 done
17361 Checking in brmod;
17362 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17363 new revision: 1\.1\.2\.1; previous revision: 1\.1
17364 done
17365 Checking in brmod-trmod;
17366 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17367 new revision: 1\.1\.2\.1; previous revision: 1\.1
17368 done
17369 Checking in brmod-wdmod;
17370 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17371 new revision: 1\.1\.2\.1; previous revision: 1\.1
17372 done"
17373           dotest binfiles2-6 "${testcvs} -q update -A" \
17374 "${PROG} update: binfile\.dat is no longer in the repository
17375 [UP] brmod
17376 [UP] brmod-trmod
17377 [UP] brmod-wdmod"
17378           dotest_fail binfiles2-7 "test -f binfile.dat" ''
17379           dotest binfiles2-7-brmod "cmp ../binfile brmod"
17380           cp ../binfile3 brmod-trmod
17381           dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
17382 "Checking in brmod-trmod;
17383 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17384 new revision: 1\.2; previous revision: 1\.1
17385 done"
17386           cp ../binfile3 brmod-wdmod
17387
17388           dotest binfiles2-8 "${testcvs} -q update -j br" \
17389 "U binfile\.dat
17390 U brmod
17391 ${PROG} update: nonmergeable file needs merge
17392 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
17393 ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
17394 C brmod-trmod
17395 M brmod-wdmod
17396 ${PROG} update: nonmergeable file needs merge
17397 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
17398 ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
17399 C brmod-wdmod"
17400
17401           dotest binfiles2-9 "cmp ../binfile binfile.dat"
17402           dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
17403           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
17404           dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
17405           dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
17406           dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
17407
17408           # Test that everything was properly scheduled.
17409           dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
17410 "Checking in binfile\.dat;
17411 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
17412 new revision: 1\.2; previous revision: 1\.1
17413 done
17414 Checking in brmod;
17415 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17416 new revision: 1\.2; previous revision: 1\.1
17417 done
17418 Checking in brmod-trmod;
17419 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17420 new revision: 1\.3; previous revision: 1\.2
17421 done
17422 Checking in brmod-wdmod;
17423 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17424 new revision: 1\.2; previous revision: 1\.1
17425 done"
17426
17427           dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
17428 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17429 deleting revision 1\.2
17430 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v: can't remove branch point 1\.1
17431 ${PROG} admin: RCS file for .brmod-trmod. not modified\."
17432           dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
17433 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17434 deleting revision 1\.1\.2\.1
17435 done"
17436           dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
17437 "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17438 deleting revision 1\.2
17439 deleting revision 1\.1
17440 done"
17441           dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
17442 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17443 Working file: brmod-trmod
17444 head: 1\.3
17445 branch:
17446 locks: strict
17447 access list:
17448 keyword substitution: b
17449 total revisions: 1;     selected revisions: 1
17450 description:
17451 ----------------------------
17452 revision 1\.3
17453 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
17454 checkin
17455 ============================================================================="
17456           cd ..
17457           cd ..
17458
17459           rm -rf ${CVSROOT_DIRNAME}/first-dir
17460           rm -r 1
17461           ;;
17462
17463         binfiles3)
17464           # More binary file tests, especially removing, adding, &c.
17465           # See "binfiles" for a list of binary file tests.
17466           mkdir ${CVSROOT_DIRNAME}/first-dir
17467           mkdir 1; cd 1
17468           dotest binfiles3-1 "${testcvs} -q co first-dir" ''
17469           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
17470             </dev/null | ${TR} '@' '\000' >binfile.dat
17471           cd first-dir
17472           echo hello >file1
17473           dotest binfiles3-2 "${testcvs} add file1" \
17474 "${PROG} add: scheduling file .file1. for addition
17475 ${PROG} add: use .${PROG} commit. to add this file permanently"
17476           dotest binfiles3-3 "${testcvs} -q ci -m add-it" \
17477 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17478 done
17479 Checking in file1;
17480 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17481 initial revision: 1\.1
17482 done"
17483           rm file1
17484           dotest binfiles3-4 "${testcvs} rm file1" \
17485 "${PROG} remove: scheduling .file1. for removal
17486 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
17487           dotest binfiles3-5 "${testcvs} -q ci -m remove-it" \
17488 "Removing file1;
17489 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17490 new revision: delete; previous revision: 1\.1
17491 done"
17492           cp ../binfile.dat file1
17493           dotest binfiles3-6 "${testcvs} add -kb file1" \
17494 "${PROG} add: Re-adding file .file1. (in place of dead revision 1\.2)\.
17495 ${PROG} add: use .${PROG} commit. to add this file permanently"
17496           # The idea behind this test is to make sure that the file
17497           # gets opened in binary mode to send to "cvs ci".
17498           dotest binfiles3-6a "cat CVS/Entries" \
17499 "/file1/0/[A-Za-z0-9 :]*/-kb/
17500 D"
17501           # TODO: This just tests the case where the old keyword
17502           # expansion mode is the default (RCS_getexpand == NULL
17503           # in checkaddfile()); should also test the case in which
17504           # we are changing it from one non-default value to another.
17505           dotest binfiles3-7 "${testcvs} -q ci -m readd-it" \
17506 "${PROG} commit: changing keyword expansion mode to -kb
17507 Checking in file1;
17508 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17509 new revision: 1\.3; previous revision: 1\.2
17510 done"
17511           dotest binfiles3-8 "${testcvs} -q log -h -N file1" "
17512 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17513 Working file: file1
17514 head: 1\.3
17515 branch:
17516 locks: strict
17517 access list:
17518 keyword substitution: b
17519 total revisions: 3
17520 ============================================================================="
17521
17522           # OK, now test admin -o on a binary file.  See "admin"
17523           # test for a more complete list of admin -o tests.
17524           cp ${TESTDIR}/1/binfile.dat ${TESTDIR}/1/binfile4.dat
17525           echo '%%$$##@@!!jjiiuull' | ${TR} j '\000' >>${TESTDIR}/1/binfile4.dat
17526           cp ${TESTDIR}/1/binfile4.dat ${TESTDIR}/1/binfile5.dat
17527           echo 'aawwee%$$##@@!!jjil' | ${TR} w '\000' >>${TESTDIR}/1/binfile5.dat
17528
17529           cp ../binfile4.dat file1
17530           dotest binfiles3-9 "${testcvs} -q ci -m change" \
17531 "Checking in file1;
17532 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17533 new revision: 1\.4; previous revision: 1\.3
17534 done"
17535           cp ../binfile5.dat file1
17536           dotest binfiles3-10 "${testcvs} -q ci -m change" \
17537 "Checking in file1;
17538 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17539 new revision: 1\.5; previous revision: 1\.4
17540 done"
17541           dotest binfiles3-11 "${testcvs} admin -o 1.3::1.5 file1" \
17542 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17543 deleting revision 1\.4
17544 done"
17545           dotest binfiles3-12 "${testcvs} -q update -r 1.3 file1" "U file1"
17546           dotest binfiles3-13 "cmp file1 ${TESTDIR}/1/binfile.dat" ""
17547
17548           cd ../..
17549           rm -r 1
17550           rm -rf ${CVSROOT_DIRNAME}/first-dir
17551           ;;
17552
17553         mcopy)
17554           # See comment at "mwrap" test for list of other wrappers tests.
17555           # Test cvs's ability to handle nonmergeable files specified with
17556           # -m 'COPY' in wrappers.  Similar to the binfiles2 test,
17557           # which tests the same thing for binary files
17558           # (which are non-mergeable in the same sense).
17559           #
17560           # Cases (we are merging from the branch to the trunk):
17561           # brmod) File modified on branch, not on trunk.
17562           #      File should be copied over to trunk (no merging is needed).
17563           # brmod-trmod) File modified on branch, also on trunk.
17564           #      This is a conflict.  Present the user with both files and
17565           #      let them figure it out.
17566           # brmod-wdmod) File modified on branch, not modified in the trunk
17567           #      repository, but modified in the (trunk) working directory.
17568           #      This is also a conflict.
17569
17570           # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
17571           # (see wrap_send).  So skip these tests for remote.
17572           if $remote; then :; else
17573
17574             mkdir ${CVSROOT_DIRNAME}/first-dir
17575             mkdir 1; cd 1
17576             dotest mcopy-1 "${testcvs} -q co first-dir" ''
17577             cd first-dir
17578
17579             # FIXCVS: unless a branch has at least one file on it,
17580             # tag_check_valid won't know it exists.  So if brmod didn't
17581             # exist, we would have to invent it.
17582             echo 'brmod initial contents' >brmod
17583             echo 'brmod-trmod initial contents' >brmod-trmod
17584             echo 'brmod-wdmod initial contents' >brmod-wdmod
17585             echo "* -m 'COPY'" >.cvswrappers
17586             dotest mcopy-1a \
17587 "${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
17588 "${PROG} add: scheduling file .\.cvswrappers. for addition
17589 ${PROG} add: scheduling file .brmod. for addition
17590 ${PROG} add: scheduling file .brmod-trmod. for addition
17591 ${PROG} add: scheduling file .brmod-wdmod. for addition
17592 ${PROG} add: use .${PROG} commit. to add these files permanently"
17593             dotest mcopy-1b "${testcvs} -q ci -m add" \
17594 "RCS file: ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v
17595 done
17596 Checking in \.cvswrappers;
17597 ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v  <--  \.cvswrappers
17598 initial revision: 1\.1
17599 done
17600 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
17601 done
17602 Checking in brmod;
17603 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17604 initial revision: 1\.1
17605 done
17606 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17607 done
17608 Checking in brmod-trmod;
17609 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17610 initial revision: 1\.1
17611 done
17612 RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
17613 done
17614 Checking in brmod-wdmod;
17615 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17616 initial revision: 1\.1
17617 done"
17618
17619             # NOTE: .cvswrappers files are broken (see comment in
17620             # src/wrapper.c).  So doing everything via the environment
17621             # variable is a workaround.  Better would be to test them
17622             # both.
17623             CVSWRAPPERS="* -m 'COPY'"
17624             export CVSWRAPPERS
17625             dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
17626 T brmod
17627 T brmod-trmod
17628 T brmod-wdmod'
17629             dotest mcopy-3 "$testcvs -q update -r br" \
17630 'U .cvswrappers
17631 U brmod
17632 U brmod-trmod
17633 U brmod-wdmod'
17634             echo 'modify brmod on br' >brmod
17635             echo 'modify brmod-trmod on br' >brmod-trmod
17636             echo 'modify brmod-wdmod on br' >brmod-wdmod
17637             dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
17638 "Checking in brmod;
17639 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17640 new revision: 1\.1\.2\.1; previous revision: 1\.1
17641 done
17642 Checking in brmod-trmod;
17643 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17644 new revision: 1\.1\.2\.1; previous revision: 1\.1
17645 done
17646 Checking in brmod-wdmod;
17647 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17648 new revision: 1\.1\.2\.1; previous revision: 1\.1
17649 done"
17650             dotest mcopy-6 "$testcvs -q update -A" \
17651 'U .cvswrappers
17652 U brmod
17653 U brmod-trmod
17654 U brmod-wdmod'
17655             dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
17656 "brmod initial contents
17657 brmod-trmod initial contents
17658 brmod-wdmod initial contents"
17659
17660             echo 'modify brmod-trmod again on trunk' >brmod-trmod
17661             dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
17662 "Checking in brmod-trmod;
17663 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17664 new revision: 1\.2; previous revision: 1\.1
17665 done"
17666             echo 'modify brmod-wdmod in working dir' >brmod-wdmod
17667
17668             dotest mcopy-8 "${testcvs} -q update -j br" \
17669 "U brmod
17670 ${PROG} update: nonmergeable file needs merge
17671 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
17672 ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
17673 C brmod-trmod
17674 M brmod-wdmod
17675 ${PROG} update: nonmergeable file needs merge
17676 ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
17677 ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
17678 C brmod-wdmod"
17679
17680             dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
17681 "modify brmod on br
17682 modify brmod-trmod on br
17683 modify brmod-wdmod on br"
17684             dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
17685 "modify brmod-trmod again on trunk
17686 modify brmod-wdmod in working dir"
17687
17688             # Test that everything was properly scheduled.
17689             dotest mcopy-10 "${testcvs} -q ci -m checkin" \
17690 "Checking in brmod;
17691 ${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17692 new revision: 1\.2; previous revision: 1\.1
17693 done
17694 Checking in brmod-trmod;
17695 ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17696 new revision: 1\.3; previous revision: 1\.2
17697 done
17698 Checking in brmod-wdmod;
17699 ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17700 new revision: 1\.2; previous revision: 1\.1
17701 done"
17702             cd ..
17703             cd ..
17704
17705             rm -rf ${CVSROOT_DIRNAME}/first-dir
17706             rm -r 1
17707             unset CVSWRAPPERS
17708
17709           fi # end of tests to be skipped for remote
17710
17711           ;;
17712
17713         binwrap)
17714           # Test the ability to specify binary-ness based on file name.
17715           # See "mwrap" for a list of other wrappers tests.
17716
17717           mkdir dir-to-import
17718           cd dir-to-import
17719           touch foo.c foo.exe
17720
17721           # While we're here, test for rejection of duplicate tag names.
17722           dotest_fail binwrap-0 \
17723             "${testcvs} import -m msg -I ! first-dir dup dup" \
17724 "${PROG} \[[a-z]* aborted\]: tag .dup. was specified more than once"
17725
17726           if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
17727               first-dir tag1 tag2 >>${LOGFILE}; then
17728             pass binwrap-1
17729           else
17730             fail binwrap-1
17731           fi
17732           cd ..
17733           rm -r dir-to-import
17734           dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
17735 U first-dir/foo.exe'
17736           dotest binwrap-3 "${testcvs} -q status first-dir" \
17737 "===================================================================
17738 File: foo\.c                    Status: Up-to-date
17739
17740    Working revision:    1\.1\.1\.1.*
17741    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
17742    Sticky Tag:          (none)
17743    Sticky Date:         (none)
17744    Sticky Options:      (none)
17745
17746 ===================================================================
17747 File: foo\.exe                  Status: Up-to-date
17748
17749    Working revision:    1\.1\.1\.1.*
17750    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
17751    Sticky Tag:          (none)
17752    Sticky Date:         (none)
17753    Sticky Options:      -kb"
17754           rm -r first-dir
17755           rm -rf ${CVSROOT_DIRNAME}/first-dir
17756           ;;
17757
17758         binwrap2)
17759           # Test the ability to specify binary-ness based on file name.
17760           # See "mwrap" for a list of other wrappers tests.
17761
17762           mkdir dir-to-import
17763           cd dir-to-import
17764           touch foo.c foo.exe
17765
17766           # Specify that all files are binary except *.c.
17767           # The order seems to matter, with the earlier rules taking
17768           # precedence.  I'm not sure whether that is good or not,
17769           # but it is the current behavior.
17770           if ${testcvs} import -m message -I ! \
17771               -W "*.c -k 'o'" -W "* -k 'b'" \
17772               first-dir tag1 tag2 >>${LOGFILE}; then
17773             pass binwrap2-1
17774           else
17775             fail binwrap2-1
17776           fi
17777           cd ..
17778           rm -r dir-to-import
17779           dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
17780 U first-dir/foo.exe'
17781           dotest binwrap2-3 "${testcvs} -q status first-dir" \
17782 "===================================================================
17783 File: foo\.c                    Status: Up-to-date
17784
17785    Working revision:    1\.1\.1\.1.*
17786    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
17787    Sticky Tag:          (none)
17788    Sticky Date:         (none)
17789    Sticky Options:      -ko
17790
17791 ===================================================================
17792 File: foo\.exe                  Status: Up-to-date
17793
17794    Working revision:    1\.1\.1\.1.*
17795    Repository revision: 1\.1\.1\.1      ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
17796    Sticky Tag:          (none)
17797    Sticky Date:         (none)
17798    Sticky Options:      -kb"
17799           rm -r first-dir
17800           rm -rf ${CVSROOT_DIRNAME}/first-dir
17801           ;;
17802
17803         binwrap3)
17804           # Test communication of file-specified -k wrappers between
17805           # client and server, in `import':
17806           #
17807           #   1. Set up a directory tree, populate it with files.
17808           #   2. Give each directory a different .cvswrappers file. 
17809           #   3. Give the server its own .cvswrappers file.
17810           #   4. Import the whole tree, see if the right files got set
17811           #      to binary.
17812           #
17813           # The tree has a top ("0th") level, and two subdirs, sub1/
17814           # and sub2/; sub2/ contains directory subsub/.  Every
17815           # directory has a .cvswrappers file as well as regular
17816           # files.
17817           #
17818           # In the file names, "foo-b.*" should end up binary, and
17819           # "foo-t.*" should end up text.  Don't worry about the two
17820           # letter extensions; they're just there to help me keep
17821           # things straight.
17822           #
17823           # Here's the directory tree:
17824           #
17825           # ./
17826           #    .cvswrappers
17827           #    foo-b.c0
17828           #    foo-b.sb
17829           #    foo-t.c1
17830           #    foo-t.st
17831           #
17832           #    sub1/             sub2/
17833           #      .cvswrappers      .cvswrappers
17834           #      foo-b.c1          foo-b.sb
17835           #      foo-b.sb          foo-b.st
17836           #      foo-t.c0          foo-t.c0
17837           #      foo-t.st          foo-t.c1
17838           #                        foo-t.c2
17839           #                        foo-t.c3
17840           #
17841           #                        subsub/
17842           #                          .cvswrappers
17843           #                          foo-b.c3
17844           #                          foo-b.sb
17845           #                          foo-t.c0
17846           #                          foo-t.c1
17847           #                          foo-t.c2
17848           #                          foo-t.st
17849
17850           binwrap3_line1="This is a test file "
17851           binwrap3_line2="containing little of use "
17852           binwrap3_line3="except this non-haiku"
17853
17854           binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
17855
17856           cd ${TESTDIR}
17857
17858           # On Windows, we can't check out CVSROOT, because the case
17859           # insensitivity means that this conflicts with cvsroot.
17860           mkdir wnt
17861           cd wnt
17862
17863           mkdir binwrap3 # the 0th dir
17864           mkdir binwrap3/sub1
17865           mkdir binwrap3/sub2
17866           mkdir binwrap3/sub2/subsub
17867           
17868           echo "bar*" > binwrap3/.cvswrappers
17869           echo "*.c0 -k 'b'" >> binwrap3/.cvswrappers
17870           echo "whatever -k 'b'" >> binwrap3/.cvswrappers
17871           echo ${binwrap3_text} > binwrap3/foo-b.c0
17872           echo ${binwrap3_text} > binwrap3/bar-t.c0
17873           echo ${binwrap3_text} > binwrap3/foo-b.sb
17874           echo ${binwrap3_text} > binwrap3/foo-t.sb
17875           echo ${binwrap3_text} > binwrap3/foo-t.c1
17876           echo ${binwrap3_text} > binwrap3/foo-t.st
17877
17878           echo "bar* -k 'kv'" > binwrap3/sub1/.cvswrappers
17879           echo "*.c1 -k 'b'" >> binwrap3/sub1/.cvswrappers
17880           echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
17881           echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
17882           echo ${binwrap3_text} > binwrap3/sub1/bar-t.c1
17883           echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
17884           echo ${binwrap3_text} > binwrap3/sub1/foo-t.sb
17885           echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
17886           echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
17887
17888           echo "bar*" > binwrap3/sub2/.cvswrappers
17889           echo "*.st -k 'b'" >> binwrap3/sub2/.cvswrappers
17890           echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
17891           echo ${binwrap3_text} > binwrap3/sub2/foo-t.sb
17892           echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
17893           echo ${binwrap3_text} > binwrap3/sub2/bar-t.st
17894           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
17895           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
17896           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
17897           echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
17898
17899           echo "bar* -k 'kv'" > binwrap3/sub2/subsub/.cvswrappers
17900           echo "*.c3 -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
17901           echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
17902           echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
17903           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
17904           echo ${binwrap3_text} > binwrap3/sub2/subsub/bar-t.c3
17905           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
17906           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.sb
17907           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
17908           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
17909           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
17910           echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
17911
17912           # Now set up CVSROOT/cvswrappers, the easy way:
17913           dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
17914           cd CVSROOT
17915           # This destroys anything currently in cvswrappers, but
17916           # presumably other tests will take care of it themselves if
17917           # they use cvswrappers:
17918           echo "foo-t.sb" > cvswrappers
17919           echo "foo*.sb  -k 'b'" >> cvswrappers
17920           dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
17921 "Checking in cvswrappers;
17922 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
17923 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
17924 done
17925 ${PROG} commit: Rebuilding administrative file database"
17926           cd ..
17927
17928           # Avoid environmental interference
17929           CVSWRAPPERS_save=${CVSWRAPPERS}
17930           unset CVSWRAPPERS
17931
17932           # Do the import
17933           cd binwrap3
17934           # Not importing .cvswrappers tests whether the client is really
17935           # letting the server know "honestly" whether the file is binary,
17936           # rather than just letting the server see the .cvswrappers file.
17937           dotest binwrap3-2a \
17938 "${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
17939 "[NI] ${DOTSTAR}"
17940
17941           # OK, now test "cvs add".
17942           cd ..
17943           rm -r binwrap3
17944           dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
17945           cd binwrap3
17946           cd sub2
17947           echo "*.newbin -k 'b'" > .cvswrappers
17948           echo .cvswrappers >.cvsignore
17949           echo .cvsignore >>.cvsignore
17950           touch file1.newbin file1.txt
17951           dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
17952 "${PROG} add: scheduling file .file1\.newbin. for addition
17953 ${PROG} add: scheduling file .file1\.txt. for addition
17954 ${PROG} add: use .${PROG} commit. to add these files permanently"
17955           dotest binwrap3-2d "${testcvs} -q ci -m add" \
17956 "RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v
17957 done
17958 Checking in file1\.newbin;
17959 ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v  <--  file1\.newbin
17960 initial revision: 1\.1
17961 done
17962 RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v
17963 done
17964 Checking in file1\.txt;
17965 ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v  <--  file1\.txt
17966 initial revision: 1\.1
17967 done"
17968           cd ..
17969
17970           # Now check out the module and see which files are binary.
17971           cd ..
17972           rm -r binwrap3
17973           dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
17974           cd binwrap3
17975
17976           # Running "cvs status" and matching output is too
17977           # error-prone, too likely to falsely fail.  Instead, we'll
17978           # just grep the Entries lines:
17979
17980           dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
17981                  "/foo-b.c0/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
17982
17983           dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
17984                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
17985
17986           dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
17987                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
17988
17989           dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
17990                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
17991
17992           dotest binwrap3-top5 "grep foo-t.sb ./CVS/Entries" \
17993                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
17994
17995           dotest binwrap3-top6 "grep bar-t.c0 ./CVS/Entries" \
17996                  "/bar-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
17997
17998           dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
17999                  "/foo-b.c1/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18000
18001           dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
18002                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18003
18004           dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
18005                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
18006
18007           dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
18008                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
18009
18010           dotest binwrap3-sub1-5 "grep foo-t.sb sub1/CVS/Entries" \
18011                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
18012
18013           dotest binwrap3-sub1-6 "grep bar-t.c1 sub1/CVS/Entries" \
18014                  "/bar-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
18015
18016           dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
18017                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18018
18019           dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
18020                  "/foo-b.st/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18021
18022           dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
18023                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
18024
18025           dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
18026                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
18027
18028           dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
18029                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
18030
18031           dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
18032                  "/foo-t.c3/1.1.1.1/[A-Za-z0-9  :]*//"
18033
18034           dotest binwrap3-sub2-7 "grep foo-t.sb sub2/CVS/Entries" \
18035                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
18036
18037           dotest binwrap3-sub2-8 "grep bar-t.st sub2/CVS/Entries" \
18038                  "/bar-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
18039
18040           dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
18041                  "/foo-b.c3/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18042
18043           dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
18044                  "/foo-b.sb/1.1.1.1/[A-Za-z0-9  :]*/-kb/"
18045
18046           dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
18047                  "/foo-t.c0/1.1.1.1/[A-Za-z0-9  :]*//"
18048
18049           dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
18050                  "/foo-t.c1/1.1.1.1/[A-Za-z0-9  :]*//"
18051
18052           dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
18053                  "/foo-t.c2/1.1.1.1/[A-Za-z0-9  :]*//"
18054
18055           dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
18056                  "/foo-t.st/1.1.1.1/[A-Za-z0-9  :]*//"
18057
18058           dotest binwrap3-subsub7 "grep foo-t.sb sub2/subsub/CVS/Entries" \
18059                  "/foo-t.sb/1.1.1.1/[A-Za-z0-9  :]*//"
18060
18061           dotest binwrap3-subsub8 "grep bar-t.c3 sub2/subsub/CVS/Entries" \
18062                  "/bar-t.c3/1.1.1.1/[A-Za-z0-9  :]*//"
18063
18064           dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
18065             "/file1.newbin/1.1/[A-Za-z0-9       :]*/-kb/"
18066           dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
18067             "/file1.txt/1.1/[A-Za-z0-9  :]*//"
18068
18069           # Restore and clean up
18070           cd ..
18071           rm -r binwrap3 CVSROOT
18072           cd ..
18073           rm -r wnt
18074           rm -rf ${CVSROOT_DIRNAME}/binwrap3
18075           CVSWRAPPERS=${CVSWRAPPERS_save}
18076           ;; 
18077
18078         mwrap)
18079           # Tests of various wrappers features:
18080           # -m 'COPY' and cvs update: mwrap
18081           # -m 'COPY' and joining: mcopy
18082           # -k: binwrap, binwrap2
18083           # -t/-f: hasn't been written yet.
18084           # 
18085           # Tests of different ways of specifying wrappers:
18086           # CVSROOT/cvswrappers: mwrap
18087           # -W: binwrap, binwrap2
18088           # .cvswrappers in working directory, local: mcopy
18089           # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
18090           # CVSWRAPPERS environment variable: mcopy
18091
18092           # This test is similar to binfiles-con1; -m 'COPY' specifies
18093           # non-mergeableness the same way that -kb does.
18094
18095           # On Windows, we can't check out CVSROOT, because the case
18096           # insensitivity means that this conflicts with cvsroot.
18097           mkdir wnt
18098           cd wnt
18099
18100           dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
18101           cd CVSROOT
18102           echo "* -m 'COPY'" >>cvswrappers
18103           dotest mwrap-c2 "${testcvs} -q ci -m wrapper-mod" \
18104 "Checking in cvswrappers;
18105 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
18106 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18107 done
18108 ${PROG} commit: Rebuilding administrative file database"
18109           cd ..
18110           mkdir m1; cd m1
18111           dotest mwrap-1 "${testcvs} -q co -l ." ''
18112           mkdir first-dir
18113           dotest mwrap-2 "${testcvs} add first-dir" \
18114 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18115           cd first-dir
18116           touch aa
18117           dotest mwrap-3 "${testcvs} add aa" \
18118 "${PROG} add: scheduling file .aa. for addition
18119 ${PROG} add: use .${PROG} commit. to add this file permanently"
18120           dotest mwrap-4 "${testcvs} -q ci -m add" \
18121 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
18122 done
18123 Checking in aa;
18124 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
18125 initial revision: 1\.1
18126 done"
18127           cd ../..
18128           mkdir m2; cd m2
18129           dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
18130           cd first-dir
18131           echo "changed in m2" >aa
18132           dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
18133 "Checking in aa;
18134 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
18135 new revision: 1\.2; previous revision: 1\.1
18136 done"
18137           cd ../..
18138           cd m1/first-dir
18139           echo "changed in m1" >aa
18140           dotest mwrap-7 "$testcvs -nq update" \
18141 "${PROG} update: nonmergeable file needs merge
18142 ${PROG} update: revision 1\.2 from repository is now in aa
18143 ${PROG} update: file from working directory is now in \.#aa\.1\.1
18144 C aa"
18145           dotest mwrap-8 "${testcvs} -q update" \
18146 "$PROG update: nonmergeable file needs merge
18147 ${PROG} update: revision 1\.2 from repository is now in aa
18148 ${PROG} update: file from working directory is now in \.#aa\.1\.1
18149 C aa"
18150           dotest mwrap-9 "cat aa" "changed in m2"
18151           dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
18152           cd ../..
18153           cd CVSROOT
18154           echo '# comment out' >cvswrappers
18155           dotest mwrap-ce "${testcvs} -q ci -m wrapper-mod" \
18156 "Checking in cvswrappers;
18157 ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
18158 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18159 done
18160 ${PROG} commit: Rebuilding administrative file database"
18161           cd ..
18162           rm -r CVSROOT
18163           rm -r m1 m2
18164           cd ..
18165           rm -r wnt
18166           rm -rf ${CVSROOT_DIRNAME}/first-dir
18167           ;;
18168
18169         info)
18170           # Administrative file tests.
18171           # Here is a list of where each administrative file is tested:
18172           # loginfo: info
18173           # modules: modules, modules2, modules3
18174           # cvsignore: ignore
18175           # verifymsg: info
18176           # cvswrappers: mwrap
18177           # taginfo: taginfo
18178           # config: config
18179
18180           # On Windows, we can't check out CVSROOT, because the case
18181           # insensitivity means that this conflicts with cvsroot.
18182           mkdir wnt
18183           cd wnt
18184
18185           dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
18186           cd CVSROOT
18187           rm -f $TESTDIR/testlog $TESTDIR/testlog2
18188           echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
18189           # The following cases test the format string substitution
18190           echo "ALL echo %{sVv} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
18191           echo "ALL echo %{v} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
18192           echo "ALL echo %s >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
18193           echo "ALL echo %{V}AX >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
18194           echo "first-dir echo %sux >>$TESTDIR/testlog2; cat >/dev/null" \
18195             >> loginfo
18196
18197           # Might be nice to move this to crerepos tests; it should
18198           # work to create a loginfo file if you didn't create one
18199           # with "cvs init".
18200           : dotest info-2 "${testcvs} add loginfo" \
18201 "${PROG}"' add: scheduling file `loginfo'"'"' for addition
18202 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
18203
18204           dotest info-3 "${testcvs} -q ci -m new-loginfo" \
18205 "Checking in loginfo;
18206 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
18207 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18208 done
18209 ${PROG} commit: Rebuilding administrative file database"
18210           cd ..
18211
18212           mkdir ${CVSROOT_DIRNAME}/first-dir
18213           dotest info-5 "${testcvs} -q co first-dir" ''
18214           cd first-dir
18215           touch file1
18216           dotest info-6 "${testcvs} add file1" \
18217 "${PROG}"' add: scheduling file `file1'\'' for addition
18218 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
18219           echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
18220           dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
18221 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18222 done
18223 Checking in file1;
18224 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18225 initial revision: 1\.1
18226 done
18227 ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
18228           echo line0 >>file1
18229           dotest info-6b "${testcvs} -q -sOTHER=foo ci -m mod-it" \
18230 "Checking in file1;
18231 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18232 new revision: 1\.2; previous revision: 1\.1
18233 done
18234 ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
18235           echo line1 >>file1
18236           dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
18237 "Checking in file1;
18238 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18239 new revision: 1\.3; previous revision: 1\.2
18240 done"
18241           cd ..
18242           dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${CVSROOT_DIRNAME}="
18243           dotest info-10 "cat $TESTDIR/testlog2" \
18244 'first-dir file1,NONE,1.1
18245 first-dir 1.1
18246 first-dir file1
18247 first-dir NONEAX
18248 first-dir file1ux
18249 first-dir file1,1.1,1.2
18250 first-dir 1.2
18251 first-dir file1
18252 first-dir 1.1AX
18253 first-dir file1ux
18254 first-dir file1,1.2,1.3
18255 first-dir 1.3
18256 first-dir file1
18257 first-dir 1.2AX
18258 first-dir file1ux'
18259
18260           cd CVSROOT
18261           echo '# do nothing' >loginfo
18262           dotest info-11 "${testcvs} -q -s ZEE=garbage ci -m nuke-loginfo" \
18263 "Checking in loginfo;
18264 ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
18265 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18266 done
18267 ${PROG} commit: Rebuilding administrative file database"
18268
18269           # Now test verifymsg
18270           cat >${TESTDIR}/vscript <<EOF
18271 #!${TESTSHELL}
18272 if sed 1q < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
18273     exit 0
18274 elif sed 1q < \$1 | grep '^BugId:[ ]*new$' > /dev/null; then
18275     echo A new bugid was found. >> \$1
18276     exit 0
18277 else
18278     echo "No BugId found."
18279     sleep 1
18280     exit 1
18281 fi
18282 EOF
18283           cat >${TESTDIR}/vscript2 <<EOF
18284 #!${TESTSHELL}
18285 if test -f CVS/Repository; then
18286         repo=\`cat CVS/Repository\`
18287 else
18288         repo=\`pwd\`
18289 fi
18290 echo \$repo
18291 if echo "\$repo" |grep yet-another/ >/dev/null 2>&1; then
18292         exit 1
18293 else
18294         exit 0
18295 fi
18296 EOF
18297           # Grumble, grumble, mumble, search for "Cygwin".
18298           if test -n "$remotehost"; then
18299             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/vscript*"
18300           else
18301             chmod +x ${TESTDIR}/vscript*
18302           fi
18303           echo "^first-dir/yet-another\\(/\\|\$\\) ${TESTDIR}/vscript2" >>verifymsg
18304           echo "^first-dir\\(/\\|\$\\) ${TESTDIR}/vscript" >>verifymsg
18305           echo "^missing-script\$ ${TESTDIR}/bogus" >>verifymsg
18306           echo "^missing-var\$ ${TESTDIR}/vscript \${=Bogus}" >>verifymsg
18307           # first test the directory independant verifymsg
18308           dotest info-v1 "${testcvs} -q ci -m add-verification" \
18309 "Checking in verifymsg;
18310 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
18311 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18312 done
18313 ${PROG} commit: Rebuilding administrative file database"
18314
18315           cd ../first-dir
18316           echo line2 >>file1
18317           dotest_fail info-v2 "${testcvs} -q ci -m bogus" \
18318 "No BugId found\.
18319 ${PROG} \[commit aborted\]: Message verification failed"
18320
18321           cat >${TESTDIR}/comment.tmp <<EOF
18322 BugId: 42
18323 and many more lines after it
18324 EOF
18325           dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18326 "Checking in file1;
18327 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18328 new revision: 1\.4; previous revision: 1\.3
18329 done"
18330           rm ${TESTDIR}/comment.tmp
18331
18332           cd ..
18333           mkdir another-dir
18334           cd another-dir
18335           touch file2
18336           dotest_fail info-v4 \
18337             "${testcvs} import -m bogus first-dir/another x y" \
18338 "No BugId found\.
18339 ${PROG} \[import aborted\]: Message verification failed"
18340
18341           # now verify that directory dependent verifymsgs work
18342           dotest info-v5 \
18343             "${testcvs} import -m bogus first-dir/yet-another x y" \
18344 "${TESTDIR}/wnt/another-dir
18345 N first-dir/yet-another/file2
18346
18347 No conflicts created by this import" \
18348 "${CVSROOT_DIRNAME}/first-dir/yet-another
18349 N first-dir/yet-another/file2
18350
18351 No conflicts created by this import"
18352
18353           # FIXMECVS
18354           #
18355           # note that in the local case the error message is the same as
18356           # info-v5
18357           #
18358           # This means that the verifymsg scripts cannot reliably and
18359           # consistantly obtain information on which directory is being
18360           # committed to.  Thus it is currently useless for them to be
18361           # running in every dir.  They should either be run once or
18362           # directory information should be passed.
18363           if $remote; then
18364             dotest_fail info-v6r \
18365               "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
18366 "${CVSROOT_DIRNAME}/first-dir/yet-another/and-another
18367 ${PROG} \[import aborted\]: Message verification failed"
18368           else
18369             dotest info-v6 \
18370               "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
18371 "${TESTDIR}/wnt/another-dir
18372 N first-dir/yet-another/and-another/file2
18373
18374 No conflicts created by this import"
18375           fi
18376
18377           # check that errors invoking the script cause verification failure
18378           #
18379           # The second text below occurs on Cygwin, where I assume execvp
18380           # does not return to let CVS print the error message when its
18381           # argument does not exist.
18382           dotest_fail info-v7 "${testcvs} import -m bogus missing-script x y" \
18383 "${PROG} import: cannot exec ${TESTDIR}/bogus: No such file or directory
18384 ${PROG} \[import aborted\]: Message verification failed" \
18385 "${PROG} \[import aborted\]: Message verification failed"
18386
18387           dotest_fail info-v8 "${testcvs} import -m bogus missing-var x y" \
18388 "${PROG} import: verifymsg:25: no such user variable \${=Bogus}
18389 ${PROG} \[import aborted\]: Message verification failed"
18390
18391           rm file2
18392           cd ..
18393           rmdir another-dir
18394
18395           cd CVSROOT
18396           echo "RereadLogAfterVerify=always" >>config
18397           dotest info-rereadlog-1 "${testcvs} -q ci -m add-RereadLogAfterVerify=always" \
18398 "Checking in config;
18399 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18400 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18401 done
18402 ${PROG} commit: Rebuilding administrative file database"
18403           cd ../first-dir
18404           echo line3 >>file1
18405           cat >${TESTDIR}/comment.tmp <<EOF
18406 BugId: new
18407 See what happens next.
18408 EOF
18409           dotest info-reread-2 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18410 "Checking in file1;
18411 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18412 new revision: 1\.5; previous revision: 1\.4
18413 done"
18414           dotest info-reread-3 "${testcvs} -q log -N -r1.5 file1" "
18415 .*
18416 BugId: new
18417 See what happens next.
18418 A new bugid was found.
18419 ============================================================================="
18420
18421           cd ../CVSROOT
18422           grep -v "RereadLogAfterVerify" config > config.new
18423           mv config.new config
18424           echo "RereadLogAfterVerify=stat" >>config
18425           dotest info-reread-4 "${testcvs} -q ci -m add-RereadLogAfterVerify=stat" \
18426 "Checking in config;
18427 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18428 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18429 done
18430 ${PROG} commit: Rebuilding administrative file database"
18431           cd ../first-dir
18432           echo line4 >>file1
18433           cat >${TESTDIR}/comment.tmp <<EOF
18434 BugId: new
18435 See what happens next with stat.
18436 EOF
18437           dotest info-reread-5 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18438 "Checking in file1;
18439 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18440 new revision: 1\.6; previous revision: 1\.5
18441 done"
18442           dotest info-reread-6 "${testcvs} -q log -N -r1.6 file1" "
18443 .*
18444 BugId: new
18445 See what happens next with stat.
18446 A new bugid was found.
18447 ============================================================================="
18448
18449           cd ../CVSROOT
18450           grep -v "RereadLogAfterVerify" config > config.new
18451           mv config.new config
18452           echo "RereadLogAfterVerify=never" >>config
18453           dotest info-reread-7 "${testcvs} -q ci -m add-RereadLogAfterVerify=never" \
18454 "Checking in config;
18455 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18456 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18457 done
18458 ${PROG} commit: Rebuilding administrative file database"
18459           cd ../first-dir
18460           echo line5 >>file1
18461           cat >${TESTDIR}/comment.tmp <<EOF
18462 BugId: new
18463 See what happens next.
18464 EOF
18465           dotest info-reread-8 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18466 "Checking in file1;
18467 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18468 new revision: 1\.7; previous revision: 1\.6
18469 done"
18470           dotest info-reread-6 "${testcvs} -q log -N -r1.7 file1" "
18471 .*
18472 BugId: new
18473 See what happens next.
18474 ============================================================================="
18475
18476           cd ../CVSROOT
18477           echo 'DEFAULT false' >verifymsg
18478           echo 'DEFAULT true' >>verifymsg
18479           echo '# defaults' >config
18480           dotest info-multdef "${testcvs} -q ci -m multdef" \
18481 "Checking in config;
18482 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18483 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18484 done
18485 Checking in verifymsg;
18486 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
18487 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18488 done
18489 ${PROG} commit: Rebuilding administrative file database"
18490
18491           cd ../CVSROOT
18492           echo '# do nothing' >verifymsg
18493           dotest info-cleanup-verifymsg "${testcvs} -q ci -m nuke-verifymsg" \
18494 "${PROG} commit: Multiple .DEFAULT. lines (1 and 2) in verifymsg file
18495 Checking in verifymsg;
18496 ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
18497 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18498 done
18499 ${PROG} commit: Rebuilding administrative file database"
18500           rm ${TESTDIR}/vscript*
18501           cd ..
18502
18503           dotest_fail info-cleanup-0 "${testcvs} -n release -d CVSROOT" \
18504 "${PROG} \[release aborted\]: cannot run command ${DOTSTAR}"
18505
18506           if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
18507             pass info-cleanup
18508           else
18509             fail info-cleanup
18510           fi
18511           if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
18512             pass info-cleanup-2
18513           else
18514             fail info-cleanup-2
18515           fi
18516           cd ..
18517           rm -r wnt
18518           rm $HOME/.cvsrc
18519           rm -rf ${CVSROOT_DIRNAME}/first-dir
18520           ;;
18521
18522         taginfo)
18523           # Tests of the CVSROOT/taginfo file.  See the comment at the
18524           # "info" tests for a full list of administrative file tests.
18525
18526           # Tests to add:
18527           #   -F to move
18528
18529           mkdir 1; cd 1
18530           dotest taginfo-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
18531           cd CVSROOT
18532           cat >${TESTDIR}/1/loggit <<EOF
18533 #!${TESTSHELL}
18534 if test "\$1" = rejectme; then
18535   exit 1
18536 else
18537   echo "\$@" >>${TESTDIR}/1/taglog
18538   exit 0
18539 fi
18540 EOF
18541           # #^@&!^@ Cygwin.
18542           if test -n "$remotehost"; then
18543             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/1/loggit"
18544           else
18545             chmod +x ${TESTDIR}/1/loggit
18546           fi
18547           echo "ALL ${TESTDIR}/1/loggit" >taginfo
18548           dotest taginfo-2 "${testcvs} -q ci -m check-in-taginfo" \
18549 "Checking in taginfo;
18550 ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
18551 new revision: 1\.2; previous revision: 1\.1
18552 done
18553 ${PROG} commit: Rebuilding administrative file database"
18554           cd ..
18555
18556           # taginfo-3 used to rely on the top-level CVS directory
18557           # being created to add "first-dir" to the repository.  Since
18558           # that won't happen anymore, we create the directory in the
18559           # repository.
18560           mkdir ${CVSROOT_DIRNAME}/first-dir
18561           dotest taginfo-3 "${testcvs} -q co first-dir" ''
18562
18563           cd first-dir
18564           echo first >file1
18565           dotest taginfo-4 "${testcvs} add file1" \
18566 "${PROG} add: scheduling file .file1. for addition
18567 ${PROG} add: use .${PROG} commit. to add this file permanently"
18568           dotest taginfo-5 "${testcvs} -q ci -m add-it" \
18569 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18570 done
18571 Checking in file1;
18572 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18573 initial revision: 1\.1
18574 done"
18575           dotest taginfo-6 "${testcvs} -q tag tag1" "T file1"
18576           dotest taginfo-7 "${testcvs} -q tag -b br" "T file1"
18577           dotest taginfo-8 "$testcvs -q update -r br" '[UP] file1'
18578           echo add text on branch >>file1
18579           dotest taginfo-9 "${testcvs} -q ci -m modify-on-br" \
18580 "Checking in file1;
18581 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18582 new revision: 1\.1\.2\.1; previous revision: 1\.1
18583 done"
18584           dotest taginfo-10 "${testcvs} -q tag -F -c brtag" "T file1"
18585
18586           dotest_fail taginfo-11 "${testcvs} -q tag rejectme" \
18587 "${PROG} tag: Pre-tag check failed
18588 ${PROG} \[tag aborted\]: correct the above errors first!"
18589
18590           # When we are using taginfo to allow/disallow, it would be
18591           # convenient to be able to use "cvs -n tag" to test whether
18592           # the allow/disallow functionality is working as expected.
18593           dotest taginfo-12 "${testcvs} -nq tag rejectme" "T file1"
18594
18595           # But when taginfo is used for logging, it is a pain for -n
18596           # to call taginfo, since taginfo doesn't know whether -n was
18597           # specified or not.
18598           dotest taginfo-13 "${testcvs} -nq tag would-be-tag" "T file1"
18599
18600           # Deleting: the cases are basically either the tag existed,
18601           # or it didn't exist.
18602           dotest taginfo-14 "${testcvs} -q tag -d tag1" "D file1"
18603           dotest taginfo-15 "${testcvs} -q tag -d tag1" ""
18604
18605           # Likewise with rtag.
18606           dotest taginfo-16 "${testcvs} -q rtag tag1 first-dir" ""
18607           dotest taginfo-17 "${testcvs} -q rtag -d tag1 first-dir" ""
18608           dotest taginfo-18 "${testcvs} -q rtag -d tag1 first-dir" ""
18609
18610           # The "br" example should be passing 1.1.2 or 1.1.0.2.
18611           # But it turns out that is very hard to implement, since
18612           # check_fileproc doesn't know what branch number it will
18613           # get.  Probably the whole thing should be re-architected
18614           # so that taginfo only allows/denies tagging, and a new
18615           # hook, which is done from tag_fileproc, does logging.
18616           # That would solve this, some more subtle races, and also
18617           # the fact that it is nice for users to run "-n tag foo" to
18618           # see whether a tag would be allowed.  Failing that,
18619           # I suppose passing "1.1.branch" or "branch" for "br"
18620           # would be an improvement.
18621           dotest taginfo-examine "cat ${TESTDIR}/1/taglog" \
18622 "tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
18623 br add ${CVSROOT_DIRNAME}/first-dir file1 1.1
18624 brtag mov ${CVSROOT_DIRNAME}/first-dir file1 1.1.2.1
18625 tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
18626 tag1 del ${CVSROOT_DIRNAME}/first-dir
18627 tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
18628 tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
18629 tag1 del ${CVSROOT_DIRNAME}/first-dir"
18630
18631           cd ..
18632           cd CVSROOT
18633           echo '# Keep life simple' > taginfo
18634           dotest taginfo-cleanup-1 "${testcvs} -q ci -m check-in-taginfo" \
18635 "Checking in taginfo;
18636 ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
18637 new revision: 1\.3; previous revision: 1\.2
18638 done
18639 ${PROG} commit: Rebuilding administrative file database"
18640           cd ..
18641           cd ..
18642           rm -r 1
18643           rm -rf ${CVSROOT_DIRNAME}/first-dir
18644           ;;
18645
18646         config)
18647           # Tests of the CVSROOT/config file.  See the comment at the
18648           # "info" tests for a full list of administrative file tests.
18649
18650           # On Windows, we can't check out CVSROOT, because the case
18651           # insensitivity means that this conflicts with cvsroot.
18652           mkdir wnt
18653           cd wnt
18654
18655           dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
18656           cd CVSROOT
18657           echo 'bogus line' >config
18658           # We can't rely on specific revisions, since other tests
18659           # might need to modify CVSROOT/config
18660           dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
18661 "Checking in config;
18662 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18663 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18664 done
18665 ${PROG} commit: Rebuilding administrative file database"
18666           echo 'BogusOption=yes' >config
18667           dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
18668 "${PROG} [a-z]*: syntax error in ${CVSROOT_DIRNAME}/CVSROOT/config: line 'bogus line' is missing '='
18669 Checking in config;
18670 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18671 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18672 done
18673 ${PROG} commit: Rebuilding administrative file database"
18674           echo '# No config is a good config' > config
18675           dotest config-5 "${testcvs} -q ci -m change-to-comment" \
18676 "${PROG} [a-z]*: ${CVSROOT_DIRNAME}/CVSROOT/config: unrecognized keyword 'BogusOption'
18677 Checking in config;
18678 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18679 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18680 done
18681 ${PROG} commit: Rebuilding administrative file database"
18682           dotest config-6 "${testcvs} -q update" ''
18683           echo 'IgnoreUnknownConfigKeys=yes' > config
18684           echo 'BogusOption=yes' >> config
18685           dotest config-7 "${testcvs} -q ci -m change-to-comment" \
18686 "Checking in config;
18687 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18688 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18689 done
18690 ${PROG} commit: Rebuilding administrative file database"
18691           dotest config-8 "${testcvs} -q update" ''
18692           echo '# No config is a good config' > config
18693           dotest config-9 "${testcvs} -q ci -m change-to-comment" \
18694 "Checking in config;
18695 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18696 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18697 done
18698 ${PROG} commit: Rebuilding administrative file database"
18699           dotest config-10 "${testcvs} -q update" ''
18700
18701           cd ..
18702           rm -r CVSROOT
18703           cd ..
18704           rm -r wnt
18705           ;;
18706
18707         serverpatch)
18708           # Test remote CVS handling of unpatchable files.  This isn't
18709           # much of a test for local CVS.
18710           # We test this with some keyword expansion games, but the situation
18711           # also arises if the user modifies the file while CVS is running.
18712           mkdir ${CVSROOT_DIRNAME}/first-dir
18713           mkdir 1
18714           cd 1
18715           dotest serverpatch-1 "${testcvs} -q co first-dir" ''
18716
18717           cd first-dir
18718
18719           # Add a file with an RCS keyword.
18720           echo '$''Name$' > file1
18721           echo '1' >> file1
18722           dotest serverpatch-2 "${testcvs} add file1" \
18723 "${PROG}"' add: scheduling file `file1'\'' for addition
18724 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
18725
18726           dotest serverpatch-3 "${testcvs} -q commit -m add" \
18727 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18728 done
18729 Checking in file1;
18730 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18731 initial revision: 1\.1
18732 done"
18733
18734           # Tag the file.
18735           dotest serverpatch-4 "${testcvs} -q tag tag file1" 'T file1'
18736
18737           # Check out a tagged copy of the file.
18738           cd ../..
18739           mkdir 2
18740           cd 2
18741           dotest serverpatch-5 "${testcvs} -q co -r tag first-dir" \
18742 'U first-dir/file1'
18743
18744           # Remove the tag.  Prior to 1.11.23, this left the tag string in the
18745           # expansion of the Name keyword.
18746           dotest serverpatch-6 "$testcvs -q update -A first-dir" \
18747 'U first-dir/file1'
18748
18749           # Modify and check in the first copy.
18750           cd ../1/first-dir
18751           echo '2' >> file1
18752           dotest serverpatch-7 "${testcvs} -q ci -mx file1" \
18753 "Checking in file1;
18754 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18755 new revision: 1\.2; previous revision: 1\.1
18756 done"
18757
18758           # Now update the second copy.  Prior to 1.11.23, the patch would fail
18759           # using remote CVS, forcing the file to be refetched.
18760           cd ../../2/first-dir
18761           dotest serverpatch-8 "${testcvs} -q update" \
18762 '[UP] file1'
18763
18764           cd ../..
18765           rm -r 1 2
18766           rm -rf ${CVSROOT_DIRNAME}/first-dir
18767           ;;
18768
18769         log)
18770           # Test selecting revisions with cvs log.
18771           # See also log2 tests for more tests.
18772           # See also branches-14.3 for logging with a branch off of a branch.
18773           # See also multibranch-14 for logging with several branches off the
18774           #   same branchpoint.
18775           # Tests of each option to cvs log:
18776           #   -h: admin-19a-log
18777           #   -N: log, log2, admin-19a-log
18778           #   -b, -r: log
18779           #   -d: logopt, rcs
18780           #   -s: logopt, rcs3
18781           #   -R: logopt, rcs3
18782           #   -w, -t: not tested yet (TODO)
18783
18784           # Check in a file with a few revisions and branches.
18785           mkdir ${CVSROOT_DIRNAME}/first-dir
18786           dotest log-1 "${testcvs} -q co first-dir" ''
18787           cd first-dir
18788           echo 'first revision' > file1
18789           echo 'first revision' > file2
18790           dotest log-2 "${testcvs} add file1 file2" \
18791 "${PROG} add: scheduling file .file1. for addition
18792 ${PROG} add: scheduling file .file2. for addition
18793 ${PROG} add: use .${PROG} commit. to add these files permanently"
18794
18795           # While we're at it, check multi-line comments, input from file,
18796           # and trailing whitespace trimming
18797           echo 'line 1     '     >${TESTDIR}/comment.tmp
18798           echo '     '          >>${TESTDIR}/comment.tmp
18799           echo 'line 2  '       >>${TESTDIR}/comment.tmp
18800           echo '        '       >>${TESTDIR}/comment.tmp
18801           echo '          '     >>${TESTDIR}/comment.tmp
18802           dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
18803 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18804 done
18805 Checking in file1;
18806 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18807 initial revision: 1\.1
18808 done
18809 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18810 done
18811 Checking in file2;
18812 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18813 initial revision: 1\.1
18814 done"
18815           rm -f ${TESTDIR}/comment.tmp
18816
18817           echo 'second revision' > file1
18818           echo 'second revision' > file2
18819           dotest log-4 "${testcvs} -q ci -m2 file1 file2" \
18820 "Checking in file1;
18821 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18822 new revision: 1\.2; previous revision: 1\.1
18823 done
18824 Checking in file2;
18825 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18826 new revision: 1\.2; previous revision: 1\.1
18827 done"
18828
18829           dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
18830           dotest log-5a "${testcvs} -q tag tag1 file2" 'T file2'
18831
18832           echo 'third revision' > file1
18833           echo 'third revision' > file2
18834           dotest log-6 "${testcvs} -q ci -m3 file1 file2" \
18835 "Checking in file1;
18836 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18837 new revision: 1\.3; previous revision: 1\.2
18838 done
18839 Checking in file2;
18840 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18841 new revision: 1\.3; previous revision: 1\.2
18842 done"
18843
18844           dotest log-6a "${testcvs} -q tag tag2 file2" 'T file2'
18845
18846           dotest log-7 "${testcvs} -q update -r branch" \
18847 "[UP] file1
18848 ${PROG} update: file2 is no longer in the repository"
18849
18850           echo 'first branch revision' > file1
18851           dotest log-8 "${testcvs} -q ci -m1b file1" \
18852 "Checking in file1;
18853 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18854 new revision: 1\.2\.2\.1; previous revision: 1\.2
18855 done"
18856
18857           dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
18858
18859           echo 'second branch revision' > file1
18860           dotest log-10 "${testcvs} -q ci -m2b file1" \
18861 "Checking in file1;
18862 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18863 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
18864 done"
18865
18866           # Set up a bunch of shell variables to make the later tests
18867           # easier to describe.=
18868           log_header1="
18869 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18870 Working file: file1
18871 head: 1\.3
18872 branch:
18873 locks: strict
18874 access list:"
18875           rlog_header1="
18876 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18877 head: 1\.3
18878 branch:
18879 locks: strict
18880 access list:"
18881           log_tags1='symbolic names:
18882         tag: 1\.2\.2\.1
18883         branch: 1\.2\.0\.2'
18884           log_keyword='keyword substitution: kv'
18885           log_dash='----------------------------
18886 revision'
18887           log_date="date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;"
18888           log_lines="  lines: ${PLUS}1 -1"
18889           log_rev1="${log_dash} 1\.1
18890 ${log_date}
18891 line 1
18892
18893 line 2"
18894           log_rev2="${log_dash} 1\.2
18895 ${log_date}${log_lines}
18896 branches:  1\.2\.2;
18897 2"
18898           log_rev3="${log_dash} 1\.3
18899 ${log_date}${log_lines}
18900 3"
18901           log_rev1b="${log_dash} 1\.2\.2\.1
18902 ${log_date}${log_lines}
18903 1b"
18904           log_rev2b="${log_dash} 1\.2\.2\.2
18905 ${log_date}${log_lines}
18906 2b"
18907           log_trailer='============================================================================='
18908
18909           # Now, finally, test the log output.
18910
18911           dotest log-11 "${testcvs} log file1" \
18912 "${log_header1}
18913 ${log_tags1}
18914 ${log_keyword}
18915 total revisions: 5;     selected revisions: 5
18916 description:
18917 ${log_rev3}
18918 ${log_rev2}
18919 ${log_rev1}
18920 ${log_rev2b}
18921 ${log_rev1b}
18922 ${log_trailer}"
18923
18924           dotest log-12 "${testcvs} log -N file1" \
18925 "${log_header1}
18926 ${log_keyword}
18927 total revisions: 5;     selected revisions: 5
18928 description:
18929 ${log_rev3}
18930 ${log_rev2}
18931 ${log_rev1}
18932 ${log_rev2b}
18933 ${log_rev1b}
18934 ${log_trailer}"
18935
18936           dotest log-13 "${testcvs} log -b file1" \
18937 "${log_header1}
18938 ${log_tags1}
18939 ${log_keyword}
18940 total revisions: 5;     selected revisions: 3
18941 description:
18942 ${log_rev3}
18943 ${log_rev2}
18944 ${log_rev1}
18945 ${log_trailer}"
18946
18947           dotest log-14 "${testcvs} log -r file1" \
18948 "${log_header1}
18949 ${log_tags1}
18950 ${log_keyword}
18951 total revisions: 5;     selected revisions: 1
18952 description:
18953 ${log_rev3}
18954 ${log_trailer}"
18955
18956           dotest log-14a "${testcvs} log -rHEAD file1" \
18957 "${log_header1}
18958 ${log_tags1}
18959 ${log_keyword}
18960 total revisions: 5;     selected revisions: 1
18961 description:
18962 ${log_rev3}
18963 ${log_trailer}"
18964
18965           # The user might not realize that "-r" must not take a space.
18966           # In the error message, HEAD is a file name, not a tag name (which
18967           # might be confusing itself).
18968           dotest_fail log-14b "${testcvs} log -r HEAD file1" \
18969 "${PROG} log: nothing known about HEAD
18970 ${log_header1}
18971 ${log_tags1}
18972 ${log_keyword}
18973 total revisions: 5;     selected revisions: 1
18974 description:
18975 ${log_rev3}
18976 ${log_trailer}"
18977
18978 #         Check that unusual syntax works correctly.
18979
18980           dotest log-14c "${testcvs} log -r: file1" \
18981 "${log_header1}
18982 ${log_tags1}
18983 ${log_keyword}
18984 total revisions: 5;     selected revisions: 1
18985 description:
18986 ${log_rev3}
18987 ${log_trailer}"
18988           dotest log-14d "${testcvs} log -r, file1" \
18989 "${log_header1}
18990 ${log_tags1}
18991 ${log_keyword}
18992 total revisions: 5;     selected revisions: 1
18993 description:
18994 ${log_rev3}
18995 ${log_trailer}"
18996           dotest log-14e "${testcvs} log -r. file1" \
18997 "${log_header1}
18998 ${log_tags1}
18999 ${log_keyword}
19000 total revisions: 5;     selected revisions: 1
19001 description:
19002 ${log_rev3}
19003 ${log_trailer}"
19004           dotest log-14f "${testcvs} log -r:: file1" \
19005 "${log_header1}
19006 ${log_tags1}
19007 ${log_keyword}
19008 total revisions: 5;     selected revisions: 0
19009 description:
19010 ${log_trailer}"
19011
19012           dotest log-15 "${testcvs} log -r1.2 file1" \
19013 "${log_header1}
19014 ${log_tags1}
19015 ${log_keyword}
19016 total revisions: 5;     selected revisions: 1
19017 description:
19018 ${log_rev2}
19019 ${log_trailer}"
19020
19021           dotest log-16 "${testcvs} log -r1.2.2 file1" \
19022 "${log_header1}
19023 ${log_tags1}
19024 ${log_keyword}
19025 total revisions: 5;     selected revisions: 2
19026 description:
19027 ${log_rev2b}
19028 ${log_rev1b}
19029 ${log_trailer}"
19030
19031           # This test would fail with the old invocation of rlog, but it
19032           # works with the builtin log support.
19033           dotest log-17 "${testcvs} log -rbranch file1" \
19034 "${log_header1}
19035 ${log_tags1}
19036 ${log_keyword}
19037 total revisions: 5;     selected revisions: 2
19038 description:
19039 ${log_rev2b}
19040 ${log_rev1b}
19041 ${log_trailer}"
19042
19043           dotest log-18 "${testcvs} log -r1.2.2. file1" \
19044 "${log_header1}
19045 ${log_tags1}
19046 ${log_keyword}
19047 total revisions: 5;     selected revisions: 1
19048 description:
19049 ${log_rev2b}
19050 ${log_trailer}"
19051
19052           # Multiple -r options are undocumented; see comments in
19053           # cvs.texinfo about whether they should be deprecated.
19054           dotest log-18a "${testcvs} log -r1.2.2.2 -r1.3:1.3 file1" \
19055 "${log_header1}
19056 ${log_tags1}
19057 ${log_keyword}
19058 total revisions: 5;     selected revisions: 2
19059 description:
19060 ${log_rev3}
19061 ${log_rev2b}
19062 ${log_trailer}"
19063
19064           # This test would fail with the old invocation of rlog, but it
19065           # works with the builtin log support.
19066           dotest log-19 "${testcvs} log -rbranch. file1" \
19067 "${log_header1}
19068 ${log_tags1}
19069 ${log_keyword}
19070 total revisions: 5;     selected revisions: 1
19071 description:
19072 ${log_rev2b}
19073 ${log_trailer}"
19074
19075           dotest log-20 "${testcvs} log -r1.2: file1" \
19076 "${log_header1}
19077 ${log_tags1}
19078 ${log_keyword}
19079 total revisions: 5;     selected revisions: 2
19080 description:
19081 ${log_rev3}
19082 ${log_rev2}
19083 ${log_trailer}"
19084
19085           dotest log-20a "${testcvs} log -r1.2:: file1" \
19086 "${log_header1}
19087 ${log_tags1}
19088 ${log_keyword}
19089 total revisions: 5;     selected revisions: 1
19090 description:
19091 ${log_rev3}
19092 ${log_trailer}"
19093
19094           dotest log-21 "${testcvs} log -r:1.2 file1" \
19095 "${log_header1}
19096 ${log_tags1}
19097 ${log_keyword}
19098 total revisions: 5;     selected revisions: 2
19099 description:
19100 ${log_rev2}
19101 ${log_rev1}
19102 ${log_trailer}"
19103
19104           dotest log-21a "${testcvs} log -r::1.2 file1" \
19105 "${log_header1}
19106 ${log_tags1}
19107 ${log_keyword}
19108 total revisions: 5;     selected revisions: 2
19109 description:
19110 ${log_rev2}
19111 ${log_rev1}
19112 ${log_trailer}"
19113
19114           dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
19115 "${log_header1}
19116 ${log_tags1}
19117 ${log_keyword}
19118 total revisions: 5;     selected revisions: 2
19119 description:
19120 ${log_rev2}
19121 ${log_rev1}
19122 ${log_trailer}"
19123
19124           dotest log-22a "${testcvs} log -r1.1::1.2 file1" \
19125 "${log_header1}
19126 ${log_tags1}
19127 ${log_keyword}
19128 total revisions: 5;     selected revisions: 1
19129 description:
19130 ${log_rev2}
19131 ${log_trailer}"
19132
19133           dotest log-22b "${testcvs} log -r1.1::1.3 file1" \
19134 "${log_header1}
19135 ${log_tags1}
19136 ${log_keyword}
19137 total revisions: 5;     selected revisions: 2
19138 description:
19139 ${log_rev3}
19140 ${log_rev2}
19141 ${log_trailer}"
19142
19143           # Test BASE pseudotag
19144           dotest log-23 "${testcvs} log -rBASE file1" \
19145 "${log_header1}
19146 ${log_tags1}
19147 ${log_keyword}
19148 total revisions: 5;     selected revisions: 1
19149 description:
19150 ${log_rev2b}
19151 ${log_trailer}"
19152
19153           dotest log-24 "${testcvs} -q up -r1.2 file1" "[UP] file1"
19154           dotest log-25 "${testcvs} log -rBASE file1" \
19155 "${log_header1}
19156 ${log_tags1}
19157 ${log_keyword}
19158 total revisions: 5;     selected revisions: 1
19159 description:
19160 ${log_rev2}
19161 ${log_trailer}"
19162
19163           dotest log-26 "${testcvs} -q up -rbranch file1" "[UP] file1"
19164
19165           # Now the same tests but with rlog
19166
19167           dotest log-r11 "${testcvs} rlog first-dir/file1" \
19168 "${rlog_header1}
19169 ${log_tags1}
19170 ${log_keyword}
19171 total revisions: 5;     selected revisions: 5
19172 description:
19173 ${log_rev3}
19174 ${log_rev2}
19175 ${log_rev1}
19176 ${log_rev2b}
19177 ${log_rev1b}
19178 ${log_trailer}"
19179
19180           dotest log-r12 "${testcvs} rlog -N first-dir/file1" \
19181 "${rlog_header1}
19182 ${log_keyword}
19183 total revisions: 5;     selected revisions: 5
19184 description:
19185 ${log_rev3}
19186 ${log_rev2}
19187 ${log_rev1}
19188 ${log_rev2b}
19189 ${log_rev1b}
19190 ${log_trailer}"
19191
19192           dotest log-r13 "${testcvs} rlog -b first-dir/file1" \
19193 "${rlog_header1}
19194 ${log_tags1}
19195 ${log_keyword}
19196 total revisions: 5;     selected revisions: 3
19197 description:
19198 ${log_rev3}
19199 ${log_rev2}
19200 ${log_rev1}
19201 ${log_trailer}"
19202
19203           dotest log-r14 "${testcvs} rlog -r first-dir/file1" \
19204 "${rlog_header1}
19205 ${log_tags1}
19206 ${log_keyword}
19207 total revisions: 5;     selected revisions: 1
19208 description:
19209 ${log_rev3}
19210 ${log_trailer}"
19211
19212           dotest log-r14a "${testcvs} rlog -rHEAD first-dir/file1" \
19213 "${rlog_header1}
19214 ${log_tags1}
19215 ${log_keyword}
19216 total revisions: 5;     selected revisions: 1
19217 description:
19218 ${log_rev3}
19219 ${log_trailer}"
19220
19221           dotest_fail log-r14b "${testcvs} rlog -r HEAD first-dir/file1" \
19222 "${PROG} rlog: cannot find module .HEAD. - ignored
19223 ${rlog_header1}
19224 ${log_tags1}
19225 ${log_keyword}
19226 total revisions: 5;     selected revisions: 1
19227 description:
19228 ${log_rev3}
19229 ${log_trailer}"
19230
19231           dotest log-r14c "${testcvs} rlog -r: first-dir/file1" \
19232 "${rlog_header1}
19233 ${log_tags1}
19234 ${log_keyword}
19235 total revisions: 5;     selected revisions: 1
19236 description:
19237 ${log_rev3}
19238 ${log_trailer}"
19239           dotest log-r14d "${testcvs} rlog -r, first-dir/file1" \
19240 "${rlog_header1}
19241 ${log_tags1}
19242 ${log_keyword}
19243 total revisions: 5;     selected revisions: 1
19244 description:
19245 ${log_rev3}
19246 ${log_trailer}"
19247           dotest log-r14e "${testcvs} rlog -r. first-dir/file1" \
19248 "${rlog_header1}
19249 ${log_tags1}
19250 ${log_keyword}
19251 total revisions: 5;     selected revisions: 1
19252 description:
19253 ${log_rev3}
19254 ${log_trailer}"
19255           dotest log-r14f "${testcvs} rlog -r:: first-dir/file1" \
19256 "${rlog_header1}
19257 ${log_tags1}
19258 ${log_keyword}
19259 total revisions: 5;     selected revisions: 0
19260 description:
19261 ${log_trailer}"
19262
19263           dotest log-r15 "${testcvs} rlog -r1.2 first-dir/file1" \
19264 "${rlog_header1}
19265 ${log_tags1}
19266 ${log_keyword}
19267 total revisions: 5;     selected revisions: 1
19268 description:
19269 ${log_rev2}
19270 ${log_trailer}"
19271
19272           dotest log-r16 "${testcvs} rlog -r1.2.2 first-dir/file1" \
19273 "${rlog_header1}
19274 ${log_tags1}
19275 ${log_keyword}
19276 total revisions: 5;     selected revisions: 2
19277 description:
19278 ${log_rev2b}
19279 ${log_rev1b}
19280 ${log_trailer}"
19281
19282           dotest log-r17 "${testcvs} rlog -rbranch first-dir/file1" \
19283 "${rlog_header1}
19284 ${log_tags1}
19285 ${log_keyword}
19286 total revisions: 5;     selected revisions: 2
19287 description:
19288 ${log_rev2b}
19289 ${log_rev1b}
19290 ${log_trailer}"
19291
19292           dotest log-r18 "${testcvs} rlog -r1.2.2. first-dir/file1" \
19293 "${rlog_header1}
19294 ${log_tags1}
19295 ${log_keyword}
19296 total revisions: 5;     selected revisions: 1
19297 description:
19298 ${log_rev2b}
19299 ${log_trailer}"
19300
19301           dotest log-r18a "${testcvs} rlog -r1.2.2.2 -r1.3:1.3 first-dir/file1" \
19302 "${rlog_header1}
19303 ${log_tags1}
19304 ${log_keyword}
19305 total revisions: 5;     selected revisions: 2
19306 description:
19307 ${log_rev3}
19308 ${log_rev2b}
19309 ${log_trailer}"
19310
19311           dotest log-r19 "${testcvs} rlog -rbranch. first-dir/file1" \
19312 "${rlog_header1}
19313 ${log_tags1}
19314 ${log_keyword}
19315 total revisions: 5;     selected revisions: 1
19316 description:
19317 ${log_rev2b}
19318 ${log_trailer}"
19319
19320           dotest log-r20 "${testcvs} rlog -r1.2: first-dir/file1" \
19321 "${rlog_header1}
19322 ${log_tags1}
19323 ${log_keyword}
19324 total revisions: 5;     selected revisions: 2
19325 description:
19326 ${log_rev3}
19327 ${log_rev2}
19328 ${log_trailer}"
19329
19330           dotest log-r20a "${testcvs} rlog -r1.2:: first-dir/file1" \
19331 "${rlog_header1}
19332 ${log_tags1}
19333 ${log_keyword}
19334 total revisions: 5;     selected revisions: 1
19335 description:
19336 ${log_rev3}
19337 ${log_trailer}"
19338
19339           dotest log-r21 "${testcvs} rlog -r:1.2 first-dir/file1" \
19340 "${rlog_header1}
19341 ${log_tags1}
19342 ${log_keyword}
19343 total revisions: 5;     selected revisions: 2
19344 description:
19345 ${log_rev2}
19346 ${log_rev1}
19347 ${log_trailer}"
19348
19349           dotest log-r21a "${testcvs} rlog -r::1.2 first-dir/file1" \
19350 "${rlog_header1}
19351 ${log_tags1}
19352 ${log_keyword}
19353 total revisions: 5;     selected revisions: 2
19354 description:
19355 ${log_rev2}
19356 ${log_rev1}
19357 ${log_trailer}"
19358
19359           dotest log-r22 "${testcvs} rlog -r1.1:1.2 first-dir/file1" \
19360 "${rlog_header1}
19361 ${log_tags1}
19362 ${log_keyword}
19363 total revisions: 5;     selected revisions: 2
19364 description:
19365 ${log_rev2}
19366 ${log_rev1}
19367 ${log_trailer}"
19368
19369           dotest log-r22a "${testcvs} rlog -r1.1::1.2 first-dir/file1" \
19370 "${rlog_header1}
19371 ${log_tags1}
19372 ${log_keyword}
19373 total revisions: 5;     selected revisions: 1
19374 description:
19375 ${log_rev2}
19376 ${log_trailer}"
19377
19378           dotest log-r22b "${testcvs} rlog -r1.1::1.3 first-dir/file1" \
19379 "${rlog_header1}
19380 ${log_tags1}
19381 ${log_keyword}
19382 total revisions: 5;     selected revisions: 2
19383 description:
19384 ${log_rev3}
19385 ${log_rev2}
19386 ${log_trailer}"
19387
19388           # Test BASE pseudotag
19389           dotest log-r23 "${testcvs} rlog -rBASE first-dir/file1" \
19390 "${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v.
19391 ${rlog_header1}
19392 ${log_tags1}
19393 ${log_keyword}
19394 total revisions: 5;     selected revisions: 0
19395 description:
19396 ${log_trailer}"
19397
19398           dotest log-r24 "${testcvs} -q up -r1.2 file1" "[UP] file1"
19399           dotest log-r25 "${testcvs} rlog -rBASE first-dir/file1" \
19400 "${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v.
19401 ${rlog_header1}
19402 ${log_tags1}
19403 ${log_keyword}
19404 total revisions: 5;     selected revisions: 0
19405 description:
19406 ${log_trailer}"
19407
19408           # Test when head is dead
19409
19410           dotest log-d0 "${testcvs} -q up -A" \
19411 "[UP] file1
19412 U file2"
19413           dotest log-d1 "${testcvs} -q rm -f file1" \
19414 "${PROG} remove: use .${PROG} commit. to remove this file permanently"
19415           dotest log-d2 "${testcvs} -q ci -m4" \
19416 "Removing file1;
19417 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19418 new revision: delete; previous revision: 1\.3
19419 done"
19420
19421           log_header1="
19422 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19423 Working file: file1
19424 head: 1\.4
19425 branch:
19426 locks: strict
19427 access list:"
19428           rlog_header1="
19429 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19430 head: 1\.4
19431 branch:
19432 locks: strict
19433 access list:"
19434           log_header2="
19435 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19436 Working file: file2
19437 head: 1\.3
19438 branch:
19439 locks: strict
19440 access list:"
19441           rlog_header2="
19442 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19443 head: 1\.3
19444 branch:
19445 locks: strict
19446 access list:"
19447           log_tags2='symbolic names:
19448         tag2: 1\.3
19449         tag1: 1\.2'
19450           log_rev4="${log_dash} 1\.4
19451 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
19452 4"
19453           log_rev22="${log_dash} 1\.2
19454 ${log_date}${log_lines}
19455 2"
19456
19457           dotest log-d3 "${testcvs} log -rbranch file1" \
19458 "${log_header1}
19459 ${log_tags1}
19460 ${log_keyword}
19461 total revisions: 6;     selected revisions: 2
19462 description:
19463 ${log_rev2b}
19464 ${log_rev1b}
19465 ${log_trailer}"
19466           dotest log-rd3 "${testcvs} rlog -rbranch first-dir/file1" \
19467 "${rlog_header1}
19468 ${log_tags1}
19469 ${log_keyword}
19470 total revisions: 6;     selected revisions: 2
19471 description:
19472 ${log_rev2b}
19473 ${log_rev1b}
19474 ${log_trailer}"
19475           dotest log-d4 "${testcvs} -q log -rbranch" \
19476 "${log_header1}
19477 ${log_tags1}
19478 ${log_keyword}
19479 total revisions: 6;     selected revisions: 2
19480 description:
19481 ${log_rev2b}
19482 ${log_rev1b}
19483 ${log_trailer}
19484 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19485 ${log_header2}
19486 ${log_tags2}
19487 ${log_keyword}
19488 total revisions: 3;     selected revisions: 0
19489 description:
19490 ${log_trailer}"
19491           dotest log-d4a "${testcvs} -q log -t -rbranch" \
19492 "${log_header1}
19493 ${log_tags1}
19494 ${log_keyword}
19495 total revisions: 6
19496 description:
19497 ${log_trailer}
19498 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19499 ${log_header2}
19500 ${log_tags2}
19501 ${log_keyword}
19502 total revisions: 3
19503 description:
19504 ${log_trailer}"
19505           dotest log-d4b "${testcvs} -q log -tS -rbranch" \
19506 "${log_header1}
19507 ${log_tags1}
19508 ${log_keyword}
19509 total revisions: 6;     selected revisions: 2
19510 description:
19511 ${log_trailer}
19512 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19513           dotest log-d4c "${testcvs} -q log -h -rbranch" \
19514 "${log_header1}
19515 ${log_tags1}
19516 ${log_keyword}
19517 total revisions: 6
19518 ${log_trailer}
19519 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19520 ${log_header2}
19521 ${log_tags2}
19522 ${log_keyword}
19523 total revisions: 3
19524 ${log_trailer}"
19525           dotest log-d4d "${testcvs} -q log -hS -rbranch" \
19526 "${log_header1}
19527 ${log_tags1}
19528 ${log_keyword}
19529 total revisions: 6;     selected revisions: 2
19530 ${log_trailer}
19531 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19532           dotest log-d4e "${testcvs} -q log -R -rbranch" \
19533 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19534 ${CVSROOT_DIRNAME}/first-dir/file2,v"
19535           dotest log-d4f "${testcvs} -q log -R -S -rbranch" \
19536 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19537 ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19538           dotest log-rd4 "${testcvs} -q rlog -rbranch first-dir" \
19539 "${rlog_header1}
19540 ${log_tags1}
19541 ${log_keyword}
19542 total revisions: 6;     selected revisions: 2
19543 description:
19544 ${log_rev2b}
19545 ${log_rev1b}
19546 ${log_trailer}
19547 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19548 ${rlog_header2}
19549 ${log_tags2}
19550 ${log_keyword}
19551 total revisions: 3;     selected revisions: 0
19552 description:
19553 ${log_trailer}"
19554           dotest log-rd4a "${testcvs} -q rlog -t -rbranch first-dir" \
19555 "${rlog_header1}
19556 ${log_tags1}
19557 ${log_keyword}
19558 total revisions: 6
19559 description:
19560 ${log_trailer}
19561 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19562 ${rlog_header2}
19563 ${log_tags2}
19564 ${log_keyword}
19565 total revisions: 3
19566 description:
19567 ${log_trailer}"
19568           dotest log-rd4b "${testcvs} -q rlog -St -rbranch first-dir" \
19569 "${rlog_header1}
19570 ${log_tags1}
19571 ${log_keyword}
19572 total revisions: 6;     selected revisions: 2
19573 description:
19574 ${log_trailer}
19575 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19576           dotest log-rd4c "${testcvs} -q rlog -h -rbranch first-dir" \
19577 "${rlog_header1}
19578 ${log_tags1}
19579 ${log_keyword}
19580 total revisions: 6
19581 ${log_trailer}
19582 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
19583 ${rlog_header2}
19584 ${log_tags2}
19585 ${log_keyword}
19586 total revisions: 3
19587 ${log_trailer}"
19588           dotest log-rd4d "${testcvs} -q rlog -Sh -rbranch first-dir" \
19589 "${rlog_header1}
19590 ${log_tags1}
19591 ${log_keyword}
19592 total revisions: 6;     selected revisions: 2
19593 ${log_trailer}
19594 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19595           dotest log-rd4e "${testcvs} -q rlog -R -rbranch first-dir" \
19596 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19597 ${CVSROOT_DIRNAME}/first-dir/file2,v"
19598           dotest log-rd4f "${testcvs} -q rlog -R -S -rbranch first-dir" \
19599 "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19600 ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
19601           dotest log-d5 "${testcvs} log -r1.2.2.1:1.2.2.2 file1" \
19602 "${log_header1}
19603 ${log_tags1}
19604 ${log_keyword}
19605 total revisions: 6;     selected revisions: 2
19606 description:
19607 ${log_rev2b}
19608 ${log_rev1b}
19609 ${log_trailer}"
19610           dotest log-rd5 "${testcvs} rlog -r1.2.2.1:1.2.2.2 first-dir/file1" \
19611 "${rlog_header1}
19612 ${log_tags1}
19613 ${log_keyword}
19614 total revisions: 6;     selected revisions: 2
19615 description:
19616 ${log_rev2b}
19617 ${log_rev1b}
19618 ${log_trailer}"
19619           dotest log-d6 "${testcvs} -q log -r1.2.2.1:1.2.2.2" \
19620 "${log_header1}
19621 ${log_tags1}
19622 ${log_keyword}
19623 total revisions: 6;     selected revisions: 2
19624 description:
19625 ${log_rev2b}
19626 ${log_rev1b}
19627 ${log_trailer}
19628 ${log_header2}
19629 ${log_tags2}
19630 ${log_keyword}
19631 total revisions: 3;     selected revisions: 0
19632 description:
19633 ${log_trailer}"
19634           dotest log-rd6 "${testcvs} -q rlog -r1.2.2.1:1.2.2.2 first-dir" \
19635 "${rlog_header1}
19636 ${log_tags1}
19637 ${log_keyword}
19638 total revisions: 6;     selected revisions: 2
19639 description:
19640 ${log_rev2b}
19641 ${log_rev1b}
19642 ${log_trailer}
19643 ${rlog_header2}
19644 ${log_tags2}
19645 ${log_keyword}
19646 total revisions: 3;     selected revisions: 0
19647 description:
19648 ${log_trailer}"
19649           dotest log-d7 "${testcvs} log -r1.2:1.3 file1" \
19650 "${log_header1}
19651 ${log_tags1}
19652 ${log_keyword}
19653 total revisions: 6;     selected revisions: 2
19654 description:
19655 ${log_rev3}
19656 ${log_rev2}
19657 ${log_trailer}"
19658           dotest log-rd7 "${testcvs} -q rlog -r1.2:1.3 first-dir/file1" \
19659 "${rlog_header1}
19660 ${log_tags1}
19661 ${log_keyword}
19662 total revisions: 6;     selected revisions: 2
19663 description:
19664 ${log_rev3}
19665 ${log_rev2}
19666 ${log_trailer}"
19667           dotest log-d8 "${testcvs} -q log -rtag1:tag2" \
19668 "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19669 ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19670 ${log_header1}
19671 ${log_tags1}
19672 ${log_keyword}
19673 total revisions: 6;     selected revisions: 0
19674 description:
19675 ${log_trailer}
19676 ${log_header2}
19677 ${log_tags2}
19678 ${log_keyword}
19679 total revisions: 3;     selected revisions: 2
19680 description:
19681 ${log_rev3}
19682 ${log_rev22}
19683 ${log_trailer}"
19684           dotest log-d8a "${testcvs} -q log -rtag1:tag2 -S" \
19685 "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19686 ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19687 ${log_header2}
19688 ${log_tags2}
19689 ${log_keyword}
19690 total revisions: 3;     selected revisions: 2
19691 description:
19692 ${log_rev3}
19693 ${log_rev22}
19694 ${log_trailer}"
19695           dotest log-rd8 "${testcvs} -q rlog -rtag1:tag2 first-dir" \
19696 "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19697 ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19698 ${rlog_header1}
19699 ${log_tags1}
19700 ${log_keyword}
19701 total revisions: 6;     selected revisions: 0
19702 description:
19703 ${log_trailer}
19704 ${rlog_header2}
19705 ${log_tags2}
19706 ${log_keyword}
19707 total revisions: 3;     selected revisions: 2
19708 description:
19709 ${log_rev3}
19710 ${log_rev22}
19711 ${log_trailer}"
19712           dotest log-rd8a "${testcvs} -q rlog -rtag1:tag2 -S first-dir" \
19713 "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19714 ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
19715 ${rlog_header2}
19716 ${log_tags2}
19717 ${log_keyword}
19718 total revisions: 3;     selected revisions: 2
19719 description:
19720 ${log_rev3}
19721 ${log_rev22}
19722 ${log_trailer}"
19723
19724           dotest log-d99 "${testcvs} -q up -rbranch" \
19725 "[UP] file1
19726 ${PROG} update: file2 is no longer in the repository"
19727
19728           # Now test outdating revisions
19729
19730           dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
19731 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19732 done"
19733           dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
19734 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19735 done"
19736           dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
19737 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19738 deleting revision 1\.2\.2\.2
19739 done"
19740           dotest log-o3 "${testcvs} log file1" \
19741 "${log_header1}
19742 ${log_tags1}
19743 ${log_keyword}
19744 total revisions: 5;     selected revisions: 5
19745 description:
19746 ${log_rev4}
19747 ${log_rev3}
19748 ${log_rev2}
19749 ${log_rev1}
19750 ${log_rev1b}
19751 ${log_trailer}"
19752           dotest log-ro3 "${testcvs} rlog first-dir/file1" \
19753 "${rlog_header1}
19754 ${log_tags1}
19755 ${log_keyword}
19756 total revisions: 5;     selected revisions: 5
19757 description:
19758 ${log_rev4}
19759 ${log_rev3}
19760 ${log_rev2}
19761 ${log_rev1}
19762 ${log_rev1b}
19763 ${log_trailer}"
19764           dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
19765 "first branch revision"
19766
19767           cd ..
19768           rm -r first-dir
19769           rm -rf ${CVSROOT_DIRNAME}/first-dir
19770           ;;
19771
19772         log2)
19773           # More "cvs log" tests, for example the file description.
19774
19775           # Check in a file
19776           mkdir ${CVSROOT_DIRNAME}/first-dir
19777           dotest log2-1 "${testcvs} -q co first-dir" ''
19778           cd first-dir
19779           echo 'first revision' > file1
19780           dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
19781 "${PROG}"' add: scheduling file `file1'\'' for addition
19782 '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
19783           dotest log2-3 "${testcvs} -q commit -m 1" \
19784 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19785 done
19786 Checking in file1;
19787 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19788 initial revision: 1\.1
19789 done"
19790           # Setting the file description with add -m doesn't yet work
19791           # client/server, so skip log2-4 for remote.
19792           if $remote; then :; else
19793
19794             dotest log2-4 "${testcvs} log -N file1" "
19795 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19796 Working file: file1
19797 head: 1\.1
19798 branch:
19799 locks: strict
19800 access list:
19801 keyword substitution: kv
19802 total revisions: 1;     selected revisions: 1
19803 description:
19804 file1-is-for-testing
19805 ----------------------------
19806 revision 1\.1
19807 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19808 1
19809 ============================================================================="
19810
19811           fi # end of tests skipped for remote
19812
19813           dotest log2-5 "${testcvs} admin -t-change-description file1" \
19814 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19815 done"
19816           dotest log2-6 "${testcvs} log -N file1" "
19817 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19818 Working file: file1
19819 head: 1\.1
19820 branch:
19821 locks: strict
19822 access list:
19823 keyword substitution: kv
19824 total revisions: 1;     selected revisions: 1
19825 description:
19826 change-description
19827 ----------------------------
19828 revision 1\.1
19829 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19830 1
19831 ============================================================================="
19832
19833           echo 'longer description' >${TESTDIR}/descrip
19834           echo 'with two lines' >>${TESTDIR}/descrip
19835           dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
19836 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19837 done"
19838           dotest_fail log2-7a "${testcvs} admin -t${TESTDIR}/nonexist file1" \
19839 "${PROG} \[[a-z]* aborted\]: can't stat ${TESTDIR}/nonexist: No such file or directory"
19840           dotest log2-8 "${testcvs} log -N file1" "
19841 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19842 Working file: file1
19843 head: 1\.1
19844 branch:
19845 locks: strict
19846 access list:
19847 keyword substitution: kv
19848 total revisions: 1;     selected revisions: 1
19849 description:
19850 longer description
19851 with two lines
19852 ----------------------------
19853 revision 1\.1
19854 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19855 1
19856 ============================================================================="
19857
19858           # TODO: `cvs admin -t "my message" file1' is a request to
19859           # read the message from stdin and to operate on two files.
19860           # Should test that there is an error because "my message"
19861           # doesn't exist.
19862
19863           dotest log2-9 "echo change from stdin | ${testcvs} admin -t -q file1" ""
19864           dotest log2-10 "${testcvs} log -N file1" "
19865 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19866 Working file: file1
19867 head: 1\.1
19868 branch:
19869 locks: strict
19870 access list:
19871 keyword substitution: kv
19872 total revisions: 1;     selected revisions: 1
19873 description:
19874 change from stdin
19875 ----------------------------
19876 revision 1\.1
19877 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19878 1
19879 ============================================================================="
19880
19881           cd ..
19882           rm ${TESTDIR}/descrip
19883           rm -r first-dir
19884           rm -rf ${CVSROOT_DIRNAME}/first-dir
19885
19886           ;;
19887
19888         logopt)
19889           # Some tests of log.c's option parsing and such things.
19890           mkdir 1; cd 1
19891           dotest logopt-1 "${testcvs} -q co -l ." ''
19892           mkdir first-dir
19893           dotest logopt-2 "${testcvs} add first-dir" \
19894 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
19895           cd first-dir
19896           echo hi >file1
19897           dotest logopt-3 "${testcvs} add file1" \
19898 "${PROG} add: scheduling file .file1. for addition
19899 ${PROG} add: use .${PROG} commit. to add this file permanently"
19900           dotest logopt-4 "${testcvs} -q ci -m add file1" \
19901 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19902 done
19903 Checking in file1;
19904 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19905 initial revision: 1\.1
19906 done"
19907           cd ..
19908
19909           dotest logopt-5 "${testcvs} log -R -d 2038-01-01" \
19910 "${PROG} log: Logging \.
19911 ${PROG} log: Logging first-dir
19912 ${CVSROOT_DIRNAME}/first-dir/file1,v"
19913           dotest logopt-6 "${testcvs} log -d 2038-01-01 -R" \
19914 "${PROG} log: Logging \.
19915 ${PROG} log: Logging first-dir
19916 ${CVSROOT_DIRNAME}/first-dir/file1,v"
19917           dotest logopt-6a "${testcvs} log -Rd 2038-01-01" \
19918 "${PROG} log: Logging \.
19919 ${PROG} log: Logging first-dir
19920 ${CVSROOT_DIRNAME}/first-dir/file1,v"
19921           dotest logopt-7 "${testcvs} log -s Exp -R" \
19922 "${PROG} log: Logging \.
19923 ${PROG} log: Logging first-dir
19924 ${CVSROOT_DIRNAME}/first-dir/file1,v"
19925
19926           cd ..
19927           rm -r 1
19928           rm -rf ${CVSROOT_DIRNAME}/first-dir
19929           ;;
19930
19931         ann)
19932           # Tests of "cvs annotate".  See also:
19933           #   basica-10  A simple annotate test
19934           #   rcs        Annotate and the year 2000
19935           #   keywordlog Annotate and $Log.
19936           mkdir 1; cd 1
19937           dotest ann-1 "${testcvs} -q co -l ." ''
19938           mkdir first-dir
19939           dotest ann-2 "${testcvs} add first-dir" \
19940 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
19941           cd first-dir
19942           cat >file1 <<EOF
19943 this
19944 is
19945 the
19946 ancestral
19947 file
19948 EOF
19949           dotest ann-3 "${testcvs} add file1" \
19950 "${PROG} add: scheduling file .file1. for addition
19951 ${PROG} add: use .${PROG} commit. to add this file permanently"
19952           dotest ann-4 "${testcvs} -q ci -m add file1" \
19953 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19954 done
19955 Checking in file1;
19956 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19957 initial revision: 1\.1
19958 done"
19959           cat >file1 <<EOF
19960 this
19961 is
19962 a
19963 file
19964
19965 with
19966 a
19967 blank
19968 line
19969 EOF
19970           dotest ann-5 "${testcvs} -q ci -m modify file1" \
19971 "Checking in file1;
19972 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19973 new revision: 1\.2; previous revision: 1\.1
19974 done"
19975           dotest ann-6 "${testcvs} -q tag -b br" "T file1"
19976           cat >file1 <<EOF
19977 this
19978 is
19979 a
19980 trunk file
19981
19982 with
19983 a
19984 blank
19985 line
19986 EOF
19987           dotest ann-7 "${testcvs} -q ci -m modify file1" \
19988 "Checking in file1;
19989 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19990 new revision: 1\.3; previous revision: 1\.2
19991 done"
19992           dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
19993           cat >file1 <<EOF
19994 this
19995 is
19996 a
19997 file
19998
19999 with
20000 a
20001 blank
20002 line
20003 and some
20004 branched content
20005 EOF
20006           dotest ann-9 "${testcvs} -q ci -m modify" \
20007 "Checking in file1;
20008 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20009 new revision: 1\.2\.2\.1; previous revision: 1\.2
20010 done"
20011           # Note that this annotates the trunk despite the presence
20012           # of a sticky tag in the current directory.  This is
20013           # fairly bogus, but it is the longstanding behavior for
20014           # whatever that is worth.
20015           dotest ann-10 "${testcvs} ann" \
20016 "
20017 Annotations for file1
20018 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20019 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20020 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20021 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20022 1\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
20023 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20024 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20025 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20026 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20027 1\.2          ($username8 *[0-9a-zA-Z-]*): line"
20028           dotest ann-10blame "${testcvs} blame" \
20029 "
20030 Annotations for file1
20031 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20032 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20033 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20034 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20035 1\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
20036 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20037 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20038 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20039 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20040 1\.2          ($username8 *[0-9a-zA-Z-]*): line"
20041           dotest ann-11 "${testcvs} ann -r br" \
20042 "
20043 Annotations for file1
20044 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20045 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20046 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20047 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20048 1\.1          ($username8 *[0-9a-zA-Z-]*): file
20049 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20050 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20051 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20052 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20053 1\.2          ($username8 *[0-9a-zA-Z-]*): line
20054 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
20055 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): branched content"
20056           # FIXCVS: shouldn't "-r 1.2.0.2" be the same as "-r br"?
20057           dotest ann-12 "${testcvs} ann -r 1.2.0.2 file1" ""
20058           dotest ann-13 "${testcvs} ann -r 1.2.2 file1" \
20059 "
20060 Annotations for file1
20061 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20062 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20063 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20064 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20065 1\.1          ($username8 *[0-9a-zA-Z-]*): file
20066 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20067 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20068 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20069 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20070 1\.2          ($username8 *[0-9a-zA-Z-]*): line
20071 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
20072 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): branched content"
20073           dotest_fail ann-14 "${testcvs} ann -r bill-clintons-chastity file1" \
20074 "${PROG} \[annotate aborted\]: no such tag bill-clintons-chastity"
20075
20076           # Now get rid of the working directory and test rannotate
20077
20078           cd ../..
20079           rm -r 1
20080           dotest ann-r10 "${testcvs} rann first-dir" \
20081 "
20082 Annotations for first-dir/file1
20083 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20084 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20085 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20086 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20087 1\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
20088 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20089 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20090 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20091 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20092 1\.2          ($username8 *[0-9a-zA-Z-]*): line"
20093           dotest ann-r11 "${testcvs} rann -r br first-dir" \
20094 "
20095 Annotations for first-dir/file1
20096 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20097 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20098 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20099 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20100 1\.1          ($username8 *[0-9a-zA-Z-]*): file
20101 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20102 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20103 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20104 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20105 1\.2          ($username8 *[0-9a-zA-Z-]*): line
20106 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
20107 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): branched content"
20108           dotest ann-r12 "${testcvs} rann -r 1.2.0.2 first-dir/file1" ""
20109           dotest ann-r13 "${testcvs} rann -r 1.2.2 first-dir/file1" \
20110 "
20111 Annotations for first-dir/file1
20112 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20113 1\.1          ($username8 *[0-9a-zA-Z-]*): this
20114 1\.1          ($username8 *[0-9a-zA-Z-]*): is
20115 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20116 1\.1          ($username8 *[0-9a-zA-Z-]*): file
20117 1\.2          ($username8 *[0-9a-zA-Z-]*): 
20118 1\.2          ($username8 *[0-9a-zA-Z-]*): with
20119 1\.2          ($username8 *[0-9a-zA-Z-]*): a
20120 1\.2          ($username8 *[0-9a-zA-Z-]*): blank
20121 1\.2          ($username8 *[0-9a-zA-Z-]*): line
20122 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
20123 1\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): branched content"
20124           dotest_fail ann-r14 "${testcvs} rann -r bill-clintons-chastity first-dir/file1" \
20125 "${PROG} \[rannotate aborted\]: no such tag bill-clintons-chastity"
20126
20127           rm -rf ${CVSROOT_DIRNAME}/first-dir
20128           ;;
20129
20130         ann-id)
20131           # Demonstrate that cvs-1.9.28.1 improperly expands rcs keywords in
20132           # the output of `cvs annotate' -- it uses values from the previous
20133           # delta.  In this case, `1.1' instead of `1.2', even though it puts
20134           # the proper version number on the prefix to each line of output.
20135           mkdir 1; cd 1
20136           dotest ann-id-1 "${testcvs} -q co -l ." ''
20137           module=x
20138           mkdir $module
20139           dotest ann-id-2 "${testcvs} add $module" \
20140 "Directory ${CVSROOT_DIRNAME}/$module added to the repository"
20141           cd $module
20142
20143           file=m
20144           echo '$Id''$' > $file
20145
20146           dotest ann-id-3 "$testcvs add $file" \
20147 "${PROG} add: scheduling file .$file. for addition
20148 ${PROG} add: use .${PROG} commit. to add this file permanently"
20149           dotest ann-id-4 "$testcvs -Q ci -m . $file" \
20150 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
20151 done
20152 Checking in $file;
20153 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
20154 initial revision: 1\.1
20155 done"
20156
20157           echo line2 >> $file
20158           dotest ann-id-5 "$testcvs -Q ci -m . $file" \
20159 "Checking in $file;
20160 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
20161 new revision: 1\.2; previous revision: 1\.1
20162 done"
20163
20164           # The version number after $file,v should be `1.2'.
20165           # 1.9.28.1 puts `1.1' there.
20166           dotest ann-id-6 "$testcvs -Q ann $file" \
20167 "
20168 Annotations for $file
20169 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20170 1.2          ($username8 *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'"
20171 1.2          ($username8 *[0-9a-zA-Z-]*): line2"
20172
20173           cd ../..
20174           rm -rf 1
20175           rm -rf ${CVSROOT_DIRNAME}/$module
20176           ;;
20177
20178         crerepos)
20179           # Various tests relating to creating repositories, operating
20180           # on repositories created with old versions of CVS, etc.
20181
20182           CVS_SERVER_save=$CVS_SERVER
20183
20184           # Because this test is all about -d options and such, it
20185           # at least to some extent needs to be different for remote vs.
20186           # local.
20187           if $remote; then
20188
20189             # Use :ext: rather than :fork:.  Most of the tests use :fork:,
20190             # so we want to make sure that we test :ext: _somewhere_.
20191             # Make sure 'rsh' works first.
20192             depends_on_rsh "$CVS_RSH"
20193             if test $? -eq 77; then
20194                 skip crerepos "$skipreason"
20195                 continue
20196             fi
20197
20198             # For remote, just create the repository.  We don't yet do
20199             # the various other tests above for remote but that should be
20200             # changed.
20201             mkdir crerepos
20202             mkdir crerepos/CVSROOT
20203
20204             # Make sure server ignores real ${HOME}/.cvsrc:
20205             cat >$TESTDIR/cvs-setHome <<EOF
20206 #!/bin/sh
20207 HOME=$HOME
20208 export HOME
20209 exec $CVS_SERVER_save "\$@"
20210 EOF
20211             chmod a+x $TESTDIR/cvs-setHome
20212
20213             # Note that we set CVS_SERVER at the beginning.
20214             CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER
20215             CREREPOS_ROOT=:ext:$host$TESTDIR/crerepos
20216           else
20217
20218             # First, if the repository doesn't exist at all...
20219             dotest_fail crerepos-1 \
20220 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20221 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
20222             mkdir crerepos
20223
20224             # The repository exists but CVSROOT doesn't.
20225             dotest_fail crerepos-2 \
20226 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20227 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
20228             mkdir crerepos/CVSROOT
20229
20230             # Checkout of nonexistent module
20231             dotest_fail crerepos-3 \
20232 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20233 "${PROG} checkout: cannot find module .cvs-sanity. - ignored"
20234
20235             # Now test that CVS works correctly without a modules file
20236             # or any of that other stuff.  In particular, it *must*
20237             # function if administrative files added to CVS recently (since
20238             # CVS 1.3) do not exist, because the repository might have
20239             # been created with an old version of CVS.
20240             mkdir 1; cd 1
20241             dotest crerepos-4 \
20242 "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
20243 ''
20244             if echo yes | \
20245 ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
20246               pass crerepos-5
20247             else
20248               fail crerepos-5
20249             fi
20250             rm -rf CVS
20251             cd ..
20252             # The directory 1 should be empty
20253             dotest crerepos-6 "rmdir 1"
20254
20255             CREREPOS_ROOT=${TESTDIR}/crerepos
20256
20257           fi
20258
20259           if $remote; then
20260             # Test that CVS rejects a relative path in CVSROOT.
20261             mkdir 1; cd 1
20262             # Note that having the client reject the pathname (as :fork:
20263             # does), does _not_ test for the bugs we are trying to catch
20264             # here.  The point is that malicious clients might send all
20265             # manner of things and the server better protect itself.
20266             dotest_fail crerepos-6a-r \
20267 "${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
20268 "${PROG} [a-z]*: CVSROOT may only specify a positive, non-zero, integer port (not .\.\..)\.
20269 ${PROG} [a-z]*: Perhaps you entered a relative pathname${QUESTION}
20270 ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:\.\./crerepos.\."
20271             cd ..
20272             rm -r 1
20273           else # local
20274             # Test that CVS rejects a relative path in CVSROOT.
20275
20276             mkdir 1; cd 1
20277             # Set CVS_RSH=false since ocassionally (e.g. when CVS_RSH=ssh on
20278             # some systems) some rsh implementations will block because they
20279             # can look up '..' and want to ask the user about the unknown host
20280             # key or somesuch.  Which error message we get depends on whether
20281             # false finishes running before we try to talk to it or not.
20282             dotest_fail crerepos-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \
20283 "${PROG} \[checkout aborted\]: .*" \
20284 "${PROG} checkout: CVSROOT is set for a remote access method but your
20285 ${PROG} checkout: CVS executable doesn't support it\.
20286 ${PROG} \[checkout aborted\]: Bad CVSROOT: .\.\./crerepos.\."
20287             cd ..
20288             rm -r 1
20289
20290             mkdir 1; cd 1
20291             dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
20292 "${PROG} init: CVSROOT must be an absolute pathname (not .crerepos.)
20293 ${PROG} init: when using local access method\.
20294 ${PROG} \[init aborted\]: Bad CVSROOT: .crerepos.\."
20295             cd ..
20296             rm -r 1
20297           fi # end of tests to be skipped for remote
20298
20299           # CVS better not create a history file--if the administrator 
20300           # doesn't need it and wants to save on disk space, they just
20301           # delete it.
20302           dotest_fail crerepos-7 \
20303 "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
20304
20305           # Now test mixing repositories.  This kind of thing tends to
20306           # happen accidentally when people work with several repositories.
20307           mkdir 1; cd 1
20308           dotest crerepos-8 "${testcvs} -q co -l ." ''
20309           mkdir first-dir
20310           dotest crerepos-9 "${testcvs} add first-dir" \
20311 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20312           cd first-dir
20313           touch file1
20314           dotest crerepos-10 "${testcvs} add file1" \
20315 "${PROG} add: scheduling file .file1. for addition
20316 ${PROG} add: use .${PROG} commit. to add this file permanently"
20317           dotest crerepos-11 "${testcvs} -q ci -m add-it" \
20318 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20319 done
20320 Checking in file1;
20321 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20322 initial revision: 1\.1
20323 done"
20324           cd ../..
20325           rm -r 1
20326
20327           mkdir 1; cd 1
20328           dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
20329           mkdir crerepos-dir
20330           dotest crerepos-13 "${testcvs} add crerepos-dir" \
20331 "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
20332           cd crerepos-dir
20333           touch cfile
20334           dotest crerepos-14 "${testcvs} add cfile" \
20335 "${PROG} add: scheduling file .cfile. for addition
20336 ${PROG} add: use .${PROG} commit. to add this file permanently"
20337           dotest crerepos-15 "${testcvs} -q ci -m add-it" \
20338 "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
20339 done
20340 Checking in cfile;
20341 ${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
20342 initial revision: 1\.1
20343 done"
20344           cd ../..
20345           rm -r 1
20346
20347           mkdir 1; cd 1
20348           dotest crerepos-16 "${testcvs} co first-dir" \
20349 "${PROG} checkout: Updating first-dir
20350 U first-dir/file1"
20351           dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
20352 "${PROG} checkout: Updating crerepos-dir
20353 U crerepos-dir/cfile"
20354           dotest crerepos-18 "${testcvs} update" \
20355 "${PROG} update: Updating first-dir
20356 ${PROG} update: Updating crerepos-dir"
20357
20358           cd ..
20359
20360           CVS_SERVER=$CVS_SERVER_save; export CVS_SERVER
20361
20362           if $keep; then
20363             echo Keeping ${TESTDIR} and exiting due to --keep
20364             exit 0
20365           fi
20366
20367           rm -f $TESTDIR/cvs-setHome
20368           rm -r 1
20369           rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
20370           ;;
20371
20372
20373
20374         crerepos-extssh)
20375           # Various tests relating to creating repositories, operating
20376           # on repositories created with old versions of CVS, etc.
20377
20378           CVS_SERVER_save=$CVS_SERVER
20379
20380           # Because this test is all about -d options and such, it
20381           # at least to some extent needs to be different for remote vs.
20382           # local.
20383           if $remote; then
20384
20385             # Use :extssh: rather than :fork:.  Most of the tests use :fork:,
20386             # so we want to make sure that we test :extssh: _somewhere_.
20387             # Make sure 'ssh' works first.
20388             depends_on_rsh "$CVS_RSH"
20389             if test $? -eq 77; then
20390                 skip crerepos "$skipreason"
20391                 continue
20392             fi
20393
20394             # For remote, just create the repository.  We don't yet do
20395             # the various other tests above for remote but that should be
20396             # changed.
20397             mkdir crerepos
20398             mkdir crerepos/CVSROOT
20399
20400             # Make sure server ignores real ${HOME}/.cvsrc:
20401             cat >$TESTDIR/cvs-setHome <<EOF
20402 #!/bin/sh
20403 HOME=$HOME
20404 export HOME
20405 exec $CVS_SERVER_save "\$@"
20406 EOF
20407             chmod a+x $TESTDIR/cvs-setHome
20408
20409             # Note that we set CVS_SERVER at the beginning.
20410             CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER
20411             CREREPOS_ROOT=:extssh:$host$TESTDIR/crerepos
20412           else
20413
20414             # First, if the repository doesn't exist at all...
20415             dotest_fail crerepos-extssh-1 \
20416 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20417 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
20418             mkdir crerepos
20419
20420             # The repository exists but CVSROOT doesn't.
20421             dotest_fail crerepos-extssh-2 \
20422 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20423 "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
20424             mkdir crerepos/CVSROOT
20425
20426             # Checkout of nonexistent module
20427             dotest_fail crerepos-extssh-3 \
20428 "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
20429 "${PROG} checkout: cannot find module .cvs-sanity. - ignored"
20430
20431             # Now test that CVS works correctly without a modules file
20432             # or any of that other stuff.  In particular, it *must*
20433             # function if administrative files added to CVS recently (since
20434             # CVS 1.3) do not exist, because the repository might have
20435             # been created with an old version of CVS.
20436             mkdir 1; cd 1
20437             dotest crerepos-extssh-4 \
20438 "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
20439 ''
20440             if echo yes | \
20441 ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
20442               pass crerepos-extssh-5
20443             else
20444               fail crerepos-extssh-5
20445             fi
20446             rm -rf CVS
20447             cd ..
20448             # The directory 1 should be empty
20449             dotest crerepos-extssh-6 "rmdir 1"
20450
20451             CREREPOS_ROOT=${TESTDIR}/crerepos
20452
20453           fi
20454
20455           if $remote; then
20456             # Test that CVS rejects a relative path in CVSROOT.
20457             mkdir 1; cd 1
20458             # Note that having the client reject the pathname (as :fork:
20459             # does), does _not_ test for the bugs we are trying to catch
20460             # here.  The point is that malicious clients might send all
20461             # manner of things and the server better protect itself.
20462             dotest_fail crerepos-extssh-6a-r \
20463 "${testcvs} -q -d :extssh:`hostname`:../crerepos get ." \
20464 "${PROG} [a-z]*: CVSROOT may only specify a positive, non-zero, integer port (not .\.\..)\.
20465 ${PROG} [a-z]*: Perhaps you entered a relative pathname${QUESTION}
20466 ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:extssh:${hostname}:\.\./crerepos.\."
20467             cd ..
20468             rm -r 1
20469           else # local
20470             # Test that CVS rejects a relative path in CVSROOT.
20471
20472             mkdir 1; cd 1
20473             # Set CVS_RSH=false since ocassionally (e.g. when CVS_RSH=ssh on
20474             # some systems) some rsh implementations will block because they
20475             # can look up '..' and want to ask the user about the unknown host
20476             # key or somesuch.  Which error message we get depends on whether
20477             # false finishes running before we try to talk to it or not.
20478             dotest_fail crerepos-extssh-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \
20479 "${PROG} \[checkout aborted\]: .*" \
20480 "${PROG} checkout: CVSROOT is set for a remote access method but your
20481 ${PROG} checkout: CVS executable doesn't support it\.
20482 ${PROG} \[checkout aborted\]: Bad CVSROOT: .\.\./crerepos.\."
20483             cd ..
20484             rm -r 1
20485
20486             mkdir 1; cd 1
20487             dotest_fail crerepos-extssh-6b "${testcvs} -d crerepos init" \
20488 "${PROG} init: CVSROOT must be an absolute pathname (not .crerepos.)
20489 ${PROG} init: when using local access method\.
20490 ${PROG} \[init aborted\]: Bad CVSROOT: .crerepos.\."
20491             cd ..
20492             rm -r 1
20493           fi # end of tests to be skipped for remote
20494
20495           # CVS better not create a history file--if the administrator 
20496           # doesn't need it and wants to save on disk space, they just
20497           # delete it.
20498           dotest_fail crerepos-extssh-7 \
20499 "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
20500
20501           # Now test mixing repositories.  This kind of thing tends to
20502           # happen accidentally when people work with several repositories.
20503           mkdir 1; cd 1
20504           dotest crerepos-extssh-8 "${testcvs} -q co -l ." ''
20505           mkdir first-dir
20506           dotest crerepos-extssh-9 "${testcvs} add first-dir" \
20507 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20508           cd first-dir
20509           touch file1
20510           dotest crerepos-extssh-10 "${testcvs} add file1" \
20511 "${PROG} add: scheduling file .file1. for addition
20512 ${PROG} add: use .${PROG} commit. to add this file permanently"
20513           dotest crerepos-extssh-11 "${testcvs} -q ci -m add-it" \
20514 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20515 done
20516 Checking in file1;
20517 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20518 initial revision: 1\.1
20519 done"
20520           cd ../..
20521           rm -r 1
20522
20523           mkdir 1; cd 1
20524           dotest crerepos-extssh-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
20525           mkdir crerepos-dir
20526           dotest crerepos-extssh-13 "${testcvs} add crerepos-dir" \
20527 "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
20528           cd crerepos-dir
20529           touch cfile
20530           dotest crerepos-extssh-14 "${testcvs} add cfile" \
20531 "${PROG} add: scheduling file .cfile. for addition
20532 ${PROG} add: use .${PROG} commit. to add this file permanently"
20533           dotest crerepos-extssh-15 "${testcvs} -q ci -m add-it" \
20534 "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
20535 done
20536 Checking in cfile;
20537 ${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
20538 initial revision: 1\.1
20539 done"
20540           cd ../..
20541           rm -r 1
20542
20543           mkdir 1; cd 1
20544           dotest crerepos-extssh-16 "${testcvs} co first-dir" \
20545 "${PROG} checkout: Updating first-dir
20546 U first-dir/file1"
20547           dotest crerepos-extssh-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
20548 "${PROG} checkout: Updating crerepos-dir
20549 U crerepos-dir/cfile"
20550           dotest crerepos-extssh-18 "${testcvs} update" \
20551 "${PROG} update: Updating first-dir
20552 ${PROG} update: Updating crerepos-dir"
20553
20554           cd ..
20555
20556           CVS_SERVER=$CVS_SERVER_save; export CVS_SERVER
20557
20558           if $keep; then
20559             echo Keeping ${TESTDIR} and exiting due to --keep
20560             exit 0
20561           fi
20562
20563           rm -f $TESTDIR/cvs-setHome
20564           rm -r 1
20565           rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
20566           ;;
20567
20568
20569
20570         rcs)
20571           # Test ability to import an RCS file.  Note that this format
20572           # is fixed--files written by RCS5, and other software which
20573           # implements this format, will be out there "forever" and
20574           # CVS must always be able to import such files.
20575
20576           # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
20577
20578           mkdir ${CVSROOT_DIRNAME}/first-dir
20579
20580           # Currently the way to import an RCS file is to copy it
20581           # directly into the repository.
20582           #
20583           # This file was written by RCS 5.7, and then the dates were
20584           # hacked so that we test year 2000 stuff.  Note also that
20585           # "author" names are just strings, as far as importing
20586           # RCS files is concerned--they need not correspond to user
20587           # IDs on any particular system.
20588           #
20589           # I also tried writing a file with the RCS supplied with
20590           # HPUX A.09.05.  According to "man rcsintro" this is
20591           # "Revision Number: 3.0; Release Date: 83/05/11".  There
20592           # were a few minor differences like whitespace but at least
20593           # in simple cases like this everything else seemed the same
20594           # as the file written by RCS 5.7 (so I won't try to make it
20595           # a separate test case).
20596
20597           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
20598 head    1.3;
20599 access;
20600 symbols;
20601 locks; strict;
20602 comment @# @;
20603
20604
20605 1.3
20606 date    2000.11.24.15.58.37;    author kingdon; state Exp;
20607 branches;
20608 next    1.2;
20609
20610 1.2
20611 date    96.11.24.15.57.41;      author kingdon; state Exp;
20612 branches;
20613 next    1.1;
20614
20615 1.1
20616 date    96.11.24.15.56.05;      author kingdon; state Exp;
20617 branches;
20618 next    ;
20619
20620
20621 desc
20622 @file1 is for testing CVS
20623 @
20624
20625
20626 1.3
20627 log
20628 @delete second line; modify twelfth line
20629 @
20630 text
20631 @This is the first line
20632 This is the third line
20633 This is the fourth line
20634 This is the fifth line
20635 This is the sixth line
20636 This is the seventh line
20637 This is the eighth line
20638 This is the ninth line
20639 This is the tenth line
20640 This is the eleventh line
20641 This is the twelfth line (and what a line it is)
20642 This is the thirteenth line
20643 @
20644
20645
20646 1.2
20647 log
20648 @add more lines
20649 @
20650 text
20651 @a1 1
20652 This is the second line
20653 d11 1
20654 a11 1
20655 This is the twelfth line
20656 @
20657
20658
20659 1.1
20660 log
20661 @add file1
20662 @
20663 text
20664 @d2 12
20665 @
20666 EOF
20667           dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
20668           cd first-dir
20669           dotest rcs-2 "${testcvs} -q log" "
20670 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20671 Working file: file1
20672 head: 1\.3
20673 branch:
20674 locks: strict
20675 access list:
20676 symbolic names:
20677 keyword substitution: kv
20678 total revisions: 3;     selected revisions: 3
20679 description:
20680 file1 is for testing CVS
20681 ----------------------------
20682 revision 1\.3
20683 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
20684 delete second line; modify twelfth line
20685 ----------------------------
20686 revision 1\.2
20687 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
20688 add more lines
20689 ----------------------------
20690 revision 1\.1
20691 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
20692 add file1
20693 ============================================================================="
20694
20695           # Note that the dates here are chosen so that (a) we test
20696           # at least one date after 2000, (b) we will notice if the
20697           # month and day are getting mixed up with each other.
20698           # TODO: also test that year isn't getting mixed up with month
20699           # or day, for example 01-02-03.
20700
20701           # ISO8601 format.  There are many, many, other variations
20702           # specified by ISO8601 which we should be testing too.
20703           dotest rcs-3 "${testcvs} -q log -d '1996-12-11<'" "
20704 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20705 Working file: file1
20706 head: 1\.3
20707 branch:
20708 locks: strict
20709 access list:
20710 symbolic names:
20711 keyword substitution: kv
20712 total revisions: 3;     selected revisions: 1
20713 description:
20714 file1 is for testing CVS
20715 ----------------------------
20716 revision 1\.3
20717 date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
20718 delete second line; modify twelfth line
20719 ============================================================================="
20720
20721           # RFC822 format (as amended by RFC1123).
20722           dotest rcs-4 "${testcvs} -q log -d '<3 Apr 2000 00:00'" \
20723 "
20724 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20725 Working file: file1
20726 head: 1\.3
20727 branch:
20728 locks: strict
20729 access list:
20730 symbolic names:
20731 keyword substitution: kv
20732 total revisions: 3;     selected revisions: 2
20733 description:
20734 file1 is for testing CVS
20735 ----------------------------
20736 revision 1\.2
20737 date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
20738 add more lines
20739 ----------------------------
20740 revision 1\.1
20741 date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
20742 add file1
20743 ============================================================================="
20744
20745           # Intended behavior for "cvs annotate" is that it displays the
20746           # last two digits of the year.  Make sure it does that rather
20747           # than some bogosity like "100".
20748           dotest rcs-4a "${testcvs} annotate file1" \
20749 "
20750 Annotations for file1
20751 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
20752 1\.1          (kingdon  24-Nov-96): This is the first line
20753 1\.2          (kingdon  24-Nov-96): This is the third line
20754 1\.2          (kingdon  24-Nov-96): This is the fourth line
20755 1\.2          (kingdon  24-Nov-96): This is the fifth line
20756 1\.2          (kingdon  24-Nov-96): This is the sixth line
20757 1\.2          (kingdon  24-Nov-96): This is the seventh line
20758 1\.2          (kingdon  24-Nov-96): This is the eighth line
20759 1\.2          (kingdon  24-Nov-96): This is the ninth line
20760 1\.2          (kingdon  24-Nov-96): This is the tenth line
20761 1\.2          (kingdon  24-Nov-96): This is the eleventh line
20762 1\.3          (kingdon  24-Nov-00): This is the twelfth line (and what a line it is)
20763 1\.2          (kingdon  24-Nov-96): This is the thirteenth line"
20764
20765           # Probably should split this test into two at this point (file1
20766           # above this line and file2 below), as the two share little
20767           # data/setup.
20768
20769           # OK, here is another one.  This one was written by hand based on
20770           # doc/RCSFILES and friends.  One subtle point is that none of
20771           # the lines end with newlines; that is a feature which we
20772           # should be testing.
20773           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
20774 head                            1.5                 ;
20775      branch        1.2.6;
20776 access ;
20777 symbols branch:1.2.6;
20778 locks;
20779 testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
20780 1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
20781 1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
20782 1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
20783 1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
20784 1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
20785 1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
20786 desc @@
20787 1.5 log @@ newphrase1; newphrase2 42; text @head revision@
20788 1.4 log @@ text @d1 1
20789 a1 1
20790 new year revision@
20791 1.3 log @@ text @d1 1
20792 a1 1
20793 old year revision@
20794 1.2 log @@ text @d1 1
20795 a1 1
20796 mid revision@ 1.1
20797
20798 log           @@ text @d1 1
20799 a1 1
20800 start revision@
20801 1.2.6.1 log @@ text @d1 1
20802 a1 1
20803 branch revision@
20804 EOF
20805           # ' Match the single quote in above here doc -- for font-lock mode.
20806
20807           # First test the default branch.
20808           dotest rcs-5 "${testcvs} -q update file2" "U file2"
20809           dotest rcs-6 "cat file2" "branch revision"
20810
20811           # Check in a revision on the branch to force CVS to
20812           # interpret every revision in the file.
20813           dotest rcs-6a "$testcvs -q update -r branch file2" 'U file2'
20814           echo "next branch revision" > file2
20815           dotest rcs-6b "${testcvs} -q ci -m mod file2" \
20816 "Checking in file2;
20817 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
20818 new revision: 1\.2\.6\.2; previous revision: 1\.2\.6\.1
20819 done"
20820
20821           # Now get rid of the default branch, it will get in the way.
20822           dotest rcs-7 "${testcvs} admin -b file2" \
20823 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
20824 done"
20825           # But we do want to make sure that "cvs admin" leaves the newphrases
20826           # in the file.
20827           # The extra whitespace regexps are for the RCS library, which does
20828           # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
20829           dotest rcs-8 \
20830 "grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
20831 "testofanewphrase[       ][     ]*@without newphrase we'd have trouble extending @@ all@[        ]*;"
20832           # The easiest way to test for newphrases in deltas and deltatexts
20833           # is to just look at the whole file, I guess.
20834           dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
20835 "head   1\.5;
20836 access;
20837 symbols
20838         branch:1.2.6;
20839 locks;
20840
20841 testofanewphrase        @without newphrase we'd have trouble extending @@ all@;
20842
20843 1\.5
20844 date    71\.01\.01\.01\.00\.00; author joe;     state bogus;
20845 branches;
20846 next    1\.4;
20847
20848 1\.4
20849 date    71\.01\.01\.00\.00\.05; author joe;     state bogus;
20850 branches;
20851 next    1\.3;
20852
20853 1\.3
20854 date    70\.12\.31\.15\.00\.05; author joe;     state bogus;
20855 branches;
20856 next    1\.2;
20857
20858 1\.2
20859 date    70\.12\.31\.12\.15\.05; author me;      state bogus;
20860 branches
20861         1\.2\.6\.1;
20862 next    1\.1;
20863
20864 1\.1
20865 date    70\.12\.31\.11\.00\.05; author joe;     state bogus;
20866 branches;
20867 next    ;
20868 newph   ;
20869
20870 1\.2\.6\.1
20871 date    71\.01\.01\.08\.00\.05; author joe;     state Exp;
20872 branches;
20873 next    1\.2\.6\.2;
20874
20875 1\.2\.6\.2
20876 date    [0-9.]*;        author ${username};     state Exp;
20877 branches;
20878 next    ;
20879
20880
20881 desc
20882 @@
20883
20884
20885 1\.5
20886 log
20887 @@
20888 newphrase1      ;
20889 newphrase2      42;
20890 text
20891 @head revision@
20892
20893
20894 1\.4
20895 log
20896 @@
20897 text
20898 @d1 1
20899 a1 1
20900 new year revision@
20901
20902
20903 1\.3
20904 log
20905 @@
20906 text
20907 @d1 1
20908 a1 1
20909 old year revision@
20910
20911
20912 1\.2
20913 log
20914 @@
20915 text
20916 @d1 1
20917 a1 1
20918 mid revision@
20919
20920
20921 1\.1
20922 log
20923 @@
20924 text
20925 @d1 1
20926 a1 1
20927 start revision@
20928
20929
20930 1\.2\.6\.1
20931 log
20932 @@
20933 text
20934 @d1 1
20935 a1 1
20936 branch revision@
20937
20938
20939 1\.2\.6\.2
20940 log
20941 @mod
20942 @
20943 text
20944 @d1 1
20945 a1 1
20946 next branch revision
20947 @"
20948
20949           dotest rcs-9 "${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2" \
20950 "start revision"
20951
20952           dotest rcs-10 "${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2" \
20953 "mid revision"
20954
20955           dotest rcs-11 "${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2" \
20956 "new year revision"
20957
20958           # Same test as rcs-10, but with am/pm.
20959           dotest rcs-12 "${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2" \
20960 "mid revision"
20961
20962           # Same test as rcs-11, but with am/pm.
20963           dotest rcs-13 "${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2" \
20964 "new year revision"
20965
20966           # OK, now make sure cvs log doesn't have any trouble with the
20967           # newphrases and such.
20968           dotest rcs-14 "${testcvs} -q log file2" "
20969 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
20970 Working file: file2
20971 head: 1\.5
20972 branch:
20973 locks:
20974 access list:
20975 symbolic names:
20976         branch: 1\.2\.6
20977 keyword substitution: kv
20978 total revisions: 7;     selected revisions: 7
20979 description:
20980 ----------------------------
20981 revision 1\.5
20982 date: 1971/01/01 01:00:00;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20983 \*\*\* empty log message \*\*\*
20984 ----------------------------
20985 revision 1\.4
20986 date: 1971/01/01 00:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20987 \*\*\* empty log message \*\*\*
20988 ----------------------------
20989 revision 1\.3
20990 date: 1970/12/31 15:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20991 \*\*\* empty log message \*\*\*
20992 ----------------------------
20993 revision 1\.2
20994 date: 1970/12/31 12:15:05;  author: me;  state: bogus;  lines: ${PLUS}1 -1
20995 branches:  1\.2\.6;
20996 \*\*\* empty log message \*\*\*
20997 ----------------------------
20998 revision 1\.1
20999 date: 1970/12/31 11:00:05;  author: joe;  state: bogus;
21000 \*\*\* empty log message \*\*\*
21001 ----------------------------
21002 revision 1\.2\.6\.2
21003 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
21004 mod
21005 ----------------------------
21006 revision 1\.2\.6\.1
21007 date: 1971/01/01 08:00:05;  author: joe;  state: Exp;  lines: ${PLUS}1 -1
21008 \*\*\* empty log message \*\*\*
21009 ============================================================================="
21010           # Now test each date format for "cvs log -d".
21011           # Earlier than 1971-01-01
21012           dotest rcs-15 "${testcvs} -q log -d '<1971-01-01 00:00 GMT' file2 \
21013             | grep revision" \
21014 "total revisions: 7;    selected revisions: 3
21015 revision 1\.3
21016 revision 1\.2
21017 revision 1\.1"
21018           # Later than 1971-01-01
21019           dotest rcs-16 "${testcvs} -q log -d '1971-01-01 00:00 GMT<' file2 \
21020             | grep revision" \
21021 "total revisions: 7;    selected revisions: 4
21022 revision 1\.5
21023 revision 1\.4
21024 revision 1\.2\.6\.2
21025 revision 1\.2\.6\.1"
21026           # Alternate syntaxes for later and earlier; multiple -d options
21027           dotest rcs-17 "${testcvs} -q log -d '>1971-01-01 00:00 GMT' \
21028             -d '1970-12-31 12:15 GMT>' file2 | grep revision" \
21029 "total revisions: 7;    selected revisions: 5
21030 revision 1\.5
21031 revision 1\.4
21032 revision 1\.1
21033 revision 1\.2\.6\.2
21034 revision 1\.2\.6\.1"
21035           # Range, and single date
21036           dotest rcs-18 "${testcvs} -q log -d '1970-12-31 11:30 GMT' \
21037             -d '1971-01-01 00:00:05 GMT<1971-01-01 01:00:01 GMT' \
21038             file2 | grep revision" \
21039 "total revisions: 7;    selected revisions: 2
21040 revision 1\.5
21041 revision 1\.1"
21042           # Alternate range syntax; equality
21043           dotest rcs-19 "${testcvs} -q log \
21044             -d '1971-01-01 01:00:01 GMT>=1971-01-01 00:00:05 GMT' \
21045             file2 | grep revision" \
21046 "total revisions: 7;    selected revisions: 2
21047 revision 1\.5
21048 revision 1\.4"
21049
21050           cd ..
21051
21052           rm -r first-dir
21053           rm -rf ${CVSROOT_DIRNAME}/first-dir
21054           ;;
21055
21056         rcs2)
21057           # More date tests.  Might as well do this as a separate
21058           # test from "rcs", so that we don't need to perturb the
21059           # "written by RCS 5.7" RCS file.
21060           mkdir ${CVSROOT_DIRNAME}/first-dir
21061           # Significance of various dates:
21062           # * At least one Y2K standard refers to recognizing 9 Sep 1999
21063           #   (as an example of a pre-2000 date, I guess).
21064           # * At least one Y2K standard refers to recognizing 1 Jan 2001
21065           #   (as an example of a post-2000 date, I guess).
21066           # * Many Y2K standards refer to 2000 being a leap year.
21067           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
21068 head 1.7; access; symbols; locks; strict;
21069 1.7 date 2004.08.31.01.01.01; author sue; state; branches; next 1.6;
21070 1.6 date 2004.02.29.01.01.01; author sue; state; branches; next 1.5;
21071 1.5 date 2003.02.28.01.01.01; author sue; state; branches; next 1.4;
21072 1.4 date 2001.01.01.01.01.01; author sue; state; branches; next 1.3;
21073 1.3 date 2000.02.29.01.01.01; author sue; state; branches; next 1.2;
21074 1.2 date 99.09.09.01.01.01; author sue; state; branches; next 1.1;
21075 1.1 date 98.09.10.01.01.01; author sue; state; branches; next;
21076 desc @a test file@
21077 1.7 log @@ text @head revision@
21078 1.6 log @@ text @d1 1
21079 a1 1
21080 2004 was a great year for leaping@
21081 1.5 log @@ text @d1 1
21082 a1 1
21083 2003 wasn't@
21084 1.4 log @@ text @d1 1
21085 a1 1
21086 two year hiatus@
21087 1.3 log @@ text @d1 1
21088 a1 1
21089 2000 is also a good year for leaping@
21090 1.2 log @@ text @d1 1
21091 a1 1
21092 Tonight we're going to party like it's a certain year@
21093 1.1 log @@ text @d1 1
21094 a1 1
21095 Need to start somewhere@
21096 EOF
21097           # ' Match the 3rd single quote in the here doc -- for font-lock mode.
21098
21099           dotest rcs2-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
21100           cd first-dir
21101
21102           # 9 Sep 1999
21103           dotest rcs2-2 "${testcvs} -q update -p -D '1999-09-09 11:30 UT' file1" \
21104 "Tonight we're going to party like it's a certain year"
21105           # 1 Jan 2001.
21106           dotest rcs2-3 "${testcvs} -q update -p -D '2001-01-01 11:30 UT' file1" \
21107 "two year hiatus"
21108           # 29 Feb 2000
21109           dotest rcs2-4 "${testcvs} -q update -p -D '2000-02-29 11:30 UT' file1" \
21110 "2000 is also a good year for leaping"
21111           # 29 Feb 2003 is invalid
21112           dotest_fail rcs2-5 "${testcvs} -q update -p -D '2003-02-29 11:30 UT' file1" \
21113 "${PROG} \[[a-z]* aborted\]: Can't parse date/time: 2003-02-29 11:30 UT"
21114
21115           dotest rcs2-6 "${testcvs} -q update -p -D 2007-01-07 file1" \
21116 "head revision"
21117           # This assumes that the clock of the machine running the tests
21118           # is set to at least the year 1998 or so.  There don't seem
21119           # to be a lot of ways to test the relative date code (short
21120           # of something like LD_LIBRARY_PRELOAD'ing in our own
21121           # getttimeofday, or hacking the CVS source with testing
21122           # features, which always seems to be problematic since then
21123           # someone feels like documenting them and things go downhill
21124           # from there).
21125           # 
21126           # These tests can be expected to fail 3 times every 400 years
21127           # starting Feb. 29, 2096 (because 8 years from that date would
21128           # be Feb. 29, 2100, which is an invalid date -- 2100 isn't a
21129           # leap year because it's divisible by 100 but not by 400).
21130
21131           dotest rcs2-7 "${testcvs} -q update -p -D '96 months' file1" \
21132 "head revision"
21133           dotest rcs2-8 "${testcvs} -q update -p -D '8 years' file1" \
21134 "head revision"
21135
21136           cd ..
21137           rm -r first-dir
21138           rm -rf ${CVSROOT_DIRNAME}/first-dir
21139           ;;
21140
21141         rcs3)
21142           # More RCS file tests, in particular at least some of the
21143           # error handling issues.
21144           mkdir ${CVSROOT_DIRNAME}/first-dir
21145           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
21146 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
21147 ; author jeremiah ;state ;  branches; next;desc@@1.1log@@text@head@
21148 EOF
21149           mkdir 1; cd 1
21150           # CVS requires whitespace between "desc" and its value.
21151           # The rcsfile(5) manpage doesn't really seem to answer the
21152           # question one way or the other (it has a grammar but almost
21153           # nothing about lexical analysis).
21154           dotest_fail rcs3-1 "${testcvs} -q co first-dir" \
21155 "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
21156           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
21157 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
21158 ; author jeremiah ;state ;  branches; next;desc @@1.1log@@text@head@
21159 EOF
21160           # Whitespace issues, likewise.
21161           dotest_fail rcs3-2 "${testcvs} -q co first-dir" \
21162 "${PROG} \[checkout aborted\]: unexpected '.x6c' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
21163           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
21164 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
21165 ; author jeremiah ;state ;  branches; next;desc @@1.1 log@@text@head@
21166 EOF
21167           # Charming array of different messages for similar
21168           # whitespace issues (depending on where the whitespace is).
21169           dotest_fail rcs3-3 "${testcvs} -q co first-dir" \
21170 "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
21171           cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
21172 head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
21173 ; author jeremiah ;state ;  branches; next;desc @@1.1 log @@text @head@
21174 EOF
21175           dotest rcs3-4 "${testcvs} -q co first-dir" 'U first-dir/file1'
21176
21177           # Ouch, didn't expect this one.  FIXCVS.  Or maybe just remove
21178           # the feature, if this is a -s problem?
21179           dotest_fail rcs3-5 "${testcvs} log -s nostate first-dir/file1" \
21180 "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
21181           cd first-dir
21182           dotest_fail rcs3-5a "${testcvs} log -s nostate file1" \
21183 "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
21184           cd ..
21185
21186           # See remote code above for rationale for cd.
21187           cd first-dir
21188           dotest rcs3-6 "${testcvs} log -R file1" \
21189 "${CVSROOT_DIRNAME}/first-dir/file1,v"
21190
21191           # OK, now put an extraneous '\0' at the end.
21192           ${AWK} </dev/null 'BEGIN { printf "@%c", 10 }' | ${TR} '@' '\000' \
21193             >>${CVSROOT_DIRNAME}/first-dir/file1,v
21194           dotest_fail rcs3-7 "${testcvs} log -s nostate file1" \
21195 "${PROG} \[log aborted\]: unexpected '.x0' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
21196
21197           cd ../..
21198           rm -r 1
21199           rm -rf ${CVSROOT_DIRNAME}/first-dir
21200           ;;
21201
21202         rcs4)
21203           # Fix a bug that shows up when checking out files by date with the
21204           # "-D date" command line option.  There is code in the original to
21205           # handle a special case.  If the date search finds revision 1.1 it
21206           # is supposed to check whether revision 1.1.1.1 has the same date
21207           # stamp, which would indicate that the file was originally brought
21208           # in with "cvs import".  In that case it is supposed to return the
21209           # vendor branch version 1.1.1.1.
21210           # 
21211           # However, there is a bug in the code. It actually compares
21212           # the date of revision 1.1 for equality with the date given
21213           # on the command line -- clearly wrong. This commit fixes
21214           # the coding bug.
21215           # 
21216           # There is an additional bug which is _not_ fixed yet. 
21217           # The date comparison should not be a strict
21218           # equality test. It should allow a fudge factor of, say, 2-3
21219           # seconds. Old versions of CVS created the two revisions
21220           # with two separate invocations of the RCS "ci" command. We
21221           # have many old files in the tree in which the dates of
21222           # revisions 1.1 and 1.1.1.1 differ by 1 second.
21223
21224           mkdir rcs4
21225           cd rcs4
21226
21227           mkdir imp-dir
21228           cd imp-dir
21229           echo 'OpenMunger sources' >file1
21230
21231           # choose a time in the past to demonstrate the problem
21232           TZ=GMT touch -t 200012010123 file1
21233
21234           dotest_sort rcs4-1 \
21235 "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_0" \
21236 '
21237
21238 N rcs4-dir/file1
21239 No conflicts created by this import'
21240           echo 'OpenMunger sources release 1.1 extras' >>file1
21241           TZ=GMT touch -t 200112011234 file1
21242           dotest_sort rcs4-2 \
21243 "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_1" \
21244 '
21245
21246 No conflicts created by this import
21247 U rcs4-dir/file1'
21248           cd ..
21249           # Next checkout the new module
21250           dotest rcs4-3 \
21251 "${testcvs} -q co rcs4-dir" \
21252 'U rcs4-dir/file1'
21253           cd rcs4-dir
21254           echo 'local change' >> file1
21255
21256           # commit a local change
21257           dotest rcs4-4 \
21258 "${testcvs} -q commit -m hack file1" \
21259 "Checking in file1;
21260 ${CVSROOT_DIRNAME}/rcs4-dir/file1,v  <--  file1
21261 new revision: 1\.2; previous revision: 1\.1
21262 done"
21263           # now see if we get version 1.1 or 1.1.1.1 when we ask for
21264           # a checkout by time... it really should be 1.1.1.1 as
21265           # that was indeed the version that was visible at the target
21266           # time.
21267           dotest rcs4-5 \
21268 "${testcvs} -q update -D 'October 1, 2001 UTC' file1" \
21269 '[UP] file1'
21270           dotest rcs4-6 \
21271 "${testcvs} -q status file1" \
21272 '===================================================================
21273 File: file1             Status: Up-to-date
21274
21275    Working revision:    1\.1\.1\.1.*
21276    Repository revision: 1\.1\.1\.1      '${CVSROOT_DIRNAME}'/rcs4-dir/file1,v
21277    Sticky Tag:          (none)
21278    Sticky Date:         2001\.10\.01\.00\.00\.00
21279    Sticky Options:      (none)'
21280
21281           if $keep; then
21282             echo Keeping ${TESTDIR} and exiting due to --keep
21283             exit 0
21284           fi
21285
21286           cd ../..
21287           rm -r rcs4
21288           rm -rf ${CVSROOT_DIRNAME}/rcs4-dir
21289           ;;
21290
21291
21292
21293         rcs5)
21294           # Some tests of the $Log keyword and log message without a trailing
21295           # EOL.  This used to look ugly and, in the worst case, could cause
21296           # a seg fault due to a buffer overflow.
21297           #
21298           # Note that it should not be possible to create this situation via a
21299           # CVS server (and any client), since the server itself inserts the
21300           # trailing EOL onto log messages that are missing one.  Still, we
21301           # shouldn't segfault due to a corrupt RCS file and I think that a log
21302           # message without the trailing EOL doesn't actually violate the RCS
21303           # spec, though it doesn't appear to be possible to create such a log
21304           # message using RCS 5.7.
21305
21306           mkdir $CVSROOT_DIRNAME/rcs5
21307           cat <<\EOF >$CVSROOT_DIRNAME/rcs5/file1,v
21308 head 1.1;
21309 access;
21310 symbols;
21311 locks;
21312 expand kv;
21313
21314 1.1 date 2007.03.20.04.03.02; author jeremiah; state Ext;  branches; next;
21315
21316 desc
21317 @@
21318
21319 1.1
21320 log
21321 @he always had very fine wine@
21322 text
21323 @line1
21324 /*
21325 EOF
21326 echo ' * Revision history: $''Log$' >>$CVSROOT_DIRNAME/rcs5/file1,v
21327           cat <<\EOF >>$CVSROOT_DIRNAME/rcs5/file1,v
21328  */
21329 line5
21330 @
21331 EOF
21332
21333           mkdir rcs5
21334           cd rcs5
21335           dotest rcs5-1 "$testcvs -Q co rcs5"
21336           dotest rcs5-2 "cat rcs5/file1" \
21337 "line1
21338 /\\*
21339  \\* Revision history: "'\$'"Log: file1,v "'\$'"
21340  \\* Revision history: Revision 1\.1  2007/03/20 04:03:02  jeremiah
21341  \\* Revision history: he always had very fine wine
21342  \\* Revision history:
21343  \\*/
21344 line5"
21345
21346           cd ..
21347           rm -r rcs5
21348           rm -rf $CVSROOT_DIRNAME/rcs5
21349           ;;
21350
21351
21352
21353         rcs6)
21354           # Test that CVS notices a specific type of corruption in the RCS
21355           # archive.  In the past, this type of corruption had turned up after
21356           # a user ineptly attempted to delete a revision from an arcvhive 
21357           # manually.
21358           mkdir rcs6; cd rcs6
21359
21360           # Make the project.
21361           dotest rcs6-init-1 "$testcvs -Q co -ld top .; cd top"
21362           mkdir rcs6
21363           dotest rcs6-init-2 "$testcvs -Q add rcs6"
21364           cd rcs6
21365
21366           # Populate it.
21367           echo some words >afile
21368           dotest rcs6-init-3 "$testcvs -Q add afile"
21369           dotest rcs6-init-4 "$testcvs -Q ci -mnewfile afile" \
21370 "RCS file: $CVSROOT_DIRNAME/rcs6/afile,v
21371 done
21372 Checking in afile;
21373 $CVSROOT_DIRNAME/rcs6/afile,v  <--  afile
21374 initial revision: 1\.1
21375 done"
21376           echo more words >>afile
21377           dotest rcs6-init-5 "$testcvs -Q ci -mrev2 afile" \
21378 "Checking in afile;
21379 $CVSROOT_DIRNAME/rcs6/afile,v  <--  afile
21380 new revision: 1\.2; previous revision: 1\.1
21381 done"
21382
21383           # Corrupt the archive.
21384           sed -e '8,12d' \
21385               -e 's/^head       1\.2/head       1.1/' \
21386               <$CVSROOT_DIRNAME/rcs6/afile,v \
21387               >$CVSROOT_DIRNAME/rcs6/cfile,v
21388
21389           # Update used to work.
21390           dotest_fail rcs6-1 "$testcvs -q up" \
21391 "$PROG \[update aborted\]: Expected head revision 1\.1, found 1\.2\."
21392
21393           # Then a commit hosed the archive further without any warnings.
21394           # Updating to an old revision (e.g. 1.1) would have reported the
21395           # corruption.  A second commit would have deleted data from the
21396           # file.
21397
21398           if $keep; then
21399             echo Keeping $TESTDIR and exiting due to --keep
21400             exit 0
21401           fi
21402
21403           cd ../../..
21404           rm -r rcs6
21405           rm -rf $CVSROOT_DIRNAME/rcs6
21406           ;;
21407
21408
21409
21410         lockfiles)
21411           # Tests of CVS lock files.
21412           # TODO-maybe: Add a test where we arrange for a loginfo
21413           # script (or some such) to ensure that locks are in place
21414           # so then we can see how they are behaving.
21415
21416           mkdir 1; cd 1
21417           mkdir sdir
21418           mkdir sdir/ssdir
21419           echo file >sdir/ssdir/file1
21420           dotest lockfiles-1 \
21421 "${testcvs} -Q import -m import-it first-dir bar baz" ""
21422           cd ..
21423
21424           mkdir 2; cd 2
21425           dotest lockfiles-2 "${testcvs} -q co first-dir" \
21426 "U first-dir/sdir/ssdir/file1"
21427           dotest lockfiles-3 "${testcvs} -Q co CVSROOT" ""
21428           cd CVSROOT
21429           echo "LockDir=${TESTDIR}/locks" >config
21430           dotest lockfiles-4 "${testcvs} -q ci -m config-it" \
21431 "Checking in config;
21432 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
21433 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
21434 done
21435 ${PROG} commit: Rebuilding administrative file database"
21436           cd ../first-dir/sdir/ssdir
21437           # The error message appears twice because Lock_Cleanup only
21438           # stops recursing after the first attempt.
21439           dotest_fail lockfiles-5 "${testcvs} -q update" \
21440 "${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory
21441 ${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory"
21442           mkdir ${TESTDIR}/locks
21443           # Grumble, mumble.  Cygwin.
21444           if test -n "$remotehost"; then
21445             $CVS_RSH $remotehost "chmod u=rwx,g=r,o= ${TESTDIR}/locks"
21446           else
21447             chmod u=rwx,g=r,o= ${TESTDIR}/locks
21448           fi
21449           umask 0077
21450           CVSUMASK=0077; export CVSUMASK
21451           dotest lockfiles-6 "${testcvs} -q update" ""
21452           # TODO: should also be testing that CVS continues to honor the
21453           # umask and CVSUMASK normally.  In the case of the umask, CVS
21454           # doesn't seem to use it for much (although it perhaps should).
21455           dotest lockfiles-7 "ls ${TESTDIR}/locks/first-dir/sdir/ssdir" ""
21456
21457           # The policy is that when CVS creates new lock directories, they
21458           # inherit the permissions from the parent directory.  CVSUMASK
21459           # isn't right, because typically the reason for LockDir is to
21460           # use a different set of permissions.
21461           #
21462           # Bah!  Cygwin!
21463           if test -n "$remotehost"; then
21464             dotest lockfiles-7a "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir'" \
21465 "drwxr-----.*first-dir"
21466             dotest lockfiles-7b "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir'" \
21467 "drwxr-----.*first-dir/sdir/ssdir"
21468           else
21469             dotest lockfiles-7a "ls -ld ${TESTDIR}/locks/first-dir" \
21470 "drwxr-----.*first-dir"
21471             dotest lockfiles-7b "ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir" \
21472 "drwxr-----.*first-dir/sdir/ssdir"
21473           fi
21474
21475           cd ../../..
21476           dotest lockfiles-8 "${testcvs} -q update" ""
21477           dotest lockfiles-9 "${testcvs} -q co -l ." ""
21478
21479           ###
21480           ### There are race conditions in the following tests, but hopefully
21481           ### the 5 seconds the first process waits to remove the lockdir and
21482           ### the 30 seconds CVS waits betweens checks will be significant
21483           ### enough to render the case moot.
21484           ###
21485           # Considers the following cases:
21486           #
21487           #                    Lock Present
21488           # Operation          Allowed (case #)
21489           #
21490           #                    Read      Write
21491           #                    _______   ______
21492           # Read              |Yes (1)   No (3)
21493           # Write             |No (7)    No (9)
21494           #
21495           # Tests do not appear in same ordering as table.  The odd numbering
21496           # scheme maintains correspondance with a larger table on 1.12.x:
21497           # 1. Read when read locks are present...
21498           # 3. Don't read when write locks present...
21499           # 7. Don't write when read locks are present...
21500           # 9. Don't write when write locks are present...
21501
21502           # 3. Don't read when write locks present...
21503           mkdir "$TESTDIR/locks/first-dir/#cvs.lock"
21504           (sleep 5; rmdir "$TESTDIR/locks/first-dir/#cvs.lock")&
21505           dotest lockfiles-10 "$testcvs -q co -l first-dir" \
21506 "$PROG checkout: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir
21507 $PROG checkout: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir"
21508
21509           # 1. Read when read locks are present...
21510           touch "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock"
21511           dotest lockfiles-11 "$testcvs -q co -l first-dir"
21512           rm "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock"
21513
21514           # 7. Don't write when read locks are present...
21515           echo I always have trouble coming up with witty text for the test files >>first-dir/sdir/ssdir/file1
21516           touch "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock"
21517           (sleep 5; rm "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock")&
21518           dotest lockfiles-13 "$testcvs -q ci -mconflict first-dir" \
21519 "$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
21520 $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
21521 Checking in first-dir/sdir/ssdir/file1;
21522 $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v  <--  file1
21523 new revision: 1\.2; previous revision: 1\.1
21524 done"
21525
21526           # 9. Don't write when write locks are present...
21527           echo yet this poem would probably only give longfellow bile >>first-dir/sdir/ssdir/file1
21528           mkdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock"
21529           (sleep 5; rmdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock")&
21530           dotest lockfiles-19 "$testcvs -q ci -mnot-up-to-date first-dir" \
21531 "$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
21532 $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
21533 Checking in first-dir/sdir/ssdir/file1;
21534 $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v  <--  file1
21535 new revision: 1\.3; previous revision: 1\.2
21536 done"
21537
21538           # 10. Don't write when history locks are present...
21539           echo have you ever heard a poem quite so vile\? >>first-dir/sdir/ssdir/file1
21540           mkdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock"
21541           (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock")&
21542           dotest lockfiles-20 "$testcvs -q ci -mnot-up-to-date first-dir" \
21543 "Checking in first-dir/sdir/ssdir/file1;
21544 $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v  <--  file1
21545 new revision: 1\.4; previous revision: 1\.3
21546 done
21547 $PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT
21548 $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT"
21549
21550           dotest lockfiles-21 "$testcvs -Q tag newtag first-dir"
21551
21552           rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags
21553           mkdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock"
21554           (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock")&
21555           dotest lockfiles-22 "$testcvs -q up -r newtag first-dir" \
21556 "$PROG update: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT
21557 $PROG update: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT
21558 [UP] first-dir/sdir/ssdir/file1"
21559
21560           cd CVSROOT
21561           echo "# nobody here but us comments" >config
21562           dotest lockfiles-cleanup-1 "${testcvs} -q ci -m config-it" \
21563 "Checking in config;
21564 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
21565 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
21566 done
21567 ${PROG} commit: Rebuilding administrative file database"
21568           cd ../..
21569           # Perhaps should restore the umask and CVSUMASK to what they
21570           # were before.  But the other tests "should" not care about them...
21571           umask 0077
21572           unset CVSUMASK
21573           rm -r ${TESTDIR}/locks
21574           rm -r 1 2
21575           rm -rf ${CVSROOT_DIRNAME}/first-dir
21576           ;;
21577
21578         backuprecover)
21579           # Tests to make sure we get the expected behavior
21580           # when we recover a repository from an old backup
21581           #
21582           # Details:
21583           #   Backup will be older than some developer's workspaces
21584           #     This means the first attempt at an update will fail
21585           #     The workaround for this is to replace the CVS
21586           #       directories with those from a "new" checkout from
21587           #       the recovered repository.  Due to this, multiple
21588           #       merges should cause conflicts (the same data
21589           #       will be merged more than once).
21590           #     A workspace updated before the date of the recovered
21591           #       copy will not need any extra attention
21592           #
21593           # Note that backuprecover-15 is probably a failure case
21594           #   If nobody else had a more recent update, the data would be lost
21595           #     permanently
21596           #   Granted, the developer should have been notified not to do this
21597           #     by now, but still...
21598           #
21599           mkdir backuprecover; cd backuprecover
21600           mkdir 1; cd 1
21601           dotest backuprecover-1 "${testcvs} -q co -l ." ''
21602           mkdir first-dir
21603           dotest backuprecover-2 "${testcvs} add first-dir" \
21604 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
21605           cd first-dir
21606           mkdir dir
21607           dotest backuprecover-3 "${testcvs} add dir" \
21608 "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository"
21609           touch file1 dir/file2
21610           dotest backuprecover-4 "${testcvs} -q add file1 dir/file2" \
21611 "${PROG} add: use .${PROG} commit. to add these files permanently"
21612           dotest backuprecover-5 "${testcvs} -q ci -mtest" \
21613 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21614 done
21615 Checking in file1;
21616 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21617 initial revision: 1\.1
21618 done
21619 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21620 done
21621 Checking in dir/file2;
21622 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21623 initial revision: 1\.1
21624 done"
21625           echo "Line one" >>file1
21626           echo "  is the place" >>file1
21627           echo "    we like to begin" >>file1
21628           echo "Anything else" >>file1
21629           echo "  looks like" >>file1
21630           echo "    a sin" >>file1
21631           echo "File 2" >>dir/file2
21632           echo "  is the place" >>dir/file2
21633           echo "    the rest of it goes"  >>dir/file2
21634           echo "Why I don't use" >>dir/file2
21635           echo "  something like 'foo'" >>dir/file2
21636           echo "    God only knows" >>dir/file2
21637           dotest backuprecover-6 "${testcvs} -q ci -mtest" \
21638 "Checking in file1;
21639 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21640 new revision: 1\.2; previous revision: 1\.1
21641 done
21642 Checking in dir/file2;
21643 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21644 new revision: 1\.2; previous revision: 1\.1
21645 done"
21646
21647           # Simulate the lazy developer
21648           # (he did some work but didn't check it in...)
21649           cd ../..
21650           mkdir 2; cd 2
21651           dotest backuprecover-7 "${testcvs} -Q co first-dir" ''
21652           cd first-dir
21653           sed -e "s/looks like/just looks like/" file1 >tmp; mv tmp file1
21654           sed -e "s/don't use/don't just use/" dir/file2 >tmp; mv tmp dir/file2
21655
21656           # developer 1 is on a roll
21657           cd ../../1/first-dir
21658           echo "I need some more words" >>file1
21659           echo "  to fill up this space" >>file1
21660           echo "    anything else would be a disgrace" >>file1
21661           echo "My rhymes cross many boundries" >>dir/file2
21662           echo "  this time it's files" >>dir/file2
21663           echo "    a word that fits here would be something like dials" >>dir/file2
21664           dotest backuprecover-8 "${testcvs} -q ci -mtest" \
21665 "Checking in file1;
21666 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21667 new revision: 1\.3; previous revision: 1\.2
21668 done
21669 Checking in dir/file2;
21670 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21671 new revision: 1\.3; previous revision: 1\.2
21672 done"
21673
21674           # Save a backup copy
21675           cp -r ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/backup
21676
21677           # Simulate developer 3
21678           cd ../..
21679           mkdir 3; cd 3
21680           dotest backuprecover-9a "${testcvs} -Q co first-dir" ''
21681           cd first-dir
21682           echo >>file1
21683           echo >>dir/file2
21684           echo "Developer 1 makes very lame rhymes" >>file1
21685           echo "  I think he should quit and become a mime" >>file1
21686           echo "What the %*^# kind of rhyme crosses a boundry?" >>dir/file2
21687           echo "  I think you should quit and get a job in the foundry" >>dir/file2
21688           dotest backuprecover-9b "${testcvs} -q ci -mtest" \
21689 "Checking in file1;
21690 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21691 new revision: 1\.4; previous revision: 1\.3
21692 done
21693 Checking in dir/file2;
21694 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21695 new revision: 1\.4; previous revision: 1\.3
21696 done"
21697
21698           # Developer 4 so we can simulate a conflict later...
21699           cd ../..
21700           mkdir 4; cd 4
21701           dotest backuprecover-10 "${testcvs} -Q co first-dir" ''
21702           cd first-dir
21703           sed -e "s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
21704
21705           # And back to developer 1
21706           cd ../../1/first-dir
21707           dotest backuprecover-11 "${testcvs} -Q update" ''
21708           echo >>file1
21709           echo >>dir/file2
21710           echo "Oh yeah, well rhyme this" >>file1
21711           echo "  developer three" >>file1
21712           echo "    you want opposition" >>file1
21713           echo "      you found some in me!" >>file1
21714           echo "I'll give you mimes" >>dir/file2
21715           echo "  and foundries galore!"  >>dir/file2
21716           echo "    your head will spin" >>dir/file2
21717           echo "      once you find what's in store!" >>dir/file2
21718           dotest backuprecover-12 "${testcvs} -q ci -mtest" \
21719 "Checking in file1;
21720 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21721 new revision: 1\.5; previous revision: 1\.4
21722 done
21723 Checking in dir/file2;
21724 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21725 new revision: 1\.5; previous revision: 1\.4
21726 done"
21727
21728           # developer 3'll do a bit of work that never gets checked in
21729           cd ../../3/first-dir
21730           dotest backuprecover-13 "${testcvs} -Q update" ''
21731           sed -e "s/very/some extremely/" file1 >tmp; mv tmp file1
21732           dotest backuprecover-14 "${testcvs} -q ci -mtest" \
21733 "Checking in file1;
21734 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21735 new revision: 1\.6; previous revision: 1\.5
21736 done"
21737           echo >>file1
21738           echo "Tee hee hee hee" >>file1
21739           echo >>dir/file2
21740           echo "Find what's in store?" >>dir/file2
21741           echo "  Oh, I'm so sure!" >>dir/file2
21742           echo "    You've got an ill, and I have the cure!"  >>dir/file2
21743
21744           # Slag the original and restore it a few revisions back
21745           rm -rf ${CVSROOT_DIRNAME}/first-dir
21746           mv ${CVSROOT_DIRNAME}/backup ${CVSROOT_DIRNAME}/first-dir
21747
21748           # Have developer 1 try an update and lose some data
21749           #
21750           # Feel free to imagine the horrific scream of despair
21751           cd ../../1/first-dir
21752           dotest backuprecover-15 "${testcvs} update" \
21753 "${PROG} update: Updating .
21754 U file1
21755 ${PROG} update: Updating dir
21756 U dir/file2"
21757
21758           # Developer 3 tries the same thing (he has an office)
21759           # but fails without losing data since all of his files have
21760           # uncommitted changes
21761           cd ../../3/first-dir
21762           dotest_fail backuprecover-16 "${testcvs} update" \
21763 "${PROG} update: Updating \.
21764 ${PROG} \[update aborted\]: could not find desired version 1\.6 in ${CVSROOT_DIRNAME}/first-dir/file1,v"
21765
21766           # create our workspace fixin' script
21767           cd ../..
21768           echo \
21769 "#!/bin/sh
21770
21771 # This script will copy the CVS database dirs from the checked out
21772 # version of a newly recovered repository and replace the CVS
21773 # database dirs in a workspace with later revisions than those in the
21774 # recovered repository
21775 cd repos-first-dir
21776 DATADIRS=\`find . -name CVS -print\`
21777 cd ../first-dir
21778 find . -name CVS -print | xargs rm -rf
21779 for file in \${DATADIRS}; do
21780         cp -r ../repos-first-dir/\${file} \${file}
21781 done" >fixit
21782
21783           # We only need to fix the workspaces of developers 3 and 4
21784           # (1 lost all her data and 2 has an update date from
21785           # before the date the backup was made)
21786           cd 3
21787           dotest backuprecover-17 \
21788                 "${testcvs} -Q co -d repos-first-dir first-dir" ''
21789           cd ../4
21790           dotest backuprecover-18 \
21791                 "${testcvs} -Q co -d repos-first-dir first-dir" ''
21792           sh ../fixit
21793           cd ../3; sh ../fixit
21794
21795           # (re)commit developer 3's stuff
21796           cd first-dir
21797           dotest backuprecover-19 "${testcvs} -q ci -mrecover/merge" \
21798 "Checking in file1;
21799 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21800 new revision: 1\.4; previous revision: 1\.3
21801 done
21802 Checking in dir/file2;
21803 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21804 new revision: 1\.4; previous revision: 1\.3
21805 done"
21806
21807           # and we should get a conflict on developer 4's stuff
21808           cd ../../4/first-dir
21809           dotest backuprecover-20 "${testcvs} update" \
21810 "${PROG} update: Updating \.
21811 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21812 retrieving revision 1\.3
21813 retrieving revision 1\.4
21814 Merging differences between 1\.3 and 1\.4 into file1
21815 rcsmerge: warning: conflicts during merge
21816 ${PROG} update: conflicts found in file1
21817 C file1
21818 ${PROG} update: Updating dir
21819 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21820 retrieving revision 1\.3
21821 retrieving revision 1\.4
21822 Merging differences between 1\.3 and 1\.4 into file2
21823 rcsmerge: warning: conflicts during merge
21824 ${PROG} update: conflicts found in dir/file2
21825 C dir/file2"
21826           sed -e \
21827 "/^<<<<<<</,/^=======/d
21828 /^>>>>>>>/d" file1 >tmp; mv tmp file1
21829           sed -e \
21830 "/^<<<<<<</,/^=======/d
21831 /^>>>>>>>/d
21832 s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
21833           dotest backuprecover-21 "${testcvs} -q ci -mrecover/merge" \
21834 "Checking in dir/file2;
21835 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21836 new revision: 1\.5; previous revision: 1\.4
21837 done"
21838
21839           # go back and commit developer 2's stuff to prove it can still be done
21840           cd ../../2/first-dir
21841           dotest backuprecover-22 "${testcvs} -Q update" \
21842 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21843 retrieving revision 1\.2
21844 retrieving revision 1\.4
21845 Merging differences between 1\.2 and 1\.4 into file1
21846 RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21847 retrieving revision 1\.2
21848 retrieving revision 1\.5
21849 Merging differences between 1\.2 and 1\.5 into file2"
21850           dotest backuprecover-23 "${testcvs} -q ci -mtest" \
21851 "Checking in file1;
21852 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21853 new revision: 1\.5; previous revision: 1\.4
21854 done
21855 Checking in dir/file2;
21856 ${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21857 new revision: 1\.6; previous revision: 1\.5
21858 done"
21859
21860           # and restore the data to developer 1
21861           cd ../../1/first-dir
21862           dotest backuprecover-24 "${testcvs} -Q update" ''
21863
21864           cd ../../..
21865           rm -r backuprecover
21866           rm -rf ${CVSROOT_DIRNAME}/first-dir
21867           ;;
21868
21869
21870
21871         sshstdio)
21872           # CVS_RSH=ssh can have a problem with a non-blocking stdio
21873           # in some cases. So, this test is all about testing :ext:
21874           # with CVS_RSH=ssh. The problem is that not all machines
21875           # will necessarily have ssh available, so be prepared to
21876           # skip this test.
21877
21878           # Are we able to run find and use an ssh?
21879           if $remote; then :; else
21880             continue
21881           fi
21882
21883           depends_on_ssh
21884           if test $? -eq 77; then
21885             skip sshstdio "$skipreason"
21886             continue
21887           fi
21888
21889           SSHSTDIO_ROOT=:ext:$host$CVSROOT_DIRNAME
21890
21891           mkdir sshstdio; cd sshstdio
21892           dotest sshstdio-1 "$testcvs -d $SSHSTDIO_ROOT -q co -l ."
21893           mkdir first-dir
21894           dotest sshstdio-2 "$testcvs add first-dir" \
21895   "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
21896           cd first-dir
21897           a='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
21898           c='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
21899           # Generate 1024 lines of $a
21900           cnt=0
21901           echo $a > aaa
21902           while [ $cnt -lt 5 ] ; do
21903             cnt=`expr $cnt + 1` ;
21904             mv aaa aaa.old
21905             cat aaa.old aaa.old aaa.old aaa.old > aaa
21906           done
21907           dotest sshstdio-3 "$testcvs -q add aaa" \
21908 "$PROG add: use .$PROG commit. to add this file permanently"
21909           dotest sshstdio-4 "$testcvs -q ci -mcreate aaa" \
21910 "RCS file: $CVSROOT_DIRNAME/first-dir/aaa,v
21911 done
21912 Checking in aaa;
21913 $CVSROOT_DIRNAME/first-dir/aaa,v  <--  aaa
21914 initial revision: 1\.1
21915 done"
21916           # replace lines 1, 512, 513, 1024 with $c
21917           sed 510q < aaa > aaa.old
21918           (echo $c; cat aaa.old; echo $c; \
21919            echo $c; cat aaa.old; echo $c) > aaa
21920           dotest sshstdio-5 "$testcvs -q ci -mmodify-it aaa" \
21921 "Checking in aaa;
21922 $CVSROOT_DIRNAME/first-dir/aaa,v  <--  aaa
21923 new revision: 1\.2; previous revision: 1\.1
21924 done"
21925           cat > wrapper.sh <<EOF
21926 #!$TESTSHELL
21927 exec "\$@" 2>&1 < /dev/null | cat
21928 EOF
21929           chmod +x wrapper.sh
21930           ./wrapper.sh \
21931            $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \
21932              aaa \
21933            |sed -e \
21934 '/^Write failed flushing stdout buffer\.\r$/d;
21935  /^write stdout: Broken pipe\r$/d;
21936  :retry;
21937  /Write failed flushing stdout buffer\.\r$/{
21938         N;
21939         s/Write failed flushing stdout buffer\.\r\n//;
21940         b retry;
21941 }
21942  /write stdout: Broken pipe\r$/{
21943         N;
21944         s/write stdout: Broken pipe\r\n//;
21945         b retry;
21946 }' \
21947           > wrapper.dif
21948   
21949           $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \
21950              aaa > good.dif
21951   
21952           dotest sshstdio-6 "cmp wrapper.dif good.dif"
21953
21954           if $keep; then
21955             echo Keeping $TESTDIR and exiting due to --keep
21956             exit 0
21957           fi
21958   
21959           cd ../..
21960           CVS_RSH=$save_CVS_RSH; export CVS_RSH
21961           rm -r sshstdio
21962           rm -rf $CVSROOT_DIRNAME/first-dir
21963           ;;
21964
21965
21966
21967         parseroot2)
21968           # Test some :ext: roots for consistancy.
21969           if $remote; then :; else
21970             continue
21971           fi
21972
21973           depends_on_rsh "$CVS_RSH"
21974           if test $? -eq 77; then
21975             skip parseroot2 "$skipreason"
21976             continue
21977           fi
21978
21979           # Test checking out and subsequently updating with some different
21980           # CVSROOTs.
21981
21982           # A standard case, hostname:dirname.
21983           mkdir parseroot2; cd parseroot2
21984           save_CVSROOT=$CVSROOT
21985           CVSROOT=$host:$CVSROOT_DIRNAME
21986           dotest parseroot2-1 "$testcvs -Q co CVSROOT"
21987           cd CVSROOT
21988           dotest parseroot2-2 "$testcvs -Q up"
21989           cd ..
21990
21991           # A degenerate remote case, just the server name and the directory
21992           # name, with no :'s to help parsing.  It can be mistaken for a
21993           # relative directory name.
21994           rm -r CVSROOT
21995           CVSROOT=$host$CVSROOT_DIRNAME
21996           dotest parseroot2-3 "$testcvs -Q co CVSROOT"
21997           cd CVSROOT
21998           dotest parseroot2-4 "$testcvs -Q up"
21999
22000           if $keep; then
22001             echo Keeping $TESTDIR and exiting due to --keep
22002             exit 0
22003           fi
22004   
22005           cd ../..
22006           CVSROOT=$save_CVSROOT
22007           rm -r parseroot2
22008           ;;
22009
22010
22011
22012         history)
22013           # CVSROOT/history tests:
22014           # history: various "cvs history" invocations
22015           # basic2: Generating the CVSROOT/history file via CVS commands.
22016
22017           # Put in some data for the history file (discarding what was
22018           # there before).  Note that this file format is fixed; the
22019           # user may wish to analyze data from a previous version of
22020           # CVS.  If we phase out this format, it should be done
22021           # slowly and carefully.
22022           cat >${CVSROOT_DIRNAME}/CVSROOT/history <<EOF
22023 O3395c677|anonymous|<remote>/*0|ccvs||ccvs
22024 O3396c677|anonymous|<remote>/src|ccvs||src
22025 O3397c677|kingdon|<remote>/*0|ccvs||ccvs
22026 M339cafae|nk|<remote>|ccvs/src|1.229|sanity.sh
22027 M339cafff|anonymous|<remote>|ccvs/src|1.23|Makefile
22028 M339dc339|kingdon|~/work/*0|ccvs/src|1.231|sanity.sh
22029 W33a6eada|anonymous|<remote>*4|ccvs/emx||Makefile.in
22030 C3b235f50|kingdon|<remote>|ccvs/emx|1.3|README
22031 M3b23af50|kingdon|~/work/*0|ccvs/doc|1.281|cvs.texinfo
22032 EOF
22033           dotest history-1 "${testcvs} history -e -a" \
22034 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs     =ccvs= <remote>/\*
22035 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs     =src=  <remote>/\*
22036 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22037 W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
22038 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs     =ccvs= <remote>/\*
22039 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
22040 C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
22041 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc
22042 M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity\.sh   ccvs/src == <remote>"
22043
22044           dotest history-2 "${testcvs} history -e -a -D '10 Jun 1997 13:00 UT'" \
22045 "W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
22046 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
22047 C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
22048 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
22049
22050           dotest history-3 "${testcvs} history -e -a -D '10 Jun 2001 13:00 UT'" \
22051 "M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
22052
22053           dotest history-4 "${testcvs} history -ac sanity.sh" \
22054 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22055 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22056
22057           dotest history-5 "${testcvs} history -a -xCGUWAMR README sanity.sh" \
22058 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22059 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22060 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22061
22062           dotest history-6 "${testcvs} history -xCGUWAMR -a -f README -f sanity.sh" \
22063 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22064 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22065 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22066
22067           dotest history-7 "${testcvs} history -xCGUWAMR -a -f sanity.sh README" \
22068 "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22069 C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22070 M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22071
22072           dotest history-8 "${testcvs} history -ca -D '1970-01-01 00:00 UT'" \
22073 "M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity.sh   ccvs/src == <remote>
22074 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22075 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src
22076 M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc"
22077
22078           dotest history-9 "${testcvs} history -acl" \
22079 "M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
22080 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22081 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
22082
22083           dotest history-10 "${testcvs} history -lca -D '1970-01-01 00:00 UT'" \
22084 "M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
22085 M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22086 M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
22087
22088           dotest history-11 "${testcvs} history -aw" \
22089 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
22090 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
22091 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
22092
22093           dotest history-12 "${testcvs} history -aw -D'1970-01-01 00:00 UT'" \
22094 "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
22095 O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
22096 O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
22097           ;;
22098
22099         big)
22100
22101           # Test ability to operate on big files.  Intention is to
22102           # test various realloc'ing code in RCS_deltas, rcsgetkey,
22103           # etc.  "big" is currently defined to be 1000 lines (64000
22104           # bytes), which in terms of files that users will use is not
22105           # large, merely average, but my reasoning is that this
22106           # should be big enough to make sure realloc'ing is going on
22107           # and that raising it a lot would start to stress resources
22108           # on machines which run the tests, without any significant
22109           # benefit.
22110
22111           mkdir ${CVSROOT_DIRNAME}/first-dir
22112           dotest big-1 "${testcvs} -q co first-dir" ''
22113           cd first-dir
22114           for i in 0 1 2 3 4 5 6 7 8 9; do
22115             for j in 0 1 2 3 4 5 6 7 8 9; do
22116               for k in 0 1 2 3 4 5 6 7 8 9; do
22117                 echo \
22118 "This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
22119               done
22120             done
22121           done
22122           dotest big-2 "${testcvs} add file1" \
22123 "${PROG} add: scheduling file .file1. for addition
22124 ${PROG} add: use .${PROG} commit. to add this file permanently"
22125           dotest big-3 "${testcvs} -q ci -m add" \
22126 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22127 done
22128 Checking in file1;
22129 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22130 initial revision: 1\.1
22131 done"
22132           cd ..
22133           mkdir 2
22134           cd 2
22135           dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
22136           cd ../first-dir
22137           echo "add a line to the end" >>file1
22138           dotest big-5 "${testcvs} -q ci -m modify" \
22139 "Checking in file1;
22140 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22141 new revision: 1\.2; previous revision: 1\.1
22142 done"
22143           cd ../2/first-dir
22144           # The idea here is particularly to test the Rcs-diff response
22145           # and the reallocing thereof, for remote.
22146           dotest big-6 "${testcvs} -q update" "[UP] file1"
22147           cd ../..
22148
22149           if $keep; then
22150             echo Keeping ${TESTDIR} and exiting due to --keep
22151             exit 0
22152           fi
22153
22154           rm -r first-dir 2
22155           rm -rf ${CVSROOT_DIRNAME}/first-dir
22156           ;;
22157
22158         modes)
22159           # Test repository permissions (CVSUMASK and so on).
22160           # Although the tests in this section "cheat" by testing
22161           # repository permissions, which are sort of not a user-visible
22162           # sort of thing, the modes do have user-visible consequences,
22163           # such as whether a second user can check out the files.  But
22164           # it would be awkward to test the consequences, so we don't.
22165
22166           # Solaris /bin/sh doesn't support export -n.  I'm not sure
22167           # what we can do about this, other than hope that whoever
22168           # is running the tests doesn't have CVSUMASK set.
22169           #export -n CVSUMASK # if unset, defaults to 002
22170
22171           umask 077
22172           mkdir 1; cd 1
22173           dotest modes-1 "${testcvs} -q co -l ." ''
22174           mkdir first-dir
22175           dotest modes-2 "${testcvs} add first-dir" \
22176 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22177           cd first-dir
22178           touch aa
22179           dotest modes-3 "${testcvs} add aa" \
22180 "${PROG} add: scheduling file .aa. for addition
22181 ${PROG} add: use .${PROG} commit. to add this file permanently"
22182           dotest modes-4 "${testcvs} -q ci -m add" \
22183 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22184 done
22185 Checking in aa;
22186 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22187 initial revision: 1\.1
22188 done"
22189           # Yawn.  Cygwin.
22190           if test -n "$remotehost"; then
22191             dotest modes-5remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22192 "-r--r--r-- .*"
22193           else
22194             dotest modes-5 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22195 "-r--r--r-- .*"
22196           fi
22197
22198           # Test for whether we can set the execute bit.
22199           chmod +x aa
22200           echo change it >>aa
22201           dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
22202 "Checking in aa;
22203 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22204 new revision: 1\.2; previous revision: 1\.1
22205 done"
22206           # If CVS let us update the execute bit, it would be set here.
22207           # But it doesn't, and as far as I know that is longstanding
22208           # CVS behavior.
22209           #
22210           # Yeah, yeah.  Search for "Cygwin".
22211           if test -n "$remotehost"; then
22212             dotest modes-7remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22213 "-r--r--r-- .*"
22214           else
22215             dotest modes-7 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22216 "-r--r--r-- .*"
22217           fi
22218
22219           # OK, now manually change the modes and see what happens.
22220           #
22221           # Cygwin, already.
22222           if test -n "$remotehost"; then
22223             $CVS_RSH $remotehost "chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v"
22224           else
22225             chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v
22226           fi
22227           echo second line >>aa
22228           dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
22229 "Checking in aa;
22230 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22231 new revision: 1\.3; previous revision: 1\.2
22232 done"
22233           # Cygwin.
22234           if test -n "$remotehost"; then
22235             dotest modes-7bremotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22236 "-r--r----- .*"
22237           else
22238             dotest modes-7b "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22239 "-r--r----- .*"
22240           fi
22241
22242           CVSUMASK=007
22243           export CVSUMASK
22244           touch ab
22245           # Might as well test the execute bit too.
22246           chmod +x ab
22247           dotest modes-8 "${testcvs} add ab" \
22248 "${PROG} add: scheduling file .ab. for addition
22249 ${PROG} add: use .${PROG} commit. to add this file permanently"
22250           dotest modes-9 "${testcvs} -q ci -m add" \
22251 "RCS file: ${CVSROOT_DIRNAME}/first-dir/ab,v
22252 done
22253 Checking in ab;
22254 ${CVSROOT_DIRNAME}/first-dir/ab,v  <--  ab
22255 initial revision: 1\.1
22256 done"
22257           if $remote; then
22258             # The problem here is that the CVSUMASK environment variable
22259             # needs to be set on the server (e.g. .bashrc).  This is, of
22260             # course, bogus, but that is the way it is currently.
22261             if test -n "$remotehost"; then
22262               dotest modes-10remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v'" \
22263 "-r--r--r--.*"
22264             else
22265               dotest modes-10r "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
22266 "-r-xr-x---.*" "-r-xr-xr-x.*"
22267             fi
22268           else
22269             dotest modes-10 "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
22270 "-r-xr-x---.*"
22271           fi
22272
22273           # OK, now add a file on a branch.  Check that the mode gets
22274           # set the same way (it is a different code path in CVS).
22275           dotest modes-11 "${testcvs} -q tag -b br" 'T aa
22276 T ab'
22277           dotest modes-12 "$testcvs -q update -r br" \
22278 '[UP] aa
22279 U ab'
22280           touch ac
22281           dotest modes-13 "${testcvs} add ac" \
22282 "${PROG} add: scheduling file .ac. for addition on branch .br.
22283 ${PROG} add: use .${PROG} commit. to add this file permanently"
22284           # Not sure it really makes sense to refer to a "previous revision"
22285           # when we are just now adding the file; as far as I know
22286           # that is longstanding CVS behavior, for what it's worth.
22287           dotest modes-14 "${testcvs} -q ci -m add" \
22288 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v
22289 done
22290 Checking in ac;
22291 ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v  <--  ac
22292 new revision: 1\.1\.2\.1; previous revision: 1\.1
22293 done"
22294           if $remote; then
22295             # The problem here is that the CVSUMASK environment variable
22296             # needs to be set on the server (e.g. .bashrc).  This is, of
22297             # course, bogus, but that is the way it is currently.  The
22298             # first match is for the :ext: method (where the CVSUMASK
22299             # won't be set), while the second is for the :fork: method
22300             # (where it will be).
22301             if test -n "$remotehost"; then
22302               dotest modes-15r \
22303 "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v'" \
22304 "-r--r--r--.*"
22305             else
22306               dotest modes-15r \
22307 "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
22308 "-r--r--r--.*" "-r--r-----.*"
22309             fi
22310           else
22311             dotest modes-15 \
22312 "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
22313 "-r--r-----.*"
22314           fi
22315
22316           cd ../..
22317           rm -r 1
22318           rm -rf ${CVSROOT_DIRNAME}/first-dir
22319           # Perhaps should restore the umask and CVSUMASK.  But the other
22320           # tests "should" not care about them...
22321           ;;
22322
22323         modes2)
22324           # More tests of file permissions in the working directory
22325           # and that sort of thing.
22326
22327           # The usual setup, file first-dir/aa with two revisions.
22328           mkdir 1; cd 1
22329           dotest modes2-1 "${testcvs} -q co -l ." ''
22330           mkdir first-dir
22331           dotest modes2-2 "${testcvs} add first-dir" \
22332 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22333           cd first-dir
22334           touch aa
22335           dotest modes2-3 "${testcvs} add aa" \
22336 "${PROG} add: scheduling file .aa. for addition
22337 ${PROG} add: use .${PROG} commit. to add this file permanently"
22338           dotest modes2-4 "${testcvs} -q ci -m add" \
22339 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22340 done
22341 Checking in aa;
22342 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22343 initial revision: 1\.1
22344 done"
22345           echo "more money" >> aa
22346           dotest modes2-5 "${testcvs} -q ci -m add" \
22347 "Checking in aa;
22348 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22349 new revision: 1\.2; previous revision: 1\.1
22350 done"
22351
22352           # OK, here is the test.  The idea is to see what
22353           # No_Difference does if it can't open the file.
22354           # If we don't change the st_mtime, CVS doesn't even try to read
22355           # the file.  Note that some versions of "touch" require that we
22356           # do this while the file is still writable.
22357           touch aa
22358           chmod a= aa
22359           # Don't try this when permissions are broken, as with Cygwin.
22360           if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then :; else
22361             dotest_fail modes2-6 "${testcvs} -q update -r 1.1 aa" \
22362 "${PROG} \[update aborted\]: cannot open file aa for comparing: Permission denied" \
22363 "${PROG} \[update aborted\]: reading aa: Permission denied"
22364           fi
22365
22366           chmod u+rwx aa
22367           cd ../..
22368           rm -r 1
22369           rm -rf ${CVSROOT_DIRNAME}/first-dir
22370           ;;
22371
22372         modes3)
22373           # Repository permissions.  Particularly, what happens if we
22374           # can't read/write in the repository.
22375           # TODO: the case where we can access the repository, just not
22376           # the attic (may that one can remain a fatal error, seems less
22377           # useful for access control).
22378           mkdir 1; cd 1
22379           dotest modes3-1 "${testcvs} -q co -l ." ''
22380           mkdir first-dir second-dir
22381           dotest modes3-2 "${testcvs} add first-dir second-dir" \
22382 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
22383 Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
22384           touch first-dir/aa second-dir/ab
22385           dotest modes3-3 "${testcvs} add first-dir/aa second-dir/ab" \
22386 "${PROG} add: scheduling file .first-dir/aa. for addition
22387 ${PROG} add: scheduling file .second-dir/ab. for addition
22388 ${PROG} add: use .${PROG} commit. to add these files permanently"
22389           dotest modes3-4 "${testcvs} -q ci -m add" \
22390 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22391 done
22392 Checking in first-dir/aa;
22393 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22394 initial revision: 1\.1
22395 done
22396 RCS file: ${CVSROOT_DIRNAME}/second-dir/ab,v
22397 done
22398 Checking in second-dir/ab;
22399 ${CVSROOT_DIRNAME}/second-dir/ab,v  <--  ab
22400 initial revision: 1\.1
22401 done"
22402           if test -n "$remotehost"; then
22403             $CVS_RSH $remotehost "chmod a= ${CVSROOT_DIRNAME}/first-dir"
22404           else
22405             chmod a= ${CVSROOT_DIRNAME}/first-dir
22406           fi
22407           if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then
22408             # Avoid this test under Cygwin since permissions work differently
22409             # there.
22410             #
22411             # This test also gets avoided under Mac OS X since the system `ls'
22412             # is broken and exits with a 0 status despite the permission
22413             # denied error.
22414             if test -n "$remotehost"; then
22415               cygwin_hack=false
22416             else
22417               cygwin_hack=:
22418             fi
22419           else
22420             cygwin_hack=false
22421           fi
22422
22423           cd $TESTDIR/1
22424           if $cygwin_hack; then :; else
22425             dotest modes3-5 "${testcvs} update" \
22426 "${PROG} update: Updating \.
22427 ${PROG} update: Updating first-dir
22428 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
22429 ${PROG} update: skipping directory first-dir
22430 ${PROG} update: Updating second-dir"
22431           fi
22432
22433           # OK, I can see why one might say the above case could be a
22434           # fatal error, because normally users without access to first-dir
22435           # won't have it in their working directory.  But the next
22436           # one is more of a problem if it is fatal.
22437           #
22438           # The second text string below is for Cygwin again, and again it
22439           # should really be XFAIL under Cygwin, but for now deal with the
22440           # passing opendir by accepting the alternate string.
22441           rm -r first-dir
22442           dotest modes3-6 "${testcvs} update -dP" \
22443 "${PROG} update: Updating .
22444 ${PROG} update: Updating CVSROOT
22445 U ${DOTSTAR}
22446 ${PROG} update: Updating first-dir
22447 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
22448 ${PROG} update: skipping directory first-dir
22449 ${PROG} update: Updating second-dir" \
22450 "${PROG} update: Updating .
22451 ${PROG} update: Updating CVSROOT
22452 U ${DOTSTAR}
22453 ${PROG} update: Updating first-dir
22454 ${PROG} update: Updating second-dir"
22455
22456           cd ..
22457           rm -r 1
22458           chmod u+rwx ${CVSROOT_DIRNAME}/first-dir
22459           rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
22460           ;;
22461
22462         stamps)
22463           # Test timestamps.
22464           mkdir 1; cd 1
22465           dotest stamps-1 "${testcvs} -q co -l ." ''
22466           mkdir first-dir
22467           dotest stamps-2 "${testcvs} add first-dir" \
22468 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22469           cd first-dir
22470           touch aa
22471           echo '$''Id$' >kw
22472           # Cygwin, *cough*, puts the year in the time column until the minute
22473           # is no longer the current minute.  Sleep 60 seconds to avoid this
22474           # problem.
22475           sleep 60
22476           ls -l aa >${TESTDIR}/1/stamp.aa.touch
22477           ls -l kw >${TESTDIR}/1/stamp.kw.touch
22478           # "sleep 1" would suffice if we could assume ls --full-time, but
22479           # that is as far as I know unique to GNU ls.  Is there some POSIX.2
22480           # way to get the timestamp of a file, including the seconds?
22481           sleep 60
22482           dotest stamps-3 "${testcvs} add aa kw" \
22483 "${PROG} add: scheduling file .aa. for addition
22484 ${PROG} add: scheduling file .kw. for addition
22485 ${PROG} add: use .${PROG} commit. to add these files permanently"
22486           ls -l aa >${TESTDIR}/1/stamp.aa.add
22487           ls -l kw >${TESTDIR}/1/stamp.kw.add
22488           # "cvs add" should not muck with the timestamp.
22489           dotest stamps-4aa \
22490 "cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
22491           dotest stamps-4kw \
22492 "cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
22493           sleep 60
22494           dotest stamps-5 "${testcvs} -q ci -m add" \
22495 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22496 done
22497 Checking in aa;
22498 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22499 initial revision: 1\.1
22500 done
22501 RCS file: ${CVSROOT_DIRNAME}/first-dir/kw,v
22502 done
22503 Checking in kw;
22504 ${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
22505 initial revision: 1\.1
22506 done"
22507           # Cygwin, *cough*, puts the year in the time column until the minute
22508           # is no longer the current minute.  Sleep 60 seconds to avoid this
22509           # problem.
22510           sleep 60
22511           ls -l aa >${TESTDIR}/1/stamp.aa.ci
22512           ls -l kw >${TESTDIR}/1/stamp.kw.ci
22513           # If there are no keywords, "cvs ci" leaves the timestamp alone
22514           # If there are, it sets the timestamp to the date of the commit.
22515           # I'm not sure how logical this is, but it is intentional.
22516           # If we wanted to get fancy we would make sure the time as
22517           # reported in "cvs log kw" matched stamp.kw.ci.  But that would
22518           # be a lot of work.
22519           dotest stamps-6aa \
22520             "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
22521           if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
22522           then
22523             fail stamps-6kw
22524           else
22525             pass stamps-6kw
22526           fi
22527           cd ../..
22528           sleep 60
22529           mkdir 2
22530           cd 2
22531           dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
22532 U first-dir/kw"
22533           cd first-dir
22534           ls -l aa >${TESTDIR}/1/stamp.aa.get
22535           ls -l kw >${TESTDIR}/1/stamp.kw.get
22536           # On checkout, CVS should set the timestamp to the date that the
22537           # file was committed.  Could check that the time as reported in
22538           # "cvs log aa" matches stamp.aa.get, but that would be a lot of
22539           # work.
22540           if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
22541           then
22542             fail stamps-8aa
22543           else
22544             pass stamps-8aa
22545           fi
22546           dotest stamps-8kw \
22547             "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
22548
22549           # Now we want to see what "cvs update" does.
22550           sleep 60
22551           echo add a line >>aa
22552           echo add a line >>kw
22553           dotest stamps-9 "${testcvs} -q ci -m change-them" \
22554 "Checking in aa;
22555 ${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22556 new revision: 1\.2; previous revision: 1\.1
22557 done
22558 Checking in kw;
22559 ${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
22560 new revision: 1\.2; previous revision: 1\.1
22561 done"
22562           
22563           # Cygwin, *cough*, puts the year in the time column until the minute
22564           # is no longer the current minute.  Sleep 60 seconds to avoid this
22565           # problem.
22566           sleep 60
22567           ls -l aa >${TESTDIR}/1/stamp.aa.ci2
22568           ls -l kw >${TESTDIR}/1/stamp.kw.ci2
22569           cd ../..
22570           cd 1/first-dir
22571           sleep 60
22572           dotest stamps-10 "${testcvs} -q update" '[UP] aa
22573 [UP] kw'
22574           # this doesn't serve any function other than being able to
22575           # look at it manually, as we have no machinery for dates being
22576           # newer or older than other dates.
22577           date >${TESTDIR}/1/stamp.debug.update
22578           ls -l aa >${TESTDIR}/1/stamp.aa.update
22579           ls -l kw >${TESTDIR}/1/stamp.kw.update
22580           # stamp.aa.update and stamp.kw.update should both be approximately
22581           # the same as stamp.debug.update.  Perhaps we could be testing
22582           # this in a more fancy fashion by "touch stamp.before" before
22583           # stamps-10, "touch stamp.after" after, and then using ls -t
22584           # to check them.  But for now we just make sure that the *.update
22585           # stamps differ from the *.ci2 ones.
22586           # As for the rationale, this is so that if one updates and gets
22587           # a new revision, then "make" will be sure to regard those files
22588           # as newer than .o files which may be sitting around.
22589           if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
22590              >/dev/null
22591           then
22592             fail stamps-11aa
22593           else
22594             pass stamps-11aa
22595           fi
22596           if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
22597              >/dev/null
22598           then
22599             fail stamps-11kw
22600           else
22601             pass stamps-11kw
22602           fi
22603
22604           cd ../..
22605
22606           if $keep; then
22607             echo Keeping ${TESTDIR} and exiting due to --keep
22608             exit 0
22609           fi
22610
22611           rm -r 1 2
22612           rm -rf ${CVSROOT_DIRNAME}/first-dir
22613           ;;
22614
22615         perms)
22616           # short cut around checking out and committing CVSROOT
22617           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22618           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22619           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22620
22621           mkdir 1; cd 1
22622           dotest perms-1 "${testcvs} -q co -l ." ''
22623           mkdir first-dir
22624           dotest perms-2 "${testcvs} add first-dir" \
22625 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22626           cd first-dir
22627
22628           touch foo
22629           chmod 431 foo
22630           dotest perms-3 "${testcvs} add foo" \
22631 "${PROG} add: scheduling file .foo. for addition
22632 ${PROG} add: use .${PROG} commit. to add this file permanently"
22633           dotest perms-4 "${testcvs} -q ci -m ''" \
22634 "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo,v
22635 done
22636 Checking in foo;
22637 ${CVSROOT_DIRNAME}/first-dir/foo,v  <--  foo
22638 initial revision: 1\.1
22639 done"
22640
22641           # Test checking out files with different permissions.
22642           cd ../..
22643           mkdir 2; cd 2
22644           dotest perms-5 "${testcvs} -q co first-dir" "U first-dir/foo"
22645           cd first-dir
22646           if $remote; then :; else
22647             # PreservePermissions not yet implemented for remote.
22648             dotest perms-6 "ls -l foo" "-r---wx--x .* foo"
22649           fi
22650
22651           cd ../..
22652           rm -rf 1 2
22653           rm -rf ${CVSROOT_DIRNAME}/first-dir
22654
22655           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22656           touch ${CVSROOT_DIRNAME}/CVSROOT/config
22657           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22658           ;;
22659
22660         symlinks)
22661           # short cut around checking out and committing CVSROOT
22662           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22663           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22664           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22665
22666           mkdir 1; cd 1
22667           dotest symlinks-1 "${testcvs} -q co -l ." ''
22668           mkdir first-dir
22669           dotest symlinks-2 "${testcvs} add first-dir" \
22670 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22671           cd first-dir
22672
22673           dotest symlinks-2.1 "ln -s ${TESTDIR}/fumble slink" ""
22674           dotest symlinks-3 "${testcvs} add slink" \
22675 "${PROG} add: scheduling file .slink. for addition
22676 ${PROG} add: use .${PROG} commit. to add this file permanently"
22677           if $remote; then
22678             # Remote doesn't implement PreservePermissions, and in its
22679             # absence the correct behavior is to follow the symlink.
22680             dotest_fail symlinks-4r "${testcvs} -q ci -m ''" \
22681 "${PROG} \[commit aborted\]: reading slink: No such file or directory"
22682           else
22683             dotest symlinks-4 "${testcvs} -q ci -m ''" \
22684 "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
22685 done
22686 Checking in slink;
22687 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22688 initial revision: 1\.1
22689 done"
22690
22691             # Test checking out symbolic links.
22692             cd ../..
22693             mkdir 2; cd 2
22694             dotest symlinks-5 "${testcvs} -q co first-dir" "U first-dir/slink"
22695             cd first-dir
22696             dotest symlinks-6 "ls -l slink" \
22697 "l[rwx\-]* .* slink -> ${TESTDIR}/fumble"
22698           fi
22699
22700           cd ../..
22701           rm -rf 1 2
22702           rm -rf ${CVSROOT_DIRNAME}/first-dir
22703
22704           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22705           touch ${CVSROOT_DIRNAME}/CVSROOT/config
22706           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22707           ;;
22708
22709         symlinks2)
22710           # Symlinks in working directory without PreservePermissions.
22711           # Also see: symlinks: with PreservePermissions
22712           # rcslib-symlink-*: symlinks in repository.
22713           mkdir 1; cd 1
22714           dotest symlinks2-1 "${testcvs} -q co -l ." ''
22715           mkdir first-dir
22716           dotest symlinks2-2 "${testcvs} add first-dir" \
22717 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22718           cd first-dir
22719           echo nonsymlink > slink
22720           dotest symlinks2-3 "${testcvs} add slink" \
22721 "${PROG} add: scheduling file .slink. for addition
22722 ${PROG} add: use .${PROG} commit. to add this file permanently"
22723           dotest symlinks2-4 "${testcvs} -q ci -m ''" \
22724 "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
22725 done
22726 Checking in slink;
22727 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22728 initial revision: 1\.1
22729 done"
22730           rm slink
22731           # Choose name cvslog.* so it is in default ignore list.
22732           echo second file >cvslog.file2
22733           dotest symlinks2-5 "ln -s cvslog.file2 slink" ""
22734           dotest symlinks2-6 "${testcvs} -q ci -m linkify" \
22735 "Checking in slink;
22736 ${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22737 new revision: 1\.2; previous revision: 1\.1
22738 done"
22739           dotest symlinks2-7 "${testcvs} -q update -r 1.1 slink" "[UP] slink"
22740           dotest symlinks2-8 "cat slink" "nonsymlink"
22741           dotest symlinks2-9 "ls -l slink" "-[-rwx]* .* slink"
22742           cd ../..
22743
22744           rm -rf 1
22745           rm -rf ${CVSROOT_DIRNAME}/first-dir
22746           ;;
22747
22748         hardlinks)
22749           # short cut around checking out and committing CVSROOT
22750           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22751           echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22752           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22753
22754           mkdir 1; cd 1
22755           dotest hardlinks-1 "${testcvs} -q co -l ." ''
22756           mkdir first-dir
22757           dotest hardlinks-2 "${testcvs} add first-dir" \
22758 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22759           cd first-dir
22760
22761           # Make up some ugly filenames, to test that they get
22762           # encoded properly in the delta nodes.  Note that `dotest' screws
22763           # up if some arguments have embedded spaces.
22764           if touch aaaa
22765           then
22766             pass hardlinks-2.1
22767           else
22768             fail hardlinks-2.1
22769           fi
22770
22771           if ln aaaa b.b.b.b
22772           then
22773             pass hardlinks-2.2
22774           else
22775             fail hardlinks-2.2
22776           fi
22777
22778           if ln aaaa 'dd dd dd'
22779           then
22780             pass hardlinks-2.3
22781           else
22782             fail hardlinks-2.3
22783           fi
22784
22785           dotest hardlinks-3 "${testcvs} add [abd]*" \
22786 "${PROG} add: scheduling file .aaaa. for addition
22787 ${PROG} add: scheduling file .b\.b\.b\.b. for addition
22788 ${PROG} add: scheduling file .dd dd dd. for addition
22789 ${PROG} add: use .${PROG} commit. to add these files permanently"
22790           dotest hardlinks-4 "${testcvs} -q ci -m ''" \
22791 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaaa,v
22792 done
22793 Checking in aaaa;
22794 ${CVSROOT_DIRNAME}/first-dir/aaaa,v  <--  aaaa
22795 initial revision: 1\.1
22796 done
22797 RCS file: ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v
22798 done
22799 Checking in b\.b\.b\.b;
22800 ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v  <--  b\.b\.b\.b
22801 initial revision: 1\.1
22802 done
22803 RCS file: ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v
22804 done
22805 Checking in dd dd dd;
22806 ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v  <--  dd dd dd
22807 initial revision: 1\.1
22808 done"
22809           # Test checking out hardlinked files.
22810           cd ../..
22811           mkdir 2; cd 2
22812           if $remote; then
22813             # Remote does not implement PreservePermissions.
22814             dotest hardlinks-5r "${testcvs} -q co first-dir" \
22815 "U first-dir/aaaa
22816 U first-dir/b\.b\.b\.b
22817 U first-dir/dd dd dd"
22818             cd first-dir
22819             dotest hardlinks-6r "ls -l [abd]*" \
22820 "-[rwx\-]* *1 .* aaaa
22821 -[rwx\-]* *1 .* b\.b\.b\.b
22822 -[rwx\-]* *1 .* dd dd dd"
22823           else
22824             dotest hardlinks-5 "${testcvs} -q co first-dir" \
22825 "U first-dir/aaaa
22826 U first-dir/b\.b\.b\.b
22827 U first-dir/dd dd dd"
22828             cd first-dir
22829             # To make sure that the files are properly hardlinked, it
22830             # would be nice to do `ls -i' and make sure all the inodes
22831             # match.  But I think that would require expr to support
22832             # tagged regexps, and I don't think we can rely on that.
22833             # So instead we just see that each file has the right
22834             # number of links. -twp
22835             dotest hardlinks-6 "ls -l [abd]*" \
22836 "-[rwx\-]* *3 .* aaaa
22837 -[rwx\-]* *3 .* b\.b\.b\.b
22838 -[rwx\-]* *3 .* dd dd dd"
22839           fi
22840
22841           cd ../..
22842           rm -rf 1 2
22843           rm -rf ${CVSROOT_DIRNAME}/first-dir
22844
22845           rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22846           touch ${CVSROOT_DIRNAME}/CVSROOT/config
22847           chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22848           ;;
22849
22850         sticky)
22851           # More tests of sticky tags, particularly non-branch sticky tags.
22852           # See many tests (e.g. multibranch) for ordinary sticky tag
22853           # operations such as adding files on branches.
22854           # See "head" test for interaction between stick tags and HEAD.
22855           mkdir 1; cd 1
22856           dotest sticky-1 "${testcvs} -q co -l ." ''
22857           mkdir first-dir
22858           dotest sticky-2 "${testcvs} add first-dir" \
22859 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22860           cd first-dir
22861
22862           touch file1
22863           dotest sticky-3 "${testcvs} add file1" \
22864 "${PROG} add: scheduling file .file1. for addition
22865 ${PROG} add: use .${PROG} commit. to add this file permanently"
22866           dotest sticky-4 "${testcvs} -q ci -m add" \
22867 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22868 done
22869 Checking in file1;
22870 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22871 initial revision: 1\.1
22872 done"
22873           dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
22874           echo add a line >>file1
22875           dotest sticky-6 "${testcvs} -q ci -m modify" \
22876 "Checking in file1;
22877 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22878 new revision: 1\.2; previous revision: 1\.1
22879 done"
22880           dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
22881           dotest sticky-8 "cat file1" ''
22882           dotest sticky-9 "${testcvs} -q update" ''
22883           dotest sticky-10 "cat file1" ''
22884           touch file2
22885           dotest_fail sticky-11 "${testcvs} add file2" \
22886 "${PROG} add: cannot add file on non-branch tag tag1"
22887           dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
22888 ${QUESTION} file2" "${QUESTION} file2
22889 [UP] file1"
22890           dotest sticky-13 "${testcvs} add file2" \
22891 "${PROG} add: scheduling file .file2. for addition
22892 ${PROG} add: use .${PROG} commit. to add this file permanently"
22893           dotest sticky-14 "${testcvs} -q ci -m add" \
22894 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22895 done
22896 Checking in file2;
22897 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22898 initial revision: 1\.1
22899 done"
22900
22901           # Now back to tag1
22902           dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
22903 ${PROG} update: file2 is no longer in the repository"
22904
22905           rm file1
22906           dotest sticky-16 "${testcvs} rm file1" \
22907 "${PROG} remove: scheduling .file1. for removal
22908 ${PROG} remove: use .${PROG} commit. to remove this file permanently"
22909           # Hmm, this command seems to silently remove the tag from
22910           # the file.  This appears to be intentional.
22911           # The silently part especially strikes me as odd, though.
22912           dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
22913           dotest sticky-18 "${testcvs} -q update -A" "U file1
22914 U file2"
22915           dotest sticky-19 "${testcvs} -q update -r tag1" \
22916 "${PROG} update: file1 is no longer in the repository
22917 ${PROG} update: file2 is no longer in the repository"
22918           dotest sticky-20 "${testcvs} -q update -A" "U file1
22919 U file2"
22920
22921           # Now try with a numeric revision.
22922           dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
22923           dotest sticky-22 "${testcvs} rm -f file1" \
22924 "${PROG} remove: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
22925           # The old behavior was that remove allowed this and then commit
22926           # gave an error, which was somewhat hard to clear.  I mean, you
22927           # could get into a long elaborate discussion of this being a
22928           # conflict and two ways to resolve it, but I don't really see
22929           # why CVS should have a concept of conflict that arises, not from
22930           # parallel development, but from CVS's own sticky tags.
22931
22932           # Ditto with a sticky date.
22933           #
22934           # I'm kind of surprised that the "file1 was lost" doesn't crop
22935           # up elsewhere in the testsuite.  It is a long-standing
22936           # discrepency between local and remote CVS and should probably
22937           # be cleaned up at some point.
22938           dotest sticky-23 "${testcvs} -q update -Dnow file1" \
22939 "${PROG} update: warning: file1 was lost
22940 U file1" "U file1"
22941           dotest sticky-24 "${testcvs} rm -f file1" \
22942 "${PROG} remove: cannot remove file .file1. which has a sticky date of .[0-9.]*."
22943
22944           dotest sticky-25 "${testcvs} -q update -A" \
22945 "${PROG} update: warning: file1 was lost
22946 U file1" "U file1"
22947
22948           cd ../..
22949           rm -r 1
22950           rm -rf ${CVSROOT_DIRNAME}/first-dir
22951           ;;
22952
22953         keyword)
22954           # Test keyword expansion.
22955           # Various other tests relate to our ability to correctly
22956           # set the keyword expansion mode.
22957           # "binfiles" tests "cvs admin -k".
22958           # "binfiles" and "binfiles2" test "cvs add -k".
22959           # "rdiff" tests "cvs co -k".
22960           # "binfiles" (and this test) test "cvs update -k".
22961           # "binwrap" tests setting the mode from wrappers.
22962           # "keyword2" tests "cvs update -kk -j" with text and binary files
22963           # I don't think any test is testing "cvs import -k".
22964           # Other keyword expansion tests:
22965           #   keywordlog - $Log.
22966           mkdir 1; cd 1
22967           dotest keyword-1 "${testcvs} -q co -l ." ''
22968           mkdir first-dir
22969           dotest keyword-2 "${testcvs} add first-dir" \
22970 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22971           cd first-dir
22972
22973           echo '$''Author$' > file1
22974           echo '$''Date$' >> file1
22975           echo '$''Header$' >> file1
22976           echo '$''Id$' >> file1
22977           echo '$''Locker$' >> file1
22978           echo '$''Name$' >> file1
22979           echo '$''RCSfile$' >> file1
22980           echo '$''Revision$' >> file1
22981           echo '$''Source$' >> file1
22982           echo '$''State$' >> file1
22983           echo '$''Nonkey$' >> file1
22984           # Omit the trailing dollar sign
22985           echo '$''Date' >> file1
22986           # Put two keywords on one line
22987           echo '$''State$' '$''State$' >> file1
22988           # Use a header for Log
22989           echo 'xx $''Log$' >> file1
22990
22991           dotest keyword-3 "${testcvs} add file1" \
22992 "${PROG} add: scheduling file .file1. for addition
22993 ${PROG} add: use .${PROG} commit. to add this file permanently"
22994           dotest keyword-4 "${testcvs} -q ci -m add" \
22995 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22996 done
22997 Checking in file1;
22998 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22999 initial revision: 1\.1
23000 done"
23001           dotest keyword-5 "cat file1" \
23002 '\$'"Author: ${username} "'\$'"
23003 "'\$'"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] "'\$'"
23004 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23005 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23006 "'\$'"Locker:  "'\$'"
23007 "'\$'"Name:  "'\$'"
23008 "'\$'"RCSfile: file1,v "'\$'"
23009 "'\$'"Revision: 1\.1 "'\$'"
23010 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23011 "'\$'"State: Exp "'\$'"
23012 "'\$'"Nonkey"'\$'"
23013 "'\$'"Date
23014 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23015 xx "'\$'"Log: file1,v "'\$'"
23016 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23017 xx add
23018 xx"
23019
23020           # Use cvs admin to lock the RCS file in order to check -kkvl
23021           # vs. -kkv.  CVS does not normally lock RCS files, but some
23022           # people use cvs admin to enforce reserved checkouts.
23023           dotest keyword-6 "${testcvs} admin -l file1" \
23024 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23025 1\.1 locked
23026 done"
23027
23028           dotest keyword-7 "$testcvs update -kkv file1" '[UP] file1'
23029           dotest keyword-8 "cat file1" \
23030 '\$'"Author: ${username} "'\$'"
23031 "'\$'"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] "'\$'"
23032 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23033 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23034 "'\$'"Locker:  "'\$'"
23035 "'\$'"Name:  "'\$'"
23036 "'\$'"RCSfile: file1,v "'\$'"
23037 "'\$'"Revision: 1\.1 "'\$'"
23038 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23039 "'\$'"State: Exp "'\$'"
23040 "'\$'"Nonkey"'\$'"
23041 "'\$'"Date
23042 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23043 xx "'\$'"Log: file1,v "'\$'"
23044 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23045 xx add
23046 xx"
23047
23048           dotest keyword-9 "$testcvs update -kkvl file1" '[UP] file1'
23049           dotest keyword-10 "cat file1" \
23050 '\$'"Author: ${username} "'\$'"
23051 "'\$'"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] "'\$'"
23052 "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
23053 "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
23054 "'\$'"Locker: ${username} "'\$'"
23055 "'\$'"Name:  "'\$'"
23056 "'\$'"RCSfile: file1,v "'\$'"
23057 "'\$'"Revision: 1\.1 "'\$'"
23058 "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23059 "'\$'"State: Exp "'\$'"
23060 "'\$'"Nonkey"'\$'"
23061 "'\$'"Date
23062 "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23063 xx "'\$'"Log: file1,v "'\$'"
23064 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23065 xx add
23066 xx"
23067
23068           dotest keyword-11 "${testcvs} update -kk file1" '[UP] file1'
23069           dotest keyword-12 "cat file1" \
23070 '\$'"Author"'\$'"
23071 "'\$'"Date"'\$'"
23072 "'\$'"Header"'\$'"
23073 "'\$'"Id"'\$'"
23074 "'\$'"Locker"'\$'"
23075 "'\$'"Name"'\$'"
23076 "'\$'"RCSfile"'\$'"
23077 "'\$'"Revision"'\$'"
23078 "'\$'"Source"'\$'"
23079 "'\$'"State"'\$'"
23080 "'\$'"Nonkey"'\$'"
23081 "'\$'"Date
23082 "'\$'"State"'\$'" "'\$'"State"'\$'"
23083 xx "'\$'"Log"'\$'"
23084 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23085 xx add
23086 xx"
23087
23088           dotest keyword-13 "$testcvs update -kv file1" '[UP] file1'
23089           dotest keyword-14 "cat file1" \
23090 "${username}
23091 [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]
23092 ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
23093 file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
23094
23095
23096 file1,v
23097 1\.1
23098 ${CVSROOT_DIRNAME}/first-dir/file1,v
23099 Exp
23100 "'\$'"Nonkey"'\$'"
23101 "'\$'"Date
23102 Exp Exp
23103 xx file1,v
23104 xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23105 xx add
23106 xx"
23107
23108           dotest keyword-15 "${testcvs} update -ko file1" "U file1"
23109           dotest keyword-16 "cat file1" \
23110 '\$'"Author"'\$'"
23111 "'\$'"Date"'\$'"
23112 "'\$'"Header"'\$'"
23113 "'\$'"Id"'\$'"
23114 "'\$'"Locker"'\$'"
23115 "'\$'"Name"'\$'"
23116 "'\$'"RCSfile"'\$'"
23117 "'\$'"Revision"'\$'"
23118 "'\$'"Source"'\$'"
23119 "'\$'"State"'\$'"
23120 "'\$'"Nonkey"'\$'"
23121 "'\$'"Date
23122 "'\$'"State"'\$'" "'\$'"State"'\$'"
23123 xx "'\$'"Log"'\$'
23124
23125           # Test the Name keyword.  First go back to normal expansion.
23126
23127           dotest keyword-17 "${testcvs} update -A file1" "U file1"
23128
23129           echo '$''Name$' > file1
23130           dotest keyword-18 "${testcvs} ci -m modify file1" \
23131 "Checking in file1;
23132 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23133 new revision: 1\.2; previous revision: 1\.1
23134 done"
23135           dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
23136           echo "change" >> file1
23137           dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
23138 "Checking in file1;
23139 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23140 new revision: 1\.3; previous revision: 1\.2
23141 done"
23142
23143           # Prior to 1.11.23, remote CVS would fail the patch checksum test
23144           # and refetch the file here, failing this test.
23145           dotest keyword-21 "$testcvs -q update -r tag1" 'U file1'
23146
23147           dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$'
23148
23149           # The update used to fail the first time with a checksum failure
23150           # here, then the server would send the whole failure.  This was fixed
23151           # in 1.11.23.
23152           dotest keyword-23 "$testcvs update -A file1" "U file1"
23153           dotest keyword-24 "cat file1" '\$'"Name:  "'\$'"
23154 change"
23155
23156           cd ../..
23157           rm -r 1
23158           rm -rf ${CVSROOT_DIRNAME}/first-dir
23159           ;;
23160
23161         keywordlog)
23162           # Test the Log keyword.
23163           mkdir 1; cd 1
23164           dotest keywordlog-1 "${testcvs} -q co -l ." ''
23165           mkdir first-dir
23166           dotest keywordlog-2 "${testcvs} add first-dir" \
23167 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23168           cd first-dir
23169           echo initial >file1
23170           dotest keywordlog-3 "${testcvs} add file1" \
23171 "${PROG} add: scheduling file .file1. for addition
23172 ${PROG} add: use .${PROG} commit. to add this file permanently"
23173
23174           # See "rmadd" for a list of other tests of cvs ci -r.
23175           dotest keywordlog-4 "${testcvs} -q ci -r 1.3 -m add file1" \
23176 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23177 done
23178 Checking in file1;
23179 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23180 initial revision: 1\.3
23181 done"
23182
23183           cd ../..
23184           mkdir 2; cd 2
23185           dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
23186           cd ../1/first-dir
23187
23188           echo 'xx $''Log$' >> file1
23189           cat >${TESTDIR}/comment.tmp <<EOF
23190 First log line
23191 Second log line
23192 EOF
23193           # As with rmadd-25, "cvs ci -r" sets a sticky tag.
23194           dotest_fail keywordlog-4b \
23195 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
23196 "${PROG} commit: sticky tag .1\.3. for file .file1. is not a branch
23197 ${PROG} \[commit aborted\]: correct above errors first!"
23198           dotest keywordlog-4c "${testcvs} -q update -A" "M file1"
23199
23200           dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
23201 "Checking in file1;
23202 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23203 new revision: 1\.4; previous revision: 1\.3
23204 done"
23205           rm -f ${TESTDIR}/comment.tmp
23206           dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
23207           dotest keywordlog-7 "cat file1" \
23208 "initial
23209 xx "'\$'"Log: file1,v "'\$'"
23210 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23211 xx First log line
23212 xx Second log line
23213 xx"
23214
23215           cd ../../2/first-dir
23216           dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
23217           dotest keywordlog-9 "cat file1" \
23218 "initial
23219 xx "'\$'"Log: file1,v "'\$'"
23220 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23221 xx First log line
23222 xx Second log line
23223 xx"
23224           cd ../../1/first-dir
23225
23226           echo "change" >> file1
23227           dotest keywordlog-10 "${testcvs} ci -m modify file1" \
23228 "Checking in file1;
23229 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23230 new revision: 1\.5; previous revision: 1\.4
23231 done"
23232           dotest keywordlog-11 "cat file1" \
23233 "initial
23234 xx "'\$'"Log: file1,v "'\$'"
23235 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23236 xx modify
23237 xx
23238 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23239 xx First log line
23240 xx Second log line
23241 xx
23242 change"
23243
23244           cd ../../2/first-dir
23245           dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
23246           dotest keywordlog-13 "cat file1" \
23247 "initial
23248 xx "'\$'"Log: file1,v "'\$'"
23249 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23250 xx modify
23251 xx
23252 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23253 xx First log line
23254 xx Second log line
23255 xx
23256 change"
23257
23258           cd ../../1/first-dir
23259           dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
23260           echo br-change >>file1
23261           dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
23262 "Checking in file1;
23263 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23264 new revision: 1\.4\.2\.1; previous revision: 1\.4
23265 done"
23266           dotest keywordlog-16 "cat file1" \
23267 "initial
23268 xx "'\$'"Log: file1,v "'\$'"
23269 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23270 xx br-modify
23271 xx
23272 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23273 xx First log line
23274 xx Second log line
23275 xx
23276 br-change"
23277           cd ../../2/first-dir
23278           dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
23279           dotest keywordlog-18 "cat file1" \
23280 "initial
23281 xx "'\$'"Log: file1,v "'\$'"
23282 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23283 xx br-modify
23284 xx
23285 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23286 xx First log line
23287 xx Second log line
23288 xx
23289 br-change"
23290           cd ../..
23291           dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
23292 "initial
23293 xx "'\$'"Log: file1,v "'\$'"
23294 xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23295 xx br-modify
23296 xx
23297 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23298 xx First log line
23299 xx Second log line
23300 xx
23301 br-change"
23302           dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
23303 "initial
23304 xx "'\$'"Log: file1,v "'\$'"
23305 xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23306 xx modify
23307 xx
23308 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23309 xx First log line
23310 xx Second log line
23311 xx
23312 change"
23313           dotest keywordlog-21 "${testcvs} -q co -p -r 1.4 first-dir/file1" \
23314 "initial
23315 xx "'\$'"Log: file1,v "'\$'"
23316 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23317 xx First log line
23318 xx Second log line
23319 xx"
23320
23321           cd 2/first-dir
23322           # OK, the basic rule for keyword expansion is that it
23323           # happens on checkout.  And the rule for annotate is that
23324           # it annotates a checked-in revision, rather than a checked-out
23325           # file.  So, although it is kind of confusing that the latest
23326           # revision does not appear in the annotated output, and the
23327           # annotated output does not quite match what you'd get with
23328           # update or checkout, the behavior is more or less logical.
23329           # The same issue occurs with annotate and other keywords,
23330           # I think, although it is particularly noticeable for $Log.
23331           dotest keywordlog-22 "${testcvs} ann -r br file1" \
23332 "
23333 Annotations for file1
23334 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23335 1\.3          ($username8 *[0-9a-zA-Z-]*): initial
23336 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
23337 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  $username
23338 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx First log line
23339 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx Second log line
23340 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx
23341 1\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): br-change"
23342           dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \
23343 "
23344 Annotations for file1
23345 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23346 1\.3          ($username8 *[0-9a-zA-Z-]*): initial
23347 1\.5          ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
23348 1\.5          ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  $username
23349 1\.5          ($username8 *[0-9a-zA-Z-]*): xx First log line
23350 1\.5          ($username8 *[0-9a-zA-Z-]*): xx Second log line
23351 1\.5          ($username8 *[0-9a-zA-Z-]*): xx
23352 1\.5          ($username8 *[0-9a-zA-Z-]*): change"
23353           cd ../..
23354
23355           #
23356           # test the operation of 'admin -o' in conjunction with keywords
23357           # (especially Log - this used to munge the RCS file for all time)
23358           #
23359
23360           dotest keywordlog-24 \
23361 "${testcvs} admin -oHEAD 1/first-dir/file1" \
23362 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23363 deleting revision 1\.5
23364 done"
23365
23366           dotest keywordlog-25 \
23367 "${testcvs} -q co -p first-dir/file1" \
23368 "initial
23369 xx "'\$'"Log: file1,v "'\$'"
23370 xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23371 xx First log line
23372 xx Second log line
23373 xx"
23374
23375           if $keep; then
23376             echo Keeping ${TESTDIR} and exiting due to --keep
23377             exit 0
23378           fi
23379
23380           rm -r 1 2
23381           rm -rf ${CVSROOT_DIRNAME}/first-dir
23382           ;;
23383
23384         keywordname)
23385           # Test the Name keyword.
23386           # See the keyword test for a descriptions of some other tests that
23387           # test keyword expansion modes.
23388           mkdir keywordname; cd keywordname
23389           mkdir 1; cd 1
23390           dotest keywordname-init-1 "${testcvs} -q co -l ." ''
23391           mkdir first-dir
23392           dotest keywordname-init-2 "${testcvs} add first-dir" \
23393 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23394           cd first-dir
23395
23396           echo '$'"Name$" >file1
23397           echo '$'"Name$" >file2
23398           dotest keywordname-init-3 "${testcvs} add file1 file2" \
23399 "${PROG} add: scheduling file .file1. for addition
23400 ${PROG} add: scheduling file .file2. for addition
23401 ${PROG} add: use .${PROG} commit. to add these files permanently"
23402
23403           # See "rmadd" for a list of other tests of cvs ci -r.
23404           dotest keywordname-init-4 "${testcvs} -q ci -r 1.3 -m add" \
23405 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23406 done
23407 Checking in file1;
23408 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23409 initial revision: 1\.3
23410 done
23411 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23412 done
23413 Checking in file2;
23414 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23415 initial revision: 1\.3
23416 done"
23417           dotest keywordname-init-5b "cat file1" \
23418 '\$''Name:  \$'
23419           dotest keywordname-init-5c "cat file2" \
23420 '\$''Name:  \$'
23421
23422           dotest keywordname-init-6 "$testcvs -q up -A"
23423           dotest keywordname-init-6b "cat file1" \
23424 '\$''Name:  \$'
23425           dotest keywordname-init-6c "cat file2" \
23426 '\$''Name:  \$'
23427
23428           dotest keywordname-init-7 "${testcvs} -q tag -b br" \
23429 "T file1
23430 T file2"
23431
23432           echo new data >>file1
23433           dotest keywordname-init-8 "${testcvs} -q ci -mchange" \
23434 "Checking in file1;
23435 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23436 new revision: 1\.4; previous revision: 1\.3
23437 done"
23438
23439           # First check out a branch.
23440           #
23441           # There used to be a bug where static tags would be substituted for
23442           # Name keywords but not branch tags.
23443           #
23444           # Prior to 1.11.23, there also used to be a bug where keyword
23445           # substitutions were not performed unless the file was otherwise
23446           # updated.  When this bug was present, keywordname-update-1 would
23447           # report a patch checksum failure and refetch file1 in client/server
23448           # mode and no `br' would have been substituted into Name's value for
23449           # file2, meaning keywordname-update-3 would also fail.
23450           dotest keywordname-update-1 "$testcvs -q up -rbr" \
23451 'U file1
23452 U file2'
23453           dotest keywordname-update-2 "cat file1" '\$''Name: br \$'
23454
23455           # For the same reason keywordname-update-1 would fail above, no `br'
23456           # would have been substituted into Name's value here prior to
23457           # 1.11.23.
23458           dotest keywordname-update-3 "cat file2" '\$''Name: br \$'
23459
23460           # Now verify that updating to the trunk leaves no substitution for
23461           # $Name
23462           dotest keywordname-update-4 "${testcvs} -q tag firsttag" \
23463 "T file1
23464 T file2"
23465           # This used to fail in the same manner as keywordname-update-1.
23466           dotest keywordname-update-5 "$testcvs -q up -A" \
23467 'U file1
23468 U file2'
23469           dotest keywordname-update-6 "cat file1" \
23470 '\$''Name:  \$
23471 new data'
23472           dotest keywordname-update-7 "cat file2" '\$''Name:  \$'
23473
23474           # This used to fail in the same manner as keywordname-update-1.
23475           dotest keywordname-update-8 "$testcvs -q up -rfirsttag" \
23476 'U file1
23477 U file2'
23478           dotest keywordname-update-9 "cat file1" '\$''Name: firsttag \$'
23479
23480           # This used to fail in the same manner as keywordname-update-3.
23481           dotest keywordname-update-10 "cat file2" '\$''Name: firsttag \$'
23482
23483           # And reverify the trunk update when the change is actually removed.
23484           dotest keywordname-update-11 "$testcvs -q up -A" \
23485 'U file1
23486 U file2'
23487           dotest keywordname-update-12 "cat file1" \
23488 '\$''Name:  \$
23489 new data'
23490           dotest keywordname-update-13 "cat file2" '\$''Name:  \$'
23491
23492           cd ../..
23493
23494           # now verify that a fresh checkout substitutes all the $Name fields
23495           mkdir 2; cd 2
23496           dotest keywordname-checkout-1 \
23497 "${testcvs} -q co -rfirsttag first-dir" \
23498 "U first-dir/file1
23499 U first-dir/file2"
23500           cd first-dir
23501           dotest keywordname-checkout-2 "cat file1" '\$'"Name: firsttag "'\$'
23502           dotest keywordname-checkout-3 "cat file2" '\$'"Name: firsttag "'\$'
23503
23504           cd ../..
23505
23506           if $keep; then
23507             echo Keeping ${TESTDIR} and exiting due to --keep
23508             exit 0
23509           fi
23510
23511           cd ..
23512           rm -r keywordname
23513           rm -rf ${CVSROOT_DIRNAME}/first-dir
23514           ;;
23515
23516         keyword2)
23517           # Test merging on files with keywords:
23518           #   without -kk
23519           #   with -kk
23520           #     on text files
23521           #     on binary files
23522           # Note:  This test assumes that CVS has already passed the binfiles
23523           #    test sequence
23524           # Note2:  We are testing positive on binary corruption here
23525           #    we probably really DON'T want to 'cvs update -kk' a binary file...
23526           mkdir 1; cd 1
23527           dotest keyword2-1 "${testcvs} -q co -l ." ''
23528           mkdir first-dir
23529           dotest keyword2-2 "${testcvs} add first-dir" \
23530 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23531           cd first-dir
23532
23533           echo '$''Revision$' >> file1
23534           echo "I" >>file1
23535           echo "like" >>file1
23536           echo "long" >>file1
23537           echo "files!" >>file1
23538           echo "" >>file1
23539           echo "a test line for our times" >>file1
23540           echo "" >>file1
23541           echo "They" >>file1
23542           echo "make" >>file1
23543           echo "diff" >>file1
23544           echo "look like it" >>file1
23545           echo "did a much better" >>file1
23546           echo "job." >>file1
23547           dotest keyword2-3 "${testcvs} add file1" \
23548 "${PROG} add: scheduling file .file1. for addition
23549 ${PROG} add: use .${PROG} commit. to add this file permanently"
23550
23551           ${AWK} 'BEGIN { printf "%c%c%c%sRevision: 1.1 $@%c%c", \
23552             2, 10, 137, "$", 13, 10 }' \
23553             </dev/null | ${TR} '@' '\000' >../binfile.dat
23554           cp ../binfile.dat .
23555           dotest keyword2-5 "${testcvs} add -kb binfile.dat" \
23556 "${PROG} add: scheduling file .binfile\.dat. for addition
23557 ${PROG} add: use .${PROG} commit. to add this file permanently"
23558
23559           dotest keyword2-6 "${testcvs} -q ci -m add" \
23560 "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
23561 done
23562 Checking in binfile\.dat;
23563 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
23564 initial revision: 1\.1
23565 done
23566 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23567 done
23568 Checking in file1;
23569 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23570 initial revision: 1\.1
23571 done"
23572
23573           dotest keyword2-7 "${testcvs} -q tag -b branch" \
23574 "T binfile\.dat
23575 T file1"
23576
23577           sed -e 's/our/the best of and the worst of/' file1 >f; mv f file1
23578           dotest keyword2-8 "${testcvs} -q ci -m change" \
23579 "Checking in file1;
23580 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23581 new revision: 1\.2; previous revision: 1\.1
23582 done"
23583
23584           dotest keyword2-9 "$testcvs -q update -r branch" \
23585 'U binfile\.dat
23586 [UP] file1'
23587
23588           echo "what else do we have?" >>file1
23589           dotest keyword2-10 "${testcvs} -q ci -m change" \
23590 "Checking in file1;
23591 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23592 new revision: 1\.1\.2\.1; previous revision: 1\.1
23593 done"
23594
23595           # Okay, first a conflict in file1 - should be okay with binfile.dat
23596           dotest keyword2-11 "$testcvs -q update -A -j branch" \
23597 "U binfile\.dat
23598 U file1
23599 RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
23600 retrieving revision 1\.1
23601 retrieving revision 1\.1\.2\.1
23602 Merging differences between 1\.1 and 1\.1\.2\.1 into file1
23603 rcsmerge: warning: conflicts during merge"
23604
23605           dotest_fail keyword2-12 "${testcvs} diff file1" \
23606 "Index: file1
23607 ===================================================================
23608 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23609 retrieving revision 1\.2
23610 diff -r1\.2 file1
23611 0a1
23612 > <<<<<<< file1
23613 1a3,5
23614 > =======
23615 > \\\$""Revision: 1\.1\.2\.1 \\\$
23616 > >>>>>>> 1\.1\.2\.1
23617 14a19
23618 > what else do we have${QUESTION}"
23619
23620           # Here's the problem... shouldn't -kk a binary file...
23621           rm file1
23622           dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \
23623 "${PROG} update: warning: file1 was lost
23624 U file1
23625 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23626 retrieving revision 1\.1
23627 retrieving revision 1\.1\.2\.1
23628 Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
23629
23630           # binfile won't get checked in, but it is now corrupt and could
23631           # have been checked in if it had changed on the branch...
23632           dotest keyword2-14 "${testcvs} -q ci -m change" \
23633 "Checking in file1;
23634 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23635 new revision: 1\.3; previous revision: 1\.2
23636 done"
23637
23638           # "-kk" no longer corrupts binary files
23639           dotest keyword2-15 "cmp binfile.dat ../binfile.dat" ''
23640
23641           # Okay, restore everything and make CVS try and merge a binary file...
23642           # "-kk" no longer affects binary files
23643           dotest keyword2-16 "${testcvs} -q update -A" \
23644 "[UP] file1"
23645           dotest keyword2-17 "${testcvs} -q tag -b branch2" \
23646 "T binfile\.dat
23647 T file1"
23648           dotest keyword2-18 "$testcvs -q update -r branch2" \
23649 'U binfile\.dat
23650 [UP] file1'
23651
23652           ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
23653             </dev/null | ${TR} '@' '\000' >>binfile.dat
23654           dotest keyword2-19 "${testcvs} -q ci -m badbadbad" \
23655 "Checking in binfile\.dat;
23656 ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
23657 new revision: 1\.1\.4\.1; previous revision: 1\.1
23658 done"
23659           # "-kk" no longer affects binary files
23660
23661           # XXXX: do not ask, why we get the "U binfile.dat" line twice
23662           #       looks like a bug!
23663           dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \
23664 "U binfile\.dat
23665 U binfile\.dat
23666 U file1"
23667
23668           cd ../..
23669           rm -r 1
23670           rm -rf ${CVSROOT_DIRNAME}/first-dir
23671           ;;
23672
23673         head)
23674           # Testing handling of the HEAD special tag.
23675           # There are many cases involving added and removed files
23676           # which we don't yet try to deal with.
23677           # TODO: We also could be paying much closer attention to
23678           # "head of the trunk" versus "head of the default branch".
23679           # That is what "cvs import" is doing here (but I didn't really
23680           # fully follow through on writing the tests for that case).
23681           mkdir imp-dir
23682           cd imp-dir
23683           echo 'imported contents' >file1
23684           # It may seem like we don't do much with file2, but do note that
23685           # the "cvs diff" invocations do also diff file2 (and come up empty).
23686           echo 'imported contents' >file2
23687           dotest_sort head-1 "${testcvs} import -m add first-dir tag1 tag2" \
23688 "
23689
23690 N first-dir/file1
23691 N first-dir/file2
23692 No conflicts created by this import"
23693           cd ..
23694           rm -r imp-dir
23695           mkdir 1
23696           cd 1
23697           dotest head-2 "${testcvs} -q co first-dir" \
23698 "U first-dir/file1
23699 U first-dir/file2"
23700           cd first-dir
23701           echo 'add a line on trunk' >> file1
23702           dotest head-3 "${testcvs} -q ci -m modify" \
23703 "Checking in file1;
23704 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23705 new revision: 1\.2; previous revision: 1\.1
23706 done"
23707           dotest head-4 "${testcvs} -q tag trunktag" "T file1
23708 T file2"
23709           echo 'add a line on trunk after trunktag' >> file1
23710           dotest head-5 "${testcvs} -q ci -m modify" \
23711 "Checking in file1;
23712 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23713 new revision: 1\.3; previous revision: 1\.2
23714 done"
23715           dotest head-6 "${testcvs} -q tag -b br1" "T file1
23716 T file2"
23717           dotest head-7 "$testcvs -q update -r br1" \
23718 '[UP] file1
23719 [UP] file2'
23720           echo 'modify on branch' >>file1
23721           dotest head-8 "${testcvs} -q ci -m modify" \
23722 "Checking in file1;
23723 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23724 new revision: 1\.3\.2\.1; previous revision: 1\.3
23725 done"
23726           dotest head-9 "${testcvs} -q tag brtag" "T file1
23727 T file2"
23728           echo 'modify on branch after brtag' >>file1
23729           dotest head-10 "${testcvs} -q ci -m modify" \
23730 "Checking in file1;
23731 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23732 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
23733 done"
23734           # With no sticky tags, HEAD is the head of the trunk.
23735           dotest head-trunk-setup "$testcvs -q update -A" \
23736 '[UP] file1
23737 [UP] file2'
23738           dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
23739 "imported contents
23740 add a line on trunk
23741 add a line on trunk after trunktag"
23742           # and diff thinks so too.  Case (a) from the comment in
23743           # cvs.texinfo (Common options).
23744           dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
23745 "Index: file1
23746 ===================================================================
23747 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23748 retrieving revision 1\.3
23749 retrieving revision 1\.3\.2\.2
23750 diff -c -r1\.3 -r1\.3\.2\.2
23751 \*\*\* file1    ${RFCDATE}      1\.3
23752 --- file1       ${RFCDATE}      1\.3\.2\.2
23753 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23754 \*\*\* 1,3 \*\*\*\*
23755 --- 1,5 ----
23756   imported contents
23757   add a line on trunk
23758   add a line on trunk after trunktag
23759 ${PLUS} modify on branch
23760 ${PLUS} modify on branch after brtag"
23761
23762           # With a branch sticky tag, HEAD is the head of the trunk.
23763           dotest head-br1-setup "$testcvs -q update -r br1" \
23764 '[UP] file1
23765 [UP] file2'
23766           dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
23767 "imported contents
23768 add a line on trunk
23769 add a line on trunk after trunktag"
23770           # But diff thinks that HEAD is "br1".  Case (b) from cvs.texinfo.
23771           # Probably people are relying on it.
23772           dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
23773
23774           # With a nonbranch sticky tag on a branch,
23775           # HEAD is the head of the trunk
23776           dotest head-brtag-setup "$testcvs -q update -r brtag" \
23777 '[UP] file1
23778 [UP] file2'
23779           dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
23780 "imported contents
23781 add a line on trunk
23782 add a line on trunk after trunktag"
23783
23784           # CVS 1.9 and older thought that HEAD is "brtag" (this was
23785           # noted as "strange, maybe accidental").  But "br1" makes a
23786           # whole lot more sense.
23787           dotest head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
23788
23789           # With a nonbranch sticky tag on the trunk, HEAD is the head
23790           # of the trunk, I think.
23791           dotest head-trunktag-setup "$testcvs -q update -r trunktag" \
23792 '[UP] file1
23793 [UP] file2'
23794           dotest head-trunktag-check "cat file1" "imported contents
23795 add a line on trunk"
23796           dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
23797 "imported contents
23798 add a line on trunk
23799 add a line on trunk after trunktag"
23800           # Like head-brtag-diff, there is a non-branch sticky tag.
23801           dotest_fail head-trunktag-diff \
23802             "${testcvs} -q diff -c -r HEAD -r br1" \
23803 "Index: file1
23804 ===================================================================
23805 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23806 retrieving revision 1\.3
23807 retrieving revision 1\.3\.2\.2
23808 diff -c -r1\.3 -r1\.3\.2\.2
23809 \*\*\* file1    ${RFCDATE}      1\.3
23810 --- file1       ${RFCDATE}      1\.3\.2\.2
23811 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23812 \*\*\* 1,3 \*\*\*\*
23813 --- 1,5 ----
23814   imported contents
23815   add a line on trunk
23816   add a line on trunk after trunktag
23817 ${PLUS} modify on branch
23818 ${PLUS} modify on branch after brtag"
23819
23820           # Also might test what happens if we setup with update -r
23821           # HEAD.  In general, if sticky tags matter, does the
23822           # behavior of "update -r <foo>" (without -p) depend on the
23823           # sticky tags before or after the update?
23824
23825           # Note that we are testing both the case where this deletes
23826           # a revision (file1) and the case where it does not (file2)
23827           dotest_fail head-o0a "${testcvs} admin -o ::br1" \
23828 "${PROG} admin: Administrating \.
23829 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23830 ${PROG} admin: cannot remove revision 1\.3\.2\.1 because it has tags
23831 ${PROG} admin: RCS file for .file1. not modified\.
23832 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23833 done"
23834           dotest head-o0b "${testcvs} tag -d brtag" \
23835 "${PROG} tag: Untagging \.
23836 D file1
23837 D file2"
23838           dotest head-o1 "${testcvs} admin -o ::br1" \
23839 "${PROG} admin: Administrating \.
23840 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23841 deleting revision 1\.3\.2\.1
23842 done
23843 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23844 done"
23845           cd ../..
23846           rm -r 1
23847           rm -rf ${CVSROOT_DIRNAME}/first-dir
23848           ;;
23849
23850         tagdate)
23851           # Test combining -r and -D.
23852           #
23853           # Note that this is not a complete test.  It relies on the fact
23854           # that update, checkout and export have a LOT of shared code.
23855           # Notice:
23856           #     1)  checkout is never tested at all with -r -D
23857           #     2)  update never uses an argument to '-D' besides 'now'
23858           #             (this test does not provide enough data to prove
23859           #             that 'cvs update' with both a '-r' and a '-D'
23860           #             specified does not ignore '-D': a 'cvs up
23861           #             -r<branch> -Dnow' and a 'cvs up -r<branch>'
23862           #             should specify the same file revision).
23863           #     3)  export uses '-r<branch> -D<when there was a different
23864           #             revision>', hopefully completing this behavior test
23865           #             for checkout and update as well.
23866           #
23867           mkdir 1; cd 1
23868           save_TZ=$TZ
23869           TZ=UTC; export TZ
23870           dotest tagdate-1 "${testcvs} -q co -l ." ''
23871           mkdir first-dir
23872           dotest tagdate-2 "${testcvs} add first-dir" \
23873 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23874           cd first-dir
23875
23876           echo trunk-1 >file1
23877           dotest tagdate-3 "${testcvs} add file1" \
23878 "${PROG} add: scheduling file .file1. for addition
23879 ${PROG} add: use .${PROG} commit. to add this file permanently"
23880           dotest tagdate-4 "${testcvs} -q ci -m add" \
23881 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23882 done
23883 Checking in file1;
23884 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23885 initial revision: 1\.1
23886 done"
23887           date_T1=`getrlogdate -r1.1 first-dir/file1`
23888
23889           dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
23890           dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
23891           echo trunk-2 >file1
23892           dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
23893 "Checking in file1;
23894 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23895 new revision: 1\.2; previous revision: 1\.1
23896 done"
23897           date_T2=`getrlogdate -r1.2 first-dir/file1`
23898
23899           # We are testing -r -D where br1 is a (magic) branch without
23900           # any revisions.  First the case where br2 doesn't have any
23901           # revisions either:
23902           dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
23903           dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
23904           echo br2-1 >file1
23905           dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
23906 "Checking in file1;
23907 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23908 new revision: 1\.1\.4\.1; previous revision: 1\.1
23909 done"
23910           date_T3=`getrlogdate -r1.1.4.1 first-dir/file1`
23911
23912           # Then the case where br2 does have revisions:
23913           dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
23914
23915           # For some reason, doing this on a branch seems to be relevant.
23916           dotest_fail tagdate-12 "${testcvs} -q update -j:yesterday" \
23917 "${PROG} \[update aborted\]: argument to join may not contain a date specifier without a tag"
23918           # And check export
23919
23920           echo br2-2 >file1
23921           dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \
23922 "Checking in file1;
23923 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23924 new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1
23925 done"
23926           date_T4=`getrlogdate -r1.1.4.2 first-dir/file1`
23927
23928           cd ../..
23929           mkdir 2; cd 2
23930           dotest tagdate-14 "${testcvs} -q export -r br2 -D'$date_T3' first-dir" \
23931 "[UP] first-dir/file1"
23932           dotest tagdate-15 "cat first-dir/file1" "br2-1"
23933
23934           # Now for annotate
23935           cd ../1/first-dir
23936           dotest tagdate-16 "${testcvs} annotate -rbr2 -D'$date_T3'" \
23937 "
23938 Annotations for file1
23939 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23940 1\.1\.4\.1      ($username8 *[0-9a-zA-Z-]*): br2-1"
23941
23942           dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \
23943 "
23944 Annotations for file1
23945 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23946 1\.1\.4\.2      ($username8 *[0-9a-zA-Z-]*): br2-2"
23947
23948           # Now check to see what happens when we add files to br2 and trunk
23949           echo br2-1 > file3
23950           dotest tagdate-18 "${testcvs} add file3" \
23951 "${PROG} add: scheduling file \`file3' for addition on branch \`br2'
23952 ${PROG} add: use .${PROG} commit. to add this file permanently"
23953           dotest tagdate-19 "${testcvs} -q ci -m add file3" \
23954 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
23955 done
23956 Checking in file3;
23957 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
23958 new revision: 1\.1\.2\.1; previous revision: 1\.1
23959 done"
23960           date_T5=`getrlogdate -r1.1 first-dir/file3`
23961           date_T6=`getrlogdate -r1.1.2.1 first-dir/file3`
23962
23963           cd ../..
23964           mkdir 3; cd 3
23965           dotest tagdate-20 "${testcvs} -Q co first-dir" ''
23966           cd first-dir
23967           echo trunk-1 > file2
23968           dotest tagdate-21 "${testcvs} add file2" \
23969 "${PROG} add: scheduling file .file2. for addition
23970 ${PROG} add: use .${PROG} commit. to add this file permanently"
23971           dotest tagdate-22 "${testcvs} -q ci -m add file2" \
23972 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23973 done
23974 Checking in file2;
23975 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23976 initial revision: 1\.1
23977 done"
23978           date_T7=`getrlogdate -r1.1 first-dir/file2`
23979           echo "trunk-2" >file2
23980           dotest tagdate-23 "${testcvs} -q ci -m update file2" \
23981 "Checking in file2;
23982 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23983 new revision: 1\.2; previous revision: 1\.1
23984 done"
23985           date_T8=`getrlogdate -r1.2 first-dir/file2`
23986
23987           cd ../../1/first-dir
23988           echo br2-1 > file2
23989           dotest tagdate-24 "${testcvs} add file2" \
23990 "${PROG} add: scheduling file \`file2' for addition on branch \`br2'
23991 ${PROG} add: use .${PROG} commit. to add this file permanently"
23992           dotest tagdate-25 "${testcvs} -q ci -m add file2" \
23993 "Checking in file2;
23994 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23995 new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
23996 done"
23997           date_T9=`getrlogdate -r1.2.2.2 first-dir/file2`
23998           cd ../..
23999
24000           # Time  Rev     Branch  Comments
24001           # T0            trunk   first-dir created
24002           # T1    1.1     trunk   first-dir/file1 committed "trunk-1"
24003           #               br1     branch created
24004           #               br2     branch created
24005           # T2    1.2     trunk   first-dir/file1 committed "trunk-2"
24006           # T3    1.1.4.1 br2     first-dir/file1 committed "br2-1"
24007           # +60s
24008           # T4    1.1.4.2 br2     first-dir/file1 committed "br2-2"
24009           # T5    1.1     trunk   first-dir/file3 dead
24010           # T6    1.1.2.1 br2     first-dir/file3 committed "br2-1"
24011           # T7    1.1     trunk   first-dir/file2 committed "trunk-1"
24012           # T8    1.2     trunk   first-dir/file2 committed "trunk-2"
24013           # T8    1.2.2.1 br2     first-dir/file2 dead
24014           # T9    1.2.2.2 br2     first-dir/file2 committed "br2-1"
24015           # 
24016
24017           mkdir 4; cd 4
24018           (echo Dates for tagdate-26-* are:;\
24019            echo "  date_T1='$date_T1'";\
24020            echo "  date_T2='$date_T2'";\
24021            echo "  date_T3='$date_T3'";\
24022            echo "  date_T4='$date_T4'";\
24023            echo "  date_T5='$date_T5'";\
24024            echo "  date_T6='$date_T6'";\
24025            echo "  date_T7='$date_T7'";\
24026            echo "  date_T8='$date_T8'";\
24027            echo "  date_T9='$date_T9'") >>$LOGFILE
24028           dotest tagdate-26-trunk-t1 \
24029 "${testcvs} co -D'$date_T1' -d first-dir-trunk-t1 first-dir" \
24030 "${PROG} checkout: Updating first-dir-trunk-t1
24031 U first-dir-trunk-t1/file1"
24032           dotest tagdate-26-br2-t1 \
24033 "${testcvs} co -r br2 -D'$date_T1' -d first-dir-br2-t1 first-dir" \
24034 "${PROG} checkout: Updating first-dir-br2-t1
24035 U first-dir-br2-t1/file1"
24036           dotest tagdate-26-trunk-t2 \
24037 "${testcvs} co -D'$date_T2' -d first-dir-trunk-t2 first-dir" \
24038 "${PROG} checkout: Updating first-dir-trunk-t2
24039 U first-dir-trunk-t2/file1"
24040           dotest tagdate-26-br2-t2 \
24041 "${testcvs} co -r br2 -D'$date_T2' -d first-dir-br2-t2 first-dir" \
24042 "${PROG} checkout: Updating first-dir-br2-t2
24043 U first-dir-br2-t2/file1"
24044           dotest tagdate-26-br2-t3 \
24045 "${testcvs} co -r br2 -D'$date_T3' -d first-dir-br2-t3 first-dir" \
24046 "${PROG} checkout: Updating first-dir-br2-t3
24047 U first-dir-br2-t3/file1"
24048           dotest tagdate-26-br2-t4 \
24049 "${testcvs} co -r br2 -D'$date_T4' -d first-dir-br2-t4 first-dir" \
24050 "${PROG} checkout: Updating first-dir-br2-t4
24051 U first-dir-br2-t4/file1"
24052           dotest tagdate-26-br2-t6 \
24053 "${testcvs} co -r br2 -D'$date_T6' -d first-dir-br2-t6 first-dir" \
24054 "${PROG} checkout: Updating first-dir-br2-t6
24055 U first-dir-br2-t6/file1
24056 U first-dir-br2-t6/file3"
24057           dotest tagdate-26-trunk-t7 \
24058 "${testcvs} co -D'$date_T7' -d first-dir-trunk-t7 first-dir" \
24059 "${PROG} checkout: Updating first-dir-trunk-t7
24060 U first-dir-trunk-t7/file1
24061 U first-dir-trunk-t7/file2"
24062           dotest tagdate-26-br2-t7 \
24063 "${testcvs} co -r br2 -D'$date_T7' -d first-dir-br2-t7 first-dir" \
24064 "${PROG} checkout: Updating first-dir-br2-t7
24065 U first-dir-br2-t7/file1
24066 U first-dir-br2-t7/file3"
24067           dotest tagdate-26-trunk-t8 \
24068 "${testcvs} co -D'$date_T8' -d first-dir-trunk-t8 first-dir" \
24069 "${PROG} checkout: Updating first-dir-trunk-t8
24070 U first-dir-trunk-t8/file1
24071 U first-dir-trunk-t8/file2"
24072           dotest tagdate-26-br2-t8 \
24073 "${testcvs} co -r br2 -D'$date_T8' -d first-dir-br2-t8 first-dir" \
24074 "${PROG} checkout: Updating first-dir-br2-t8
24075 U first-dir-br2-t8/file1
24076 U first-dir-br2-t8/file3"
24077           dotest tagdate-26-br2-t9 \
24078 "${testcvs} co -r br2 -D'$date_T9' -d first-dir-br2-t9 first-dir" \
24079 "${PROG} checkout: Updating first-dir-br2-t9
24080 U first-dir-br2-t9/file1
24081 U first-dir-br2-t9/file2
24082 U first-dir-br2-t9/file3"
24083           dotest tagdate-27-trunk-t1 \
24084 "${testcvs} status first-dir-trunk-t1" \
24085 "${PROG} status: Examining first-dir-trunk-t1
24086 ===================================================================
24087 File: file1             Status: Up-to-date
24088
24089    Working revision:    1\.1[^.]*
24090    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file1,v
24091    Sticky Tag:          (none)
24092    Sticky Date:         [0-9.]*
24093    Sticky Options:      (none)"
24094           dotest tagdate-27-br2-t1 \
24095 "${testcvs} status first-dir-br2-t1" \
24096 "${PROG} status: Examining first-dir-br2-t1
24097 ===================================================================
24098 File: file1             Status: Needs Patch
24099
24100    Working revision:    1\.1[^.]*
24101    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24102    Sticky Tag:          br2 (branch: 1\.1\.4)
24103    Sticky Date:         (none)
24104    Sticky Options:      (none)"
24105           dotest tagdate-27-trunk-t2 \
24106 "${testcvs} status first-dir-trunk-t2" \
24107 "${PROG} status: Examining first-dir-trunk-t2
24108 ===================================================================
24109 File: file1             Status: Up-to-date
24110
24111    Working revision:    1\.2[^.]*
24112    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file1,v
24113    Sticky Tag:          (none)
24114    Sticky Date:         [0-9.]*
24115    Sticky Options:      (none)"
24116           dotest tagdate-27-br2-t2 \
24117 "${testcvs} status first-dir-br2-t2" \
24118 "${PROG} status: Examining first-dir-br2-t2
24119 ===================================================================
24120 File: file1             Status: Needs Patch
24121
24122    Working revision:    1\.1[^.]*
24123    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24124    Sticky Tag:          br2 (branch: 1\.1\.4)
24125    Sticky Date:         (none)
24126    Sticky Options:      (none)"
24127           dotest tagdate-27-br2-t3 \
24128 "${testcvs} status first-dir-br2-t3" \
24129 "${PROG} status: Examining first-dir-br2-t3
24130 ===================================================================
24131 File: file1             Status: Needs Patch
24132
24133    Working revision:    1\.1\.4\.1[^.]*
24134    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24135    Sticky Tag:          br2 (branch: 1\.1\.4)
24136    Sticky Date:         (none)
24137    Sticky Options:      (none)"
24138           dotest tagdate-27-br2-t4 \
24139 "${testcvs} status first-dir-br2-t4" \
24140 "${PROG} status: Examining first-dir-br2-t4
24141 ===================================================================
24142 File: file1             Status: Up-to-date
24143
24144    Working revision:    1\.1\.4\.2[^.]*
24145    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24146    Sticky Tag:          br2 (branch: 1\.1\.4)
24147    Sticky Date:         (none)
24148    Sticky Options:      (none)"
24149           dotest tagdate-27-br2-t6 \
24150 "${testcvs} status first-dir-br2-t6" \
24151 "${PROG} status: Examining first-dir-br2-t6
24152 ===================================================================
24153 File: file1             Status: Up-to-date
24154
24155    Working revision:    1\.1\.4\.2[^.]*
24156    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24157    Sticky Tag:          br2 (branch: 1\.1\.4)
24158    Sticky Date:         (none)
24159    Sticky Options:      (none)
24160
24161 ===================================================================
24162 File: file3             Status: Up-to-date
24163
24164    Working revision:    1\.1\.2\.1[^.]*
24165    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24166    Sticky Tag:          br2 (branch: 1\.1\.2)
24167    Sticky Date:         (none)
24168    Sticky Options:      (none)"
24169           dotest tagdate-27-trunk-t7 \
24170 "${testcvs} status first-dir-trunk-t7" \
24171 "${PROG} status: Examining first-dir-trunk-t7
24172 ===================================================================
24173 File: file1             Status: Up-to-date
24174
24175    Working revision:    1\.2[^.]*
24176    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file1,v
24177    Sticky Tag:          (none)
24178    Sticky Date:         [0-9.]*
24179    Sticky Options:      (none)
24180
24181 ===================================================================
24182 File: file2             Status: Up-to-date
24183
24184    Working revision:    1\.1[^.]*
24185    Repository revision: 1\.1    ${CVSROOT_DIRNAME}/first-dir/file2,v
24186    Sticky Tag:          (none)
24187    Sticky Date:         [0-9.]*
24188    Sticky Options:      (none)"
24189           dotest tagdate-27-br2-t7 \
24190 "${testcvs} status first-dir-br2-t7" \
24191 "${PROG} status: Examining first-dir-br2-t7
24192 ===================================================================
24193 File: file1             Status: Up-to-date
24194
24195    Working revision:    1\.1\.4\.2[^.]*
24196    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24197    Sticky Tag:          br2 (branch: 1\.1\.4)
24198    Sticky Date:         (none)
24199    Sticky Options:      (none)
24200
24201 ===================================================================
24202 File: file3             Status: Up-to-date
24203
24204    Working revision:    1\.1\.2\.1[^.]*
24205    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24206    Sticky Tag:          br2 (branch: 1\.1\.2)
24207    Sticky Date:         (none)
24208    Sticky Options:      (none)"
24209           dotest tagdate-27-trunk-t8 \
24210 "${testcvs} status first-dir-trunk-t8" \
24211 "${PROG} status: Examining first-dir-trunk-t8
24212 ===================================================================
24213 File: file1             Status: Up-to-date
24214
24215    Working revision:    1\.2[^.]*
24216    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file1,v
24217    Sticky Tag:          (none)
24218    Sticky Date:         [0-9.]*
24219    Sticky Options:      (none)
24220
24221 ===================================================================
24222 File: file2             Status: Up-to-date
24223
24224    Working revision:    1\.2[^.]*
24225    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file2,v
24226    Sticky Tag:          (none)
24227    Sticky Date:         [0-9.]*
24228    Sticky Options:      (none)"
24229           dotest tagdate-27-br2-t8 \
24230 "${testcvs} status first-dir-br2-t8" \
24231 "${PROG} status: Examining first-dir-br2-t8
24232 ===================================================================
24233 File: file1             Status: Up-to-date
24234
24235    Working revision:    1\.1\.4\.2[^.]*
24236    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24237    Sticky Tag:          br2 (branch: 1\.1\.4)
24238    Sticky Date:         (none)
24239    Sticky Options:      (none)
24240
24241 ===================================================================
24242 File: file3             Status: Up-to-date
24243
24244    Working revision:    1\.1\.2\.1[^.]*
24245    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24246    Sticky Tag:          br2 (branch: 1\.1\.2)
24247    Sticky Date:         (none)
24248    Sticky Options:      (none)"
24249           dotest tagdate-27-br2-t9 \
24250 "${testcvs} status first-dir-br2-t9" \
24251 "${PROG} status: Examining first-dir-br2-t9
24252 ===================================================================
24253 File: file1             Status: Up-to-date
24254
24255    Working revision:    1\.1\.4\.2[^.]*
24256    Repository revision: 1\.1\.4\.2      ${CVSROOT_DIRNAME}/first-dir/file1,v
24257    Sticky Tag:          br2 (branch: 1\.1\.4)
24258    Sticky Date:         (none)
24259    Sticky Options:      (none)
24260
24261 ===================================================================
24262 File: file2             Status: Up-to-date
24263
24264    Working revision:    1\.2\.2\.2[^.]*
24265    Repository revision: 1\.2\.2\.2      ${CVSROOT_DIRNAME}/first-dir/file2,v
24266    Sticky Tag:          br2 (branch: 1\.2\.2)
24267    Sticky Date:         (none)
24268    Sticky Options:      (none)
24269
24270 ===================================================================
24271 File: file3             Status: Up-to-date
24272
24273    Working revision:    1\.1\.2\.1[^.]*
24274    Repository revision: 1\.1\.2\.1      ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24275    Sticky Tag:          br2 (branch: 1\.1\.2)
24276    Sticky Date:         (none)
24277    Sticky Options:      (none)"
24278
24279           # Now check the contents of the files
24280           dotest tagdate-28-trunk-t1 'cat first-dir-trunk-t1/file1' 'trunk-1'
24281           dotest tagdate-28-br2-t1 'cat first-dir-br2-t1/file1' 'trunk-1'
24282           dotest tagdate-28-trunk-t2 'cat first-dir-trunk-t2/file1' 'trunk-2'
24283           dotest tagdate-28-br2-t2 'cat first-dir-br2-t2/file1' 'trunk-1'
24284           dotest tagdate-28-br2-t3 'cat first-dir-br2-t3/file1' 'br2-1'
24285           dotest tagdate-28-br2-t4 'cat first-dir-br2-t4/file1' 'br2-2'
24286           dotest tagdate-28-br2-t6a 'cat first-dir-br2-t6/file1' "br2-2"
24287           dotest tagdate-28-br2-t6b 'cat first-dir-br2-t6/file3' "br2-1"
24288           dotest tagdate-28-trunk-t7a 'cat first-dir-trunk-t7/file1' "trunk-2"
24289           dotest tagdate-28-trunk-t7b 'cat first-dir-trunk-t7/file2' "trunk-1"
24290           dotest tagdate-28-br2-t7a 'cat first-dir-br2-t7/file1' "br2-2"
24291           dotest tagdate-28-br2-t7b 'cat first-dir-br2-t7/file3' "br2-1"
24292           dotest tagdate-28-trunk-t8a 'cat first-dir-trunk-t8/file1' "trunk-2"
24293           dotest tagdate-28-trunk-t8b 'cat first-dir-trunk-t8/file2' "trunk-2"
24294           dotest tagdate-28-br2-t8a 'cat first-dir-br2-t8/file1' "br2-2"
24295           dotest tagdate-28-br2-t8c 'cat first-dir-br2-t8/file3' "br2-1"
24296           dotest tagdate-28-br2-t9a 'cat first-dir-br2-t9/file1' "br2-2"
24297           dotest tagdate-28-br2-t9b 'cat first-dir-br2-t9/file2' "br2-1"
24298           dotest tagdate-28-br2-t9c 'cat first-dir-br2-t9/file3' "br2-1"
24299           cd ..
24300
24301           unset date_T1 date_T2 date_T3 date_T4 date_T5
24302           unset date_T6 date_T7 date_T8 date_T9
24303           TZ=$save_TZ
24304
24305           if $keep; then
24306             echo Keeping ${TESTDIR} and exiting due to --keep
24307             exit 0
24308           fi
24309
24310           rm -r 1 2 3 4
24311           rm -rf ${CVSROOT_DIRNAME}/first-dir
24312           ;;
24313
24314         multibranch2)
24315           # Commit the first delta on branch A when there is an older
24316           # branch, B, that already has a delta.  A and B come from the
24317           # same branch point.  Then verify that branches A and B are
24318           # in the right order.
24319           mkdir 1; cd 1
24320           dotest multibranch2-1 "${testcvs} -q co -l ." ''
24321           mkdir first-dir
24322           dotest multibranch2-2 "${testcvs} add first-dir" \
24323 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
24324           cd first-dir
24325
24326           echo trunk-1 >file1
24327           echo trunk-1 >file2
24328           dotest multibranch2-3 "${testcvs} add file1 file2" \
24329 "${PROG} add: scheduling file .file1. for addition
24330 ${PROG} add: scheduling file .file2. for addition
24331 ${PROG} add: use .${PROG} commit. to add these files permanently"
24332           dotest multibranch2-4 "${testcvs} -q ci -m add" \
24333 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24334 done
24335 Checking in file1;
24336 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24337 initial revision: 1\.1
24338 done
24339 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24340 done
24341 Checking in file2;
24342 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24343 initial revision: 1\.1
24344 done"
24345           dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1
24346 T file2"
24347           dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1
24348 T file2"
24349
24350           dotest multibranch2-7 "$testcvs -q update -r B" \
24351 '[UP] file1
24352 [UP] file2'
24353           echo branch-B >file1
24354           echo branch-B >file2
24355           dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
24356 "Checking in file1;
24357 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24358 new revision: 1\.1\.4\.1; previous revision: 1\.1
24359 done
24360 Checking in file2;
24361 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24362 new revision: 1\.1\.4\.1; previous revision: 1\.1
24363 done"
24364
24365           dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1
24366 [UP] file2'
24367           echo branch-A >file1
24368           # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
24369           dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
24370 "Checking in file1;
24371 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24372 new revision: 1\.1\.2\.1; previous revision: 1\.1
24373 done"
24374
24375           dotest multibranch2-11 "${testcvs} -q log file1" \
24376 "
24377 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24378 Working file: file1
24379 head: 1\.1
24380 branch:
24381 locks: strict
24382 access list:
24383 symbolic names:
24384         B: 1\.1\.0\.4
24385         A: 1\.1\.0\.2
24386 keyword substitution: kv
24387 total revisions: 3;     selected revisions: 3
24388 description:
24389 ----------------------------
24390 revision 1\.1
24391 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24392 branches:  1\.1\.2;  1\.1\.4;
24393 add
24394 ----------------------------
24395 revision 1\.1\.4\.1
24396 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
24397 modify-on-B
24398 ----------------------------
24399 revision 1\.1\.2\.1
24400 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
24401 modify-on-A
24402 ============================================================================="
24403
24404           # This one is more concise.
24405           dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \
24406 "
24407 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24408 Working file: file1
24409 head: 1\.1
24410 branch:
24411 locks: strict
24412 access list:
24413 symbolic names:
24414         B: 1\.1\.0\.4
24415         A: 1\.1\.0\.2
24416 keyword substitution: kv
24417 total revisions: 3;     selected revisions: 1
24418 description:
24419 ----------------------------
24420 revision 1\.1
24421 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24422 branches:  1\.1\.2;  1\.1\.4;
24423 add
24424 ============================================================================="
24425
24426           # OK, try very much the same thing except we run update -j to
24427           # bring the changes from B to A.  Probably tests many of the
24428           # same code paths but might as well keep it separate, I guess.
24429
24430           dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1
24431 [UP] file2"
24432           dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \
24433 "[UP] file2
24434 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24435 retrieving revision 1.1
24436 retrieving revision 1.1.4.1
24437 Merging differences between 1.1 and 1.1.4.1 into file2"
24438           dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \
24439 "Checking in file2;
24440 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24441 new revision: 1\.1\.2\.1; previous revision: 1\.1
24442 done"
24443           cd ../..
24444           rm -r 1
24445           rm -rf ${CVSROOT_DIRNAME}/first-dir
24446           ;;
24447
24448         tag8k)
24449           # In cvs-1.9.27, there is a bug that can cause an abort.
24450           # It happens when you commit a change to a ,v file that has
24451           # just the right amount of tag/branch info to align one of the
24452           # semicolons in the branch info to be on a 8k-byte boundary.
24453           # The result: rcsbuf_getkey got an abort.  This failure doesn't
24454           # corrupt the ,v file -- that would be really serious.  But it
24455           # does leave stale write locks that have to be removed manually.
24456
24457           mkdir 1
24458           cd 1
24459
24460           module=x
24461
24462           : > junk
24463           dotest tag8k-1 "$testcvs -Q import -m . $module X Y" ''
24464           dotest tag8k-2 "$testcvs -Q co $module" ''
24465           cd $module
24466
24467           file=m
24468           : > $file
24469           dotest tag8k-3 "$testcvs add $file" \
24470 "${PROG} add: scheduling file .$file. for addition
24471 ${PROG} add: use .${PROG} commit. to add this file permanently"
24472           dotest tag8k-4 "$testcvs -Q ci -m . $file" \
24473 "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
24474 done
24475 Checking in $file;
24476 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24477 initial revision: 1\.1
24478 done"
24479
24480           # It seems there have to be at least two versions.
24481           echo a > $file
24482           dotest tag8k-5 "$testcvs -Q ci -m . $file" \
24483 "Checking in $file;
24484 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24485 new revision: 1\.2; previous revision: 1\.1
24486 done"
24487
24488           # Add just under 8K worth of tags.
24489           t=TAG---------------------------------------------------------------------
24490           t=$t$t
24491           t=$t$t$t$t$t
24492           # Now $t is 720 bytes long.
24493
24494           # Apply some tags with that long prefix.
24495           dotest tag8k-6  "$testcvs -Q tag $t-0 $file" ''
24496           dotest tag8k-7  "$testcvs -Q tag $t-1 $file" ''
24497           dotest tag8k-8  "$testcvs -Q tag $t-2 $file" ''
24498           dotest tag8k-9  "$testcvs -Q tag $t-3 $file" ''
24499           dotest tag8k-10 "$testcvs -Q tag $t-4 $file" ''
24500           dotest tag8k-11 "$testcvs -Q tag $t-5 $file" ''
24501           dotest tag8k-12 "$testcvs -Q tag $t-6 $file" ''
24502           dotest tag8k-13 "$testcvs -Q tag $t-7 $file" ''
24503           dotest tag8k-14 "$testcvs -Q tag $t-8 $file" ''
24504           dotest tag8k-15 "$testcvs -Q tag $t-9 $file" ''
24505           dotest tag8k-16 "$testcvs -Q tag $t-a $file" ''
24506
24507           # Extract the author value.
24508           name=`sed -n 's/.*;   author \([^;]*\);.*/\1/p' ${CVSROOT_DIRNAME}/$module/$file,v|sed 1q`
24509
24510           # Form a suffix string of length (16 - length($name)).
24511           # CAREFUL: this will lose if $name is longer than 16.
24512           sed_pattern=`echo $name|sed s/././g`
24513           suffix=`echo 1234567890123456|sed s/$sed_pattern//`
24514
24515           # Add a final tag with length chosen so that it will push the
24516           # offset of the `;' in the 2nd occurrence of `;\tauthor' in the
24517           # ,v file to exactly 8192.
24518           dotest tag8k-17 "$testcvs -Q tag "x8bytes-$suffix" $file" ''
24519
24520           # This commit would fail with 1.9.27.
24521           echo a >> $file
24522           dotest tag8k-18 "$testcvs -Q ci -m . $file" \
24523 "Checking in $file;
24524 ${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24525 new revision: 1\.3; previous revision: 1\.2
24526 done"
24527           cd ../..
24528           rm -r 1
24529           rm -rf ${CVSROOT_DIRNAME}/$module
24530           ;;
24531
24532
24533         admin)
24534           # More "cvs admin" tests.
24535           # The basicb-21 test tests rejecting an illegal option.
24536           # For -l and -u, see "reserved" and "keyword" tests.
24537           # "binfiles" test has a test of "cvs admin -k".
24538           # "log2" test has tests of -t and -q options to cvs admin.
24539           # "rcs" tests -b option also.
24540           # For -o, see:
24541           #   admin-22-o1 through admin-23 (various cases not involving ::)
24542           #   binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
24543           #   basicb-o* (attempt to delete all revisions)
24544           #   basica-o1 through basica-o3 (basic :: usage)
24545           #   head-o1 (::branch, where this deletes a revision or is noop)
24546           #   branches-o1 (::branch, similar, with different branch topology)
24547           #   log-o1 (1.3.2.1::)
24548           #   binfiles-o1 (1.3:: and ::1.3; binary files)
24549           #   binfiles3-9 (binary files)
24550           #   Also could be testing:
24551           #     1.3.2.6::1.3.2.8
24552           #     1.3.2.6::1.3.2
24553           #     1.3.2.1::1.3.2.6
24554           #     1.3::1.3.2.6 (error?  or synonym for ::1.3.2.6?)
24555           # -n: admin, tagf tests.
24556
24557           mkdir 1; cd 1
24558           dotest admin-1 "${testcvs} -q co -l ." ''
24559           mkdir first-dir
24560           dotest admin-2 "${testcvs} add first-dir" \
24561 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
24562           cd first-dir
24563
24564           dotest_fail admin-3 "${testcvs} -q admin -i file1" \
24565 "${PROG} admin: the -i option to admin is not supported
24566 ${PROG} admin: run add or import to create an RCS file
24567 ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
24568           dotest_fail admin-4 "${testcvs} -q log file1" \
24569 "${PROG} log: nothing known about file1"
24570           dotest_fail admin-4a "${testcvs} -q admin file1" \
24571 "${PROG} admin: nothing known about file1"
24572
24573           # Set up some files, file2 a plain one and file1 with a revision
24574           # on a branch.
24575           touch file1 file2
24576           dotest admin-5 "${testcvs} add file1 file2" \
24577 "${PROG} add: scheduling file .file1. for addition
24578 ${PROG} add: scheduling file .file2. for addition
24579 ${PROG} add: use .${PROG} commit. to add these files permanently"
24580           dotest admin-6 "${testcvs} -q ci -m add" \
24581 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24582 done
24583 Checking in file1;
24584 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24585 initial revision: 1\.1
24586 done
24587 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24588 done
24589 Checking in file2;
24590 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24591 initial revision: 1\.1
24592 done"
24593           dotest admin-7 "${testcvs} -q tag -b br" "T file1
24594 T file2"
24595           dotest admin-8 "$testcvs -q update -r br" \
24596 'U file1
24597 U file2'
24598           echo 'add a line on the branch' >> file1
24599           echo 'add a file on the branch' >> file3
24600           dotest admin-9a "${testcvs} -q add file3" \
24601 "${PROG} add: use .${PROG} commit. to add this file permanently"
24602           dotest admin-9b "${testcvs} -q ci -m modify-on-branch" \
24603 "Checking in file1;
24604 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24605 new revision: 1\.1\.2\.1; previous revision: 1\.1
24606 done
24607 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24608 done
24609 Checking in file3;
24610 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
24611 new revision: 1\.1\.2\.1; previous revision: 1\.1
24612 done"
24613           dotest admin-10 "$testcvs -q update -A" \
24614 "U file1
24615 U file2
24616 $PROG update: file3 is no longer in the repository"
24617
24618           # Check that we can administer files in the repository that
24619           # aren't in the working directory.
24620           dotest admin-10-1 "${testcvs} admin ." \
24621 "${PROG} admin: Administrating .
24622 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24623 done
24624 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24625 done"
24626           dotest admin-10-2 "${testcvs} -q admin file3" \
24627 "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24628 done"
24629
24630           # Try to recurse with a numeric revision arg.
24631           # If we wanted to comprehensive about this, we would also test
24632           # this for -l, -u, and all the different -o syntaxes.
24633           dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
24634 "${PROG} [a-z]*: while processing more than one file:
24635 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
24636           dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
24637 "${PROG} [a-z]*: while processing more than one file:
24638 ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
24639
24640           # try a bad symbolic revision
24641           dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \
24642 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24643 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: Symbolic name BOGUS is undefined.
24644 ${PROG} admin: RCS file for .file1. not modified\.
24645 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24646 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name BOGUS is undefined.
24647 ${PROG} admin: RCS file for .file2. not modified\."
24648
24649           # Note that -s option applies to the new default branch, not
24650           # the old one.
24651           # Also note that the implementation of -a via "rcs" requires
24652           # no space between -a and the argument.  However, we expect
24653           # to change that once CVS parses options.
24654           dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
24655 -b1.1.2 -cxx -U -sfoo file1" \
24656 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24657 done"
24658           dotest admin-11a "${testcvs} log -N file1" "
24659 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24660 Working file: file1
24661 head: 1\.1
24662 branch: 1\.1\.2
24663 locks:
24664 access list:
24665         foo
24666         bar
24667         baz
24668 keyword substitution: kv
24669 total revisions: 2;     selected revisions: 2
24670 description:
24671 ----------------------------
24672 revision 1\.1
24673 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24674 branches:  1\.1\.2;
24675 add
24676 ----------------------------
24677 revision 1\.1\.2\.1
24678 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24679 modify-on-branch
24680 ============================================================================="
24681           dotest admin-12 "${testcvs} -q admin -bbr file1" \
24682 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24683 done"
24684           dotest admin-12a "${testcvs} log -N file1" "
24685 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24686 Working file: file1
24687 head: 1\.1
24688 branch: 1\.1\.2
24689 locks:
24690 access list:
24691         foo
24692         bar
24693         baz
24694 keyword substitution: kv
24695 total revisions: 2;     selected revisions: 2
24696 description:
24697 ----------------------------
24698 revision 1\.1
24699 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24700 branches:  1\.1\.2;
24701 add
24702 ----------------------------
24703 revision 1\.1\.2\.1
24704 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24705 modify-on-branch
24706 ============================================================================="
24707
24708           # "cvs log" doesn't print the comment leader.  RCS 5.7 will print
24709           # the comment leader only if one specifies "-V4" to rlog.  So it
24710           # seems like the only way to test it is by looking at the RCS file
24711           # directly.  This also serves as a test of exporting RCS files
24712           # (analogous to the import tests in "rcs").
24713           # Rather than try to write a rigorous check for whether the
24714           # file CVS exports is legal, we just write a simpler
24715           # test for what CVS actually exports, and figure we can revise
24716           # the check as needed (within the confines of the RCS5 format as
24717           # documented in RCSFILES).
24718           # Note that we must accept either 2 or 4 digit year.
24719           dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
24720 "head   1\.1;
24721 branch  1\.1\.2;
24722 access
24723         foo
24724         bar
24725         baz;
24726 symbols
24727         br:1\.1\.0\.2;
24728 locks;
24729 comment @xx@;
24730
24731
24732 1\.1
24733 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;
24734 branches
24735         1\.1\.2\.1;
24736 next    ;
24737
24738 1\.1\.2\.1
24739 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;
24740 branches;
24741 next    ;
24742
24743
24744 desc
24745 @@
24746
24747
24748 1\.1
24749 log
24750 @add
24751 @
24752 text
24753 @@
24754
24755
24756 1\.1\.2\.1
24757 log
24758 @modify-on-branch
24759 @
24760 text
24761 @a0 1
24762 add a line on the branch
24763 @"
24764           dotest_fail admin-14-1 "${testcvs} -q admin \
24765 -m1.1.1.1:changed-bogus-log-message file2" \
24766 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24767 cvs admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision 1\.1\.1\.1
24768 cvs admin: RCS file for .file2. not modified."
24769           dotest admin-14-2 "${testcvs} -q log file2" "
24770 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24771 Working file: file2
24772 head: 1\.1
24773 branch:
24774 locks: strict
24775 access list:
24776 symbolic names:
24777         br: 1\.1\.0\.2
24778 keyword substitution: kv
24779 total revisions: 1;     selected revisions: 1
24780 description:
24781 ----------------------------
24782 revision 1\.1
24783 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24784 add
24785 ============================================================================="
24786
24787           dotest admin-14-3 "${testcvs} -q admin -aauth3 -aauth2,foo \
24788 -soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
24789 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24790 done"
24791           dotest admin-15 "${testcvs} -q log file2" "
24792 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24793 Working file: file2
24794 head: 1\.1
24795 branch:
24796 locks: strict
24797 access list:
24798         auth3
24799         auth2
24800         foo
24801 symbolic names:
24802         tagone: 1\.1
24803         br: 1\.1\.0\.2
24804 keyword substitution: kv
24805 total revisions: 1;     selected revisions: 1
24806 description:
24807 ----------------------------
24808 revision 1\.1
24809 date: [0-9/]* [0-9:]*;  author: ${username};  state: oneone;
24810 changed-log-message
24811 ============================================================================="
24812
24813           dotest admin-16 "${testcvs} -q admin \
24814 -A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
24815 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24816 done"
24817           dotest admin-17 "${testcvs} -q log file1" "
24818 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24819 Working file: file1
24820 head: 1\.1
24821 branch:
24822 locks: strict
24823 access list:
24824         foo
24825         bar
24826         baz
24827         auth3
24828         auth2
24829 symbolic names:
24830         br: 1\.1
24831 keyword substitution: kv
24832 total revisions: 2;     selected revisions: 2
24833 description:
24834 ----------------------------
24835 revision 1\.1
24836 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24837 branches:  1\.1\.2;
24838 add
24839 ----------------------------
24840 revision 1\.1\.2\.1
24841 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24842 modify-on-branch
24843 ============================================================================="
24844
24845           dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
24846 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24847 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: symbolic name br already bound to 1\.1
24848 ${PROG} admin: RCS file for .file1. not modified\."
24849           dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
24850 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24851 done"
24852           dotest admin-20 "${testcvs} -q log file1" "
24853 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24854 Working file: file1
24855 head: 1\.1
24856 branch:
24857 locks: strict
24858 access list:
24859         foo
24860         auth2
24861 symbolic names:
24862 keyword substitution: kv
24863 total revisions: 2;     selected revisions: 2
24864 description:
24865 ----------------------------
24866 revision 1\.1
24867 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24868 branches:  1\.1\.2;
24869 add
24870 ----------------------------
24871 revision 1.1.2.1
24872 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24873 modify-on-branch
24874 ============================================================================="
24875
24876           # OK, this is starting to get ridiculous, in terms of
24877           # testing a feature (access lists) which doesn't do anything
24878           # useful, but what about nonexistent files and
24879           # relative pathnames in admin -A?
24880           dotest_fail admin-19a-nonexist \
24881 "${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
24882 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24883 ${PROG} admin: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
24884 ${PROG} \[admin aborted\]: cannot continue"
24885
24886           # In the remote case, we are cd'd off into the temp directory
24887           # and so these tests give "No such file or directory" errors.
24888           if $remote; then :; else
24889             dotest admin-19a-admin "${testcvs} -q admin -A../../${CVSROOTDIR}/first-dir/file2,v file1" \
24890 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24891 done"
24892             dotest admin-19a-log "${testcvs} -q log -h -N file1" "
24893 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24894 Working file: file1
24895 head: 1\.1
24896 branch:
24897 locks: strict
24898 access list:
24899         foo
24900         auth2
24901         auth3
24902 keyword substitution: kv
24903 total revisions: 2
24904 ============================================================================="
24905           fi # end of tests skipped for remote
24906
24907           # Now test that plain -e works right.
24908           dotest admin-19a-2 "${testcvs} -q admin -e file1" \
24909 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24910 done"
24911           dotest admin-19a-3 "${testcvs} -q log -h -N file1" "
24912 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24913 Working file: file1
24914 head: 1\.1
24915 branch:
24916 locks: strict
24917 access list:
24918 keyword substitution: kv
24919 total revisions: 2
24920 ============================================================================="
24921
24922           # Put the access list back, to avoid special cases later.
24923           dotest admin-19a-4 "${testcvs} -q admin -afoo,auth2 file1" \
24924 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24925 done"
24926
24927           # Add another revision to file2, so we can delete one.
24928           echo 'add a line' >> file2
24929           dotest admin-21 "${testcvs} -q ci -m modify file2" \
24930 "Checking in file2;
24931 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24932 new revision: 1\.2; previous revision: 1\.1
24933 done"
24934           dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
24935 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24936 deleting revision 1\.1
24937 done"
24938           # Test admin -o.  More variants that we could be testing:
24939           # * REV: [on branch]
24940           # * REV1:REV2 [deleting whole branch]
24941           # * high branch numbers (e.g. 1.2.2.3.2.3)
24942           # ... and probably others.  See RCS_delete_revs for ideas.
24943
24944           echo first rev > aaa
24945           dotest admin-22-o1 "${testcvs} add aaa" \
24946 "${PROG} add: scheduling file .aaa. for addition
24947 ${PROG} add: use .${PROG} commit. to add this file permanently"
24948           dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
24949 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
24950 done
24951 Checking in aaa;
24952 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24953 initial revision: 1\.1
24954 done"
24955           echo second rev >> aaa
24956           dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
24957 "Checking in aaa;
24958 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24959 new revision: 1\.2; previous revision: 1\.1
24960 done"
24961           echo third rev >> aaa
24962           dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
24963 "Checking in aaa;
24964 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24965 new revision: 1\.3; previous revision: 1\.2
24966 done"
24967           echo fourth rev >> aaa
24968           dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
24969 "Checking in aaa;
24970 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24971 new revision: 1\.4; previous revision: 1\.3
24972 done"
24973           echo fifth rev >>aaa
24974           dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
24975 "Checking in aaa;
24976 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24977 new revision: 1\.5; previous revision: 1\.4
24978 done"
24979           echo sixth rev >> aaa
24980           dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
24981 "Checking in aaa;
24982 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24983 new revision: 1\.6; previous revision: 1\.5
24984 done"
24985           dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
24986 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
24987 1\.6 locked
24988 done"
24989           dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
24990 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
24991 Working file: aaa
24992 head: 1\.6
24993 branch:
24994 locks: strict
24995         ${username}: 1\.6
24996 access list:
24997 symbolic names:
24998 keyword substitution: kv
24999 total revisions: 6;     selected revisions: 1
25000 description:
25001 ----------------------------
25002 revision 1\.6   locked by: ${username};
25003 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25004 sixth
25005 ============================================================================="
25006           dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
25007 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25008 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove locked revision 1\.6
25009 ${PROG} admin: RCS file for .aaa. not modified\."
25010           dotest admin-22-o11 "${testcvs} admin -u aaa" \
25011 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25012 1\.6 unlocked
25013 done"
25014           dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
25015 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25016 deleting revision 1\.6
25017 deleting revision 1\.5
25018 done"
25019           dotest admin-22-o13 "${testcvs} log aaa" "
25020 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25021 Working file: aaa
25022 head: 1\.4
25023 branch:
25024 locks: strict
25025 access list:
25026 symbolic names:
25027 keyword substitution: kv
25028 total revisions: 4;     selected revisions: 4
25029 description:
25030 ----------------------------
25031 revision 1\.4
25032 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25033 fourth
25034 ----------------------------
25035 revision 1\.3
25036 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25037 third
25038 ----------------------------
25039 revision 1\.2
25040 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25041 second
25042 ----------------------------
25043 revision 1\.1
25044 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25045 first
25046 ============================================================================="
25047
25048           dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
25049           dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
25050           echo new branch rev >> aaa
25051           dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
25052 "Checking in aaa;
25053 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25054 new revision: 1\.3\.2\.1; previous revision: 1\.3
25055 done"
25056           dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
25057 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25058 deleting revision 1\.4
25059 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove branch point 1\.3
25060 ${PROG} admin: RCS file for .aaa. not modified\."
25061           dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
25062 "===================================================================
25063 Checking out aaa
25064 RCS:  ${CVSROOT_DIRNAME}/first-dir/aaa,v
25065 VERS: 1\.4
25066 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
25067 first rev
25068 second rev
25069 third rev
25070 fourth rev"
25071           echo second branch rev >> aaa
25072           dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
25073 "Checking in aaa;
25074 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25075 new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
25076 done"
25077           echo third branch rev >> aaa
25078           dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
25079 "Checking in aaa;
25080 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25081 new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
25082 done"
25083           echo fourth branch rev >> aaa
25084           dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
25085 "Checking in aaa;
25086 ${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25087 new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
25088 done"
25089           dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
25090 "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25091 deleting revision 1\.3\.2\.1
25092 deleting revision 1\.3\.2\.2
25093 deleting revision 1\.3\.2\.3
25094 done"
25095           dotest admin-22-o23 "${testcvs} log aaa" "
25096 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25097 Working file: aaa
25098 head: 1\.4
25099 branch:
25100 locks: strict
25101 access list:
25102 symbolic names:
25103         br1: 1\.3\.0\.2
25104 keyword substitution: kv
25105 total revisions: 5;     selected revisions: 5
25106 description:
25107 ----------------------------
25108 revision 1\.4
25109 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25110 fourth
25111 ----------------------------
25112 revision 1\.3
25113 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25114 branches:  1\.3\.2;
25115 third
25116 ----------------------------
25117 revision 1\.2
25118 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25119 second
25120 ----------------------------
25121 revision 1\.1
25122 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25123 first
25124 ----------------------------
25125 revision 1\.3\.2\.4
25126 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
25127 branch-four
25128 ============================================================================="
25129
25130           dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
25131 "first rev
25132 second rev
25133 third rev
25134 new branch rev
25135 second branch rev
25136 third branch rev
25137 fourth branch rev"
25138
25139           # The bit here about how there is a "tagone" tag pointing to
25140           # a nonexistent revision is documented by rcs.  I dunno, I
25141           # wonder whether the "cvs admin -o" should give a warning in
25142           # this case.
25143           dotest admin-23 "${testcvs} -q log file2" "
25144 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25145 Working file: file2
25146 head: 1\.2
25147 branch:
25148 locks: strict
25149 access list:
25150         auth3
25151         auth2
25152         foo
25153 symbolic names:
25154         tagone: 1\.1
25155         br: 1\.1\.0\.2
25156 keyword substitution: kv
25157 total revisions: 1;     selected revisions: 1
25158 description:
25159 ----------------------------
25160 revision 1\.2
25161 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25162 modify
25163 ============================================================================="
25164
25165           dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
25166 "head   1\.1;
25167 access
25168         foo
25169         auth2;
25170 symbols;
25171 locks; strict;
25172 comment @xx@;
25173
25174
25175 1\.1
25176 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;
25177 branches
25178         1\.1\.2\.1;
25179 next    ;
25180
25181 1\.1\.2\.1
25182 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;
25183 branches;
25184 next    ;
25185
25186
25187 desc
25188 @@
25189
25190
25191 1\.1
25192 log
25193 @add
25194 @
25195 text
25196 @@
25197
25198
25199 1\.1\.2\.1
25200 log
25201 @modify-on-branch
25202 @
25203 text
25204 @a0 1
25205 add a line on the branch
25206 @"
25207
25208           # Tests of cvs admin -n.  Make use of the results of
25209           # admin-1 through admin-25.
25210           # FIXME: We probably shouldn't make use of those results;
25211           # this test is way too long as it is.
25212
25213           # tagtwo should be a revision
25214           #
25215           dotest admin-26-1 "${testcvs} admin -ntagtwo:tagone file2" \
25216 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25217 done"
25218           
25219           # br1 should be a branch
25220           #
25221           dotest admin-26-2 "${testcvs} admin -nbr1:br file2" \
25222 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25223 done"
25224           
25225           # Attach some tags using RCS versions
25226           #
25227           dotest admin-26-3 "${testcvs} admin -ntagthree:1.1 file2" \
25228 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25229 done"
25230
25231           dotest admin-26-4 "${testcvs} admin -nbr2:1.1.2 file2"  \
25232 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25233 done"
25234
25235           dotest admin-26-5 "${testcvs} admin -nbr4:1.1.0.2 file2"  \
25236 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25237 done"
25238           
25239           # Check results so far
25240           #
25241           dotest admin-26-6 "${testcvs} status -v file2" \
25242 "===================================================================
25243 File: file2             Status: Up-to-date
25244
25245    Working revision:    1\.2.*
25246    Repository revision: 1\.2    ${CVSROOT_DIRNAME}/first-dir/file2,v
25247    Sticky Tag:          (none)
25248    Sticky Date:         (none)
25249    Sticky Options:      (none)
25250
25251    Existing Tags:
25252         br4                             (branch: 1\.1\.2)
25253         br2                             (branch: 1\.1\.2)
25254         tagthree                        (revision: 1\.1)
25255         br1                             (branch: 1\.1\.2)
25256         tagtwo                          (revision: 1\.1)
25257         tagone                          (revision: 1\.1)
25258         br                              (branch: 1\.1\.2)"
25259
25260           
25261           # Add a couple more revisions
25262           #
25263           echo "nuthr_line" >> file2
25264           dotest admin-27-1 "${testcvs} commit -m nuthr_line file2"  \
25265 "Checking in file2;
25266 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
25267 new revision: 1\.3; previous revision: 1\.2
25268 done"
25269
25270           echo "yet_another" >> file2
25271           dotest admin-27-2 "${testcvs} commit -m yet_another file2"  \
25272 "Checking in file2;
25273 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
25274 new revision: 1\.4; previous revision: 1\.3
25275 done"
25276           
25277           # Fail trying to reattach existing tag with -n
25278           #
25279           dotest admin-27-3 "${testcvs} admin -ntagfour:1.1 file2"  \
25280 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25281 done"
25282
25283           dotest_fail admin-27-4 "${testcvs} admin -ntagfour:1.3 file2"  \
25284 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25285 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: symbolic name tagfour already bound to 1\.1
25286 ${PROG} admin: RCS file for .file2. not modified\."
25287           
25288           # Succeed at reattaching existing tag, using -N
25289           #
25290           dotest admin-27-5 "${testcvs} admin -Ntagfour:1.3 file2"  \
25291 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25292 done"
25293           
25294           # Fail on some bogus operations
25295           # Try to attach to nonexistant tag
25296           #
25297           dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \
25298 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25299 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision tagfive is undefined\.
25300 ${PROG} admin: RCS file for .file2. not modified\."
25301           
25302           # Try a some nonexisting numeric target tags
25303           #
25304           dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2"  \
25305 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25306 ${PROG} \[admin aborted\]: revision .2\.1. does not exist"
25307
25308           dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2"  \
25309 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25310 ${PROG} \[admin aborted\]: revision .2\.1\.2. does not exist"
25311           
25312           # Try some invalid targets
25313           #
25314           dotest_fail admin-28-4 "${testcvs} admin -ntagnine:1.a.2 file2"  \
25315 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25316 ${PROG} \[admin aborted\]: tag .1\.a\.2. must start with a letter"
25317
25318           # Confirm that a missing tag is not a fatal error.
25319           dotest admin-28-5.1 "${testcvs} -Q tag BO+GUS file1" ''
25320           dotest_fail admin-28-5.2 "${testcvs} admin -ntagten:BO+GUS file2 file1"  \
25321 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25322 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision BO${PLUS}GUS is undefined\.
25323 ${PROG} admin: RCS file for .file2. not modified\.
25324 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25325 done"
25326
25327           dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2"  \
25328 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25329 ${PROG} \[admin aborted\]: tag .q\.werty. must not contain the characters ..*"
25330
25331           # Verify the archive
25332           #
25333           dotest admin-29 "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
25334 "head   1\.4;
25335 access
25336         auth3
25337         auth2
25338         foo;
25339 symbols
25340         tagfour:1\.3
25341         br4:1\.1\.0\.2
25342         br2:1\.1\.0\.2
25343         tagthree:1\.1
25344         br1:1\.1\.0\.2
25345         tagtwo:1\.1
25346         tagone:1\.1
25347         br:1\.1\.0\.2;
25348 locks; strict;
25349 comment @# @;
25350
25351
25352 1\.4
25353 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;
25354 branches;
25355 next    1\.3;
25356
25357 1\.3
25358 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;
25359 branches;
25360 next    1\.2;
25361
25362 1\.2
25363 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;
25364 branches;
25365 next    ;
25366
25367
25368 desc
25369 @@
25370
25371
25372 1\.4
25373 log
25374 @yet_another
25375 @
25376 text
25377 @add a line
25378 nuthr_line
25379 yet_another
25380 @
25381
25382
25383 1\.3
25384 log
25385 @nuthr_line
25386 @
25387 text
25388 @d3 1
25389 @
25390
25391
25392 1\.2
25393 log
25394 @modify
25395 @
25396 text
25397 @d2 1
25398 @"
25399
25400           dotest_fail admin-30 "${testcvs} admin -mbr:another-log-message \
25401 file2 aaa file3" \
25402 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25403 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision br: 1\.1
25404 ${PROG} admin: RCS file for .file2. not modified.
25405 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25406 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: no such revision br
25407 ${PROG} admin: RCS file for .aaa. not modified.
25408 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
25409 done"
25410           dotest admin-31 "${testcvs} log" \
25411 "${PROG} log: Logging \.
25412
25413 RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25414 Working file: aaa
25415 head: 1\.4
25416 branch:
25417 locks: strict
25418 access list:
25419 symbolic names:
25420         br1: 1\.3\.0\.2
25421 keyword substitution: kv
25422 total revisions: 5;     selected revisions: 5
25423 description:
25424 ----------------------------
25425 revision 1\.4
25426 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25427 fourth
25428 ----------------------------
25429 revision 1\.3
25430 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25431 branches:  1\.3\.2;
25432 third
25433 ----------------------------
25434 revision 1\.2
25435 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25436 second
25437 ----------------------------
25438 revision 1\.1
25439 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25440 first
25441 ----------------------------
25442 revision 1\.3\.2\.4
25443 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
25444 branch-four
25445 =============================================================================
25446
25447 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25448 Working file: file1
25449 head: 1\.1
25450 branch:
25451 locks: strict
25452 access list:
25453         foo
25454         auth2
25455 symbolic names:
25456         tagten: 1\.1
25457         BO${PLUS}GUS: 1\.1
25458 keyword substitution: kv
25459 total revisions: 2;     selected revisions: 2
25460 description:
25461 ----------------------------
25462 revision 1\.1
25463 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25464 branches:  1\.1\.2;
25465 add
25466 ----------------------------
25467 revision 1\.1\.2\.1
25468 date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
25469 modify-on-branch
25470 =============================================================================
25471
25472 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25473 Working file: file2
25474 head: 1\.4
25475 branch:
25476 locks: strict
25477 access list:
25478         auth3
25479         auth2
25480         foo
25481 symbolic names:
25482         tagfour: 1\.3
25483         br4: 1\.1\.0\.2
25484         br2: 1\.1\.0\.2
25485         tagthree: 1\.1
25486         br1: 1\.1\.0\.2
25487         tagtwo: 1\.1
25488         tagone: 1\.1
25489         br: 1\.1\.0\.2
25490 keyword substitution: kv
25491 total revisions: 3;     selected revisions: 3
25492 description:
25493 ----------------------------
25494 revision 1\.4
25495 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25496 yet_another
25497 ----------------------------
25498 revision 1\.3
25499 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25500 nuthr_line
25501 ----------------------------
25502 revision 1\.2
25503 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25504 modify
25505 =============================================================================
25506
25507 RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
25508 Working file: file3
25509 head: 1\.1
25510 branch:
25511 locks: strict
25512 access list:
25513 symbolic names:
25514         br: 1\.1\.0\.2
25515 keyword substitution: kv
25516 total revisions: 2;     selected revisions: 2
25517 description:
25518 ----------------------------
25519 revision 1\.1
25520 date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;
25521 branches:  1\.1\.2;
25522 file file3 was initially added on branch br\.
25523 ----------------------------
25524 revision 1\.1\.2\.1
25525 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25526 another-log-message
25527 ============================================================================="
25528
25529           cd ../..
25530           if $keep; then
25531             echo Keeping ${TESTDIR} and exiting due to --keep
25532             exit 0
25533           fi
25534           # clean up our after ourselves
25535           rm -r 1
25536           rm -rf ${CVSROOT_DIRNAME}/first-dir
25537           ;;
25538
25539         reserved)
25540           # Tests of reserved checkouts.  Eventually this will test
25541           # rcslock.pl (or equivalent) and all kinds of stuff.  Right
25542           # now it just does some very basic checks on cvs admin -u
25543           # and cvs admin -l.
25544           # Also should test locking on a branch (and making sure that
25545           # locks from one branch don't get mixed up with those from
25546           # another.  Both the case where one of the branches is the
25547           # main branch, and in which neither one is).
25548           # See also test keyword, which tests that keywords and -kkvl
25549           # do the right thing in the presence of locks.
25550
25551           # The usual setup, directory first-dir containing file file1.
25552           mkdir 1; cd 1
25553           dotest reserved-1 "${testcvs} -q co -l ." ''
25554           mkdir first-dir
25555           dotest reserved-2 "${testcvs} add first-dir" \
25556 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
25557           cd first-dir
25558           touch file1
25559           dotest reserved-3 "${testcvs} add file1" \
25560 "${PROG} add: scheduling file .file1. for addition
25561 ${PROG} add: use .${PROG} commit. to add this file permanently"
25562           dotest reserved-4 "${testcvs} -q ci -m add" \
25563 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25564 done
25565 Checking in file1;
25566 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
25567 initial revision: 1\.1
25568 done"
25569
25570           dotest reserved-5 "${testcvs} -q admin -l file1" \
25571 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25572 1\.1 locked
25573 done"
25574           dotest reserved-6 "${testcvs} log -N file1" "
25575 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25576 Working file: file1
25577 head: 1\.1
25578 branch:
25579 locks: strict
25580         ${username}: 1\.1
25581 access list:
25582 keyword substitution: kv
25583 total revisions: 1;     selected revisions: 1
25584 description:
25585 ----------------------------
25586 revision 1\.1   locked by: ${username};
25587 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25588 add
25589 ============================================================================="
25590
25591           # Note that this just tests the owner of the lock giving
25592           # it up.  It doesn't test breaking a lock.
25593           dotest reserved-7 "${testcvs} -q admin -u file1" \
25594 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25595 1\.1 unlocked
25596 done"
25597
25598           dotest reserved-8 "${testcvs} log -N file1" "
25599 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25600 Working file: file1
25601 head: 1\.1
25602 branch:
25603 locks: strict
25604 access list:
25605 keyword substitution: kv
25606 total revisions: 1;     selected revisions: 1
25607 description:
25608 ----------------------------
25609 revision 1\.1
25610 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25611 add
25612 ============================================================================="
25613
25614           # rcslock.pl tests.  Of course, the point isn't to test
25615           # rcslock.pl from the distribution but equivalent
25616           # functionality (for example, many sites may have an old
25617           # rcslock.pl).  The functionality of this hook falls
25618           # short of the real rcslock.pl though.
25619           # Note that we can use rlog or look at the RCS file directly,
25620           # but we can't use "cvs log" because "cvs commit" has a lock.
25621
25622           cat >${TESTDIR}/lockme <<EOF
25623 #!${TESTSHELL}
25624 line=\`grep <\$1/\$2,v 'locks $anyusername:1\.[0-9];'\`
25625 if test -z "\$line"; then
25626   # It isn't locked
25627   exit 0
25628 else
25629   user=\`echo \$line | sed -e 's/locks \\($anyusername\\):[0-9.]*;.*/\\1/'\`
25630   version=\`echo \$line | sed -e 's/locks $anyusername:\\([0-9.]*\\);.*/\\1/'\`
25631   echo "\$user has file a-lock locked for version  \$version" >&2
25632   exit 1
25633 fi
25634 EOF
25635           # Cygwin.  Blaaarg.
25636           if test -n "$remotehost"; then
25637             $CVS_RSH $remotehost "chmod +x ${TESTDIR}/lockme"
25638           else
25639             chmod +x ${TESTDIR}/lockme
25640           fi
25641
25642           echo stuff > a-lock
25643           dotest reserved-9 "${testcvs} add a-lock" \
25644 "${PROG} add: scheduling file .a-lock. for addition
25645 ${PROG} add: use .${PROG} commit. to add this file permanently"
25646           dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
25647 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25648 done
25649 Checking in a-lock;
25650 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25651 initial revision: 1\.1
25652 done"
25653           # FIXME: the contents of CVSROOT fluctuate a lot
25654           # here. Maybe the expect pattern should just
25655           # confirm that commitinfo is one of the files checked out,
25656           # but for now we just check that CVS exited with success.
25657           cd ..
25658           if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
25659             pass reserved-11
25660           else
25661             fail reserved-11
25662           fi
25663           cd CVSROOT
25664           echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
25665           dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
25666 "Checking in commitinfo;
25667 ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
25668 new revision: 1\.2; previous revision: 1\.1
25669 done
25670 ${PROG} commit: Rebuilding administrative file database"
25671           cd ..; cd first-dir
25672
25673           # Simulate (approximately) what a-lock would look like
25674           # if someone else had locked revision 1.1.
25675           sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
25676           # Cygwin.
25677           if test -n "$remotehost"; then
25678             $CVS_RSH $remotehost "chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25679           else
25680             chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25681           fi
25682           dotest reserved-13 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25683           # Cygwin.  Blah.
25684           if test -n "$remotehost"; then
25685             $CVS_RSH $remotehost "chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25686           else
25687             chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25688           fi
25689           echo more stuff >> a-lock
25690           dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
25691 "fred has file a-lock locked for version  1\.1
25692 ${PROG} commit: Pre-commit check failed
25693 ${PROG} \[commit aborted\]: correct above errors first!"
25694           # OK, now test "cvs admin -l" in the case where someone
25695           # else has the file locked.
25696           dotest_fail reserved-13c "${testcvs} admin -l a-lock" \
25697 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25698 ${PROG} \[admin aborted\]: Revision 1\.1 is already locked by fred"
25699
25700           dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
25701 "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25702 ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/a-lock,v: revision 1\.1 locked by fred; breaking lock
25703 1\.1 unlocked
25704 done"
25705           dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
25706 "Checking in a-lock;
25707 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25708 new revision: 1\.2; previous revision: 1\.1
25709 done"
25710
25711           # Now test for a bug involving branches and locks
25712           sed -e 's/locks; strict;/locks fred:1.2; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
25713           chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25714           dotest reserved-16 \
25715 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v" ""
25716           chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25717           dotest reserved-17 "${testcvs} -q tag -b br a-lock" "T a-lock"
25718           dotest reserved-18 "$testcvs -q update -r br a-lock" '[UP] a-lock'
25719           echo edit it >>a-lock
25720           dotest reserved-19 "${testcvs} -q ci -m modify a-lock" \
25721 "Checking in a-lock;
25722 ${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25723 new revision: 1\.2\.2\.1; previous revision: 1\.2
25724 done"
25725
25726           # undo commitinfo changes
25727           cd ../CVSROOT
25728           echo '# vanilla commitinfo' >commitinfo
25729           dotest reserved-cleanup-1 "${testcvs} -q ci -m back commitinfo" \
25730 "Checking in commitinfo;
25731 ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
25732 new revision: 1\.3; previous revision: 1\.2
25733 done
25734 ${PROG} commit: Rebuilding administrative file database"
25735           cd ..; rm -r CVSROOT; cd first-dir
25736
25737           cd ../..
25738           rm -r 1
25739           rm ${TESTDIR}/lockme
25740           rm -rf ${CVSROOT_DIRNAME}/first-dir
25741           ;;
25742
25743         diffmerge1)
25744           # Make sure CVS can merge correctly in circumstances where it
25745           # used to mess up (due to a bug which existed in diffutils 2.7
25746           # and 2.6, but not 2.5, and which has been fixed in CVS's diff
25747           # lib by Paul Eggert, bless his bitty heart).
25748
25749           # This first test involves two working copies, "mine" and
25750           # "yours", checked out from the same repository at the same
25751           # time.  In yours, you remove some text from the end of the
25752           # file and check it in; meanwhile, "me" has commented out some
25753           # lines earlier in the file, and I go to check it in right
25754           # after you checked yours in.  CVS naturally tells me the file
25755           # is not up-to-date, so I run cvs update, but it updates
25756           # incorrectly, leaving in the lines of text you just deleted.
25757           # Bad!  I'm in too much of a hurry to actually look at the
25758           # file, so I check it in and go home, and so your changes have
25759           # been lost.  Later you discover this, and you suspect me of
25760           # deliberately sabotaging your work, so you let all the air
25761           # out of my tires.  Only after a series of expensive lawsuits
25762           # and countersuits do we discover that this was all CVS's
25763           # fault.
25764           #
25765           # Luckily, this problem has been fixed now, as our test will
25766           # handily confirm, no doubt:
25767
25768           # First make a repository containing the original text:
25769
25770           # We should be here anyway, but cd to it just in case:
25771           cd ${TESTDIR}
25772
25773           mkdir diffmerge1
25774           cd diffmerge1
25775
25776           # These are the files we both start out with:
25777           mkdir import
25778           cd import
25779           diffmerge_create_older_files
25780
25781           dotest diffmerge1_import \
25782             "${testcvs} import -m import diffmerge1 tag1 tag2" \
25783             "${DOTSTAR}No conflicts created by this import"
25784           cd ..
25785
25786           # Check out two working copies, one for "you" and one for
25787           # "me".  If no branch is used and cvs detects that only one
25788           # of the two people made changes, then cvs does not run the
25789           # merge algorithm.  But if a branch is used, then cvs does run
25790           # the merge algorithm (even in this case of only one of the two
25791           # people having made changes).  CVS used to have a bug in this
25792           # case.  Therefore, it is important to test this case by
25793           # using a branch:
25794           ${testcvs} rtag     -b tag diffmerge1 >/dev/null 2>&1
25795           ${testcvs} checkout -r tag diffmerge1 >/dev/null 2>&1
25796           mv diffmerge1 yours
25797           ${testcvs} checkout diffmerge1 >/dev/null 2>&1
25798           mv diffmerge1 mine
25799
25800           # In your working copy, you'll make changes, and
25801           # then check in your changes before I check in mine:
25802           cd yours
25803           diffmerge_create_your_files
25804           dotest diffmerge1_yours "${testcvs} -q ci -m yours" \
25805 "Checking in testcase01;
25806 ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v  <--  testcase01
25807 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25808 done
25809 Checking in testcase02;
25810 ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v  <--  testcase02
25811 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25812 done
25813 Checking in testcase03;
25814 ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v  <--  testcase03
25815 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25816 done
25817 Checking in testcase04;
25818 ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v  <--  testcase04
25819 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25820 done
25821 Checking in testcase05;
25822 ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v  <--  testcase05
25823 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25824 done
25825 Checking in testcase06;
25826 ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v  <--  testcase06
25827 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25828 done
25829 Checking in testcase07;
25830 ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v  <--  testcase07
25831 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25832 done
25833 Checking in testcase08;
25834 ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v  <--  testcase08
25835 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25836 done
25837 Checking in testcase09;
25838 ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v  <--  testcase09
25839 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25840 done
25841 Checking in testcase10;
25842 ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v  <--  testcase10
25843 new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25844 done"
25845
25846           # Change my copy.  Then I
25847           # update, after both my modifications and your checkin:
25848           cd ../mine
25849           diffmerge_create_my_files
25850           dotest diffmerge1_mine "${testcvs} -q update -j tag" \
25851 "M testcase01
25852 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v
25853 retrieving revision 1\.1\.1\.1
25854 retrieving revision 1\.1\.1\.1\.2\.1
25855 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase01
25856 M testcase02
25857 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v
25858 retrieving revision 1\.1\.1\.1
25859 retrieving revision 1\.1\.1\.1\.2\.1
25860 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase02
25861 M testcase03
25862 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v
25863 retrieving revision 1\.1\.1\.1
25864 retrieving revision 1\.1\.1\.1\.2\.1
25865 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase03
25866 M testcase04
25867 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v
25868 retrieving revision 1\.1\.1\.1
25869 retrieving revision 1\.1\.1\.1\.2\.1
25870 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase04
25871 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v
25872 retrieving revision 1\.1\.1\.1
25873 retrieving revision 1\.1\.1\.1\.2\.1
25874 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase05
25875 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v
25876 retrieving revision 1\.1\.1\.1
25877 retrieving revision 1\.1\.1\.1\.2\.1
25878 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase06
25879 M testcase07
25880 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v
25881 retrieving revision 1\.1\.1\.1
25882 retrieving revision 1\.1\.1\.1\.2\.1
25883 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase07
25884 testcase07 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1
25885 M testcase08
25886 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
25887 retrieving revision 1\.1\.1\.1
25888 retrieving revision 1\.1\.1\.1\.2\.1
25889 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase08
25890 M testcase09
25891 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v
25892 retrieving revision 1\.1\.1\.1
25893 retrieving revision 1\.1\.1\.1\.2\.1
25894 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase09
25895 M testcase10
25896 RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v
25897 retrieving revision 1\.1\.1\.1
25898 retrieving revision 1\.1\.1\.1\.2\.1
25899 Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase10"
25900
25901           # So if your changes didn't make it into my working copy, or
25902           # in any case if the files do not look like the final text
25903           # in the files in directory comp_me, then the test flunks:
25904           cd ..
25905           mkdir comp_me
25906           cd comp_me
25907           diffmerge_create_expected_files
25908           cd ..
25909           rm mine/.#*
25910
25911           # If you have GNU's version of diff, you may try
25912           # uncommenting the following line which will give more
25913           # fine-grained information about how cvs differed from the
25914           # correct result:
25915           #dotest diffmerge1_cmp "diff -u --recursive --exclude=CVS comp_me mine" ''
25916           dotest diffmerge1_cmp "directory_cmp comp_me mine"
25917
25918           # Clean up after ourselves:
25919           cd ..
25920           if $keep; then :; else
25921             rm -rf diffmerge1 ${CVSROOT_DIRNAME}/diffmerge1
25922           fi
25923           ;;
25924
25925         diffmerge2)
25926
25927           # FIXME: This test should be rewritten to be much more concise.
25928           # It currently weighs in at something like 600 lines, but the
25929           # same thing could probably be tested in more like 50-100 lines.
25930           mkdir diffmerge2
25931
25932           # This tests for another diffmerge bug reported by Martin
25933           # Tomes; actually, his bug was probably caused by an initial
25934           # fix for the bug in test diffmerge1, and likely wasn't ever
25935           # a problem in CVS as long as one was using a normal
25936           # distribution of diff or a version of CVS that has the diff
25937           # lib in it. 
25938           #
25939           # Nevertheless, once burned twice cautious, so we test for his
25940           # bug here.
25941           #
25942           # Here is his report, more or less verbatim:
25943           # ------------------------------------------
25944           #
25945           # Put the attached file (sgrid.h,v) into your repository
25946           # somewhere, check out the module and do this:
25947           #
25948           # cvs update -j Review_Phase_2_Enhancements sgrid.h
25949           # cvs diff -r Review_V1p3 sgrid.h
25950           #
25951           # As there have been no changes made on the trunk there
25952           # should be no differences, however this is output:
25953           #
25954           # % cvs diff -r Review_V1p3 sgrid.h
25955           # Index: sgrid.h
25956           # ===================================================================
25957           # RCS file: /usr/local/repository/play/fred/sgrid.h,v
25958           # retrieving revision 1.1.2.1
25959           # diff -r1.1.2.1 sgrid.h
25960           # 178a179,184
25961           # > /*--------------------------------------------------------------
25962           # > INLINE FUNCTION    :    HORIZONTALLINES
25963           # > NOTES              :    Description at the end of the file
25964           # > ----------------------------------------------------------------*/
25965           # >         uint16 horizontalLines( void );
25966           # >
25967           #
25968           # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
25969           # differences to sgrid.h version 1.1 and got the correct result
25970           # so it looks like the built in patch is faulty.
25971           # -------------------------------------------------------------------
25972           #
25973           # This is the RCS file, sgrid.h,v, that he sent:
25974
25975           echo "head    1.1;
25976 access;
25977 symbols
25978         Review_V1p3:1.1.2.1
25979         Review_V1p3C:1.1.2.1
25980         Review_1p3A:1.1.2.1
25981         Review_V1p3A:1.1.2.1
25982         Review_Phase_2_Enhancements:1.1.0.2
25983         Review_V1p2:1.1
25984         Review_V1p2B:1.1
25985         Review_V1p2A:1.1
25986         Review_V1p1:1.1
25987         Review_1p1:1.1;
25988 locks; strict;
25989 comment @ * @;
25990
25991
25992 1.1
25993 date    97.04.02.11.20.05;      author colinl;  state Exp;
25994 branches
25995         1.1.2.1;
25996 next    ;
25997
25998 1.1.2.1
25999 date    97.06.09.10.00.07;      author colinl;  state Exp;
26000 branches;
26001 next    ;
26002
26003
26004 desc
26005 @@
26006
26007
26008 1.1
26009 log
26010 @Project:     DEV1175
26011 DCN:
26012 Tested By:   Colin Law
26013 Reviewed By:
26014 Reason for Change: Initial Revision of all files
26015
26016 Design Change Details:
26017
26018 Implications:
26019 @
26020 text
26021 @/* \$""Header:   L:/gpanels/dis/sgrid.h_v   1.1.1.0   24 Jan 1996 14:59:20   PAULT  \$ */
26022 /*
26023  * \$""Log:   L:/gpanels/dis/sgrid.h_v  \$
26024  * 
26025  *    Rev 1.1.1.0   24 Jan 1996 14:59:20   PAULT
26026  * Branched
26027  * 
26028  *    Rev 1.1   24 Jan 1996 12:09:52   PAULT
26029  * Consolidated 4100 code merged to trunk
26030  * 
26031  *    Rev 1.0.2.0   01 Jun 1995 14:18:58   DAVEH
26032  * Branched
26033  * 
26034  *    Rev 1.0   19 Apr 1995 16:32:48   COLINL
26035  * Initial revision.
26036 */
26037 /*****************************************************************************
26038 FILE        :   SGRID.H
26039 VERSION     :   2.1
26040 AUTHOR      :   Dave Hartley
26041 SYSTEM      :   Borland C++
26042 DESCRIPTION :   The declaration of the scrolling grid class
26043                   
26044 *****************************************************************************/
26045 #if !defined(__SGRID_H)
26046 #define __SGRID_H
26047
26048 #if !defined(__SCROLL_H)
26049 #include <scroll.h>
26050 #endif
26051
26052 #if !defined(__GKI_H)
26053 #include \"gki.h\"
26054 #endif
26055
26056 #if defined PRINTING_SUPPORT
26057 class Printer;
26058 #endif
26059
26060 /*****************************************************************************
26061 CLASS      :    ScrollingGrid   
26062 DESCRIPTION:    This class inherits from a grid and a scrollable, and
26063                 can therefore use all the PUBLIC services provided by these
26064                 classes. A description of these can be found in
26065                 GRID.H and SCROLL.H.
26066                 A scrolling grid is a set of horizontal and vertical lines
26067                 that scroll and continually update to provide a complete grid
26068
26069 *****************************************************************************/
26070
26071 class ScrollingGrid : public Scrollable
26072 {
26073     public:
26074 #if defined _WINDOWS
26075 /*---------------------------------------------------------------------------
26076 FUNCTION    :   CONSTRUCTOR
26077 DESCRIPTION :   sets up the details of the grid, ready for painting
26078 ARGUMENTS   :   name  : sgColour
26079                         - the colour of the grid
26080                         sgLineType
26081                         - the syle of line
26082                         sgHorizontalTotal
26083                         - the total number of horizontal grid lines
26084                         verticalSpacingMin
26085                         - the min distance between the vertical grid lines
26086                           on the scrolling axis
26087                         currentTimestamp
26088                         - timestamp value now
26089                         ticksPerSecond
26090                         - number of timestamp ticks per second
26091                         ticksPerPixel
26092                         - number of timestamp ticks per pixel required
26093                       
26094 RETURN      :   None
26095 NOTES       :   
26096 ---------------------------------------------------------------------------*/
26097         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, 
26098             uint16 sgHorizontalTotal, 
26099             uint16 verticalSpacingMin, uint32 currentTimestamp, 
26100             uint16 ticksPerSecond, uint32 ticksPerPixel );
26101 #else
26102 /*---------------------------------------------------------------------------
26103 FUNCTION    :   CONSTRUCTOR
26104 DESCRIPTION :   sets up the details of the grid, ready for painting
26105 ARGUMENTS   :   name  : sgColour
26106                         - the colour of the grid
26107                         sgLineType
26108                         - the syle of line
26109                         sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
26110                         - the total number of horizontal grid lines
26111                         sgVerticalSpacing
26112                         - the distance between the vertical grid lines
26113                         on the scrolling axis
26114                       
26115 RETURN      :   None
26116 NOTES       :   If the caller does not get the total grid lines value, synced
26117                 with the overall size of the viewport, the spacing between
26118                 grid lines will not be consistent.
26119
26120 ---------------------------------------------------------------------------*/
26121         ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
26122                      , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
26123 #endif
26124 /*---------------------------------------------------------------------------
26125 FUNCTION    :   DESTRUCTOR
26126 DESCRIPTION :   tidies it all up
26127 ARGUMENTS   :   name  :      
26128                       
26129 RETURN      :   None
26130 NOTES       : 
26131 ---------------------------------------------------------------------------*/
26132         ~ScrollingGrid( void );
26133
26134 /*---------------------------------------------------------------------------
26135 FUNCTION    :   ATTACH
26136 DESCRIPTION :   This service overloads the base class service, as it does
26137                 additional work at the time of attachment.
26138
26139 ARGUMENTS   :   name  : tDrawingArea
26140                         - the scrolled viewport to attach this trend to
26141                       
26142 RETURN      :   None
26143 NOTES       :
26144 ---------------------------------------------------------------------------*/
26145         void attach( SViewport *tDrawingArea );
26146
26147 #if defined _WINDOWS
26148 /*---------------------------------------------------------------------------
26149 FUNCTION    :   calculateVerticalSpacing
26150 DESCRIPTION :   determines optimum spacing along time axis
26151 ARGUMENTS   :   
26152 RETURN      :   None
26153 NOTES       : 
26154 ---------------------------------------------------------------------------*/
26155         void calculateVerticalSpacing();
26156
26157 /*---------------------------------------------------------------------------
26158 FUNCTION    :   gridSpacingTicks
26159 DESCRIPTION :   Provides the grid spacing in the time axis in ticks
26160 ARGUMENTS   :   
26161 RETURN      :   Number of ticks
26162 NOTES       : 
26163 ---------------------------------------------------------------------------*/
26164         uint32 gridSpacingTicks();
26165
26166 #endif
26167
26168 /*---------------------------------------------------------------------------
26169 INLINE FUNCTION    :    HORIZONTALLINES
26170 NOTES              :    Description at the end of the file
26171 ---------------------------------------------------------------------------*/
26172         uint16 horizontalLines( void );
26173
26174 #if defined _WINDOWS
26175 // In Windows the OnDraw() function replaces paint()
26176 /*---------------------------------------------------------------------------
26177 FUNCTION    :   ScrollingGrid OnDraw   
26178 DESCRIPTION :   Paints the given area of the grid.
26179                 Pure virtual
26180 ARGUMENTS   :   pDC     pointer to the device context to use for display
26181                         Note that the device context operates in the coords
26182                         of the window owning the viewport
26183 RETURN      :   None
26184 NOTES       : 
26185 ---------------------------------------------------------------------------*/
26186         virtual void OnDraw( CDC *pDC );
26187
26188 #else   // not Windows            
26189
26190 /*---------------------------------------------------------------------------
26191 FUNCTION    :   PAINT
26192 DESCRIPTION :   This extends the standard grid paint method to paint the
26193                 viewport relative to its current position. 
26194                 
26195 ARGUMENTS   :   name  :      
26196                       
26197 RETURN      :   None
26198 NOTES       : 
26199 ---------------------------------------------------------------------------*/
26200         void paint( void );
26201 #endif
26202
26203 /*---------------------------------------------------------------------------
26204 FUNCTION    :   P A I N T   T E X T   M A R K E R S 
26205 DESCRIPTION :   this service allow the text markers to be painted seperatley
26206                 from the grid lines
26207
26208 ARGUMENTS   :   name : 
26209                                                                           
26210 RETURN      :   None
26211 NOTES       : 
26212 ---------------------------------------------------------------------------*/
26213         void paintTextMarkers();
26214
26215 #if defined PRINTING_SUPPORT
26216 /*---------------------------------------------------------------------------
26217 FUNCTION    :   P R I N T 
26218 DESCRIPTION :   This print service prints a grid marker ( being either a
26219                 timestamp or a date, IF there is one at the plot position
26220                 given
26221
26222 ARGUMENTS   :   name :
26223                         displayPosition
26224                         - Where in the log to look to see if there is an
26225                           entry to print
26226
26227                         - printerPtr
26228                           the printer to print to
26229                                                                           
26230 RETURN      :   None
26231 NOTES       : 
26232 ---------------------------------------------------------------------------*/
26233         void print( uint16 currentPrintPos, Printer *printerPtr );
26234 #endif
26235
26236 /*---------------------------------------------------------------------------
26237 FUNCTION    :   S E T  D R I V E  D I R E C T I O N
26238 DESCRIPTION :   Sets direction for update and scrolling forwards or backwards
26239 ARGUMENTS   :   direction  - required direction
26240 RETURN      :   None
26241 NOTES       : 
26242 ---------------------------------------------------------------------------*/
26243         void setDriveDirection( ScrollDirection direction );
26244
26245 /*---------------------------------------------------------------------------
26246 FUNCTION    :   S E T U P 
26247 DESCRIPTION :   service that will setup the grid prior to a paint
26248
26249 ARGUMENTS   :   name :
26250                         - newTimestamp
26251                             
26252
26253                         - newTimeBase
26254                         the number of ticks that represent a plot point on
26255                         the trendgraph. 
26256                                                                           
26257 RETURN      :   None
26258 NOTES       : 
26259 ---------------------------------------------------------------------------*/
26260         void setup( uint32 newTimestamp, uint32 newTimeBase );
26261
26262 #if defined PRINTING_SUPPORT
26263 /*---------------------------------------------------------------------------
26264 FUNCTION    :   S E T U P   F O R   P R I N T   
26265 DESCRIPTION :   This service iis to be called prior to printing. It allows
26266                 the grid to prepare its markers ready for the print
26267                 commands
26268
26269 ARGUMENTS   :   name : 
26270                                                                           
26271 RETURN      :   None
26272 NOTES       : 
26273 ---------------------------------------------------------------------------*/
26274         void setupForPrint();
26275 #endif
26276
26277 /*---------------------------------------------------------------------------
26278 FUNCTION    :   UPDATE
26279 DESCRIPTION :   When this service is called it will calculate what needs to
26280                 be painted and fill in the display again.
26281
26282 ARGUMENTS   :   name  :     timeStamp
26283                             - the reference time of this update.
26284                       
26285 RETURN      :   None
26286 NOTES       : 
26287 ---------------------------------------------------------------------------*/
26288         void update( uint32 timeStamp );
26289
26290 /*---------------------------------------------------------------------------
26291 FUNCTION    :   U P D A T E   B U F F E R
26292 DESCRIPTION :   When a display update is not required, use this method. It
26293                 updates the internal data ready for a call to paint that
26294                 will then show the grid in the right position
26295
26296 ARGUMENTS   :   name  :      
26297                       
26298 RETURN      :   None
26299 NOTES       : 
26300 ---------------------------------------------------------------------------*/
26301         void updateBuffer( void );
26302
26303     private:
26304
26305 /*---------------------------------------------------------------------------
26306 FUNCTION    :   M A K E   G R I D   M A R K E R 
26307 DESCRIPTION :   service that perpares a string for display. The string will
26308                 either be a short date, or short time. this is determined
26309                 by the current setting of the dateMarker flag
26310
26311 ARGUMENTS   :   name :  timestampVal
26312                         - the value to convert
26313                         
26314                         storePtr
26315                         - the place to put the string
26316
26317 RETURN      :   None
26318 NOTES       : 
26319 ---------------------------------------------------------------------------*/
26320         void makeGridMarker( uint32 timestampVal, char *storePtr );
26321             
26322 /*---------------------------------------------------------------------------
26323 FUNCTION    :   P A I N T   G R I D   M A R K E R 
26324 DESCRIPTION :   given a position will put the string on the display
26325
26326 ARGUMENTS   :   name :
26327                         yPos
26328                         - were it goes on the Y-axis
26329
26330                         gridMarkerPtr
26331                         - what it is
26332                                                                           
26333 RETURN      :   None
26334 NOTES       : 
26335 ---------------------------------------------------------------------------*/
26336         void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
26337
26338 #if defined _WINDOWS
26339 /*---------------------------------------------------------------------------
26340 FUNCTION    :   PAINTHORIZONTALLINES
26341 DESCRIPTION :   responsible for painting the grids horizontal lines 
26342 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
26343                                 in viewport coords
26344                 pDC             pointer to device context to use
26345                       
26346 RETURN      : None
26347 NOTES       :
26348 ---------------------------------------------------------------------------*/
26349         void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
26350 #else
26351 /*---------------------------------------------------------------------------
26352 FUNCTION    :   PAINTHORIZONTALLINES
26353 DESCRIPTION :   responsible for painting the grids horizontal lines 
26354 ARGUMENTS   : name: xStart
26355                     - the starting X co-ordinate for the horizontal line
26356                     xEnd
26357                     - the ending X co-ordinate for the horizontal line
26358                       
26359 RETURN      : None
26360 NOTES       : Remember lines are drawn from origin. The origin in a
26361               horizontal viewport will be the top.    
26362 ---------------------------------------------------------------------------*/
26363         void paintHorizontalLines( uint16 xStart, uint16 xEnd );
26364 #endif
26365
26366 #if defined _WINDOWS
26367 /*---------------------------------------------------------------------------
26368 FUNCTION    :   PAINTVERTICALLINES
26369 DESCRIPTION :   responsible for painting the grids vertical lines 
26370 ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
26371                                 in viewport coords
26372                 offset          offset from rhs that rightmost line would be 
26373                                 drawn if rectangle included whole viewport
26374                 pDC             pointer to device context to use
26375 RETURN      : None
26376 NOTES       : 
26377 ---------------------------------------------------------------------------*/
26378         void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
26379             CDC* pDC );
26380 #else
26381 /*---------------------------------------------------------------------------
26382 FUNCTION    :   PAINTVERTICALLINES
26383 DESCRIPTION :   responsible for painting the grids vertical lines 
26384 ARGUMENTS   : name  :   yStart
26385                         - the starting Y co-ordinate for the vertical line
26386                         yEnd
26387                         - the ending Y co-ordinate for the vertical line
26388                         offset
26389                         - a starting point offset that determines at what X
26390                         position the first line will be drawn
26391
26392                       
26393 RETURN      : None
26394 NOTES       : 
26395 ---------------------------------------------------------------------------*/
26396         void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
26397 #endif
26398
26399 #if defined _WINDOWS
26400 /*---------------------------------------------------------------------------
26401 FUNCTION    :   PAINTVERTICALLINE
26402 DESCRIPTION :   paints one line at the position specified, and length
26403 ARGUMENTS   :   name  : yStart
26404                         - the starting point on the y axis for the line
26405                         yEnd
26406                         - the end point on the y axis for the line
26407                         xPosition
26408                         - The horizontal offset from the start of the viewport
26409                 pDC             pointer to device context to use
26410                       
26411 RETURN      :   None
26412 NOTES       :   There is not an equivalent horizontal method as yet. This
26413                 is a seperate method because the service is useful to a
26414                 derivation of this class
26415 ---------------------------------------------------------------------------*/
26416         void paintVerticalLine( uint16 yStart, uint16 yEnd
26417                               , uint16 xPosition, CDC *pDC );
26418 #else
26419 /*---------------------------------------------------------------------------
26420 FUNCTION    :   PAINTVERTICALLINE
26421 DESCRIPTION :   paints one line at the position specified, and length
26422 ARGUMENTS   :   name  : yStart
26423                         - the starting point on the y axis for the line
26424                         yEnd
26425                         - the end point on the y axis for the line
26426                         xPosition
26427                         - The horizontal offset from the start of the viewport
26428                       
26429 RETURN      :   None
26430 NOTES       :   There is not an equivalent horizontal method as yet. This
26431                 is a seperate method because the service is useful to a
26432                 derivation of this class
26433 ---------------------------------------------------------------------------*/
26434         void paintVerticalLine( uint16 yStart, uint16 yEnd
26435                               , uint16 xPosition );
26436 #endif
26437
26438 /*---------------------------------------------------------------------------
26439 INLINE FUNCTION    :    VERTICALSPACING
26440 NOTES              :    Description at the end of the file
26441 ---------------------------------------------------------------------------*/
26442         uint16 verticalSpacing( void );
26443
26444
26445         // Position in viewport that we are now writing to if going forwards
26446         // Note that if this is greater than viewport length then we have
26447         // just scrolled and value must be adjusted before use.
26448         sint16 forwardsOutputPosition;
26449         
26450         // Position in viewport that we are now writing to if going backwards
26451         // Note that if this is less than zero then we have
26452         // just scrolled and value must be adjusted before use.
26453         sint16 backwardsOutputPosition;
26454
26455         // position in grid cycle of forwards output position.
26456         // if zero then it is time to output a grid line
26457         sint16 forwardsIntervalCount;
26458
26459         // position in grid cycle of forwards output position.
26460         // if zero then it is time to output a grid line
26461         sint16 backwardsIntervalCount;
26462         
26463         uint32  lastUpdateTimestamp;
26464         uint32  timeBase;       // ticks per pixel
26465         uint16  currentOutputPosition;
26466         uint16  gridTimestampSpacing;
26467         uint16  intervalCount;
26468         uint16  horizontalTotal;
26469         uint16  vSpacing;
26470 #if defined PRINTING_SUPPORT
26471         uint16  numberOfGridMarkersPrinted;
26472 #endif
26473         bool    firstTime;       // indicates first time through
26474         bool    dateMarker;
26475
26476         GkiLineType lineType;
26477         GkiColour   gridColour;
26478
26479     #if defined _WINDOWS
26480         uint16 ticksPerSec;     // number of time ticks per second
26481         uint16 vSpacingMin;     // minimum pixels per division along time axis 
26482         CPen *pPen;             // the pen to use for drawing in windows
26483     #endif
26484
26485 };
26486
26487
26488 /*****************************************************************************
26489                         I N L I N E   F U N C T I O N S   
26490 *****************************************************************************/
26491
26492 /*---------------------------------------------------------------------------
26493 FUNCTION    :   HORIZONTALLINES
26494 DESCRIPTION :   supplies the number of horizontal lines in the grid
26495 ARGUMENTS   :   name  :      
26496                       
26497 RETURN      :   
26498 NOTES       : 
26499 ---------------------------------------------------------------------------*/
26500 inline uint16 ScrollingGrid::horizontalLines( void )
26501 {
26502     return( horizontalTotal );
26503 }
26504 /*---------------------------------------------------------------------------
26505 FUNCTION    :   VERTICALSPACING
26506 DESCRIPTION :   returns the distance between adjacent vertical lines
26507 ARGUMENTS   :   name  :      
26508                       
26509 RETURN      :   None
26510 NOTES       : 
26511 ---------------------------------------------------------------------------*/
26512 inline uint16 ScrollingGrid::verticalSpacing( void )
26513 {
26514     return( vSpacing );
26515 }
26516
26517 #endif
26518 @
26519
26520
26521 1.1.2.1
26522 log
26523 @DEV1194:DS4    Provision of major and minor grid lines
26524 @
26525 text
26526 @d1 1
26527 a1 1
26528 /* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
26529 d3 1
26530 a3 12
26531  * \$""Log: sgrid.h,v \$
26532  * Revision 1.1  1997/04/02 11:20:05  colinl
26533  * Project:     DEV1175
26534  * DCN:
26535  * Tested By:   Colin Law
26536  * Reviewed By:
26537  * Reason for Change: Initial Revision of all files
26538  *
26539  * Design Change Details:
26540  *
26541  * Implications:
26542  *
26543 d58 6
26544 a63 5
26545 ARGUMENTS   :   name  : majorColour         colour for major grid lines
26546                         minorColour         colour for minor grid lines
26547                         sgLineType          line type for minor grid lines
26548                         yMajorGridLines     number of major y lines on grid
26549                         yMinorGridLines     number of major y lines on grid
26550 d77 2
26551 a78 3
26552         ScrollingGrid( GkiColour majorColour, GkiColour minorColour, 
26553             GkiLineType sgLineType, 
26554             uint16 yMajorGridLines, uint16 yMinorGridLines,
26555 a137 17
26556 FUNCTION    :   DrawHorizontalGridLines
26557
26558 DESCRIPTION :   Draws major or minor grid lines
26559 ARGUMENTS   :   pDC         device context
26560                 pPen        pen to use
26561                 numLines    total lines required
26562                 yLow, yHigh, xLow, xHigh   rectangle to draw in
26563                 yMax        max y value
26564 RETURN      :   None
26565 NOTES       :   
26566 ---------------------------------------------------------------------------*/
26567         void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, 
26568             uint16 numLines,
26569             uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, 
26570             uint16 yMax );
26571
26572 /*---------------------------------------------------------------------------
26573 d148 6
26574 d448 1
26575 a448 2
26576         uint16  m_yMajorGridLines;
26577         uint16  m_yMinorGridLines;
26578 d456 2
26579 a457 3
26580         GkiLineType lineType;    // line type for minor grid lines
26581         GkiColour   m_majorColour;
26582         GkiColour   m_minorColour;
26583 d462 1
26584 a462 2
26585         CPen *pMajorPen;        // pen to use for drawing major grid lines
26586         CPen *pMinorPen;        // pen to use for drawing minor grid lines
26587 d472 12
26588 @" > diffmerge2/sgrid.h,v
26589
26590           # We have to put the RCS file in the repository by hand for
26591           # this test:
26592           mkdir ${CVSROOT_DIRNAME}/diffmerge2
26593           cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
26594           rm -rf diffmerge2
26595           dotest diffmerge2_co \
26596             "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
26597           cd diffmerge2
26598           dotest diffmerge2_update \
26599             "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
26600             "${DOTSTAR}erging ${DOTSTAR}"
26601           # This is the one that counts -- there should be no output:
26602           dotest diffmerge2_diff \
26603             "${testcvs} diff -r Review_V1p3 sgrid.h" ''
26604
26605           cd ..
26606           rm -rf diffmerge2
26607           rm -rf ${CVSROOT_DIRNAME}/diffmerge2
26608           ;;
26609
26610         release)
26611           # Tests of "cvs release", particularly multiple arguments.
26612           # Other CVS release tests:
26613           #   info-cleanup-0 for "cvs -n release".
26614           #   ignore-193 for the text of the question that cvs release asks.
26615           #     Also for interactions with cvsignore.
26616           #   basicc: "-d .", global -Q, no arguments (is a noop),
26617           #     "cvs release" without -d, multiple arguments.
26618           #   dirs-4: repository directory has been deleted.
26619           #   modules2-6: multiple arguments.
26620
26621           # First the usual setup; create a directory first-dir.
26622           mkdir 1; cd 1
26623           dotest release-1 "${testcvs} -q co -l ." ''
26624           mkdir first-dir
26625           dotest release-2 "${testcvs} add first-dir" \
26626 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
26627           cd first-dir
26628           mkdir dir1
26629           dotest release-3 "${testcvs} add dir1" \
26630 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
26631           mkdir dir2
26632           dotest release-4 "${testcvs} add dir2" \
26633 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository"
26634           cd dir2
26635           mkdir dir3
26636           dotest release-5 "${testcvs} add dir3" \
26637 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
26638
26639           cd ../..
26640           dotest release-6 "${testcvs} release -d first-dir/dir2/dir3 first-dir/dir1" \
26641 "You have .0. altered files in this repository.
26642 Are you sure you want to release (and delete) directory .first-dir/dir2/dir3.: \
26643 You have .0. altered files in this repository.
26644 Are you sure you want to release (and delete) directory .first-dir/dir1.: " <<EOF
26645 yes
26646 yes
26647 EOF
26648           dotest_fail release-7 "test -d first-dir/dir1" ''
26649           dotest_fail release-8 "test -d first-dir/dir2/dir3" ''
26650           dotest release-9 "${testcvs} update" \
26651 "${PROG} update: Updating \.
26652 ${PROG} update: Updating first-dir
26653 ${PROG} update: Updating first-dir/dir2"
26654
26655           cd first-dir
26656           mkdir dir1
26657           dotest release-10 "${testcvs} add dir1" \
26658 "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
26659           cd dir2
26660           mkdir dir3
26661           dotest release-11 "${testcvs} add dir3" \
26662 "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
26663
26664           cd ../..
26665           dotest release-12 "${testcvs} release first-dir/dir2/dir3 first-dir/dir1" \
26666 "You have .0. altered files in this repository.
26667 Are you sure you want to release directory .first-dir/dir2/dir3.: .. .release. aborted by user choice.
26668 You have .0. altered files in this repository.
26669 Are you sure you want to release directory .first-dir/dir1.: " <<EOF
26670 no
26671 yes
26672 EOF
26673           dotest release-13 "${testcvs} release first-dir/dir2/dir3 first-dir/dir2" \
26674 "You have .0. altered files in this repository.
26675 Are you sure you want to release directory .first-dir/dir2/dir3.: \
26676 You have .0. altered files in this repository.
26677 Are you sure you want to release directory .first-dir/dir2.: " <<EOF
26678 yes
26679 yes
26680 EOF
26681           dotest release-14 "test -d first-dir/dir1" ''
26682           dotest release-15 "test -d first-dir/dir2/dir3" ''
26683           rm -rf first-dir/dir1 first-dir/dir2
26684
26685           dotest release-16 "${testcvs} update" \
26686 "${PROG} update: Updating \.
26687 ${PROG} update: Updating first-dir"
26688
26689           # Check to make sure release isn't overwriting a
26690           # CVS/Entries file in the current directory (using data
26691           # from the released directory).
26692
26693           # cvs 1.11 (remote) fails on release-21 (a message about
26694           # chdir into the removed directory), although it seemingly
26695           # unedits and removes the directory correctly.  If
26696           # you manually continue, it then fails on release-22 do
26697           # to the messed up CVS/Entries file from release-21.
26698           cd first-dir
26699           mkdir second-dir
26700           dotest release-18 "$testcvs add second-dir" \
26701 "Directory $CVSROOT_DIRNAME/first-dir/second-dir added to the repository"
26702
26703           cd second-dir
26704           touch file1
26705           dotest release-19 "$testcvs -Q add file1"
26706           dotest release-20 '$testcvs -q ci -m add' \
26707 "RCS file: $CVSROOT_DIRNAME/first-dir/second-dir/file1,v
26708 done
26709 Checking in file1;
26710 $CVSROOT_DIRNAME/first-dir/second-dir/file1,v  <--  file1
26711 initial revision: 1\.1
26712 done"
26713           dotest release-21 "$testcvs edit file1"
26714           cd ..
26715           dotest release-22 "echo yes | $testcvs release -d second-dir" \
26716 "You have \[0\] altered files in this repository.
26717 Are you sure you want to release (and delete) directory \`second-dir': "
26718           dotest release-23 "$testcvs -q update -d" "U second-dir/file1"
26719           dotest release-24 "$testcvs edit"
26720
26721           cd ../..
26722           rm -rf 1 $CVSROOT_DIRNAME/first-dir
26723           ;;
26724
26725
26726
26727         recase)
26728           #
26729           # Some tests of behavior which broke at one time or another when run
26730           # from case insensitive clients against case sensitive servers.
26731           #
26732           # These tests are namned according to the following convention:
26733           #
26734           #   ci        Client (sandbox filesystem) case Insensitive
26735           #   cs        Client (sandbox filesystem) case Sensitive
26736           #   si        Server (repository filesystem) case Insensitive
26737           #   ss        Server (repository filesystem) case Sensitive
26738           #
26739
26740           mkdir 1; cd 1
26741
26742           # First, we will expect different results for a few of these tests
26743           # based on whether the repository is on a case sensitive filesystem
26744           # or not and whether the sandbox is on a case sensitive filesystem or
26745           # not, so determine which cases we are dealing with:
26746           echo file >file
26747           echo FiLe >FiLe
26748           if cmp file FiLe >/dev/null; then
26749             client_sensitive=false
26750           else
26751             client_sensitive=:
26752           fi
26753           if test -n "$remotehost"; then
26754             $CVS_RSH $remotehost 'echo file >file'
26755             $CVS_RSH $remotehost 'echo FiLe >FiLe'
26756             if $CVS_RSH $remotehost 'cmp file FiLe >/dev/null'; then
26757               server_sensitive=false
26758             else
26759               server_sensitive=:
26760             fi
26761           else
26762             server_sensitive=$client_sensitive
26763           fi
26764
26765           # The first test (recase-1 & recase-2) is for a remove of a file then
26766           # a readd in a different case.
26767           mkdir $CVSROOT_DIRNAME/first-dir
26768           dotest recase-init-1 "$testcvs -Q co first-dir"       
26769           cd first-dir
26770
26771           echo this file has no content >file
26772           dotest recase-init-2 "$testcvs -Q add file"
26773           dotest recase-init-3 "$testcvs -Q ci -madd" \
26774 "RCS file: $CVSROOT_DIRNAME/first-dir/file,v
26775 done
26776 Checking in file;
26777 $CVSROOT_DIRNAME/first-dir/file,v  <--  file
26778 initial revision: 1\.1
26779 done"
26780           dotest recase-init-4 "$testcvs -Q tag first"
26781
26782           # Now remove the file.
26783           dotest recase-init-5 "$testcvs -Q rm -f file"
26784           dotest recase-init-6 "$testcvs -Q ci -mrm" \
26785 "Removing file;
26786 $CVSROOT_DIRNAME/first-dir/file,v  <--  file
26787 new revision: delete; previous revision: 1\.1
26788 done"
26789
26790           # Now the test - readd in a different case.
26791           echo this file needs some content >FiLe
26792           if $server_sensitive; then
26793             dotest recase-1ss "$testcvs add FiLe" \
26794 "$PROG add: scheduling file \`FiLe' for addition
26795 $PROG add: use '$PROG commit' to add this file permanently"
26796             dotest recase-2ss "$testcvs -q ci -mrecase" \
26797 "RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26798 done
26799 Checking in FiLe;
26800 $CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
26801 initial revision: 1\.1
26802 done"
26803           else # server insensitive
26804             dotest recase-1si "$testcvs add FiLe" \
26805 "$PROG add: Re-adding file \`FiLe' (in place of dead revision 1\.2)\.
26806 $PROG add: use '$PROG commit' to add this file permanently"
26807             dotest recase-2si "$testcvs -q ci -mrecase" \
26808 "Checking in FiLe;
26809 $CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
26810 new revision: 1\.3; previous revision: 1\.2
26811 done"
26812           fi
26813
26814           # Now verify that a checkout will still work
26815           cd ../..
26816           mkdir 2; cd 2
26817           dotest recase-3 "$testcvs -q co first-dir" \
26818 "U first-dir/FiLe"
26819
26820           cd first-dir
26821           # Prove that we can still get status and log information on
26822           # conflicting case files (1 in Attic, one in parent).
26823           if $remote; then
26824             if $client_sensitive; then
26825               file=file
26826               fIlE=fIlE
26827             else # client insensitive
26828               # Because FiLe is present on a case insensitive client, it is the
26829               # only one ever found and queried or altered.
26830               file=FiLe
26831               fIlE=FiLe
26832             fi
26833           else # ! $remote
26834             file=file
26835             fIlE=fIlE
26836           fi
26837           if $server_sensitive; then
26838             if $client_sensitive; then
26839               # Client finds Entry only for FiLe.  Others returned by server.
26840               dotest recase-4sscs "$testcvs status file" \
26841 "===================================================================
26842 File: no file file              Status: Up-to-date
26843
26844    Working revision:    No entry for file
26845    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/Attic/file,v"
26846               dotest recase-5sscs "$testcvs log file" \
26847 "
26848 RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
26849 Working file: file
26850 head: 1\.2
26851 branch:
26852 locks: strict
26853 access list:
26854 symbolic names:
26855         first: 1\.1
26856 keyword substitution: kv
26857 total revisions: 2;     selected revisions: 2
26858 description:
26859 ----------------------------
26860 revision 1\.2
26861 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
26862 rm
26863 ----------------------------
26864 revision 1\.1
26865 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26866 add
26867 ============================================================================="
26868               dotest recase-6sscs "$testcvs status FiLe" \
26869 "===================================================================
26870 File: FiLe              Status: Up-to-date
26871
26872    Working revision:    1\.1.*
26873    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
26874    Sticky Tag:          (none)
26875    Sticky Date:         (none)
26876    Sticky Options:      (none)"
26877               dotest recase-7sscs "$testcvs log FiLe" \
26878 "
26879 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26880 Working file: FiLe
26881 head: 1\.1
26882 branch:
26883 locks: strict
26884 access list:
26885 symbolic names:
26886 keyword substitution: kv
26887 total revisions: 1;     selected revisions: 1
26888 description:
26889 ----------------------------
26890 revision 1\.1
26891 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26892 recase
26893 ============================================================================="
26894             else # server sensitive && client insensitive
26895               # Client finds same Entry for file & FiLe.
26896               dotest recase-4ssci "$testcvs status file" \
26897 "===================================================================
26898 File: FiLe              Status: Up-to-date
26899
26900    Working revision:    1\.1.*
26901    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
26902    Sticky Tag:          (none)
26903    Sticky Date:         (none)
26904    Sticky Options:      (none)"
26905               dotest recase-5ssci "$testcvs log file" \
26906 "
26907 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26908 Working file: FiLe
26909 head: 1\.1
26910 branch:
26911 locks: strict
26912 access list:
26913 symbolic names:
26914 keyword substitution: kv
26915 total revisions: 1;     selected revisions: 1
26916 description:
26917 ----------------------------
26918 revision 1\.1
26919 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26920 recase
26921 ============================================================================="
26922               dotest recase-6ss "$testcvs status FiLe" \
26923 "===================================================================
26924 File: FiLe              Status: Up-to-date
26925
26926    Working revision:    1\.1.*
26927    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
26928    Sticky Tag:          (none)
26929    Sticky Date:         (none)
26930    Sticky Options:      (none)"
26931               dotest recase-7ss "$testcvs log FiLe" \
26932 "
26933 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26934 Working file: FiLe
26935 head: 1\.1
26936 branch:
26937 locks: strict
26938 access list:
26939 symbolic names:
26940 keyword substitution: kv
26941 total revisions: 1;     selected revisions: 1
26942 description:
26943 ----------------------------
26944 revision 1\.1
26945 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26946 recase
26947 ============================================================================="
26948             fi
26949           else # server insensitive
26950             # There is only one archive when the server is insensitive, but the
26951             # printed file/archive name can vary.
26952             dotest recase-4si "$testcvs status file" \
26953 "===================================================================
26954 File: $file                     Status: Up-to-date
26955
26956    Working revision:    1\.3.*
26957    Repository revision: 1\.3    $CVSROOT_DIRNAME/first-dir/$file,v
26958    Sticky Tag:          (none)
26959    Sticky Date:         (none)
26960    Sticky Options:      (none)"
26961             dotest recase-5si "$testcvs log file" \
26962 "
26963 RCS file: $CVSROOT_DIRNAME/first-dir/$file,v
26964 Working file: $file
26965 head: 1\.3
26966 branch:
26967 locks: strict
26968 access list:
26969 symbolic names:
26970         first: 1\.1
26971 keyword substitution: kv
26972 total revisions: 3;     selected revisions: 3
26973 description:
26974 ----------------------------
26975 revision 1\.3
26976 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
26977 recase
26978 ----------------------------
26979 revision 1\.2
26980 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
26981 rm
26982 ----------------------------
26983 revision 1\.1
26984 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26985 add
26986 ============================================================================="
26987             dotest recase-6si "$testcvs status FiLe" \
26988 "===================================================================
26989 File: FiLe              Status: Up-to-date
26990
26991    Working revision:    1\.3.*
26992    Repository revision: 1\.3    $CVSROOT_DIRNAME/first-dir/FiLe,v
26993    Sticky Tag:          (none)
26994    Sticky Date:         (none)
26995    Sticky Options:      (none)"
26996             dotest recase-7si "$testcvs log FiLe" \
26997 "
26998 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26999 Working file: FiLe
27000 head: 1\.3
27001 branch:
27002 locks: strict
27003 access list:
27004 symbolic names:
27005         first: 1\.1
27006 keyword substitution: kv
27007 total revisions: 3;     selected revisions: 3
27008 description:
27009 ----------------------------
27010 revision 1\.3
27011 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
27012 recase
27013 ----------------------------
27014 revision 1\.2
27015 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
27016 rm
27017 ----------------------------
27018 revision 1\.1
27019 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27020 add
27021 ============================================================================="
27022           fi
27023
27024           # And when the file does not exist on the client, we go with the
27025           # client Entries match.
27026           if $client_sensitive && $server_sensitive; then
27027             dotest recase-8sscs "$testcvs status fIlE" \
27028 "$PROG status: nothing known about fIlE
27029 ===================================================================
27030 File: no file fIlE              Status: Unknown
27031
27032    Working revision:    No entry for fIlE
27033    Repository revision: No revision control file"
27034           else # !$client_sensitive || !$server_sensitive
27035             dotest recase-8anyi "$testcvs status fIlE" \
27036 "===================================================================
27037 File: $fIlE                     Status: Up-to-date
27038
27039    Working revision:    1\.[0-9]*.*
27040    Repository revision: 1\.[0-9]*       $CVSROOT_DIRNAME/first-dir/$fIlE,v
27041    Sticky Tag:          (none)
27042    Sticky Date:         (none)
27043    Sticky Options:      (none)"
27044           fi
27045
27046           # and an update
27047           if $server_sensitive; then
27048             dotest recase-9ss "$testcvs -q up -rfirst" \
27049 "$PROG update: FiLe is no longer in the repository
27050 U file"
27051
27052             if $client_sensitive; then
27053               dotest recase-10sscs "$testcvs -q up -A" \
27054 "U FiLe
27055 $PROG update: file is no longer in the repository"
27056             else # client insensitive
27057               # FIXCVS: This should remove the offending file first.
27058               dotest_fail recase-10ssci "$testcvs -q up -A" \
27059 "$PROG update: move away \./FiLe; it is in the way
27060 C FiLe
27061 $PROG update: file is no longer in the repository"
27062
27063               cd ..
27064               rm -r first-dir
27065               dotest recase-11ssci "$testcvs -q co first-dir" \
27066 "U first-dir/FiLe"
27067               cd first-dir
27068             fi
27069
27070             #
27071             # See what happens when cased names clash.
27072             #
27073
27074             # Copy the archive
27075             if test -n "$remotehost"; then
27076               $CVS_RSH $remotehost "cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
27077                 $CVSROOT_DIRNAME/first-dir/FILE,v"
27078             else
27079               cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
27080                 $CVSROOT_DIRNAME/first-dir/FILE,v
27081             fi
27082
27083             if $client_sensitive; then
27084               dotest recase-12sscs "$testcvs -q up" "U FILE"
27085             else # client insensitive
27086               dotest_fail recase-12ssci "$testcvs -q up" \
27087 "$PROG update: move away \./FILE; it is in the way
27088 C FILE"
27089             fi
27090           else # server insensitive
27091             dotest recase-9si "$testcvs -q up -rfirst" "U FiLe"
27092             dotest recase-10si "$testcvs -q up -A" "U FiLe"
27093           fi
27094
27095           # Prove that we can still get status and log information on
27096           # conflicting case files (1 in Attic, two in parent).
27097           if $server_sensitive; then
27098             if $client_sensitive; then
27099               # Client finds Entry only for FiLe.  Others returned by server.
27100               dotest recase-13sscs "$testcvs status file" \
27101 "===================================================================
27102 File: no file file              Status: Up-to-date
27103
27104    Working revision:    No entry for file
27105    Repository revision: 1\.2    $CVSROOT_DIRNAME/first-dir/Attic/file,v"
27106             dotest recase-14sscs "$testcvs log file" \
27107 "
27108 RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
27109 Working file: file
27110 head: 1\.2
27111 branch:
27112 locks: strict
27113 access list:
27114 symbolic names:
27115         first: 1\.1
27116 keyword substitution: kv
27117 total revisions: 2;     selected revisions: 2
27118 description:
27119 ----------------------------
27120 revision 1\.2
27121 date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
27122 rm
27123 ----------------------------
27124 revision 1\.1
27125 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27126 add
27127 ============================================================================="
27128             dotest recase-15sscs "$testcvs status FiLe" \
27129 "===================================================================
27130 File: FiLe              Status: Up-to-date
27131
27132    Working revision:    1\.1.*
27133    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
27134    Sticky Tag:          (none)
27135    Sticky Date:         (none)
27136    Sticky Options:      (none)"
27137               dotest recase-16sscs "$testcvs log FiLe" \
27138 "
27139 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27140 Working file: FiLe
27141 head: 1\.1
27142 branch:
27143 locks: strict
27144 access list:
27145 symbolic names:
27146 keyword substitution: kv
27147 total revisions: 1;     selected revisions: 1
27148 description:
27149 ----------------------------
27150 revision 1\.1
27151 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27152 recase
27153 ============================================================================="
27154               dotest recase-17sscs "$testcvs status FILE" \
27155 "===================================================================
27156 File: FILE              Status: Up-to-date
27157
27158    Working revision:    1.1.*
27159    Repository revision: 1.1     ${CVSROOT_DIRNAME}/first-dir/FILE,v
27160    Sticky Tag:          (none)
27161    Sticky Date:         (none)
27162    Sticky Options:      (none)"
27163               dotest recase-18sscs "$testcvs log FILE" \
27164 "
27165 RCS file: $CVSROOT_DIRNAME/first-dir/FILE,v
27166 Working file: FILE
27167 head: 1\.1
27168 branch:
27169 locks: strict
27170 access list:
27171 symbolic names:
27172 keyword substitution: kv
27173 total revisions: 1;     selected revisions: 1
27174 description:
27175 ----------------------------
27176 revision 1\.1
27177 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27178 recase
27179 ============================================================================="
27180             else # $server_sensitive && !$client_sensitive
27181               # Client finds same Entry for file & FiLe.
27182               dotest recase-13ssci "$testcvs status file" \
27183 "===================================================================
27184 File: FiLe              Status: Up-to-date
27185
27186    Working revision:    1\.1.*
27187    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
27188    Sticky Tag:          (none)
27189    Sticky Date:         (none)
27190    Sticky Options:      (none)"
27191               dotest recase-16ssci "$testcvs log FiLe" \
27192 "
27193 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27194 Working file: FiLe
27195 head: 1\.1
27196 branch:
27197 locks: strict
27198 access list:
27199 symbolic names:
27200 keyword substitution: kv
27201 total revisions: 1;     selected revisions: 1
27202 description:
27203 ----------------------------
27204 revision 1\.1
27205 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27206 recase
27207 ============================================================================="
27208               dotest recase-17ssci "$testcvs status FILE" \
27209 "===================================================================
27210 File: FiLe              Status: Up-to-date
27211
27212    Working revision:    1\.1.*
27213    Repository revision: 1\.1    $CVSROOT_DIRNAME/first-dir/FiLe,v
27214    Sticky Tag:          (none)
27215    Sticky Date:         (none)
27216    Sticky Options:      (none)"
27217               dotest recase-18ssci "$testcvs log FILE" \
27218 "
27219 RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27220 Working file: FiLe
27221 head: 1\.1
27222 branch:
27223 locks: strict
27224 access list:
27225 symbolic names:
27226 keyword substitution: kv
27227 total revisions: 1;     selected revisions: 1
27228 description:
27229 ----------------------------
27230 revision 1\.1
27231 date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27232 recase
27233 ============================================================================="
27234             fi
27235           else # !$server_sensitive
27236             # Skip these when the server is case insensitive - nothing
27237             # has changed since recase-[4-7]si
27238             :
27239           fi
27240
27241           if $client_sensitive && $server_sensitive; then
27242             dotest recase-19sscs "$testcvs status fIlE" \
27243 "$PROG status: nothing known about fIlE
27244 ===================================================================
27245 File: no file fIlE              Status: Unknown
27246
27247    Working revision:    No entry for fIlE
27248    Repository revision: No revision control file"
27249           else # !$client_sensitive || !$server_sensitive
27250             dotest recase-19anyi "$testcvs status fIlE" \
27251 "===================================================================
27252 File: $fIlE                     Status: Up-to-date
27253
27254    Working revision:    1\.[0-9]*.*
27255    Repository revision: 1\.[0-9]*       $CVSROOT_DIRNAME/first-dir/$fIlE,v
27256    Sticky Tag:          (none)
27257    Sticky Date:         (none)
27258    Sticky Options:      (none)"
27259           fi
27260
27261           # And last but not least, prove that a checkout is still possible.
27262           cd ../..
27263           mkdir 3; cd 3
27264           if $server_sensitive; then
27265             if $client_sensitive; then
27266               dotest recase-20sscs "$testcvs -q co first-dir" \
27267 "U first-dir/FILE
27268 U first-dir/FiLe"
27269             else # $server_senstive && !$client_sensitive
27270               dotest_fail recase-20ssci "$testcvs -q co first-dir" \
27271 "U first-dir/FILE
27272 $PROG checkout: move away first-dir/FiLe; it is in the way
27273 C first-dir/FiLe"
27274             fi
27275           else # !$server_sensitive
27276             # Skip these since nothing has changed.
27277             :
27278           fi
27279
27280           if $keep; then
27281             echo Keeping ${TESTDIR} and exiting due to --keep
27282             exit 0
27283           fi
27284
27285           cd ..
27286           rm -r 1 2 3
27287           if $server_sensitive && test -n "$remotehost"; then
27288             # It is necessary to remove one of the case-conflicted files before
27289             # recursively removing the rest under Cygwin on a Samba share or
27290             # Samba returns a permission denied error due to its case
27291             # confusion.
27292             $CVS_RSH $remotehost "rm -f $CVSROOT_DIRNAME/first-dir/FILE,v"
27293           fi
27294           rm -rf $CVSROOT_DIRNAME/first-dir
27295           ;;
27296
27297
27298
27299         multiroot)
27300           #
27301           # set up two repositories
27302           #
27303
27304           CVSROOT1_DIRNAME=${TESTDIR}/root1
27305           CVSROOT2_DIRNAME=${TESTDIR}/root2
27306           CVSROOT1=`newroot $CVSROOT1_DIRNAME`
27307           CVSROOT2=`newroot $CVSROOT2_DIRNAME`
27308           testcvs1="${testcvs} -d ${CVSROOT1}"
27309           testcvs2="${testcvs} -d ${CVSROOT2}"
27310
27311           dotest multiroot-setup-1 "mkdir $CVSROOT1_DIRNAME $CVSROOT2_DIRNAME"
27312           dotest multiroot-setup-2 "$testcvs -d$CVSROOT1_DIRNAME init"
27313           dotest multiroot-setup-3 "$testcvs -d$CVSROOT2_DIRNAME init"
27314
27315           #
27316           # create some directories in root1
27317           #
27318           mkdir 1; cd 1
27319           dotest multiroot-setup-4 "${testcvs1} co -l ." \
27320 "${PROG} checkout: Updating ."
27321           mkdir mod1-1 mod1-2
27322           dotest multiroot-setup-5 "${testcvs1} add mod1-1 mod1-2" \
27323 "Directory ${CVSROOT1_DIRNAME}/mod1-1 added to the repository
27324 Directory ${CVSROOT1_DIRNAME}/mod1-2 added to the repository"
27325           echo file1-1 > mod1-1/file1-1
27326           echo file1-2 > mod1-2/file1-2
27327           dotest multiroot-setup-6 "${testcvs1} add mod1-1/file1-1 mod1-2/file1-2" \
27328 "${PROG} add: scheduling file .mod1-1/file1-1. for addition
27329 ${PROG} add: scheduling file .mod1-2/file1-2. for addition
27330 ${PROG} add: use .${PROG} commit. to add these files permanently"
27331           dotest multiroot-setup-7 "${testcvs1} commit -m is" \
27332 "${PROG} [a-z]*: Examining \.
27333 ${PROG} [a-z]*: Examining mod1-1
27334 ${PROG} [a-z]*: Examining mod1-2
27335 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27336 done
27337 Checking in mod1-1/file1-1;
27338 ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v  <--  file1-1
27339 initial revision: 1.1
27340 done
27341 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27342 done
27343 Checking in mod1-2/file1-2;
27344 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
27345 initial revision: 1.1
27346 done"
27347           cd ..
27348           rm -rf 1
27349
27350           #
27351           # create some directories in root2
27352           #
27353           mkdir 1; cd 1
27354           dotest multiroot-setup-8 "${testcvs2} co -l ." \
27355 "${PROG} checkout: Updating ."
27356           mkdir mod2-1 mod2-2
27357           dotest multiroot-setup-9 "${testcvs2} add mod2-1 mod2-2" \
27358 "Directory ${CVSROOT2_DIRNAME}/mod2-1 added to the repository
27359 Directory ${CVSROOT2_DIRNAME}/mod2-2 added to the repository"
27360           echo file2-1 > mod2-1/file2-1
27361           echo file2-2 > mod2-2/file2-2
27362           dotest multiroot-setup-6 "${testcvs2} add mod2-1/file2-1 mod2-2/file2-2" \
27363 "${PROG} add: scheduling file .mod2-1/file2-1. for addition
27364 ${PROG} add: scheduling file .mod2-2/file2-2. for addition
27365 ${PROG} add: use .${PROG} commit. to add these files permanently"
27366           dotest multiroot-setup-10 "${testcvs2} commit -m anyone" \
27367 "${PROG} [a-z]*: Examining \.
27368 ${PROG} [a-z]*: Examining mod2-1
27369 ${PROG} [a-z]*: Examining mod2-2
27370 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27371 done
27372 Checking in mod2-1/file2-1;
27373 ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v  <--  file2-1
27374 initial revision: 1.1
27375 done
27376 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27377 done
27378 Checking in mod2-2/file2-2;
27379 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v  <--  file2-2
27380 initial revision: 1.1
27381 done"
27382           cd ..
27383           rm -rf 1
27384
27385           # check out a few directories, from simple/shallow to
27386           # complex/deep
27387           mkdir 1; cd 1
27388
27389           # OK, this case is kind of weird.  If we just run things from
27390           # here, without CVS/Root, then CVS will contact the server
27391           # mentioned in CVSROOT (which is irrelevant) which will print
27392           # some messages.  Our workaround is to make sure we have a
27393           # CVS/Root file at top level.  In the future, it is possible
27394           # the best behavior will be to extend the existing behavior
27395           # ("being called from a directory without CVS administration
27396           # has always meant to process each of the sub-dirs") to also
27397           # do that if there is no CVSROOT, CVS/Root, or -d at top level.
27398           # 
27399           # The local case could stumble through the tests without creating
27400           # the top-level CVS/Root, but we create it for local and for
27401           # remote to reduce special cases later in the test.
27402           dotest multiroot-workaround "${testcvs1} -q co -l ." ""
27403
27404           dotest multiroot-setup-11 "${testcvs1} co mod1-1 mod1-2" \
27405 "${PROG} checkout: Updating mod1-1
27406 U mod1-1/file1-1
27407 ${PROG} checkout: Updating mod1-2
27408 U mod1-2/file1-2"
27409           dotest multiroot-setup-12 "${testcvs2} co mod2-1 mod2-2" \
27410 "${PROG} checkout: Updating mod2-1
27411 U mod2-1/file2-1
27412 ${PROG} checkout: Updating mod2-2
27413 U mod2-2/file2-2"
27414           cd mod1-2
27415           dotest multiroot-setup-13 "${testcvs2} co mod2-2" \
27416 "${PROG} checkout: Updating mod2-2
27417 U mod2-2/file2-2"
27418           cd ..
27419           cd mod2-2
27420           dotest multiroot-setup-14 "${testcvs1} co mod1-2" \
27421 "${PROG} checkout: Updating mod1-2
27422 U mod1-2/file1-2"
27423           cd ..
27424
27425           #
27426           # Make sure that the Root and Repository files contain the
27427           # correct information.
27428           #
27429           dotest multiroot-cvsadm-1a "cat mod1-1/CVS/Root" "${CVSROOT1}"
27430           dotest multiroot-cvsadm-1b "cat mod1-1/CVS/Repository" "mod1-1"
27431           dotest multiroot-cvsadm-2a "cat mod2-1/CVS/Root" "${CVSROOT2}"
27432           dotest multiroot-cvsadm-2b "cat mod2-1/CVS/Repository" "mod2-1"
27433           dotest multiroot-cvsadm-3a "cat mod1-2/CVS/Root" "${CVSROOT1}"
27434           dotest multiroot-cvsadm-3b "cat mod1-2/CVS/Repository" "mod1-2"
27435           dotest multiroot-cvsadm-3c "cat mod1-2/mod2-2/CVS/Root" "${CVSROOT2}"
27436           dotest multiroot-cvsadm-3d "cat mod1-2/mod2-2/CVS/Repository" "mod2-2"
27437           dotest multiroot-cvsadm-4a "cat mod2-2/CVS/Root" "${CVSROOT2}"
27438           dotest multiroot-cvsadm-4b "cat mod2-2/CVS/Repository" "mod2-2"
27439           dotest multiroot-cvsadm-4c "cat mod2-2/mod1-2/CVS/Root" "${CVSROOT1}"
27440           dotest multiroot-cvsadm-4d "cat mod2-2/mod1-2/CVS/Repository" "mod1-2"
27441
27442           #
27443           # Start testing various cvs commands.  Begin with commands
27444           # without extra arguments (e.g. "cvs update", "cvs diff",
27445           # etc.
27446           #
27447
27448           # Do at least one command with both CVSROOTs to make sure
27449           # that there's not some kind of unexpected dependency on the
27450           # choice of which CVSROOT is specified on the command line.
27451
27452           dotest multiroot-update-1a "${testcvs1} update" \
27453 "${PROG} update: Updating \.
27454 ${PROG} update: Updating mod1-1
27455 ${PROG} update: Updating mod1-2
27456 ${PROG} update: Updating mod1-2/mod2-2
27457 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
27458 ${PROG} update: skipping directory mod1-2/mod2-2
27459 ${PROG} update: Updating mod2-1
27460 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-1: No such file or directory
27461 ${PROG} update: skipping directory mod2-1
27462 ${PROG} update: Updating mod2-2
27463 ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
27464 ${PROG} update: skipping directory mod2-2"
27465
27466           # Same deal but with -d ${CVSROOT2}.
27467           dotest multiroot-update-1b "${testcvs2} update" \
27468 "${PROG} update: Updating \.
27469 ${PROG} update: Updating mod1-1
27470 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-1: No such file or directory
27471 ${PROG} update: skipping directory mod1-1
27472 ${PROG} update: Updating mod1-2
27473 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
27474 ${PROG} update: skipping directory mod1-2
27475 ${PROG} update: Updating mod2-1
27476 ${PROG} update: Updating mod2-2
27477 ${PROG} update: Updating mod2-2/mod1-2
27478 ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
27479 ${PROG} update: skipping directory mod2-2/mod1-2"
27480
27481           # modify all files and do a diff
27482
27483           echo bobby >> mod1-1/file1-1
27484           echo brown >> mod1-2/file1-2
27485           echo goes >> mod2-1/file2-1
27486           echo down >> mod2-2/file2-2
27487
27488           dotest_fail multiroot-diff-1 "${testcvs} diff" \
27489 "${PROG} diff: Diffing \.
27490 ${PROG} diff: Diffing mod1-1
27491 Index: mod1-1/file1-1
27492 ===================================================================
27493 RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
27494 retrieving revision 1\.1
27495 diff -r1\.1 file1-1
27496 1a2
27497 > bobby
27498 ${PROG} diff: Diffing mod1-2
27499 Index: mod1-2/file1-2
27500 ===================================================================
27501 RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
27502 retrieving revision 1\.1
27503 diff -r1\.1 file1-2
27504 1a2
27505 > brown
27506 ${PROG} diff: Diffing mod2-2/mod1-2
27507 ${PROG} diff: Diffing mod1-2/mod2-2
27508 ${PROG} diff: Diffing mod2-1
27509 Index: mod2-1/file2-1
27510 ===================================================================
27511 RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
27512 retrieving revision 1\.1
27513 diff -r1\.1 file2-1
27514 1a2
27515 > goes
27516 ${PROG} diff: Diffing mod2-2
27517 Index: mod2-2/file2-2
27518 ===================================================================
27519 RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
27520 retrieving revision 1\.1
27521 diff -r1\.1 file2-2
27522 1a2
27523 > down" \
27524 "${PROG} diff: Diffing \.
27525 ${PROG} diff: Diffing mod1-1
27526 Index: mod1-1/file1-1
27527 ===================================================================
27528 RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
27529 retrieving revision 1\.1
27530 diff -r1\.1 file1-1
27531 1a2
27532 > bobby
27533 ${PROG} diff: Diffing mod1-2
27534 Index: mod1-2/file1-2
27535 ===================================================================
27536 RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
27537 retrieving revision 1\.1
27538 diff -r1\.1 file1-2
27539 1a2
27540 > brown
27541 ${PROG} diff: Diffing mod2-2
27542 ${PROG} diff: Diffing mod2-2/mod1-2
27543 ${PROG} diff: Diffing mod1-2
27544 ${PROG} diff: Diffing mod1-2/mod2-2
27545 ${PROG} diff: Diffing mod2-1
27546 Index: mod2-1/file2-1
27547 ===================================================================
27548 RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
27549 retrieving revision 1\.1
27550 diff -r1\.1 file2-1
27551 1a2
27552 > goes
27553 ${PROG} diff: Diffing mod2-2
27554 Index: mod2-2/file2-2
27555 ===================================================================
27556 RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
27557 retrieving revision 1\.1
27558 diff -r1\.1 file2-2
27559 1a2
27560 > down"
27561
27562           dotest multiroot-commit-1 "${testcvs} commit -m actually" \
27563 "${PROG} [a-z]*: Examining \.
27564 ${PROG} [a-z]*: Examining mod1-1
27565 ${PROG} [a-z]*: Examining mod1-2
27566 ${PROG} [a-z]*: Examining mod2-2/mod1-2
27567 Checking in mod1-1/file1-1;
27568 ${TESTDIR}/root1/mod1-1/file1-1,v  <--  file1-1
27569 new revision: 1.2; previous revision: 1.1
27570 done
27571 Checking in mod1-2/file1-2;
27572 ${TESTDIR}/root1/mod1-2/file1-2,v  <--  file1-2
27573 new revision: 1.2; previous revision: 1.1
27574 done
27575 ${PROG} [a-z]*: Examining mod1-2/mod2-2
27576 ${PROG} [a-z]*: Examining mod2-1
27577 ${PROG} [a-z]*: Examining mod2-2
27578 Checking in mod2-1/file2-1;
27579 ${TESTDIR}/root2/mod2-1/file2-1,v  <--  file2-1
27580 new revision: 1.2; previous revision: 1.1
27581 done
27582 Checking in mod2-2/file2-2;
27583 ${TESTDIR}/root2/mod2-2/file2-2,v  <--  file2-2
27584 new revision: 1.2; previous revision: 1.1
27585 done"
27586
27587           dotest multiroot-update-2 "${testcvs} update" \
27588 "${PROG} update: Updating \.
27589 ${PROG} [a-z]*: Updating mod1-1
27590 ${PROG} [a-z]*: Updating mod1-2
27591 ${PROG} [a-z]*: Updating mod2-2/mod1-2
27592 U mod2-2/mod1-2/file1-2
27593 ${PROG} [a-z]*: Updating mod1-2/mod2-2
27594 U mod1-2/mod2-2/file2-2
27595 ${PROG} update: Updating mod2-1
27596 ${PROG} update: Updating mod2-2" \
27597 "${PROG} update: Updating \.
27598 ${PROG} update: Updating mod1-1
27599 ${PROG} update: Updating mod1-2
27600 ${PROG} update: Updating mod2-2
27601 ${PROG} update: Updating mod2-2/mod1-2
27602 P mod2-2/mod1-2/file1-2
27603 ${PROG} update: Updating mod1-2
27604 ${PROG} update: Updating mod1-2/mod2-2
27605 P mod1-2/mod2-2/file2-2
27606 ${PROG} update: Updating mod2-1
27607 ${PROG} update: Updating mod2-2"
27608
27609           dotest multiroot-tag-1 "${testcvs} tag cattle" \
27610 "${PROG} tag: Tagging \.
27611 ${PROG} tag: Tagging mod1-1
27612 T mod1-1/file1-1
27613 ${PROG} tag: Tagging mod1-2
27614 T mod1-2/file1-2
27615 ${PROG} tag: Tagging mod2-2/mod1-2
27616 ${PROG} tag: Tagging mod1-2/mod2-2
27617 T mod1-2/mod2-2/file2-2
27618 ${PROG} tag: Tagging mod2-1
27619 T mod2-1/file2-1
27620 ${PROG} tag: Tagging mod2-2" \
27621 "${PROG} tag: Tagging \.
27622 ${PROG} tag: Tagging mod1-1
27623 T mod1-1/file1-1
27624 ${PROG} tag: Tagging mod1-2
27625 T mod1-2/file1-2
27626 ${PROG} tag: Tagging mod2-2
27627 ${PROG} tag: Tagging mod2-2/mod1-2
27628 ${PROG} tag: Tagging mod1-2
27629 ${PROG} tag: Tagging mod1-2/mod2-2
27630 T mod1-2/mod2-2/file2-2
27631 ${PROG} tag: Tagging mod2-1
27632 T mod2-1/file2-1
27633 ${PROG} tag: Tagging mod2-2"
27634
27635           echo anotherfile1-1 > mod1-1/anotherfile1-1
27636           echo anotherfile2-1 > mod2-1/anotherfile2-1
27637           echo anotherfile1-2 > mod2-2/mod1-2/anotherfile1-2
27638           echo anotherfile2-2 > mod1-2/mod2-2/anotherfile2-2
27639
27640           if $remote; then
27641             cd mod1-1
27642             dotest multiroot-add-1ar "${testcvs} add anotherfile1-1" \
27643 "${PROG} add: scheduling file .anotherfile1-1. for addition
27644 ${PROG} add: use .${PROG} commit. to add this file permanently"
27645             cd ../mod2-1
27646             dotest multiroot-add-1br "${testcvs} add anotherfile2-1" \
27647 "${PROG} add: scheduling file .anotherfile2-1. for addition
27648 ${PROG} add: use .${PROG} commit. to add this file permanently"
27649             cd ../mod2-2/mod1-2
27650             dotest multiroot-add-1cr "${testcvs} add anotherfile1-2" \
27651 "${PROG} add: scheduling file .anotherfile1-2. for addition
27652 ${PROG} add: use .${PROG} commit. to add this file permanently"
27653             cd ../../mod1-2/mod2-2
27654             dotest multiroot-add-1dr "${testcvs} add anotherfile2-2" \
27655 "${PROG} add: scheduling file .anotherfile2-2. for addition
27656 ${PROG} add: use .${PROG} commit. to add this file permanently"
27657             cd ../..
27658           else
27659             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" \
27660 "${PROG} add: scheduling file .mod1-1/anotherfile1-1. for addition
27661 ${PROG} add: scheduling file .mod2-1/anotherfile2-1. for addition
27662 ${PROG} add: scheduling file .mod2-2/mod1-2/anotherfile1-2. for addition
27663 ${PROG} add: scheduling file .mod1-2/mod2-2/anotherfile2-2. for addition
27664 ${PROG} add: use .${PROG} commit. to add these files permanently"
27665           fi
27666
27667           dotest multiroot-status-1 "${testcvs} status -v" \
27668 "${PROG} status: Examining \.
27669 ${PROG} status: Examining mod1-1
27670 ===================================================================
27671 File: anotherfile1-1    Status: Locally Added
27672
27673    Working revision:    New file!
27674    Repository revision: No revision control file
27675    Sticky Tag:          (none)
27676    Sticky Date:         (none)
27677    Sticky Options:      (none)
27678
27679 ===================================================================
27680 File: file1-1           Status: Up-to-date
27681
27682    Working revision:    1\.2.*
27683    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27684    Sticky Tag:          (none)
27685    Sticky Date:         (none)
27686    Sticky Options:      (none)
27687
27688    Existing Tags:
27689         cattle                          (revision: 1\.2)
27690
27691 ${PROG} status: Examining mod1-2
27692 ===================================================================
27693 File: file1-2           Status: Up-to-date
27694
27695    Working revision:    1\.2.*
27696    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27697    Sticky Tag:          (none)
27698    Sticky Date:         (none)
27699    Sticky Options:      (none)
27700
27701    Existing Tags:
27702         cattle                          (revision: 1\.2)
27703
27704 ${PROG} status: Examining mod2-2/mod1-2
27705 ===================================================================
27706 File: anotherfile1-2    Status: Locally Added
27707
27708    Working revision:    New file!
27709    Repository revision: No revision control file
27710    Sticky Tag:          (none)
27711    Sticky Date:         (none)
27712    Sticky Options:      (none)
27713
27714 ===================================================================
27715 File: file1-2           Status: Up-to-date
27716
27717    Working revision:    1\.2.*
27718    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27719    Sticky Tag:          (none)
27720    Sticky Date:         (none)
27721    Sticky Options:      (none)
27722
27723    Existing Tags:
27724         cattle                          (revision: 1\.2)
27725
27726 ${PROG} status: Examining mod1-2/mod2-2
27727 ===================================================================
27728 File: anotherfile2-2    Status: Locally Added
27729
27730    Working revision:    New file!
27731    Repository revision: No revision control file
27732    Sticky Tag:          (none)
27733    Sticky Date:         (none)
27734    Sticky Options:      (none)
27735
27736 ===================================================================
27737 File: file2-2           Status: Up-to-date
27738
27739    Working revision:    1\.2.*
27740    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27741    Sticky Tag:          (none)
27742    Sticky Date:         (none)
27743    Sticky Options:      (none)
27744
27745    Existing Tags:
27746         cattle                          (revision: 1\.2)
27747
27748 ${PROG} status: Examining mod2-1
27749 ===================================================================
27750 File: anotherfile2-1    Status: Locally Added
27751
27752    Working revision:    New file!
27753    Repository revision: No revision control file
27754    Sticky Tag:          (none)
27755    Sticky Date:         (none)
27756    Sticky Options:      (none)
27757
27758 ===================================================================
27759 File: file2-1           Status: Up-to-date
27760
27761    Working revision:    1\.2.*
27762    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27763    Sticky Tag:          (none)
27764    Sticky Date:         (none)
27765    Sticky Options:      (none)
27766
27767    Existing Tags:
27768         cattle                          (revision: 1\.2)
27769
27770 ${PROG} status: Examining mod2-2
27771 ===================================================================
27772 File: file2-2           Status: Up-to-date
27773
27774    Working revision:    1\.2.*
27775    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27776    Sticky Tag:          (none)
27777    Sticky Date:         (none)
27778    Sticky Options:      (none)
27779
27780    Existing Tags:
27781         cattle                          (revision: 1\.2)" \
27782 "${PROG} status: Examining \.
27783 ${PROG} status: Examining mod1-1
27784 ===================================================================
27785 File: anotherfile1-1    Status: Locally Added
27786
27787    Working revision:    New file!
27788    Repository revision: No revision control file
27789    Sticky Tag:          (none)
27790    Sticky Date:         (none)
27791    Sticky Options:      (none)
27792
27793 ===================================================================
27794 File: file1-1           Status: Up-to-date
27795
27796    Working revision:    1\.2.*
27797    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27798    Sticky Tag:          (none)
27799    Sticky Date:         (none)
27800    Sticky Options:      (none)
27801
27802    Existing Tags:
27803         cattle                          (revision: 1\.2)
27804
27805 ${PROG} status: Examining mod1-2
27806 ===================================================================
27807 File: file1-2           Status: Up-to-date
27808
27809    Working revision:    1\.2.*
27810    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27811    Sticky Tag:          (none)
27812    Sticky Date:         (none)
27813    Sticky Options:      (none)
27814
27815    Existing Tags:
27816         cattle                          (revision: 1\.2)
27817
27818 ${PROG} status: Examining mod2-2
27819 ${PROG} status: Examining mod2-2/mod1-2
27820 ===================================================================
27821 File: anotherfile1-2    Status: Locally Added
27822
27823    Working revision:    New file!
27824    Repository revision: No revision control file
27825    Sticky Tag:          (none)
27826    Sticky Date:         (none)
27827    Sticky Options:      (none)
27828
27829 ===================================================================
27830 File: file1-2           Status: Up-to-date
27831
27832    Working revision:    1\.2.*
27833    Repository revision: 1\.2    ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27834    Sticky Tag:          (none)
27835    Sticky Date:         (none)
27836    Sticky Options:      (none)
27837
27838    Existing Tags:
27839         cattle                          (revision: 1\.2)
27840
27841 ${PROG} status: Examining mod1-2
27842 ${PROG} status: Examining mod1-2/mod2-2
27843 ===================================================================
27844 File: anotherfile2-2    Status: Locally Added
27845
27846    Working revision:    New file!
27847    Repository revision: No revision control file
27848    Sticky Tag:          (none)
27849    Sticky Date:         (none)
27850    Sticky Options:      (none)
27851
27852 ===================================================================
27853 File: file2-2           Status: Up-to-date
27854
27855    Working revision:    1\.2.*
27856    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27857    Sticky Tag:          (none)
27858    Sticky Date:         (none)
27859    Sticky Options:      (none)
27860
27861    Existing Tags:
27862         cattle                          (revision: 1\.2)
27863
27864 ${PROG} status: Examining mod2-1
27865 ===================================================================
27866 File: anotherfile2-1    Status: Locally Added
27867
27868    Working revision:    New file!
27869    Repository revision: No revision control file
27870    Sticky Tag:          (none)
27871    Sticky Date:         (none)
27872    Sticky Options:      (none)
27873
27874 ===================================================================
27875 File: file2-1           Status: Up-to-date
27876
27877    Working revision:    1\.2.*
27878    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27879    Sticky Tag:          (none)
27880    Sticky Date:         (none)
27881    Sticky Options:      (none)
27882
27883    Existing Tags:
27884         cattle                          (revision: 1\.2)
27885
27886 ${PROG} status: Examining mod2-2
27887 ===================================================================
27888 File: file2-2           Status: Up-to-date
27889
27890    Working revision:    1\.2.*
27891    Repository revision: 1\.2    ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27892    Sticky Tag:          (none)
27893    Sticky Date:         (none)
27894    Sticky Options:      (none)
27895
27896    Existing Tags:
27897         cattle                          (revision: 1\.2)"
27898
27899           dotest multiroot-commit-2 "${testcvs} commit -m reading" \
27900 "${PROG} [a-z]*: Examining \.
27901 ${PROG} [a-z]*: Examining mod1-1
27902 ${PROG} [a-z]*: Examining mod1-2
27903 ${PROG} [a-z]*: Examining mod2-2/mod1-2
27904 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
27905 done
27906 Checking in mod1-1/anotherfile1-1;
27907 ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v  <--  anotherfile1-1
27908 initial revision: 1\.1
27909 done
27910 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
27911 done
27912 Checking in mod2-2/mod1-2/anotherfile1-2;
27913 ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v  <--  anotherfile1-2
27914 initial revision: 1\.1
27915 done
27916 ${PROG} [a-z]*: Examining mod1-2/mod2-2
27917 ${PROG} [a-z]*: Examining mod2-1
27918 ${PROG} [a-z]*: Examining mod2-2
27919 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
27920 done
27921 Checking in mod1-2/mod2-2/anotherfile2-2;
27922 ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v  <--  anotherfile2-2
27923 initial revision: 1\.1
27924 done
27925 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
27926 done
27927 Checking in mod2-1/anotherfile2-1;
27928 ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v  <--  anotherfile2-1
27929 initial revision: 1\.1
27930 done"
27931
27932           dotest multiroot-update-3 "${testcvs} update" \
27933 "${PROG} update: Updating \.
27934 ${PROG} [a-z]*: Updating mod1-1
27935 ${PROG} [a-z]*: Updating mod1-2
27936 U mod1-2/anotherfile1-2
27937 ${PROG} [a-z]*: Updating mod2-2/mod1-2
27938 ${PROG} [a-z]*: Updating mod1-2/mod2-2
27939 ${PROG} [a-z]*: Updating mod2-1
27940 ${PROG} [a-z]*: Updating mod2-2
27941 U mod2-2/anotherfile2-2" \
27942 "${PROG} update: Updating \.
27943 ${PROG} update: Updating mod1-1
27944 ${PROG} update: Updating mod1-2
27945 U mod1-2/anotherfile1-2
27946 ${PROG} update: Updating mod2-2
27947 ${PROG} update: Updating mod2-2/mod1-2
27948 ${PROG} update: Updating mod1-2
27949 ${PROG} update: Updating mod1-2/mod2-2
27950 ${PROG} update: Updating mod2-1
27951 ${PROG} update: Updating mod2-2
27952 U mod2-2/anotherfile2-2"
27953
27954           dotest multiroot-log-1 "${testcvs} log" \
27955 "${PROG} log: Logging \.
27956 ${PROG} log: Logging mod1-1
27957
27958 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
27959 Working file: mod1-1/anotherfile1-1
27960 head: 1\.1
27961 branch:
27962 locks: strict
27963 access list:
27964 symbolic names:
27965 keyword substitution: kv
27966 total revisions: 1;     selected revisions: 1
27967 description:
27968 ----------------------------
27969 revision 1\.1
27970 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
27971 reading
27972 =============================================================================
27973
27974 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27975 Working file: mod1-1/file1-1
27976 head: 1\.2
27977 branch:
27978 locks: strict
27979 access list:
27980 symbolic names:
27981         cattle: 1\.2
27982 keyword substitution: kv
27983 total revisions: 2;     selected revisions: 2
27984 description:
27985 ----------------------------
27986 revision 1\.2
27987 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
27988 actually
27989 ----------------------------
27990 revision 1\.1
27991 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
27992 is
27993 =============================================================================
27994 ${PROG} log: Logging mod1-2
27995
27996 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
27997 Working file: mod1-2/anotherfile1-2
27998 head: 1\.1
27999 branch:
28000 locks: strict
28001 access list:
28002 symbolic names:
28003 keyword substitution: kv
28004 total revisions: 1;     selected revisions: 1
28005 description:
28006 ----------------------------
28007 revision 1\.1
28008 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28009 reading
28010 =============================================================================
28011
28012 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28013 Working file: mod1-2/file1-2
28014 head: 1\.2
28015 branch:
28016 locks: strict
28017 access list:
28018 symbolic names:
28019         cattle: 1\.2
28020 keyword substitution: kv
28021 total revisions: 2;     selected revisions: 2
28022 description:
28023 ----------------------------
28024 revision 1\.2
28025 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28026 actually
28027 ----------------------------
28028 revision 1\.1
28029 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28030 is
28031 =============================================================================
28032 ${PROG} log: Logging mod2-2/mod1-2
28033
28034 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28035 Working file: mod2-2/mod1-2/anotherfile1-2
28036 head: 1\.1
28037 branch:
28038 locks: strict
28039 access list:
28040 symbolic names:
28041 keyword substitution: kv
28042 total revisions: 1;     selected revisions: 1
28043 description:
28044 ----------------------------
28045 revision 1\.1
28046 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28047 reading
28048 =============================================================================
28049
28050 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28051 Working file: mod2-2/mod1-2/file1-2
28052 head: 1\.2
28053 branch:
28054 locks: strict
28055 access list:
28056 symbolic names:
28057         cattle: 1\.2
28058 keyword substitution: kv
28059 total revisions: 2;     selected revisions: 2
28060 description:
28061 ----------------------------
28062 revision 1\.2
28063 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28064 actually
28065 ----------------------------
28066 revision 1\.1
28067 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28068 is
28069 =============================================================================
28070 ${PROG} log: Logging mod1-2/mod2-2
28071
28072 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28073 Working file: mod1-2/mod2-2/anotherfile2-2
28074 head: 1\.1
28075 branch:
28076 locks: strict
28077 access list:
28078 symbolic names:
28079 keyword substitution: kv
28080 total revisions: 1;     selected revisions: 1
28081 description:
28082 ----------------------------
28083 revision 1\.1
28084 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28085 reading
28086 =============================================================================
28087
28088 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28089 Working file: mod1-2/mod2-2/file2-2
28090 head: 1\.2
28091 branch:
28092 locks: strict
28093 access list:
28094 symbolic names:
28095         cattle: 1\.2
28096 keyword substitution: kv
28097 total revisions: 2;     selected revisions: 2
28098 description:
28099 ----------------------------
28100 revision 1\.2
28101 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28102 actually
28103 ----------------------------
28104 revision 1\.1
28105 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28106 anyone
28107 =============================================================================
28108 ${PROG} log: Logging mod2-1
28109
28110 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
28111 Working file: mod2-1/anotherfile2-1
28112 head: 1\.1
28113 branch:
28114 locks: strict
28115 access list:
28116 symbolic names:
28117 keyword substitution: kv
28118 total revisions: 1;     selected revisions: 1
28119 description:
28120 ----------------------------
28121 revision 1\.1
28122 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28123 reading
28124 =============================================================================
28125
28126 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
28127 Working file: mod2-1/file2-1
28128 head: 1\.2
28129 branch:
28130 locks: strict
28131 access list:
28132 symbolic names:
28133         cattle: 1\.2
28134 keyword substitution: kv
28135 total revisions: 2;     selected revisions: 2
28136 description:
28137 ----------------------------
28138 revision 1\.2
28139 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28140 actually
28141 ----------------------------
28142 revision 1\.1
28143 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28144 anyone
28145 =============================================================================
28146 ${PROG} log: Logging mod2-2
28147
28148 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28149 Working file: mod2-2/anotherfile2-2
28150 head: 1\.1
28151 branch:
28152 locks: strict
28153 access list:
28154 symbolic names:
28155 keyword substitution: kv
28156 total revisions: 1;     selected revisions: 1
28157 description:
28158 ----------------------------
28159 revision 1\.1
28160 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28161 reading
28162 =============================================================================
28163
28164 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28165 Working file: mod2-2/file2-2
28166 head: 1\.2
28167 branch:
28168 locks: strict
28169 access list:
28170 symbolic names:
28171         cattle: 1\.2
28172 keyword substitution: kv
28173 total revisions: 2;     selected revisions: 2
28174 description:
28175 ----------------------------
28176 revision 1\.2
28177 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28178 actually
28179 ----------------------------
28180 revision 1\.1
28181 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28182 anyone
28183 =============================================================================" \
28184 "${PROG} log: Logging \.
28185 ${PROG} log: Logging mod1-1
28186
28187 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
28188 Working file: mod1-1/anotherfile1-1
28189 head: 1\.1
28190 branch:
28191 locks: strict
28192 access list:
28193 symbolic names:
28194 keyword substitution: kv
28195 total revisions: 1;     selected revisions: 1
28196 description:
28197 ----------------------------
28198 revision 1\.1
28199 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28200 reading
28201 =============================================================================
28202
28203 RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
28204 Working file: mod1-1/file1-1
28205 head: 1\.2
28206 branch:
28207 locks: strict
28208 access list:
28209 symbolic names:
28210         cattle: 1\.2
28211 keyword substitution: kv
28212 total revisions: 2;     selected revisions: 2
28213 description:
28214 ----------------------------
28215 revision 1\.2
28216 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28217 actually
28218 ----------------------------
28219 revision 1\.1
28220 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28221 is
28222 =============================================================================
28223 ${PROG} log: Logging mod1-2
28224
28225 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28226 Working file: mod1-2/anotherfile1-2
28227 head: 1\.1
28228 branch:
28229 locks: strict
28230 access list:
28231 symbolic names:
28232 keyword substitution: kv
28233 total revisions: 1;     selected revisions: 1
28234 description:
28235 ----------------------------
28236 revision 1\.1
28237 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28238 reading
28239 =============================================================================
28240
28241 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28242 Working file: mod1-2/file1-2
28243 head: 1\.2
28244 branch:
28245 locks: strict
28246 access list:
28247 symbolic names:
28248         cattle: 1\.2
28249 keyword substitution: kv
28250 total revisions: 2;     selected revisions: 2
28251 description:
28252 ----------------------------
28253 revision 1\.2
28254 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28255 actually
28256 ----------------------------
28257 revision 1\.1
28258 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28259 is
28260 =============================================================================
28261 ${PROG} log: Logging mod2-2
28262 ${PROG} log: Logging mod2-2/mod1-2
28263
28264 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28265 Working file: mod2-2/mod1-2/anotherfile1-2
28266 head: 1\.1
28267 branch:
28268 locks: strict
28269 access list:
28270 symbolic names:
28271 keyword substitution: kv
28272 total revisions: 1;     selected revisions: 1
28273 description:
28274 ----------------------------
28275 revision 1\.1
28276 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28277 reading
28278 =============================================================================
28279
28280 RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28281 Working file: mod2-2/mod1-2/file1-2
28282 head: 1\.2
28283 branch:
28284 locks: strict
28285 access list:
28286 symbolic names:
28287         cattle: 1\.2
28288 keyword substitution: kv
28289 total revisions: 2;     selected revisions: 2
28290 description:
28291 ----------------------------
28292 revision 1\.2
28293 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28294 actually
28295 ----------------------------
28296 revision 1\.1
28297 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28298 is
28299 =============================================================================
28300 ${PROG} log: Logging mod1-2
28301 ${PROG} log: Logging mod1-2/mod2-2
28302
28303 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28304 Working file: mod1-2/mod2-2/anotherfile2-2
28305 head: 1\.1
28306 branch:
28307 locks: strict
28308 access list:
28309 symbolic names:
28310 keyword substitution: kv
28311 total revisions: 1;     selected revisions: 1
28312 description:
28313 ----------------------------
28314 revision 1\.1
28315 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28316 reading
28317 =============================================================================
28318
28319 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28320 Working file: mod1-2/mod2-2/file2-2
28321 head: 1\.2
28322 branch:
28323 locks: strict
28324 access list:
28325 symbolic names:
28326         cattle: 1\.2
28327 keyword substitution: kv
28328 total revisions: 2;     selected revisions: 2
28329 description:
28330 ----------------------------
28331 revision 1\.2
28332 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28333 actually
28334 ----------------------------
28335 revision 1\.1
28336 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28337 anyone
28338 =============================================================================
28339 ${PROG} log: Logging mod2-1
28340
28341 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
28342 Working file: mod2-1/anotherfile2-1
28343 head: 1\.1
28344 branch:
28345 locks: strict
28346 access list:
28347 symbolic names:
28348 keyword substitution: kv
28349 total revisions: 1;     selected revisions: 1
28350 description:
28351 ----------------------------
28352 revision 1\.1
28353 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28354 reading
28355 =============================================================================
28356
28357 RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
28358 Working file: mod2-1/file2-1
28359 head: 1\.2
28360 branch:
28361 locks: strict
28362 access list:
28363 symbolic names:
28364         cattle: 1\.2
28365 keyword substitution: kv
28366 total revisions: 2;     selected revisions: 2
28367 description:
28368 ----------------------------
28369 revision 1\.2
28370 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28371 actually
28372 ----------------------------
28373 revision 1\.1
28374 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28375 anyone
28376 =============================================================================
28377 ${PROG} log: Logging mod2-2
28378
28379 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28380 Working file: mod2-2/anotherfile2-2
28381 head: 1\.1
28382 branch:
28383 locks: strict
28384 access list:
28385 symbolic names:
28386 keyword substitution: kv
28387 total revisions: 1;     selected revisions: 1
28388 description:
28389 ----------------------------
28390 revision 1\.1
28391 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28392 reading
28393 =============================================================================
28394
28395 RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28396 Working file: mod2-2/file2-2
28397 head: 1\.2
28398 branch:
28399 locks: strict
28400 access list:
28401 symbolic names:
28402         cattle: 1\.2
28403 keyword substitution: kv
28404 total revisions: 2;     selected revisions: 2
28405 description:
28406 ----------------------------
28407 revision 1\.2
28408 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28409 actually
28410 ----------------------------
28411 revision 1\.1
28412 date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28413 anyone
28414 ============================================================================="
28415
28416
28417           # After the simple cases, let's execute some commands which
28418           # refer to parts of our checked-out tree (e.g. "cvs update
28419           # mod1-1 mod2-2")
28420
28421           if $keep; then
28422             echo Keeping ${TESTDIR} and exiting due to --keep
28423             exit 0
28424           fi
28425
28426           # clean up after ourselves
28427           cd ..
28428           rm -r 1
28429
28430           # clean up our repositories
28431           rm -rf root1 root2
28432           ;;
28433
28434         multiroot2)
28435           # More multiroot tests.  In particular, nested directories.
28436
28437           CVSROOT1_DIRNAME=${TESTDIR}/root1
28438           CVSROOT2_DIRNAME=${TESTDIR}/root2
28439           CVSROOT1=`newroot $CVSROOT1_DIRNAME`
28440           CVSROOT2=`newroot $CVSROOT2_DIRNAME`
28441
28442           dotest multiroot2-1 "$testcvs -d$CVSROOT1_DIRNAME init"
28443           dotest multiroot2-2 "$testcvs -d$CVSROOT2_DIRNAME init"
28444
28445           mkdir imp-dir; cd imp-dir
28446           echo file1 >file1
28447           mkdir sdir
28448           echo sfile >sdir/sfile
28449           mkdir sdir/ssdir
28450           echo ssfile >sdir/ssdir/ssfile
28451           dotest_sort multiroot2-3 \
28452 "${testcvs} -d ${CVSROOT1} import -m import-to-root1 dir1 vend rel" "
28453
28454 N dir1/file1
28455 N dir1/sdir/sfile
28456 N dir1/sdir/ssdir/ssfile
28457 No conflicts created by this import
28458 ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir
28459 ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir/ssdir"
28460           cd sdir
28461           dotest_sort multiroot2-4 \
28462 "${testcvs} -d ${CVSROOT2} import -m import-to-root2 sdir vend2 rel2" "
28463
28464 N sdir/sfile
28465 N sdir/ssdir/ssfile
28466 No conflicts created by this import
28467 ${PROG} import: Importing ${TESTDIR}/root2/sdir/ssdir"
28468           cd ../..
28469
28470           mkdir 1; cd 1
28471           # Get TopLevelAdmin-like behavior.
28472           dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co -l ."
28473           dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co dir1" \
28474 "U dir1/file1
28475 U dir1/sdir/sfile
28476 U dir1/sdir/ssdir/ssfile"
28477           cd dir1
28478           dotest multiroot2-6 "${testcvs} -Q release -d sdir" ""
28479           dotest multiroot2-7 "${testcvs} -d ${CVSROOT2} -q co sdir" \
28480 "U sdir/sfile
28481 U sdir/ssdir/ssfile"
28482           cd ..
28483           # This has one subtle effect - it deals with Entries.Log
28484           # so that the next test doesn't get trace messages for
28485           # Entries.Log
28486           dotest multiroot2-8 "${testcvs} update" \
28487 "${PROG} update: Updating \.
28488 ${PROG} update: Updating dir1
28489 ${PROG} update: Updating dir1/sdir
28490 ${PROG} update: Updating dir1/sdir/ssdir" \
28491 "${PROG} update: Updating \.
28492 ${PROG} update: Updating dir1
28493 ${PROG} update: Updating dir1
28494 ${PROG} update: Updating dir1/sdir
28495 ${PROG} update: Updating dir1/sdir/ssdir"
28496           # Two reasons we don't run this on the server: (1) the server
28497           # also prints some trace messages, and (2) the server trace
28498           # messages are subject to out-of-order bugs (this one is hard
28499           # to work around).
28500           if $remote; then :; else
28501             dotest multiroot2-9a "${testcvs} -t update" \
28502 " *-> main loop with CVSROOT=${TESTDIR}/root1
28503 ${PROG} update: Updating \.
28504  *-> Reader_Lock(${TESTDIR}/root1)
28505  *-> Lock_Cleanup()
28506 ${PROG} update: Updating dir1
28507  *-> Reader_Lock(${TESTDIR}/root1/dir1)
28508  *-> Lock_Cleanup()
28509  *-> main loop with CVSROOT=${TESTDIR}/root2
28510 ${PROG} update: Updating dir1/sdir
28511  *-> Reader_Lock(${TESTDIR}/root2/sdir)
28512  *-> Lock_Cleanup()
28513 ${PROG} update: Updating dir1/sdir/ssdir
28514  *-> Reader_Lock(${TESTDIR}/root2/sdir/ssdir)
28515  *-> Lock_Cleanup()
28516  *-> Lock_Cleanup()"
28517           fi
28518
28519           dotest multiroot2-9 "${testcvs} -q tag tag1" \
28520 "T dir1/file1
28521 T dir1/sdir/sfile
28522 T dir1/sdir/ssdir/ssfile"
28523           echo "change it" >>dir1/file1
28524           echo "change him too" >>dir1/sdir/sfile
28525           dotest multiroot2-10 "${testcvs} -q ci -m modify" \
28526 "Checking in dir1/file1;
28527 ${TESTDIR}/root1/dir1/file1,v  <--  file1
28528 new revision: 1\.2; previous revision: 1\.1
28529 done
28530 Checking in dir1/sdir/sfile;
28531 ${TESTDIR}/root2/sdir/sfile,v  <--  sfile
28532 new revision: 1\.2; previous revision: 1\.1
28533 done"
28534           dotest multiroot2-11 "${testcvs} -q tag tag2" \
28535 "T dir1/file1
28536 T dir1/sdir/sfile
28537 T dir1/sdir/ssdir/ssfile"
28538           dotest_fail multiroot2-12 \
28539 "${testcvs} -q diff -u -r tag1 -r tag2" \
28540 "Index: dir1/file1
28541 ===================================================================
28542 RCS file: ${TESTDIR}/root1/dir1/file1,v
28543 retrieving revision 1\.1\.1\.1
28544 retrieving revision 1\.2
28545 diff -u -r1\.1\.1\.1 -r1\.2
28546 --- dir1/file1  ${RFCDATE}      1\.1\.1\.1
28547 ${PLUS}${PLUS}${PLUS} dir1/file1        ${RFCDATE}      1\.2
28548 @@ -1 ${PLUS}1,2 @@
28549  file1
28550 ${PLUS}change it
28551 Index: dir1/sdir/sfile
28552 ===================================================================
28553 RCS file: ${TESTDIR}/root2/sdir/sfile,v
28554 retrieving revision 1\.1\.1\.1
28555 retrieving revision 1\.2
28556 diff -u -r1\.1\.1\.1 -r1\.2
28557 --- dir1/sdir/sfile     ${RFCDATE}      1\.1\.1\.1
28558 ${PLUS}${PLUS}${PLUS} dir1/sdir/sfile   ${RFCDATE}      1\.2
28559 @@ -1 ${PLUS}1,2 @@
28560  sfile
28561 ${PLUS}change him too"
28562
28563           if $keep; then
28564             echo Keeping ${TESTDIR} and exiting due to --keep
28565             exit 0
28566           fi
28567
28568           # clean up after ourselves
28569           cd ..
28570           rm -r imp-dir 1
28571
28572           # clean up our repositories
28573           rm -rf root1 root2
28574           ;;
28575
28576         multiroot3)
28577           # More multiroot tests.  Directories are side-by-side, not nested.
28578           # Not drastically different from multiroot but it covers somewhat
28579           # different stuff.
28580
28581           CVSROOT1=`newroot ${TESTDIR}/root1`
28582           CVSROOT2=`newroot ${TESTDIR}/root2`
28583
28584           mkdir 1; cd 1
28585           dotest multiroot3-1 "$testcvs -d$TESTDIR/root1 init"
28586           dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
28587           mkdir dir1
28588           dotest multiroot3-3 "${testcvs} add dir1" \
28589 "Directory ${TESTDIR}/root1/dir1 added to the repository"
28590           dotest multiroot3-4 "$testcvs -d$TESTDIR/root2 init"
28591           rm -r CVS
28592           dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
28593           mkdir dir2
28594
28595           # OK, the problem is that CVS/Entries doesn't look quite right,
28596           # I suppose because of the "rm -r".
28597           # For local this fixes it up.
28598           dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
28599           if $remote; then
28600             # For remote that doesn't do it.  Use the quick and dirty fix.
28601             echo "D/dir1////" >CVS/Entries
28602             echo "D/dir2////" >>CVS/Entries
28603           fi
28604
28605           dotest multiroot3-7 "${testcvs} add dir2" \
28606 "Directory ${TESTDIR}/root2/dir2 added to the repository"
28607
28608           touch dir1/file1 dir2/file2
28609           if $remote; then
28610             # Trying to add them both in one command doesn't work,
28611             # because add.c doesn't do multiroot (it doesn't use recurse.c).
28612             # Furthermore, it can't deal with the parent directory
28613             # having a different root from the child, hence the cd.
28614             cd dir1
28615             dotest multiroot3-8 "${testcvs} add file1" \
28616 "${PROG} add: scheduling file .file1. for addition
28617 ${PROG} add: use .${PROG} commit. to add this file permanently"
28618             cd ..
28619             dotest multiroot3-8a "${testcvs} add dir2/file2" \
28620 "${PROG} add: scheduling file .dir2/file2. for addition
28621 ${PROG} add: use .${PROG} commit. to add this file permanently"
28622           else
28623             dotest multiroot3-8 "${testcvs} add dir1/file1 dir2/file2" \
28624 "${PROG} add: scheduling file .dir1/file1. for addition
28625 ${PROG} add: scheduling file .dir2/file2. for addition
28626 ${PROG} add: use .${PROG} commit. to add these files permanently"
28627           fi
28628
28629           dotest multiroot3-9 "${testcvs} -q ci -m add-them" \
28630 "RCS file: ${TESTDIR}/root2/dir2/file2,v
28631 done
28632 Checking in dir2/file2;
28633 ${TESTDIR}/root2/dir2/file2,v  <--  file2
28634 initial revision: 1\.1
28635 done
28636 RCS file: ${TESTDIR}/root1/dir1/file1,v
28637 done
28638 Checking in dir1/file1;
28639 ${TESTDIR}/root1/dir1/file1,v  <--  file1
28640 initial revision: 1\.1
28641 done"
28642
28643           # That this is an error is good - we are asking CVS to do
28644           # something which doesn't make sense.
28645           dotest_fail multiroot3-10 \
28646 "${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
28647 "${PROG} diff: failed to create lock directory for .${TESTDIR}/root1/dir2' (${TESTDIR}/root1/dir2/#cvs.lock): No such file or directory
28648 ${PROG} diff: failed to obtain dir lock in repository .${TESTDIR}/root1/dir2'
28649 ${PROG} \[diff aborted\]: read lock failed - giving up"
28650
28651           # This one is supposed to work.
28652           dotest multiroot3-11 "${testcvs} -q diff dir1/file1 dir2/file2" ""
28653
28654           # make sure we can't access across repositories
28655           mkdir 1a
28656           cd 1a
28657           dotest_fail multiroot3-12 \
28658 "$testcvs -d $CVSROOT1 -q co ../root2/dir2" \
28659 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
28660 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
28661 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28662           dotest_fail multiroot3-13 \
28663 "$testcvs -d $CVSROOT2 -q co ../root1/dir1" \
28664 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\." \
28665 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\.
28666 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28667           dotest_fail multiroot3-14 \
28668 "$testcvs -d $CVSROOT1 -q co ./../root2/dir2" \
28669 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\." \
28670 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\.
28671 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28672           dotest_fail multiroot3-15 \
28673 "$testcvs -d $CVSROOT2 -q co ./../root1/dir1" \
28674 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
28675 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
28676 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28677           dotest_fail multiroot3-16 \
28678 "$testcvs -d $CVSROOT1 -q co -p ../root2/dir2" \
28679 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
28680 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
28681 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28682           dotest_fail multiroot3-17 \
28683 "$testcvs -d $CVSROOT1 -q co -p ./../root1/dir1" \
28684 "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
28685 "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
28686 $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28687
28688           if $keep; then
28689             echo Keeping $TESTDIR and exiting due to --keep
28690             exit 0
28691           fi
28692
28693           cd ../..
28694
28695           rm -r 1
28696           rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
28697           unset CVSROOT1
28698           unset CVSROOT2
28699           ;;
28700
28701         multiroot4)
28702           # More multiroot tests, in particular we have two roots with
28703           # similarly-named directories and we try to see that CVS can
28704           # keep them separate.
28705
28706           CVSROOT1=`newroot ${TESTDIR}/root1`
28707           CVSROOT2=`newroot ${TESTDIR}/root2`
28708
28709           mkdir 1; cd 1
28710           dotest multiroot4-1 "$testcvs -d$TESTDIR/root1 init"
28711           dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
28712           mkdir dircom
28713           dotest multiroot4-3 "${testcvs} add dircom" \
28714 "Directory ${TESTDIR}/root1/dircom added to the repository"
28715           cd dircom
28716           touch file1
28717           dotest multiroot4-4 "${testcvs} add file1" \
28718 "${PROG} add: scheduling file .file1. for addition
28719 ${PROG} add: use .${PROG} commit. to add this file permanently"
28720           dotest multiroot4-5 "${testcvs} -q ci -m add" \
28721 "RCS file: ${TESTDIR}/root1/dircom/file1,v
28722 done
28723 Checking in file1;
28724 ${TESTDIR}/root1/dircom/file1,v  <--  file1
28725 initial revision: 1\.1
28726 done"
28727           cd ../..
28728           mkdir 2; cd 2
28729           dotest multiroot4-6 "$testcvs -d$TESTDIR/root2 init"
28730           dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
28731           mkdir dircom
28732           dotest multiroot4-8 "${testcvs} add dircom" \
28733 "Directory ${TESTDIR}/root2/dircom added to the repository"
28734           cd dircom
28735           touch file2
28736           dotest multiroot4-9 "${testcvs} add file2" \
28737 "${PROG} add: scheduling file .file2. for addition
28738 ${PROG} add: use .${PROG} commit. to add this file permanently"
28739           dotest multiroot4-10 "${testcvs} -q ci -m add" \
28740 "RCS file: ${TESTDIR}/root2/dircom/file2,v
28741 done
28742 Checking in file2;
28743 ${TESTDIR}/root2/dircom/file2,v  <--  file2
28744 initial revision: 1\.1
28745 done"
28746
28747           cd ../..
28748           cd 1/dircom
28749           # This may look contrived; the real world example which inspired
28750           # it was that a user was changing from local to remote.  Cases
28751           # like switching servers (among those mounting the same
28752           # repository) and so on would also look the same.
28753           mkdir sdir2
28754           dotest multiroot4-11 "${testcvs} -d ${CVSROOT2} add sdir2" \
28755 "Directory ${TESTDIR}/root2/dircom/sdir2 added to the repository"
28756
28757           dotest multiroot4-12 "${testcvs} -q update" ""
28758           cd ..
28759           dotest multiroot4-13 "${testcvs} -q update dircom" ""
28760           cd ..
28761
28762           rm -r 1 2
28763           rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
28764           unset CVSROOT1
28765           unset CVSROOT2
28766           ;;
28767
28768         rmroot)
28769           # When the Entries/Root file is removed from an existing
28770           # workspace, CVS should assume $CVSROOT instead
28771           #
28772           # Right now only checking that CVS exits normally on an
28773           # update once CVS/Root is deleted
28774           #
28775           # There was a time when this would core dump when run in
28776           # client/server mode
28777
28778           mkdir 1; cd 1
28779           dotest rmroot-setup-1 "${testcvs} -q co -l ." ''
28780           mkdir first-dir
28781           dotest rmroot-setup-2 "${testcvs} add first-dir" \
28782 "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
28783           cd first-dir
28784           touch file1 file2
28785           dotest rmroot-setup-3 "${testcvs} add file1 file2" \
28786 "${PROG} add: scheduling file .file1. for addition
28787 ${PROG} add: scheduling file .file2. for addition
28788 ${PROG} add: use .${PROG} commit. to add these files permanently"
28789           dotest rmroot-setup-4 "${testcvs} -q commit -minit" \
28790 "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
28791 done
28792 Checking in file1;
28793 ${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
28794 initial revision: 1\.1
28795 done
28796 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
28797 done
28798 Checking in file2;
28799 ${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
28800 initial revision: 1\.1
28801 done"
28802           rm CVS/Root
28803           dotest rmroot-1 "${testcvs} -q update" ''
28804
28805           cd ../..
28806           rm -rf 1
28807           ;;
28808
28809         reposmv)
28810           # More tests of repositories and specifying them.
28811           # Similar to crerepos but that test is probably getting big
28812           # enough.
28813           CVSROOT1=`newroot ${TESTDIR}/root1`
28814           CVSROOT_MOVED=`newroot ${TESTDIR}/root-moved`
28815
28816           dotest reposmv-setup-1 "$testcvs -d$TESTDIR/root1 init"
28817           mkdir imp-dir; cd imp-dir
28818           echo file1 >file1
28819           dotest reposmv-setup-2 \
28820 "${testcvs} -d ${CVSROOT1} import -m add dir1 vendor release" \
28821 "N dir1/file1
28822
28823 No conflicts created by this import"
28824           cd ..
28825
28826           mkdir 1; cd 1
28827           dotest reposmv-1 "${testcvs} -d ${CVSROOT1} -Q co dir1" ""
28828           mv ${TESTDIR}/root1 ${TESTDIR}/root-moved
28829           cd dir1
28830
28831           # If we didn't have a relative repository, get one now.
28832           dotest reposmv-1a "cat CVS/Repository" \
28833 "${TESTDIR}/root1/dir1" "dir1"
28834           echo dir1 >CVS/Repository
28835
28836           # There were some duplicated warnings and such; only test
28837           # for the part of the error message which makes sense.
28838           # Bug: "skipping directory " without filename.
28839           if $remote; then
28840             dotest_fail reposmv-2r "${testcvs} update" \
28841 "Cannot access ${TESTDIR}/root1/CVSROOT
28842 No such file or directory"
28843           else
28844             dotest reposmv-2 "${testcvs} update" "${DOTSTAR}
28845 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28846 ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1: No such file or directory
28847 ${PROG} update: skipping directory "
28848           fi
28849
28850           # CVS/Root overrides $CVSROOT
28851           if $remote; then
28852             CVSROOT_save=${CVSROOT}
28853             CVSROOT=:fork:${TESTDIR}/root-moved; export CVSROOT
28854             dotest_fail reposmv-3r "${testcvs} update" \
28855 "Cannot access ${TESTDIR}/root1/CVSROOT
28856 No such file or directory"
28857             CVSROOT=${CVSROOT_save}; export CVSROOT
28858           else
28859             CVSROOT_save=${CVSROOT}
28860             CVSROOT=${TESTDIR}/root-moved; export CVSROOT
28861             dotest reposmv-3 "${testcvs} update" \
28862 "${DOTSTAR}
28863 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28864 ${PROG} update: Updating \.
28865 ${DOTSTAR}"
28866             CVSROOT=${CVSROOT_save}; export CVSROOT
28867           fi
28868
28869           if $remote; then
28870             CVSROOT_save=${CVSROOT}
28871             CVSROOT=:fork:${TESTDIR}/root-none; export CVSROOT
28872             dotest_fail reposmv-4 "${testcvs} update" \
28873 "Cannot access ${TESTDIR}/root1/CVSROOT
28874 No such file or directory"
28875             CVSROOT=${CVSROOT_save}; export CVSROOT
28876           else
28877             # CVS/Root doesn't seem to quite completely override $CVSROOT
28878             # Bug?  Not necessarily a big deal if it only affects error
28879             # messages.
28880             CVSROOT_save=${CVSROOT}
28881             CVSROOT=${TESTDIR}/root-none; export CVSROOT
28882             dotest_fail reposmv-4 "${testcvs} update" \
28883 "${PROG} update: in directory \.:
28884 ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28885 ${PROG} \[update aborted\]: ${TESTDIR}/root-none/CVSROOT: No such file or directory"
28886             CVSROOT=${CVSROOT_save}; export CVSROOT
28887           fi
28888
28889           # -d overrides CVS/Root
28890           # 
28891           # Oddly enough, with CVS 1.10 I think this didn't work for
28892           # local (that is, it would appear that CVS/Root would not
28893           # get used, but would produce an error if it didn't exist).
28894           dotest reposmv-5 "${testcvs} -d ${CVSROOT_MOVED} update" \
28895 "${PROG} update: Updating \."
28896
28897           # TODO: could also test various other things, like what if the
28898           # user removes CVS/Root (which is legit).  Or another set of
28899           # tests would be if both repositories exist but we want to make
28900           # sure that CVS is using the correct one.
28901
28902           cd ../..
28903           rm -r imp-dir 1
28904           rm -rf root1 root2
28905           unset CVSROOT1
28906           ;;
28907
28908         pserver)
28909           # Test basic pserver functionality.
28910           if $remote; then
28911             # First set SystemAuth=no.  Not really necessary, I don't
28912             # think, but somehow it seems like the clean thing for
28913             # the testsuite.
28914             mkdir 1; cd 1
28915             dotest pserver-1 "${testcvs} -Q co CVSROOT" ""
28916             cd CVSROOT
28917             echo "SystemAuth=no" >config
28918             dotest pserver-2 "${testcvs} -q ci -m config-it" \
28919 "Checking in config;
28920 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
28921 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
28922 done
28923 ${PROG} commit: Rebuilding administrative file database"
28924             cat >${CVSROOT_DIRNAME}/CVSROOT/passwd <<EOF
28925 testme:q6WV9d2t848B2:$username
28926 dontroot:q6WV9d2t848B2:root
28927 anonymous::$username
28928 $username:
28929 willfail:   :whocares
28930 EOF
28931             dotest_fail pserver-3 "${testcvs} pserver" \
28932 "error 0 Server configuration missing --allow-root in inetd.conf" <<EOF
28933 BEGIN AUTH REQUEST
28934 ${CVSROOT_DIRNAME}
28935 testme
28936 Ay::'d
28937 END AUTH REQUEST
28938 EOF
28939
28940             dotest_fail pserver-3a "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28941 "error 0 ${CVSROOT_DIRNAME}XXX: no such repository
28942 I HATE YOU" <<EOF
28943 BEGIN AUTH REQUEST
28944 ${CVSROOT_DIRNAME}XXX
28945 testme
28946 Ay::'d
28947 END AUTH REQUEST
28948 EOF
28949
28950             # Confirm that not sending a newline during auth cannot constitute
28951             # a denial-of-service attack.  This assumes that PATH_MAX is less
28952             # than 65536 bytes.  If PATH_MAX is larger than 65535 bytes, this
28953             # test could hang indefinitely.
28954             ${AWK} 'BEGIN { printf "0123456789abcdef" }' </dev/null >garbageseg
28955             echo "BEGIN AUTH REQUEST" >garbageinput
28956             i=0
28957             while test $i -lt 64; do
28958               cat <garbageseg >>garbageseg2
28959               i=`expr $i + 1`
28960             done
28961             i=0
28962             while test $i -lt 64; do
28963               cat <garbageseg2 >>garbageinput
28964               i=`expr $i + 1`
28965             done
28966             dotest_fail pserver-auth-no-dos \
28967 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28968 "${PROG} \\[pserver aborted\\]: Maximum line length exceeded during authentication\." <garbageinput
28969             unset i
28970             rm garbageseg garbageseg2 garbageinput
28971
28972             # Sending the Root and noop before waiting for the
28973             # "I LOVE YOU" is bogus, but hopefully we can get
28974             # away with it.
28975             dotest pserver-4 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28976 "${DOTSTAR} LOVE YOU
28977 ok" <<EOF
28978 BEGIN AUTH REQUEST
28979 ${CVSROOT_DIRNAME}
28980 testme
28981 Ay::'d
28982 END AUTH REQUEST
28983 Root ${CVSROOT_DIRNAME}
28984 noop
28985 EOF
28986
28987             # The "no such system user" error is occurring on at least one of
28988             # our BSD 2.0.2 nightly test platforms.
28989             dotest_fail pserver-4.2 \
28990 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28991 "error 0: root not allowed" \
28992 "E Fatal error, aborting\.
28993 error 0 root: no such system user" <<EOF
28994 BEGIN AUTH REQUEST
28995 ${CVSROOT_DIRNAME}
28996 dontroot
28997 Ay::'d
28998 END AUTH REQUEST
28999 EOF
29000
29001             dotest pserver-5 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29002 "${DOTSTAR} LOVE YOU
29003 E Protocol error: Root says \"${TESTDIR}/1\" but pserver says \"${CVSROOT_DIRNAME}\"
29004 error  " <<EOF
29005 BEGIN AUTH REQUEST
29006 ${CVSROOT_DIRNAME}
29007 testme
29008 Ay::'d
29009 END AUTH REQUEST
29010 Root ${TESTDIR}/1
29011 noop
29012 EOF
29013
29014             dotest pserver-5a "$testcvs --allow-root=$CVSROOT_DIRNAME pserver" \
29015 "$DOTSTAR LOVE YOU
29016 E init may not be run remotely
29017 error  " <<EOF
29018 BEGIN AUTH REQUEST
29019 $CVSROOT_DIRNAME
29020 testme
29021 Ay::'d
29022 END AUTH REQUEST
29023 init $TESTDIR/2
29024 EOF
29025             dotest_fail pserver-5b "test -d $TESTDIR/2"
29026
29027             dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29028 "I HATE YOU" <<EOF
29029 BEGIN AUTH REQUEST
29030 ${CVSROOT_DIRNAME}
29031 testme
29032 Ay::'d^b?hd
29033 END AUTH REQUEST
29034 EOF
29035
29036             dotest_fail pserver-7 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29037 "I HATE YOU" <<EOF
29038 BEGIN VERIFICATION REQUEST
29039 ${CVSROOT_DIRNAME}
29040 testme
29041 Ay::'d^b?hd
29042 END VERIFICATION REQUEST
29043 EOF
29044
29045             dotest pserver-8 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29046 "${DOTSTAR} LOVE YOU" <<EOF
29047 BEGIN VERIFICATION REQUEST
29048 ${CVSROOT_DIRNAME}
29049 testme
29050 Ay::'d
29051 END VERIFICATION REQUEST
29052 EOF
29053
29054 # Tests pserver-9 through pserver-13 are about empty passwords
29055
29056             # Test empty password (both sides) for aliased user
29057             dotest pserver-9 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29058 "${DOTSTAR} LOVE YOU" <<EOF
29059 BEGIN AUTH REQUEST
29060 ${CVSROOT_DIRNAME}
29061 anonymous
29062 A
29063 END AUTH REQUEST
29064 EOF
29065
29066             # Test empty password (server side only) for aliased user
29067             dotest pserver-10 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29068 "${DOTSTAR} LOVE YOU" <<EOF
29069 BEGIN AUTH REQUEST
29070 ${CVSROOT_DIRNAME}
29071 anonymous
29072 Aanythingwouldworkhereittrulydoesnotmatter
29073 END AUTH REQUEST
29074 EOF
29075
29076             # Test empty (both sides) password for non-aliased user
29077             dotest pserver-11 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29078 "${DOTSTAR} LOVE YOU" <<EOF
29079 BEGIN AUTH REQUEST
29080 ${CVSROOT_DIRNAME}
29081 ${username}
29082 A
29083 END AUTH REQUEST
29084 EOF
29085
29086             # Test empty (server side only) password for non-aliased user
29087             dotest pserver-12 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29088 "${DOTSTAR} LOVE YOU" <<EOF
29089 BEGIN AUTH REQUEST
29090 ${CVSROOT_DIRNAME}
29091 ${username}
29092 Anypasswordwouldworkwhynotthisonethen
29093 END AUTH REQUEST
29094 EOF
29095
29096             # Test failure of whitespace password
29097             dotest_fail pserver-13 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29098 "${DOTSTAR} HATE YOU" <<EOF
29099 BEGIN AUTH REQUEST
29100 ${CVSROOT_DIRNAME}
29101 willfail
29102 Amquiteunabletocomeupwithinterestingpasswordsanymore
29103 END AUTH REQUEST
29104 EOF
29105
29106             # The following tests are for read-only access
29107
29108             # Check that readers can only read, everyone else can write
29109
29110             cat >${CVSROOT_DIRNAME}/CVSROOT/readers <<EOF
29111 anonymous
29112 EOF
29113
29114             dotest pserver-14 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29115 "${DOTSTAR} LOVE YOU
29116 M Concurrent Versions System (CVS) .*
29117 ok" <<EOF
29118 BEGIN AUTH REQUEST
29119 ${CVSROOT_DIRNAME}
29120 anonymous
29121 Ay::'d
29122 END AUTH REQUEST
29123 Root ${CVSROOT_DIRNAME}
29124 version
29125 EOF
29126
29127             dotest pserver-16 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29128 "${DOTSTAR} LOVE YOU
29129 M Concurrent Versions System (CVS) .*
29130 ok" <<EOF
29131 BEGIN AUTH REQUEST
29132 ${CVSROOT_DIRNAME}
29133 testme
29134 Ay::'d
29135 END AUTH REQUEST
29136 Root ${CVSROOT_DIRNAME}
29137 version
29138 EOF
29139
29140             dotest pserver-18 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29141 "${DOTSTAR} LOVE YOU
29142 M Concurrent Versions System (CVS) .*
29143 ok" <<EOF
29144 BEGIN AUTH REQUEST
29145 ${CVSROOT_DIRNAME}
29146 ${username}
29147 Ay::'d
29148 END AUTH REQUEST
29149 Root ${CVSROOT_DIRNAME}
29150 version
29151 EOF
29152
29153             # Check that writers can write, everyone else can only read
29154             # even if not listed in readers
29155
29156             cat >${CVSROOT_DIRNAME}/CVSROOT/writers <<EOF
29157 testme
29158 EOF
29159
29160             dotest pserver-20 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29161 "${DOTSTAR} LOVE YOU
29162 M Concurrent Versions System (CVS) .*
29163 ok" <<EOF
29164 BEGIN AUTH REQUEST
29165 ${CVSROOT_DIRNAME}
29166 anonymous
29167 Ay::'d
29168 END AUTH REQUEST
29169 Root ${CVSROOT_DIRNAME}
29170 version
29171 EOF
29172
29173             dotest pserver-22 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29174 "${DOTSTAR} LOVE YOU
29175 M Concurrent Versions System (CVS) .*
29176 ok" <<EOF
29177 BEGIN AUTH REQUEST
29178 ${CVSROOT_DIRNAME}
29179 testme
29180 Ay::'d
29181 END AUTH REQUEST
29182 Root ${CVSROOT_DIRNAME}
29183 version
29184 EOF
29185
29186             dotest pserver-24 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29187 "${DOTSTAR} LOVE YOU
29188 M Concurrent Versions System (CVS) .*
29189 ok" <<EOF
29190 BEGIN AUTH REQUEST
29191 ${CVSROOT_DIRNAME}
29192 ${username}
29193 Ay::'d
29194 END AUTH REQUEST
29195 Root ${CVSROOT_DIRNAME}
29196 version
29197 EOF
29198
29199             # Should work the same without readers
29200
29201             rm ${CVSROOT_DIRNAME}/CVSROOT/readers
29202
29203             dotest pserver-26 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29204 "${DOTSTAR} LOVE YOU
29205 M Concurrent Versions System (CVS) .*
29206 ok" <<EOF
29207 BEGIN AUTH REQUEST
29208 ${CVSROOT_DIRNAME}
29209 anonymous
29210 Ay::'d
29211 END AUTH REQUEST
29212 Root ${CVSROOT_DIRNAME}
29213 version
29214 EOF
29215
29216             dotest pserver-28 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29217 "${DOTSTAR} LOVE YOU
29218 M Concurrent Versions System (CVS) .*
29219 ok" <<EOF
29220 BEGIN AUTH REQUEST
29221 ${CVSROOT_DIRNAME}
29222 testme
29223 Ay::'d
29224 END AUTH REQUEST
29225 Root ${CVSROOT_DIRNAME}
29226 version
29227 EOF
29228
29229             dotest pserver-30 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29230 "${DOTSTAR} LOVE YOU
29231 M Concurrent Versions System (CVS) .*
29232 ok" <<EOF
29233 BEGIN AUTH REQUEST
29234 ${CVSROOT_DIRNAME}
29235 ${username}
29236 Ay::'d
29237 END AUTH REQUEST
29238 Root ${CVSROOT_DIRNAME}
29239 version
29240 EOF
29241
29242             # pserver used to try and print from the NULL pointer 
29243             # in this error message in this case
29244             dotest_fail pserver-bufinit "${testcvs} pserver" \
29245 "${PROG} \[pserver aborted\]: bad auth protocol start: EOF" </dev/null
29246
29247             # Clean up.
29248             echo "# comments only" >config
29249             dotest pserver-cleanup-1 "${testcvs} -q ci -m config-it" \
29250 "Checking in config;
29251 ${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
29252 new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
29253 done
29254 ${PROG} commit: Rebuilding administrative file database"
29255             cd ../..
29256             rm -r 1
29257             rm ${CVSROOT_DIRNAME}/CVSROOT/passwd ${CVSROOT_DIRNAME}/CVSROOT/writers
29258           fi # skip the whole thing for local
29259           ;;
29260
29261         server)
29262           # Some tests of the server (independent of the client).
29263           if $remote; then
29264             dotest server-1 "${testcvs} server" \
29265 "E Protocol error: Root request missing
29266 error  " <<EOF
29267 Directory bogus
29268 mumble/bar
29269 update
29270 EOF
29271
29272             # Could also test for relative pathnames here (so that crerepos-6a
29273             # and crerepos-6b can use :fork:).
29274             dotest server-2 "$testcvs server" \
29275 "E init may not be run remotely
29276 error  " <<EOF
29277 Set OTHER=variable
29278 Set MYENV=env-value
29279 init ${TESTDIR}/crerepos
29280 EOF
29281             dotest_fail server-3 "test -d $TESTDIR/crerepos/CVSROOT"
29282
29283             dotest server-3a "$testcvs -d$TESTDIR/crerepos init"
29284
29285             # Now some tests of gzip-file-contents (used by jCVS).
29286             ${AWK} 'BEGIN { \
29287 printf "%c%c%c%c%c%c.6%c%c+I-.%c%c%c%c5%c;%c%c%c%c", \
29288 31, 139, 8, 64, 5, 7, 64, 3, 225, 2, 64, 198, 185, 5, 64, 64, 64}' \
29289               </dev/null | ${TR} '\100' '\000' >gzipped.dat
29290             # Note that the CVS client sends "-b 1.1.1", and this
29291             # test doesn't.  But the server also defaults to that.
29292             cat <<EOF >session.dat
29293 Root ${TESTDIR}/crerepos
29294 UseUnchanged
29295 gzip-file-contents 3
29296 Argument -m
29297 Argument msg
29298 Argumentx 
29299 Argument dir1
29300 Argument tag1
29301 Argument tag2
29302 Directory .
29303 ${TESTDIR}/crerepos
29304 Modified file1
29305 u=rw,g=r,o=r
29306 z25
29307 EOF
29308             cat gzipped.dat >>session.dat
29309             echo import >>session.dat
29310             dotest server-4 "${testcvs} server" \
29311 "M N dir1/file1
29312
29313 M No conflicts created by this import
29314
29315 ok" <session.dat
29316             dotest server-5 \
29317 "${testcvs} -q -d ${TESTDIR}/crerepos co -p dir1/file1" "test"
29318
29319             # OK, here are some notify tests.
29320             dotest server-6 "${testcvs} server" \
29321 "Notified \./
29322 ${TESTDIR}/crerepos/dir1/file1
29323 ok" <<EOF
29324 Root ${TESTDIR}/crerepos
29325 Directory .
29326 ${TESTDIR}/crerepos/dir1
29327 Notify file1
29328 E       Fri May  7 13:21:09 1999 GMT    myhost  some-work-dir   EUC
29329 noop
29330 EOF
29331             # Sending the second "noop" before waiting for the output
29332             # from the first is bogus but hopefully we can get away
29333             # with it.
29334             dotest server-7 "${testcvs} server" \
29335 "Notified \./
29336 ${TESTDIR}/crerepos/dir1/file1
29337 ok
29338 Notified \./
29339 ${TESTDIR}/crerepos/dir1/file1
29340 ok" <<EOF
29341 Root ${TESTDIR}/crerepos
29342 Directory .
29343 ${TESTDIR}/crerepos/dir1
29344 Notify file1
29345 E       Fri May  7 13:21:09 1999 GMT    myhost  some-work-dir   EUC
29346 noop
29347 Notify file1
29348 E       The 57th day of Discord in the YOLD 3165        myhost  some-work-dir   EUC
29349 noop
29350 EOF
29351
29352             # OK, now test a few error conditions.
29353             # FIXCVS: should give "error" and no "Notified", like server-9
29354             dotest server-8 "${testcvs} server" \
29355 "E ${PROG} server: invalid character in editor value
29356 Notified \./
29357 ${TESTDIR}/crerepos/dir1/file1
29358 ok" <<EOF
29359 Root ${TESTDIR}/crerepos
29360 Directory .
29361 ${TESTDIR}/crerepos/dir1
29362 Notify file1
29363 E       Setting Orange, the 52th day of Discord in the YOLD 3165        myhost  some-work-dir   EUC
29364 noop
29365 EOF
29366
29367             dotest server-9 "${testcvs} server" \
29368 "E Protocol error; misformed Notify request
29369 error  " <<EOF
29370 Root ${TESTDIR}/crerepos
29371 Directory .
29372 ${TESTDIR}/crerepos/dir1
29373 Notify file1
29374 E       Setting Orange+57th day of Discord      myhost  some-work-dir   EUC
29375 noop
29376 EOF
29377
29378             # First demonstrate an interesting quirk in the protocol.
29379             # The "watchers" request selects the files to operate based
29380             # on files which exist in the working directory.  So if we
29381             # don't send "Entry" or the like, it won't do anything.
29382             # Wants to be documented in cvsclient.texi...
29383             dotest server-10 "${testcvs} server" "ok" <<EOF
29384 Root ${TESTDIR}/crerepos
29385 Directory .
29386 ${TESTDIR}/crerepos/dir1
29387 watchers
29388 EOF
29389             # See if "watchers" and "editors" display the right thing.
29390             dotest server-11 "${testcvs} server" \
29391 "M file1        ${username}     tedit   tunedit tcommit
29392 ok" <<EOF
29393 Root ${TESTDIR}/crerepos
29394 Directory .
29395 ${TESTDIR}/crerepos/dir1
29396 Entry /file1/1.1////
29397 watchers
29398 EOF
29399             dotest server-12 "${testcvs} server" \
29400 "M file1        ${username}     The 57th day of Discord in the YOLD 3165        myhost  some-work-dir
29401 ok" <<EOF
29402 Root ${TESTDIR}/crerepos
29403 Directory .
29404 ${TESTDIR}/crerepos/dir1
29405 Entry /file1/1.1////
29406 editors
29407 EOF
29408
29409             # Now do an unedit.
29410             dotest server-13 "${testcvs} server" \
29411 "Notified \./
29412 ${TESTDIR}/crerepos/dir1/file1
29413 ok" <<EOF
29414 Root ${TESTDIR}/crerepos
29415 Directory .
29416 ${TESTDIR}/crerepos/dir1
29417 Notify file1
29418 U       7 May 1999 15:00 GMT    myhost  some-work-dir   EUC
29419 noop
29420 EOF
29421
29422             # Now try "watchers" and "editors" again.
29423             dotest server-14 "${testcvs} server" "ok" <<EOF
29424 Root ${TESTDIR}/crerepos
29425 Directory .
29426 ${TESTDIR}/crerepos/dir1
29427 watchers
29428 EOF
29429             dotest server-15 "${testcvs} server" "ok" <<EOF
29430 Root ${TESTDIR}/crerepos
29431 Directory .
29432 ${TESTDIR}/crerepos/dir1
29433 editors
29434 EOF
29435
29436             # Test that the global `-l' option is ignored nonfatally.
29437             dotest server-16 "${testcvs} server" \
29438 "E cvs server: WARNING: global \`-l' option ignored\.
29439 ok" <<EOF
29440 Global_option -l
29441 noop
29442 EOF
29443
29444             # There used to be some exploits based on malformed Entry requests
29445             dotest server-17 "$testcvs server" \
29446 "E protocol error: Malformed Entry
29447 error  " <<EOF
29448 Root $TESTDIR/crerepos
29449 Directory .
29450 $TESTDIR/crerepos/dir1
29451 Entry X/file1/1.1////
29452 noop
29453 EOF
29454
29455             dotest server-18 "$testcvs server" \
29456 "E protocol error: Malformed Entry
29457 error  " <<EOF
29458 Root $TESTDIR/crerepos
29459 Directory .
29460 $TESTDIR/crerepos/dir1
29461 Entry /CC/CC/CC
29462 noop
29463 EOF
29464
29465             if $keep; then
29466               echo Keeping ${TESTDIR} and exiting due to --keep
29467               exit 0
29468             fi
29469
29470             rm -rf ${TESTDIR}/crerepos
29471             rm gzipped.dat session.dat
29472           fi # skip the whole thing for local
29473           ;;
29474
29475         server2)
29476           # More server tests, in particular testing that various
29477           # possible security holes are plugged.
29478           if $remote; then
29479             dotest server2-1 "${testcvs} server" \
29480 "E protocol error: directory '${CVSROOT_DIRNAME}/\.\./dir1' not within root '${CVSROOT_DIRNAME}'
29481 error  " <<EOF
29482 Root ${CVSROOT_DIRNAME}
29483 Directory .
29484 ${CVSROOT_DIRNAME}/../dir1
29485 noop
29486 EOF
29487
29488             dotest server2-2 "${testcvs} server" \
29489 "E protocol error: directory '${CVSROOT_DIRNAME}dir1' not within root '${CVSROOT_DIRNAME}'
29490 error  " <<EOF
29491 Root ${CVSROOT_DIRNAME}
29492 Directory .
29493 ${CVSROOT_DIRNAME}dir1
29494 noop
29495 EOF
29496
29497             dotest server2-3 "${testcvs} server" \
29498 "E protocol error: directory '${TESTDIR}' not within root '${CVSROOT_DIRNAME}'
29499 error  " <<EOF
29500 Root ${CVSROOT_DIRNAME}
29501 Directory .
29502 ${TESTDIR}
29503 noop
29504 EOF
29505
29506             # OK, now a few tests for the rule that one cannot pass a
29507             # filename containing a slash to Modified, Is-modified,
29508             # Notify, Questionable, or Unchanged.  For completeness
29509             # we'd try them all.  For lazyness/conciseness we don't.
29510             dotest server2-4 "${testcvs} server" \
29511 "E protocol error: directory 'foo/bar' not within current directory
29512 error  " <<EOF
29513 Root ${CVSROOT_DIRNAME}
29514 Directory .
29515 ${CVSROOT_DIRNAME}
29516 Unchanged foo/bar
29517 noop
29518 EOF
29519             dotest server2-5 \
29520 "$testcvs --allow-root=$CVSROOT_DIRNAME.bad server" \
29521 "E Bad root $CVSROOT_DIRNAME
29522 error  " <<EOF
29523 Root $CVSROOT_DIRNAME
29524 noop
29525 EOF
29526             dotest server2-6 \
29527 "$testcvs --allow-root=$CVSROOT_DIRNAME server" \
29528 "ok" <<EOF
29529 Root $CVSROOT_DIRNAME
29530 noop
29531 EOF
29532           fi
29533           ;;
29534
29535
29536
29537         server3)
29538           # Test that various checks on the Root request generate the correct
29539           # error messages.
29540           if $remote; then
29541             # As a control, a valid request.
29542             dotest server3-1 "$testcvs server" 'ok' <<EOF
29543 Root $CVSROOT_DIRNAME
29544 Directory .
29545 $CVSROOT_DIRNAME
29546 Unchanged foo
29547 noop
29548 EOF
29549
29550             dotest server3-2 "$testcvs server" \
29551 "E Root somewhere/over/the/rainbow must be an absolute pathname
29552 error  " <<EOF
29553 Root somewhere/over/the/rainbow
29554 noop
29555 EOF
29556
29557             dotest server3-3 "$testcvs server" \
29558 "E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
29559 error  " <<EOF
29560 Root $CVSROOT_DIRNAME
29561 Root $CVSROOT_DIRNAME
29562 noop
29563 EOF
29564
29565             dotest server3-4 "$testcvs server" \
29566 "E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
29567 error  " <<EOF
29568 Root $CVSROOT_DIRNAME
29569 Root $CVSROOT_DIRNAME
29570 Directory .
29571 $CVSROOT_DIRNAME
29572 Unchanged foo
29573 noop
29574 EOF
29575
29576             # These cascading errors seem odd, but the client should have hung
29577             # up after the first.
29578             dotest server3-5 "$testcvs server" \
29579 "E Root somewhere/over/the/rainbow must be an absolute pathname
29580 error  
29581 E Protocol error: Root request missing
29582 error  " <<EOF
29583 Root somewhere/over/the/rainbow
29584 Directory .
29585 somewhere/over/the/rainbow
29586 Unchanged foo
29587 noop
29588 EOF
29589           fi
29590           ;;
29591
29592
29593
29594         client)
29595           # Some tests of the client (independent of the server).
29596           if $remote; then
29597             cat >${TESTDIR}/serveme <<EOF
29598 #!${TESTSHELL}
29599 # This is admittedly a bit cheezy, in the sense that we make lots
29600 # of assumptions about what the client is going to send us.
29601 # We don't mention Repository, because current clients don't require it.
29602 # Sending these at our own pace, rather than waiting for the client to
29603 # make the requests, is bogus, but hopefully we can get away with it.
29604 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29605 echo "ok"
29606 echo "M special message"
29607 echo "Created first-dir/"
29608 echo "${CVSROOT_DIRNAME}/first-dir/file1"
29609 echo "/file1/1.1///"
29610 echo "u=rw,g=rw,o=rw"
29611 echo "4"
29612 echo "xyz"
29613 echo "ok"
29614 cat >/dev/null
29615 EOF
29616             # Cygwin.  Pthffffffffft!
29617             if test -n "$remotehost"; then
29618               $CVS_RSH $remotehost "chmod +x ${TESTDIR}/serveme"
29619             else
29620               chmod +x ${TESTDIR}/serveme
29621             fi
29622             save_CVS_SERVER=$CVS_SERVER
29623             CVS_SERVER=${TESTDIR}/serveme; export CVS_SERVER
29624             mkdir 1; cd 1
29625             dotest_fail client-1 "${testcvs} -q co first-dir" \
29626 "${PROG} \[checkout aborted\]: This server does not support the global -q option${DOTSTAR}"
29627             dotest client-2 "${testcvs} co first-dir" "special message"
29628
29629             cat >${TESTDIR}/serveme <<EOF
29630 #!${TESTSHELL}
29631 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29632 echo "ok"
29633 echo "M merge-it"
29634 echo "Copy-file ./"
29635 echo "${CVSROOT_DIRNAME}/first-dir/file1"
29636 echo "${TESTDIR}/bogus/.#file1.1.1"
29637 echo "Merged ./"
29638 echo "${CVSROOT_DIRNAME}/first-dir/file1"
29639 echo "/file1/1.2///"
29640 echo "u=rw,g=rw,o=rw"
29641 echo "4"
29642 echo "abd"
29643 echo "ok"
29644 cat >/dev/null
29645 EOF
29646             cd first-dir
29647             mkdir ${TESTDIR}/bogus
29648             # The ${DOTSTAR} is to match a potential "broken pipe" if the
29649             # client exits before the server script sends everything
29650             dotest_fail client-3 "${testcvs} update" "merge-it
29651 ${PROG} \[update aborted\]: protocol error: Copy-file tried to specify director${DOTSTAR}"
29652             cat >${TESTDIR}/serveme <<EOF
29653 #!${TESTSHELL}
29654 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29655 echo "ok"
29656 echo "M merge-it"
29657 echo "Copy-file ./"
29658 echo "${CVSROOT_DIRNAME}/first-dir/file1"
29659 echo ".#file1.1.1"
29660 echo "Merged ./"
29661 echo "${CVSROOT_DIRNAME}/first-dir/file1"
29662 echo "/file1/1.2///"
29663 echo "u=rw,g=rw,o=rw"
29664 echo "4"
29665 echo "abc"
29666 echo "ok"
29667 cat >/dev/null
29668 EOF
29669             dotest client-4 "${testcvs} update" "merge-it"
29670             dotest client-5 "cat .#file1.1.1" "xyz"
29671             dotest client-6 "cat CVS/Entries" "/file1/1.2/[A-Za-z0-9 :]*//
29672 D"
29673             dotest client-7 "cat file1" "abc"
29674
29675             cat >${TESTDIR}/serveme <<EOF
29676 #!${TESTSHELL}
29677 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29678 echo "ok"
29679 echo "M OK, whatever"
29680 echo "ok"
29681 cat >${TESTDIR}/client.tmp
29682 EOF
29683             chmod u=rw,go= file1
29684             # By specifying the time zone in local time, we don't
29685             # know exactly how that will translate to GMT.
29686             dotest client-8 "${testcvs} update -D 99-10-04" "OK, whatever"
29687             # String 2 below is Cygwin again - ptoooey.
29688             dotest client-9 "cat ${TESTDIR}/client.tmp" \
29689 "Root ${CVSROOT_DIRNAME}
29690 Valid-responses [-a-zA-Z ]*
29691 valid-requests
29692 Argument -D
29693 Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
29694 Argument --
29695 Directory \.
29696 ${CVSROOT_DIRNAME}/first-dir
29697 Entry /file1/1\.2///
29698 Modified file1
29699 u=rw,g=,o=
29700 4
29701 abc
29702 update" \
29703 "Root ${CVSROOT_DIRNAME}
29704 Valid-responses [-a-zA-Z ]*
29705 valid-requests
29706 Argument -D
29707 Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
29708 Argument --
29709 Directory \.
29710 ${CVSROOT_DIRNAME}/first-dir
29711 Entry /file1/1\.2///
29712 Modified file1
29713 u=rw,g=r,o=r
29714 4
29715 abc
29716 update"
29717
29718             # The following test tests what was a potential client update in
29719             # CVS versions 1.11.14 and CVS versions 1.12.6 and earlier.  This
29720             # exploit would allow a trojan server to create arbitrary files,
29721             # anywhere the user had write permissions, even outside of the
29722             # user's sandbox.
29723             cat >$HOME/.bashrc <<EOF
29724 #!$TESTSHELL
29725 # This is where login scripts would usually be
29726 # stored.
29727 EOF
29728             cat >$TESTDIR/serveme <<EOF
29729 #!$TESTSHELL
29730 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29731 echo "ok"
29732 echo "Rcs-diff $HOME/"
29733 echo "$HOME/.bashrc"
29734 echo "/.bashrc/73.50///"
29735 echo "u=rw,g=rw,o=rw"
29736 echo "20"
29737 echo "a1 1"
29738 echo "echo 'gotcha!'"
29739 echo "ok"
29740 cat >/dev/null
29741 EOF
29742             
29743             # If I don't run the following sleep between the above cat and
29744             # the following calls to dotest, sometimes the serveme file isn't
29745             # completely written yet by the time CVS tries to execute it,
29746             # causing the shell to intermittantly report syntax errors (usually
29747             # early EOF).  There's probably a new race condition here, but this
29748             # works.
29749             #
29750             # Incidentally, I can reproduce this behavior with Linux 2.4.20 and
29751             # Bash 2.05 or Bash 2.05b.
29752             sleep 1
29753             dotest_fail client-10 "$testcvs update" \
29754 "$PROG update: Server attempted to update a file via an invalid pathname:
29755 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
29756
29757             # A second try at a client exploit.  This one never actually
29758             # failed in the past, but I thought it wouldn't hurt to add a test.
29759             cat >$TESTDIR/serveme <<EOF
29760 #!$TESTSHELL
29761 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29762 echo "ok"
29763 echo "Rcs-diff ./"
29764 echo "$HOME/.bashrc"
29765 echo "/.bashrc/73.50///"
29766 echo "u=rw,g=rw,o=rw"
29767 echo "20"
29768 echo "a1 1"
29769 echo "echo 'gotcha!'"
29770 echo "ok"
29771 cat >/dev/null
29772 EOF
29773             sleep 1
29774             dotest_fail client-11 "$testcvs update" \
29775 "$PROG \[update aborted\]: patch original file \./\.bashrc does not exist"
29776
29777             # A third try at a client exploit.  This one did used to fail like
29778             # client-10.
29779             cat >$TESTDIR/serveme <<EOF
29780 #!$TESTSHELL
29781 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29782 echo "ok"
29783 echo "Rcs-diff ../../home/"
29784 echo "../../.bashrc"
29785 echo "/.bashrc/73.50///"
29786 echo "u=rw,g=rw,o=rw"
29787 echo "20"
29788 echo "a1 1"
29789 echo "echo 'gotcha!'"
29790 echo "ok"
29791 cat >/dev/null
29792 EOF
29793             sleep 1
29794             dotest_fail client-12 "$testcvs update" \
29795 "$PROG update: Server attempted to update a file via an invalid pathname:
29796 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29797
29798             # Try the same exploit using the Created response.
29799             cat >$TESTDIR/serveme <<EOF
29800 #!$TESTSHELL
29801 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29802 echo "ok"
29803 echo "Created $HOME/"
29804 echo "$HOME/.bashrc"
29805 echo "/.bashrc/73.50///"
29806 echo "u=rw,g=rw,o=rw"
29807 echo "26"
29808 echo "#! /bin/sh"
29809 echo "echo 'gotcha!'"
29810 echo "ok"
29811 cat >/dev/null
29812 EOF
29813             sleep 1
29814             dotest_fail client-13 "$testcvs update" \
29815 "$PROG update: Server attempted to update a file via an invalid pathname:
29816 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
29817
29818             # Now try using the Update-existing response
29819             cat >$TESTDIR/serveme <<EOF
29820 #!$TESTSHELL
29821 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29822 echo "ok"
29823 echo "Update-existing ../../home/"
29824 echo "../../home/.bashrc"
29825 echo "/.bashrc/73.50///"
29826 echo "u=rw,g=rw,o=rw"
29827 echo "26"
29828 echo "#! /bin/sh"
29829 echo "echo 'gotcha!'"
29830 echo "ok"
29831 cat >/dev/null
29832 EOF
29833             sleep 1
29834             dotest_fail client-14 "$testcvs update" \
29835 "$PROG update: Server attempted to update a file via an invalid pathname:
29836 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29837
29838             # Try the same exploit using the Merged response.
29839             cat >$TESTDIR/serveme <<EOF
29840 #!$TESTSHELL
29841 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29842 echo "ok"
29843 echo "Merged $HOME/"
29844 echo "$HOME/.bashrc"
29845 echo "/.bashrc/73.50///"
29846 echo "u=rw,g=rw,o=rw"
29847 echo "26"
29848 echo "#! /bin/sh"
29849 echo "echo 'gotcha!'"
29850 echo "ok"
29851 cat >/dev/null
29852 EOF
29853             sleep 1
29854             dotest_fail client-15 "$testcvs update" \
29855 "$PROG update: Server attempted to update a file via an invalid pathname:
29856 $PROG \[update aborted\]: \`$HOME/.bashrc'\."
29857
29858             # Now try using the Updated response
29859             cat >$TESTDIR/serveme <<EOF
29860 #!$TESTSHELL
29861 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29862 echo "ok"
29863 echo "Updated ../../home/"
29864 echo "../../home/.bashrc"
29865 echo "/.bashrc/73.50///"
29866 echo "u=rw,g=rw,o=rw"
29867 echo "26"
29868 echo "#! /bin/sh"
29869 echo "echo 'gotcha!'"
29870 echo "ok"
29871 cat >/dev/null
29872 EOF
29873             sleep 1
29874             dotest_fail client-16 "$testcvs update" \
29875 "$PROG update: Server attempted to update a file via an invalid pathname:
29876 $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29877
29878             # Try the same exploit using the Copy-file response.
29879             # As far as I know, Copy-file was never exploitable either.
29880             cat >$TESTDIR/serveme <<EOF
29881 #!$TESTSHELL
29882 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29883 echo "ok"
29884 echo "Created ."
29885 echo "./innocuous"
29886 echo "/innocuous/73.50///"
29887 echo "u=rw,g=rw,o=rw"
29888 echo "26"
29889 echo "#! /bin/sh"
29890 echo "echo 'gotcha!'"
29891 echo "Copy-file ."
29892 echo "./innocuous"
29893 echo "$HOME/innocuous"
29894 echo "ok"
29895 cat >/dev/null
29896 EOF
29897             sleep 1
29898             dotest_fail client-18 "$testcvs update" \
29899 "$PROG \[update aborted\]: protocol error: Copy-file tried to specify directory"
29900
29901             # And verify that none of the exploits was successful.
29902             dotest client-19 "cat $HOME/.bashrc" \
29903 "#!$TESTSHELL
29904 # This is where login scripts would usually be
29905 # stored\."
29906
29907             if $keep; then
29908               echo Keeping ${TESTDIR} and exiting due to --keep
29909               exit 0
29910             fi
29911
29912             cd ../..
29913             rm -r 1
29914             rmdir ${TESTDIR}/bogus
29915             rm $TESTDIR/serveme $HOME/.bashrc
29916             CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
29917           fi # skip the whole thing for local
29918           ;;
29919
29920
29921
29922         client2)
29923           # Test how the client handles error messages from the server.
29924           if $remote; then
29925             cat >$TESTDIR/serveme <<EOF
29926 #!$TESTSHELL
29927 # This is just as cheesy as the "client" tests made it out to be.
29928 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29929 echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
29930 echo "error  "
29931 echo "E Protocol error: Root request missing"
29932 echo "error  "
29933 cat >/dev/null
29934 EOF
29935             # Cygwin.  Pthffffffffft!
29936             if test -n "$remotehost"; then
29937               $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
29938             else
29939               chmod +x $TESTDIR/serveme
29940             fi
29941             save_CVS_SERVER=$CVS_SERVER
29942             CVS_SERVER=$TESTDIR/serveme; export CVS_SERVER
29943             mkdir client2; cd client2
29944             dotest_fail client2-1 "$testcvs co first-dir" \
29945 "Root somewhere/over/the/rainbow must be an absolute pathname"
29946
29947             cat >$TESTDIR/serveme <<EOF
29948 #!$TESTSHELL
29949 # This is just as cheesy as the "client" tests made it out to be.
29950 echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29951 echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
29952 echo
29953 echo "error  "
29954 echo "E Protocol error: Root request missing"
29955 echo "error  "
29956 cat >/dev/null
29957 EOF
29958             # Cygwin.  Pthffffffffft!
29959             if test -n "$remotehost"; then
29960               $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
29961             else
29962               chmod +x $TESTDIR/serveme
29963             fi
29964             dotest_fail client2-2 "$testcvs co first-dir" \
29965 "Root somewhere/over/the/rainbow must be an absolute pathname
29966 $PROG checkout: warning: unrecognized response \`' from cvs server"
29967
29968             if $keep; then
29969               echo Keeping $TESTDIR and exiting due to --keep
29970               exit 0
29971             fi
29972
29973             cd ..
29974             rm -r client2
29975             rm $TESTDIR/serveme
29976             CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER
29977           fi # skip the whole thing for local
29978           ;;
29979
29980
29981
29982         dottedroot)
29983           # Check that a CVSROOT with a "." in the name will work.
29984           CVSROOT_save=${CVSROOT}
29985           CVSROOT_DIRNAME_save=${CVSROOT_DIRNAME}
29986           CVSROOT_DIRNAME=${TESTDIR}/cvs.root
29987           CVSROOT=`newroot ${CVSROOT_DIRNAME}`
29988
29989           dotest dottedroot-init-1 "$testcvs -d$CVSROOT_DIRNAME init"
29990           mkdir dir1
29991           mkdir dir1/dir2
29992           echo version1 >dir1/dir2/file1
29993           cd dir1
29994           dotest dottedroot-1 "${testcvs} import -m '' module1 AUTHOR INITIAL" \
29995 "${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/module1/dir2
29996 N module1/dir2/file1
29997
29998 No conflicts created by this import"
29999           cd ..
30000
30001           # This is the test that used to cause an assertion failure
30002           # in recurse.c:do_recursion().
30003           dotest dottedroot-2 "${testcvs} co -rINITIAL module1" \
30004 "${PROG} [a-z]*: Updating module1
30005 ${PROG} [a-z]*: Updating module1/dir2
30006 U module1/dir2/file1"
30007
30008           # This also triggered the assertion failure above prior to 1.11.23.
30009           dotest dottedroot-3 \
30010 "$testcvs -q co -prINITIAL module1/./dir2/file1" \
30011 'version1'
30012
30013           if $keep; then
30014             echo Keeping $TESTDIR and exiting due to --keep
30015             exit 0
30016           fi
30017
30018           rm -rf ${CVSROOT_DIRNAME}
30019           rm -r dir1 module1
30020           CVSROOT_DIRNAME=${CVSROOT_DIRNAME_save}
30021           CVSROOT=${CVSROOT_save}
30022           ;;
30023  
30024         fork)
30025           # Test that the server defaults to the correct executable in :fork:
30026           # mode.  See the note in the TODO at the end of this file about this.
30027           #
30028           # This test and client should be left after all other references to
30029           # CVS_SERVER are removed from this script.
30030           #
30031           # The client series of tests already tests that CVS_SERVER is
30032           # working, but that test might be better here.
30033           if $remote; then
30034             mkdir fork; cd fork
30035             save_CVS_SERVER=$CVS_SERVER
30036             unset CVS_SERVER
30037             # So looking through $PATH for cvs won't work...
30038             echo "echo junk" >cvs
30039             chmod a+x cvs
30040             save_PATH=$PATH; PATH=.:$PATH
30041             dotest fork-1 "$testcvs -d:fork:$CVSROOT_DIRNAME version" \
30042 'Client: \(.*\)
30043 Server: \1'
30044             CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
30045             unset save_CVS_SERVER
30046             PATH=$save_PATH; unset save_PATH
30047             cd ..
30048
30049             if $keep; then
30050               echo Keeping ${TESTDIR} and exiting due to --keep
30051               exit 0
30052             fi
30053           fi
30054           ;;
30055
30056         commit-add-missing)
30057           # Make sure that a commit fails when a `cvs add'ed file has
30058           # been removed from the working directory.
30059
30060           mkdir 1; cd 1
30061           module=c-a-m
30062           echo > unused-file
30063           dotest commit-add-missing-1 \
30064             "$testcvs -Q import -m. $module X Y" ''
30065
30066           file=F
30067           # Check it out and tag it.
30068           dotest commit-add-missing-2 "$testcvs -Q co $module" ''
30069           cd $module
30070           dotest commit-add-missing-3 "$testcvs -Q tag -b B" ''
30071           echo v1 > $file
30072           dotest commit-add-missing-4 "$testcvs -Q add $file" ''
30073           rm -f $file
30074           dotest_fail commit-add-missing-5 "$testcvs -Q ci -m. $file" \
30075 "${PROG} commit: Up-to-date check failed for .$file'
30076 ${PROG} \[commit aborted\]: correct above errors first!"
30077
30078           cd ../..
30079           rm -rf 1
30080           rm -rf ${CVSROOT_DIRNAME}/$module
30081           ;;
30082
30083         add-restricted)
30084           # Verify that `sdir/CVS' may not be explicitly added.
30085           mkdir add-restricted; cd add-restricted
30086
30087           mkdir import; cd import
30088           : > junk
30089           dotest add-restricted-init-1 \
30090 "$testcvs -Q import -m. add-restricted X Y"
30091           cd ..
30092
30093           dotest add-restricted-init-2 "$testcvs -Q co add-restricted"
30094           cd add-restricted
30095
30096           # errmsg2-3 tests the specific message here.
30097           dotest_fail add-restricted-1 "$testcvs -Q add CVS"
30098
30099           mkdir sdir
30100           dotest add-restricted-2 "$testcvs -Q add sdir"
30101           dotest_fail add-restricted-3 "$testcvs add sdir/CVS" \
30102 "$PROG add: cannot add special file \`sdir/CVS'; skipping"
30103
30104           if $keep; then
30105             echo Keeping $TESTDIR and exiting due to --keep
30106             exit 0
30107           fi
30108           cd ../..
30109           rm -rf add-restricted $CVSROOT_DIRNAME/add-restricted
30110         ;;
30111
30112
30113
30114         commit-d)
30115           # Check that top-level commits work when CVS/Root
30116           # is overridden by cvs -d.
30117
30118           mkdir -p 1/subdir; cd 1
30119           touch file1 subdir/file2
30120           dotest commit-d-1 "$testcvs -Q import -m. c-d-c X Y" ""
30121           dotest commit-d-2 "$testcvs -Q co c-d-c" ""
30122           cd c-d-c
30123           echo change >>file1; echo another change >>subdir/file2
30124           # Changing working root, then override with -d
30125           echo nosuchhost:/cvs > CVS/Root
30126           dotest commit-d-3 "$testcvs -Q -d $CVSROOT commit -m." \
30127 "Checking in file1;
30128 ${CVSROOT_DIRNAME}/c-d-c/file1,v  <--  file1
30129 new revision: 1.2; previous revision: 1.1
30130 done
30131 Checking in subdir/file2;
30132 ${CVSROOT_DIRNAME}/c-d-c/subdir/file2,v  <--  file2
30133 new revision: 1.2; previous revision: 1.1
30134 done"
30135           cd ../..
30136           rm -rf 1 cvsroot/c-d-c
30137           ;;
30138
30139         *)
30140            echo $what is not the name of a test -- ignored
30141            ;;
30142         esac
30143
30144     # Sanity check sanity.sh.  :)
30145     #
30146     # Test our exit directory so that tests that exit in an incorrect directory
30147     # are noticed during single test runs.
30148     #
30149     # FIXME?
30150     # Sparc Solaris 9 is dereferencing paths here as if /bin/pwd were
30151     # called when /tmp is a symlink.  This might be a new problem with this
30152     # test, but since this was recently tested I think it more likely to be
30153     # A Solaris issue.
30154     if test "x$TESTDIR" != "x`pwd`"; then
30155             fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')"
30156     fi
30157
30158     # Reset val-tags to a pristine state.
30159     rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags
30160
30161     verify_tmp_empty "post $what"
30162
30163 done # The big loop
30164
30165 # Set up summary data for output.
30166 skippedoutput=
30167 warningsoutput=
30168 extendedinfo=
30169 if test $skipped -ne 0; then
30170   skippedoutput="$skipped test group"
30171   if test $skipped -ne 1; then
30172     skippedoutput="${skippedoutput}s"
30173   fi
30174   skippedoutput="$skippedoutput skipped"
30175 fi
30176 if test $warnings -ne 0; then
30177   warningsoutput="$warnings test"
30178   if test $warnings -ne 1; then
30179     warningsoutput="${warningsoutput}s"
30180   fi
30181   warningsoutput="$warningsoutput passed with warnings"
30182 fi
30183 if test -n "$skippedoutput" || test -n "$warningsoutput"; then
30184   extendedinfo=" ("
30185   if test -n "$skippedoutput"; then
30186     extendedinfo="$extendedinfo$skippedoutput"
30187   fi
30188   if test -n "$skippedoutput" && test -n "$warningsoutput"; then
30189     extendedinfo="$extendedinfo and "
30190   fi
30191   if test -n "$warningsoutput"; then
30192     extendedinfo="$extendedinfo$warningsoutput"
30193   fi
30194   extendedinfo="$extendedinfo)"
30195 fi
30196
30197 echo "OK, all $passed tests passed$extendedinfo."
30198
30199 # TODO:
30200 # * Test `cvs update -d foo' (where foo does not exist).
30201 # * Test `cvs update foo bar' (where foo and bar are both from the
30202 #   same directory in the repository).  Suppose one is a branch--make
30203 #   sure that both directories get updated with the respective correct
30204 #   thing.
30205 # * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
30206 #   foo/.././../bar foo/../bar etc.
30207 # * Test all flags in modules file.
30208 #   Test that ciprog gets run both on checkin in that directory, or a
30209 #     higher-level checkin which recurses into it.
30210 # * Test operations on a directory that contains other directories but has
30211 #   no files of its own.
30212 # * -t global option
30213 # * cvs rm followed by cvs add or vice versa (with no checkin in between).
30214 # * cvs rm twice (should be a nice error message).
30215 # * -P option to checkout--(a) refrains from checking out new empty dirs,
30216 #   (b) prunes empty dirs already there.
30217 # * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
30218 #   gives an appropriate error (e.g.
30219 #     Cannot access ${TESTDIR}/non-existent/CVSROOT
30220 #     No such file or directory).
30221 #   (like basica-9, but for remote).
30222 # * Test ability to send notifications in response to watches.  (currently
30223 #   hard to test because CVS doesn't send notifications if username is the
30224 #   same).
30225 # * Test the contents of adm files other than Root and Repository.
30226 #   Entries seems the next most important thing.
30227 # * Test the following compatibility issues:
30228 #   - The filler fields in "D" entries in CVS/Entries get preserved
30229 #     (per cvs.texinfo).
30230 #   - Unrecognized entry types in CVS/Entries get ignored (looks like
30231 #     this needs to be documented in cvs.texinfo, but is not)
30232 #   - Test that unrecognized files in CVS directories (e.g. CVS/Foobar)
30233 #     are ignored (per cvs.texinfo).
30234 #   - Test 'cvs history' with symlinks in the path to the working directory.
30235 #   - Remove most of the CVS_SERVER stuff after a reasonable amount of time.
30236 #     The "fork" & "client" series of tests should be left.  4/2/00, CVS
30237 #     1.11.0.1 was altered so that it would default to program_name (set from
30238 #     argv[0]) rather than "cvs", but I'd like this script to work on legacy
30239 #     versions of CVS for awhile.
30240 #   - Testsuite doesn't work with usernames over eight characters in length.
30241 #     Fix it.
30242 # End of TODO list.
30243
30244 # Exit if keep set
30245 if $keep; then
30246   echo "Keeping ${TESTDIR} and exiting due to -k (keep) option."
30247   exit 0
30248 fi
30249
30250 # Remove the test directory, but first change out of it.
30251 cd `dirname ${TESTDIR}`
30252 rm -rf ${TESTDIR}
30253
30254 # end of sanity.sh