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:
22usage ()
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
28exit_usage ()
29{
30    usage 1>&2
31    exit 2
32}
33
34exit_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.
65unset 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.
69MALLOC_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).
77LANG=C
78export LANG
79LC_ALL=C
80export LC_ALL
81
82
83#
84# Initialize the test counts.
85#
86passed=0
87skipped=0
88warnings=0
89
90
91
92#
93# read our options
94#
95unset fromtest
96unset remotehost
97keep=false
98linkroot=false
99remote=false
100skipfail=false
101verbose=false
102while 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
173done
174
175# boot the arguments we used above
176while test $OPTIND -gt 1 ; do
177    shift
178    OPTIND=`expr $OPTIND - 1`
179done
180
181# Use full path for CVS executable, so that CVS_SERVER gets set properly
182# for remote.
183case $1 in
184"")
185  exit_usage
186  ;;
187/*)
188  testcvs=$1
189  ;;
190*)
191  testcvs=`pwd`/$1
192  ;;
193esac
194shift
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.
199if 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
204fi
205
206
207
208###
209### GUTS
210###
211
212# "debugger"
213#set -x
214
215echo 'This test should produce no other output than this message, and a final "OK".'
216echo '(Note that the test can take an hour or more to run and periodically stops'
217echo 'for as long as one minute.  Do not assume there is a problem just because'
218echo 'nothing seems to happen for a long time.  If you cannot live without'
219echo 'running status, use the -v option or try the command:'
220echo "\`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.
226PROG=`basename ${testcvs}`
227
228# Match the hostname
229hostname="[-_.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.
233tempname="[-a-zA-Z0-9/.%_]*"
234
235# Regexp to match a date in RFC822 format (as amended by RFC1123).
236RFCDATE="[a-zA-Z0-9 ][a-zA-Z0-9 ]* [0-9:][0-9:]* -0000"
237RFCDATE_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
242DATE="[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?
245SEARCHPATH=$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]
249Which() {
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.
275if test -r /bin/sh; then
276  TESTSHELL="/bin/sh"
277else
278  TESTSHELL=`Which -f sh`
279  if test ! -r "$TESTSHELL"; then
280    TESTSHELL="/bin/sh"
281  fi
282fi
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#
291CVS="${testcvs} -Q"
292
293LOGFILE=`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.
298if test -f check.log; then
299	mv check.log check.plog
300fi
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.
306touch 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
331if 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
339else
340	tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null`
341fi
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)
352if test -d ${TESTDIR}; then
353    chmod -R a+wx ${TESTDIR}
354    rm -rf ${TESTDIR}
355fi
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.
359mkdir ${TESTDIR} || exit 1
360cd ${TESTDIR} || exit 1
361# Ensure $TESTDIR is absolute
362if 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`
368fi
369
370if test -z "${TESTDIR}" || echo "${TESTDIR}" |grep '^[^/]'; then
371    echo "Unable to resolve TESTDIR to an absolute directory." >&2
372    exit 1
373fi
374cd ${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}
383export TMPDIR
384if test -d $TMPDIR; then :; else
385    mkdir $TMPDIR
386fi
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
397badtools=
398set_bad_tool ()
399{
400   badtools=$badtools:$1
401}
402is_bad_tool ()
403{
404   case ":$badtools:" in *:$1:*) return 0 ;; *) return 1 ; esac
405}
406
407version_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
427find_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
474id_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
487ID=`find_tool id version_test id_tool_test`
488echo "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.
492for 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
503done
504
505# Cause NextStep 3.3 users to lose in a more graceful fashion.
506expr_tooltest1 ()
507{
508expr=$1
509if $expr 'abc
510def' : 'abc
511def' >/dev/null; then
512  # good, it works
513  return 0
514else
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
519fi
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...
524expr_tooltest2 ()
525{
526expr=$1
527if $expr 'a
528b' : 'a
529c' >/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
534else
535  return 0
536fi
537}
538
539expr_create_bar ()
540{
541echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo
542cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
543cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo
544cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
545rm -f ${TESTDIR}/foo
546}
547
548expr_tooltest3 ()
549{
550expr=$1
551# More SunOS lossage...
552test ! -f ${TESTDIR}/bar && expr_create_bar
553if $expr "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then
554  : good, it works
555else
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
560fi
561if $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
566fi
567# good, it works
568return 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).
576ENDANCHOR="$"
577expr_set_ENDANCHOR ()
578{
579expr=$1
580ENDANCHOR="$"
581if $expr 'abc
582def' : '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"
586fi
587return 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).
598DOTSTAR='.*'
599expr_set_DOTSTAR ()
600{
601expr=$1
602DOTSTAR='.*'
603if $expr 'abc
604def' : "a${DOTSTAR}f" >/dev/null; then
605  : good, it works
606else
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."
612fi
613return 0
614}
615
616# Now that we have DOTSTAR, make sure it works with big matches
617expr_tooltest_DOTSTAR ()
618{
619expr=$1
620test ! -f ${TESTDIR}/bar && expr_create_bar
621if $expr "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then
622  # good, it works
623  return 0
624else
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
629fi
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.)
639exprDASHDASH='false'
640expr_set_DASHDASH ()
641{
642expr=$1
643exprDASHDASH='false'
644# Not POSIX, but works on a lot of expr versions.
645if $expr "-rw-rw-r--" : "-rw-rw-r--" >/dev/null 2>&1; then
646  # good, it works
647  return 0
648else
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
661fi
662}
663
664
665EXPR=`find_tool ${EXPR}:gexpr \
666  version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \
667expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR`
668
669# Set the ENDANCHOR and DOTSTAR for the chosen expr version.
670expr_set_ENDANCHOR ${EXPR} >/dev/null
671expr_tooltest_DOTSTAR ${EXPR} >/dev/null
672
673# Is $EXPR a POSIX or non-POSIX implementation
674# with regard to command-line arguments?
675expr_set_DASHDASH ${EXPR}
676$exprDASHDASH && EXPR="$EXPR --"
677
678echo "Using EXPR=$EXPR" >>$LOGFILE
679echo "Using ENDANCHOR=$ENDANCHOR" >>$LOGFILE
680echo "Using DOTSTAR=$DOTSTAR" >>$LOGFILE
681
682# Cleanup
683rm -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).
692PLUS='+'
693if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
694  : good, it works
695else
696  PLUS='\+'
697fi
698
699# Likewise, for ?
700QUESTION='?'
701if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
702  : good, it works
703else
704  QUESTION='\?'
705fi
706
707# Now test the username to make sure it contains only valid characters
708username=`$ID -un`
709if $EXPR "${username}" : "${username}" >/dev/null; then
710  : good, it works
711else
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
715fi
716
717# Only 8 characters of $username appear in some output.
718if test `echo $username |wc -c` -gt 8; then
719  username8=`echo $username |sed 's/^\(........\).*/\1/'`
720else
721  username8=$username
722fi
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.
730anyusername="[-a-zA-Z0-9][-a-zA-Z0-9]*"
731
732# now make sure that tr works on NULs
733tr_tooltest1 ()
734{
735tr=$1
736if $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
741fi
742# good, it works
743return 0
744}
745
746TR=`find_tool ${TR}:gtr version_test tr_tooltest1`
747echo "Using TR=$TR" >>$LOGFILE
748
749# Awk testing
750
751awk_tooltest1 ()
752{
753awk=$1
754$awk 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
755if $EXPR "`cat abc`" : \
756'one
757two
758three
759four
760five
761six'; then
762  rm abc
763  return 0
764else
765  rm abc
766  echo "Notice: awk BEGIN clause or printf is not be working properly."
767  return 1
768fi
769}
770
771# Format item %c check
772awk_tooltest2 ()
773{
774awk=$1
775$awk 'BEGIN { printf "%c%c%c", 2, 3, 4 }' </dev/null \
776  | ${TR} '\002\003\004' '123' >abc
777if $EXPR "`cat abc`" : "123" ; then
778  : good, found it
779else
780  echo "Notice: awk format %c string may not be working properly."
781  rm abc
782  return 77
783fi
784rm abc
785return 0
786}
787
788AWK=`find_tool gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2`
789echo "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.
794depends_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.
811depends_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
838pass ()
839{
840  echo "PASS: $1" >>${LOGFILE}
841  passed=`expr $passed + 1`
842}
843
844# Like skip(), but don't fail when $skipfail is set.
845skip_always ()
846{
847  echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
848  skipped=`expr $skipped + 1`
849}
850
851skip ()
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
861warn ()
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.
872localonly ()
873{
874  skip_always $1 "only tested in local mode"
875}
876
877fail ()
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
885verify_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.
908restore_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).
916dotest_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
963dotest_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#
974dotest_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#
1003dotest_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 \|).
1064dotest ()
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
1078dotest_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.
1102dotest_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.
1116dotest_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
1131getrlogdate () {
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
1144mkdir home
1145HOME=${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.
1150RCSINIT=; 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
1159if 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"
1219else
1220	tests="$*"
1221fi
1222
1223# Now check the -f argument for validity.
1224if 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
1243fi
1244
1245
1246
1247# a simple function to compare directory contents
1248#
1249# Returns: 0 for same, 1 for different
1250#
1251directory_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
1298diffmerge_create_older_files() {
1299	  # This test case was supplied by Noah Friedman:
1300	  cat >testcase01 <<EOF
1301// Button.java
1302
1303package random.application;
1304
1305import random.util.*;
1306
1307public 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}
1332EOF
1333
1334	  # This test case was supplied by Jacob Burckhardt:
1335	  cat >testcase02 <<EOF
1336a
1337a
1338a
1339a
1340a
1341EOF
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
1346x
1347s
1348a
1349b
1350s
1351y
1352EOF
1353
1354	  # This test case was supplied by Karl Tomlinson:
1355	  cat >testcase04 <<EOF
1356s
1357x
1358m
1359m
1360x
1361s
1362v
1363s
1364x
1365m
1366m
1367x
1368s
1369EOF
1370
1371	  # This test case was supplied by Karl Tomlinson:
1372	  cat >testcase05 <<EOF
1373s
1374x
1375m
1376m
1377x
1378x
1379x
1380x
1381x
1382x
1383x
1384x
1385x
1386x
1387s
1388s
1389s
1390s
1391s
1392s
1393s
1394s
1395s
1396s
1397v
1398EOF
1399
1400	  # This test case was supplied by Jacob Burckhardt:
1401	  cat >testcase06 <<EOF
1402g
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414i
1415EOF
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
1422h
1423f
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433g
1434r
1435
1436
1437
1438i
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449i
1450EOF
1451
1452	  # This test case was supplied by Jacob Burckhardt:
1453	  cat >testcase08 <<EOF
1454Both changes move this line to the end of the file.
1455
1456no
1457changes
1458here
1459
1460First change will delete this line.
1461
1462First change will also delete this line.
1463
1464    no
1465    changes
1466    here
1467
1468Second change will change it here.
1469
1470        no
1471        changes
1472        here
1473EOF
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
1480m
1481a
1482{
1483}
1484b
1485{
1486}
1487EOF
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 );
1500MTGTXM 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
1526MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1527{
1528MTGTXM 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}
1544EOF
1545}
1546
1547# Create "your" revisions for diffmerge1
1548diffmerge_create_your_files() {
1549	  # remove the Button() method
1550	  cat >testcase01 <<\EOF
1551// Button.java
1552
1553package random.application;
1554
1555import random.util.*;
1556
1557public 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}
1571EOF
1572
1573	  cat >testcase02 <<\EOF
1574y
1575a
1576a
1577a
1578a
1579EOF
1580
1581	  cat >testcase03 <<\EOF
1582x
1583s
1584a
1585b
1586s
1587b
1588s
1589y
1590EOF
1591
1592	  cat >testcase04 <<\EOF
1593s
1594m
1595s
1596v
1597s
1598m
1599s
1600EOF
1601
1602	  cat >testcase05 <<\EOF
1603v
1604s
1605m
1606s
1607s
1608s
1609s
1610s
1611s
1612s
1613s
1614s
1615s
1616v
1617EOF
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
1634no
1635changes
1636here
1637
1638First change has now added this in.
1639
1640    no
1641    changes
1642    here
1643
1644Second change will change it here.
1645
1646        no
1647        changes
1648        here
1649
1650Both changes move this line to the end of the file.
1651EOF
1652
1653	  cat >testcase09 <<\EOF
1654
1655m
1656a
1657{
1658}
1659b
1660{
1661}
1662c
1663{
1664}
1665EOF
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 );
1687MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1688{
1689MTGTXM 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
1717MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1718{
1719MTGTXM 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
1736EOF
1737}
1738
1739# Create "my" revisions for diffmerge1
1740diffmerge_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
1746package random.application;
1747
1748import random.util.*;
1749
1750public 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}
1775EOF
1776
1777	  cat >testcase02 <<\EOF
1778a
1779a
1780a
1781a
1782m
1783EOF
1784
1785	  cat >testcase03 <<\EOF
1786x
1787s
1788c
1789s
1790b
1791s
1792y
1793EOF
1794
1795	  cat >testcase04 <<\EOF
1796v
1797s
1798x
1799m
1800m
1801x
1802s
1803v
1804s
1805x
1806m
1807m
1808x
1809s
1810v
1811EOF
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
1823no
1824changes
1825here
1826
1827First change will delete this line.
1828
1829First change will also delete this line.
1830
1831    no
1832    changes
1833    here
1834
1835Second change has now changed it here.
1836
1837        no
1838        changes
1839        here
1840
1841Both changes move this line to the end of the file.
1842EOF
1843
1844	  cat >testcase09 <<\EOF
1845m
1846a
1847{
1848}
1849b
1850{
1851}
1852c
1853{
1854}
1855EOF
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 );
1866MTGTXM 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
1892MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1893{
1894MTGTXM 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
1910EOF
1911}
1912
1913# Create expected results of merge for diffmerge1
1914diffmerge_create_expected_files() {
1915	  cat >testcase01 <<\EOF
1916// Button.java
1917
1918package random.application;
1919
1920import random.util.*;
1921
1922public 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}
1936EOF
1937
1938	  cat >testcase02 <<\EOF
1939y
1940a
1941a
1942a
1943m
1944EOF
1945
1946	  cat >testcase03 <<\EOF
1947x
1948s
1949c
1950s
1951b
1952s
1953b
1954s
1955y
1956EOF
1957
1958	  cat >testcase04 <<\EOF
1959v
1960s
1961m
1962s
1963v
1964s
1965m
1966s
1967v
1968EOF
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
1985no
1986changes
1987here
1988
1989First change has now added this in.
1990
1991    no
1992    changes
1993    here
1994
1995Second change has now changed it here.
1996
1997        no
1998        changes
1999        here
2000
2001Both changes move this line to the end of the file.
2002EOF
2003
2004	  cat >testcase09 <<\EOF
2005
2006m
2007a
2008{
2009}
2010b
2011{
2012}
2013c
2014{
2015}
2016EOF
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 );
2038MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
2039{
2040MTGTXM 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
2068MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
2069{
2070MTGTXM 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
2086EOF
2087}
2088
2089
2090
2091# Echo a new CVSROOT based on $1, $remote, and $remotehost
2092newroot() {
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+)
2130CVSROOTDIR=cvsrootdir
2131if $linkroot; then
2132    mkdir ${TESTDIR}/realcvsroot
2133    ln -s realcvsroot ${TESTDIR}/${CVSROOTDIR}
2134fi
2135CVSROOT_DIRNAME=${TESTDIR}/${CVSROOTDIR}
2136CVSROOT=`newroot $CVSROOT_DIRNAME`; export CVSROOT
2137
2138
2139
2140###
2141### Init the repository.
2142###
2143dotest init-1 "$testcvs -d$CVSROOT_DIRNAME init"
2144
2145# Copy the admin files for restore_adm.
2146cp -Rp $CVSROOT_DIRNAME/CVSROOT $TESTDIR/CVSROOT.save
2147
2148
2149
2150###
2151### The tests
2152###
2153if $remote; then
2154	localonly init-2
2155	localonly init-3
2156else
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'"
2160fi
2161
2162
2163
2164### The big loop
2165for 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'
2185Concurrent Versions System (CVS) [0-9.]*.*
2186
2187Copyright (C) [0-9]* Free Software Foundation, Inc.
2188
2189Senior active maintainers include Larry Jones, Derek R. Price,
2190and Mark D. Baushke.  Please see the AUTHORS and README files from the CVS
2191distribution kit for a complete list of contributors and copyrights.
2192
2193CVS may be copied only under the terms of the GNU General Public License,
2194a copy of which can be found with the CVS distribution kit.
2195
2196Specify 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)
2201Server: 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
2243Directory ${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
2274done
2275Checking in sdir/ssdir/ssfile;
2276${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
2277initial revision: 1\.1
2278done"
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===================================================================
2291RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2292retrieving revision 1\.1
2293diff -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===================================================================
2304RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2305retrieving revision 1\.1
2306diff -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===================================================================
2317RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2318retrieving revision 1\.1
2319diff -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
2324new revision: 1\.2; previous revision: 1\.1
2325done"
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
2337new revision: 1\.3; previous revision: 1\.2
2338done"
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
2342new revision: 2\.0; previous revision: 1\.3
2343done"
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
2347new revision: 2\.9; previous revision: 2\.0
2348done"
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
2353new revision: 2\.10; previous revision: 2\.9
2354done"
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
2358new revision: 2\.99; previous revision: 2\.10
2359done"
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
2364new revision: 2\.100; previous revision: 2\.99
2365done"
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
2369new revision: 2\.1099; previous revision: 2\.100
2370done"
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
2375new revision: 2\.1100; previous revision: 2\.1099
2376done"
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
2382new revision: 3\.1; previous revision: 2\.1100
2383done"
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
2394new revision: 3\.1\.2\.1; previous revision: 3\.1
2395done"
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'
2420Annotations for sdir/ssdir/ssfile
2421\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
24221\.1          .'"$username8"' *[0-9a-zA-Z-]*.: ssfile
24231\.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
2433new revision: delete; previous revision: 3\.1
2434done"
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
2442new revision: 3\.3; previous revision: 3\.2
2443done"
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
2454done"
2455	  dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
2456"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2457done"
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
2464done"
2465	  dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
2466"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2467deleting revision 3\.3
2468deleting revision 3\.2
2469done"
2470	  dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
2471"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2472done"
2473	  dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
2474"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2475deleting revision 2\.1100
2476deleting revision 2\.1099
2477deleting revision 2\.100
2478deleting revision 2\.99
2479deleting revision 2\.10
2480deleting revision 2\.9
2481deleting revision 2\.0
2482deleting revision 1\.3
2483done"
2484	  dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
2485"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2486deleting revision 2\.1100
2487deleting revision 2\.1099
2488deleting revision 2\.100
2489deleting revision 2\.99
2490deleting revision 2\.10
2491deleting revision 2\.9
2492deleting revision 2\.0
2493deleting revision 1\.3
2494done"
2495	  dotest basica-o6a "${testcvs} admin -o 3.1.2: ssfile" \
2496"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2497deleting revision 3\.1\.2\.1
2498done"
2499	  dotest basica-o7 "${testcvs} log -N ssfile" "
2500RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
2501Working file: ssfile
2502head: 3\.1
2503branch:
2504locks: strict
2505access list:
2506keyword substitution: kv
2507total revisions: 3;	selected revisions: 3
2508description:
2509----------------------------
2510revision 3\.1
2511date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
2512bump-it
2513----------------------------
2514revision 1\.2
2515date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
2516modify-it
2517----------------------------
2518revision 1\.1
2519date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2520add-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
2541done
2542Checking in topfile;
2543${CVSROOT_DIRNAME}/topfile,v  <--  topfile
2544initial revision: 1\.1
2545done"
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
2580Directory ${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===================================================================
2589File: 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"===================================================================
2598File: 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
2617done
2618Checking in Emptydir/sfile1;
2619${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
2620initial revision: 1\.1
2621done
2622RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2623done
2624Checking in sdir2/sfile2;
2625${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2626initial revision: 1\.1
2627done"
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
2632new revision: 1\.2; previous revision: 1\.1
2633done"
2634	  dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
2635T 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
2640new revision: 1\.2; previous revision: 1\.1
2641done"
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
2653U 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
2670U 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
2689sfile2 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
2698U 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
2722done
2723Checking in aa;
2724${CVSROOT_DIRNAME}/second-dir/aa,v  <--  aa
2725initial revision: 1\.1
2726done"
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
2732deleting 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
2736U 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
2740deleting revision 1\.2
2741deleting 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
2780Directory ${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////
2829D/first-dir////
2830D/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////
2836D/first-dir////
2837D/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////
2843D/first-dir////
2844D/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////
2850D/first-dir////
2851D/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
2880A file3
2881A file4
2882A file5"
2883	  dotest basic1-16-add-add "${testcvs} -q update" \
2884"A file2
2885A file3
2886A file4
2887A file5"
2888	  dotest basic1-17-add-add "${testcvs} -q status" \
2889"===================================================================
2890File: 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===================================================================
2899File: 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===================================================================
2908File: 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===================================================================
2917File: 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
2932A first-dir/file3
2933A first-dir/file4
2934A 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===================================================================
2945File: 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===================================================================
2954File: 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===================================================================
2963File: 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===================================================================
2972File: 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
2981A first-dir/file2
2982A first-dir/file3
2983A first-dir/file4
2984A first-dir/file5"
2985	  dotest basic1-27-add-add "${testcvs} co first-dir" \
2986"${PROG} checkout: Updating first-dir
2987A first-dir/file2
2988A first-dir/file3
2989A first-dir/file4
2990A 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
2995done
2996Checking in file2;
2997${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2998initial revision: 1\.1
2999done
3000RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
3001done
3002Checking in file3;
3003${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
3004initial revision: 1\.1
3005done
3006RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
3007done
3008Checking in file4;
3009${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
3010initial revision: 1\.1
3011done
3012RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
3013done
3014Checking in file5;
3015${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
3016initial revision: 1\.1
3017done"
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"===================================================================
3023File: 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===================================================================
3032File: 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===================================================================
3041File: 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===================================================================
3050File: 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
3098R file3
3099R file4
3100R file5"
3101	  dotest basic1-16-rm-rm "${testcvs} -q update" \
3102"R file2
3103R file3
3104R file4
3105R file5"
3106	  dotest basic1-17-rm-rm "${testcvs} -q status" \
3107"===================================================================
3108File: 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===================================================================
3117File: 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===================================================================
3126File: 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===================================================================
3135File: 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
3152R first-dir/file3
3153R first-dir/file4
3154R 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
3167R first-dir/file3
3168R first-dir/file4
3169R first-dir/file5"
3170	  dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
3171"R first-dir/file2
3172R first-dir/file3
3173R first-dir/file4
3174R 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
3179new revision: delete; previous revision: 1\.1
3180done
3181Removing file3;
3182${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
3183new revision: delete; previous revision: 1\.1
3184done
3185Removing file4;
3186${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
3187new revision: delete; previous revision: 1\.1
3188done
3189Removing file5;
3190${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
3191new revision: delete; previous revision: 1\.1
3192done"
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
3250RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v
3251done
3252Checking in first-dir/dir1/file1;
3253${CVSROOT_DIRNAME}/first-dir/dir1/file1,v  <--  file1
3254initial revision: 1.1
3255done
3256RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v
3257done
3258Checking in first-dir/dir1/dir2/file1;
3259${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v  <--  file1
3260initial revision: 1.1
3261done
3262RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v
3263done
3264Checking in first-dir/dir1/dir2/dir3/file1;
3265${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v  <--  file1
3266initial revision: 1.1
3267done
3268RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v
3269done
3270Checking in first-dir/dir1/dir2/dir3/dir4/file1;
3271${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
3272initial revision: 1.1
3273done
3274RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
3275done
3276Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
3277${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
3278initial revision: 1.1
3279done
3280RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
3281done
3282Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
3283${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
3284initial revision: 1.1
3285done
3286RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
3287done
3288Checking 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
3290initial revision: 1.1
3291done
3292RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
3293done
3294Checking 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
3296initial revision: 1.1
3297done
3298HERE
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
3307new revision: delete; previous revision: 1\.1
3308done"
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
3327U 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
3340new revision: delete; previous revision: 1\.1
3341done"
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
3356new revision: delete; previous revision: 1\.1
3357done
3358Removing dir5/dir6/file1;
3359${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
3360new revision: delete; previous revision: 1\.1
3361done"
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
3413A first-dir/file6
3414A first-dir/file7
3415${PROG} update: Updating first-dir/dir1
3416A first-dir/dir1/file6
3417A first-dir/dir1/file7
3418${PROG} update: Updating first-dir/dir1/dir2
3419A first-dir/dir1/dir2/file6
3420A 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===================================================================
3437File: 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===================================================================
3446File: 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===================================================================
3456File: 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===================================================================
3465File: 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===================================================================
3475File: 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===================================================================
3484File: 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
3501done
3502Checking in first-dir/file6;
3503${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3504initial revision: 1\.1
3505done
3506RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3507done
3508Checking in first-dir/file7;
3509${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3510initial revision: 1\.1
3511done
3512RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3513done
3514Checking in first-dir/dir1/file6;
3515${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3516initial revision: 1\.1
3517done
3518RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3519done
3520Checking in first-dir/dir1/file7;
3521${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3522initial revision: 1\.1
3523done
3524RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3525done
3526Checking in first-dir/dir1/dir2/file6;
3527${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3528initial revision: 1\.1
3529done
3530RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3531done
3532Checking in first-dir/dir1/dir2/file7;
3533${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3534initial revision: 1\.1
3535done"
3536
3537		dotest basic2-9 "${testcvs} tag second-dive first-dir" \
3538"${PROG} tag: Tagging first-dir
3539T first-dir/file6
3540T first-dir/file7
3541${PROG} tag: Tagging first-dir/dir1
3542T first-dir/dir1/file6
3543T first-dir/dir1/file7
3544${PROG} tag: Tagging first-dir/dir1/dir2
3545T first-dir/dir1/dir2/file6
3546T 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
3575A first-dir/file14
3576M first-dir/file6
3577R first-dir/file7
3578${PROG} update: Updating first-dir/dir1
3579A first-dir/dir1/file14
3580M first-dir/dir1/file6
3581R first-dir/dir1/file7
3582${PROG} update: Updating first-dir/dir1/dir2
3583A first-dir/dir1/dir2/file14
3584M first-dir/dir1/dir2/file6
3585R 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
3592RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
3593Working file: first-dir/file6
3594head: 1\.1
3595branch:
3596locks: strict
3597access list:
3598symbolic names:
3599	second-dive: 1\.1
3600keyword substitution: kv
3601total revisions: 1;	selected revisions: 1
3602description:
3603----------------------------
3604revision 1\.1
3605date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3606second dive
3607=============================================================================
3608
3609RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
3610Working file: first-dir/file7
3611head: 1\.1
3612branch:
3613locks: strict
3614access list:
3615symbolic names:
3616	second-dive: 1\.1
3617keyword substitution: kv
3618total revisions: 1;	selected revisions: 1
3619description:
3620----------------------------
3621revision 1\.1
3622date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3623second dive
3624=============================================================================
3625${PROG} log: Logging first-dir/dir1
3626${PROG} log: file14 has been added, but not committed
3627
3628RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3629Working file: first-dir/dir1/file6
3630head: 1\.1
3631branch:
3632locks: strict
3633access list:
3634symbolic names:
3635	second-dive: 1\.1
3636keyword substitution: kv
3637total revisions: 1;	selected revisions: 1
3638description:
3639----------------------------
3640revision 1\.1
3641date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3642second dive
3643=============================================================================
3644
3645RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3646Working file: first-dir/dir1/file7
3647head: 1\.1
3648branch:
3649locks: strict
3650access list:
3651symbolic names:
3652	second-dive: 1\.1
3653keyword substitution: kv
3654total revisions: 1;	selected revisions: 1
3655description:
3656----------------------------
3657revision 1\.1
3658date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3659second dive
3660=============================================================================
3661${PROG} log: Logging first-dir/dir1/dir2
3662${PROG} log: file14 has been added, but not committed
3663
3664RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3665Working file: first-dir/dir1/dir2/file6
3666head: 1\.1
3667branch:
3668locks: strict
3669access list:
3670symbolic names:
3671	second-dive: 1\.1
3672keyword substitution: kv
3673total revisions: 1;	selected revisions: 1
3674description:
3675----------------------------
3676revision 1\.1
3677date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3678second dive
3679=============================================================================
3680
3681RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3682Working file: first-dir/dir1/dir2/file7
3683head: 1\.1
3684branch:
3685locks: strict
3686access list:
3687symbolic names:
3688	second-dive: 1\.1
3689keyword substitution: kv
3690total revisions: 1;	selected revisions: 1
3691description:
3692----------------------------
3693revision 1\.1
3694date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3695second dive
3696============================================================================="
3697
3698		dotest basic2-14 "${testcvs} status first-dir" \
3699"${PROG} status: Examining first-dir
3700===================================================================
3701File: 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===================================================================
3710File: 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===================================================================
3719File: 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===================================================================
3729File: 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===================================================================
3738File: 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===================================================================
3747File: 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===================================================================
3757File: 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===================================================================
3766File: 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===================================================================
3775File: 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
3794RCS file: ${CVSROOT_DIRNAME}/first-dir/file14,v
3795done
3796Checking in first-dir/file14;
3797${CVSROOT_DIRNAME}/first-dir/file14,v  <--  file14
3798initial revision: 1\.1
3799done
3800Checking in first-dir/file6;
3801${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3802new revision: 1\.2; previous revision: 1\.1
3803done
3804Removing first-dir/file7;
3805${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3806new revision: delete; previous revision: 1\.1
3807done
3808RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v
3809done
3810Checking in first-dir/dir1/file14;
3811${CVSROOT_DIRNAME}/first-dir/dir1/file14,v  <--  file14
3812initial revision: 1\.1
3813done
3814Checking in first-dir/dir1/file6;
3815${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3816new revision: 1\.2; previous revision: 1\.1
3817done
3818Removing first-dir/dir1/file7;
3819${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3820new revision: delete; previous revision: 1\.1
3821done
3822RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v
3823done
3824Checking in first-dir/dir1/dir2/file14;
3825${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v  <--  file14
3826initial revision: 1\.1
3827done
3828Checking in first-dir/dir1/dir2/file6;
3829${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3830new revision: 1\.2; previous revision: 1\.1
3831done
3832Removing first-dir/dir1/dir2/file7;
3833${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3834new revision: delete; previous revision: 1\.1
3835done"
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
3840T first-dir/file14
3841T first-dir/file6
3842${PROG} tag: Tagging first-dir/dir1
3843T first-dir/dir1/file14
3844T first-dir/dir1/file6
3845${PROG} tag: Tagging first-dir/dir1/dir2
3846T first-dir/dir1/dir2/file14
3847T 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\.
3851Are 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"===================================================================
3868Checking out first-dir/file6
3869RCS:  $CVSROOT_DIRNAME/first-dir/file6,v
3870VERS: 1\.2
3871\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3872file6
3873file6"
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
3889Index: first-dir/file6
3890diff -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
3898Index: first-dir/file7
3899diff -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
3907Index: first-dir/dir1/file6
3908diff -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
3916Index: first-dir/dir1/file7
3917diff -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
3925Index: first-dir/dir1/dir2/file6
3926diff -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
3934Index: first-dir/dir1/dir2/file7
3935diff -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
3944Index: first-dir/file6
3945diff -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
3953Index: first-dir/file7
3954diff -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
3964U 1dir/file14
3965U 1dir/file6
3966${PROG} export: Updating 1dir/dir1
3967U 1dir/dir1/file14
3968U 1dir/dir1/file6
3969${PROG} export: Updating 1dir/dir1/dir2
3970U 1dir/dir1/dir2/file14
3971U 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
3978U first-dir/file14
3979U first-dir/file6
3980${PROG} export: Updating first-dir/dir1
3981U first-dir/dir1/file14
3982U first-dir/dir1/file6
3983${PROG} export: Updating first-dir/dir1/dir2
3984U first-dir/dir1/dir2/file14
3985U 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
3997U export-dir/file14
3998U export-dir/file6
3999U export-dir/file7
4000${PROG} export: Updating export-dir/dir1
4001U export-dir/dir1/file14
4002U export-dir/dir1/file6
4003U export-dir/dir1/file7
4004${PROG} export: Updating export-dir/dir1/dir2
4005U export-dir/dir1/dir2/file14
4006U export-dir/dir1/dir2/file6
4007U 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
4014U first-dir/file14
4015U first-dir/file6
4016U first-dir/file7
4017${PROG} checkout: Updating first-dir/dir1
4018U first-dir/dir1/file14
4019U first-dir/dir1/file6
4020U first-dir/dir1/file7
4021${PROG} checkout: Updating first-dir/dir1/dir2
4022U first-dir/dir1/dir2/file14
4023U first-dir/dir1/dir2/file6
4024U 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
4037N second-dir/dir1/dir2/file14
4038N second-dir/dir1/dir2/file6
4039N second-dir/dir1/dir2/file7
4040N second-dir/dir1/file14
4041N second-dir/dir1/file6
4042N second-dir/dir1/file7
4043N second-dir/file14
4044N second-dir/file6
4045N second-dir/file7
4046No 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
4053U second-dir/file14
4054U second-dir/file6
4055U second-dir/file7
4056${PROG} export: Updating second-dir/dir1
4057U second-dir/dir1/file14
4058U second-dir/dir1/file6
4059U second-dir/dir1/file7
4060${PROG} export: Updating second-dir/dir1/dir2
4061U second-dir/dir1/dir2/file14
4062U second-dir/dir1/dir2/file6
4063U 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 \.
4083D file14
4084D file6"
4085		dotest basic2-36 "${testcvs} tag -l rtagged-by-revision" \
4086"${PROG} tag: Tagging \.
4087T file14
4088T 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}/\*
4123A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == ${TESTDIR}
4124A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == ${TESTDIR}
4125A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == ${TESTDIR}
4126A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == ${TESTDIR}
4127A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == ${TESTDIR}
4128A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == ${TESTDIR}
4129A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == ${TESTDIR}
4130M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}
4131R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == ${TESTDIR}
4132A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == ${TESTDIR}
4133M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == ${TESTDIR}
4134R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == ${TESTDIR}
4135A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == ${TESTDIR}
4136M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == ${TESTDIR}
4137R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == ${TESTDIR}
4138F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= ${TESTDIR}/\*
4139T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
4140T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
4141T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
4142O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= ${TESTDIR}/\*
4143U [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}/first-dir
4144W [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>/\*
4146A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == <remote>
4147A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == <remote>
4148A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == <remote>
4149A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == <remote>
4150A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == <remote>
4151A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == <remote>
4152A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == <remote>
4153M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
4154R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == <remote>
4155A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == <remote>
4156M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == <remote>
4157R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == <remote>
4158A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == <remote>
4159M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == <remote>
4160R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == <remote>
4161F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= <remote>/\*
4162T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
4163T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
4164T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
4165O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= <remote>/\*
4166P [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
4167W [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
4184new revision: 1\.2; previous revision: 1\.1
4185done
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\.
4197Logging 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
4234done
4235Checking in tfile;
4236${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4237initial revision: 1\.1
4238done"
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
4267done
4268Checking in \.file;
4269${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4270new revision: 1\.1\.2\.1; previous revision: 1\.1
4271done
4272RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v
4273done
4274Checking in sdir/ssdir/\.file;
4275${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4276new revision: 1\.1\.2\.1; previous revision: 1\.1
4277done"
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
4282new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
4283done
4284Checking in \./sdir/ssdir/\.file;
4285${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
4286new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
4287done"
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
4299new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4300done"
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
4309new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4310done"
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
4316new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4317done
4318Checking in \.file;
4319${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
4320new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
4321done"
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
4327new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4328done"
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
4334new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4335done"
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
4341new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
4342done"
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
4364done
4365Checking in -c;
4366${CVSROOT_DIRNAME}/-c,v  <--  -c
4367initial revision: 1\.1
4368done"
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
4382done
4383Checking in a file;
4384${CVSROOT_DIRNAME}/first dir/a file,v  <--  a file
4385initial revision: 1\.1
4386done"
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
4429done
4430Checking in $file;
4431${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
4432initial revision: 1\.1
4433done"
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
4442new revision: 1\.2; previous revision: 1\.1
4443done"
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
4465done
4466Checking in tfile;
4467${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
4468initial revision: 1\.1
4469done"
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
4478new revision: 1\.2; previous revision: 1\.1
4479done"
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
4484retrieving revision 1\.1
4485retrieving revision 1\.2
4486Merging differences between 1\.1 and 1\.2 into tfile
4487rcsmerge: warning: conflicts during merge
4488${PROG} update: conflicts found in tfile
4489C tfile"
4490
4491		# Now note our status
4492		dotest status-1 "${testcvs} status tfile" \
4493"===================================================================
4494File: 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"===================================================================
4507File: 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"===================================================================
4519File: 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"===================================================================
4532File: 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
4559done
4560Checking in t3file;
4561$CVSROOT_DIRNAME/fourth-dir/t3file,v  <--  t3file
4562initial revision: 1\.1
4563done"
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
4575done
4576Checking in t2file;
4577$CVSROOT_DIRNAME/first-dir/third-dir/t2file,v  <--  t2file
4578initial revision: 1\.1
4579done"
4580                dotest status-5 "$testcvs status ../tfile" \
4581"===================================================================
4582File: 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"===================================================================
4591File: 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
4624N trdiff/bar
4625N trdiff/foo
4626No conflicts created by this import'
4627		dotest rdiff-2 \
4628		  "${testcvs} co -ko trdiff" \
4629"${PROG} checkout: Updating trdiff
4630U trdiff/bar
4631U 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
4638new revision: 1\.2; previous revision: 1\.1
4639done"
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
4649done
4650Checking in new;
4651${CVSROOT_DIRNAME}/trdiff/new,v  <--  new
4652initial revision: 1\.1
4653done"
4654		dotest rdiff-6 \
4655		  "${testcvs} tag local-v0" \
4656"${PROG} tag: Tagging .
4657T bar
4658T foo
4659T new"
4660		dotest rdiff-7 \
4661		  "${testcvs} status -v foo" \
4662"===================================================================
4663File: 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
4682Index: trdiff/foo
4683diff -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
4694Index: trdiff/new
4695diff -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'
4727No 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
4738done
4739Checking in file1\.txt;
4740${CVSROOT_DIRNAME}/abc/file1\.txt,v  <--  file1\.txt
4741initial revision: 1\.1
4742done"
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
4748new revision: 1\.2; previous revision: 1\.1
4749done"
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
4755new revision: 1\.3; previous revision: 1\.2
4756done"
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
4774done
4775Checking in file2\.txt;
4776${CVSROOT_DIRNAME}/abc/file2\.txt,v  <--  file2\.txt
4777initial revision: 1\.1
4778done"
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
4802File 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
4818File 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
4836N m/d/bar
4837N m/foo
4838No 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
4846U m/foo
4847${PROG} checkout: Updating m/d
4848U 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
4857new revision: delete; previous revision: 1\.1\.1\.1
4858done"
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
4865new revision: 1\.2; previous revision: 1\.1
4866done"
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
4872Index: m/d/bar
4873diff -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
4915done
4916Checking in abc;
4917${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4918initial revision: 1\.1
4919done"
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
4924new revision: 1\.2; previous revision: 1\.1
4925done"
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===================================================================
4931RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4932retrieving revision 1\.2
4933diff --ifdef HAVE_WINSOCK_H -r1\.2 abc
4934#ifndef HAVE_WINSOCK_H
4935extern 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
4965done
4966Checking in abc;
4967${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
4968initial revision: 1\.1
4969done"
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===================================================================
4976RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4977retrieving revision 1\.1
4978diff -r1\.1 abc
49795d4
4980< five"
4981          dotest_fail diffnl-101 "${testcvs} diff -u abc" \
4982"Index: abc
4983===================================================================
4984RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
4985retrieving revision 1\.1
4986diff -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
4999new revision: 1\.2; previous revision: 1\.1
5000done"
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===================================================================
5007RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5008retrieving revision 1\.2
5009diff -r1\.2 abc
50105c5
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===================================================================
5019RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5020retrieving revision 1\.2
5021diff -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
5035new revision: 1\.3; previous revision: 1\.2
5036done"
5037
5038	  # Addition of newline
5039	  echo "one
5040two
5041three
5042four
5043seven" > abc
5044	  dotest_fail diffnl-300 "${testcvs} diff abc" \
5045"Index: abc
5046===================================================================
5047RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5048retrieving revision 1\.3
5049diff -r1\.3 abc
50505c5
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===================================================================
5058RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5059retrieving revision 1\.3
5060diff -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
5073new revision: 1\.4; previous revision: 1\.3
5074done"
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===================================================================
5081RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5082retrieving revision 1\.4
5083diff -r1\.4 abc
50845c5
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===================================================================
5092RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
5093retrieving revision 1\.4
5094diff -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
5139done
5140Checking in sfile;
5141${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
5142initial revision: 1\.1
5143done"
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
5151new revision: delete; previous revision: 1\.1
5152done"
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
5225done
5226Checking in file4;
5227${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5228initial revision: 1\.1
5229done"
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
5237new revision: delete; previous revision: 1\.1
5238done"
5239
5240		# Tag the branchpoint.
5241		dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
5242T 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
5278diff -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
5288diff -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
5369retrieving revision 1\.3
5370retrieving revision 1\.3\.2\.1
5371Merging differences between 1\.3 and 1\.3\.2\.1 into file1
5372${PROG} update: scheduling file2 for removal
5373U 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
5401new revision: 1\.4; previous revision: 1\.3
5402done
5403Removing file2;
5404${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5405new revision: delete; previous revision: 1\.1
5406done
5407Checking in file3;
5408${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
5409new revision: 1\.2; previous revision: 1\.1
5410done"
5411		cd ..
5412		mkdir 2
5413		cd 2
5414		dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
5415U 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
5474C 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
5506done
5507Checking in file1;
5508${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5509initial revision: 1\.1
5510done
5511RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5512done
5513Checking in file4;
5514${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5515initial revision: 1\.1
5516done"
5517
5518	  # Make a branch and a non-branch tag.
5519	  dotest death2-4 "${testcvs} -q tag -b branch" \
5520'T file1
5521T file4'
5522	  dotest death2-5 "${testcvs} -q tag tag" \
5523'T file1
5524T 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===================================================================
5544RCS file: file1
5545diff -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
5556new revision: delete; previous revision: 1\.1
5557done"
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===================================================================
5574RCS file: file1
5575diff -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===================================================================
5587RCS file: file1
5588diff -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===================================================================
5603RCS file: file1
5604diff -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
5618diff -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===================================================================
5639RCS file: file1
5640diff -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
5651new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5652done"
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
5661new revision: delete; previous revision: 1\.1
5662done"
5663
5664	  # Back to the trunk.
5665	  dotest death2-11 "${testcvs} -q update -A" \
5666"[UP] file1
5667U 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
5676done
5677Checking in file2;
5678${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5679initial revision: 1\.1
5680done"
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
5687new revision: 1\.2; previous revision: 1\.1
5688done"
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
5707new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5708done"
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
5717done
5718Checking in file3;
5719${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
5720new revision: 1\.1\.2\.1; previous revision: 1\.1
5721done"
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===================================================================
5730RCS file: file3
5731diff -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===================================================================
5742RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5743retrieving revision 1\.1
5744retrieving revision 1\.1\.2\.2
5745diff -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===================================================================
5760RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5761retrieving revision 1\.1
5762retrieving revision 1\.1\.2\.2
5763diff -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
5771Index: file2
5772===================================================================
5773RCS file: file2
5774diff -N file2
5775\*\*\* /dev/null	${RFCDATE_EPOCH}
5776--- file2	${RFCDATE}	[0-9.]*
5777\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5778\*\*\* 0 \*\*\*\*
5779--- 1 ----
5780${PLUS} branch revision
5781Index: file3
5782===================================================================
5783RCS file: file3
5784diff -N file3
5785\*\*\* /dev/null	${RFCDATE_EPOCH}
5786--- file3	${RFCDATE}	[0-9.]*
5787\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5788\*\*\* 0 \*\*\*\*
5789--- 1 ----
5790${PLUS} first revision
5791Index: file4
5792===================================================================
5793RCS file: file4
5794diff -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
5807U 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===================================================================
5819RCS file: file1
5820diff -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
5831U file2
5832U file4'
5833
5834	  # test merging with a dead file
5835	  dotest death2-22 "${testcvs} -q co first-dir" \
5836"U first-dir/file1
5837U first-dir/file2
5838U 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
5847new revision: delete; previous revision: 1\.2
5848done"
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
5853C 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
5871done
5872Checking in bar;
5873$CVSROOT_DIRNAME/death-rtag/bar,v  <--  bar
5874initial revision: 1\.[0-9]*
5875done
5876RCS file: $CVSROOT_DIRNAME/death-rtag/foo,v
5877done
5878Checking in foo;
5879$CVSROOT_DIRNAME/death-rtag/foo,v  <--  foo
5880initial revision: 1\.[0-9]*
5881done"
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
5889new revision: delete; previous revision: 1\.[0-9]*
5890done"
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
5898new revision: 1\.1\.2\.1; previous revision: 1\.1
5899done
5900Checking in foo;
5901$CVSROOT_DIRNAME/death-rtag/Attic/foo,v  <--  foo
5902new revision: 1\.1\.2\.1; previous revision: 1\.1
5903done"
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"
5919RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v
5920head: 1.[0-9]*
5921branch:
5922locks: strict
5923access list:
5924symbolic names:
5925	wonttag: 1\.1\.2\.1
5926	wontmove: 1\.1
5927	willtag: 1\.1
5928	mybranch: 1\.1.0\.2
5929keyword substitution: kv
5930$DOTSTAR
5931RCS file: $CVSROOT_DIRNAME/death-rtag/Attic/foo,v
5932head: 1.[0-9]*
5933branch:
5934locks: strict
5935access list:
5936symbolic names:
5937	wonttag: 1\.1\.2\.1
5938	wontmove: 1\.2
5939	willtag: 1\.1
5940	mybranch: 1\.1.0\.2
5941keyword 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
5969done
5970Checking in $file;
5971$CVSROOT_DIRNAME/rm-update-message/$file,v  <--  $file
5972initial revision: 1\.1
5973done"
5974
5975	  rm $file
5976	  dotest rm-update-message-1 "$testcvs up $file" \
5977"${PROG} update: warning: $file was lost
5978U $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
6021done
6022Checking in file1;
6023${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6024initial revision: 7\.1
6025done"
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
6051done
6052Checking in file2;
6053${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6054initial revision: 7\.1
6055done"
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
6069done
6070Checking in file3;
6071${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
6072new revision: 1\.1\.2\.1; previous revision: 1\.1
6073done"
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
6101done
6102Checking in file4;
6103${CVSROOT_DIRNAME}/first-dir/Attic/file4,v  <--  file4
6104new revision: 1\.1\.2\.1; previous revision: 1\.1
6105done"
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
6119done
6120Checking in file5;
6121${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6122initial revision: 1\.1
6123done"
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
6128new revision: 7\.1; previous revision: 1\.1
6129done"
6130	  else
6131	    dotest rmadd-23 "${testcvs} -q ci -m add" \
6132"RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
6133done
6134Checking in file5;
6135${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6136initial revision: 7\.1
6137done"
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
6148new revision: 8\.4; previous revision: 7\.1
6149done"
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"===================================================================
6154File: 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
6172done
6173Checking in sub/subfile;
6174${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
6175initial revision: 1\.1
6176done"
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
6188new revision: 9\.1; previous revision: 7\.1
6189done
6190Checking in file2;
6191${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6192new revision: 9\.1; previous revision: 7\.1
6193done
6194Checking in file5;
6195${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6196new revision: 9\.1; previous revision: 8\.4
6197done"
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
6203new revision: 9\.2; previous revision: 9\.1
6204done
6205Checking in file2;
6206${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6207new revision: 9\.2; previous revision: 9\.1
6208done
6209Checking in file5;
6210${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
6211new revision: 9\.2; previous revision: 9\.1
6212done
6213Checking in sub/subfile;
6214${CVSROOT_DIRNAME}/first-dir/sub/subfile,v  <--  subfile
6215new revision: 9\.1; previous revision: 1\.1
6216done"
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
6246done
6247Checking in file1;
6248${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6249initial revision: 1\.1
6250done"
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
6258new revision: delete; previous revision: 1\.1
6259done"
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
6264new revision: 1\.3; previous revision: 1\.2
6265done"
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
6270new revision: 1\.4; previous revision: 1\.3
6271done"
6272	  dotest rmadd2-10 "${testcvs} -q update -j 1.4 -j 1.3 file1" \
6273"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6274retrieving revision 1\.4
6275retrieving revision 1\.3
6276Merging 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
6280new revision: 1\.5; previous revision: 1\.4
6281done"
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
6298new revision: delete; previous revision: 1\.5
6299done"
6300	  dotest rmadd2-16 "${testcvs} log -h file1" "
6301RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
6302Working file: file1
6303head: 1\.6
6304branch:
6305locks: strict
6306access list:
6307symbolic names:
6308	tagone: 1\.1
6309keyword substitution: kv
6310total revisions: 6
6311============================================================================="
6312	  dotest rmadd2-17 "${testcvs} status -v file1" \
6313"===================================================================
6314File: 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
6358done
6359Checking in file1;
6360${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6361initial revision: 1\.1
6362done"
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
6410done
6411Checking in file1;
6412$CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
6413initial revision: 1\.1
6414done"
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
6430new revision: delete; previous revision: 1\.1
6431done"
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
6443new revision: 1\.3; previous revision: 1\.2
6444done"
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
6451new revision: delete; previous revision: 1\.1
6452done"
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
6465new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
6466done"
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
6474done
6475Checking in file2;
6476$CVSROOT_DIRNAME/first-dir/Attic/file2,v  <--  file2
6477new revision: 1\.1\.2\.1; previous revision: 1\.1
6478done"
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
6513N dir1/file1
6514N dir1/sdir/sfile
6515No 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 
6548You have \[0\] altered files in this repository\.
6549Are 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 :]*//
6556D/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 :]*//
6560D/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
6590done
6591Checking in sdir/file1;
6592${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
6593initial revision: 1\.1
6594done"
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
6603C 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
6612U 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
6644C 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
6669new revision: delete; previous revision: 1\.1
6670done"
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
6705RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6706done
6707Checking in file1;
6708${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6709initial revision: 1.1
6710done
6711RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6712done
6713Checking in file2;
6714${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6715initial revision: 1.1
6716done
6717RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6718done
6719Checking in file3;
6720${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6721initial revision: 1.1
6722done
6723RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6724done
6725Checking in file4;
6726${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6727initial revision: 1.1
6728done
6729HERE
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
6734new revision: 1\.2; previous revision: 1\.1
6735done"
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
6740T file2
6741T file3
6742T 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 \.
6748T file1
6749T file2
6750T file3
6751T file4'
6752	  dotest branches-5 "$testcvs update -r br1" \
6753"$PROG update: Updating \.
6754M 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
6763new revision: 1\.1\.2\.1; previous revision: 1\.1
6764done
6765Checking in file2;
6766${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6767new revision: 1\.1\.2\.1; previous revision: 1\.1
6768done
6769Checking in file4;
6770${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6771new revision: 1\.2\.2\.1; previous revision: 1\.2
6772done"
6773	  dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
6774T file2
6775T file3
6776T 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
6787new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
6788done
6789Checking in file4;
6790${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6791new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
6792done"
6793	  dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
67942:br1
67953:ancest
67964:brbr'
6797	  dotest branches-11 "$testcvs -q update -r br1" \
6798'U file1
6799[UP] file2
6800[UP] file3
6801U file4'
6802	  dotest branches-12 "cat file1 file2 file3 file4" '1:br1
68032:br1
68043:ancest
68054: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
6810new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
6811done"
6812	  dotest branches-13 "${testcvs} -q update -A" \
6813'U file1
6814U file2
6815[UP] file3
6816U file4'
6817	  dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
68182:ancest
68193:ancest
68204: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
6826new revision: 1\.3; previous revision: 1\.2
6827done"
6828	  dotest branches-14.3 "${testcvs} log file4" \
6829"
6830RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6831Working file: file4
6832head: 1\.3
6833branch:
6834locks: strict
6835access list:
6836symbolic names:
6837	brbr: 1\.2\.2\.1\.0\.2
6838	br1: 1\.2\.0\.2
6839keyword substitution: kv
6840total revisions: 6;	selected revisions: 6
6841description:
6842----------------------------
6843revision 1\.3
6844date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6845trunk-change-after-branch
6846----------------------------
6847revision 1\.2
6848date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6849branches:  1\.2\.2;
6850trunk-before-branch
6851----------------------------
6852revision 1\.1
6853date: [0-9/: ]*;  author: ${username};  state: Exp;
6854add-it
6855----------------------------
6856revision 1\.2\.2\.2
6857date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6858change-on-br1
6859----------------------------
6860revision 1\.2\.2\.1
6861date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6862branches:  1\.2\.2\.1\.2;
6863modify
6864----------------------------
6865revision 1\.2\.2\.1\.2\.1
6866date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6867modify
6868============================================================================="
6869	  dotest_fail branches-14.4 \
6870	    "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
6871"Index: file4
6872===================================================================
6873RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6874retrieving revision 1\.1
6875retrieving revision 1\.3
6876diff -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===================================================================
6888RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6889retrieving revision 1\.1
6890retrieving revision 1\.2\.2\.1
6891diff -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
6902retrieving revision 1\.1\.2\.1
6903retrieving revision 1\.1\.2\.1\.2\.1
6904Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
6905rcsmerge: warning: conflicts during merge"
6906	  dotest branches-16 "cat file1" '<<<<<<< file1
69071:ancest
6908[=]======
69091: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
6914done
6915RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6916done
6917RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6918done
6919RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6920done"
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
6951done
6952Checking in file1;
6953${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6954initial revision: 1\.1
6955done"
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
6984done
6985Checking in file2;
6986${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
6987new revision: 1\.1\.2\.1; previous revision: 1\.1
6988done
6989RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
6990done
6991Checking in dir1/file3;
6992${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v  <--  file3
6993new revision: 1\.1\.2\.1; previous revision: 1\.1
6994done"
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
7006U dir1/file3"
7007	  dotest branches2-14 "${testcvs} -q status" \
7008"===================================================================
7009File: 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===================================================================
7018File: 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
7033U 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"===================================================================
7040File: 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===================================================================
7049File: 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
7063U dir1/file3"
7064	  dotest branches2-20 "${testcvs} -q status" \
7065"===================================================================
7066File: 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===================================================================
7075File: 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
7086U dir1/file3"
7087	  dotest branches2-22 "${testcvs} -q status" \
7088"===================================================================
7089File: 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===================================================================
7098File: 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
7117U first-dir/file2
7118U first-dir/dir1/file3'
7119	  cd ../b1a
7120	  dotest branches2-24 "${testcvs} -q co -r b1 first-dir" \
7121'U first-dir/file1
7122U first-dir/file2
7123U 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
7135done
7136Checking in dir2/file4;
7137${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v  <--  file4
7138new revision: 1\.1\.2\.1; previous revision: 1\.1
7139done"
7140
7141	  cd ../../b1b/first-dir
7142	  dotest branches2-28 "${testcvs} update -d dir2" \
7143"${PROG} update: Updating dir2
7144U dir2/file4"
7145	  cd dir2
7146	  dotest branches2-29 "${testcvs} -q status" \
7147"===================================================================
7148File: 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
7173done
7174Checking in file5;
7175${CVSROOT_DIRNAME}/first-dir/dir2/file5,v  <--  file5
7176initial revision: 1\.1
7177done"
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"===================================================================
7184File: 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
7213done
7214Checking in file1;
7215${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7216initial revision: 1\.1
7217done
7218RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7219done
7220Checking in file2;
7221${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7222initial revision: 1\.1
7223done"
7224	  dotest tagc-5 "${testcvs} -q tag -c tag1" \
7225"T file1
7226T file2"
7227	  touch file1 file2
7228	  dotest tagc-6 "${testcvs} -q tag -c tag2" \
7229"T file1
7230T 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
7252U 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
7257new revision: 1\.2; previous revision: 1\.1
7258done
7259Removing file2;
7260${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7261new revision: delete; previous revision: 1\.1
7262done
7263RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
7264done
7265Checking in file3;
7266${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
7267initial revision: 1\.1
7268done"
7269	  cd ../../2/first-dir
7270	  dotest tagc-10 "${testcvs} -q tag -c tag4" \
7271"${PROG} tag: file2 is no longer in the repository
7272T file1
7273T 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
7302done
7303Checking in $file;
7304${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
7305initial revision: 1\.1
7306done"
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"===================================================================
7318Checking out $file
7319RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
7320VERS: 1\.1
7321\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7322v1"
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"===================================================================
7332Checking out $file
7333RCS:  ${CVSROOT_DIRNAME}/$module/$file,v
7334VERS: 1\.1
7335\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7336v1"
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 \.
7355U $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
7362new revision: delete; previous revision: 1\.1
7363done"
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
7396done
7397Checking in file1;
7398${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7399initial revision: 1\.1
7400done
7401RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7402done
7403Checking in file2;
7404${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7405initial revision: 1\.1
7406done"
7407
7408	  # Now create a branch and commit a revision there.
7409	  dotest tagf-5 "${testcvs} -q tag -b br" "T file1
7410T file2"
7411	  dotest tagf-6 "$testcvs -q update -r br" \
7412'U file1
7413U 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
7419new revision: 1\.1\.2\.1; previous revision: 1\.1
7420done
7421Checking in file2;
7422${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7423new revision: 1\.1\.2\.1; previous revision: 1\.1
7424done"
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
7435T file2"
7436	  echo moremod >> file1
7437	  echo moremod >> file2
7438	  dotest tagf-9 "${testcvs} -q status -v file1" \
7439"===================================================================
7440File: 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
7453D 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
7461done"
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
7467retrieving revision 1\.1\.2\.1
7468retrieving revision 1\.1
7469Merging differences between 1\.1\.2\.1 and 1\.1 into file1
7470rcsmerge: warning: conflicts during merge
7471${PROG} update: conflicts found in file1
7472C file1
7473M 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
7479brmod
7480moremod
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
7487new revision: 1\.1\.4\.1; previous revision: 1\.1
7488done
7489Checking in file2;
7490${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7491new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
7492done"
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 \.
7552U file1
7553U 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 \.
7559Checking in file1;
7560${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7561new revision: 1\.1\.8\.1; previous revision: 1\.1
7562done
7563Checking in file2;
7564${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7565new revision: 1\.1\.6\.1; previous revision: 1\.1
7566done"
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
7613done
7614Checking in file1;
7615${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7616initial revision: 1\.1
7617done"
7618
7619          dotest tag-log-1 "$testcvs -Q tag mytag file1" ''
7620          dotest tag-log-2 "$testcvs log -N file1" \
7621"
7622RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7623Working file: file1
7624head: 1\.1
7625branch:
7626locks: strict
7627access list:
7628keyword substitution: kv
7629total revisions: 1;	selected revisions: 1
7630description:
7631----------------------------
7632revision 1\.1
7633date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7634add
7635============================================================================="
7636          dotest tag-log-3 "$testcvs log -N -n file1" \
7637"
7638RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7639Working file: file1
7640head: 1\.1
7641branch:
7642locks: strict
7643access list:
7644symbolic names:
7645	mytag: 1\.1
7646keyword substitution: kv
7647total revisions: 1;	selected revisions: 1
7648description:
7649----------------------------
7650revision 1\.1
7651date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7652add
7653============================================================================="
7654          dotest tag-log-4 "$testcvs log file1" \
7655"
7656RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7657Working file: file1
7658head: 1\.1
7659branch:
7660locks: strict
7661access list:
7662symbolic names:
7663	mytag: 1\.1
7664keyword substitution: kv
7665total revisions: 1;	selected revisions: 1
7666description:
7667----------------------------
7668revision 1\.1
7669date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7670add
7671============================================================================="
7672          dotest tag-log-5 "$testcvs log -n file1" \
7673"
7674RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7675Working file: file1
7676head: 1\.1
7677branch:
7678locks: strict
7679access list:
7680symbolic names:
7681	mytag: 1\.1
7682keyword substitution: kv
7683total revisions: 1;	selected revisions: 1
7684description:
7685----------------------------
7686revision 1\.1
7687date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
7688add
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
7715done
7716Checking in file1;
7717$CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
7718initial revision: 1\.1
7719done"
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
7731error  " <<EOF
7732Root $CVSROOT_DIRNAME
7733UseUnchanged
7734Argument --
7735Argument  spacetag 
7736Directory .
7737$CVSROOT_DIRNAME/first-dir
7738Entry /file1/1.1///
7739Unchanged file1
7740tag
7741EOF
7742
7743	    dotest tag-space-4 "$testcvs server" \
7744"E $PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters
7745error  " <<EOF
7746Root $CVSROOT_DIRNAME
7747UseUnchanged
7748Argument --
7749Argument spacetag 
7750Directory .
7751$CVSROOT_DIRNAME/first-dir
7752Entry /file1/1.1///
7753Unchanged file1
7754tag
7755EOF
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
7787error  " <<EOF
7788Root $CVSROOT_DIRNAME
7789Argument -P
7790Argument -r
7791Argument  spacetag 
7792Argument first-dir
7793Directory .
7794$CVSROOT_DIRNAME
7795co
7796EOF
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
7801error  " <<EOF
7802Root $CVSROOT_DIRNAME
7803Argument -P
7804Argument -r
7805Argument  spacetag 
7806Argument second-dir
7807Directory .
7808$CVSROOT_DIRNAME
7809co
7810EOF
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
7823error  " <<EOF
7824Root $CVSROOT_DIRNAME
7825Argument -r
7826Argument  spacetag 
7827Argument -u
7828Argument --
7829Directory .
7830$CVSROOT_DIRNAME
7831Unchanged file1
7832update
7833EOF
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
7866done
7867Checking in foo\.c;
7868${CVSROOT_DIRNAME}/first-dir/foo.c,v  <--  foo\.c
7869initial revision: 1\.1
7870done"
7871	  dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
7872	  dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
7873"===================================================================
7874Checking out foo\.c
7875RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7876VERS: 1\.1
7877\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7878I 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
7884new revision: 1\.2; previous revision: 1\.1
7885done"
7886	  dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
7887	  dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
7888"===================================================================
7889Checking out foo\.c
7890RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7891VERS: 1\.2
7892\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7893I 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 \.
7897Index: foo\.c
7898===================================================================
7899RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7900retrieving revision 1\.1
7901retrieving revision 1\.2
7902diff -r1\.1 -r1\.2
79031c1
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 \.
7911Index: foo\.c
7912===================================================================
7913RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
7914retrieving revision 1\.1
7915diff -r1\.1 foo\.c
79161c1
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
7928test_regex (whiz, bang)
7929{
7930foo;
7931bar;
7932baz;
7933grumble;
7934}
7935EOF
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
7941done
7942Checking in rgx\.c;
7943${CVSROOT_DIRNAME}/first-dir/rgx\.c,v  <--  rgx\.c
7944initial revision: 1\.1
7945done"
7946	  cat >rgx.c <<EOF
7947test_regex (whiz, bang)
7948{
7949foo;
7950bar;
7951baz;
7952mumble;
7953}
7954EOF
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===================================================================
7959RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
7960retrieving revision 1\.1
7961diff -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
8005done
8006Checking in file1;
8007${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8008initial revision: 1\.1
8009done"
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
8014new revision: 1\.2; previous revision: 1\.1
8015done"
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"===================================================================
8020File: 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 $
80292
80303'
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
8035new revision: 1\.1\.2\.1; previous revision: 1\.1
8036done"
8037	  dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
8038"U file1
8039RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8040retrieving revision 1\.1
8041retrieving revision 1\.2
8042Merging differences between 1\.1 and 1\.2 into file1
8043rcsmerge: warning: conflicts during merge"
8044	  dotest rcslib-merge-13 "cat file1" \
8045"<<<<<<< file1
80461\.1\.2\.1
80472
8048three
8049[=]======
80501\.2
8051two
80523
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
8070new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
8071done"
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
8087U 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
8092new revision: 1\.1\.2\.[0-9]*; previous revision: 1\.1\.2\.[0-9]*
8093done"
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
8100done
8101Checking in file3;
8102${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
8103new revision: 1\.1\.2\.1; previous revision: 1\.1
8104done"
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
8121new revision: delete; previous revision: 1\.1\.2\.1
8122done"
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 .
8141T file1
8142W 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
8157U 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
8165new revision: delete; previous revision: 1\.2
8166done"
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
8182new revision: 1\.4; previous revision: 1\.3
8183done"
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
8210U 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
8219new revision: 1\.5; previous revision: 1\.4
8220done"
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
8257RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8258done
8259Checking in file1;
8260${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8261initial revision: 1.1
8262done
8263HERE
8264	  dotest multibranch-4 "${testcvs} tag -b br1" \
8265"${PROG} tag: Tagging \.
8266T file1"
8267	  dotest multibranch-5 "${testcvs} tag -b br2" \
8268"${PROG} tag: Tagging \.
8269T 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
8275new revision: 1\.1\.2\.1; previous revision: 1\.1
8276done"
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
8282new revision: 1\.1\.4\.1; previous revision: 1\.1
8283done"
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
8288br2 adds a line'
8289
8290	  dotest multibranch-14 "${testcvs} log file1" \
8291"
8292RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8293Working file: file1
8294head: 1\.1
8295branch:
8296locks: strict
8297access list:
8298symbolic names:
8299	br2: 1\.1\.0\.4
8300	br1: 1\.1\.0\.2
8301keyword substitution: kv
8302total revisions: 3;	selected revisions: 3
8303description:
8304----------------------------
8305revision 1\.1
8306date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8307branches:  1\.1\.2;  1\.1\.4;
8308add-it
8309----------------------------
8310revision 1\.1\.4\.1
8311date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
8312modify-on-br2
8313----------------------------
8314revision 1\.1\.2\.1
8315date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
8316modify-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
8365I first-dir/RCS
8366N first-dir/imported-f1
8367N first-dir/imported-f2
8368N first-dir/imported-f3
8369N first-dir/imported-f4
8370No 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
8379U first-dir/imported-f2
8380U first-dir/imported-f3
8381U 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 .
8402Removing imported-f1;
8403${CVSROOT_DIRNAME}/first-dir/imported-f1,v  <--  imported-f1
8404new revision: delete; previous revision: 1\.1\.1\.1
8405done
8406Checking in imported-f2;
8407${CVSROOT_DIRNAME}/first-dir/imported-f2,v  <--  imported-f2
8408new revision: 1\.2; previous revision: 1\.1
8409done"
8410
8411		# log
8412		dotest import-101 "${testcvs} log imported-f1" \
8413"
8414RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/imported-f1,v
8415Working file: imported-f1
8416head: 1\.2
8417branch:
8418locks: strict
8419access list:
8420symbolic names:
8421	junk-1_0: 1\.1\.1\.1
8422	vendor-branch: 1\.1\.1
8423keyword substitution: kv
8424total revisions: 3;	selected revisions: 3
8425description:
8426----------------------------
8427revision 1\.2
8428date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
8429local-changes
8430----------------------------
8431revision 1\.1
8432date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8433branches:  1\.1\.1;
8434Initial revision
8435----------------------------
8436revision 1\.1\.1\.1
8437date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8438first-import
8439============================================================================="
8440
8441		# update into the vendor branch.
8442		dotest import-102 "$testcvs update -rvendor-branch" \
8443"$PROG update: Updating .
8444U 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
8460new revision: delete; previous revision: 1\.1\.1\.1
8461done"
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
84822 conflicts created by this import.
8483C first-dir/imported-f1
8484C first-dir/imported-f2
8485I first-dir/RCS
8486U first-dir/imported-f3
8487U first-dir/imported-f4
8488Use 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
8532RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f2,v
8533retrieving revision 1\.1\.1\.1
8534retrieving revision 1\.1\.1\.2
8535Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
8536rcsmerge: warning: conflicts during merge
8537first-dir/imported-f3 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.2
8538first-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
8551import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
8552local-change
8553[=]======
8554import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
8555rev 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
8577N first-dir/file1
8578N first-dir/file2
8579No 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
85982 conflicts created by this import.
8599C first-dir/file1
8600C first-dir/file2
8601Use 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
8613supported by import, not \`1'\.  For example: \`1\.1\.1'\."
8614	  : when we implement main-branch import, should be \
8615"N second-dir/mine1\.c
8616N second-dir/mine2\.c
8617
8618No 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
8628U first-dir/file2"
8629	  cd first-dir
8630	  dotest importb-5 "${testcvs} -q log file1" "
8631RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8632Working file: file1
8633head: 1\.1
8634branch: 1\.1\.1
8635locks: strict
8636access list:
8637symbolic 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
8642keyword substitution: kv
8643total revisions: 3;	selected revisions: 3
8644description:
8645----------------------------
8646revision 1\.1
8647date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
8648branches:  1\.1\.1;  1\.1\.3;
8649Initial revision
8650----------------------------
8651revision 1\.1\.3\.1
8652date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
8653add
8654----------------------------
8655revision 1\.1\.1\.1
8656date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8657add
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
8680N first-dir/adir/sub1/file1
8681N first-dir/adir/sub1/ssdir/ssfile
8682N first-dir/adir/sub2/file2
8683N first-dir/bdir/subdir/file1
8684N first-dir/cdir/cfile
8685No 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
8697U first-dir/adir/sub1/ssdir/ssfile
8698U first-dir/adir/sub2/file2
8699U first-dir/bdir/subdir/file1
8700U 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
8715U adir/sub1/ssdir/ssfile
8716U adir/sub2/file2
8717U bdir/subdir/file1
8718M 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
8724new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
8725done"
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" "
8730RCS file: ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v
8731Working file: cdir/cfile
8732head: 1\.1
8733branch: 1\.1\.1
8734locks: strict
8735access list:
8736symbolic names:
8737	wip_test: 1\.1\.1\.1\.0\.2
8738	release: 1\.1\.1\.1
8739	vendor: 1\.1\.1
8740keyword substitution: kv
8741total revisions: 3;	selected revisions: 3
8742description:
8743----------------------------
8744revision 1\.1
8745date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;
8746branches:  1\.1\.1;
8747Initial revision
8748----------------------------
8749revision 1\.1\.1\.1
8750date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8751branches:  1\.1\.1\.1\.2;
8752import-it
8753----------------------------
8754revision 1\.1\.1\.1\.2\.1
8755date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
8756modify
8757============================================================================="
8758
8759	  dotest importc-9 "${testcvs} -q log bdir/subdir/file1" "
8760RCS file: ${CVSROOT_DIRNAME}/first-dir/bdir/subdir/file1,v
8761Working file: bdir/subdir/file1
8762head: 1\.1
8763branch: 1\.1\.1
8764locks: strict
8765access list:
8766symbolic names:
8767	wip_test: 1\.1\.1\.1\.0\.2
8768	release: 1\.1\.1\.1
8769	vendor: 1\.1\.1
8770keyword substitution: kv
8771total revisions: 2;	selected revisions: 2
8772description:
8773----------------------------
8774revision 1\.1
8775date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;
8776branches:  1\.1\.1;
8777Initial revision
8778----------------------------
8779revision 1\.1\.1\.1
8780date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
8781import-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
8821I import-CVS/CVS
8822I import-CVS/sdir/CVS
8823N import-CVS/file1
8824N import-CVS/file2
8825N import-CVS/file3
8826N import-CVS/sdir/file6
8827N import-CVS/sdir/file7
8828No 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
8858supported 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
8863supported 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
8870N import-quirks-2/file1
8871N import-quirks-2/file2
8872N import-quirks-2/file3
8873No 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
8879N import-quirks-3/file1
8880N import-quirks-3/file2
8881N import-quirks-3/file3
8882No 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
8888N import-quirks-4/file1
8889N import-quirks-4/file2
8890N import-quirks-4/file3
8891No 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
8932done
8933Checking in $file;
8934${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
8935initial revision: 1\.1
8936done"
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
8981N first-dir/file1
8982N first-dir/file2
8983No 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
8990U 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
9014new revision: 1\.1\.1\.1\.2\.2; previous revision: 1\.1\.1\.1\.2\.1
9015done"
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
9129done
9130Checking in file3;
9131${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9132initial revision: 1\.1
9133done
9134RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
9135done
9136Checking in file4;
9137${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9138initial revision: 1\.1
9139done
9140RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
9141done
9142Checking in file6;
9143${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9144initial revision: 1\.1
9145done
9146RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
9147done
9148Checking in file8;
9149${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9150initial revision: 1\.1
9151done
9152RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
9153done
9154Checking in file9;
9155${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9156initial revision: 1\.1
9157done"
9158
9159	  # Make a branch.
9160	  dotest join-4 "${testcvs} -q tag -b branch ." \
9161'T file3
9162T file4
9163T file6
9164T file8
9165T 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
9186done
9187Checking in file10;
9188${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
9189initial revision: 1\.1
9190done
9191RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
9192done
9193Checking in file2;
9194${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9195initial revision: 1\.1
9196done
9197Checking in file4;
9198${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9199new revision: 1\.2; previous revision: 1\.1
9200done
9201Removing file6;
9202${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9203new revision: delete; previous revision: 1\.1
9204done
9205RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
9206done
9207Checking in file7;
9208${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
9209initial revision: 1\.1
9210done
9211Removing file8;
9212${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9213new revision: delete; previous revision: 1\.1
9214done
9215Removing file9;
9216${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9217new revision: delete; previous revision: 1\.1
9218done"
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
9227new revision: delete; previous revision: 1\.1
9228done"
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
9236U first-dir/file4
9237U first-dir/file6
9238U first-dir/file8
9239U 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
9256new revision: 1\.1\.2\.1; previous revision: 1\.1
9257done
9258Checking in file4;
9259${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9260new revision: 1\.1\.2\.1; previous revision: 1\.1
9261done
9262RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
9263done
9264Checking in file5;
9265${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9266new revision: 1\.1\.2\.1; previous revision: 1\.1
9267done
9268Checking in file6;
9269${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
9270new revision: 1\.1\.2\.1; previous revision: 1\.1
9271done
9272Checking in file9;
9273${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
9274new revision: 1\.1\.2\.1; previous revision: 1\.1
9275done"
9276
9277	  # Tag the current revisions on the branch.
9278	  dotest join-11 "${testcvs} -q tag T1 ." \
9279'T file3
9280T file4
9281T file5
9282T file6
9283T file8
9284T 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
9303done
9304Checking in file1;
9305${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
9306new revision: 1\.1\.2\.1; previous revision: 1\.1
9307done
9308Checking in file2;
9309${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9310new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
9311done
9312Removing file3;
9313${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9314new revision: delete; previous revision: 1\.1\.2\.1
9315done
9316Removing file4;
9317${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9318new revision: delete; previous revision: 1\.1\.2\.1
9319done
9320Removing file5;
9321${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9322new revision: delete; previous revision: 1\.1\.2\.1
9323done
9324Removing file6;
9325${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
9326new revision: delete; previous revision: 1\.1\.2\.1
9327done
9328Checking in file9;
9329${CVSROOT_DIRNAME}/first-dir/Attic/file9,v  <--  file9
9330new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
9331done"
9332
9333	  # Tag the current revisions on the branch.
9334	  dotest join-15 "${testcvs} -q tag T2 ." \
9335'T file1
9336T file2
9337T file8
9338T 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
9346U first-dir/file2
9347$PROG checkout: file first-dir/file2 exists, but has been added in revision T2
9348U first-dir/file3
9349$PROG checkout: scheduling first-dir/file3 for removal
9350U first-dir/file4
9351$PROG checkout: file first-dir/file4 has been removed in revision T2, but the destination is incompatibly modified
9352C first-dir/file4
9353U 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
9360R file3
9361C 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
9370M file4
9371$PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
9372C 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
9378R file3
9379C 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
9396U first-dir/file2
9397RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9398retrieving revision 1\.1
9399retrieving revision 1\.1\.2\.2
9400Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9401U first-dir/file3
9402$PROG checkout: scheduling first-dir/file3 for removal
9403U first-dir/file4
9404$PROG checkout: file first-dir/file4 has been removed in revision branch, but the destination is incompatibly modified
9405C first-dir/file4
9406U 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
9414M file2
9415R file3
9416C 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
9423U first-dir/file3
9424U first-dir/file4
9425U 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
9434RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9435retrieving revision 1\.1
9436retrieving revision 1\.1\.2\.2
9437Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9438$PROG update: scheduling file3 for removal
9439M file4
9440$PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
9441C 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
9448M file2
9449R file3
9450C 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
9459U first-dir/file3
9460U first-dir/file4
9461U first-dir/file7'
9462	  cd first-dir
9463	  dotest join-26 "${testcvs} -q tag -b br2" \
9464"T file2
9465T file3
9466T file4
9467T 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
9478RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9479retrieving revision 1\.1
9480retrieving revision 1\.1\.2\.2
9481Merging 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
9484C file4
9485U file8
9486U file9"
9487	  # Verify that the right changes have been scheduled.
9488	  dotest_fail join-29 "$testcvs -q update" \
9489"A file1
9490M file2
9491R file3
9492C file4
9493A file8
9494A 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
9506U first-dir/file2
9507U first-dir/file8
9508U 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
9512U file1
9513U file2
9514RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
9515retrieving revision 1\.1
9516retrieving revision 1\.1\.2\.2
9517Merging differences between 1\.1 and 1\.1\.2\.2 into file2
9518U file3
9519$PROG update: scheduling file3 for removal
9520U file4
9521$PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
9522C file4
9523U file7
9524$PROG update: file8 is no longer in the repository
9525U file8
9526$PROG update: file9 is no longer in the repository
9527U file9"
9528	  # Verify that the right changes have been scheduled.
9529	  dotest_fail join-twobranch-3 "$testcvs -q update" \
9530"A file1
9531M file2
9532R file3
9533C file4
9534A file8
9535A 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
9543U first-dir/file3
9544U first-dir/file4
9545U 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
9551T file3
9552T file4
9553T 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
9560new revision: 1\.2; previous revision: 1\.1
9561done"
9562
9563	  # And Tag again.
9564	  dotest join-33 "${testcvs} -q tag T4 ." \
9565'T file2
9566T file3
9567T file4
9568T 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
9574U 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
9585RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
9586retrieving revision 1\.1
9587retrieving revision 1\.2
9588Merging 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
9617done
9618Checking in file1;
9619${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9620initial revision: 1\.1
9621done"
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
9631done
9632Checking in bradd;
9633${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v  <--  bradd
9634new revision: 1\.1\.2\.1; previous revision: 1\.1
9635done
9636Checking in file1;
9637${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9638new revision: 1\.1\.2\.1; previous revision: 1\.1
9639done"
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"===================================================================
9646File: 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
9657retrieving revision 1\.1
9658retrieving revision 1\.1\.2\.1
9659Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
9660	  dotest join2-12 "cat file1" "initial contents of file1
9661modify on branch"
9662	  # We should have no sticky tag on file1
9663	  dotest join2-13 "${testcvs} -q status file1" \
9664"===================================================================
9665File: 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
9677new revision: 1\.2; previous revision: 1\.1
9678done"
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"===================================================================
9700File: 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
9710new revision: 1\.2; previous revision: 1\.1
9711done"
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
9734done
9735Checking in file1;
9736${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9737initial revision: 1\.1
9738done"
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
9745new revision: 1\.1\.2\.1; previous revision: 1\.1
9746done"
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
9760new revision: 1\.2; previous revision: 1\.1
9761done
9762RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
9763done
9764Checking in file2;
9765${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
9766initial revision: 1\.1
9767done"
9768	  dotest join3-10 "${testcvs} -q tag -b br2" "T file1
9769T 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
9776retrieving revision 1\.1
9777retrieving revision 1\.2
9778Merging differences between 1\.1 and 1\.2 into file1
9779rcsmerge: warning: conflicts during merge
9780U file2"
9781	  dotest join3-13 "cat file1" \
9782"initial contents of file1
9783[<]<<<<<< file1
9784br1:line1
9785[=]======
9786trunk: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
9793U 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
9798new revision: 1\.2\.2\.1; previous revision: 1\.2
9799done"
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
9809retrieving revision 1\.1
9810retrieving revision 1\.2\.2\.1
9811Merging differences between 1\.1 and 1\.2\.2\.1 into file1
9812rcsmerge: warning: conflicts during merge"
9813	  dotest join3-18 "cat file1" \
9814"initial contents of file1
9815[<]<<<<<< file1
9816br1:line1
9817[=]======
9818trunk:line1
9819br2: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
9853done
9854Checking in file3;
9855${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
9856initial revision: 1\.1
9857done
9858RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
9859done
9860Checking in file4;
9861${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9862initial revision: 1\.1
9863done
9864RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
9865done
9866Checking in file6;
9867${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9868initial revision: 1\.1
9869done
9870RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
9871done
9872Checking in file8;
9873${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
9874initial revision: 1\.1
9875done
9876RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
9877done
9878Checking in file9;
9879${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9880initial revision: 1\.1
9881done"
9882
9883	  # Make a branch.
9884	  dotest join4-4 "${testcvs} -q tag -b branch ." \
9885'T file3
9886T file4
9887T file6
9888T file8
9889T 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
9898done
9899Checking in file10;
9900${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
9901initial revision: 1\.1
9902done"
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
9927U first-dir/file4
9928U first-dir/file6
9929U first-dir/file8
9930U 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
9947new revision: 1\.1\.2\.1; previous revision: 1\.1
9948done
9949Checking in file4;
9950${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
9951new revision: 1\.1\.2\.1; previous revision: 1\.1
9952done
9953RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
9954done
9955Checking in file5;
9956${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
9957new revision: 1\.1\.2\.1; previous revision: 1\.1
9958done
9959Checking in file6;
9960${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
9961new revision: 1\.1\.2\.1; previous revision: 1\.1
9962done
9963Checking in file9;
9964${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
9965new revision: 1\.1\.2\.1; previous revision: 1\.1
9966done"
9967
9968	  # Tag the current revisions on the branch.
9969	  dotest join4-11 "${testcvs} -q tag T1 ." \
9970'T file3
9971T file4
9972T file5
9973T file6
9974T file8
9975T 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
9994done
9995Checking in file1;
9996${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
9997new revision: 1\.1\.2\.1; previous revision: 1\.1
9998done
9999RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
10000done
10001Checking in file2;
10002${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
10003new revision: 1\.1\.2\.1; previous revision: 1\.1
10004done
10005Removing file3;
10006${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
10007new revision: delete; previous revision: 1\.1\.2\.1
10008done
10009Removing file4;
10010${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
10011new revision: delete; previous revision: 1\.1\.2\.1
10012done
10013Removing file5;
10014${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
10015new revision: delete; previous revision: 1\.1\.2\.1
10016done
10017Removing file6;
10018${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
10019new revision: delete; previous revision: 1\.1\.2\.1
10020done
10021Checking in file9;
10022${CVSROOT_DIRNAME}/first-dir/file9,v  <--  file9
10023new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
10024done"
10025
10026	  # Tag the current revisions on the branch.
10027	  dotest join4-15 "${testcvs} -q tag T2 ." \
10028'T file1
10029T file2
10030T file8
10031T 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
10038R file10
10039A file2
10040$PROG update: file file2 exists, but has been added in revision T2
10041$PROG update: scheduling file3 for removal
10042M file4
10043$PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
10044C file4
10045R file6
10046A file7
10047R file8
10048R 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
10054R file10
10055A file2
10056R file3
10057C file4
10058R file6
10059A file7
10060R file8
10061R 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
10087done
10088Checking in -file;
10089${CVSROOT_DIRNAME}/join5/-file,v  <--  -file
10090initial revision: 1\.1
10091done"
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
10102new revision: 1\.2; previous revision: 1\.1
10103done"
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 \.
10111RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
10112retrieving revision 1\.1
10113retrieving revision 1\.2
10114Merging differences between 1\.1 and 1\.2 into -file
10115rcsmerge: warning: conflicts during merge
10116${PROG} update: conflicts found in -file
10117C -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
10143done
10144Checking in temp\.txt;
10145${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
10146initial revision: 1\.1
10147done"
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
10153new revision: 1\.2; previous revision: 1\.1
10154done"
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
10171RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10172retrieving revision 1\.1
10173retrieving revision 1\.2
10174Merging differences between 1\.1 and 1\.2 into temp\.txt
10175temp\.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===================================================================
10179RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10180retrieving revision 1\.2
10181diff -r1\.2 temp.txt
101821d0
10183< aaa"
10184
10185	  cp temp2.txt temp.txt
10186	  dotest_fail join6-4 "${testcvs} diff temp.txt" \
10187"Index: temp.txt
10188===================================================================
10189RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10190retrieving revision 1\.2
10191diff -r1\.2 temp\.txt
101924d3
10193< ddd"
10194
10195	  dotest join6-5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
10196"M temp\.txt
10197RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10198retrieving revision 1\.1
10199retrieving revision 1\.2
10200Merging 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
10206RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10207retrieving revision 1\.1
10208retrieving revision 1\.2
10209Merging differences between 1\.1 and 1\.2 into temp\.txt
10210rcsmerge: warning: conflicts during merge"
10211	  dotest_fail join6-9 "${testcvs} diff temp.txt" \
10212"Index: temp\.txt
10213===================================================================
10214RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10215retrieving revision 1\.2
10216diff -r1\.2 temp\.txt
102173a4,6
10218> <<<<<<< temp\.txt
10219> dddd
10220> =======
102214a8
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
10227new revision: 1\.3; previous revision: 1\.2
10228done"
10229          cp temp3.txt temp.txt
10230	  dotest_fail join6-11 "${testcvs} diff temp.txt" \
10231"Index: temp\.txt
10232===================================================================
10233RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10234retrieving revision 1\.3
10235diff -r1\.3 temp\.txt
102363a4
10237> ddd"
10238	  dotest join6-12 "${testcvs} update -j1.2 -j1.3 temp.txt" \
10239"M temp\.txt
10240RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
10241retrieving revision 1\.2
10242retrieving revision 1\.3
10243Merging 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
10255done
10256Checking in temp2\.txt;
10257${CVSROOT_DIRNAME}/join6/temp2\.txt,v  <--  temp2\.txt
10258initial revision: 1\.1
10259done"
10260	  dotest join6-23 "${testcvs} -q tag t2" \
10261"T temp.txt
10262T 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
10267new revision: 1\.4; previous revision: 1\.3
10268done"
10269	  dotest join6-25 "${testcvs} -q up -jt1 -jt2" \
10270"RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10271retrieving revision 1\.1
10272retrieving revision 1\.3
10273Merging differences between 1\.1 and 1\.3 into temp.txt
10274temp.txt already contains the differences between 1\.1 and 1\.3
10275temp2.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
10284new revision: delete; previous revision: 1\.1
10285done"
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
10292RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10293retrieving revision 1\.1
10294retrieving revision 1\.3
10295Merging differences between 1\.1 and 1\.3 into temp.txt
10296temp.txt already contains the differences between 1\.1 and 1\.3
10297${PROG} update: move away \./temp2\.txt; it is in the way
10298C temp2\.txt"
10299	  else
10300	    dotest join6-32 "${testcvs} -q up -jt1 -jt2" \
10301"RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
10302retrieving revision 1\.1
10303retrieving revision 1\.3
10304Merging differences between 1\.1 and 1\.3 into temp.txt
10305temp.txt already contains the differences between 1\.1 and 1\.3
10306${PROG} update: use .${PROG} add. to create an entry for temp2\.txt
10307U 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
10339new revision: 1\.2; previous revision: 1\.1
10340done"
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
10353retrieving revision 1\.1\.1\.1
10354retrieving revision 1\.1\.1\.2
10355Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10356rcsmerge: 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
10360retrieving revision 1\.1\.1\.1
10361retrieving revision 1\.1\.1\.2
10362Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10363rcsmerge: warning: conflicts during merge" \
10364"RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
10365retrieving revision 1\.1\.1\.1
10366retrieving revision 1\.1\.1\.2
10367Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
10368rcsmerge: 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
10402No 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
104091 conflicts created by this import.
10410Use 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
10419No 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
10425U combine/file\.txt
10426$PROG checkout: file combine/file\.txt has been removed in revision project-1, but the destination is incompatibly modified
10427C combine/file.txt
10428U 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
10436M combine/file\.txt
10437$PROG update: scheduling combine/file\.txt for removal
10438A 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
10474No 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
104811 conflicts created by this import.
10482Use 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
10491No 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
10497U combine/file\.txt
10498$PROG checkout: scheduling combine/file\.txt for removal
10499U 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
10538done
10539Checking in $file;
10540$CVSROOT_DIRNAME/$module/$file,v  <--  $file
10541initial revision: 1\.1
10542done"
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
10551new revision: 1\.1\.2\.1; previous revision: 1\.1
10552done"
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
10562retrieving revision 1\.1
10563retrieving revision 1\.1\.2\.1
10564Merging differences between 1\.1 and 1\.1\.2\.1 into $file
10565rcsmerge: warning: conflicts during merge
10566${PROG} update: conflicts found in $file
10567C $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
10585retrieving revision 1\.1
10586retrieving revision 1\.1\.2\.1
10587Merging differences between 1\.1 and 1\.1\.2\.1 into $file
10588rcsmerge: warning: conflicts during merge
10589${PROG} update: conflicts found in $file
10590C 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"===================================================================
10629File: 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
10661done
10662Checking in e;
10663${CVSROOT_DIRNAME}/x/e,v  <--  e
10664initial revision: 1\.1
10665done"
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
10673new revision: 1\.1\.2\.1; previous revision: 1\.1
10674done"
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
10684done
10685Checking in b;
10686${CVSROOT_DIRNAME}/x/b,v  <--  b
10687initial revision: 1\.1
10688done
10689Checking in e;
10690${CVSROOT_DIRNAME}/x/e,v  <--  e
10691new revision: 1\.2; previous revision: 1\.1
10692done"
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 .
10699U b
10700U e
10701RCS file: ${CVSROOT_DIRNAME}/x/e,v
10702retrieving revision 1\.1
10703retrieving revision 1\.2
10704Merging differences between 1\.1 and 1\.2 into e
10705e already contains the differences between 1\.1 and 1\.2
10706${QUESTION} e0" \
10707"${QUESTION} e0
10708${PROG} update: Updating .
10709U b
10710U e
10711RCS file: ${CVSROOT_DIRNAME}/x/e,v
10712retrieving revision 1\.1
10713retrieving revision 1\.2
10714Merging differences between 1\.1 and 1\.2 into e
10715e 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
10747done
10748Checking in a;
10749$CVSROOT_DIRNAME/join-rm/a,v  <--  a
10750initial revision: 1\.1
10751done
10752RCS file: $CVSROOT_DIRNAME/join-rm/b,v
10753done
10754Checking in b;
10755$CVSROOT_DIRNAME/join-rm/b,v  <--  b
10756initial revision: 1\.1
10757done
10758RCS file: $CVSROOT_DIRNAME/join-rm/c,v
10759done
10760Checking in c;
10761$CVSROOT_DIRNAME/join-rm/c,v  <--  c
10762initial revision: 1\.1
10763done
10764RCS file: $CVSROOT_DIRNAME/join-rm/d,v
10765done
10766Checking in d;
10767$CVSROOT_DIRNAME/join-rm/d,v  <--  d
10768initial revision: 1\.1
10769done
10770RCS file: $CVSROOT_DIRNAME/join-rm/e,v
10771done
10772Checking in e;
10773$CVSROOT_DIRNAME/join-rm/e,v  <--  e
10774initial revision: 1\.1
10775done
10776RCS file: $CVSROOT_DIRNAME/join-rm/f,v
10777done
10778Checking in f;
10779$CVSROOT_DIRNAME/join-rm/f,v  <--  f
10780initial revision: 1\.1
10781done
10782RCS file: $CVSROOT_DIRNAME/join-rm/g,v
10783done
10784Checking in g;
10785$CVSROOT_DIRNAME/join-rm/g,v  <--  g
10786initial revision: 1\.1
10787done"
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
10798new revision: delete; previous revision: 1\.1
10799done
10800Removing d;
10801$CVSROOT_DIRNAME/join-rm/d,v  <--  d
10802new revision: delete; previous revision: 1\.1
10803done
10804Removing g;
10805$CVSROOT_DIRNAME/join-rm/g,v  <--  g
10806new revision: delete; previous revision: 1\.1
10807done"
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
10821R d
10822R 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
10827new revision: delete; previous revision: 1\.1
10828done
10829Removing d;
10830$CVSROOT_DIRNAME/join-rm/d,v  <--  d
10831new revision: delete; previous revision: 1\.1
10832done
10833Removing g;
10834$CVSROOT_DIRNAME/join-rm/g,v  <--  g
10835new revision: delete; previous revision: 1\.1
10836done"
10837
10838	  # and verify that it was the head revision which was removed.
10839	  dotest join-rm-4 "$testcvs -q log b"  "
10840RCS file: $CVSROOT_DIRNAME/join-rm/Attic/b,v
10841Working file: b
10842head: 1\.2
10843branch:
10844locks: strict
10845access list:
10846symbolic names:
10847	br: 1\.1\.0\.2
10848keyword substitution: kv
10849total revisions: 3;	selected revisions: 3
10850description:
10851----------------------------
10852revision 1\.2
10853date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
10854save the merge
10855----------------------------
10856revision 1\.1
10857date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
10858branches:  1.1.2;
10859add-em
10860----------------------------
10861revision 1\.1\.2\.1
10862date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: ${PLUS}0 -0
10863rm
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
10872new revision: delete; previous revision: 1\.1
10873done"
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
10881U c
10882U e
10883U f'
10884
10885	  # and verify that there is no sticky tag
10886	  dotest join-rm-6 "$testcvs status a" \
10887"===================================================================
10888File: 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
10978done
10979Checking in a;
10980${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
10981initial revision: 1\.1
10982done"
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
11009new revision: delete; previous revision: 1\.1
11010done"
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===================================================================
11027File: 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
11064done
11065Checking in a;
11066${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11067initial revision: 1\.1
11068done"
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===================================================================
11077Checking out first-dir/a
11078RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
11079VERS: 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
11101new revision: 1\.2; previous revision: 1\.1
11102done"
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===================================================================
11112Checking out first-dir/a
11113RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
11114VERS: 1\.2
11115\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
11116add 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"===================================================================
11131File: 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
11140retrieving revision 1\.1
11141retrieving revision 1\.2
11142Merging differences between 1\.1 and 1\.2 into a
11143rcsmerge: warning: conflicts during merge
11144${PROG} update: conflicts found in a
11145C a"
11146		dotest conflicts-130 "${testcvs} -q update" \
11147"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11148retrieving revision 1\.1
11149retrieving revision 1\.2
11150Merging differences between 1\.1 and 1\.2 into a
11151rcsmerge: warning: conflicts during merge
11152${PROG} update: conflicts found in a
11153C a
11154${QUESTION} dir1
11155${QUESTION} sdir" \
11156"${QUESTION} dir1
11157${QUESTION} sdir
11158RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
11159retrieving revision 1\.1
11160retrieving revision 1\.2
11161Merging differences between 1\.1 and 1\.2 into a
11162rcsmerge: warning: conflicts during merge
11163${PROG} update: conflicts found in a
11164C a"
11165		rmdir dir1 sdir
11166
11167		dotest conflicts-status-1 "${testcvs} status a" \
11168"===================================================================
11169File: 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"===================================================================
11199File: 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
11208Checking in a;
11209${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11210new revision: 1\.3; previous revision: 1\.2
11211done"
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"===================================================================
11218File: 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
11228new revision: 1\.4; previous revision: 1\.3
11229done"
11230		dotest conflicts-status-7 "${testcvs} status a" \
11231"===================================================================
11232File: 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
11331done
11332Checking in a;
11333${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
11334initial revision: 1\.1
11335done
11336RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
11337done
11338Checking in abc;
11339${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
11340initial revision: 1\.1
11341done"
11342
11343	  cd ../..
11344	  mkdir 2
11345	  cd 2
11346
11347	  dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
11348U 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
11362new revision: 1\.2; previous revision: 1\.1
11363done"
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
11371C 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"===================================================================
11378File: 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
11428new revision: delete; previous revision: 1\.1
11429done"
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
11450done
11451Checking in aa\.c;
11452${CVSROOT_DIRNAME}/first-dir/aa\.c,v  <--  aa\.c
11453initial revision: 1\.1
11454done
11455RCS file: ${CVSROOT_DIRNAME}/first-dir/same\.c,v
11456done
11457Checking in same\.c;
11458${CVSROOT_DIRNAME}/first-dir/same\.c,v  <--  same\.c
11459initial revision: 1\.1
11460done"
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
11476C aa\.c
11477${PROG} update: move away \./same\.c; it is in the way
11478C 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
11482C aa\.c
11483U 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===================================================================
11488File: 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
11546done
11547Checking in file1;
11548${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11549initial revision: 1\.1
11550done
11551RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
11552done
11553Checking in file2;
11554${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11555initial revision: 1\.1
11556done"
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
11562U file2"
11563	  dotest_fail conflicts3-7 "test -f file1" ''
11564	  dotest conflicts3-8 "${testcvs} -q update" \
11565"U file1
11566U 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
11577new revision: delete; previous revision: 1\.1
11578done
11579Removing file2;
11580${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11581new revision: delete; previous revision: 1\.1
11582done"
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
11602done
11603Checking in sdir/sfile;
11604${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
11605initial revision: 1\.1
11606done"
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
11672C 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
11693new revision: delete; previous revision: 1\.1
11694done"
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
11722done
11723Checking in file1;
11724$CVSROOT_DIRNAME/first-dir/file1,v  <--  file1
11725initial revision: 1\.1
11726done"
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
11734new revision: 1\.2; previous revision: 1\.1
11735done"
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
11740retrieving revision 1\.1
11741retrieving revision 1\.2
11742Merging differences between 1\.1 and 1\.2 into file1
11743rcsmerge: warning: conflicts during merge
11744cvs 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.
11756echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option"
11757echo "ok"
11758echo "MT text C "
11759echo "MT fname file1"
11760echo "MT newline"
11761echo "error  "
11762cat >$TESTDIR/conflicts4/client.out
11763EOF
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
11775Argument --
11776Directory .
11777$CVSROOT_DIRNAME/first-dir
11778Entry /file1/1.2/$PLUS=//
11779Modified file1
11780u=.*,g=.*,o=.*
1178159
11782baseline
11783""<<<<<<< file1
11784wibble1
11785""=======
11786wibble2
11787"">>>>>>> 1.2
11788update"
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.
11797echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option Empty-conflicts"
11798echo "ok"
11799echo "MT text C "
11800echo "MT fname file1"
11801echo "MT newline"
11802echo "error  "
11803cat >$TESTDIR/conflicts4/client.out
11804EOF
11805
11806	    dotest_fail conflicts4-12r "$testcvs -q up" "C file1"
11807	    dotest conflicts4-13r "cat $TESTDIR/conflicts4/client.out" \
11808"$DOTSTAR
11809Argument --
11810Directory .
11811$CVSROOT_DIRNAME/first-dir
11812Entry /file1/1.2/$PLUS=//
11813Unchanged file1
11814update"
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
11843done
11844Checking in cleanme\.txt;
11845${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
11846initial revision: 1\.1
11847done"
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)
11859U 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\.
11863fish"
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)
11873U 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\.
11877bluegill"
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
11888new revision: 1\.2; previous revision: 1\.1
11889done"
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
11894retrieving revision 1\.1
11895retrieving revision 1\.2
11896Merging differences between 1\.1 and 1\.2 into cleanme\.txt
11897rcsmerge: warning: conflicts during merge
11898${PROG} update: conflicts found in cleanme\.txt
11899C cleanme\.txt"
11900	  dotest clean-18 "${testcvs} -q update -C" \
11901"(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
11902U cleanme\.txt"
11903	  dotest clean-19 "cat .#cleanme.txt.1.1" \
11904"The usual boring test text\.
11905fish"
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
11938U CVSROOT/commitinfo
11939U CVSROOT/config
11940U CVSROOT/cvswrappers
11941U CVSROOT/editinfo
11942U CVSROOT/loginfo
11943U CVSROOT/modules
11944U CVSROOT/notify
11945U CVSROOT/rcsinfo
11946U CVSROOT/taginfo
11947U 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
11952new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11953done
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
11962U CVSROOT/commitinfo
11963U CVSROOT/config
11964U CVSROOT/cvswrappers
11965U CVSROOT/editinfo
11966U CVSROOT/loginfo
11967U CVSROOT/modules
11968U CVSROOT/notify
11969U CVSROOT/rcsinfo
11970U CVSROOT/taginfo
11971U 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
11976new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11977done
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
11989U CVSROOT/commitinfo
11990U CVSROOT/config
11991U CVSROOT/cvswrappers
11992U CVSROOT/editinfo
11993U CVSROOT/loginfo
11994U CVSROOT/modules
11995U CVSROOT/notify
11996U CVSROOT/rcsinfo
11997U CVSROOT/taginfo
11998U 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
12003new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12004done
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
12041RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
12042done
12043Checking in a;
12044${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
12045initial revision: 1\.1
12046done
12047RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
12048done
12049Checking in b;
12050${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
12051initial revision: 1\.1
12052done"
12053
12054	  cd ..
12055	  dotest modules-146 "${testcvs} -q co CVSROOT" \
12056"U CVSROOT/checkoutlist
12057U CVSROOT/commitinfo
12058U CVSROOT/config
12059U CVSROOT/cvswrappers
12060U CVSROOT/editinfo
12061U CVSROOT/loginfo
12062U CVSROOT/modules
12063U CVSROOT/notify
12064U CVSROOT/rcsinfo
12065U CVSROOT/taginfo
12066U 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
12075realmodule first-dir/subdir a
12076dirmodule first-dir/subdir
12077namedmodule -d nameddir first-dir/subdir
12078aliasmodule -a first-dir/subdir/a
12079aliasnested -a first-dir/subdir/ssdir
12080topfiles -a first-dir/file1 first-dir/file2
12081world -a .
12082statusmod -s Mungeable
12083# Check for ability to block infinite loops.
12084infinitealias -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).
12088infinitealias2 -a infinitealias2/
12089infinitealias3 -a infinitealias4/
12090infinitealias4 -a aliasmodule infinitealias5
12091infinitealias5 -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.
12095bogusalias first-dir/subdir/a -a
12096EOF
12097	  dotest modules-148 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
12098"Checking in CVSROOT/modules;
12099${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12100new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12101done
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
12110aliasnested  -a first-dir/subdir/ssdir
12111bogusalias   first-dir/subdir/a -a
12112dirmodule    first-dir/subdir
12113infinitealias -a infinitealias
12114infinitealias2 -a infinitealias2/
12115infinitealias3 -a infinitealias4/
12116infinitealias4 -a aliasmodule infinitealias5
12117infinitealias5 -a infinitealias3/
12118namedmodule  -d nameddir first-dir/subdir
12119realmodule   first-dir/subdir a
12120statusmod    -s Mungeable
12121topfiles     -a first-dir/file1 first-dir/file2
12122world        -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  
12128bogusalias   NONE        first-dir/subdir/a -a
12129dirmodule    NONE        first-dir/subdir
12130namedmodule  NONE        first-dir/subdir
12131realmodule   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\.
12158Are 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\.
12171Are 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
12190U 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\.
12198Are 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
12220first-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}
12229U first-dir/subdir/a
12230U 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
12241U 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
12252done
12253Checking in file1;
12254${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12255initial revision: 1\.1
12256done
12257RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
12258done
12259Checking in file2;
12260${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
12261initial revision: 1\.1
12262done"
12263
12264	  cd ..
12265	  rm -r first-dir
12266	  dotest modules-155c4 "${testcvs} -q co topfiles" \
12267"U first-dir/file1
12268U 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
12278new revision: delete; previous revision: 1\.1
12279done"
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
12284U 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
12300Directory ${CVSROOT_DIRNAME}/second-dir added to the repository
12301Directory ${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
12309done
12310Checking in file3;
12311${CVSROOT_DIRNAME}/third-dir/file3,v  <--  file3
12312initial revision: 1\.1
12313done"
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
12324ampermodule &first-dir &second-dir
12325combmodule third-dir file3 &first-dir
12326ampdirmod -d newdir &first-dir &second-dir
12327badmod -d newdir
12328messymod first-dir &messymodchild
12329messymodchild -d sdir/child second-dir
12330EOF
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
12336new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12337done
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}
12350yes
12351yes
12352EOF
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
12403A 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
12409done
12410Checking in ampermodule/first-dir/amper1;
12411${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
12412initial revision: 1\.1
12413done"
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
12420done
12421Checking in first-dir/amper1;
12422${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
12423initial revision: 1\.1
12424done"
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
12436U 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
12464U 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
12535new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12536done
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
12570done
12571Checking in file1;
12572${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12573initial revision: 1\.1
12574done"
12575	  cd ..
12576
12577	  dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
12578"U CVSROOT${DOTSTAR}"
12579	  cd CVSROOT
12580	  cat >modules <<EOF
12581mod1 -a first-dir/file1
12582bigmod -a mod1 first-dir/file1
12583namednest -d src/sub/dir first-dir
12584nestdeeper -d src/sub1/sub2/sub3/dir first-dir
12585nestshallow -d src/dir second-dir/suba/subb
12586path/in/modules &mod1
12587another/path/test -d another/path/test first-dir
12588EOF
12589	  dotest modules3-5 "${testcvs} -q ci -m add-modules" \
12590"Checking in modules;
12591${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12592new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12593done
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
12614No conflicts created by this import" "
12615No 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
12643done
12644Checking in fileb;
12645${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v  <--  fileb
12646initial revision: 1\.1
12647done"
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
12740Directory ${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
12759done
12760Checking in file1;
12761${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12762initial revision: 1\.1
12763done
12764RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
12765done
12766Checking in subdir/file2;
12767${CVSROOT_DIRNAME}/first-dir/subdir/file2,v  <--  file2
12768initial revision: 1\.1
12769done
12770RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v
12771done
12772Checking in subdir_long/file3;
12773${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v  <--  file3
12774initial revision: 1\.1
12775done"
12776
12777	  cd ..
12778
12779	  dotest modules4-8 "${testcvs} -q update -d CVSROOT" \
12780"U CVSROOT${DOTSTAR}"
12781	  cd CVSROOT
12782	  cat >modules <<EOF
12783all -a first-dir
12784some -a !first-dir/subdir first-dir
12785other -a !first-dir/subdir !first-dir/subdir_long first-dir
12786somewhat -a first-dir !first-dir/subdir
12787EOF
12788	  dotest modules4-9 "${testcvs} -q ci -m add-modules" \
12789"Checking in modules;
12790${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
12791new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12792done
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
12801U first-dir/subdir/file2
12802U first-dir/subdir_long/file3"
12803	  rm -r first-dir
12804
12805	  dotest modules4-11 "${testcvs} -q co some" \
12806"U first-dir/file1
12807U 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
12816U 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
12826U first-dir/subdir/file2
12827U 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" "
12849RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
12850Working file: file2
12851head: 1\.1
12852branch:
12853locks: strict
12854access list:
12855symbolic names:
12856keyword substitution: kv
12857total revisions: 1;	selected revisions: 1
12858description:
12859----------------------------
12860revision 1\.1
12861date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
12862add-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
12900RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
12901done
12902Checking in a;
12903${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
12904initial revision: 1\.1
12905done
12906RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
12907done
12908Checking in b;
12909${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
12910initial revision: 1\.1
12911done"
12912
12913	  cd ..
12914	  dotest modules5-6 "${testcvs} -q co CVSROOT" \
12915"U CVSROOT/checkoutlist
12916U CVSROOT/commitinfo
12917U CVSROOT/config
12918U CVSROOT/cvswrappers
12919U CVSROOT/editinfo
12920U CVSROOT/loginfo
12921U CVSROOT/modules
12922U CVSROOT/notify
12923U CVSROOT/rcsinfo
12924U CVSROOT/taginfo
12925U 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
12933sleep 1
12934echo "$i script invoked in \`pwd\`"
12935echo "args: \$@"
12936EOF
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
12947realmodule ${OPTS} first-dir/subdir a
12948dirmodule ${OPTS} first-dir/subdir
12949namedmodule -d nameddir ${OPTS} first-dir/subdir
12950EOF
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
12956new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
12957done
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..
12975checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
12976args: realmodule"
12977	  else
12978	    dotest modules5-8 "${testcvs} co realmodule" \
12979"U realmodule/a
12980${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
12981checkout script invoked in ${TESTDIR}/1
12982args: 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]*
12989args: 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
12995new revision: 1\.2; previous revision: 1\.1
12996done"
12997	  else
12998	    dotest modules5-11 "${testcvs} -q co realmodule" \
12999"checkout script invoked in ${TESTDIR}/1
13000args: 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
13006new revision: 1\.2; previous revision: 1\.1
13007done"
13008	  fi
13009	  dotest modules5-14 "echo yes | ${testcvs} release -d realmodule" \
13010"You have \[0\] altered files in this repository\.
13011Are 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
13014args: realmodule MYTAG" \
13015"tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13016args: realmodule MYTAG"
13017	  if $remote; then
13018	    dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
13019"U realmodule/a
13020export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13021args: realmodule"
13022	  else
13023	    dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
13024"U realmodule/a
13025export script invoked in ${TESTDIR}/1
13026args: 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..
13040checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13041args: dirmodule"
13042	  else
13043	    dotest modules5-18 "${testcvs} co dirmodule/a" \
13044"U dirmodule/a
13045${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
13046checkout script invoked in ${TESTDIR}/1
13047args: 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\.
13053Are 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..
13065checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13066args: 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..
13071checkout script invoked in ${TESTDIR}/1
13072args: 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
13085U nameddir/b
13086checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13087args: nameddir"
13088	  else
13089	    dotest modules5-24 "${testcvs} -q co namedmodule" \
13090"U nameddir/a
13091U nameddir/b
13092checkout script invoked in ${TESTDIR}/1
13093args: 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
13103checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13104args: nameddir"
13105	  else
13106	    dotest modules5-26 "${testcvs} -q co namedmodule" \
13107"M nameddir/a
13108checkout script invoked in ${TESTDIR}/1
13109args: nameddir"
13110	  fi
13111	  rm nameddir/a
13112
13113	  if $remote; then
13114	    dotest modules5-27 "${testcvs} -q co namedmodule" \
13115"U nameddir/a
13116checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13117args: nameddir"
13118	  else
13119	    dotest modules5-27 "${testcvs} -q co namedmodule" \
13120"U nameddir/a
13121checkout script invoked in ${TESTDIR}/1
13122args: nameddir"
13123	  fi
13124	  dotest modules5-28 "echo yes | ${testcvs} release -d nameddir" \
13125"You have \[0\] altered files in this repository\.
13126Are 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..
13135checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13136args: 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..
13141checkout script invoked in ${TESTDIR}/1
13142args: 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]*
13149args: 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
13155new revision: 1\.3; previous revision: 1\.2
13156done"
13157	  else
13158	    dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
13159"checkout script invoked in ${TESTDIR}/1
13160args: 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
13166new revision: 1\.3; previous revision: 1\.2
13167done"
13168	  fi
13169	  dotest modules5-35 "echo yes | ${testcvs} release -d mydir" \
13170"You have \[0\] altered files in this repository\.
13171Are 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]*
13175args: realmodule MYTAG2"
13176	    dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
13177"U mydir/a
13178export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13179args: mydir"
13180	  else
13181	    dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
13182"tag script invoked in ${TESTDIR}/1
13183args: realmodule MYTAG2"
13184	    dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
13185"U mydir/a
13186export script invoked in ${TESTDIR}/1
13187args: 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..
13196checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13197args: 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..
13202checkout script invoked in ${TESTDIR}/1
13203args: 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\.
13209Are 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..
13221checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13222args: 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..
13227checkout script invoked in ${TESTDIR}/1
13228args: 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
13239U mydir/b
13240checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13241args: mydir"
13242	  else
13243	    dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
13244"U mydir/a
13245U mydir/b
13246checkout script invoked in ${TESTDIR}/1
13247args: 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
13258checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13259args: mydir"
13260	  else
13261	    dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
13262"M mydir/a
13263checkout script invoked in ${TESTDIR}/1
13264args: 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
13271checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
13272args: mydir"
13273	  else
13274	    dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
13275"U mydir/a
13276checkout script invoked in ${TESTDIR}/1
13277args: mydir"
13278	  fi
13279	  dotest modules5-49 "echo yes | ${testcvs} release -d mydir" \
13280"You have \[0\] altered files in this repository\.
13281Are 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
13312new revision: [0-9.]*; previous revision: [0-9.]*
13313done
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
13331new revision: [0-9.]*; previous revision: [0-9.]*
13332done
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
13361done
13362Checking in file1;
13363$CVSROOT_DIRNAME/one/file1,v  <--  file1
13364initial revision: 1\.1
13365done"
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
13372new revision: [0-9.]*; previous revision: [0-9.]*
13373done
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
13390U 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
13404new revision: [0-9.]*; previous revision: [0-9.]*
13405done
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
13426new revision: 1\.2; previous revision: 1\.1
13427done
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
13439new revision: 1\.3; previous revision: 1\.2
13440done
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
13452new revision: 1\.4; previous revision: 1\.3
13453done
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
13461new revision: 1\.5; previous revision: 1\.4
13462done
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
13487done
13488Checking in file1;
13489$CVSROOT_DIRNAME/co-d/file1,v  <--  file1
13490initial revision: 1\.1
13491done
13492RCS file: $CVSROOT_DIRNAME/co-d/file2,v
13493done
13494Checking in file2;
13495$CVSROOT_DIRNAME/co-d/file2,v  <--  file2
13496initial revision: 1\.1
13497done"
13498	  cd ../..
13499
13500	  mkdir 2; cd 2
13501	  dotest co-d-1 "$testcvs -q co -d dir $module" \
13502"U dir/file1
13503U 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
13519U 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
13537U 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
13548U 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
13616new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13617done
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
13654Checking in CVSROOT/modules;
13655${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
13656new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13657done
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
13673Directory ${CVSROOT_DIRNAME}/mod1-2 added to the repository
13674Directory ${CVSROOT_DIRNAME}/mod2 added to the repository
13675Directory ${CVSROOT_DIRNAME}/mod2/sub2 added to the repository
13676Directory ${CVSROOT_DIRNAME}/mod2-2 added to the repository
13677Directory ${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
13698RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
13699done
13700Checking in mod1/file1;
13701${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
13702initial revision: 1.1
13703done
13704RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
13705done
13706Checking in mod1-2/file1-2;
13707${CVSROOT_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
13708initial revision: 1.1
13709done
13710RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
13711done
13712Checking in mod2/sub2/file2;
13713${CVSROOT_DIRNAME}/mod2/sub2/file2,v  <--  file2
13714initial revision: 1.1
13715done
13716RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
13717done
13718Checking in mod2-2/sub2-2/file2-2;
13719${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v  <--  file2-2
13720initial revision: 1.1
13721done"
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
13737U 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
13744U 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
13751U 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
13758U 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
13765U 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
13773U 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
13788U 1mod/file1
13789${PROG} checkout: Updating 1mod-2
13790U 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
13802U 1mod/file1
13803${PROG} checkout: Updating 2mod
13804U 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
13815U 1mod/file1
13816${PROG} checkout: Updating dir1d1
13817U 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
13828U 1mod/file1
13829${PROG} checkout: Updating dir1d2
13830U 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
13841U 1mod/file1
13842${PROG} checkout: Updating dir2d1/sub2d1
13843U 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
13855U 1mod/file1
13856${PROG} checkout: Updating dir2d2/sub2d2
13857U 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
13872U 2mod/file2
13873${PROG} checkout: Updating 2mod-2
13874U 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
13886U 2mod/file2
13887${PROG} checkout: Updating dir1d1
13888U 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
13899U 2mod/file2
13900${PROG} checkout: Updating dir1d2
13901U 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
13912U 2mod/file2
13913${PROG} checkout: Updating dir2d1/sub2d1
13914U 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
13926U 2mod/file2
13927${PROG} checkout: Updating dir2d2/sub2d2
13928U 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
13943U dir1d1/file1
13944${PROG} checkout: Updating dir1d1-2
13945U 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
13956U dir1d1/file1
13957${PROG} checkout: Updating dir1d2
13958U 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
13969U dir1d1/file1
13970${PROG} checkout: Updating dir2d1/sub2d1
13971U 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
13983U dir1d1/file1
13984${PROG} checkout: Updating dir2d2/sub2d2
13985U 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
14000U dir1d2/file2
14001${PROG} checkout: Updating dir1d2-2
14002U 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
14013U dir1d2/file2
14014${PROG} checkout: Updating dir2d1/sub2d1
14015U 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
14027U dir1d2/file2
14028${PROG} checkout: Updating dir2d2/sub2d2
14029U 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
14044U dir2d1/sub2d1/file1
14045${PROG} checkout: Updating dir2d1-2/sub2d1-2
14046U 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
14059U dir2d1/sub2d1/file1
14060${PROG} checkout: Updating dir2d2/sub2d2
14061U 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
14077U dir2d2/sub2d2/file2
14078${PROG} checkout: Updating dir2d2-2/sub2d2-2
14079U 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
14098U 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
14105U 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
14112U 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
14119U 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
14126U 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
14133U 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
14146U dir/1mod/file1
14147${PROG} checkout: Updating dir/1mod-2
14148U 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
14162U dir/1mod/file1
14163${PROG} checkout: Updating dir/2mod
14164U 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
14176U dir/1mod/file1
14177${PROG} checkout: Updating dir/dir1d1
14178U 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
14190U dir/1mod/file1
14191${PROG} checkout: Updating dir/dir1d2
14192U 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
14204U dir/1mod/file1
14205${PROG} checkout: Updating dir/dir2d1/sub2d1
14206U 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
14219U dir/1mod/file1
14220${PROG} checkout: Updating dir/dir2d2/sub2d2
14221U 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
14237U dir/2mod/file2
14238${PROG} checkout: Updating dir/2mod-2
14239U 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
14251U dir/2mod/file2
14252${PROG} checkout: Updating dir/dir1d1
14253U 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
14265U dir/2mod/file2
14266${PROG} checkout: Updating dir/dir1d2
14267U 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
14279U dir/2mod/file2
14280${PROG} checkout: Updating dir/dir2d1/sub2d1
14281U 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
14294U dir/2mod/file2
14295${PROG} checkout: Updating dir/dir2d2/sub2d2
14296U 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
14312U dir/dir1d1/file1
14313${PROG} checkout: Updating dir/dir1d1-2
14314U 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
14326U dir/dir1d1/file1
14327${PROG} checkout: Updating dir/dir1d2
14328U 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
14340U dir/dir1d1/file1
14341${PROG} checkout: Updating dir/dir2d1/sub2d1
14342U 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
14355U dir/dir1d1/file1
14356${PROG} checkout: Updating dir/dir2d2/sub2d2
14357U 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
14373U dir/dir1d2/file2
14374${PROG} checkout: Updating dir/dir1d2-2
14375U 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
14387U dir/dir1d2/file2
14388${PROG} checkout: Updating dir/dir2d1/sub2d1
14389U 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
14402U dir/dir1d2/file2
14403${PROG} checkout: Updating dir/dir2d2/sub2d2
14404U 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
14420U dir/dir2d1/sub2d1/file1
14421${PROG} checkout: Updating dir/dir2d1-2/sub2d1-2
14422U 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
14437U dir/dir2d1/sub2d1/file1
14438${PROG} checkout: Updating dir/dir2d2/sub2d2
14439U 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
14456U dir/dir2d2/sub2d2/file2
14457${PROG} checkout: Updating dir/dir2d2-2/sub2d2-2
14458U 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
14486U 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
14495U 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
14503U 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
14511U 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
14519U 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
14527U 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
14539U 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
14546U 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
14553U 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
14560U 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
14567U 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
14575U 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
14585U 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
14593U 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
14601U 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
14609U 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
14617U 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
14626U 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
14639U 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
14648U 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
14657U 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
14666U 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
14675U 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
14686U 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
14707new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14708done
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
14742Checking in CVSROOT/modules;
14743${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
14744new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14745done
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
14767done
14768Checking in mod1/file1;
14769${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
14770initial revision: 1\.1
14771done
14772RCS file: ${CVSROOT_DIRNAME}/moda/modasub/filea,v
14773done
14774Checking in moda/modasub/filea;
14775${CVSROOT_DIRNAME}/moda/modasub/filea,v  <--  filea
14776initial revision: 1\.1
14777done"
14778	  rm -rf mod1 moda CVS
14779	  # End Populate.
14780
14781	  dotest emptydir-6 "${testcvs} co 2d1mod" \
14782"${PROG} checkout: Updating dir2d1/sub/sub2d1
14783U 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
14833U 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
14881RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
14882done
14883Checking in mod1/file1;
14884${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
14885initial revision: 1.1
14886done
14887RCS file: ${CVSROOT_DIRNAME}/mod2/file2,v
14888done
14889Checking in mod2/file2;
14890${CVSROOT_DIRNAME}/mod2/file2,v  <--  file2
14891initial revision: 1.1
14892done"
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
14903U 1/file1"
14904	  else
14905	    dotest abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
14906"${PROG} checkout: Updating ${TESTDIR}/1
14907U ${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
14942U 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
14948U ${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
14976U 1/mod1/file1
14977${PROG} checkout: Updating 1/mod2
14978U 1/mod2/file2"
14979	  else
14980	    dotest abspath-5a "${testcvs} co -d ${TESTDIR}/1 mod1 mod2" \
14981"${PROG} checkout: Updating ${TESTDIR}/1/mod1
14982U ${TESTDIR}/1/mod1/file1
14983${PROG} checkout: Updating ${TESTDIR}/1/mod2
14984U ${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
15000U 1/mod1/file1
15001${PROG} checkout: Updating 1/mod2
15002U 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
15009U ${TESTDIR}/1/mod1/file1
15010${PROG} checkout: Updating ${TESTDIR}/1/mod2
15011U ${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
15097new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15098done
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
15108Directory ${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
15117done
15118Checking in file1;
15119${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
15120initial revision: 1\.1
15121done"
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
15131done
15132Checking in file2;
15133${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
15134initial revision: 1\.1
15135done"
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
15141U 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
15172U 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
15210new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15211done
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
15231new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15232done
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
15243Directory ${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
15252done
15253Checking in file1;
15254${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
15255initial revision: 1\.1
15256done"
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
15266done
15267Checking in file2;
15268${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
15269initial revision: 1\.1
15270done"
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
15276U 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
15293U 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
15306new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
15307done
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"
15324RCS 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
15345done
15346Checking in topfile;
15347$CVSROOT_DIRNAME/topfile,v  <--  topfile
15348initial revision: 1\.1
15349done"
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
15388C CVSROOT/checkoutlist
15389${PROG} checkout: move away CVSROOT/commitinfo; it is in the way
15390C CVSROOT/commitinfo
15391${PROG} checkout: move away CVSROOT/config; it is in the way
15392C CVSROOT/config
15393${PROG} checkout: move away CVSROOT/cvswrappers; it is in the way
15394C CVSROOT/cvswrappers
15395${PROG} checkout: move away CVSROOT/editinfo; it is in the way
15396C CVSROOT/editinfo
15397${PROG} checkout: move away CVSROOT/loginfo; it is in the way
15398C CVSROOT/loginfo
15399${PROG} checkout: move away CVSROOT/modules; it is in the way
15400C CVSROOT/modules
15401${PROG} checkout: move away CVSROOT/notify; it is in the way
15402C CVSROOT/notify
15403${PROG} checkout: move away CVSROOT/rcsinfo; it is in the way
15404C CVSROOT/rcsinfo
15405${PROG} checkout: move away CVSROOT/taginfo; it is in the way
15406C CVSROOT/taginfo
15407${PROG} checkout: move away CVSROOT/verifymsg; it is in the way
15408C CVSROOT/verifymsg"
15409
15410          dotest checkout_repository-3 \
15411"${testcvs} co -p CVSROOT/modules >/dev/null" \
15412"===================================================================
15413Checking out CVSROOT/modules
15414RCS:  ${CVSROOT_DIRNAME}/CVSROOT/modules,v
15415VERS: 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}
15484sleep 1
15485sed <\$1 -e 's/^/x/' >${TESTDIR}/edit.new
15486mv ${TESTDIR}/edit.new \$1
15487exit 0
15488EOF
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
15504done
15505Checking in file1;
15506${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15507initial revision: 1\.1
15508done
15509RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15510done
15511Checking in file2;
15512${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
15513initial revision: 1\.1
15514done"
15515	  dotest editor-5 "${testcvs} -q tag -b br" "T file1
15516T file2"
15517	  dotest editor-6 "$testcvs -q update -r br" \
15518'U file1
15519U 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
15524new revision: 1\.1\.2\.1; previous revision: 1\.1
15525done"
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
15533U 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
15538new revision: 1\.1\.2\.1; previous revision: 1\.1
15539done"
15540
15541	  dotest editor-log-file1 "${testcvs} log -N file1" "
15542RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15543Working file: file1
15544head: 1\.1
15545branch:
15546locks: strict
15547access list:
15548keyword substitution: kv
15549total revisions: 2;	selected revisions: 2
15550description:
15551----------------------------
15552revision 1\.1
15553date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15554branches:  1\.1\.2;
15555xCVS: ----------------------------------------------------------------------
15556xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15557xCVS:
15558xCVS: Committing in .
15559xCVS:
15560xCVS: Added Files:
15561xCVS: 	file1 file2
15562xCVS: ----------------------------------------------------------------------
15563----------------------------
15564revision 1\.1\.2\.1
15565date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15566xCVS: ----------------------------------------------------------------------
15567xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15568xCVS:
15569xCVS: Committing in .
15570xCVS:
15571xCVS: Modified Files:
15572xCVS:  Tag: br
15573xCVS: 	file1
15574xCVS: ----------------------------------------------------------------------
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" "
15580RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15581Working file: file2
15582head: 1\.1
15583branch:
15584locks: strict
15585access list:
15586keyword substitution: kv
15587total revisions: 2;	selected revisions: 2
15588description:
15589----------------------------
15590revision 1\.1
15591date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15592branches:  1\.1\.2;
15593xCVS: ----------------------------------------------------------------------
15594xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15595xCVS:
15596xCVS: Committing in .
15597xCVS:
15598xCVS: Added Files:
15599xCVS: 	file1 file2
15600xCVS: ----------------------------------------------------------------------
15601----------------------------
15602revision 1\.1\.2\.1
15603date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15604xCVS: ----------------------------------------------------------------------
15605xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15606xCVS:
15607xCVS: Modified Files:
15608xCVS:  Tag: br
15609xCVS: 	file2
15610xCVS: ----------------------------------------------------------------------
15611=============================================================================" "
15612RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15613Working file: file2
15614head: 1\.1
15615branch:
15616locks: strict
15617access list:
15618keyword substitution: kv
15619total revisions: 2;	selected revisions: 2
15620description:
15621----------------------------
15622revision 1\.1
15623date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
15624branches:  1\.1\.2;
15625xCVS: ----------------------------------------------------------------------
15626xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15627xCVS:
15628xCVS: Committing in .
15629xCVS:
15630xCVS: Added Files:
15631xCVS: 	file1 file2
15632xCVS: ----------------------------------------------------------------------
15633----------------------------
15634revision 1\.1\.2\.1
15635date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
15636xCVS: ----------------------------------------------------------------------
15637xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
15638xCVS:
15639xCVS: Committing in .
15640xCVS:
15641xCVS: Modified Files:
15642xCVS:  Tag: br
15643xCVS: 	file2
15644xCVS: ----------------------------------------------------------------------
15645============================================================================="
15646
15647	  # Test CVS's response to an unchanged log message
15648	  cat >${TESTDIR}/editme <<EOF
15649#!${TESTSHELL}
15650sleep 1
15651exit 0
15652EOF
15653	  chmod +x ${TESTDIR}/editme
15654	  dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15655"
15656Log message unchanged or not specified
15657a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15658Action: (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}
15663sleep 1
15664cat /dev/null >\$1
15665exit 0
15666EOF
15667	  chmod +x ${TESTDIR}/editme
15668	  dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15669"
15670Log message unchanged or not specified
15671a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15672Action: (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}
15677sleep 1
15678echo >\$1
15679exit 0
15680EOF
15681	  chmod +x ${TESTDIR}/editme
15682	  dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15683"
15684Log message unchanged or not specified
15685a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15686Action: (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}
15691sleep 1
15692cat \$1 >${TESTDIR}/edit.new
15693mv ${TESTDIR}/edit.new \$1
15694exit 0
15695EOF
15696	  chmod +x ${TESTDIR}/editme
15697	  dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
15698"
15699Log message unchanged or not specified
15700a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15701Action: (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
15715new revision: 1\.2; previous revision: 1\.1
15716done
15717${PROG} commit: Rebuilding administrative file database"
15718
15719	  cd ../first-dir
15720	  cat >${TESTDIR}/editme <<EOF
15721#!${TESTSHELL}
15722sleep 1
15723cp /dev/null \$1
15724exit 1
15725EOF
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
15730Log message unchanged or not specified
15731a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
15732Action: (continue) Checking in file1;
15733${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15734new revision: 1\.2; previous revision: 1\.1
15735done"
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
15743Update of ${CVSROOT_DIRNAME}/first-dir
15744In directory ${hostname}:${TMPDIR}/cvs-serv[0-9a-z]*
15745
15746Modified Files:
15747	file1 
15748Log Message:
15749
15750End-Log"
15751          else
15752	    dotest editor-emptylog-continue-4 \
15753"cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
15754"Start-Log
15755Update of ${CVSROOT_DIRNAME}/first-dir
15756In directory ${hostname}:${TESTDIR}/1/first-dir
15757
15758Modified Files:
15759	file1 
15760Log Message:
15761
15762End-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"
15767RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15768Working file: file1
15769head: 1\.2
15770branch:
15771locks: strict
15772access list:
15773keyword substitution: kv
15774total revisions: 3;	selected revisions: 1
15775description:
15776----------------------------
15777revision 1\.2
15778date: [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
15900done
15901Checking in file1;
15902${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15903initial revision: 1\.1
15904done"
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
15924Directory ${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
15928done
15929Checking in file10;
15930${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
15931initial revision: 1\.1
15932done"
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
15974done
15975Checking in first-dir/file15;
15976${CVSROOT_DIRNAME}/first-dir/file15,v  <--  file15
15977initial revision: 1\.1
15978done
15979RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v
15980done
15981Checking in first-dir/sdir10/ssdir/ssfile;
15982${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v  <--  ssfile
15983initial revision: 1\.1
15984done"
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
16033done
16034Checking in file1;
16035${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v  <--  file1
16036initial revision: 1\.1
16037done"
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
16085done
16086Checking in abb;
16087${CVSROOT_DIRNAME}/first-dir/abb,v  <--  abb
16088initial revision: 1\.1
16089done"
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
16102done
16103Checking in abc;
16104${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
16105initial revision: 1\.1
16106done"
16107
16108	  cd ../..
16109	  mkdir 2
16110	  cd 2
16111
16112	  dotest devcom-8 "${testcvs} -q co first-dir" \
16113"U first-dir/abb
16114U 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
16136new revision: 1\.2; previous revision: 1\.1
16137done"
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
16174abc	${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
16183T 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
16205U 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
16218U 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
16236U 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
16290U first-dir/w1
16291U first-dir/w2
16292U 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=
16311Fw2	_watched=
16312Fw3	_watched=
16313Fnw1	_watched=
16314D	_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
16320U first${PLUS}dir/w1
16321U first${PLUS}dir/w2
16322U 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=
16330Fw2	_watched=
16331Fw3	_watched=
16332Fnw1	_watched=
16333D	_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=
16360Fw2	_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
16364Enew	line	here
16365G@#$^!@#=&
16366EOF
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=
16374G@#..!@#=&
16375Enew	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=
16388Fw1	_watched=
16389Enew	line	here
16390G@#..!@#=&"
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
16459done
16460Checking in file1;
16461${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16462initial revision: 1\.1
16463done"
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
16475done
16476Checking in sfile;
16477${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
16478initial revision: 1\.1
16479done"
16480	  cd ../../..
16481	  mkdir 2; cd 2
16482	  dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
16483U 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
16497new revision: 1\.2; previous revision: 1\.1
16498done"
16499	  cd ../..
16500	  cd 2/first-dir
16501	  dotest watch4-13 "${testcvs} -q update" \
16502"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16503retrieving revision 1\.1
16504retrieving revision 1\.2
16505Merging differences between 1\.1 and 1\.2 into file1
16506rcsmerge: warning: conflicts during merge
16507${PROG} update: conflicts found in file1
16508C 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
16565done
16566Checking in file1;
16567${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16568initial revision: 1\.1
16569done"
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
16645done
16646Checking in afile;
16647$CVSROOT_DIRNAME/watch6/subdir/afile,v  <--  afile
16648initial revision: 1\.1
16649done"
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
16714U 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
16736new revision: 1\.2; previous revision: 1\.1
16737done"
16738	  cd ../..
16739	  cd 2/x
16740	  dotest unedit-without-baserev-13 "${testcvs} -q update" \
16741"RCS file: ${CVSROOT_DIRNAME}/x/m,v
16742retrieving revision 1\.1\.1\.1
16743retrieving revision 1\.2
16744Merging differences between 1\.1\.1\.1 and 1\.2 into m
16745rcsmerge: warning: conflicts during merge
16746${PROG} update: conflicts found in m
16747C 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
16754U 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 \.
16786RCS file: ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v
16787done
16788Checking in cvsignore;
16789${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v  <--  cvsignore
16790initial revision: 1\.1
16791done
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
16813I ignore/first-dir/defig.o
16814I ignore/first-dir/envig.c
16815I ignore/first-dir/optig.c
16816I ignore/first-dir/rootig.c
16817N ignore/first-dir/bar.c
16818N ignore/first-dir/foobar.c
16819No conflicts created by this import'
16820	  dotest_sort ignore-6 "${testcvs} import -m m -I ! ignore/second-dir tag3 tag4" \
16821'
16822
16823N ignore/second-dir/bar.c
16824N ignore/second-dir/defig.o
16825N ignore/second-dir/envig.c
16826N ignore/second-dir/foobar.c
16827N ignore/second-dir/optig.c
16828N ignore/second-dir/rootig.c
16829No 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
16837U second-dir/defig.o
16838U second-dir/envig.c
16839U second-dir/foobar.c
16840U second-dir/optig.c
16841U second-dir/rootig.c'
16842	  dotest ignore-8 "${testcvs} -q co -dfirst-dir ignore/first-dir" 'U first-dir/bar.c
16843U 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
16894You have \[0\] altered files in this repository.
16895Are 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
16901You have \[1\] altered files in this repository.
16902Are 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
16925done
16926Checking in file1;
16927$CVSROOT_DIRNAME/ignore-on-branch/file1,v  <--  file1
16928initial revision: 1\.1
16929done"
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
16936done
16937Checking in file2;
16938$CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
16939initial revision: 1\.1
16940done"
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
16959T 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
16968new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
16969done"
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
17004done
17005Checking in binfile;
17006${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
17007initial revision: 1\.1
17008done"
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"===================================================================
17019File: 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"===================================================================
17037File: 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"===================================================================
17055File: 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"===================================================================
17071File: 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
17086new revision: 1\.2; previous revision: 1\.1
17087done"
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
17097new revision: 1\.3; previous revision: 1\.2
17098done"
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
17105C 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
17116new revision: 1\.4; previous revision: 1\.3
17117done"
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"===================================================================
17138File: 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
17153new revision: 1\.5; previous revision: 1\.4
17154done"
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"===================================================================
17159File: 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
17168done"
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"===================================================================
17176File: 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"===================================================================
17187File: 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
17201done
17202Checking in nibfile;
17203${CVSROOT_DIRNAME}/first-dir/nibfile,v  <--  nibfile
17204initial revision: 1\.1
17205done"
17206	  dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
17207	    '[UP] nibfile'
17208	  dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
17209"===================================================================
17210File: 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"===================================================================
17223File: 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
17232done"
17233	  dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
17234	  dotest binfiles-17 "${testcvs} -q status nibfile" \
17235"===================================================================
17236File: 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
17246deleting revision 1\.5
17247deleting revision 1\.4
17248done"
17249	  dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
17250"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17251deleting revision 1\.2
17252deleting revision 1\.1
17253done"
17254	  dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
17255RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
17256Working file: binfile
17257head: 1\.3
17258branch:
17259locks: strict
17260access list:
17261keyword substitution: v
17262total 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
17323done
17324Checking in brmod;
17325${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17326initial revision: 1\.1
17327done
17328RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17329done
17330Checking in brmod-trmod;
17331${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17332initial revision: 1\.1
17333done
17334RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
17335done
17336Checking in brmod-wdmod;
17337${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17338initial revision: 1\.1
17339done"
17340	  dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
17341T brmod-trmod
17342T brmod-wdmod'
17343	  dotest binfiles2-3 "$testcvs -q update -r br" \
17344'U brmod
17345U brmod-trmod
17346U 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
17356done
17357Checking in binfile\.dat;
17358${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v  <--  binfile\.dat
17359new revision: 1\.1\.2\.1; previous revision: 1\.1
17360done
17361Checking in brmod;
17362${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17363new revision: 1\.1\.2\.1; previous revision: 1\.1
17364done
17365Checking in brmod-trmod;
17366${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17367new revision: 1\.1\.2\.1; previous revision: 1\.1
17368done
17369Checking in brmod-wdmod;
17370${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17371new revision: 1\.1\.2\.1; previous revision: 1\.1
17372done"
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
17384new revision: 1\.2; previous revision: 1\.1
17385done"
17386	  cp ../binfile3 brmod-wdmod
17387
17388	  dotest binfiles2-8 "${testcvs} -q update -j br" \
17389"U binfile\.dat
17390U 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
17394C brmod-trmod
17395M 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
17399C 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
17412new revision: 1\.2; previous revision: 1\.1
17413done
17414Checking in brmod;
17415${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17416new revision: 1\.2; previous revision: 1\.1
17417done
17418Checking in brmod-trmod;
17419${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17420new revision: 1\.3; previous revision: 1\.2
17421done
17422Checking in brmod-wdmod;
17423${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17424new revision: 1\.2; previous revision: 1\.1
17425done"
17426
17427	  dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
17428"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17429deleting 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
17434deleting revision 1\.1\.2\.1
17435done"
17436	  dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
17437"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17438deleting revision 1\.2
17439deleting revision 1\.1
17440done"
17441	  dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
17442RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17443Working file: brmod-trmod
17444head: 1\.3
17445branch:
17446locks: strict
17447access list:
17448keyword substitution: b
17449total revisions: 1;	selected revisions: 1
17450description:
17451----------------------------
17452revision 1\.3
17453date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
17454checkin
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
17478done
17479Checking in file1;
17480${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17481initial revision: 1\.1
17482done"
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
17490new revision: delete; previous revision: 1\.1
17491done"
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/
17500D"
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
17507Checking in file1;
17508${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17509new revision: 1\.3; previous revision: 1\.2
17510done"
17511	  dotest binfiles3-8 "${testcvs} -q log -h -N file1" "
17512RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17513Working file: file1
17514head: 1\.3
17515branch:
17516locks: strict
17517access list:
17518keyword substitution: b
17519total 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
17533new revision: 1\.4; previous revision: 1\.3
17534done"
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
17539new revision: 1\.5; previous revision: 1\.4
17540done"
17541	  dotest binfiles3-11 "${testcvs} admin -o 1.3::1.5 file1" \
17542"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17543deleting revision 1\.4
17544done"
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
17595done
17596Checking in \.cvswrappers;
17597${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v  <--  \.cvswrappers
17598initial revision: 1\.1
17599done
17600RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
17601done
17602Checking in brmod;
17603${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
17604initial revision: 1\.1
17605done
17606RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
17607done
17608Checking in brmod-trmod;
17609${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17610initial revision: 1\.1
17611done
17612RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
17613done
17614Checking in brmod-wdmod;
17615${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17616initial revision: 1\.1
17617done"
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
17626T brmod
17627T brmod-trmod
17628T brmod-wdmod'
17629	    dotest mcopy-3 "$testcvs -q update -r br" \
17630'U .cvswrappers
17631U brmod
17632U brmod-trmod
17633U 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
17640new revision: 1\.1\.2\.1; previous revision: 1\.1
17641done
17642Checking in brmod-trmod;
17643${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17644new revision: 1\.1\.2\.1; previous revision: 1\.1
17645done
17646Checking in brmod-wdmod;
17647${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17648new revision: 1\.1\.2\.1; previous revision: 1\.1
17649done"
17650	    dotest mcopy-6 "$testcvs -q update -A" \
17651'U .cvswrappers
17652U brmod
17653U brmod-trmod
17654U brmod-wdmod'
17655	    dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
17656"brmod initial contents
17657brmod-trmod initial contents
17658brmod-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
17664new revision: 1\.2; previous revision: 1\.1
17665done"
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
17673C brmod-trmod
17674M 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
17678C brmod-wdmod"
17679
17680	    dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
17681"modify brmod on br
17682modify brmod-trmod on br
17683modify brmod-wdmod on br"
17684	    dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
17685"modify brmod-trmod again on trunk
17686modify 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
17692new revision: 1\.2; previous revision: 1\.1
17693done
17694Checking in brmod-trmod;
17695${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
17696new revision: 1\.3; previous revision: 1\.2
17697done
17698Checking in brmod-wdmod;
17699${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
17700new revision: 1\.2; previous revision: 1\.1
17701done"
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
17735U first-dir/foo.exe'
17736	  dotest binwrap-3 "${testcvs} -q status first-dir" \
17737"===================================================================
17738File: 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===================================================================
17747File: 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
17780U first-dir/foo.exe'
17781	  dotest binwrap2-3 "${testcvs} -q status first-dir" \
17782"===================================================================
17783File: 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===================================================================
17792File: 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
17923new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
17924done
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
17957done
17958Checking in file1\.newbin;
17959${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v  <--  file1\.newbin
17960initial revision: 1\.1
17961done
17962RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v
17963done
17964Checking in file1\.txt;
17965${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v  <--  file1\.txt
17966initial revision: 1\.1
17967done"
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
18106new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18107done
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
18122done
18123Checking in aa;
18124${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
18125initial revision: 1\.1
18126done"
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
18135new revision: 1\.2; previous revision: 1\.1
18136done"
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
18144C 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
18149C 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
18158new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18159done
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
18207new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18208done
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
18222done
18223Checking in file1;
18224${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18225initial revision: 1\.1
18226done
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
18232new revision: 1\.2; previous revision: 1\.1
18233done
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
18239new revision: 1\.3; previous revision: 1\.2
18240done"
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
18245first-dir 1.1
18246first-dir file1
18247first-dir NONEAX
18248first-dir file1ux
18249first-dir file1,1.1,1.2
18250first-dir 1.2
18251first-dir file1
18252first-dir 1.1AX
18253first-dir file1ux
18254first-dir file1,1.2,1.3
18255first-dir 1.3
18256first-dir file1
18257first-dir 1.2AX
18258first-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
18265new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18266done
18267${PROG} commit: Rebuilding administrative file database"
18268
18269	  # Now test verifymsg
18270	  cat >${TESTDIR}/vscript <<EOF
18271#!${TESTSHELL}
18272if sed 1q < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
18273    exit 0
18274elif sed 1q < \$1 | grep '^BugId:[ ]*new$' > /dev/null; then
18275    echo A new bugid was found. >> \$1
18276    exit 0
18277else
18278    echo "No BugId found."
18279    sleep 1
18280    exit 1
18281fi
18282EOF
18283	  cat >${TESTDIR}/vscript2 <<EOF
18284#!${TESTSHELL}
18285if test -f CVS/Repository; then
18286	repo=\`cat CVS/Repository\`
18287else
18288	repo=\`pwd\`
18289fi
18290echo \$repo
18291if echo "\$repo" |grep yet-another/ >/dev/null 2>&1; then
18292	exit 1
18293else
18294	exit 0
18295fi
18296EOF
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
18311new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18312done
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
18322BugId: 42
18323and many more lines after it
18324EOF
18325	  dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18326"Checking in file1;
18327${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18328new revision: 1\.4; previous revision: 1\.3
18329done"
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
18345N first-dir/yet-another/file2
18346
18347No conflicts created by this import" \
18348"${CVSROOT_DIRNAME}/first-dir/yet-another
18349N first-dir/yet-another/file2
18350
18351No 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
18372N first-dir/yet-another/and-another/file2
18373
18374No 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
18400new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18401done
18402${PROG} commit: Rebuilding administrative file database"
18403	  cd ../first-dir
18404	  echo line3 >>file1
18405	  cat >${TESTDIR}/comment.tmp <<EOF
18406BugId: new
18407See what happens next.
18408EOF
18409	  dotest info-reread-2 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18410"Checking in file1;
18411${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18412new revision: 1\.5; previous revision: 1\.4
18413done"
18414	  dotest info-reread-3 "${testcvs} -q log -N -r1.5 file1" "
18415.*
18416BugId: new
18417See what happens next.
18418A 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
18428new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18429done
18430${PROG} commit: Rebuilding administrative file database"
18431	  cd ../first-dir
18432	  echo line4 >>file1
18433	  cat >${TESTDIR}/comment.tmp <<EOF
18434BugId: new
18435See what happens next with stat.
18436EOF
18437	  dotest info-reread-5 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18438"Checking in file1;
18439${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18440new revision: 1\.6; previous revision: 1\.5
18441done"
18442	  dotest info-reread-6 "${testcvs} -q log -N -r1.6 file1" "
18443.*
18444BugId: new
18445See what happens next with stat.
18446A 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
18456new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18457done
18458${PROG} commit: Rebuilding administrative file database"
18459	  cd ../first-dir
18460	  echo line5 >>file1
18461	  cat >${TESTDIR}/comment.tmp <<EOF
18462BugId: new
18463See what happens next.
18464EOF
18465	  dotest info-reread-8 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
18466"Checking in file1;
18467${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18468new revision: 1\.7; previous revision: 1\.6
18469done"
18470	  dotest info-reread-6 "${testcvs} -q log -N -r1.7 file1" "
18471.*
18472BugId: new
18473See 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
18483new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18484done
18485Checking in verifymsg;
18486${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
18487new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18488done
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
18495Checking in verifymsg;
18496${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
18497new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18498done
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}
18534if test "\$1" = rejectme; then
18535  exit 1
18536else
18537  echo "\$@" >>${TESTDIR}/1/taglog
18538  exit 0
18539fi
18540EOF
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
18551new revision: 1\.2; previous revision: 1\.1
18552done
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
18570done
18571Checking in file1;
18572${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18573initial revision: 1\.1
18574done"
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
18582new revision: 1\.1\.2\.1; previous revision: 1\.1
18583done"
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
18623br add ${CVSROOT_DIRNAME}/first-dir file1 1.1
18624brtag mov ${CVSROOT_DIRNAME}/first-dir file1 1.1.2.1
18625tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
18626tag1 del ${CVSROOT_DIRNAME}/first-dir
18627tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
18628tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
18629tag1 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
18637new revision: 1\.3; previous revision: 1\.2
18638done
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
18663new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18664done
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 '='
18669Checking in config;
18670${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18671new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18672done
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'
18677Checking in config;
18678${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
18679new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18680done
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
18688new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18689done
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
18696new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
18697done
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
18728done
18729Checking in file1;
18730${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18731initial revision: 1\.1
18732done"
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
18755new revision: 1\.2; previous revision: 1\.1
18756done"
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
18804done
18805Checking in file1;
18806${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18807initial revision: 1\.1
18808done
18809RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18810done
18811Checking in file2;
18812${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18813initial revision: 1\.1
18814done"
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
18822new revision: 1\.2; previous revision: 1\.1
18823done
18824Checking in file2;
18825${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18826new revision: 1\.2; previous revision: 1\.1
18827done"
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
18837new revision: 1\.3; previous revision: 1\.2
18838done
18839Checking in file2;
18840${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18841new revision: 1\.3; previous revision: 1\.2
18842done"
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
18854new revision: 1\.2\.2\.1; previous revision: 1\.2
18855done"
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
18863new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
18864done"
18865
18866	  # Set up a bunch of shell variables to make the later tests
18867	  # easier to describe.=
18868	  log_header1="
18869RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18870Working file: file1
18871head: 1\.3
18872branch:
18873locks: strict
18874access list:"
18875	  rlog_header1="
18876RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18877head: 1\.3
18878branch:
18879locks: strict
18880access 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='----------------------------
18886revision'
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}
18891line 1
18892
18893line 2"
18894	  log_rev2="${log_dash} 1\.2
18895${log_date}${log_lines}
18896branches:  1\.2\.2;
188972"
18898	  log_rev3="${log_dash} 1\.3
18899${log_date}${log_lines}
189003"
18901	  log_rev1b="${log_dash} 1\.2\.2\.1
18902${log_date}${log_lines}
189031b"
18904	  log_rev2b="${log_dash} 1\.2\.2\.2
18905${log_date}${log_lines}
189062b"
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}
18915total revisions: 5;	selected revisions: 5
18916description:
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}
18927total revisions: 5;	selected revisions: 5
18928description:
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}
18940total revisions: 5;	selected revisions: 3
18941description:
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}
18951total revisions: 5;	selected revisions: 1
18952description:
18953${log_rev3}
18954${log_trailer}"
18955
18956	  dotest log-14a "${testcvs} log -rHEAD file1" \
18957"${log_header1}
18958${log_tags1}
18959${log_keyword}
18960total revisions: 5;	selected revisions: 1
18961description:
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}
18973total revisions: 5;	selected revisions: 1
18974description:
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}
18984total revisions: 5;	selected revisions: 1
18985description:
18986${log_rev3}
18987${log_trailer}"
18988	  dotest log-14d "${testcvs} log -r, file1" \
18989"${log_header1}
18990${log_tags1}
18991${log_keyword}
18992total revisions: 5;	selected revisions: 1
18993description:
18994${log_rev3}
18995${log_trailer}"
18996	  dotest log-14e "${testcvs} log -r. file1" \
18997"${log_header1}
18998${log_tags1}
18999${log_keyword}
19000total revisions: 5;	selected revisions: 1
19001description:
19002${log_rev3}
19003${log_trailer}"
19004	  dotest log-14f "${testcvs} log -r:: file1" \
19005"${log_header1}
19006${log_tags1}
19007${log_keyword}
19008total revisions: 5;	selected revisions: 0
19009description:
19010${log_trailer}"
19011
19012	  dotest log-15 "${testcvs} log -r1.2 file1" \
19013"${log_header1}
19014${log_tags1}
19015${log_keyword}
19016total revisions: 5;	selected revisions: 1
19017description:
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}
19025total revisions: 5;	selected revisions: 2
19026description:
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}
19037total revisions: 5;	selected revisions: 2
19038description:
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}
19047total revisions: 5;	selected revisions: 1
19048description:
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}
19058total revisions: 5;	selected revisions: 2
19059description:
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}
19070total revisions: 5;	selected revisions: 1
19071description:
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}
19079total revisions: 5;	selected revisions: 2
19080description:
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}
19089total revisions: 5;	selected revisions: 1
19090description:
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}
19098total revisions: 5;	selected revisions: 2
19099description:
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}
19108total revisions: 5;	selected revisions: 2
19109description:
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}
19118total revisions: 5;	selected revisions: 2
19119description:
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}
19128total revisions: 5;	selected revisions: 1
19129description:
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}
19137total revisions: 5;	selected revisions: 2
19138description:
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}
19148total revisions: 5;	selected revisions: 1
19149description:
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}
19158total revisions: 5;	selected revisions: 1
19159description:
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}
19171total revisions: 5;	selected revisions: 5
19172description:
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}
19183total revisions: 5;	selected revisions: 5
19184description:
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}
19196total revisions: 5;	selected revisions: 3
19197description:
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}
19207total revisions: 5;	selected revisions: 1
19208description:
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}
19216total revisions: 5;	selected revisions: 1
19217description:
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}
19226total revisions: 5;	selected revisions: 1
19227description:
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}
19235total revisions: 5;	selected revisions: 1
19236description:
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}
19243total revisions: 5;	selected revisions: 1
19244description:
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}
19251total revisions: 5;	selected revisions: 1
19252description:
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}
19259total revisions: 5;	selected revisions: 0
19260description:
19261${log_trailer}"
19262
19263	  dotest log-r15 "${testcvs} rlog -r1.2 first-dir/file1" \
19264"${rlog_header1}
19265${log_tags1}
19266${log_keyword}
19267total revisions: 5;	selected revisions: 1
19268description:
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}
19276total revisions: 5;	selected revisions: 2
19277description:
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}
19286total revisions: 5;	selected revisions: 2
19287description:
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}
19296total revisions: 5;	selected revisions: 1
19297description:
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}
19305total revisions: 5;	selected revisions: 2
19306description:
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}
19315total revisions: 5;	selected revisions: 1
19316description:
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}
19324total revisions: 5;	selected revisions: 2
19325description:
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}
19334total revisions: 5;	selected revisions: 1
19335description:
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}
19343total revisions: 5;	selected revisions: 2
19344description:
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}
19353total revisions: 5;	selected revisions: 2
19354description:
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}
19363total revisions: 5;	selected revisions: 2
19364description:
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}
19373total revisions: 5;	selected revisions: 1
19374description:
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}
19382total revisions: 5;	selected revisions: 2
19383description:
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}
19394total revisions: 5;	selected revisions: 0
19395description:
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}
19404total revisions: 5;	selected revisions: 0
19405description:
19406${log_trailer}"
19407
19408	  # Test when head is dead
19409
19410	  dotest log-d0 "${testcvs} -q up -A" \
19411"[UP] file1
19412U 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
19418new revision: delete; previous revision: 1\.3
19419done"
19420
19421	  log_header1="
19422RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19423Working file: file1
19424head: 1\.4
19425branch:
19426locks: strict
19427access list:"
19428	  rlog_header1="
19429RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19430head: 1\.4
19431branch:
19432locks: strict
19433access list:"
19434	  log_header2="
19435RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19436Working file: file2
19437head: 1\.3
19438branch:
19439locks: strict
19440access list:"
19441	  rlog_header2="
19442RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19443head: 1\.3
19444branch:
19445locks: strict
19446access list:"
19447	  log_tags2='symbolic names:
19448	tag2: 1\.3
19449	tag1: 1\.2'
19450	  log_rev4="${log_dash} 1\.4
19451date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
194524"
19453	  log_rev22="${log_dash} 1\.2
19454${log_date}${log_lines}
194552"
19456
19457	  dotest log-d3 "${testcvs} log -rbranch file1" \
19458"${log_header1}
19459${log_tags1}
19460${log_keyword}
19461total revisions: 6;	selected revisions: 2
19462description:
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}
19470total revisions: 6;	selected revisions: 2
19471description:
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}
19479total revisions: 6;	selected revisions: 2
19480description:
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}
19488total revisions: 3;	selected revisions: 0
19489description:
19490${log_trailer}"
19491	  dotest log-d4a "${testcvs} -q log -t -rbranch" \
19492"${log_header1}
19493${log_tags1}
19494${log_keyword}
19495total revisions: 6
19496description:
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}
19502total revisions: 3
19503description:
19504${log_trailer}"
19505	  dotest log-d4b "${testcvs} -q log -tS -rbranch" \
19506"${log_header1}
19507${log_tags1}
19508${log_keyword}
19509total revisions: 6;	selected revisions: 2
19510description:
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}
19517total 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}
19523total revisions: 3
19524${log_trailer}"
19525	  dotest log-d4d "${testcvs} -q log -hS -rbranch" \
19526"${log_header1}
19527${log_tags1}
19528${log_keyword}
19529total 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}
19542total revisions: 6;	selected revisions: 2
19543description:
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}
19551total revisions: 3;	selected revisions: 0
19552description:
19553${log_trailer}"
19554	  dotest log-rd4a "${testcvs} -q rlog -t -rbranch first-dir" \
19555"${rlog_header1}
19556${log_tags1}
19557${log_keyword}
19558total revisions: 6
19559description:
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}
19565total revisions: 3
19566description:
19567${log_trailer}"
19568	  dotest log-rd4b "${testcvs} -q rlog -St -rbranch first-dir" \
19569"${rlog_header1}
19570${log_tags1}
19571${log_keyword}
19572total revisions: 6;	selected revisions: 2
19573description:
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}
19580total 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}
19586total 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}
19592total 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}
19605total revisions: 6;	selected revisions: 2
19606description:
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}
19614total revisions: 6;	selected revisions: 2
19615description:
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}
19623total revisions: 6;	selected revisions: 2
19624description:
19625${log_rev2b}
19626${log_rev1b}
19627${log_trailer}
19628${log_header2}
19629${log_tags2}
19630${log_keyword}
19631total revisions: 3;	selected revisions: 0
19632description:
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}
19638total revisions: 6;	selected revisions: 2
19639description:
19640${log_rev2b}
19641${log_rev1b}
19642${log_trailer}
19643${rlog_header2}
19644${log_tags2}
19645${log_keyword}
19646total revisions: 3;	selected revisions: 0
19647description:
19648${log_trailer}"
19649	  dotest log-d7 "${testcvs} log -r1.2:1.3 file1" \
19650"${log_header1}
19651${log_tags1}
19652${log_keyword}
19653total revisions: 6;	selected revisions: 2
19654description:
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}
19662total revisions: 6;	selected revisions: 2
19663description:
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}
19673total revisions: 6;	selected revisions: 0
19674description:
19675${log_trailer}
19676${log_header2}
19677${log_tags2}
19678${log_keyword}
19679total revisions: 3;	selected revisions: 2
19680description:
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}
19690total revisions: 3;	selected revisions: 2
19691description:
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}
19701total revisions: 6;	selected revisions: 0
19702description:
19703${log_trailer}
19704${rlog_header2}
19705${log_tags2}
19706${log_keyword}
19707total revisions: 3;	selected revisions: 2
19708description:
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}
19718total revisions: 3;	selected revisions: 2
19719description:
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
19732done"
19733	  dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
19734"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19735done"
19736	  dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
19737"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
19738deleting revision 1\.2\.2\.2
19739done"
19740	  dotest log-o3 "${testcvs} log file1" \
19741"${log_header1}
19742${log_tags1}
19743${log_keyword}
19744total revisions: 5;	selected revisions: 5
19745description:
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}
19756total revisions: 5;	selected revisions: 5
19757description:
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
19785done
19786Checking in file1;
19787${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19788initial revision: 1\.1
19789done"
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" "
19795RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19796Working file: file1
19797head: 1\.1
19798branch:
19799locks: strict
19800access list:
19801keyword substitution: kv
19802total revisions: 1;	selected revisions: 1
19803description:
19804file1-is-for-testing
19805----------------------------
19806revision 1\.1
19807date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
198081
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
19815done"
19816	  dotest log2-6 "${testcvs} log -N file1" "
19817RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19818Working file: file1
19819head: 1\.1
19820branch:
19821locks: strict
19822access list:
19823keyword substitution: kv
19824total revisions: 1;	selected revisions: 1
19825description:
19826change-description
19827----------------------------
19828revision 1\.1
19829date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
198301
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
19837done"
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" "
19841RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19842Working file: file1
19843head: 1\.1
19844branch:
19845locks: strict
19846access list:
19847keyword substitution: kv
19848total revisions: 1;	selected revisions: 1
19849description:
19850longer description
19851with two lines
19852----------------------------
19853revision 1\.1
19854date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
198551
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" "
19865RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19866Working file: file1
19867head: 1\.1
19868branch:
19869locks: strict
19870access list:
19871keyword substitution: kv
19872total revisions: 1;	selected revisions: 1
19873description:
19874change from stdin
19875----------------------------
19876revision 1\.1
19877date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
198781
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
19902done
19903Checking in file1;
19904${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19905initial revision: 1\.1
19906done"
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
19943this
19944is
19945the
19946ancestral
19947file
19948EOF
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
19954done
19955Checking in file1;
19956${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19957initial revision: 1\.1
19958done"
19959	  cat >file1 <<EOF
19960this
19961is
19962a
19963file
19964
19965with
19966a
19967blank
19968line
19969EOF
19970	  dotest ann-5 "${testcvs} -q ci -m modify file1" \
19971"Checking in file1;
19972${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19973new revision: 1\.2; previous revision: 1\.1
19974done"
19975	  dotest ann-6 "${testcvs} -q tag -b br" "T file1"
19976	  cat >file1 <<EOF
19977this
19978is
19979a
19980trunk file
19981
19982with
19983a
19984blank
19985line
19986EOF
19987	  dotest ann-7 "${testcvs} -q ci -m modify file1" \
19988"Checking in file1;
19989${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19990new revision: 1\.3; previous revision: 1\.2
19991done"
19992	  dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
19993	  cat >file1 <<EOF
19994this
19995is
19996a
19997file
19998
19999with
20000a
20001blank
20002line
20003and some
20004branched content
20005EOF
20006	  dotest ann-9 "${testcvs} -q ci -m modify" \
20007"Checking in file1;
20008${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20009new revision: 1\.2\.2\.1; previous revision: 1\.2
20010done"
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"
20017Annotations for file1
20018\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200191\.1          ($username8 *[0-9a-zA-Z-]*): this
200201\.1          ($username8 *[0-9a-zA-Z-]*): is
200211\.2          ($username8 *[0-9a-zA-Z-]*): a
200221\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
200231\.2          ($username8 *[0-9a-zA-Z-]*): 
200241\.2          ($username8 *[0-9a-zA-Z-]*): with
200251\.2          ($username8 *[0-9a-zA-Z-]*): a
200261\.2          ($username8 *[0-9a-zA-Z-]*): blank
200271\.2          ($username8 *[0-9a-zA-Z-]*): line"
20028	  dotest ann-10blame "${testcvs} blame" \
20029"
20030Annotations for file1
20031\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200321\.1          ($username8 *[0-9a-zA-Z-]*): this
200331\.1          ($username8 *[0-9a-zA-Z-]*): is
200341\.2          ($username8 *[0-9a-zA-Z-]*): a
200351\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
200361\.2          ($username8 *[0-9a-zA-Z-]*): 
200371\.2          ($username8 *[0-9a-zA-Z-]*): with
200381\.2          ($username8 *[0-9a-zA-Z-]*): a
200391\.2          ($username8 *[0-9a-zA-Z-]*): blank
200401\.2          ($username8 *[0-9a-zA-Z-]*): line"
20041	  dotest ann-11 "${testcvs} ann -r br" \
20042"
20043Annotations for file1
20044\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200451\.1          ($username8 *[0-9a-zA-Z-]*): this
200461\.1          ($username8 *[0-9a-zA-Z-]*): is
200471\.2          ($username8 *[0-9a-zA-Z-]*): a
200481\.1          ($username8 *[0-9a-zA-Z-]*): file
200491\.2          ($username8 *[0-9a-zA-Z-]*): 
200501\.2          ($username8 *[0-9a-zA-Z-]*): with
200511\.2          ($username8 *[0-9a-zA-Z-]*): a
200521\.2          ($username8 *[0-9a-zA-Z-]*): blank
200531\.2          ($username8 *[0-9a-zA-Z-]*): line
200541\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
200551\.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"
20060Annotations for file1
20061\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200621\.1          ($username8 *[0-9a-zA-Z-]*): this
200631\.1          ($username8 *[0-9a-zA-Z-]*): is
200641\.2          ($username8 *[0-9a-zA-Z-]*): a
200651\.1          ($username8 *[0-9a-zA-Z-]*): file
200661\.2          ($username8 *[0-9a-zA-Z-]*): 
200671\.2          ($username8 *[0-9a-zA-Z-]*): with
200681\.2          ($username8 *[0-9a-zA-Z-]*): a
200691\.2          ($username8 *[0-9a-zA-Z-]*): blank
200701\.2          ($username8 *[0-9a-zA-Z-]*): line
200711\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
200721\.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"
20082Annotations for first-dir/file1
20083\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200841\.1          ($username8 *[0-9a-zA-Z-]*): this
200851\.1          ($username8 *[0-9a-zA-Z-]*): is
200861\.2          ($username8 *[0-9a-zA-Z-]*): a
200871\.3          ($username8 *[0-9a-zA-Z-]*): trunk file
200881\.2          ($username8 *[0-9a-zA-Z-]*): 
200891\.2          ($username8 *[0-9a-zA-Z-]*): with
200901\.2          ($username8 *[0-9a-zA-Z-]*): a
200911\.2          ($username8 *[0-9a-zA-Z-]*): blank
200921\.2          ($username8 *[0-9a-zA-Z-]*): line"
20093	  dotest ann-r11 "${testcvs} rann -r br first-dir" \
20094"
20095Annotations for first-dir/file1
20096\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
200971\.1          ($username8 *[0-9a-zA-Z-]*): this
200981\.1          ($username8 *[0-9a-zA-Z-]*): is
200991\.2          ($username8 *[0-9a-zA-Z-]*): a
201001\.1          ($username8 *[0-9a-zA-Z-]*): file
201011\.2          ($username8 *[0-9a-zA-Z-]*): 
201021\.2          ($username8 *[0-9a-zA-Z-]*): with
201031\.2          ($username8 *[0-9a-zA-Z-]*): a
201041\.2          ($username8 *[0-9a-zA-Z-]*): blank
201051\.2          ($username8 *[0-9a-zA-Z-]*): line
201061\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
201071\.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"
20111Annotations for first-dir/file1
20112\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
201131\.1          ($username8 *[0-9a-zA-Z-]*): this
201141\.1          ($username8 *[0-9a-zA-Z-]*): is
201151\.2          ($username8 *[0-9a-zA-Z-]*): a
201161\.1          ($username8 *[0-9a-zA-Z-]*): file
201171\.2          ($username8 *[0-9a-zA-Z-]*): 
201181\.2          ($username8 *[0-9a-zA-Z-]*): with
201191\.2          ($username8 *[0-9a-zA-Z-]*): a
201201\.2          ($username8 *[0-9a-zA-Z-]*): blank
201211\.2          ($username8 *[0-9a-zA-Z-]*): line
201221\.2\.2\.1      ($username8 *[0-9a-zA-Z-]*): and some
201231\.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
20151done
20152Checking in $file;
20153${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
20154initial revision: 1\.1
20155done"
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
20161new revision: 1\.2; previous revision: 1\.1
20162done"
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"
20168Annotations for $file
20169\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
201701.2          ($username8 *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'"
201711.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
20207HOME=$HOME
20208export HOME
20209exec $CVS_SERVER_save "\$@"
20210EOF
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
20319done
20320Checking in file1;
20321${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20322initial revision: 1\.1
20323done"
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
20339done
20340Checking in cfile;
20341${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
20342initial revision: 1\.1
20343done"
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
20350U first-dir/file1"
20351	  dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
20352"${PROG} checkout: Updating crerepos-dir
20353U 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
20403HOME=$HOME
20404export HOME
20405exec $CVS_SERVER_save "\$@"
20406EOF
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
20515done
20516Checking in file1;
20517${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
20518initial revision: 1\.1
20519done"
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
20535done
20536Checking in cfile;
20537${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
20538initial revision: 1\.1
20539done"
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
20546U first-dir/file1"
20547	  dotest crerepos-extssh-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
20548"${PROG} checkout: Updating crerepos-dir
20549U 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
20598head	1.3;
20599access;
20600symbols;
20601locks; strict;
20602comment	@# @;
20603
20604
206051.3
20606date	2000.11.24.15.58.37;	author kingdon;	state Exp;
20607branches;
20608next	1.2;
20609
206101.2
20611date	96.11.24.15.57.41;	author kingdon;	state Exp;
20612branches;
20613next	1.1;
20614
206151.1
20616date	96.11.24.15.56.05;	author kingdon;	state Exp;
20617branches;
20618next	;
20619
20620
20621desc
20622@file1 is for testing CVS
20623@
20624
20625
206261.3
20627log
20628@delete second line; modify twelfth line
20629@
20630text
20631@This is the first line
20632This is the third line
20633This is the fourth line
20634This is the fifth line
20635This is the sixth line
20636This is the seventh line
20637This is the eighth line
20638This is the ninth line
20639This is the tenth line
20640This is the eleventh line
20641This is the twelfth line (and what a line it is)
20642This is the thirteenth line
20643@
20644
20645
206461.2
20647log
20648@add more lines
20649@
20650text
20651@a1 1
20652This is the second line
20653d11 1
20654a11 1
20655This is the twelfth line
20656@
20657
20658
206591.1
20660log
20661@add file1
20662@
20663text
20664@d2 12
20665@
20666EOF
20667	  dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
20668	  cd first-dir
20669	  dotest rcs-2 "${testcvs} -q log" "
20670RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20671Working file: file1
20672head: 1\.3
20673branch:
20674locks: strict
20675access list:
20676symbolic names:
20677keyword substitution: kv
20678total revisions: 3;	selected revisions: 3
20679description:
20680file1 is for testing CVS
20681----------------------------
20682revision 1\.3
20683date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
20684delete second line; modify twelfth line
20685----------------------------
20686revision 1\.2
20687date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
20688add more lines
20689----------------------------
20690revision 1\.1
20691date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
20692add 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<'" "
20704RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20705Working file: file1
20706head: 1\.3
20707branch:
20708locks: strict
20709access list:
20710symbolic names:
20711keyword substitution: kv
20712total revisions: 3;	selected revisions: 1
20713description:
20714file1 is for testing CVS
20715----------------------------
20716revision 1\.3
20717date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
20718delete 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"
20724RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
20725Working file: file1
20726head: 1\.3
20727branch:
20728locks: strict
20729access list:
20730symbolic names:
20731keyword substitution: kv
20732total revisions: 3;	selected revisions: 2
20733description:
20734file1 is for testing CVS
20735----------------------------
20736revision 1\.2
20737date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
20738add more lines
20739----------------------------
20740revision 1\.1
20741date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
20742add 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"
20750Annotations for file1
20751\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
207521\.1          (kingdon  24-Nov-96): This is the first line
207531\.2          (kingdon  24-Nov-96): This is the third line
207541\.2          (kingdon  24-Nov-96): This is the fourth line
207551\.2          (kingdon  24-Nov-96): This is the fifth line
207561\.2          (kingdon  24-Nov-96): This is the sixth line
207571\.2          (kingdon  24-Nov-96): This is the seventh line
207581\.2          (kingdon  24-Nov-96): This is the eighth line
207591\.2          (kingdon  24-Nov-96): This is the ninth line
207601\.2          (kingdon  24-Nov-96): This is the tenth line
207611\.2          (kingdon  24-Nov-96): This is the eleventh line
207621\.3          (kingdon  24-Nov-00): This is the twelfth line (and what a line it is)
207631\.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
20774head			 	1.5                 ;
20775     branch        1.2.6;
20776access ;
20777symbols branch:1.2.6;
20778locks;
20779testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
207801.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
207811.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
207821.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
207831.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
207841.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
207851.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
20786desc @@
207871.5 log @@ newphrase1; newphrase2 42; text @head revision@
207881.4 log @@ text @d1 1
20789a1 1
20790new year revision@
207911.3 log @@ text @d1 1
20792a1 1
20793old year revision@
207941.2 log @@ text @d1 1
20795a1 1
20796mid revision@ 1.1
20797
20798log           @@ text @d1 1
20799a1 1
20800start revision@
208011.2.6.1 log @@ text @d1 1
20802a1 1
20803branch revision@
20804EOF
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
20818new revision: 1\.2\.6\.2; previous revision: 1\.2\.6\.1
20819done"
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
20824done"
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;
20836access;
20837symbols
20838	branch:1.2.6;
20839locks;
20840
20841testofanewphrase	@without newphrase we'd have trouble extending @@ all@;
20842
208431\.5
20844date	71\.01\.01\.01\.00\.00;	author joe;	state bogus;
20845branches;
20846next	1\.4;
20847
208481\.4
20849date	71\.01\.01\.00\.00\.05;	author joe;	state bogus;
20850branches;
20851next	1\.3;
20852
208531\.3
20854date	70\.12\.31\.15\.00\.05;	author joe;	state bogus;
20855branches;
20856next	1\.2;
20857
208581\.2
20859date	70\.12\.31\.12\.15\.05;	author me;	state bogus;
20860branches
20861	1\.2\.6\.1;
20862next	1\.1;
20863
208641\.1
20865date	70\.12\.31\.11\.00\.05;	author joe;	state bogus;
20866branches;
20867next	;
20868newph	;
20869
208701\.2\.6\.1
20871date	71\.01\.01\.08\.00\.05;	author joe;	state Exp;
20872branches;
20873next	1\.2\.6\.2;
20874
208751\.2\.6\.2
20876date	[0-9.]*;	author ${username};	state Exp;
20877branches;
20878next	;
20879
20880
20881desc
20882@@
20883
20884
208851\.5
20886log
20887@@
20888newphrase1	;
20889newphrase2	42;
20890text
20891@head revision@
20892
20893
208941\.4
20895log
20896@@
20897text
20898@d1 1
20899a1 1
20900new year revision@
20901
20902
209031\.3
20904log
20905@@
20906text
20907@d1 1
20908a1 1
20909old year revision@
20910
20911
209121\.2
20913log
20914@@
20915text
20916@d1 1
20917a1 1
20918mid revision@
20919
20920
209211\.1
20922log
20923@@
20924text
20925@d1 1
20926a1 1
20927start revision@
20928
20929
209301\.2\.6\.1
20931log
20932@@
20933text
20934@d1 1
20935a1 1
20936branch revision@
20937
20938
209391\.2\.6\.2
20940log
20941@mod
20942@
20943text
20944@d1 1
20945a1 1
20946next 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" "
20969RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
20970Working file: file2
20971head: 1\.5
20972branch:
20973locks:
20974access list:
20975symbolic names:
20976	branch: 1\.2\.6
20977keyword substitution: kv
20978total revisions: 7;	selected revisions: 7
20979description:
20980----------------------------
20981revision 1\.5
20982date: 1971/01/01 01:00:00;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20983\*\*\* empty log message \*\*\*
20984----------------------------
20985revision 1\.4
20986date: 1971/01/01 00:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20987\*\*\* empty log message \*\*\*
20988----------------------------
20989revision 1\.3
20990date: 1970/12/31 15:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
20991\*\*\* empty log message \*\*\*
20992----------------------------
20993revision 1\.2
20994date: 1970/12/31 12:15:05;  author: me;  state: bogus;  lines: ${PLUS}1 -1
20995branches:  1\.2\.6;
20996\*\*\* empty log message \*\*\*
20997----------------------------
20998revision 1\.1
20999date: 1970/12/31 11:00:05;  author: joe;  state: bogus;
21000\*\*\* empty log message \*\*\*
21001----------------------------
21002revision 1\.2\.6\.2
21003date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
21004mod
21005----------------------------
21006revision 1\.2\.6\.1
21007date: 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
21015revision 1\.3
21016revision 1\.2
21017revision 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
21022revision 1\.5
21023revision 1\.4
21024revision 1\.2\.6\.2
21025revision 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
21030revision 1\.5
21031revision 1\.4
21032revision 1\.1
21033revision 1\.2\.6\.2
21034revision 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
21040revision 1\.5
21041revision 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
21047revision 1\.5
21048revision 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
21068head 1.7; access; symbols; locks; strict;
210691.7 date 2004.08.31.01.01.01; author sue; state; branches; next 1.6;
210701.6 date 2004.02.29.01.01.01; author sue; state; branches; next 1.5;
210711.5 date 2003.02.28.01.01.01; author sue; state; branches; next 1.4;
210721.4 date 2001.01.01.01.01.01; author sue; state; branches; next 1.3;
210731.3 date 2000.02.29.01.01.01; author sue; state; branches; next 1.2;
210741.2 date 99.09.09.01.01.01; author sue; state; branches; next 1.1;
210751.1 date 98.09.10.01.01.01; author sue; state; branches; next;
21076desc @a test file@
210771.7 log @@ text @head revision@
210781.6 log @@ text @d1 1
21079a1 1
210802004 was a great year for leaping@
210811.5 log @@ text @d1 1
21082a1 1
210832003 wasn't@
210841.4 log @@ text @d1 1
21085a1 1
21086two year hiatus@
210871.3 log @@ text @d1 1
21088a1 1
210892000 is also a good year for leaping@
210901.2 log @@ text @d1 1
21091a1 1
21092Tonight we're going to party like it's a certain year@
210931.1 log @@ text @d1 1
21094a1 1
21095Need to start somewhere@
21096EOF
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
21146head 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@
21148EOF
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
21157head 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@
21159EOF
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
21164head 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@
21166EOF
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
21172head 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@
21174EOF
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
21238N rcs4-dir/file1
21239No 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
21246No conflicts created by this import
21247U 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
21261new revision: 1\.2; previous revision: 1\.1
21262done"
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'===================================================================
21273File: 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
21308head 1.1;
21309access;
21310symbols;
21311locks;
21312expand kv;
21313
213141.1 date 2007.03.20.04.03.02; author jeremiah; state Ext;  branches; next;
21315
21316desc
21317@@
21318
213191.1
21320log
21321@he always had very fine wine@
21322text
21323@line1
21324/*
21325EOF
21326echo ' * Revision history: $''Log$' >>$CVSROOT_DIRNAME/rcs5/file1,v
21327	  cat <<\EOF >>$CVSROOT_DIRNAME/rcs5/file1,v
21328 */
21329line5
21330@
21331EOF
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 \\*/
21344line5"
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
21371done
21372Checking in afile;
21373$CVSROOT_DIRNAME/rcs6/afile,v  <--  afile
21374initial revision: 1\.1
21375done"
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
21380new revision: 1\.2; previous revision: 1\.1
21381done"
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
21433new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
21434done
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
21521Checking in first-dir/sdir/ssdir/file1;
21522$CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v  <--  file1
21523new revision: 1\.2; previous revision: 1\.1
21524done"
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
21533Checking in first-dir/sdir/ssdir/file1;
21534$CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v  <--  file1
21535new revision: 1\.3; previous revision: 1\.2
21536done"
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
21545new revision: 1\.4; previous revision: 1\.3
21546done
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
21565new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
21566done
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
21614done
21615Checking in file1;
21616${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
21617initial revision: 1\.1
21618done
21619RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21620done
21621Checking in dir/file2;
21622${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21623initial revision: 1\.1
21624done"
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
21640new revision: 1\.2; previous revision: 1\.1
21641done
21642Checking in dir/file2;
21643${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21644new revision: 1\.2; previous revision: 1\.1
21645done"
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
21667new revision: 1\.3; previous revision: 1\.2
21668done
21669Checking in dir/file2;
21670${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21671new revision: 1\.3; previous revision: 1\.2
21672done"
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
21691new revision: 1\.4; previous revision: 1\.3
21692done
21693Checking in dir/file2;
21694${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21695new revision: 1\.4; previous revision: 1\.3
21696done"
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
21721new revision: 1\.5; previous revision: 1\.4
21722done
21723Checking in dir/file2;
21724${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21725new revision: 1\.5; previous revision: 1\.4
21726done"
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
21735new revision: 1\.6; previous revision: 1\.5
21736done"
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 .
21754U file1
21755${PROG} update: Updating dir
21756U 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
21775cd repos-first-dir
21776DATADIRS=\`find . -name CVS -print\`
21777cd ../first-dir
21778find . -name CVS -print | xargs rm -rf
21779for file in \${DATADIRS}; do
21780	cp -r ../repos-first-dir/\${file} \${file}
21781done" >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
21800new revision: 1\.4; previous revision: 1\.3
21801done
21802Checking in dir/file2;
21803${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21804new revision: 1\.4; previous revision: 1\.3
21805done"
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 \.
21811RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
21812retrieving revision 1\.3
21813retrieving revision 1\.4
21814Merging differences between 1\.3 and 1\.4 into file1
21815rcsmerge: warning: conflicts during merge
21816${PROG} update: conflicts found in file1
21817C file1
21818${PROG} update: Updating dir
21819RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21820retrieving revision 1\.3
21821retrieving revision 1\.4
21822Merging differences between 1\.3 and 1\.4 into file2
21823rcsmerge: warning: conflicts during merge
21824${PROG} update: conflicts found in dir/file2
21825C dir/file2"
21826	  sed -e \
21827"/^<<<<<<</,/^=======/d
21828/^>>>>>>>/d" file1 >tmp; mv tmp file1
21829	  sed -e \
21830"/^<<<<<<</,/^=======/d
21831/^>>>>>>>/d
21832s/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
21836new revision: 1\.5; previous revision: 1\.4
21837done"
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
21843retrieving revision 1\.2
21844retrieving revision 1\.4
21845Merging differences between 1\.2 and 1\.4 into file1
21846RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
21847retrieving revision 1\.2
21848retrieving revision 1\.5
21849Merging 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
21853new revision: 1\.5; previous revision: 1\.4
21854done
21855Checking in dir/file2;
21856${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
21857new revision: 1\.6; previous revision: 1\.5
21858done"
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
21911done
21912Checking in aaa;
21913$CVSROOT_DIRNAME/first-dir/aaa,v  <--  aaa
21914initial revision: 1\.1
21915done"
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
21923new revision: 1\.2; previous revision: 1\.1
21924done"
21925          cat > wrapper.sh <<EOF
21926#!$TESTSHELL
21927exec "\$@" 2>&1 < /dev/null | cat
21928EOF
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\.
21935$/d;
21936 /^write stdout: Broken pipe
21937$/d;
21938 :retry;
21939 /Write failed flushing stdout buffer\.
21940$/{
21941	N;
21942	s/Write failed flushing stdout buffer\.
21943\n//;
21944	b retry;
21945}
21946 /write stdout: Broken pipe
21947$/{
21948	N;
21949	s/write stdout: Broken pipe
21950\n//;
21951	b retry;
21952}' \
21953          > wrapper.dif
21954  
21955          $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \
21956             aaa > good.dif
21957  
21958          dotest sshstdio-6 "cmp wrapper.dif good.dif"
21959
21960          if $keep; then
21961            echo Keeping $TESTDIR and exiting due to --keep
21962            exit 0
21963          fi
21964  
21965          cd ../..
21966          CVS_RSH=$save_CVS_RSH; export CVS_RSH
21967          rm -r sshstdio
21968          rm -rf $CVSROOT_DIRNAME/first-dir
21969          ;;
21970
21971
21972
21973	parseroot2)
21974	  # Test some :ext: roots for consistancy.
21975	  if $remote; then :; else
21976	    continue
21977	  fi
21978
21979	  depends_on_rsh "$CVS_RSH"
21980	  if test $? -eq 77; then
21981	    skip parseroot2 "$skipreason"
21982	    continue
21983	  fi
21984
21985	  # Test checking out and subsequently updating with some different
21986	  # CVSROOTs.
21987
21988	  # A standard case, hostname:dirname.
21989	  mkdir parseroot2; cd parseroot2
21990	  save_CVSROOT=$CVSROOT
21991	  CVSROOT=$host:$CVSROOT_DIRNAME
21992	  dotest parseroot2-1 "$testcvs -Q co CVSROOT"
21993	  cd CVSROOT
21994	  dotest parseroot2-2 "$testcvs -Q up"
21995	  cd ..
21996
21997	  # A degenerate remote case, just the server name and the directory
21998	  # name, with no :'s to help parsing.  It can be mistaken for a
21999	  # relative directory name.
22000	  rm -r CVSROOT
22001	  CVSROOT=$host$CVSROOT_DIRNAME
22002	  dotest parseroot2-3 "$testcvs -Q co CVSROOT"
22003	  cd CVSROOT
22004	  dotest parseroot2-4 "$testcvs -Q up"
22005
22006	  if $keep; then
22007	    echo Keeping $TESTDIR and exiting due to --keep
22008	    exit 0
22009	  fi
22010  
22011	  cd ../..
22012	  CVSROOT=$save_CVSROOT
22013	  rm -r parseroot2
22014	  ;;
22015
22016
22017
22018	history)
22019	  # CVSROOT/history tests:
22020	  # history: various "cvs history" invocations
22021	  # basic2: Generating the CVSROOT/history file via CVS commands.
22022
22023	  # Put in some data for the history file (discarding what was
22024	  # there before).  Note that this file format is fixed; the
22025	  # user may wish to analyze data from a previous version of
22026	  # CVS.  If we phase out this format, it should be done
22027	  # slowly and carefully.
22028	  cat >${CVSROOT_DIRNAME}/CVSROOT/history <<EOF
22029O3395c677|anonymous|<remote>/*0|ccvs||ccvs
22030O3396c677|anonymous|<remote>/src|ccvs||src
22031O3397c677|kingdon|<remote>/*0|ccvs||ccvs
22032M339cafae|nk|<remote>|ccvs/src|1.229|sanity.sh
22033M339cafff|anonymous|<remote>|ccvs/src|1.23|Makefile
22034M339dc339|kingdon|~/work/*0|ccvs/src|1.231|sanity.sh
22035W33a6eada|anonymous|<remote>*4|ccvs/emx||Makefile.in
22036C3b235f50|kingdon|<remote>|ccvs/emx|1.3|README
22037M3b23af50|kingdon|~/work/*0|ccvs/doc|1.281|cvs.texinfo
22038EOF
22039	  dotest history-1 "${testcvs} history -e -a" \
22040"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs     =ccvs= <remote>/\*
22041O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs     =src=  <remote>/\*
22042M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22043W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
22044O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs     =ccvs= <remote>/\*
22045M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
22046C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
22047M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc
22048M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity\.sh   ccvs/src == <remote>"
22049
22050	  dotest history-2 "${testcvs} history -e -a -D '10 Jun 1997 13:00 UT'" \
22051"W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
22052M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
22053C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
22054M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
22055
22056	  dotest history-3 "${testcvs} history -e -a -D '10 Jun 2001 13:00 UT'" \
22057"M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
22058
22059	  dotest history-4 "${testcvs} history -ac sanity.sh" \
22060"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22061M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22062
22063	  dotest history-5 "${testcvs} history -a -xCGUWAMR README sanity.sh" \
22064"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22065C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22066M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22067
22068	  dotest history-6 "${testcvs} history -xCGUWAMR -a -f README -f sanity.sh" \
22069"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22070C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22071M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22072
22073	  dotest history-7 "${testcvs} history -xCGUWAMR -a -f sanity.sh README" \
22074"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
22075C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
22076M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
22077
22078	  dotest history-8 "${testcvs} history -ca -D '1970-01-01 00:00 UT'" \
22079"M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity.sh   ccvs/src == <remote>
22080M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22081M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src
22082M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc"
22083
22084	  dotest history-9 "${testcvs} history -acl" \
22085"M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
22086M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22087M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
22088
22089	  dotest history-10 "${testcvs} history -lca -D '1970-01-01 00:00 UT'" \
22090"M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
22091M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
22092M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
22093
22094	  dotest history-11 "${testcvs} history -aw" \
22095"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
22096O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
22097O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
22098
22099	  dotest history-12 "${testcvs} history -aw -D'1970-01-01 00:00 UT'" \
22100"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
22101O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
22102O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
22103	  ;;
22104
22105	big)
22106
22107	  # Test ability to operate on big files.  Intention is to
22108	  # test various realloc'ing code in RCS_deltas, rcsgetkey,
22109	  # etc.  "big" is currently defined to be 1000 lines (64000
22110	  # bytes), which in terms of files that users will use is not
22111	  # large, merely average, but my reasoning is that this
22112	  # should be big enough to make sure realloc'ing is going on
22113	  # and that raising it a lot would start to stress resources
22114	  # on machines which run the tests, without any significant
22115	  # benefit.
22116
22117	  mkdir ${CVSROOT_DIRNAME}/first-dir
22118	  dotest big-1 "${testcvs} -q co first-dir" ''
22119	  cd first-dir
22120	  for i in 0 1 2 3 4 5 6 7 8 9; do
22121	    for j in 0 1 2 3 4 5 6 7 8 9; do
22122	      for k in 0 1 2 3 4 5 6 7 8 9; do
22123		echo \
22124"This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
22125	      done
22126	    done
22127	  done
22128	  dotest big-2 "${testcvs} add file1" \
22129"${PROG} add: scheduling file .file1. for addition
22130${PROG} add: use .${PROG} commit. to add this file permanently"
22131	  dotest big-3 "${testcvs} -q ci -m add" \
22132"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22133done
22134Checking in file1;
22135${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22136initial revision: 1\.1
22137done"
22138	  cd ..
22139	  mkdir 2
22140	  cd 2
22141	  dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
22142	  cd ../first-dir
22143	  echo "add a line to the end" >>file1
22144	  dotest big-5 "${testcvs} -q ci -m modify" \
22145"Checking in file1;
22146${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22147new revision: 1\.2; previous revision: 1\.1
22148done"
22149	  cd ../2/first-dir
22150	  # The idea here is particularly to test the Rcs-diff response
22151	  # and the reallocing thereof, for remote.
22152	  dotest big-6 "${testcvs} -q update" "[UP] file1"
22153	  cd ../..
22154
22155	  if $keep; then
22156	    echo Keeping ${TESTDIR} and exiting due to --keep
22157	    exit 0
22158	  fi
22159
22160	  rm -r first-dir 2
22161	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22162	  ;;
22163
22164	modes)
22165	  # Test repository permissions (CVSUMASK and so on).
22166	  # Although the tests in this section "cheat" by testing
22167	  # repository permissions, which are sort of not a user-visible
22168	  # sort of thing, the modes do have user-visible consequences,
22169	  # such as whether a second user can check out the files.  But
22170	  # it would be awkward to test the consequences, so we don't.
22171
22172	  # Solaris /bin/sh doesn't support export -n.  I'm not sure
22173	  # what we can do about this, other than hope that whoever
22174	  # is running the tests doesn't have CVSUMASK set.
22175	  #export -n CVSUMASK # if unset, defaults to 002
22176
22177	  umask 077
22178	  mkdir 1; cd 1
22179	  dotest modes-1 "${testcvs} -q co -l ." ''
22180	  mkdir first-dir
22181	  dotest modes-2 "${testcvs} add first-dir" \
22182"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22183	  cd first-dir
22184	  touch aa
22185	  dotest modes-3 "${testcvs} add aa" \
22186"${PROG} add: scheduling file .aa. for addition
22187${PROG} add: use .${PROG} commit. to add this file permanently"
22188	  dotest modes-4 "${testcvs} -q ci -m add" \
22189"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22190done
22191Checking in aa;
22192${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22193initial revision: 1\.1
22194done"
22195	  # Yawn.  Cygwin.
22196	  if test -n "$remotehost"; then
22197	    dotest modes-5remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22198"-r--r--r-- .*"
22199	  else
22200	    dotest modes-5 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22201"-r--r--r-- .*"
22202	  fi
22203
22204	  # Test for whether we can set the execute bit.
22205	  chmod +x aa
22206	  echo change it >>aa
22207	  dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
22208"Checking in aa;
22209${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22210new revision: 1\.2; previous revision: 1\.1
22211done"
22212	  # If CVS let us update the execute bit, it would be set here.
22213	  # But it doesn't, and as far as I know that is longstanding
22214	  # CVS behavior.
22215	  #
22216	  # Yeah, yeah.  Search for "Cygwin".
22217	  if test -n "$remotehost"; then
22218	    dotest modes-7remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22219"-r--r--r-- .*"
22220	  else
22221	    dotest modes-7 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22222"-r--r--r-- .*"
22223	  fi
22224
22225	  # OK, now manually change the modes and see what happens.
22226	  #
22227	  # Cygwin, already.
22228	  if test -n "$remotehost"; then
22229	    $CVS_RSH $remotehost "chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v"
22230	  else
22231	    chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v
22232	  fi
22233	  echo second line >>aa
22234	  dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
22235"Checking in aa;
22236${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22237new revision: 1\.3; previous revision: 1\.2
22238done"
22239	  # Cygwin.
22240	  if test -n "$remotehost"; then
22241	    dotest modes-7bremotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
22242"-r--r----- .*"
22243	  else
22244	    dotest modes-7b "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
22245"-r--r----- .*"
22246	  fi
22247
22248	  CVSUMASK=007
22249	  export CVSUMASK
22250	  touch ab
22251	  # Might as well test the execute bit too.
22252	  chmod +x ab
22253	  dotest modes-8 "${testcvs} add ab" \
22254"${PROG} add: scheduling file .ab. for addition
22255${PROG} add: use .${PROG} commit. to add this file permanently"
22256	  dotest modes-9 "${testcvs} -q ci -m add" \
22257"RCS file: ${CVSROOT_DIRNAME}/first-dir/ab,v
22258done
22259Checking in ab;
22260${CVSROOT_DIRNAME}/first-dir/ab,v  <--  ab
22261initial revision: 1\.1
22262done"
22263	  if $remote; then
22264	    # The problem here is that the CVSUMASK environment variable
22265	    # needs to be set on the server (e.g. .bashrc).  This is, of
22266	    # course, bogus, but that is the way it is currently.
22267	    if test -n "$remotehost"; then
22268	      dotest modes-10remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v'" \
22269"-r--r--r--.*"
22270	    else
22271	      dotest modes-10r "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
22272"-r-xr-x---.*" "-r-xr-xr-x.*"
22273	    fi
22274	  else
22275	    dotest modes-10 "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
22276"-r-xr-x---.*"
22277	  fi
22278
22279	  # OK, now add a file on a branch.  Check that the mode gets
22280	  # set the same way (it is a different code path in CVS).
22281	  dotest modes-11 "${testcvs} -q tag -b br" 'T aa
22282T ab'
22283	  dotest modes-12 "$testcvs -q update -r br" \
22284'[UP] aa
22285U ab'
22286	  touch ac
22287	  dotest modes-13 "${testcvs} add ac" \
22288"${PROG} add: scheduling file .ac. for addition on branch .br.
22289${PROG} add: use .${PROG} commit. to add this file permanently"
22290	  # Not sure it really makes sense to refer to a "previous revision"
22291	  # when we are just now adding the file; as far as I know
22292	  # that is longstanding CVS behavior, for what it's worth.
22293	  dotest modes-14 "${testcvs} -q ci -m add" \
22294"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v
22295done
22296Checking in ac;
22297${CVSROOT_DIRNAME}/first-dir/Attic/ac,v  <--  ac
22298new revision: 1\.1\.2\.1; previous revision: 1\.1
22299done"
22300	  if $remote; then
22301	    # The problem here is that the CVSUMASK environment variable
22302	    # needs to be set on the server (e.g. .bashrc).  This is, of
22303	    # course, bogus, but that is the way it is currently.  The
22304	    # first match is for the :ext: method (where the CVSUMASK
22305	    # won't be set), while the second is for the :fork: method
22306	    # (where it will be).
22307	    if test -n "$remotehost"; then
22308	      dotest modes-15r \
22309"$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v'" \
22310"-r--r--r--.*"
22311	    else
22312	      dotest modes-15r \
22313"ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
22314"-r--r--r--.*" "-r--r-----.*"
22315	    fi
22316	  else
22317	    dotest modes-15 \
22318"ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
22319"-r--r-----.*"
22320	  fi
22321
22322	  cd ../..
22323	  rm -r 1
22324	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22325	  # Perhaps should restore the umask and CVSUMASK.  But the other
22326	  # tests "should" not care about them...
22327	  ;;
22328
22329	modes2)
22330	  # More tests of file permissions in the working directory
22331	  # and that sort of thing.
22332
22333	  # The usual setup, file first-dir/aa with two revisions.
22334	  mkdir 1; cd 1
22335	  dotest modes2-1 "${testcvs} -q co -l ." ''
22336	  mkdir first-dir
22337	  dotest modes2-2 "${testcvs} add first-dir" \
22338"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22339	  cd first-dir
22340	  touch aa
22341	  dotest modes2-3 "${testcvs} add aa" \
22342"${PROG} add: scheduling file .aa. for addition
22343${PROG} add: use .${PROG} commit. to add this file permanently"
22344	  dotest modes2-4 "${testcvs} -q ci -m add" \
22345"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22346done
22347Checking in aa;
22348${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22349initial revision: 1\.1
22350done"
22351	  echo "more money" >> aa
22352	  dotest modes2-5 "${testcvs} -q ci -m add" \
22353"Checking in aa;
22354${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22355new revision: 1\.2; previous revision: 1\.1
22356done"
22357
22358	  # OK, here is the test.  The idea is to see what
22359	  # No_Difference does if it can't open the file.
22360	  # If we don't change the st_mtime, CVS doesn't even try to read
22361	  # the file.  Note that some versions of "touch" require that we
22362	  # do this while the file is still writable.
22363	  touch aa
22364	  chmod a= aa
22365	  # Don't try this when permissions are broken, as with Cygwin.
22366	  if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then :; else
22367	    dotest_fail modes2-6 "${testcvs} -q update -r 1.1 aa" \
22368"${PROG} \[update aborted\]: cannot open file aa for comparing: Permission denied" \
22369"${PROG} \[update aborted\]: reading aa: Permission denied"
22370	  fi
22371
22372	  chmod u+rwx aa
22373	  cd ../..
22374	  rm -r 1
22375	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22376	  ;;
22377
22378	modes3)
22379	  # Repository permissions.  Particularly, what happens if we
22380	  # can't read/write in the repository.
22381	  # TODO: the case where we can access the repository, just not
22382	  # the attic (may that one can remain a fatal error, seems less
22383	  # useful for access control).
22384	  mkdir 1; cd 1
22385	  dotest modes3-1 "${testcvs} -q co -l ." ''
22386	  mkdir first-dir second-dir
22387	  dotest modes3-2 "${testcvs} add first-dir second-dir" \
22388"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
22389Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
22390	  touch first-dir/aa second-dir/ab
22391	  dotest modes3-3 "${testcvs} add first-dir/aa second-dir/ab" \
22392"${PROG} add: scheduling file .first-dir/aa. for addition
22393${PROG} add: scheduling file .second-dir/ab. for addition
22394${PROG} add: use .${PROG} commit. to add these files permanently"
22395	  dotest modes3-4 "${testcvs} -q ci -m add" \
22396"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22397done
22398Checking in first-dir/aa;
22399${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22400initial revision: 1\.1
22401done
22402RCS file: ${CVSROOT_DIRNAME}/second-dir/ab,v
22403done
22404Checking in second-dir/ab;
22405${CVSROOT_DIRNAME}/second-dir/ab,v  <--  ab
22406initial revision: 1\.1
22407done"
22408	  if test -n "$remotehost"; then
22409	    $CVS_RSH $remotehost "chmod a= ${CVSROOT_DIRNAME}/first-dir"
22410	  else
22411	    chmod a= ${CVSROOT_DIRNAME}/first-dir
22412	  fi
22413	  if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then
22414	    # Avoid this test under Cygwin since permissions work differently
22415	    # there.
22416	    #
22417	    # This test also gets avoided under Mac OS X since the system `ls'
22418	    # is broken and exits with a 0 status despite the permission
22419	    # denied error.
22420	    if test -n "$remotehost"; then
22421	      cygwin_hack=false
22422	    else
22423	      cygwin_hack=:
22424	    fi
22425	  else
22426	    cygwin_hack=false
22427	  fi
22428
22429	  cd $TESTDIR/1
22430	  if $cygwin_hack; then :; else
22431	    dotest modes3-5 "${testcvs} update" \
22432"${PROG} update: Updating \.
22433${PROG} update: Updating first-dir
22434${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
22435${PROG} update: skipping directory first-dir
22436${PROG} update: Updating second-dir"
22437	  fi
22438
22439	  # OK, I can see why one might say the above case could be a
22440	  # fatal error, because normally users without access to first-dir
22441	  # won't have it in their working directory.  But the next
22442	  # one is more of a problem if it is fatal.
22443	  #
22444	  # The second text string below is for Cygwin again, and again it
22445	  # should really be XFAIL under Cygwin, but for now deal with the
22446	  # passing opendir by accepting the alternate string.
22447	  rm -r first-dir
22448	  dotest modes3-6 "${testcvs} update -dP" \
22449"${PROG} update: Updating .
22450${PROG} update: Updating CVSROOT
22451U ${DOTSTAR}
22452${PROG} update: Updating first-dir
22453${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
22454${PROG} update: skipping directory first-dir
22455${PROG} update: Updating second-dir" \
22456"${PROG} update: Updating .
22457${PROG} update: Updating CVSROOT
22458U ${DOTSTAR}
22459${PROG} update: Updating first-dir
22460${PROG} update: Updating second-dir"
22461
22462	  cd ..
22463	  rm -r 1
22464	  chmod u+rwx ${CVSROOT_DIRNAME}/first-dir
22465	  rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
22466	  ;;
22467
22468	stamps)
22469	  # Test timestamps.
22470	  mkdir 1; cd 1
22471	  dotest stamps-1 "${testcvs} -q co -l ." ''
22472	  mkdir first-dir
22473	  dotest stamps-2 "${testcvs} add first-dir" \
22474"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22475	  cd first-dir
22476	  touch aa
22477	  echo '$''Id$' >kw
22478	  # Cygwin, *cough*, puts the year in the time column until the minute
22479	  # is no longer the current minute.  Sleep 60 seconds to avoid this
22480	  # problem.
22481	  sleep 60
22482	  ls -l aa >${TESTDIR}/1/stamp.aa.touch
22483	  ls -l kw >${TESTDIR}/1/stamp.kw.touch
22484	  # "sleep 1" would suffice if we could assume ls --full-time, but
22485	  # that is as far as I know unique to GNU ls.  Is there some POSIX.2
22486	  # way to get the timestamp of a file, including the seconds?
22487	  sleep 60
22488	  dotest stamps-3 "${testcvs} add aa kw" \
22489"${PROG} add: scheduling file .aa. for addition
22490${PROG} add: scheduling file .kw. for addition
22491${PROG} add: use .${PROG} commit. to add these files permanently"
22492	  ls -l aa >${TESTDIR}/1/stamp.aa.add
22493	  ls -l kw >${TESTDIR}/1/stamp.kw.add
22494	  # "cvs add" should not muck with the timestamp.
22495	  dotest stamps-4aa \
22496"cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
22497	  dotest stamps-4kw \
22498"cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
22499	  sleep 60
22500	  dotest stamps-5 "${testcvs} -q ci -m add" \
22501"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
22502done
22503Checking in aa;
22504${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22505initial revision: 1\.1
22506done
22507RCS file: ${CVSROOT_DIRNAME}/first-dir/kw,v
22508done
22509Checking in kw;
22510${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
22511initial revision: 1\.1
22512done"
22513	  # Cygwin, *cough*, puts the year in the time column until the minute
22514	  # is no longer the current minute.  Sleep 60 seconds to avoid this
22515	  # problem.
22516	  sleep 60
22517	  ls -l aa >${TESTDIR}/1/stamp.aa.ci
22518	  ls -l kw >${TESTDIR}/1/stamp.kw.ci
22519	  # If there are no keywords, "cvs ci" leaves the timestamp alone
22520	  # If there are, it sets the timestamp to the date of the commit.
22521	  # I'm not sure how logical this is, but it is intentional.
22522	  # If we wanted to get fancy we would make sure the time as
22523	  # reported in "cvs log kw" matched stamp.kw.ci.  But that would
22524	  # be a lot of work.
22525	  dotest stamps-6aa \
22526	    "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
22527	  if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
22528	  then
22529	    fail stamps-6kw
22530	  else
22531	    pass stamps-6kw
22532	  fi
22533	  cd ../..
22534	  sleep 60
22535	  mkdir 2
22536	  cd 2
22537	  dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
22538U first-dir/kw"
22539	  cd first-dir
22540	  ls -l aa >${TESTDIR}/1/stamp.aa.get
22541	  ls -l kw >${TESTDIR}/1/stamp.kw.get
22542	  # On checkout, CVS should set the timestamp to the date that the
22543	  # file was committed.  Could check that the time as reported in
22544	  # "cvs log aa" matches stamp.aa.get, but that would be a lot of
22545	  # work.
22546	  if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
22547	  then
22548	    fail stamps-8aa
22549	  else
22550	    pass stamps-8aa
22551	  fi
22552	  dotest stamps-8kw \
22553	    "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
22554
22555	  # Now we want to see what "cvs update" does.
22556	  sleep 60
22557	  echo add a line >>aa
22558	  echo add a line >>kw
22559	  dotest stamps-9 "${testcvs} -q ci -m change-them" \
22560"Checking in aa;
22561${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
22562new revision: 1\.2; previous revision: 1\.1
22563done
22564Checking in kw;
22565${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
22566new revision: 1\.2; previous revision: 1\.1
22567done"
22568	  
22569	  # Cygwin, *cough*, puts the year in the time column until the minute
22570	  # is no longer the current minute.  Sleep 60 seconds to avoid this
22571	  # problem.
22572	  sleep 60
22573	  ls -l aa >${TESTDIR}/1/stamp.aa.ci2
22574	  ls -l kw >${TESTDIR}/1/stamp.kw.ci2
22575	  cd ../..
22576	  cd 1/first-dir
22577	  sleep 60
22578	  dotest stamps-10 "${testcvs} -q update" '[UP] aa
22579[UP] kw'
22580	  # this doesn't serve any function other than being able to
22581	  # look at it manually, as we have no machinery for dates being
22582	  # newer or older than other dates.
22583	  date >${TESTDIR}/1/stamp.debug.update
22584	  ls -l aa >${TESTDIR}/1/stamp.aa.update
22585	  ls -l kw >${TESTDIR}/1/stamp.kw.update
22586	  # stamp.aa.update and stamp.kw.update should both be approximately
22587	  # the same as stamp.debug.update.  Perhaps we could be testing
22588	  # this in a more fancy fashion by "touch stamp.before" before
22589	  # stamps-10, "touch stamp.after" after, and then using ls -t
22590	  # to check them.  But for now we just make sure that the *.update
22591	  # stamps differ from the *.ci2 ones.
22592	  # As for the rationale, this is so that if one updates and gets
22593	  # a new revision, then "make" will be sure to regard those files
22594	  # as newer than .o files which may be sitting around.
22595	  if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
22596	     >/dev/null
22597	  then
22598	    fail stamps-11aa
22599	  else
22600	    pass stamps-11aa
22601	  fi
22602	  if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
22603	     >/dev/null
22604	  then
22605	    fail stamps-11kw
22606	  else
22607	    pass stamps-11kw
22608	  fi
22609
22610	  cd ../..
22611
22612	  if $keep; then
22613	    echo Keeping ${TESTDIR} and exiting due to --keep
22614	    exit 0
22615	  fi
22616
22617	  rm -r 1 2
22618	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22619	  ;;
22620
22621	perms)
22622	  # short cut around checking out and committing CVSROOT
22623	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22624	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22625	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22626
22627	  mkdir 1; cd 1
22628	  dotest perms-1 "${testcvs} -q co -l ." ''
22629	  mkdir first-dir
22630	  dotest perms-2 "${testcvs} add first-dir" \
22631"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22632	  cd first-dir
22633
22634	  touch foo
22635	  chmod 431 foo
22636	  dotest perms-3 "${testcvs} add foo" \
22637"${PROG} add: scheduling file .foo. for addition
22638${PROG} add: use .${PROG} commit. to add this file permanently"
22639	  dotest perms-4 "${testcvs} -q ci -m ''" \
22640"RCS file: ${CVSROOT_DIRNAME}/first-dir/foo,v
22641done
22642Checking in foo;
22643${CVSROOT_DIRNAME}/first-dir/foo,v  <--  foo
22644initial revision: 1\.1
22645done"
22646
22647	  # Test checking out files with different permissions.
22648	  cd ../..
22649	  mkdir 2; cd 2
22650	  dotest perms-5 "${testcvs} -q co first-dir" "U first-dir/foo"
22651	  cd first-dir
22652	  if $remote; then :; else
22653	    # PreservePermissions not yet implemented for remote.
22654	    dotest perms-6 "ls -l foo" "-r---wx--x .* foo"
22655	  fi
22656
22657	  cd ../..
22658	  rm -rf 1 2
22659	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22660
22661	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22662	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
22663	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22664	  ;;
22665
22666	symlinks)
22667	  # short cut around checking out and committing CVSROOT
22668	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22669	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22670	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22671
22672	  mkdir 1; cd 1
22673	  dotest symlinks-1 "${testcvs} -q co -l ." ''
22674	  mkdir first-dir
22675	  dotest symlinks-2 "${testcvs} add first-dir" \
22676"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22677	  cd first-dir
22678
22679	  dotest symlinks-2.1 "ln -s ${TESTDIR}/fumble slink" ""
22680	  dotest symlinks-3 "${testcvs} add slink" \
22681"${PROG} add: scheduling file .slink. for addition
22682${PROG} add: use .${PROG} commit. to add this file permanently"
22683	  if $remote; then
22684	    # Remote doesn't implement PreservePermissions, and in its
22685	    # absence the correct behavior is to follow the symlink.
22686	    dotest_fail symlinks-4r "${testcvs} -q ci -m ''" \
22687"${PROG} \[commit aborted\]: reading slink: No such file or directory"
22688	  else
22689	    dotest symlinks-4 "${testcvs} -q ci -m ''" \
22690"RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
22691done
22692Checking in slink;
22693${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22694initial revision: 1\.1
22695done"
22696
22697	    # Test checking out symbolic links.
22698	    cd ../..
22699	    mkdir 2; cd 2
22700	    dotest symlinks-5 "${testcvs} -q co first-dir" "U first-dir/slink"
22701	    cd first-dir
22702	    dotest symlinks-6 "ls -l slink" \
22703"l[rwx\-]* .* slink -> ${TESTDIR}/fumble"
22704	  fi
22705
22706	  cd ../..
22707	  rm -rf 1 2
22708	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22709
22710	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22711	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
22712	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22713	  ;;
22714
22715	symlinks2)
22716	  # Symlinks in working directory without PreservePermissions.
22717	  # Also see: symlinks: with PreservePermissions
22718	  # rcslib-symlink-*: symlinks in repository.
22719	  mkdir 1; cd 1
22720	  dotest symlinks2-1 "${testcvs} -q co -l ." ''
22721	  mkdir first-dir
22722	  dotest symlinks2-2 "${testcvs} add first-dir" \
22723"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22724	  cd first-dir
22725	  echo nonsymlink > slink
22726	  dotest symlinks2-3 "${testcvs} add slink" \
22727"${PROG} add: scheduling file .slink. for addition
22728${PROG} add: use .${PROG} commit. to add this file permanently"
22729	  dotest symlinks2-4 "${testcvs} -q ci -m ''" \
22730"RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
22731done
22732Checking in slink;
22733${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22734initial revision: 1\.1
22735done"
22736	  rm slink
22737	  # Choose name cvslog.* so it is in default ignore list.
22738	  echo second file >cvslog.file2
22739	  dotest symlinks2-5 "ln -s cvslog.file2 slink" ""
22740	  dotest symlinks2-6 "${testcvs} -q ci -m linkify" \
22741"Checking in slink;
22742${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
22743new revision: 1\.2; previous revision: 1\.1
22744done"
22745	  dotest symlinks2-7 "${testcvs} -q update -r 1.1 slink" "[UP] slink"
22746	  dotest symlinks2-8 "cat slink" "nonsymlink"
22747	  dotest symlinks2-9 "ls -l slink" "-[-rwx]* .* slink"
22748	  cd ../..
22749
22750	  rm -rf 1
22751	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22752	  ;;
22753
22754	hardlinks)
22755	  # short cut around checking out and committing CVSROOT
22756	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22757	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
22758	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22759
22760	  mkdir 1; cd 1
22761	  dotest hardlinks-1 "${testcvs} -q co -l ." ''
22762	  mkdir first-dir
22763	  dotest hardlinks-2 "${testcvs} add first-dir" \
22764"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22765	  cd first-dir
22766
22767	  # Make up some ugly filenames, to test that they get
22768	  # encoded properly in the delta nodes.  Note that `dotest' screws
22769	  # up if some arguments have embedded spaces.
22770	  if touch aaaa
22771	  then
22772	    pass hardlinks-2.1
22773	  else
22774	    fail hardlinks-2.1
22775	  fi
22776
22777	  if ln aaaa b.b.b.b
22778	  then
22779	    pass hardlinks-2.2
22780	  else
22781	    fail hardlinks-2.2
22782	  fi
22783
22784	  if ln aaaa 'dd dd dd'
22785	  then
22786	    pass hardlinks-2.3
22787	  else
22788	    fail hardlinks-2.3
22789	  fi
22790
22791	  dotest hardlinks-3 "${testcvs} add [abd]*" \
22792"${PROG} add: scheduling file .aaaa. for addition
22793${PROG} add: scheduling file .b\.b\.b\.b. for addition
22794${PROG} add: scheduling file .dd dd dd. for addition
22795${PROG} add: use .${PROG} commit. to add these files permanently"
22796	  dotest hardlinks-4 "${testcvs} -q ci -m ''" \
22797"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaaa,v
22798done
22799Checking in aaaa;
22800${CVSROOT_DIRNAME}/first-dir/aaaa,v  <--  aaaa
22801initial revision: 1\.1
22802done
22803RCS file: ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v
22804done
22805Checking in b\.b\.b\.b;
22806${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v  <--  b\.b\.b\.b
22807initial revision: 1\.1
22808done
22809RCS file: ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v
22810done
22811Checking in dd dd dd;
22812${CVSROOT_DIRNAME}/first-dir/dd dd dd,v  <--  dd dd dd
22813initial revision: 1\.1
22814done"
22815	  # Test checking out hardlinked files.
22816	  cd ../..
22817	  mkdir 2; cd 2
22818	  if $remote; then
22819	    # Remote does not implement PreservePermissions.
22820	    dotest hardlinks-5r "${testcvs} -q co first-dir" \
22821"U first-dir/aaaa
22822U first-dir/b\.b\.b\.b
22823U first-dir/dd dd dd"
22824	    cd first-dir
22825	    dotest hardlinks-6r "ls -l [abd]*" \
22826"-[rwx\-]* *1 .* aaaa
22827-[rwx\-]* *1 .* b\.b\.b\.b
22828-[rwx\-]* *1 .* dd dd dd"
22829	  else
22830	    dotest hardlinks-5 "${testcvs} -q co first-dir" \
22831"U first-dir/aaaa
22832U first-dir/b\.b\.b\.b
22833U first-dir/dd dd dd"
22834	    cd first-dir
22835	    # To make sure that the files are properly hardlinked, it
22836	    # would be nice to do `ls -i' and make sure all the inodes
22837	    # match.  But I think that would require expr to support
22838	    # tagged regexps, and I don't think we can rely on that.
22839	    # So instead we just see that each file has the right
22840	    # number of links. -twp
22841	    dotest hardlinks-6 "ls -l [abd]*" \
22842"-[rwx\-]* *3 .* aaaa
22843-[rwx\-]* *3 .* b\.b\.b\.b
22844-[rwx\-]* *3 .* dd dd dd"
22845	  fi
22846
22847	  cd ../..
22848	  rm -rf 1 2
22849	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22850
22851	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
22852	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
22853	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
22854	  ;;
22855
22856	sticky)
22857	  # More tests of sticky tags, particularly non-branch sticky tags.
22858	  # See many tests (e.g. multibranch) for ordinary sticky tag
22859	  # operations such as adding files on branches.
22860	  # See "head" test for interaction between stick tags and HEAD.
22861	  mkdir 1; cd 1
22862	  dotest sticky-1 "${testcvs} -q co -l ." ''
22863	  mkdir first-dir
22864	  dotest sticky-2 "${testcvs} add first-dir" \
22865"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22866	  cd first-dir
22867
22868	  touch file1
22869	  dotest sticky-3 "${testcvs} add file1" \
22870"${PROG} add: scheduling file .file1. for addition
22871${PROG} add: use .${PROG} commit. to add this file permanently"
22872	  dotest sticky-4 "${testcvs} -q ci -m add" \
22873"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22874done
22875Checking in file1;
22876${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22877initial revision: 1\.1
22878done"
22879	  dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
22880	  echo add a line >>file1
22881	  dotest sticky-6 "${testcvs} -q ci -m modify" \
22882"Checking in file1;
22883${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22884new revision: 1\.2; previous revision: 1\.1
22885done"
22886	  dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
22887	  dotest sticky-8 "cat file1" ''
22888	  dotest sticky-9 "${testcvs} -q update" ''
22889	  dotest sticky-10 "cat file1" ''
22890	  touch file2
22891	  dotest_fail sticky-11 "${testcvs} add file2" \
22892"${PROG} add: cannot add file on non-branch tag tag1"
22893	  dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
22894${QUESTION} file2" "${QUESTION} file2
22895[UP] file1"
22896	  dotest sticky-13 "${testcvs} add file2" \
22897"${PROG} add: scheduling file .file2. for addition
22898${PROG} add: use .${PROG} commit. to add this file permanently"
22899	  dotest sticky-14 "${testcvs} -q ci -m add" \
22900"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22901done
22902Checking in file2;
22903${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22904initial revision: 1\.1
22905done"
22906
22907	  # Now back to tag1
22908	  dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
22909${PROG} update: file2 is no longer in the repository"
22910
22911	  rm file1
22912	  dotest sticky-16 "${testcvs} rm file1" \
22913"${PROG} remove: scheduling .file1. for removal
22914${PROG} remove: use .${PROG} commit. to remove this file permanently"
22915	  # Hmm, this command seems to silently remove the tag from
22916	  # the file.  This appears to be intentional.
22917	  # The silently part especially strikes me as odd, though.
22918	  dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
22919	  dotest sticky-18 "${testcvs} -q update -A" "U file1
22920U file2"
22921	  dotest sticky-19 "${testcvs} -q update -r tag1" \
22922"${PROG} update: file1 is no longer in the repository
22923${PROG} update: file2 is no longer in the repository"
22924	  dotest sticky-20 "${testcvs} -q update -A" "U file1
22925U file2"
22926
22927	  # Now try with a numeric revision.
22928	  dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
22929	  dotest sticky-22 "${testcvs} rm -f file1" \
22930"${PROG} remove: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
22931	  # The old behavior was that remove allowed this and then commit
22932	  # gave an error, which was somewhat hard to clear.  I mean, you
22933	  # could get into a long elaborate discussion of this being a
22934	  # conflict and two ways to resolve it, but I don't really see
22935	  # why CVS should have a concept of conflict that arises, not from
22936	  # parallel development, but from CVS's own sticky tags.
22937
22938	  # Ditto with a sticky date.
22939	  #
22940	  # I'm kind of surprised that the "file1 was lost" doesn't crop
22941	  # up elsewhere in the testsuite.  It is a long-standing
22942	  # discrepency between local and remote CVS and should probably
22943	  # be cleaned up at some point.
22944	  dotest sticky-23 "${testcvs} -q update -Dnow file1" \
22945"${PROG} update: warning: file1 was lost
22946U file1" "U file1"
22947	  dotest sticky-24 "${testcvs} rm -f file1" \
22948"${PROG} remove: cannot remove file .file1. which has a sticky date of .[0-9.]*."
22949
22950	  dotest sticky-25 "${testcvs} -q update -A" \
22951"${PROG} update: warning: file1 was lost
22952U file1" "U file1"
22953
22954	  cd ../..
22955	  rm -r 1
22956	  rm -rf ${CVSROOT_DIRNAME}/first-dir
22957	  ;;
22958
22959	keyword)
22960	  # Test keyword expansion.
22961	  # Various other tests relate to our ability to correctly
22962	  # set the keyword expansion mode.
22963	  # "binfiles" tests "cvs admin -k".
22964	  # "binfiles" and "binfiles2" test "cvs add -k".
22965	  # "rdiff" tests "cvs co -k".
22966	  # "binfiles" (and this test) test "cvs update -k".
22967	  # "binwrap" tests setting the mode from wrappers.
22968	  # "keyword2" tests "cvs update -kk -j" with text and binary files
22969	  # I don't think any test is testing "cvs import -k".
22970	  # Other keyword expansion tests:
22971	  #   keywordlog - $Log.
22972	  mkdir 1; cd 1
22973	  dotest keyword-1 "${testcvs} -q co -l ." ''
22974	  mkdir first-dir
22975	  dotest keyword-2 "${testcvs} add first-dir" \
22976"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22977          cd first-dir
22978
22979	  echo '$''Author$' > file1
22980	  echo '$''Date$' >> file1
22981	  echo '$''Header$' >> file1
22982	  echo '$''Id$' >> file1
22983	  echo '$''Locker$' >> file1
22984	  echo '$''Name$' >> file1
22985	  echo '$''RCSfile$' >> file1
22986	  echo '$''Revision$' >> file1
22987	  echo '$''Source$' >> file1
22988	  echo '$''State$' >> file1
22989	  echo '$''Nonkey$' >> file1
22990	  # Omit the trailing dollar sign
22991	  echo '$''Date' >> file1
22992	  # Put two keywords on one line
22993	  echo '$''State$' '$''State$' >> file1
22994	  # Use a header for Log
22995	  echo 'xx $''Log$' >> file1
22996
22997	  dotest keyword-3 "${testcvs} add file1" \
22998"${PROG} add: scheduling file .file1. for addition
22999${PROG} add: use .${PROG} commit. to add this file permanently"
23000	  dotest keyword-4 "${testcvs} -q ci -m add" \
23001"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23002done
23003Checking in file1;
23004${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23005initial revision: 1\.1
23006done"
23007	  dotest keyword-5 "cat file1" \
23008'\$'"Author: ${username} "'\$'"
23009"'\$'"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] "'\$'"
23010"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23011"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23012"'\$'"Locker:  "'\$'"
23013"'\$'"Name:  "'\$'"
23014"'\$'"RCSfile: file1,v "'\$'"
23015"'\$'"Revision: 1\.1 "'\$'"
23016"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23017"'\$'"State: Exp "'\$'"
23018"'\$'"Nonkey"'\$'"
23019"'\$'"Date
23020"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23021xx "'\$'"Log: file1,v "'\$'"
23022xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23023xx add
23024xx"
23025
23026	  # Use cvs admin to lock the RCS file in order to check -kkvl
23027	  # vs. -kkv.  CVS does not normally lock RCS files, but some
23028	  # people use cvs admin to enforce reserved checkouts.
23029	  dotest keyword-6 "${testcvs} admin -l file1" \
23030"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
230311\.1 locked
23032done"
23033
23034	  dotest keyword-7 "$testcvs update -kkv file1" '[UP] file1'
23035	  dotest keyword-8 "cat file1" \
23036'\$'"Author: ${username} "'\$'"
23037"'\$'"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] "'\$'"
23038"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23039"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
23040"'\$'"Locker:  "'\$'"
23041"'\$'"Name:  "'\$'"
23042"'\$'"RCSfile: file1,v "'\$'"
23043"'\$'"Revision: 1\.1 "'\$'"
23044"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23045"'\$'"State: Exp "'\$'"
23046"'\$'"Nonkey"'\$'"
23047"'\$'"Date
23048"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23049xx "'\$'"Log: file1,v "'\$'"
23050xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23051xx add
23052xx"
23053
23054	  dotest keyword-9 "$testcvs update -kkvl file1" '[UP] file1'
23055	  dotest keyword-10 "cat file1" \
23056'\$'"Author: ${username} "'\$'"
23057"'\$'"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] "'\$'"
23058"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
23059"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
23060"'\$'"Locker: ${username} "'\$'"
23061"'\$'"Name:  "'\$'"
23062"'\$'"RCSfile: file1,v "'\$'"
23063"'\$'"Revision: 1\.1 "'\$'"
23064"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
23065"'\$'"State: Exp "'\$'"
23066"'\$'"Nonkey"'\$'"
23067"'\$'"Date
23068"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
23069xx "'\$'"Log: file1,v "'\$'"
23070xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23071xx add
23072xx"
23073
23074	  dotest keyword-11 "${testcvs} update -kk file1" '[UP] file1'
23075	  dotest keyword-12 "cat file1" \
23076'\$'"Author"'\$'"
23077"'\$'"Date"'\$'"
23078"'\$'"Header"'\$'"
23079"'\$'"Id"'\$'"
23080"'\$'"Locker"'\$'"
23081"'\$'"Name"'\$'"
23082"'\$'"RCSfile"'\$'"
23083"'\$'"Revision"'\$'"
23084"'\$'"Source"'\$'"
23085"'\$'"State"'\$'"
23086"'\$'"Nonkey"'\$'"
23087"'\$'"Date
23088"'\$'"State"'\$'" "'\$'"State"'\$'"
23089xx "'\$'"Log"'\$'"
23090xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23091xx add
23092xx"
23093
23094	  dotest keyword-13 "$testcvs update -kv file1" '[UP] file1'
23095	  dotest keyword-14 "cat file1" \
23096"${username}
23097[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]
23098${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
23099file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
23100
23101
23102file1,v
231031\.1
23104${CVSROOT_DIRNAME}/first-dir/file1,v
23105Exp
23106"'\$'"Nonkey"'\$'"
23107"'\$'"Date
23108Exp Exp
23109xx file1,v
23110xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
23111xx add
23112xx"
23113
23114	  dotest keyword-15 "${testcvs} update -ko file1" "U file1"
23115	  dotest keyword-16 "cat file1" \
23116'\$'"Author"'\$'"
23117"'\$'"Date"'\$'"
23118"'\$'"Header"'\$'"
23119"'\$'"Id"'\$'"
23120"'\$'"Locker"'\$'"
23121"'\$'"Name"'\$'"
23122"'\$'"RCSfile"'\$'"
23123"'\$'"Revision"'\$'"
23124"'\$'"Source"'\$'"
23125"'\$'"State"'\$'"
23126"'\$'"Nonkey"'\$'"
23127"'\$'"Date
23128"'\$'"State"'\$'" "'\$'"State"'\$'"
23129xx "'\$'"Log"'\$'
23130
23131	  # Test the Name keyword.  First go back to normal expansion.
23132
23133	  dotest keyword-17 "${testcvs} update -A file1" "U file1"
23134
23135	  echo '$''Name$' > file1
23136	  dotest keyword-18 "${testcvs} ci -m modify file1" \
23137"Checking in file1;
23138${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23139new revision: 1\.2; previous revision: 1\.1
23140done"
23141	  dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
23142	  echo "change" >> file1
23143	  dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
23144"Checking in file1;
23145${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23146new revision: 1\.3; previous revision: 1\.2
23147done"
23148
23149	  # Prior to 1.11.23, remote CVS would fail the patch checksum test
23150	  # and refetch the file here, failing this test.
23151	  dotest keyword-21 "$testcvs -q update -r tag1" 'U file1'
23152
23153	  dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$'
23154
23155	  # The update used to fail the first time with a checksum failure
23156	  # here, then the server would send the whole failure.  This was fixed
23157	  # in 1.11.23.
23158	  dotest keyword-23 "$testcvs update -A file1" "U file1"
23159	  dotest keyword-24 "cat file1" '\$'"Name:  "'\$'"
23160change"
23161
23162	  cd ../..
23163	  rm -r 1
23164	  rm -rf ${CVSROOT_DIRNAME}/first-dir
23165	  ;;
23166
23167	keywordlog)
23168	  # Test the Log keyword.
23169	  mkdir 1; cd 1
23170	  dotest keywordlog-1 "${testcvs} -q co -l ." ''
23171	  mkdir first-dir
23172	  dotest keywordlog-2 "${testcvs} add first-dir" \
23173"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23174	  cd first-dir
23175	  echo initial >file1
23176	  dotest keywordlog-3 "${testcvs} add file1" \
23177"${PROG} add: scheduling file .file1. for addition
23178${PROG} add: use .${PROG} commit. to add this file permanently"
23179
23180	  # See "rmadd" for a list of other tests of cvs ci -r.
23181	  dotest keywordlog-4 "${testcvs} -q ci -r 1.3 -m add file1" \
23182"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23183done
23184Checking in file1;
23185${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23186initial revision: 1\.3
23187done"
23188
23189	  cd ../..
23190	  mkdir 2; cd 2
23191	  dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
23192	  cd ../1/first-dir
23193
23194	  echo 'xx $''Log$' >> file1
23195	  cat >${TESTDIR}/comment.tmp <<EOF
23196First log line
23197Second log line
23198EOF
23199	  # As with rmadd-25, "cvs ci -r" sets a sticky tag.
23200	  dotest_fail keywordlog-4b \
23201"${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
23202"${PROG} commit: sticky tag .1\.3. for file .file1. is not a branch
23203${PROG} \[commit aborted\]: correct above errors first!"
23204	  dotest keywordlog-4c "${testcvs} -q update -A" "M file1"
23205
23206	  dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
23207"Checking in file1;
23208${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23209new revision: 1\.4; previous revision: 1\.3
23210done"
23211	  rm -f ${TESTDIR}/comment.tmp
23212	  dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
23213	  dotest keywordlog-7 "cat file1" \
23214"initial
23215xx "'\$'"Log: file1,v "'\$'"
23216xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23217xx First log line
23218xx Second log line
23219xx"
23220
23221	  cd ../../2/first-dir
23222	  dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
23223	  dotest keywordlog-9 "cat file1" \
23224"initial
23225xx "'\$'"Log: file1,v "'\$'"
23226xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23227xx First log line
23228xx Second log line
23229xx"
23230	  cd ../../1/first-dir
23231
23232	  echo "change" >> file1
23233	  dotest keywordlog-10 "${testcvs} ci -m modify file1" \
23234"Checking in file1;
23235${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23236new revision: 1\.5; previous revision: 1\.4
23237done"
23238	  dotest keywordlog-11 "cat file1" \
23239"initial
23240xx "'\$'"Log: file1,v "'\$'"
23241xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23242xx modify
23243xx
23244xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23245xx First log line
23246xx Second log line
23247xx
23248change"
23249
23250	  cd ../../2/first-dir
23251	  dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
23252	  dotest keywordlog-13 "cat file1" \
23253"initial
23254xx "'\$'"Log: file1,v "'\$'"
23255xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23256xx modify
23257xx
23258xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23259xx First log line
23260xx Second log line
23261xx
23262change"
23263
23264	  cd ../../1/first-dir
23265	  dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
23266	  echo br-change >>file1
23267	  dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
23268"Checking in file1;
23269${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23270new revision: 1\.4\.2\.1; previous revision: 1\.4
23271done"
23272	  dotest keywordlog-16 "cat file1" \
23273"initial
23274xx "'\$'"Log: file1,v "'\$'"
23275xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23276xx br-modify
23277xx
23278xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23279xx First log line
23280xx Second log line
23281xx
23282br-change"
23283	  cd ../../2/first-dir
23284	  dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
23285	  dotest keywordlog-18 "cat file1" \
23286"initial
23287xx "'\$'"Log: file1,v "'\$'"
23288xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23289xx br-modify
23290xx
23291xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23292xx First log line
23293xx Second log line
23294xx
23295br-change"
23296	  cd ../..
23297	  dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
23298"initial
23299xx "'\$'"Log: file1,v "'\$'"
23300xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
23301xx br-modify
23302xx
23303xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23304xx First log line
23305xx Second log line
23306xx
23307br-change"
23308	  dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
23309"initial
23310xx "'\$'"Log: file1,v "'\$'"
23311xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
23312xx modify
23313xx
23314xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23315xx First log line
23316xx Second log line
23317xx
23318change"
23319	  dotest keywordlog-21 "${testcvs} -q co -p -r 1.4 first-dir/file1" \
23320"initial
23321xx "'\$'"Log: file1,v "'\$'"
23322xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23323xx First log line
23324xx Second log line
23325xx"
23326
23327	  cd 2/first-dir
23328	  # OK, the basic rule for keyword expansion is that it
23329	  # happens on checkout.  And the rule for annotate is that
23330	  # it annotates a checked-in revision, rather than a checked-out
23331	  # file.  So, although it is kind of confusing that the latest
23332	  # revision does not appear in the annotated output, and the
23333	  # annotated output does not quite match what you'd get with
23334	  # update or checkout, the behavior is more or less logical.
23335	  # The same issue occurs with annotate and other keywords,
23336	  # I think, although it is particularly noticeable for $Log.
23337	  dotest keywordlog-22 "${testcvs} ann -r br file1" \
23338"
23339Annotations for file1
23340\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
233411\.3          ($username8 *[0-9a-zA-Z-]*): initial
233421\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
233431\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  $username
233441\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx First log line
233451\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx Second log line
233461\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): xx
233471\.4\.2\.1      ($username8 *[0-9a-zA-Z-]*): br-change"
23348	  dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \
23349"
23350Annotations for file1
23351\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
233521\.3          ($username8 *[0-9a-zA-Z-]*): initial
233531\.5          ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
233541\.5          ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  $username
233551\.5          ($username8 *[0-9a-zA-Z-]*): xx First log line
233561\.5          ($username8 *[0-9a-zA-Z-]*): xx Second log line
233571\.5          ($username8 *[0-9a-zA-Z-]*): xx
233581\.5          ($username8 *[0-9a-zA-Z-]*): change"
23359	  cd ../..
23360
23361	  #
23362	  # test the operation of 'admin -o' in conjunction with keywords
23363	  # (especially Log - this used to munge the RCS file for all time)
23364	  #
23365
23366	  dotest keywordlog-24 \
23367"${testcvs} admin -oHEAD 1/first-dir/file1" \
23368"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23369deleting revision 1\.5
23370done"
23371
23372	  dotest keywordlog-25 \
23373"${testcvs} -q co -p first-dir/file1" \
23374"initial
23375xx "'\$'"Log: file1,v "'\$'"
23376xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
23377xx First log line
23378xx Second log line
23379xx"
23380
23381	  if $keep; then
23382	    echo Keeping ${TESTDIR} and exiting due to --keep
23383	    exit 0
23384	  fi
23385
23386	  rm -r 1 2
23387	  rm -rf ${CVSROOT_DIRNAME}/first-dir
23388	  ;;
23389
23390	keywordname)
23391	  # Test the Name keyword.
23392	  # See the keyword test for a descriptions of some other tests that
23393	  # test keyword expansion modes.
23394	  mkdir keywordname; cd keywordname
23395	  mkdir 1; cd 1
23396	  dotest keywordname-init-1 "${testcvs} -q co -l ." ''
23397	  mkdir first-dir
23398	  dotest keywordname-init-2 "${testcvs} add first-dir" \
23399"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23400	  cd first-dir
23401
23402	  echo '$'"Name$" >file1
23403	  echo '$'"Name$" >file2
23404	  dotest keywordname-init-3 "${testcvs} add file1 file2" \
23405"${PROG} add: scheduling file .file1. for addition
23406${PROG} add: scheduling file .file2. for addition
23407${PROG} add: use .${PROG} commit. to add these files permanently"
23408
23409	  # See "rmadd" for a list of other tests of cvs ci -r.
23410	  dotest keywordname-init-4 "${testcvs} -q ci -r 1.3 -m add" \
23411"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23412done
23413Checking in file1;
23414${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23415initial revision: 1\.3
23416done
23417RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23418done
23419Checking in file2;
23420${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23421initial revision: 1\.3
23422done"
23423	  dotest keywordname-init-5b "cat file1" \
23424'\$''Name:  \$'
23425	  dotest keywordname-init-5c "cat file2" \
23426'\$''Name:  \$'
23427
23428	  dotest keywordname-init-6 "$testcvs -q up -A"
23429	  dotest keywordname-init-6b "cat file1" \
23430'\$''Name:  \$'
23431	  dotest keywordname-init-6c "cat file2" \
23432'\$''Name:  \$'
23433
23434	  dotest keywordname-init-7 "${testcvs} -q tag -b br" \
23435"T file1
23436T file2"
23437
23438	  echo new data >>file1
23439	  dotest keywordname-init-8 "${testcvs} -q ci -mchange" \
23440"Checking in file1;
23441${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23442new revision: 1\.4; previous revision: 1\.3
23443done"
23444
23445	  # First check out a branch.
23446	  #
23447	  # There used to be a bug where static tags would be substituted for
23448	  # Name keywords but not branch tags.
23449	  #
23450	  # Prior to 1.11.23, there also used to be a bug where keyword
23451	  # substitutions were not performed unless the file was otherwise
23452	  # updated.  When this bug was present, keywordname-update-1 would
23453	  # report a patch checksum failure and refetch file1 in client/server
23454	  # mode and no `br' would have been substituted into Name's value for
23455	  # file2, meaning keywordname-update-3 would also fail.
23456	  dotest keywordname-update-1 "$testcvs -q up -rbr" \
23457'U file1
23458U file2'
23459	  dotest keywordname-update-2 "cat file1" '\$''Name: br \$'
23460
23461	  # For the same reason keywordname-update-1 would fail above, no `br'
23462	  # would have been substituted into Name's value here prior to
23463	  # 1.11.23.
23464	  dotest keywordname-update-3 "cat file2" '\$''Name: br \$'
23465
23466	  # Now verify that updating to the trunk leaves no substitution for
23467	  # $Name
23468	  dotest keywordname-update-4 "${testcvs} -q tag firsttag" \
23469"T file1
23470T file2"
23471	  # This used to fail in the same manner as keywordname-update-1.
23472	  dotest keywordname-update-5 "$testcvs -q up -A" \
23473'U file1
23474U file2'
23475	  dotest keywordname-update-6 "cat file1" \
23476'\$''Name:  \$
23477new data'
23478	  dotest keywordname-update-7 "cat file2" '\$''Name:  \$'
23479
23480	  # This used to fail in the same manner as keywordname-update-1.
23481	  dotest keywordname-update-8 "$testcvs -q up -rfirsttag" \
23482'U file1
23483U file2'
23484	  dotest keywordname-update-9 "cat file1" '\$''Name: firsttag \$'
23485
23486	  # This used to fail in the same manner as keywordname-update-3.
23487	  dotest keywordname-update-10 "cat file2" '\$''Name: firsttag \$'
23488
23489	  # And reverify the trunk update when the change is actually removed.
23490	  dotest keywordname-update-11 "$testcvs -q up -A" \
23491'U file1
23492U file2'
23493	  dotest keywordname-update-12 "cat file1" \
23494'\$''Name:  \$
23495new data'
23496	  dotest keywordname-update-13 "cat file2" '\$''Name:  \$'
23497
23498	  cd ../..
23499
23500	  # now verify that a fresh checkout substitutes all the $Name fields
23501	  mkdir 2; cd 2
23502	  dotest keywordname-checkout-1 \
23503"${testcvs} -q co -rfirsttag first-dir" \
23504"U first-dir/file1
23505U first-dir/file2"
23506	  cd first-dir
23507	  dotest keywordname-checkout-2 "cat file1" '\$'"Name: firsttag "'\$'
23508	  dotest keywordname-checkout-3 "cat file2" '\$'"Name: firsttag "'\$'
23509
23510	  cd ../..
23511
23512	  if $keep; then
23513	    echo Keeping ${TESTDIR} and exiting due to --keep
23514	    exit 0
23515	  fi
23516
23517	  cd ..
23518	  rm -r keywordname
23519	  rm -rf ${CVSROOT_DIRNAME}/first-dir
23520	  ;;
23521
23522	keyword2)
23523	  # Test merging on files with keywords:
23524	  #   without -kk
23525	  #   with -kk
23526	  #     on text files
23527	  #     on binary files
23528	  # Note:  This test assumes that CVS has already passed the binfiles
23529	  #    test sequence
23530	  # Note2:  We are testing positive on binary corruption here
23531	  #    we probably really DON'T want to 'cvs update -kk' a binary file...
23532	  mkdir 1; cd 1
23533	  dotest keyword2-1 "${testcvs} -q co -l ." ''
23534	  mkdir first-dir
23535	  dotest keyword2-2 "${testcvs} add first-dir" \
23536"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23537          cd first-dir
23538
23539	  echo '$''Revision$' >> file1
23540	  echo "I" >>file1
23541	  echo "like" >>file1
23542	  echo "long" >>file1
23543	  echo "files!" >>file1
23544	  echo "" >>file1
23545	  echo "a test line for our times" >>file1
23546	  echo "" >>file1
23547	  echo "They" >>file1
23548	  echo "make" >>file1
23549	  echo "diff" >>file1
23550	  echo "look like it" >>file1
23551	  echo "did a much better" >>file1
23552	  echo "job." >>file1
23553	  dotest keyword2-3 "${testcvs} add file1" \
23554"${PROG} add: scheduling file .file1. for addition
23555${PROG} add: use .${PROG} commit. to add this file permanently"
23556
23557	  ${AWK} 'BEGIN { printf "%c%c%c%sRevision: 1.1 $@%c%c", \
23558	    2, 10, 137, "$", 13, 10 }' \
23559	    </dev/null | ${TR} '@' '\000' >../binfile.dat
23560	  cp ../binfile.dat .
23561	  dotest keyword2-5 "${testcvs} add -kb binfile.dat" \
23562"${PROG} add: scheduling file .binfile\.dat. for addition
23563${PROG} add: use .${PROG} commit. to add this file permanently"
23564
23565	  dotest keyword2-6 "${testcvs} -q ci -m add" \
23566"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
23567done
23568Checking in binfile\.dat;
23569${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
23570initial revision: 1\.1
23571done
23572RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23573done
23574Checking in file1;
23575${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23576initial revision: 1\.1
23577done"
23578
23579	  dotest keyword2-7 "${testcvs} -q tag -b branch" \
23580"T binfile\.dat
23581T file1"
23582
23583	  sed -e 's/our/the best of and the worst of/' file1 >f; mv f file1
23584	  dotest keyword2-8 "${testcvs} -q ci -m change" \
23585"Checking in file1;
23586${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23587new revision: 1\.2; previous revision: 1\.1
23588done"
23589
23590	  dotest keyword2-9 "$testcvs -q update -r branch" \
23591'U binfile\.dat
23592[UP] file1'
23593
23594	  echo "what else do we have?" >>file1
23595	  dotest keyword2-10 "${testcvs} -q ci -m change" \
23596"Checking in file1;
23597${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23598new revision: 1\.1\.2\.1; previous revision: 1\.1
23599done"
23600
23601	  # Okay, first a conflict in file1 - should be okay with binfile.dat
23602	  dotest keyword2-11 "$testcvs -q update -A -j branch" \
23603"U binfile\.dat
23604U file1
23605RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
23606retrieving revision 1\.1
23607retrieving revision 1\.1\.2\.1
23608Merging differences between 1\.1 and 1\.1\.2\.1 into file1
23609rcsmerge: warning: conflicts during merge"
23610
23611	  dotest_fail keyword2-12 "${testcvs} diff file1" \
23612"Index: file1
23613===================================================================
23614RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23615retrieving revision 1\.2
23616diff -r1\.2 file1
236170a1
23618> <<<<<<< file1
236191a3,5
23620> =======
23621> \\\$""Revision: 1\.1\.2\.1 \\\$
23622> >>>>>>> 1\.1\.2\.1
2362314a19
23624> what else do we have${QUESTION}"
23625
23626	  # Here's the problem... shouldn't -kk a binary file...
23627	  rm file1
23628	  dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \
23629"${PROG} update: warning: file1 was lost
23630U file1
23631RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23632retrieving revision 1\.1
23633retrieving revision 1\.1\.2\.1
23634Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
23635
23636	  # binfile won't get checked in, but it is now corrupt and could
23637	  # have been checked in if it had changed on the branch...
23638	  dotest keyword2-14 "${testcvs} -q ci -m change" \
23639"Checking in file1;
23640${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23641new revision: 1\.3; previous revision: 1\.2
23642done"
23643
23644	  # "-kk" no longer corrupts binary files
23645	  dotest keyword2-15 "cmp binfile.dat ../binfile.dat" ''
23646
23647	  # Okay, restore everything and make CVS try and merge a binary file...
23648	  # "-kk" no longer affects binary files
23649	  dotest keyword2-16 "${testcvs} -q update -A" \
23650"[UP] file1"
23651	  dotest keyword2-17 "${testcvs} -q tag -b branch2" \
23652"T binfile\.dat
23653T file1"
23654	  dotest keyword2-18 "$testcvs -q update -r branch2" \
23655'U binfile\.dat
23656[UP] file1'
23657
23658	  ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
23659	    </dev/null | ${TR} '@' '\000' >>binfile.dat
23660	  dotest keyword2-19 "${testcvs} -q ci -m badbadbad" \
23661"Checking in binfile\.dat;
23662${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
23663new revision: 1\.1\.4\.1; previous revision: 1\.1
23664done"
23665	  # "-kk" no longer affects binary files
23666
23667	  # XXXX: do not ask, why we get the "U binfile.dat" line twice
23668	  #       looks like a bug!
23669	  dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \
23670"U binfile\.dat
23671U binfile\.dat
23672U file1"
23673
23674	  cd ../..
23675	  rm -r 1
23676	  rm -rf ${CVSROOT_DIRNAME}/first-dir
23677	  ;;
23678
23679	head)
23680	  # Testing handling of the HEAD special tag.
23681	  # There are many cases involving added and removed files
23682	  # which we don't yet try to deal with.
23683	  # TODO: We also could be paying much closer attention to
23684	  # "head of the trunk" versus "head of the default branch".
23685	  # That is what "cvs import" is doing here (but I didn't really
23686	  # fully follow through on writing the tests for that case).
23687	  mkdir imp-dir
23688	  cd imp-dir
23689	  echo 'imported contents' >file1
23690	  # It may seem like we don't do much with file2, but do note that
23691	  # the "cvs diff" invocations do also diff file2 (and come up empty).
23692	  echo 'imported contents' >file2
23693	  dotest_sort head-1 "${testcvs} import -m add first-dir tag1 tag2" \
23694"
23695
23696N first-dir/file1
23697N first-dir/file2
23698No conflicts created by this import"
23699	  cd ..
23700	  rm -r imp-dir
23701	  mkdir 1
23702	  cd 1
23703	  dotest head-2 "${testcvs} -q co first-dir" \
23704"U first-dir/file1
23705U first-dir/file2"
23706	  cd first-dir
23707	  echo 'add a line on trunk' >> file1
23708	  dotest head-3 "${testcvs} -q ci -m modify" \
23709"Checking in file1;
23710${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23711new revision: 1\.2; previous revision: 1\.1
23712done"
23713	  dotest head-4 "${testcvs} -q tag trunktag" "T file1
23714T file2"
23715	  echo 'add a line on trunk after trunktag' >> file1
23716	  dotest head-5 "${testcvs} -q ci -m modify" \
23717"Checking in file1;
23718${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23719new revision: 1\.3; previous revision: 1\.2
23720done"
23721	  dotest head-6 "${testcvs} -q tag -b br1" "T file1
23722T file2"
23723	  dotest head-7 "$testcvs -q update -r br1" \
23724'[UP] file1
23725[UP] file2'
23726	  echo 'modify on branch' >>file1
23727	  dotest head-8 "${testcvs} -q ci -m modify" \
23728"Checking in file1;
23729${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23730new revision: 1\.3\.2\.1; previous revision: 1\.3
23731done"
23732	  dotest head-9 "${testcvs} -q tag brtag" "T file1
23733T file2"
23734	  echo 'modify on branch after brtag' >>file1
23735	  dotest head-10 "${testcvs} -q ci -m modify" \
23736"Checking in file1;
23737${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23738new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
23739done"
23740	  # With no sticky tags, HEAD is the head of the trunk.
23741	  dotest head-trunk-setup "$testcvs -q update -A" \
23742'[UP] file1
23743[UP] file2'
23744	  dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
23745"imported contents
23746add a line on trunk
23747add a line on trunk after trunktag"
23748	  # and diff thinks so too.  Case (a) from the comment in
23749	  # cvs.texinfo (Common options).
23750	  dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
23751"Index: file1
23752===================================================================
23753RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23754retrieving revision 1\.3
23755retrieving revision 1\.3\.2\.2
23756diff -c -r1\.3 -r1\.3\.2\.2
23757\*\*\* file1	${RFCDATE}	1\.3
23758--- file1	${RFCDATE}	1\.3\.2\.2
23759\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23760\*\*\* 1,3 \*\*\*\*
23761--- 1,5 ----
23762  imported contents
23763  add a line on trunk
23764  add a line on trunk after trunktag
23765${PLUS} modify on branch
23766${PLUS} modify on branch after brtag"
23767
23768	  # With a branch sticky tag, HEAD is the head of the trunk.
23769	  dotest head-br1-setup "$testcvs -q update -r br1" \
23770'[UP] file1
23771[UP] file2'
23772	  dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
23773"imported contents
23774add a line on trunk
23775add a line on trunk after trunktag"
23776	  # But diff thinks that HEAD is "br1".  Case (b) from cvs.texinfo.
23777	  # Probably people are relying on it.
23778	  dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
23779
23780	  # With a nonbranch sticky tag on a branch,
23781	  # HEAD is the head of the trunk
23782	  dotest head-brtag-setup "$testcvs -q update -r brtag" \
23783'[UP] file1
23784[UP] file2'
23785	  dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
23786"imported contents
23787add a line on trunk
23788add a line on trunk after trunktag"
23789
23790	  # CVS 1.9 and older thought that HEAD is "brtag" (this was
23791	  # noted as "strange, maybe accidental").  But "br1" makes a
23792	  # whole lot more sense.
23793	  dotest head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
23794
23795	  # With a nonbranch sticky tag on the trunk, HEAD is the head
23796	  # of the trunk, I think.
23797	  dotest head-trunktag-setup "$testcvs -q update -r trunktag" \
23798'[UP] file1
23799[UP] file2'
23800	  dotest head-trunktag-check "cat file1" "imported contents
23801add a line on trunk"
23802	  dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
23803"imported contents
23804add a line on trunk
23805add a line on trunk after trunktag"
23806	  # Like head-brtag-diff, there is a non-branch sticky tag.
23807	  dotest_fail head-trunktag-diff \
23808	    "${testcvs} -q diff -c -r HEAD -r br1" \
23809"Index: file1
23810===================================================================
23811RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23812retrieving revision 1\.3
23813retrieving revision 1\.3\.2\.2
23814diff -c -r1\.3 -r1\.3\.2\.2
23815\*\*\* file1	${RFCDATE}	1\.3
23816--- file1	${RFCDATE}	1\.3\.2\.2
23817\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
23818\*\*\* 1,3 \*\*\*\*
23819--- 1,5 ----
23820  imported contents
23821  add a line on trunk
23822  add a line on trunk after trunktag
23823${PLUS} modify on branch
23824${PLUS} modify on branch after brtag"
23825
23826	  # Also might test what happens if we setup with update -r
23827	  # HEAD.  In general, if sticky tags matter, does the
23828	  # behavior of "update -r <foo>" (without -p) depend on the
23829	  # sticky tags before or after the update?
23830
23831	  # Note that we are testing both the case where this deletes
23832	  # a revision (file1) and the case where it does not (file2)
23833	  dotest_fail head-o0a "${testcvs} admin -o ::br1" \
23834"${PROG} admin: Administrating \.
23835RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23836${PROG} admin: cannot remove revision 1\.3\.2\.1 because it has tags
23837${PROG} admin: RCS file for .file1. not modified\.
23838RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23839done"
23840	  dotest head-o0b "${testcvs} tag -d brtag" \
23841"${PROG} tag: Untagging \.
23842D file1
23843D file2"
23844	  dotest head-o1 "${testcvs} admin -o ::br1" \
23845"${PROG} admin: Administrating \.
23846RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23847deleting revision 1\.3\.2\.1
23848done
23849RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23850done"
23851	  cd ../..
23852	  rm -r 1
23853	  rm -rf ${CVSROOT_DIRNAME}/first-dir
23854	  ;;
23855
23856	tagdate)
23857	  # Test combining -r and -D.
23858	  #
23859	  # Note that this is not a complete test.  It relies on the fact
23860	  # that update, checkout and export have a LOT of shared code.
23861	  # Notice:
23862	  #	1)  checkout is never tested at all with -r -D
23863	  #	2)  update never uses an argument to '-D' besides 'now'
23864	  #		(this test does not provide enough data to prove
23865	  #		that 'cvs update' with both a '-r' and a '-D'
23866	  #		specified does not ignore '-D': a 'cvs up
23867	  #		-r<branch> -Dnow' and a 'cvs up -r<branch>'
23868	  #		should specify the same file revision).
23869	  #	3)  export uses '-r<branch> -D<when there was a different
23870	  #		revision>', hopefully completing this behavior test
23871	  #		for checkout and update as well.
23872	  #
23873	  mkdir 1; cd 1
23874	  save_TZ=$TZ
23875	  TZ=UTC; export TZ
23876	  dotest tagdate-1 "${testcvs} -q co -l ." ''
23877	  mkdir first-dir
23878	  dotest tagdate-2 "${testcvs} add first-dir" \
23879"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
23880	  cd first-dir
23881
23882	  echo trunk-1 >file1
23883	  dotest tagdate-3 "${testcvs} add file1" \
23884"${PROG} add: scheduling file .file1. for addition
23885${PROG} add: use .${PROG} commit. to add this file permanently"
23886	  dotest tagdate-4 "${testcvs} -q ci -m add" \
23887"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
23888done
23889Checking in file1;
23890${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23891initial revision: 1\.1
23892done"
23893	  date_T1=`getrlogdate -r1.1 first-dir/file1`
23894
23895	  dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
23896	  dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
23897	  echo trunk-2 >file1
23898	  dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
23899"Checking in file1;
23900${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23901new revision: 1\.2; previous revision: 1\.1
23902done"
23903	  date_T2=`getrlogdate -r1.2 first-dir/file1`
23904
23905	  # We are testing -r -D where br1 is a (magic) branch without
23906	  # any revisions.  First the case where br2 doesn't have any
23907	  # revisions either:
23908	  dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
23909	  dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
23910	  echo br2-1 >file1
23911	  dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
23912"Checking in file1;
23913${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23914new revision: 1\.1\.4\.1; previous revision: 1\.1
23915done"
23916	  date_T3=`getrlogdate -r1.1.4.1 first-dir/file1`
23917
23918	  # Then the case where br2 does have revisions:
23919	  dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
23920
23921	  # For some reason, doing this on a branch seems to be relevant.
23922	  dotest_fail tagdate-12 "${testcvs} -q update -j:yesterday" \
23923"${PROG} \[update aborted\]: argument to join may not contain a date specifier without a tag"
23924	  # And check export
23925
23926	  echo br2-2 >file1
23927	  dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \
23928"Checking in file1;
23929${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
23930new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1
23931done"
23932	  date_T4=`getrlogdate -r1.1.4.2 first-dir/file1`
23933
23934	  cd ../..
23935	  mkdir 2; cd 2
23936	  dotest tagdate-14 "${testcvs} -q export -r br2 -D'$date_T3' first-dir" \
23937"[UP] first-dir/file1"
23938	  dotest tagdate-15 "cat first-dir/file1" "br2-1"
23939
23940	  # Now for annotate
23941	  cd ../1/first-dir
23942	  dotest tagdate-16 "${testcvs} annotate -rbr2 -D'$date_T3'" \
23943"
23944Annotations for file1
23945\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
239461\.1\.4\.1      ($username8 *[0-9a-zA-Z-]*): br2-1"
23947
23948	  dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \
23949"
23950Annotations for file1
23951\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
239521\.1\.4\.2      ($username8 *[0-9a-zA-Z-]*): br2-2"
23953
23954	  # Now check to see what happens when we add files to br2 and trunk
23955	  echo br2-1 > file3
23956	  dotest tagdate-18 "${testcvs} add file3" \
23957"${PROG} add: scheduling file \`file3' for addition on branch \`br2'
23958${PROG} add: use .${PROG} commit. to add this file permanently"
23959	  dotest tagdate-19 "${testcvs} -q ci -m add file3" \
23960"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
23961done
23962Checking in file3;
23963${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
23964new revision: 1\.1\.2\.1; previous revision: 1\.1
23965done"
23966	  date_T5=`getrlogdate -r1.1 first-dir/file3`
23967	  date_T6=`getrlogdate -r1.1.2.1 first-dir/file3`
23968
23969	  cd ../..
23970	  mkdir 3; cd 3
23971	  dotest tagdate-20 "${testcvs} -Q co first-dir" ''
23972	  cd first-dir
23973	  echo trunk-1 > file2
23974	  dotest tagdate-21 "${testcvs} add file2" \
23975"${PROG} add: scheduling file .file2. for addition
23976${PROG} add: use .${PROG} commit. to add this file permanently"
23977	  dotest tagdate-22 "${testcvs} -q ci -m add file2" \
23978"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
23979done
23980Checking in file2;
23981${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23982initial revision: 1\.1
23983done"
23984	  date_T7=`getrlogdate -r1.1 first-dir/file2`
23985	  echo "trunk-2" >file2
23986	  dotest tagdate-23 "${testcvs} -q ci -m update file2" \
23987"Checking in file2;
23988${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
23989new revision: 1\.2; previous revision: 1\.1
23990done"
23991	  date_T8=`getrlogdate -r1.2 first-dir/file2`
23992
23993	  cd ../../1/first-dir
23994	  echo br2-1 > file2
23995	  dotest tagdate-24 "${testcvs} add file2" \
23996"${PROG} add: scheduling file \`file2' for addition on branch \`br2'
23997${PROG} add: use .${PROG} commit. to add this file permanently"
23998	  dotest tagdate-25 "${testcvs} -q ci -m add file2" \
23999"Checking in file2;
24000${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24001new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
24002done"
24003	  date_T9=`getrlogdate -r1.2.2.2 first-dir/file2`
24004	  cd ../..
24005
24006	  # Time  Rev     Branch  Comments
24007	  # T0            trunk   first-dir created
24008	  # T1    1.1     trunk   first-dir/file1 committed "trunk-1"
24009	  #               br1     branch created
24010	  #               br2     branch created
24011	  # T2    1.2     trunk   first-dir/file1 committed "trunk-2"
24012	  # T3    1.1.4.1 br2     first-dir/file1 committed "br2-1"
24013	  # +60s
24014	  # T4    1.1.4.2 br2     first-dir/file1 committed "br2-2"
24015	  # T5    1.1     trunk   first-dir/file3 dead
24016	  # T6    1.1.2.1 br2     first-dir/file3 committed "br2-1"
24017	  # T7    1.1     trunk   first-dir/file2 committed "trunk-1"
24018	  # T8    1.2     trunk   first-dir/file2 committed "trunk-2"
24019	  # T8    1.2.2.1 br2     first-dir/file2 dead
24020	  # T9    1.2.2.2 br2     first-dir/file2 committed "br2-1"
24021	  # 
24022
24023	  mkdir 4; cd 4
24024	  (echo Dates for tagdate-26-* are:;\
24025	   echo "  date_T1='$date_T1'";\
24026	   echo "  date_T2='$date_T2'";\
24027	   echo "  date_T3='$date_T3'";\
24028	   echo "  date_T4='$date_T4'";\
24029	   echo "  date_T5='$date_T5'";\
24030	   echo "  date_T6='$date_T6'";\
24031	   echo "  date_T7='$date_T7'";\
24032	   echo "  date_T8='$date_T8'";\
24033	   echo "  date_T9='$date_T9'") >>$LOGFILE
24034	  dotest tagdate-26-trunk-t1 \
24035"${testcvs} co -D'$date_T1' -d first-dir-trunk-t1 first-dir" \
24036"${PROG} checkout: Updating first-dir-trunk-t1
24037U first-dir-trunk-t1/file1"
24038	  dotest tagdate-26-br2-t1 \
24039"${testcvs} co -r br2 -D'$date_T1' -d first-dir-br2-t1 first-dir" \
24040"${PROG} checkout: Updating first-dir-br2-t1
24041U first-dir-br2-t1/file1"
24042	  dotest tagdate-26-trunk-t2 \
24043"${testcvs} co -D'$date_T2' -d first-dir-trunk-t2 first-dir" \
24044"${PROG} checkout: Updating first-dir-trunk-t2
24045U first-dir-trunk-t2/file1"
24046	  dotest tagdate-26-br2-t2 \
24047"${testcvs} co -r br2 -D'$date_T2' -d first-dir-br2-t2 first-dir" \
24048"${PROG} checkout: Updating first-dir-br2-t2
24049U first-dir-br2-t2/file1"
24050	  dotest tagdate-26-br2-t3 \
24051"${testcvs} co -r br2 -D'$date_T3' -d first-dir-br2-t3 first-dir" \
24052"${PROG} checkout: Updating first-dir-br2-t3
24053U first-dir-br2-t3/file1"
24054	  dotest tagdate-26-br2-t4 \
24055"${testcvs} co -r br2 -D'$date_T4' -d first-dir-br2-t4 first-dir" \
24056"${PROG} checkout: Updating first-dir-br2-t4
24057U first-dir-br2-t4/file1"
24058	  dotest tagdate-26-br2-t6 \
24059"${testcvs} co -r br2 -D'$date_T6' -d first-dir-br2-t6 first-dir" \
24060"${PROG} checkout: Updating first-dir-br2-t6
24061U first-dir-br2-t6/file1
24062U first-dir-br2-t6/file3"
24063	  dotest tagdate-26-trunk-t7 \
24064"${testcvs} co -D'$date_T7' -d first-dir-trunk-t7 first-dir" \
24065"${PROG} checkout: Updating first-dir-trunk-t7
24066U first-dir-trunk-t7/file1
24067U first-dir-trunk-t7/file2"
24068	  dotest tagdate-26-br2-t7 \
24069"${testcvs} co -r br2 -D'$date_T7' -d first-dir-br2-t7 first-dir" \
24070"${PROG} checkout: Updating first-dir-br2-t7
24071U first-dir-br2-t7/file1
24072U first-dir-br2-t7/file3"
24073	  dotest tagdate-26-trunk-t8 \
24074"${testcvs} co -D'$date_T8' -d first-dir-trunk-t8 first-dir" \
24075"${PROG} checkout: Updating first-dir-trunk-t8
24076U first-dir-trunk-t8/file1
24077U first-dir-trunk-t8/file2"
24078	  dotest tagdate-26-br2-t8 \
24079"${testcvs} co -r br2 -D'$date_T8' -d first-dir-br2-t8 first-dir" \
24080"${PROG} checkout: Updating first-dir-br2-t8
24081U first-dir-br2-t8/file1
24082U first-dir-br2-t8/file3"
24083	  dotest tagdate-26-br2-t9 \
24084"${testcvs} co -r br2 -D'$date_T9' -d first-dir-br2-t9 first-dir" \
24085"${PROG} checkout: Updating first-dir-br2-t9
24086U first-dir-br2-t9/file1
24087U first-dir-br2-t9/file2
24088U first-dir-br2-t9/file3"
24089	  dotest tagdate-27-trunk-t1 \
24090"${testcvs} status first-dir-trunk-t1" \
24091"${PROG} status: Examining first-dir-trunk-t1
24092===================================================================
24093File: file1            	Status: Up-to-date
24094
24095   Working revision:	1\.1[^.]*
24096   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
24097   Sticky Tag:		(none)
24098   Sticky Date:		[0-9.]*
24099   Sticky Options:	(none)"
24100	  dotest tagdate-27-br2-t1 \
24101"${testcvs} status first-dir-br2-t1" \
24102"${PROG} status: Examining first-dir-br2-t1
24103===================================================================
24104File: file1            	Status: Needs Patch
24105
24106   Working revision:	1\.1[^.]*
24107   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24108   Sticky Tag:		br2 (branch: 1\.1\.4)
24109   Sticky Date:		(none)
24110   Sticky Options:	(none)"
24111	  dotest tagdate-27-trunk-t2 \
24112"${testcvs} status first-dir-trunk-t2" \
24113"${PROG} status: Examining first-dir-trunk-t2
24114===================================================================
24115File: file1            	Status: Up-to-date
24116
24117   Working revision:	1\.2[^.]*
24118   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24119   Sticky Tag:		(none)
24120   Sticky Date:		[0-9.]*
24121   Sticky Options:	(none)"
24122	  dotest tagdate-27-br2-t2 \
24123"${testcvs} status first-dir-br2-t2" \
24124"${PROG} status: Examining first-dir-br2-t2
24125===================================================================
24126File: file1            	Status: Needs Patch
24127
24128   Working revision:	1\.1[^.]*
24129   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24130   Sticky Tag:		br2 (branch: 1\.1\.4)
24131   Sticky Date:		(none)
24132   Sticky Options:	(none)"
24133	  dotest tagdate-27-br2-t3 \
24134"${testcvs} status first-dir-br2-t3" \
24135"${PROG} status: Examining first-dir-br2-t3
24136===================================================================
24137File: file1            	Status: Needs Patch
24138
24139   Working revision:	1\.1\.4\.1[^.]*
24140   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24141   Sticky Tag:		br2 (branch: 1\.1\.4)
24142   Sticky Date:		(none)
24143   Sticky Options:	(none)"
24144	  dotest tagdate-27-br2-t4 \
24145"${testcvs} status first-dir-br2-t4" \
24146"${PROG} status: Examining first-dir-br2-t4
24147===================================================================
24148File: file1            	Status: Up-to-date
24149
24150   Working revision:	1\.1\.4\.2[^.]*
24151   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24152   Sticky Tag:		br2 (branch: 1\.1\.4)
24153   Sticky Date:		(none)
24154   Sticky Options:	(none)"
24155	  dotest tagdate-27-br2-t6 \
24156"${testcvs} status first-dir-br2-t6" \
24157"${PROG} status: Examining first-dir-br2-t6
24158===================================================================
24159File: file1            	Status: Up-to-date
24160
24161   Working revision:	1\.1\.4\.2[^.]*
24162   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24163   Sticky Tag:		br2 (branch: 1\.1\.4)
24164   Sticky Date:		(none)
24165   Sticky Options:	(none)
24166
24167===================================================================
24168File: file3            	Status: Up-to-date
24169
24170   Working revision:	1\.1\.2\.1[^.]*
24171   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24172   Sticky Tag:		br2 (branch: 1\.1\.2)
24173   Sticky Date:		(none)
24174   Sticky Options:	(none)"
24175	  dotest tagdate-27-trunk-t7 \
24176"${testcvs} status first-dir-trunk-t7" \
24177"${PROG} status: Examining first-dir-trunk-t7
24178===================================================================
24179File: file1            	Status: Up-to-date
24180
24181   Working revision:	1\.2[^.]*
24182   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24183   Sticky Tag:		(none)
24184   Sticky Date:		[0-9.]*
24185   Sticky Options:	(none)
24186
24187===================================================================
24188File: file2            	Status: Up-to-date
24189
24190   Working revision:	1\.1[^.]*
24191   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file2,v
24192   Sticky Tag:		(none)
24193   Sticky Date:		[0-9.]*
24194   Sticky Options:	(none)"
24195	  dotest tagdate-27-br2-t7 \
24196"${testcvs} status first-dir-br2-t7" \
24197"${PROG} status: Examining first-dir-br2-t7
24198===================================================================
24199File: file1            	Status: Up-to-date
24200
24201   Working revision:	1\.1\.4\.2[^.]*
24202   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24203   Sticky Tag:		br2 (branch: 1\.1\.4)
24204   Sticky Date:		(none)
24205   Sticky Options:	(none)
24206
24207===================================================================
24208File: file3            	Status: Up-to-date
24209
24210   Working revision:	1\.1\.2\.1[^.]*
24211   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24212   Sticky Tag:		br2 (branch: 1\.1\.2)
24213   Sticky Date:		(none)
24214   Sticky Options:	(none)"
24215	  dotest tagdate-27-trunk-t8 \
24216"${testcvs} status first-dir-trunk-t8" \
24217"${PROG} status: Examining first-dir-trunk-t8
24218===================================================================
24219File: file1            	Status: Up-to-date
24220
24221   Working revision:	1\.2[^.]*
24222   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24223   Sticky Tag:		(none)
24224   Sticky Date:		[0-9.]*
24225   Sticky Options:	(none)
24226
24227===================================================================
24228File: file2            	Status: Up-to-date
24229
24230   Working revision:	1\.2[^.]*
24231   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file2,v
24232   Sticky Tag:		(none)
24233   Sticky Date:		[0-9.]*
24234   Sticky Options:	(none)"
24235	  dotest tagdate-27-br2-t8 \
24236"${testcvs} status first-dir-br2-t8" \
24237"${PROG} status: Examining first-dir-br2-t8
24238===================================================================
24239File: file1            	Status: Up-to-date
24240
24241   Working revision:	1\.1\.4\.2[^.]*
24242   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24243   Sticky Tag:		br2 (branch: 1\.1\.4)
24244   Sticky Date:		(none)
24245   Sticky Options:	(none)
24246
24247===================================================================
24248File: file3            	Status: Up-to-date
24249
24250   Working revision:	1\.1\.2\.1[^.]*
24251   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24252   Sticky Tag:		br2 (branch: 1\.1\.2)
24253   Sticky Date:		(none)
24254   Sticky Options:	(none)"
24255	  dotest tagdate-27-br2-t9 \
24256"${testcvs} status first-dir-br2-t9" \
24257"${PROG} status: Examining first-dir-br2-t9
24258===================================================================
24259File: file1            	Status: Up-to-date
24260
24261   Working revision:	1\.1\.4\.2[^.]*
24262   Repository revision:	1\.1\.4\.2	${CVSROOT_DIRNAME}/first-dir/file1,v
24263   Sticky Tag:		br2 (branch: 1\.1\.4)
24264   Sticky Date:		(none)
24265   Sticky Options:	(none)
24266
24267===================================================================
24268File: file2            	Status: Up-to-date
24269
24270   Working revision:	1\.2\.2\.2[^.]*
24271   Repository revision:	1\.2\.2\.2	${CVSROOT_DIRNAME}/first-dir/file2,v
24272   Sticky Tag:		br2 (branch: 1\.2\.2)
24273   Sticky Date:		(none)
24274   Sticky Options:	(none)
24275
24276===================================================================
24277File: file3            	Status: Up-to-date
24278
24279   Working revision:	1\.1\.2\.1[^.]*
24280   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24281   Sticky Tag:		br2 (branch: 1\.1\.2)
24282   Sticky Date:		(none)
24283   Sticky Options:	(none)"
24284
24285	  # Now check the contents of the files
24286	  dotest tagdate-28-trunk-t1 'cat first-dir-trunk-t1/file1' 'trunk-1'
24287	  dotest tagdate-28-br2-t1 'cat first-dir-br2-t1/file1' 'trunk-1'
24288	  dotest tagdate-28-trunk-t2 'cat first-dir-trunk-t2/file1' 'trunk-2'
24289	  dotest tagdate-28-br2-t2 'cat first-dir-br2-t2/file1' 'trunk-1'
24290	  dotest tagdate-28-br2-t3 'cat first-dir-br2-t3/file1' 'br2-1'
24291	  dotest tagdate-28-br2-t4 'cat first-dir-br2-t4/file1' 'br2-2'
24292	  dotest tagdate-28-br2-t6a 'cat first-dir-br2-t6/file1' "br2-2"
24293	  dotest tagdate-28-br2-t6b 'cat first-dir-br2-t6/file3' "br2-1"
24294	  dotest tagdate-28-trunk-t7a 'cat first-dir-trunk-t7/file1' "trunk-2"
24295	  dotest tagdate-28-trunk-t7b 'cat first-dir-trunk-t7/file2' "trunk-1"
24296	  dotest tagdate-28-br2-t7a 'cat first-dir-br2-t7/file1' "br2-2"
24297	  dotest tagdate-28-br2-t7b 'cat first-dir-br2-t7/file3' "br2-1"
24298	  dotest tagdate-28-trunk-t8a 'cat first-dir-trunk-t8/file1' "trunk-2"
24299	  dotest tagdate-28-trunk-t8b 'cat first-dir-trunk-t8/file2' "trunk-2"
24300	  dotest tagdate-28-br2-t8a 'cat first-dir-br2-t8/file1' "br2-2"
24301	  dotest tagdate-28-br2-t8c 'cat first-dir-br2-t8/file3' "br2-1"
24302	  dotest tagdate-28-br2-t9a 'cat first-dir-br2-t9/file1' "br2-2"
24303	  dotest tagdate-28-br2-t9b 'cat first-dir-br2-t9/file2' "br2-1"
24304	  dotest tagdate-28-br2-t9c 'cat first-dir-br2-t9/file3' "br2-1"
24305	  cd ..
24306
24307	  unset date_T1 date_T2 date_T3 date_T4 date_T5
24308	  unset date_T6 date_T7 date_T8 date_T9
24309	  TZ=$save_TZ
24310
24311	  if $keep; then
24312	    echo Keeping ${TESTDIR} and exiting due to --keep
24313	    exit 0
24314	  fi
24315
24316	  rm -r 1 2 3 4
24317	  rm -rf ${CVSROOT_DIRNAME}/first-dir
24318	  ;;
24319
24320	multibranch2)
24321	  # Commit the first delta on branch A when there is an older
24322	  # branch, B, that already has a delta.  A and B come from the
24323	  # same branch point.  Then verify that branches A and B are
24324	  # in the right order.
24325	  mkdir 1; cd 1
24326	  dotest multibranch2-1 "${testcvs} -q co -l ." ''
24327	  mkdir first-dir
24328	  dotest multibranch2-2 "${testcvs} add first-dir" \
24329"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
24330	  cd first-dir
24331
24332	  echo trunk-1 >file1
24333	  echo trunk-1 >file2
24334	  dotest multibranch2-3 "${testcvs} add file1 file2" \
24335"${PROG} add: scheduling file .file1. for addition
24336${PROG} add: scheduling file .file2. for addition
24337${PROG} add: use .${PROG} commit. to add these files permanently"
24338	  dotest multibranch2-4 "${testcvs} -q ci -m add" \
24339"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24340done
24341Checking in file1;
24342${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24343initial revision: 1\.1
24344done
24345RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24346done
24347Checking in file2;
24348${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24349initial revision: 1\.1
24350done"
24351	  dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1
24352T file2"
24353	  dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1
24354T file2"
24355
24356	  dotest multibranch2-7 "$testcvs -q update -r B" \
24357'[UP] file1
24358[UP] file2'
24359	  echo branch-B >file1
24360	  echo branch-B >file2
24361	  dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
24362"Checking in file1;
24363${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24364new revision: 1\.1\.4\.1; previous revision: 1\.1
24365done
24366Checking in file2;
24367${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24368new revision: 1\.1\.4\.1; previous revision: 1\.1
24369done"
24370
24371	  dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1
24372[UP] file2'
24373	  echo branch-A >file1
24374	  # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
24375	  dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
24376"Checking in file1;
24377${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24378new revision: 1\.1\.2\.1; previous revision: 1\.1
24379done"
24380
24381	  dotest multibranch2-11 "${testcvs} -q log file1" \
24382"
24383RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24384Working file: file1
24385head: 1\.1
24386branch:
24387locks: strict
24388access list:
24389symbolic names:
24390	B: 1\.1\.0\.4
24391	A: 1\.1\.0\.2
24392keyword substitution: kv
24393total revisions: 3;	selected revisions: 3
24394description:
24395----------------------------
24396revision 1\.1
24397date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24398branches:  1\.1\.2;  1\.1\.4;
24399add
24400----------------------------
24401revision 1\.1\.4\.1
24402date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
24403modify-on-B
24404----------------------------
24405revision 1\.1\.2\.1
24406date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
24407modify-on-A
24408============================================================================="
24409
24410	  # This one is more concise.
24411	  dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \
24412"
24413RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24414Working file: file1
24415head: 1\.1
24416branch:
24417locks: strict
24418access list:
24419symbolic names:
24420	B: 1\.1\.0\.4
24421	A: 1\.1\.0\.2
24422keyword substitution: kv
24423total revisions: 3;	selected revisions: 1
24424description:
24425----------------------------
24426revision 1\.1
24427date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
24428branches:  1\.1\.2;  1\.1\.4;
24429add
24430============================================================================="
24431
24432	  # OK, try very much the same thing except we run update -j to
24433	  # bring the changes from B to A.  Probably tests many of the
24434	  # same code paths but might as well keep it separate, I guess.
24435
24436	  dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1
24437[UP] file2"
24438	  dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \
24439"[UP] file2
24440RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24441retrieving revision 1.1
24442retrieving revision 1.1.4.1
24443Merging differences between 1.1 and 1.1.4.1 into file2"
24444	  dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \
24445"Checking in file2;
24446${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24447new revision: 1\.1\.2\.1; previous revision: 1\.1
24448done"
24449	  cd ../..
24450	  rm -r 1
24451	  rm -rf ${CVSROOT_DIRNAME}/first-dir
24452	  ;;
24453
24454	tag8k)
24455	  # In cvs-1.9.27, there is a bug that can cause an abort.
24456	  # It happens when you commit a change to a ,v file that has
24457	  # just the right amount of tag/branch info to align one of the
24458	  # semicolons in the branch info to be on a 8k-byte boundary.
24459	  # The result: rcsbuf_getkey got an abort.  This failure doesn't
24460	  # corrupt the ,v file -- that would be really serious.  But it
24461	  # does leave stale write locks that have to be removed manually.
24462
24463	  mkdir 1
24464	  cd 1
24465
24466	  module=x
24467
24468	  : > junk
24469	  dotest tag8k-1 "$testcvs -Q import -m . $module X Y" ''
24470	  dotest tag8k-2 "$testcvs -Q co $module" ''
24471	  cd $module
24472
24473	  file=m
24474	  : > $file
24475	  dotest tag8k-3 "$testcvs add $file" \
24476"${PROG} add: scheduling file .$file. for addition
24477${PROG} add: use .${PROG} commit. to add this file permanently"
24478	  dotest tag8k-4 "$testcvs -Q ci -m . $file" \
24479"RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
24480done
24481Checking in $file;
24482${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24483initial revision: 1\.1
24484done"
24485
24486	  # It seems there have to be at least two versions.
24487	  echo a > $file
24488	  dotest tag8k-5 "$testcvs -Q ci -m . $file" \
24489"Checking in $file;
24490${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24491new revision: 1\.2; previous revision: 1\.1
24492done"
24493
24494	  # Add just under 8K worth of tags.
24495	  t=TAG---------------------------------------------------------------------
24496	  t=$t$t
24497	  t=$t$t$t$t$t
24498	  # Now $t is 720 bytes long.
24499
24500	  # Apply some tags with that long prefix.
24501	  dotest tag8k-6  "$testcvs -Q tag $t-0 $file" ''
24502	  dotest tag8k-7  "$testcvs -Q tag $t-1 $file" ''
24503	  dotest tag8k-8  "$testcvs -Q tag $t-2 $file" ''
24504	  dotest tag8k-9  "$testcvs -Q tag $t-3 $file" ''
24505	  dotest tag8k-10 "$testcvs -Q tag $t-4 $file" ''
24506	  dotest tag8k-11 "$testcvs -Q tag $t-5 $file" ''
24507	  dotest tag8k-12 "$testcvs -Q tag $t-6 $file" ''
24508	  dotest tag8k-13 "$testcvs -Q tag $t-7 $file" ''
24509	  dotest tag8k-14 "$testcvs -Q tag $t-8 $file" ''
24510	  dotest tag8k-15 "$testcvs -Q tag $t-9 $file" ''
24511	  dotest tag8k-16 "$testcvs -Q tag $t-a $file" ''
24512
24513	  # Extract the author value.
24514	  name=`sed -n 's/.*;	author \([^;]*\);.*/\1/p' ${CVSROOT_DIRNAME}/$module/$file,v|sed 1q`
24515
24516	  # Form a suffix string of length (16 - length($name)).
24517	  # CAREFUL: this will lose if $name is longer than 16.
24518	  sed_pattern=`echo $name|sed s/././g`
24519	  suffix=`echo 1234567890123456|sed s/$sed_pattern//`
24520
24521	  # Add a final tag with length chosen so that it will push the
24522	  # offset of the `;' in the 2nd occurrence of `;\tauthor' in the
24523	  # ,v file to exactly 8192.
24524	  dotest tag8k-17 "$testcvs -Q tag "x8bytes-$suffix" $file" ''
24525
24526	  # This commit would fail with 1.9.27.
24527	  echo a >> $file
24528	  dotest tag8k-18 "$testcvs -Q ci -m . $file" \
24529"Checking in $file;
24530${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
24531new revision: 1\.3; previous revision: 1\.2
24532done"
24533	  cd ../..
24534	  rm -r 1
24535	  rm -rf ${CVSROOT_DIRNAME}/$module
24536	  ;;
24537
24538
24539	admin)
24540	  # More "cvs admin" tests.
24541	  # The basicb-21 test tests rejecting an illegal option.
24542	  # For -l and -u, see "reserved" and "keyword" tests.
24543	  # "binfiles" test has a test of "cvs admin -k".
24544	  # "log2" test has tests of -t and -q options to cvs admin.
24545	  # "rcs" tests -b option also.
24546	  # For -o, see:
24547	  #   admin-22-o1 through admin-23 (various cases not involving ::)
24548	  #   binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
24549	  #   basicb-o* (attempt to delete all revisions)
24550	  #   basica-o1 through basica-o3 (basic :: usage)
24551	  #   head-o1 (::branch, where this deletes a revision or is noop)
24552	  #   branches-o1 (::branch, similar, with different branch topology)
24553	  #   log-o1 (1.3.2.1::)
24554	  #   binfiles-o1 (1.3:: and ::1.3; binary files)
24555	  #   binfiles3-9 (binary files)
24556	  #   Also could be testing:
24557	  #     1.3.2.6::1.3.2.8
24558	  #     1.3.2.6::1.3.2
24559	  #     1.3.2.1::1.3.2.6
24560	  #     1.3::1.3.2.6 (error?  or synonym for ::1.3.2.6?)
24561	  # -n: admin, tagf tests.
24562
24563	  mkdir 1; cd 1
24564	  dotest admin-1 "${testcvs} -q co -l ." ''
24565	  mkdir first-dir
24566	  dotest admin-2 "${testcvs} add first-dir" \
24567"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
24568          cd first-dir
24569
24570	  dotest_fail admin-3 "${testcvs} -q admin -i file1" \
24571"${PROG} admin: the -i option to admin is not supported
24572${PROG} admin: run add or import to create an RCS file
24573${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
24574	  dotest_fail admin-4 "${testcvs} -q log file1" \
24575"${PROG} log: nothing known about file1"
24576	  dotest_fail admin-4a "${testcvs} -q admin file1" \
24577"${PROG} admin: nothing known about file1"
24578
24579	  # Set up some files, file2 a plain one and file1 with a revision
24580	  # on a branch.
24581	  touch file1 file2
24582	  dotest admin-5 "${testcvs} add file1 file2" \
24583"${PROG} add: scheduling file .file1. for addition
24584${PROG} add: scheduling file .file2. for addition
24585${PROG} add: use .${PROG} commit. to add these files permanently"
24586	  dotest admin-6 "${testcvs} -q ci -m add" \
24587"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24588done
24589Checking in file1;
24590${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24591initial revision: 1\.1
24592done
24593RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24594done
24595Checking in file2;
24596${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24597initial revision: 1\.1
24598done"
24599	  dotest admin-7 "${testcvs} -q tag -b br" "T file1
24600T file2"
24601	  dotest admin-8 "$testcvs -q update -r br" \
24602'U file1
24603U file2'
24604	  echo 'add a line on the branch' >> file1
24605	  echo 'add a file on the branch' >> file3
24606	  dotest admin-9a "${testcvs} -q add file3" \
24607"${PROG} add: use .${PROG} commit. to add this file permanently"
24608	  dotest admin-9b "${testcvs} -q ci -m modify-on-branch" \
24609"Checking in file1;
24610${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
24611new revision: 1\.1\.2\.1; previous revision: 1\.1
24612done
24613RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24614done
24615Checking in file3;
24616${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
24617new revision: 1\.1\.2\.1; previous revision: 1\.1
24618done"
24619	  dotest admin-10 "$testcvs -q update -A" \
24620"U file1
24621U file2
24622$PROG update: file3 is no longer in the repository"
24623
24624	  # Check that we can administer files in the repository that
24625	  # aren't in the working directory.
24626	  dotest admin-10-1 "${testcvs} admin ." \
24627"${PROG} admin: Administrating .
24628RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24629done
24630RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24631done"
24632	  dotest admin-10-2 "${testcvs} -q admin file3" \
24633"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
24634done"
24635
24636	  # Try to recurse with a numeric revision arg.
24637	  # If we wanted to comprehensive about this, we would also test
24638	  # this for -l, -u, and all the different -o syntaxes.
24639	  dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
24640"${PROG} [a-z]*: while processing more than one file:
24641${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
24642	  dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
24643"${PROG} [a-z]*: while processing more than one file:
24644${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
24645
24646	  # try a bad symbolic revision
24647	  dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \
24648"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24649${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: Symbolic name BOGUS is undefined.
24650${PROG} admin: RCS file for .file1. not modified\.
24651RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24652${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name BOGUS is undefined.
24653${PROG} admin: RCS file for .file2. not modified\."
24654
24655	  # Note that -s option applies to the new default branch, not
24656	  # the old one.
24657	  # Also note that the implementation of -a via "rcs" requires
24658	  # no space between -a and the argument.  However, we expect
24659	  # to change that once CVS parses options.
24660	  dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
24661-b1.1.2 -cxx -U -sfoo file1" \
24662"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24663done"
24664	  dotest admin-11a "${testcvs} log -N file1" "
24665RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24666Working file: file1
24667head: 1\.1
24668branch: 1\.1\.2
24669locks:
24670access list:
24671	foo
24672	bar
24673	baz
24674keyword substitution: kv
24675total revisions: 2;	selected revisions: 2
24676description:
24677----------------------------
24678revision 1\.1
24679date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24680branches:  1\.1\.2;
24681add
24682----------------------------
24683revision 1\.1\.2\.1
24684date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24685modify-on-branch
24686============================================================================="
24687	  dotest admin-12 "${testcvs} -q admin -bbr file1" \
24688"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24689done"
24690	  dotest admin-12a "${testcvs} log -N file1" "
24691RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24692Working file: file1
24693head: 1\.1
24694branch: 1\.1\.2
24695locks:
24696access list:
24697	foo
24698	bar
24699	baz
24700keyword substitution: kv
24701total revisions: 2;	selected revisions: 2
24702description:
24703----------------------------
24704revision 1\.1
24705date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24706branches:  1\.1\.2;
24707add
24708----------------------------
24709revision 1\.1\.2\.1
24710date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24711modify-on-branch
24712============================================================================="
24713
24714	  # "cvs log" doesn't print the comment leader.  RCS 5.7 will print
24715	  # the comment leader only if one specifies "-V4" to rlog.  So it
24716	  # seems like the only way to test it is by looking at the RCS file
24717	  # directly.  This also serves as a test of exporting RCS files
24718	  # (analogous to the import tests in "rcs").
24719	  # Rather than try to write a rigorous check for whether the
24720	  # file CVS exports is legal, we just write a simpler
24721	  # test for what CVS actually exports, and figure we can revise
24722	  # the check as needed (within the confines of the RCS5 format as
24723	  # documented in RCSFILES).
24724	  # Note that we must accept either 2 or 4 digit year.
24725	  dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
24726"head	1\.1;
24727branch	1\.1\.2;
24728access
24729	foo
24730	bar
24731	baz;
24732symbols
24733	br:1\.1\.0\.2;
24734locks;
24735comment	@xx@;
24736
24737
247381\.1
24739date	[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;
24740branches
24741	1\.1\.2\.1;
24742next	;
24743
247441\.1\.2\.1
24745date	[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;
24746branches;
24747next	;
24748
24749
24750desc
24751@@
24752
24753
247541\.1
24755log
24756@add
24757@
24758text
24759@@
24760
24761
247621\.1\.2\.1
24763log
24764@modify-on-branch
24765@
24766text
24767@a0 1
24768add a line on the branch
24769@"
24770	  dotest_fail admin-14-1 "${testcvs} -q admin \
24771-m1.1.1.1:changed-bogus-log-message file2" \
24772"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24773cvs admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision 1\.1\.1\.1
24774cvs admin: RCS file for .file2. not modified."
24775	  dotest admin-14-2 "${testcvs} -q log file2" "
24776RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24777Working file: file2
24778head: 1\.1
24779branch:
24780locks: strict
24781access list:
24782symbolic names:
24783	br: 1\.1\.0\.2
24784keyword substitution: kv
24785total revisions: 1;	selected revisions: 1
24786description:
24787----------------------------
24788revision 1\.1
24789date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24790add
24791============================================================================="
24792
24793	  dotest admin-14-3 "${testcvs} -q admin -aauth3 -aauth2,foo \
24794-soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
24795"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24796done"
24797	  dotest admin-15 "${testcvs} -q log file2" "
24798RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24799Working file: file2
24800head: 1\.1
24801branch:
24802locks: strict
24803access list:
24804	auth3
24805	auth2
24806	foo
24807symbolic names:
24808	tagone: 1\.1
24809	br: 1\.1\.0\.2
24810keyword substitution: kv
24811total revisions: 1;	selected revisions: 1
24812description:
24813----------------------------
24814revision 1\.1
24815date: [0-9/]* [0-9:]*;  author: ${username};  state: oneone;
24816changed-log-message
24817============================================================================="
24818
24819	  dotest admin-16 "${testcvs} -q admin \
24820-A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
24821"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24822done"
24823	  dotest admin-17 "${testcvs} -q log file1" "
24824RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24825Working file: file1
24826head: 1\.1
24827branch:
24828locks: strict
24829access list:
24830	foo
24831	bar
24832	baz
24833	auth3
24834	auth2
24835symbolic names:
24836	br: 1\.1
24837keyword substitution: kv
24838total revisions: 2;	selected revisions: 2
24839description:
24840----------------------------
24841revision 1\.1
24842date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24843branches:  1\.1\.2;
24844add
24845----------------------------
24846revision 1\.1\.2\.1
24847date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24848modify-on-branch
24849============================================================================="
24850
24851	  dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
24852"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24853${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: symbolic name br already bound to 1\.1
24854${PROG} admin: RCS file for .file1. not modified\."
24855	  dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
24856"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24857done"
24858	  dotest admin-20 "${testcvs} -q log file1" "
24859RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24860Working file: file1
24861head: 1\.1
24862branch:
24863locks: strict
24864access list:
24865	foo
24866	auth2
24867symbolic names:
24868keyword substitution: kv
24869total revisions: 2;	selected revisions: 2
24870description:
24871----------------------------
24872revision 1\.1
24873date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
24874branches:  1\.1\.2;
24875add
24876----------------------------
24877revision 1.1.2.1
24878date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
24879modify-on-branch
24880============================================================================="
24881
24882	  # OK, this is starting to get ridiculous, in terms of
24883	  # testing a feature (access lists) which doesn't do anything
24884	  # useful, but what about nonexistent files and
24885	  # relative pathnames in admin -A?
24886	  dotest_fail admin-19a-nonexist \
24887"${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
24888"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24889${PROG} admin: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
24890${PROG} \[admin aborted\]: cannot continue"
24891
24892	  # In the remote case, we are cd'd off into the temp directory
24893	  # and so these tests give "No such file or directory" errors.
24894	  if $remote; then :; else
24895	    dotest admin-19a-admin "${testcvs} -q admin -A../../${CVSROOTDIR}/first-dir/file2,v file1" \
24896"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24897done"
24898	    dotest admin-19a-log "${testcvs} -q log -h -N file1" "
24899RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24900Working file: file1
24901head: 1\.1
24902branch:
24903locks: strict
24904access list:
24905	foo
24906	auth2
24907	auth3
24908keyword substitution: kv
24909total revisions: 2
24910============================================================================="
24911	  fi # end of tests skipped for remote
24912
24913	  # Now test that plain -e works right.
24914	  dotest admin-19a-2 "${testcvs} -q admin -e file1" \
24915"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24916done"
24917	  dotest admin-19a-3 "${testcvs} -q log -h -N file1" "
24918RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24919Working file: file1
24920head: 1\.1
24921branch:
24922locks: strict
24923access list:
24924keyword substitution: kv
24925total revisions: 2
24926============================================================================="
24927
24928	  # Put the access list back, to avoid special cases later.
24929	  dotest admin-19a-4 "${testcvs} -q admin -afoo,auth2 file1" \
24930"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
24931done"
24932
24933	  # Add another revision to file2, so we can delete one.
24934	  echo 'add a line' >> file2
24935	  dotest admin-21 "${testcvs} -q ci -m modify file2" \
24936"Checking in file2;
24937${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
24938new revision: 1\.2; previous revision: 1\.1
24939done"
24940	  dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
24941"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
24942deleting revision 1\.1
24943done"
24944	  # Test admin -o.  More variants that we could be testing:
24945	  # * REV: [on branch]
24946	  # * REV1:REV2 [deleting whole branch]
24947	  # * high branch numbers (e.g. 1.2.2.3.2.3)
24948	  # ... and probably others.  See RCS_delete_revs for ideas.
24949
24950	  echo first rev > aaa
24951	  dotest admin-22-o1 "${testcvs} add aaa" \
24952"${PROG} add: scheduling file .aaa. for addition
24953${PROG} add: use .${PROG} commit. to add this file permanently"
24954	  dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
24955"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
24956done
24957Checking in aaa;
24958${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24959initial revision: 1\.1
24960done"
24961	  echo second rev >> aaa
24962	  dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
24963"Checking in aaa;
24964${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24965new revision: 1\.2; previous revision: 1\.1
24966done"
24967	  echo third rev >> aaa
24968	  dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
24969"Checking in aaa;
24970${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24971new revision: 1\.3; previous revision: 1\.2
24972done"
24973	  echo fourth rev >> aaa
24974	  dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
24975"Checking in aaa;
24976${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24977new revision: 1\.4; previous revision: 1\.3
24978done"
24979	  echo fifth rev >>aaa
24980	  dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
24981"Checking in aaa;
24982${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24983new revision: 1\.5; previous revision: 1\.4
24984done"
24985	  echo sixth rev >> aaa
24986	  dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
24987"Checking in aaa;
24988${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
24989new revision: 1\.6; previous revision: 1\.5
24990done"
24991	  dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
24992"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
249931\.6 locked
24994done"
24995	  dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
24996RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
24997Working file: aaa
24998head: 1\.6
24999branch:
25000locks: strict
25001	${username}: 1\.6
25002access list:
25003symbolic names:
25004keyword substitution: kv
25005total revisions: 6;	selected revisions: 1
25006description:
25007----------------------------
25008revision 1\.6	locked by: ${username};
25009date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25010sixth
25011============================================================================="
25012	  dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
25013"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25014${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove locked revision 1\.6
25015${PROG} admin: RCS file for .aaa. not modified\."
25016	  dotest admin-22-o11 "${testcvs} admin -u aaa" \
25017"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
250181\.6 unlocked
25019done"
25020	  dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
25021"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25022deleting revision 1\.6
25023deleting revision 1\.5
25024done"
25025	  dotest admin-22-o13 "${testcvs} log aaa" "
25026RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25027Working file: aaa
25028head: 1\.4
25029branch:
25030locks: strict
25031access list:
25032symbolic names:
25033keyword substitution: kv
25034total revisions: 4;	selected revisions: 4
25035description:
25036----------------------------
25037revision 1\.4
25038date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25039fourth
25040----------------------------
25041revision 1\.3
25042date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25043third
25044----------------------------
25045revision 1\.2
25046date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25047second
25048----------------------------
25049revision 1\.1
25050date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25051first
25052============================================================================="
25053
25054	  dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
25055	  dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
25056	  echo new branch rev >> aaa
25057	  dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
25058"Checking in aaa;
25059${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25060new revision: 1\.3\.2\.1; previous revision: 1\.3
25061done"
25062	  dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
25063"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25064deleting revision 1\.4
25065${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove branch point 1\.3
25066${PROG} admin: RCS file for .aaa. not modified\."
25067	  dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
25068"===================================================================
25069Checking out aaa
25070RCS:  ${CVSROOT_DIRNAME}/first-dir/aaa,v
25071VERS: 1\.4
25072\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
25073first rev
25074second rev
25075third rev
25076fourth rev"
25077	  echo second branch rev >> aaa
25078	  dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
25079"Checking in aaa;
25080${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25081new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
25082done"
25083	  echo third branch rev >> aaa
25084	  dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
25085"Checking in aaa;
25086${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25087new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
25088done"
25089	  echo fourth branch rev >> aaa
25090	  dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
25091"Checking in aaa;
25092${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
25093new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
25094done"
25095	  dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
25096"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25097deleting revision 1\.3\.2\.1
25098deleting revision 1\.3\.2\.2
25099deleting revision 1\.3\.2\.3
25100done"
25101	  dotest admin-22-o23 "${testcvs} log aaa" "
25102RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25103Working file: aaa
25104head: 1\.4
25105branch:
25106locks: strict
25107access list:
25108symbolic names:
25109	br1: 1\.3\.0\.2
25110keyword substitution: kv
25111total revisions: 5;	selected revisions: 5
25112description:
25113----------------------------
25114revision 1\.4
25115date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25116fourth
25117----------------------------
25118revision 1\.3
25119date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25120branches:  1\.3\.2;
25121third
25122----------------------------
25123revision 1\.2
25124date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25125second
25126----------------------------
25127revision 1\.1
25128date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25129first
25130----------------------------
25131revision 1\.3\.2\.4
25132date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
25133branch-four
25134============================================================================="
25135
25136	  dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
25137"first rev
25138second rev
25139third rev
25140new branch rev
25141second branch rev
25142third branch rev
25143fourth branch rev"
25144
25145	  # The bit here about how there is a "tagone" tag pointing to
25146	  # a nonexistent revision is documented by rcs.  I dunno, I
25147	  # wonder whether the "cvs admin -o" should give a warning in
25148	  # this case.
25149	  dotest admin-23 "${testcvs} -q log file2" "
25150RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25151Working file: file2
25152head: 1\.2
25153branch:
25154locks: strict
25155access list:
25156	auth3
25157	auth2
25158	foo
25159symbolic names:
25160	tagone: 1\.1
25161	br: 1\.1\.0\.2
25162keyword substitution: kv
25163total revisions: 1;	selected revisions: 1
25164description:
25165----------------------------
25166revision 1\.2
25167date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25168modify
25169============================================================================="
25170
25171	  dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
25172"head	1\.1;
25173access
25174	foo
25175	auth2;
25176symbols;
25177locks; strict;
25178comment	@xx@;
25179
25180
251811\.1
25182date	[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;
25183branches
25184	1\.1\.2\.1;
25185next	;
25186
251871\.1\.2\.1
25188date	[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;
25189branches;
25190next	;
25191
25192
25193desc
25194@@
25195
25196
251971\.1
25198log
25199@add
25200@
25201text
25202@@
25203
25204
252051\.1\.2\.1
25206log
25207@modify-on-branch
25208@
25209text
25210@a0 1
25211add a line on the branch
25212@"
25213
25214	  # Tests of cvs admin -n.  Make use of the results of
25215	  # admin-1 through admin-25.
25216	  # FIXME: We probably shouldn't make use of those results;
25217	  # this test is way too long as it is.
25218
25219	  # tagtwo should be a revision
25220	  #
25221	  dotest admin-26-1 "${testcvs} admin -ntagtwo:tagone file2" \
25222"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25223done"
25224      	  
25225	  # br1 should be a branch
25226	  #
25227	  dotest admin-26-2 "${testcvs} admin -nbr1:br file2" \
25228"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25229done"
25230      	  
25231	  # Attach some tags using RCS versions
25232	  #
25233	  dotest admin-26-3 "${testcvs} admin -ntagthree:1.1 file2" \
25234"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25235done"
25236
25237	  dotest admin-26-4 "${testcvs} admin -nbr2:1.1.2 file2"  \
25238"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25239done"
25240
25241	  dotest admin-26-5 "${testcvs} admin -nbr4:1.1.0.2 file2"  \
25242"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25243done"
25244      	  
25245	  # Check results so far
25246	  #
25247	  dotest admin-26-6 "${testcvs} status -v file2" \
25248"===================================================================
25249File: file2            	Status: Up-to-date
25250
25251   Working revision:	1\.2.*
25252   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file2,v
25253   Sticky Tag:		(none)
25254   Sticky Date:		(none)
25255   Sticky Options:	(none)
25256
25257   Existing Tags:
25258	br4                      	(branch: 1\.1\.2)
25259	br2                      	(branch: 1\.1\.2)
25260	tagthree                 	(revision: 1\.1)
25261	br1                      	(branch: 1\.1\.2)
25262	tagtwo                   	(revision: 1\.1)
25263	tagone                   	(revision: 1\.1)
25264	br                       	(branch: 1\.1\.2)"
25265
25266      	  
25267	  # Add a couple more revisions
25268	  #
25269	  echo "nuthr_line" >> file2
25270	  dotest admin-27-1 "${testcvs} commit -m nuthr_line file2"  \
25271"Checking in file2;
25272${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
25273new revision: 1\.3; previous revision: 1\.2
25274done"
25275
25276	  echo "yet_another" >> file2
25277	  dotest admin-27-2 "${testcvs} commit -m yet_another file2"  \
25278"Checking in file2;
25279${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
25280new revision: 1\.4; previous revision: 1\.3
25281done"
25282      	  
25283	  # Fail trying to reattach existing tag with -n
25284	  #
25285	  dotest admin-27-3 "${testcvs} admin -ntagfour:1.1 file2"  \
25286"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25287done"
25288
25289	  dotest_fail admin-27-4 "${testcvs} admin -ntagfour:1.3 file2"  \
25290"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25291${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: symbolic name tagfour already bound to 1\.1
25292${PROG} admin: RCS file for .file2. not modified\."
25293      	  
25294	  # Succeed at reattaching existing tag, using -N
25295	  #
25296	  dotest admin-27-5 "${testcvs} admin -Ntagfour:1.3 file2"  \
25297"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25298done"
25299      	  
25300	  # Fail on some bogus operations
25301	  # Try to attach to nonexistant tag
25302	  #
25303	  dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \
25304"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25305${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision tagfive is undefined\.
25306${PROG} admin: RCS file for .file2. not modified\."
25307      	  
25308	  # Try a some nonexisting numeric target tags
25309	  #
25310	  dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2"  \
25311"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25312${PROG} \[admin aborted\]: revision .2\.1. does not exist"
25313
25314	  dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2"  \
25315"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25316${PROG} \[admin aborted\]: revision .2\.1\.2. does not exist"
25317      	  
25318	  # Try some invalid targets
25319	  #
25320	  dotest_fail admin-28-4 "${testcvs} admin -ntagnine:1.a.2 file2"  \
25321"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25322${PROG} \[admin aborted\]: tag .1\.a\.2. must start with a letter"
25323
25324	  # Confirm that a missing tag is not a fatal error.
25325	  dotest admin-28-5.1 "${testcvs} -Q tag BO+GUS file1" ''
25326	  dotest_fail admin-28-5.2 "${testcvs} admin -ntagten:BO+GUS file2 file1"  \
25327"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25328${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision BO${PLUS}GUS is undefined\.
25329${PROG} admin: RCS file for .file2. not modified\.
25330RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25331done"
25332
25333	  dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2"  \
25334"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25335${PROG} \[admin aborted\]: tag .q\.werty. must not contain the characters ..*"
25336
25337	  # Verify the archive
25338	  #
25339	  dotest admin-29 "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
25340"head	1\.4;
25341access
25342	auth3
25343	auth2
25344	foo;
25345symbols
25346	tagfour:1\.3
25347	br4:1\.1\.0\.2
25348	br2:1\.1\.0\.2
25349	tagthree:1\.1
25350	br1:1\.1\.0\.2
25351	tagtwo:1\.1
25352	tagone:1\.1
25353	br:1\.1\.0\.2;
25354locks; strict;
25355comment	@# @;
25356
25357
253581\.4
25359date	[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;
25360branches;
25361next	1\.3;
25362
253631\.3
25364date	[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;
25365branches;
25366next	1\.2;
25367
253681\.2
25369date	[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;
25370branches;
25371next	;
25372
25373
25374desc
25375@@
25376
25377
253781\.4
25379log
25380@yet_another
25381@
25382text
25383@add a line
25384nuthr_line
25385yet_another
25386@
25387
25388
253891\.3
25390log
25391@nuthr_line
25392@
25393text
25394@d3 1
25395@
25396
25397
253981\.2
25399log
25400@modify
25401@
25402text
25403@d2 1
25404@"
25405
25406	  dotest_fail admin-30 "${testcvs} admin -mbr:another-log-message \
25407file2 aaa file3" \
25408"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25409${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision br: 1\.1
25410${PROG} admin: RCS file for .file2. not modified.
25411RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25412${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: no such revision br
25413${PROG} admin: RCS file for .aaa. not modified.
25414RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
25415done"
25416	  dotest admin-31 "${testcvs} log" \
25417"${PROG} log: Logging \.
25418
25419RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
25420Working file: aaa
25421head: 1\.4
25422branch:
25423locks: strict
25424access list:
25425symbolic names:
25426	br1: 1\.3\.0\.2
25427keyword substitution: kv
25428total revisions: 5;	selected revisions: 5
25429description:
25430----------------------------
25431revision 1\.4
25432date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25433fourth
25434----------------------------
25435revision 1\.3
25436date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25437branches:  1\.3\.2;
25438third
25439----------------------------
25440revision 1\.2
25441date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25442second
25443----------------------------
25444revision 1\.1
25445date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25446first
25447----------------------------
25448revision 1\.3\.2\.4
25449date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
25450branch-four
25451=============================================================================
25452
25453RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25454Working file: file1
25455head: 1\.1
25456branch:
25457locks: strict
25458access list:
25459	foo
25460	auth2
25461symbolic names:
25462	tagten: 1\.1
25463	BO${PLUS}GUS: 1\.1
25464keyword substitution: kv
25465total revisions: 2;	selected revisions: 2
25466description:
25467----------------------------
25468revision 1\.1
25469date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25470branches:  1\.1\.2;
25471add
25472----------------------------
25473revision 1\.1\.2\.1
25474date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
25475modify-on-branch
25476=============================================================================
25477
25478RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
25479Working file: file2
25480head: 1\.4
25481branch:
25482locks: strict
25483access list:
25484	auth3
25485	auth2
25486	foo
25487symbolic names:
25488	tagfour: 1\.3
25489	br4: 1\.1\.0\.2
25490	br2: 1\.1\.0\.2
25491	tagthree: 1\.1
25492	br1: 1\.1\.0\.2
25493	tagtwo: 1\.1
25494	tagone: 1\.1
25495	br: 1\.1\.0\.2
25496keyword substitution: kv
25497total revisions: 3;	selected revisions: 3
25498description:
25499----------------------------
25500revision 1\.4
25501date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25502yet_another
25503----------------------------
25504revision 1\.3
25505date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25506nuthr_line
25507----------------------------
25508revision 1\.2
25509date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25510modify
25511=============================================================================
25512
25513RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
25514Working file: file3
25515head: 1\.1
25516branch:
25517locks: strict
25518access list:
25519symbolic names:
25520	br: 1\.1\.0\.2
25521keyword substitution: kv
25522total revisions: 2;	selected revisions: 2
25523description:
25524----------------------------
25525revision 1\.1
25526date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;
25527branches:  1\.1\.2;
25528file file3 was initially added on branch br\.
25529----------------------------
25530revision 1\.1\.2\.1
25531date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
25532another-log-message
25533============================================================================="
25534
25535	  cd ../..
25536	  if $keep; then
25537	    echo Keeping ${TESTDIR} and exiting due to --keep
25538	    exit 0
25539	  fi
25540	  # clean up our after ourselves
25541	  rm -r 1
25542	  rm -rf ${CVSROOT_DIRNAME}/first-dir
25543	  ;;
25544
25545	reserved)
25546	  # Tests of reserved checkouts.  Eventually this will test
25547	  # rcslock.pl (or equivalent) and all kinds of stuff.  Right
25548	  # now it just does some very basic checks on cvs admin -u
25549	  # and cvs admin -l.
25550	  # Also should test locking on a branch (and making sure that
25551	  # locks from one branch don't get mixed up with those from
25552	  # another.  Both the case where one of the branches is the
25553	  # main branch, and in which neither one is).
25554	  # See also test keyword, which tests that keywords and -kkvl
25555	  # do the right thing in the presence of locks.
25556
25557	  # The usual setup, directory first-dir containing file file1.
25558	  mkdir 1; cd 1
25559	  dotest reserved-1 "${testcvs} -q co -l ." ''
25560	  mkdir first-dir
25561	  dotest reserved-2 "${testcvs} add first-dir" \
25562"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
25563          cd first-dir
25564	  touch file1
25565	  dotest reserved-3 "${testcvs} add file1" \
25566"${PROG} add: scheduling file .file1. for addition
25567${PROG} add: use .${PROG} commit. to add this file permanently"
25568	  dotest reserved-4 "${testcvs} -q ci -m add" \
25569"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25570done
25571Checking in file1;
25572${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
25573initial revision: 1\.1
25574done"
25575
25576	  dotest reserved-5 "${testcvs} -q admin -l file1" \
25577"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
255781\.1 locked
25579done"
25580	  dotest reserved-6 "${testcvs} log -N file1" "
25581RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25582Working file: file1
25583head: 1\.1
25584branch:
25585locks: strict
25586	${username}: 1\.1
25587access list:
25588keyword substitution: kv
25589total revisions: 1;	selected revisions: 1
25590description:
25591----------------------------
25592revision 1\.1	locked by: ${username};
25593date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25594add
25595============================================================================="
25596
25597	  # Note that this just tests the owner of the lock giving
25598	  # it up.  It doesn't test breaking a lock.
25599	  dotest reserved-7 "${testcvs} -q admin -u file1" \
25600"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
256011\.1 unlocked
25602done"
25603
25604	  dotest reserved-8 "${testcvs} log -N file1" "
25605RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
25606Working file: file1
25607head: 1\.1
25608branch:
25609locks: strict
25610access list:
25611keyword substitution: kv
25612total revisions: 1;	selected revisions: 1
25613description:
25614----------------------------
25615revision 1\.1
25616date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
25617add
25618============================================================================="
25619
25620	  # rcslock.pl tests.  Of course, the point isn't to test
25621	  # rcslock.pl from the distribution but equivalent
25622	  # functionality (for example, many sites may have an old
25623	  # rcslock.pl).  The functionality of this hook falls
25624	  # short of the real rcslock.pl though.
25625	  # Note that we can use rlog or look at the RCS file directly,
25626	  # but we can't use "cvs log" because "cvs commit" has a lock.
25627
25628	  cat >${TESTDIR}/lockme <<EOF
25629#!${TESTSHELL}
25630line=\`grep <\$1/\$2,v 'locks $anyusername:1\.[0-9];'\`
25631if test -z "\$line"; then
25632  # It isn't locked
25633  exit 0
25634else
25635  user=\`echo \$line | sed -e 's/locks \\($anyusername\\):[0-9.]*;.*/\\1/'\`
25636  version=\`echo \$line | sed -e 's/locks $anyusername:\\([0-9.]*\\);.*/\\1/'\`
25637  echo "\$user has file a-lock locked for version  \$version" >&2
25638  exit 1
25639fi
25640EOF
25641	  # Cygwin.  Blaaarg.
25642	  if test -n "$remotehost"; then
25643	    $CVS_RSH $remotehost "chmod +x ${TESTDIR}/lockme"
25644	  else
25645	    chmod +x ${TESTDIR}/lockme
25646	  fi
25647
25648	  echo stuff > a-lock
25649	  dotest reserved-9 "${testcvs} add a-lock" \
25650"${PROG} add: scheduling file .a-lock. for addition
25651${PROG} add: use .${PROG} commit. to add this file permanently"
25652	  dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
25653"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25654done
25655Checking in a-lock;
25656${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25657initial revision: 1\.1
25658done"
25659	  # FIXME: the contents of CVSROOT fluctuate a lot
25660	  # here. Maybe the expect pattern should just
25661	  # confirm that commitinfo is one of the files checked out,
25662	  # but for now we just check that CVS exited with success.
25663	  cd ..
25664	  if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
25665	    pass reserved-11
25666	  else
25667	    fail reserved-11
25668	  fi
25669	  cd CVSROOT
25670	  echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
25671	  dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
25672"Checking in commitinfo;
25673${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
25674new revision: 1\.2; previous revision: 1\.1
25675done
25676${PROG} commit: Rebuilding administrative file database"
25677	  cd ..; cd first-dir
25678
25679	  # Simulate (approximately) what a-lock would look like
25680	  # if someone else had locked revision 1.1.
25681	  sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
25682	  # Cygwin.
25683	  if test -n "$remotehost"; then
25684	    $CVS_RSH $remotehost "chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25685	  else
25686	    chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25687	  fi
25688	  dotest reserved-13 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25689	  # Cygwin.  Blah.
25690	  if test -n "$remotehost"; then
25691	    $CVS_RSH $remotehost "chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
25692	  else
25693	    chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25694	  fi
25695	  echo more stuff >> a-lock
25696	  dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
25697"fred has file a-lock locked for version  1\.1
25698${PROG} commit: Pre-commit check failed
25699${PROG} \[commit aborted\]: correct above errors first!"
25700	  # OK, now test "cvs admin -l" in the case where someone
25701	  # else has the file locked.
25702	  dotest_fail reserved-13c "${testcvs} admin -l a-lock" \
25703"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25704${PROG} \[admin aborted\]: Revision 1\.1 is already locked by fred"
25705
25706	  dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
25707"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25708${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/a-lock,v: revision 1\.1 locked by fred; breaking lock
257091\.1 unlocked
25710done"
25711	  dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
25712"Checking in a-lock;
25713${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25714new revision: 1\.2; previous revision: 1\.1
25715done"
25716
25717	  # Now test for a bug involving branches and locks
25718	  sed -e 's/locks; strict;/locks fred:1.2; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
25719	  chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25720	  dotest reserved-16 \
25721"mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v" ""
25722	  chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
25723	  dotest reserved-17 "${testcvs} -q tag -b br a-lock" "T a-lock"
25724	  dotest reserved-18 "$testcvs -q update -r br a-lock" '[UP] a-lock'
25725	  echo edit it >>a-lock
25726	  dotest reserved-19 "${testcvs} -q ci -m modify a-lock" \
25727"Checking in a-lock;
25728${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
25729new revision: 1\.2\.2\.1; previous revision: 1\.2
25730done"
25731
25732	  # undo commitinfo changes
25733	  cd ../CVSROOT
25734	  echo '# vanilla commitinfo' >commitinfo
25735	  dotest reserved-cleanup-1 "${testcvs} -q ci -m back commitinfo" \
25736"Checking in commitinfo;
25737${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
25738new revision: 1\.3; previous revision: 1\.2
25739done
25740${PROG} commit: Rebuilding administrative file database"
25741	  cd ..; rm -r CVSROOT; cd first-dir
25742
25743	  cd ../..
25744	  rm -r 1
25745	  rm ${TESTDIR}/lockme
25746	  rm -rf ${CVSROOT_DIRNAME}/first-dir
25747	  ;;
25748
25749        diffmerge1)
25750	  # Make sure CVS can merge correctly in circumstances where it
25751	  # used to mess up (due to a bug which existed in diffutils 2.7
25752	  # and 2.6, but not 2.5, and which has been fixed in CVS's diff
25753	  # lib by Paul Eggert, bless his bitty heart).
25754
25755	  # This first test involves two working copies, "mine" and
25756	  # "yours", checked out from the same repository at the same
25757	  # time.  In yours, you remove some text from the end of the
25758	  # file and check it in; meanwhile, "me" has commented out some
25759	  # lines earlier in the file, and I go to check it in right
25760	  # after you checked yours in.  CVS naturally tells me the file
25761	  # is not up-to-date, so I run cvs update, but it updates
25762	  # incorrectly, leaving in the lines of text you just deleted.
25763	  # Bad!  I'm in too much of a hurry to actually look at the
25764	  # file, so I check it in and go home, and so your changes have
25765	  # been lost.  Later you discover this, and you suspect me of
25766	  # deliberately sabotaging your work, so you let all the air
25767	  # out of my tires.  Only after a series of expensive lawsuits
25768	  # and countersuits do we discover that this was all CVS's
25769	  # fault.
25770	  #
25771	  # Luckily, this problem has been fixed now, as our test will
25772	  # handily confirm, no doubt:
25773
25774	  # First make a repository containing the original text:
25775
25776	  # We should be here anyway, but cd to it just in case:
25777	  cd ${TESTDIR}
25778
25779	  mkdir diffmerge1
25780	  cd diffmerge1
25781
25782	  # These are the files we both start out with:
25783	  mkdir import
25784	  cd import
25785	  diffmerge_create_older_files
25786
25787	  dotest diffmerge1_import \
25788	    "${testcvs} import -m import diffmerge1 tag1 tag2" \
25789	    "${DOTSTAR}No conflicts created by this import"
25790	  cd ..
25791
25792	  # Check out two working copies, one for "you" and one for
25793	  # "me".  If no branch is used and cvs detects that only one
25794	  # of the two people made changes, then cvs does not run the
25795	  # merge algorithm.  But if a branch is used, then cvs does run
25796	  # the merge algorithm (even in this case of only one of the two
25797	  # people having made changes).  CVS used to have a bug in this
25798	  # case.  Therefore, it is important to test this case by
25799	  # using a branch:
25800	  ${testcvs} rtag     -b tag diffmerge1 >/dev/null 2>&1
25801	  ${testcvs} checkout -r tag diffmerge1 >/dev/null 2>&1
25802	  mv diffmerge1 yours
25803	  ${testcvs} checkout diffmerge1 >/dev/null 2>&1
25804	  mv diffmerge1 mine
25805
25806	  # In your working copy, you'll make changes, and
25807	  # then check in your changes before I check in mine:
25808	  cd yours
25809	  diffmerge_create_your_files
25810          dotest diffmerge1_yours "${testcvs} -q ci -m yours" \
25811"Checking in testcase01;
25812${CVSROOT_DIRNAME}/diffmerge1/testcase01,v  <--  testcase01
25813new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25814done
25815Checking in testcase02;
25816${CVSROOT_DIRNAME}/diffmerge1/testcase02,v  <--  testcase02
25817new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25818done
25819Checking in testcase03;
25820${CVSROOT_DIRNAME}/diffmerge1/testcase03,v  <--  testcase03
25821new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25822done
25823Checking in testcase04;
25824${CVSROOT_DIRNAME}/diffmerge1/testcase04,v  <--  testcase04
25825new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25826done
25827Checking in testcase05;
25828${CVSROOT_DIRNAME}/diffmerge1/testcase05,v  <--  testcase05
25829new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25830done
25831Checking in testcase06;
25832${CVSROOT_DIRNAME}/diffmerge1/testcase06,v  <--  testcase06
25833new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25834done
25835Checking in testcase07;
25836${CVSROOT_DIRNAME}/diffmerge1/testcase07,v  <--  testcase07
25837new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25838done
25839Checking in testcase08;
25840${CVSROOT_DIRNAME}/diffmerge1/testcase08,v  <--  testcase08
25841new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25842done
25843Checking in testcase09;
25844${CVSROOT_DIRNAME}/diffmerge1/testcase09,v  <--  testcase09
25845new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25846done
25847Checking in testcase10;
25848${CVSROOT_DIRNAME}/diffmerge1/testcase10,v  <--  testcase10
25849new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
25850done"
25851
25852	  # Change my copy.  Then I
25853	  # update, after both my modifications and your checkin:
25854	  cd ../mine
25855	  diffmerge_create_my_files
25856	  dotest diffmerge1_mine "${testcvs} -q update -j tag" \
25857"M testcase01
25858RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v
25859retrieving revision 1\.1\.1\.1
25860retrieving revision 1\.1\.1\.1\.2\.1
25861Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase01
25862M testcase02
25863RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v
25864retrieving revision 1\.1\.1\.1
25865retrieving revision 1\.1\.1\.1\.2\.1
25866Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase02
25867M testcase03
25868RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v
25869retrieving revision 1\.1\.1\.1
25870retrieving revision 1\.1\.1\.1\.2\.1
25871Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase03
25872M testcase04
25873RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v
25874retrieving revision 1\.1\.1\.1
25875retrieving revision 1\.1\.1\.1\.2\.1
25876Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase04
25877RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v
25878retrieving revision 1\.1\.1\.1
25879retrieving revision 1\.1\.1\.1\.2\.1
25880Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase05
25881RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v
25882retrieving revision 1\.1\.1\.1
25883retrieving revision 1\.1\.1\.1\.2\.1
25884Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase06
25885M testcase07
25886RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v
25887retrieving revision 1\.1\.1\.1
25888retrieving revision 1\.1\.1\.1\.2\.1
25889Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase07
25890testcase07 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1
25891M testcase08
25892RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
25893retrieving revision 1\.1\.1\.1
25894retrieving revision 1\.1\.1\.1\.2\.1
25895Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase08
25896M testcase09
25897RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v
25898retrieving revision 1\.1\.1\.1
25899retrieving revision 1\.1\.1\.1\.2\.1
25900Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase09
25901M testcase10
25902RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v
25903retrieving revision 1\.1\.1\.1
25904retrieving revision 1\.1\.1\.1\.2\.1
25905Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase10"
25906
25907	  # So if your changes didn't make it into my working copy, or
25908	  # in any case if the files do not look like the final text
25909	  # in the files in directory comp_me, then the test flunks:
25910	  cd ..
25911	  mkdir comp_me
25912	  cd comp_me
25913	  diffmerge_create_expected_files
25914	  cd ..
25915	  rm mine/.#*
25916
25917	  # If you have GNU's version of diff, you may try
25918	  # uncommenting the following line which will give more
25919	  # fine-grained information about how cvs differed from the
25920	  # correct result:
25921	  #dotest diffmerge1_cmp "diff -u --recursive --exclude=CVS comp_me mine" ''
25922	  dotest diffmerge1_cmp "directory_cmp comp_me mine"
25923
25924	  # Clean up after ourselves:
25925	  cd ..
25926	  if $keep; then :; else
25927	    rm -rf diffmerge1 ${CVSROOT_DIRNAME}/diffmerge1
25928	  fi
25929	  ;;
25930
25931        diffmerge2)
25932
25933	  # FIXME: This test should be rewritten to be much more concise.
25934	  # It currently weighs in at something like 600 lines, but the
25935	  # same thing could probably be tested in more like 50-100 lines.
25936	  mkdir diffmerge2
25937
25938	  # This tests for another diffmerge bug reported by Martin
25939	  # Tomes; actually, his bug was probably caused by an initial
25940	  # fix for the bug in test diffmerge1, and likely wasn't ever
25941	  # a problem in CVS as long as one was using a normal
25942	  # distribution of diff or a version of CVS that has the diff
25943	  # lib in it. 
25944	  #
25945	  # Nevertheless, once burned twice cautious, so we test for his
25946	  # bug here.
25947	  #
25948	  # Here is his report, more or less verbatim:
25949	  # ------------------------------------------
25950	  #
25951	  # Put the attached file (sgrid.h,v) into your repository
25952	  # somewhere, check out the module and do this:
25953	  #
25954	  # cvs update -j Review_Phase_2_Enhancements sgrid.h
25955	  # cvs diff -r Review_V1p3 sgrid.h
25956	  #
25957	  # As there have been no changes made on the trunk there
25958	  # should be no differences, however this is output:
25959	  #
25960	  # % cvs diff -r Review_V1p3 sgrid.h
25961	  # Index: sgrid.h
25962	  # ===================================================================
25963	  # RCS file: /usr/local/repository/play/fred/sgrid.h,v
25964	  # retrieving revision 1.1.2.1
25965	  # diff -r1.1.2.1 sgrid.h
25966	  # 178a179,184
25967	  # > /*--------------------------------------------------------------
25968	  # > INLINE FUNCTION    :    HORIZONTALLINES
25969	  # > NOTES              :    Description at the end of the file
25970	  # > ----------------------------------------------------------------*/
25971	  # >         uint16 horizontalLines( void );
25972	  # >
25973	  #
25974	  # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
25975	  # differences to sgrid.h version 1.1 and got the correct result
25976	  # so it looks like the built in patch is faulty.
25977	  # -------------------------------------------------------------------
25978	  #
25979	  # This is the RCS file, sgrid.h,v, that he sent:
25980
25981	  echo "head	1.1;
25982access;
25983symbols
25984	Review_V1p3:1.1.2.1
25985	Review_V1p3C:1.1.2.1
25986	Review_1p3A:1.1.2.1
25987	Review_V1p3A:1.1.2.1
25988	Review_Phase_2_Enhancements:1.1.0.2
25989	Review_V1p2:1.1
25990	Review_V1p2B:1.1
25991	Review_V1p2A:1.1
25992	Review_V1p1:1.1
25993	Review_1p1:1.1;
25994locks; strict;
25995comment	@ * @;
25996
25997
259981.1
25999date	97.04.02.11.20.05;	author colinl;	state Exp;
26000branches
26001	1.1.2.1;
26002next	;
26003
260041.1.2.1
26005date	97.06.09.10.00.07;	author colinl;	state Exp;
26006branches;
26007next	;
26008
26009
26010desc
26011@@
26012
26013
260141.1
26015log
26016@Project:     DEV1175
26017DCN:
26018Tested By:   Colin Law
26019Reviewed By:
26020Reason for Change: Initial Revision of all files
26021
26022Design Change Details:
26023
26024Implications:
26025@
26026text
26027@/* \$""Header:   L:/gpanels/dis/sgrid.h_v   1.1.1.0   24 Jan 1996 14:59:20   PAULT  \$ */
26028/*
26029 * \$""Log:   L:/gpanels/dis/sgrid.h_v  \$
26030 * 
26031 *    Rev 1.1.1.0   24 Jan 1996 14:59:20   PAULT
26032 * Branched
26033 * 
26034 *    Rev 1.1   24 Jan 1996 12:09:52   PAULT
26035 * Consolidated 4100 code merged to trunk
26036 * 
26037 *    Rev 1.0.2.0   01 Jun 1995 14:18:58   DAVEH
26038 * Branched
26039 * 
26040 *    Rev 1.0   19 Apr 1995 16:32:48   COLINL
26041 * Initial revision.
26042*/
26043/*****************************************************************************
26044FILE        :   SGRID.H
26045VERSION     :   2.1
26046AUTHOR      :   Dave Hartley
26047SYSTEM      :   Borland C++
26048DESCRIPTION :   The declaration of the scrolling grid class
26049                  
26050*****************************************************************************/
26051#if !defined(__SGRID_H)
26052#define __SGRID_H
26053
26054#if !defined(__SCROLL_H)
26055#include <scroll.h>
26056#endif
26057
26058#if !defined(__GKI_H)
26059#include \"gki.h\"
26060#endif
26061
26062#if defined PRINTING_SUPPORT
26063class Printer;
26064#endif
26065
26066/*****************************************************************************
26067CLASS      :    ScrollingGrid   
26068DESCRIPTION:    This class inherits from a grid and a scrollable, and
26069                can therefore use all the PUBLIC services provided by these
26070                classes. A description of these can be found in
26071                GRID.H and SCROLL.H.
26072                A scrolling grid is a set of horizontal and vertical lines
26073                that scroll and continually update to provide a complete grid
26074
26075*****************************************************************************/
26076
26077class ScrollingGrid : public Scrollable
26078{
26079    public:
26080#if defined _WINDOWS
26081/*---------------------------------------------------------------------------
26082FUNCTION    :   CONSTRUCTOR
26083DESCRIPTION :   sets up the details of the grid, ready for painting
26084ARGUMENTS   :   name  : sgColour
26085                        - the colour of the grid
26086                        sgLineType
26087                        - the syle of line
26088                        sgHorizontalTotal
26089                        - the total number of horizontal grid lines
26090                        verticalSpacingMin
26091                        - the min distance between the vertical grid lines
26092                          on the scrolling axis
26093                        currentTimestamp
26094                        - timestamp value now
26095                        ticksPerSecond
26096                        - number of timestamp ticks per second
26097                        ticksPerPixel
26098                        - number of timestamp ticks per pixel required
26099                      
26100RETURN      :   None
26101NOTES       :   
26102---------------------------------------------------------------------------*/
26103        ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType, 
26104            uint16 sgHorizontalTotal, 
26105            uint16 verticalSpacingMin, uint32 currentTimestamp, 
26106            uint16 ticksPerSecond, uint32 ticksPerPixel );
26107#else
26108/*---------------------------------------------------------------------------
26109FUNCTION    :   CONSTRUCTOR
26110DESCRIPTION :   sets up the details of the grid, ready for painting
26111ARGUMENTS   :   name  : sgColour
26112                        - the colour of the grid
26113                        sgLineType
26114                        - the syle of line
26115                        sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
26116                        - the total number of horizontal grid lines
26117                        sgVerticalSpacing
26118                        - the distance between the vertical grid lines
26119                        on the scrolling axis
26120                      
26121RETURN      :   None
26122NOTES       :   If the caller does not get the total grid lines value, synced
26123                with the overall size of the viewport, the spacing between
26124                grid lines will not be consistent.
26125
26126---------------------------------------------------------------------------*/
26127        ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
26128                     , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
26129#endif
26130/*---------------------------------------------------------------------------
26131FUNCTION    :   DESTRUCTOR
26132DESCRIPTION :   tidies it all up
26133ARGUMENTS   :   name  :      
26134                      
26135RETURN      :   None
26136NOTES       : 
26137---------------------------------------------------------------------------*/
26138        ~ScrollingGrid( void );
26139
26140/*---------------------------------------------------------------------------
26141FUNCTION    :   ATTACH
26142DESCRIPTION :   This service overloads the base class service, as it does
26143                additional work at the time of attachment.
26144
26145ARGUMENTS   :   name  : tDrawingArea
26146                        - the scrolled viewport to attach this trend to
26147                      
26148RETURN      :   None
26149NOTES       :
26150---------------------------------------------------------------------------*/
26151        void attach( SViewport *tDrawingArea );
26152
26153#if defined _WINDOWS
26154/*---------------------------------------------------------------------------
26155FUNCTION    :   calculateVerticalSpacing
26156DESCRIPTION :   determines optimum spacing along time axis
26157ARGUMENTS   :   
26158RETURN      :   None
26159NOTES       : 
26160---------------------------------------------------------------------------*/
26161        void calculateVerticalSpacing();
26162
26163/*---------------------------------------------------------------------------
26164FUNCTION    :   gridSpacingTicks
26165DESCRIPTION :   Provides the grid spacing in the time axis in ticks
26166ARGUMENTS   :   
26167RETURN      :   Number of ticks
26168NOTES       : 
26169---------------------------------------------------------------------------*/
26170        uint32 gridSpacingTicks();
26171
26172#endif
26173
26174/*---------------------------------------------------------------------------
26175INLINE FUNCTION    :    HORIZONTALLINES
26176NOTES              :    Description at the end of the file
26177---------------------------------------------------------------------------*/
26178        uint16 horizontalLines( void );
26179
26180#if defined _WINDOWS
26181// In Windows the OnDraw() function replaces paint()
26182/*---------------------------------------------------------------------------
26183FUNCTION    :   ScrollingGrid OnDraw   
26184DESCRIPTION :   Paints the given area of the grid.
26185                Pure virtual
26186ARGUMENTS   :   pDC     pointer to the device context to use for display
26187                        Note that the device context operates in the coords
26188                        of the window owning the viewport
26189RETURN      :   None
26190NOTES       : 
26191---------------------------------------------------------------------------*/
26192        virtual void OnDraw( CDC *pDC );
26193
26194#else   // not Windows            
26195
26196/*---------------------------------------------------------------------------
26197FUNCTION    :   PAINT
26198DESCRIPTION :   This extends the standard grid paint method to paint the
26199                viewport relative to its current position. 
26200                
26201ARGUMENTS   :   name  :      
26202                      
26203RETURN      :   None
26204NOTES       : 
26205---------------------------------------------------------------------------*/
26206        void paint( void );
26207#endif
26208
26209/*---------------------------------------------------------------------------
26210FUNCTION    :   P A I N T   T E X T   M A R K E R S 
26211DESCRIPTION :   this service allow the text markers to be painted seperatley
26212                from the grid lines
26213
26214ARGUMENTS   :   name : 
26215                                                                          
26216RETURN      :   None
26217NOTES       : 
26218---------------------------------------------------------------------------*/
26219        void paintTextMarkers();
26220
26221#if defined PRINTING_SUPPORT
26222/*---------------------------------------------------------------------------
26223FUNCTION    :   P R I N T 
26224DESCRIPTION :   This print service prints a grid marker ( being either a
26225                timestamp or a date, IF there is one at the plot position
26226                given
26227
26228ARGUMENTS   :   name :
26229                        displayPosition
26230                        - Where in the log to look to see if there is an
26231                          entry to print
26232
26233                        - printerPtr
26234                          the printer to print to
26235                                                                          
26236RETURN      :   None
26237NOTES       : 
26238---------------------------------------------------------------------------*/
26239        void print( uint16 currentPrintPos, Printer *printerPtr );
26240#endif
26241
26242/*---------------------------------------------------------------------------
26243FUNCTION    :   S E T  D R I V E  D I R E C T I O N
26244DESCRIPTION :   Sets direction for update and scrolling forwards or backwards
26245ARGUMENTS   :   direction  - required direction
26246RETURN      :   None
26247NOTES       : 
26248---------------------------------------------------------------------------*/
26249        void setDriveDirection( ScrollDirection direction );
26250
26251/*---------------------------------------------------------------------------
26252FUNCTION    :   S E T U P 
26253DESCRIPTION :   service that will setup the grid prior to a paint
26254
26255ARGUMENTS   :   name :
26256                        - newTimestamp
26257                            
26258
26259                        - newTimeBase
26260                        the number of ticks that represent a plot point on
26261                        the trendgraph. 
26262                                                                          
26263RETURN      :   None
26264NOTES       : 
26265---------------------------------------------------------------------------*/
26266        void setup( uint32 newTimestamp, uint32 newTimeBase );
26267
26268#if defined PRINTING_SUPPORT
26269/*---------------------------------------------------------------------------
26270FUNCTION    :   S E T U P   F O R   P R I N T   
26271DESCRIPTION :   This service iis to be called prior to printing. It allows
26272                the grid to prepare its markers ready for the print
26273                commands
26274
26275ARGUMENTS   :   name : 
26276                                                                          
26277RETURN      :   None
26278NOTES       : 
26279---------------------------------------------------------------------------*/
26280        void setupForPrint();
26281#endif
26282
26283/*---------------------------------------------------------------------------
26284FUNCTION    :   UPDATE
26285DESCRIPTION :   When this service is called it will calculate what needs to
26286                be painted and fill in the display again.
26287
26288ARGUMENTS   :   name  :     timeStamp
26289                            - the reference time of this update.
26290                      
26291RETURN      :   None
26292NOTES       : 
26293---------------------------------------------------------------------------*/
26294        void update( uint32 timeStamp );
26295
26296/*---------------------------------------------------------------------------
26297FUNCTION    :   U P D A T E   B U F F E R
26298DESCRIPTION :   When a display update is not required, use this method. It
26299                updates the internal data ready for a call to paint that
26300                will then show the grid in the right position
26301
26302ARGUMENTS   :   name  :      
26303                      
26304RETURN      :   None
26305NOTES       : 
26306---------------------------------------------------------------------------*/
26307        void updateBuffer( void );
26308
26309    private:
26310
26311/*---------------------------------------------------------------------------
26312FUNCTION    :   M A K E   G R I D   M A R K E R 
26313DESCRIPTION :   service that perpares a string for display. The string will
26314                either be a short date, or short time. this is determined
26315                by the current setting of the dateMarker flag
26316
26317ARGUMENTS   :   name :  timestampVal
26318                        - the value to convert
26319                        
26320                        storePtr
26321                        - the place to put the string
26322
26323RETURN      :   None
26324NOTES       : 
26325---------------------------------------------------------------------------*/
26326        void makeGridMarker( uint32 timestampVal, char *storePtr );
26327            
26328/*---------------------------------------------------------------------------
26329FUNCTION    :   P A I N T   G R I D   M A R K E R 
26330DESCRIPTION :   given a position will put the string on the display
26331
26332ARGUMENTS   :   name :
26333                        yPos
26334                        - were it goes on the Y-axis
26335
26336                        gridMarkerPtr
26337                        - what it is
26338                                                                          
26339RETURN      :   None
26340NOTES       : 
26341---------------------------------------------------------------------------*/
26342        void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
26343
26344#if defined _WINDOWS
26345/*---------------------------------------------------------------------------
26346FUNCTION    :   PAINTHORIZONTALLINES
26347DESCRIPTION :   responsible for painting the grids horizontal lines 
26348ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
26349                                in viewport coords
26350                pDC             pointer to device context to use
26351                      
26352RETURN      : None
26353NOTES       :
26354---------------------------------------------------------------------------*/
26355        void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
26356#else
26357/*---------------------------------------------------------------------------
26358FUNCTION    :   PAINTHORIZONTALLINES
26359DESCRIPTION :   responsible for painting the grids horizontal lines 
26360ARGUMENTS   : name: xStart
26361                    - the starting X co-ordinate for the horizontal line
26362                    xEnd
26363                    - the ending X co-ordinate for the horizontal line
26364                      
26365RETURN      : None
26366NOTES       : Remember lines are drawn from origin. The origin in a
26367              horizontal viewport will be the top.    
26368---------------------------------------------------------------------------*/
26369        void paintHorizontalLines( uint16 xStart, uint16 xEnd );
26370#endif
26371
26372#if defined _WINDOWS
26373/*---------------------------------------------------------------------------
26374FUNCTION    :   PAINTVERTICALLINES
26375DESCRIPTION :   responsible for painting the grids vertical lines 
26376ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
26377                                in viewport coords
26378                offset          offset from rhs that rightmost line would be 
26379                                drawn if rectangle included whole viewport
26380                pDC             pointer to device context to use
26381RETURN      : None
26382NOTES       : 
26383---------------------------------------------------------------------------*/
26384        void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
26385            CDC* pDC );
26386#else
26387/*---------------------------------------------------------------------------
26388FUNCTION    :   PAINTVERTICALLINES
26389DESCRIPTION :   responsible for painting the grids vertical lines 
26390ARGUMENTS   : name  :   yStart
26391                        - the starting Y co-ordinate for the vertical line
26392                        yEnd
26393                        - the ending Y co-ordinate for the vertical line
26394                        offset
26395                        - a starting point offset that determines at what X
26396                        position the first line will be drawn
26397
26398                      
26399RETURN      : None
26400NOTES       : 
26401---------------------------------------------------------------------------*/
26402        void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
26403#endif
26404
26405#if defined _WINDOWS
26406/*---------------------------------------------------------------------------
26407FUNCTION    :   PAINTVERTICALLINE
26408DESCRIPTION :   paints one line at the position specified, and length
26409ARGUMENTS   :   name  : yStart
26410                        - the starting point on the y axis for the line
26411                        yEnd
26412                        - the end point on the y axis for the line
26413                        xPosition
26414                        - The horizontal offset from the start of the viewport
26415                pDC             pointer to device context to use
26416                      
26417RETURN      :   None
26418NOTES       :   There is not an equivalent horizontal method as yet. This
26419                is a seperate method because the service is useful to a
26420                derivation of this class
26421---------------------------------------------------------------------------*/
26422        void paintVerticalLine( uint16 yStart, uint16 yEnd
26423                              , uint16 xPosition, CDC *pDC );
26424#else
26425/*---------------------------------------------------------------------------
26426FUNCTION    :   PAINTVERTICALLINE
26427DESCRIPTION :   paints one line at the position specified, and length
26428ARGUMENTS   :   name  : yStart
26429                        - the starting point on the y axis for the line
26430                        yEnd
26431                        - the end point on the y axis for the line
26432                        xPosition
26433                        - The horizontal offset from the start of the viewport
26434                      
26435RETURN      :   None
26436NOTES       :   There is not an equivalent horizontal method as yet. This
26437                is a seperate method because the service is useful to a
26438                derivation of this class
26439---------------------------------------------------------------------------*/
26440        void paintVerticalLine( uint16 yStart, uint16 yEnd
26441                              , uint16 xPosition );
26442#endif
26443
26444/*---------------------------------------------------------------------------
26445INLINE FUNCTION    :    VERTICALSPACING
26446NOTES              :    Description at the end of the file
26447---------------------------------------------------------------------------*/
26448        uint16 verticalSpacing( void );
26449
26450
26451        // Position in viewport that we are now writing to if going forwards
26452        // Note that if this is greater than viewport length then we have
26453        // just scrolled and value must be adjusted before use.
26454        sint16 forwardsOutputPosition;
26455        
26456        // Position in viewport that we are now writing to if going backwards
26457        // Note that if this is less than zero then we have
26458        // just scrolled and value must be adjusted before use.
26459        sint16 backwardsOutputPosition;
26460
26461        // position in grid cycle of forwards output position.
26462        // if zero then it is time to output a grid line
26463        sint16 forwardsIntervalCount;
26464
26465        // position in grid cycle of forwards output position.
26466        // if zero then it is time to output a grid line
26467        sint16 backwardsIntervalCount;
26468        
26469        uint32  lastUpdateTimestamp;
26470        uint32  timeBase;       // ticks per pixel
26471        uint16  currentOutputPosition;
26472        uint16  gridTimestampSpacing;
26473        uint16  intervalCount;
26474        uint16  horizontalTotal;
26475        uint16  vSpacing;
26476#if defined PRINTING_SUPPORT
26477        uint16  numberOfGridMarkersPrinted;
26478#endif
26479        bool    firstTime;       // indicates first time through
26480        bool    dateMarker;
26481
26482        GkiLineType lineType;
26483        GkiColour   gridColour;
26484
26485    #if defined _WINDOWS
26486        uint16 ticksPerSec;     // number of time ticks per second
26487        uint16 vSpacingMin;     // minimum pixels per division along time axis 
26488        CPen *pPen;             // the pen to use for drawing in windows
26489    #endif
26490
26491};
26492
26493
26494/*****************************************************************************
26495                        I N L I N E   F U N C T I O N S   
26496*****************************************************************************/
26497
26498/*---------------------------------------------------------------------------
26499FUNCTION    :   HORIZONTALLINES
26500DESCRIPTION :   supplies the number of horizontal lines in the grid
26501ARGUMENTS   :   name  :      
26502                      
26503RETURN      :   
26504NOTES       : 
26505---------------------------------------------------------------------------*/
26506inline uint16 ScrollingGrid::horizontalLines( void )
26507{
26508    return( horizontalTotal );
26509}
26510/*---------------------------------------------------------------------------
26511FUNCTION    :   VERTICALSPACING
26512DESCRIPTION :   returns the distance between adjacent vertical lines
26513ARGUMENTS   :   name  :      
26514                      
26515RETURN      :   None
26516NOTES       : 
26517---------------------------------------------------------------------------*/
26518inline uint16 ScrollingGrid::verticalSpacing( void )
26519{
26520    return( vSpacing );
26521}
26522
26523#endif
26524@
26525
26526
265271.1.2.1
26528log
26529@DEV1194:DS4    Provision of major and minor grid lines
26530@
26531text
26532@d1 1
26533a1 1
26534/* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
26535d3 1
26536a3 12
26537 * \$""Log: sgrid.h,v \$
26538 * Revision 1.1  1997/04/02 11:20:05  colinl
26539 * Project:     DEV1175
26540 * DCN:
26541 * Tested By:   Colin Law
26542 * Reviewed By:
26543 * Reason for Change: Initial Revision of all files
26544 *
26545 * Design Change Details:
26546 *
26547 * Implications:
26548 *
26549d58 6
26550a63 5
26551ARGUMENTS   :   name  : majorColour         colour for major grid lines
26552                        minorColour         colour for minor grid lines
26553                        sgLineType          line type for minor grid lines
26554                        yMajorGridLines     number of major y lines on grid
26555                        yMinorGridLines     number of major y lines on grid
26556d77 2
26557a78 3
26558        ScrollingGrid( GkiColour majorColour, GkiColour minorColour, 
26559            GkiLineType sgLineType, 
26560            uint16 yMajorGridLines, uint16 yMinorGridLines,
26561a137 17
26562FUNCTION    :   DrawHorizontalGridLines
26563
26564DESCRIPTION :   Draws major or minor grid lines
26565ARGUMENTS   :   pDC         device context
26566                pPen        pen to use
26567                numLines    total lines required
26568                yLow, yHigh, xLow, xHigh   rectangle to draw in
26569                yMax        max y value
26570RETURN      :   None
26571NOTES       :   
26572---------------------------------------------------------------------------*/
26573        void DrawHorizontalGridLines( CDC* pDC, CPen* pPen, 
26574            uint16 numLines,
26575            uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh, 
26576            uint16 yMax );
26577
26578/*---------------------------------------------------------------------------
26579d148 6
26580d448 1
26581a448 2
26582        uint16  m_yMajorGridLines;
26583        uint16  m_yMinorGridLines;
26584d456 2
26585a457 3
26586        GkiLineType lineType;    // line type for minor grid lines
26587        GkiColour   m_majorColour;
26588        GkiColour   m_minorColour;
26589d462 1
26590a462 2
26591        CPen *pMajorPen;        // pen to use for drawing major grid lines
26592        CPen *pMinorPen;        // pen to use for drawing minor grid lines
26593d472 12
26594@" > diffmerge2/sgrid.h,v
26595
26596	  # We have to put the RCS file in the repository by hand for
26597	  # this test:
26598	  mkdir ${CVSROOT_DIRNAME}/diffmerge2
26599	  cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
26600	  rm -rf diffmerge2
26601	  dotest diffmerge2_co \
26602	    "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
26603	  cd diffmerge2
26604	  dotest diffmerge2_update \
26605	    "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
26606	    "${DOTSTAR}erging ${DOTSTAR}"
26607	  # This is the one that counts -- there should be no output:
26608	  dotest diffmerge2_diff \
26609	    "${testcvs} diff -r Review_V1p3 sgrid.h" ''
26610
26611	  cd ..
26612	  rm -rf diffmerge2
26613	  rm -rf ${CVSROOT_DIRNAME}/diffmerge2
26614	  ;;
26615
26616	release)
26617	  # Tests of "cvs release", particularly multiple arguments.
26618	  # Other CVS release tests:
26619	  #   info-cleanup-0 for "cvs -n release".
26620	  #   ignore-193 for the text of the question that cvs release asks.
26621	  #     Also for interactions with cvsignore.
26622	  #   basicc: "-d .", global -Q, no arguments (is a noop),
26623	  #     "cvs release" without -d, multiple arguments.
26624	  #   dirs-4: repository directory has been deleted.
26625	  #   modules2-6: multiple arguments.
26626
26627	  # First the usual setup; create a directory first-dir.
26628	  mkdir 1; cd 1
26629	  dotest release-1 "${testcvs} -q co -l ." ''
26630	  mkdir first-dir
26631	  dotest release-2 "${testcvs} add first-dir" \
26632"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
26633          cd first-dir
26634	  mkdir dir1
26635	  dotest release-3 "${testcvs} add dir1" \
26636"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
26637	  mkdir dir2
26638	  dotest release-4 "${testcvs} add dir2" \
26639"Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository"
26640          cd dir2
26641	  mkdir dir3
26642	  dotest release-5 "${testcvs} add dir3" \
26643"Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
26644
26645          cd ../..
26646	  dotest release-6 "${testcvs} release -d first-dir/dir2/dir3 first-dir/dir1" \
26647"You have .0. altered files in this repository.
26648Are you sure you want to release (and delete) directory .first-dir/dir2/dir3.: \
26649You have .0. altered files in this repository.
26650Are you sure you want to release (and delete) directory .first-dir/dir1.: " <<EOF
26651yes
26652yes
26653EOF
26654	  dotest_fail release-7 "test -d first-dir/dir1" ''
26655	  dotest_fail release-8 "test -d first-dir/dir2/dir3" ''
26656	  dotest release-9 "${testcvs} update" \
26657"${PROG} update: Updating \.
26658${PROG} update: Updating first-dir
26659${PROG} update: Updating first-dir/dir2"
26660
26661          cd first-dir
26662	  mkdir dir1
26663	  dotest release-10 "${testcvs} add dir1" \
26664"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
26665          cd dir2
26666	  mkdir dir3
26667	  dotest release-11 "${testcvs} add dir3" \
26668"Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
26669
26670          cd ../..
26671	  dotest release-12 "${testcvs} release first-dir/dir2/dir3 first-dir/dir1" \
26672"You have .0. altered files in this repository.
26673Are you sure you want to release directory .first-dir/dir2/dir3.: .. .release. aborted by user choice.
26674You have .0. altered files in this repository.
26675Are you sure you want to release directory .first-dir/dir1.: " <<EOF
26676no
26677yes
26678EOF
26679	  dotest release-13 "${testcvs} release first-dir/dir2/dir3 first-dir/dir2" \
26680"You have .0. altered files in this repository.
26681Are you sure you want to release directory .first-dir/dir2/dir3.: \
26682You have .0. altered files in this repository.
26683Are you sure you want to release directory .first-dir/dir2.: " <<EOF
26684yes
26685yes
26686EOF
26687	  dotest release-14 "test -d first-dir/dir1" ''
26688	  dotest release-15 "test -d first-dir/dir2/dir3" ''
26689	  rm -rf first-dir/dir1 first-dir/dir2
26690
26691	  dotest release-16 "${testcvs} update" \
26692"${PROG} update: Updating \.
26693${PROG} update: Updating first-dir"
26694
26695	  # Check to make sure release isn't overwriting a
26696	  # CVS/Entries file in the current directory (using data
26697	  # from the released directory).
26698
26699	  # cvs 1.11 (remote) fails on release-21 (a message about
26700          # chdir into the removed directory), although it seemingly
26701	  # unedits and removes the directory correctly.  If
26702	  # you manually continue, it then fails on release-22 do
26703	  # to the messed up CVS/Entries file from release-21.
26704          cd first-dir
26705	  mkdir second-dir
26706	  dotest release-18 "$testcvs add second-dir" \
26707"Directory $CVSROOT_DIRNAME/first-dir/second-dir added to the repository"
26708
26709	  cd second-dir
26710	  touch file1
26711	  dotest release-19 "$testcvs -Q add file1"
26712	  dotest release-20 '$testcvs -q ci -m add' \
26713"RCS file: $CVSROOT_DIRNAME/first-dir/second-dir/file1,v
26714done
26715Checking in file1;
26716$CVSROOT_DIRNAME/first-dir/second-dir/file1,v  <--  file1
26717initial revision: 1\.1
26718done"
26719	  dotest release-21 "$testcvs edit file1"
26720	  cd ..
26721	  dotest release-22 "echo yes | $testcvs release -d second-dir" \
26722"You have \[0\] altered files in this repository.
26723Are you sure you want to release (and delete) directory \`second-dir': "
26724	  dotest release-23 "$testcvs -q update -d" "U second-dir/file1"
26725	  dotest release-24 "$testcvs edit"
26726
26727	  cd ../..
26728	  rm -rf 1 $CVSROOT_DIRNAME/first-dir
26729	  ;;
26730
26731
26732
26733	recase)
26734	  #
26735	  # Some tests of behavior which broke at one time or another when run
26736	  # from case insensitive clients against case sensitive servers.
26737	  #
26738	  # These tests are namned according to the following convention:
26739	  #
26740	  #   ci	Client (sandbox filesystem) case Insensitive
26741	  #   cs	Client (sandbox filesystem) case Sensitive
26742	  #   si	Server (repository filesystem) case Insensitive
26743	  #   ss	Server (repository filesystem) case Sensitive
26744	  #
26745
26746	  mkdir 1; cd 1
26747
26748	  # First, we will expect different results for a few of these tests
26749	  # based on whether the repository is on a case sensitive filesystem
26750	  # or not and whether the sandbox is on a case sensitive filesystem or
26751	  # not, so determine which cases we are dealing with:
26752	  echo file >file
26753	  echo FiLe >FiLe
26754	  if cmp file FiLe >/dev/null; then
26755	    client_sensitive=false
26756	  else
26757	    client_sensitive=:
26758	  fi
26759	  if test -n "$remotehost"; then
26760	    $CVS_RSH $remotehost 'echo file >file'
26761	    $CVS_RSH $remotehost 'echo FiLe >FiLe'
26762	    if $CVS_RSH $remotehost 'cmp file FiLe >/dev/null'; then
26763	      server_sensitive=false
26764	    else
26765	      server_sensitive=:
26766	    fi
26767	  else
26768	    server_sensitive=$client_sensitive
26769	  fi
26770
26771	  # The first test (recase-1 & recase-2) is for a remove of a file then
26772	  # a readd in a different case.
26773	  mkdir $CVSROOT_DIRNAME/first-dir
26774	  dotest recase-init-1 "$testcvs -Q co first-dir"	
26775	  cd first-dir
26776
26777	  echo this file has no content >file
26778	  dotest recase-init-2 "$testcvs -Q add file"
26779	  dotest recase-init-3 "$testcvs -Q ci -madd" \
26780"RCS file: $CVSROOT_DIRNAME/first-dir/file,v
26781done
26782Checking in file;
26783$CVSROOT_DIRNAME/first-dir/file,v  <--  file
26784initial revision: 1\.1
26785done"
26786	  dotest recase-init-4 "$testcvs -Q tag first"
26787
26788	  # Now remove the file.
26789	  dotest recase-init-5 "$testcvs -Q rm -f file"
26790	  dotest recase-init-6 "$testcvs -Q ci -mrm" \
26791"Removing file;
26792$CVSROOT_DIRNAME/first-dir/file,v  <--  file
26793new revision: delete; previous revision: 1\.1
26794done"
26795
26796	  # Now the test - readd in a different case.
26797	  echo this file needs some content >FiLe
26798	  if $server_sensitive; then
26799	    dotest recase-1ss "$testcvs add FiLe" \
26800"$PROG add: scheduling file \`FiLe' for addition
26801$PROG add: use '$PROG commit' to add this file permanently"
26802	    dotest recase-2ss "$testcvs -q ci -mrecase" \
26803"RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26804done
26805Checking in FiLe;
26806$CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
26807initial revision: 1\.1
26808done"
26809	  else # server insensitive
26810	    dotest recase-1si "$testcvs add FiLe" \
26811"$PROG add: Re-adding file \`FiLe' (in place of dead revision 1\.2)\.
26812$PROG add: use '$PROG commit' to add this file permanently"
26813	    dotest recase-2si "$testcvs -q ci -mrecase" \
26814"Checking in FiLe;
26815$CVSROOT_DIRNAME/first-dir/FiLe,v  <--  FiLe
26816new revision: 1\.3; previous revision: 1\.2
26817done"
26818	  fi
26819
26820	  # Now verify that a checkout will still work
26821	  cd ../..
26822	  mkdir 2; cd 2
26823	  dotest recase-3 "$testcvs -q co first-dir" \
26824"U first-dir/FiLe"
26825
26826	  cd first-dir
26827	  # Prove that we can still get status and log information on
26828	  # conflicting case files (1 in Attic, one in parent).
26829	  if $remote; then
26830	    if $client_sensitive; then
26831	      file=file
26832	      fIlE=fIlE
26833	    else # client insensitive
26834	      # Because FiLe is present on a case insensitive client, it is the
26835	      # only one ever found and queried or altered.
26836	      file=FiLe
26837	      fIlE=FiLe
26838	    fi
26839	  else # ! $remote
26840	    file=file
26841	    fIlE=fIlE
26842	  fi
26843	  if $server_sensitive; then
26844	    if $client_sensitive; then
26845	      # Client finds Entry only for FiLe.  Others returned by server.
26846	      dotest recase-4sscs "$testcvs status file" \
26847"===================================================================
26848File: no file file		Status: Up-to-date
26849
26850   Working revision:	No entry for file
26851   Repository revision:	1\.2	$CVSROOT_DIRNAME/first-dir/Attic/file,v"
26852	      dotest recase-5sscs "$testcvs log file" \
26853"
26854RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
26855Working file: file
26856head: 1\.2
26857branch:
26858locks: strict
26859access list:
26860symbolic names:
26861	first: 1\.1
26862keyword substitution: kv
26863total revisions: 2;	selected revisions: 2
26864description:
26865----------------------------
26866revision 1\.2
26867date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
26868rm
26869----------------------------
26870revision 1\.1
26871date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26872add
26873============================================================================="
26874	      dotest recase-6sscs "$testcvs status FiLe" \
26875"===================================================================
26876File: FiLe             	Status: Up-to-date
26877
26878   Working revision:	1\.1.*
26879   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
26880   Sticky Tag:		(none)
26881   Sticky Date:		(none)
26882   Sticky Options:	(none)"
26883	      dotest recase-7sscs "$testcvs log FiLe" \
26884"
26885RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26886Working file: FiLe
26887head: 1\.1
26888branch:
26889locks: strict
26890access list:
26891symbolic names:
26892keyword substitution: kv
26893total revisions: 1;	selected revisions: 1
26894description:
26895----------------------------
26896revision 1\.1
26897date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26898recase
26899============================================================================="
26900	    else # server sensitive && client insensitive
26901	      # Client finds same Entry for file & FiLe.
26902	      dotest recase-4ssci "$testcvs status file" \
26903"===================================================================
26904File: FiLe             	Status: Up-to-date
26905
26906   Working revision:	1\.1.*
26907   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
26908   Sticky Tag:		(none)
26909   Sticky Date:		(none)
26910   Sticky Options:	(none)"
26911	      dotest recase-5ssci "$testcvs log file" \
26912"
26913RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26914Working file: FiLe
26915head: 1\.1
26916branch:
26917locks: strict
26918access list:
26919symbolic names:
26920keyword substitution: kv
26921total revisions: 1;	selected revisions: 1
26922description:
26923----------------------------
26924revision 1\.1
26925date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26926recase
26927============================================================================="
26928	      dotest recase-6ss "$testcvs status FiLe" \
26929"===================================================================
26930File: FiLe             	Status: Up-to-date
26931
26932   Working revision:	1\.1.*
26933   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
26934   Sticky Tag:		(none)
26935   Sticky Date:		(none)
26936   Sticky Options:	(none)"
26937	      dotest recase-7ss "$testcvs log FiLe" \
26938"
26939RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
26940Working file: FiLe
26941head: 1\.1
26942branch:
26943locks: strict
26944access list:
26945symbolic names:
26946keyword substitution: kv
26947total revisions: 1;	selected revisions: 1
26948description:
26949----------------------------
26950revision 1\.1
26951date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26952recase
26953============================================================================="
26954	    fi
26955	  else # server insensitive
26956	    # There is only one archive when the server is insensitive, but the
26957	    # printed file/archive name can vary.
26958	    dotest recase-4si "$testcvs status file" \
26959"===================================================================
26960File: $file             	Status: Up-to-date
26961
26962   Working revision:	1\.3.*
26963   Repository revision:	1\.3	$CVSROOT_DIRNAME/first-dir/$file,v
26964   Sticky Tag:		(none)
26965   Sticky Date:		(none)
26966   Sticky Options:	(none)"
26967	    dotest recase-5si "$testcvs log file" \
26968"
26969RCS file: $CVSROOT_DIRNAME/first-dir/$file,v
26970Working file: $file
26971head: 1\.3
26972branch:
26973locks: strict
26974access list:
26975symbolic names:
26976	first: 1\.1
26977keyword substitution: kv
26978total revisions: 3;	selected revisions: 3
26979description:
26980----------------------------
26981revision 1\.3
26982date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
26983recase
26984----------------------------
26985revision 1\.2
26986date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
26987rm
26988----------------------------
26989revision 1\.1
26990date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
26991add
26992============================================================================="
26993	    dotest recase-6si "$testcvs status FiLe" \
26994"===================================================================
26995File: FiLe             	Status: Up-to-date
26996
26997   Working revision:	1\.3.*
26998   Repository revision:	1\.3	$CVSROOT_DIRNAME/first-dir/FiLe,v
26999   Sticky Tag:		(none)
27000   Sticky Date:		(none)
27001   Sticky Options:	(none)"
27002	    dotest recase-7si "$testcvs log FiLe" \
27003"
27004RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27005Working file: FiLe
27006head: 1\.3
27007branch:
27008locks: strict
27009access list:
27010symbolic names:
27011	first: 1\.1
27012keyword substitution: kv
27013total revisions: 3;	selected revisions: 3
27014description:
27015----------------------------
27016revision 1\.3
27017date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: +1 -1
27018recase
27019----------------------------
27020revision 1\.2
27021date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
27022rm
27023----------------------------
27024revision 1\.1
27025date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27026add
27027============================================================================="
27028	  fi
27029
27030	  # And when the file does not exist on the client, we go with the
27031	  # client Entries match.
27032	  if $client_sensitive && $server_sensitive; then
27033	    dotest recase-8sscs "$testcvs status fIlE" \
27034"$PROG status: nothing known about fIlE
27035===================================================================
27036File: no file fIlE		Status: Unknown
27037
27038   Working revision:	No entry for fIlE
27039   Repository revision:	No revision control file"
27040	  else # !$client_sensitive || !$server_sensitive
27041	    dotest recase-8anyi "$testcvs status fIlE" \
27042"===================================================================
27043File: $fIlE             	Status: Up-to-date
27044
27045   Working revision:	1\.[0-9]*.*
27046   Repository revision:	1\.[0-9]*	$CVSROOT_DIRNAME/first-dir/$fIlE,v
27047   Sticky Tag:		(none)
27048   Sticky Date:		(none)
27049   Sticky Options:	(none)"
27050	  fi
27051
27052	  # and an update
27053	  if $server_sensitive; then
27054	    dotest recase-9ss "$testcvs -q up -rfirst" \
27055"$PROG update: FiLe is no longer in the repository
27056U file"
27057
27058	    if $client_sensitive; then
27059	      dotest recase-10sscs "$testcvs -q up -A" \
27060"U FiLe
27061$PROG update: file is no longer in the repository"
27062	    else # client insensitive
27063	      # FIXCVS: This should remove the offending file first.
27064	      dotest_fail recase-10ssci "$testcvs -q up -A" \
27065"$PROG update: move away \./FiLe; it is in the way
27066C FiLe
27067$PROG update: file is no longer in the repository"
27068
27069	      cd ..
27070	      rm -r first-dir
27071	      dotest recase-11ssci "$testcvs -q co first-dir" \
27072"U first-dir/FiLe"
27073	      cd first-dir
27074	    fi
27075
27076	    #
27077	    # See what happens when cased names clash.
27078	    #
27079
27080	    # Copy the archive
27081	    if test -n "$remotehost"; then
27082	      $CVS_RSH $remotehost "cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
27083		$CVSROOT_DIRNAME/first-dir/FILE,v"
27084	    else
27085	      cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
27086		$CVSROOT_DIRNAME/first-dir/FILE,v
27087	    fi
27088
27089	    if $client_sensitive; then
27090	      dotest recase-12sscs "$testcvs -q up" "U FILE"
27091	    else # client insensitive
27092	      dotest_fail recase-12ssci "$testcvs -q up" \
27093"$PROG update: move away \./FILE; it is in the way
27094C FILE"
27095	    fi
27096	  else # server insensitive
27097	    dotest recase-9si "$testcvs -q up -rfirst" "U FiLe"
27098	    dotest recase-10si "$testcvs -q up -A" "U FiLe"
27099	  fi
27100
27101	  # Prove that we can still get status and log information on
27102	  # conflicting case files (1 in Attic, two in parent).
27103	  if $server_sensitive; then
27104	    if $client_sensitive; then
27105	      # Client finds Entry only for FiLe.  Others returned by server.
27106	      dotest recase-13sscs "$testcvs status file" \
27107"===================================================================
27108File: no file file		Status: Up-to-date
27109
27110   Working revision:	No entry for file
27111   Repository revision:	1\.2	$CVSROOT_DIRNAME/first-dir/Attic/file,v"
27112	    dotest recase-14sscs "$testcvs log file" \
27113"
27114RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
27115Working file: file
27116head: 1\.2
27117branch:
27118locks: strict
27119access list:
27120symbolic names:
27121	first: 1\.1
27122keyword substitution: kv
27123total revisions: 2;	selected revisions: 2
27124description:
27125----------------------------
27126revision 1\.2
27127date: [0-9/]* [0-9:]*;  author: $username;  state: dead;  lines: +0 -0
27128rm
27129----------------------------
27130revision 1\.1
27131date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27132add
27133============================================================================="
27134	    dotest recase-15sscs "$testcvs status FiLe" \
27135"===================================================================
27136File: FiLe             	Status: Up-to-date
27137
27138   Working revision:	1\.1.*
27139   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
27140   Sticky Tag:		(none)
27141   Sticky Date:		(none)
27142   Sticky Options:	(none)"
27143	      dotest recase-16sscs "$testcvs log FiLe" \
27144"
27145RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27146Working file: FiLe
27147head: 1\.1
27148branch:
27149locks: strict
27150access list:
27151symbolic names:
27152keyword substitution: kv
27153total revisions: 1;	selected revisions: 1
27154description:
27155----------------------------
27156revision 1\.1
27157date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27158recase
27159============================================================================="
27160	      dotest recase-17sscs "$testcvs status FILE" \
27161"===================================================================
27162File: FILE             	Status: Up-to-date
27163
27164   Working revision:	1.1.*
27165   Repository revision:	1.1	${CVSROOT_DIRNAME}/first-dir/FILE,v
27166   Sticky Tag:		(none)
27167   Sticky Date:		(none)
27168   Sticky Options:	(none)"
27169	      dotest recase-18sscs "$testcvs log FILE" \
27170"
27171RCS file: $CVSROOT_DIRNAME/first-dir/FILE,v
27172Working file: FILE
27173head: 1\.1
27174branch:
27175locks: strict
27176access list:
27177symbolic names:
27178keyword substitution: kv
27179total revisions: 1;	selected revisions: 1
27180description:
27181----------------------------
27182revision 1\.1
27183date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27184recase
27185============================================================================="
27186	    else # $server_sensitive && !$client_sensitive
27187	      # Client finds same Entry for file & FiLe.
27188	      dotest recase-13ssci "$testcvs status file" \
27189"===================================================================
27190File: FiLe             	Status: Up-to-date
27191
27192   Working revision:	1\.1.*
27193   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
27194   Sticky Tag:		(none)
27195   Sticky Date:		(none)
27196   Sticky Options:	(none)"
27197	      dotest recase-16ssci "$testcvs log FiLe" \
27198"
27199RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27200Working file: FiLe
27201head: 1\.1
27202branch:
27203locks: strict
27204access list:
27205symbolic names:
27206keyword substitution: kv
27207total revisions: 1;	selected revisions: 1
27208description:
27209----------------------------
27210revision 1\.1
27211date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27212recase
27213============================================================================="
27214	      dotest recase-17ssci "$testcvs status FILE" \
27215"===================================================================
27216File: FiLe             	Status: Up-to-date
27217
27218   Working revision:	1\.1.*
27219   Repository revision:	1\.1	$CVSROOT_DIRNAME/first-dir/FiLe,v
27220   Sticky Tag:		(none)
27221   Sticky Date:		(none)
27222   Sticky Options:	(none)"
27223	      dotest recase-18ssci "$testcvs log FILE" \
27224"
27225RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
27226Working file: FiLe
27227head: 1\.1
27228branch:
27229locks: strict
27230access list:
27231symbolic names:
27232keyword substitution: kv
27233total revisions: 1;	selected revisions: 1
27234description:
27235----------------------------
27236revision 1\.1
27237date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
27238recase
27239============================================================================="
27240	    fi
27241	  else # !$server_sensitive
27242	    # Skip these when the server is case insensitive - nothing
27243	    # has changed since recase-[4-7]si
27244	    :
27245	  fi
27246
27247	  if $client_sensitive && $server_sensitive; then
27248	    dotest recase-19sscs "$testcvs status fIlE" \
27249"$PROG status: nothing known about fIlE
27250===================================================================
27251File: no file fIlE		Status: Unknown
27252
27253   Working revision:	No entry for fIlE
27254   Repository revision:	No revision control file"
27255	  else # !$client_sensitive || !$server_sensitive
27256	    dotest recase-19anyi "$testcvs status fIlE" \
27257"===================================================================
27258File: $fIlE             	Status: Up-to-date
27259
27260   Working revision:	1\.[0-9]*.*
27261   Repository revision:	1\.[0-9]*	$CVSROOT_DIRNAME/first-dir/$fIlE,v
27262   Sticky Tag:		(none)
27263   Sticky Date:		(none)
27264   Sticky Options:	(none)"
27265	  fi
27266
27267	  # And last but not least, prove that a checkout is still possible.
27268	  cd ../..
27269	  mkdir 3; cd 3
27270	  if $server_sensitive; then
27271	    if $client_sensitive; then
27272	      dotest recase-20sscs "$testcvs -q co first-dir" \
27273"U first-dir/FILE
27274U first-dir/FiLe"
27275	    else # $server_senstive && !$client_sensitive
27276	      dotest_fail recase-20ssci "$testcvs -q co first-dir" \
27277"U first-dir/FILE
27278$PROG checkout: move away first-dir/FiLe; it is in the way
27279C first-dir/FiLe"
27280	    fi
27281	  else # !$server_sensitive
27282	    # Skip these since nothing has changed.
27283	    :
27284	  fi
27285
27286	  if $keep; then
27287	    echo Keeping ${TESTDIR} and exiting due to --keep
27288	    exit 0
27289	  fi
27290
27291	  cd ..
27292	  rm -r 1 2 3
27293	  if $server_sensitive && test -n "$remotehost"; then
27294	    # It is necessary to remove one of the case-conflicted files before
27295	    # recursively removing the rest under Cygwin on a Samba share or
27296	    # Samba returns a permission denied error due to its case
27297	    # confusion.
27298	    $CVS_RSH $remotehost "rm -f $CVSROOT_DIRNAME/first-dir/FILE,v"
27299	  fi
27300	  rm -rf $CVSROOT_DIRNAME/first-dir
27301	  ;;
27302
27303
27304
27305	multiroot)
27306	  #
27307	  # set up two repositories
27308	  #
27309
27310	  CVSROOT1_DIRNAME=${TESTDIR}/root1
27311	  CVSROOT2_DIRNAME=${TESTDIR}/root2
27312	  CVSROOT1=`newroot $CVSROOT1_DIRNAME`
27313	  CVSROOT2=`newroot $CVSROOT2_DIRNAME`
27314	  testcvs1="${testcvs} -d ${CVSROOT1}"
27315	  testcvs2="${testcvs} -d ${CVSROOT2}"
27316
27317	  dotest multiroot-setup-1 "mkdir $CVSROOT1_DIRNAME $CVSROOT2_DIRNAME"
27318	  dotest multiroot-setup-2 "$testcvs -d$CVSROOT1_DIRNAME init"
27319	  dotest multiroot-setup-3 "$testcvs -d$CVSROOT2_DIRNAME init"
27320
27321	  #
27322	  # create some directories in root1
27323	  #
27324	  mkdir 1; cd 1
27325	  dotest multiroot-setup-4 "${testcvs1} co -l ." \
27326"${PROG} checkout: Updating ."
27327	  mkdir mod1-1 mod1-2
27328	  dotest multiroot-setup-5 "${testcvs1} add mod1-1 mod1-2" \
27329"Directory ${CVSROOT1_DIRNAME}/mod1-1 added to the repository
27330Directory ${CVSROOT1_DIRNAME}/mod1-2 added to the repository"
27331	  echo file1-1 > mod1-1/file1-1
27332	  echo file1-2 > mod1-2/file1-2
27333	  dotest multiroot-setup-6 "${testcvs1} add mod1-1/file1-1 mod1-2/file1-2" \
27334"${PROG} add: scheduling file .mod1-1/file1-1. for addition
27335${PROG} add: scheduling file .mod1-2/file1-2. for addition
27336${PROG} add: use .${PROG} commit. to add these files permanently"
27337	  dotest multiroot-setup-7 "${testcvs1} commit -m is" \
27338"${PROG} [a-z]*: Examining \.
27339${PROG} [a-z]*: Examining mod1-1
27340${PROG} [a-z]*: Examining mod1-2
27341RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27342done
27343Checking in mod1-1/file1-1;
27344${CVSROOT1_DIRNAME}/mod1-1/file1-1,v  <--  file1-1
27345initial revision: 1.1
27346done
27347RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27348done
27349Checking in mod1-2/file1-2;
27350${CVSROOT1_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
27351initial revision: 1.1
27352done"
27353	  cd ..
27354	  rm -rf 1
27355
27356	  #
27357	  # create some directories in root2
27358	  #
27359	  mkdir 1; cd 1
27360	  dotest multiroot-setup-8 "${testcvs2} co -l ." \
27361"${PROG} checkout: Updating ."
27362	  mkdir mod2-1 mod2-2
27363	  dotest multiroot-setup-9 "${testcvs2} add mod2-1 mod2-2" \
27364"Directory ${CVSROOT2_DIRNAME}/mod2-1 added to the repository
27365Directory ${CVSROOT2_DIRNAME}/mod2-2 added to the repository"
27366	  echo file2-1 > mod2-1/file2-1
27367	  echo file2-2 > mod2-2/file2-2
27368	  dotest multiroot-setup-6 "${testcvs2} add mod2-1/file2-1 mod2-2/file2-2" \
27369"${PROG} add: scheduling file .mod2-1/file2-1. for addition
27370${PROG} add: scheduling file .mod2-2/file2-2. for addition
27371${PROG} add: use .${PROG} commit. to add these files permanently"
27372	  dotest multiroot-setup-10 "${testcvs2} commit -m anyone" \
27373"${PROG} [a-z]*: Examining \.
27374${PROG} [a-z]*: Examining mod2-1
27375${PROG} [a-z]*: Examining mod2-2
27376RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27377done
27378Checking in mod2-1/file2-1;
27379${CVSROOT2_DIRNAME}/mod2-1/file2-1,v  <--  file2-1
27380initial revision: 1.1
27381done
27382RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27383done
27384Checking in mod2-2/file2-2;
27385${CVSROOT2_DIRNAME}/mod2-2/file2-2,v  <--  file2-2
27386initial revision: 1.1
27387done"
27388	  cd ..
27389	  rm -rf 1
27390
27391	  # check out a few directories, from simple/shallow to
27392	  # complex/deep
27393	  mkdir 1; cd 1
27394
27395	  # OK, this case is kind of weird.  If we just run things from
27396	  # here, without CVS/Root, then CVS will contact the server
27397	  # mentioned in CVSROOT (which is irrelevant) which will print
27398	  # some messages.  Our workaround is to make sure we have a
27399	  # CVS/Root file at top level.  In the future, it is possible
27400	  # the best behavior will be to extend the existing behavior
27401	  # ("being called from a directory without CVS administration
27402	  # has always meant to process each of the sub-dirs") to also
27403	  # do that if there is no CVSROOT, CVS/Root, or -d at top level.
27404	  # 
27405	  # The local case could stumble through the tests without creating
27406	  # the top-level CVS/Root, but we create it for local and for
27407	  # remote to reduce special cases later in the test.
27408	  dotest multiroot-workaround "${testcvs1} -q co -l ." ""
27409
27410	  dotest multiroot-setup-11 "${testcvs1} co mod1-1 mod1-2" \
27411"${PROG} checkout: Updating mod1-1
27412U mod1-1/file1-1
27413${PROG} checkout: Updating mod1-2
27414U mod1-2/file1-2"
27415	  dotest multiroot-setup-12 "${testcvs2} co mod2-1 mod2-2" \
27416"${PROG} checkout: Updating mod2-1
27417U mod2-1/file2-1
27418${PROG} checkout: Updating mod2-2
27419U mod2-2/file2-2"
27420	  cd mod1-2
27421	  dotest multiroot-setup-13 "${testcvs2} co mod2-2" \
27422"${PROG} checkout: Updating mod2-2
27423U mod2-2/file2-2"
27424	  cd ..
27425	  cd mod2-2
27426	  dotest multiroot-setup-14 "${testcvs1} co mod1-2" \
27427"${PROG} checkout: Updating mod1-2
27428U mod1-2/file1-2"
27429	  cd ..
27430
27431	  #
27432	  # Make sure that the Root and Repository files contain the
27433	  # correct information.
27434	  #
27435	  dotest multiroot-cvsadm-1a "cat mod1-1/CVS/Root" "${CVSROOT1}"
27436	  dotest multiroot-cvsadm-1b "cat mod1-1/CVS/Repository" "mod1-1"
27437	  dotest multiroot-cvsadm-2a "cat mod2-1/CVS/Root" "${CVSROOT2}"
27438	  dotest multiroot-cvsadm-2b "cat mod2-1/CVS/Repository" "mod2-1"
27439	  dotest multiroot-cvsadm-3a "cat mod1-2/CVS/Root" "${CVSROOT1}"
27440	  dotest multiroot-cvsadm-3b "cat mod1-2/CVS/Repository" "mod1-2"
27441	  dotest multiroot-cvsadm-3c "cat mod1-2/mod2-2/CVS/Root" "${CVSROOT2}"
27442	  dotest multiroot-cvsadm-3d "cat mod1-2/mod2-2/CVS/Repository" "mod2-2"
27443	  dotest multiroot-cvsadm-4a "cat mod2-2/CVS/Root" "${CVSROOT2}"
27444	  dotest multiroot-cvsadm-4b "cat mod2-2/CVS/Repository" "mod2-2"
27445	  dotest multiroot-cvsadm-4c "cat mod2-2/mod1-2/CVS/Root" "${CVSROOT1}"
27446	  dotest multiroot-cvsadm-4d "cat mod2-2/mod1-2/CVS/Repository" "mod1-2"
27447
27448	  #
27449	  # Start testing various cvs commands.  Begin with commands
27450	  # without extra arguments (e.g. "cvs update", "cvs diff",
27451	  # etc.
27452	  #
27453
27454	  # Do at least one command with both CVSROOTs to make sure
27455	  # that there's not some kind of unexpected dependency on the
27456	  # choice of which CVSROOT is specified on the command line.
27457
27458	  dotest multiroot-update-1a "${testcvs1} update" \
27459"${PROG} update: Updating \.
27460${PROG} update: Updating mod1-1
27461${PROG} update: Updating mod1-2
27462${PROG} update: Updating mod1-2/mod2-2
27463${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
27464${PROG} update: skipping directory mod1-2/mod2-2
27465${PROG} update: Updating mod2-1
27466${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-1: No such file or directory
27467${PROG} update: skipping directory mod2-1
27468${PROG} update: Updating mod2-2
27469${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
27470${PROG} update: skipping directory mod2-2"
27471
27472	  # Same deal but with -d ${CVSROOT2}.
27473	  dotest multiroot-update-1b "${testcvs2} update" \
27474"${PROG} update: Updating \.
27475${PROG} update: Updating mod1-1
27476${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-1: No such file or directory
27477${PROG} update: skipping directory mod1-1
27478${PROG} update: Updating mod1-2
27479${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
27480${PROG} update: skipping directory mod1-2
27481${PROG} update: Updating mod2-1
27482${PROG} update: Updating mod2-2
27483${PROG} update: Updating mod2-2/mod1-2
27484${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
27485${PROG} update: skipping directory mod2-2/mod1-2"
27486
27487	  # modify all files and do a diff
27488
27489	  echo bobby >> mod1-1/file1-1
27490	  echo brown >> mod1-2/file1-2
27491	  echo goes >> mod2-1/file2-1
27492	  echo down >> mod2-2/file2-2
27493
27494	  dotest_fail multiroot-diff-1 "${testcvs} diff" \
27495"${PROG} diff: Diffing \.
27496${PROG} diff: Diffing mod1-1
27497Index: mod1-1/file1-1
27498===================================================================
27499RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
27500retrieving revision 1\.1
27501diff -r1\.1 file1-1
275021a2
27503> bobby
27504${PROG} diff: Diffing mod1-2
27505Index: mod1-2/file1-2
27506===================================================================
27507RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
27508retrieving revision 1\.1
27509diff -r1\.1 file1-2
275101a2
27511> brown
27512${PROG} diff: Diffing mod2-2/mod1-2
27513${PROG} diff: Diffing mod1-2/mod2-2
27514${PROG} diff: Diffing mod2-1
27515Index: mod2-1/file2-1
27516===================================================================
27517RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
27518retrieving revision 1\.1
27519diff -r1\.1 file2-1
275201a2
27521> goes
27522${PROG} diff: Diffing mod2-2
27523Index: mod2-2/file2-2
27524===================================================================
27525RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
27526retrieving revision 1\.1
27527diff -r1\.1 file2-2
275281a2
27529> down" \
27530"${PROG} diff: Diffing \.
27531${PROG} diff: Diffing mod1-1
27532Index: mod1-1/file1-1
27533===================================================================
27534RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
27535retrieving revision 1\.1
27536diff -r1\.1 file1-1
275371a2
27538> bobby
27539${PROG} diff: Diffing mod1-2
27540Index: mod1-2/file1-2
27541===================================================================
27542RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
27543retrieving revision 1\.1
27544diff -r1\.1 file1-2
275451a2
27546> brown
27547${PROG} diff: Diffing mod2-2
27548${PROG} diff: Diffing mod2-2/mod1-2
27549${PROG} diff: Diffing mod1-2
27550${PROG} diff: Diffing mod1-2/mod2-2
27551${PROG} diff: Diffing mod2-1
27552Index: mod2-1/file2-1
27553===================================================================
27554RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
27555retrieving revision 1\.1
27556diff -r1\.1 file2-1
275571a2
27558> goes
27559${PROG} diff: Diffing mod2-2
27560Index: mod2-2/file2-2
27561===================================================================
27562RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
27563retrieving revision 1\.1
27564diff -r1\.1 file2-2
275651a2
27566> down"
27567
27568	  dotest multiroot-commit-1 "${testcvs} commit -m actually" \
27569"${PROG} [a-z]*: Examining \.
27570${PROG} [a-z]*: Examining mod1-1
27571${PROG} [a-z]*: Examining mod1-2
27572${PROG} [a-z]*: Examining mod2-2/mod1-2
27573Checking in mod1-1/file1-1;
27574${TESTDIR}/root1/mod1-1/file1-1,v  <--  file1-1
27575new revision: 1.2; previous revision: 1.1
27576done
27577Checking in mod1-2/file1-2;
27578${TESTDIR}/root1/mod1-2/file1-2,v  <--  file1-2
27579new revision: 1.2; previous revision: 1.1
27580done
27581${PROG} [a-z]*: Examining mod1-2/mod2-2
27582${PROG} [a-z]*: Examining mod2-1
27583${PROG} [a-z]*: Examining mod2-2
27584Checking in mod2-1/file2-1;
27585${TESTDIR}/root2/mod2-1/file2-1,v  <--  file2-1
27586new revision: 1.2; previous revision: 1.1
27587done
27588Checking in mod2-2/file2-2;
27589${TESTDIR}/root2/mod2-2/file2-2,v  <--  file2-2
27590new revision: 1.2; previous revision: 1.1
27591done"
27592
27593	  dotest multiroot-update-2 "${testcvs} update" \
27594"${PROG} update: Updating \.
27595${PROG} [a-z]*: Updating mod1-1
27596${PROG} [a-z]*: Updating mod1-2
27597${PROG} [a-z]*: Updating mod2-2/mod1-2
27598U mod2-2/mod1-2/file1-2
27599${PROG} [a-z]*: Updating mod1-2/mod2-2
27600U mod1-2/mod2-2/file2-2
27601${PROG} update: Updating mod2-1
27602${PROG} update: Updating mod2-2" \
27603"${PROG} update: Updating \.
27604${PROG} update: Updating mod1-1
27605${PROG} update: Updating mod1-2
27606${PROG} update: Updating mod2-2
27607${PROG} update: Updating mod2-2/mod1-2
27608P mod2-2/mod1-2/file1-2
27609${PROG} update: Updating mod1-2
27610${PROG} update: Updating mod1-2/mod2-2
27611P mod1-2/mod2-2/file2-2
27612${PROG} update: Updating mod2-1
27613${PROG} update: Updating mod2-2"
27614
27615	  dotest multiroot-tag-1 "${testcvs} tag cattle" \
27616"${PROG} tag: Tagging \.
27617${PROG} tag: Tagging mod1-1
27618T mod1-1/file1-1
27619${PROG} tag: Tagging mod1-2
27620T mod1-2/file1-2
27621${PROG} tag: Tagging mod2-2/mod1-2
27622${PROG} tag: Tagging mod1-2/mod2-2
27623T mod1-2/mod2-2/file2-2
27624${PROG} tag: Tagging mod2-1
27625T mod2-1/file2-1
27626${PROG} tag: Tagging mod2-2" \
27627"${PROG} tag: Tagging \.
27628${PROG} tag: Tagging mod1-1
27629T mod1-1/file1-1
27630${PROG} tag: Tagging mod1-2
27631T mod1-2/file1-2
27632${PROG} tag: Tagging mod2-2
27633${PROG} tag: Tagging mod2-2/mod1-2
27634${PROG} tag: Tagging mod1-2
27635${PROG} tag: Tagging mod1-2/mod2-2
27636T mod1-2/mod2-2/file2-2
27637${PROG} tag: Tagging mod2-1
27638T mod2-1/file2-1
27639${PROG} tag: Tagging mod2-2"
27640
27641	  echo anotherfile1-1 > mod1-1/anotherfile1-1
27642	  echo anotherfile2-1 > mod2-1/anotherfile2-1
27643	  echo anotherfile1-2 > mod2-2/mod1-2/anotherfile1-2
27644	  echo anotherfile2-2 > mod1-2/mod2-2/anotherfile2-2
27645
27646	  if $remote; then
27647	    cd mod1-1
27648	    dotest multiroot-add-1ar "${testcvs} add anotherfile1-1" \
27649"${PROG} add: scheduling file .anotherfile1-1. for addition
27650${PROG} add: use .${PROG} commit. to add this file permanently"
27651	    cd ../mod2-1
27652	    dotest multiroot-add-1br "${testcvs} add anotherfile2-1" \
27653"${PROG} add: scheduling file .anotherfile2-1. for addition
27654${PROG} add: use .${PROG} commit. to add this file permanently"
27655	    cd ../mod2-2/mod1-2
27656	    dotest multiroot-add-1cr "${testcvs} add anotherfile1-2" \
27657"${PROG} add: scheduling file .anotherfile1-2. for addition
27658${PROG} add: use .${PROG} commit. to add this file permanently"
27659	    cd ../../mod1-2/mod2-2
27660	    dotest multiroot-add-1dr "${testcvs} add anotherfile2-2" \
27661"${PROG} add: scheduling file .anotherfile2-2. for addition
27662${PROG} add: use .${PROG} commit. to add this file permanently"
27663	    cd ../..
27664          else
27665	    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" \
27666"${PROG} add: scheduling file .mod1-1/anotherfile1-1. for addition
27667${PROG} add: scheduling file .mod2-1/anotherfile2-1. for addition
27668${PROG} add: scheduling file .mod2-2/mod1-2/anotherfile1-2. for addition
27669${PROG} add: scheduling file .mod1-2/mod2-2/anotherfile2-2. for addition
27670${PROG} add: use .${PROG} commit. to add these files permanently"
27671          fi
27672
27673	  dotest multiroot-status-1 "${testcvs} status -v" \
27674"${PROG} status: Examining \.
27675${PROG} status: Examining mod1-1
27676===================================================================
27677File: anotherfile1-1   	Status: Locally Added
27678
27679   Working revision:	New file!
27680   Repository revision:	No revision control file
27681   Sticky Tag:		(none)
27682   Sticky Date:		(none)
27683   Sticky Options:	(none)
27684
27685===================================================================
27686File: file1-1          	Status: Up-to-date
27687
27688   Working revision:	1\.2.*
27689   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27690   Sticky Tag:		(none)
27691   Sticky Date:		(none)
27692   Sticky Options:	(none)
27693
27694   Existing Tags:
27695	cattle                   	(revision: 1\.2)
27696
27697${PROG} status: Examining mod1-2
27698===================================================================
27699File: file1-2          	Status: Up-to-date
27700
27701   Working revision:	1\.2.*
27702   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27703   Sticky Tag:		(none)
27704   Sticky Date:		(none)
27705   Sticky Options:	(none)
27706
27707   Existing Tags:
27708	cattle                   	(revision: 1\.2)
27709
27710${PROG} status: Examining mod2-2/mod1-2
27711===================================================================
27712File: anotherfile1-2   	Status: Locally Added
27713
27714   Working revision:	New file!
27715   Repository revision:	No revision control file
27716   Sticky Tag:		(none)
27717   Sticky Date:		(none)
27718   Sticky Options:	(none)
27719
27720===================================================================
27721File: file1-2          	Status: Up-to-date
27722
27723   Working revision:	1\.2.*
27724   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27725   Sticky Tag:		(none)
27726   Sticky Date:		(none)
27727   Sticky Options:	(none)
27728
27729   Existing Tags:
27730	cattle                   	(revision: 1\.2)
27731
27732${PROG} status: Examining mod1-2/mod2-2
27733===================================================================
27734File: anotherfile2-2   	Status: Locally Added
27735
27736   Working revision:	New file!
27737   Repository revision:	No revision control file
27738   Sticky Tag:		(none)
27739   Sticky Date:		(none)
27740   Sticky Options:	(none)
27741
27742===================================================================
27743File: file2-2          	Status: Up-to-date
27744
27745   Working revision:	1\.2.*
27746   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27747   Sticky Tag:		(none)
27748   Sticky Date:		(none)
27749   Sticky Options:	(none)
27750
27751   Existing Tags:
27752	cattle                   	(revision: 1\.2)
27753
27754${PROG} status: Examining mod2-1
27755===================================================================
27756File: anotherfile2-1   	Status: Locally Added
27757
27758   Working revision:	New file!
27759   Repository revision:	No revision control file
27760   Sticky Tag:		(none)
27761   Sticky Date:		(none)
27762   Sticky Options:	(none)
27763
27764===================================================================
27765File: file2-1          	Status: Up-to-date
27766
27767   Working revision:	1\.2.*
27768   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27769   Sticky Tag:		(none)
27770   Sticky Date:		(none)
27771   Sticky Options:	(none)
27772
27773   Existing Tags:
27774	cattle                   	(revision: 1\.2)
27775
27776${PROG} status: Examining mod2-2
27777===================================================================
27778File: file2-2          	Status: Up-to-date
27779
27780   Working revision:	1\.2.*
27781   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27782   Sticky Tag:		(none)
27783   Sticky Date:		(none)
27784   Sticky Options:	(none)
27785
27786   Existing Tags:
27787	cattle                   	(revision: 1\.2)" \
27788"${PROG} status: Examining \.
27789${PROG} status: Examining mod1-1
27790===================================================================
27791File: anotherfile1-1   	Status: Locally Added
27792
27793   Working revision:	New file!
27794   Repository revision:	No revision control file
27795   Sticky Tag:		(none)
27796   Sticky Date:		(none)
27797   Sticky Options:	(none)
27798
27799===================================================================
27800File: file1-1          	Status: Up-to-date
27801
27802   Working revision:	1\.2.*
27803   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27804   Sticky Tag:		(none)
27805   Sticky Date:		(none)
27806   Sticky Options:	(none)
27807
27808   Existing Tags:
27809	cattle                   	(revision: 1\.2)
27810
27811${PROG} status: Examining mod1-2
27812===================================================================
27813File: file1-2          	Status: Up-to-date
27814
27815   Working revision:	1\.2.*
27816   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27817   Sticky Tag:		(none)
27818   Sticky Date:		(none)
27819   Sticky Options:	(none)
27820
27821   Existing Tags:
27822	cattle                   	(revision: 1\.2)
27823
27824${PROG} status: Examining mod2-2
27825${PROG} status: Examining mod2-2/mod1-2
27826===================================================================
27827File: anotherfile1-2   	Status: Locally Added
27828
27829   Working revision:	New file!
27830   Repository revision:	No revision control file
27831   Sticky Tag:		(none)
27832   Sticky Date:		(none)
27833   Sticky Options:	(none)
27834
27835===================================================================
27836File: file1-2          	Status: Up-to-date
27837
27838   Working revision:	1\.2.*
27839   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
27840   Sticky Tag:		(none)
27841   Sticky Date:		(none)
27842   Sticky Options:	(none)
27843
27844   Existing Tags:
27845	cattle                   	(revision: 1\.2)
27846
27847${PROG} status: Examining mod1-2
27848${PROG} status: Examining mod1-2/mod2-2
27849===================================================================
27850File: anotherfile2-2   	Status: Locally Added
27851
27852   Working revision:	New file!
27853   Repository revision:	No revision control file
27854   Sticky Tag:		(none)
27855   Sticky Date:		(none)
27856   Sticky Options:	(none)
27857
27858===================================================================
27859File: file2-2          	Status: Up-to-date
27860
27861   Working revision:	1\.2.*
27862   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27863   Sticky Tag:		(none)
27864   Sticky Date:		(none)
27865   Sticky Options:	(none)
27866
27867   Existing Tags:
27868	cattle                   	(revision: 1\.2)
27869
27870${PROG} status: Examining mod2-1
27871===================================================================
27872File: anotherfile2-1   	Status: Locally Added
27873
27874   Working revision:	New file!
27875   Repository revision:	No revision control file
27876   Sticky Tag:		(none)
27877   Sticky Date:		(none)
27878   Sticky Options:	(none)
27879
27880===================================================================
27881File: file2-1          	Status: Up-to-date
27882
27883   Working revision:	1\.2.*
27884   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
27885   Sticky Tag:		(none)
27886   Sticky Date:		(none)
27887   Sticky Options:	(none)
27888
27889   Existing Tags:
27890	cattle                   	(revision: 1\.2)
27891
27892${PROG} status: Examining mod2-2
27893===================================================================
27894File: file2-2          	Status: Up-to-date
27895
27896   Working revision:	1\.2.*
27897   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
27898   Sticky Tag:		(none)
27899   Sticky Date:		(none)
27900   Sticky Options:	(none)
27901
27902   Existing Tags:
27903	cattle                   	(revision: 1\.2)"
27904
27905	  dotest multiroot-commit-2 "${testcvs} commit -m reading" \
27906"${PROG} [a-z]*: Examining \.
27907${PROG} [a-z]*: Examining mod1-1
27908${PROG} [a-z]*: Examining mod1-2
27909${PROG} [a-z]*: Examining mod2-2/mod1-2
27910RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
27911done
27912Checking in mod1-1/anotherfile1-1;
27913${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v  <--  anotherfile1-1
27914initial revision: 1\.1
27915done
27916RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
27917done
27918Checking in mod2-2/mod1-2/anotherfile1-2;
27919${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v  <--  anotherfile1-2
27920initial revision: 1\.1
27921done
27922${PROG} [a-z]*: Examining mod1-2/mod2-2
27923${PROG} [a-z]*: Examining mod2-1
27924${PROG} [a-z]*: Examining mod2-2
27925RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
27926done
27927Checking in mod1-2/mod2-2/anotherfile2-2;
27928${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v  <--  anotherfile2-2
27929initial revision: 1\.1
27930done
27931RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
27932done
27933Checking in mod2-1/anotherfile2-1;
27934${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v  <--  anotherfile2-1
27935initial revision: 1\.1
27936done"
27937
27938	  dotest multiroot-update-3 "${testcvs} update" \
27939"${PROG} update: Updating \.
27940${PROG} [a-z]*: Updating mod1-1
27941${PROG} [a-z]*: Updating mod1-2
27942U mod1-2/anotherfile1-2
27943${PROG} [a-z]*: Updating mod2-2/mod1-2
27944${PROG} [a-z]*: Updating mod1-2/mod2-2
27945${PROG} [a-z]*: Updating mod2-1
27946${PROG} [a-z]*: Updating mod2-2
27947U mod2-2/anotherfile2-2" \
27948"${PROG} update: Updating \.
27949${PROG} update: Updating mod1-1
27950${PROG} update: Updating mod1-2
27951U mod1-2/anotherfile1-2
27952${PROG} update: Updating mod2-2
27953${PROG} update: Updating mod2-2/mod1-2
27954${PROG} update: Updating mod1-2
27955${PROG} update: Updating mod1-2/mod2-2
27956${PROG} update: Updating mod2-1
27957${PROG} update: Updating mod2-2
27958U mod2-2/anotherfile2-2"
27959
27960	  dotest multiroot-log-1 "${testcvs} log" \
27961"${PROG} log: Logging \.
27962${PROG} log: Logging mod1-1
27963
27964RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
27965Working file: mod1-1/anotherfile1-1
27966head: 1\.1
27967branch:
27968locks: strict
27969access list:
27970symbolic names:
27971keyword substitution: kv
27972total revisions: 1;	selected revisions: 1
27973description:
27974----------------------------
27975revision 1\.1
27976date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
27977reading
27978=============================================================================
27979
27980RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
27981Working file: mod1-1/file1-1
27982head: 1\.2
27983branch:
27984locks: strict
27985access list:
27986symbolic names:
27987	cattle: 1\.2
27988keyword substitution: kv
27989total revisions: 2;	selected revisions: 2
27990description:
27991----------------------------
27992revision 1\.2
27993date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
27994actually
27995----------------------------
27996revision 1\.1
27997date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
27998is
27999=============================================================================
28000${PROG} log: Logging mod1-2
28001
28002RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28003Working file: mod1-2/anotherfile1-2
28004head: 1\.1
28005branch:
28006locks: strict
28007access list:
28008symbolic names:
28009keyword substitution: kv
28010total revisions: 1;	selected revisions: 1
28011description:
28012----------------------------
28013revision 1\.1
28014date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28015reading
28016=============================================================================
28017
28018RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28019Working file: mod1-2/file1-2
28020head: 1\.2
28021branch:
28022locks: strict
28023access list:
28024symbolic names:
28025	cattle: 1\.2
28026keyword substitution: kv
28027total revisions: 2;	selected revisions: 2
28028description:
28029----------------------------
28030revision 1\.2
28031date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28032actually
28033----------------------------
28034revision 1\.1
28035date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28036is
28037=============================================================================
28038${PROG} log: Logging mod2-2/mod1-2
28039
28040RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28041Working file: mod2-2/mod1-2/anotherfile1-2
28042head: 1\.1
28043branch:
28044locks: strict
28045access list:
28046symbolic names:
28047keyword substitution: kv
28048total revisions: 1;	selected revisions: 1
28049description:
28050----------------------------
28051revision 1\.1
28052date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28053reading
28054=============================================================================
28055
28056RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28057Working file: mod2-2/mod1-2/file1-2
28058head: 1\.2
28059branch:
28060locks: strict
28061access list:
28062symbolic names:
28063	cattle: 1\.2
28064keyword substitution: kv
28065total revisions: 2;	selected revisions: 2
28066description:
28067----------------------------
28068revision 1\.2
28069date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28070actually
28071----------------------------
28072revision 1\.1
28073date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28074is
28075=============================================================================
28076${PROG} log: Logging mod1-2/mod2-2
28077
28078RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28079Working file: mod1-2/mod2-2/anotherfile2-2
28080head: 1\.1
28081branch:
28082locks: strict
28083access list:
28084symbolic names:
28085keyword substitution: kv
28086total revisions: 1;	selected revisions: 1
28087description:
28088----------------------------
28089revision 1\.1
28090date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28091reading
28092=============================================================================
28093
28094RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28095Working file: mod1-2/mod2-2/file2-2
28096head: 1\.2
28097branch:
28098locks: strict
28099access list:
28100symbolic names:
28101	cattle: 1\.2
28102keyword substitution: kv
28103total revisions: 2;	selected revisions: 2
28104description:
28105----------------------------
28106revision 1\.2
28107date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28108actually
28109----------------------------
28110revision 1\.1
28111date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28112anyone
28113=============================================================================
28114${PROG} log: Logging mod2-1
28115
28116RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
28117Working file: mod2-1/anotherfile2-1
28118head: 1\.1
28119branch:
28120locks: strict
28121access list:
28122symbolic names:
28123keyword substitution: kv
28124total revisions: 1;	selected revisions: 1
28125description:
28126----------------------------
28127revision 1\.1
28128date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28129reading
28130=============================================================================
28131
28132RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
28133Working file: mod2-1/file2-1
28134head: 1\.2
28135branch:
28136locks: strict
28137access list:
28138symbolic names:
28139	cattle: 1\.2
28140keyword substitution: kv
28141total revisions: 2;	selected revisions: 2
28142description:
28143----------------------------
28144revision 1\.2
28145date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28146actually
28147----------------------------
28148revision 1\.1
28149date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28150anyone
28151=============================================================================
28152${PROG} log: Logging mod2-2
28153
28154RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28155Working file: mod2-2/anotherfile2-2
28156head: 1\.1
28157branch:
28158locks: strict
28159access list:
28160symbolic names:
28161keyword substitution: kv
28162total revisions: 1;	selected revisions: 1
28163description:
28164----------------------------
28165revision 1\.1
28166date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28167reading
28168=============================================================================
28169
28170RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28171Working file: mod2-2/file2-2
28172head: 1\.2
28173branch:
28174locks: strict
28175access list:
28176symbolic names:
28177	cattle: 1\.2
28178keyword substitution: kv
28179total revisions: 2;	selected revisions: 2
28180description:
28181----------------------------
28182revision 1\.2
28183date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28184actually
28185----------------------------
28186revision 1\.1
28187date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28188anyone
28189=============================================================================" \
28190"${PROG} log: Logging \.
28191${PROG} log: Logging mod1-1
28192
28193RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
28194Working file: mod1-1/anotherfile1-1
28195head: 1\.1
28196branch:
28197locks: strict
28198access list:
28199symbolic names:
28200keyword substitution: kv
28201total revisions: 1;	selected revisions: 1
28202description:
28203----------------------------
28204revision 1\.1
28205date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28206reading
28207=============================================================================
28208
28209RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
28210Working file: mod1-1/file1-1
28211head: 1\.2
28212branch:
28213locks: strict
28214access list:
28215symbolic names:
28216	cattle: 1\.2
28217keyword substitution: kv
28218total revisions: 2;	selected revisions: 2
28219description:
28220----------------------------
28221revision 1\.2
28222date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28223actually
28224----------------------------
28225revision 1\.1
28226date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28227is
28228=============================================================================
28229${PROG} log: Logging mod1-2
28230
28231RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28232Working file: mod1-2/anotherfile1-2
28233head: 1\.1
28234branch:
28235locks: strict
28236access list:
28237symbolic names:
28238keyword substitution: kv
28239total revisions: 1;	selected revisions: 1
28240description:
28241----------------------------
28242revision 1\.1
28243date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28244reading
28245=============================================================================
28246
28247RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28248Working file: mod1-2/file1-2
28249head: 1\.2
28250branch:
28251locks: strict
28252access list:
28253symbolic names:
28254	cattle: 1\.2
28255keyword substitution: kv
28256total revisions: 2;	selected revisions: 2
28257description:
28258----------------------------
28259revision 1\.2
28260date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28261actually
28262----------------------------
28263revision 1\.1
28264date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28265is
28266=============================================================================
28267${PROG} log: Logging mod2-2
28268${PROG} log: Logging mod2-2/mod1-2
28269
28270RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
28271Working file: mod2-2/mod1-2/anotherfile1-2
28272head: 1\.1
28273branch:
28274locks: strict
28275access list:
28276symbolic names:
28277keyword substitution: kv
28278total revisions: 1;	selected revisions: 1
28279description:
28280----------------------------
28281revision 1\.1
28282date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28283reading
28284=============================================================================
28285
28286RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
28287Working file: mod2-2/mod1-2/file1-2
28288head: 1\.2
28289branch:
28290locks: strict
28291access list:
28292symbolic names:
28293	cattle: 1\.2
28294keyword substitution: kv
28295total revisions: 2;	selected revisions: 2
28296description:
28297----------------------------
28298revision 1\.2
28299date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28300actually
28301----------------------------
28302revision 1\.1
28303date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28304is
28305=============================================================================
28306${PROG} log: Logging mod1-2
28307${PROG} log: Logging mod1-2/mod2-2
28308
28309RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28310Working file: mod1-2/mod2-2/anotherfile2-2
28311head: 1\.1
28312branch:
28313locks: strict
28314access list:
28315symbolic names:
28316keyword substitution: kv
28317total revisions: 1;	selected revisions: 1
28318description:
28319----------------------------
28320revision 1\.1
28321date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28322reading
28323=============================================================================
28324
28325RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28326Working file: mod1-2/mod2-2/file2-2
28327head: 1\.2
28328branch:
28329locks: strict
28330access list:
28331symbolic names:
28332	cattle: 1\.2
28333keyword substitution: kv
28334total revisions: 2;	selected revisions: 2
28335description:
28336----------------------------
28337revision 1\.2
28338date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28339actually
28340----------------------------
28341revision 1\.1
28342date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28343anyone
28344=============================================================================
28345${PROG} log: Logging mod2-1
28346
28347RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
28348Working file: mod2-1/anotherfile2-1
28349head: 1\.1
28350branch:
28351locks: strict
28352access list:
28353symbolic names:
28354keyword substitution: kv
28355total revisions: 1;	selected revisions: 1
28356description:
28357----------------------------
28358revision 1\.1
28359date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28360reading
28361=============================================================================
28362
28363RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
28364Working file: mod2-1/file2-1
28365head: 1\.2
28366branch:
28367locks: strict
28368access list:
28369symbolic names:
28370	cattle: 1\.2
28371keyword substitution: kv
28372total revisions: 2;	selected revisions: 2
28373description:
28374----------------------------
28375revision 1\.2
28376date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28377actually
28378----------------------------
28379revision 1\.1
28380date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28381anyone
28382=============================================================================
28383${PROG} log: Logging mod2-2
28384
28385RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
28386Working file: mod2-2/anotherfile2-2
28387head: 1\.1
28388branch:
28389locks: strict
28390access list:
28391symbolic names:
28392keyword substitution: kv
28393total revisions: 1;	selected revisions: 1
28394description:
28395----------------------------
28396revision 1\.1
28397date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28398reading
28399=============================================================================
28400
28401RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
28402Working file: mod2-2/file2-2
28403head: 1\.2
28404branch:
28405locks: strict
28406access list:
28407symbolic names:
28408	cattle: 1\.2
28409keyword substitution: kv
28410total revisions: 2;	selected revisions: 2
28411description:
28412----------------------------
28413revision 1\.2
28414date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
28415actually
28416----------------------------
28417revision 1\.1
28418date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
28419anyone
28420============================================================================="
28421
28422
28423	  # After the simple cases, let's execute some commands which
28424	  # refer to parts of our checked-out tree (e.g. "cvs update
28425	  # mod1-1 mod2-2")
28426
28427	  if $keep; then
28428	    echo Keeping ${TESTDIR} and exiting due to --keep
28429	    exit 0
28430	  fi
28431
28432	  # clean up after ourselves
28433	  cd ..
28434	  rm -r 1
28435
28436	  # clean up our repositories
28437	  rm -rf root1 root2
28438	  ;;
28439
28440	multiroot2)
28441	  # More multiroot tests.  In particular, nested directories.
28442
28443	  CVSROOT1_DIRNAME=${TESTDIR}/root1
28444	  CVSROOT2_DIRNAME=${TESTDIR}/root2
28445	  CVSROOT1=`newroot $CVSROOT1_DIRNAME`
28446	  CVSROOT2=`newroot $CVSROOT2_DIRNAME`
28447
28448	  dotest multiroot2-1 "$testcvs -d$CVSROOT1_DIRNAME init"
28449	  dotest multiroot2-2 "$testcvs -d$CVSROOT2_DIRNAME init"
28450
28451	  mkdir imp-dir; cd imp-dir
28452	  echo file1 >file1
28453	  mkdir sdir
28454	  echo sfile >sdir/sfile
28455	  mkdir sdir/ssdir
28456	  echo ssfile >sdir/ssdir/ssfile
28457	  dotest_sort multiroot2-3 \
28458"${testcvs} -d ${CVSROOT1} import -m import-to-root1 dir1 vend rel" "
28459
28460N dir1/file1
28461N dir1/sdir/sfile
28462N dir1/sdir/ssdir/ssfile
28463No conflicts created by this import
28464${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir
28465${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir/ssdir"
28466	  cd sdir
28467	  dotest_sort multiroot2-4 \
28468"${testcvs} -d ${CVSROOT2} import -m import-to-root2 sdir vend2 rel2" "
28469
28470N sdir/sfile
28471N sdir/ssdir/ssfile
28472No conflicts created by this import
28473${PROG} import: Importing ${TESTDIR}/root2/sdir/ssdir"
28474	  cd ../..
28475
28476	  mkdir 1; cd 1
28477	  # Get TopLevelAdmin-like behavior.
28478	  dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co -l ."
28479	  dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co dir1" \
28480"U dir1/file1
28481U dir1/sdir/sfile
28482U dir1/sdir/ssdir/ssfile"
28483	  cd dir1
28484	  dotest multiroot2-6 "${testcvs} -Q release -d sdir" ""
28485	  dotest multiroot2-7 "${testcvs} -d ${CVSROOT2} -q co sdir" \
28486"U sdir/sfile
28487U sdir/ssdir/ssfile"
28488	  cd ..
28489	  # This has one subtle effect - it deals with Entries.Log
28490	  # so that the next test doesn't get trace messages for
28491	  # Entries.Log
28492	  dotest multiroot2-8 "${testcvs} update" \
28493"${PROG} update: Updating \.
28494${PROG} update: Updating dir1
28495${PROG} update: Updating dir1/sdir
28496${PROG} update: Updating dir1/sdir/ssdir" \
28497"${PROG} update: Updating \.
28498${PROG} update: Updating dir1
28499${PROG} update: Updating dir1
28500${PROG} update: Updating dir1/sdir
28501${PROG} update: Updating dir1/sdir/ssdir"
28502	  # Two reasons we don't run this on the server: (1) the server
28503	  # also prints some trace messages, and (2) the server trace
28504	  # messages are subject to out-of-order bugs (this one is hard
28505	  # to work around).
28506	  if $remote; then :; else
28507	    dotest multiroot2-9a "${testcvs} -t update" \
28508" *-> main loop with CVSROOT=${TESTDIR}/root1
28509${PROG} update: Updating \.
28510 *-> Reader_Lock(${TESTDIR}/root1)
28511 *-> Lock_Cleanup()
28512${PROG} update: Updating dir1
28513 *-> Reader_Lock(${TESTDIR}/root1/dir1)
28514 *-> Lock_Cleanup()
28515 *-> main loop with CVSROOT=${TESTDIR}/root2
28516${PROG} update: Updating dir1/sdir
28517 *-> Reader_Lock(${TESTDIR}/root2/sdir)
28518 *-> Lock_Cleanup()
28519${PROG} update: Updating dir1/sdir/ssdir
28520 *-> Reader_Lock(${TESTDIR}/root2/sdir/ssdir)
28521 *-> Lock_Cleanup()
28522 *-> Lock_Cleanup()"
28523	  fi
28524
28525	  dotest multiroot2-9 "${testcvs} -q tag tag1" \
28526"T dir1/file1
28527T dir1/sdir/sfile
28528T dir1/sdir/ssdir/ssfile"
28529	  echo "change it" >>dir1/file1
28530	  echo "change him too" >>dir1/sdir/sfile
28531	  dotest multiroot2-10 "${testcvs} -q ci -m modify" \
28532"Checking in dir1/file1;
28533${TESTDIR}/root1/dir1/file1,v  <--  file1
28534new revision: 1\.2; previous revision: 1\.1
28535done
28536Checking in dir1/sdir/sfile;
28537${TESTDIR}/root2/sdir/sfile,v  <--  sfile
28538new revision: 1\.2; previous revision: 1\.1
28539done"
28540	  dotest multiroot2-11 "${testcvs} -q tag tag2" \
28541"T dir1/file1
28542T dir1/sdir/sfile
28543T dir1/sdir/ssdir/ssfile"
28544	  dotest_fail multiroot2-12 \
28545"${testcvs} -q diff -u -r tag1 -r tag2" \
28546"Index: dir1/file1
28547===================================================================
28548RCS file: ${TESTDIR}/root1/dir1/file1,v
28549retrieving revision 1\.1\.1\.1
28550retrieving revision 1\.2
28551diff -u -r1\.1\.1\.1 -r1\.2
28552--- dir1/file1	${RFCDATE}	1\.1\.1\.1
28553${PLUS}${PLUS}${PLUS} dir1/file1	${RFCDATE}	1\.2
28554@@ -1 ${PLUS}1,2 @@
28555 file1
28556${PLUS}change it
28557Index: dir1/sdir/sfile
28558===================================================================
28559RCS file: ${TESTDIR}/root2/sdir/sfile,v
28560retrieving revision 1\.1\.1\.1
28561retrieving revision 1\.2
28562diff -u -r1\.1\.1\.1 -r1\.2
28563--- dir1/sdir/sfile	${RFCDATE}	1\.1\.1\.1
28564${PLUS}${PLUS}${PLUS} dir1/sdir/sfile	${RFCDATE}	1\.2
28565@@ -1 ${PLUS}1,2 @@
28566 sfile
28567${PLUS}change him too"
28568
28569	  if $keep; then
28570	    echo Keeping ${TESTDIR} and exiting due to --keep
28571	    exit 0
28572	  fi
28573
28574	  # clean up after ourselves
28575	  cd ..
28576	  rm -r imp-dir 1
28577
28578	  # clean up our repositories
28579	  rm -rf root1 root2
28580	  ;;
28581
28582	multiroot3)
28583	  # More multiroot tests.  Directories are side-by-side, not nested.
28584	  # Not drastically different from multiroot but it covers somewhat
28585	  # different stuff.
28586
28587	  CVSROOT1=`newroot ${TESTDIR}/root1`
28588	  CVSROOT2=`newroot ${TESTDIR}/root2`
28589
28590	  mkdir 1; cd 1
28591	  dotest multiroot3-1 "$testcvs -d$TESTDIR/root1 init"
28592	  dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
28593	  mkdir dir1
28594	  dotest multiroot3-3 "${testcvs} add dir1" \
28595"Directory ${TESTDIR}/root1/dir1 added to the repository"
28596	  dotest multiroot3-4 "$testcvs -d$TESTDIR/root2 init"
28597	  rm -r CVS
28598	  dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
28599	  mkdir dir2
28600
28601	  # OK, the problem is that CVS/Entries doesn't look quite right,
28602	  # I suppose because of the "rm -r".
28603	  # For local this fixes it up.
28604	  dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
28605	  if $remote; then
28606	    # For remote that doesn't do it.  Use the quick and dirty fix.
28607	    echo "D/dir1////" >CVS/Entries
28608	    echo "D/dir2////" >>CVS/Entries
28609	  fi
28610
28611	  dotest multiroot3-7 "${testcvs} add dir2" \
28612"Directory ${TESTDIR}/root2/dir2 added to the repository"
28613
28614	  touch dir1/file1 dir2/file2
28615	  if $remote; then
28616	    # Trying to add them both in one command doesn't work,
28617	    # because add.c doesn't do multiroot (it doesn't use recurse.c).
28618	    # Furthermore, it can't deal with the parent directory
28619	    # having a different root from the child, hence the cd.
28620	    cd dir1
28621	    dotest multiroot3-8 "${testcvs} add file1" \
28622"${PROG} add: scheduling file .file1. for addition
28623${PROG} add: use .${PROG} commit. to add this file permanently"
28624	    cd ..
28625	    dotest multiroot3-8a "${testcvs} add dir2/file2" \
28626"${PROG} add: scheduling file .dir2/file2. for addition
28627${PROG} add: use .${PROG} commit. to add this file permanently"
28628	  else
28629	    dotest multiroot3-8 "${testcvs} add dir1/file1 dir2/file2" \
28630"${PROG} add: scheduling file .dir1/file1. for addition
28631${PROG} add: scheduling file .dir2/file2. for addition
28632${PROG} add: use .${PROG} commit. to add these files permanently"
28633	  fi
28634
28635	  dotest multiroot3-9 "${testcvs} -q ci -m add-them" \
28636"RCS file: ${TESTDIR}/root2/dir2/file2,v
28637done
28638Checking in dir2/file2;
28639${TESTDIR}/root2/dir2/file2,v  <--  file2
28640initial revision: 1\.1
28641done
28642RCS file: ${TESTDIR}/root1/dir1/file1,v
28643done
28644Checking in dir1/file1;
28645${TESTDIR}/root1/dir1/file1,v  <--  file1
28646initial revision: 1\.1
28647done"
28648
28649	  # That this is an error is good - we are asking CVS to do
28650	  # something which doesn't make sense.
28651	  dotest_fail multiroot3-10 \
28652"${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
28653"${PROG} diff: failed to create lock directory for .${TESTDIR}/root1/dir2' (${TESTDIR}/root1/dir2/#cvs.lock): No such file or directory
28654${PROG} diff: failed to obtain dir lock in repository .${TESTDIR}/root1/dir2'
28655${PROG} \[diff aborted\]: read lock failed - giving up"
28656
28657	  # This one is supposed to work.
28658	  dotest multiroot3-11 "${testcvs} -q diff dir1/file1 dir2/file2" ""
28659
28660	  # make sure we can't access across repositories
28661	  mkdir 1a
28662	  cd 1a
28663	  dotest_fail multiroot3-12 \
28664"$testcvs -d $CVSROOT1 -q co ../root2/dir2" \
28665"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
28666"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
28667$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28668	  dotest_fail multiroot3-13 \
28669"$testcvs -d $CVSROOT2 -q co ../root1/dir1" \
28670"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\." \
28671"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\.
28672$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28673	  dotest_fail multiroot3-14 \
28674"$testcvs -d $CVSROOT1 -q co ./../root2/dir2" \
28675"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\." \
28676"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\.
28677$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28678	  dotest_fail multiroot3-15 \
28679"$testcvs -d $CVSROOT2 -q co ./../root1/dir1" \
28680"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
28681"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
28682$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28683	  dotest_fail multiroot3-16 \
28684"$testcvs -d $CVSROOT1 -q co -p ../root2/dir2" \
28685"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
28686"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
28687$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28688	  dotest_fail multiroot3-17 \
28689"$testcvs -d $CVSROOT1 -q co -p ./../root1/dir1" \
28690"$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
28691"$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
28692$PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
28693
28694	  if $keep; then
28695	    echo Keeping $TESTDIR and exiting due to --keep
28696	    exit 0
28697	  fi
28698
28699	  cd ../..
28700
28701	  rm -r 1
28702	  rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
28703	  unset CVSROOT1
28704	  unset CVSROOT2
28705	  ;;
28706
28707	multiroot4)
28708	  # More multiroot tests, in particular we have two roots with
28709	  # similarly-named directories and we try to see that CVS can
28710	  # keep them separate.
28711
28712	  CVSROOT1=`newroot ${TESTDIR}/root1`
28713	  CVSROOT2=`newroot ${TESTDIR}/root2`
28714
28715	  mkdir 1; cd 1
28716	  dotest multiroot4-1 "$testcvs -d$TESTDIR/root1 init"
28717	  dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
28718	  mkdir dircom
28719	  dotest multiroot4-3 "${testcvs} add dircom" \
28720"Directory ${TESTDIR}/root1/dircom added to the repository"
28721	  cd dircom
28722	  touch file1
28723	  dotest multiroot4-4 "${testcvs} add file1" \
28724"${PROG} add: scheduling file .file1. for addition
28725${PROG} add: use .${PROG} commit. to add this file permanently"
28726	  dotest multiroot4-5 "${testcvs} -q ci -m add" \
28727"RCS file: ${TESTDIR}/root1/dircom/file1,v
28728done
28729Checking in file1;
28730${TESTDIR}/root1/dircom/file1,v  <--  file1
28731initial revision: 1\.1
28732done"
28733	  cd ../..
28734	  mkdir 2; cd 2
28735	  dotest multiroot4-6 "$testcvs -d$TESTDIR/root2 init"
28736	  dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
28737	  mkdir dircom
28738	  dotest multiroot4-8 "${testcvs} add dircom" \
28739"Directory ${TESTDIR}/root2/dircom added to the repository"
28740	  cd dircom
28741	  touch file2
28742	  dotest multiroot4-9 "${testcvs} add file2" \
28743"${PROG} add: scheduling file .file2. for addition
28744${PROG} add: use .${PROG} commit. to add this file permanently"
28745	  dotest multiroot4-10 "${testcvs} -q ci -m add" \
28746"RCS file: ${TESTDIR}/root2/dircom/file2,v
28747done
28748Checking in file2;
28749${TESTDIR}/root2/dircom/file2,v  <--  file2
28750initial revision: 1\.1
28751done"
28752
28753	  cd ../..
28754	  cd 1/dircom
28755	  # This may look contrived; the real world example which inspired
28756	  # it was that a user was changing from local to remote.  Cases
28757	  # like switching servers (among those mounting the same
28758	  # repository) and so on would also look the same.
28759	  mkdir sdir2
28760	  dotest multiroot4-11 "${testcvs} -d ${CVSROOT2} add sdir2" \
28761"Directory ${TESTDIR}/root2/dircom/sdir2 added to the repository"
28762
28763	  dotest multiroot4-12 "${testcvs} -q update" ""
28764	  cd ..
28765	  dotest multiroot4-13 "${testcvs} -q update dircom" ""
28766	  cd ..
28767
28768	  rm -r 1 2
28769	  rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
28770	  unset CVSROOT1
28771	  unset CVSROOT2
28772	  ;;
28773
28774	rmroot)
28775	  # When the Entries/Root file is removed from an existing
28776	  # workspace, CVS should assume $CVSROOT instead
28777	  #
28778	  # Right now only checking that CVS exits normally on an
28779	  # update once CVS/Root is deleted
28780	  #
28781	  # There was a time when this would core dump when run in
28782	  # client/server mode
28783
28784	  mkdir 1; cd 1
28785	  dotest rmroot-setup-1 "${testcvs} -q co -l ." ''
28786	  mkdir first-dir
28787	  dotest rmroot-setup-2 "${testcvs} add first-dir" \
28788"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
28789          cd first-dir
28790	  touch file1 file2
28791	  dotest rmroot-setup-3 "${testcvs} add file1 file2" \
28792"${PROG} add: scheduling file .file1. for addition
28793${PROG} add: scheduling file .file2. for addition
28794${PROG} add: use .${PROG} commit. to add these files permanently"
28795	  dotest rmroot-setup-4 "${testcvs} -q commit -minit" \
28796"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
28797done
28798Checking in file1;
28799${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
28800initial revision: 1\.1
28801done
28802RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
28803done
28804Checking in file2;
28805${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
28806initial revision: 1\.1
28807done"
28808	  rm CVS/Root
28809	  dotest rmroot-1 "${testcvs} -q update" ''
28810
28811	  cd ../..
28812	  rm -rf 1
28813	  ;;
28814
28815	reposmv)
28816	  # More tests of repositories and specifying them.
28817	  # Similar to crerepos but that test is probably getting big
28818	  # enough.
28819	  CVSROOT1=`newroot ${TESTDIR}/root1`
28820	  CVSROOT_MOVED=`newroot ${TESTDIR}/root-moved`
28821
28822	  dotest reposmv-setup-1 "$testcvs -d$TESTDIR/root1 init"
28823	  mkdir imp-dir; cd imp-dir
28824	  echo file1 >file1
28825	  dotest reposmv-setup-2 \
28826"${testcvs} -d ${CVSROOT1} import -m add dir1 vendor release" \
28827"N dir1/file1
28828
28829No conflicts created by this import"
28830	  cd ..
28831
28832	  mkdir 1; cd 1
28833	  dotest reposmv-1 "${testcvs} -d ${CVSROOT1} -Q co dir1" ""
28834	  mv ${TESTDIR}/root1 ${TESTDIR}/root-moved
28835	  cd dir1
28836
28837	  # If we didn't have a relative repository, get one now.
28838	  dotest reposmv-1a "cat CVS/Repository" \
28839"${TESTDIR}/root1/dir1" "dir1"
28840	  echo dir1 >CVS/Repository
28841
28842	  # There were some duplicated warnings and such; only test
28843	  # for the part of the error message which makes sense.
28844	  # Bug: "skipping directory " without filename.
28845	  if $remote; then
28846	    dotest_fail reposmv-2r "${testcvs} update" \
28847"Cannot access ${TESTDIR}/root1/CVSROOT
28848No such file or directory"
28849	  else
28850	    dotest reposmv-2 "${testcvs} update" "${DOTSTAR}
28851${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28852${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1: No such file or directory
28853${PROG} update: skipping directory "
28854	  fi
28855
28856	  # CVS/Root overrides $CVSROOT
28857	  if $remote; then
28858	    CVSROOT_save=${CVSROOT}
28859	    CVSROOT=:fork:${TESTDIR}/root-moved; export CVSROOT
28860	    dotest_fail reposmv-3r "${testcvs} update" \
28861"Cannot access ${TESTDIR}/root1/CVSROOT
28862No such file or directory"
28863	    CVSROOT=${CVSROOT_save}; export CVSROOT
28864	  else
28865	    CVSROOT_save=${CVSROOT}
28866	    CVSROOT=${TESTDIR}/root-moved; export CVSROOT
28867	    dotest reposmv-3 "${testcvs} update" \
28868"${DOTSTAR}
28869${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28870${PROG} update: Updating \.
28871${DOTSTAR}"
28872	    CVSROOT=${CVSROOT_save}; export CVSROOT
28873	  fi
28874
28875	  if $remote; then
28876	    CVSROOT_save=${CVSROOT}
28877	    CVSROOT=:fork:${TESTDIR}/root-none; export CVSROOT
28878	    dotest_fail reposmv-4 "${testcvs} update" \
28879"Cannot access ${TESTDIR}/root1/CVSROOT
28880No such file or directory"
28881	    CVSROOT=${CVSROOT_save}; export CVSROOT
28882	  else
28883	    # CVS/Root doesn't seem to quite completely override $CVSROOT
28884	    # Bug?  Not necessarily a big deal if it only affects error
28885	    # messages.
28886	    CVSROOT_save=${CVSROOT}
28887	    CVSROOT=${TESTDIR}/root-none; export CVSROOT
28888	    dotest_fail reposmv-4 "${testcvs} update" \
28889"${PROG} update: in directory \.:
28890${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
28891${PROG} \[update aborted\]: ${TESTDIR}/root-none/CVSROOT: No such file or directory"
28892	    CVSROOT=${CVSROOT_save}; export CVSROOT
28893	  fi
28894
28895	  # -d overrides CVS/Root
28896	  # 
28897	  # Oddly enough, with CVS 1.10 I think this didn't work for
28898	  # local (that is, it would appear that CVS/Root would not
28899	  # get used, but would produce an error if it didn't exist).
28900	  dotest reposmv-5 "${testcvs} -d ${CVSROOT_MOVED} update" \
28901"${PROG} update: Updating \."
28902
28903	  # TODO: could also test various other things, like what if the
28904	  # user removes CVS/Root (which is legit).  Or another set of
28905	  # tests would be if both repositories exist but we want to make
28906	  # sure that CVS is using the correct one.
28907
28908	  cd ../..
28909	  rm -r imp-dir 1
28910	  rm -rf root1 root2
28911	  unset CVSROOT1
28912	  ;;
28913
28914	pserver)
28915	  # Test basic pserver functionality.
28916	  if $remote; then
28917   	    # First set SystemAuth=no.  Not really necessary, I don't
28918	    # think, but somehow it seems like the clean thing for
28919	    # the testsuite.
28920	    mkdir 1; cd 1
28921	    dotest pserver-1 "${testcvs} -Q co CVSROOT" ""
28922	    cd CVSROOT
28923	    echo "SystemAuth=no" >config
28924	    dotest pserver-2 "${testcvs} -q ci -m config-it" \
28925"Checking in config;
28926${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
28927new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
28928done
28929${PROG} commit: Rebuilding administrative file database"
28930	    cat >${CVSROOT_DIRNAME}/CVSROOT/passwd <<EOF
28931testme:q6WV9d2t848B2:$username
28932dontroot:q6WV9d2t848B2:root
28933anonymous::$username
28934$username:
28935willfail:   :whocares
28936EOF
28937	    dotest_fail pserver-3 "${testcvs} pserver" \
28938"error 0 Server configuration missing --allow-root in inetd.conf" <<EOF
28939BEGIN AUTH REQUEST
28940${CVSROOT_DIRNAME}
28941testme
28942Ay::'d
28943END AUTH REQUEST
28944EOF
28945
28946	    dotest_fail pserver-3a "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28947"error 0 ${CVSROOT_DIRNAME}XXX: no such repository
28948I HATE YOU" <<EOF
28949BEGIN AUTH REQUEST
28950${CVSROOT_DIRNAME}XXX
28951testme
28952Ay::'d
28953END AUTH REQUEST
28954EOF
28955
28956	    # Confirm that not sending a newline during auth cannot constitute
28957	    # a denial-of-service attack.  This assumes that PATH_MAX is less
28958	    # than 65536 bytes.  If PATH_MAX is larger than 65535 bytes, this
28959	    # test could hang indefinitely.
28960	    ${AWK} 'BEGIN { printf "0123456789abcdef" }' </dev/null >garbageseg
28961	    echo "BEGIN AUTH REQUEST" >garbageinput
28962	    i=0
28963	    while test $i -lt 64; do
28964	      cat <garbageseg >>garbageseg2
28965	      i=`expr $i + 1`
28966	    done
28967	    i=0
28968	    while test $i -lt 64; do
28969	      cat <garbageseg2 >>garbageinput
28970	      i=`expr $i + 1`
28971	    done
28972	    dotest_fail pserver-auth-no-dos \
28973"${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28974"${PROG} \\[pserver aborted\\]: Maximum line length exceeded during authentication\." <garbageinput
28975	    unset i
28976	    rm garbageseg garbageseg2 garbageinput
28977
28978	    # Sending the Root and noop before waiting for the
28979	    # "I LOVE YOU" is bogus, but hopefully we can get
28980	    # away with it.
28981	    dotest pserver-4 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28982"${DOTSTAR} LOVE YOU
28983ok" <<EOF
28984BEGIN AUTH REQUEST
28985${CVSROOT_DIRNAME}
28986testme
28987Ay::'d
28988END AUTH REQUEST
28989Root ${CVSROOT_DIRNAME}
28990noop
28991EOF
28992
28993	    # The "no such system user" error is occurring on at least one of
28994	    # our BSD 2.0.2 nightly test platforms.
28995	    dotest_fail pserver-4.2 \
28996"${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
28997"error 0: root not allowed" \
28998"E Fatal error, aborting\.
28999error 0 root: no such system user" <<EOF
29000BEGIN AUTH REQUEST
29001${CVSROOT_DIRNAME}
29002dontroot
29003Ay::'d
29004END AUTH REQUEST
29005EOF
29006
29007	    dotest pserver-5 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29008"${DOTSTAR} LOVE YOU
29009E Protocol error: Root says \"${TESTDIR}/1\" but pserver says \"${CVSROOT_DIRNAME}\"
29010error  " <<EOF
29011BEGIN AUTH REQUEST
29012${CVSROOT_DIRNAME}
29013testme
29014Ay::'d
29015END AUTH REQUEST
29016Root ${TESTDIR}/1
29017noop
29018EOF
29019
29020	    dotest pserver-5a "$testcvs --allow-root=$CVSROOT_DIRNAME pserver" \
29021"$DOTSTAR LOVE YOU
29022E init may not be run remotely
29023error  " <<EOF
29024BEGIN AUTH REQUEST
29025$CVSROOT_DIRNAME
29026testme
29027Ay::'d
29028END AUTH REQUEST
29029init $TESTDIR/2
29030EOF
29031	    dotest_fail pserver-5b "test -d $TESTDIR/2"
29032
29033	    dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29034"I HATE YOU" <<EOF
29035BEGIN AUTH REQUEST
29036${CVSROOT_DIRNAME}
29037testme
29038Ay::'d^b?hd
29039END AUTH REQUEST
29040EOF
29041
29042	    dotest_fail pserver-7 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29043"I HATE YOU" <<EOF
29044BEGIN VERIFICATION REQUEST
29045${CVSROOT_DIRNAME}
29046testme
29047Ay::'d^b?hd
29048END VERIFICATION REQUEST
29049EOF
29050
29051	    dotest pserver-8 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29052"${DOTSTAR} LOVE YOU" <<EOF
29053BEGIN VERIFICATION REQUEST
29054${CVSROOT_DIRNAME}
29055testme
29056Ay::'d
29057END VERIFICATION REQUEST
29058EOF
29059
29060# Tests pserver-9 through pserver-13 are about empty passwords
29061
29062            # Test empty password (both sides) for aliased user
29063	    dotest pserver-9 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29064"${DOTSTAR} LOVE YOU" <<EOF
29065BEGIN AUTH REQUEST
29066${CVSROOT_DIRNAME}
29067anonymous
29068A
29069END AUTH REQUEST
29070EOF
29071
29072            # Test empty password (server side only) for aliased user
29073	    dotest pserver-10 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29074"${DOTSTAR} LOVE YOU" <<EOF
29075BEGIN AUTH REQUEST
29076${CVSROOT_DIRNAME}
29077anonymous
29078Aanythingwouldworkhereittrulydoesnotmatter
29079END AUTH REQUEST
29080EOF
29081
29082            # Test empty (both sides) password for non-aliased user
29083	    dotest pserver-11 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29084"${DOTSTAR} LOVE YOU" <<EOF
29085BEGIN AUTH REQUEST
29086${CVSROOT_DIRNAME}
29087${username}
29088A
29089END AUTH REQUEST
29090EOF
29091
29092            # Test empty (server side only) password for non-aliased user
29093	    dotest pserver-12 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29094"${DOTSTAR} LOVE YOU" <<EOF
29095BEGIN AUTH REQUEST
29096${CVSROOT_DIRNAME}
29097${username}
29098Anypasswordwouldworkwhynotthisonethen
29099END AUTH REQUEST
29100EOF
29101
29102            # Test failure of whitespace password
29103	    dotest_fail pserver-13 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29104"${DOTSTAR} HATE YOU" <<EOF
29105BEGIN AUTH REQUEST
29106${CVSROOT_DIRNAME}
29107willfail
29108Amquiteunabletocomeupwithinterestingpasswordsanymore
29109END AUTH REQUEST
29110EOF
29111
29112	    # The following tests are for read-only access
29113
29114	    # Check that readers can only read, everyone else can write
29115
29116	    cat >${CVSROOT_DIRNAME}/CVSROOT/readers <<EOF
29117anonymous
29118EOF
29119
29120	    dotest pserver-14 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29121"${DOTSTAR} LOVE YOU
29122M Concurrent Versions System (CVS) .*
29123ok" <<EOF
29124BEGIN AUTH REQUEST
29125${CVSROOT_DIRNAME}
29126anonymous
29127Ay::'d
29128END AUTH REQUEST
29129Root ${CVSROOT_DIRNAME}
29130version
29131EOF
29132
29133	    dotest pserver-16 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29134"${DOTSTAR} LOVE YOU
29135M Concurrent Versions System (CVS) .*
29136ok" <<EOF
29137BEGIN AUTH REQUEST
29138${CVSROOT_DIRNAME}
29139testme
29140Ay::'d
29141END AUTH REQUEST
29142Root ${CVSROOT_DIRNAME}
29143version
29144EOF
29145
29146	    dotest pserver-18 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29147"${DOTSTAR} LOVE YOU
29148M Concurrent Versions System (CVS) .*
29149ok" <<EOF
29150BEGIN AUTH REQUEST
29151${CVSROOT_DIRNAME}
29152${username}
29153Ay::'d
29154END AUTH REQUEST
29155Root ${CVSROOT_DIRNAME}
29156version
29157EOF
29158
29159	    # Check that writers can write, everyone else can only read
29160	    # even if not listed in readers
29161
29162	    cat >${CVSROOT_DIRNAME}/CVSROOT/writers <<EOF
29163testme
29164EOF
29165
29166	    dotest pserver-20 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29167"${DOTSTAR} LOVE YOU
29168M Concurrent Versions System (CVS) .*
29169ok" <<EOF
29170BEGIN AUTH REQUEST
29171${CVSROOT_DIRNAME}
29172anonymous
29173Ay::'d
29174END AUTH REQUEST
29175Root ${CVSROOT_DIRNAME}
29176version
29177EOF
29178
29179	    dotest pserver-22 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29180"${DOTSTAR} LOVE YOU
29181M Concurrent Versions System (CVS) .*
29182ok" <<EOF
29183BEGIN AUTH REQUEST
29184${CVSROOT_DIRNAME}
29185testme
29186Ay::'d
29187END AUTH REQUEST
29188Root ${CVSROOT_DIRNAME}
29189version
29190EOF
29191
29192	    dotest pserver-24 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29193"${DOTSTAR} LOVE YOU
29194M Concurrent Versions System (CVS) .*
29195ok" <<EOF
29196BEGIN AUTH REQUEST
29197${CVSROOT_DIRNAME}
29198${username}
29199Ay::'d
29200END AUTH REQUEST
29201Root ${CVSROOT_DIRNAME}
29202version
29203EOF
29204
29205	    # Should work the same without readers
29206
29207	    rm ${CVSROOT_DIRNAME}/CVSROOT/readers
29208
29209	    dotest pserver-26 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29210"${DOTSTAR} LOVE YOU
29211M Concurrent Versions System (CVS) .*
29212ok" <<EOF
29213BEGIN AUTH REQUEST
29214${CVSROOT_DIRNAME}
29215anonymous
29216Ay::'d
29217END AUTH REQUEST
29218Root ${CVSROOT_DIRNAME}
29219version
29220EOF
29221
29222	    dotest pserver-28 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29223"${DOTSTAR} LOVE YOU
29224M Concurrent Versions System (CVS) .*
29225ok" <<EOF
29226BEGIN AUTH REQUEST
29227${CVSROOT_DIRNAME}
29228testme
29229Ay::'d
29230END AUTH REQUEST
29231Root ${CVSROOT_DIRNAME}
29232version
29233EOF
29234
29235	    dotest pserver-30 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
29236"${DOTSTAR} LOVE YOU
29237M Concurrent Versions System (CVS) .*
29238ok" <<EOF
29239BEGIN AUTH REQUEST
29240${CVSROOT_DIRNAME}
29241${username}
29242Ay::'d
29243END AUTH REQUEST
29244Root ${CVSROOT_DIRNAME}
29245version
29246EOF
29247
29248	    # pserver used to try and print from the NULL pointer 
29249	    # in this error message in this case
29250	    dotest_fail pserver-bufinit "${testcvs} pserver" \
29251"${PROG} \[pserver aborted\]: bad auth protocol start: EOF" </dev/null
29252
29253	    # Clean up.
29254	    echo "# comments only" >config
29255	    dotest pserver-cleanup-1 "${testcvs} -q ci -m config-it" \
29256"Checking in config;
29257${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
29258new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
29259done
29260${PROG} commit: Rebuilding administrative file database"
29261	    cd ../..
29262	    rm -r 1
29263	    rm ${CVSROOT_DIRNAME}/CVSROOT/passwd ${CVSROOT_DIRNAME}/CVSROOT/writers
29264	  fi # skip the whole thing for local
29265	  ;;
29266
29267	server)
29268	  # Some tests of the server (independent of the client).
29269	  if $remote; then
29270	    dotest server-1 "${testcvs} server" \
29271"E Protocol error: Root request missing
29272error  " <<EOF
29273Directory bogus
29274mumble/bar
29275update
29276EOF
29277
29278	    # Could also test for relative pathnames here (so that crerepos-6a
29279	    # and crerepos-6b can use :fork:).
29280	    dotest server-2 "$testcvs server" \
29281"E init may not be run remotely
29282error  " <<EOF
29283Set OTHER=variable
29284Set MYENV=env-value
29285init ${TESTDIR}/crerepos
29286EOF
29287	    dotest_fail server-3 "test -d $TESTDIR/crerepos/CVSROOT"
29288
29289	    dotest server-3a "$testcvs -d$TESTDIR/crerepos init"
29290
29291	    # Now some tests of gzip-file-contents (used by jCVS).
29292	    ${AWK} 'BEGIN { \
29293printf "%c%c%c%c%c%c.6%c%c+I-.%c%c%c%c5%c;%c%c%c%c", \
2929431, 139, 8, 64, 5, 7, 64, 3, 225, 2, 64, 198, 185, 5, 64, 64, 64}' \
29295	      </dev/null | ${TR} '\100' '\000' >gzipped.dat
29296	    # Note that the CVS client sends "-b 1.1.1", and this
29297	    # test doesn't.  But the server also defaults to that.
29298	    cat <<EOF >session.dat
29299Root ${TESTDIR}/crerepos
29300UseUnchanged
29301gzip-file-contents 3
29302Argument -m
29303Argument msg
29304Argumentx 
29305Argument dir1
29306Argument tag1
29307Argument tag2
29308Directory .
29309${TESTDIR}/crerepos
29310Modified file1
29311u=rw,g=r,o=r
29312z25
29313EOF
29314	    cat gzipped.dat >>session.dat
29315	    echo import >>session.dat
29316	    dotest server-4 "${testcvs} server" \
29317"M N dir1/file1
29318M 
29319M No conflicts created by this import
29320M 
29321ok" <session.dat
29322	    dotest server-5 \
29323"${testcvs} -q -d ${TESTDIR}/crerepos co -p dir1/file1" "test"
29324
29325	    # OK, here are some notify tests.
29326	    dotest server-6 "${testcvs} server" \
29327"Notified \./
29328${TESTDIR}/crerepos/dir1/file1
29329ok" <<EOF
29330Root ${TESTDIR}/crerepos
29331Directory .
29332${TESTDIR}/crerepos/dir1
29333Notify file1
29334E	Fri May  7 13:21:09 1999 GMT	myhost	some-work-dir	EUC
29335noop
29336EOF
29337	    # Sending the second "noop" before waiting for the output
29338	    # from the first is bogus but hopefully we can get away
29339	    # with it.
29340	    dotest server-7 "${testcvs} server" \
29341"Notified \./
29342${TESTDIR}/crerepos/dir1/file1
29343ok
29344Notified \./
29345${TESTDIR}/crerepos/dir1/file1
29346ok" <<EOF
29347Root ${TESTDIR}/crerepos
29348Directory .
29349${TESTDIR}/crerepos/dir1
29350Notify file1
29351E	Fri May  7 13:21:09 1999 GMT	myhost	some-work-dir	EUC
29352noop
29353Notify file1
29354E	The 57th day of Discord in the YOLD 3165	myhost	some-work-dir	EUC
29355noop
29356EOF
29357
29358	    # OK, now test a few error conditions.
29359	    # FIXCVS: should give "error" and no "Notified", like server-9
29360	    dotest server-8 "${testcvs} server" \
29361"E ${PROG} server: invalid character in editor value
29362Notified \./
29363${TESTDIR}/crerepos/dir1/file1
29364ok" <<EOF
29365Root ${TESTDIR}/crerepos
29366Directory .
29367${TESTDIR}/crerepos/dir1
29368Notify file1
29369E	Setting Orange, the 52th day of Discord in the YOLD 3165	myhost	some-work-dir	EUC
29370noop
29371EOF
29372
29373	    dotest server-9 "${testcvs} server" \
29374"E Protocol error; misformed Notify request
29375error  " <<EOF
29376Root ${TESTDIR}/crerepos
29377Directory .
29378${TESTDIR}/crerepos/dir1
29379Notify file1
29380E	Setting Orange+57th day of Discord	myhost	some-work-dir	EUC
29381noop
29382EOF
29383
29384	    # First demonstrate an interesting quirk in the protocol.
29385	    # The "watchers" request selects the files to operate based
29386	    # on files which exist in the working directory.  So if we
29387	    # don't send "Entry" or the like, it won't do anything.
29388	    # Wants to be documented in cvsclient.texi...
29389	    dotest server-10 "${testcvs} server" "ok" <<EOF
29390Root ${TESTDIR}/crerepos
29391Directory .
29392${TESTDIR}/crerepos/dir1
29393watchers
29394EOF
29395	    # See if "watchers" and "editors" display the right thing.
29396	    dotest server-11 "${testcvs} server" \
29397"M file1	${username}	tedit	tunedit	tcommit
29398ok" <<EOF
29399Root ${TESTDIR}/crerepos
29400Directory .
29401${TESTDIR}/crerepos/dir1
29402Entry /file1/1.1////
29403watchers
29404EOF
29405	    dotest server-12 "${testcvs} server" \
29406"M file1	${username}	The 57th day of Discord in the YOLD 3165	myhost	some-work-dir
29407ok" <<EOF
29408Root ${TESTDIR}/crerepos
29409Directory .
29410${TESTDIR}/crerepos/dir1
29411Entry /file1/1.1////
29412editors
29413EOF
29414
29415	    # Now do an unedit.
29416	    dotest server-13 "${testcvs} server" \
29417"Notified \./
29418${TESTDIR}/crerepos/dir1/file1
29419ok" <<EOF
29420Root ${TESTDIR}/crerepos
29421Directory .
29422${TESTDIR}/crerepos/dir1
29423Notify file1
29424U	7 May 1999 15:00 GMT	myhost	some-work-dir	EUC
29425noop
29426EOF
29427
29428	    # Now try "watchers" and "editors" again.
29429	    dotest server-14 "${testcvs} server" "ok" <<EOF
29430Root ${TESTDIR}/crerepos
29431Directory .
29432${TESTDIR}/crerepos/dir1
29433watchers
29434EOF
29435	    dotest server-15 "${testcvs} server" "ok" <<EOF
29436Root ${TESTDIR}/crerepos
29437Directory .
29438${TESTDIR}/crerepos/dir1
29439editors
29440EOF
29441
29442	    # Test that the global `-l' option is ignored nonfatally.
29443	    dotest server-16 "${testcvs} server" \
29444"E cvs server: WARNING: global \`-l' option ignored\.
29445ok" <<EOF
29446Global_option -l
29447noop
29448EOF
29449
29450	    # There used to be some exploits based on malformed Entry requests
29451	    dotest server-17 "$testcvs server" \
29452"E protocol error: Malformed Entry
29453error  " <<EOF
29454Root $TESTDIR/crerepos
29455Directory .
29456$TESTDIR/crerepos/dir1
29457Entry X/file1/1.1////
29458noop
29459EOF
29460
29461	    dotest server-18 "$testcvs server" \
29462"E protocol error: Malformed Entry
29463error  " <<EOF
29464Root $TESTDIR/crerepos
29465Directory .
29466$TESTDIR/crerepos/dir1
29467Entry /CC/CC/CC
29468noop
29469EOF
29470
29471	    if $keep; then
29472	      echo Keeping ${TESTDIR} and exiting due to --keep
29473	      exit 0
29474	    fi
29475
29476	    rm -rf ${TESTDIR}/crerepos
29477	    rm gzipped.dat session.dat
29478	  fi # skip the whole thing for local
29479	  ;;
29480
29481	server2)
29482	  # More server tests, in particular testing that various
29483	  # possible security holes are plugged.
29484	  if $remote; then
29485	    dotest server2-1 "${testcvs} server" \
29486"E protocol error: directory '${CVSROOT_DIRNAME}/\.\./dir1' not within root '${CVSROOT_DIRNAME}'
29487error  " <<EOF
29488Root ${CVSROOT_DIRNAME}
29489Directory .
29490${CVSROOT_DIRNAME}/../dir1
29491noop
29492EOF
29493
29494	    dotest server2-2 "${testcvs} server" \
29495"E protocol error: directory '${CVSROOT_DIRNAME}dir1' not within root '${CVSROOT_DIRNAME}'
29496error  " <<EOF
29497Root ${CVSROOT_DIRNAME}
29498Directory .
29499${CVSROOT_DIRNAME}dir1
29500noop
29501EOF
29502
29503	    dotest server2-3 "${testcvs} server" \
29504"E protocol error: directory '${TESTDIR}' not within root '${CVSROOT_DIRNAME}'
29505error  " <<EOF
29506Root ${CVSROOT_DIRNAME}
29507Directory .
29508${TESTDIR}
29509noop
29510EOF
29511
29512	    # OK, now a few tests for the rule that one cannot pass a
29513	    # filename containing a slash to Modified, Is-modified,
29514	    # Notify, Questionable, or Unchanged.  For completeness
29515	    # we'd try them all.  For lazyness/conciseness we don't.
29516	    dotest server2-4 "${testcvs} server" \
29517"E protocol error: directory 'foo/bar' not within current directory
29518error  " <<EOF
29519Root ${CVSROOT_DIRNAME}
29520Directory .
29521${CVSROOT_DIRNAME}
29522Unchanged foo/bar
29523noop
29524EOF
29525	    dotest server2-5 \
29526"$testcvs --allow-root=$CVSROOT_DIRNAME.bad server" \
29527"E Bad root $CVSROOT_DIRNAME
29528error  " <<EOF
29529Root $CVSROOT_DIRNAME
29530noop
29531EOF
29532	    dotest server2-6 \
29533"$testcvs --allow-root=$CVSROOT_DIRNAME server" \
29534"ok" <<EOF
29535Root $CVSROOT_DIRNAME
29536noop
29537EOF
29538	  fi
29539	  ;;
29540
29541
29542
29543	server3)
29544	  # Test that various checks on the Root request generate the correct
29545	  # error messages.
29546	  if $remote; then
29547	    # As a control, a valid request.
29548	    dotest server3-1 "$testcvs server" 'ok' <<EOF
29549Root $CVSROOT_DIRNAME
29550Directory .
29551$CVSROOT_DIRNAME
29552Unchanged foo
29553noop
29554EOF
29555
29556	    dotest server3-2 "$testcvs server" \
29557"E Root somewhere/over/the/rainbow must be an absolute pathname
29558error  " <<EOF
29559Root somewhere/over/the/rainbow
29560noop
29561EOF
29562
29563	    dotest server3-3 "$testcvs server" \
29564"E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
29565error  " <<EOF
29566Root $CVSROOT_DIRNAME
29567Root $CVSROOT_DIRNAME
29568noop
29569EOF
29570
29571	    dotest server3-4 "$testcvs server" \
29572"E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
29573error  " <<EOF
29574Root $CVSROOT_DIRNAME
29575Root $CVSROOT_DIRNAME
29576Directory .
29577$CVSROOT_DIRNAME
29578Unchanged foo
29579noop
29580EOF
29581
29582	    # These cascading errors seem odd, but the client should have hung
29583	    # up after the first.
29584	    dotest server3-5 "$testcvs server" \
29585"E Root somewhere/over/the/rainbow must be an absolute pathname
29586error  
29587E Protocol error: Root request missing
29588error  " <<EOF
29589Root somewhere/over/the/rainbow
29590Directory .
29591somewhere/over/the/rainbow
29592Unchanged foo
29593noop
29594EOF
29595	  fi
29596	  ;;
29597
29598
29599
29600	client)
29601	  # Some tests of the client (independent of the server).
29602	  if $remote; then
29603	    cat >${TESTDIR}/serveme <<EOF
29604#!${TESTSHELL}
29605# This is admittedly a bit cheezy, in the sense that we make lots
29606# of assumptions about what the client is going to send us.
29607# We don't mention Repository, because current clients don't require it.
29608# Sending these at our own pace, rather than waiting for the client to
29609# make the requests, is bogus, but hopefully we can get away with it.
29610echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29611echo "ok"
29612echo "M special message"
29613echo "Created first-dir/"
29614echo "${CVSROOT_DIRNAME}/first-dir/file1"
29615echo "/file1/1.1///"
29616echo "u=rw,g=rw,o=rw"
29617echo "4"
29618echo "xyz"
29619echo "ok"
29620cat >/dev/null
29621EOF
29622	    # Cygwin.  Pthffffffffft!
29623	    if test -n "$remotehost"; then
29624	      $CVS_RSH $remotehost "chmod +x ${TESTDIR}/serveme"
29625	    else
29626	      chmod +x ${TESTDIR}/serveme
29627	    fi
29628	    save_CVS_SERVER=$CVS_SERVER
29629	    CVS_SERVER=${TESTDIR}/serveme; export CVS_SERVER
29630	    mkdir 1; cd 1
29631	    dotest_fail client-1 "${testcvs} -q co first-dir" \
29632"${PROG} \[checkout aborted\]: This server does not support the global -q option${DOTSTAR}"
29633	    dotest client-2 "${testcvs} co first-dir" "special message"
29634
29635	    cat >${TESTDIR}/serveme <<EOF
29636#!${TESTSHELL}
29637echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29638echo "ok"
29639echo "M merge-it"
29640echo "Copy-file ./"
29641echo "${CVSROOT_DIRNAME}/first-dir/file1"
29642echo "${TESTDIR}/bogus/.#file1.1.1"
29643echo "Merged ./"
29644echo "${CVSROOT_DIRNAME}/first-dir/file1"
29645echo "/file1/1.2///"
29646echo "u=rw,g=rw,o=rw"
29647echo "4"
29648echo "abd"
29649echo "ok"
29650cat >/dev/null
29651EOF
29652	    cd first-dir
29653	    mkdir ${TESTDIR}/bogus
29654	    # The ${DOTSTAR} is to match a potential "broken pipe" if the
29655	    # client exits before the server script sends everything
29656	    dotest_fail client-3 "${testcvs} update" "merge-it
29657${PROG} \[update aborted\]: protocol error: Copy-file tried to specify director${DOTSTAR}"
29658	    cat >${TESTDIR}/serveme <<EOF
29659#!${TESTSHELL}
29660echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29661echo "ok"
29662echo "M merge-it"
29663echo "Copy-file ./"
29664echo "${CVSROOT_DIRNAME}/first-dir/file1"
29665echo ".#file1.1.1"
29666echo "Merged ./"
29667echo "${CVSROOT_DIRNAME}/first-dir/file1"
29668echo "/file1/1.2///"
29669echo "u=rw,g=rw,o=rw"
29670echo "4"
29671echo "abc"
29672echo "ok"
29673cat >/dev/null
29674EOF
29675	    dotest client-4 "${testcvs} update" "merge-it"
29676	    dotest client-5 "cat .#file1.1.1" "xyz"
29677	    dotest client-6 "cat CVS/Entries" "/file1/1.2/[A-Za-z0-9 :]*//
29678D"
29679	    dotest client-7 "cat file1" "abc"
29680
29681	    cat >${TESTDIR}/serveme <<EOF
29682#!${TESTSHELL}
29683echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29684echo "ok"
29685echo "M OK, whatever"
29686echo "ok"
29687cat >${TESTDIR}/client.tmp
29688EOF
29689	    chmod u=rw,go= file1
29690	    # By specifying the time zone in local time, we don't
29691	    # know exactly how that will translate to GMT.
29692	    dotest client-8 "${testcvs} update -D 99-10-04" "OK, whatever"
29693	    # String 2 below is Cygwin again - ptoooey.
29694	    dotest client-9 "cat ${TESTDIR}/client.tmp" \
29695"Root ${CVSROOT_DIRNAME}
29696Valid-responses [-a-zA-Z ]*
29697valid-requests
29698Argument -D
29699Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
29700Argument --
29701Directory \.
29702${CVSROOT_DIRNAME}/first-dir
29703Entry /file1/1\.2///
29704Modified file1
29705u=rw,g=,o=
297064
29707abc
29708update" \
29709"Root ${CVSROOT_DIRNAME}
29710Valid-responses [-a-zA-Z ]*
29711valid-requests
29712Argument -D
29713Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
29714Argument --
29715Directory \.
29716${CVSROOT_DIRNAME}/first-dir
29717Entry /file1/1\.2///
29718Modified file1
29719u=rw,g=r,o=r
297204
29721abc
29722update"
29723
29724	    # The following test tests what was a potential client update in
29725	    # CVS versions 1.11.14 and CVS versions 1.12.6 and earlier.  This
29726	    # exploit would allow a trojan server to create arbitrary files,
29727	    # anywhere the user had write permissions, even outside of the
29728	    # user's sandbox.
29729	    cat >$HOME/.bashrc <<EOF
29730#!$TESTSHELL
29731# This is where login scripts would usually be
29732# stored.
29733EOF
29734	    cat >$TESTDIR/serveme <<EOF
29735#!$TESTSHELL
29736echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29737echo "ok"
29738echo "Rcs-diff $HOME/"
29739echo "$HOME/.bashrc"
29740echo "/.bashrc/73.50///"
29741echo "u=rw,g=rw,o=rw"
29742echo "20"
29743echo "a1 1"
29744echo "echo 'gotcha!'"
29745echo "ok"
29746cat >/dev/null
29747EOF
29748	    
29749	    # If I don't run the following sleep between the above cat and
29750	    # the following calls to dotest, sometimes the serveme file isn't
29751	    # completely written yet by the time CVS tries to execute it,
29752	    # causing the shell to intermittantly report syntax errors (usually
29753	    # early EOF).  There's probably a new race condition here, but this
29754	    # works.
29755	    #
29756	    # Incidentally, I can reproduce this behavior with Linux 2.4.20 and
29757	    # Bash 2.05 or Bash 2.05b.
29758	    sleep 1
29759	    dotest_fail client-10 "$testcvs update" \
29760"$PROG update: Server attempted to update a file via an invalid pathname:
29761$PROG \[update aborted\]: \`$HOME/.bashrc'\."
29762
29763	    # A second try at a client exploit.  This one never actually
29764	    # failed in the past, but I thought it wouldn't hurt to add a test.
29765	    cat >$TESTDIR/serveme <<EOF
29766#!$TESTSHELL
29767echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29768echo "ok"
29769echo "Rcs-diff ./"
29770echo "$HOME/.bashrc"
29771echo "/.bashrc/73.50///"
29772echo "u=rw,g=rw,o=rw"
29773echo "20"
29774echo "a1 1"
29775echo "echo 'gotcha!'"
29776echo "ok"
29777cat >/dev/null
29778EOF
29779	    sleep 1
29780	    dotest_fail client-11 "$testcvs update" \
29781"$PROG \[update aborted\]: patch original file \./\.bashrc does not exist"
29782
29783	    # A third try at a client exploit.  This one did used to fail like
29784	    # client-10.
29785	    cat >$TESTDIR/serveme <<EOF
29786#!$TESTSHELL
29787echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29788echo "ok"
29789echo "Rcs-diff ../../home/"
29790echo "../../.bashrc"
29791echo "/.bashrc/73.50///"
29792echo "u=rw,g=rw,o=rw"
29793echo "20"
29794echo "a1 1"
29795echo "echo 'gotcha!'"
29796echo "ok"
29797cat >/dev/null
29798EOF
29799	    sleep 1
29800	    dotest_fail client-12 "$testcvs update" \
29801"$PROG update: Server attempted to update a file via an invalid pathname:
29802$PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29803
29804	    # Try the same exploit using the Created response.
29805	    cat >$TESTDIR/serveme <<EOF
29806#!$TESTSHELL
29807echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29808echo "ok"
29809echo "Created $HOME/"
29810echo "$HOME/.bashrc"
29811echo "/.bashrc/73.50///"
29812echo "u=rw,g=rw,o=rw"
29813echo "26"
29814echo "#! /bin/sh"
29815echo "echo 'gotcha!'"
29816echo "ok"
29817cat >/dev/null
29818EOF
29819	    sleep 1
29820	    dotest_fail client-13 "$testcvs update" \
29821"$PROG update: Server attempted to update a file via an invalid pathname:
29822$PROG \[update aborted\]: \`$HOME/.bashrc'\."
29823
29824	    # Now try using the Update-existing response
29825	    cat >$TESTDIR/serveme <<EOF
29826#!$TESTSHELL
29827echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29828echo "ok"
29829echo "Update-existing ../../home/"
29830echo "../../home/.bashrc"
29831echo "/.bashrc/73.50///"
29832echo "u=rw,g=rw,o=rw"
29833echo "26"
29834echo "#! /bin/sh"
29835echo "echo 'gotcha!'"
29836echo "ok"
29837cat >/dev/null
29838EOF
29839	    sleep 1
29840	    dotest_fail client-14 "$testcvs update" \
29841"$PROG update: Server attempted to update a file via an invalid pathname:
29842$PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29843
29844	    # Try the same exploit using the Merged response.
29845	    cat >$TESTDIR/serveme <<EOF
29846#!$TESTSHELL
29847echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29848echo "ok"
29849echo "Merged $HOME/"
29850echo "$HOME/.bashrc"
29851echo "/.bashrc/73.50///"
29852echo "u=rw,g=rw,o=rw"
29853echo "26"
29854echo "#! /bin/sh"
29855echo "echo 'gotcha!'"
29856echo "ok"
29857cat >/dev/null
29858EOF
29859	    sleep 1
29860	    dotest_fail client-15 "$testcvs update" \
29861"$PROG update: Server attempted to update a file via an invalid pathname:
29862$PROG \[update aborted\]: \`$HOME/.bashrc'\."
29863
29864	    # Now try using the Updated response
29865	    cat >$TESTDIR/serveme <<EOF
29866#!$TESTSHELL
29867echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29868echo "ok"
29869echo "Updated ../../home/"
29870echo "../../home/.bashrc"
29871echo "/.bashrc/73.50///"
29872echo "u=rw,g=rw,o=rw"
29873echo "26"
29874echo "#! /bin/sh"
29875echo "echo 'gotcha!'"
29876echo "ok"
29877cat >/dev/null
29878EOF
29879	    sleep 1
29880	    dotest_fail client-16 "$testcvs update" \
29881"$PROG update: Server attempted to update a file via an invalid pathname:
29882$PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
29883
29884	    # Try the same exploit using the Copy-file response.
29885	    # As far as I know, Copy-file was never exploitable either.
29886	    cat >$TESTDIR/serveme <<EOF
29887#!$TESTSHELL
29888echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29889echo "ok"
29890echo "Created ."
29891echo "./innocuous"
29892echo "/innocuous/73.50///"
29893echo "u=rw,g=rw,o=rw"
29894echo "26"
29895echo "#! /bin/sh"
29896echo "echo 'gotcha!'"
29897echo "Copy-file ."
29898echo "./innocuous"
29899echo "$HOME/innocuous"
29900echo "ok"
29901cat >/dev/null
29902EOF
29903	    sleep 1
29904	    dotest_fail client-18 "$testcvs update" \
29905"$PROG \[update aborted\]: protocol error: Copy-file tried to specify directory"
29906
29907	    # And verify that none of the exploits was successful.
29908	    dotest client-19 "cat $HOME/.bashrc" \
29909"#!$TESTSHELL
29910# This is where login scripts would usually be
29911# stored\."
29912
29913	    if $keep; then
29914	      echo Keeping ${TESTDIR} and exiting due to --keep
29915	      exit 0
29916	    fi
29917
29918	    cd ../..
29919	    rm -r 1
29920	    rmdir ${TESTDIR}/bogus
29921	    rm $TESTDIR/serveme $HOME/.bashrc
29922	    CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
29923	  fi # skip the whole thing for local
29924	  ;;
29925
29926
29927
29928	client2)
29929	  # Test how the client handles error messages from the server.
29930	  if $remote; then
29931	    cat >$TESTDIR/serveme <<EOF
29932#!$TESTSHELL
29933# This is just as cheesy as the "client" tests made it out to be.
29934echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29935echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
29936echo "error  "
29937echo "E Protocol error: Root request missing"
29938echo "error  "
29939cat >/dev/null
29940EOF
29941	    # Cygwin.  Pthffffffffft!
29942	    if test -n "$remotehost"; then
29943	      $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
29944	    else
29945	      chmod +x $TESTDIR/serveme
29946	    fi
29947	    save_CVS_SERVER=$CVS_SERVER
29948	    CVS_SERVER=$TESTDIR/serveme; export CVS_SERVER
29949	    mkdir client2; cd client2
29950	    dotest_fail client2-1 "$testcvs co first-dir" \
29951"Root somewhere/over/the/rainbow must be an absolute pathname"
29952
29953	    cat >$TESTDIR/serveme <<EOF
29954#!$TESTSHELL
29955# This is just as cheesy as the "client" tests made it out to be.
29956echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
29957echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
29958echo
29959echo "error  "
29960echo "E Protocol error: Root request missing"
29961echo "error  "
29962cat >/dev/null
29963EOF
29964	    # Cygwin.  Pthffffffffft!
29965	    if test -n "$remotehost"; then
29966	      $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
29967	    else
29968	      chmod +x $TESTDIR/serveme
29969	    fi
29970	    dotest_fail client2-2 "$testcvs co first-dir" \
29971"Root somewhere/over/the/rainbow must be an absolute pathname
29972$PROG checkout: warning: unrecognized response \`' from cvs server"
29973
29974	    if $keep; then
29975	      echo Keeping $TESTDIR and exiting due to --keep
29976	      exit 0
29977	    fi
29978
29979	    cd ..
29980	    rm -r client2
29981	    rm $TESTDIR/serveme
29982	    CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER
29983	  fi # skip the whole thing for local
29984	  ;;
29985
29986
29987
29988	dottedroot)
29989	  # Check that a CVSROOT with a "." in the name will work.
29990	  CVSROOT_save=${CVSROOT}
29991	  CVSROOT_DIRNAME_save=${CVSROOT_DIRNAME}
29992	  CVSROOT_DIRNAME=${TESTDIR}/cvs.root
29993	  CVSROOT=`newroot ${CVSROOT_DIRNAME}`
29994
29995	  dotest dottedroot-init-1 "$testcvs -d$CVSROOT_DIRNAME init"
29996	  mkdir dir1
29997	  mkdir dir1/dir2
29998	  echo version1 >dir1/dir2/file1
29999	  cd dir1
30000	  dotest dottedroot-1 "${testcvs} import -m '' module1 AUTHOR INITIAL" \
30001"${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/module1/dir2
30002N module1/dir2/file1
30003
30004No conflicts created by this import"
30005	  cd ..
30006
30007	  # This is the test that used to cause an assertion failure
30008	  # in recurse.c:do_recursion().
30009	  dotest dottedroot-2 "${testcvs} co -rINITIAL module1" \
30010"${PROG} [a-z]*: Updating module1
30011${PROG} [a-z]*: Updating module1/dir2
30012U module1/dir2/file1"
30013
30014	  # This also triggered the assertion failure above prior to 1.11.23.
30015	  dotest dottedroot-3 \
30016"$testcvs -q co -prINITIAL module1/./dir2/file1" \
30017'version1'
30018
30019	  if $keep; then
30020	    echo Keeping $TESTDIR and exiting due to --keep
30021	    exit 0
30022	  fi
30023
30024	  rm -rf ${CVSROOT_DIRNAME}
30025	  rm -r dir1 module1
30026	  CVSROOT_DIRNAME=${CVSROOT_DIRNAME_save}
30027	  CVSROOT=${CVSROOT_save}
30028 	  ;;
30029 
30030	fork)
30031	  # Test that the server defaults to the correct executable in :fork:
30032	  # mode.  See the note in the TODO at the end of this file about this.
30033	  #
30034	  # This test and client should be left after all other references to
30035	  # CVS_SERVER are removed from this script.
30036	  #
30037	  # The client series of tests already tests that CVS_SERVER is
30038	  # working, but that test might be better here.
30039	  if $remote; then
30040	    mkdir fork; cd fork
30041	    save_CVS_SERVER=$CVS_SERVER
30042	    unset CVS_SERVER
30043	    # So looking through $PATH for cvs won't work...
30044	    echo "echo junk" >cvs
30045	    chmod a+x cvs
30046	    save_PATH=$PATH; PATH=.:$PATH
30047	    dotest fork-1 "$testcvs -d:fork:$CVSROOT_DIRNAME version" \
30048'Client: \(.*\)
30049Server: \1'
30050	    CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
30051	    unset save_CVS_SERVER
30052	    PATH=$save_PATH; unset save_PATH
30053	    cd ..
30054
30055	    if $keep; then
30056	      echo Keeping ${TESTDIR} and exiting due to --keep
30057	      exit 0
30058	    fi
30059	  fi
30060	  ;;
30061
30062	commit-add-missing)
30063	  # Make sure that a commit fails when a `cvs add'ed file has
30064	  # been removed from the working directory.
30065
30066	  mkdir 1; cd 1
30067	  module=c-a-m
30068	  echo > unused-file
30069	  dotest commit-add-missing-1 \
30070	    "$testcvs -Q import -m. $module X Y" ''
30071
30072	  file=F
30073	  # Check it out and tag it.
30074	  dotest commit-add-missing-2 "$testcvs -Q co $module" ''
30075	  cd $module
30076	  dotest commit-add-missing-3 "$testcvs -Q tag -b B" ''
30077	  echo v1 > $file
30078	  dotest commit-add-missing-4 "$testcvs -Q add $file" ''
30079	  rm -f $file
30080	  dotest_fail commit-add-missing-5 "$testcvs -Q ci -m. $file" \
30081"${PROG} commit: Up-to-date check failed for .$file'
30082${PROG} \[commit aborted\]: correct above errors first!"
30083
30084	  cd ../..
30085	  rm -rf 1
30086	  rm -rf ${CVSROOT_DIRNAME}/$module
30087	  ;;
30088
30089	add-restricted)
30090	  # Verify that `sdir/CVS' may not be explicitly added.
30091	  mkdir add-restricted; cd add-restricted
30092
30093	  mkdir import; cd import
30094	  : > junk
30095	  dotest add-restricted-init-1 \
30096"$testcvs -Q import -m. add-restricted X Y"
30097	  cd ..
30098
30099	  dotest add-restricted-init-2 "$testcvs -Q co add-restricted"
30100	  cd add-restricted
30101
30102	  # errmsg2-3 tests the specific message here.
30103	  dotest_fail add-restricted-1 "$testcvs -Q add CVS"
30104
30105	  mkdir sdir
30106	  dotest add-restricted-2 "$testcvs -Q add sdir"
30107	  dotest_fail add-restricted-3 "$testcvs add sdir/CVS" \
30108"$PROG add: cannot add special file \`sdir/CVS'; skipping"
30109
30110	  if $keep; then
30111	    echo Keeping $TESTDIR and exiting due to --keep
30112	    exit 0
30113	  fi
30114	  cd ../..
30115	  rm -rf add-restricted $CVSROOT_DIRNAME/add-restricted
30116	;;
30117
30118
30119
30120	commit-d)
30121	  # Check that top-level commits work when CVS/Root
30122	  # is overridden by cvs -d.
30123
30124	  mkdir -p 1/subdir; cd 1
30125	  touch file1 subdir/file2
30126	  dotest commit-d-1 "$testcvs -Q import -m. c-d-c X Y" ""
30127	  dotest commit-d-2 "$testcvs -Q co c-d-c" ""
30128	  cd c-d-c
30129	  echo change >>file1; echo another change >>subdir/file2
30130	  # Changing working root, then override with -d
30131	  echo nosuchhost:/cvs > CVS/Root
30132	  dotest commit-d-3 "$testcvs -Q -d $CVSROOT commit -m." \
30133"Checking in file1;
30134${CVSROOT_DIRNAME}/c-d-c/file1,v  <--  file1
30135new revision: 1.2; previous revision: 1.1
30136done
30137Checking in subdir/file2;
30138${CVSROOT_DIRNAME}/c-d-c/subdir/file2,v  <--  file2
30139new revision: 1.2; previous revision: 1.1
30140done"
30141	  cd ../..
30142	  rm -rf 1 cvsroot/c-d-c
30143	  ;;
30144
30145	*)
30146	   echo $what is not the name of a test -- ignored
30147	   ;;
30148	esac
30149
30150    # Sanity check sanity.sh.  :)
30151    #
30152    # Test our exit directory so that tests that exit in an incorrect directory
30153    # are noticed during single test runs.
30154    #
30155    # FIXME?
30156    # Sparc Solaris 9 is dereferencing paths here as if /bin/pwd were
30157    # called when /tmp is a symlink.  This might be a new problem with this
30158    # test, but since this was recently tested I think it more likely to be
30159    # A Solaris issue.
30160    if test "x$TESTDIR" != "x`pwd`"; then
30161	    fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')"
30162    fi
30163
30164    # Reset val-tags to a pristine state.
30165    rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags
30166
30167    verify_tmp_empty "post $what"
30168
30169done # The big loop
30170
30171# Set up summary data for output.
30172skippedoutput=
30173warningsoutput=
30174extendedinfo=
30175if test $skipped -ne 0; then
30176  skippedoutput="$skipped test group"
30177  if test $skipped -ne 1; then
30178    skippedoutput="${skippedoutput}s"
30179  fi
30180  skippedoutput="$skippedoutput skipped"
30181fi
30182if test $warnings -ne 0; then
30183  warningsoutput="$warnings test"
30184  if test $warnings -ne 1; then
30185    warningsoutput="${warningsoutput}s"
30186  fi
30187  warningsoutput="$warningsoutput passed with warnings"
30188fi
30189if test -n "$skippedoutput" || test -n "$warningsoutput"; then
30190  extendedinfo=" ("
30191  if test -n "$skippedoutput"; then
30192    extendedinfo="$extendedinfo$skippedoutput"
30193  fi
30194  if test -n "$skippedoutput" && test -n "$warningsoutput"; then
30195    extendedinfo="$extendedinfo and "
30196  fi
30197  if test -n "$warningsoutput"; then
30198    extendedinfo="$extendedinfo$warningsoutput"
30199  fi
30200  extendedinfo="$extendedinfo)"
30201fi
30202
30203echo "OK, all $passed tests passed$extendedinfo."
30204
30205# TODO:
30206# * Test `cvs update -d foo' (where foo does not exist).
30207# * Test `cvs update foo bar' (where foo and bar are both from the
30208#   same directory in the repository).  Suppose one is a branch--make
30209#   sure that both directories get updated with the respective correct
30210#   thing.
30211# * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
30212#   foo/.././../bar foo/../bar etc.
30213# * Test all flags in modules file.
30214#   Test that ciprog gets run both on checkin in that directory, or a
30215#     higher-level checkin which recurses into it.
30216# * Test operations on a directory that contains other directories but has
30217#   no files of its own.
30218# * -t global option
30219# * cvs rm followed by cvs add or vice versa (with no checkin in between).
30220# * cvs rm twice (should be a nice error message).
30221# * -P option to checkout--(a) refrains from checking out new empty dirs,
30222#   (b) prunes empty dirs already there.
30223# * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
30224#   gives an appropriate error (e.g.
30225#     Cannot access ${TESTDIR}/non-existent/CVSROOT
30226#     No such file or directory).
30227#   (like basica-9, but for remote).
30228# * Test ability to send notifications in response to watches.  (currently
30229#   hard to test because CVS doesn't send notifications if username is the
30230#   same).
30231# * Test the contents of adm files other than Root and Repository.
30232#   Entries seems the next most important thing.
30233# * Test the following compatibility issues:
30234#   - The filler fields in "D" entries in CVS/Entries get preserved
30235#     (per cvs.texinfo).
30236#   - Unrecognized entry types in CVS/Entries get ignored (looks like
30237#     this needs to be documented in cvs.texinfo, but is not)
30238#   - Test that unrecognized files in CVS directories (e.g. CVS/Foobar)
30239#     are ignored (per cvs.texinfo).
30240#   - Test 'cvs history' with symlinks in the path to the working directory.
30241#   - Remove most of the CVS_SERVER stuff after a reasonable amount of time.
30242#     The "fork" & "client" series of tests should be left.  4/2/00, CVS
30243#     1.11.0.1 was altered so that it would default to program_name (set from
30244#     argv[0]) rather than "cvs", but I'd like this script to work on legacy
30245#     versions of CVS for awhile.
30246#   - Testsuite doesn't work with usernames over eight characters in length.
30247#     Fix it.
30248# End of TODO list.
30249
30250# Exit if keep set
30251if $keep; then
30252  echo "Keeping ${TESTDIR} and exiting due to -k (keep) option."
30253  exit 0
30254fi
30255
30256# Remove the test directory, but first change out of it.
30257cd `dirname ${TESTDIR}`
30258rm -rf ${TESTDIR}
30259
30260# end of sanity.sh
30261