xref: /openbsd/gnu/usr.bin/cvs/src/sanity.sh (revision 43c1707e)
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:
22exit_usage ()
23{
24    echo "Usage: `basename $0` [-kr] [-f FROM-TEST] CVS-TO-TEST [TESTS-TO-RUN...]" 1>&2
25    exit 2
26}
27# -r		test remote instead of local cvs.
28# -k 		try to keep directories created by individual tests around
29# -f FROM-TEST	run TESTS-TO-RUN, skipping all tests in the list before
30#		FROM-TEST
31#
32# TESTS-TO-RUN are the names of the tests to run; if omitted default to all tests.
33
34# See TODO list at end of file.
35
36# required to make this script work properly.
37unset CVSREAD
38
39# We want to invoke a predictable set of i18n behaviors, not whatever
40# the user running this script might have set.
41# In particular:
42#   'sort' and tabs and spaces (LC_COLLATE).
43#   Messages from getopt (LC_MESSAGES) (in the future, CVS itself might
44#     also alter its messages based on LC_MESSAGES).
45LC_ALL=C
46export LC_ALL
47
48
49
50#
51# read our options
52#
53unset fromtest
54keep=false
55remote=false
56while getopts f:kr option ; do
57    case "$option" in
58	f)
59	    fromtest="$OPTARG"
60	    ;;
61	k)
62	    # The -k (keep) option will eventually cause all the tests to leave around the
63	    # contents of the /tmp directory; right now only some implement it.  Not
64	    # originally intended to be useful with more than one test, but this should work
65	    # if each test uses a uniquely named dir (use the name of the test).
66	    keep=:
67	    ;;
68	r)
69	    remote=:
70	    ;;
71	\?)
72	    exit_usage
73	    ;;
74    esac
75done
76
77# boot the arguments we used above
78while test $OPTIND -gt 1 ; do
79    shift
80    OPTIND=`expr $OPTIND - 1`
81done
82
83# Use full path for CVS executable, so that CVS_SERVER gets set properly
84# for remote.
85case $1 in
86"")
87  exit_usage
88  ;;
89/*)
90  testcvs=$1
91  ;;
92*)
93  testcvs=`pwd`/$1
94  ;;
95esac
96shift
97
98
99
100###
101### GUTS
102###
103
104# "debugger"
105#set -x
106
107echo 'This test should produce no other output than this line, and a final "OK".'
108
109# Regexp to match what CVS will call itself in output that it prints.
110# FIXME: we don't properly quote this--if the name contains . we'll
111# just spuriously match a few things; if the name contains other regexp
112# special characters we are probably in big trouble.
113PROG=`basename ${testcvs}`
114
115# Regexp to match an author name.  I'm not really sure what characters
116# should be here.  a-zA-Z obviously.  People complained when 0-9 were
117# not allowed in usernames.  Other than that I'm not sure.
118username="[-a-zA-Z0-9][-a-zA-Z0-9]*"
119author="[-a-zA-Z0-9][-a-zA-Z0-9]*"
120hostname="[-_.a-zA-Z0-9]*"
121
122# Regexp to match the name of a temporary file (from cvs_temp_name).
123# This appears in certain diff output.
124tempname="[-a-zA-Z0-9/.%_]*"
125
126# Regexp to match a date in RFC822 format (as amended by RFC1123).
127RFCDATE="[a-zA-Z0-9 ][a-zA-Z0-9 ]* [0-9:][0-9:]* -0000"
128RFCDATE_EPOCH="1 Jan 1970 00:00:00 -0000"
129
130# On cygwin32, we may not have /bin/sh.
131if test -r /bin/sh; then
132  TESTSHELL="/bin/sh"
133else
134  TESTSHELL=`type -p sh 2>/dev/null`
135  if test ! -r "$TESTSHELL"; then
136    TESTSHELL="/bin/sh"
137  fi
138fi
139
140# FIXME: try things (what things? checkins?) without -m.
141#
142# Some of these tests are written to expect -Q.  But testing with
143# -Q is kind of bogus, it is not the way users actually use CVS (usually).
144# So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
145# and then they've obviously got to do something with the output....
146#
147CVS="${testcvs} -Q"
148
149LOGFILE=`pwd`/check.log
150
151# Save the previous log in case the person running the tests decides
152# they want to look at it.  The extension ".plog" is chosen for consistency
153# with dejagnu.
154if test -f check.log; then
155	mv check.log check.plog
156fi
157
158# The default value of /tmp/cvs-sanity for TESTDIR is dubious,
159# because it loses if two people/scripts try to run the tests
160# at the same time.  Some possible solutions:
161# 1.  Use /tmp/cvs-test$$.  One disadvantage is that the old
162#     cvs-test* directories would pile up, because they wouldn't
163#     necessarily get removed.
164# 2.  Have everyone/everything running the testsuite set
165#     TESTDIR to some appropriate directory.
166# 3.  Have the default value of TESTDIR be some variation of
167#     `pwd`/cvs-sanity.  The biggest problem here is that we have
168#     been fairly careful to test that CVS prints in messages the
169#     actual pathnames that we pass to it, rather than a different
170#     pathname for the same directory, as may come out of `pwd`.
171#     So this would be lost if everything was `pwd`-based.  I suppose
172#     if we wanted to get baroque we could start making symlinks
173#     to ensure the two are different.
174tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null`
175
176# Now:
177#	1) Set TESTDIR if it's not set already
178#	2) Remove any old test remnants
179#	3) Create $TESTDIR
180#	4) Normalize TESTDIR with `cd && (/bin/pwd || pwd)`
181#	   (This will match CVS output later)
182: ${TESTDIR=$tmp/cvs-sanity}
183# clean any old remnants (we need the chmod because some tests make
184# directories read-only)
185if test -d ${TESTDIR}; then
186    chmod -R a+wx ${TESTDIR}
187    rm -rf ${TESTDIR}
188fi
189# These exits are important.  The first time I tried this, if the `mkdir && cd`
190# failed then the build directory would get blown away.  Some people probably
191# wouldn't appreciate that.
192mkdir ${TESTDIR} || exit 1
193cd ${TESTDIR} || exit 1
194TESTDIR=`(/bin/pwd || pwd) 2>/dev/null`
195# Ensure $TESTDIR is absolute
196if test -z "${TESTDIR}" || echo "${TESTDIR}" |grep '^[^/]'; then
197    echo "Unable to resolve TESTDIR to an absolute directory." >&2
198    exit 1
199fi
200cd ${TESTDIR}
201
202# Make sure various tools work the way we expect, or try to find
203# versions that do.
204: ${AWK=awk}
205: ${EXPR=expr}
206: ${ID=id}
207: ${TR=tr}
208
209find_tool ()
210{
211  GLOCS="`echo $PATH | sed 's/:/ /g'` /usr/local/bin /usr/contrib/bin /usr/gnu/bin /local/bin /local/gnu/bin /gnu/bin"
212  TOOL=""
213  for path in $GLOCS ; do
214    if test -x $path/g$1 ; then
215      RES="`$path/g$1 --version </dev/null 2>/dev/null`"
216      if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
217        TOOL=$path/g$1
218        break
219      fi
220    fi
221    if test -x $path/$1 ; then
222      RES="`$path/$1 --version </dev/null 2>/dev/null`"
223      if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
224        TOOL=$path/$1
225        break
226      fi
227    fi
228  done
229  if test -z "$TOOL"; then
230    :
231  else
232    echo "Notice: The default version of \`$1' is defective, using" >&2
233    echo "\`$TOOL' instead." >&2
234  fi
235  echo "$TOOL"
236}
237
238# You can't run CVS as root; print a nice error message here instead
239# of somewhere later, after making a mess.
240#
241# FIXME - find_tool() finds the 'gid' from GNU id-utils if I pull 'id' out of
242# my path.
243for pass in false :; do
244  case "`$ID -u 2>/dev/null`" in
245    "0")
246      echo "Test suite does not work correctly when run as root" >&2
247      exit 1
248      ;;
249
250    "")
251      if $pass; then :; else
252	ID=`find_tool id`
253      fi
254      if $pass || test -z "$ID" ; then
255	echo "Running these tests requires an \`id' program that understands the" >&2
256	echo "-u and -n flags.  Make sure that such an id (GNU, or many but not" >&2
257	echo "all vendor-supplied versions) is in your path." >&2
258	exit 1
259      fi
260      ;;
261
262    *)
263      break
264      ;;
265  esac
266done
267username=`$ID -un`
268if $EXPR "${username}" : "${username}" >/dev/null; then
269  : good, it works
270else
271  echo "Test suite does not work correctly when run by a username" >&2
272  echo "containing regular expression meta-characters." >&2
273  exit 1
274fi
275
276# Cause NextStep 3.3 users to lose in a more graceful fashion.
277if $EXPR 'abc
278def' : 'abc
279def' >/dev/null; then
280  : good, it works
281else
282  EXPR=`find_tool expr`
283  if test -z "$EXPR" ; then
284    echo 'Running these tests requires an "expr" program that can handle' >&2
285    echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but' >&2
286    echo 'not all vendor-supplied versions) is in your path.' >&2
287    exit 1
288  fi
289fi
290
291# Warn SunOS, SysVr3.2, etc., users that they may be partially losing
292# if we can't find a GNU expr to ease their troubles...
293if $EXPR 'a
294b' : 'a
295c' >/dev/null; then
296  EXPR=`find_tool expr`
297  if test -z "$EXPR" ; then
298    echo 'Warning: you are using a version of expr which does not correctly'
299    echo 'match multi-line patterns.  Some tests may spuriously pass.'
300    echo 'You may wish to make sure GNU expr is in your path.'
301    EXPR=expr
302  fi
303else
304  : good, it works
305fi
306
307# More SunOS lossage...
308echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo
309cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
310cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo
311cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
312if $EXPR "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then
313  : good, it works
314else
315  EXPR=`find_tool expr`
316  if test -z "$EXPR" ; then
317    echo 'Warning: you are using a version of expr which does not correctly'
318    echo 'match large patterns.  Some tests may spuriously fail.'
319    echo 'You may wish to make sure GNU expr is in your path.'
320    EXPR=expr
321  fi
322fi
323if $EXPR "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then
324  EXPR=`find_tool expr`
325  if test -z "$EXPR" ; then
326    echo 'Warning: you are using a version of expr which does not correctly'
327    echo 'match large patterns.  Some tests may spuriously pass.'
328    echo 'You may wish to make sure GNU expr is in your path.'
329    EXPR=expr
330  fi
331else
332  : good, it works
333fi
334
335# That we should have to do this is total bogosity, but GNU expr
336# version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix
337# (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
338# next release of GNU expr after 1.12 (but we still have to cater to the old
339# ones for some time because they are in many linux distributions).
340ENDANCHOR="$"
341if $EXPR 'abc
342def' : 'abc$' >/dev/null; then
343  ENDANCHOR='\'\'
344fi
345
346# Work around another GNU expr (version 1.10-1.12) bug/incompatibility.
347# "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
348# Note that the workaround is not a complete equivalent of .* because
349# the first parenthesized expression in the regexp must match something
350# in order for expr to return a successful exit status.
351# Rumor has it this will be fixed in the
352# next release of GNU expr after 1.12 (but we still have to cater to the old
353# ones for some time because they are in many linux distributions).
354DOTSTAR='.*'
355if $EXPR 'abc
356def' : "a${DOTSTAR}f" >/dev/null; then
357  : good, it works
358else
359  DOTSTAR='\(.\|
360\)*'
361fi
362
363# Now that we have DOTSTAR, make sure it works with big matches
364if $EXPR "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then
365  : good, it works
366else
367  EXPR=`find_tool expr`
368  if test -z "$EXPR" ; then
369    echo 'Warning: you are using a version of expr which does not correctly'
370    echo 'match large patterns.  Some tests may spuriously fail.'
371    echo 'You may wish to make sure GNU expr is in your path.'
372    EXPR=expr
373  fi
374fi
375
376rm -f ${TESTDIR}/foo ${TESTDIR}/bar
377
378# Work around yet another GNU expr (version 1.10) bug/incompatibility.
379# "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
380# it is not.  I doubt that POSIX allows us to use \+ and assume it means
381# (non-special) +, so here is another workaround
382# Rumor has it this will be fixed in the
383# next release of GNU expr after 1.12 (but we still have to cater to the old
384# ones for some time because they are in many linux distributions).
385PLUS='+'
386if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
387  : good, it works
388else
389  PLUS='\+'
390fi
391
392# Likewise, for ?
393QUESTION='?'
394if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
395  : good, it works
396else
397  QUESTION='\?'
398fi
399
400# now make sure that tr works on NULs
401if $EXPR `echo "123" | ${TR} '2' '\0'` : "123" >/dev/null; then
402  TR=`find_tool tr`
403  if test -z "$TR" ; then
404    echo 'Warning: you are using a version of tr which does not correctly'
405    echo 'handle NUL bytes.  Some tests may spuriously pass or fail.'
406    echo 'You may wish to make sure GNU tr is in your path.'
407    TR=tr
408  fi
409else
410  : good, it works
411fi
412
413pass ()
414{
415  echo "PASS: $1" >>${LOGFILE}
416}
417
418fail ()
419{
420  echo "FAIL: $1" | tee -a ${LOGFILE}
421  # This way the tester can go and see what remnants were left
422  exit 1
423}
424
425# See dotest and dotest_fail for explanation (this is the parts
426# of the implementation common to the two).
427dotest_internal ()
428{
429  if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$3${ENDANCHOR}" >/dev/null; then
430    # Why, I hear you ask, do we write this to the logfile
431    # even when the test passes?  The reason is that the test
432    # may give us the regexp which we were supposed to match,
433    # but sometimes it may be useful to look at the exact
434    # text which was output.  For example, suppose one wants
435    # to grep for a particular warning, and make _sure_ that
436    # CVS never hits it (even in cases where the tests might
437    # match it with .*).  Or suppose one wants to see the exact
438    # date format output in a certain case (where the test will
439    # surely use a somewhat non-specific pattern).
440    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
441    pass "$1"
442  # expr can't distinguish between "zero characters matched" and "no match",
443  # so special-case it.
444  elif test -z "$3" && test ! -s ${TESTDIR}/dotest.tmp; then
445    pass "$1"
446  elif test x"$4" != x; then
447    if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$4${ENDANCHOR}" >/dev/null; then
448      cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
449      pass "$1"
450    else
451      echo "** expected: " >>${LOGFILE}
452      echo "$3" >>${LOGFILE}
453      echo "$3" > ${TESTDIR}/dotest.ex1
454      echo "** or: " >>${LOGFILE}
455      echo "$4" >>${LOGFILE}
456      echo "$4" > ${TESTDIR}/dotest.ex2
457      echo "** got: " >>${LOGFILE}
458      cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
459      fail "$1"
460    fi
461  else
462    echo "** expected: " >>${LOGFILE}
463    echo "$3" >>${LOGFILE}
464    echo "$3" > ${TESTDIR}/dotest.exp
465    echo "** got: " >>${LOGFILE}
466    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
467    fail "$1"
468  fi
469}
470
471dotest_all_in_one ()
472{
473  if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
474         "`cat ${TESTDIR}/dotest.exp`" >/dev/null; then
475    return 0
476  fi
477  return 1
478}
479
480# WARNING: this won't work with REs that match newlines....
481#
482dotest_line_by_line ()
483{
484  line=1
485  while [ $line -le `wc -l <${TESTDIR}/dotest.tmp` ] ; do
486    if $EXPR "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" : \
487       "`sed -n ${line}p ${TESTDIR}/dotest.exp`" >/dev/null; then
488      :
489    elif test -z "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" &&
490       test -z "`sed -n ${line}p ${TESTDIR}/dotest.exp`"; then
491      :
492    else
493      echo "Line $line:" >> ${LOGFILE}
494      echo "**** expected: " >>${LOGFILE}
495      sed -n ${line}p ${TESTDIR}/dotest.exp >>${LOGFILE}
496      echo "**** got: " >>${LOGFILE}
497      sed -n ${line}p ${TESTDIR}/dotest.tmp >>${LOGFILE}
498      unset line
499      return 1
500    fi
501    line=`expr $line + 1`
502  done
503  unset line
504  return 0
505}
506
507# If you are having trouble telling which line of a multi-line
508# expression is not being matched, replace calls to dotest_internal()
509# with calls to this function:
510#
511dotest_internal_debug ()
512{
513  if test -z "$3"; then
514    if test -s ${TESTDIR}/dotest.tmp; then
515      echo "** expected: " >>${LOGFILE}
516      echo "$3" >>${LOGFILE}
517      echo "$3" > ${TESTDIR}/dotest.exp
518      rm -f ${TESTDIR}/dotest.ex2
519      echo "** got: " >>${LOGFILE}
520      cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
521      fail "$1"
522    else
523      pass "$1"
524    fi
525  else
526    echo "$3" > ${TESTDIR}/dotest.exp
527    if dotest_line_by_line "$1" "$2"; then
528      pass "$1"
529    else
530      if test x"$4" != x; then
531	mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1
532	echo "$4" > ${TESTDIR}/dotest.exp
533	if dotest_line_by_line "$1" "$2"; then
534	  pass "$1"
535	else
536	  mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2
537	  echo "** expected: " >>${LOGFILE}
538	  echo "$3" >>${LOGFILE}
539	  echo "** or: " >>${LOGFILE}
540	  echo "$4" >>${LOGFILE}
541	  echo "** got: " >>${LOGFILE}
542	  cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
543	  fail "$1"
544	fi
545      else
546	echo "** expected: " >>${LOGFILE}
547	echo "$3" >>${LOGFILE}
548	echo "** got: " >>${LOGFILE}
549	cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
550	fail "$1"
551      fi
552    fi
553  fi
554}
555
556# Usage:
557#  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
558# TESTNAME is the name used in the log to identify the test.
559# COMMAND is the command to run; for the test to pass, it exits with
560# exitstatus zero.
561# OUTPUT is a regexp which is compared against the output (stdout and
562# stderr combined) from the test.  It is anchored to the start and end
563# of the output, so should start or end with ".*" if that is what is desired.
564# Trailing newlines are stripped from the command's actual output before
565# matching against OUTPUT.
566# If OUTPUT2 is specified and the output matches it, then it is also
567# a pass (partial workaround for the fact that some versions of expr
568# lack \|).
569dotest ()
570{
571  rm -f ${TESTDIR}/dotest.ex? 2>&1
572  eval "$2" >${TESTDIR}/dotest.tmp 2>&1
573  status=$?
574  if test "$status" != 0; then
575    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
576    echo "exit status was $status" >>${LOGFILE}
577    fail "$1"
578  fi
579  dotest_internal "$@"
580}
581
582# Like dotest except only 2 args and result must exactly match stdin
583dotest_lit ()
584{
585  rm -f ${TESTDIR}/dotest.ex? 2>&1
586  eval "$2" >${TESTDIR}/dotest.tmp 2>&1
587  status=$?
588  if test "$status" != 0; then
589    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
590    echo "exit status was $status" >>${LOGFILE}
591    fail "$1"
592  fi
593  cat >${TESTDIR}/dotest.exp
594  if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
595    pass "$1"
596  else
597    echo "** expected: " >>${LOGFILE}
598    cat ${TESTDIR}/dotest.exp >>${LOGFILE}
599    echo "** got: " >>${LOGFILE}
600    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
601    fail "$1"
602  fi
603}
604
605# Like dotest except exitstatus should be nonzero.
606dotest_fail ()
607{
608  rm -f ${TESTDIR}/dotest.ex? 2>&1
609  eval "$2" >${TESTDIR}/dotest.tmp 2>&1
610  status=$?
611  if test "$status" = 0; then
612    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
613    echo "exit status was $status" >>${LOGFILE}
614    fail "$1"
615  fi
616  dotest_internal "$@"
617}
618
619# Like dotest except second argument is the required exitstatus.
620dotest_status ()
621{
622  eval "$3" >${TESTDIR}/dotest.tmp 2>&1
623  status=$?
624  if test "$status" != "$2"; then
625    cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
626    echo "exit status was $status; expected $2" >>${LOGFILE}
627    fail "$1"
628  fi
629  dotest_internal "$1" "$3" "$4" "$5"
630}
631
632# Like dotest except output is sorted.
633dotest_sort ()
634{
635  rm -f ${TESTDIR}/dotest.ex? 2>&1
636  eval "$2" >${TESTDIR}/dotest.tmp1 2>&1
637  status=$?
638  if test "$status" != 0; then
639    cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
640    echo "exit status was $status" >>${LOGFILE}
641    fail "$1"
642  fi
643  ${TR} '	' ' ' < ${TESTDIR}/dotest.tmp1 | sort > ${TESTDIR}/dotest.tmp
644  dotest_internal "$@"
645}
646
647# Avoid picking up any stray .cvsrc, etc., from the user running the tests
648mkdir home
649HOME=${TESTDIR}/home; export HOME
650
651# Make sure this variable is not defined to anything that would
652# change the format of rcs dates.  Otherwise people using e.g.,
653# RCSINIT=-zLT get lots of spurious failures.
654RCSINIT=; export RCSINIT
655
656# Remaining arguments are the names of tests to run.
657#
658# The testsuite is broken up into (hopefully manageably-sized)
659# independently runnable tests, so that one can quickly get a result
660# from a cvs or testsuite change, and to facilitate understanding the
661# tests.
662
663if test x"$*" = x; then
664	# Basic/miscellaneous functionality
665	tests="version basica basicb basicc basic1 deep basic2"
666	tests="${tests} files spacefiles commit-readonly"
667	# Branching, tagging, removing, adding, multiple directories
668	tests="${tests} rdiff diff death death2 rm-update-message rmadd rmadd2"
669	tests="${tests} dirs dirs2 branches branches2 tagc tagf"
670	tests="${tests} rcslib multibranch import importb importc"
671	tests="${tests} import-after-initial"
672	tests="${tests} join join2 join3 join-readonly-conflict"
673	tests="${tests} join-admin join-admin-2"
674	tests="${tests} new newb conflicts conflicts2 conflicts3"
675	tests="${tests} clean"
676	# Checking out various places (modules, checkout -d, &c)
677	tests="${tests} modules modules2 modules3 modules4 modules5"
678	tests="${tests} mkmodules-temp-file-removal"
679	tests="${tests} cvsadm emptydir abspath toplevel toplevel2"
680	# Log messages, error messages.
681	tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg"
682	# Watches, binary files, history browsing, &c.
683	tests="${tests} devcom devcom2 devcom3 watch4 watch5"
684	tests="${tests} unedit-without-baserev"
685	tests="${tests} ignore ignore-on-branch binfiles binfiles2 binfiles3"
686	tests="${tests} mcopy binwrap binwrap2"
687	tests="${tests} binwrap3 mwrap info taginfo config"
688	tests="${tests} serverpatch log log2 logopt ann ann-id"
689	# Repository Storage (RCS file format, CVS lock files, creating
690	# a repository without "cvs init", &c).
691	tests="${tests} crerepos rcs rcs2 rcs3 lockfiles backuprecover"
692	# More history browsing, &c.
693	tests="${tests} history"
694	tests="${tests} big modes modes2 modes3 stamps"
695	# PreservePermissions stuff: permissions, symlinks et al.
696	# tests="${tests} perms symlinks symlinks2 hardlinks"
697	# More tag and branch tests, keywords.
698	tests="${tests} sticky keyword keyword2 keywordlog"
699	tests="${tests} head tagdate multibranch2 tag8k"
700	# "cvs admin", reserved checkouts.
701	tests="${tests} admin reserved"
702	# Nuts and bolts of diffing/merging (diff library, &c)
703	tests="${tests} diffmerge1 diffmerge2"
704	# Release of multiple directories
705	tests="${tests} release"
706	# Multiple root directories and low-level protocol tests.
707	tests="${tests} multiroot multiroot2 multiroot3 multiroot4"
708	tests="${tests} rmroot reposmv pserver server server2 client"
709	tests="${tests} fork"
710else
711	tests="$*"
712fi
713
714# a simple function to compare directory contents
715#
716# Returns: 0 for same, 1 for different
717#
718directory_cmp ()
719{
720	OLDPWD=`pwd`
721	DIR_1=$1
722	DIR_2=$2
723
724	cd $DIR_1
725	find . -print | fgrep -v /CVS | sort > /tmp/dc$$d1
726
727	# go back where we were to avoid symlink hell...
728	cd $OLDPWD
729	cd $DIR_2
730	find . -print | fgrep -v /CVS | sort > /tmp/dc$$d2
731
732	if diff /tmp/dc$$d1 /tmp/dc$$d2 >/dev/null 2>&1
733	then
734		:
735	else
736		return 1
737	fi
738	cd $OLDPWD
739	while read a
740	do
741		if test -f $DIR_1/"$a" ; then
742			cmp -s $DIR_1/"$a" $DIR_2/"$a"
743			if test $? -ne 0 ; then
744				return 1
745			fi
746		fi
747	done < /tmp/dc$$d1
748	rm -f /tmp/dc$$*
749	return 0
750}
751
752
753
754#
755# The following 4 functions are used by the diffmerge1 test case.  They set up,
756# respectively, the four versions of the files necessary:
757#
758#	1.  Ancestor revisions.
759#	2.  "Your" changes.
760#	3.  "My" changes.
761#	4.  Expected merge result.
762#
763
764# Create ancestor revisions for diffmerge1
765diffmerge_create_older_files() {
766	  # This test case was supplied by Noah Friedman:
767	  cat >testcase01 <<EOF
768// Button.java
769
770package random.application;
771
772import random.util.*;
773
774public class Button
775{
776  /* Instantiates a Button with origin (0, 0) and zero width and height.
777   * You must call an initializer method to properly initialize the Button.
778   */
779  public Button ()
780  {
781    super ();
782
783    _titleColor = Color.black;
784    _disabledTitleColor = Color.gray;
785    _titleFont = Font.defaultFont ();
786  }
787
788  /* Convenience constructor for instantiating a Button with
789   * bounds x, y, width, and height.  Equivalent to
790   *     foo = new Button ();
791   *     foo.init (x, y, width, height);
792   */
793  public Button (int x, int y, int width, int height)
794  {
795    this ();
796    init (x, y, width, height);
797  }
798}
799EOF
800
801	  # This test case was supplied by Jacob Burckhardt:
802	  cat >testcase02 <<EOF
803a
804a
805a
806a
807a
808EOF
809
810	  # This test case was supplied by Karl Tomlinson who also wrote the
811	  # patch which lets CVS correctly handle this and several other cases:
812	  cat >testcase03 <<EOF
813x
814s
815a
816b
817s
818y
819EOF
820
821	  # This test case was supplied by Karl Tomlinson:
822	  cat >testcase04 <<EOF
823s
824x
825m
826m
827x
828s
829v
830s
831x
832m
833m
834x
835s
836EOF
837
838	  # This test case was supplied by Karl Tomlinson:
839	  cat >testcase05 <<EOF
840s
841x
842m
843m
844x
845x
846x
847x
848x
849x
850x
851x
852x
853x
854s
855s
856s
857s
858s
859s
860s
861s
862s
863s
864v
865EOF
866
867	  # This test case was supplied by Jacob Burckhardt:
868	  cat >testcase06 <<EOF
869g
870
871
872
873
874
875
876
877
878
879
880
881i
882EOF
883
884	  # This test is supposed to verify that the horizon lines are the same
885	  # for both 2-way diffs, but unfortunately, it does not fail with the
886	  # old version of cvs.  However, Karl Tomlinson still thought it would
887	  # be good to test it anyway:
888	  cat >testcase07 <<EOF
889h
890f
891
892
893
894
895
896
897
898
899
900g
901r
902
903
904
905i
906
907
908
909
910
911
912
913
914
915
916i
917EOF
918
919	  # This test case was supplied by Jacob Burckhardt:
920	  cat >testcase08 <<EOF
921Both changes move this line to the end of the file.
922
923no
924changes
925here
926
927First change will delete this line.
928
929First change will also delete this line.
930
931    no
932    changes
933    here
934
935Second change will change it here.
936
937        no
938        changes
939        here
940EOF
941
942	  # This test case was supplied by Jacob Burckhardt.  Note that I do not
943	  # think cvs has ever failed with this case, but I include it anyway,
944	  # since I think it is a hard case.  It is hard because Peter Miller's
945	  # fmerge utility fails on it:
946	  cat >testcase09 <<EOF
947m
948a
949{
950}
951b
952{
953}
954EOF
955
956	  # This test case was supplied by Martin Dorey and simplified by Jacob
957	  # Burckhardt:
958	  cat >testcase10 <<EOF
959
960    petRpY ( MtatRk );
961    fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
962
963    MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
964    OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
965
966    Bloke_GttpfIRte_MtpeaL ( &acI );
967MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
968{
969    fV ( Y < 16 )
970    {
971        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
972                                                      Y * jfle_Uecopd_MfJe_fY_Mectopk,
973                                jfle_Uecopd_MfJe_fY_Mectopk,
974                                nRVVep ) );
975    }
976    elke
977    {
978        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
979                                                 ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
980                                jfle_Uecopd_MfJe_fY_Mectopk,
981                                nRVVep ) );
982    }
983
984}
985
986
987/****************************************************************************
988*                                                                           *
989*   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
990*                                                                           *
991****************************************************************************/
992
993MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
994{
995MTGTXM MtatRk = Zy;
996
997    MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
998
999    petRpY ( MtatRk );
1000
1001}
1002    HfkQipfte ( waYdle,                 /*  waYdle                         */
1003                waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1004                (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1005                0,                      /*  MRrepVlRoRk KfxoYfkL           */
1006                beYgtz                  /*  nEtek to Apfte                 */
1007              );
1008
1009    petRpY ( Zy );
1010}
1011EOF
1012}
1013
1014# Create "your" revisions for diffmerge1
1015diffmerge_create_your_files() {
1016	  # remove the Button() method
1017	  cat >testcase01 <<\EOF
1018// Button.java
1019
1020package random.application;
1021
1022import random.util.*;
1023
1024public class Button
1025{
1026  /* Instantiates a Button with origin (0, 0) and zero width and height.
1027   * You must call an initializer method to properly initialize the Button.
1028   */
1029  public Button ()
1030  {
1031    super ();
1032
1033    _titleColor = Color.black;
1034    _disabledTitleColor = Color.gray;
1035    _titleFont = Font.defaultFont ();
1036  }
1037}
1038EOF
1039
1040	  cat >testcase02 <<\EOF
1041y
1042a
1043a
1044a
1045a
1046EOF
1047
1048	  cat >testcase03 <<\EOF
1049x
1050s
1051a
1052b
1053s
1054b
1055s
1056y
1057EOF
1058
1059	  cat >testcase04 <<\EOF
1060s
1061m
1062s
1063v
1064s
1065m
1066s
1067EOF
1068
1069	  cat >testcase05 <<\EOF
1070v
1071s
1072m
1073s
1074s
1075s
1076s
1077s
1078s
1079s
1080s
1081s
1082s
1083v
1084EOF
1085
1086	  # Test case 6 and test case 7 both use the same input files, but they
1087	  # order the input files differently.  In one case, a certain file is
1088	  # used as the older file, but in the other test case, that same file
1089	  # is used as the file which has changes.  I could have put echo
1090	  # commands here, but since the echo lines would be the same as those
1091	  # in the previous function, I decided to save space and avoid repeating
1092	  # several lines of code.  Instead, I merely swap the files:
1093	  mv testcase07 tmp
1094	  mv testcase06 testcase07
1095	  mv tmp testcase06
1096
1097	  # Make the date newer so that cvs thinks that the files are changed:
1098	  touch testcase06 testcase07
1099
1100	  cat >testcase08 <<\EOF
1101no
1102changes
1103here
1104
1105First change has now added this in.
1106
1107    no
1108    changes
1109    here
1110
1111Second change will change it here.
1112
1113        no
1114        changes
1115        here
1116
1117Both changes move this line to the end of the file.
1118EOF
1119
1120	  cat >testcase09 <<\EOF
1121
1122m
1123a
1124{
1125}
1126b
1127{
1128}
1129c
1130{
1131}
1132EOF
1133
1134	  cat >testcase10 <<\EOF
1135
1136    fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
1137
1138    petRpY ( MtatRk );
1139    fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1140
1141    fV ( jfle_Uecopd_KRLIep < 16 )
1142    {
1143        MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
1144    }
1145    elke
1146    {
1147        MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
1148        fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1149
1150        MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1151        OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1152
1153    Bloke_GttpfIRte_MtpeaL ( &acI );
1154MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1155{
1156MTGTXM MtatRk = Zy;
1157
1158    fV ( Y < 16 )
1159    {
1160        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1161                                                      Y * jfle_Uecopd_MfJe_fY_Mectopk,
1162                                jfle_Uecopd_MfJe_fY_Mectopk,
1163                                nRVVep ) );
1164    }
1165    elke
1166    {
1167        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1168                                                 ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1169                                jfle_Uecopd_MfJe_fY_Mectopk,
1170                                nRVVep ) );
1171    }
1172
1173    petRpY ( MtatRk );
1174
1175}
1176
1177
1178/****************************************************************************
1179*                                                                           *
1180*   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1181*                                                                           *
1182****************************************************************************/
1183
1184MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1185{
1186MTGTXM MtatRk = Zy;
1187
1188    MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1189
1190    petRpY ( MtatRk );
1191
1192}
1193    HfkQipfte ( waYdle,                 /*  waYdle                         */
1194                waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1195                (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1196                0,                      /*  MRrepVlRoRk KfxoYfkL           */
1197                beYgtz                  /*  nEtek to Apfte                 */
1198              );
1199
1200    petRpY ( Zy );
1201}
1202
1203EOF
1204}
1205
1206# Create "my" revisions for diffmerge1
1207diffmerge_create_my_files() {
1208          # My working copy still has the Button() method, but I
1209	  # comment out some code at the top of the class.
1210	  cat >testcase01 <<\EOF
1211// Button.java
1212
1213package random.application;
1214
1215import random.util.*;
1216
1217public class Button
1218{
1219  /* Instantiates a Button with origin (0, 0) and zero width and height.
1220   * You must call an initializer method to properly initialize the Button.
1221   */
1222  public Button ()
1223  {
1224    super ();
1225
1226    // _titleColor = Color.black;
1227    // _disabledTitleColor = Color.gray;
1228    // _titleFont = Font.defaultFont ();
1229  }
1230
1231  /* Convenience constructor for instantiating a Button with
1232   * bounds x, y, width, and height.  Equivalent to
1233   *     foo = new Button ();
1234   *     foo.init (x, y, width, height);
1235   */
1236  public Button (int x, int y, int width, int height)
1237  {
1238    this ();
1239    init (x, y, width, height);
1240  }
1241}
1242EOF
1243
1244	  cat >testcase02 <<\EOF
1245a
1246a
1247a
1248a
1249m
1250EOF
1251
1252	  cat >testcase03 <<\EOF
1253x
1254s
1255c
1256s
1257b
1258s
1259y
1260EOF
1261
1262	  cat >testcase04 <<\EOF
1263v
1264s
1265x
1266m
1267m
1268x
1269s
1270v
1271s
1272x
1273m
1274m
1275x
1276s
1277v
1278EOF
1279
1280	  # Note that in test case 5, there are no changes in the "mine"
1281	  # section, which explains why there is no command here which writes to
1282	  # file testcase05.
1283
1284	  # no changes for testcase06
1285
1286	  # The two branches make the same changes:
1287	  cp ../yours/testcase07 .
1288
1289	  cat >testcase08 <<\EOF
1290no
1291changes
1292here
1293
1294First change will delete this line.
1295
1296First change will also delete this line.
1297
1298    no
1299    changes
1300    here
1301
1302Second change has now changed it here.
1303
1304        no
1305        changes
1306        here
1307
1308Both changes move this line to the end of the file.
1309EOF
1310
1311	  cat >testcase09 <<\EOF
1312m
1313a
1314{
1315}
1316b
1317{
1318}
1319c
1320{
1321}
1322EOF
1323
1324	  cat >testcase10 <<\EOF
1325
1326    petRpY ( MtatRk );
1327    fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1328
1329    MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1330    OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1331
1332    Bloke_GttpfIRte_MtpeaL ( &acI );
1333MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1334{
1335    fV ( Y < 16 )
1336    {
1337        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1338                                                      Y * jfle_Uecopd_MfJe_fY_Mectopk,
1339                                jfle_Uecopd_MfJe_fY_Mectopk,
1340                                nRVVep ) );
1341    }
1342    elke
1343    {
1344        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1345                                                 ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1346                                jfle_Uecopd_MfJe_fY_Mectopk,
1347                                nRVVep ) );
1348    }
1349
1350}
1351
1352
1353/****************************************************************************
1354*                                                                           *
1355*   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1356*                                                                           *
1357****************************************************************************/
1358
1359MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1360{
1361MTGTXM MtatRk = Zy;
1362
1363    MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1364
1365    petRpY ( MtatRk );
1366
1367}
1368    HfkQipfte ( waYdle,                 /*  waYdle                         */
1369                waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1370                (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1371                beYgtz                  /*  nEtek to Apfte                 */
1372              );
1373
1374    petRpY ( Zy );
1375}
1376
1377EOF
1378}
1379
1380# Create expected results of merge for diffmerge1
1381diffmerge_create_expected_files() {
1382	  cat >testcase01 <<\EOF
1383// Button.java
1384
1385package random.application;
1386
1387import random.util.*;
1388
1389public class Button
1390{
1391  /* Instantiates a Button with origin (0, 0) and zero width and height.
1392   * You must call an initializer method to properly initialize the Button.
1393   */
1394  public Button ()
1395  {
1396    super ();
1397
1398    // _titleColor = Color.black;
1399    // _disabledTitleColor = Color.gray;
1400    // _titleFont = Font.defaultFont ();
1401  }
1402}
1403EOF
1404
1405	  cat >testcase02 <<\EOF
1406y
1407a
1408a
1409a
1410m
1411EOF
1412
1413	  cat >testcase03 <<\EOF
1414x
1415s
1416c
1417s
1418b
1419s
1420b
1421s
1422y
1423EOF
1424
1425	  cat >testcase04 <<\EOF
1426v
1427s
1428m
1429s
1430v
1431s
1432m
1433s
1434v
1435EOF
1436
1437	  # Since there are no changes in the "mine" section, just take exactly
1438	  # the version in the "yours" section:
1439	  cp ../yours/testcase05 .
1440
1441	  cp ../yours/testcase06 .
1442
1443	  # Since the two branches make the same changes, the result should be
1444	  # the same as both branches.  Here, I happen to pick yours to copy from,
1445	  # but I could have also picked mine, since the source of the copy is
1446	  # the same in either case.  However, the mine has already been
1447	  # altered by the update command, so don't use it.  Instead, use the
1448	  # yours section which has not had an update on it and so is unchanged:
1449	  cp ../yours/testcase07 .
1450
1451	  cat >testcase08 <<\EOF
1452no
1453changes
1454here
1455
1456First change has now added this in.
1457
1458    no
1459    changes
1460    here
1461
1462Second change has now changed it here.
1463
1464        no
1465        changes
1466        here
1467
1468Both changes move this line to the end of the file.
1469EOF
1470
1471	  cat >testcase09 <<\EOF
1472
1473m
1474a
1475{
1476}
1477b
1478{
1479}
1480c
1481{
1482}
1483EOF
1484
1485	  cat >testcase10 <<\EOF
1486
1487    fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
1488
1489    petRpY ( MtatRk );
1490    fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1491
1492    fV ( jfle_Uecopd_KRLIep < 16 )
1493    {
1494        MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
1495    }
1496    elke
1497    {
1498        MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
1499        fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
1500
1501        MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
1502        OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
1503
1504    Bloke_GttpfIRte_MtpeaL ( &acI );
1505MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
1506{
1507MTGTXM MtatRk = Zy;
1508
1509    fV ( Y < 16 )
1510    {
1511        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1512                                                      Y * jfle_Uecopd_MfJe_fY_Mectopk,
1513                                jfle_Uecopd_MfJe_fY_Mectopk,
1514                                nRVVep ) );
1515    }
1516    elke
1517    {
1518        petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
1519                                                 ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
1520                                jfle_Uecopd_MfJe_fY_Mectopk,
1521                                nRVVep ) );
1522    }
1523
1524    petRpY ( MtatRk );
1525
1526}
1527
1528
1529/****************************************************************************
1530*                                                                           *
1531*   Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY )                      *
1532*                                                                           *
1533****************************************************************************/
1534
1535MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
1536{
1537MTGTXM MtatRk = Zy;
1538
1539    MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
1540
1541    petRpY ( MtatRk );
1542
1543}
1544    HfkQipfte ( waYdle,                 /*  waYdle                         */
1545                waYdleFok,              /*  ZVVket VpoL ktapt oV dfkQ      */
1546                (coYkt RfYt8*) nRVVep,  /*  nRVVep                         */
1547                beYgtz                  /*  nEtek to Apfte                 */
1548              );
1549
1550    petRpY ( Zy );
1551}
1552
1553EOF
1554}
1555
1556# Set up CVSROOT (the crerepos tests will test operating without CVSROOT set).
1557CVSROOT_DIRNAME=${TESTDIR}/cvsroot
1558if $remote; then
1559	# Currently we test :fork: and :ext: (see crerepos test).
1560	# Testing :pserver: would be hard (inetd issues).
1561	# Also :ext: and :fork support CVS_SERVER in a convenient way.
1562	# If you want to edit this script to change the next line to
1563	# :ext:, you can run the tests that way.  There is a known
1564	# difference in modes-15 (see comments there).
1565	CVSROOT=:fork:${CVSROOT_DIRNAME} ; export CVSROOT
1566	CVS_SERVER=${testcvs}; export CVS_SERVER
1567else
1568	CVSROOT=${CVSROOT_DIRNAME} ; export CVSROOT
1569fi
1570
1571dotest 1 "${testcvs} init" ''
1572dotest 1a "${testcvs} init" ''
1573
1574### The big loop
1575for what in $tests; do
1576	if test -n "$fromtest" ; then
1577	    if test $fromtest = $what ; then
1578		unset fromtest
1579	    else
1580		continue
1581	    fi
1582	fi
1583	case $what in
1584
1585	version)
1586	  # We've had cases where the version command started dumping core,
1587	  # so we might as well test it
1588	  dotest version-1 "${testcvs} --version" \
1589'
1590Concurrent Versions System (CVS) [0-9.]*.*
1591
1592Copyright (c) [-0-9]* Brian Berliner, david d .zoo. zuhn,
1593                        Jeff Polk, and other authors
1594
1595CVS may be copied only under the terms of the GNU General Public License,
1596a copy of which can be found with the CVS distribution kit.
1597
1598Specify the --help option for further information about CVS'
1599
1600	  if $remote; then
1601		dotest version-2r "${testcvs} version" \
1602'Client: Concurrent Versions System (CVS) [0-9.]* (client/server)
1603Server: Concurrent Versions System (CVS) [0-9.]* (client/server)'
1604	  else
1605		dotest version-2 "${testcvs} version" \
1606'Concurrent Versions System (CVS) [0-9.]*.*'
1607	  fi
1608	  ;;
1609
1610	basica)
1611	  # Similar in spirit to some of the basic1, and basic2
1612	  # tests, but hopefully a lot faster.  Also tests operating on
1613	  # files two directories down *without* operating on the parent dirs.
1614
1615	  # Tests basica-0a and basica-0b provide the equivalent of the:
1616	  #    mkdir ${CVSROOT_DIRNAME}/first-dir
1617	  # used by many of the tests.  It is "more official" in the sense
1618	  # that is does everything through CVS; the reason most of the
1619	  # tests don't use it is mostly historical.
1620	  mkdir 1; cd 1
1621	  dotest basica-0a "${testcvs} -q co -l ." ''
1622	  mkdir first-dir
1623	  dotest basica-0b "${testcvs} add first-dir" \
1624"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
1625	  cd ..
1626	  rm -r 1
1627
1628	  dotest basica-1 "${testcvs} -q co first-dir" ''
1629	  cd first-dir
1630
1631	  # Test a few operations, to ensure they gracefully do
1632	  # nothing in an empty directory.
1633	  dotest basica-1a0 "${testcvs} -q update" ''
1634	  dotest basica-1a1 "${testcvs} -q diff -c" ''
1635	  dotest basica-1a2 "${testcvs} -q status" ''
1636
1637	  mkdir sdir
1638	  # Remote CVS gives the "cannot open CVS/Entries" error, which is
1639	  # clearly a bug, but not a simple one to fix.
1640	  dotest basica-1a10 "${testcvs} -n add sdir" \
1641"Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository" \
1642"${PROG} add: cannot open CVS/Entries for reading: No such file or directory
1643Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
1644	  dotest_fail basica-1a11 \
1645	    "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
1646	  dotest basica-2 "${testcvs} add sdir" \
1647"Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
1648	  cd sdir
1649	  mkdir ssdir
1650	  dotest basica-3 "${testcvs} add ssdir" \
1651"Directory ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir added to the repository"
1652	  cd ssdir
1653	  echo ssfile >ssfile
1654
1655	  # Trying to commit it without a "cvs add" should be an error.
1656	  # The "use `cvs add' to create an entry" message is the one
1657	  # that I consider to be more correct, but local cvs prints the
1658	  # "nothing known" message and noone has gotten around to fixing it.
1659	  dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
1660"${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
1661${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
1662"${PROG}"' [a-z]*: nothing known about `ssfile'\''
1663'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
1664
1665	  dotest basica-4 "${testcvs} add ssfile" \
1666"${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition
1667'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
1668	  dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
1669"${PROG} [a-z]*: nothing known about ssfile
1670${PROG} "'\[[a-z]* aborted\]: correct the above errors first!'
1671	  cd ../..
1672	  dotest basica-5 "${testcvs} -q ci -m add-it" \
1673"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1674done
1675Checking in sdir/ssdir/ssfile;
1676${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1677initial revision: 1\.1
1678done"
1679	  dotest_fail basica-5a \
1680	    "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
1681"${PROG} [a-z]*: Attempt to add reserved tag name BASE
1682${PROG} \[[a-z]* aborted\]: failed to set tag BASE to revision 1\.1 in ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v"
1683	  dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
1684'T sdir/ssdir/ssfile'
1685
1686	  dotest basica-6 "${testcvs} -q update" ''
1687	  echo "ssfile line 2" >>sdir/ssdir/ssfile
1688	  dotest_status basica-6.2 1 "${testcvs} -q diff -c" \
1689"Index: sdir/ssdir/ssfile
1690===================================================================
1691RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1692retrieving revision 1\.1
1693diff -c -r1\.1 ssfile
1694\*\*\* sdir/ssdir/ssfile	${RFCDATE}	1\.1
1695--- sdir/ssdir/ssfile	${RFCDATE}
1696\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1697\*\*\* 1 \*\*\*\*
1698--- 1,2 ----
1699  ssfile
1700${PLUS} ssfile line 2"
1701	  dotest_status basica-6.3 1 "${testcvs} -q diff -c -rBASE" \
1702"Index: sdir/ssdir/ssfile
1703===================================================================
1704RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1705retrieving revision 1\.1
1706diff -c -r1\.1 ssfile
1707\*\*\* sdir/ssdir/ssfile	${RFCDATE}	1\.1
1708--- sdir/ssdir/ssfile	${RFCDATE}
1709\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1710\*\*\* 1 \*\*\*\*
1711--- 1,2 ----
1712  ssfile
1713${PLUS} ssfile line 2"
1714	  dotest basica-7 "${testcvs} -q ci -m modify-it" \
1715"Checking in sdir/ssdir/ssfile;
1716${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1717new revision: 1\.2; previous revision: 1\.1
1718done"
1719	  dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
1720"${PROG}"' [a-z]*: nothing known about `nonexist'\''
1721'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
1722	  dotest basica-8 "${testcvs} -q update" ''
1723
1724	  # Test the -f option to ci
1725	  cd sdir/ssdir
1726	  dotest basica-8a0 "${testcvs} -q ci -m not-modified ssfile" ''
1727	  dotest basica-8a "${testcvs} -q ci -f -m force-it" \
1728"Checking in ssfile;
1729${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1730new revision: 1\.3; previous revision: 1\.2
1731done"
1732	  dotest basica-8a1 "${testcvs} -q ci -m bump-it -r 2.0" \
1733"Checking in ssfile;
1734${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1735new revision: 2\.0; previous revision: 1\.3
1736done"
1737	  # -f should not be necessary, but it should be harmless.
1738	  # Also test the "-r 3" (rather than "-r 3.0") usage.
1739	  dotest basica-8a2 "${testcvs} -q ci -m bump-it -f -r 3" \
1740"Checking in ssfile;
1741${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1742new revision: 3\.1; previous revision: 2\.0
1743done"
1744
1745	  # Test using -r to create a branch
1746	  dotest_fail basica-8a3 "${testcvs} -q ci -m bogus -r 3.0.0" \
1747"Checking in ssfile;
1748${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1749${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: can't find branch point 3\.0
1750${PROG} [a-z]*: could not check in ssfile"
1751	  dotest basica-8a4 "${testcvs} -q ci -m valid -r 3.1.2" \
1752"Checking in ssfile;
1753${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1754new revision: 3\.1\.2\.1; previous revision: 3\.1
1755done"
1756	  # now get rid of the sticky tag and go back to the trunk
1757	  dotest basica-8a5 "${testcvs} -q up -A" "[UP] ssfile"
1758
1759	  cd ../..
1760	  dotest basica-8b "${testcvs} -q diff -r1.2 -r1.3" \
1761"Index: sdir/ssdir/ssfile
1762===================================================================
1763RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1764retrieving revision 1\.2
1765retrieving revision 1\.3
1766diff -r1\.2 -r1\.3"
1767
1768	  dotest_fail basica-8b1 "${testcvs} -q diff -r1.2 -r1.3 -C 3isacrowd" \
1769"Index: sdir/ssdir/ssfile
1770===================================================================
1771RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1772retrieving revision 1\.2
1773retrieving revision 1\.3
1774diff -C3isacrowd -r1\.2 -r1\.3
1775${PROG} [a-z]*: invalid context length argument"
1776
1777	  # The .* here will normally be "No such file or directory",
1778	  # but if memory serves some systems (AIX?) have a different message.
1779:	  dotest_fail basica-9 \
1780	    "${testcvs} -q -d ${TESTDIR}/nonexist update" \
1781"${PROG}: cannot access cvs root ${TESTDIR}/nonexist: .*"
1782	  dotest_fail basica-9 \
1783	    "${testcvs} -q -d ${TESTDIR}/nonexist update" \
1784"${PROG} \[[a-z]* aborted\]: ${TESTDIR}/nonexist/CVSROOT: .*"
1785
1786	  dotest basica-10 "${testcvs} annotate" \
1787'Annotations for sdir/ssdir/ssfile
1788\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
17891\.1          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile
17901\.2          .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2'
1791
1792	  # Test resurrecting with strange revision numbers
1793	  cd sdir/ssdir
1794	  dotest basica-r1 "${testcvs} rm -f ssfile" \
1795"${PROG} [a-z]*: scheduling .ssfile. for removal
1796${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
1797	  dotest basica-r2 "${testcvs} -q ci -m remove" \
1798"Removing ssfile;
1799${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1800new revision: delete; previous revision: 3\.1
1801done"
1802	  dotest basica-r3 "${testcvs} -q up -p -r 3.1 ssfile >ssfile" ""
1803	  dotest basica-r4 "${testcvs} add ssfile" \
1804"${PROG} [a-z]*: re-adding file ssfile (in place of dead revision 3\.2)
1805${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1806	  dotest basica-r5 "${testcvs} -q ci -m resurrect" \
1807"Checking in ssfile;
1808${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
1809new revision: 3\.3; previous revision: 3\.2
1810done"
1811	  cd ../..
1812
1813	  # As long as we have a file with a few revisions, test
1814	  # a few "cvs admin -o" invocations.
1815	  cd sdir/ssdir
1816	  dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
1817"${PROG} [a-z]*: while processing more than one file:
1818${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
1819	  dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
1820"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1821done"
1822	  dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
1823"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1824done"
1825	  dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
1826"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1827${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
1828${PROG} [a-z]*: RCS file for .ssfile. not modified\."
1829	  dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
1830"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1831done"
1832	  dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
1833"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1834deleting revision 3\.3
1835deleting revision 3\.2
1836done"
1837	  dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
1838"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1839done"
1840	  dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
1841"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1842deleting revision 2\.0
1843deleting revision 1\.3
1844done"
1845	  dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
1846"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1847deleting revision 2\.0
1848deleting revision 1\.3
1849done"
1850	  dotest basica-o6a "${testcvs} admin -o 3.1.2: ssfile" \
1851"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1852deleting revision 3\.1\.2\.1
1853done"
1854	  dotest basica-o7 "${testcvs} log -N ssfile" "
1855RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
1856Working file: ssfile
1857head: 3\.1
1858branch:
1859locks: strict
1860access list:
1861keyword substitution: kv
1862total revisions: 3;	selected revisions: 3
1863description:
1864----------------------------
1865revision 3\.1
1866date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
1867bump-it
1868----------------------------
1869revision 1\.2
1870date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
1871modify-it
1872----------------------------
1873revision 1\.1
1874date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
1875add-it
1876============================================================================="
1877	  dotest basica-o8 "${testcvs} -q update -p -r 1.1 ssfile" "ssfile"
1878	  cd ../..
1879
1880	  cd ..
1881
1882	  rm -rf ${CVSROOT_DIRNAME}/first-dir
1883	  rm -r first-dir
1884	  ;;
1885
1886	basicb)
1887	  # More basic tests, including non-branch tags and co -d.
1888	  mkdir 1; cd 1
1889	  dotest basicb-0a "${testcvs} -q co -l ." ''
1890	  touch topfile
1891	  dotest basicb-0b "${testcvs} add topfile" \
1892"${PROG} [a-z]*: scheduling file .topfile. for addition
1893${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1894	  dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
1895"RCS file: ${CVSROOT_DIRNAME}/topfile,v
1896done
1897Checking in topfile;
1898${CVSROOT_DIRNAME}/topfile,v  <--  topfile
1899initial revision: 1\.1
1900done"
1901	  cd ..
1902	  rm -r 1
1903	  mkdir 2; cd 2
1904	  dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
1905	  # Now test the ability to run checkout on an existing working
1906	  # directory without having it lose its mind.  I don't know
1907	  # whether this is tested elsewhere in sanity.sh.  A more elaborate
1908	  # test might also have modified files, make sure it works if
1909	  # the modules file was modified to add new directories to the
1910	  # module, and such.
1911	  dotest basicb-0d0 "${testcvs} -q co -l ." ""
1912	  mkdir first-dir
1913	  dotest basicb-0e "${testcvs} add first-dir" \
1914"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
1915	  cd ..
1916	  rm -r 2
1917
1918	  dotest basicb-1 "${testcvs} -q co first-dir" ''
1919
1920	  # The top-level CVS directory is not created by default.
1921	  # I'm leaving basicb-1a and basicb-1b untouched, mostly, in
1922	  # case we decide that the default should be reversed...
1923
1924	  dotest_fail basicb-1a "test -d CVS" ''
1925
1926	  # In 1b and 1c, the first string matches if we're using absolute
1927	  # paths, while the second matches if RELATIVE_REPOS is defined
1928	  # (we're using relative paths).
1929
1930:	  dotest basicb-1b "cat CVS/Repository" \
1931"${CVSROOT_DIRNAME}/\." \
1932"\."
1933	  dotest basicb-1c "cat first-dir/CVS/Repository" \
1934"${CVSROOT_DIRNAME}/first-dir" \
1935"first-dir"
1936
1937	  cd first-dir
1938	  # Note that the name Emptydir is chosen to test that CVS just
1939	  # treats it like any other directory name.  It should be
1940	  # special only when it is directly in $CVSROOT/CVSROOT.
1941	  mkdir Emptydir sdir2
1942	  dotest basicb-2 "${testcvs} add Emptydir sdir2" \
1943"Directory ${CVSROOT_DIRNAME}/first-dir/Emptydir added to the repository
1944Directory ${CVSROOT_DIRNAME}/first-dir/sdir2 added to the repository"
1945	  cd Emptydir
1946	  echo sfile1 starts >sfile1
1947	  dotest basicb-2a10 "${testcvs} -n add sfile1" \
1948"${PROG} [a-z]*: scheduling file .sfile1. for addition
1949${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1950	  dotest basicb-2a11 "${testcvs} status sfile1" \
1951"${PROG} [a-z]*: use .${PROG} add. to create an entry for sfile1
1952===================================================================
1953File: sfile1           	Status: Unknown
1954
1955   Working revision:	No entry for sfile1
1956   Repository revision:	No revision control file"
1957	  dotest basicb-3 "${testcvs} add sfile1" \
1958"${PROG} [a-z]*: scheduling file .sfile1. for addition
1959${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1960	  dotest basicb-3a1 "${testcvs} status sfile1" \
1961"===================================================================
1962File: sfile1           	Status: Locally Added
1963
1964   Working revision:	New file!
1965   Repository revision:	No revision control file
1966   Sticky Tag:		(none)
1967   Sticky Date:		(none)
1968   Sticky Options:	(none)"
1969
1970	  cd ../sdir2
1971	  echo sfile2 starts >sfile2
1972	  dotest basicb-4 "${testcvs} add sfile2" \
1973"${PROG} [a-z]*: scheduling file .sfile2. for addition
1974${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
1975	  dotest basicb-4a "${testcvs} -q ci CVS" \
1976"${PROG} [a-z]*: warning: directory CVS specified in argument
1977${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
1978	  cd ..
1979	  dotest basicb-5 "${testcvs} -q ci -m add" \
1980"RCS file: ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v
1981done
1982Checking in Emptydir/sfile1;
1983${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
1984initial revision: 1\.1
1985done
1986RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
1987done
1988Checking in sdir2/sfile2;
1989${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
1990initial revision: 1\.1
1991done"
1992	  echo sfile1 develops >Emptydir/sfile1
1993	  dotest basicb-6 "${testcvs} -q ci -m modify" \
1994"Checking in Emptydir/sfile1;
1995${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v  <--  sfile1
1996new revision: 1\.2; previous revision: 1\.1
1997done"
1998	  dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
1999T sdir2/sfile2'
2000	  echo not in time for release-1 >sdir2/sfile2
2001	  dotest basicb-8 "${testcvs} -q ci -m modify-2" \
2002"Checking in sdir2/sfile2;
2003${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v  <--  sfile2
2004new revision: 1\.2; previous revision: 1\.1
2005done"
2006	  # See if CVS can correctly notice when an invalid numeric
2007	  # revision is specified.
2008	  # Commented out until we get around to fixing CVS
2009:	  dotest basicb-8a0 "${testcvs} diff -r 1.5 -r 1.7 sfile2" 'error msg'
2010	  cd ..
2011
2012	  # Test that we recurse into the correct directory when checking
2013	  # for existing files, even if co -d is in use.
2014	  touch first-dir/extra
2015	  dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
2016'U first-dir1/Emptydir/sfile1
2017U first-dir1/sdir2/sfile2'
2018	  rm -r first-dir1
2019
2020	  rm -r first-dir
2021
2022	  # FIXME? basicb-9 used to check things out like this:
2023	  #   U newdir/Emptydir/sfile1
2024	  #   U newdir/sdir2/sfile2
2025	  # but that's difficult to do.  The whole "shorten" thing
2026	  # is pretty bogus, because it will break on things
2027	  # like "cvs co foo/bar baz/quux".  Unless there's some
2028	  # pretty detailed expansion and analysis of the command-line
2029	  # arguments, we shouldn't do "shorten" stuff at all.
2030
2031	  dotest basicb-9 \
2032"${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
2033'U newdir/first-dir/Emptydir/sfile1
2034U newdir/first-dir/sdir2/sfile2'
2035
2036	  # basicb-9a and basicb-9b: see note about basicb-1a
2037
2038	  dotest_fail basicb-9a "test -d CVS" ''
2039
2040	  # In 9b through 9f, the first string matches if we're using
2041          # absolute paths, while the second matches if RELATIVE_REPOS
2042	  # is defined (we're using relative paths).
2043
2044:	  dotest basicb-9b "cat CVS/Repository" \
2045"${CVSROOT_DIRNAME}/\." \
2046"\."
2047	  dotest basicb-9c "cat newdir/CVS/Repository" \
2048"${CVSROOT_DIRNAME}/\." \
2049"\."
2050	  dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
2051"${CVSROOT_DIRNAME}/first-dir" \
2052"first-dir"
2053	  dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
2054"${CVSROOT_DIRNAME}/first-dir/Emptydir" \
2055"first-dir/Emptydir"
2056	  dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
2057"${CVSROOT_DIRNAME}/first-dir/sdir2" \
2058"first-dir/sdir2"
2059
2060	  dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
2061"sfile1 develops
2062sfile2 starts"
2063
2064	  rm -r newdir
2065
2066	  # Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
2067	  # seem to deal with it...
2068	  if false; then
2069	  dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
2070"U sub1/sub2/Emptydir/sfile1
2071U sub1/sub2/sdir2/sfile2"
2072	  cd sub1
2073	  dotest basicb-12 "${testcvs} -q update" ''
2074	  touch xx
2075	  dotest basicb-13 "${testcvs} add xx" fixme
2076	  cd ..
2077	  rm -r sub1
2078	  # to test: sub1/sub2/sub3
2079	  fi # end of tests commented out.
2080
2081	  # Create a second directory.
2082	  mkdir 1
2083	  cd 1
2084	  dotest basicb-14 "${testcvs} -q co -l ." 'U topfile'
2085	  mkdir second-dir
2086	  dotest basicb-15 "${testcvs} add second-dir" \
2087"Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2088	  cd second-dir
2089	  touch aa
2090	  dotest basicb-16 "${testcvs} add aa" \
2091"${PROG} [a-z]*: scheduling file .aa. for addition
2092${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
2093	  dotest basicb-17 "${testcvs} -q ci -m add" \
2094"RCS file: ${CVSROOT_DIRNAME}/second-dir/aa,v
2095done
2096Checking in aa;
2097${CVSROOT_DIRNAME}/second-dir/aa,v  <--  aa
2098initial revision: 1\.1
2099done"
2100	  cd ..
2101
2102	  # Try to remove all revisions in a file.
2103	  dotest_fail basicb-o1 "${testcvs} admin -o1.1 topfile" \
2104"RCS file: ${CVSROOT_DIRNAME}/topfile,v
2105deleting revision 1\.1
2106${PROG} \[[a-z]* aborted\]: attempt to delete all revisions"
2107	  dotest basicb-o2 "${testcvs} -q update -d first-dir" \
2108"U first-dir/Emptydir/sfile1
2109U first-dir/sdir2/sfile2"
2110	  dotest_fail basicb-o3 \
2111"${testcvs} admin -o1.1:1.2 first-dir/sdir2/sfile2" \
2112"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
2113deleting revision 1\.2
2114deleting revision 1\.1
2115${PROG} \[[a-z]* aborted\]: attempt to delete all revisions"
2116	  cd ..
2117	  rm -r 1
2118
2119	  mkdir 1; cd 1
2120	  # Note that -H is an illegal option.
2121	  # I suspect that the choice between "illegal" and "invalid"
2122	  # depends on the user's environment variables, the phase
2123	  # of the moon (weirdness with optind), and who knows what else.
2124	  # I've been seeing "illegal"...
2125	  dotest_fail basicb-21 "${testcvs} -q admin -H" \
2126"admin: illegal option -- H
2127${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
2128"admin: invalid option -- H
2129${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
2130	  cd ..
2131	  rmdir 1
2132
2133	  if $keep; then
2134	    echo Keeping ${TESTDIR} and exiting due to --keep
2135	    exit 0
2136	  fi
2137
2138	  rm -rf ${CVSROOT_DIRNAME}/first-dir
2139	  rm -rf ${CVSROOT_DIRNAME}/second-dir
2140	  rm -f ${CVSROOT_DIRNAME}/topfile,v
2141	  ;;
2142
2143	basicc)
2144	  # More tests of basic/miscellaneous functionality.
2145	  mkdir 1; cd 1
2146	  dotest_fail basicc-1 "${testcvs} diff" \
2147"${PROG} [a-z]*: in directory \.:
2148${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
2149	  dotest basicc-2 "${testcvs} -q co -l ." ''
2150	  mkdir first-dir second-dir
2151	  dotest basicc-3 "${testcvs} add first-dir second-dir" \
2152"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
2153Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
2154	  # Old versions of CVS often didn't create this top-level CVS
2155	  # directory in the first place.  I think that maybe the only
2156	  # way to get it to work currently is to let CVS create it,
2157	  # and then blow it away (don't complain if it does not
2158	  # exist).  But that is perfectly legal; people who are used
2159	  # to the old behavior especially may be interested.
2160	  # FIXME: this test is intended for the TopLevelAdmin=yes case;
2161	  # should adjust/move it accordingly.
2162	  rm -rf CVS
2163	  dotest basicc-4 "echo *" "first-dir second-dir"
2164	  dotest basicc-5 "${testcvs} update" \
2165"${PROG} [a-z]*: Updating first-dir
2166${PROG} [a-z]*: Updating second-dir" \
2167"${PROG} [a-z]*: Updating \.
2168${PROG} [a-z]*: Updating first-dir
2169${PROG} [a-z]*: Updating second-dir"
2170
2171	  cd first-dir
2172	  dotest basicc-6 "${testcvs} release -d" ""
2173	  dotest basicc-7 "test -d ../first-dir" ""
2174	  # The Linux 2.2 kernel lets you delete ".".  That's OK either way,
2175	  # the point is that CVS must not mess with anything *outside* "."
2176	  # the way that CVS 1.10 and older tried to.
2177	  dotest basicc-8 "${testcvs} -Q release -d ." \
2178"" "${PROG} release: deletion of directory \. failed: .*"
2179	  dotest basicc-9 "test -d ../second-dir" ""
2180	  # For CVS to make a syntactic check for "." wouldn't suffice.
2181	  # On Linux 2.2 systems, the cwd may be gone, so we recreate it
2182          # to allow basicc-11 to actually happen
2183	  if test ! -d ../first-dir; then
2184	    cd ..
2185	    mkdir ./first-dir
2186            cd ./first-dir
2187	  fi
2188	  dotest basicc-11 "${testcvs} -Q release -d ./." \
2189"" "${PROG} release: deletion of directory \./\. failed: .*"
2190	  dotest basicc-11a "test -d ../second-dir" ""
2191
2192	  cd ..
2193	  cd ..
2194
2195	  mkdir 2; cd 2
2196	  dotest basicc-12 "${testcvs} -Q co ." ""
2197	  dotest basicc-13 "echo *" "CVS CVSROOT first-dir second-dir"
2198	  dotest basicc-14 "${testcvs} -Q release first-dir second-dir" ""
2199	  dotest basicc-15 "${testcvs} -Q release -d first-dir second-dir" ""
2200	  dotest basicc-16 "echo *" "CVS CVSROOT"
2201
2202	  cd ..
2203	  rm -r 1 2
2204	  rm -rf ${CVSROOT_DIRNAME}/first-dir
2205	  ;;
2206
2207	basic1)
2208	  # first dive - add a files, first singly, then in a group.
2209	  mkdir ${CVSROOT_DIRNAME}/first-dir
2210	  mkdir basic1; cd basic1
2211	  # check out an empty directory
2212	  dotest basic1-1 "${testcvs} -q co first-dir" ''
2213
2214	  cd first-dir
2215	  echo file2 >file2
2216	  echo file3 >file3
2217	  echo file4 >file4
2218	  echo file5 >file5
2219
2220	  dotest basic1-14-add-add "${testcvs} add file2 file3 file4 file5" \
2221"${PROG} [a-z]*: scheduling file \`file2' for addition
2222${PROG} [a-z]*: scheduling file \`file3' for addition
2223${PROG} [a-z]*: scheduling file \`file4' for addition
2224${PROG} [a-z]*: scheduling file \`file5' for addition
2225${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
2226	  dotest basic1-15-add-add \
2227"${testcvs} -q update file2 file3 file4 file5" \
2228"A file2
2229A file3
2230A file4
2231A file5"
2232	  dotest basic1-16-add-add "${testcvs} -q update" \
2233"A file2
2234A file3
2235A file4
2236A file5"
2237	  dotest basic1-17-add-add "${testcvs} -q status" \
2238"===================================================================
2239File: file2            	Status: Locally Added
2240
2241   Working revision:	New file!
2242   Repository revision:	No revision control file
2243   Sticky Tag:		(none)
2244   Sticky Date:		(none)
2245   Sticky Options:	(none)
2246
2247===================================================================
2248File: file3            	Status: Locally Added
2249
2250   Working revision:	New file!
2251   Repository revision:	No revision control file
2252   Sticky Tag:		(none)
2253   Sticky Date:		(none)
2254   Sticky Options:	(none)
2255
2256===================================================================
2257File: file4            	Status: Locally Added
2258
2259   Working revision:	New file!
2260   Repository revision:	No revision control file
2261   Sticky Tag:		(none)
2262   Sticky Date:		(none)
2263   Sticky Options:	(none)
2264
2265===================================================================
2266File: file5            	Status: Locally Added
2267
2268   Working revision:	New file!
2269   Repository revision:	No revision control file
2270   Sticky Tag:		(none)
2271   Sticky Date:		(none)
2272   Sticky Options:	(none)"
2273	  dotest basic1-18-add-add "${testcvs} -q log" \
2274"${PROG} [a-z]*: file2 has been added, but not committed
2275${PROG} [a-z]*: file3 has been added, but not committed
2276${PROG} [a-z]*: file4 has been added, but not committed
2277${PROG} [a-z]*: file5 has been added, but not committed"
2278	  cd ..
2279	  dotest basic1-21-add-add "${testcvs} -q update" \
2280"A first-dir/file2
2281A first-dir/file3
2282A first-dir/file4
2283A first-dir/file5"
2284	  # FIXCVS?  Shouldn't this read first-dir/file2 instead of file2?
2285	  dotest basic1-22-add-add "${testcvs} log first-dir" \
2286"${PROG} [a-z]*: Logging first-dir
2287${PROG} [a-z]*: file2 has been added, but not committed
2288${PROG} [a-z]*: file3 has been added, but not committed
2289${PROG} [a-z]*: file4 has been added, but not committed
2290${PROG} [a-z]*: file5 has been added, but not committed"
2291	  dotest basic1-23-add-add "${testcvs} status first-dir" \
2292"${PROG} [a-z]*: Examining first-dir
2293===================================================================
2294File: file2            	Status: Locally Added
2295
2296   Working revision:	New file!
2297   Repository revision:	No revision control file
2298   Sticky Tag:		(none)
2299   Sticky Date:		(none)
2300   Sticky Options:	(none)
2301
2302===================================================================
2303File: file3            	Status: Locally Added
2304
2305   Working revision:	New file!
2306   Repository revision:	No revision control file
2307   Sticky Tag:		(none)
2308   Sticky Date:		(none)
2309   Sticky Options:	(none)
2310
2311===================================================================
2312File: file4            	Status: Locally Added
2313
2314   Working revision:	New file!
2315   Repository revision:	No revision control file
2316   Sticky Tag:		(none)
2317   Sticky Date:		(none)
2318   Sticky Options:	(none)
2319
2320===================================================================
2321File: file5            	Status: Locally Added
2322
2323   Working revision:	New file!
2324   Repository revision:	No revision control file
2325   Sticky Tag:		(none)
2326   Sticky Date:		(none)
2327   Sticky Options:	(none)"
2328	  dotest basic1-24-add-add "${testcvs} update first-dir" \
2329"${PROG} [a-z]*: Updating first-dir
2330A first-dir/file2
2331A first-dir/file3
2332A first-dir/file4
2333A first-dir/file5"
2334	  dotest basic1-27-add-add "${testcvs} co first-dir" \
2335"${PROG} [a-z]*: Updating first-dir
2336A first-dir/file2
2337A first-dir/file3
2338A first-dir/file4
2339A first-dir/file5"
2340	  cd first-dir
2341	  dotest basic1-14-add-ci \
2342"${testcvs} commit -m test file2 file3 file4 file5" \
2343"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
2344done
2345Checking in file2;
2346${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2347initial revision: 1\.1
2348done
2349RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
2350done
2351Checking in file3;
2352${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
2353initial revision: 1\.1
2354done
2355RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
2356done
2357Checking in file4;
2358${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
2359initial revision: 1\.1
2360done
2361RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
2362done
2363Checking in file5;
2364${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
2365initial revision: 1\.1
2366done"
2367	  dotest basic1-15-add-ci \
2368"${testcvs} -q update file2 file3 file4 file5" ''
2369	  dotest basic1-16-add-ci "${testcvs} -q update" ''
2370	  dotest basic1-17-add-ci "${testcvs} -q status" \
2371"===================================================================
2372File: file2            	Status: Up-to-date
2373
2374   Working revision:	1\.1.*
2375   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file2,v
2376   Sticky Tag:		(none)
2377   Sticky Date:		(none)
2378   Sticky Options:	(none)
2379
2380===================================================================
2381File: file3            	Status: Up-to-date
2382
2383   Working revision:	1\.1.*
2384   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file3,v
2385   Sticky Tag:		(none)
2386   Sticky Date:		(none)
2387   Sticky Options:	(none)
2388
2389===================================================================
2390File: file4            	Status: Up-to-date
2391
2392   Working revision:	1\.1.*
2393   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file4,v
2394   Sticky Tag:		(none)
2395   Sticky Date:		(none)
2396   Sticky Options:	(none)
2397
2398===================================================================
2399File: file5            	Status: Up-to-date
2400
2401   Working revision:	1\.1.*
2402   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file5,v
2403   Sticky Tag:		(none)
2404   Sticky Date:		(none)
2405   Sticky Options:	(none)"
2406	  # The "log" tests and friends probably already test the output
2407	  # from log quite adequately.
2408	  # Note: using dotest fails here.  It seems to be related
2409	  # to the output being sufficiently large (Red Hat 4.1).
2410	  # dotest basic1-18-add-ci "${testcvs} log" "${DOTSTAR}"
2411	  if ${testcvs} -q log >>${LOGFILE}; then
2412	    pass basic1-18-add-ci
2413	  else
2414	    pass basic1-18-add-ci
2415	  fi
2416	  cd ..
2417	  dotest basic1-21-add-ci "${testcvs} -q update" ''
2418	  # See test basic1-18-add-ci for explanation of non-use of dotest.
2419	  if ${testcvs} -q log first-dir >>${LOGFILE}; then
2420	    pass basic1-22-add-ci
2421	  else
2422	    pass basic1-22-add-ci
2423	  fi
2424	  # At least for the moment I am going to consider 17-add-ci
2425	  # an adequate test of the output here.
2426	  # See test basic1-18-add-ci for explanation of non-use of dotest.
2427	  if ${testcvs} -q status first-dir >>${LOGFILE}; then
2428	    pass basic1-23-add-ci
2429	  else
2430	    pass basic1-23-add-ci
2431	  fi
2432	  dotest basic1-24-add-ci "${testcvs} -q update first-dir" ''
2433	  dotest basic1-27-add-ci "${testcvs} -q co first-dir" ''
2434
2435	  cd first-dir
2436	  rm file2 file3 file4 file5
2437	  dotest basic1-14-rm-rm "${testcvs} rm file2 file3 file4 file5" \
2438"${PROG} [a-z]*: scheduling .file2. for removal
2439${PROG} [a-z]*: scheduling .file3. for removal
2440${PROG} [a-z]*: scheduling .file4. for removal
2441${PROG} [a-z]*: scheduling .file5. for removal
2442${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
2443	  # 15-rm-rm was commented out.  Why?
2444	  dotest basic1-15-rm-rm \
2445"${testcvs} -q update file2 file3 file4 file5" \
2446"R file2
2447R file3
2448R file4
2449R file5"
2450	  dotest basic1-16-rm-rm "${testcvs} -q update" \
2451"R file2
2452R file3
2453R file4
2454R file5"
2455	  dotest basic1-17-rm-rm "${testcvs} -q status" \
2456"===================================================================
2457File: no file file2		Status: Locally Removed
2458
2459   Working revision:	-1\.1.*
2460   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file2,v
2461   Sticky Tag:		(none)
2462   Sticky Date:		(none)
2463   Sticky Options:	(none)
2464
2465===================================================================
2466File: no file file3		Status: Locally Removed
2467
2468   Working revision:	-1\.1.*
2469   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file3,v
2470   Sticky Tag:		(none)
2471   Sticky Date:		(none)
2472   Sticky Options:	(none)
2473
2474===================================================================
2475File: no file file4		Status: Locally Removed
2476
2477   Working revision:	-1\.1.*
2478   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file4,v
2479   Sticky Tag:		(none)
2480   Sticky Date:		(none)
2481   Sticky Options:	(none)
2482
2483===================================================================
2484File: no file file5		Status: Locally Removed
2485
2486   Working revision:	-1\.1.*
2487   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file5,v
2488   Sticky Tag:		(none)
2489   Sticky Date:		(none)
2490   Sticky Options:	(none)"
2491	  # Would be nice to test that real logs appear (with dead state
2492	  # and all), either here or someplace like log2 tests.
2493	  if ${testcvs} -q log >>${LOGFILE}; then
2494	    pass basic1-18-rm-rm
2495	  else
2496	    fail basic1-18-rm-rm
2497	  fi
2498	  cd ..
2499	  dotest basic1-21-rm-rm "${testcvs} -q update" \
2500"R first-dir/file2
2501R first-dir/file3
2502R first-dir/file4
2503R first-dir/file5"
2504	  if ${testcvs} -q log first-dir >>${LOGFILE}; then
2505	    pass basic1-22-rm-rm
2506	  else
2507	    fail basic1-22-rm-rm
2508	  fi
2509	  if ${testcvs} -q status first-dir >>${LOGFILE}; then
2510	    pass basic1-23-rm-rm
2511	  else
2512	    fail basic1-23-rm-rm
2513	  fi
2514	  dotest basic1-24-rm-rm "${testcvs} -q update first-dir" \
2515"R first-dir/file2
2516R first-dir/file3
2517R first-dir/file4
2518R first-dir/file5"
2519	  dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
2520"R first-dir/file2
2521R first-dir/file3
2522R first-dir/file4
2523R first-dir/file5"
2524	  cd first-dir
2525	  dotest basic1-14-rm-ci "${testcvs} -q commit -m test" \
2526"Removing file2;
2527${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
2528new revision: delete; previous revision: 1\.1
2529done
2530Removing file3;
2531${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
2532new revision: delete; previous revision: 1\.1
2533done
2534Removing file4;
2535${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
2536new revision: delete; previous revision: 1\.1
2537done
2538Removing file5;
2539${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
2540new revision: delete; previous revision: 1\.1
2541done"
2542	  dotest basic1-15-rm-ci \
2543"${testcvs} -q update file2 file3 file4 file5" ''
2544	  dotest basic1-16-rm-ci "${testcvs} -q update" ''
2545	  dotest basic1-17-rm-ci "${testcvs} -q status" ''
2546	  # Would be nice to test that real logs appear (with dead state
2547	  # and all), either here or someplace like log2 tests.
2548	  if ${testcvs} -q log >>${LOGFILE}; then
2549	    pass basic1-18-rm-ci
2550	  else
2551	    fail basic1-18-rm-ci
2552	  fi
2553	  cd ..
2554	  dotest basic1-21-rm-ci "${testcvs} -q update" ''
2555	  if ${testcvs} -q log first-dir >>${LOGFILE}; then
2556	    pass basic1-22-rm-ci
2557	  else
2558	    fail basic1-22-rm-ci
2559	  fi
2560	  if ${testcvs} -q status first-dir >>${LOGFILE}; then
2561	    pass basic1-23-rm-ci
2562	  else
2563	    fail basic1-23-rm-ci
2564	  fi
2565	  dotest basic1-24-rm-ci "${testcvs} -q update first-dir" ''
2566	  dotest basic1-27-rm-ci "${testcvs} -q co first-dir" ''
2567	  cd first-dir
2568	  # All the files are removed, so nothing gets tagged.
2569	  dotest basic1-28 "${testcvs} -q tag first-dive" ''
2570	  cd ..
2571	  cd ..
2572
2573	  if $keep; then
2574	    echo Keeping ${TESTDIR} and exiting due to --keep
2575	    exit 0
2576	  fi
2577
2578	  rm -r basic1
2579	  rm -rf ${CVSROOT_DIRNAME}/first-dir
2580	  ;;
2581
2582	deep)
2583	  # Test the ability to operate on directories nested rather deeply.
2584	  mkdir ${CVSROOT_DIRNAME}/first-dir
2585	  dotest deep-1 "${testcvs} -q co first-dir" ''
2586	  cd first-dir
2587	  for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
2588	    mkdir $i
2589	    dotest deep-2-$i "${testcvs} add $i" \
2590"Directory ${CVSROOT_DIRNAME}/first-dir/dir1[/dir0-9]* added to the repository"
2591	    cd $i
2592	    echo file1 >file1
2593	    dotest deep-3-$i "${testcvs} add file1" \
2594"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
2595'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
2596	  done
2597	  cd ../../../../../../../../..
2598	  dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
2599RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v
2600done
2601Checking in first-dir/dir1/file1;
2602${CVSROOT_DIRNAME}/first-dir/dir1/file1,v  <--  file1
2603initial revision: 1.1
2604done
2605RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v
2606done
2607Checking in first-dir/dir1/dir2/file1;
2608${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v  <--  file1
2609initial revision: 1.1
2610done
2611RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v
2612done
2613Checking in first-dir/dir1/dir2/dir3/file1;
2614${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v  <--  file1
2615initial revision: 1.1
2616done
2617RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v
2618done
2619Checking in first-dir/dir1/dir2/dir3/dir4/file1;
2620${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
2621initial revision: 1.1
2622done
2623RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
2624done
2625Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
2626${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
2627initial revision: 1.1
2628done
2629RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
2630done
2631Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
2632${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
2633initial revision: 1.1
2634done
2635RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
2636done
2637Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
2638${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
2639initial revision: 1.1
2640done
2641RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
2642done
2643Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
2644${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
2645initial revision: 1.1
2646done
2647HERE
2648
2649	  cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
2650	  rm file1
2651	  dotest deep-4a0 "${testcvs} rm file1" \
2652"${PROG} [a-z]*: scheduling .file1. for removal
2653${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
2654	  dotest deep-4a1 "${testcvs} -q ci -m rm-it" "Removing file1;
2655${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
2656new revision: delete; previous revision: 1\.1
2657done"
2658	  cd ../../..
2659	  dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
2660	  # Should be using "test -e" if that is portable enough.
2661	  dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
2662
2663	  # Test that if we remove the working directory, CVS does not
2664	  # recreate it.  (I realize that this behavior is what the
2665	  # users expect, but in the longer run we might want to
2666	  # re-think it.  The corresponding behavior for a file is that
2667	  # CVS *will* recreate it, and we might want to make it so
2668	  # that "cvs release -d" is the way to delete the directory
2669	  # and have it stay gone -kingdon, Oct1996).
2670	  rm -r dir6
2671	  dotest deep-4b0a "${testcvs} -q diff" ''
2672	  dotest deep-4b0b "${testcvs} -q ci" ''
2673	  dotest deep-4b1 "${testcvs} -q update" ''
2674	  dotest deep-4b2 "${testcvs} -q update -d -P" \
2675'U dir6/file1
2676U dir6/dir7/file1'
2677
2678	  # Test what happens if one uses -P when there are files removed
2679	  # but not committed.
2680	  cd dir6/dir7
2681	  dotest deep-rm1 "${testcvs} rm -f file1" \
2682"${PROG} [a-z]*: scheduling .file1. for removal
2683${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
2684	  cd ..
2685	  dotest deep-rm2 "${testcvs} -q update -d -P" 'R dir7/file1'
2686	  dotest deep-rm3 "test -d dir7" ''
2687	  dotest deep-rm4 "${testcvs} -q ci -m rm-it" "Removing dir7/file1;
2688${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
2689new revision: delete; previous revision: 1\.1
2690done"
2691	  dotest deep-rm5 "${testcvs} -q update -d -P" ''
2692	  dotest_fail deep-rm6 "test -d dir7" ''
2693
2694	  # Test rm -f -R.
2695	  cd ../..
2696	  dotest deep-rm7 "${testcvs} rm -f -R dir5" \
2697"${PROG} [a-z]*: Removing dir5
2698${PROG} [a-z]*: scheduling .dir5/file1. for removal
2699${PROG} [a-z]*: Removing dir5/dir6
2700${PROG} [a-z]*: scheduling .dir5/dir6/file1. for removal
2701${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
2702	  dotest deep-rm8 "${testcvs} -q ci -m rm-it" \
2703"Removing dir5/file1;
2704${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
2705new revision: delete; previous revision: 1\.1
2706done
2707Removing dir5/dir6/file1;
2708${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
2709new revision: delete; previous revision: 1\.1
2710done"
2711	  dotest deep-rm9 "${testcvs} -q update -d -P" ''
2712	  dotest_fail deep-rm10 "test -d dir5"
2713
2714	  cd ../../../../..
2715
2716	  if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
2717	    pass deep-5
2718	  else
2719	    fail deep-5
2720	  fi
2721	  rm -rf ${CVSROOT_DIRNAME}/first-dir
2722	  ;;
2723
2724	basic2)
2725		# Test rtag, import, history, various miscellaneous operations
2726
2727		# NOTE: this section has reached the size and
2728		# complexity where it is getting to be a good idea to
2729		# add new tests to a new section rather than
2730		# continuing to piggyback them onto the tests here.
2731
2732		# First empty the history file
2733		rm ${CVSROOT_DIRNAME}/CVSROOT/history
2734		touch ${CVSROOT_DIRNAME}/CVSROOT/history
2735
2736### XXX maybe should use 'cvs imprt -b1 -m new-module first-dir F F1' in an
2737### empty directory to do this instead of hacking directly into $CVSROOT
2738		mkdir ${CVSROOT_DIRNAME}/first-dir
2739		dotest basic2-1 "${testcvs} -q co first-dir" ''
2740		for i in first-dir dir1 dir2 ; do
2741			if test ! -d $i ; then
2742				mkdir $i
2743				dotest basic2-2-$i "${testcvs} add $i" \
2744"Directory ${CVSROOT_DIRNAME}/.*/$i added to the repository"
2745			fi
2746
2747			cd $i
2748
2749			for j in file6 file7; do
2750				echo $j > $j
2751			done
2752
2753			dotest basic2-3-$i "${testcvs} add file6 file7" \
2754"${PROG} [a-z]*: scheduling file .file6. for addition
2755${PROG} [a-z]*: scheduling file .file7. for addition
2756${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
2757
2758		done
2759		cd ../../..
2760		dotest basic2-4 "${testcvs} update first-dir" \
2761"${PROG} [a-z]*: Updating first-dir
2762A first-dir/file6
2763A first-dir/file7
2764${PROG} [a-z]*: Updating first-dir/dir1
2765A first-dir/dir1/file6
2766A first-dir/dir1/file7
2767${PROG} [a-z]*: Updating first-dir/dir1/dir2
2768A first-dir/dir1/dir2/file6
2769A first-dir/dir1/dir2/file7"
2770
2771		# fixme: doesn't work right for added files.
2772		dotest basic2-5 "${testcvs} log first-dir" \
2773"${PROG} [a-z]*: Logging first-dir
2774${PROG} [a-z]*: file6 has been added, but not committed
2775${PROG} [a-z]*: file7 has been added, but not committed
2776${PROG} [a-z]*: Logging first-dir/dir1
2777${PROG} [a-z]*: file6 has been added, but not committed
2778${PROG} [a-z]*: file7 has been added, but not committed
2779${PROG} [a-z]*: Logging first-dir/dir1/dir2
2780${PROG} [a-z]*: file6 has been added, but not committed
2781${PROG} [a-z]*: file7 has been added, but not committed"
2782
2783		dotest basic2-6 "${testcvs} status first-dir" \
2784"${PROG} [a-z]*: Examining first-dir
2785===================================================================
2786File: file6            	Status: Locally Added
2787
2788   Working revision:	New file!
2789   Repository revision:	No revision control file
2790   Sticky Tag:		(none)
2791   Sticky Date:		(none)
2792   Sticky Options:	(none)
2793
2794===================================================================
2795File: file7            	Status: Locally Added
2796
2797   Working revision:	New file!
2798   Repository revision:	No revision control file
2799   Sticky Tag:		(none)
2800   Sticky Date:		(none)
2801   Sticky Options:	(none)
2802
2803${PROG} [a-z]*: Examining first-dir/dir1
2804===================================================================
2805File: file6            	Status: Locally Added
2806
2807   Working revision:	New file!
2808   Repository revision:	No revision control file
2809   Sticky Tag:		(none)
2810   Sticky Date:		(none)
2811   Sticky Options:	(none)
2812
2813===================================================================
2814File: file7            	Status: Locally Added
2815
2816   Working revision:	New file!
2817   Repository revision:	No revision control file
2818   Sticky Tag:		(none)
2819   Sticky Date:		(none)
2820   Sticky Options:	(none)
2821
2822${PROG} [a-z]*: Examining first-dir/dir1/dir2
2823===================================================================
2824File: file6            	Status: Locally Added
2825
2826   Working revision:	New file!
2827   Repository revision:	No revision control file
2828   Sticky Tag:		(none)
2829   Sticky Date:		(none)
2830   Sticky Options:	(none)
2831
2832===================================================================
2833File: file7            	Status: Locally Added
2834
2835   Working revision:	New file!
2836   Repository revision:	No revision control file
2837   Sticky Tag:		(none)
2838   Sticky Date:		(none)
2839   Sticky Options:	(none)"
2840
2841# XXX why is this commented out???
2842#		if ${CVS} diff -u first-dir   >> ${LOGFILE} || test $? = 1 ; then
2843#		    pass 34
2844#		else
2845#		    fail 34
2846#		fi
2847
2848		dotest basic2-8 "${testcvs} -q ci -m 'second dive' first-dir" \
2849"RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
2850done
2851Checking in first-dir/file6;
2852${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
2853initial revision: 1\.1
2854done
2855RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
2856done
2857Checking in first-dir/file7;
2858${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
2859initial revision: 1\.1
2860done
2861RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
2862done
2863Checking in first-dir/dir1/file6;
2864${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
2865initial revision: 1\.1
2866done
2867RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
2868done
2869Checking in first-dir/dir1/file7;
2870${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
2871initial revision: 1\.1
2872done
2873RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
2874done
2875Checking in first-dir/dir1/dir2/file6;
2876${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
2877initial revision: 1\.1
2878done
2879RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
2880done
2881Checking in first-dir/dir1/dir2/file7;
2882${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
2883initial revision: 1\.1
2884done"
2885
2886		dotest basic2-9 "${testcvs} tag second-dive first-dir" \
2887"${PROG} [a-z]*: Tagging first-dir
2888T first-dir/file6
2889T first-dir/file7
2890${PROG} [a-z]*: Tagging first-dir/dir1
2891T first-dir/dir1/file6
2892T first-dir/dir1/file7
2893${PROG} [a-z]*: Tagging first-dir/dir1/dir2
2894T first-dir/dir1/dir2/file6
2895T first-dir/dir1/dir2/file7"
2896
2897		# third dive - in bunch o' directories, add bunch o' files,
2898		# delete some, change some.
2899
2900		for i in first-dir dir1 dir2 ; do
2901			cd $i
2902
2903			# modify a file
2904			echo file6 >>file6
2905
2906			# delete a file
2907			rm file7
2908
2909			dotest basic2-10-$i "${testcvs} rm file7" \
2910"${PROG} [a-z]*: scheduling .file7. for removal
2911${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
2912
2913			# and add a new file
2914			echo file14 >file14
2915
2916			dotest basic2-11-$i "${testcvs} add file14" \
2917"${PROG} [a-z]*: scheduling file .file14. for addition
2918${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
2919		done
2920
2921		cd ../../..
2922		dotest basic2-12 "${testcvs} update first-dir" \
2923"${PROG} [a-z]*: Updating first-dir
2924A first-dir/file14
2925M first-dir/file6
2926R first-dir/file7
2927${PROG} [a-z]*: Updating first-dir/dir1
2928A first-dir/dir1/file14
2929M first-dir/dir1/file6
2930R first-dir/dir1/file7
2931${PROG} [a-z]*: Updating first-dir/dir1/dir2
2932A first-dir/dir1/dir2/file14
2933M first-dir/dir1/dir2/file6
2934R first-dir/dir1/dir2/file7"
2935
2936		# FIXME: doesn't work right for added files
2937		dotest basic2-13 "${testcvs} log first-dir" \
2938"${PROG} [a-z]*: Logging first-dir
2939${PROG} [a-z]*: file14 has been added, but not committed
2940
2941RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
2942Working file: first-dir/file6
2943head: 1\.1
2944branch:
2945locks: strict
2946access list:
2947symbolic names:
2948	second-dive: 1\.1
2949keyword substitution: kv
2950total revisions: 1;	selected revisions: 1
2951description:
2952----------------------------
2953revision 1\.1
2954date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2955second dive
2956=============================================================================
2957
2958RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
2959Working file: first-dir/file7
2960head: 1\.1
2961branch:
2962locks: strict
2963access list:
2964symbolic names:
2965	second-dive: 1\.1
2966keyword substitution: kv
2967total revisions: 1;	selected revisions: 1
2968description:
2969----------------------------
2970revision 1\.1
2971date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2972second dive
2973=============================================================================
2974${PROG} [a-z]*: Logging first-dir/dir1
2975${PROG} [a-z]*: file14 has been added, but not committed
2976
2977RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
2978Working file: first-dir/dir1/file6
2979head: 1\.1
2980branch:
2981locks: strict
2982access list:
2983symbolic names:
2984	second-dive: 1\.1
2985keyword substitution: kv
2986total revisions: 1;	selected revisions: 1
2987description:
2988----------------------------
2989revision 1\.1
2990date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
2991second dive
2992=============================================================================
2993
2994RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
2995Working file: first-dir/dir1/file7
2996head: 1\.1
2997branch:
2998locks: strict
2999access list:
3000symbolic names:
3001	second-dive: 1\.1
3002keyword substitution: kv
3003total revisions: 1;	selected revisions: 1
3004description:
3005----------------------------
3006revision 1\.1
3007date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3008second dive
3009=============================================================================
3010${PROG} [a-z]*: Logging first-dir/dir1/dir2
3011${PROG} [a-z]*: file14 has been added, but not committed
3012
3013RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3014Working file: first-dir/dir1/dir2/file6
3015head: 1\.1
3016branch:
3017locks: strict
3018access list:
3019symbolic names:
3020	second-dive: 1\.1
3021keyword substitution: kv
3022total revisions: 1;	selected revisions: 1
3023description:
3024----------------------------
3025revision 1\.1
3026date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3027second dive
3028=============================================================================
3029
3030RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3031Working file: first-dir/dir1/dir2/file7
3032head: 1\.1
3033branch:
3034locks: strict
3035access list:
3036symbolic names:
3037	second-dive: 1\.1
3038keyword substitution: kv
3039total revisions: 1;	selected revisions: 1
3040description:
3041----------------------------
3042revision 1\.1
3043date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
3044second dive
3045============================================================================="
3046
3047		dotest basic2-14 "${testcvs} status first-dir" \
3048"${PROG} [a-z]*: Examining first-dir
3049===================================================================
3050File: file14           	Status: Locally Added
3051
3052   Working revision:	New file!
3053   Repository revision:	No revision control file
3054   Sticky Tag:		(none)
3055   Sticky Date:		(none)
3056   Sticky Options:	(none)
3057
3058===================================================================
3059File: file6            	Status: Locally Modified
3060
3061   Working revision:	1\.1.*
3062   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file6,v
3063   Sticky Tag:		(none)
3064   Sticky Date:		(none)
3065   Sticky Options:	(none)
3066
3067===================================================================
3068File: no file file7		Status: Locally Removed
3069
3070   Working revision:	-1\.1.*
3071   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file7,v
3072   Sticky Tag:		(none)
3073   Sticky Date:		(none)
3074   Sticky Options:	(none)
3075
3076${PROG} [a-z]*: Examining first-dir/dir1
3077===================================================================
3078File: file14           	Status: Locally Added
3079
3080   Working revision:	New file!
3081   Repository revision:	No revision control file
3082   Sticky Tag:		(none)
3083   Sticky Date:		(none)
3084   Sticky Options:	(none)
3085
3086===================================================================
3087File: file6            	Status: Locally Modified
3088
3089   Working revision:	1\.1.*
3090   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
3091   Sticky Tag:		(none)
3092   Sticky Date:		(none)
3093   Sticky Options:	(none)
3094
3095===================================================================
3096File: no file file7		Status: Locally Removed
3097
3098   Working revision:	-1\.1.*
3099   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
3100   Sticky Tag:		(none)
3101   Sticky Date:		(none)
3102   Sticky Options:	(none)
3103
3104${PROG} [a-z]*: Examining first-dir/dir1/dir2
3105===================================================================
3106File: file14           	Status: Locally Added
3107
3108   Working revision:	New file!
3109   Repository revision:	No revision control file
3110   Sticky Tag:		(none)
3111   Sticky Date:		(none)
3112   Sticky Options:	(none)
3113
3114===================================================================
3115File: file6            	Status: Locally Modified
3116
3117   Working revision:	1\.1.*
3118   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
3119   Sticky Tag:		(none)
3120   Sticky Date:		(none)
3121   Sticky Options:	(none)
3122
3123===================================================================
3124File: no file file7		Status: Locally Removed
3125
3126   Working revision:	-1\.1.*
3127   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
3128   Sticky Tag:		(none)
3129   Sticky Date:		(none)
3130   Sticky Options:	(none)"
3131
3132# XXX why is this commented out?
3133#		if ${CVS} diff -u first-dir  >> ${LOGFILE} || test $? = 1 ; then
3134#		    pass 42
3135#		else
3136#		    fail 42
3137#		fi
3138
3139		dotest basic2-16 "${testcvs} ci -m 'third dive' first-dir" \
3140"${PROG} [a-z]*: Examining first-dir
3141${PROG} [a-z]*: Examining first-dir/dir1
3142${PROG} [a-z]*: Examining first-dir/dir1/dir2
3143RCS file: ${CVSROOT_DIRNAME}/first-dir/file14,v
3144done
3145Checking in first-dir/file14;
3146${CVSROOT_DIRNAME}/first-dir/file14,v  <--  file14
3147initial revision: 1\.1
3148done
3149Checking in first-dir/file6;
3150${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
3151new revision: 1\.2; previous revision: 1\.1
3152done
3153Removing first-dir/file7;
3154${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
3155new revision: delete; previous revision: 1\.1
3156done
3157RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v
3158done
3159Checking in first-dir/dir1/file14;
3160${CVSROOT_DIRNAME}/first-dir/dir1/file14,v  <--  file14
3161initial revision: 1\.1
3162done
3163Checking in first-dir/dir1/file6;
3164${CVSROOT_DIRNAME}/first-dir/dir1/file6,v  <--  file6
3165new revision: 1\.2; previous revision: 1\.1
3166done
3167Removing first-dir/dir1/file7;
3168${CVSROOT_DIRNAME}/first-dir/dir1/file7,v  <--  file7
3169new revision: delete; previous revision: 1\.1
3170done
3171RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v
3172done
3173Checking in first-dir/dir1/dir2/file14;
3174${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v  <--  file14
3175initial revision: 1\.1
3176done
3177Checking in first-dir/dir1/dir2/file6;
3178${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v  <--  file6
3179new revision: 1\.2; previous revision: 1\.1
3180done
3181Removing first-dir/dir1/dir2/file7;
3182${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v  <--  file7
3183new revision: delete; previous revision: 1\.1
3184done"
3185		dotest basic2-17 "${testcvs} -q update first-dir" ''
3186
3187		dotest basic2-18 "${testcvs} tag third-dive first-dir" \
3188"${PROG} [a-z]*: Tagging first-dir
3189T first-dir/file14
3190T first-dir/file6
3191${PROG} [a-z]*: Tagging first-dir/dir1
3192T first-dir/dir1/file14
3193T first-dir/dir1/file6
3194${PROG} [a-z]*: Tagging first-dir/dir1/dir2
3195T first-dir/dir1/dir2/file14
3196T first-dir/dir1/dir2/file6"
3197
3198		dotest basic2-19 "echo yes | ${testcvs} release -d first-dir" \
3199"You have \[0\] altered files in this repository\.
3200Are you sure you want to release (and delete) directory .first-dir.: "
3201
3202		# end of third dive
3203		dotest_fail basic2-20 "test -d first-dir" ""
3204
3205		# now try some rtags
3206
3207		# rtag HEADS
3208		dotest basic2-21 "${testcvs} rtag rtagged-by-head first-dir" \
3209"${PROG} [a-z]*: Tagging first-dir
3210${PROG} [a-z]*: Tagging first-dir/dir1
3211${PROG} [a-z]*: Tagging first-dir/dir1/dir2"
3212
3213		# tag by tag
3214		dotest basic2-22 "${testcvs} rtag -r rtagged-by-head rtagged-by-tag first-dir" \
3215"${PROG} [a-z]*: Tagging first-dir
3216${PROG} [a-z]*: Tagging first-dir/dir1
3217${PROG} [a-z]*: Tagging first-dir/dir1/dir2"
3218
3219		# tag by revision
3220		dotest basic2-23 "${testcvs} rtag -r1.1 rtagged-by-revision first-dir" \
3221"${PROG} [a-z]*: Tagging first-dir
3222${PROG} [a-z]*: Tagging first-dir/dir1
3223${PROG} [a-z]*: Tagging first-dir/dir1/dir2"
3224
3225		# rdiff by revision
3226		dotest basic2-24 "${testcvs} rdiff -r1.1 -rrtagged-by-head first-dir" \
3227"${PROG} [a-z]*: Diffing first-dir
3228Index: first-dir/file6
3229diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
3230\*\*\* first-dir/file6:1\.1	.*
3231--- first-dir/file6	.*
3232\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3233\*\*\* 1 \*\*\*\*
3234--- 1,2 ----
3235  file6
3236${PLUS} file6
3237Index: first-dir/file7
3238diff -c first-dir/file7:1\.1 first-dir/file7:removed
3239\*\*\* first-dir/file7:1.1	.*
3240--- first-dir/file7	.*
3241\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3242\*\*\* 1 \*\*\*\*
3243- file7
3244--- 0 ----
3245${PROG} [a-z]*: Diffing first-dir/dir1
3246Index: first-dir/dir1/file6
3247diff -c first-dir/dir1/file6:1\.1 first-dir/dir1/file6:1\.2
3248\*\*\* first-dir/dir1/file6:1\.1	.*
3249--- first-dir/dir1/file6	.*
3250\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3251\*\*\* 1 \*\*\*\*
3252--- 1,2 ----
3253  file6
3254${PLUS} file6
3255Index: first-dir/dir1/file7
3256diff -c first-dir/dir1/file7:1\.1 first-dir/dir1/file7:removed
3257\*\*\* first-dir/dir1/file7:1\.1	.*
3258--- first-dir/dir1/file7	.*
3259\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3260\*\*\* 1 \*\*\*\*
3261- file7
3262--- 0 ----
3263${PROG} [a-z]*: Diffing first-dir/dir1/dir2
3264Index: first-dir/dir1/dir2/file6
3265diff -c first-dir/dir1/dir2/file6:1\.1 first-dir/dir1/dir2/file6:1\.2
3266\*\*\* first-dir/dir1/dir2/file6:1\.1	.*
3267--- first-dir/dir1/dir2/file6	.*
3268\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3269\*\*\* 1 \*\*\*\*
3270--- 1,2 ----
3271  file6
3272${PLUS} file6
3273Index: first-dir/dir1/dir2/file7
3274diff -c first-dir/dir1/dir2/file7:1\.1 first-dir/dir1/dir2/file7:removed
3275\*\*\* first-dir/dir1/dir2/file7:1\.1	.*
3276--- first-dir/dir1/dir2/file7	.*
3277\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3278\*\*\* 1 \*\*\*\*
3279- file7
3280--- 0 ----"
3281		# now export by rtagged-by-head and rtagged-by-tag and compare.
3282		dotest basic2-25 "${testcvs} export -r rtagged-by-head first-dir" \
3283"${PROG} [a-z]*: Updating first-dir
3284U first-dir/file14
3285U first-dir/file6
3286${PROG} [a-z]*: Updating first-dir/dir1
3287U first-dir/dir1/file14
3288U first-dir/dir1/file6
3289${PROG} [a-z]*: Updating first-dir/dir1/dir2
3290U first-dir/dir1/dir2/file14
3291U first-dir/dir1/dir2/file6"
3292
3293		mv first-dir 1dir
3294		dotest basic2-26 "${testcvs} export -r rtagged-by-tag first-dir" \
3295"${PROG} [a-z]*: Updating first-dir
3296U first-dir/file14
3297U first-dir/file6
3298${PROG} [a-z]*: Updating first-dir/dir1
3299U first-dir/dir1/file14
3300U first-dir/dir1/file6
3301${PROG} [a-z]*: Updating first-dir/dir1/dir2
3302U first-dir/dir1/dir2/file14
3303U first-dir/dir1/dir2/file6"
3304
3305		dotest basic2-27 "directory_cmp 1dir first-dir"
3306		rm -r 1dir first-dir
3307
3308		# checkout by revision vs export by rtagged-by-revision and compare.
3309		dotest basic2-28 "${testcvs} export -rrtagged-by-revision -d export-dir first-dir" \
3310"${PROG} [a-z]*: Updating export-dir
3311U export-dir/file14
3312U export-dir/file6
3313U export-dir/file7
3314${PROG} [a-z]*: Updating export-dir/dir1
3315U export-dir/dir1/file14
3316U export-dir/dir1/file6
3317U export-dir/dir1/file7
3318${PROG} [a-z]*: Updating export-dir/dir1/dir2
3319U export-dir/dir1/dir2/file14
3320U export-dir/dir1/dir2/file6
3321U export-dir/dir1/dir2/file7"
3322
3323		dotest basic2-29 "${testcvs} co -r1.1 first-dir" \
3324"${PROG} [a-z]*: Updating first-dir
3325U first-dir/file14
3326U first-dir/file6
3327U first-dir/file7
3328${PROG} [a-z]*: Updating first-dir/dir1
3329U first-dir/dir1/file14
3330U first-dir/dir1/file6
3331U first-dir/dir1/file7
3332${PROG} [a-z]*: Updating first-dir/dir1/dir2
3333U first-dir/dir1/dir2/file14
3334U first-dir/dir1/dir2/file6
3335U first-dir/dir1/dir2/file7"
3336
3337		# directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
3338		mkdir first-dir.cpy ; (cd first-dir ; tar cf - . | (cd ../first-dir.cpy ; tar xf -))
3339
3340		dotest basic2-30 "directory_cmp first-dir export-dir"
3341
3342		# interrupt, while we've got a clean 1.1 here, let's import it
3343		# into a couple of other modules.
3344		cd export-dir
3345		dotest_sort basic2-31 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
3346"
3347
3348N second-dir/dir1/dir2/file14
3349N second-dir/dir1/dir2/file6
3350N second-dir/dir1/dir2/file7
3351N second-dir/dir1/file14
3352N second-dir/dir1/file6
3353N second-dir/dir1/file7
3354N second-dir/file14
3355N second-dir/file6
3356N second-dir/file7
3357No conflicts created by this import
3358${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/second-dir/dir1
3359${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/second-dir/dir1/dir2"
3360		cd ..
3361
3362		dotest basic2-32 "${testcvs} export -r HEAD second-dir" \
3363"${PROG} [a-z]*: Updating second-dir
3364U second-dir/file14
3365U second-dir/file6
3366U second-dir/file7
3367${PROG} [a-z]*: Updating second-dir/dir1
3368U second-dir/dir1/file14
3369U second-dir/dir1/file6
3370U second-dir/dir1/file7
3371${PROG} [a-z]*: Updating second-dir/dir1/dir2
3372U second-dir/dir1/dir2/file14
3373U second-dir/dir1/dir2/file6
3374U second-dir/dir1/dir2/file7"
3375
3376		dotest basic2-33 "directory_cmp first-dir second-dir"
3377
3378		rm -r second-dir
3379
3380		rm -r export-dir first-dir
3381		mkdir first-dir
3382		(cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
3383
3384		# update the top, cancelling sticky tags, retag, update other copy, compare.
3385		cd first-dir
3386		dotest basic2-34 "${testcvs} update -A -l *file*" \
3387"[UP] file6
3388${PROG} [a-z]*: file7 is no longer in the repository"
3389
3390		# If we don't delete the tag first, cvs won't retag it.
3391		# This would appear to be a feature.
3392		dotest basic2-35 "${testcvs} tag -l -d rtagged-by-revision" \
3393"${PROG} [a-z]*: Untagging \.
3394D file14
3395D file6"
3396		dotest basic2-36 "${testcvs} tag -l rtagged-by-revision" \
3397"${PROG} [a-z]*: Tagging \.
3398T file14
3399T file6"
3400
3401		cd ..
3402		mv first-dir 1dir
3403		mv first-dir.cpy first-dir
3404		cd first-dir
3405
3406		dotest basic2-37 "${testcvs} -q diff -u" ''
3407
3408		dotest basic2-38 "${testcvs} update" \
3409"${PROG} [a-z]*: Updating .
3410${PROG} [a-z]*: Updating dir1
3411${PROG} [a-z]*: Updating dir1/dir2"
3412
3413		cd ..
3414
3415		#### FIXME: is this expected to work???  Need to investigate
3416		#### and fix or remove the test.
3417#		dotest basic2-39 "directory_cmp 1dir first-dir"
3418
3419		rm -r 1dir first-dir
3420
3421		# Test the cvs history command.
3422
3423		# The reason that there are two patterns rather than using
3424		# \(${TESTDIR}\|<remote>\) is that we are trying to
3425		# make this portable.  Perhaps at some point we should
3426		# ditch that notion and require GNU expr (or dejagnu or....)
3427		# since it seems to be so painful.
3428
3429		# why are there two lines at the end of the local output
3430		# which don't exist in the remote output?  would seem to be
3431		# a CVS bug.
3432		dotest basic2-64 "${testcvs} his -x TOFWUCGMAR -a" \
3433"O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= ${TESTDIR}/\*
3434A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == ${TESTDIR}
3435A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == ${TESTDIR}
3436A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == ${TESTDIR}
3437A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == ${TESTDIR}
3438A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == ${TESTDIR}
3439A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == ${TESTDIR}
3440A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == ${TESTDIR}
3441M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}
3442R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == ${TESTDIR}
3443A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == ${TESTDIR}
3444M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == ${TESTDIR}
3445R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == ${TESTDIR}
3446A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == ${TESTDIR}
3447M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == ${TESTDIR}
3448R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == ${TESTDIR}
3449F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= ${TESTDIR}/\*
3450T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
3451T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
3452T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
3453O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= ${TESTDIR}/\*
3454U [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == ${TESTDIR}/first-dir
3455W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == ${TESTDIR}/first-dir" \
3456"O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir           =first-dir= <remote>/\*
3457A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir           == <remote>
3458A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir           == <remote>
3459A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1      == <remote>
3460A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1      == <remote>
3461A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6     first-dir/dir1/dir2 == <remote>
3462A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7     first-dir/dir1/dir2 == <remote>
3463A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir           == <remote>
3464M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir           == <remote>
3465R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir           == <remote>
3466A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1      == <remote>
3467M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1      == <remote>
3468R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1      == <remote>
3469A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14    first-dir/dir1/dir2 == <remote>
3470M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6     first-dir/dir1/dir2 == <remote>
3471R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7     first-dir/dir1/dir2 == <remote>
3472F [0-9-]* [0-9:]* ${PLUS}0000 ${username}                     =first-dir= <remote>/\*
3473T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
3474T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
3475T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
3476O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir           =first-dir= <remote>/\*
3477W [0-9-]* [0-9:]* ${PLUS}0000 ${username}     file7     first-dir           == <remote>" \
3478
3479		rm -rf ${CVSROOT_DIRNAME}/first-dir
3480		rm -rf ${CVSROOT_DIRNAME}/second-dir
3481		;;
3482
3483	files)
3484	  # Test of how we specify files on the command line
3485	  # (recurse.c and that sort of thing).  Vaguely similar to
3486	  # tests like basic* and deep.  See modules and such tests
3487	  # for what happens when we throw in modules and co -d, &c.
3488
3489	  # This particular test is fairly carefully crafted, to spot
3490	  # one particular issue with remote.
3491	  mkdir 1; cd 1
3492	  dotest files-1 "${testcvs} -q co -l ." ""
3493	  mkdir first-dir
3494	  dotest files-2 "${testcvs} add first-dir" \
3495"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
3496	  cd first-dir
3497	  touch tfile
3498	  dotest files-3 "${testcvs} add tfile" \
3499"${PROG} [a-z]*: scheduling file .tfile. for addition
3500${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3501	  dotest files-4 "${testcvs} -q ci -m add" \
3502"RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
3503done
3504Checking in tfile;
3505${CVSROOT_DIRNAME}/first-dir/tfile,v  <--  tfile
3506initial revision: 1\.1
3507done"
3508	  dotest files-5 "${testcvs} -q tag -b C" "T tfile"
3509	  dotest files-6 "${testcvs} -q update -r C" ""
3510	  mkdir dir
3511	  dotest files-7 "${testcvs} add dir" \
3512"Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository
3513--> Using per-directory sticky tag .C'"
3514	  cd dir
3515	  touch .file
3516	  dotest files-6 "${testcvs} add .file" \
3517"${PROG} [a-z]*: scheduling file .\.file' for addition on branch .C.
3518${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3519	  mkdir sdir
3520	  dotest files-7 "${testcvs} add sdir" \
3521"Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir added to the repository
3522--> Using per-directory sticky tag .C'"
3523	  cd sdir
3524	  mkdir ssdir
3525	  dotest files-8 "${testcvs} add ssdir" \
3526"Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir added to the repository
3527--> Using per-directory sticky tag .C'"
3528	  cd ssdir
3529	  touch .file
3530	  dotest files-9 "${testcvs} add .file" \
3531"${PROG} [a-z]*: scheduling file .\.file' for addition on branch .C.
3532${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3533	  cd ../..
3534	  dotest files-10 "${testcvs} -q ci -m test" \
3535"RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v
3536done
3537Checking in \.file;
3538${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3539new revision: 1\.1\.2\.1; previous revision: 1\.1
3540done
3541RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v
3542done
3543Checking in sdir/ssdir/\.file;
3544${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3545new revision: 1\.1\.2\.1; previous revision: 1\.1
3546done"
3547	  dotest files-11 \
3548"${testcvs} commit -m test -f ./.file ./sdir/ssdir/.file" \
3549"Checking in \.file;
3550${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3551new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
3552done
3553Checking in \./sdir/ssdir/\.file;
3554${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3555new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
3556done"
3557	  if $remote; then
3558	    # This is a bug, looks like that toplevel_repos cruft in
3559	    # client.c is coming back to haunt us.
3560	    # May want to think about the whole issue, toplevel_repos
3561	    # has always been crufty and trying to patch it up again
3562	    # might be a mistake.
3563	    dotest_fail files-12 \
3564"${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
3565"${PROG} server: Up-to-date check failed for .\.file'
3566${PROG} \[server aborted\]: correct above errors first!"
3567
3568	    # Sync up the version numbers so that the rest of the
3569	    # tests don't need to expect different numbers based
3570	    # local or remote.
3571	    dotest files-12-workaround \
3572"${testcvs} commit -f -m test sdir/ssdir/.file .file" \
3573"Checking in sdir/ssdir/\.file;
3574${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3575new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3576done
3577Checking in \.file;
3578${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3579new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3580done"
3581	  else
3582	    dotest files-12 \
3583"${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
3584"Checking in \./sdir/ssdir/\.file;
3585${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3586new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3587done
3588Checking in \.file;
3589${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3590new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
3591done"
3592	  fi
3593	  dotest files-13 \
3594"${testcvs} commit -fmtest ./sdir/../sdir/ssdir/..///ssdir/.file" \
3595"Checking in \./sdir/\.\./sdir/ssdir/\.\.///ssdir/\.file;
3596${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v  <--  \.file
3597new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
3598done"
3599	  if $remote; then
3600	    dotest_fail files-14 \
3601"${testcvs} commit -fmtest ../../first-dir/dir/.file" \
3602"protocol error: .\.\./\.\./first-dir/dir' has too many \.\."
3603	  else
3604	    dotest files-14 \
3605"${testcvs} commit -fmtest ../../first-dir/dir/.file" \
3606"Checking in \.\./\.\./first-dir/dir/\.file;
3607${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v  <--  \.file
3608new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
3609done"
3610	  fi
3611	  cd ../../..
3612
3613	  rm -r 1
3614	  rm -rf ${CVSROOT_DIRNAME}/first-dir
3615	  ;;
3616
3617	spacefiles)
3618	  # More filename tests, in particular spaces in file names.
3619	  # (it might be better to just change a few of the names in
3620	  # basica or some other test instead, always good to keep the
3621	  # testsuite concise).
3622
3623	  # I wrote this test to worry about problems in do_module;
3624	  # but then I found that the CVS server has its own problems
3625	  # with filenames starting with "-".  Work around it for now.
3626	  if $remote; then
3627	    dashb=dashb
3628	    dashc=dashc
3629	  else
3630	    dashb=-b
3631	    dashc=-c
3632	  fi
3633
3634	  mkdir 1; cd 1
3635	  dotest spacefiles-1 "${testcvs} -q co -l ." ""
3636	  touch ./${dashc} top
3637	  dotest spacefiles-2 "${testcvs} add -- ${dashc} top" \
3638"${PROG} [a-z]*: scheduling file .${dashc}. for addition
3639${PROG} [a-z]*: scheduling file .top. for addition
3640${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
3641	  dotest spacefiles-3 "${testcvs} -q ci -m add" \
3642"RCS file: ${CVSROOT_DIRNAME}/${dashc},v
3643done
3644Checking in ${dashc};
3645${CVSROOT_DIRNAME}/${dashc},v  <--  ${dashc}
3646initial revision: 1\.1
3647done
3648RCS file: ${CVSROOT_DIRNAME}/top,v
3649done
3650Checking in top;
3651${CVSROOT_DIRNAME}/top,v  <--  top
3652initial revision: 1\.1
3653done"
3654	  mkdir 'first dir'
3655	  dotest spacefiles-4 "${testcvs} add 'first dir'" \
3656"Directory ${CVSROOT_DIRNAME}/first dir added to the repository"
3657	  mkdir ./${dashb}
3658	  dotest spacefiles-5 "${testcvs} add -- ${dashb}" \
3659"Directory ${CVSROOT_DIRNAME}/${dashb} added to the repository"
3660	  cd 'first dir'
3661	  touch 'a file'
3662	  dotest spacefiles-6 "${testcvs} add 'a file'" \
3663"${PROG} [a-z]*: scheduling file .a file. for addition
3664${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3665	  dotest spacefiles-7 "${testcvs} -q ci -m add" \
3666"RCS file: ${CVSROOT_DIRNAME}/first dir/a file,v
3667done
3668Checking in a file;
3669${CVSROOT_DIRNAME}/first dir/a file,v  <--  a file
3670initial revision: 1\.1
3671done"
3672	  dotest spacefiles-8 "${testcvs} -q tag new-tag" "T a file"
3673	  cd ../..
3674
3675	  mkdir 2; cd 2
3676	  # Leading slash strikes me as kind of oddball, but there is
3677	  # a special case for it in do_module.  And (in the case of
3678	  # "top", rather than "-c") it has worked in CVS 1.10.6 and
3679	  # presumably back to CVS 1.3 or so.
3680	  dotest spacefiles-9 "${testcvs} -q co -- /top" "U \./top"
3681	  dotest spacefiles-10 "${testcvs} co -- ${dashb}" \
3682"${PROG} [a-z]*: Updating ${dashb}"
3683	  dotest spacefiles-11 "${testcvs} -q co -- ${dashc}" "U \./${dashc}"
3684	  rm ./${dashc}
3685	  dotest spacefiles-12 "${testcvs} -q co -- /${dashc}" "U \./${dashc}"
3686	  dotest spacefiles-13 "${testcvs} -q co 'first dir'" \
3687"U first dir/a file"
3688	  cd ..
3689
3690	  mkdir 3; cd 3
3691	  dotest spacefiles-14 "${testcvs} -q co 'first dir/a file'" \
3692"U first dir/a file"
3693	  cd ..
3694
3695	  rm -r 1 2 3
3696	  rm -rf "${CVSROOT_DIRNAME}/first dir"
3697	  rm -r ${CVSROOT_DIRNAME}/${dashb}
3698	  rm -f ${CVSROOT_DIRNAME}/${dashc},v ${CVSROOT_DIRNAME}/top,v
3699	  ;;
3700
3701	commit-readonly)
3702	  mkdir 1; cd 1
3703	  module=x
3704
3705	  : > junk
3706	  dotest commit-readonly-1 "$testcvs -Q import -m . $module X Y" ''
3707	  dotest commit-readonly-2 "$testcvs -Q co $module" ''
3708	  cd $module
3709
3710	  file=m
3711
3712	  # Include an rcs keyword to be expanded.
3713	  echo '$Id''$' > $file
3714
3715	  dotest commit-readonly-3 "$testcvs add $file" \
3716"${PROG} [a-z]*: scheduling file .$file. for addition
3717${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3718	  dotest commit-readonly-4 "$testcvs -Q ci -m . $file" \
3719"RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
3720done
3721Checking in $file;
3722${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
3723initial revision: 1\.1
3724done"
3725
3726	  echo line2 >> $file
3727	  # Make the file read-only.
3728	  chmod a-w $file
3729
3730	  dotest commit-readonly-5 "$testcvs -Q ci -m . $file" \
3731"Checking in $file;
3732${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
3733new revision: 1\.2; previous revision: 1\.1
3734done"
3735
3736	  cd ../..
3737	  rm -rf 1
3738	  rm -rf ${CVSROOT_DIRNAME}/$module
3739	  ;;
3740
3741
3742	rdiff)
3743		# Test rdiff
3744		# XXX for now this is just the most essential test...
3745		cd ${TESTDIR}
3746
3747		mkdir testimport
3748		cd testimport
3749		echo '$''Id$' > foo
3750		echo '$''Name$' >> foo
3751		echo '$''Id$' > bar
3752		echo '$''Name$' >> bar
3753		dotest_sort rdiff-1 \
3754		  "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
3755'
3756
3757N trdiff/bar
3758N trdiff/foo
3759No conflicts created by this import'
3760		dotest rdiff-2 \
3761		  "${testcvs} co -ko trdiff" \
3762"${PROG} [a-z]*: Updating trdiff
3763U trdiff/bar
3764U trdiff/foo"
3765		cd trdiff
3766		echo something >> foo
3767		dotest rdiff-3 \
3768		  "${testcvs} ci -m added-something foo" \
3769"Checking in foo;
3770${CVSROOT_DIRNAME}/trdiff/foo,v  <--  foo
3771new revision: 1\.2; previous revision: 1\.1
3772done"
3773		echo '#ident	"@(#)trdiff:$''Name$:$''Id$"' > new
3774		echo "new file" >> new
3775		dotest rdiff-4 \
3776		  "${testcvs} add -m new-file-description new" \
3777"${PROG} [a-z]*: scheduling file \`new' for addition
3778${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3779		dotest rdiff-5 \
3780		  "${testcvs} commit -m added-new-file new" \
3781"RCS file: ${CVSROOT_DIRNAME}/trdiff/new,v
3782done
3783Checking in new;
3784${CVSROOT_DIRNAME}/trdiff/new,v  <--  new
3785initial revision: 1\.1
3786done"
3787		dotest rdiff-6 \
3788		  "${testcvs} tag local-v0" \
3789"${PROG} [a-z]*: Tagging .
3790T bar
3791T foo
3792T new"
3793		dotest rdiff-7 \
3794		  "${testcvs} status -v foo" \
3795"===================================================================
3796File: foo              	Status: Up-to-date
3797
3798   Working revision:	1\.2.*
3799   Repository revision:	1\.2	${CVSROOT_DIRNAME}/trdiff/foo,v
3800   Sticky Tag:		(none)
3801   Sticky Date:		(none)
3802   Sticky Options:	-ko
3803
3804   Existing Tags:
3805	local-v0                 	(revision: 1\.2)
3806	T1                       	(revision: 1\.1\.1\.1)
3807	TRDIFF                   	(branch: 1\.1\.1)"
3808
3809		cd ..
3810		rm -r trdiff
3811
3812		dotest rdiff-8 \
3813		  "${testcvs} rdiff -r T1 -r local-v0 trdiff" \
3814"${PROG}"' [a-z]*: Diffing trdiff
3815Index: trdiff/foo
3816diff -c trdiff/foo:1\.1\.1\.1 trdiff/foo:1\.2
3817\*\*\* trdiff/foo:1\.1\.1\.1	.*
3818--- trdiff/foo	.*
3819\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3820\*\*\* 1,2 \*\*\*\*
3821! \$''Id: foo,v 1\.1\.1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$
3822! \$''Name: T1 \$
3823--- 1,3 ----
3824! \$''Id: foo,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
3825! \$''Name: local-v0 \$
3826! something
3827Index: trdiff/new
3828diff -c /dev/null trdiff/new:1\.1
3829\*\*\* /dev/null	.*
3830--- trdiff/new	.*
3831\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
3832\*\*\* 0 \*\*\*\*
3833--- 1,2 ----
3834'"${PLUS}"' #ident	"@(#)trdiff:\$''Name: local-v0 \$:\$''Id: new,v 1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$"
3835'"${PLUS}"' new file'
3836
3837		if $keep; then
3838		  echo Keeping ${TESTDIR} and exiting due to --keep
3839		  exit 0
3840		fi
3841
3842		cd ..
3843		rm -r testimport
3844		rm -rf ${CVSROOT_DIRNAME}/trdiff
3845		;;
3846
3847	diff)
3848	  # Various tests specific to the "cvs diff" command.
3849	  # Related tests:
3850	  #   death2: -N
3851	  #   rcslib: cvs diff and $Name.
3852	  #   rdiff: cvs rdiff.
3853	  #   diffmerge*: nuts and bolts (stuff within diff library)
3854	  mkdir 1; cd 1
3855	  dotest diff-1 "${testcvs} -q co -l ." ''
3856	  mkdir first-dir
3857	  dotest diff-2 "${testcvs} add first-dir" \
3858"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
3859	  cd first-dir
3860
3861	  # diff is anomalous.  Most CVS commands print the "nothing
3862	  # known" message (or worse yet, no message in some cases) but
3863	  # diff says "I know nothing".  Shrug.
3864	  dotest_fail diff-3 "${testcvs} diff xyzpdq" \
3865"${PROG} [a-z]*: I know nothing about xyzpdq"
3866	  touch abc
3867	  dotest diff-4 "${testcvs} add abc" \
3868"${PROG} [a-z]*: scheduling file .abc. for addition
3869${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
3870	  dotest diff-5 "${testcvs} -q ci -mtest" \
3871"RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
3872done
3873Checking in abc;
3874${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
3875initial revision: 1\.1
3876done"
3877	  echo "extern int gethostname ();" >abc
3878	  dotest diff-6 "${testcvs} -q ci -mtest" \
3879"Checking in abc;
3880${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
3881new revision: 1\.2; previous revision: 1\.1
3882done"
3883	  echo "#include <winsock.h>" >abc
3884	  # check the behavior of the --ifdef=MACRO option
3885	  dotest_fail diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \
3886"Index: abc
3887===================================================================
3888RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
3889retrieving revision 1\.2
3890diff --ifdef=HAVE_WINSOCK_H -r1\.2 abc
3891#ifndef HAVE_WINSOCK_H
3892extern int gethostname ();
3893#else /\* HAVE_WINSOCK_H \*/
3894#include <winsock\.h>
3895#endif /\* HAVE_WINSOCK_H \*/"
3896
3897	  if $keep; then
3898	    echo Keeping ${TESTDIR} and exiting due to --keep
3899	    exit 0
3900	  fi
3901
3902	  cd ../..
3903	  rm -rf ${CVSROOT_DIRNAME}/first-dir
3904	  rm -r 1
3905	  ;;
3906
3907	death)
3908		# next dive.  test death support.
3909
3910		# NOTE: this section has reached the size and
3911		# complexity where it is getting to be a good idea to
3912		# add new death support tests to a new section rather
3913		# than continuing to piggyback them onto the tests here.
3914
3915		mkdir  ${CVSROOT_DIRNAME}/first-dir
3916		if ${CVS} co first-dir  ; then
3917		    pass 65
3918		else
3919		    fail 65
3920		fi
3921
3922		cd first-dir
3923
3924		# Create a directory with only dead files, to make sure CVS
3925		# doesn't get confused by it.
3926		mkdir subdir
3927		dotest 65a0 "${testcvs} add subdir" \
3928"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
3929		cd subdir
3930		echo file in subdir >sfile
3931		dotest 65a1 "${testcvs} add sfile" \
3932"${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition
3933'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
3934		dotest 65a2 "${testcvs} -q ci -m add-it" \
3935"RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
3936done
3937Checking in sfile;
3938${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
3939initial revision: 1\.1
3940done"
3941		rm sfile
3942		dotest 65a3 "${testcvs} rm sfile" \
3943"${PROG}"' [a-z]*: scheduling `sfile'\'' for removal
3944'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
3945		dotest 65a4 "${testcvs} -q ci -m remove-it" \
3946"Removing sfile;
3947${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
3948new revision: delete; previous revision: 1\.1
3949done"
3950		cd ..
3951		dotest 65a5 "${testcvs} -q update -P" ''
3952		dotest_fail 65a6 "test -d subdir" ''
3953
3954		# add a file.
3955		touch file1
3956		if ${CVS} add file1  2>> ${LOGFILE}; then
3957		    pass 66
3958		else
3959		    fail 66
3960		fi
3961
3962		# commit
3963		if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
3964		    pass 67
3965		else
3966		    fail 67
3967		fi
3968
3969		# remove
3970		rm file1
3971		if ${CVS} rm file1  2>> ${LOGFILE}; then
3972		    pass 68
3973		else
3974		    fail 68
3975		fi
3976
3977		# commit
3978		if ${CVS} ci -m test  >>${LOGFILE} ; then
3979		    pass 69
3980		else
3981		    fail 69
3982		fi
3983
3984		dotest_fail 69a0 "test -f file1" ''
3985		# get the old contents of file1 back
3986		if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
3987		  pass 69a1
3988		else
3989		  fail 69a1
3990		fi
3991		dotest 69a2 "cat file1" ''
3992
3993		# create second file
3994		touch file2
3995		if ${CVS} add file1 file2  2>> ${LOGFILE}; then
3996		    pass 70
3997		else
3998		    fail 70
3999		fi
4000
4001		# commit
4002		if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4003		    pass 71
4004		else
4005		    fail 71
4006		fi
4007
4008		# log
4009		if ${CVS} log file1  >> ${LOGFILE}; then
4010		    pass 72
4011		else
4012		    fail 72
4013		fi
4014
4015		# file4 will be dead at the time of branching and stay dead.
4016		echo file4 > file4
4017		dotest death-file4-add "${testcvs} add file4" \
4018"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
4019'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
4020		dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
4021"RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
4022done
4023Checking in file4;
4024${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4025initial revision: 1\.1
4026done"
4027		rm file4
4028		dotest death-file4-rm "${testcvs} remove file4" \
4029"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
4030'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
4031		dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
4032"Removing file4;
4033${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4034new revision: delete; previous revision: 1\.1
4035done"
4036
4037		# Tag the branchpoint.
4038		dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
4039T file2'
4040
4041		# branch1
4042		if ${CVS} tag -b branch1  ; then
4043		    pass 73
4044		else
4045		    fail 73
4046		fi
4047
4048		# and move to the branch.
4049		if ${CVS} update -r branch1  ; then
4050		    pass 74
4051		else
4052		    fail 74
4053		fi
4054
4055		dotest_fail death-file4-3 "test -f file4" ''
4056
4057		# add a file in the branch
4058		echo line1 from branch1 >> file3
4059		if ${CVS} add file3  2>> ${LOGFILE}; then
4060		    pass 75
4061		else
4062		    fail 75
4063		fi
4064
4065		# commit
4066		if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4067		    pass 76
4068		else
4069		    fail 76
4070		fi
4071
4072		dotest death-76a0 \
4073"${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
4074"Index: first-dir/file3
4075diff -c /dev/null first-dir/file3:1\.1\.2\.1
4076\*\*\* /dev/null	.*
4077--- first-dir/file3	.*
4078\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4079\*\*\* 0 \*\*\*\*
4080--- 1 ----
4081${PLUS} line1 from branch1"
4082		dotest death-76a1 \
4083"${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
4084'Index: first-dir/file3
4085diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
4086\*\*\* first-dir/file3:1\.1\.2\.1	.*
4087--- first-dir/file3	.*
4088\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4089\*\*\* 1 \*\*\*\*
4090- line1 from branch1
4091--- 0 ----'
4092
4093		# remove
4094		rm file3
4095		if ${CVS} rm file3  2>> ${LOGFILE}; then
4096		    pass 77
4097		else
4098		    fail 77
4099		fi
4100
4101		# commit
4102		if ${CVS} ci -m test  >>${LOGFILE} ; then
4103		    pass 78
4104		else
4105		    fail 78
4106		fi
4107
4108		# add again
4109		echo line1 from branch1 >> file3
4110		if ${CVS} add file3  2>> ${LOGFILE}; then
4111		    pass 79
4112		else
4113		    fail 79
4114		fi
4115
4116		# commit
4117		if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4118		    pass 80
4119		else
4120		    fail 80
4121		fi
4122
4123		# change the first file
4124		echo line2 from branch1 >> file1
4125
4126		# commit
4127		if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
4128		    pass 81
4129		else
4130		    fail 81
4131		fi
4132
4133		# remove the second
4134		rm file2
4135		if ${CVS} rm file2  2>> ${LOGFILE}; then
4136		    pass 82
4137		else
4138		    fail 82
4139		fi
4140
4141		# commit
4142		if ${CVS} ci -m test  >>${LOGFILE}; then
4143		    pass 83
4144		else
4145		    fail 83
4146		fi
4147
4148		# back to the trunk.
4149		if ${CVS} update -A  2>> ${LOGFILE}; then
4150		    pass 84
4151		else
4152		    fail 84
4153		fi
4154
4155		dotest_fail death-file4-4 "test -f file4" ''
4156
4157		if test -f file3 ; then
4158		    fail 85
4159		else
4160		    pass 85
4161		fi
4162
4163		# join
4164		dotest 86 "${testcvs} -q update -j branch1" \
4165"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4166retrieving revision 1\.3
4167retrieving revision 1\.3\.2\.1
4168Merging differences between 1\.3 and 1\.3\.2\.1 into file1
4169${PROG} [a-z]*: scheduling file2 for removal
4170U file3"
4171
4172		dotest_fail death-file4-5 "test -f file4" ''
4173
4174		if test -f file3 ; then
4175		    pass 87
4176		else
4177		    fail 87
4178		fi
4179
4180		# Make sure that we joined the correct change to file1
4181		if echo line2 from branch1 | cmp - file1 >/dev/null; then
4182		    pass 87a
4183		else
4184		    fail 87a
4185		fi
4186
4187		# update
4188		if ${CVS} update  ; then
4189		    pass 88
4190		else
4191		    fail 88
4192		fi
4193
4194		# commit
4195		dotest 89 "${testcvs} -q ci -m test" \
4196"Checking in file1;
4197${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4198new revision: 1\.4; previous revision: 1\.3
4199done
4200Removing file2;
4201${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
4202new revision: delete; previous revision: 1\.1
4203done
4204Checking in file3;
4205${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
4206new revision: 1\.2; previous revision: 1\.1
4207done"
4208		cd ..
4209		mkdir 2
4210		cd 2
4211		dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
4212U first-dir/file3'
4213		cd ..
4214		rm -r 2
4215		cd first-dir
4216
4217		# remove first file.
4218		rm file1
4219		if ${CVS} rm file1  2>> ${LOGFILE}; then
4220		    pass 90
4221		else
4222		    fail 90
4223		fi
4224
4225		# commit
4226		if ${CVS} ci -m test  >>${LOGFILE}; then
4227		    pass 91
4228		else
4229		    fail 91
4230		fi
4231
4232		if test -f file1 ; then
4233		    fail 92
4234		else
4235		    pass 92
4236		fi
4237
4238		# typo; try to get to the branch and fail
4239		dotest_fail 92.1a "${testcvs} update -r brnach1" \
4240		  "${PROG}"' \[[a-z]* aborted\]: no such tag brnach1'
4241		# Make sure we are still on the trunk
4242		if test -f file1 ; then
4243		    fail 92.1b
4244		else
4245		    pass 92.1b
4246		fi
4247		if test -f file3 ; then
4248		    pass 92.1c
4249		else
4250		    fail 92.1c
4251		fi
4252
4253		# back to branch1
4254		if ${CVS} update -r branch1  2>> ${LOGFILE}; then
4255		    pass 93
4256		else
4257		    fail 93
4258		fi
4259
4260		dotest_fail death-file4-6 "test -f file4" ''
4261
4262		if test -f file1 ; then
4263		    pass 94
4264		else
4265		    fail 94
4266		fi
4267
4268		# and join
4269		dotest 95 "${testcvs} -q update -j HEAD" \
4270"${PROG}"' [a-z]*: file file1 has been modified, but has been removed in revision HEAD
4271'"${PROG}"' [a-z]*: file file3 exists, but has been added in revision HEAD'
4272
4273		dotest_fail death-file4-7 "test -f file4" ''
4274
4275		# file2 should not have been recreated.  It was
4276		# deleted on the branch, and has not been modified on
4277		# the trunk.  That means that there have been no
4278		# changes between the greatest common ancestor (the
4279		# trunk version) and HEAD.
4280		dotest_fail death-file2-1 "test -f file2" ''
4281
4282		cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
4283		;;
4284
4285	death2)
4286	  # More tests of death support.
4287	  mkdir ${CVSROOT_DIRNAME}/first-dir
4288	  dotest death2-1 "${testcvs} -q co first-dir" ''
4289
4290	  cd first-dir
4291
4292	  # Add two files on the trunk.
4293	  echo "first revision" > file1
4294	  echo "file4 first revision" > file4
4295	  dotest death2-2 "${testcvs} add file1 file4" \
4296"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
4297'"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
4298'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
4299
4300	  dotest death2-3 "${testcvs} -q commit -m add" \
4301"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4302done
4303Checking in file1;
4304${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4305initial revision: 1\.1
4306done
4307RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
4308done
4309Checking in file4;
4310${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4311initial revision: 1\.1
4312done"
4313
4314	  # Make a branch and a non-branch tag.
4315	  dotest death2-4 "${testcvs} -q tag -b branch" \
4316'T file1
4317T file4'
4318	  dotest death2-5 "${testcvs} -q tag tag" \
4319'T file1
4320T file4'
4321
4322	  # Switch over to the branch.
4323	  dotest death2-6 "${testcvs} -q update -r branch" ''
4324
4325	  # Delete the file on the branch.
4326	  rm file1
4327	  dotest death2-7 "${testcvs} rm file1" \
4328"${PROG} [a-z]*: scheduling .file1. for removal
4329${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4330
4331	  # Test diff of the removed file before it is committed.
4332	  dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
4333"${PROG} [a-z]*: file1 was removed, no comparison available"
4334
4335	  # If the DIFF that CVS is using (options.h) is Sun diff, this
4336	  # test is said to fail (I think the /dev/null is the part
4337	  # that differs), along with a number of the other similar tests.
4338	  dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
4339"Index: file1
4340===================================================================
4341RCS file: file1
4342diff -N file1
4343\*\*\* file1	${RFCDATE}	[0-9.]*
4344--- /dev/null	${RFCDATE_EPOCH}
4345\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4346\*\*\* 1 \*\*\*\*
4347- first revision
4348--- 0 ----"
4349
4350	  dotest death2-8 "${testcvs} -q ci -m removed" \
4351"Removing file1;
4352${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4353new revision: delete; previous revision: 1\.1\.2
4354done"
4355
4356	  # Test diff of a dead file.
4357	  dotest_fail death2-diff-3 \
4358"${testcvs} -q diff -r1.1 -rbranch -c file1" \
4359"${PROG} [a-z]*: file1 was removed, no comparison available"
4360
4361	  dotest_fail death2-diff-4 \
4362"${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
4363"Index: file1
4364===================================================================
4365RCS file: file1
4366diff -N file1
4367\*\*\* file1	${RFCDATE}	[0-9.]*
4368--- /dev/null	${RFCDATE_EPOCH}
4369\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4370\*\*\* 1 \*\*\*\*
4371- first revision
4372--- 0 ----"
4373
4374	  dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \
4375"${PROG} [a-z]*: file1 no longer exists, no comparison available"
4376
4377	  dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \
4378"Index: file1
4379===================================================================
4380RCS file: file1
4381diff -N file1
4382\*\*\* file1	[-a-zA-Z0-9: ]*	[0-9.]*
4383--- /dev/null	${RFCDATE_EPOCH}
4384\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4385\*\*\* 1 \*\*\*\*
4386- first revision
4387--- 0 ----"
4388
4389	  # Test rdiff of a dead file.
4390	  dotest death2-rdiff-1 \
4391"${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
4392
4393	  dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
4394"Index: first-dir/file1
4395diff -c first-dir/file1:1\.1 first-dir/file1:removed
4396\*\*\* first-dir/file1:1\.1	[a-zA-Z0-9: ]*
4397--- first-dir/file1	[a-zA-Z0-9: ]*
4398\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4399\*\*\* 1 \*\*\*\*
4400- first revision
4401--- 0 ----"
4402
4403	  # Readd the file to the branch.
4404	  echo "second revision" > file1
4405	  dotest death2-9 "${testcvs} add file1" \
4406"${PROG}"' [a-z]*: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
4407'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
4408
4409	  # Test diff of the added file before it is committed.
4410	  dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
4411"${PROG} [a-z]*: file1 is a new entry, no comparison available"
4412
4413	  dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \
4414"Index: file1
4415===================================================================
4416RCS file: file1
4417diff -N file1
4418\*\*\* /dev/null	${RFCDATE_EPOCH}
4419--- file1	${RFCDATE}
4420\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4421\*\*\* 0 \*\*\*\*
4422--- 1 ----
4423${PLUS} second revision"
4424
4425	  dotest death2-10 "${testcvs} -q commit -m add" \
4426"Checking in file1;
4427${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4428new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
4429done"
4430
4431	  # Delete file4 from the branch
4432	  dotest death2-10a "${testcvs} rm -f file4" \
4433"${PROG} [a-z]*: scheduling .file4. for removal
4434${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4435	  dotest death2-10b "${testcvs} -q ci -m removed" \
4436"Removing file4;
4437${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4438new revision: delete; previous revision: 1\.1\.2
4439done"
4440
4441	  # Back to the trunk.
4442	  dotest death2-11 "${testcvs} -q update -A" \
4443"[UP] file1
4444U file4"
4445
4446	  # Add another file on the trunk.
4447	  echo "first revision" > file2
4448	  dotest death2-12 "${testcvs} add file2" \
4449"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
4450'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
4451	  dotest death2-13 "${testcvs} -q commit -m add" \
4452"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
4453done
4454Checking in file2;
4455${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
4456initial revision: 1\.1
4457done"
4458
4459	  # Modify file4 on the trunk.
4460	  echo "new file4 revision" > file4
4461	  dotest death2-13a "${testcvs} -q commit -m mod" \
4462"Checking in file4;
4463${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4464new revision: 1\.2; previous revision: 1\.1
4465done"
4466
4467	  # Back to the branch.
4468	  # The ``no longer in the repository'' message doesn't really
4469	  # look right to me, but that's what CVS currently prints for
4470	  # this case.
4471	  dotest death2-14 "${testcvs} -q update -r branch" \
4472"[UP] file1
4473${PROG} [a-z]*: file2 is no longer in the repository
4474${PROG} [a-z]*: file4 is no longer in the repository"
4475
4476	  # Add a file on the branch with the same name.
4477	  echo "branch revision" > file2
4478	  dotest death2-15 "${testcvs} add file2" \
4479"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
4480'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
4481	  dotest death2-16 "${testcvs} -q commit -m add" \
4482"Checking in file2;
4483${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
4484new revision: 1\.1\.2\.1; previous revision: 1\.1
4485done"
4486
4487	  # Add a new file on the branch.
4488	  echo "first revision" > file3
4489	  dotest death2-17 "${testcvs} add file3" \
4490"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition on branch `branch'\''
4491'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
4492	  dotest death2-18 "${testcvs} -q commit -m add" \
4493"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
4494done
4495Checking in file3;
4496${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
4497new revision: 1\.1\.2\.1; previous revision: 1\.1
4498done"
4499
4500	  # Test diff of a nonexistent tag
4501	  dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \
4502"${PROG} [a-z]*: tag tag is not in file file3"
4503
4504	  dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \
4505"Index: file3
4506===================================================================
4507RCS file: file3
4508diff -N file3
4509\*\*\* /dev/null	${RFCDATE_EPOCH}
4510--- file3	${RFCDATE}	[0-9.]*
4511\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4512\*\*\* 0 \*\*\*\*
4513--- 1 ----
4514${PLUS} first revision"
4515
4516	  dotest_fail death2-diff-11 "${testcvs} -q diff -rtag -c ." \
4517"Index: file1
4518===================================================================
4519RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4520retrieving revision 1\.1
4521retrieving revision 1\.1\.2\.2
4522diff -c -r1\.1 -r1\.1\.2\.2
4523\*\*\* file1	${RFCDATE}	[0-9.]*
4524--- file1	${RFCDATE}	[0-9.]*
4525\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4526\*\*\* 1 \*\*\*\*
4527! first revision
4528--- 1 ----
4529! second revision
4530${PROG} [a-z]*: tag tag is not in file file2
4531${PROG} [a-z]*: tag tag is not in file file3
4532${PROG} [a-z]*: file4 no longer exists, no comparison available"
4533
4534	  dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \
4535"Index: file1
4536===================================================================
4537RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4538retrieving revision 1\.1
4539retrieving revision 1\.1\.2\.2
4540diff -c -r1\.1 -r1\.1\.2\.2
4541\*\*\* file1	${RFCDATE}	[0-9.]*
4542--- file1	${RFCDATE}	[0-9.]*
4543\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4544\*\*\* 1 \*\*\*\*
4545! first revision
4546--- 1 ----
4547! second revision
4548Index: file2
4549===================================================================
4550RCS file: file2
4551diff -N file2
4552\*\*\* /dev/null	${RFCDATE_EPOCH}
4553--- file2	${RFCDATE}	[0-9.]*
4554\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4555\*\*\* 0 \*\*\*\*
4556--- 1 ----
4557${PLUS} branch revision
4558Index: file3
4559===================================================================
4560RCS file: file3
4561diff -N file3
4562\*\*\* /dev/null	${RFCDATE_EPOCH}
4563--- file3	${RFCDATE}	[0-9.]*
4564\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4565\*\*\* 0 \*\*\*\*
4566--- 1 ----
4567${PLUS} first revision
4568Index: file4
4569===================================================================
4570RCS file: file4
4571diff -N file4
4572\*\*\* file4	${RFCDATE}	[0-9.]*
4573--- /dev/null	${RFCDATE_EPOCH}
4574\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4575\*\*\* 1 \*\*\*\*
4576- file4 first revision
4577--- 0 ----"
4578
4579	  # Switch to the nonbranch tag.
4580	  dotest death2-19 "${testcvs} -q update -r tag" \
4581"[UP] file1
4582${PROG} [a-z]*: file2 is no longer in the repository
4583${PROG} [a-z]*: file3 is no longer in the repository
4584U file4"
4585
4586	  dotest_fail death2-20 "test -f file2"
4587
4588	  # Make sure diff only reports appropriate files.
4589	  dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \
4590"${PROG} [a-z]*: file1 is a new entry, no comparison available"
4591
4592	  dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \
4593"Index: file1
4594===================================================================
4595RCS file: file1
4596diff -N file1
4597\*\*\* /dev/null	${RFCDATE_EPOCH}
4598--- file1	${RFCDATE}	[0-9.]*
4599\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
4600\*\*\* 0 \*\*\*\*
4601--- 1 ----
4602${PLUS} first revision"
4603
4604	  # now back to the trunk
4605	  dotest death2-21 "${testcvs} -q update -A" \
4606"U file2
4607[UP] file4"
4608
4609	  # test merging with a dead file
4610	  dotest death2-22 "${testcvs} -q co first-dir" \
4611"U first-dir/file1
4612U first-dir/file2
4613U first-dir/file4"
4614
4615	  cd first-dir
4616	  dotest death2-23 "${testcvs} rm -f file4" \
4617"${PROG} [a-z]*: scheduling .file4. for removal
4618${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4619	  dotest death2-24 "${testcvs} -q ci -m removed file4" \
4620"Removing file4;
4621${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
4622new revision: delete; previous revision: 1\.2
4623done"
4624	  cd ..
4625	  echo "new stuff" >file4
4626	  dotest_fail death2-25 "${testcvs} up file4" \
4627"${PROG} [a-z]*: conflict: file4 is modified but no longer in the repository
4628C file4"
4629
4630	  cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
4631	  ;;
4632
4633	rm-update-message)
4634	  # FIXME
4635	  # local CVS prints a warning message when update notices a missing
4636	  # file and client/server CVS doesn't.  These should be identical.
4637	  mkdir rm-update-message; cd rm-update-message
4638	  mkdir $CVSROOT_DIRNAME/rm-update-message
4639	  dotest rm-update-message-setup-1 "$testcvs -q co rm-update-message" ''
4640	  cd rm-update-message
4641	  file=x
4642	  echo >$file
4643	  dotest rm-update-message-setup-2 "$testcvs -q add $file" \
4644"$PROG [a-z]*: use .cvs commit. to add this file permanently"
4645	  dotest rm-update-message-setup-3 "$testcvs -q ci -mcreate $file" \
4646"RCS file: $CVSROOT_DIRNAME/rm-update-message/$file,v
4647done
4648Checking in $file;
4649$CVSROOT_DIRNAME/rm-update-message/$file,v  <--  $file
4650initial revision: 1\.1
4651done"
4652
4653	  rm $file
4654	  if $remote; then
4655	    dotest rm-update-message-1 "$testcvs up $file" "U $file"
4656	  else
4657	    dotest rm-update-message-1 "$testcvs up $file" \
4658"$PROG [a-z]*: warning: $file was lost
4659U $file"
4660	  fi
4661
4662	  cd ../..
4663	  if $keep; then :; else
4664	    rm -rf rm-update-message
4665	    rm -rf $CVSROOT_DIRNAME/rm-update-message
4666	  fi
4667	  ;;
4668
4669	rmadd)
4670	  # More tests of adding and removing files.
4671	  # In particular ci -r.
4672	  # Other ci -r tests:
4673	  #   * editor-9: checking in a modified file,
4674	  #     where "ci -r" means a branch.
4675	  #   * basica-8a1: checking in a modified file with numeric revision.
4676	  #   * basica-8a2: likewise.
4677	  #   * keywordlog-4: adding a new file with numeric revision.
4678	  mkdir 1; cd 1
4679	  dotest rmadd-1 "${testcvs} -q co -l ." ''
4680	  mkdir first-dir
4681	  dotest rmadd-2 "${testcvs} add first-dir" \
4682"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4683	  cd first-dir
4684	  echo first file1 >file1
4685	  dotest rmadd-3 "${testcvs} add file1" \
4686"${PROG} [a-z]*: scheduling file .file1. for addition
4687${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4688
4689	  dotest_fail rmadd-4 "${testcvs} -q ci -r 1.2.2.4 -m add" \
4690"${PROG} [a-z]*: cannot add file .file1' with revision .1\.2\.2\.4'; must be on trunk
4691${PROG} \[[a-z]* aborted\]: correct above errors first!"
4692	  dotest_fail rmadd-5 "${testcvs} -q ci -r 1.2.2 -m add" \
4693"${PROG} [a-z]*: cannot add file .file1' with revision .1\.2\.2'; must be on trunk
4694${PROG} \[[a-z]* aborted\]: correct above errors first!"
4695	  dotest_fail rmadd-6 "${testcvs} -q ci -r mybranch -m add" \
4696"${PROG} \[[a-z]* aborted\]: no such tag mybranch"
4697
4698	  # The thing with the trailing periods strikes me as a very
4699	  # bizarre behavior, but it would seem to be intentional
4700	  # (see commit.c).  It probably could go away....
4701	  dotest rmadd-7 "${testcvs} -q ci -r 7.... -m add" \
4702"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4703done
4704Checking in file1;
4705${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4706initial revision: 7\.1
4707done"
4708	  if $remote; then
4709	    # I guess remote doesn't set a sticky tag in this case.
4710	    # Kind of odd, in the sense that rmadd-24a does set one
4711	    # both local and remote.
4712	    dotest_fail rmadd-7a "test -f CVS/Tag"
4713	    echo T7 >CVS/Tag
4714	  else
4715	    dotest rmadd-7a "cat CVS/Tag" "T7"
4716	  fi
4717
4718	  dotest rmadd-8 "${testcvs} -q tag -b mybranch" "T file1"
4719	  dotest rmadd-9 "${testcvs} -q tag mynonbranch" "T file1"
4720
4721	  touch file2
4722	  # The previous "cvs ci -r" set a sticky tag of '7'.  Seems a
4723	  # bit odd, and I guess commit.c (findmaxrev) makes '7' sticky
4724	  # tags unnecessary (?).  I kind of suspect that it should be
4725	  # saying "sticky tag is not a branch" like keywordlog-4b.
4726	  # Or something.
4727	  dotest rmadd-10 "${testcvs} add file2" \
4728"${PROG} [a-z]*: scheduling file .file2. for addition on branch .7'
4729${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4730	  # As in the previous example, CVS is confused....
4731	  dotest rmadd-11 "${testcvs} -q ci -m add" \
4732"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
4733done
4734Checking in file2;
4735${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
4736initial revision: 7\.1
4737done"
4738
4739	  dotest rmadd-12 "${testcvs} -q update -A" ""
4740	  touch file3
4741	  dotest rmadd-13 "${testcvs} add file3" \
4742"${PROG} [a-z]*: scheduling file .file3. for addition
4743${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4744	  # Huh?  file2 is not up to date?  Seems buggy to me....
4745	  dotest_fail rmadd-14 "${testcvs} -q ci -r mybranch -m add" \
4746"${PROG} [a-z]*: Up-to-date check failed for .file2'
4747${PROG} \[[a-z]* aborted\]: correct above errors first!"
4748	  # Whatever, let's not let file2 distract us....
4749	  dotest rmadd-15 "${testcvs} -q ci -r mybranch -m add file3" \
4750"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
4751done
4752Checking in file3;
4753${CVSROOT_DIRNAME}/first-dir/Attic/file3,v  <--  file3
4754new revision: 1\.1\.2\.1; previous revision: 1\.1
4755done"
4756
4757	  touch file4
4758	  dotest rmadd-16 "${testcvs} add file4" \
4759"${PROG} [a-z]*: scheduling file .file4. for addition
4760${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4761	  # Same "Up-to-date check" issues as in rmadd-14.
4762	  # The "no such tag" thing is due to the fact that we only
4763	  # update val-tags when the tag is used (might be more of a
4764	  # bug than a feature, I dunno).
4765	  dotest_fail rmadd-17 \
4766"${testcvs} -q ci -r mynonbranch -m add file4" \
4767"${PROG} \[[a-z]* aborted\]: no such tag mynonbranch"
4768	  # Try to make CVS write val-tags.
4769	  dotest rmadd-18 "${testcvs} -q update -p -r mynonbranch file1" \
4770"first file1"
4771	  # Oops, -p suppresses writing val-tags (probably a questionable
4772	  # behavior).
4773	  dotest_fail rmadd-19 \
4774"${testcvs} -q ci -r mynonbranch -m add file4" \
4775"${PROG} \[[a-z]* aborted\]: no such tag mynonbranch"
4776	  # Now make CVS write val-tags for real.
4777	  dotest rmadd-20 "${testcvs} -q update -r mynonbranch file1" ""
4778	  # Oops - CVS isn't distinguishing between a branch tag and
4779	  # a non-branch tag.
4780	  dotest rmadd-21 \
4781"${testcvs} -q ci -r mynonbranch -m add file4" \
4782"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v
4783done
4784Checking in file4;
4785${CVSROOT_DIRNAME}/first-dir/Attic/file4,v  <--  file4
4786new revision: 1\.1\.2\.1; previous revision: 1\.1
4787done"
4788
4789	  # OK, we add this one in a vanilla way, but then check in
4790	  # a modification with ci -r and sniff around for sticky tags.
4791	  echo file5 >file5
4792	  dotest rmadd-22 "${testcvs} add file5" \
4793"${PROG} [a-z]*: scheduling file .file5. for addition
4794${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4795	  if $remote; then
4796	    # Interesting bug (or missing feature) here.  findmaxrev
4797	    # gets the major revision from the Entries.  Well, remote
4798	    # doesn't send the entries for files which are not involved.
4799	    dotest rmadd-23r "${testcvs} -q ci -m add" \
4800"RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
4801done
4802Checking in file5;
4803${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
4804initial revision: 1\.1
4805done"
4806	    dotest rmadd-23-workaroundr \
4807"${testcvs} -q ci -r 7 -m bump-it file5" \
4808"Checking in file5;
4809${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
4810new revision: 7\.1; previous revision: 1\.1
4811done"
4812	  else
4813	    dotest rmadd-23 "${testcvs} -q ci -m add" \
4814"RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
4815done
4816Checking in file5;
4817${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
4818initial revision: 7\.1
4819done"
4820	  fi
4821	  echo change it >file5
4822	  dotest_fail rmadd-24 "${testcvs} -q ci -r 4.8 -m change file5" \
4823"Checking in file5;
4824${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
4825${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file5,v: revision 4\.8 too low; must be higher than 7\.1
4826${PROG} [a-z]*: could not check in file5
48277\.1 unlocked"
4828	  dotest rmadd-24a "${testcvs} -q ci -r 8.4 -m change file5" \
4829"Checking in file5;
4830${CVSROOT_DIRNAME}/first-dir/file5,v  <--  file5
4831new revision: 8\.4; previous revision: 7\.1
4832done"
4833	  # I'm not really sure that a sticky tag make sense here.
4834	  # It seems to be longstanding behavior for what that is worth.
4835	  dotest rmadd-25 "${testcvs} status file5" \
4836"===================================================================
4837File: file5            	Status: Up-to-date
4838
4839   Working revision:	8\.4.*
4840   Repository revision:	8\.4	${CVSROOT_DIRNAME}/first-dir/file5,v
4841   Sticky Tag:		8\.4
4842   Sticky Date:		(none)
4843   Sticky Options:	(none)"
4844
4845	  cd ../..
4846	  rm -r 1
4847	  rm -rf ${CVSROOT_DIRNAME}/first-dir
4848	  ;;
4849
4850	rmadd2)
4851	  # Tests of undoing commits, including in the presence of
4852	  # adding and removing files.  See join for a list of -j tests.
4853	  mkdir 1; cd 1
4854	  dotest rmadd2-1 "${testcvs} -q co -l ." ''
4855	  mkdir first-dir
4856	  dotest rmadd2-2 "${testcvs} add first-dir" \
4857"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
4858	  cd first-dir
4859	  echo 'initial contents' >file1
4860	  dotest rmadd2-3 "${testcvs} add file1" \
4861"${PROG} [a-z]*: scheduling file .file1. for addition
4862${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
4863	  dotest rmadd2-4 "${testcvs} -q ci -m add" \
4864"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4865done
4866Checking in file1;
4867${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4868initial revision: 1\.1
4869done"
4870	  dotest rmadd2-4a "${testcvs} -Q tag tagone" ""
4871	  dotest rmadd2-5 "${testcvs} rm -f file1" \
4872"${PROG} [a-z]*: scheduling .file1. for removal
4873${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
4874	  dotest rmadd2-6 "${testcvs} -q ci -m remove" \
4875"Removing file1;
4876${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4877new revision: delete; previous revision: 1\.1
4878done"
4879	  dotest rmadd2-7 "${testcvs} -q update -j 1.2 -j 1.1 file1" "U file1"
4880	  dotest rmadd2-8 "${testcvs} -q ci -m readd" \
4881"Checking in file1;
4882${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4883new revision: 1\.3; previous revision: 1\.2
4884done"
4885	  echo 'new contents' >file1
4886	  dotest rmadd2-9 "${testcvs} -q ci -m modify" \
4887"Checking in file1;
4888${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4889new revision: 1\.4; previous revision: 1\.3
4890done"
4891	  dotest rmadd2-10 "${testcvs} -q update -j 1.4 -j 1.3 file1" \
4892"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
4893retrieving revision 1\.4
4894retrieving revision 1\.3
4895Merging differences between 1\.4 and 1\.3 into file1"
4896	  dotest rmadd2-11 "${testcvs} -q ci -m undo" \
4897"Checking in file1;
4898${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4899new revision: 1\.5; previous revision: 1\.4
4900done"
4901	  dotest rmadd2-12 "cat file1" "initial contents"
4902	  dotest rmadd2-13 "${testcvs} -q update -p -r 1.3" "initial contents"
4903
4904	  # Hmm, might be a bit odd that this works even if 1.3 is not
4905	  # the head.
4906	  dotest rmadd2-14 "${testcvs} -q update -j 1.3 -j 1.2 file1" \
4907"${PROG} [a-z]*: scheduling file1 for removal"
4908
4909	  # Check that -p can get arbitrary revisions of a removed file
4910	  dotest rmadd2-14a "${testcvs} -q update -p" "initial contents"
4911	  dotest rmadd2-14b "${testcvs} -q update -p -r 1.5" "initial contents"
4912	  dotest rmadd2-14c "${testcvs} -q update -p -r 1.3" "initial contents"
4913
4914	  dotest rmadd2-15 "${testcvs} -q ci -m re-remove" \
4915"Removing file1;
4916${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
4917new revision: delete; previous revision: 1\.5
4918done"
4919	  dotest rmadd2-16 "${testcvs} log -h file1" "
4920RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
4921Working file: file1
4922head: 1\.6
4923branch:
4924locks: strict
4925access list:
4926symbolic names:
4927	tagone: 1\.1
4928keyword substitution: kv
4929total revisions: 6
4930============================================================================="
4931	  dotest rmadd2-17 "${testcvs} status -v file1" \
4932"===================================================================
4933File: no file file1		Status: Up-to-date
4934
4935   Working revision:	No entry for file1
4936   Repository revision:	1\.6	${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
4937
4938   Existing Tags:
4939	tagone                   	(revision: 1.1)"
4940
4941	  cd ../..
4942
4943	  rm -r 1
4944	  rm -rf ${CVSROOT_DIRNAME}/first-dir
4945	  ;;
4946
4947	dirs)
4948	  # Tests related to removing and adding directories.
4949	  # See also:
4950	  #   conflicts (especially dir1 in conflicts-130): What happens if
4951	  #     directory exists in repository and a non-CVS-controlled
4952	  #     directory in the working directory?
4953	  #   conflicts3-15.  More cases, especially where CVS directory
4954	  #     exists but without CVS/Repository and friends.
4955	  #   conflicts3-22.  Similar to conflicts-130 but there is a file
4956	  #     in the directory.
4957	  #   dirs2.  Sort of similar to conflicts3-22 but somewhat different.
4958	  mkdir imp-dir; cd imp-dir
4959	  echo file1 >file1
4960	  mkdir sdir
4961	  echo sfile >sdir/sfile
4962	  dotest_sort dirs-1 \
4963"${testcvs} import -m import-it dir1 vend rel" "
4964
4965N dir1/file1
4966N dir1/sdir/sfile
4967No conflicts created by this import
4968${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/dir1/sdir"
4969	  cd ..
4970
4971	  mkdir 1; cd 1
4972	  dotest dirs-2 "${testcvs} -Q co dir1" ""
4973
4974	  # Various CVS administrators are in the habit of removing
4975	  # the repository directory for things they don't want any
4976	  # more.  I've even been known to do it myself (on rare
4977	  # occasions).  Not the usual recommended practice, but we want
4978	  # to try to come up with some kind of reasonable/documented/sensible
4979	  # behavior.
4980	  rm -rf ${CVSROOT_DIRNAME}/dir1/sdir
4981
4982	  dotest dirs-3 "${testcvs} update" \
4983"${PROG} [a-z]*: Updating dir1
4984${PROG} [a-z]*: Updating dir1/sdir
4985${PROG} [a-z]*: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
4986${PROG} [a-z]*: skipping directory dir1/sdir"
4987	  dotest dirs-3a "${testcvs} update -d" \
4988"${PROG} [a-z]*: Updating dir1
4989${PROG} [a-z]*: Updating dir1/sdir
4990${PROG} [a-z]*: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
4991${PROG} [a-z]*: skipping directory dir1/sdir"
4992
4993	  # If we say "yes", then CVS gives errors about not being able to
4994	  # create lock files.
4995	  # The fact that it says "skipping directory " rather than
4996	  # "skipping directory dir1/sdir" is some kind of bug.
4997	  echo no | dotest dirs-4 "${testcvs} release -d dir1/sdir" \
4998"${PROG} [a-z]*: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
4999${PROG} [a-z]*: skipping directory
5000You have \[0\] altered files in this repository\.
5001Are you sure you want to release (and delete) directory .dir1/sdir': .. .release' aborted by user choice."
5002
5003	  # OK, if "cvs release" won't help, we'll try it the other way...
5004	  rm -r dir1/sdir
5005
5006	  dotest dirs-5 "cat dir1/CVS/Entries" \
5007"/file1/1.1.1.1/[a-zA-Z0-9 :]*//
5008D/sdir////"
5009	  dotest dirs-6 "${testcvs} update" "${PROG} [a-z]*: Updating dir1"
5010	  dotest dirs-7 "cat dir1/CVS/Entries" \
5011"/file1/1.1.1.1/[a-zA-Z0-9 :]*//
5012D/sdir////"
5013	  dotest dirs-8 "${testcvs} update -d dir1" \
5014"${PROG} [a-z]*: Updating dir1"
5015
5016	  cd ..
5017
5018	  rm -r imp-dir 1
5019
5020	  # clean up our repositories
5021	  rm -rf ${CVSROOT_DIRNAME}/dir1
5022	  ;;
5023
5024	dirs2)
5025	  # See "dirs" for a list of tests involving adding and
5026	  # removing directories.
5027	  mkdir 1; cd 1
5028	  dotest dirs2-1 "${testcvs} -q co -l ." ''
5029	  mkdir first-dir
5030	  dotest dirs2-2 "${testcvs} add first-dir" \
5031"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5032	  cd first-dir
5033	  mkdir sdir
5034	  dotest dirs2-3 "${testcvs} add sdir" \
5035"Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
5036	  touch sdir/file1
5037	  dotest dirs2-4 "${testcvs} add sdir/file1" \
5038"${PROG} [a-z]*: scheduling file .sdir/file1. for addition
5039${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5040	  dotest dirs2-5 "${testcvs} -q ci -m add" \
5041"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v
5042done
5043Checking in sdir/file1;
5044${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
5045initial revision: 1\.1
5046done"
5047	  rm -r sdir/CVS
5048	  if $remote; then
5049	    # This is just like conflicts3-23
5050	    dotest_fail dirs2-6 "${testcvs} update -d" \
5051"${QUESTION} sdir
5052${PROG} server: Updating \.
5053${PROG} server: Updating sdir
5054${PROG} update: move away sdir/file1; it is in the way
5055C sdir/file1"
5056	    rm sdir/file1
5057	    rm -r sdir/CVS
5058
5059	    # This is where things are not just like conflicts3-23
5060	    dotest dirs2-7 "${testcvs} update -d" \
5061"${QUESTION} sdir
5062${PROG} server: Updating \.
5063${PROG} server: Updating sdir
5064U sdir/file1"
5065	  else
5066	    dotest dirs2-6 "${testcvs} update -d" \
5067"${PROG} update: Updating \.
5068${QUESTION} sdir"
5069	    rm sdir/file1
5070	    dotest dirs2-7 "${testcvs} update -d" \
5071"${PROG} update: Updating \.
5072${QUESTION} sdir"
5073	  fi
5074	  cd ../..
5075
5076	  # Now, the same thing (more or less) on a branch.
5077	  mkdir 2; cd 2
5078	  dotest dirs2-8 "${testcvs} -q co first-dir" 'U first-dir/sdir/file1'
5079	  cd first-dir
5080	  dotest dirs2-9 "${testcvs} -q tag -b br" "T sdir/file1"
5081	  rm -r sdir/CVS
5082	  if $remote; then
5083	    # Cute little quirk of val-tags; if we don't recurse into
5084	    # the directories where the tag is defined, val-tags won't
5085	    # get updated.
5086	    dotest_fail dirs2-10 "${testcvs} update -d -r br" \
5087"${QUESTION} sdir
5088${PROG} \[server aborted\]: no such tag br"
5089	    dotest dirs2-10-rem \
5090"${testcvs} -q rdiff -u -r 1.1 -r br first-dir/sdir/file1" \
5091""
5092	    dotest_fail dirs2-10-again "${testcvs} update -d -r br" \
5093"${QUESTION} sdir
5094${PROG} server: Updating \.
5095${PROG} server: Updating sdir
5096${PROG} update: move away sdir/file1; it is in the way
5097C sdir/file1"
5098	  else
5099	    dotest_fail dirs2-10 "${testcvs} update -d -r br" \
5100"${PROG} update: in directory sdir:
5101${PROG} \[update aborted\]: there is no version here; do '${PROG} checkout' first"
5102	  fi
5103	  cd ../..
5104
5105	  # OK, the above tests make the situation somewhat harder
5106	  # than it might be, in the sense that they actually have a
5107	  # file which is alive on the branch we are updating.  Let's
5108	  # try it where it is just a directory where all the files
5109	  # have been removed.
5110	  mkdir 3; cd 3
5111	  dotest dirs2-11 "${testcvs} -q co -r br first-dir" \
5112"U first-dir/sdir/file1"
5113	  cd first-dir
5114	  # Hmm, this doesn't mention the branch like add does.  That's
5115	  # an odd non-orthogonality.
5116	  dotest dirs2-12 "${testcvs} rm -f sdir/file1" \
5117"${PROG} [a-z]*: scheduling .sdir/file1. for removal
5118${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
5119	  dotest dirs2-13 "${testcvs} -q ci -m remove" \
5120"Removing sdir/file1;
5121${CVSROOT_DIRNAME}/first-dir/sdir/file1,v  <--  file1
5122new revision: delete; previous revision: 1\.1\.2
5123done"
5124	  cd ../../2/first-dir
5125	  if $remote; then
5126	    dotest dirs2-14 "${testcvs} update -d -r br" \
5127"${QUESTION} sdir/file1
5128${PROG} server: Updating \.
5129${PROG} server: Updating sdir"
5130	  else
5131	    dotest dirs2-14 "${testcvs} update -d -r br" \
5132"${PROG} update: Updating \.
5133${QUESTION} sdir"
5134	  fi
5135	  cd ../..
5136
5137	  rm -r 1 2 3
5138	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5139	  ;;
5140
5141	branches)
5142	  # More branch tests, including branches off of branches
5143	  mkdir ${CVSROOT_DIRNAME}/first-dir
5144	  dotest branches-1 "${testcvs} -q co first-dir" ''
5145	  cd first-dir
5146	  echo 1:ancest >file1
5147	  echo 2:ancest >file2
5148	  echo 3:ancest >file3
5149	  echo 4:trunk-1 >file4
5150	  dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
5151"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
5152'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
5153'"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
5154'"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
5155'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
5156	  dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
5157	  dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
5158RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5159done
5160Checking in file1;
5161${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5162initial revision: 1.1
5163done
5164RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5165done
5166Checking in file2;
5167${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5168initial revision: 1.1
5169done
5170RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
5171done
5172Checking in file3;
5173${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
5174initial revision: 1.1
5175done
5176RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5177done
5178Checking in file4;
5179${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5180initial revision: 1.1
5181done
5182HERE
5183	  echo 4:trunk-2 >file4
5184	  dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
5185"Checking in file4;
5186${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5187new revision: 1\.2; previous revision: 1\.1
5188done"
5189	  # The "cvs log file4" in test branches-14.3 will test that we
5190	  # didn't really add the tag.
5191	  dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
5192"T file1
5193T file2
5194T file3
5195T file4"
5196	  # Modify this file before branching, to deal with the case where
5197	  # someone is hacking along, says "oops, I should be doing this on
5198	  # a branch", and only then creates the branch.
5199	  echo 1:br1 >file1
5200	  dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \.
5201T file1
5202T file2
5203T file3
5204T file4'
5205	  dotest branches-5 "${testcvs} update -r br1" \
5206"${PROG} [a-z]*: Updating \.
5207M file1"
5208	  echo 2:br1 >file2
5209	  echo 4:br1 >file4
5210	  dotest branches-6 "${testcvs} -q ci -m modify" \
5211"Checking in file1;
5212${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5213new revision: 1\.1\.2\.1; previous revision: 1\.1
5214done
5215Checking in file2;
5216${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5217new revision: 1\.1\.2\.1; previous revision: 1\.1
5218done
5219Checking in file4;
5220${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5221new revision: 1\.2\.2\.1; previous revision: 1\.2
5222done"
5223	  dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
5224T file2
5225T file3
5226T file4'
5227	  dotest branches-8 "${testcvs} -q update -r brbr" ''
5228	  echo 1:brbr >file1
5229	  echo 4:brbr >file4
5230	  dotest branches-9 "${testcvs} -q ci -m modify" \
5231"Checking in file1;
5232${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5233new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
5234done
5235Checking in file4;
5236${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5237new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
5238done"
5239	  dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
52402:br1
52413:ancest
52424:brbr'
5243	  dotest branches-11 "${testcvs} -q update -r br1" \
5244'[UP] file1
5245[UP] file4'
5246	  dotest branches-12 "cat file1 file2 file3 file4" '1:br1
52472:br1
52483:ancest
52494:br1'
5250	  echo 4:br1-2 >file4
5251	  dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
5252"Checking in file4;
5253${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5254new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
5255done"
5256	  dotest branches-13 "${testcvs} -q update -A" '[UP] file1
5257[UP] file2
5258[UP] file4'
5259	  dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
52602:ancest
52613:ancest
52624:trunk-2'
5263	  echo 4:trunk-3 >file4
5264	  dotest branches-14.2 \
5265	    "${testcvs} -q ci -m trunk-change-after-branch" \
5266"Checking in file4;
5267${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
5268new revision: 1\.3; previous revision: 1\.2
5269done"
5270	  dotest branches-14.3 "${testcvs} log file4" \
5271"
5272RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5273Working file: file4
5274head: 1\.3
5275branch:
5276locks: strict
5277access list:
5278symbolic names:
5279	brbr: 1\.2\.2\.1\.0\.2
5280	br1: 1\.2\.0\.2
5281keyword substitution: kv
5282total revisions: 6;	selected revisions: 6
5283description:
5284----------------------------
5285revision 1\.3
5286date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
5287trunk-change-after-branch
5288----------------------------
5289revision 1\.2
5290date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
5291branches:  1\.2\.2;
5292trunk-before-branch
5293----------------------------
5294revision 1\.1
5295date: [0-9/: ]*;  author: ${username};  state: Exp;
5296add-it
5297----------------------------
5298revision 1\.2\.2\.2
5299date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
5300change-on-br1
5301----------------------------
5302revision 1\.2\.2\.1
5303date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
5304branches:  1\.2\.2\.1\.2;
5305modify
5306----------------------------
5307revision 1\.2\.2\.1\.2\.1
5308date: [0-9/: ]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
5309modify
5310============================================================================="
5311	  dotest_status branches-14.4 1 \
5312	    "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
5313"Index: file4
5314===================================================================
5315RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5316retrieving revision 1\.1
5317retrieving revision 1\.3
5318diff -c -r1\.1 -r1\.3
5319\*\*\* file4	${RFCDATE}	1\.1
5320--- file4	${RFCDATE}	1\.3
5321\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5322\*\*\* 1 \*\*\*\*
5323! 4:trunk-1
5324--- 1 ----
5325! 4:trunk-3"
5326	  dotest_status branches-14.5 1 \
5327	    "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
5328"Index: file4
5329===================================================================
5330RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5331retrieving revision 1\.1
5332retrieving revision 1\.2\.2\.1
5333diff -c -r1\.1 -r1\.2\.2\.1
5334\*\*\* file4	${RFCDATE}	1\.1
5335--- file4	${RFCDATE}	1\.2\.2\.1
5336\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5337\*\*\* 1 \*\*\*\*
5338! 4:trunk-1
5339--- 1 ----
5340! 4:br1"
5341	  dotest branches-15 \
5342	    "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
5343	    "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5344retrieving revision 1\.1\.2\.1
5345retrieving revision 1\.1\.2\.1\.2\.1
5346Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
5347rcsmerge: warning: conflicts during merge"
5348	  dotest branches-16 "cat file1" '<<<<<<< file1
53491:ancest
5350[=]======
53511:brbr
5352[>]>>>>>> 1\.1\.2\.1\.2\.1'
5353
5354	  dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
5355"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5356done
5357RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5358done
5359RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
5360done
5361RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
5362done"
5363	  cd ..
5364
5365	  if $keep; then
5366	    echo Keeping ${TESTDIR} and exiting due to --keep
5367	    exit 0
5368	  fi
5369
5370	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5371	  rm -r first-dir
5372	  ;;
5373
5374	branches2)
5375	  # More branch tests.
5376	  # Test that when updating a new subdirectory in a directory
5377	  # which was checked out on a branch, the new subdirectory is
5378	  # created on the appropriate branch.  Test this when joining
5379	  # as well.
5380
5381	  mkdir ${CVSROOT_DIRNAME}/first-dir
5382	  mkdir trunk; cd trunk
5383
5384	  # Create a file.
5385	  dotest branches2-1 "${testcvs} -q co first-dir"
5386	  cd first-dir
5387	  echo "file1 first revision" > file1
5388	  dotest branches2-2 "${testcvs} add file1" \
5389"${PROG} [a-z]*: scheduling file .file1. for addition
5390${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5391	  dotest branches2-3 "${testcvs} commit -m add file1" \
5392"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5393done
5394Checking in file1;
5395${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5396initial revision: 1\.1
5397done"
5398
5399	  # Tag the file.
5400	  dotest branches2-4 "${testcvs} -q tag tag1" 'T file1'
5401
5402	  # Make two branches.
5403	  dotest branches2-5 "${testcvs} -q rtag -b -r tag1 b1 first-dir" ''
5404	  dotest branches2-6 "${testcvs} -q rtag -b -r tag1 b2 first-dir" ''
5405
5406	  # Create some files and a subdirectory on branch b1.
5407	  cd ../..
5408	  mkdir b1; cd b1
5409	  dotest branches2-7 "${testcvs} -q co -r b1 first-dir" \
5410"U first-dir/file1"
5411	  cd first-dir
5412	  echo "file2 first revision" > file2
5413	  dotest branches2-8 "${testcvs} add file2" \
5414"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `b1'\''
5415'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
5416	  mkdir dir1
5417	  dotest branches2-9 "${testcvs} add dir1" \
5418"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository
5419--> Using per-directory sticky tag "'`'"b1'"
5420	  echo "file3 first revision" > dir1/file3
5421	  dotest branches2-10 "${testcvs} add dir1/file3" \
5422"${PROG}"' [a-z]*: scheduling file `dir1/file3'\'' for addition on branch `b1'\''
5423'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
5424	  dotest branches2-11 "${testcvs} -q ci -madd ." \
5425"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
5426done
5427Checking in file2;
5428${CVSROOT_DIRNAME}/first-dir/Attic/file2,v  <--  file2
5429new revision: 1\.1\.2\.1; previous revision: 1\.1
5430done
5431RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
5432done
5433Checking in dir1/file3;
5434${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v  <--  file3
5435new revision: 1\.1\.2\.1; previous revision: 1\.1
5436done"
5437
5438	  # Check out the second branch, and update the working
5439	  # directory to the first branch, to make sure the right
5440	  # happens with dir1.
5441	  cd ../..
5442	  mkdir b2; cd b2
5443	  dotest branches2-12 "${testcvs} -q co -r b2 first-dir" \
5444'U first-dir/file1'
5445	  cd first-dir
5446	  dotest branches2-13 "${testcvs} update -d -r b1 dir1" \
5447"${PROG} [a-z]*: Updating dir1
5448U dir1/file3"
5449	  dotest branches2-14 "${testcvs} -q status" \
5450"===================================================================
5451File: file1            	Status: Up-to-date
5452
5453   Working revision:	1\.1.*
5454   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5455   Sticky Tag:		b2 (branch: 1\.1\.4)
5456   Sticky Date:		(none)
5457   Sticky Options:	(none)
5458
5459===================================================================
5460File: file3            	Status: Up-to-date
5461
5462   Working revision:	1\.1\.2\.1.*
5463   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
5464   Sticky Tag:		b1 (branch: 1\.1\.2)
5465   Sticky Date:		(none)
5466   Sticky Options:	(none)"
5467
5468	  # FIXME: Just clobbering the directory like this is a bit
5469	  # tacky, although people generally expect it to work.  Maybe
5470	  # we should release it instead.  We do it a few other places
5471	  # below as well.
5472	  rm -r dir1
5473	  dotest branches2-15 "${testcvs} update -d -j b1 dir1" \
5474"${PROG} [a-z]*: Updating dir1
5475U dir1/file3"
5476	  # FIXCVS: The `No revision control file' stuff seems to be
5477	  # CVS's way of telling us that we're adding the file on a
5478	  # branch, and the file is not on that branch yet.  This
5479	  # should be nicer.
5480	  dotest branches2-16 "${testcvs} -q status" \
5481"===================================================================
5482File: file1            	Status: Up-to-date
5483
5484   Working revision:	1\.1.*
5485   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5486   Sticky Tag:		b2 (branch: 1\.1\.4)
5487   Sticky Date:		(none)
5488   Sticky Options:	(none)
5489
5490===================================================================
5491File: file3            	Status: Locally Added
5492
5493   Working revision:	New file!
5494   Repository revision:	No revision control file
5495   Sticky Tag:		b2 - MISSING from RCS file!
5496   Sticky Date:		(none)
5497   Sticky Options:	(none)"
5498
5499	  cd ../../trunk/first-dir
5500	  dotest branches2-17 "${testcvs} update -d -P dir1" \
5501"${PROG} [a-z]*: Updating dir1"
5502	  dotest_fail branches2-18 "test -d dir1"
5503	  dotest branches2-19 "${testcvs} update -d -P -r b1 dir1" \
5504"${PROG} [a-z]*: Updating dir1
5505U dir1/file3"
5506	  dotest branches2-20 "${testcvs} -q status" \
5507"===================================================================
5508File: file1            	Status: Up-to-date
5509
5510   Working revision:	1\.1.*
5511   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5512   Sticky Tag:		(none)
5513   Sticky Date:		(none)
5514   Sticky Options:	(none)
5515
5516===================================================================
5517File: file3            	Status: Up-to-date
5518
5519   Working revision:	1\.1\.2\.1.*
5520   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
5521   Sticky Tag:		b1 (branch: 1\.1\.2)
5522   Sticky Date:		(none)
5523   Sticky Options:	(none)"
5524
5525	  rm -r dir1
5526	  dotest branches2-21 "${testcvs} update -d -P -j b1 dir1" \
5527"${PROG} [a-z]*: Updating dir1
5528U dir1/file3"
5529	  dotest branches2-22 "${testcvs} -q status" \
5530"===================================================================
5531File: file1            	Status: Up-to-date
5532
5533   Working revision:	1\.1.*
5534   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5535   Sticky Tag:		(none)
5536   Sticky Date:		(none)
5537   Sticky Options:	(none)
5538
5539===================================================================
5540File: file3            	Status: Locally Added
5541
5542   Working revision:	New file!
5543   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
5544   Sticky Tag:		(none)
5545   Sticky Date:		(none)
5546   Sticky Options:	(none)"
5547
5548	  cd ../..
5549	  rm -r b1 b2
5550
5551	  # Check out branch b1 twice.  Crate a new directory in one
5552	  # working directory, then do a cvs update in the other
5553	  # working directory and see if the tags are right.
5554	  mkdir b1a
5555	  mkdir b1b
5556	  cd b1b
5557	  dotest branches2-23 "${testcvs} -q co -r b1 first-dir" \
5558'U first-dir/file1
5559U first-dir/file2
5560U first-dir/dir1/file3'
5561	  cd ../b1a
5562	  dotest branches2-24 "${testcvs} -q co -r b1 first-dir" \
5563'U first-dir/file1
5564U first-dir/file2
5565U first-dir/dir1/file3'
5566	  cd first-dir
5567	  mkdir dir2
5568	  dotest branches2-25 "${testcvs} add dir2" \
5569"Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository
5570--> Using per-directory sticky tag "'`'"b1'"
5571	  echo "file4 first revision" > dir2/file4
5572	  dotest branches2-26 "${testcvs} add dir2/file4" \
5573"${PROG}"' [a-z]*: scheduling file `dir2/file4'\'' for addition on branch `b1'\''
5574'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
5575	  dotest branches2-27 "${testcvs} -q commit -madd" \
5576"RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
5577done
5578Checking in dir2/file4;
5579${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v  <--  file4
5580new revision: 1\.1\.2\.1; previous revision: 1\.1
5581done"
5582
5583	  cd ../../b1b/first-dir
5584	  dotest branches2-28 "${testcvs} update -d dir2" \
5585"${PROG} [a-z]*: Updating dir2
5586U dir2/file4"
5587	  cd dir2
5588	  dotest branches2-29 "${testcvs} -q status" \
5589"===================================================================
5590File: file4            	Status: Up-to-date
5591
5592   Working revision:	1\.1\.2\.1.*
5593   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
5594   Sticky Tag:		b1 (branch: 1\.1\.2)
5595   Sticky Date:		(none)
5596   Sticky Options:	(none)"
5597	  dotest branches2-30 "cat CVS/Tag" 'Tb1'
5598
5599	  # Test update -A on a subdirectory
5600	  cd ..
5601	  rm -r dir2
5602	  dotest branches2-31 "${testcvs} update -A -d dir2" \
5603"${PROG} [a-z]*: Updating dir2"
5604	  cd dir2
5605	  dotest branches2-32 "${testcvs} -q status" ''
5606	  dotest_fail branches2-33 "test -f CVS/Tag"
5607
5608	  # Add a file on the trunk.
5609	  echo "file5 first revision" > file5
5610	  dotest branches2-34 "${testcvs} add file5" \
5611"${PROG}"' [a-z]*: scheduling file `file5'\'' for addition
5612'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
5613	  dotest branches2-35 "${testcvs} -q commit -madd" \
5614"RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
5615done
5616Checking in file5;
5617${CVSROOT_DIRNAME}/first-dir/dir2/file5,v  <--  file5
5618initial revision: 1\.1
5619done"
5620
5621	  cd ../../../trunk/first-dir
5622	  dotest branches2-36 "${testcvs} -q update -d dir2" 'U dir2/file5'
5623	  cd dir2
5624	  dotest branches2-37 "${testcvs} -q status" \
5625"===================================================================
5626File: file5            	Status: Up-to-date
5627
5628   Working revision:	1\.1.*
5629   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
5630   Sticky Tag:		(none)
5631   Sticky Date:		(none)
5632   Sticky Options:	(none)"
5633	  dotest_fail branches2-38 "test -f CVS/status"
5634
5635	  cd ../../..
5636	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5637	  rm -r trunk b1a b1b
5638	  ;;
5639
5640	tagc)
5641	  # Test the tag -c option.
5642	  mkdir 1; cd 1
5643	  dotest tagc-1 "${testcvs} -q co -l ." ''
5644	  mkdir first-dir
5645	  dotest tagc-2 "${testcvs} add first-dir" \
5646"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5647	  cd first-dir
5648	  touch file1
5649	  dotest tagc-3 "${testcvs} add file1" \
5650"${PROG} [a-z]*: scheduling file .file1. for addition
5651${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5652	  dotest tagc-4 "${testcvs} -q ci -m add" \
5653"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5654done
5655Checking in file1;
5656${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5657initial revision: 1\.1
5658done"
5659	  dotest tagc-5 "${testcvs} -q tag -c tag1" "T file1"
5660	  touch file1
5661	  dotest tagc-6 "${testcvs} -q tag -c tag2" "T file1"
5662	  # Avoid timestamp granularity bugs (FIXME: CVS should be
5663	  # doing the sleep, right?).
5664	  sleep 1
5665	  echo myedit >>file1
5666	  dotest_fail tagc-7 "${testcvs} -q tag -c tag3" \
5667"${PROG} [a-z]*: file1 is locally modified
5668${PROG} \[[a-z]* aborted\]: correct the above errors first!"
5669	  cd ../..
5670	  mkdir 2
5671	  cd 2
5672	  dotest tagc-8 "${testcvs} -q co first-dir" "U first-dir/file1"
5673	  cd ../1/first-dir
5674	  dotest tagc-9 "${testcvs} -q ci -m modify" \
5675"Checking in file1;
5676${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5677new revision: 1\.2; previous revision: 1\.1
5678done"
5679	  cd ../../2/first-dir
5680	  dotest tagc-10 "${testcvs} -q tag -c tag4" "T file1"
5681	  cd ../..
5682
5683	  rm -r 1 2
5684	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5685	  ;;
5686
5687	tagf)
5688	  # More tagging tests, including using tag -F to convert a
5689	  # branch tag to a regular tag and recovering thereof.
5690
5691	  # Setup; check in first-dir/file1
5692	  mkdir 1; cd 1
5693	  dotest tagf-1 "${testcvs} -q co -l ." ''
5694	  mkdir first-dir
5695	  dotest tagf-2 "${testcvs} add first-dir" \
5696"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
5697	  cd first-dir
5698	  touch file1 file2
5699	  dotest tagf-3 "${testcvs} add file1 file2" \
5700"${PROG} [a-z]*: scheduling file .file1. for addition
5701${PROG} [a-z]*: scheduling file .file2. for addition
5702${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
5703	  dotest tagf-4 "${testcvs} -q ci -m add" \
5704"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5705done
5706Checking in file1;
5707${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5708initial revision: 1\.1
5709done
5710RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5711done
5712Checking in file2;
5713${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5714initial revision: 1\.1
5715done"
5716
5717	  # Now create a branch and commit a revision there.
5718	  dotest tagf-5 "${testcvs} -q tag -b br" "T file1
5719T file2"
5720	  dotest tagf-6 "${testcvs} -q update -r br" ""
5721	  echo brmod >> file1
5722	  echo brmod >> file2
5723	  dotest tagf-7 "${testcvs} -q ci -m modify" \
5724"Checking in file1;
5725${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5726new revision: 1\.1\.2\.1; previous revision: 1\.1
5727done
5728Checking in file2;
5729${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5730new revision: 1\.1\.2\.1; previous revision: 1\.1
5731done"
5732	  # Here we make it a non-branch tag.  Some think this should
5733	  # be an error.  But if -F means "I want to put this tag here,
5734	  # never mind whether there was a tag of that name before", then
5735	  # an error wouldn't fit.
5736	  dotest tagf-8 "${testcvs} -q tag -F br" "T file1
5737T file2"
5738	  echo moremod >> file1
5739	  echo moremod >> file2
5740	  dotest tagf-9 "${testcvs} -q status -v file1" \
5741"===================================================================
5742File: file1            	Status: Locally Modified
5743
5744   Working revision:	1\.1\.2\.1.*
5745   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5746   Sticky Tag:		br (revision: 1\.1\.2\.1)
5747   Sticky Date:		(none)
5748   Sticky Options:	(none)
5749
5750   Existing Tags:
5751	br                       	(revision: 1\.1\.2\.1)"
5752
5753	  # Now, how do we recover?
5754	  dotest tagf-10 "${testcvs} -q tag -d br" "D file1
5755D file2"
5756	  # This creates a new branch, 1.1.4.  See the code in RCS_magicrev
5757	  # which will notice that there is a (non-magic) 1.1.2 and thus
5758	  # skip that number.
5759	  dotest tagf-11 "${testcvs} -q tag -r 1.1 -b br file1" "T file1"
5760	  # Fix it with admin -n (cf admin-18, admin-26-4).
5761	  dotest tagf-12 "${testcvs} -q admin -nbr:1.1.2 file2" \
5762"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
5763done"
5764	  # Another variation on the file2 test would be to use two working
5765	  # directories so that the update -r br would need to
5766	  # a merge to get from 1.1.2.1 to the head of the 1.1.2 branch.
5767	  dotest tagf-13 "${testcvs} -q update -r br" \
5768"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5769retrieving revision 1\.1\.2\.1
5770retrieving revision 1\.1
5771Merging differences between 1\.1\.2\.1 and 1\.1 into file1
5772rcsmerge: warning: conflicts during merge
5773${PROG} [a-z]*: conflicts found in file1
5774C file1
5775M file2"
5776	  # CVS is giving a conflict because we are trying to get back to
5777	  # 1.1.4.  I'm not sure why it is a conflict rather than just
5778	  # "M file1".
5779	  dotest tagf-14 "cat file1" \
5780"<<<<<<< file1
5781brmod
5782moremod
5783[=]======
5784[>]>>>>>> 1\.1"
5785	  echo resolve >file1
5786	  dotest tagf-15 "${testcvs} -q ci -m recovered" \
5787"Checking in file1;
5788${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5789new revision: 1\.1\.4\.1; previous revision: 1\.1
5790done
5791Checking in file2;
5792${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
5793new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
5794done"
5795	  cd ../..
5796
5797	  rm -r 1
5798	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5799	  ;;
5800
5801	rcslib)
5802	  # Test librarification of RCS.
5803	  # First: test whether `cvs diff' handles $Name expansion
5804	  # correctly.	We diff two revisions with their symbolic tags;
5805	  # neither tag should be expanded in the output.  Also diff
5806	  # one revision with the working copy.
5807
5808	  mkdir ${CVSROOT_DIRNAME}/first-dir
5809	  dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
5810	  cd first-dir
5811	  echo "I am the first foo, and my name is $""Name$." > foo.c
5812	  dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
5813"${PROG} [a-z]*: scheduling file .foo\.c. for addition
5814${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5815	  dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
5816"RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
5817done
5818Checking in foo\.c;
5819${CVSROOT_DIRNAME}/first-dir/foo.c,v  <--  foo\.c
5820initial revision: 1\.1
5821done"
5822	  dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
5823	  dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
5824"===================================================================
5825Checking out foo\.c
5826RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
5827VERS: 1\.1
5828\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5829I am the first foo, and my name is \$""Name: first \$\."
5830
5831	  echo "I am the second foo, and my name is $""Name$." > foo.c
5832	  dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
5833"Checking in foo\.c;
5834${CVSROOT_DIRNAME}/first-dir/foo\.c,v  <--  foo\.c
5835new revision: 1\.2; previous revision: 1\.1
5836done"
5837	  dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
5838	  dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
5839"===================================================================
5840Checking out foo\.c
5841RCS:  ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
5842VERS: 1\.2
5843\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
5844I am the second foo, and my name is \$""Name: second \$\."
5845
5846	dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
5847"${PROG} [a-z]*: Diffing \.
5848Index: foo\.c
5849===================================================================
5850RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
5851retrieving revision 1\.1
5852retrieving revision 1\.2
5853diff -r1\.1 -r1\.2
58541c1
5855< I am the first foo, and my name is \$""Name:  \$\.
5856---
5857> I am the second foo, and my name is \$""Name:  \$\."
5858
5859	  echo "I am the once and future foo, and my name is $""Name$." > foo.c
5860	  dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
5861"${PROG} [a-z]*: Diffing \.
5862Index: foo\.c
5863===================================================================
5864RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
5865retrieving revision 1\.1
5866diff -r1\.1 foo\.c
58671c1
5868< I am the first foo, and my name is \$""Name:  \$\.
5869---
5870> I am the once and future foo, and my name is \$""Name\$\."
5871
5872	  # Test handling of libdiff options.  diff gets quite enough
5873	  # of a workout elsewhere in sanity.sh, so we assume that it's
5874	  # mostly working properly if it passes all the other tests.
5875	  # The main one we want to try is regex handling, since we are
5876	  # using CVS's regex matcher and not diff's.
5877
5878	  cat >rgx.c <<EOF
5879test_regex (whiz, bang)
5880{
5881foo;
5882bar;
5883baz;
5884grumble;
5885}
5886EOF
5887
5888	  dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
5889"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5890	  dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
5891"RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
5892done
5893Checking in rgx\.c;
5894${CVSROOT_DIRNAME}/first-dir/rgx\.c,v  <--  rgx\.c
5895initial revision: 1\.1
5896done"
5897	  cat >rgx.c <<EOF
5898test_regex (whiz, bang)
5899{
5900foo;
5901bar;
5902baz;
5903mumble;
5904}
5905EOF
5906	  # Use dotest_fail because exit status from `cvs diff' must be 1.
5907	  dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.*(' rgx.c" \
5908"Index: rgx\.c
5909===================================================================
5910RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
5911retrieving revision 1\.1
5912diff -c -F\.\*( -r1\.1 rgx\.c
5913\*\*\* rgx\.c	${RFCDATE}	1\.1
5914--- rgx\.c	${RFCDATE}
5915\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
5916\*\*\* 3,7 \*\*\*\*
5917  foo;
5918  bar;
5919  baz;
5920! grumble;
5921  }
5922--- 3,7 ----
5923  foo;
5924  bar;
5925  baz;
5926! mumble;
5927  }"
5928
5929	  # Tests of rcsmerge/diff3.  Merge operations get a good general
5930	  # workout elsewhere; we want to make sure that options are still
5931	  # handled properly.  Try merging two branches with -kv, to test
5932	  # both -j and -k switches.
5933
5934	  cd ..
5935
5936	  rm -rf ${CVSROOT_DIRNAME}/first-dir
5937	  rm -r first-dir
5938
5939	  mkdir 1; cd 1
5940	  dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
5941	  mkdir first-dir
5942	  dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
5943"Directory ${CVSROOT_DIRNAME}.*/first-dir added to the repository"
5944	  cd ..; rm -r 1
5945
5946	  dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
5947	  cd first-dir
5948
5949	  echo '$''Revision$' > file1
5950	  echo '2' >> file1
5951	  echo '3' >> file1
5952	  dotest rcslib-merge-4 "${testcvs} -q add file1" \
5953"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
5954	  dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
5955"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5956done
5957Checking in file1;
5958${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5959initial revision: 1\.1
5960done"
5961	  sed -e 's/2/two/' file1 > f; mv f file1
5962	  dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
5963"Checking in file1;
5964${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5965new revision: 1\.2; previous revision: 1\.1
5966done"
5967	  dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
5968	  dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
5969	  dotest rcslib-merge-9 "${testcvs} -q status" \
5970"===================================================================
5971File: file1            	Status: Up-to-date
5972
5973   Working revision:	1\.1.*
5974   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
5975   Sticky Tag:		patch1 (branch: 1\.1\.2)
5976   Sticky Date:		(none)
5977   Sticky Options:	(none)"
5978	  dotest rcslib-merge-10 "cat file1" \
5979'$''Revision: 1\.1 $
59802
59813'
5982	  sed -e 's/3/three/' file1 > f; mv f file1
5983	  dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
5984"Checking in file1;
5985${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
5986new revision: 1\.1\.2\.1; previous revision: 1\.1
5987done"
5988	  dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
5989"U file1
5990RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
5991retrieving revision 1\.1
5992retrieving revision 1\.2
5993Merging differences between 1\.1 and 1\.2 into file1
5994rcsmerge: warning: conflicts during merge"
5995	  dotest rcslib-merge-13 "cat file1" \
5996"<<<<<<< file1
59971\.1\.2\.1
59982
5999three
6000[=]======
60011\.2
6002two
60033
6004[>]>>>>>> 1\.2"
6005
6006	  # Test behavior of symlinks in the repository.
6007	  dotest rcslib-symlink-1 "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
6008	  dotest rcslib-symlink-2 "${testcvs} update file2" "U file2"
6009	  echo "This is a change" >> file2
6010	  dotest rcslib-symlink-3 "${testcvs} ci -m because file2" \
6011"Checking in file2;
6012${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
6013new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
6014done"
6015	  dotest rcslib-symlink-4 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
6016".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
6017	  # Test 5 reveals a problem with having symlinks in the
6018	  # repository.  CVS will try to tag both of the files
6019	  # separately.  After processing one, it will do the same
6020	  # operation to the other, which is actually the same file,
6021	  # so the tag will already be there.  FIXME: do we bother
6022	  # changing operations to notice cases like this?  This
6023	  # strikes me as a difficult problem.  -Noel
6024	  dotest rcslib-symlink-5 "${testcvs} tag the_tag" \
6025"${PROG} [a-z]*: Tagging .
6026T file1
6027W file2 : the_tag already exists on version 1.1.2.1 : NOT MOVING tag to version 1.1.2.2"
6028	  dotest rcslib-symlink-6 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
6029".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
6030
6031	  # Symlinks tend to interact poorly with the Attic.
6032	  cd ..
6033	  mkdir 2; cd 2
6034	  dotest rcslib-symlink-7 "${testcvs} -q co first-dir" \
6035"U first-dir/file1
6036U first-dir/file2"
6037	  cd first-dir
6038	  dotest rcslib-symlink-8 "${testcvs} rm -f file2" \
6039"${PROG} [a-z]*: scheduling .file2. for removal
6040${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
6041	  dotest rcslib-symlink-9 "${testcvs} -q ci -m rm-it" \
6042"Removing file2;
6043${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file2
6044new revision: delete; previous revision: 1\.2
6045done"
6046	  # OK, why this message happens twice is relatively clear
6047	  # (the check_* and rtag_* calls to start_recursion).
6048	  # Why it happens a third time I didn't try to find out.
6049	  dotest rcslib-symlink-10 \
6050"${testcvs} -q rtag -b -r the_tag brtag first-dir" \
6051"${PROG} [a-z]*: could not read RCS file for file2
6052${PROG} [a-z]*: could not read RCS file for first-dir/file2
6053${PROG} [a-z]*: could not read RCS file for first-dir/file2"
6054	  cd ..
6055
6056	  cd ..
6057
6058	  if $keep; then
6059	    echo Keeping ${TESTDIR} and exiting due to --keep
6060	    exit 0
6061	  fi
6062
6063	  rm -rf ${CVSROOT_DIRNAME}/first-dir
6064	  rm -r first-dir 2
6065	  ;;
6066
6067	multibranch)
6068	  # Test the ability to have several branchpoints coming off the
6069	  # same revision.
6070	  mkdir ${CVSROOT_DIRNAME}/first-dir
6071	  dotest multibranch-1 "${testcvs} -q co first-dir" ''
6072	  cd first-dir
6073	  echo 1:trunk-1 >file1
6074	  dotest multibranch-2 "${testcvs} add file1" \
6075"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
6076'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
6077	  dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
6078RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6079done
6080Checking in file1;
6081${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6082initial revision: 1.1
6083done
6084HERE
6085	  dotest multibranch-4 "${testcvs} tag -b br1" \
6086"${PROG} [a-z]*: Tagging \.
6087T file1"
6088	  dotest multibranch-5 "${testcvs} tag -b br2" \
6089"${PROG} [a-z]*: Tagging \.
6090T file1"
6091	  dotest multibranch-6 "${testcvs} -q update -r br1" ''
6092	  echo on-br1 >file1
6093	  dotest multibranch-7 "${testcvs} -q ci -m modify-on-br1" \
6094"Checking in file1;
6095${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6096new revision: 1\.1\.2\.1; previous revision: 1\.1
6097done"
6098	  dotest multibranch-8 "${testcvs} -q update -r br2" '[UP] file1'
6099	  echo br2 adds a line >>file1
6100	  dotest multibranch-9 "${testcvs} -q ci -m modify-on-br2" \
6101"Checking in file1;
6102${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
6103new revision: 1\.1\.4\.1; previous revision: 1\.1
6104done"
6105	  dotest multibranch-10 "${testcvs} -q update -r br1" '[UP] file1'
6106	  dotest multibranch-11 "cat file1" 'on-br1'
6107	  dotest multibranch-12 "${testcvs} -q update -r br2" '[UP] file1'
6108	  dotest multibranch-13 "cat file1" '1:trunk-1
6109br2 adds a line'
6110
6111	  dotest multibranch-14 "${testcvs} log file1" \
6112"
6113RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6114Working file: file1
6115head: 1\.1
6116branch:
6117locks: strict
6118access list:
6119symbolic names:
6120	br2: 1\.1\.0\.4
6121	br1: 1\.1\.0\.2
6122keyword substitution: kv
6123total revisions: 3;	selected revisions: 3
6124description:
6125----------------------------
6126revision 1\.1
6127date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
6128branches:  1\.1\.2;  1\.1\.4;
6129add-it
6130----------------------------
6131revision 1\.1\.4\.1
6132date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
6133modify-on-br2
6134----------------------------
6135revision 1\.1\.2\.1
6136date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6137modify-on-br1
6138============================================================================="
6139	  cd ..
6140
6141	  if $keep; then
6142	    echo Keeping ${TESTDIR} and exiting due to --keep
6143	    exit 0
6144	  fi
6145
6146	  rm -rf ${CVSROOT_DIRNAME}/first-dir
6147	  rm -r first-dir
6148	  ;;
6149
6150	import) # test death after import
6151		# Tests of "cvs import":
6152		# basic2
6153		# rdiff  -- imports with keywords
6154		# import  -- more tests of imports with keywords
6155		# importb  -- -b option.
6156		# importc -- bunch o' files in bunch o' directories
6157		# modules3
6158		# mflag -- various -m messages
6159		# ignore  -- import and cvsignore
6160		# binwrap -- import and -k wrappers
6161		# info -- imports which are rejected by verifymsg
6162		# head -- intended to test vendor branches and HEAD,
6163		#   although it doesn't really do it yet.
6164
6165		# import
6166		mkdir import-dir ; cd import-dir
6167
6168		for i in 1 2 3 4 ; do
6169		  echo imported file"$i" > imported-f"$i"
6170		done
6171
6172		# This directory should be on the default ignore list,
6173		# so it shouldn't get imported.
6174		mkdir RCS
6175		echo ignore.me >RCS/ignore.me
6176
6177		echo 'import should not expand $''Id$' >>imported-f2
6178		cp imported-f2 ../imported-f2-orig.tmp
6179
6180		dotest_sort import-96 \
6181"${testcvs} import -m first-import first-dir vendor-branch junk-1_0" \
6182"
6183
6184I first-dir/RCS
6185N first-dir/imported-f1
6186N first-dir/imported-f2
6187N first-dir/imported-f3
6188N first-dir/imported-f4
6189No conflicts created by this import"
6190
6191		dotest import-96.5 "cmp ../imported-f2-orig.tmp imported-f2" ''
6192
6193		cd ..
6194
6195		# co
6196		dotest import-97 "${testcvs} -q co first-dir" \
6197"U first-dir/imported-f1
6198U first-dir/imported-f2
6199U first-dir/imported-f3
6200U first-dir/imported-f4"
6201
6202		cd first-dir
6203
6204		for i in 1 2 3 4 ; do
6205		  dotest import-98-$i "test -f imported-f$i" ''
6206		done
6207		dotest_fail import-98.5 "test -d RCS" ''
6208
6209		# remove
6210		rm imported-f1
6211		dotest import-99 "${testcvs} rm imported-f1" \
6212"${PROG}"' [a-z]*: scheduling `imported-f1'\'' for removal
6213'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
6214
6215		# change
6216		echo local-change >> imported-f2
6217
6218		# commit
6219		dotest import-100 "${testcvs} ci -m local-changes" \
6220"${PROG} [a-z]*: Examining .
6221Removing imported-f1;
6222${CVSROOT_DIRNAME}/first-dir/imported-f1,v  <--  imported-f1
6223new revision: delete; previous revision: 1\.1\.1\.1
6224done
6225Checking in imported-f2;
6226${CVSROOT_DIRNAME}/first-dir/imported-f2,v  <--  imported-f2
6227new revision: 1\.2; previous revision: 1\.1
6228done"
6229
6230		# log
6231		dotest import-101 "${testcvs} log imported-f1" \
6232"
6233RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/imported-f1,v
6234Working file: imported-f1
6235head: 1\.2
6236branch:
6237locks: strict
6238access list:
6239symbolic names:
6240	junk-1_0: 1\.1\.1\.1
6241	vendor-branch: 1\.1\.1
6242keyword substitution: kv
6243total revisions: 3;	selected revisions: 3
6244description:
6245----------------------------
6246revision 1\.2
6247date: [0-9/]* [0-9:]*;  author: ${username};  state: dead;  lines: ${PLUS}0 -0
6248local-changes
6249----------------------------
6250revision 1\.1
6251date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
6252branches:  1\.1\.1;
6253Initial revision
6254----------------------------
6255revision 1\.1\.1\.1
6256date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
6257first-import
6258============================================================================="
6259
6260		# update into the vendor branch.
6261		dotest import-102 "${testcvs} update -rvendor-branch" \
6262"${PROG} [a-z]*: Updating .
6263[UP] imported-f1
6264[UP] imported-f2"
6265
6266		# remove file4 on the vendor branch
6267		rm imported-f4
6268		dotest import-103 "${testcvs} rm imported-f4" \
6269"${PROG}"' [a-z]*: scheduling `imported-f4'\'' for removal
6270'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
6271
6272		# commit
6273		dotest import-104 \
6274"${testcvs} ci -m vendor-removed imported-f4" \
6275"Removing imported-f4;
6276${CVSROOT_DIRNAME}/first-dir/imported-f4,v  <--  imported-f4
6277new revision: delete; previous revision: 1\.1\.1\.1
6278done"
6279
6280		# update to main line
6281		dotest import-105 "${testcvs} -q update -A" \
6282"${PROG} [a-z]*: imported-f1 is no longer in the repository
6283[UP] imported-f2"
6284
6285		# second import - file4 deliberately unchanged
6286		cd ../import-dir
6287		for i in 1 2 3 ; do
6288		  echo rev 2 of file $i >> imported-f"$i"
6289		done
6290		cp imported-f2 ../imported-f2-orig.tmp
6291
6292		dotest_sort import-106 \
6293"${testcvs} import -m second-import first-dir vendor-branch junk-2_0" \
6294"
6295
6296
6297 ${PROG} checkout -jvendor-branch:yesterday -jvendor-branch first-dir
62982 conflicts created by this import.
6299C first-dir/imported-f1
6300C first-dir/imported-f2
6301I first-dir/RCS
6302U first-dir/imported-f3
6303U first-dir/imported-f4
6304Use the following command to help the merge:"
6305
6306		dotest import-106.5 "cmp ../imported-f2-orig.tmp imported-f2" \
6307''
6308
6309		cd ..
6310
6311		rm imported-f2-orig.tmp
6312
6313		# co
6314		dotest import-107 "${testcvs} co first-dir" \
6315"${PROG} [a-z]*: Updating first-dir
6316[UP] first-dir/imported-f3
6317[UP] first-dir/imported-f4"
6318
6319		cd first-dir
6320
6321		dotest_fail import-108 "test -f imported-f1" ''
6322
6323		for i in 2 3 ; do
6324		  dotest import-109-$i "test -f imported-f$i" ''
6325		done
6326
6327		# check vendor branch for file4
6328		dotest import-110 "${testcvs} -q update -rvendor-branch" \
6329"[UP] imported-f1
6330[UP] imported-f2"
6331
6332		dotest import-111 "test -f imported-f4" ''
6333
6334		# update to main line
6335		dotest import-112 "${testcvs} -q update -A" \
6336"${PROG} [a-z]*: imported-f1 is no longer in the repository
6337[UP] imported-f2"
6338
6339		cd ..
6340
6341		dotest import-113 \
6342"${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
6343"${PROG} [a-z]*: file first-dir/imported-f1 does not exist, but is present in revision junk-2_0
6344RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f2,v
6345retrieving revision 1\.1\.1\.1
6346retrieving revision 1\.1\.1\.2
6347Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
6348rcsmerge: warning: conflicts during merge"
6349
6350		cd first-dir
6351
6352		dotest_fail import-114 "test -f imported-f1" ''
6353
6354		for i in 2 3 ; do
6355		  dotest import-115-$i "test -f imported-f$i" ''
6356		done
6357
6358		dotest import-116 'cat imported-f2' \
6359'imported file2
6360[<]<<<<<< imported-f2
6361import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
6362local-change
6363[=]======
6364import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
6365rev 2 of file 2
6366[>]>>>>>> 1\.1\.1\.2'
6367
6368		cd ..
6369		rm -r first-dir
6370		rm -rf ${CVSROOT_DIRNAME}/first-dir
6371		rm -r import-dir
6372		;;
6373
6374	importb)
6375	  # More cvs import tests, especially -b option.
6376
6377	  # OK, first we get some sources from the NetMunger project, and
6378	  # import them into the 1.1.1 vendor branch.
6379	  mkdir imp-dir
6380	  cd imp-dir
6381	  echo 'OpenMunger sources' >file1
6382	  echo 'OpenMunger sources' >file2
6383	  dotest_sort importb-1 \
6384"${testcvs} import -m add first-dir openmunger openmunger-1_0" \
6385"
6386
6387N first-dir/file1
6388N first-dir/file2
6389No conflicts created by this import"
6390	  cd ..
6391	  rm -r imp-dir
6392
6393	  # Now we put the sources we get from FreeMunger into 1.1.3
6394	  mkdir imp-dir
6395	  cd imp-dir
6396	  echo 'FreeMunger sources' >file1
6397	  echo 'FreeMunger sources' >file2
6398	  # Not completely sure how the conflict detection is supposed to
6399	  # be working here (haven't really thought about it).
6400	  # We use an explicit -d option to test that it is reflected
6401	  # in the suggested checkout.
6402	  dotest_sort importb-2 \
6403"${testcvs} -d ${CVSROOT} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
6404"
6405
6406
6407 ${PROG} -d ${CVSROOT} checkout -jfreemunger:yesterday -jfreemunger first-dir
64082 conflicts created by this import.
6409C first-dir/file1
6410C first-dir/file2
6411Use the following command to help the merge:"
6412	  cd ..
6413	  rm -r imp-dir
6414
6415	  # Now a test of main branch import (into second-dir, not first-dir).
6416	  mkdir imp-dir
6417	  cd imp-dir
6418	  echo 'my own stuff' >mine1.c
6419	  echo 'my own stuff' >mine2.c
6420	  dotest_fail importb-3 \
6421"${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
6422"${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1"
6423	  : when we implement main-branch import, should be \
6424"N second-dir/mine1\.c
6425N second-dir/mine2\.c
6426
6427No conflicts created by this import"
6428	  cd ..
6429	  rm -r imp-dir
6430
6431	  mkdir 1
6432	  cd 1
6433	  # when we implement main branch import, will want to
6434	  # add "second-dir" here.
6435	  dotest importb-4 "${testcvs} -q co first-dir" \
6436"U first-dir/file1
6437U first-dir/file2"
6438	  cd first-dir
6439	  dotest importb-5 "${testcvs} -q log file1" "
6440RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
6441Working file: file1
6442head: 1\.1
6443branch: 1\.1\.1
6444locks: strict
6445access list:
6446symbolic names:
6447	freemunger-1_0: 1\.1\.3\.1
6448	freemunger: 1\.1\.3
6449	openmunger-1_0: 1\.1\.1\.1
6450	openmunger: 1\.1\.1
6451keyword substitution: kv
6452total revisions: 3;	selected revisions: 3
6453description:
6454----------------------------
6455revision 1\.1
6456date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
6457branches:  1\.1\.1;  1\.1\.3;
6458Initial revision
6459----------------------------
6460revision 1\.1\.3\.1
6461date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
6462add
6463----------------------------
6464revision 1\.1\.1\.1
6465date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
6466add
6467============================================================================="
6468
6469	  cd ../..
6470	  rm -r 1
6471	  rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
6472	  ;;
6473
6474	importc)
6475	  # Test importing a bunch o' files in a bunch o' directories.
6476	  # Also the -d option.
6477	  mkdir 1; cd 1
6478	  mkdir adir bdir cdir
6479	  mkdir adir/sub1 adir/sub2
6480	  mkdir adir/sub1/ssdir
6481	  mkdir bdir/subdir
6482	  touch adir/sub1/file1 adir/sub2/file2 adir/sub1/ssdir/ssfile
6483	  # If I'm correctly reading the Single Unix Specification,
6484	  # version 2, then "touch -t 197107040343" or "touch -t 203412251801"
6485	  # should work.  But GNU touch seems to have other ideas.
6486	  # I sort of wonder if this is lossage by the standards bodies,
6487	  # I'm not sure.
6488	  # Note that some versions of touch when used without -t don't handle
6489	  # y2k and/or set the seconds reliably.
6490	  # We should probably find a different way of doing this.
6491	  touch 0704034371 bdir/subdir/file1
6492	  touch 1225180134 cdir/cfile
6493	  dotest_sort importc-1 \
6494"${testcvs} import -d -m import-it first-dir vendor release" \
6495"
6496
6497N first-dir/adir/sub1/file1
6498N first-dir/adir/sub1/ssdir/ssfile
6499N first-dir/adir/sub2/file2
6500N first-dir/bdir/subdir/file1
6501N first-dir/cdir/cfile
6502No conflicts created by this import
6503${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/adir
6504${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1
6505${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1/ssdir
6506${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub2
6507${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/bdir
6508${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/bdir/subdir
6509${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/first-dir/cdir"
6510	  cd ..
6511	  mkdir 2; cd 2
6512	  dotest importc-2 "${testcvs} -q co first-dir" \
6513"U first-dir/adir/sub1/file1
6514U first-dir/adir/sub1/ssdir/ssfile
6515U first-dir/adir/sub2/file2
6516U first-dir/bdir/subdir/file1
6517U first-dir/cdir/cfile"
6518	  cd first-dir
6519	  dotest importc-3 "${testcvs} update adir/sub1" \
6520"${PROG} [a-z]*: Updating adir/sub1
6521${PROG} [a-z]*: Updating adir/sub1/ssdir"
6522	  dotest importc-4 "${testcvs} update adir/sub1 bdir/subdir" \
6523"${PROG} [a-z]*: Updating adir/sub1
6524${PROG} [a-z]*: Updating adir/sub1/ssdir
6525${PROG} [a-z]*: Updating bdir/subdir"
6526
6527	  echo modify >>cdir/cfile
6528	  dotest importc-5 \
6529"${testcvs} -q rtag -b -r release wip_test first-dir" ""
6530	  dotest importc-6 "${testcvs} -q update -r wip_test" "M cdir/cfile"
6531
6532	  if $remote; then
6533	    # Remote doesn't have the bug in the first place.
6534	    dotest importc-7r "${testcvs} -q ci -m modify -r wip_test" \
6535"Checking in cdir/cfile;
6536${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v  <--  cfile
6537new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
6538done"
6539	  else
6540	    # This checkin should just succeed.  That it doesn't is a
6541	    # bug (CVS 1.9.16 through the present seem to have it; CVS
6542	    # 1.9 did not).
6543	    dotest_fail importc-7 "${testcvs} -q ci -m modify -r wip_test" \
6544"${PROG} [a-z]*: in directory adir/sub1/ssdir:
6545${PROG} \[[a-z]* aborted\]: there is no version here; do .${PROG} checkout. first"
6546	    # The workaround is to leave off the "-r wip_test".
6547	    dotest importc-7a "${testcvs} -q ci -m modify" \
6548"Checking in cdir/cfile;
6549${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v  <--  cfile
6550new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
6551done"
6552	  fi
6553
6554	  # TODO: should also be testing "import -d" when we update
6555	  # an existing file.
6556	  dotest importc-8 "${testcvs} -q log cdir/cfile" "
6557RCS file: ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v
6558Working file: cdir/cfile
6559head: 1\.1
6560branch: 1\.1\.1
6561locks: strict
6562access list:
6563symbolic names:
6564	wip_test: 1\.1\.1\.1\.0\.2
6565	release: 1\.1\.1\.1
6566	vendor: 1\.1\.1
6567keyword substitution: kv
6568total revisions: 3;	selected revisions: 3
6569description:
6570----------------------------
6571revision 1\.1
6572date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;
6573branches:  1\.1\.1;
6574Initial revision
6575----------------------------
6576revision 1\.1\.1\.1
6577date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
6578branches:  1\.1\.1\.1\.2;
6579import-it
6580----------------------------
6581revision 1\.1\.1\.1\.2\.1
6582date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
6583modify
6584============================================================================="
6585
6586	  dotest importc-9 "${testcvs} -q log bdir/subdir/file1" "
6587RCS file: ${CVSROOT_DIRNAME}/first-dir/bdir/subdir/file1,v
6588Working file: bdir/subdir/file1
6589head: 1\.1
6590branch: 1\.1\.1
6591locks: strict
6592access list:
6593symbolic names:
6594	wip_test: 1\.1\.1\.1\.0\.2
6595	release: 1\.1\.1\.1
6596	vendor: 1\.1\.1
6597keyword substitution: kv
6598total revisions: 2;	selected revisions: 2
6599description:
6600----------------------------
6601revision 1\.1
6602date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;
6603branches:  1\.1\.1;
6604Initial revision
6605----------------------------
6606revision 1\.1\.1\.1
6607date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9];  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
6608import-it
6609============================================================================="
6610	  cd ..
6611
6612	  # Now tests of absolute pathnames and .. as repository directory.
6613	  cd ../1
6614	  dotest_fail importc-10 \
6615"${testcvs} import -m imp ../other vendor release2" \
6616"${PROG} \[[a-z]* aborted\]: directory \.\./other not relative within the repository"
6617	  dotest_fail importc-11 \
6618"${testcvs} import -m imp ${TESTDIR}/other vendor release3" \
6619"${PROG} \[[a-z]* aborted\]: directory ${TESTDIR}/other not relative within the repository"
6620	  dotest_fail importc-12 "test -d ${TESTDIR}/other" ""
6621	  cd ..
6622
6623	  rm -r 1 2
6624	  rm -rf ${CVSROOT_DIRNAME}/first-dir
6625	  ;;
6626
6627	import-after-initial)
6628	  # Properly handle the case in which the first version of a
6629	  # file is created by a regular cvs add and commit, and there
6630	  # is a subsequent cvs import of the same file.  cvs update with
6631	  # a date tag must resort to searching the vendor branch only if
6632	  # the initial version of the file was created at the same time
6633	  # as the initial version on the vendor branch.
6634
6635	  mkdir 1; cd 1
6636	  module=x
6637
6638	  echo > unused-file
6639
6640	  # Create the module.
6641	  dotest import-after-initial-1 \
6642	    "$testcvs -Q import -m. $module X Y" ''
6643
6644	  file=m
6645	  # Check it out and add a file.
6646	  dotest import-after-initial-2 "$testcvs -Q co $module" ''
6647	  cd $module
6648	  echo original > $file
6649	  dotest import-after-initial-3 "${testcvs} -Q add $file" ""
6650	  dotest import-after-initial-4 "${testcvs} -Q ci -m. $file" \
6651"RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
6652done
6653Checking in $file;
6654${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
6655initial revision: 1\.1
6656done"
6657
6658	  # Delay a little so the following import isn't done in the same
6659	  # second as the preceding commit.
6660	  sleep 2
6661
6662	  # Do the first import of $file *after* $file already has an
6663	  # initial version.
6664	  mkdir sub
6665	  cd sub
6666	  echo newer-via-import > $file
6667	  dotest import-after-initial-5 \
6668	    "$testcvs -Q import -m. $module X Y2" ''
6669	  cd ..
6670
6671	  # Sleep a second so we're sure to be after the second of the import.
6672	  sleep 1
6673
6674	  dotest import-after-initial-6 \
6675	    "$testcvs -Q update -p -D now $file" 'original'
6676
6677	  cd ../..
6678	  rm -rf 1
6679	  rm -rf ${CVSROOT_DIRNAME}/$module
6680	  ;;
6681
6682	join)
6683	  # Test doing joins which involve adding and removing files.
6684	  #   Variety of scenarios (see list below), in the context of:
6685	  #     * merge changes from T1 to T2 into the main line
6686	  #     * merge changes from branch 'branch' into the main line
6687	  #     * merge changes from branch 'branch' into branch 'br2'.
6688	  # See also binfile2, which does similar things with binary files.
6689	  # See also join2, which tests joining (and update -A) on only
6690	  # a single file, rather than a directory.
6691	  # See also rmadd2, which tests -j cases not involving branches
6692	  #   (e.g. undoing a commit)
6693	  # See also join3, which tests some cases involving the greatest
6694	  # common ancestor.  Here is a list of tests according to branch
6695	  # topology:
6696	  #
6697	  # --->bp---->trunk          too many to mention
6698	  #     \----->branch
6699	  #
6700	  #     /----->branch1
6701	  # --->bp---->trunk          multibranch, multibranch2
6702	  #     \----->branch2
6703	  #
6704	  # --->bp1----->bp2---->trunk   join3
6705	  #     \->br1   \->br2
6706	  #
6707	  # --->bp1----->trunk
6708	  #     \----bp2---->branch                branches
6709	  #          \------>branch-of-branch
6710
6711	  # We check merging changes from T1 to T2 into the main line.
6712	  # Here are the interesting cases I can think of:
6713	  #   1) File added between T1 and T2, not on main line.
6714	  #      File should be marked for addition.
6715	  #   2) File added between T1 and T2, also added on main line.
6716	  #      Conflict.
6717	  #   3) File removed between T1 and T2, unchanged on main line.
6718	  #      File should be marked for removal.
6719	  #   4) File removed between T1 and T2, modified on main line.
6720	  #      If mod checked in, file should be marked for removal.
6721	  #	 If mod still in working directory, conflict.
6722	  #   5) File removed between T1 and T2, was never on main line.
6723	  #      Nothing should happen.
6724	  #   6) File removed between T1 and T2, also removed on main line.
6725	  #      Nothing should happen.
6726	  #   7) File added on main line, not added between T1 and T2.
6727	  #      Nothing should happen.
6728	  #   8) File removed on main line, not modified between T1 and T2.
6729	  #      Nothing should happen.
6730
6731	  # We also check merging changes from a branch into the main
6732	  # line.  Here are the interesting cases:
6733	  #   1) File added on branch, not on main line.
6734	  #      File should be marked for addition.
6735	  #   2) File added on branch, also added on main line.
6736	  #      Conflict.
6737	  #   3) File removed on branch, unchanged on main line.
6738	  #      File should be marked for removal.
6739	  #   4) File removed on branch, modified on main line.
6740	  #      Conflict.
6741	  #   5) File removed on branch, was never on main line.
6742	  #      Nothing should happen.
6743	  #   6) File removed on branch, also removed on main line.
6744	  #      Nothing should happen.
6745	  #   7) File added on main line, not added on branch.
6746	  #      Nothing should happen.
6747	  #   8) File removed on main line, not modified on branch.
6748	  #      Nothing should happen.
6749
6750	  # In the tests below, fileN represents case N in the above
6751	  # lists.
6752
6753	  mkdir ${CVSROOT_DIRNAME}/first-dir
6754	  mkdir 1
6755	  cd 1
6756	  dotest join-1 "${testcvs} -q co first-dir" ''
6757
6758	  cd first-dir
6759
6760	  # Add two files.
6761	  echo 'first revision of file3' > file3
6762	  echo 'first revision of file4' > file4
6763	  echo 'first revision of file6' > file6
6764	  echo 'first revision of file8' > file8
6765	  dotest join-2 "${testcvs} add file3 file4 file6 file8" \
6766"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
6767'"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
6768'"${PROG}"' [a-z]*: scheduling file `file6'\'' for addition
6769'"${PROG}"' [a-z]*: scheduling file `file8'\'' for addition
6770'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
6771
6772	  dotest join-3 "${testcvs} -q commit -m add" \
6773"RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
6774done
6775Checking in file3;
6776${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6777initial revision: 1\.1
6778done
6779RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
6780done
6781Checking in file4;
6782${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6783initial revision: 1\.1
6784done
6785RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
6786done
6787Checking in file6;
6788${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
6789initial revision: 1\.1
6790done
6791RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
6792done
6793Checking in file8;
6794${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
6795initial revision: 1\.1
6796done"
6797
6798	  # Make a branch.
6799	  dotest join-4 "${testcvs} -q tag -b branch ." \
6800'T file3
6801T file4
6802T file6
6803T file8'
6804
6805	  # Add file2 and file7, modify file4, and remove file6 and file8.
6806	  echo 'first revision of file2' > file2
6807	  echo 'second revision of file4' > file4
6808	  echo 'first revision of file7' > file7
6809	  rm file6 file8
6810	  dotest join-5 "${testcvs} add file2 file7" \
6811"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
6812'"${PROG}"' [a-z]*: scheduling file `file7'\'' for addition
6813'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
6814	  dotest join-6 "${testcvs} rm file6 file8" \
6815"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
6816'"${PROG}"' [a-z]*: scheduling `file8'\'' for removal
6817'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
6818	  dotest join-7 "${testcvs} -q ci -mx ." \
6819"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6820done
6821Checking in file2;
6822${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6823initial revision: 1\.1
6824done
6825Checking in file4;
6826${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6827new revision: 1\.2; previous revision: 1\.1
6828done
6829Removing file6;
6830${CVSROOT_DIRNAME}/first-dir/file6,v  <--  file6
6831new revision: delete; previous revision: 1\.1
6832done
6833RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
6834done
6835Checking in file7;
6836${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
6837initial revision: 1\.1
6838done
6839Removing file8;
6840${CVSROOT_DIRNAME}/first-dir/file8,v  <--  file8
6841new revision: delete; previous revision: 1\.1
6842done"
6843
6844	  # Check out the branch.
6845	  cd ../..
6846	  mkdir 2
6847	  cd 2
6848	  dotest join-8 "${testcvs} -q co -r branch first-dir" \
6849'U first-dir/file3
6850U first-dir/file4
6851U first-dir/file6
6852U first-dir/file8'
6853
6854	  cd first-dir
6855
6856	  # Modify the files on the branch, so that T1 is not an
6857	  # ancestor of the main line, and add file5
6858	  echo 'first branch revision of file3' > file3
6859	  echo 'first branch revision of file4' > file4
6860	  echo 'first branch revision of file6' > file6
6861	  echo 'first branch revision of file5' > file5
6862	  dotest join-9 "${testcvs} add file5" \
6863"${PROG}"' [a-z]*: scheduling file `file5'\'' for addition on branch `branch'\''
6864'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
6865	  dotest join-10 "${testcvs} -q ci -mx ." \
6866"Checking in file3;
6867${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6868new revision: 1\.1\.2\.1; previous revision: 1\.1
6869done
6870Checking in file4;
6871${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6872new revision: 1\.1\.2\.1; previous revision: 1\.1
6873done
6874RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
6875done
6876Checking in file5;
6877${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
6878new revision: 1\.1\.2\.1; previous revision: 1\.1
6879done
6880Checking in file6;
6881${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
6882new revision: 1\.1\.2\.1; previous revision: 1\.1
6883done"
6884
6885	  # Tag the current revisions on the branch.
6886	  dotest join-11 "${testcvs} -q tag T1 ." \
6887'T file3
6888T file4
6889T file5
6890T file6
6891T file8'
6892
6893	  # Add file1 and file2, and remove the other files.
6894	  echo 'first branch revision of file1' > file1
6895	  echo 'first branch revision of file2' > file2
6896	  rm file3 file4 file5 file6
6897	  dotest join-12 "${testcvs} add file1 file2" \
6898"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition on branch `branch'\''
6899'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
6900'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
6901	  dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
6902"${PROG}"' [a-z]*: scheduling `file3'\'' for removal
6903'"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
6904'"${PROG}"' [a-z]*: scheduling `file5'\'' for removal
6905'"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
6906'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
6907	  dotest join-14 "${testcvs} -q ci -mx ." \
6908"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
6909done
6910Checking in file1;
6911${CVSROOT_DIRNAME}/first-dir/Attic/file1,v  <--  file1
6912new revision: 1\.1\.2\.1; previous revision: 1\.1
6913done
6914Checking in file2;
6915${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
6916new revision: 1\.1\.2\.1; previous revision: 1\.1
6917done
6918Removing file3;
6919${CVSROOT_DIRNAME}/first-dir/file3,v  <--  file3
6920new revision: delete; previous revision: 1\.1\.2\.1
6921done
6922Removing file4;
6923${CVSROOT_DIRNAME}/first-dir/file4,v  <--  file4
6924new revision: delete; previous revision: 1\.1\.2\.1
6925done
6926Removing file5;
6927${CVSROOT_DIRNAME}/first-dir/Attic/file5,v  <--  file5
6928new revision: delete; previous revision: 1\.1\.2\.1
6929done
6930Removing file6;
6931${CVSROOT_DIRNAME}/first-dir/Attic/file6,v  <--  file6
6932new revision: delete; previous revision: 1\.1\.2\.1
6933done"
6934
6935	  # Tag the current revisions on the branch.
6936	  dotest join-15 "${testcvs} -q tag T2 ." \
6937'T file1
6938T file2
6939T file8'
6940
6941	  # Do a checkout with a merge.
6942	  cd ../..
6943	  mkdir 3
6944	  cd 3
6945	  dotest join-16 "${testcvs} -q co -jT1 -jT2 first-dir" \
6946'U first-dir/file1
6947U first-dir/file2
6948'"${PROG}"' [a-z]*: file first-dir/file2 exists, but has been added in revision T2
6949U first-dir/file3
6950'"${PROG}"' [a-z]*: scheduling first-dir/file3 for removal
6951U first-dir/file4
6952'"${PROG}"' [a-z]*: scheduling first-dir/file4 for removal
6953U first-dir/file7'
6954
6955	  # Verify that the right changes have been scheduled.
6956	  cd first-dir
6957	  dotest join-17 "${testcvs} -q update" \
6958'A file1
6959R file3
6960R file4'
6961
6962	  # Modify file4 locally, and do an update with a merge.
6963	  cd ../../1/first-dir
6964	  echo 'third revision of file4' > file4
6965	  dotest join-18 "${testcvs} -q update -jT1 -jT2 ." \
6966'U file1
6967'"${PROG}"' [a-z]*: file file2 exists, but has been added in revision T2
6968'"${PROG}"' [a-z]*: scheduling file3 for removal
6969M file4
6970'"${PROG}"' [a-z]*: file file4 is locally modified, but has been removed in revision T2'
6971
6972	  # Verify that the right changes have been scheduled.
6973	  dotest join-19 "${testcvs} -q update" \
6974'A file1
6975R file3
6976M file4'
6977
6978	  # Do a checkout with a merge from a single revision.
6979
6980	  # FIXME: CVS currently gets this wrong.  file2 has been
6981	  # added on both the branch and the main line, and so should
6982	  # be regarded as a conflict.  However, given the way that
6983	  # CVS sets up the RCS file, there is no way to distinguish
6984	  # this case from the case of file2 having existed before the
6985	  # branch was made.  This could be fixed by reserving
6986	  # a revision somewhere, perhaps 1.1, as an always dead
6987	  # revision which can be used as the source for files added
6988	  # on branches.
6989	  cd ../../3
6990	  rm -r first-dir
6991	  dotest join-20 "${testcvs} -q co -jbranch first-dir" \
6992"U first-dir/file1
6993U first-dir/file2
6994RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
6995retrieving revision 1\.1
6996retrieving revision 1\.1\.2\.1
6997Merging differences between 1\.1 and 1\.1\.2\.1 into file2
6998U first-dir/file3
6999${PROG} [a-z]*: scheduling first-dir/file3 for removal
7000U first-dir/file4
7001${PROG} [a-z]*: file first-dir/file4 has been modified, but has been removed in revision branch
7002U first-dir/file7"
7003
7004	  # Verify that the right changes have been scheduled.
7005	  # The M file2 line is a bug; see above join-20.
7006	  cd first-dir
7007	  dotest join-21 "${testcvs} -q update" \
7008'A file1
7009M file2
7010R file3'
7011
7012	  # Checkout the main line again.
7013	  cd ../../1
7014	  rm -r first-dir
7015	  dotest join-22 "${testcvs} -q co first-dir" \
7016'U first-dir/file2
7017U first-dir/file3
7018U first-dir/file4
7019U first-dir/file7'
7020
7021	  # Modify file4 locally, and do an update with a merge from a
7022	  # single revision.
7023	  # The file2 handling is a bug; see above join-20.
7024	  cd first-dir
7025	  echo 'third revision of file4' > file4
7026	  dotest join-23 "${testcvs} -q update -jbranch ." \
7027"U file1
7028RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7029retrieving revision 1\.1
7030retrieving revision 1\.1\.2\.1
7031Merging differences between 1\.1 and 1\.1\.2\.1 into file2
7032${PROG} [a-z]*: scheduling file3 for removal
7033M file4
7034${PROG} [a-z]*: file file4 is locally modified, but has been removed in revision branch"
7035
7036	  # Verify that the right changes have been scheduled.
7037	  # The M file2 line is a bug; see above join-20
7038	  dotest join-24 "${testcvs} -q update" \
7039'A file1
7040M file2
7041R file3
7042M file4'
7043
7044	  cd ..
7045
7046	  # Checkout the main line again and make a new branch which we
7047	  # merge to.
7048	  rm -r first-dir
7049	  dotest join-25 "${testcvs} -q co first-dir" \
7050'U first-dir/file2
7051U first-dir/file3
7052U first-dir/file4
7053U first-dir/file7'
7054	  cd first-dir
7055	  dotest join-26 "${testcvs} -q tag -b br2" \
7056"T file2
7057T file3
7058T file4
7059T file7"
7060	  dotest join-27 "${testcvs} -q update -r br2" ""
7061	  # The handling of file8 here looks fishy to me.  I don't see
7062	  # why it should be different from the case where we merge to
7063	  # the trunk (e.g. join-23).
7064	  dotest join-28 "${testcvs} -q update -j branch" \
7065"U file1
7066RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7067retrieving revision 1.1
7068retrieving revision 1.1.2.1
7069Merging differences between 1.1 and 1.1.2.1 into file2
7070${PROG} [a-z]*: scheduling file3 for removal
7071${PROG} [a-z]*: file file4 has been modified, but has been removed in revision branch
7072U file8"
7073	  # Verify that the right changes have been scheduled.
7074	  dotest join-29 "${testcvs} -q update" \
7075"A file1
7076M file2
7077R file3
7078A file8"
7079
7080	  # Checkout the mainline again to try updating and merging between two
7081	  # branches in the same step
7082	  # this seems a likely scenario - the user finishes up on branch and
7083	  # updates to br2 and merges in the same step - and there was a bug
7084	  # once that if the file was removed in the update then it wouldn't be
7085	  # readded in the merge
7086	  cd ..
7087	  rm -r first-dir
7088	  dotest join-twobranch-1 "${testcvs} -q co -rbranch first-dir" \
7089'U first-dir/file1
7090U first-dir/file2
7091U first-dir/file8'
7092	  cd first-dir
7093	  dotest join-twobranch-2 "${testcvs} -q update -rbr2 -jbranch" \
7094"cvs [a-z]*: file1 is no longer in the repository
7095U file1
7096U file2
7097RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7098retrieving revision 1\.1
7099retrieving revision 1\.1\.2\.1
7100Merging differences between 1\.1 and 1\.1\.2\.1 into file2
7101U file3
7102${PROG} [a-z]*: scheduling file3 for removal
7103U file4
7104${PROG} [a-z]*: file file4 has been modified, but has been removed in revision branch
7105U file7
7106${PROG} [a-z]*: file8 is no longer in the repository
7107U file8"
7108	  # Verify that the right changes have been scheduled.
7109	  dotest join-twobranch-3 "${testcvs} -q update" \
7110"A file1
7111M file2
7112R file3
7113A file8"
7114
7115	  # Checkout the mainline again to try merging from the trunk
7116	  # to a branch.
7117	  cd ..
7118	  rm -r first-dir
7119	  dotest join-30 "${testcvs} -q co first-dir" \
7120'U first-dir/file2
7121U first-dir/file3
7122U first-dir/file4
7123U first-dir/file7'
7124	  cd first-dir
7125
7126	  # Tag the current revisions on the trunk.
7127	  dotest join-31 "${testcvs} -q tag T3 ." \
7128'T file2
7129T file3
7130T file4
7131T file7'
7132
7133	  # Modify file7.
7134	  echo 'second revision of file7' > file7
7135	  dotest join-32 "${testcvs} -q ci -mx ." \
7136"Checking in file7;
7137${CVSROOT_DIRNAME}/first-dir/file7,v  <--  file7
7138new revision: 1\.2; previous revision: 1\.1
7139done"
7140
7141	  # And Tag again.
7142	  dotest join-33 "${testcvs} -q tag T4 ." \
7143'T file2
7144T file3
7145T file4
7146T file7'
7147
7148	  # Now update branch to T3.
7149	  cd ../../2/first-dir
7150	  dotest join-34 "${testcvs} -q up -jT3" \
7151"${PROG} [a-z]*: file file4 does not exist, but is present in revision T3
7152U file7"
7153
7154	  # Verify that the right changes have been scheduled.
7155	  dotest join-35 "${testcvs} -q update" \
7156'A file7'
7157
7158	  # Now update to T4.
7159	  # This is probably a bug, although in this particular case it just
7160	  # happens to do the right thing; see above join-20.
7161	  dotest join-36 "${testcvs} -q up -j T3 -j T4" \
7162"A file7
7163RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
7164retrieving revision 1\.1
7165retrieving revision 1\.2
7166Merging differences between 1\.1 and 1\.2 into file7"
7167
7168	  # Verify that the right changes have been scheduled.
7169	  dotest join-37 "${testcvs} -q update" \
7170'A file7'
7171
7172	  cd ../..
7173
7174	  rm -r 1 2 3
7175	  rm -rf ${CVSROOT_DIRNAME}/first-dir
7176	  ;;
7177
7178	join2)
7179	  # More joining tests.
7180
7181	  # First the usual setup; create a directory first-dir, a file
7182	  # first-dir/file1, and a branch br1.
7183	  mkdir 1; cd 1
7184	  dotest join2-1 "${testcvs} -q co -l ." ''
7185	  mkdir first-dir
7186	  dotest join2-2 "${testcvs} add first-dir" \
7187"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
7188          cd first-dir
7189	  echo 'initial contents of file1' >file1
7190	  dotest join2-3 "${testcvs} add file1" \
7191"${PROG} [a-z]*: scheduling file .file1. for addition
7192${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7193	  dotest join2-4 "${testcvs} -q ci -m add" \
7194"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7195done
7196Checking in file1;
7197${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7198initial revision: 1\.1
7199done"
7200	  dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
7201	  dotest join2-6 "${testcvs} -q update -r br1" ""
7202	  echo 'modify on branch' >>file1
7203	  touch bradd
7204	  dotest join2-6a "${testcvs} add bradd" \
7205"${PROG} [a-z]*: scheduling file .bradd. for addition on branch .br1.
7206${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7207	  dotest join2-7 "${testcvs} -q ci -m modify" \
7208"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
7209done
7210Checking in bradd;
7211${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v  <--  bradd
7212new revision: 1\.1\.2\.1; previous revision: 1\.1
7213done
7214Checking in file1;
7215${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7216new revision: 1\.1\.2\.1; previous revision: 1\.1
7217done"
7218
7219	  # Here is the unusual/pathological part.  We switch back to
7220	  # the trunk *for file1 only*, not for the whole directory.
7221	  dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
7222	  dotest join2-9 "${testcvs} -q status file1" \
7223"===================================================================
7224File: file1            	Status: Up-to-date
7225
7226   Working revision:	1\.1.*
7227   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
7228   Sticky Tag:		(none)
7229   Sticky Date:		(none)
7230   Sticky Options:	(none)"
7231	  dotest join2-10 "cat CVS/Tag" "Tbr1"
7232
7233	  dotest join2-11 "${testcvs} -q update -j br1 file1" \
7234"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7235retrieving revision 1\.1
7236retrieving revision 1\.1\.2\.1
7237Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
7238	  dotest join2-12 "cat file1" "initial contents of file1
7239modify on branch"
7240	  # We should have no sticky tag on file1
7241	  dotest join2-13 "${testcvs} -q status file1" \
7242"===================================================================
7243File: file1            	Status: Locally Modified
7244
7245   Working revision:	1\.1.*
7246   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/file1,v
7247   Sticky Tag:		(none)
7248   Sticky Date:		(none)
7249   Sticky Options:	(none)"
7250	  dotest join2-14 "cat CVS/Tag" "Tbr1"
7251	  # And the checkin should go to the trunk
7252	  dotest join2-15 "${testcvs} -q ci -m modify file1" \
7253"Checking in file1;
7254${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7255new revision: 1\.2; previous revision: 1\.1
7256done"
7257
7258	  # OK, the above is all well and good and has worked for some
7259	  # time.  Now try the case where the file had been added on
7260	  # the branch.
7261	  dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
7262	  # The workaround is to update the whole directory.
7263	  # The non-circumvented version won't work.  The reason is that
7264	  # update removes the entry from CVS/Entries, so of course we get
7265	  # the tag from CVS/Tag and not Entries.  I suppose maybe
7266	  # we could invent some new format in Entries which would handle
7267	  # this, but doing so, and handling it properly throughout
7268	  # CVS, would be a lot of work and I'm not sure this case justifies
7269	  # it.
7270	  dotest join2-17-circumvent "${testcvs} -q update -A" \
7271"${PROG} [a-z]*: bradd is no longer in the repository
7272[UP] file1"
7273:	  dotest join2-17 "${testcvs} -q update -A bradd" \
7274"${PROG} [a-z]*: warning: bradd is not (any longer) pertinent"
7275	  dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
7276	  dotest join2-19 "${testcvs} -q status bradd" \
7277"===================================================================
7278File: bradd            	Status: Locally Added
7279
7280   Working revision:	New file!
7281   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
7282   Sticky Tag:		(none)
7283   Sticky Date:		(none)
7284   Sticky Options:	(none)"
7285	  dotest join2-20 "${testcvs} -q ci -m modify bradd" \
7286"Checking in bradd;
7287${CVSROOT_DIRNAME}/first-dir/bradd,v  <--  bradd
7288new revision: 1\.2; previous revision: 1\.1
7289done"
7290
7291	  cd ../..
7292	  rm -r 1
7293	  rm -rf ${CVSROOT_DIRNAME}/first-dir
7294	  ;;
7295
7296	join3)
7297	  # See "join" for a list of other joining/branching tests.
7298	  # First the usual setup; create a directory first-dir, a file
7299	  # first-dir/file1, and a branch br1.
7300	  mkdir 1; cd 1
7301	  dotest join3-1 "${testcvs} -q co -l ." ''
7302	  mkdir first-dir
7303	  dotest join3-2 "${testcvs} add first-dir" \
7304"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
7305	  cd first-dir
7306	  echo 'initial contents of file1' >file1
7307	  dotest join3-3 "${testcvs} add file1" \
7308"${PROG} [a-z]*: scheduling file .file1. for addition
7309${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7310	  dotest join3-4 "${testcvs} -q ci -m add" \
7311"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7312done
7313Checking in file1;
7314${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7315initial revision: 1\.1
7316done"
7317	  dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
7318	  dotest join3-6 "${testcvs} -q update -r br1" ""
7319	  echo 'br1:line1' >>file1
7320	  dotest join3-7 "${testcvs} -q ci -m modify" \
7321"Checking in file1;
7322${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7323new revision: 1\.1\.2\.1; previous revision: 1\.1
7324done"
7325
7326	  # Now back to the trunk for:
7327	  # another revision and another branch for file1.
7328	  # add file2, which will exist on trunk and br2 but not br1.
7329	  dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
7330	  echo 'trunk:line1' > file2
7331	  dotest join3-8a "${testcvs} add file2" \
7332"${PROG} [a-z]*: scheduling file .file2. for addition
7333${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7334	  echo 'trunk:line1' >>file1
7335	  dotest join3-9 "${testcvs} -q ci -m modify" \
7336"Checking in file1;
7337${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7338new revision: 1\.2; previous revision: 1\.1
7339done
7340RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
7341done
7342Checking in file2;
7343${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
7344initial revision: 1\.1
7345done"
7346	  dotest join3-10 "${testcvs} -q tag -b br2" "T file1
7347T file2"
7348
7349	  # Before we actually have any revision on br2, let's try a join
7350	  dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
7351${PROG} [a-z]*: file2 is no longer in the repository"
7352	  dotest join3-12 "${testcvs} -q update -j br2" \
7353"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7354retrieving revision 1\.1
7355retrieving revision 1\.2
7356Merging differences between 1\.1 and 1\.2 into file1
7357rcsmerge: warning: conflicts during merge
7358U file2"
7359	  dotest join3-13 "cat file1" \
7360"initial contents of file1
7361[<]<<<<<< file1
7362br1:line1
7363[=]======
7364trunk:line1
7365[>]>>>>>> 1\.2"
7366	  rm file1
7367
7368	  # OK, we'll try the same thing with a revision on br2.
7369	  dotest join3-14 "${testcvs} -q update -r br2 file1" \
7370"${PROG} [a-z]*: warning: file1 was lost
7371U file1" "U file1"
7372	  echo 'br2:line1' >>file1
7373	  dotest join3-15 "${testcvs} -q ci -m modify file1" \
7374"Checking in file1;
7375${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
7376new revision: 1\.2\.2\.1; previous revision: 1\.2
7377done"
7378
7379	  # OK, now we can join br2 to br1
7380	  dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
7381	  # It may seem odd, to merge a higher branch into a lower
7382	  # branch, but in fact CVS defines the ancestor as 1.1
7383	  # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
7384	  # This seems like a reasonably plausible behavior.
7385	  dotest join3-17 "${testcvs} -q update -j br2 file1" \
7386"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
7387retrieving revision 1\.1
7388retrieving revision 1\.2\.2\.1
7389Merging differences between 1\.1 and 1\.2\.2\.1 into file1
7390rcsmerge: warning: conflicts during merge"
7391	  dotest join3-18 "cat file1" \
7392"initial contents of file1
7393[<]<<<<<< file1
7394br1:line1
7395[=]======
7396trunk:line1
7397br2:line1
7398[>]>>>>>> 1\.2\.2\.1"
7399
7400	  cd ../..
7401	  rm -r 1
7402	  rm -rf ${CVSROOT_DIRNAME}/first-dir
7403	  ;;
7404
7405	join-readonly-conflict)
7406	  # Previously, only tests 1 & 11 were being tested.  I added the
7407	  # intermediate dotest's to try and diagnose a different failure
7408	  #
7409	  # Demonstrate that cvs-1.9.29 can fail on 2nd and subsequent
7410	  # conflict-evoking join attempts.
7411	  # Even with that version of CVS, This test failed only in
7412	  # client-server mode, and would have been noticed in normal
7413	  # operation only for files that were read-only (either due to
7414	  # use of cvs' global -r option, setting the CVSREAD envvar,
7415	  # or use of watch lists).
7416	  mkdir join-readonly-conflict; cd join-readonly-conflict
7417	  dotest join-readonly-conflict-1 "$testcvs -q co -l ." ''
7418	  module=join-readonly-conflict
7419	  mkdir $module
7420	  $testcvs -q add $module >>$LOGFILE 2>&1
7421	  cd $module
7422
7423	  file=m
7424	  echo trunk > $file
7425	  dotest join-readonly-conflict-2 "$testcvs -Q add $file" ''
7426
7427	  dotest join-readonly-conflict-3 "$testcvs -q ci -m . $file" \
7428"RCS file: $CVSROOT_DIRNAME/$module/$file,v
7429done
7430Checking in $file;
7431$CVSROOT_DIRNAME/$module/$file,v  <--  $file
7432initial revision: 1\.1
7433done"
7434
7435	  dotest join-readonly-conflict-4 "$testcvs tag -b B $file" "T $file"
7436	  dotest join-readonly-conflict-5 "$testcvs -q update -rB $file" ''
7437	  echo branch B > $file
7438	  dotest join-readonly-conflict-6 "$testcvs -q ci -m . $file" \
7439"Checking in $file;
7440$CVSROOT_DIRNAME/$module/$file,v  <--  $file
7441new revision: 1\.1\.2\.1; previous revision: 1\.1
7442done"
7443
7444	  rm $file
7445	  dotest join-readonly-conflict-7 "$testcvs -Q update -A $file" ''
7446	  # Make sure $file is read-only.  This can happen more realistically
7447	  # via patch -- which could be used to apply a delta, yet would
7448	  # preserve a file's read-only permissions.
7449	  echo conflict > $file; chmod u-w $file
7450	  dotest join-readonly-conflict-8 "$testcvs update -r B $file" \
7451"RCS file: $CVSROOT_DIRNAME/$module/$file,v
7452retrieving revision 1\.1
7453retrieving revision 1\.1\.2\.1
7454Merging differences between 1\.1 and 1\.1\.2\.1 into $file
7455rcsmerge: warning: conflicts during merge
7456$PROG [a-z]*: conflicts found in $file
7457C $file"
7458
7459	  # restore to the trunk
7460	  rm -f $file
7461	  dotest join-readonly-conflict-9 "$testcvs -Q update -A $file" ''
7462
7463	  # This one would fail because cvs couldn't open the existing
7464	  # (and read-only) .# file for writing.
7465	  echo conflict > $file
7466
7467	  # verify that the backup file is writable
7468	  if test -w ".#$file.1.1"; then
7469	    fail "join-readonly-conflict-10 : .#$file.1.1 is writable"
7470	  else
7471	    pass "join-readonly-conflict-10"
7472	  fi
7473	  dotest join-readonly-conflict-11 "$testcvs update -r B $file" \
7474"RCS file: $CVSROOT_DIRNAME/$module/$file,v
7475retrieving revision 1\.1
7476retrieving revision 1\.1\.2\.1
7477Merging differences between 1\.1 and 1\.1\.2\.1 into $file
7478rcsmerge: warning: conflicts during merge
7479$PROG [a-z]*: conflicts found in $file
7480C m"
7481
7482	  cd ../..
7483	  if $keep; then :; else
7484	    rm -rf join-readonly-conflict
7485	    rm -rf $CVSROOT_DIRNAME/$module
7486	  fi
7487	  ;;
7488
7489	join-admin)
7490	  mkdir 1; cd 1
7491	  dotest join-admin-1 "$testcvs -q co -l ." ''
7492	  module=x
7493	  mkdir $module
7494	  $testcvs -q add $module >>$LOGFILE 2>&1
7495	  cd $module
7496
7497	  # Create a file so applying the first tag works.
7498	  echo foo > a
7499	  $testcvs -Q add a > /dev/null 2>&1
7500	  $testcvs -Q ci -m. a > /dev/null 2>&1
7501
7502	  $testcvs -Q tag -b B
7503	  $testcvs -Q tag -b M1
7504	  echo '$''Id$' > b
7505	  $testcvs -Q add b > /dev/null 2>&1
7506	  $testcvs -Q ci -m. b > /dev/null 2>&1
7507	  $testcvs -Q tag -b M2
7508
7509	  $testcvs -Q update -r B
7510	  $testcvs -Q update -kk -jM1 -jM2
7511	  $testcvs -Q ci -m. b >/dev/null 2>&1
7512
7513	  $testcvs -Q update -A
7514
7515	  # Verify that the -kk flag from the update did not
7516	  # propagate to the repository.
7517	  dotest join-admin-1 "$testcvs status b" \
7518"===================================================================
7519File: b                	Status: Up-to-date
7520
7521   Working revision:	1\.1.*
7522   Repository revision:	1\.1	${CVSROOT_DIRNAME}/x/b,v
7523   Sticky Tag:		(none)
7524   Sticky Date:		(none)
7525   Sticky Options:	(none)"
7526
7527	  cd ../..
7528	  rm -rf 1
7529	  rm -rf ${CVSROOT_DIRNAME}/$module
7530	  ;;
7531
7532	join-admin-2)
7533	  # Show that when a merge (via update -kk -jtag1 -jtag2) first
7534	  # removes a file, then modifies another containing an $Id...$ line,
7535	  # the resulting file contains the unexpanded `$Id.$' string, as
7536	  # -kk requires.
7537	  mkdir 1; cd 1
7538	  dotest join-admin-2-1 "$testcvs -q co -l ." ''
7539	  module=x
7540	  mkdir $module
7541	  dotest join-admin-2-2 "$testcvs -q add $module" \
7542"Directory ${CVSROOT_DIRNAME}/x added to the repository"
7543	  cd $module
7544
7545	  # Create a file so applying the first tag works.
7546	  echo '$''Id$' > e0
7547	  cp e0 e
7548	  dotest join-admin-2-3 "$testcvs -Q add e" ''
7549	  dotest join-admin-2-4 "$testcvs -Q ci -m. e" \
7550"RCS file: ${CVSROOT_DIRNAME}/x/e,v
7551done
7552Checking in e;
7553${CVSROOT_DIRNAME}/x/e,v  <--  e
7554initial revision: 1\.1
7555done"
7556
7557	  dotest join-admin-2-5 "$testcvs -Q tag -b T" '' "${QUESTION} e0"
7558	  dotest join-admin-2-6 "$testcvs -Q update -r T" '' "${QUESTION} e0"
7559	  cp e0 e
7560	  dotest join-admin-2-7 "$testcvs -Q ci -m. e" \
7561"Checking in e;
7562${CVSROOT_DIRNAME}/x/e,v  <--  e
7563new revision: 1\.1\.2\.1; previous revision: 1\.1
7564done"
7565
7566	  dotest join-admin-2-8 "$testcvs -Q update -A" '' "${QUESTION} e0"
7567	  dotest join-admin-2-9 "$testcvs -Q tag -b M1" '' "${QUESTION} e0"
7568
7569	  echo '$''Id$' > b
7570	  dotest join-admin-2-10 "$testcvs -Q add b" ''
7571	  cp e0 e
7572	  dotest join-admin-2-11 "$testcvs -Q ci -m. b e" \
7573"RCS file: ${CVSROOT_DIRNAME}/x/b,v
7574done
7575Checking in b;
7576${CVSROOT_DIRNAME}/x/b,v  <--  b
7577initial revision: 1\.1
7578done
7579Checking in e;
7580${CVSROOT_DIRNAME}/x/e,v  <--  e
7581new revision: 1\.2; previous revision: 1\.1
7582done"
7583
7584	  dotest join-admin-2-12 "$testcvs -Q tag -b M2" '' "${QUESTION} e0"
7585
7586	  dotest join-admin-2-13 "$testcvs -Q update -r T" '' "${QUESTION} e0"
7587	  dotest join-admin-2-14 "$testcvs update -kk -jM1 -jM2" \
7588"${PROG} [a-z]*: Updating .
7589U b
7590U e
7591RCS file: ${CVSROOT_DIRNAME}/x/e,v
7592retrieving revision 1\.1
7593retrieving revision 1\.2
7594Merging differences between 1\.1 and 1\.2 into e
7595${QUESTION} e0" \
7596"${QUESTION} e0
7597${PROG} [a-z]*: Updating .
7598U b
7599U e
7600RCS file: ${CVSROOT_DIRNAME}/x/e,v
7601retrieving revision 1\.1
7602retrieving revision 1\.2
7603Merging differences between 1\.1 and 1\.2 into e"
7604
7605	  # Verify that the $Id.$ string is not expanded.
7606	  dotest join-admin-2-15 "cat e" '$''Id$'
7607
7608	  cd ../..
7609	  rm -rf 1
7610	  rm -rf ${CVSROOT_DIRNAME}/$module
7611	  ;;
7612
7613	new) # look for stray "no longer pertinent" messages.
7614		mkdir ${CVSROOT_DIRNAME}/first-dir
7615
7616		if ${CVS} co first-dir  ; then
7617		    pass 117
7618		else
7619		    fail 117
7620		fi
7621
7622		cd first-dir
7623		touch a
7624
7625		if ${CVS} add a  2>>${LOGFILE}; then
7626		    pass 118
7627		else
7628		    fail 118
7629		fi
7630
7631		if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
7632		    pass 119
7633		else
7634		    fail 119
7635		fi
7636
7637		rm a
7638
7639		if ${CVS} rm a  2>>${LOGFILE}; then
7640		    pass 120
7641		else
7642		    fail 120
7643		fi
7644
7645		if ${CVS} ci -m removed >>${LOGFILE} ; then
7646		    pass 121
7647		else
7648		    fail 121
7649		fi
7650
7651		if ${CVS} update -A  2>&1 | grep longer ; then
7652		    fail 122
7653		else
7654		    pass 122
7655		fi
7656
7657		if ${CVS} update -rHEAD 2>&1 | grep longer ; then
7658		    fail 123
7659		else
7660		    pass 123
7661		fi
7662
7663		cd ..
7664		rm -r first-dir
7665		rm -rf ${CVSROOT_DIRNAME}/first-dir
7666		;;
7667
7668	newb)
7669	  # Test removing a file on a branch and then checking it out.
7670
7671	  # We call this "newb" only because it, like the "new" tests,
7672	  # has something to do with "no longer pertinent" messages.
7673	  # Not necessarily the most brilliant nomenclature.
7674
7675	  # Create file 'a'.
7676	  mkdir ${CVSROOT_DIRNAME}/first-dir
7677	  dotest newb-123a "${testcvs} -q co first-dir" ''
7678	  cd first-dir
7679	  touch a
7680	  dotest newb-123b "${testcvs} add a" \
7681"${PROG} [a-z]*: scheduling file .a. for addition
7682${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7683	  dotest newb-123c "${testcvs} -q ci -m added" \
7684"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
7685done
7686Checking in a;
7687${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7688initial revision: 1\.1
7689done"
7690
7691	  # Make a branch.
7692	  dotest newb-123d "${testcvs} -q tag -b branch" "T a"
7693
7694	  # Check out the branch.
7695	  cd ..
7696	  rm -r first-dir
7697	  mkdir 1
7698	  cd 1
7699	  dotest newb-123e "${testcvs} -q co -r branch first-dir" \
7700"U first-dir/a"
7701
7702	  # Remove 'a' on another copy of the branch.
7703	  cd ..
7704	  mkdir 2
7705	  cd 2
7706	  dotest newb-123f "${testcvs} -q co -r branch first-dir" \
7707"U first-dir/a"
7708	  cd first-dir
7709	  rm a
7710	  dotest newb-123g "${testcvs} rm a" \
7711"${PROG} [a-z]*: scheduling .a. for removal
7712${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
7713	  dotest newb-123h "${testcvs} -q ci -m removed" \
7714"Removing a;
7715${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7716new revision: delete; previous revision: 1\.1\.2
7717done"
7718
7719	  # Check out the file on the branch.  This should report
7720	  # that the file is not pertinent, but it should not
7721	  # say anything else.
7722	  cd ..
7723	  rm -r first-dir
7724	  dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
7725"${PROG} [a-z]*: warning: first-dir/a is not (any longer) pertinent"
7726
7727	  # Update the other copy, and make sure that a is removed.
7728	  cd ../1/first-dir
7729	  # "Entry Invalid" is a rather strange output here.  Something like
7730	  # "Removed in Repository" would make more sense.
7731	  dotest newb-123j0 "${testcvs} status a" \
7732"${PROG} [a-z]*: a is no longer in the repository
7733===================================================================
7734File: a                	Status: Entry Invalid
7735
7736   Working revision:	1\.1.*
7737   Repository revision:	1\.1\.2\.1	${CVSROOT_DIRNAME}/first-dir/a,v
7738   Sticky Tag:		branch (branch: 1\.1\.2)
7739   Sticky Date:		(none)
7740   Sticky Options:	(none)"
7741	  dotest newb-123j "${testcvs} -q update" \
7742"${PROG} [a-z]*: a is no longer in the repository"
7743
7744	  if test -f a; then
7745	    fail newb-123k
7746	  else
7747	    pass newb-123k
7748	  fi
7749
7750	  cd ../..
7751	  rm -r 1 2
7752	  rm -rf ${CVSROOT_DIRNAME}/first-dir
7753	  ;;
7754
7755	conflicts)
7756		mkdir ${CVSROOT_DIRNAME}/first-dir
7757
7758		mkdir 1
7759		cd 1
7760
7761		dotest conflicts-124 "${testcvs} -q co first-dir" ''
7762
7763		cd first-dir
7764		touch a
7765
7766		dotest conflicts-125 "${testcvs} add a" \
7767"${PROG} [a-z]*: scheduling file .a. for addition
7768${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
7769		dotest conflicts-126 "${testcvs} -q ci -m added" \
7770"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
7771done
7772Checking in a;
7773${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7774initial revision: 1\.1
7775done"
7776
7777		cd ../..
7778		mkdir 2
7779		cd 2
7780
7781		dotest conflicts-126.5 "${testcvs} co -p first-dir" \
7782"${PROG} [a-z]*: Updating first-dir
7783===================================================================
7784Checking out first-dir/a
7785RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
7786VERS: 1\.1
7787\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
7788		if ${CVS} co first-dir ; then
7789		    pass 127
7790		else
7791		    fail 127
7792		fi
7793		cd first-dir
7794		if test -f a; then
7795		    pass 127a
7796		else
7797		    fail 127a
7798		fi
7799
7800		cd ../../1/first-dir
7801		echo add a line >>a
7802		mkdir dir1
7803		dotest conflicts-127b "${testcvs} add dir1" \
7804"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
7805		dotest conflicts-128 "${testcvs} -q ci -m changed" \
7806"Checking in a;
7807${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7808new revision: 1\.2; previous revision: 1\.1
7809done"
7810		cd ../..
7811
7812		# Similar to conflicts-126.5, but now the file has nonempty
7813		# contents.
7814		mkdir 3
7815		cd 3
7816		dotest conflicts-128.5 "${testcvs} co -p -l first-dir" \
7817"${PROG} [a-z]*: Updating first-dir
7818===================================================================
7819Checking out first-dir/a
7820RCS:  ${CVSROOT_DIRNAME}/first-dir/a,v
7821VERS: 1\.2
7822\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
7823add a line"
7824		cd ..
7825		rmdir 3
7826
7827		# Now go over the to the other working directory and
7828		# start testing conflicts
7829		cd 2/first-dir
7830		echo add a conflicting line >>a
7831		dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
7832"${PROG}"' [a-z]*: Up-to-date check failed for `a'\''
7833'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
7834		mkdir dir1
7835		mkdir sdir
7836		dotest conflicts-status-0 "${testcvs} status a" \
7837"===================================================================
7838File: a                	Status: Needs Merge
7839
7840   Working revision:	1\.1.*
7841   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/a,v
7842   Sticky Tag:		(none)
7843   Sticky Date:		(none)
7844   Sticky Options:	(none)"
7845		dotest conflicts-129a "${testcvs} -nq update a" \
7846"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
7847retrieving revision 1\.1
7848retrieving revision 1\.2
7849Merging differences between 1\.1 and 1\.2 into a
7850rcsmerge: warning: conflicts during merge
7851${PROG} [a-z]*: conflicts found in a
7852C a"
7853		dotest conflicts-130 "${testcvs} -q update" \
7854"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
7855retrieving revision 1\.1
7856retrieving revision 1\.2
7857Merging differences between 1\.1 and 1\.2 into a
7858rcsmerge: warning: conflicts during merge
7859${PROG} [a-z]*: conflicts found in a
7860C a
7861${QUESTION} dir1
7862${QUESTION} sdir" \
7863"${QUESTION} dir1
7864${QUESTION} sdir
7865RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
7866retrieving revision 1\.1
7867retrieving revision 1\.2
7868Merging differences between 1\.1 and 1\.2 into a
7869rcsmerge: warning: conflicts during merge
7870${PROG} [a-z]*: conflicts found in a
7871C a"
7872		rmdir dir1 sdir
7873
7874		dotest conflicts-status-1 "${testcvs} status a" \
7875"===================================================================
7876File: a                	Status: File had conflicts on merge
7877
7878   Working revision:	1\.2.*
7879   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/a,v
7880   Sticky Tag:		(none)
7881   Sticky Date:		(none)
7882   Sticky Options:	(none)"
7883		dotest_fail conflicts-131 "${testcvs} -q ci -m try" \
7884"${PROG} [a-z]*: file .a. had a conflict and has not been modified
7885${PROG} \[[a-z]* aborted\]: correct above errors first!"
7886
7887		# Try to check in the file with the conflict markers in it.
7888		# Make sure we detect any one of the three conflict markers
7889		mv a aa
7890		grep '^<<<<<<<' aa >a
7891		dotest conflicts-status-2 "${testcvs} -nq ci -m try a" \
7892"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators"
7893
7894		grep '^=======' aa >a
7895		dotest conflicts-status-3 "${testcvs} -nq ci -m try a" \
7896"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators"
7897
7898		grep '^>>>>>>>' aa >a
7899		dotest conflicts-status-4 "${testcvs} -qn ci -m try a" \
7900"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators"
7901
7902		mv aa a
7903		echo lame attempt at resolving it >>a
7904		dotest conflicts-status-5 "${testcvs} status a" \
7905"===================================================================
7906File: a                	Status: File had conflicts on merge
7907
7908   Working revision:	1\.2.*
7909   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/a,v
7910   Sticky Tag:		(none)
7911   Sticky Date:		(none)
7912   Sticky Options:	(none)"
7913		dotest conflicts-132 "${testcvs} -q ci -m try" \
7914"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators
7915Checking in a;
7916${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7917new revision: 1\.3; previous revision: 1\.2
7918done"
7919
7920		# OK, the user saw the warning (good user), and now
7921		# resolves it for real.
7922		echo resolve conflict >a
7923		dotest conflicts-status-6 "${testcvs} status a" \
7924"===================================================================
7925File: a                	Status: Locally Modified
7926
7927   Working revision:	1\.3.*
7928   Repository revision:	1\.3	${CVSROOT_DIRNAME}/first-dir/a,v
7929   Sticky Tag:		(none)
7930   Sticky Date:		(none)
7931   Sticky Options:	(none)"
7932		dotest conflicts-133 "${testcvs} -q ci -m resolved" \
7933"Checking in a;
7934${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
7935new revision: 1\.4; previous revision: 1\.3
7936done"
7937		dotest conflicts-status-7 "${testcvs} status a" \
7938"===================================================================
7939File: a                	Status: Up-to-date
7940
7941   Working revision:	1\.4.*
7942   Repository revision:	1\.4	${CVSROOT_DIRNAME}/first-dir/a,v
7943   Sticky Tag:		(none)
7944   Sticky Date:		(none)
7945   Sticky Options:	(none)"
7946
7947		# Now test that we can add a file in one working directory
7948		# and have an update in another get it.
7949		cd ../../1/first-dir
7950		echo abc >abc
7951		if ${testcvs} add abc >>${LOGFILE} 2>&1; then
7952		    pass 134
7953		else
7954		    fail 134
7955		fi
7956		if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
7957		    pass 135
7958		else
7959		    fail 135
7960		fi
7961		cd ../../2
7962		mkdir first-dir/dir1 first-dir/sdir
7963		dotest conflicts-136 "${testcvs} -q update first-dir" \
7964'[UP] first-dir/abc
7965'"${QUESTION}"' first-dir/dir1
7966'"${QUESTION}"' first-dir/sdir' \
7967''"${QUESTION}"' first-dir/dir1
7968'"${QUESTION}"' first-dir/sdir
7969[UP] first-dir/abc'
7970		dotest conflicts-137 'test -f first-dir/abc' ''
7971		rmdir first-dir/dir1 first-dir/sdir
7972
7973		# Now test something similar, but in which the parent directory
7974		# (not the directory in question) has the Entries.Static flag
7975		# set.
7976		cd ../1/first-dir
7977		mkdir subdir
7978		if ${testcvs} add subdir >>${LOGFILE}; then
7979		    pass 138
7980		else
7981		    fail 138
7982		fi
7983		cd ../..
7984		mkdir 3
7985		cd 3
7986		if ${testcvs} -q co first-dir/abc first-dir/subdir \
7987		    >>${LOGFILE}; then
7988		    pass 139
7989		else
7990		    fail 139
7991		fi
7992		cd ../1/first-dir/subdir
7993		echo sss >sss
7994		if ${testcvs} add sss >>${LOGFILE} 2>&1; then
7995		    pass 140
7996		else
7997		    fail 140
7998		fi
7999		if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
8000		    pass 140
8001		else
8002		    fail 140
8003		fi
8004		cd ../../../3/first-dir
8005		if ${testcvs} -q update >>${LOGFILE}; then
8006		    pass 141
8007		else
8008		    fail 141
8009		fi
8010		if test -f subdir/sss; then
8011		    pass 142
8012		else
8013		    fail 142
8014		fi
8015		cd ../..
8016		rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
8017		;;
8018
8019	conflicts2)
8020	  # More conflicts tests; separate from conflicts to keep each
8021	  # test a manageable size.
8022	  mkdir ${CVSROOT_DIRNAME}/first-dir
8023
8024	  mkdir 1
8025	  cd 1
8026
8027	  dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
8028
8029	  cd first-dir
8030	  touch a abc
8031
8032	  dotest conflicts2-142a2 "${testcvs} add a abc" \
8033"${PROG} [a-z]*: scheduling file .a. for addition
8034${PROG} [a-z]*: scheduling file .abc. for addition
8035${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
8036	  dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
8037"RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
8038done
8039Checking in a;
8040${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
8041initial revision: 1\.1
8042done
8043RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
8044done
8045Checking in abc;
8046${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
8047initial revision: 1\.1
8048done"
8049
8050	  cd ../..
8051	  mkdir 2
8052	  cd 2
8053
8054	  dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
8055U first-dir/abc'
8056	  cd ..
8057
8058	  # BEGIN TESTS USING THE FILE A
8059	  # FIXME: would be cleaner to separate them out into their own
8060	  # tests; conflicts2 is getting long.
8061	  # Now test that if one person modifies and commits a
8062	  # file and a second person removes it, it is a
8063	  # conflict
8064	  cd 1/first-dir
8065	  echo modify a >>a
8066	  dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
8067"Checking in a;
8068${CVSROOT_DIRNAME}/first-dir/a,v  <--  a
8069new revision: 1\.2; previous revision: 1\.1
8070done"
8071	  cd ../../2/first-dir
8072	  rm a
8073	  dotest conflicts2-142b3 "${testcvs} rm a" \
8074"${PROG} [a-z]*: scheduling .a. for removal
8075${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8076	  dotest_fail conflicts2-142b4 "${testcvs} -q update" \
8077"${PROG} [a-z]*: conflict: removed a was modified by second party
8078C a"
8079	  # Resolve the conflict by deciding not to remove the file
8080	  # after all.
8081	  dotest conflicts2-142b5 "${testcvs} add a" "U a
8082${PROG} [a-z]*: a, version 1\.1, resurrected"
8083	  dotest conflicts2-142b6 "${testcvs} -q update" ''
8084
8085	  # Now one level up.
8086	  cd ..
8087	  dotest conflicts2-142b7 "${testcvs} rm -f first-dir/a" \
8088"${PROG} [a-z]*: scheduling .first-dir/a. for removal
8089${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8090
8091	  if $remote; then
8092	    # Haven't investigated this one.
8093	    dotest_fail conflicts2-142b8 "${testcvs} add first-dir/a" \
8094"${PROG} add: in directory \.:
8095${PROG} \[add aborted\]: there is no version here; do '${PROG} checkout' first"
8096	    cd first-dir
8097	  else
8098	    # The "nothing known" is a bug.  Correct behavior is for a to get
8099	    # created, as above.  Cause is pretty obvious - add.c
8100	    # calls update() without dealing with the fact we are chdir'd.
8101	    # Also note that resurrecting 1.2 instead of 1.1 is also a
8102	    # bug, I think (the same part of add.c has a comment which says
8103	    # "XXX - bugs here; this really resurrect the head" which
8104	    # presumably refers to this).
8105	    # The fix for both is presumably to call RCS_checkout() or
8106	    # something other than update().
8107	    dotest conflicts2-142b8 "${testcvs} add first-dir/a" \
8108"${PROG} [a-z]*: nothing known about first-dir
8109${PROG} [a-z]*: first-dir/a, version 1\.2, resurrected"
8110	    cd first-dir
8111	    # Now recover from the damage that the 142b8 test did.
8112	    dotest conflicts2-142b9 "${testcvs} rm -f a" \
8113"${PROG} [a-z]*: scheduling .a. for removal
8114${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8115	  fi
8116
8117	  # As before, 1.2 instead of 1.1 is a bug.
8118	  dotest conflicts2-142b10 "${testcvs} add a" "U a
8119${PROG} [a-z]*: a, version 1\.2, resurrected"
8120	  # As with conflicts2-142b6, check that things are normal again.
8121	  dotest conflicts2-142b11 "${testcvs} -q update" ''
8122	  cd ../..
8123	  # END TESTS USING THE FILE A
8124
8125	  # Now test that if one person removes a file and
8126	  # commits it, and a second person removes it, is it
8127	  # not a conflict.
8128	  cd 1/first-dir
8129	  rm abc
8130	  dotest conflicts2-142c0 "${testcvs} rm abc" \
8131"${PROG} [a-z]*: scheduling .abc. for removal
8132${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8133	  dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
8134"Removing abc;
8135${CVSROOT_DIRNAME}/first-dir/abc,v  <--  abc
8136new revision: delete; previous revision: 1\.1
8137done"
8138	  cd ../../2/first-dir
8139	  rm abc
8140	  dotest conflicts2-142c2 "${testcvs} rm abc" \
8141"${PROG} [a-z]*: scheduling .abc. for removal
8142${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8143	  dotest conflicts2-142c3 "${testcvs} update" \
8144"${PROG} [a-z]*: Updating \."
8145	  cd ../..
8146
8147	  # conflicts2-142d*: test that if one party adds a file, and another
8148	  # party has a file of the same name, cvs notices
8149	  cd 1/first-dir
8150	  touch aa.c
8151	  echo 'contents unchanged' >same.c
8152	  dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
8153"${PROG} [a-z]*: scheduling file .aa\.c. for addition
8154${PROG} [a-z]*: scheduling file .same\.c. for addition
8155${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
8156	  dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
8157"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa\.c,v
8158done
8159Checking in aa\.c;
8160${CVSROOT_DIRNAME}/first-dir/aa\.c,v  <--  aa\.c
8161initial revision: 1\.1
8162done
8163RCS file: ${CVSROOT_DIRNAME}/first-dir/same\.c,v
8164done
8165Checking in same\.c;
8166${CVSROOT_DIRNAME}/first-dir/same\.c,v  <--  same\.c
8167initial revision: 1\.1
8168done"
8169	  cd ../../2/first-dir
8170	  echo "don't you dare obliterate this text" >aa.c
8171	  echo 'contents unchanged' >same.c
8172	  # Note the discrepancy between local and remote in the handling
8173	  # of same.c.  I kind
8174	  # of suspect that the local CVS behavior is the more useful one
8175	  # although I do sort of wonder whether we should make people run
8176	  # cvs add just to get them in that habit (also, trying to implement
8177	  # the local CVS behavior for remote without the cvs add seems
8178	  # pretty difficult).
8179	  if $remote; then
8180	    dotest_fail conflicts2-142d2 "${testcvs} -q update" \
8181"${QUESTION} aa\.c
8182${QUESTION} same\.c
8183${PROG} update: move away \./aa\.c; it is in the way
8184C aa\.c
8185${PROG} update: move away \./same\.c; it is in the way
8186C same\.c"
8187	  else
8188	    dotest_fail conflicts2-142d2 "${testcvs} -q update" \
8189"${PROG} [a-z]*: move away aa\.c; it is in the way
8190C aa\.c
8191U same\.c"
8192	  fi
8193	  dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
8194"${PROG} [a-z]*: move away aa\.c; it is in the way
8195===================================================================
8196File: aa\.c             	Status: Unresolved Conflict
8197
8198   Working revision:	No entry for aa\.c
8199   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/aa\.c,v"
8200
8201	  # Could also be testing the case in which the cvs add happened
8202	  # before the commit by the other user.
8203	  # This message seems somewhat bogus.  I mean, parallel development
8204	  # means that we get to work in parallel if we choose, right?  And
8205	  # then at commit time it would be a conflict.
8206	  dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
8207"${PROG} [a-z]*: aa.c added independently by second party"
8208
8209	  # The user might want to see just what the conflict is.
8210	  # Don't bother, diff seems to kind of lose its mind, with or
8211	  # without -N.  This is a CVS bug(s).
8212	  #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
8213
8214	  # Now: "how can the user resolve this conflict", I hear you cry.
8215	  # Well, one way is to forget about the file in the working
8216	  # directory.
8217	  # Since it didn't let us do the add in conflicts2-142d4, there
8218	  # is no need to run cvs rm here.
8219	  #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
8220	  dotest conflicts2-142d6 "rm aa.c" ''
8221	  dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
8222	  dotest conflicts2-142d8 "cat aa.c" ''
8223
8224	  # The other way is to use the version from the working directory
8225	  # instead of the version from the repository.  Unfortunately,
8226	  # there doesn't seem to be any particularly clear way to do
8227	  # this (?).
8228
8229	  cd ../..
8230
8231	  rm -r 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
8232	  ;;
8233
8234	conflicts3)
8235	  # More tests of conflicts and/or multiple working directories
8236	  # in general.
8237
8238	  mkdir 1; cd 1
8239	  dotest conflicts3-1 "${testcvs} -q co -l ." ''
8240	  mkdir first-dir
8241	  dotest conflicts3-2 "${testcvs} add first-dir" \
8242"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
8243	  cd ..
8244	  mkdir 2; cd 2
8245	  dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
8246	  cd ../1/first-dir
8247	  touch file1 file2
8248	  dotest conflicts3-4 "${testcvs} add file1 file2" \
8249"${PROG} [a-z]*: scheduling file .file1. for addition
8250${PROG} [a-z]*: scheduling file .file2. for addition
8251${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
8252	  dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
8253"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8254done
8255Checking in file1;
8256${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8257initial revision: 1\.1
8258done
8259RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8260done
8261Checking in file2;
8262${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8263initial revision: 1\.1
8264done"
8265	  cd ../../2/first-dir
8266	  # Check that -n doesn't make CVS lose its mind as it creates
8267	  # (or rather, doesn't) a new file.
8268	  dotest conflicts3-6 "${testcvs} -nq update" \
8269"U file1
8270U file2"
8271	  dotest_fail conflicts3-7 "test -f file1" ''
8272	  dotest conflicts3-8 "${testcvs} -q update" \
8273"U file1
8274U file2"
8275	  dotest conflicts3-9 "test -f file2" ''
8276
8277	  # OK, now remove two files at once
8278	  dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
8279"${PROG} [a-z]*: scheduling .file1. for removal
8280${PROG} [a-z]*: scheduling .file2. for removal
8281${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
8282	  dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
8283"Removing file1;
8284${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8285new revision: delete; previous revision: 1\.1
8286done
8287Removing file2;
8288${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8289new revision: delete; previous revision: 1\.1
8290done"
8291	  cd ../../1/first-dir
8292	  dotest conflicts3-12 "${testcvs} -n -q update" \
8293"${PROG} [a-z]*: file1 is no longer in the repository
8294${PROG} [a-z]*: file2 is no longer in the repository"
8295	  dotest conflicts3-13 "${testcvs} -q update" \
8296"${PROG} [a-z]*: file1 is no longer in the repository
8297${PROG} [a-z]*: file2 is no longer in the repository"
8298
8299	  # OK, now add a directory to both working directories
8300	  # and see that CVS doesn't lose its mind.
8301	  mkdir sdir
8302	  dotest conflicts3-14 "${testcvs} add sdir" \
8303"Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
8304	  touch sdir/sfile
8305	  dotest conflicts3-14a "${testcvs} add sdir/sfile" \
8306"${PROG} [a-z]*: scheduling file .sdir/sfile. for addition
8307${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8308	  dotest conflicts3-14b "${testcvs} -q ci -m add" \
8309"RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v
8310done
8311Checking in sdir/sfile;
8312${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
8313initial revision: 1\.1
8314done"
8315
8316	  cd ../../2/first-dir
8317
8318	  # Create a CVS directory without the proper administrative
8319	  # files in it.  This can happen for example if you hit ^C
8320	  # in the middle of a checkout.
8321	  mkdir sdir
8322	  mkdir sdir/CVS
8323	  # OK, in the local case CVS sees that the directory exists
8324	  # in the repository and recurses into it.  In the remote case
8325	  # CVS can't see the repository and has no way of knowing
8326	  # that sdir is even a directory (stat'ing everything would be
8327	  # too slow).  The remote behavior makes more sense to me (but
8328	  # would this affect other cases?).
8329	  if $remote; then
8330	    dotest conflicts3-15 "${testcvs} -q update" \
8331"${QUESTION} sdir"
8332	  else
8333	    dotest conflicts3-15 "${testcvs} -q update" \
8334"${QUESTION} sdir
8335${PROG} [a-z]*: ignoring sdir (CVS/Repository missing)"
8336	    touch sdir/CVS/Repository
8337	    dotest conflicts3-16 "${testcvs} -q update" \
8338"${QUESTION} sdir
8339${PROG} [a-z]*: ignoring sdir (CVS/Entries missing)"
8340	    cd ..
8341	    dotest conflicts3-16a "${testcvs} -q update first-dir" \
8342"${QUESTION} first-dir/sdir
8343${PROG} [a-z]*: ignoring first-dir/sdir (CVS/Entries missing)"
8344	    cd first-dir
8345	  fi
8346	  rm -r sdir
8347
8348	  # OK, now the same thing, but the directory doesn't exist
8349	  # in the repository.
8350	  mkdir newdir
8351	  mkdir newdir/CVS
8352	  dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
8353	  echo "D/newdir////" >> CVS/Entries
8354	  dotest conflicts3-18 "${testcvs} -q update" \
8355"${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
8356	  touch newdir/CVS/Repository
8357	  dotest conflicts3-19 "${testcvs} -q update" \
8358"${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
8359	  cd ..
8360	  dotest conflicts3-20 "${testcvs} -q update first-dir" \
8361"${PROG} [a-z]*: ignoring first-dir/newdir (CVS/Entries missing)"
8362	  cd first-dir
8363	  rm -r newdir
8364
8365	  # The previous tests have left CVS/Entries in something of a mess.
8366	  # While we "should" be able to deal with that (maybe), for now
8367	  # we just start over.
8368	  cd ..
8369	  rm -r first-dir
8370	  dotest conflicts3-20a "${testcvs} -q co -l first-dir" ''
8371	  cd first-dir
8372
8373	  dotest conflicts3-21 "${testcvs} -q update -d sdir" "U sdir/sfile"
8374	  rm -r sdir/CVS
8375	  dotest conflicts3-22 "${testcvs} -q update" "${QUESTION} sdir"
8376	  if $remote; then
8377	    dotest_fail conflicts3-23 "${testcvs} -q update -PdA" \
8378"${QUESTION} sdir
8379${PROG} update: move away sdir/sfile; it is in the way
8380C sdir/sfile"
8381	  else
8382	    dotest conflicts3-23 "${testcvs} -q update -PdA" \
8383"${QUESTION} sdir"
8384	  fi
8385
8386	  # Not that it should really affect much, but let's do the case
8387	  # where sfile has been removed.  For example, suppose that sdir
8388	  # had been a CVS-controlled directory which was then removed
8389	  # by removing each file (and using update -P or some such).  Then
8390	  # suppose that the build process creates an sdir directory which
8391	  # is not supposed to be under CVS.
8392	  rm -r sdir
8393	  dotest conflicts3-24 "${testcvs} -q update -d sdir" "U sdir/sfile"
8394	  rm sdir/sfile
8395	  dotest conflicts3-25 "${testcvs} rm sdir/sfile" \
8396"${PROG} [a-z]*: scheduling .sdir/sfile. for removal
8397${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8398	  dotest conflicts3-26 "${testcvs} ci -m remove sdir/sfile" \
8399"Removing sdir/sfile;
8400${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v  <--  sfile
8401new revision: delete; previous revision: 1\.1
8402done"
8403	  rm -r sdir/CVS
8404	  dotest conflicts3-27 "${testcvs} -q update" "${QUESTION} sdir"
8405	  dotest conflicts3-28 "${testcvs} -q update -PdA" \
8406"${QUESTION} sdir"
8407
8408	  cd ../..
8409
8410	  rm -r 1 2
8411	  rm -rf ${CVSROOT_DIRNAME}/first-dir
8412	  ;;
8413
8414	clean)
8415	  # Test update -C (overwrite local mods w/ repository copies)
8416	  mkdir 1; cd 1
8417	  dotest clean-1 "${testcvs} -q co -l ." ''
8418	  mkdir first-dir
8419	  dotest clean-2 "${testcvs} add first-dir" \
8420"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
8421	  cd first-dir
8422	  echo "The usual boring test text." > cleanme.txt
8423          dotest clean-3 "${testcvs} add cleanme.txt" \
8424"${PROG} [a-z]*: scheduling file .cleanme\.txt. for addition
8425${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8426	  dotest clean-4 "${testcvs} -q ci -m clean-3" \
8427"RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
8428done
8429Checking in cleanme\.txt;
8430${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
8431initial revision: 1\.1
8432done"
8433          # Okay, preparation is done, now test.
8434          # Check that updating an unmodified copy works.
8435	  dotest clean-5 "${testcvs} -q update" ''
8436          # Check that updating -C an unmodified copy works.
8437	  dotest clean-6 "${testcvs} -q update -C" ''
8438          # Check that updating a modified copy works.
8439	  echo "fish" >> cleanme.txt
8440	  dotest clean-7 "${testcvs} -q update" 'M cleanme\.txt'
8441          # Check that updating -C a modified copy works.
8442	  dotest clean-8 "${testcvs} -q update -C" \
8443"(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
8444U cleanme\.txt"
8445	  # And check that the backup copy really was made.
8446	  dotest clean-9 "cat .#cleanme.txt.1.1" \
8447"The usual boring test text\.
8448fish"
8449
8450          # Do it all again, this time naming the file explicitly.
8451	  rm .#cleanme.txt.1.1
8452	  dotest clean-10 "${testcvs} -q update cleanme.txt" ''
8453	  dotest clean-11 "${testcvs} -q update -C cleanme.txt" ''
8454	  echo "bluegill" >> cleanme.txt
8455	  dotest clean-12 "${testcvs} -q update cleanme.txt" 'M cleanme\.txt'
8456	  dotest clean-13 "${testcvs} -q update -C cleanme.txt" \
8457"(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
8458U cleanme\.txt"
8459	  # And check that the backup copy really was made.
8460	  dotest clean-14 "cat .#cleanme.txt.1.1" \
8461"The usual boring test text\.
8462bluegill"
8463
8464	  # Now try with conflicts
8465	  cd ..
8466	  dotest clean-15 "${testcvs} -q co -d second-dir first-dir" \
8467'U second-dir/cleanme\.txt'
8468	  cd second-dir
8469	  echo "conflict test" >> cleanme.txt
8470	  dotest clean-16 "${testcvs} -q ci -m." \
8471"Checking in cleanme\.txt;
8472${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v  <--  cleanme\.txt
8473new revision: 1\.2; previous revision: 1\.1
8474done"
8475	  cd ../first-dir
8476	  echo "fish" >> cleanme.txt
8477	  dotest clean-17 "${testcvs} -nq update" \
8478"RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
8479retrieving revision 1\.1
8480retrieving revision 1\.2
8481Merging differences between 1\.1 and 1\.2 into cleanme\.txt
8482rcsmerge: warning: conflicts during merge
8483${PROG} [a-z]*: conflicts found in cleanme\.txt
8484C cleanme\.txt"
8485	  dotest clean-18 "${testcvs} -q update -C" \
8486"(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
8487U cleanme\.txt"
8488	  dotest clean-19 "cat .#cleanme.txt.1.1" \
8489"The usual boring test text\.
8490fish"
8491
8492          # Done.  Clean up.
8493	  cd ../..
8494          rm -rf 1
8495	  rm -rf ${CVSROOT_DIRNAME}/first-dir
8496	  ;;
8497
8498	modules)
8499	  # Tests of various ways to define and use modules.
8500	  # Roadmap to various modules tests:
8501	  # -a:
8502	  #   error on incorrect placement: modules
8503	  #   error combining with other options: modules2-a*
8504	  #   use to specify a file more than once: modules3
8505	  #   use with ! feature: modules4
8506	  # regular modules: modules, modules2, cvsadm
8507	  # ampersand modules: modules2
8508	  # -s: modules.
8509	  # -d: modules, modules3, cvsadm
8510	  # -i, -o, -u, -e, -t: modules5
8511	  # slashes in module names: modules3
8512
8513	  ############################################################
8514	  # These tests are to make sure that administrative files get
8515	  # rebuilt, regardless of how and where files are checked
8516	  # out.
8517	  ############################################################
8518	  # Check out the whole repository
8519	  mkdir 1; cd 1
8520	  dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
8521U CVSROOT/commitinfo
8522U CVSROOT/config
8523U CVSROOT/cvswrappers
8524U CVSROOT/editinfo
8525U CVSROOT/loginfo
8526U CVSROOT/modules
8527U CVSROOT/notify
8528U CVSROOT/rcsinfo
8529U CVSROOT/taginfo
8530U CVSROOT/verifymsg'
8531	  echo "# made a change" >>CVSROOT/modules
8532	  dotest modules-1d "${testcvs} -q ci -m add-modules" \
8533"Checking in CVSROOT/modules;
8534${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
8535new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
8536done
8537${PROG} [a-z]*: Rebuilding administrative file database"
8538	  cd ..
8539	  rm -rf 1
8540
8541	  ############################################################
8542	  # Check out CVSROOT
8543	  mkdir 1; cd 1
8544	  dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
8545U CVSROOT/commitinfo
8546U CVSROOT/config
8547U CVSROOT/cvswrappers
8548U CVSROOT/editinfo
8549U CVSROOT/loginfo
8550U CVSROOT/modules
8551U CVSROOT/notify
8552U CVSROOT/rcsinfo
8553U CVSROOT/taginfo
8554U CVSROOT/verifymsg'
8555	  echo "# made a change" >>CVSROOT/modules
8556	  dotest modules-2d "${testcvs} -q ci -m add-modules" \
8557"Checking in CVSROOT/modules;
8558${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
8559new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
8560done
8561${PROG} [a-z]*: Rebuilding administrative file database"
8562	  cd ..
8563	  rm -rf 1
8564
8565	  ############################################################
8566	  # Check out CVSROOT in some other directory
8567	  mkdir ${CVSROOT_DIRNAME}/somedir
8568	  mkdir 1; cd 1
8569	  dotest modules-3 "${testcvs} -q co somedir" ''
8570	  cd somedir
8571	  dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
8572U CVSROOT/commitinfo
8573U CVSROOT/config
8574U CVSROOT/cvswrappers
8575U CVSROOT/editinfo
8576U CVSROOT/loginfo
8577U CVSROOT/modules
8578U CVSROOT/notify
8579U CVSROOT/rcsinfo
8580U CVSROOT/taginfo
8581U CVSROOT/verifymsg'
8582	  echo "# made a change" >>CVSROOT/modules
8583	  dotest modules-3g "${testcvs} -q ci -m add-modules" \
8584"Checking in CVSROOT/modules;
8585${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
8586new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
8587done
8588${PROG} [a-z]*: Rebuilding administrative file database"
8589	  cd ../..
8590	  rm -rf 1
8591	  rm -rf ${CVSROOT_DIRNAME}/somedir
8592	  ############################################################
8593	  # end rebuild tests
8594	  ############################################################
8595
8596
8597	  mkdir ${CVSROOT_DIRNAME}/first-dir
8598
8599	  mkdir 1
8600	  cd 1
8601
8602	  dotest modules-143 "${testcvs} -q co first-dir" ""
8603
8604	  cd first-dir
8605	  mkdir subdir
8606	  dotest modules-143a "${testcvs} add subdir" \
8607"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
8608
8609	  cd subdir
8610	  mkdir ssdir
8611	  dotest modules-143b "${testcvs} add ssdir" \
8612"Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
8613
8614	  touch a b
8615
8616	  dotest modules-144 "${testcvs} add a b" \
8617"${PROG} [a-z]*: scheduling file .a. for addition
8618${PROG} [a-z]*: scheduling file .b. for addition
8619${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
8620
8621	  dotest modules-145 "${testcvs} ci -m added" \
8622"${PROG} [a-z]*: Examining .
8623${PROG} [a-z]*: Examining ssdir
8624RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
8625done
8626Checking in a;
8627${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
8628initial revision: 1\.1
8629done
8630RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
8631done
8632Checking in b;
8633${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
8634initial revision: 1\.1
8635done"
8636
8637	  cd ..
8638	  dotest modules-146 "${testcvs} -q co CVSROOT" \
8639"U CVSROOT/checkoutlist
8640U CVSROOT/commitinfo
8641U CVSROOT/config
8642U CVSROOT/cvswrappers
8643U CVSROOT/editinfo
8644U CVSROOT/loginfo
8645U CVSROOT/modules
8646U CVSROOT/notify
8647U CVSROOT/rcsinfo
8648U CVSROOT/taginfo
8649U CVSROOT/verifymsg"
8650
8651	  # Here we test that CVS can deal with CVSROOT (whose repository
8652	  # is at top level) in the same directory as subdir (whose repository
8653	  # is a subdirectory of first-dir).  TODO: Might want to check that
8654	  # files can actually get updated in this state.
8655	  dotest modules-147 "${testcvs} -q update" ""
8656
8657	  cat >CVSROOT/modules <<EOF
8658realmodule first-dir/subdir a
8659dirmodule first-dir/subdir
8660namedmodule -d nameddir first-dir/subdir
8661aliasmodule -a first-dir/subdir/a
8662aliasnested -a first-dir/subdir/ssdir
8663topfiles -a first-dir/file1 first-dir/file2
8664world -a .
8665statusmod -s Mungeable
8666# Options must come before arguments.  It is possible this should
8667# be relaxed at some point (though the result would be bizarre for
8668# -a); for now test the current behavior.
8669bogusalias first-dir/subdir/a -a
8670EOF
8671	  dotest modules-148 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
8672"Checking in CVSROOT/modules;
8673${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
8674new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
8675done
8676${PROG} [a-z]*: Rebuilding administrative file database"
8677
8678	  cd ..
8679	  # The "statusmod" module contains an error; trying to use it
8680	  # will produce "modules file missing directory" I think.
8681	  # However, that shouldn't affect the ability of "cvs co -c" or
8682	  # "cvs co -s" to do something reasonable with it.
8683	  dotest modules-148a0 "${testcvs} co -c" 'aliasmodule  -a first-dir/subdir/a
8684aliasnested  -a first-dir/subdir/ssdir
8685bogusalias   first-dir/subdir/a -a
8686dirmodule    first-dir/subdir
8687namedmodule  -d nameddir first-dir/subdir
8688realmodule   first-dir/subdir a
8689statusmod    -s Mungeable
8690topfiles     -a first-dir/file1 first-dir/file2
8691world        -a \.'
8692	  # There is code in modules.c:save_d which explicitly skips
8693	  # modules defined with -a, which is why aliasmodule is not
8694	  # listed.
8695	  dotest modules-148a1 "${testcvs} co -s" \
8696'statusmod    Mungeable
8697bogusalias   NONE        first-dir/subdir/a -a
8698dirmodule    NONE        first-dir/subdir
8699namedmodule  NONE        first-dir/subdir
8700realmodule   NONE        first-dir/subdir a'
8701
8702	  # Test that real modules check out to realmodule/a, not subdir/a.
8703	  dotest modules-149a1 "${testcvs} co realmodule" "U realmodule/a"
8704	  dotest modules-149a2 "test -d realmodule && test -f realmodule/a" ""
8705	  dotest_fail modules-149a3 "test -f realmodule/b" ""
8706	  dotest modules-149a4 "${testcvs} -q co realmodule" ""
8707	  dotest modules-149a5 "echo yes | ${testcvs} release -d realmodule" \
8708"You have \[0\] altered files in this repository\.
8709Are you sure you want to release (and delete) directory .realmodule.: "
8710
8711	  dotest_fail modules-149b1 "${testcvs} co realmodule/a" \
8712"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
8713"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory
8714'"${PROG}"' \[[a-z]* aborted\]: cannot expand modules'
8715
8716	  # Now test the ability to check out a single file from a directory
8717	  dotest modules-150c "${testcvs} co dirmodule/a" "U dirmodule/a"
8718	  dotest modules-150d "test -d dirmodule && test -f dirmodule/a" ""
8719	  dotest_fail modules-150e "test -f dirmodule/b" ""
8720	  dotest modules-150f "echo yes | ${testcvs} release -d dirmodule" \
8721"You have \[0\] altered files in this repository\.
8722Are you sure you want to release (and delete) directory .dirmodule.: "
8723	  # Now test the ability to correctly reject a non-existent filename.
8724	  # For maximum studliness we would check that an error message is
8725	  # being output.
8726	  # We accept a zero exit status because it is what CVS does
8727	  # (Dec 95).  Probably the exit status should be nonzero,
8728	  # however.
8729	  dotest modules-150g1 "${testcvs} co dirmodule/nonexist" \
8730"${PROG} [a-z]*: warning: new-born dirmodule/nonexist has disappeared"
8731	  # We tolerate the creation of the dirmodule directory, since that
8732	  # is what CVS does, not because we view that as preferable to not
8733	  # creating it.
8734	  dotest_fail modules-150g2 "test -f dirmodule/a || test -f dirmodule/b" ""
8735	  rm -r dirmodule
8736
8737	  # Now test that a module using -d checks out to the specified
8738	  # directory.
8739	  dotest modules-150h1 "${testcvs} -q co namedmodule" \
8740'U nameddir/a
8741U nameddir/b'
8742	  dotest modules-150h2 "test -f nameddir/a && test -f nameddir/b" ""
8743	  echo add line >>nameddir/a
8744	  dotest modules-150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
8745	  rm nameddir/a
8746	  dotest modules-150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
8747	  dotest modules-150h99 "echo yes | ${testcvs} release -d nameddir" \
8748"You have \[0\] altered files in this repository\.
8749Are you sure you want to release (and delete) directory .nameddir.: "
8750
8751	  # Now test that alias modules check out to subdir/a, not
8752	  # aliasmodule/a.
8753	  dotest modules-151 "${testcvs} co aliasmodule" ""
8754	  dotest_fail modules-152 "test -d aliasmodule" ""
8755	  echo abc >>first-dir/subdir/a
8756	  dotest modules-153 "${testcvs} -q co aliasmodule" "M first-dir/subdir/a"
8757
8758	  cd ..
8759	  rm -r 1
8760
8761	  mkdir 2
8762	  cd 2
8763	  dotest modules-155a0 "${testcvs} co aliasnested" \
8764"${PROG} [a-z]*: Updating first-dir/subdir/ssdir"
8765	  dotest modules-155a1 "test -d first-dir" ''
8766	  dotest modules-155a2 "test -d first-dir/subdir" ''
8767	  dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
8768	  # Test that nothing extraneous got created.
8769	  dotest modules-155a4 "ls" "first-dir" \
8770"CVS
8771first-dir"
8772	  cd ..
8773	  rm -r 2
8774
8775	  # Test checking out everything.
8776	  mkdir 1
8777	  cd 1
8778	  dotest modules-155b "${testcvs} -q co world" \
8779"U CVSROOT/${DOTSTAR}
8780U first-dir/subdir/a
8781U first-dir/subdir/b"
8782	  cd ..
8783	  rm -r 1
8784
8785	  # Test checking out a module which lists at least two
8786	  # specific files twice.  At one time, this failed over
8787	  # remote CVS.
8788	  mkdir 1
8789	  cd 1
8790	  dotest modules-155c1 "${testcvs} -q co first-dir" \
8791"U first-dir/subdir/a
8792U first-dir/subdir/b"
8793
8794	  cd first-dir
8795	  echo 'first revision' > file1
8796	  echo 'first revision' > file2
8797	  dotest modules-155c2 "${testcvs} add file1 file2" \
8798"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
8799'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
8800'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
8801	  dotest modules-155c3 "${testcvs} -q ci -m add-it" \
8802"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
8803done
8804Checking in file1;
8805${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8806initial revision: 1\.1
8807done
8808RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
8809done
8810Checking in file2;
8811${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
8812initial revision: 1\.1
8813done"
8814
8815	  cd ..
8816	  rm -r first-dir
8817	  dotest modules-155c4 "${testcvs} -q co topfiles" \
8818"U first-dir/file1
8819U first-dir/file2"
8820	  dotest modules-155c5 "${testcvs} -q co topfiles" ""
8821
8822	  # Make sure the right thing happens if we remove a file.
8823	  cd first-dir
8824	  dotest modules-155c6 "${testcvs} -q rm -f file1" \
8825"${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
8826	  dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
8827"Removing file1;
8828${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
8829new revision: delete; previous revision: 1\.1
8830done"
8831	  cd ..
8832	  rm -r first-dir
8833	  dotest modules-155c8 "${testcvs} -q co topfiles" \
8834"${PROG} [a-z]*: warning: first-dir/file1 is not (any longer) pertinent
8835U first-dir/file2"
8836
8837	  cd ..
8838	  rm -r 1
8839
8840	  rm -rf ${CVSROOT_DIRNAME}/first-dir
8841	  ;;
8842
8843	modules2)
8844	  # More tests of modules, in particular the & feature.
8845	  mkdir 1; cd 1
8846	  dotest modules2-setup-1 "${testcvs} -q co -l ." ''
8847	  mkdir first-dir second-dir third-dir
8848	  dotest modules2-setup-2 \
8849"${testcvs} add first-dir second-dir third-dir" \
8850"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
8851Directory ${CVSROOT_DIRNAME}/second-dir added to the repository
8852Directory ${CVSROOT_DIRNAME}/third-dir added to the repository"
8853	  cd third-dir
8854	  touch file3
8855	  dotest modules2-setup-3 "${testcvs} add file3" \
8856"${PROG} [a-z]*: scheduling file .file3. for addition
8857${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8858	  dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
8859"RCS file: ${CVSROOT_DIRNAME}/third-dir/file3,v
8860done
8861Checking in file3;
8862${CVSROOT_DIRNAME}/third-dir/file3,v  <--  file3
8863initial revision: 1\.1
8864done"
8865	  cd ../..
8866	  rm -r 1
8867
8868	  mkdir 1
8869	  cd 1
8870
8871	  dotest modules2-1 "${testcvs} -q co CVSROOT/modules" \
8872'U CVSROOT/modules'
8873	  cd CVSROOT
8874	  cat >> modules << EOF
8875ampermodule &first-dir &second-dir
8876combmodule third-dir file3 &first-dir
8877ampdirmod -d newdir &first-dir &second-dir
8878badmod -d newdir
8879messymod first-dir &messymodchild
8880messymodchild -d sdir/child second-dir
8881EOF
8882	  # Depending on whether the user also ran the modules test
8883	  # we will be checking in revision 1.2 or 1.3.
8884	  dotest modules2-2 "${testcvs} -q ci -m add-modules" \
8885"Checking in modules;
8886${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
8887new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
8888done
8889${PROG} [a-z]*: Rebuilding administrative file database"
8890
8891	  cd ..
8892
8893	  dotest modules2-3 "${testcvs} -q co ampermodule" ''
8894	  dotest modules2-4 "test -d ampermodule/first-dir" ''
8895	  dotest modules2-5 "test -d ampermodule/second-dir" ''
8896
8897	  # Test ability of cvs release to handle multiple arguments
8898	  # See comment at "release" for list of other cvs release tests.
8899	  cd ampermodule
8900	  if ${testcvs} release -d first-dir second-dir <<EOF >>${LOGFILE}
8901yes
8902yes
8903EOF
8904	  then
8905	    pass modules2-6
8906	  else
8907	    fail modules2-6
8908	  fi
8909	  dotest_fail modules2-7 "test -d first-dir" ''
8910	  dotest_fail modules2-8 "test -d second-dir" ''
8911
8912	  cd ..
8913
8914	  # There used to be a nasty-hack that made CVS skip creation of the
8915	  # module dir (in this case ampermodule) when -n was specified
8916	  dotest modules2-ampermod-1 "${testcvs} -q co -n ampermodule" ''
8917	  dotest modules2-ampermod-2 "test -d ampermodule/first-dir" ''
8918	  dotest modules2-ampermod-3 "test -d ampermodule/second-dir" ''
8919
8920	  # Test release of a module
8921	  if echo yes |${testcvs} release -d ampermodule >>${LOGFILE}; then
8922	    pass modules2-ampermod-release-1
8923	  else
8924	    fail modules2-ampermod-release-1
8925	  fi
8926	  dotest_fail modules2-ampermod-release-2 "test -d ampermodule" ''
8927
8928	  # and the '-n' test again, but in conjunction with '-d'
8929	  dotest modules2-ampermod-4 "${testcvs} -q co -n -d newname ampermodule" ''
8930	  dotest modules2-ampermod-5 "test -d newname/first-dir" ''
8931	  dotest modules2-ampermod-6 "test -d newname/second-dir" ''
8932	  rm -rf newname
8933
8934	  # Now we create another directory named first-dir and make
8935	  # sure that CVS doesn't get them mixed up.
8936	  mkdir first-dir
8937	  # Note that this message should say "Updating ampermodule/first-dir"
8938	  # I suspect.  This is a long-standing behavior/bug....
8939	  dotest modules2-9 "${testcvs} co ampermodule" \
8940"${PROG} [a-z]*: Updating first-dir
8941${PROG} [a-z]*: Updating second-dir"
8942	  touch ampermodule/first-dir/amper1
8943	  cd ampermodule
8944	  dotest modules2-10 "${testcvs} add first-dir/amper1" \
8945"${PROG} [a-z]*: scheduling file .first-dir/amper1. for addition
8946${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
8947	  cd ..
8948
8949	  # As with the "Updating xxx" message, the "U first-dir/amper1"
8950	  # message (instead of "U ampermodule/first-dir/amper1") is
8951	  # rather fishy.
8952	  dotest modules2-12 "${testcvs} co ampermodule" \
8953"${PROG} [a-z]*: Updating first-dir
8954A first-dir/amper1
8955${PROG} [a-z]*: Updating second-dir"
8956
8957	  if $remote; then
8958	    dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
8959"RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
8960done
8961Checking in ampermodule/first-dir/amper1;
8962${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
8963initial revision: 1\.1
8964done"
8965	  else
8966	    # Trying this as above led to a "protocol error" message.
8967	    # Work around this bug.
8968	    cd ampermodule
8969	    dotest modules2-13 "${testcvs} -q ci -m add-it" \
8970"RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
8971done
8972Checking in first-dir/amper1;
8973${CVSROOT_DIRNAME}/first-dir/amper1,v  <--  amper1
8974initial revision: 1\.1
8975done"
8976	    cd ..
8977	  fi
8978	  cd ..
8979	  rm -r 1
8980
8981	  # Now test the "combmodule" module (combining regular modules
8982	  # and ampersand modules in the same module definition).
8983	  mkdir 1; cd 1
8984	  dotest modules2-14 "${testcvs} co combmodule" \
8985"U combmodule/file3
8986${PROG} [a-z]*: Updating first-dir
8987U first-dir/amper1"
8988	  dotest modules2-15 "test -f combmodule/file3" ""
8989	  dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
8990	  cd combmodule
8991	  rm -r first-dir
8992	  # At least for now there is no way to tell CVS that
8993	  # some files/subdirectories come from one repository directory,
8994	  # and others from another.
8995	  # This seems like a pretty sensible behavior to me, in the
8996	  # sense that first-dir doesn't "really" exist within
8997	  # third-dir, so CVS just acts as if there is nothing there
8998	  # to do.
8999	  dotest modules2-17 "${testcvs} update -d" \
9000"${PROG} [a-z]*: Updating \."
9001
9002	  cd ..
9003	  dotest modules2-18 "${testcvs} -q co combmodule" \
9004"U first-dir/amper1"
9005	  dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
9006	  cd ..
9007	  rm -r 1
9008
9009	  # Now test the "ampdirmod" and "badmod" modules to be sure that
9010	  # options work with ampersand modules but don't prevent the
9011	  # "missing directory" error message.
9012	  mkdir 1; cd 1
9013	  dotest modules2-20 "${testcvs} co ampdirmod" \
9014"${PROG} [a-z]*: Updating first-dir
9015U first-dir/amper1
9016${PROG} [a-z]*: Updating second-dir"
9017	  dotest modules2-21 "test -f newdir/first-dir/amper1" ""
9018	  dotest modules2-22 "test -d newdir/second-dir" ""
9019	  dotest_fail modules2-23 "${testcvs} co badmod" \
9020"${PROG} [a-z]*: modules file missing directory for module badmod" \
9021"${PROG} [a-z]*: modules file missing directory for module badmod
9022${PROG} \[[a-z]* aborted\]: cannot expand modules"
9023	  cd ..
9024	  rm -r 1
9025
9026	  # Confirm that a rename with added depth nested in an ampersand
9027	  # module works.
9028	  mkdir 1; cd 1
9029	  dotest modules2-nestedrename-1 "${testcvs} -q co messymod" \
9030"U messymod/amper1"
9031	  dotest modules2-nestedrename-2 "test -d messymod/sdir" ''
9032	  dotest modules2-nestedrename-3 "test -d messymod/sdir/CVS" ''
9033	  dotest modules2-nestedrename-4 "test -d messymod/sdir/child" ''
9034	  dotest modules2-nestedrename-5 "test -d messymod/sdir/child/CVS" ''
9035	  cd ..; rm -r 1
9036
9037	  # FIXME:  client/server has a bug.  It should be working like a local
9038	  # repository in this case, but fails to check out the second module
9039	  # in the list when a branch is specified.
9040	  mkdir 1; cd 1
9041	  dotest modules2-ampertag-setup-1 \
9042"${testcvs} -Q rtag tag first-dir second-dir third-dir" \
9043''
9044	  dotest modules2-ampertag-1 "${testcvs} -q co -rtag ampermodule" \
9045"U first-dir/amper1"
9046	  if $remote; then
9047	    dotest_fail modules2-ampertag-2 "test -d ampermodule/second-dir" ''
9048	    dotest_fail modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
9049	  else
9050	    dotest modules2-ampertag-2 "test -d ampermodule/second-dir" ''
9051	    dotest modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
9052	  fi
9053	  cd ..; rm -r 1
9054
9055	  # Test for tag files when an ampermod is renamed with more path
9056	  # elements than it started with.
9057	  #
9058	  # FIXME: This is currently broken in the remote case, possibly only
9059	  # because the messymodchild isn't being checked out at all.
9060	  mkdir 1; cd 1
9061#	  dotest modules2-tagfiles-setup-1 \
9062#"${testcvs} -Q rtag -b branch first-dir second-dir" \
9063#''
9064	  dotest modules2-tagfiles-1 "${testcvs} -q co -rtag messymod" \
9065"U messymod/amper1"
9066	  if $remote; then
9067	    dotest_fail modules2-tagfiles-2r "test -d messymod/sdir" ''
9068	  else
9069	    dotest modules2-tagfiles-2 "cat messymod/sdir/CVS/Tag" 'Ttag'
9070	  fi
9071	  cd ..; rm -r 1
9072
9073	  # Test that CVS gives an error if one combines -a with
9074	  # other options.
9075	  # Probably would be better to break this out into a separate
9076	  # test.  Although it is short, it shares no files/state with
9077	  # the rest of the modules2 tests.
9078	  mkdir 1; cd 1
9079	  dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
9080'U CVSROOT/modules'
9081	  cd CVSROOT
9082	  echo 'aliasopt -a -d onedir first-dir' >modules
9083	  dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
9084"Checking in modules;
9085${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
9086new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9087done
9088${PROG} [a-z]*: Rebuilding administrative file database"
9089	  cd ..
9090	  dotest_fail modules2-a1 "${testcvs} -q co aliasopt" \
9091"${PROG} [a-z]*: -a cannot be specified in the modules file along with other options" \
9092"${PROG} [a-z]*: -a cannot be specified in the modules file along with other options
9093${PROG} \[[a-z]* aborted\]: cannot expand modules"
9094	  cd ..;  rm -r 1
9095
9096	  # Clean up.
9097	  rm -rf ${CVSROOT_DIRNAME}/first-dir
9098	  rm -rf ${CVSROOT_DIRNAME}/second-dir
9099	  rm -rf ${CVSROOT_DIRNAME}/third-dir
9100	  ;;
9101
9102	modules3)
9103	  # More tests of modules, in particular what happens if several
9104	  # modules point to the same file.
9105
9106	  # First just set up a directory first-dir and a file file1 in it.
9107	  mkdir 1; cd 1
9108
9109	  dotest modules3-0 "${testcvs} -q co -l ." ''
9110	  mkdir first-dir
9111	  dotest modules3-1 "${testcvs} add first-dir" \
9112"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
9113
9114	  cd first-dir
9115	  echo file1 >file1
9116	  dotest modules3-2 "${testcvs} add file1" \
9117"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
9118'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
9119	  dotest modules3-3 "${testcvs} -q ci -m add-it" \
9120"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9121done
9122Checking in file1;
9123${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9124initial revision: 1\.1
9125done"
9126	  cd ..
9127
9128	  dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
9129"U CVSROOT${DOTSTAR}"
9130	  cd CVSROOT
9131	  cat >modules <<EOF
9132mod1 -a first-dir/file1
9133bigmod -a mod1 first-dir/file1
9134namednest -d src/sub/dir first-dir
9135nestdeeper -d src/sub1/sub2/sub3/dir first-dir
9136nestshallow -d src/dir second-dir/suba/subb
9137path/in/modules &mod1
9138another/path/test -d another/path/test first-dir
9139EOF
9140	  dotest modules3-5 "${testcvs} -q ci -m add-modules" \
9141"Checking in modules;
9142${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
9143new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9144done
9145${PROG} [a-z]*: Rebuilding administrative file database"
9146	  cd ..
9147
9148	  dotest modules3-6 "${testcvs} -q co bigmod" ''
9149	  rm -r first-dir
9150	  dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
9151	  cd ..
9152	  rm -r 1
9153
9154	  mkdir 1; cd 1
9155	  mkdir suba
9156	  mkdir suba/subb
9157	  # This fails to work remote (it doesn't notice the directories,
9158	  # I suppose because they contain no files).  Bummer, especially
9159	  # considering this is a documented technique and everything.
9160	  dotest modules3-7a \
9161"${testcvs} import -m add-dirs second-dir tag1 tag2" \
9162"${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/second-dir/suba
9163${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/second-dir/suba/subb
9164
9165No conflicts created by this import" "
9166No conflicts created by this import"
9167	  cd ..; rm -r 1
9168	  mkdir 1; cd 1
9169	  dotest modules3-7b "${testcvs} co second-dir" \
9170"${PROG} [a-z]*: Updating second-dir
9171${PROG} [a-z]*: Updating second-dir/suba
9172${PROG} [a-z]*: Updating second-dir/suba/subb" \
9173"${PROG} server: Updating second-dir"
9174
9175	  if $remote; then
9176	    cd second-dir
9177	    mkdir suba
9178	    dotest modules3-7-workaround1 "${testcvs} add suba" \
9179"Directory ${CVSROOT_DIRNAME}/second-dir/suba added to the repository"
9180	    cd suba
9181	    mkdir subb
9182	    dotest modules3-7-workaround2 "${testcvs} add subb" \
9183"Directory ${CVSROOT_DIRNAME}/second-dir/suba/subb added to the repository"
9184	    cd ../..
9185	  fi
9186
9187	  cd second-dir/suba/subb
9188	  touch fileb
9189	  dotest modules3-7c "${testcvs} add fileb" \
9190"${PROG} [a-z]*: scheduling file .fileb. for addition
9191${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
9192	  dotest modules3-7d "${testcvs} -q ci -m add-it" \
9193"RCS file: ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v
9194done
9195Checking in fileb;
9196${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v  <--  fileb
9197initial revision: 1\.1
9198done"
9199	  cd ../../..
9200	  cd ..; rm -r 1
9201
9202	  mkdir 1
9203	  cd 1
9204	  dotest modules3-8 "${testcvs} -q co namednest" \
9205'U src/sub/dir/file1'
9206	  dotest modules3-9 "test -f src/sub/dir/file1" ''
9207	  cd ..
9208	  rm -r 1
9209
9210	  # Try the same thing, but with the directories nested even
9211	  # deeper (deeply enough so they are nested more deeply than
9212	  # the number of directories from / to ${TESTDIR}).
9213	  mkdir 1
9214	  cd 1
9215	  dotest modules3-10 "${testcvs} -q co nestdeeper" \
9216'U src/sub1/sub2/sub3/dir/file1'
9217	  dotest modules3-11 "test -f src/sub1/sub2/sub3/dir/file1" ''
9218
9219	  # While we are doing things like twisted uses of '/' (e.g.
9220	  # modules3-12), try this one.
9221	  if $remote; then
9222	    dotest_fail modules3-11b \
9223"${testcvs} -q update ${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1" \
9224"absolute pathname .${TESTDIR}/1/src/sub1/sub2/sub3/dir. illegal for server"
9225	  fi # end of remote-only tests
9226
9227	  cd ..
9228	  rm -r 1
9229
9230	  # This one is almost too twisted for words.  The pathname output
9231	  # in the message from "co" doesn't include the "path/in/modules",
9232	  # but those directories do get created (with no CVSADM except
9233	  # in "modules" which has a CVSNULLREPOS).
9234	  # I'm not sure anyone is relying on this nonsense or whether we
9235	  # need to keep doing it, but it is what CVS currently does...
9236	  # Skip it for remote; the remote code has the good sense to
9237	  # not deal with it (on the minus side it gives
9238	  # "internal error: repository string too short." (CVS 1.9) or
9239	  # "warning: server is not creating directories one at a time" (now)
9240	  # instead of a real error).
9241	  # I'm tempted to just make it a fatal error to have '/' in a
9242	  # module name.  But see comments at modules3-16.
9243	  if $remote; then :; else
9244	    mkdir 1; cd 1
9245	    dotest modules3-12 "${testcvs} -q co path/in/modules" \
9246"U first-dir/file1"
9247	    dotest modules3-13 "test -f path/in/modules/first-dir/file1" ''
9248	    cd ..; rm -r 1
9249	  fi # end of tests skipped for remote
9250
9251	  # Now here is where it used to get seriously bogus.
9252	  mkdir 1; cd 1
9253	  dotest modules3-14 \
9254"${testcvs} -q rtag tag1 path/in/modules" ''
9255	  # CVS used to create this even though rtag should *never* affect
9256	  # the directory current when it is called!
9257	  dotest_fail modules3-15 "test -d path/in/modules" ''
9258	  # Just for trivia's sake, rdiff was not similarly vulnerable
9259	  # because it passed 0 for run_module_prog to do_module.
9260	  cd ..; rm -r 1
9261
9262	  # Some people seem to want this to work.  I still suspect there
9263	  # are dark corners in slashes in module names.  This probably wants
9264	  # more thought before we start hacking on CVS (one way or the other)
9265	  # or documenting this.
9266	  mkdir 2; cd 2
9267	  dotest modules3-16 "${testcvs} -q co another/path/test" \
9268"U another/path/test/file1"
9269	  dotest modules3-17 "cat another/path/test/file1" 'file1'
9270	  cd ..; rm -r 2
9271
9272	  rm -rf ${CVSROOT_DIRNAME}/first-dir
9273	  rm -rf ${CVSROOT_DIRNAME}/second-dir
9274	  ;;
9275
9276	modules4)
9277	  # Some tests using the modules file with aliases that
9278	  # exclude particular directories.
9279
9280	  mkdir 1; cd 1
9281
9282	  dotest modules4-1 "${testcvs} -q co -l ." ''
9283	  mkdir first-dir
9284	  dotest modules4-2 "${testcvs} add first-dir" \
9285"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
9286
9287	  cd first-dir
9288          mkdir subdir
9289          dotest modules4-3 "${testcvs} add subdir" \
9290"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
9291
9292	  echo file1 > file1
9293	  dotest modules4-4 "${testcvs} add file1" \
9294"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
9295'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
9296
9297	  echo file2 > subdir/file2
9298	  dotest modules4-5 "${testcvs} add subdir/file2" \
9299"${PROG}"' [a-z]*: scheduling file `subdir/file2'\'' for addition
9300'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
9301
9302	  dotest modules4-6 "${testcvs} -q ci -m add-it" \
9303"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
9304done
9305Checking in file1;
9306${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
9307initial revision: 1\.1
9308done
9309RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
9310done
9311Checking in subdir/file2;
9312${CVSROOT_DIRNAME}/first-dir/subdir/file2,v  <--  file2
9313initial revision: 1\.1
9314done"
9315
9316	  cd ..
9317
9318	  dotest modules4-7 "${testcvs} -q update -d CVSROOT" \
9319"U CVSROOT${DOTSTAR}"
9320	  cd CVSROOT
9321	  cat >modules <<EOF
9322all -a first-dir
9323some -a !first-dir/subdir first-dir
9324somewhat -a first-dir !first-dir/subdir
9325EOF
9326	  dotest modules4-8 "${testcvs} -q ci -m add-modules" \
9327"Checking in modules;
9328${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
9329new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9330done
9331${PROG} [a-z]*: Rebuilding administrative file database"
9332	  cd ..
9333
9334	  cd ..
9335	  mkdir 2; cd 2
9336
9337	  dotest modules4-9 "${testcvs} -q co all" \
9338"U first-dir/file1
9339U first-dir/subdir/file2"
9340	  rm -r first-dir
9341
9342	  dotest modules4-10 "${testcvs} -q co some" "U first-dir/file1"
9343	  dotest_fail modules4-11 "test -d first-dir/subdir" ''
9344	  rm -r first-dir
9345
9346	  if $remote; then
9347	    # But remote seems to do it the other way.
9348	    dotest modules4-11a "${testcvs} -q co somewhat" "U first-dir/file1"
9349	    dotest_fail modules4-11b "test -d first-dir/subdir" ''
9350	  else
9351	    # This is strange behavior, in that the order of the
9352	    # "!first-dir/subdir" and "first-dir" matter, and it isn't
9353	    # clear that they should.  I suspect it is long-standing
9354	    # strange behavior but I haven't verified that.
9355	    dotest modules4-11a "${testcvs} -q co somewhat" \
9356"U first-dir/file1
9357U first-dir/subdir/file2"
9358	  fi
9359	  rm -r first-dir
9360
9361	  cd ..
9362	  rm -r 2
9363
9364	  dotest modules4-12 "${testcvs} rtag tag some" \
9365"${PROG} [a-z]*: Tagging first-dir
9366${PROG} [a-z]*: Ignoring first-dir/subdir"
9367
9368	  cd 1/first-dir/subdir
9369	  dotest modules4-13 "${testcvs} log file2" "
9370RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
9371Working file: file2
9372head: 1\.1
9373branch:
9374locks: strict
9375access list:
9376symbolic names:
9377keyword substitution: kv
9378total revisions: 1;	selected revisions: 1
9379description:
9380----------------------------
9381revision 1\.1
9382date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
9383add-it
9384============================================================================="
9385
9386	  cd ../../..
9387	  rm -r 1
9388
9389	  rm -rf ${CVSROOT_DIRNAME}/first-dir
9390	  ;;
9391
9392	modules5)
9393	  # Test module programs
9394
9395	  mkdir ${CVSROOT_DIRNAME}/first-dir
9396	  mkdir 1
9397	  cd 1
9398	  dotest modules5-1 "${testcvs} -q co first-dir" ""
9399	  cd first-dir
9400	  mkdir subdir
9401	  dotest modules5-2 "${testcvs} add subdir" \
9402"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
9403	  cd subdir
9404	  mkdir ssdir
9405	  dotest modules5-3 "${testcvs} add ssdir" \
9406"Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
9407	  touch a b
9408	  dotest modules5-4 "${testcvs} add a b" \
9409"${PROG} [a-z]*: scheduling file .a. for addition
9410${PROG} [a-z]*: scheduling file .b. for addition
9411${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
9412
9413	  dotest modules5-5 "${testcvs} ci -m added" \
9414"${PROG} [a-z]*: Examining .
9415${PROG} [a-z]*: Examining ssdir
9416RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
9417done
9418Checking in a;
9419${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
9420initial revision: 1\.1
9421done
9422RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
9423done
9424Checking in b;
9425${CVSROOT_DIRNAME}/first-dir/subdir/b,v  <--  b
9426initial revision: 1\.1
9427done"
9428
9429	  cd ..
9430	  dotest modules5-6 "${testcvs} -q co CVSROOT" \
9431"U CVSROOT/checkoutlist
9432U CVSROOT/commitinfo
9433U CVSROOT/config
9434U CVSROOT/cvswrappers
9435U CVSROOT/editinfo
9436U CVSROOT/loginfo
9437U CVSROOT/modules
9438U CVSROOT/notify
9439U CVSROOT/rcsinfo
9440U CVSROOT/taginfo
9441U CVSROOT/verifymsg"
9442
9443	  for i in checkin checkout update export tag; do
9444	    cat >> ${CVSROOT_DIRNAME}/$i.sh <<EOF
9445#! /bin/sh
9446echo "$i script invoked in \`pwd\`"
9447echo "args: \$@"
9448EOF
9449	    chmod +x ${CVSROOT_DIRNAME}/$i.sh
9450	  done
9451
9452	  OPTS="-i ${CVSROOT_DIRNAME}/checkin.sh -o${CVSROOT_DIRNAME}/checkout.sh -u ${CVSROOT_DIRNAME}/update.sh -e ${CVSROOT_DIRNAME}/export.sh -t${CVSROOT_DIRNAME}/tag.sh"
9453	  cat >CVSROOT/modules <<EOF
9454realmodule ${OPTS} first-dir/subdir a
9455dirmodule ${OPTS} first-dir/subdir
9456namedmodule -d nameddir ${OPTS} first-dir/subdir
9457EOF
9458
9459	  dotest modules5-7 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
9460"" \
9461"Checking in CVSROOT/modules;
9462${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
9463new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9464done
9465${PROG} [a-z]*: Rebuilding administrative file database"
9466
9467	  cd ..
9468	  rm -rf first-dir
9469	  # Test that real modules check out to realmodule/a, not subdir/a.
9470	  if $remote; then
9471	    dotest modules5-8 "${testcvs} co realmodule" \
9472"U realmodule/a
9473${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
9474checkout script invoked in .*
9475args: realmodule"
9476	  else
9477	    dotest modules5-8 "${testcvs} co realmodule" \
9478"U realmodule/a
9479${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
9480checkout script invoked in ${TESTDIR}/1
9481args: realmodule"
9482	  fi
9483	  dotest modules5-9 "test -d realmodule && test -f realmodule/a" ""
9484	  dotest_fail modules5-10 "test -f realmodule/b" ""
9485	  if $remote; then
9486	    dotest modules5-11 "${testcvs} -q co realmodule" \
9487"checkout script invoked in .*
9488args: realmodule"
9489	    dotest modules5-12 "${testcvs} -q update" \
9490"${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/update\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9491update script invoked in /.*/realmodule
9492args: ${CVSROOT_DIRNAME}/first-dir/subdir"
9493	    echo "change" >>realmodule/a
9494	    dotest modules5-13 "${testcvs} -q ci -m." \
9495"Checking in realmodule/a;
9496${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
9497new revision: 1\.2; previous revision: 1\.1
9498done
9499${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkin\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9500checkin script invoked in /.*/realmodule
9501args: ${CVSROOT_DIRNAME}/first-dir/subdir"
9502	  else
9503	    dotest modules5-11 "${testcvs} -q co realmodule" \
9504"checkout script invoked in ${TESTDIR}/1
9505args: realmodule"
9506	    dotest modules5-12 "${testcvs} -q update" \
9507"${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/update\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9508update script invoked in ${TESTDIR}/1/realmodule
9509args: ${CVSROOT_DIRNAME}/first-dir/subdir"
9510	    echo "change" >>realmodule/a
9511	    dotest modules5-13 "${testcvs} -q ci -m." \
9512"Checking in realmodule/a;
9513${CVSROOT_DIRNAME}/first-dir/subdir/a,v  <--  a
9514new revision: 1\.2; previous revision: 1\.1
9515done
9516${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkin\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9517checkin script invoked in ${TESTDIR}/1/realmodule
9518args: ${CVSROOT_DIRNAME}/first-dir/subdir"
9519	  fi
9520	  dotest modules5-14 "echo yes | ${testcvs} release -d realmodule" \
9521"You have \[0\] altered files in this repository\.
9522Are you sure you want to release (and delete) directory .realmodule.: "
9523	  dotest modules5-15 "${testcvs} -q rtag -Dnow MYTAG realmodule" \
9524"tag script invoked in ${TESTDIR}/1
9525args: realmodule MYTAG" \
9526"tag script invoked in $tmp/cvs-serv[0-9a-z]*
9527args: realmodule MYTAG"
9528	  if $remote; then
9529	    dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
9530"U realmodule/a
9531export script invoked in .*
9532args: realmodule"
9533	  else
9534	    dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
9535"U realmodule/a
9536export script invoked in ${TESTDIR}/1
9537args: realmodule"
9538	  fi
9539
9540	  dotest_fail modules5-17 "${testcvs} co realmodule/a" \
9541"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
9542"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory
9543'"${PROG}"' \[[a-z]* aborted\]: cannot expand modules'
9544
9545	  # FIXCVS: The client gets confused in these cases and tries to
9546	  # store the scripts in the wrong places.
9547	  if $remote; then :; else
9548	    # Now test the ability to check out a single file from a directory
9549	    dotest modules5-18 "${testcvs} co dirmodule/a" \
9550"U dirmodule/a
9551${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
9552checkout script invoked in ${TESTDIR}/1
9553args: dirmodule"
9554	    dotest modules5-19 "test -d dirmodule && test -f dirmodule/a" ""
9555	    dotest_fail modules5-20 "test -f dirmodule/b" ""
9556	    dotest modules5-21 "echo yes | ${testcvs} release -d dirmodule" \
9557"You have \[0\] altered files in this repository\.
9558Are you sure you want to release (and delete) directory .dirmodule.: "
9559
9560	    # Now test the ability to correctly reject a non-existent filename.
9561	    # For maximum studliness we would check that an error message is
9562	    # being output.
9563	    # We accept a zero exit status because it is what CVS does
9564	    # (Dec 95).  Probably the exit status should be nonzero,
9565	    # however.
9566	    dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
9567"${PROG} [a-z]*: warning: new-born dirmodule/nonexist has disappeared
9568${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
9569checkout script invoked in ${TESTDIR}/1
9570args: dirmodule"
9571
9572	    # We tolerate the creation of the dirmodule directory, since that
9573	    # is what CVS does, not because we view that as preferable to not
9574	    # creating it.
9575	    dotest_fail modules5-23 "test -f dirmodule/a || test -f dirmodule/b" ""
9576	    rm -r dirmodule
9577
9578	    # Now test that a module using -d checks out to the specified
9579	    # directory.
9580	    dotest modules5-24 "${testcvs} -q co namedmodule" \
9581"U nameddir/a
9582U nameddir/b
9583checkout script invoked in ${TESTDIR}/1
9584args: nameddir"
9585	    dotest modules5-25 "test -f nameddir/a && test -f nameddir/b" ""
9586	    echo add line >>nameddir/a
9587	    # This seems suspicious: when we checkout an existing directory,
9588	    # the checkout script gets executed in addition to the update
9589	    # script.  Is that by design or accident?
9590	    dotest modules5-26 "${testcvs} -q co namedmodule" \
9591"M nameddir/a
9592${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/update\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9593update script invoked in ${TESTDIR}/1/nameddir
9594args: ${CVSROOT_DIRNAME}/first-dir/subdir
9595checkout script invoked in ${TESTDIR}/1
9596args: nameddir"
9597	    rm nameddir/a
9598	    dotest modules5-27 "${testcvs} -q co namedmodule" \
9599"U nameddir/a
9600${PROG} [a-z]*: Executing ..${CVSROOT_DIRNAME}/update\.sh. .${CVSROOT_DIRNAME}/first-dir/subdir..
9601update script invoked in ${TESTDIR}/1/nameddir
9602args: ${CVSROOT_DIRNAME}/first-dir/subdir
9603checkout script invoked in ${TESTDIR}/1
9604args: nameddir"
9605	    dotest modules5-28 "echo yes | ${testcvs} release -d nameddir" \
9606"You have \[0\] altered files in this repository\.
9607Are you sure you want to release (and delete) directory .nameddir.: "
9608	  fi
9609
9610	  cd ..
9611	  rm -rf 1 ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/*.sh
9612	  ;;
9613
9614	mkmodules-temp-file-removal)
9615	  # When a file listed in checkoutlist doesn't exist, cvs-1.10.4
9616	  # would fail to remove the CVSROOT/.#[0-9]* temporary file it
9617	  # creates while mkmodules is in the process of trying to check
9618	  # out the missing file.
9619
9620	  mkdir 1; cd 1
9621	  dotest mtfr-1 "${testcvs} -Q co CVSROOT" ''
9622	  cd CVSROOT
9623	  echo no-such-file >> checkoutlist
9624	  dotest mtfr-2 "${testcvs} -Q ci -m. checkoutlist" \
9625"Checking in checkoutlist;
9626$CVSROOT_DIRNAME/CVSROOT/checkoutlist,v  <--  checkoutlist
9627new revision: 1\.2; previous revision: 1\.1
9628done
9629$PROG [a-z]*: Rebuilding administrative file database"
9630
9631	  dotest mtfr-3 "echo $CVSROOT_DIRNAME/CVSROOT/.#[0-9]*" \
9632	    "$CVSROOT_DIRNAME/CVSROOT/\.#\[0-9\]\*"
9633
9634	  cd ../..
9635	  rm -rf 1
9636	  ;;
9637
9638	cvsadm)
9639	  # These test check the content of CVS' administrative
9640	  # files as they are checked out in various configurations.
9641	  # (As a side note, I'm not using the "-q" flag in any of
9642	  # this code, which should provide some extra checking for
9643          # those messages which don't seem to be checked thoroughly
9644	  # anywhere else.)  To do a thorough test, we need to make
9645	  # a bunch of modules in various configurations.
9646	  #
9647	  # <1mod> is a directory at the top level of cvsroot
9648	  #    ``foo bar''
9649	  # <2mod> is a directory at the second level of cvsroot
9650	  #    ``foo bar/baz''
9651	  # <1d1mod> is a directory at the top level which is
9652	  #   checked out into another directory
9653	  #     ``foo -d bar baz''
9654	  # <1d2mod> is a directory at the second level which is
9655	  #   checked out into another directory
9656	  #     ``foo -d bar baz/quux''
9657	  # <2d1mod> is a directory at the top level which is
9658	  #   checked out into a directory that is two deep
9659	  #     ``foo -d bar/baz quux''
9660	  # <2d2mod> is a directory at the second level which is
9661	  #   checked out into a directory that is two deep
9662	  #     ``foo -d bar/baz quux''
9663	  #
9664	  # The tests do each of these types separately and in twos.
9665	  # We also repeat each test -d flag for 1-deep and 2-deep
9666	  # directories.
9667	  #
9668	  # Each test should check the output for the Repository
9669	  # file, since that is the one which varies depending on
9670	  # the directory and how it was checked out.
9671	  #
9672	  # Yes, this is verbose, but at least it's very thorough.
9673
9674	  # convenience variables
9675	  REP=${CVSROOT}
9676
9677	  # First, set TopLevelAdmin=yes so we're sure to get
9678	  # top-level CVS directories.
9679	  mkdir 1; cd 1
9680	  dotest cvsadm-setup-1 "${testcvs} -q co CVSROOT/config" \
9681"U CVSROOT/config"
9682	  cd CVSROOT
9683	  echo "TopLevelAdmin=yes" >config
9684	  dotest cvsadm-setup-2 "${testcvs} -q ci -m yes-top-level" \
9685"Checking in config;
9686${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
9687new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9688done
9689${PROG} [a-z]*: Rebuilding administrative file database"
9690	  cd ../..
9691	  rm -r 1
9692
9693	  # Second, check out the modules file and edit it.
9694	  mkdir 1; cd 1
9695	  dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
9696"U CVSROOT/modules"
9697
9698	  # Try to determine whether RELATIVE_REPOS is defined
9699	  # so that we can make the following a lot less
9700	  # verbose.
9701
9702	  echo "${CVSROOT_DIRNAME}/." > ${TESTDIR}/dotest.abs
9703	  echo "." > ${TESTDIR}/dotest.rel
9704	  if cmp ${TESTDIR}/dotest.abs CVS/Repository >/dev/null 2>&1; then
9705	    AREP="${CVSROOT_DIRNAME}/"
9706	  elif cmp ${TESTDIR}/dotest.rel CVS/Repository >/dev/null 2>&1; then
9707	    AREP=""
9708	  else
9709	    fail "Cannot figure out if RELATIVE_REPOS is defined."
9710	  fi
9711
9712	  # Test CVS/Root once.  Since there is only one part of
9713	  # the code which writes CVS/Root files (Create_Admin),
9714	  # there is no point in testing this every time.
9715	  dotest cvsadm-1a "cat CVS/Root" ${REP}
9716	  dotest cvsadm-1b "cat CVS/Repository" \
9717"${AREP}\."
9718	  dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
9719	  dotest cvsadm-1d "cat CVSROOT/CVS/Repository" \
9720"${AREP}CVSROOT"
9721          # All of the defined module names begin with a number.
9722	  # All of the top-level directory names begin with "dir".
9723	  # All of the subdirectory names begin with "sub".
9724	  # All of the top-level modules begin with "mod".
9725	  echo "# Module defs for cvsadm tests" > CVSROOT/modules
9726	  echo "1mod mod1" >> CVSROOT/modules
9727	  echo "1mod-2 mod1-2" >> CVSROOT/modules
9728	  echo "2mod mod2/sub2" >> CVSROOT/modules
9729	  echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
9730	  echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
9731	  echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
9732	  echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
9733	  echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
9734	  echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
9735	  echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
9736	  echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
9737	  echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
9738	  dotest cvsadm-1e "${testcvs} ci -m add-modules" \
9739"${PROG} [a-z]*: Examining .
9740${PROG} [a-z]*: Examining CVSROOT
9741Checking in CVSROOT/modules;
9742${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
9743new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
9744done
9745${PROG} [a-z]*: Rebuilding administrative file database" \
9746"${PROG} [a-z]*: Examining .
9747${PROG} [a-z]*: Examining CVSROOT"
9748	  rm -rf CVS CVSROOT;
9749
9750	  # Create the various modules
9751	  dotest cvsadm-2 "${testcvs} -q co -l ." ''
9752	  mkdir mod1
9753	  mkdir mod1-2
9754	  mkdir mod2
9755	  mkdir mod2/sub2
9756	  mkdir mod2-2
9757	  mkdir mod2-2/sub2-2
9758	  dotest cvsadm-2a "${testcvs} add mod1 mod1-2 mod2 mod2/sub2 mod2-2 mod2-2/sub2-2" \
9759"Directory ${CVSROOT_DIRNAME}/mod1 added to the repository
9760Directory ${CVSROOT_DIRNAME}/mod1-2 added to the repository
9761Directory ${CVSROOT_DIRNAME}/mod2 added to the repository
9762Directory ${CVSROOT_DIRNAME}/mod2/sub2 added to the repository
9763Directory ${CVSROOT_DIRNAME}/mod2-2 added to the repository
9764Directory ${CVSROOT_DIRNAME}/mod2-2/sub2-2 added to the repository"
9765
9766	  # Populate the directories for the halibut
9767	  echo "file1" > mod1/file1
9768	  echo "file1-2" > mod1-2/file1-2
9769	  echo "file2" > mod2/sub2/file2
9770	  echo "file2-2" > mod2-2/sub2-2/file2-2
9771	  dotest cvsadm-2aa "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
9772"${PROG} [a-z]*: scheduling file .mod1/file1. for addition
9773${PROG} [a-z]*: scheduling file .mod1-2/file1-2. for addition
9774${PROG} [a-z]*: scheduling file .mod2/sub2/file2. for addition
9775${PROG} [a-z]*: scheduling file .mod2-2/sub2-2/file2-2. for addition
9776${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
9777
9778	  dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
9779"${PROG} [a-z]*: Examining mod1
9780${PROG} [a-z]*: Examining mod1-2
9781${PROG} [a-z]*: Examining mod2
9782${PROG} [a-z]*: Examining mod2/sub2
9783${PROG} [a-z]*: Examining mod2-2
9784${PROG} [a-z]*: Examining mod2-2/sub2-2
9785RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
9786done
9787Checking in mod1/file1;
9788${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
9789initial revision: 1.1
9790done
9791RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
9792done
9793Checking in mod1-2/file1-2;
9794${CVSROOT_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
9795initial revision: 1.1
9796done
9797RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
9798done
9799Checking in mod2/sub2/file2;
9800${CVSROOT_DIRNAME}/mod2/sub2/file2,v  <--  file2
9801initial revision: 1.1
9802done
9803RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
9804done
9805Checking in mod2-2/sub2-2/file2-2;
9806${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v  <--  file2-2
9807initial revision: 1.1
9808done"
9809	  # Finished creating the modules -- clean up.
9810	  rm -rf CVS mod1 mod1-2 mod2 mod2-2
9811	  # Done.
9812
9813	  ##################################################
9814	  ## Start the dizzying array of possibilities.
9815	  ## Begin with each module type separately.
9816	  ##################################################
9817
9818	  # Pattern -- after each checkout, first check the top-level
9819	  # CVS directory.  Then, check the directories in numerical
9820	  # order.
9821
9822	  dotest cvsadm-3 "${testcvs} co 1mod" \
9823"${PROG} [a-z]*: Updating 1mod
9824U 1mod/file1"
9825	  dotest cvsadm-3b "cat CVS/Repository" \
9826"${AREP}\."
9827	  dotest cvsadm-3d "cat 1mod/CVS/Repository" \
9828"${AREP}mod1"
9829	  rm -rf CVS 1mod
9830
9831	  dotest cvsadm-4 "${testcvs} co 2mod" \
9832"${PROG} [a-z]*: Updating 2mod
9833U 2mod/file2"
9834	  dotest cvsadm-4b "cat CVS/Repository" \
9835"${AREP}\."
9836	  dotest cvsadm-4d "cat 2mod/CVS/Repository" \
9837"${AREP}mod2/sub2"
9838	  rm -rf CVS 2mod
9839
9840	  dotest cvsadm-5 "${testcvs} co 1d1mod" \
9841"${PROG} [a-z]*: Updating dir1d1
9842U dir1d1/file1"
9843	  dotest cvsadm-5b "cat CVS/Repository" \
9844"${AREP}\."
9845	  dotest cvsadm-5d "cat dir1d1/CVS/Repository" \
9846"${AREP}mod1"
9847	  rm -rf CVS dir1d1
9848
9849	  dotest cvsadm-6 "${testcvs} co 1d2mod" \
9850"${PROG} [a-z]*: Updating dir1d2
9851U dir1d2/file2"
9852	  dotest cvsadm-6b "cat CVS/Repository" \
9853"${AREP}\."
9854	  dotest cvsadm-6d "cat dir1d2/CVS/Repository" \
9855"${AREP}mod2/sub2"
9856	  rm -rf CVS dir1d2
9857
9858	  dotest cvsadm-7 "${testcvs} co 2d1mod" \
9859"${PROG} [a-z]*: Updating dir2d1/sub2d1
9860U dir2d1/sub2d1/file1"
9861	  dotest cvsadm-7b "cat CVS/Repository" \
9862"${AREP}\."
9863	  dotest cvsadm-7d "cat dir2d1/CVS/Repository" \
9864"${AREP}\."
9865	  dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" \
9866"${AREP}mod1"
9867	  rm -rf CVS dir2d1
9868
9869	  dotest cvsadm-8 "${testcvs} co 2d2mod" \
9870"${PROG} [a-z]*: Updating dir2d2/sub2d2
9871U dir2d2/sub2d2/file2"
9872	  dotest cvsadm-8b "cat CVS/Repository" \
9873"${AREP}\."
9874	  dotest cvsadm-8d "cat dir2d2/CVS/Repository" \
9875"${AREP}mod2"
9876	  dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" \
9877"${AREP}mod2/sub2"
9878	  rm -rf CVS dir2d2
9879
9880	  ##################################################
9881	  ## You are in a shell script of twisted little
9882	  ## module combination statements, all alike.
9883	  ##################################################
9884
9885	  ### 1mod
9886
9887	  dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
9888"${PROG} [a-z]*: Updating 1mod
9889U 1mod/file1
9890${PROG} [a-z]*: Updating 1mod-2
9891U 1mod-2/file1-2"
9892	  # the usual for the top level
9893	  dotest cvsadm-9b "cat CVS/Repository" \
9894"${AREP}\."
9895	  # the usual for 1mod
9896	  dotest cvsadm-9d "cat 1mod/CVS/Repository" \
9897"${AREP}mod1"
9898	  # the usual for 1mod copy
9899	  dotest cvsadm-9f "cat 1mod-2/CVS/Repository" \
9900"${AREP}mod1-2"
9901	  rm -rf CVS 1mod 1mod-2
9902
9903	  # 1mod 2mod redmod bluemod
9904	  dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
9905"${PROG} [a-z]*: Updating 1mod
9906U 1mod/file1
9907${PROG} [a-z]*: Updating 2mod
9908U 2mod/file2"
9909	  # the usual for the top level
9910	  dotest cvsadm-10b "cat CVS/Repository" \
9911"${AREP}\."
9912	  # the usual for 1mod
9913	  dotest cvsadm-10d "cat 1mod/CVS/Repository" \
9914"${AREP}mod1"
9915	  # the usual for 2dmod
9916	  dotest cvsadm-10f "cat 2mod/CVS/Repository" \
9917"${AREP}mod2/sub2"
9918	  rm -rf CVS 1mod 2mod
9919
9920	  dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
9921"${PROG} [a-z]*: Updating 1mod
9922U 1mod/file1
9923${PROG} [a-z]*: Updating dir1d1
9924U dir1d1/file1"
9925	  # the usual for the top level
9926	  dotest cvsadm-11b "cat CVS/Repository" \
9927"${AREP}\."
9928	  # the usual for 1mod
9929	  dotest cvsadm-11d "cat 1mod/CVS/Repository" \
9930"${AREP}mod1"
9931	  # the usual for 1d1mod
9932	  dotest cvsadm-11f "cat dir1d1/CVS/Repository" \
9933"${AREP}mod1"
9934	  rm -rf CVS 1mod dir1d1
9935
9936	  dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
9937"${PROG} [a-z]*: Updating 1mod
9938U 1mod/file1
9939${PROG} [a-z]*: Updating dir1d2
9940U dir1d2/file2"
9941	  # the usual for the top level
9942	  dotest cvsadm-12b "cat CVS/Repository" \
9943"${AREP}\."
9944	  # the usual for 1mod
9945	  dotest cvsadm-12d "cat 1mod/CVS/Repository" \
9946"${AREP}mod1"
9947	  # the usual for 1d2mod
9948	  dotest cvsadm-12f "cat dir1d2/CVS/Repository" \
9949"${AREP}mod2/sub2"
9950	  rm -rf CVS 1mod dir1d2
9951
9952	  dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
9953"${PROG} [a-z]*: Updating 1mod
9954U 1mod/file1
9955${PROG} [a-z]*: Updating dir2d1/sub2d1
9956U dir2d1/sub2d1/file1"
9957	  # the usual for the top level
9958	  dotest cvsadm-13b "cat CVS/Repository" \
9959"${AREP}\."
9960	  # the usual for 1mod
9961	  dotest cvsadm-13d "cat 1mod/CVS/Repository" \
9962"${AREP}mod1"
9963	  # the usual for 2d1mod
9964	  dotest cvsadm-13f "cat dir2d1/CVS/Repository" \
9965"${AREP}."
9966	  dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" \
9967"${AREP}mod1"
9968	  rm -rf CVS 1mod dir2d1
9969
9970	  dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
9971"${PROG} [a-z]*: Updating 1mod
9972U 1mod/file1
9973${PROG} [a-z]*: Updating dir2d2/sub2d2
9974U dir2d2/sub2d2/file2"
9975	  # the usual for the top level
9976	  dotest cvsadm-14b "cat CVS/Repository" \
9977"${AREP}\."
9978	  # the usual for 1mod
9979	  dotest cvsadm-14d "cat 1mod/CVS/Repository" \
9980"${AREP}mod1"
9981	  # the usual for 2d2mod
9982	  dotest cvsadm-14f "cat dir2d2/CVS/Repository" \
9983"${AREP}mod2"
9984	  dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" \
9985"${AREP}mod2/sub2"
9986	  rm -rf CVS 1mod dir2d2
9987
9988
9989	  ### 2mod
9990
9991	  dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
9992"${PROG} [a-z]*: Updating 2mod
9993U 2mod/file2
9994${PROG} [a-z]*: Updating 2mod-2
9995U 2mod-2/file2-2"
9996	  # the usual for the top level
9997	  dotest cvsadm-15b "cat CVS/Repository" \
9998"${AREP}\."
9999	  # the usual for 2mod
10000	  dotest cvsadm-15d "cat 2mod/CVS/Repository" \
10001"${AREP}mod2/sub2"
10002	  # the usual for 2mod copy
10003	  dotest cvsadm-15f "cat 2mod-2/CVS/Repository" \
10004"${AREP}mod2-2/sub2-2"
10005	  rm -rf CVS 2mod 2mod-2
10006
10007
10008	  dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
10009"${PROG} [a-z]*: Updating 2mod
10010U 2mod/file2
10011${PROG} [a-z]*: Updating dir1d1
10012U dir1d1/file1"
10013	  # the usual for the top level
10014	  dotest cvsadm-16b "cat CVS/Repository" \
10015"${AREP}\."
10016	  # the usual for 2mod
10017	  dotest cvsadm-16d "cat 2mod/CVS/Repository" \
10018"${AREP}mod2/sub2"
10019	  # the usual for 1d1mod
10020	  dotest cvsadm-16f "cat dir1d1/CVS/Repository" \
10021"${AREP}mod1"
10022	  rm -rf CVS 2mod dir1d1
10023
10024	  dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
10025"${PROG} [a-z]*: Updating 2mod
10026U 2mod/file2
10027${PROG} [a-z]*: Updating dir1d2
10028U dir1d2/file2"
10029	  # the usual for the top level
10030	  dotest cvsadm-17b "cat CVS/Repository" \
10031"${AREP}\."
10032	  # the usual for 2mod
10033	  dotest cvsadm-17d "cat 2mod/CVS/Repository" \
10034"${AREP}mod2/sub2"
10035	  # the usual for 1d2mod
10036	  dotest cvsadm-17f "cat dir1d2/CVS/Repository" \
10037"${AREP}mod2/sub2"
10038	  rm -rf CVS 2mod dir1d2
10039
10040	  dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
10041"${PROG} [a-z]*: Updating 2mod
10042U 2mod/file2
10043${PROG} [a-z]*: Updating dir2d1/sub2d1
10044U dir2d1/sub2d1/file1"
10045	  # the usual for the top level
10046	  dotest cvsadm-18b "cat CVS/Repository" \
10047"${AREP}\."
10048	  # the usual for 2mod
10049	  dotest cvsadm-18d "cat 2mod/CVS/Repository" \
10050"${AREP}mod2/sub2"
10051	  # the usual for 2d1mod
10052	  dotest cvsadm-18f "cat dir2d1/CVS/Repository" \
10053"${AREP}."
10054	  dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" \
10055"${AREP}mod1"
10056	  rm -rf CVS 2mod dir2d1
10057
10058	  dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
10059"${PROG} [a-z]*: Updating 2mod
10060U 2mod/file2
10061${PROG} [a-z]*: Updating dir2d2/sub2d2
10062U dir2d2/sub2d2/file2"
10063	  # the usual for the top level
10064	  dotest cvsadm-19b "cat CVS/Repository" \
10065"${AREP}\."
10066	  # the usual for 2mod
10067	  dotest cvsadm-19d "cat 2mod/CVS/Repository" \
10068"${AREP}mod2/sub2"
10069	  # the usual for 2d2mod
10070	  dotest cvsadm-19f "cat dir2d2/CVS/Repository" \
10071"${AREP}mod2"
10072	  dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" \
10073"${AREP}mod2/sub2"
10074	  rm -rf CVS 2mod dir2d2
10075
10076
10077	  ### 1d1mod
10078
10079	  dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
10080"${PROG} [a-z]*: Updating dir1d1
10081U dir1d1/file1
10082${PROG} [a-z]*: Updating dir1d1-2
10083U dir1d1-2/file1-2"
10084	  # the usual for the top level
10085	  dotest cvsadm-20b "cat CVS/Repository" \
10086"${AREP}\."
10087	  # the usual for 1d1mod
10088	  dotest cvsadm-20d "cat dir1d1/CVS/Repository" \
10089"${AREP}mod1"
10090	  # the usual for 1d1mod copy
10091	  dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" \
10092"${AREP}mod1-2"
10093	  rm -rf CVS dir1d1 dir1d1-2
10094
10095	  dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
10096"${PROG} [a-z]*: Updating dir1d1
10097U dir1d1/file1
10098${PROG} [a-z]*: Updating dir1d2
10099U dir1d2/file2"
10100	  # the usual for the top level
10101	  dotest cvsadm-21b "cat CVS/Repository" \
10102"${AREP}\."
10103	  # the usual for 1d1mod
10104	  dotest cvsadm-21d "cat dir1d1/CVS/Repository" \
10105"${AREP}mod1"
10106	  # the usual for 1d2mod
10107	  dotest cvsadm-21f "cat dir1d2/CVS/Repository" \
10108"${AREP}mod2/sub2"
10109	  rm -rf CVS dir1d1 dir1d2
10110
10111	  dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
10112"${PROG} [a-z]*: Updating dir1d1
10113U dir1d1/file1
10114${PROG} [a-z]*: Updating dir2d1/sub2d1
10115U dir2d1/sub2d1/file1"
10116	  # the usual for the top level
10117	  dotest cvsadm-22b "cat CVS/Repository" \
10118"${AREP}\."
10119	  # the usual for 1d1mod
10120	  dotest cvsadm-22d "cat dir1d1/CVS/Repository" \
10121"${AREP}mod1"
10122	  # the usual for 2d1mod
10123	  dotest cvsadm-22f "cat dir2d1/CVS/Repository" \
10124"${AREP}\."
10125	  dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" \
10126"${AREP}mod1"
10127	  rm -rf CVS dir1d1 dir2d1
10128
10129	  dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
10130"${PROG} [a-z]*: Updating dir1d1
10131U dir1d1/file1
10132${PROG} [a-z]*: Updating dir2d2/sub2d2
10133U dir2d2/sub2d2/file2"
10134	  # the usual for the top level
10135	  dotest cvsadm-23b "cat CVS/Repository" \
10136"${AREP}\."
10137	  # the usual for 1d1mod
10138	  dotest cvsadm-23d "cat dir1d1/CVS/Repository" \
10139"${AREP}mod1"
10140	  # the usual for 2d2mod
10141	  dotest cvsadm-23f "cat dir2d2/CVS/Repository" \
10142"${AREP}mod2"
10143	  dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" \
10144"${AREP}mod2/sub2"
10145	  rm -rf CVS dir1d1 dir2d2
10146
10147
10148	  ### 1d2mod
10149
10150	  dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
10151"${PROG} [a-z]*: Updating dir1d2
10152U dir1d2/file2
10153${PROG} [a-z]*: Updating dir1d2-2
10154U dir1d2-2/file2-2"
10155	  # the usual for the top level
10156	  dotest cvsadm-24b "cat CVS/Repository" \
10157"${AREP}\."
10158	  # the usual for 1d2mod
10159	  dotest cvsadm-24d "cat dir1d2/CVS/Repository" \
10160"${AREP}mod2/sub2"
10161	  # the usual for 1d2mod copy
10162	  dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" \
10163"${AREP}mod2-2/sub2-2"
10164	  rm -rf CVS dir1d2 dir1d2-2
10165
10166	  dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
10167"${PROG} [a-z]*: Updating dir1d2
10168U dir1d2/file2
10169${PROG} [a-z]*: Updating dir2d1/sub2d1
10170U dir2d1/sub2d1/file1"
10171	  # the usual for the top level
10172	  dotest cvsadm-25b "cat CVS/Repository" \
10173"${AREP}\."
10174	  # the usual for 1d2mod
10175	  dotest cvsadm-25d "cat dir1d2/CVS/Repository" \
10176"${AREP}mod2/sub2"
10177	  # the usual for 2d1mod
10178	  dotest cvsadm-25f "cat dir2d1/CVS/Repository" \
10179"${AREP}\."
10180	  dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" \
10181"${AREP}mod1"
10182	  rm -rf CVS dir1d2 dir2d1
10183
10184	  dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
10185"${PROG} [a-z]*: Updating dir1d2
10186U dir1d2/file2
10187${PROG} [a-z]*: Updating dir2d2/sub2d2
10188U dir2d2/sub2d2/file2"
10189	  # the usual for the top level
10190	  dotest cvsadm-26b "cat CVS/Repository" \
10191"${AREP}\."
10192	  # the usual for 1d2mod
10193	  dotest cvsadm-26d "cat dir1d2/CVS/Repository" \
10194"${AREP}mod2/sub2"
10195	  # the usual for 2d2mod
10196	  dotest cvsadm-26f "cat dir2d2/CVS/Repository" \
10197"${AREP}mod2"
10198	  dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" \
10199"${AREP}mod2/sub2"
10200	  rm -rf CVS dir1d2 dir2d2
10201
10202
10203	  # 2d1mod
10204
10205	  dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
10206"${PROG} [a-z]*: Updating dir2d1/sub2d1
10207U dir2d1/sub2d1/file1
10208${PROG} [a-z]*: Updating dir2d1-2/sub2d1-2
10209U dir2d1-2/sub2d1-2/file1-2"
10210	  # the usual for the top level
10211	  dotest cvsadm-27b "cat CVS/Repository" \
10212"${AREP}\."
10213	  # the usual for 2d1mod
10214	  dotest cvsadm-27d "cat dir2d1/CVS/Repository" \
10215"${AREP}\."
10216	  dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" \
10217"${AREP}mod1"
10218	  # the usual for 2d1mod
10219	  dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" \
10220"${AREP}\."
10221	  dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" \
10222"${AREP}mod1-2"
10223	  rm -rf CVS dir2d1 dir2d1-2
10224
10225	  dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
10226"${PROG} [a-z]*: Updating dir2d1/sub2d1
10227U dir2d1/sub2d1/file1
10228${PROG} [a-z]*: Updating dir2d2/sub2d2
10229U dir2d2/sub2d2/file2"
10230	  # the usual for the top level
10231	  dotest cvsadm-28b "cat CVS/Repository" \
10232"${AREP}\."
10233	  # the usual for 2d1mod
10234	  dotest cvsadm-28d "cat dir2d1/CVS/Repository" \
10235"${AREP}\."
10236	  dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" \
10237"${AREP}mod1"
10238	  # the usual for 2d2mod
10239	  dotest cvsadm-28h "cat dir2d2/CVS/Repository" \
10240"${AREP}mod2"
10241	  dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" \
10242"${AREP}mod2/sub2"
10243	  rm -rf CVS dir2d1 dir2d2
10244
10245
10246	  # 2d2mod
10247
10248	  dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
10249"${PROG} [a-z]*: Updating dir2d2/sub2d2
10250U dir2d2/sub2d2/file2
10251${PROG} [a-z]*: Updating dir2d2-2/sub2d2-2
10252U dir2d2-2/sub2d2-2/file2-2"
10253	  # the usual for the top level
10254	  dotest cvsadm-29b "cat CVS/Repository" \
10255"${AREP}\."
10256	  # the usual for 2d2mod
10257	  dotest cvsadm-29d "cat dir2d2/CVS/Repository" \
10258"${AREP}mod2"
10259	  dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" \
10260"${AREP}mod2/sub2"
10261	  # the usual for 2d2mod
10262	  dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" \
10263"${AREP}mod2-2"
10264	  dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
10265"${AREP}mod2-2/sub2-2"
10266	  rm -rf CVS dir2d2 dir2d2-2
10267
10268	  ##################################################
10269	  ## And now, all of that again using the "-d" flag
10270	  ## on the command line.
10271	  ##################################################
10272
10273	  dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
10274"${PROG} [a-z]*: Updating dir
10275U dir/file1"
10276	  dotest cvsadm-1d3b "cat CVS/Repository" \
10277"${AREP}\."
10278	  dotest cvsadm-1d3d "cat dir/CVS/Repository" \
10279"${AREP}mod1"
10280	  rm -rf CVS dir
10281
10282	  dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
10283"${PROG} [a-z]*: Updating dir
10284U dir/file2"
10285	  dotest cvsadm-1d4b "cat CVS/Repository" \
10286"${AREP}\."
10287	  dotest cvsadm-1d4d "cat dir/CVS/Repository" \
10288"${AREP}mod2/sub2"
10289	  rm -rf CVS dir
10290
10291	  dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
10292"${PROG} [a-z]*: Updating dir
10293U dir/file1"
10294	  dotest cvsadm-1d5b "cat CVS/Repository" \
10295"${AREP}\."
10296	  dotest cvsadm-1d5d "cat dir/CVS/Repository" \
10297"${AREP}mod1"
10298	  rm -rf CVS dir
10299
10300	  dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
10301"${PROG} [a-z]*: Updating dir
10302U dir/file2"
10303	  dotest cvsadm-1d6b "cat CVS/Repository" \
10304"${AREP}\."
10305	  dotest cvsadm-1d6d "cat dir/CVS/Repository" \
10306"${AREP}mod2/sub2"
10307	  rm -rf CVS dir
10308
10309	  dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
10310"${PROG} [a-z]*: Updating dir
10311U dir/file1"
10312	  dotest cvsadm-1d7b "cat CVS/Repository" \
10313"${AREP}\."
10314	  dotest cvsadm-1d7d "cat dir/CVS/Repository" \
10315"${AREP}mod1"
10316	  rm -rf CVS dir
10317
10318	  dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
10319"${PROG} [a-z]*: Updating dir
10320U dir/file2"
10321	  dotest cvsadm-1d8b "cat CVS/Repository" \
10322"${AREP}\."
10323	  dotest cvsadm-1d8d "cat dir/CVS/Repository" \
10324"${AREP}mod2/sub2"
10325	  rm -rf CVS dir
10326
10327	  ##################################################
10328	  ## Los Combonaciones
10329	  ##################################################
10330
10331	  ### 1mod
10332
10333	  dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
10334"${PROG} [a-z]*: Updating dir/1mod
10335U dir/1mod/file1
10336${PROG} [a-z]*: Updating dir/1mod-2
10337U dir/1mod-2/file1-2"
10338	  # the usual for the top level
10339	  dotest cvsadm-1d9b "cat CVS/Repository" \
10340"${AREP}\."
10341	  # the usual for the dir level
10342	  dotest cvsadm-1d9d "cat dir/CVS/Repository" \
10343"${AREP}\."
10344	  # the usual for 1mod
10345	  dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" \
10346"${AREP}mod1"
10347	  # the usual for 1mod copy
10348	  dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" \
10349"${AREP}mod1-2"
10350	  rm -rf CVS dir
10351
10352	  # 1mod 2mod redmod bluemod
10353	  dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
10354"${PROG} [a-z]*: Updating dir/1mod
10355U dir/1mod/file1
10356${PROG} [a-z]*: Updating dir/2mod
10357U dir/2mod/file2"
10358	  dotest cvsadm-1d10b "cat CVS/Repository" \
10359"${AREP}\."
10360	  # the usual for the dir level
10361	  dotest cvsadm-1d10d "cat dir/CVS/Repository" \
10362"${AREP}\."
10363	  # the usual for 1mod
10364	  dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" \
10365"${AREP}mod1"
10366	  # the usual for 2dmod
10367	  dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" \
10368"${AREP}mod2/sub2"
10369	  rm -rf CVS dir
10370
10371	  dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
10372"${PROG} [a-z]*: Updating dir/1mod
10373U dir/1mod/file1
10374${PROG} [a-z]*: Updating dir/dir1d1
10375U dir/dir1d1/file1"
10376	  dotest cvsadm-1d11b "cat CVS/Repository" \
10377"${AREP}\."
10378	  # the usual for the dir level
10379	  dotest cvsadm-1d11d "cat dir/CVS/Repository" \
10380"${AREP}\."
10381	  # the usual for 1mod
10382	  dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" \
10383"${AREP}mod1"
10384	  # the usual for 1d1mod
10385	  dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" \
10386"${AREP}mod1"
10387	  rm -rf CVS dir
10388
10389	  dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
10390"${PROG} [a-z]*: Updating dir/1mod
10391U dir/1mod/file1
10392${PROG} [a-z]*: Updating dir/dir1d2
10393U dir/dir1d2/file2"
10394	  dotest cvsadm-1d12b "cat CVS/Repository" \
10395"${AREP}\."
10396	  # the usual for the dir level
10397	  dotest cvsadm-1d12d "cat dir/CVS/Repository" \
10398"${AREP}\."
10399	  # the usual for 1mod
10400	  dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" \
10401"${AREP}mod1"
10402	  # the usual for 1d2mod
10403	  dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" \
10404"${AREP}mod2/sub2"
10405	  rm -rf CVS dir
10406
10407	  dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
10408"${PROG} [a-z]*: Updating dir/1mod
10409U dir/1mod/file1
10410${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10411U dir/dir2d1/sub2d1/file1"
10412	  dotest cvsadm-1d13b "cat CVS/Repository" \
10413"${AREP}\."
10414	  # the usual for the dir level
10415	  dotest cvsadm-1d13d "cat dir/CVS/Repository" \
10416"${AREP}\."
10417	  # the usual for 1mod
10418	  dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" \
10419"${AREP}mod1"
10420	  # the usual for 2d1mod
10421	  dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" \
10422"${AREP}\."
10423	  dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" \
10424"${AREP}mod1"
10425	  rm -rf CVS dir
10426
10427	  dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
10428"${PROG} [a-z]*: Updating dir/1mod
10429U dir/1mod/file1
10430${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10431U dir/dir2d2/sub2d2/file2"
10432	  dotest cvsadm-1d14b "cat CVS/Repository" \
10433"${AREP}\."
10434	  # the usual for the dir level
10435	  dotest cvsadm-1d14d "cat dir/CVS/Repository" \
10436"${AREP}\."
10437	  # the usual for 1mod
10438	  dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" \
10439"${AREP}mod1"
10440	  # the usual for 2d2mod
10441	  dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" \
10442"${AREP}mod2"
10443	  dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" \
10444"${AREP}mod2/sub2"
10445	  rm -rf CVS dir
10446
10447
10448	  ### 2mod
10449
10450	  dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
10451"${PROG} [a-z]*: Updating dir/2mod
10452U dir/2mod/file2
10453${PROG} [a-z]*: Updating dir/2mod-2
10454U dir/2mod-2/file2-2"
10455	  dotest cvsadm-1d15b "cat CVS/Repository" \
10456"${AREP}\."
10457	  # the usual for the dir level
10458	  dotest cvsadm-1d15d "cat dir/CVS/Repository" \
10459"${AREP}mod2"
10460	  # the usual for 2mod
10461	  dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" \
10462"${AREP}mod2/sub2"
10463	  # the usual for 2mod copy
10464	  dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" \
10465"${AREP}mod2-2/sub2-2"
10466	  rm -rf CVS dir
10467
10468	  dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
10469"${PROG} [a-z]*: Updating dir/2mod
10470U dir/2mod/file2
10471${PROG} [a-z]*: Updating dir/dir1d1
10472U dir/dir1d1/file1"
10473	  dotest cvsadm-1d16b "cat CVS/Repository" \
10474"${AREP}\."
10475	  # the usual for the dir level
10476	  dotest cvsadm-1d16d "cat dir/CVS/Repository" \
10477"${AREP}mod2"
10478	  # the usual for 2mod
10479	  dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" \
10480"${AREP}mod2/sub2"
10481	  # the usual for 1d1mod
10482	  dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" \
10483"${AREP}mod1"
10484	  rm -rf CVS dir
10485
10486	  dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
10487"${PROG} [a-z]*: Updating dir/2mod
10488U dir/2mod/file2
10489${PROG} [a-z]*: Updating dir/dir1d2
10490U dir/dir1d2/file2"
10491	  dotest cvsadm-1d17b "cat CVS/Repository" \
10492"${AREP}\."
10493	  # the usual for the dir level
10494	  dotest cvsadm-1d17d "cat dir/CVS/Repository" \
10495"${AREP}mod2"
10496	  # the usual for 2mod
10497	  dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" \
10498"${AREP}mod2/sub2"
10499	  # the usual for 1d2mod
10500	  dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" \
10501"${AREP}mod2/sub2"
10502	  rm -rf CVS dir
10503
10504	  dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
10505"${PROG} [a-z]*: Updating dir/2mod
10506U dir/2mod/file2
10507${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10508U dir/dir2d1/sub2d1/file1"
10509	  dotest cvsadm-1d18b "cat CVS/Repository" \
10510"${AREP}\."
10511	  # the usual for the dir level
10512	  dotest cvsadm-1d18d "cat dir/CVS/Repository" \
10513"${AREP}mod2"
10514	  # the usual for 2mod
10515	  dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" \
10516"${AREP}mod2/sub2"
10517	  # the usual for 2d1mod
10518	  dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" \
10519"${AREP}\."
10520	  dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" \
10521"${AREP}mod1"
10522	  rm -rf CVS dir
10523
10524	  dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
10525"${PROG} [a-z]*: Updating dir/2mod
10526U dir/2mod/file2
10527${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10528U dir/dir2d2/sub2d2/file2"
10529	  dotest cvsadm-1d19b "cat CVS/Repository" \
10530"${AREP}\."
10531	  # the usual for the dir level
10532	  dotest cvsadm-1d19d "cat dir/CVS/Repository" \
10533"${AREP}mod2"
10534	  # the usual for 2mod
10535	  dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" \
10536"${AREP}mod2/sub2"
10537	  # the usual for 2d2mod
10538	  dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" \
10539"${AREP}mod2"
10540	  dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" \
10541"${AREP}mod2/sub2"
10542	  rm -rf CVS dir
10543
10544
10545	  ### 1d1mod
10546
10547	  dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
10548"${PROG} [a-z]*: Updating dir/dir1d1
10549U dir/dir1d1/file1
10550${PROG} [a-z]*: Updating dir/dir1d1-2
10551U dir/dir1d1-2/file1-2"
10552	  dotest cvsadm-1d20b "cat CVS/Repository" \
10553"${AREP}\."
10554	  # the usual for the dir level
10555	  dotest cvsadm-1d20d "cat dir/CVS/Repository" \
10556"${AREP}\."
10557	  # the usual for 1d1mod
10558	  dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" \
10559"${AREP}mod1"
10560	  # the usual for 1d1mod copy
10561	  dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" \
10562"${AREP}mod1-2"
10563	  rm -rf CVS dir
10564
10565	  dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
10566"${PROG} [a-z]*: Updating dir/dir1d1
10567U dir/dir1d1/file1
10568${PROG} [a-z]*: Updating dir/dir1d2
10569U dir/dir1d2/file2"
10570	  dotest cvsadm-1d21b "cat CVS/Repository" \
10571"${AREP}\."
10572	  # the usual for the dir level
10573	  dotest cvsadm-1d21d "cat dir/CVS/Repository" \
10574"${AREP}\."
10575	  # the usual for 1d1mod
10576	  dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" \
10577"${AREP}mod1"
10578	  # the usual for 1d2mod
10579	  dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" \
10580"${AREP}mod2/sub2"
10581	  rm -rf CVS dir
10582
10583	  dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
10584"${PROG} [a-z]*: Updating dir/dir1d1
10585U dir/dir1d1/file1
10586${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10587U dir/dir2d1/sub2d1/file1"
10588	  dotest cvsadm-1d22b "cat CVS/Repository" \
10589"${AREP}\."
10590	  # the usual for the dir level
10591	  dotest cvsadm-1d22d "cat dir/CVS/Repository" \
10592"${AREP}\."
10593	  # the usual for 1d1mod
10594	  dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" \
10595"${AREP}mod1"
10596	  # the usual for 2d1mod
10597	  dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" \
10598"${AREP}\."
10599	  dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" \
10600"${AREP}mod1"
10601	  rm -rf CVS dir
10602
10603	  dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
10604"${PROG} [a-z]*: Updating dir/dir1d1
10605U dir/dir1d1/file1
10606${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10607U dir/dir2d2/sub2d2/file2"
10608	  dotest cvsadm-1d23b "cat CVS/Repository" \
10609"${AREP}\."
10610	  # the usual for the dir level
10611	  dotest cvsadm-1d23d "cat dir/CVS/Repository" \
10612"${AREP}\."
10613	  # the usual for 1d1mod
10614	  dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" \
10615"${AREP}mod1"
10616	  # the usual for 2d2mod
10617	  dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" \
10618"${AREP}mod2"
10619	  dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" \
10620"${AREP}mod2/sub2"
10621	  rm -rf CVS dir
10622
10623
10624	  ### 1d2mod
10625
10626	  dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
10627"${PROG} [a-z]*: Updating dir/dir1d2
10628U dir/dir1d2/file2
10629${PROG} [a-z]*: Updating dir/dir1d2-2
10630U dir/dir1d2-2/file2-2"
10631	  dotest cvsadm-1d24b "cat CVS/Repository" \
10632"${AREP}\."
10633	  # the usual for the dir level
10634	  dotest cvsadm-1d24d "cat dir/CVS/Repository" \
10635"${AREP}mod2"
10636	  # the usual for 1d2mod
10637	  dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" \
10638"${AREP}mod2/sub2"
10639	  # the usual for 1d2mod copy
10640	  dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" \
10641"${AREP}mod2-2/sub2-2"
10642	  rm -rf CVS dir
10643
10644	  dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
10645"${PROG} [a-z]*: Updating dir/dir1d2
10646U dir/dir1d2/file2
10647${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10648U dir/dir2d1/sub2d1/file1"
10649	  dotest cvsadm-1d25b "cat CVS/Repository" \
10650"${AREP}\."
10651	  # the usual for the dir level
10652	  dotest cvsadm-1d25d "cat dir/CVS/Repository" \
10653"${AREP}mod2"
10654	  # the usual for 1d2mod
10655	  dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" \
10656"${AREP}mod2/sub2"
10657	  # the usual for 2d1mod
10658	  dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" \
10659"${AREP}\."
10660	  dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" \
10661"${AREP}mod1"
10662	  rm -rf CVS dir
10663
10664	  dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
10665"${PROG} [a-z]*: Updating dir/dir1d2
10666U dir/dir1d2/file2
10667${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10668U dir/dir2d2/sub2d2/file2"
10669	  dotest cvsadm-1d26b "cat CVS/Repository" \
10670"${AREP}\."
10671	  # the usual for the dir level
10672	  dotest cvsadm-1d26d "cat dir/CVS/Repository" \
10673"${AREP}mod2"
10674	  # the usual for 1d2mod
10675	  dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" \
10676"${AREP}mod2/sub2"
10677	  # the usual for 2d2mod
10678	  dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" \
10679"${AREP}mod2"
10680	  dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" \
10681"${AREP}mod2/sub2"
10682	  rm -rf CVS dir
10683
10684
10685	  # 2d1mod
10686
10687	  dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
10688"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10689U dir/dir2d1/sub2d1/file1
10690${PROG} [a-z]*: Updating dir/dir2d1-2/sub2d1-2
10691U dir/dir2d1-2/sub2d1-2/file1-2"
10692	  dotest cvsadm-1d27b "cat CVS/Repository" \
10693"${AREP}\."
10694	  # the usual for the dir level
10695	  dotest cvsadm-1d27d "cat dir/CVS/Repository" \
10696"${AREP}CVSROOT/Emptydir"
10697	  # the usual for 2d1mod
10698	  dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" \
10699"${AREP}\."
10700	  dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" \
10701"${AREP}mod1"
10702	  # the usual for 2d1mod
10703	  dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" \
10704"${AREP}\."
10705	  dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
10706"${AREP}mod1-2"
10707	  rm -rf CVS dir
10708
10709	  dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
10710"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10711U dir/dir2d1/sub2d1/file1
10712${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10713U dir/dir2d2/sub2d2/file2"
10714	  dotest cvsadm-1d28b "cat CVS/Repository" \
10715"${AREP}\."
10716	  # the usual for the dir level
10717	  dotest cvsadm-1d28d "cat dir/CVS/Repository" \
10718"${AREP}CVSROOT/Emptydir"
10719	  # the usual for 2d1mod
10720	  dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" \
10721"${AREP}\."
10722	  dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" \
10723"${AREP}mod1"
10724	  # the usual for 2d2mod
10725	  dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" \
10726"${AREP}mod2"
10727	  dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" \
10728"${AREP}mod2/sub2"
10729	  rm -rf CVS dir
10730
10731
10732	  # 2d2mod
10733
10734	  dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
10735"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10736U dir/dir2d2/sub2d2/file2
10737${PROG} [a-z]*: Updating dir/dir2d2-2/sub2d2-2
10738U dir/dir2d2-2/sub2d2-2/file2-2"
10739	  dotest cvsadm-1d29b "cat CVS/Repository" \
10740"${AREP}\."
10741	  # the usual for the dir level
10742	  dotest cvsadm-1d29d "cat dir/CVS/Repository" \
10743"${AREP}\."
10744	  # the usual for 2d2mod
10745	  dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" \
10746"${AREP}mod2"
10747	  dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" \
10748"${AREP}mod2/sub2"
10749	  # the usual for 2d2mod
10750	  dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" \
10751"${AREP}mod2-2"
10752	  dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
10753"${AREP}mod2-2/sub2-2"
10754	  rm -rf CVS dir
10755
10756	  ##################################################
10757	  ## And now, some of that again using the "-d" flag
10758	  ## on the command line, but use a longer path.
10759	  ##################################################
10760
10761	  dotest_fail cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
10762"${PROG} [a-z]*: cannot chdir to dir: No such file or directory
10763${PROG} [a-z]*: ignoring module 1mod"
10764
10765	  if $remote; then :; else
10766	    # Remote can't handle this, even with the "mkdir dir".
10767	    # This was also true of CVS 1.9.
10768
10769	    mkdir dir
10770	    dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
10771"${PROG} [a-z]*: Updating dir/dir2
10772U dir/dir2/file1"
10773	    dotest cvsadm-2d3b "cat CVS/Repository" \
10774"${AREP}\."
10775	    dotest_fail cvsadm-2d3d "test -f dir/CVS/Repository" ""
10776	    dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" \
10777"${AREP}mod1"
10778	    rm -rf CVS dir
10779
10780	    mkdir dir
10781	    dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
10782"${PROG} [a-z]*: Updating dir/dir2
10783U dir/dir2/file2"
10784	    dotest cvsadm-2d4b "cat CVS/Repository" \
10785"${AREP}\."
10786	    dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" \
10787"${AREP}mod2/sub2"
10788	    rm -rf CVS dir
10789
10790	    mkdir dir
10791	    dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
10792"${PROG} [a-z]*: Updating dir/dir2
10793U dir/dir2/file1"
10794	    dotest cvsadm-2d5b "cat CVS/Repository" \
10795"${AREP}\."
10796	    dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" \
10797"${AREP}mod1"
10798	    rm -rf CVS dir
10799
10800	    mkdir dir
10801	    dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
10802"${PROG} [a-z]*: Updating dir/dir2
10803U dir/dir2/file2"
10804	    dotest cvsadm-2d6b "cat CVS/Repository" \
10805"${AREP}\."
10806	    dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" \
10807"${AREP}mod2/sub2"
10808	    rm -rf CVS dir
10809
10810	    mkdir dir
10811	    dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
10812"${PROG} [a-z]*: Updating dir/dir2
10813U dir/dir2/file1"
10814	    dotest cvsadm-2d7b "cat CVS/Repository" \
10815"${AREP}\."
10816	    dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" \
10817"${AREP}mod1"
10818	    rm -rf CVS dir
10819
10820	    mkdir dir
10821	    dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
10822"${PROG} [a-z]*: Updating dir/dir2
10823U dir/dir2/file2"
10824	    dotest cvsadm-2d8b "cat CVS/Repository" \
10825"${AREP}\."
10826	    dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" \
10827"${AREP}mod2/sub2"
10828	    rm -rf CVS dir
10829
10830	    ##################################################
10831	    ## And now, a few of those tests revisited to
10832	    ## test the behavior of the -N flag.
10833	    ##################################################
10834
10835	    dotest cvsadm-N3 "${testcvs} co -N 1mod" \
10836"${PROG} [a-z]*: Updating 1mod
10837U 1mod/file1"
10838	    dotest cvsadm-N3b "cat CVS/Repository" \
10839"${AREP}\."
10840	    dotest cvsadm-N3d "cat 1mod/CVS/Repository" \
10841"${AREP}mod1"
10842	    rm -rf CVS 1mod
10843
10844	    dotest cvsadm-N4 "${testcvs} co -N 2mod" \
10845"${PROG} [a-z]*: Updating 2mod
10846U 2mod/file2"
10847	    dotest cvsadm-N4b "cat CVS/Repository" \
10848"${AREP}\."
10849	    dotest cvsadm-N4d "cat 2mod/CVS/Repository" \
10850"${AREP}mod2/sub2"
10851	    rm -rf CVS 2mod
10852
10853	    dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
10854"${PROG} [a-z]*: Updating dir1d1
10855U dir1d1/file1"
10856	    dotest cvsadm-N5b "cat CVS/Repository" \
10857"${AREP}\."
10858	    dotest cvsadm-N5d "cat dir1d1/CVS/Repository" \
10859"${AREP}mod1"
10860	    rm -rf CVS dir1d1
10861
10862	    dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
10863"${PROG} [a-z]*: Updating dir1d2
10864U dir1d2/file2"
10865	    dotest cvsadm-N6b "cat CVS/Repository" \
10866"${AREP}\."
10867	    dotest cvsadm-N6d "cat dir1d2/CVS/Repository" \
10868"${AREP}mod2/sub2"
10869	    rm -rf CVS dir1d2
10870
10871	    dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
10872"${PROG} [a-z]*: Updating dir2d1/sub2d1
10873U dir2d1/sub2d1/file1"
10874	    dotest cvsadm-N7b "cat CVS/Repository" \
10875"${AREP}\."
10876	    dotest cvsadm-N7d "cat dir2d1/CVS/Repository" \
10877"${AREP}\."
10878	    dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" \
10879"${AREP}mod1"
10880	    rm -rf CVS dir2d1
10881
10882	    dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
10883"${PROG} [a-z]*: Updating dir2d2/sub2d2
10884U dir2d2/sub2d2/file2"
10885	    dotest cvsadm-N8b "cat CVS/Repository" \
10886"${AREP}\."
10887	    dotest cvsadm-N8d "cat dir2d2/CVS/Repository" \
10888"${AREP}mod2"
10889	    dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" \
10890"${AREP}mod2/sub2"
10891	    rm -rf CVS dir2d2
10892
10893	    ## the ones in one-deep directories
10894
10895	    dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
10896"${PROG} [a-z]*: Updating dir/1mod
10897U dir/1mod/file1"
10898	    dotest cvsadm-N1d3b "cat CVS/Repository" \
10899"${AREP}\."
10900	    dotest cvsadm-N1d3d "cat dir/CVS/Repository" \
10901"${AREP}\."
10902	    dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" \
10903"${AREP}mod1"
10904	    rm -rf CVS dir
10905
10906	    dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
10907"${PROG} [a-z]*: Updating dir/2mod
10908U dir/2mod/file2"
10909	    dotest cvsadm-N1d4b "cat CVS/Repository" \
10910"${AREP}\."
10911	    dotest cvsadm-N1d4d "cat dir/CVS/Repository" \
10912"${AREP}mod2"
10913	    dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" \
10914"${AREP}mod2/sub2"
10915	    rm -rf CVS dir
10916
10917	    dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
10918"${PROG} [a-z]*: Updating dir/dir1d1
10919U dir/dir1d1/file1"
10920	    dotest cvsadm-N1d5b "cat CVS/Repository" \
10921"${AREP}\."
10922	    dotest cvsadm-N1d5d "cat dir/CVS/Repository" \
10923"${AREP}\."
10924	    dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" \
10925"${AREP}mod1"
10926	    rm -rf CVS dir
10927
10928	    dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
10929"${PROG} [a-z]*: Updating dir/dir1d2
10930U dir/dir1d2/file2"
10931	    dotest cvsadm-N1d6b "cat CVS/Repository" \
10932"${AREP}\."
10933	    dotest cvsadm-N1d6d "cat dir/CVS/Repository" \
10934"${AREP}mod2"
10935	    dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" \
10936"${AREP}mod2/sub2"
10937	    rm -rf CVS dir
10938
10939	    dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
10940"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
10941U dir/dir2d1/sub2d1/file1"
10942	    dotest cvsadm-N1d7b "cat CVS/Repository" \
10943"${AREP}\."
10944	    dotest cvsadm-N1d7d "cat dir/CVS/Repository" \
10945"${AREP}CVSROOT/Emptydir"
10946	    dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" \
10947"${AREP}\."
10948	    dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" \
10949"${AREP}mod1"
10950	    rm -rf CVS dir
10951
10952	    dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
10953"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
10954U dir/dir2d2/sub2d2/file2"
10955	    dotest cvsadm-N1d8b "cat CVS/Repository" \
10956"${AREP}\."
10957	    dotest cvsadm-N1d8d "cat dir/CVS/Repository" \
10958"${AREP}\."
10959	    dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" \
10960"${AREP}mod2"
10961	    dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
10962"${AREP}mod2/sub2"
10963	    rm -rf CVS dir
10964
10965	    ## the ones in two-deep directories
10966
10967	    mkdir dir
10968	    dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
10969"${PROG} [a-z]*: Updating dir/dir2/1mod
10970U dir/dir2/1mod/file1"
10971	    dotest cvsadm-N2d3b "cat CVS/Repository" \
10972"${AREP}\."
10973	    dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" \
10974"${AREP}\."
10975	    dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" \
10976"${AREP}mod1"
10977	    rm -rf CVS dir
10978
10979	    mkdir dir
10980	    dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
10981"${PROG} [a-z]*: Updating dir/dir2/2mod
10982U dir/dir2/2mod/file2"
10983	    dotest cvsadm-N2d4b "cat CVS/Repository" \
10984"${AREP}\."
10985	    dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" \
10986"${AREP}mod2"
10987	    dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" \
10988"${AREP}mod2/sub2"
10989	    rm -rf CVS dir
10990
10991	    mkdir dir
10992	    dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
10993"${PROG} [a-z]*: Updating dir/dir2/dir1d1
10994U dir/dir2/dir1d1/file1"
10995	    dotest cvsadm-N2d5b "cat CVS/Repository" \
10996"${AREP}\."
10997	    dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" \
10998"${AREP}\."
10999	    dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" \
11000"${AREP}mod1"
11001	    rm -rf CVS dir
11002
11003	    mkdir dir
11004	    dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
11005"${PROG} [a-z]*: Updating dir/dir2/dir1d2
11006U dir/dir2/dir1d2/file2"
11007	    dotest cvsadm-N2d6b "cat CVS/Repository" \
11008"${AREP}\."
11009	    dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" \
11010"${AREP}mod2"
11011	    dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" \
11012"${AREP}mod2/sub2"
11013	    rm -rf CVS dir
11014
11015	    mkdir dir
11016	    dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
11017"${PROG} [a-z]*: Updating dir/dir2/dir2d1/sub2d1
11018U dir/dir2/dir2d1/sub2d1/file1"
11019	    dotest cvsadm-N2d7b "cat CVS/Repository" \
11020"${AREP}\."
11021	    dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" \
11022"${AREP}CVSROOT/Emptydir"
11023	    dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" \
11024"${AREP}\."
11025	    dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
11026"${AREP}mod1"
11027	    rm -rf CVS dir
11028
11029	    mkdir dir
11030	    dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
11031"${PROG} [a-z]*: Updating dir/dir2/dir2d2/sub2d2
11032U dir/dir2/dir2d2/sub2d2/file2"
11033	    dotest cvsadm-N2d8b "cat CVS/Repository" \
11034"${AREP}\."
11035	    dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" \
11036"${AREP}\."
11037	    dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" \
11038"${AREP}mod2"
11039	    dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
11040"${AREP}mod2/sub2"
11041	    rm -rf CVS dir
11042
11043	  fi # end of tests to be skipped for remote
11044
11045	  ##################################################
11046	  ## That's enough of that, thank you very much.
11047	  ##################################################
11048
11049	  dotest cvsadm-cleanup-1 "${testcvs} -q co CVSROOT/config" \
11050"U CVSROOT/config"
11051	  cd CVSROOT
11052	  echo "# empty file" >config
11053	  dotest cvsadm-cleanup-2 "${testcvs} -q ci -m cvsadm-cleanup" \
11054"Checking in config;
11055${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
11056new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11057done
11058${PROG} [a-z]*: Rebuilding administrative file database"
11059          cd ..
11060          rm -rf CVSROOT CVS
11061
11062	  # remove our junk
11063	  cd ..
11064	  rm -rf 1
11065	  rm -rf ${CVSROOT_DIRNAME}/1mod
11066	  rm -rf ${CVSROOT_DIRNAME}/1mod-2
11067	  rm -rf ${CVSROOT_DIRNAME}/2mod
11068	  rm -rf ${CVSROOT_DIRNAME}/2mod-2
11069	  rm -rf ${CVSROOT_DIRNAME}/mod1
11070	  rm -rf ${CVSROOT_DIRNAME}/mod1-2
11071	  rm -rf ${CVSROOT_DIRNAME}/mod2
11072	  rm -rf ${CVSROOT_DIRNAME}/mod2-2
11073	  ;;
11074
11075	emptydir)
11076	  # Various tests of the Emptydir (CVSNULLREPOS) code.  See also:
11077	  #   cvsadm: tests of Emptydir in various module definitions
11078	  #   basicb: Test that "Emptydir" is non-special in ordinary contexts
11079
11080	  mkdir 1; cd 1
11081	  dotest emptydir-1 "${testcvs} co CVSROOT/modules" \
11082"U CVSROOT/modules"
11083	  echo "# Module defs for emptydir tests" > CVSROOT/modules
11084	  echo "2d1mod -d dir2d1/sub/sub2d1 mod1" >> CVSROOT/modules
11085	  echo "2d1moda -d dir2d1/suba moda/modasub" >> CVSROOT/modules
11086	  echo "2d1modb -d dir2d1/suba mod1" >> CVSROOT/modules
11087	  echo "comb -a 2d1modb 2d1moda" >> CVSROOT/modules
11088
11089	  dotest emptydir-2 "${testcvs} ci -m add-modules" \
11090"${PROG} [a-z]*: Examining CVSROOT
11091Checking in CVSROOT/modules;
11092${CVSROOT_DIRNAME}/CVSROOT/modules,v  <--  modules
11093new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11094done
11095${PROG} [a-z]*: Rebuilding administrative file database" \
11096"${PROG} [a-z]*: Examining CVSROOT"
11097	  rm -rf CVS CVSROOT
11098
11099	  mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
11100	  # Populate.  Not sure we really need to do this.
11101	  dotest emptydir-3 "${testcvs} -q co -l ." ""
11102	  dotest emptydir-3a "${testcvs} co mod1 moda" \
11103"${PROG} [a-z]*: Updating mod1
11104${PROG} [a-z]*: Updating moda"
11105	  echo "file1" > mod1/file1
11106	  mkdir moda/modasub
11107	  dotest emptydir-3b "${testcvs} add moda/modasub" \
11108"Directory ${CVSROOT_DIRNAME}/moda/modasub added to the repository"
11109	  echo "filea" > moda/modasub/filea
11110	  dotest emptydir-4 "${testcvs} add mod1/file1 moda/modasub/filea" \
11111"${PROG} [a-z]*: scheduling file .mod1/file1. for addition
11112${PROG} [a-z]*: scheduling file .moda/modasub/filea. for addition
11113${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
11114	  dotest emptydir-5 "${testcvs} -q ci -m yup" \
11115"RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
11116done
11117Checking in mod1/file1;
11118${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
11119initial revision: 1\.1
11120done
11121RCS file: ${CVSROOT_DIRNAME}/moda/modasub/filea,v
11122done
11123Checking in moda/modasub/filea;
11124${CVSROOT_DIRNAME}/moda/modasub/filea,v  <--  filea
11125initial revision: 1\.1
11126done"
11127	  rm -rf mod1 moda CVS
11128	  # End Populate.
11129
11130	  dotest emptydir-6 "${testcvs} co 2d1mod" \
11131"${PROG} [a-z]*: Updating dir2d1/sub/sub2d1
11132U dir2d1/sub/sub2d1/file1"
11133	  cd dir2d1
11134	  touch emptyfile
11135	  # It doesn't make any sense to add a file (or do much of anything
11136	  # else) in Emptydir; Emptydir is a placeholder indicating that
11137	  # the working directory doesn't correspond to anything in
11138	  # the repository.
11139	  dotest_fail emptydir-7 "${testcvs} add emptyfile" \
11140"${PROG} \[[a-z]* aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
11141	  mkdir emptydir
11142	  dotest_fail emptydir-8 "${testcvs} add emptydir" \
11143"${PROG} \[[a-z]* aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
11144	  cd ..
11145	  rm -rf CVS dir2d1
11146
11147	  # OK, while we have an Emptydir around, test a few obscure
11148	  # things about it.
11149	  mkdir edir; cd edir
11150	  dotest emptydir-9 "${testcvs} -q co -l CVSROOT" \
11151"U CVSROOT${DOTSTAR}"
11152	  cd CVSROOT
11153	  dotest_fail emptydir-10 "test -d Emptydir" ''
11154	  # This tests the code in find_dirs which skips Emptydir.
11155	  dotest emptydir-11 "${testcvs} -q -n update -d -P" ''
11156	  cd ../..
11157	  rm -r edir
11158	  cd ..
11159
11160	  # Now start playing with moda.
11161	  mkdir 2; cd 2
11162	  dotest emptydir-12 "${testcvs} -q co 2d1moda" \
11163"U dir2d1/suba/filea"
11164	  # OK, this is the crux of the matter.  This used to show "Emptydir",
11165	  # but everyone seemed to think it should show "moda".  This
11166	  # usually works better, but not always as shown by the following
11167	  # test.
11168	  dotest emptydir-13 "cat dir2d1/CVS/Repository" "moda"
11169	  dotest_fail emptydir-14 "${testcvs} co comb" \
11170"${PROG} [a-z]*: existing repository ${CVSROOT_DIRNAME}/moda/modasub does not match ${TESTDIR}/cvsroot/mod1
11171${PROG} [a-z]*: ignoring module 2d1modb
11172${PROG} [a-z]*: Updating dir2d1/suba"
11173	  dotest emptydir-15 "cat dir2d1/CVS/Repository" "moda"
11174	  cd ..
11175
11176	  rm -r 1 2
11177	  rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
11178	  # I guess for the moment the convention is going to be
11179	  # that we don't need to remove ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
11180	  ;;
11181
11182	abspath)
11183
11184	  # These tests test the thituations thin thwitch thoo theck
11185	  # things thout twith thabsolute thaths.  Threally.
11186
11187	  #
11188	  # CHECKOUTS
11189	  #
11190
11191	  # Create a few modules to use
11192	  mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
11193	  dotest abspath-1a "${testcvs} co mod1 mod2" \
11194"${PROG} [a-z]*: Updating mod1
11195${PROG} [a-z]*: Updating mod2"
11196
11197	  # Populate the module
11198	  echo "file1" > mod1/file1
11199	  echo "file2" > mod2/file2
11200	  cd mod1
11201	  dotest abspath-1ba "${testcvs} add file1" \
11202"${PROG} [a-z]*: scheduling file .file1. for addition
11203${PROG} [a-z]*: use '${PROG} commit' to add this file permanently"
11204          cd ..
11205          cd mod2
11206	  dotest abspath-1bb "${testcvs} add file2" \
11207"${PROG} [a-z]*: scheduling file .file2. for addition
11208${PROG} [a-z]*: use '${PROG} commit' to add this file permanently"
11209          cd ..
11210
11211	  dotest abspath-1c "${testcvs} ci -m yup mod1 mod2" \
11212"${PROG} [a-z]*: Examining mod1
11213${PROG} [a-z]*: Examining mod2
11214RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
11215done
11216Checking in mod1/file1;
11217${CVSROOT_DIRNAME}/mod1/file1,v  <--  file1
11218initial revision: 1.1
11219done
11220RCS file: ${CVSROOT_DIRNAME}/mod2/file2,v
11221done
11222Checking in mod2/file2;
11223${CVSROOT_DIRNAME}/mod2/file2,v  <--  file2
11224initial revision: 1.1
11225done"
11226	  # Finished creating the module -- clean up.
11227	  rm -rf CVS mod1 mod2
11228	  # Done.
11229
11230	  # Try checking out the module in a local directory
11231	  if $remote; then
11232	    dotest_fail abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
11233"${PROG} \[server aborted\]: absolute pathname .${TESTDIR}/1. illegal for server"
11234	    dotest abspath-2a-try2 "${testcvs} co -d 1 mod1" \
11235"${PROG} [a-z]*: Updating 1
11236U 1/file1"
11237	  else
11238	    dotest abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
11239"${PROG} [a-z]*: Updating ${TESTDIR}/1
11240U ${TESTDIR}/1/file1"
11241	  fi # remote workaround
11242
11243	  # Are we relative or absolute in our Repository file?
11244	  echo "${CVSROOT_DIRNAME}/mod1" > ${TESTDIR}/dotest.abs
11245	  echo "mod1" > ${TESTDIR}/dotest.rel
11246	  if cmp ${TESTDIR}/dotest.abs ${TESTDIR}/1/CVS/Repository >/dev/null 2>&1; then
11247	    AREP="${CVSROOT_DIRNAME}/"
11248	  elif cmp ${TESTDIR}/dotest.rel ${TESTDIR}/1/CVS/Repository >/dev/null 2>&1; then
11249	    AREP=""
11250	  else
11251	    fail "Cannot figure out if RELATIVE_REPOS is defined."
11252	  fi
11253	  rm -f ${TESTDIR}/dotest.rel ${TESTDIR}/dotest.abs
11254
11255	  dotest abspath-2b "cat ${TESTDIR}/1/CVS/Repository" \
11256"${AREP}mod1"
11257
11258	  # Done.  Clean up.
11259	  rm -rf ${TESTDIR}/1
11260
11261
11262	  # Now try in a subdirectory.  We're not covering any more
11263	  # code here, but we might catch a future error if someone
11264	  # changes the checkout code.
11265
11266	  # Note that for the same reason that the shell command
11267	  # "touch 1/2/3" requires directories 1 and 1/2 to already
11268	  # exist, we expect ${TESTDIR}/1 to already exist.  I believe
11269	  # this is the behavior of CVS 1.9 and earlier.
11270	  if $remote; then :; else
11271	    dotest_fail abspath-3.1 "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
11272"${PROG} [a-z]*: cannot chdir to 1: No such file or directory
11273${PROG} [a-z]*: ignoring module mod1"
11274	  fi
11275	  dotest_fail abspath-3.2 "${testcvs} co -d 1/2 mod1" \
11276"${PROG} [a-z]*: cannot chdir to 1: No such file or directory
11277${PROG} [a-z]*: ignoring module mod1"
11278	  mkdir 1
11279
11280	  if $remote; then
11281	    # The server wants the directory to exist, but that is
11282	    # a bug, it should only need to exist on the client side.
11283	    # See also cvsadm-2d3.
11284	    dotest_fail abspath-3a "${testcvs} co -d 1/2 mod1" \
11285"${PROG} [a-z]*: cannot chdir to 1: No such file or directory
11286${PROG} [a-z]*: ignoring module mod1"
11287	    cd 1
11288	    dotest abspath-3a-try2 "${testcvs} co -d 2 mod1" \
11289"${PROG} [a-z]*: Updating 2
11290U 2/file1"
11291	    cd ..
11292	    rm -rf 1/CVS
11293	  else
11294	  dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
11295"${PROG} [a-z]*: Updating ${TESTDIR}/1/2
11296U ${TESTDIR}/1/2/file1"
11297	  fi # remote workaround
11298	  dotest abspath-3b "cat ${TESTDIR}/1/2/CVS/Repository" \
11299"${AREP}mod1"
11300
11301	  # For all the same reasons that we want "1" to already
11302	  # exist, we don't to mess with it to traverse it, for
11303	  # example by creating a CVS directory.
11304
11305	  dotest_fail abspath-3c "test -d ${TESTDIR}/1/CVS" ''
11306	  # Done.  Clean up.
11307	  rm -rf ${TESTDIR}/1
11308
11309
11310	  # Now try someplace where we don't have permission.
11311	  mkdir ${TESTDIR}/barf
11312	  chmod -w ${TESTDIR}/barf
11313	  if $remote; then
11314	    dotest_fail abspath-4r "${testcvs} co -d ${TESTDIR}/barf/sub mod1" \
11315"${PROG} \[server aborted\]: absolute pathname .${TESTDIR}/barf/sub. illegal for server"
11316	  else
11317	    dotest_fail abspath-4 "${testcvs} co -d ${TESTDIR}/barf/sub mod1" \
11318"${PROG} \[[a-z]* aborted\]: cannot make directory sub: No such file or directory"
11319	  fi
11320	  chmod +w ${TESTDIR}/barf
11321	  rmdir ${TESTDIR}/barf
11322	  # Done.  Nothing to clean up.
11323
11324
11325	  # Try checking out two modules into the same directory.
11326	  if $remote; then
11327	    dotest abspath-5ar "${testcvs} co -d 1 mod1 mod2" \
11328"${PROG} [a-z]*: Updating 1/mod1
11329U 1/mod1/file1
11330${PROG} [a-z]*: Updating 1/mod2
11331U 1/mod2/file2"
11332	  else
11333	    dotest abspath-5a "${testcvs} co -d ${TESTDIR}/1 mod1 mod2" \
11334"${PROG} [a-z]*: Updating ${TESTDIR}/1/mod1
11335U ${TESTDIR}/1/mod1/file1
11336${PROG} [a-z]*: Updating ${TESTDIR}/1/mod2
11337U ${TESTDIR}/1/mod2/file2"
11338	  fi # end remote workaround
11339	  dotest abspath-5b "cat ${TESTDIR}/1/CVS/Repository" \
11340"${AREP}."
11341	  dotest abspath-5c "cat ${TESTDIR}/1/mod1/CVS/Repository" \
11342"${AREP}mod1"
11343	  dotest abspath-5d "cat ${TESTDIR}/1/mod2/CVS/Repository" \
11344"${AREP}mod2"
11345	  # Done.  Clean up.
11346	  rm -rf ${TESTDIR}/1
11347
11348
11349	  # Try checking out the top-level module.
11350	  if $remote; then
11351	    dotest abspath-6ar "${testcvs} co -d 1 ." \
11352"${PROG} [a-z]*: Updating 1
11353${PROG} [a-z]*: Updating 1/CVSROOT
11354${DOTSTAR}
11355${PROG} [a-z]*: Updating 1/mod1
11356U 1/mod1/file1
11357${PROG} [a-z]*: Updating 1/mod2
11358U 1/mod2/file2"
11359	  else
11360	    dotest abspath-6a "${testcvs} co -d ${TESTDIR}/1 ." \
11361"${PROG} [a-z]*: Updating ${TESTDIR}/1
11362${PROG} [a-z]*: Updating ${TESTDIR}/1/CVSROOT
11363${DOTSTAR}
11364${PROG} [a-z]*: Updating ${TESTDIR}/1/mod1
11365U ${TESTDIR}/1/mod1/file1
11366${PROG} [a-z]*: Updating ${TESTDIR}/1/mod2
11367U ${TESTDIR}/1/mod2/file2"
11368	  fi # end of remote workaround
11369	  dotest abspath-6b "cat ${TESTDIR}/1/CVS/Repository" \
11370"${AREP}."
11371	  dotest abspath-6c "cat ${TESTDIR}/1/CVSROOT/CVS/Repository" \
11372"${AREP}CVSROOT"
11373	  dotest abspath-6c "cat ${TESTDIR}/1/mod1/CVS/Repository" \
11374"${AREP}mod1"
11375	  dotest abspath-6d "cat ${TESTDIR}/1/mod2/CVS/Repository" \
11376"${AREP}mod2"
11377	  # Done.  Clean up.
11378	  rm -rf ${TESTDIR}/1
11379
11380	  # Test that an absolute pathname to some other directory
11381	  # doesn't mess with the current working directory.
11382	  mkdir 1
11383	  cd 1
11384	  if $remote; then
11385	    dotest_fail abspath-7ar "${testcvs} -q co -d ../2 mod2" \
11386"${PROG} server: protocol error: .\.\./2. contains more leading \.\.
11387${PROG} \[server aborted\]: than the 0 which Max-dotdot specified"
11388	    cd ..
11389	    dotest abspath-7a-try2r "${testcvs} -q co -d 2 mod2" \
11390"U 2/file2"
11391	    cd 1
11392	  else
11393	    dotest abspath-7a "${testcvs} -q co -d ${TESTDIR}/2 mod2" \
11394"U ${TESTDIR}/2/file2"
11395	  fi # remote workaround
11396	  dotest abspath-7b "ls" ""
11397	  dotest abspath-7c "${testcvs} -q co mod1" \
11398"U mod1/file1"
11399	  cd mod1
11400	  if $remote; then
11401	    cd ../..
11402	    dotest abspath-7dr "${testcvs} -q co -d 3 mod2" \
11403"U 3/file2"
11404	    cd 1/mod1
11405	  else
11406	  dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
11407"U ${TESTDIR}/3/file2"
11408	  fi # remote workaround
11409	  dotest abspath-7e "${testcvs} -q update -d" ""
11410	  cd ../..
11411	  rm -r 1 2 3
11412
11413	  #
11414	  # FIXME: do other functions here (e.g. update /tmp/foo)
11415	  #
11416
11417	  # Finished with all tests.  Remove the module.
11418	  rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
11419
11420	  ;;
11421
11422	toplevel)
11423	  # test the feature that cvs creates a CVS subdir also for
11424	  # the toplevel directory
11425
11426	  # Some test, somewhere, is creating Emptydir.  That test
11427	  # should, perhaps, clean up for itself, but I don't know which
11428	  # one it is (cvsadm, emptydir, &c).
11429	  # (On the other hand, should CVS care whether there is an
11430	  # Emptydir?  That would seem a bit odd).
11431	  rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
11432
11433	  # First set the TopLevelAdmin setting.
11434	  mkdir 1; cd 1
11435	  dotest toplevel-1a "${testcvs} -q co CVSROOT/config" \
11436"U CVSROOT/config"
11437	  cd CVSROOT
11438	  echo "TopLevelAdmin=yes" >config
11439	  dotest toplevel-1b "${testcvs} -q ci -m yes-top-level" \
11440"Checking in config;
11441${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
11442new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11443done
11444${PROG} [a-z]*: Rebuilding administrative file database"
11445	  cd ../..
11446	  rm -r 1
11447
11448	  mkdir 1; cd 1
11449	  dotest toplevel-1 "${testcvs} -q co -l ." ''
11450	  mkdir top-dir second-dir
11451	  dotest toplevel-2 "${testcvs} add top-dir second-dir" \
11452"Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
11453Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
11454	  cd top-dir
11455
11456	  touch file1
11457	  dotest toplevel-3 "${testcvs} add file1" \
11458"${PROG} [a-z]*: scheduling file .file1. for addition
11459${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
11460	  dotest toplevel-4 "${testcvs} -q ci -m add" \
11461"RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
11462done
11463Checking in file1;
11464${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
11465initial revision: 1\.1
11466done"
11467	  cd ..
11468
11469	  cd second-dir
11470	  touch file2
11471	  dotest toplevel-3s "${testcvs} add file2" \
11472"${PROG} [a-z]*: scheduling file .file2. for addition
11473${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
11474	  dotest toplevel-4s "${testcvs} -q ci -m add" \
11475"RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
11476done
11477Checking in file2;
11478${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
11479initial revision: 1\.1
11480done"
11481
11482	  cd ../..
11483	  rm -r 1; mkdir 1; cd 1
11484	  dotest toplevel-5 "${testcvs} co top-dir" \
11485"${PROG} [a-z]*: Updating top-dir
11486U top-dir/file1"
11487
11488	  dotest toplevel-6 "${testcvs} update top-dir" \
11489"${PROG} [a-z]*: Updating top-dir"
11490	  dotest toplevel-7 "${testcvs} update"  \
11491"${PROG} [a-z]*: Updating \.
11492${PROG} [a-z]*: Updating top-dir"
11493
11494	  dotest toplevel-8 "${testcvs} update -d top-dir" \
11495"${PROG} [a-z]*: Updating top-dir"
11496	  # There is some sentiment that
11497	  #   "${PROG} [a-z]*: Updating \.
11498          #   ${PROG} [a-z]*: Updating top-dir"
11499	  # is correct but it isn't clear why that would be correct instead
11500	  # of the remote CVS behavior (which also updates CVSROOT).
11501	  #
11502	  # The DOTSTAR matches of a bunch of lines like
11503	  # "U CVSROOT/checkoutlist".  Trying to match them more precisely
11504	  # seemed to cause trouble.  For example CVSROOT/cvsignore will
11505	  # be present or absent depending on whether we ran the "ignore"
11506	  # test or not.
11507	  dotest toplevel-9 "${testcvs} update -d" \
11508"${PROG} [a-z]*: Updating \.
11509${PROG} [a-z]*: Updating CVSROOT
11510${DOTSTAR}
11511${PROG} [a-z]*: Updating top-dir"
11512
11513	  cd ..
11514	  rm -r 1; mkdir 1; cd 1
11515	  dotest toplevel-10 "${testcvs} co top-dir" \
11516"${PROG} [a-z]*: Updating top-dir
11517U top-dir/file1"
11518
11519	  # This tests more or less the same thing, in a particularly
11520	  # "real life" example.
11521	  dotest toplevel-11 "${testcvs} -q update -d second-dir" \
11522"U second-dir/file2"
11523
11524	  # Now remove the CVS directory (people may do this manually,
11525	  # especially if they formed their habits with CVS
11526	  # 1.9 and older, which didn't create it.  Or perhaps the working
11527	  # directory itself was created with 1.9 or older).
11528	  rm -r CVS
11529	  # Now set the permissions so we can't recreate it.
11530	  chmod -w ../1
11531	  # Now see whether CVS has trouble because it can't create CVS.
11532	  # First string is for local, second is for remote.
11533	  dotest toplevel-12 "${testcvs} co top-dir" \
11534"${PROG} [a-z]*: warning: cannot make directory CVS in \.: Permission denied
11535${PROG} [a-z]*: Updating top-dir" \
11536"${PROG} [a-z]*: warning: cannot make directory CVS in \.: Permission denied
11537${PROG} [a-z]*: warning: cannot make directory CVS in \.: Permission denied
11538${PROG} [a-z]*: in directory \.:
11539${PROG} [a-z]*: cannot open CVS/Entries for reading: No such file or directory
11540${PROG} [a-z]*: Updating top-dir"
11541
11542	  chmod +w ../1
11543
11544	  dotest toplevel-cleanup-1 "${testcvs} -q co CVSROOT/config" \
11545"U CVSROOT/config"
11546	  cd CVSROOT
11547	  echo "# empty file" >config
11548	  dotest toplevel-cleanup-2 "${testcvs} -q ci -m toplevel-cleanup" \
11549"Checking in config;
11550${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
11551new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11552done
11553${PROG} [a-z]*: Rebuilding administrative file database"
11554
11555	  cd ../..
11556	  rm -r 1
11557	  rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
11558	  ;;
11559
11560	toplevel2)
11561	  # Similar to toplevel, but test the case where TopLevelAdmin=no.
11562
11563	  # First set the TopLevelAdmin setting.
11564	  mkdir 1; cd 1
11565	  dotest toplevel2-1a "${testcvs} -q co CVSROOT/config" \
11566"U CVSROOT/config"
11567	  cd CVSROOT
11568	  echo "TopLevelAdmin=no" >config
11569	  dotest toplevel2-1b "${testcvs} -q ci -m no-top-level" \
11570"Checking in config;
11571${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
11572new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11573done
11574${PROG} [a-z]*: Rebuilding administrative file database"
11575	  cd ../..
11576	  rm -r 1
11577
11578	  # Now set up some directories and subdirectories
11579	  mkdir 1; cd 1
11580	  dotest toplevel2-1 "${testcvs} -q co -l ." ''
11581	  mkdir top-dir second-dir
11582	  dotest toplevel2-2 "${testcvs} add top-dir second-dir" \
11583"Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
11584Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
11585	  cd top-dir
11586
11587	  touch file1
11588	  dotest toplevel2-3 "${testcvs} add file1" \
11589"${PROG} [a-z]*: scheduling file .file1. for addition
11590${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
11591	  dotest toplevel2-4 "${testcvs} -q ci -m add" \
11592"RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
11593done
11594Checking in file1;
11595${CVSROOT_DIRNAME}/top-dir/file1,v  <--  file1
11596initial revision: 1\.1
11597done"
11598	  cd ..
11599
11600	  cd second-dir
11601	  touch file2
11602	  dotest toplevel2-3s "${testcvs} add file2" \
11603"${PROG} [a-z]*: scheduling file .file2. for addition
11604${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
11605	  dotest toplevel2-4s "${testcvs} -q ci -m add" \
11606"RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
11607done
11608Checking in file2;
11609${CVSROOT_DIRNAME}/second-dir/file2,v  <--  file2
11610initial revision: 1\.1
11611done"
11612
11613	  cd ../..
11614	  rm -r 1; mkdir 1; cd 1
11615	  dotest toplevel2-5 "${testcvs} co top-dir" \
11616"${PROG} [a-z]*: Updating top-dir
11617U top-dir/file1"
11618
11619	  dotest toplevel2-6 "${testcvs} update top-dir" \
11620"${PROG} [a-z]*: Updating top-dir"
11621	  dotest toplevel2-7 "${testcvs} update"  \
11622"${PROG} [a-z]*: Updating top-dir"
11623
11624	  dotest toplevel2-8 "${testcvs} update -d top-dir" \
11625"${PROG} [a-z]*: Updating top-dir"
11626	  # Contrast this with toplevel-9, which has TopLevelAdmin=yes.
11627	  dotest toplevel2-9 "${testcvs} update -d" \
11628"${PROG} [a-z]*: Updating top-dir"
11629
11630	  cd ..
11631	  rm -r 1; mkdir 1; cd 1
11632	  dotest toplevel2-10 "${testcvs} co top-dir" \
11633"${PROG} [a-z]*: Updating top-dir
11634U top-dir/file1"
11635	  # This tests more or less the same thing, in a particularly
11636	  # "real life" example.  With TopLevelAdmin=yes, this command
11637	  # would give us second-dir and CVSROOT directories too.
11638	  dotest toplevel2-11 "${testcvs} -q update -d" ""
11639
11640	  dotest toplevel2-cleanup-1 "${testcvs} -q co CVSROOT/config" \
11641"U CVSROOT/config"
11642	  cd CVSROOT
11643	  echo "# empty file" >config
11644	  dotest toplevel2-cleanup-2 "${testcvs} -q ci -m toplevel2-cleanup" \
11645"Checking in config;
11646${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
11647new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
11648done
11649${PROG} [a-z]*: Rebuilding administrative file database"
11650	  cd ../..
11651	  rm -r 1
11652	  rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
11653	  ;;
11654
11655	mflag)
11656	  for message in '' ' ' '
11657           ' '    	  	test' ; do
11658	    # Set up
11659	    mkdir a-dir; cd a-dir
11660	    # Test handling of -m during import
11661	    echo testa >>test
11662	    if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
11663	        pass 156
11664	    else
11665		fail 156
11666	    fi
11667	    # Must import twice since the first time uses inline code that
11668	    # avoids RCS call.
11669	    echo testb >>test
11670	    if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
11671		pass 157
11672	    else
11673		fail 157
11674	    fi
11675	    # Test handling of -m during ci
11676	    cd ..; rm -r a-dir
11677	    if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
11678		pass 158
11679	    else
11680		fail 158
11681	    fi
11682	    cd a-dir
11683	    echo testc >>test
11684	    if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
11685		pass 159
11686	    else
11687		fail 159
11688	    fi
11689	    # Test handling of -m during rm/ci
11690	    rm test;
11691	    if ${testcvs} rm test >>${LOGFILE} 2>&1; then
11692		pass 160
11693	    else
11694		fail 160
11695	    fi
11696	    if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
11697		pass 161
11698	    else
11699		fail 161
11700	    fi
11701	    # Clean up
11702	    cd ..
11703	    rm -r a-dir
11704	    rm -rf ${CVSROOT_DIRNAME}/a-dir
11705	  done
11706	  ;;
11707
11708	editor)
11709	  # More tests of log messages, in this case the ability to
11710	  # run an external editor.
11711	  # TODO:
11712	  #   * also test $EDITOR, $CVSEDITOR, &c.
11713	  #   * test what happens if up-to-date check fails.
11714
11715	  # Our "editor" puts "x" at the start of each line, so we
11716	  # can see the "CVS:" lines.
11717	  cat >${TESTDIR}/editme <<EOF
11718#!${TESTSHELL}
11719sleep 1
11720sed <\$1 -e 's/^/x/' >${TESTDIR}/edit.new
11721mv ${TESTDIR}/edit.new \$1
11722exit 0
11723EOF
11724	  chmod +x ${TESTDIR}/editme
11725
11726	  mkdir 1; cd 1
11727	  dotest editor-1 "${testcvs} -q co -l ." ''
11728	  mkdir first-dir
11729	  dotest editor-2 "${testcvs} add first-dir" \
11730"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11731	  cd first-dir
11732	  touch file1 file2
11733	  dotest editor-3 "${testcvs} add file1 file2" \
11734"${PROG} [a-z]*: scheduling file .file1. for addition
11735${PROG} [a-z]*: scheduling file .file2. for addition
11736${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
11737	  dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
11738"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11739done
11740Checking in file1;
11741${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11742initial revision: 1\.1
11743done
11744RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
11745done
11746Checking in file2;
11747${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11748initial revision: 1\.1
11749done"
11750	  dotest editor-5 "${testcvs} -q tag -b br" "T file1
11751T file2"
11752	  dotest editor-6 "${testcvs} -q update -r br" ''
11753	  echo modify >>file1
11754	  dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
11755"Checking in file1;
11756${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11757new revision: 1\.1\.2\.1; previous revision: 1\.1
11758done"
11759	  # OK, now we want to make sure "ci -r" puts in the branch
11760	  # where appropriate.  Note that we can check in on the branch
11761	  # without being on the branch, because there is not a revision
11762	  # already on the branch.  If there were a revision on the branch,
11763	  # CVS would correctly give an up-to-date check failed.
11764	  dotest editor-8 "${testcvs} -q update -A" "U file1"
11765	  echo add a line >>file2
11766	  dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
11767"Checking in file2;
11768${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
11769new revision: 1\.1\.2\.1; previous revision: 1\.1
11770done"
11771
11772	  dotest editor-log-file1 "${testcvs} log -N file1" "
11773RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11774Working file: file1
11775head: 1\.1
11776branch:
11777locks: strict
11778access list:
11779keyword substitution: kv
11780total revisions: 2;	selected revisions: 2
11781description:
11782----------------------------
11783revision 1\.1
11784date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
11785branches:  1\.1\.2;
11786xCVS: ----------------------------------------------------------------------
11787xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11788xCVS:
11789xCVS: Committing in .
11790xCVS:
11791xCVS: Added Files:
11792xCVS: 	file1 file2
11793xCVS: ----------------------------------------------------------------------
11794----------------------------
11795revision 1\.1\.2\.1
11796date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
11797xCVS: ----------------------------------------------------------------------
11798xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11799xCVS:
11800xCVS: Committing in .
11801xCVS:
11802xCVS: Modified Files:
11803xCVS:  Tag: br
11804xCVS: 	file1
11805xCVS: ----------------------------------------------------------------------
11806============================================================================="
11807
11808	  # The only difference between the two expect strings is the
11809	  # presence or absence of "Committing in ." for 1.1.2.1.
11810	  dotest editor-log-file2 "${testcvs} log -N file2" "
11811RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
11812Working file: file2
11813head: 1\.1
11814branch:
11815locks: strict
11816access list:
11817keyword substitution: kv
11818total revisions: 2;	selected revisions: 2
11819description:
11820----------------------------
11821revision 1\.1
11822date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
11823branches:  1\.1\.2;
11824xCVS: ----------------------------------------------------------------------
11825xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11826xCVS:
11827xCVS: Committing in .
11828xCVS:
11829xCVS: Added Files:
11830xCVS: 	file1 file2
11831xCVS: ----------------------------------------------------------------------
11832----------------------------
11833revision 1\.1\.2\.1
11834date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
11835xCVS: ----------------------------------------------------------------------
11836xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11837xCVS:
11838xCVS: Modified Files:
11839xCVS:  Tag: br
11840xCVS: 	file2
11841xCVS: ----------------------------------------------------------------------
11842=============================================================================" "
11843RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
11844Working file: file2
11845head: 1\.1
11846branch:
11847locks: strict
11848access list:
11849keyword substitution: kv
11850total revisions: 2;	selected revisions: 2
11851description:
11852----------------------------
11853revision 1\.1
11854date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
11855branches:  1\.1\.2;
11856xCVS: ----------------------------------------------------------------------
11857xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11858xCVS:
11859xCVS: Committing in .
11860xCVS:
11861xCVS: Added Files:
11862xCVS: 	file1 file2
11863xCVS: ----------------------------------------------------------------------
11864----------------------------
11865revision 1\.1\.2\.1
11866date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
11867xCVS: ----------------------------------------------------------------------
11868xCVS: Enter Log.  Lines beginning with .CVS:. are removed automatically
11869xCVS:
11870xCVS: Committing in .
11871xCVS:
11872xCVS: Modified Files:
11873xCVS:  Tag: br
11874xCVS: 	file2
11875xCVS: ----------------------------------------------------------------------
11876============================================================================="
11877	  cd ../..
11878	  rm -r 1
11879	  rm ${TESTDIR}/editme
11880	  rm -rf ${CVSROOT_DIRNAME}/first-dir
11881	  ;;
11882
11883	errmsg1)
11884	  mkdir ${CVSROOT_DIRNAME}/1dir
11885	  mkdir 1
11886	  cd 1
11887	  if ${testcvs} -q co 1dir; then
11888	      pass 162
11889	  else
11890	      fail 162
11891	  fi
11892	  cd 1dir
11893	  touch foo
11894	  if ${testcvs} add foo 2>>${LOGFILE}; then
11895	      pass 163
11896	  else
11897	      fail 163
11898	  fi
11899	  if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
11900	      pass 164
11901	  else
11902	      fail 164
11903	  fi
11904	  cd ../..
11905	  mkdir 2
11906	  cd 2
11907	  if ${testcvs} -q co 1dir >>${LOGFILE}; then
11908	      pass 165
11909	  else
11910	      fail 165
11911	  fi
11912	  chmod a-w 1dir
11913	  cd ../1/1dir
11914	  rm foo;
11915	  if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
11916	      pass 166
11917	  else
11918	      fail 166
11919	  fi
11920	  if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
11921	      pass 167
11922	  else
11923	      fail 167
11924	  fi
11925
11926	  cd ../../2/1dir
11927	  dotest 168 "${testcvs} -q update" \
11928"${PROG} [a-z]*: foo is no longer in the repository
11929${PROG} update: unable to remove foo: Permission denied" \
11930"${PROG} [a-z]*: foo is no longer in the repository
11931${PROG} update: unable to remove \./foo: Permission denied"
11932
11933	  cd ..
11934	  chmod u+w 1dir
11935	  cd ..
11936	  rm -r 1 2
11937	  rm -rf ${CVSROOT_DIRNAME}/1dir
11938	  ;;
11939
11940	errmsg2)
11941	  # More tests of various miscellaneous error handling,
11942	  # and cvs add behavior in general.
11943	  # See also test basicb-4a, concerning "cvs ci CVS".
11944	  # Too many tests to mention test the simple cases of
11945	  # adding files and directories.
11946	  # Test basicb-2a10 tests cvs -n add.
11947
11948	  # First the usual setup; create a directory first-dir.
11949	  mkdir 1; cd 1
11950	  dotest errmsg2-1 "${testcvs} -q co -l ." ''
11951	  mkdir first-dir
11952	  dotest errmsg2-2 "${testcvs} add first-dir" \
11953"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
11954          cd first-dir
11955	  dotest_fail errmsg2-3 "${testcvs} add CVS" \
11956"${PROG} [a-z]*: cannot add special file .CVS.; skipping"
11957	  touch file1
11958	  # For the most part add returns a failure exitstatus if
11959	  # there are any errors, even if the remaining files are
11960	  # processed without incident.  The "cannot add
11961	  # special file" message fits this pattern, at
11962	  # least currently.
11963	  dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
11964"${PROG} [a-z]*: cannot add special file .CVS.; skipping
11965${PROG} [a-z]*: scheduling file .file1. for addition
11966${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
11967	  # I'm not sure these tests completely convey the various strange
11968	  # behaviors that CVS had before it specially checked for "." and
11969	  # "..".  Suffice it to say that these are unlikely to work right
11970	  # without a special case.
11971	  dotest_fail errmsg2-5 "${testcvs} add ." \
11972"${PROG} [a-z]*: cannot add special file .\..; skipping"
11973	  dotest_fail errmsg2-6 "${testcvs} add .." \
11974"${PROG} [a-z]*: cannot add special file .\.\..; skipping"
11975	  # Make sure that none of the error messages left droppings
11976	  # which interfere with normal operation.
11977	  dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
11978"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
11979done
11980Checking in file1;
11981${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
11982initial revision: 1\.1
11983done"
11984	  mkdir sdir
11985	  cd ..
11986	  dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
11987"Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
11988	  # while we're here... check commit with no CVS directory
11989	  dotest_fail errmsg2-8a "${testcvs} -q ci first-dir nonexistant" \
11990"${PROG} [a-z]*: nothing known about .nonexistant'
11991${PROG} \[[a-z]* aborted\]: correct above errors first!"
11992	  dotest_fail errmsg2-8b "${testcvs} -q ci nonexistant first-dir" \
11993"${PROG} [a-z]*: nothing known about .nonexistant'
11994${PROG} \[[a-z]* aborted\]: correct above errors first!"
11995	  dotest errmsg2-8c "${testcvs} -q ci first-dir" ""
11996
11997	  cd first-dir
11998
11999	  touch file10
12000	  mkdir sdir10
12001	  dotest errmsg2-10 "${testcvs} add file10 sdir10" \
12002"${PROG} [a-z]*: scheduling file .file10. for addition
12003Directory ${CVSROOT_DIRNAME}/first-dir/sdir10 added to the repository
12004${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12005	  dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
12006"RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
12007done
12008Checking in file10;
12009${CVSROOT_DIRNAME}/first-dir/file10,v  <--  file10
12010initial revision: 1\.1
12011done"
12012	  # Try to see that there are no droppings left by
12013	  # any of the previous tests.
12014	  dotest errmsg2-12 "${testcvs} -q update" ""
12015
12016	  # Now test adding files with '/' in the name, both one level
12017	  # down and more than one level down.
12018	  cd ..
12019	  mkdir first-dir/sdir10/ssdir
12020	  dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
12021"Directory ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir added to the repository"
12022
12023	  touch first-dir/sdir10/ssdir/ssfile
12024	  dotest errmsg2-14 \
12025	    "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
12026"${PROG} [a-z]*: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
12027${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12028	  touch first-dir/file15
12029	  dotest errmsg2-15 "${testcvs} add first-dir/file15" \
12030"${PROG} [a-z]*: scheduling file .first-dir/file15. for addition
12031${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12032
12033	  # Now the case where we try to give it a directory which is not
12034	  # under CVS control.
12035	  mkdir bogus-dir
12036	  touch bogus-dir/file16
12037	  # The first message, from local CVS, is nice.  The second one
12038	  # is not nice; would be good to fix remote CVS to give a clearer
12039	  # message (e.g. the one from local CVS).  But at least it is an
12040	  # error message.
12041	  dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
12042"${PROG} [a-z]*: in directory bogus-dir:
12043${PROG} \[[a-z]* aborted\]: there is no version here; do .${PROG} checkout. first" \
12044"${PROG} [a-z]*: cannot open CVS/Entries for reading: No such file or directory
12045${PROG} \[add aborted\]: no repository"
12046	  rm -r bogus-dir
12047
12048	  # One error condition we don't test for is trying to add a file
12049	  # or directory which already is there.
12050
12051	  dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
12052"RCS file: ${CVSROOT_DIRNAME}/first-dir/file15,v
12053done
12054Checking in first-dir/file15;
12055${CVSROOT_DIRNAME}/first-dir/file15,v  <--  file15
12056initial revision: 1\.1
12057done
12058RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v
12059done
12060Checking in first-dir/sdir10/ssdir/ssfile;
12061${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v  <--  ssfile
12062initial revision: 1\.1
12063done"
12064	  dotest errmsg2-18 "${testcvs} -Q tag test" ''
12065
12066	  # trying to import the repository
12067
12068	  if $remote; then :; else
12069	    cd ${CVSROOT_DIRNAME}
12070	    dotest_fail errmsg2-20 "${testcvs} import -mtest . A B" \
12071"${PROG} \[[a-z]* aborted\]: attempt to import the repository"
12072	    dotest_fail errmsg2-21 "${testcvs} import -mtest first-dir A B" \
12073"${PROG} \[[a-z]* aborted\]: attempt to import the repository"
12074	  fi
12075
12076	  cd ..
12077	  rm -r 1
12078	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12079	  ;;
12080
12081	adderrmsg)
12082	  # Test some of the error messages the 'add' command can return and
12083	  # their reactions to '-q'.
12084
12085	  # First the usual setup; create a directory first-dir.
12086	  mkdir 1; cd 1
12087	  dotest adderrmsg-init1 "${testcvs} -q co -l ." ''
12088	  mkdir adderrmsg-dir
12089	  dotest adderrmsg-init2 "${testcvs} add adderrmsg-dir" \
12090"Directory ${CVSROOT_DIRNAME}/adderrmsg-dir added to the repository"
12091          cd adderrmsg-dir
12092
12093	  # try to add the admin dir
12094	  dotest_fail adderrmsg-1 "${testcvs} add CVS" \
12095"${PROG} [a-z]*: cannot add special file .CVS.; skipping"
12096	  # might not want to see this message when you 'cvs add *'
12097	  dotest_fail adderrmsg-2 "${testcvs} -q add CVS" ""
12098
12099	  # to test some other messages
12100	  touch file1
12101	  dotest adderrmsg-3 "${testcvs} add file1" \
12102"${PROG} [a-z]*: scheduling file .file1. for addition
12103${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12104
12105	  # add it twice
12106	  dotest_fail adderrmsg-4 "${testcvs} add file1" \
12107"${PROG} [a-z]*: file1 has already been entered"
12108	  dotest_fail adderrmsg-5 "${testcvs} -q add file1" ""
12109
12110	  dotest adderrmsg-6 "${testcvs} -q ci -madd" \
12111"RCS file: ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v
12112done
12113Checking in file1;
12114${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v  <--  file1
12115initial revision: 1\.1
12116done"
12117
12118	  # file in Entries & repository
12119	  dotest_fail adderrmsg-7 "${testcvs} add file1" \
12120"${PROG} [a-z]*: file1 already exists, with version number 1\.1"
12121	  dotest_fail adderrmsg-8 "${testcvs} -q add file1" ""
12122
12123	  # clean up
12124	  cd ../..
12125	  if $keep; then :; else
12126	      rm -r 1
12127	      rm -rf ${CVSROOT_DIRNAME}/adderrmsg-dir
12128	  fi
12129	  ;;
12130
12131	devcom)
12132	  mkdir ${CVSROOT_DIRNAME}/first-dir
12133	  mkdir 1
12134	  cd 1
12135	  if ${testcvs} -q co first-dir >>${LOGFILE} ; then
12136	      pass 169
12137	  else
12138	      fail 169
12139	  fi
12140
12141	  cd first-dir
12142	  echo abb >abb
12143	  if ${testcvs} add abb 2>>${LOGFILE}; then
12144	      pass 170
12145	  else
12146	      fail 170
12147	  fi
12148	  if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
12149	      pass 171
12150	  else
12151	      fail 171
12152	  fi
12153	  dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}"
12154	  if ${testcvs} watch on; then
12155	      pass 172
12156	  else
12157	      fail 172
12158	  fi
12159	  echo abc >abc
12160	  if ${testcvs} add abc 2>>${LOGFILE}; then
12161	      pass 173
12162	  else
12163	      fail 173
12164	  fi
12165	  if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
12166	      pass 174
12167	  else
12168	      fail 174
12169	  fi
12170
12171	  cd ../..
12172	  mkdir 2
12173	  cd 2
12174
12175	  if ${testcvs} -q co first-dir >>${LOGFILE}; then
12176	      pass 175
12177	  else
12178	      fail 175
12179	  fi
12180	  cd first-dir
12181	  if test -w abb; then
12182	      fail 176
12183	  else
12184	      pass 176
12185	  fi
12186	  if test -w abc; then
12187	      fail 177
12188	  else
12189	      pass 177
12190	  fi
12191
12192	  dotest devcom-178 "${testcvs} editors" ""
12193
12194	  if ${testcvs} edit abb; then
12195	      pass 179
12196	  else
12197	      fail 179
12198	  fi
12199
12200	  # Here we test for the traditional ISO C ctime() date format.
12201	  # We assume the C locale; I guess that works provided we set
12202	  # LC_ALL at the start of this script but whether these
12203	  # strings should vary based on locale does not strike me as
12204	  # self-evident.
12205	  dotest devcom-180 "${testcvs} editors" \
12206"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"
12207
12208	  echo aaaa >>abb
12209	  if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then
12210	      pass 182
12211	  else
12212	      fail 182
12213	  fi
12214	  # Unedit of a file not being edited should be a noop.
12215	  dotest 182.5 "${testcvs} unedit abb" ''
12216
12217	  dotest devcom-183 "${testcvs} editors" ""
12218
12219	  if test -w abb; then
12220	      fail 185
12221	  else
12222	      pass 185
12223	  fi
12224
12225	  if ${testcvs} edit abc; then
12226	      pass 186a1
12227	  else
12228	      fail 186a1
12229	  fi
12230	  # Unedit of an unmodified file.
12231	  if ${testcvs} unedit abc; then
12232	      pass 186a2
12233	  else
12234	      fail 186a2
12235	  fi
12236	  if ${testcvs} edit abc; then
12237	      pass 186a3
12238	  else
12239	      fail 186a3
12240	  fi
12241	  echo changedabc >abc
12242	  # Try to unedit a modified file; cvs should ask for confirmation
12243	  if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then
12244	      pass 186a4
12245	  else
12246	      fail 186a4
12247	  fi
12248	  if echo changedabc | cmp - abc; then
12249	      pass 186a5
12250	  else
12251	      fail 186a5
12252	  fi
12253	  # OK, now confirm the unedit
12254	  if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then
12255	      pass 186a6
12256	  else
12257	      fail 186a6
12258	  fi
12259	  if echo abc | cmp - abc; then
12260	      pass 186a7
12261	  else
12262	      fail 186a7
12263	  fi
12264
12265	  dotest devcom-a0 "${testcvs} watchers" ''
12266
12267	  # FIXME: This probably should be an error message instead
12268	  # of silently succeeding and printing nothing.
12269	  dotest devcom-a-nonexist "${testcvs} watchers nonexist" ''
12270
12271	  dotest devcom-a1 "${testcvs} watch add" ''
12272	  dotest devcom-a2 "${testcvs} watchers" \
12273"abb	${username}	edit	unedit	commit
12274abc	${username}	edit	unedit	commit"
12275	  dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
12276	  dotest devcom-a4 "${testcvs} watchers abb" \
12277"abb	${username}	edit	commit"
12278
12279	  # Check tagging and checking out while we have a CVS
12280	  # directory in the repository.
12281	  dotest devcom-t0 "${testcvs} -q tag tag" \
12282'T abb
12283T abc'
12284	  cd ../..
12285	  mkdir 3
12286	  cd 3
12287
12288	  # Test commented out because the bug it tests for is not fixed
12289	  # The error is:
12290	  # cvs watchers: cannot open CVS/Entries for reading: No such file or directory
12291	  # cvs: ../../work/ccvs/src/fileattr.c:75: fileattr_read: Assertion `fileattr_stored_repos != ((void *)0)' failed.
12292:	  dotest devcom-t-nonexist "${testcvs} watchers nonexist" fixme
12293
12294	  dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
12295'U first-dir/abb'
12296	  cd ..
12297	  # Since first-dir/abb is readonly, use -f.
12298	  rm -rf 3
12299
12300	  # Test checking out the directory rather than the file.
12301	  mkdir 3
12302	  cd 3
12303	  dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
12304'U first-dir/abb
12305U first-dir/abc'
12306	  cd ..
12307	  # Since the files are readonly, use -f.
12308	  rm -rf 3
12309
12310	  # Now do it again, after removing the val-tags file created
12311	  # by devcom-t1 to force CVS to search the repository
12312	  # containing CVS directories.
12313	  rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags
12314	  mkdir 3
12315	  cd 3
12316	  dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
12317'U first-dir/abb
12318U first-dir/abc'
12319	  cd ..
12320	  # Since the files are readonly, use -f.
12321	  rm -rf 3
12322
12323	  # Now remove all the file attributes
12324	  cd 2/first-dir
12325	  dotest devcom-b0 "${testcvs} watch off" ''
12326	  dotest devcom-b1 "${testcvs} watch remove" ''
12327	  # Test that CVS 1.6 and earlier can handle the repository.
12328	  dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
12329
12330	  # Now test watching just some, not all, files.
12331	  dotest devcom-some0 "${testcvs} watch on abc" ''
12332	  cd ../..
12333	  mkdir 3
12334	  cd 3
12335	  dotest devcom-some1 "${testcvs} -q co first-dir" 'U first-dir/abb
12336U first-dir/abc'
12337	  dotest devcom-some2 "test -w first-dir/abb" ''
12338	  dotest_fail devcom-some3 "test -w first-dir/abc" ''
12339	  cd ..
12340
12341	  if $keep; then
12342	    echo Keeping ${TESTDIR} and exiting due to --keep
12343	    exit 0
12344	  fi
12345
12346	  # Use -f because of the readonly files.
12347	  rm -rf 1 2 3
12348	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12349	  ;;
12350
12351	devcom2)
12352	  # More watch tests, most notably setting watches on
12353	  # files in various different states.
12354	  mkdir ${CVSROOT_DIRNAME}/first-dir
12355	  mkdir 1
12356	  cd 1
12357	  dotest devcom2-1 "${testcvs} -q co first-dir" ''
12358	  cd first-dir
12359
12360	  # This should probably be an error; setting a watch on a totally
12361	  # unknown file is more likely to be a typo than intentional.
12362	  # But that isn't the currently implemented behavior.
12363	  dotest devcom2-2 "${testcvs} watch on w1" ''
12364
12365	  touch w1 w2 w3 nw1
12366	  dotest devcom2-3 "${testcvs} add w1 w2 w3 nw1" "${DOTSTAR}"
12367	  # Letting the user set the watch here probably can be considered
12368	  # a feature--although it leads to a few potentially strange
12369	  # consequences like one user can set the watch and another actually
12370	  # adds the file.
12371	  dotest devcom2-4 "${testcvs} watch on w2" ''
12372	  dotest devcom2-5 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
12373
12374	  # Note that this test differs in a subtle way from devcom-some0;
12375	  # in devcom-some0 the watch is creating a new fileattr file, and
12376	  # here we are modifying an existing one.
12377	  dotest devcom2-6 "${testcvs} watch on w3" ''
12378
12379	  # Now test that all the watches got set on the correct files
12380	  # FIXME: CVS should have a way to report whether watches are
12381	  # set, I think.  The "check it out and see if it read-only" is
12382	  # sort of OK, but is complicated by CVSREAD and doesn't help
12383	  # if the file is added and not yet committed or some such.
12384	  # Probably "cvs status" should report "watch: on" if watch is on
12385	  # (and nothing if watch is off, so existing behavior is preserved).
12386	  cd ../..
12387	  mkdir 2
12388	  cd 2
12389	  dotest devcom2-7 "${testcvs} -q co first-dir" 'U first-dir/nw1
12390U first-dir/w1
12391U first-dir/w2
12392U first-dir/w3'
12393	  dotest devcom2-8 "test -w first-dir/nw1" ''
12394	  dotest_fail devcom2-9 "test -w first-dir/w1" ''
12395	  dotest_fail devcom2-10 "test -w first-dir/w2" ''
12396	  dotest_fail devcom2-11 "test -w first-dir/w3" ''
12397
12398	  cd first-dir
12399	  # OK, now we want to try files in various states with cvs edit.
12400	  dotest devcom2-12 "${testcvs} edit w4" \
12401"${PROG} edit: no such file w4; ignored"
12402	  # Try the same thing with a per-directory watch set.
12403	  dotest devcom2-13 "${testcvs} watch on" ''
12404	  dotest devcom2-14 "${testcvs} edit w5" \
12405"${PROG} edit: no such file w5; ignored"
12406	  dotest devcom2-15 "${testcvs} editors" ''
12407	  dotest devcom2-16 "${testcvs} editors w4" ''
12408	  # Make sure there are no droppings lying around
12409	  dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
12410"Fw1	_watched=
12411Fw2	_watched=
12412Fw3	_watched=
12413Fnw1	_watched=
12414D	_watched="
12415	  cd ..
12416
12417	  # Do a little error testing
12418	  dotest devcom2-18 "${testcvs} -q co -d first+dir first-dir" \
12419"U first${PLUS}dir/nw1
12420U first${PLUS}dir/w1
12421U first${PLUS}dir/w2
12422U first${PLUS}dir/w3"
12423	  cd first+dir
12424	  dotest_fail devcom2-19 "${testcvs} edit" \
12425"${PROG} \[[a-z]* aborted\]: current directory (${TESTDIR}/2/first${PLUS}dir) contains an invalid character (${PLUS},>;=\\\\t\\\\n)"
12426
12427	  # Make sure there are no droppings lying around
12428	  dotest devcom2-20 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
12429"Fw1	_watched=
12430Fw2	_watched=
12431Fw3	_watched=
12432Fnw1	_watched=
12433D	_watched="
12434
12435	  cd ../..
12436
12437	  # Use -f because of the readonly files.
12438	  rm -rf 1 2
12439	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12440	  ;;
12441
12442	devcom3)
12443	  # More watch tests, most notably handling of features designed
12444	  # for future expansion.
12445	  mkdir ${CVSROOT_DIRNAME}/first-dir
12446	  mkdir 1
12447	  cd 1
12448	  dotest devcom3-1 "${testcvs} -q co first-dir" ''
12449	  cd first-dir
12450
12451	  touch w1 w2
12452	  dotest devcom3-2 "${testcvs} add w1 w2" "${DOTSTAR}"
12453	  dotest devcom3-3 "${testcvs} watch on w1 w2" ''
12454	  dotest devcom3-4 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
12455
12456	  # OK, since we are about to delve into CVS's internals, make
12457	  # sure that we seem to be correct about how they work.
12458	  dotest devcom3-5 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
12459"Fw1	_watched=
12460Fw2	_watched="
12461	  # Now write a few more lines, just as if we were a newer version
12462	  # of CVS implementing some new feature.
12463	  cat <<'EOF' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
12464Enew	line	here
12465G@#$^!@#=&
12466EOF
12467	  # Now get CVS to write to the fileattr file....
12468	  dotest devcom3-6 "${testcvs} watch off w1" ''
12469	  # ...and make sure that it hasn't clobbered our new lines.
12470	  # Note that writing these lines in another order would be OK
12471	  # too.
12472	  dotest devcom3-7 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
12473"Fw2	_watched=
12474G@#..!@#=&
12475Enew	line	here"
12476
12477	  # See what CVS does when a file name is duplicated.  The
12478	  # behavior of all versions of CVS since file attributes were
12479	  # implemented is that it nukes the duplications.  This seems
12480	  # reasonable enough, although it means it isn't clear how
12481	  # useful duplicates would be for purposes of future
12482	  # expansion.  But in the interests of keeping behaviors
12483	  # predictable, might as well test for it, I guess.
12484	  echo 'Fw2	duplicate=' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
12485	  dotest devcom3-8 "${testcvs} watch on w1" ''
12486	  dotest devcom3-9 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
12487"Fw2	_watched=
12488Fw1	_watched=
12489Enew	line	here
12490G@#..!@#=&"
12491
12492	  # Now test disconnected "cvs edit" and the format of the
12493	  # CVS/Notify file.
12494	  if $remote; then
12495	    CVS_SERVER_SAVED=${CVS_SERVER}
12496	    CVS_SERVER=${TESTDIR}/cvs-none; export CVS_SERVER
12497
12498	    # The ${DOTSTAR} matches the exact exec error message
12499	    # (which varies) and either "end of file from server"
12500	    # (if the process doing the exec exits before the parent
12501	    # gets around to sending data to it) or "broken pipe" (if it
12502	    # is the other way around).
12503	    dotest_fail devcom3-9ar "${testcvs} edit w1" \
12504"${PROG} \[edit aborted\]: cannot exec ${TESTDIR}/cvs-none: ${DOTSTAR}"
12505	    dotest devcom3-9br "test -w w1" ""
12506	    dotest devcom3-9cr "cat CVS/Notify" \
12507"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"
12508	    CVS_SERVER=${CVS_SERVER_SAVED}; export CVS_SERVER
12509	    dotest devcom3-9dr "${testcvs} -q update" ""
12510	    dotest_fail devcom3-9er "test -f CVS/Notify" ""
12511	    dotest devcom3-9fr "${testcvs} watchers w1" \
12512"w1	${username}	tedit	tunedit	tcommit"
12513	    dotest devcom3-9gr "${testcvs} unedit w1" ""
12514	    dotest devcom3-9hr "${testcvs} watchers w1" ""
12515	  fi
12516
12517	  cd ../..
12518	  # OK, now change the tab to a space, and see that CVS gives
12519	  # a reasonable error (this is database corruption but CVS should
12520	  # not lose its mind).
12521	  sed -e 's/Fw2	/Fw2 /' <${CVSROOT_DIRNAME}/first-dir/CVS/fileattr \
12522	    >${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new
12523	  mv ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new \
12524	    ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
12525	  mkdir 2; cd 2
12526	  dotest_fail devcom3-10 "${testcvs} -Q co ." \
12527"${PROG} \[[a-z]* aborted\]: file attribute database corruption: tab missing in ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr"
12528	  cd ..
12529
12530	  # Use -f because of the readonly files.
12531	  rm -rf 1 2
12532	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12533	  ;;
12534
12535	watch4)
12536	  # More watch tests, including adding directories.
12537	  mkdir 1; cd 1
12538	  dotest watch4-0a "${testcvs} -q co -l ." ''
12539	  mkdir first-dir
12540	  dotest watch4-0b "${testcvs} add first-dir" \
12541"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
12542
12543	  cd first-dir
12544	  dotest watch4-1 "${testcvs} watch on" ''
12545	  # This is just like the 173 test
12546	  touch file1
12547	  dotest watch4-2 "${testcvs} add file1" \
12548"${PROG} [a-z]*: scheduling file .file1. for addition
12549${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12550	  dotest watch4-3 "${testcvs} -q ci -m add" \
12551"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12552done
12553Checking in file1;
12554${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12555initial revision: 1\.1
12556done"
12557	  # Now test the analogous behavior for directories.
12558	  mkdir subdir
12559	  dotest watch4-4 "${testcvs} add subdir" \
12560"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
12561	  cd subdir
12562	  touch sfile
12563	  dotest watch4-5 "${testcvs} add sfile" \
12564"${PROG} [a-z]*: scheduling file .sfile. for addition
12565${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12566	  dotest watch4-6 "${testcvs} -q ci -m add" \
12567"RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
12568done
12569Checking in sfile;
12570${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v  <--  sfile
12571initial revision: 1\.1
12572done"
12573	  cd ../../..
12574	  mkdir 2; cd 2
12575	  dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
12576U first-dir/subdir/sfile"
12577	  dotest_fail watch4-8 "test -w first-dir/file1" ''
12578	  dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
12579	  cd first-dir
12580	  dotest watch4-10 "${testcvs} edit file1" ''
12581	  echo 'edited in 2' >file1
12582	  cd ../..
12583
12584	  cd 1/first-dir
12585	  dotest watch4-11 "${testcvs} edit file1" ''
12586	  echo 'edited in 1' >file1
12587	  dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
12588"Checking in file1;
12589${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12590new revision: 1\.2; previous revision: 1\.1
12591done"
12592	  cd ../..
12593	  cd 2/first-dir
12594	  dotest watch4-13 "${testcvs} -q update" \
12595"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12596retrieving revision 1\.1
12597retrieving revision 1\.2
12598Merging differences between 1\.1 and 1\.2 into file1
12599rcsmerge: warning: conflicts during merge
12600${PROG} [a-z]*: conflicts found in file1
12601C file1"
12602	  if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
12603	    pass watch4-14
12604	  else
12605	    fail watch4-15
12606	  fi
12607	  # This could plausibly be defined to either go back to the revision
12608	  # which was cvs edit'd (the status quo), or back to revision 1.2
12609	  # (that is, the merge could update CVS/Base/file1).  We pick the
12610	  # former because it is easier to implement, not because we have
12611	  # thought much about which is better.
12612	  dotest watch4-16 "cat file1" ''
12613	  # Make sure CVS really thinks we are at 1.1.
12614	  dotest watch4-17 "${testcvs} -q update" "U file1"
12615	  dotest watch4-18 "cat file1" "edited in 1"
12616	  cd ../..
12617
12618	  # As a sanity check, make sure we are in the right place.
12619	  dotest watch4-cleanup-1 "test -d 1" ''
12620	  dotest watch4-cleanup-1 "test -d 2" ''
12621	  # Specify -f because of the readonly files.
12622	  rm -rf 1 2
12623	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12624	  ;;
12625
12626	watch5)
12627	  # This test was designed to catch a problem in server
12628	  # mode where an 'cvs edit'd file disappeared from the
12629	  # CVS/Base directory when 'cvs status' or 'cvs update'
12630	  # was called on the file after the file was touched.
12631	  #
12632	  # This test is still here to prevent the bug from
12633	  # being reintroduced.
12634	  #
12635	  # The rationale for having CVS/Base stay around is that
12636	  # CVS/Base should be there if "cvs edit" has been run (this
12637	  # may be helpful as a "cvs editors" analogue, it is
12638	  # client-side and based on working directory not username;
12639	  # but more importantly, it isn't clear why a "cvs status"
12640	  # would act like an unedit, and even if it does, it would
12641	  # need to make the file read-only again).
12642
12643	  mkdir watch5; cd watch5
12644	  dotest watch5-0a "${testcvs} -q co -l ." ''
12645	  mkdir first-dir
12646	  dotest watch5-0b "${testcvs} add first-dir" \
12647"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
12648
12649	  cd first-dir
12650	  dotest watch5-1 "${testcvs} watch on" ''
12651	  # This is just like the 173 test
12652	  touch file1
12653	  dotest watch5-2 "${testcvs} add file1" \
12654"${PROG} [a-z]*: scheduling file .file1. for addition
12655${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
12656	  dotest watch5-3 "${testcvs} -q ci -m add" \
12657"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
12658done
12659Checking in file1;
12660${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
12661initial revision: 1\.1
12662done"
12663	  dotest watch5-4 "${testcvs} edit file1" ''
12664	  dotest watch5-5 "test -f CVS/Base/file1" ''
12665	  if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
12666		pass watch5-6
12667	  else
12668		fail watch5-6
12669	  fi
12670	  dotest watch5-7 "test -f CVS/Base/file1" ''
12671
12672	  # Here's where the file used to dissappear
12673	  touch file1
12674	  if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
12675		pass watch5-8
12676	  else
12677		fail watch5-8
12678	  fi
12679	  dotest watch5-10 "test -f CVS/Base/file1" ''
12680
12681	  # Make sure update won't remove the file either
12682	  touch file1
12683	  dotest watch5-11 "${testcvs} -q up" ''
12684	  dotest watch5-12 "test -f CVS/Base/file1" ''
12685
12686	  cd ../..
12687	  rm -r watch5
12688	  rm -rf ${CVSROOT_DIRNAME}/first-dir
12689	  ;;
12690
12691	unedit-without-baserev)
12692	  mkdir 1; cd 1
12693	  module=x
12694
12695	  file=m
12696	  echo foo > $file
12697	  dotest unedit-without-baserev-1 \
12698	    "$testcvs -Q import -m . $module X Y" ''
12699	  dotest unedit-without-baserev-2 "$testcvs -Q co $module" ''
12700	  cd $module
12701
12702	  dotest unedit-without-baserev-3 "$testcvs -Q edit $file" ''
12703
12704	  echo add a line >> $file
12705	  rm -f CVS/Baserev
12706
12707	  # This will fail on most systems.
12708	  echo "yes" | dotest unedit-without-baserev-4 "${testcvs} -Q unedit $file" \
12709"m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
12710${PROG} unedit: run update to complete the unedit"
12711
12712	  # SunOS4.1.4 systems make it this far, but with a corrupted
12713	  # CVS/Entries file.  Demonstrate the corruption!
12714	  dotest unedit-without-baserev-5 "cat CVS/Entries" \
12715	    "/$file/1\.1\.1\.1/${DOTSTAR}"
12716
12717	  if $remote; then
12718	    dotest unedit-without-baserev-6r "${testcvs} -q update" "U m"
12719	  else
12720	    dotest unedit-without-baserev-6 "${testcvs} -q update" \
12721"${PROG} update: warning: m was lost
12722U m"
12723	  fi
12724
12725	  # OK, those were the easy cases.  Now tackle the hard one
12726	  # (the reason that CVS/Baserev was invented rather than just
12727	  # getting the revision from CVS/Entries).  This is very
12728	  # similar to watch4-10 through watch4-18 but with Baserev
12729	  # missing.
12730	  cd ../..
12731	  mkdir 2; cd 2
12732	  dotest unedit-without-baserev-7 "${testcvs} -Q co x" ''
12733	  cd x
12734
12735	  dotest unedit-without-baserev-10 "${testcvs} edit m" ''
12736	  echo 'edited in 2' >m
12737	  cd ../..
12738
12739	  cd 1/x
12740	  dotest unedit-without-baserev-11 "${testcvs} edit m" ''
12741	  echo 'edited in 1' >m
12742	  dotest unedit-without-baserev-12 "${testcvs} -q ci -m edit-in-1" \
12743"Checking in m;
12744${CVSROOT_DIRNAME}/x/m,v  <--  m
12745new revision: 1\.2; previous revision: 1\.1
12746done"
12747	  cd ../..
12748	  cd 2/x
12749	  dotest unedit-without-baserev-13 "${testcvs} -q update" \
12750"RCS file: ${CVSROOT_DIRNAME}/x/m,v
12751retrieving revision 1\.1\.1\.1
12752retrieving revision 1\.2
12753Merging differences between 1\.1\.1\.1 and 1\.2 into m
12754rcsmerge: warning: conflicts during merge
12755${PROG} [a-z]*: conflicts found in m
12756C m"
12757	  rm CVS/Baserev
12758	  echo yes | dotest unedit-without-baserev-14 "${testcvs} unedit m" \
12759"m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
12760${PROG} unedit: run update to complete the unedit"
12761	  if $remote; then
12762	    dotest unedit-without-baserev-15r "${testcvs} -q update" "U m"
12763	  else
12764	    dotest unedit-without-baserev-15 "${testcvs} -q update" \
12765"${PROG} update: warning: m was lost
12766U m"
12767	  fi
12768	  # The following tests are kind of degenerate compared with
12769	  # watch4-16 through watch4-18 but might as well make sure that
12770	  # nothing seriously wrong has happened to the working directory.
12771	  dotest unedit-without-baserev-16 "cat m" 'edited in 1'
12772	  # Make sure CVS really thinks we are at 1.2.
12773	  dotest unedit-without-baserev-17 "${testcvs} -q update" ""
12774	  dotest unedit-without-baserev-18 "cat m" "edited in 1"
12775
12776	  cd ../..
12777	  rm -rf 1
12778	  rm -r 2
12779	  rm -rf ${CVSROOT_DIRNAME}/$module
12780	  ;;
12781
12782	ignore)
12783	  # On Windows, we can't check out CVSROOT, because the case
12784	  # insensitivity means that this conflicts with cvsroot.
12785	  mkdir ignore
12786	  cd ignore
12787
12788	  dotest ignore-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
12789	  cd CVSROOT
12790	  echo rootig.c >cvsignore
12791	  dotest ignore-2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition
12792'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
12793
12794	  # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
12795	  # Accept either.
12796	  dotest ignore-3 " ${testcvs} ci -m added" \
12797"${PROG} [a-z]*: Examining \.
12798RCS file: ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v
12799done
12800Checking in cvsignore;
12801${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v  <--  cvsignore
12802initial revision: 1\.1
12803done
12804${PROG} [a-z]*: Rebuilding administrative file database"
12805
12806	  cd ..
12807	  if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
12808	      pass ignore-4
12809	  else
12810	      fail ignore-4
12811	  fi
12812
12813	  # CVS looks at the home dir from getpwuid, not HOME (is that correct
12814	  # behavior?), so this is hard to test and we won't try.
12815	  # echo foobar.c >${HOME}/.cvsignore
12816	  CVSIGNORE=envig.c; export CVSIGNORE
12817	  mkdir dir-to-import
12818	  cd dir-to-import
12819	  touch foobar.c bar.c rootig.c defig.o envig.c optig.c
12820	  # We use sort because we can't predict the order in which
12821	  # the files will be listed.
12822	  dotest_sort ignore-5 "${testcvs} import -m m -I optig.c ignore/first-dir tag1 tag2" \
12823'
12824
12825I ignore/first-dir/defig.o
12826I ignore/first-dir/envig.c
12827I ignore/first-dir/optig.c
12828I ignore/first-dir/rootig.c
12829N ignore/first-dir/bar.c
12830N ignore/first-dir/foobar.c
12831No conflicts created by this import'
12832	  dotest_sort ignore-6 "${testcvs} import -m m -I ! ignore/second-dir tag3 tag4" \
12833'
12834
12835N ignore/second-dir/bar.c
12836N ignore/second-dir/defig.o
12837N ignore/second-dir/envig.c
12838N ignore/second-dir/foobar.c
12839N ignore/second-dir/optig.c
12840N ignore/second-dir/rootig.c
12841No conflicts created by this import'
12842	  cd ..
12843	  rm -r dir-to-import
12844
12845	  mkdir 1
12846	  cd 1
12847	  dotest ignore-7 "${testcvs} -q co -dsecond-dir ignore/second-dir" \
12848'U second-dir/bar.c
12849U second-dir/defig.o
12850U second-dir/envig.c
12851U second-dir/foobar.c
12852U second-dir/optig.c
12853U second-dir/rootig.c'
12854	  dotest ignore-8 "${testcvs} -q co -dfirst-dir ignore/first-dir" 'U first-dir/bar.c
12855U first-dir/foobar.c'
12856	  cd first-dir
12857	  touch rootig.c defig.o envig.c optig.c notig.c
12858	  dotest ignore-9 "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
12859	  # The fact that CVS requires us to specify -I CVS here strikes me
12860	  # as a bug.
12861	  dotest_sort ignore-10 "${testcvs} -q update -I ! -I CVS" \
12862"${QUESTION} defig.o
12863${QUESTION} envig.c
12864${QUESTION} notig.c
12865${QUESTION} optig.c
12866${QUESTION} rootig.c"
12867
12868	  # Now test that commands other than update also print "? notig.c"
12869	  # where appropriate.  Only test this for remote, because local
12870	  # CVS only prints it on update.
12871	  rm optig.c
12872	  if $remote; then
12873	    dotest ignore-11r "${testcvs} -q diff" "${QUESTION} notig.c"
12874
12875	    # Force the server to be contacted.  Ugh.  Having CVS
12876	    # contact the server for the sole purpose of checking
12877	    # the CVSROOT/cvsignore file does not seem like such a
12878	    # good idea, so I imagine this will continue to be
12879	    # necessary.  Oh well, at least we test CVS's ablity to
12880	    # handle a file with a modified timestamp but unmodified
12881	    # contents.
12882	    touch bar.c
12883
12884	    dotest ignore-11r "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
12885	  fi
12886
12887	  # now test .cvsignore files
12888	  cd ..
12889	  echo notig.c >first-dir/.cvsignore
12890	  echo foobar.c >second-dir/.cvsignore
12891	  touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
12892	  dotest_sort ignore-12 "${testcvs} -qn update" \
12893"${QUESTION} first-dir/.cvsignore
12894${QUESTION} second-dir/.cvsignore
12895${QUESTION} second-dir/notig.c"
12896	  dotest_sort ignore-13 "${testcvs} -qn update -I! -I CVS" \
12897"${QUESTION} first-dir/.cvsignore
12898${QUESTION} first-dir/defig.o
12899${QUESTION} first-dir/envig.c
12900${QUESTION} first-dir/rootig.c
12901${QUESTION} second-dir/.cvsignore
12902${QUESTION} second-dir/notig.c"
12903
12904	  echo yes | dotest ignore-14 "${testcvs} release -d first-dir" \
12905"${QUESTION} \.cvsignore
12906You have \[0\] altered files in this repository.
12907Are you sure you want to release (and delete) directory .first-dir': "
12908
12909	  echo add a line >>second-dir/foobar.c
12910	  rm second-dir/notig.c second-dir/.cvsignore
12911	  echo yes | dotest ignore-15 "${testcvs} release -d second-dir" \
12912"M foobar.c
12913You have \[1\] altered files in this repository.
12914Are you sure you want to release (and delete) directory .second-dir': "
12915
12916	  cd ../..
12917	  if $keep; then :; else
12918	    rm -r ignore
12919	    rm -rf ${CVSROOT_DIRNAME}/ignore
12920	  fi
12921	  ;;
12922
12923	ignore-on-branch)
12924	  # Test that CVS _doesn't_ ignore files on branches because they were
12925	  # added to the trunk.
12926	  mkdir ignore-on-branch; cd ignore-on-branch
12927	  mkdir $CVSROOT_DIRNAME/ignore-on-branch
12928
12929	  # create file1 & file2 on trunk
12930	  dotest ignore-on-branch-setup-1 "$testcvs -q co -dsetup ignore-on-branch" ''
12931	  cd setup
12932	  echo file1 >file1
12933	  dotest ignore-on-branch-setup-2 "$testcvs -q add file1" \
12934"$PROG [a-z]*: use .cvs commit. to add this file permanently"
12935	  dotest ignore-on-branch-setup-3 "$testcvs -q ci -mfile1 file1" \
12936"RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file1,v
12937done
12938Checking in file1;
12939$CVSROOT_DIRNAME/ignore-on-branch/file1,v  <--  file1
12940initial revision: 1\.1
12941done"
12942	  dotest ignore-on-branch-setup-4 "$testcvs -q tag -b branch" 'T file1'
12943	  echo file2 >file2
12944	  dotest ignore-on-branch-setup-5 "$testcvs -q add file2" \
12945"$PROG [a-z]*: use .cvs commit. to add this file permanently"
12946	  dotest ignore-on-branch-setup-6 "$testcvs -q ci -mtrunk file2" \
12947"RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file2,v
12948done
12949Checking in file2;
12950$CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
12951initial revision: 1\.1
12952done"
12953
12954	  cd ..
12955
12956	  # Check out branch.
12957	  #
12958	  # - This was the original failure case - file2 would not be flagged
12959	  #   with a '?'
12960	  dotest ignore-on-branch-1 "$testcvs -q co -rbranch ignore-on-branch" \
12961'U ignore-on-branch/file1'
12962	  cd ignore-on-branch
12963	  echo file2 on branch >file2
12964	  dotest ignore-on-branch-2 "$testcvs -nq update" '? file2'
12965
12966	  # Now set up for a join.  One of the original fixes for this would
12967	  # print out a 'U' and a '?' during a join which added a file.
12968	  if $remote; then
12969	    dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" \
12970'? file2
12971T file1'
12972	  else
12973	    dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" 'T file1'
12974	  fi
12975	  dotest ignore-on-branch-4 "$testcvs -q add file2" \
12976"$PROG [a-z]*: use .cvs commit. to add this file permanently"
12977	  dotest ignore-on-branch-5 "$testcvs -q ci -mbranch file2" \
12978"Checking in file2;
12979$CVSROOT_DIRNAME/ignore-on-branch/file2,v  <--  file2
12980new revision: 1\.1\.2\.1; previous revision: 1\.1
12981done"
12982	  dotest ignore-on-branch-6 "$testcvs -q up -rbranch2" \
12983"$PROG [a-z]*: file2 is no longer in the repository"
12984	  dotest ignore-on-branch-7 "$testcvs -q up -jbranch" 'U file2'
12985
12986	  cd ../..
12987	  if $keep; then :; else
12988	    rm -r ignore-on-branch
12989	    rm -rf $CVSROOT_DIRNAME/ignore-on-branch
12990	  fi
12991	  ;;
12992
12993	binfiles)
12994	  # Test cvs's ability to handle binary files.
12995	  # List of binary file tests:
12996	  #   * conflicts, "cvs admin": binfiles
12997	  #   * branching and joining: binfiles2
12998	  #   * adding and removing files: binfiles3
12999	  #   * -k wrappers: binwrap, binwrap2, binwrap3
13000	  #   * "cvs import" and wrappers: binwrap, binwrap2, binwrap3
13001	  #   * -k option to "cvs import": none yet, as far as I know.
13002	  mkdir ${CVSROOT_DIRNAME}/first-dir
13003	  mkdir 1; cd 1
13004	  dotest binfiles-1 "${testcvs} -q co first-dir" ''
13005	  ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
13006	    </dev/null | ${TR} '@' '\000' >binfile.dat
13007	  cat binfile.dat binfile.dat >binfile2.dat
13008	  cd first-dir
13009	  cp ../binfile.dat binfile
13010	  dotest binfiles-2 "${testcvs} add -kb binfile" \
13011"${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition
13012'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
13013	  dotest binfiles-3 "${testcvs} -q ci -m add-it" \
13014"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
13015done
13016Checking in binfile;
13017${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
13018initial revision: 1\.1
13019done"
13020	  cd ../..
13021	  mkdir 2; cd 2
13022	  dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
13023	  cd first-dir
13024	  dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
13025	  # Testing that sticky options is -kb is the closest thing we have
13026	  # to testing that binary files work right on non-unix machines
13027	  # (until there is automated testing for such machines, of course).
13028	  dotest binfiles-5.5 "${testcvs} status binfile" \
13029"===================================================================
13030File: binfile          	Status: Up-to-date
13031
13032   Working revision:	1\.1.*
13033   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/binfile,v
13034   Sticky Tag:		(none)
13035   Sticky Date:		(none)
13036   Sticky Options:	-kb"
13037
13038	  # Test whether the default options from the RCS file are
13039	  # also used when operating on files instead of whole
13040	  # directories
13041          cd ../..
13042	  mkdir 3; cd 3
13043	  dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
13044'U first-dir/binfile'
13045	  cd first-dir
13046	  dotest binfiles-5.5b1 "${testcvs} status binfile" \
13047"===================================================================
13048File: binfile          	Status: Up-to-date
13049
13050   Working revision:	1\.1.*
13051   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/binfile,v
13052   Sticky Tag:		(none)
13053   Sticky Date:		(none)
13054   Sticky Options:	-kb"
13055	  cd ../..
13056	  rm -r 3
13057	  cd 2/first-dir
13058
13059	  cp ../../1/binfile2.dat binfile
13060	  dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
13061"Checking in binfile;
13062${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
13063new revision: 1\.2; previous revision: 1\.1
13064done"
13065	  cd ../../1/first-dir
13066	  dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
13067	  dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
13068
13069	  # Now test handling of conflicts with binary files.
13070	  cp ../binfile.dat binfile
13071	  dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
13072"Checking in binfile;
13073${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
13074new revision: 1\.3; previous revision: 1\.2
13075done"
13076	  cd ../../2/first-dir
13077	  echo 'edits in dir 2' >binfile
13078	  dotest binfiles-con1 "${testcvs} -q update" \
13079"U binfile
13080${PROG} [a-z]*: nonmergeable file needs merge
13081${PROG} [a-z]*: revision 1\.3 from repository is now in binfile
13082${PROG} [a-z]*: file from working directory is now in \.#binfile\.1\.2
13083C binfile"
13084	  dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
13085	  dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
13086
13087	  cp ../../1/binfile2.dat binfile
13088	  dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
13089"Checking in binfile;
13090${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
13091new revision: 1\.4; previous revision: 1\.3
13092done"
13093	  cd ../../1/first-dir
13094	  dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
13095
13096	  dotest binfiles-9 "${testcvs} -q update -A" ''
13097	  dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
13098	  dotest binfiles-11 "${testcvs} -q update" ''
13099	  dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
13100	  dotest binfiles-13 "${testcvs} -q update -A" ''
13101
13102	  cd ../..
13103
13104	  mkdir 3
13105	  cd 3
13106	  dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
13107'U first-dir/binfile'
13108	  cd first-dir
13109	  dotest binfiles-13a1 "${testcvs} status binfile" \
13110"===================================================================
13111File: binfile          	Status: Up-to-date
13112
13113   Working revision:	1\.4.*
13114   Repository revision:	1\.4	${CVSROOT_DIRNAME}/first-dir/binfile,v
13115   Sticky Tag:		HEAD (revision: 1\.4)
13116   Sticky Date:		(none)
13117   Sticky Options:	-kb"
13118	  cd ../..
13119	  rm -r 3
13120
13121	  cd 2/first-dir
13122	  echo 'this file is $''RCSfile$' >binfile
13123	  dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
13124"Checking in binfile;
13125${CVSROOT_DIRNAME}/first-dir/binfile,v  <--  binfile
13126new revision: 1\.5; previous revision: 1\.4
13127done"
13128	  dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
13129	  # See binfiles-5.5 for discussion of -kb.
13130	  dotest binfiles-14c "${testcvs} status binfile" \
13131"===================================================================
13132File: binfile          	Status: Up-to-date
13133
13134   Working revision:	1\.5.*
13135   Repository revision:	1\.5	${CVSROOT_DIRNAME}/first-dir/binfile,v
13136   Sticky Tag:		(none)
13137   Sticky Date:		(none)
13138   Sticky Options:	-kb"
13139	  dotest binfiles-14d "${testcvs} admin -kv binfile" \
13140"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
13141done"
13142	  # cvs admin doesn't change the checked-out file or its sticky
13143	  # kopts.  There probably should be a way which does (but
13144	  # what if the file is modified?  And do we try to version
13145	  # control the kopt setting?)
13146	  dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
13147	  dotest binfiles-14f "${testcvs} status binfile" \
13148"===================================================================
13149File: binfile          	Status: Up-to-date
13150
13151   Working revision:	1\.5.*
13152   Repository revision:	1\.5	${CVSROOT_DIRNAME}/first-dir/binfile,v
13153   Sticky Tag:		(none)
13154   Sticky Date:		(none)
13155   Sticky Options:	-kb"
13156	  dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
13157	  dotest binfiles-14h "cat binfile" 'this file is binfile,v'
13158	  dotest binfiles-14i "${testcvs} status binfile" \
13159"===================================================================
13160File: binfile          	Status: Up-to-date
13161
13162   Working revision:	1\.5.*
13163   Repository revision:	1\.5	${CVSROOT_DIRNAME}/first-dir/binfile,v
13164   Sticky Tag:		(none)
13165   Sticky Date:		(none)
13166   Sticky Options:	-kv"
13167
13168	  # Do sticky options work when used with 'cvs update'?
13169	  echo "Not a binary file." > nibfile
13170	  dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
13171"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
13172	  dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
13173	    "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
13174done
13175Checking in nibfile;
13176${CVSROOT_DIRNAME}/first-dir/nibfile,v  <--  nibfile
13177initial revision: 1\.1
13178done"
13179	  dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
13180	    '[UP] nibfile'
13181	  dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
13182"===================================================================
13183File: nibfile          	Status: Up-to-date
13184
13185   Working revision:	1\.1.*
13186   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/nibfile,v
13187   Sticky Tag:		(none)
13188   Sticky Date:		(none)
13189   Sticky Options:	-kb"
13190
13191	  # Now test that -A can clear the sticky option.
13192	  dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
13193"[UP] nibfile"
13194	  dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
13195"===================================================================
13196File: nibfile          	Status: Up-to-date
13197
13198   Working revision:	1\.1.*
13199   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/nibfile,v
13200   Sticky Tag:		(none)
13201   Sticky Date:		(none)
13202   Sticky Options:	(none)"
13203	  dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
13204"RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
13205done"
13206	  dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
13207	  dotest binfiles-17 "${testcvs} -q status nibfile" \
13208"===================================================================
13209File: nibfile          	Status: Up-to-date
13210
13211   Working revision:	1\.1.*
13212   Repository revision:	1\.1	${CVSROOT_DIRNAME}/first-dir/nibfile,v
13213   Sticky Tag:		(none)
13214   Sticky Date:		(none)
13215   Sticky Options:	-kb"
13216
13217	  dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
13218"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
13219deleting revision 1\.5
13220deleting revision 1\.4
13221done"
13222	  dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
13223"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
13224deleting revision 1\.2
13225deleting revision 1\.1
13226done"
13227	  dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
13228RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
13229Working file: binfile
13230head: 1\.3
13231branch:
13232locks: strict
13233access list:
13234keyword substitution: v
13235total revisions: 1
13236============================================================================="
13237
13238	  # Check that the contents were right.  This isn't the hard case
13239	  # (in which RCS_delete_revs does a diff), but might as well.
13240	  dotest binfiles-o4 "${testcvs} -q update binfile" "U binfile"
13241	  dotest binfiles-o5 "cmp binfile ../../1/binfile.dat" ""
13242
13243	  cd ../..
13244	  rm -rf ${CVSROOT_DIRNAME}/first-dir
13245	  rm -r 1
13246	  rm -r 2
13247	  ;;
13248
13249	binfiles2)
13250	  # Test cvs's ability to handle binary files, particularly branching
13251	  # and joining.  The key thing we are worrying about is that CVS
13252	  # doesn't print "cannot merge binary files" or some such, in
13253	  # situations where no merging is required.
13254	  # See also "join" which does this with non-binary files.
13255	  #
13256	  # Cases (we are merging from the branch to the trunk):
13257	  # binfile.dat) File added on branch, not on trunk.
13258	  #      File should be marked for addition.
13259	  # brmod) File modified on branch, not on trunk.
13260	  #      File should be copied over to trunk (no merging is needed).
13261	  # brmod-trmod) File modified on branch, also on trunk.
13262	  #      This is a conflict.  Present the user with both files and
13263	  #      let them figure it out.
13264	  # brmod-wdmod) File modified on branch, not modified in the trunk
13265	  #      repository, but modified in the (trunk) working directory.
13266	  #      This is also a conflict.
13267
13268	  mkdir ${CVSROOT_DIRNAME}/first-dir
13269	  mkdir 1; cd 1
13270	  dotest binfiles2-1 "${testcvs} -q co first-dir" ''
13271	  cd first-dir
13272
13273	  # The most important thing here is that binfile, binfile2, &c
13274	  # each be distinct from each other.  We also make sure to include
13275	  # a few likely end-of-line patterns to make sure nothing is
13276	  # being munged as if in text mode.
13277	  ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
13278	    </dev/null | ${TR} '@' '\000' >../binfile
13279	  cat ../binfile ../binfile >../binfile2
13280	  cat ../binfile2 ../binfile >../binfile3
13281
13282	  # FIXCVS: unless a branch has at least one file on it,
13283	  # tag_check_valid won't know it exists.  So if brmod didn't
13284	  # exist, we would have to invent it.
13285	  cp ../binfile brmod
13286	  cp ../binfile brmod-trmod
13287	  cp ../binfile brmod-wdmod
13288	  dotest binfiles2-1a \
13289"${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
13290"${PROG} [a-z]*: scheduling file .brmod. for addition
13291${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
13292${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
13293${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
13294	  dotest binfiles2-1b "${testcvs} -q ci -m add" \
13295"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
13296done
13297Checking in brmod;
13298${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13299initial revision: 1\.1
13300done
13301RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13302done
13303Checking in brmod-trmod;
13304${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13305initial revision: 1\.1
13306done
13307RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
13308done
13309Checking in brmod-wdmod;
13310${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13311initial revision: 1\.1
13312done"
13313	  dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
13314T brmod-trmod
13315T brmod-wdmod'
13316	  dotest binfiles2-3 "${testcvs} -q update -r br" ''
13317	  cp ../binfile binfile.dat
13318	  dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
13319"${PROG} [a-z]*: scheduling file .binfile\.dat. for addition on branch .br.
13320${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
13321	  cp ../binfile2 brmod
13322	  cp ../binfile2 brmod-trmod
13323	  cp ../binfile2 brmod-wdmod
13324	  dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
13325"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v
13326done
13327Checking in binfile\.dat;
13328${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v  <--  binfile\.dat
13329new revision: 1\.1\.2\.1; previous revision: 1\.1
13330done
13331Checking in brmod;
13332${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13333new revision: 1\.1\.2\.1; previous revision: 1\.1
13334done
13335Checking in brmod-trmod;
13336${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13337new revision: 1\.1\.2\.1; previous revision: 1\.1
13338done
13339Checking in brmod-wdmod;
13340${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13341new revision: 1\.1\.2\.1; previous revision: 1\.1
13342done"
13343	  dotest binfiles2-6 "${testcvs} -q update -A" \
13344"${PROG} [a-z]*: binfile\.dat is no longer in the repository
13345[UP] brmod
13346[UP] brmod-trmod
13347[UP] brmod-wdmod"
13348	  dotest_fail binfiles2-7 "test -f binfile.dat" ''
13349	  dotest binfiles2-7-brmod "cmp ../binfile brmod"
13350	  cp ../binfile3 brmod-trmod
13351	  dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
13352"Checking in brmod-trmod;
13353${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13354new revision: 1\.2; previous revision: 1\.1
13355done"
13356	  cp ../binfile3 brmod-wdmod
13357
13358	  dotest binfiles2-8 "${testcvs} -q update -j br" \
13359"U binfile\.dat
13360U brmod
13361${PROG} [a-z]*: nonmergeable file needs merge
13362${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
13363${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
13364C brmod-trmod
13365M brmod-wdmod
13366${PROG} [a-z]*: nonmergeable file needs merge
13367${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
13368${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
13369C brmod-wdmod"
13370
13371	  dotest binfiles2-9 "cmp ../binfile binfile.dat"
13372	  dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
13373	  dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
13374	  dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
13375	  dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
13376	  dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
13377
13378	  # Test that everything was properly scheduled.
13379	  dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
13380"Checking in binfile\.dat;
13381${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
13382new revision: 1\.2; previous revision: 1\.1
13383done
13384Checking in brmod;
13385${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13386new revision: 1\.2; previous revision: 1\.1
13387done
13388Checking in brmod-trmod;
13389${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13390new revision: 1\.3; previous revision: 1\.2
13391done
13392Checking in brmod-wdmod;
13393${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13394new revision: 1\.2; previous revision: 1\.1
13395done"
13396
13397	  dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
13398"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13399deleting revision 1\.2
13400${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v: can't remove branch point 1\.1
13401${PROG} [a-z]*: RCS file for .brmod-trmod. not modified\."
13402	  dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
13403"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13404deleting revision 1\.1\.2\.1
13405done"
13406	  dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
13407"RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13408deleting revision 1\.2
13409deleting revision 1\.1
13410done"
13411	  dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
13412RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13413Working file: brmod-trmod
13414head: 1\.3
13415branch:
13416locks: strict
13417access list:
13418keyword substitution: b
13419total revisions: 1;	selected revisions: 1
13420description:
13421----------------------------
13422revision 1\.3
13423date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
13424checkin
13425============================================================================="
13426	  cd ..
13427	  cd ..
13428
13429	  rm -rf ${CVSROOT_DIRNAME}/first-dir
13430	  rm -r 1
13431	  ;;
13432
13433	binfiles3)
13434	  # More binary file tests, especially removing, adding, &c.
13435	  # See "binfiles" for a list of binary file tests.
13436	  mkdir ${CVSROOT_DIRNAME}/first-dir
13437	  mkdir 1; cd 1
13438	  dotest binfiles3-1 "${testcvs} -q co first-dir" ''
13439	  ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
13440	    </dev/null | ${TR} '@' '\000' >binfile.dat
13441	  cd first-dir
13442	  echo hello >file1
13443	  dotest binfiles3-2 "${testcvs} add file1" \
13444"${PROG} [a-z]*: scheduling file .file1. for addition
13445${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
13446	  dotest binfiles3-3 "${testcvs} -q ci -m add-it" \
13447"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
13448done
13449Checking in file1;
13450${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
13451initial revision: 1\.1
13452done"
13453	  rm file1
13454	  dotest binfiles3-4 "${testcvs} rm file1" \
13455"${PROG} [a-z]*: scheduling .file1. for removal
13456${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
13457	  dotest binfiles3-5 "${testcvs} -q ci -m remove-it" \
13458"Removing file1;
13459${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
13460new revision: delete; previous revision: 1\.1
13461done"
13462	  cp ../binfile.dat file1
13463	  dotest binfiles3-6 "${testcvs} add -kb file1" \
13464"${PROG} [a-z]*: re-adding file file1 (in place of dead revision 1\.2)
13465${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
13466	  # The idea behind this test is to make sure that the file
13467	  # gets opened in binary mode to send to "cvs ci".
13468	  dotest binfiles3-6a "cat CVS/Entries" \
13469"/file1/0/[A-Za-z0-9 :]*/-kb/
13470D"
13471	  # TODO: This just tests the case where the old keyword
13472	  # expansion mode is the default (RCS_getexpand == NULL
13473	  # in checkaddfile()); should also test the case in which
13474	  # we are changing it from one non-default value to another.
13475	  dotest binfiles3-7 "${testcvs} -q ci -m readd-it" \
13476"${PROG} [a-z]*: changing keyword expansion mode to -kb
13477Checking in file1;
13478${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
13479new revision: 1\.3; previous revision: 1\.2
13480done"
13481	  dotest binfiles3-8 "${testcvs} -q log -h -N file1" "
13482RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
13483Working file: file1
13484head: 1\.3
13485branch:
13486locks: strict
13487access list:
13488keyword substitution: b
13489total revisions: 3
13490============================================================================="
13491
13492	  # OK, now test admin -o on a binary file.  See "admin"
13493	  # test for a more complete list of admin -o tests.
13494	  cp ${TESTDIR}/1/binfile.dat ${TESTDIR}/1/binfile4.dat
13495	  echo '%%$$##@@!!jjiiuull' | ${TR} j '\000' >>${TESTDIR}/1/binfile4.dat
13496	  cp ${TESTDIR}/1/binfile4.dat ${TESTDIR}/1/binfile5.dat
13497	  echo 'aawwee%$$##@@!!jjil' | ${TR} w '\000' >>${TESTDIR}/1/binfile5.dat
13498
13499	  cp ../binfile4.dat file1
13500	  dotest binfiles3-9 "${testcvs} -q ci -m change" \
13501"Checking in file1;
13502${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
13503new revision: 1\.4; previous revision: 1\.3
13504done"
13505	  cp ../binfile5.dat file1
13506	  dotest binfiles3-10 "${testcvs} -q ci -m change" \
13507"Checking in file1;
13508${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
13509new revision: 1\.5; previous revision: 1\.4
13510done"
13511	  dotest binfiles3-11 "${testcvs} admin -o 1.3::1.5 file1" \
13512"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
13513deleting revision 1\.4
13514done"
13515	  dotest binfiles3-12 "${testcvs} -q update -r 1.3 file1" "U file1"
13516	  dotest binfiles3-13 "cmp file1 ${TESTDIR}/1/binfile.dat" ""
13517
13518	  cd ../..
13519	  rm -r 1
13520	  rm -rf ${CVSROOT_DIRNAME}/first-dir
13521	  ;;
13522
13523	mcopy)
13524	  # See comment at "mwrap" test for list of other wrappers tests.
13525	  # Test cvs's ability to handle nonmergeable files specified with
13526	  # -m 'COPY' in wrappers.  Similar to the binfiles2 test,
13527	  # which tests the same thing for binary files
13528	  # (which are non-mergeable in the same sense).
13529	  #
13530	  # Cases (we are merging from the branch to the trunk):
13531	  # brmod) File modified on branch, not on trunk.
13532	  #      File should be copied over to trunk (no merging is needed).
13533	  # brmod-trmod) File modified on branch, also on trunk.
13534	  #      This is a conflict.  Present the user with both files and
13535	  #      let them figure it out.
13536	  # brmod-wdmod) File modified on branch, not modified in the trunk
13537	  #      repository, but modified in the (trunk) working directory.
13538	  #      This is also a conflict.
13539
13540	  # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
13541	  # (see wrap_send).  So skip these tests for remote.
13542	  if $remote; then :; else
13543
13544	    mkdir ${CVSROOT_DIRNAME}/first-dir
13545	    mkdir 1; cd 1
13546	    dotest mcopy-1 "${testcvs} -q co first-dir" ''
13547	    cd first-dir
13548
13549	    # FIXCVS: unless a branch has at least one file on it,
13550	    # tag_check_valid won't know it exists.  So if brmod didn't
13551	    # exist, we would have to invent it.
13552	    echo 'brmod initial contents' >brmod
13553	    echo 'brmod-trmod initial contents' >brmod-trmod
13554	    echo 'brmod-wdmod initial contents' >brmod-wdmod
13555	    echo "* -m 'COPY'" >.cvswrappers
13556	    dotest mcopy-1a \
13557"${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
13558"${PROG} [a-z]*: scheduling file .\.cvswrappers. for addition
13559${PROG} [a-z]*: scheduling file .brmod. for addition
13560${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
13561${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
13562${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
13563	    dotest mcopy-1b "${testcvs} -q ci -m add" \
13564"RCS file: ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v
13565done
13566Checking in \.cvswrappers;
13567${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v  <--  \.cvswrappers
13568initial revision: 1\.1
13569done
13570RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
13571done
13572Checking in brmod;
13573${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13574initial revision: 1\.1
13575done
13576RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
13577done
13578Checking in brmod-trmod;
13579${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13580initial revision: 1\.1
13581done
13582RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
13583done
13584Checking in brmod-wdmod;
13585${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13586initial revision: 1\.1
13587done"
13588
13589	    # NOTE: .cvswrappers files are broken (see comment in
13590	    # src/wrapper.c).  So doing everything via the environment
13591	    # variable is a workaround.  Better would be to test them
13592	    # both.
13593	    CVSWRAPPERS="* -m 'COPY'"
13594	    export CVSWRAPPERS
13595	    dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
13596T brmod
13597T brmod-trmod
13598T brmod-wdmod'
13599	    dotest mcopy-3 "${testcvs} -q update -r br" ''
13600	    echo 'modify brmod on br' >brmod
13601	    echo 'modify brmod-trmod on br' >brmod-trmod
13602	    echo 'modify brmod-wdmod on br' >brmod-wdmod
13603	    dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
13604"Checking in brmod;
13605${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13606new revision: 1\.1\.2\.1; previous revision: 1\.1
13607done
13608Checking in brmod-trmod;
13609${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13610new revision: 1\.1\.2\.1; previous revision: 1\.1
13611done
13612Checking in brmod-wdmod;
13613${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13614new revision: 1\.1\.2\.1; previous revision: 1\.1
13615done"
13616	    dotest mcopy-6 "${testcvs} -q update -A" \
13617"[UP] brmod
13618[UP] brmod-trmod
13619[UP] brmod-wdmod"
13620	    dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
13621"brmod initial contents
13622brmod-trmod initial contents
13623brmod-wdmod initial contents"
13624
13625	    echo 'modify brmod-trmod again on trunk' >brmod-trmod
13626	    dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
13627"Checking in brmod-trmod;
13628${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13629new revision: 1\.2; previous revision: 1\.1
13630done"
13631	    echo 'modify brmod-wdmod in working dir' >brmod-wdmod
13632
13633	    dotest mcopy-8 "${testcvs} -q update -j br" \
13634"U brmod
13635${PROG} [a-z]*: nonmergeable file needs merge
13636${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
13637${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
13638C brmod-trmod
13639M brmod-wdmod
13640${PROG} [a-z]*: nonmergeable file needs merge
13641${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
13642${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
13643C brmod-wdmod"
13644
13645	    dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
13646"modify brmod on br
13647modify brmod-trmod on br
13648modify brmod-wdmod on br"
13649	    dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
13650"modify brmod-trmod again on trunk
13651modify brmod-wdmod in working dir"
13652
13653	    # Test that everything was properly scheduled.
13654	    dotest mcopy-10 "${testcvs} -q ci -m checkin" \
13655"Checking in brmod;
13656${CVSROOT_DIRNAME}/first-dir/brmod,v  <--  brmod
13657new revision: 1\.2; previous revision: 1\.1
13658done
13659Checking in brmod-trmod;
13660${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v  <--  brmod-trmod
13661new revision: 1\.3; previous revision: 1\.2
13662done
13663Checking in brmod-wdmod;
13664${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v  <--  brmod-wdmod
13665new revision: 1\.2; previous revision: 1\.1
13666done"
13667	    cd ..
13668	    cd ..
13669
13670	    rm -rf ${CVSROOT_DIRNAME}/first-dir
13671	    rm -r 1
13672	    unset CVSWRAPPERS
13673
13674	  fi # end of tests to be skipped for remote
13675
13676	  ;;
13677
13678	binwrap)
13679	  # Test the ability to specify binary-ness based on file name.
13680	  # See "mwrap" for a list of other wrappers tests.
13681
13682	  mkdir dir-to-import
13683	  cd dir-to-import
13684	  touch foo.c foo.exe
13685
13686	  # While we're here, test for rejection of duplicate tag names.
13687	  dotest_fail binwrap-0 \
13688	    "${testcvs} import -m msg -I ! first-dir dup dup" \
13689"${PROG} \[[a-z]* aborted\]: tag .dup. was specified more than once"
13690
13691	  if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
13692	      first-dir tag1 tag2 >>${LOGFILE}; then
13693	    pass binwrap-1
13694	  else
13695	    fail binwrap-1
13696	  fi
13697	  cd ..
13698	  rm -r dir-to-import
13699	  dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
13700U first-dir/foo.exe'
13701	  dotest binwrap-3 "${testcvs} -q status first-dir" \
13702"===================================================================
13703File: foo\.c            	Status: Up-to-date
13704
13705   Working revision:	1\.1\.1\.1.*
13706   Repository revision:	1\.1\.1\.1	${CVSROOT_DIRNAME}/first-dir/foo\.c,v
13707   Sticky Tag:		(none)
13708   Sticky Date:		(none)
13709   Sticky Options:	(none)
13710
13711===================================================================
13712File: foo\.exe          	Status: Up-to-date
13713
13714   Working revision:	1\.1\.1\.1.*
13715   Repository revision:	1\.1\.1\.1	${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
13716   Sticky Tag:		(none)
13717   Sticky Date:		(none)
13718   Sticky Options:	-kb"
13719	  rm -r first-dir
13720	  rm -rf ${CVSROOT_DIRNAME}/first-dir
13721	  ;;
13722
13723	binwrap2)
13724	  # Test the ability to specify binary-ness based on file name.
13725	  # See "mwrap" for a list of other wrappers tests.
13726
13727	  mkdir dir-to-import
13728	  cd dir-to-import
13729	  touch foo.c foo.exe
13730
13731	  # Specify that all files are binary except *.c.
13732	  # The order seems to matter, with the earlier rules taking
13733	  # precedence.  I'm not sure whether that is good or not,
13734	  # but it is the current behavior.
13735	  if ${testcvs} import -m message -I ! \
13736	      -W "*.c -k 'o'" -W "* -k 'b'" \
13737	      first-dir tag1 tag2 >>${LOGFILE}; then
13738	    pass binwrap2-1
13739	  else
13740	    fail binwrap2-1
13741	  fi
13742	  cd ..
13743	  rm -r dir-to-import
13744	  dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
13745U first-dir/foo.exe'
13746	  dotest binwrap2-3 "${testcvs} -q status first-dir" \
13747"===================================================================
13748File: foo\.c            	Status: Up-to-date
13749
13750   Working revision:	1\.1\.1\.1.*
13751   Repository revision:	1\.1\.1\.1	${CVSROOT_DIRNAME}/first-dir/foo\.c,v
13752   Sticky Tag:		(none)
13753   Sticky Date:		(none)
13754   Sticky Options:	-ko
13755
13756===================================================================
13757File: foo\.exe          	Status: Up-to-date
13758
13759   Working revision:	1\.1\.1\.1.*
13760   Repository revision:	1\.1\.1\.1	${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
13761   Sticky Tag:		(none)
13762   Sticky Date:		(none)
13763   Sticky Options:	-kb"
13764	  rm -r first-dir
13765	  rm -rf ${CVSROOT_DIRNAME}/first-dir
13766	  ;;
13767
13768        binwrap3)
13769          # Test communication of file-specified -k wrappers between
13770          # client and server, in `import':
13771          #
13772          #   1. Set up a directory tree, populate it with files.
13773          #   2. Give each directory a different .cvswrappers file.
13774          #   3. Give the server its own .cvswrappers file.
13775          #   4. Import the whole tree, see if the right files got set
13776          #      to binary.
13777          #
13778          # The tree has a top ("0th") level, and two subdirs, sub1/
13779          # and sub2/; sub2/ contains directory subsub/.  Every
13780          # directory has a .cvswrappers file as well as regular
13781          # files.
13782          #
13783          # In the file names, "foo-b.*" should end up binary, and
13784          # "foo-t.*" should end up text.  Don't worry about the two
13785          # letter extensions; they're just there to help me keep
13786          # things straight.
13787          #
13788          # Here's the directory tree:
13789          #
13790          # ./
13791          #    .cvswrappers
13792          #    foo-b.c0
13793          #    foo-b.sb
13794          #    foo-t.c1
13795          #    foo-t.st
13796          #
13797          #    sub1/             sub2/
13798          #      .cvswrappers      .cvswrappers
13799          #      foo-b.c1          foo-b.sb
13800          #      foo-b.sb          foo-b.st
13801          #      foo-t.c0          foo-t.c0
13802          #      foo-t.st          foo-t.c1
13803          #                        foo-t.c2
13804          #                        foo-t.c3
13805          #
13806          #                        subsub/
13807          #                          .cvswrappers
13808          #                          foo-b.c3
13809          #                          foo-b.sb
13810          #                          foo-t.c0
13811          #                          foo-t.c1
13812          #                          foo-t.c2
13813          #                          foo-t.st
13814
13815          binwrap3_line1="This is a test file "
13816          binwrap3_line2="containing little of use "
13817          binwrap3_line3="except this non-haiku"
13818
13819          binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
13820
13821          cd ${TESTDIR}
13822
13823	  # On Windows, we can't check out CVSROOT, because the case
13824	  # insensitivity means that this conflicts with cvsroot.
13825	  mkdir wnt
13826	  cd wnt
13827
13828          mkdir binwrap3 # the 0th dir
13829          mkdir binwrap3/sub1
13830          mkdir binwrap3/sub2
13831          mkdir binwrap3/sub2/subsub
13832
13833          echo "*.c0 -k 'b'" > binwrap3/.cvswrappers
13834          echo "whatever -k 'b'" >> binwrap3/.cvswrappers
13835          echo ${binwrap3_text} > binwrap3/foo-b.c0
13836          echo ${binwrap3_text} > binwrap3/foo-b.sb
13837          echo ${binwrap3_text} > binwrap3/foo-t.c1
13838          echo ${binwrap3_text} > binwrap3/foo-t.st
13839
13840          echo "*.c1 -k 'b'" > binwrap3/sub1/.cvswrappers
13841          echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
13842          echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
13843          echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
13844          echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
13845          echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
13846
13847          echo "*.st -k 'b'" > binwrap3/sub2/.cvswrappers
13848          echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
13849          echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
13850          echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
13851          echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
13852          echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
13853          echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
13854
13855          echo "*.c3 -k 'b'" > binwrap3/sub2/subsub/.cvswrappers
13856          echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
13857          echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
13858          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
13859          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
13860          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
13861          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
13862          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
13863          echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
13864
13865          # Now set up CVSROOT/cvswrappers, the easy way:
13866	  dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
13867	  cd CVSROOT
13868          # This destroys anything currently in cvswrappers, but
13869	  # presumably other tests will take care of it themselves if
13870	  # they use cvswrappers:
13871	  echo "foo*.sb  -k 'b'" > cvswrappers
13872	  dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
13873"Checking in cvswrappers;
13874${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
13875new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
13876done
13877${PROG} [a-z]*: Rebuilding administrative file database"
13878          cd ..
13879
13880          # Avoid environmental interference
13881          CVSWRAPPERS_SAVED=${CVSWRAPPERS}
13882          unset CVSWRAPPERS
13883
13884          # Do the import
13885          cd binwrap3
13886	  # Not importing .cvswrappers tests whether the client is really
13887	  # letting the server know "honestly" whether the file is binary,
13888	  # rather than just letting the server see the .cvswrappers file.
13889          dotest binwrap3-2a \
13890"${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
13891"[NI] ${DOTSTAR}"
13892
13893	  # OK, now test "cvs add".
13894          cd ..
13895	  rm -r binwrap3
13896          dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
13897          cd binwrap3
13898	  cd sub2
13899	  echo "*.newbin -k 'b'" > .cvswrappers
13900	  echo .cvswrappers >.cvsignore
13901	  echo .cvsignore >>.cvsignore
13902	  touch file1.newbin file1.txt
13903	  dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
13904"${PROG} [a-z]*: scheduling file .file1\.newbin. for addition
13905${PROG} [a-z]*: scheduling file .file1\.txt. for addition
13906${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
13907	  dotest binwrap3-2d "${testcvs} -q ci -m add" \
13908"RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v
13909done
13910Checking in file1\.newbin;
13911${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v  <--  file1\.newbin
13912initial revision: 1\.1
13913done
13914RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v
13915done
13916Checking in file1\.txt;
13917${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v  <--  file1\.txt
13918initial revision: 1\.1
13919done"
13920	  cd ..
13921
13922          # Now check out the module and see which files are binary.
13923          cd ..
13924	  rm -r binwrap3
13925          dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
13926          cd binwrap3
13927
13928          # Running "cvs status" and matching output is too
13929          # error-prone, too likely to falsely fail.  Instead, we'll
13930          # just grep the Entries lines:
13931
13932          dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
13933                 "/foo-b.c0/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13934
13935          dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
13936                 "/foo-b.sb/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13937
13938          dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
13939                 "/foo-t.c1/1.1.1.1/[A-Za-z0-9 	:]*//"
13940
13941          dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
13942                 "/foo-t.st/1.1.1.1/[A-Za-z0-9 	:]*//"
13943
13944          dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
13945                 "/foo-b.c1/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13946
13947          dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
13948                 "/foo-b.sb/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13949
13950          dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
13951                 "/foo-t.c0/1.1.1.1/[A-Za-z0-9 	:]*//"
13952
13953          dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
13954                 "/foo-t.st/1.1.1.1/[A-Za-z0-9 	:]*//"
13955
13956          dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
13957                 "/foo-b.sb/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13958
13959          dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
13960                 "/foo-b.st/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13961
13962          dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
13963                 "/foo-t.c0/1.1.1.1/[A-Za-z0-9 	:]*//"
13964
13965          dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
13966                 "/foo-t.c1/1.1.1.1/[A-Za-z0-9 	:]*//"
13967
13968          dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
13969                 "/foo-t.c2/1.1.1.1/[A-Za-z0-9 	:]*//"
13970
13971          dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
13972                 "/foo-t.c3/1.1.1.1/[A-Za-z0-9 	:]*//"
13973
13974          dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
13975                 "/foo-b.c3/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13976
13977          dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
13978                 "/foo-b.sb/1.1.1.1/[A-Za-z0-9 	:]*/-kb/"
13979
13980          dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
13981                 "/foo-t.c0/1.1.1.1/[A-Za-z0-9 	:]*//"
13982
13983          dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
13984                 "/foo-t.c1/1.1.1.1/[A-Za-z0-9 	:]*//"
13985
13986          dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
13987                 "/foo-t.c2/1.1.1.1/[A-Za-z0-9 	:]*//"
13988
13989          dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
13990                 "/foo-t.st/1.1.1.1/[A-Za-z0-9 	:]*//"
13991
13992	  dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
13993	    "/file1.newbin/1.1/[A-Za-z0-9 	:]*/-kb/"
13994	  dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
13995	    "/file1.txt/1.1/[A-Za-z0-9 	:]*//"
13996
13997          # Restore and clean up
13998          cd ..
13999	  rm -r binwrap3 CVSROOT
14000	  cd ..
14001	  rm -r wnt
14002	  rm -rf ${CVSROOT_DIRNAME}/binwrap3
14003          CVSWRAPPERS=${CVSWRAPPERS_SAVED}
14004          ;;
14005
14006	mwrap)
14007	  # Tests of various wrappers features:
14008	  # -m 'COPY' and cvs update: mwrap
14009	  # -m 'COPY' and joining: mcopy
14010	  # -k: binwrap, binwrap2
14011	  # -t/-f: hasn't been written yet.
14012	  #
14013	  # Tests of different ways of specifying wrappers:
14014	  # CVSROOT/cvswrappers: mwrap
14015	  # -W: binwrap, binwrap2
14016	  # .cvswrappers in working directory, local: mcopy
14017	  # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
14018	  # CVSWRAPPERS environment variable: mcopy
14019
14020	  # This test is similar to binfiles-con1; -m 'COPY' specifies
14021	  # non-mergeableness the same way that -kb does.
14022
14023	  # On Windows, we can't check out CVSROOT, because the case
14024	  # insensitivity means that this conflicts with cvsroot.
14025	  mkdir wnt
14026	  cd wnt
14027
14028	  dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
14029	  cd CVSROOT
14030	  echo "* -m 'COPY'" >>cvswrappers
14031	  dotest mwrap-c2 "${testcvs} -q ci -m wrapper-mod" \
14032"Checking in cvswrappers;
14033${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
14034new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14035done
14036${PROG} [a-z]*: Rebuilding administrative file database"
14037	  cd ..
14038	  mkdir m1; cd m1
14039	  dotest mwrap-1 "${testcvs} -q co -l ." ''
14040	  mkdir first-dir
14041	  dotest mwrap-2 "${testcvs} add first-dir" \
14042"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
14043	  cd first-dir
14044	  touch aa
14045	  dotest mwrap-3 "${testcvs} add aa" \
14046"${PROG} [a-z]*: scheduling file .aa. for addition
14047${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
14048	  dotest mwrap-4 "${testcvs} -q ci -m add" \
14049"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
14050done
14051Checking in aa;
14052${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
14053initial revision: 1\.1
14054done"
14055	  cd ../..
14056	  mkdir m2; cd m2
14057	  dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
14058	  cd first-dir
14059	  echo "changed in m2" >aa
14060	  dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
14061"Checking in aa;
14062${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
14063new revision: 1\.2; previous revision: 1\.1
14064done"
14065	  cd ../..
14066	  cd m1/first-dir
14067	  echo "changed in m1" >aa
14068	  if $remote; then
14069	    # The tagged text code swallows up "U aa" but isn't yet up to
14070	    # trying to figure out how it interacts with the "C aa" and
14071	    # other stuff.  The whole deal of having both is pretty iffy.
14072	    dotest mwrap-7 "${testcvs} -nq update" \
14073"${PROG} [a-z]*: nonmergeable file needs merge
14074${PROG} [a-z]*: revision 1\.2 from repository is now in aa
14075${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1
14076C aa
14077U aa"
14078	  else
14079	    dotest mwrap-7 "${testcvs} -nq update" \
14080"U aa
14081${PROG} [a-z]*: nonmergeable file needs merge
14082${PROG} [a-z]*: revision 1\.2 from repository is now in aa
14083${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1
14084C aa"
14085	  fi
14086	  dotest mwrap-8 "${testcvs} -q update" \
14087"U aa
14088${PROG} [a-z]*: nonmergeable file needs merge
14089${PROG} [a-z]*: revision 1\.2 from repository is now in aa
14090${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1
14091C aa"
14092	  dotest mwrap-9 "cat aa" "changed in m2"
14093	  dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
14094	  cd ../..
14095	  cd CVSROOT
14096	  echo '# comment out' >cvswrappers
14097	  dotest mwrap-ce "${testcvs} -q ci -m wrapper-mod" \
14098"Checking in cvswrappers;
14099${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v  <--  cvswrappers
14100new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14101done
14102${PROG} [a-z]*: Rebuilding administrative file database"
14103	  cd ..
14104	  rm -r CVSROOT
14105	  rm -r m1 m2
14106	  cd ..
14107	  rm -r wnt
14108	  rm -rf ${CVSROOT_DIRNAME}/first-dir
14109	  ;;
14110
14111	info)
14112	  # Administrative file tests.
14113	  # Here is a list of where each administrative file is tested:
14114	  # loginfo: info
14115	  # modules: modules, modules2, modules3
14116	  # cvsignore: ignore
14117	  # verifymsg: info
14118	  # cvswrappers: mwrap
14119	  # taginfo: taginfo
14120	  # config: config
14121
14122	  # On Windows, we can't check out CVSROOT, because the case
14123	  # insensitivity means that this conflicts with cvsroot.
14124	  mkdir wnt
14125	  cd wnt
14126
14127	  dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
14128	  cd CVSROOT
14129	  rm -f $TESTDIR/testlog $TESTDIR/testlog2
14130	  echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
14131          # The following cases test the format string substitution
14132          echo "ALL echo %{sVv} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
14133          echo "ALL echo %{v} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
14134          echo "ALL echo %s >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
14135          echo "ALL echo %{V}AX >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
14136          echo "first-dir echo %sux >>$TESTDIR/testlog2; cat >/dev/null" \
14137            >> loginfo
14138
14139	  # Might be nice to move this to crerepos tests; it should
14140	  # work to create a loginfo file if you didn't create one
14141	  # with "cvs init".
14142	  : dotest info-2 "${testcvs} add loginfo" \
14143"${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition
14144'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
14145
14146	  dotest info-3 "${testcvs} -q ci -m new-loginfo" \
14147"Checking in loginfo;
14148${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
14149new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14150done
14151${PROG} [a-z]*: Rebuilding administrative file database"
14152	  cd ..
14153
14154	  mkdir ${CVSROOT_DIRNAME}/first-dir
14155	  dotest info-5 "${testcvs} -q co first-dir" ''
14156	  cd first-dir
14157	  touch file1
14158	  dotest info-6 "${testcvs} add file1" \
14159"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
14160'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
14161	  echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
14162	  dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
14163"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14164done
14165Checking in file1;
14166${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14167initial revision: 1\.1
14168done
14169${PROG} [a-z]*: loginfo:1: no such user variable \${=ZEE}"
14170	  echo line0 >>file1
14171	  dotest info-6b "${testcvs} -q -sOTHER=foo ci -m mod-it" \
14172"Checking in file1;
14173${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14174new revision: 1\.2; previous revision: 1\.1
14175done
14176${PROG} [a-z]*: loginfo:1: no such user variable \${=ZEE}"
14177	  echo line1 >>file1
14178	  dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
14179"Checking in file1;
14180${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14181new revision: 1\.3; previous revision: 1\.2
14182done"
14183	  cd ..
14184	  dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${CVSROOT_DIRNAME}="
14185          dotest info-10 "cat $TESTDIR/testlog2" 'first-dir file1,NONE,1.1
14186first-dir 1.1
14187first-dir file1
14188first-dir NONEAX
14189first-dir file1ux
14190first-dir file1,1.1,1.2
14191first-dir 1.2
14192first-dir file1
14193first-dir 1.1AX
14194first-dir file1ux
14195first-dir file1,1.2,1.3
14196first-dir 1.3
14197first-dir file1
14198first-dir 1.2AX
14199first-dir file1ux'
14200
14201	  cd CVSROOT
14202	  echo '# do nothing' >loginfo
14203	  dotest info-11 "${testcvs} -q -s ZEE=garbage ci -m nuke-loginfo" \
14204"Checking in loginfo;
14205${CVSROOT_DIRNAME}/CVSROOT/loginfo,v  <--  loginfo
14206new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14207done
14208${PROG} [a-z]*: Rebuilding administrative file database"
14209
14210	  # Now test verifymsg
14211	  cat >${TESTDIR}/vscript <<EOF
14212#!${TESTSHELL}
14213if head -1 < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
14214    exit 0
14215else
14216    echo "No BugId found."
14217    sleep 1
14218    exit 1
14219fi
14220EOF
14221	  chmod +x ${TESTDIR}/vscript
14222	  echo "^first-dir ${TESTDIR}/vscript" >>verifymsg
14223	  dotest info-v1 "${testcvs} -q ci -m add-verification" \
14224"Checking in verifymsg;
14225${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
14226new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14227done
14228${PROG} [a-z]*: Rebuilding administrative file database"
14229
14230	  cd ../first-dir
14231	  echo line2 >>file1
14232	  dotest_fail info-v2 "${testcvs} -q ci -m bogus" \
14233"No BugId found\.
14234${PROG} \[[a-z]* aborted\]: Message verification failed"
14235
14236	  cat >${TESTDIR}/comment.tmp <<EOF
14237BugId: 42
14238and many more lines after it
14239EOF
14240	  dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
14241"Checking in file1;
14242${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14243new revision: 1\.4; previous revision: 1\.3
14244done"
14245	  cd ..
14246	  mkdir another-dir
14247	  cd another-dir
14248	  touch file2
14249	  dotest_fail info-v4 \
14250	    "${testcvs} import -m bogus first-dir/another x y" \
14251"No BugId found\.
14252${PROG} \[[a-z]* aborted\]: Message verification failed"
14253	  rm file2
14254	  cd ..
14255	  rmdir another-dir
14256
14257	  cd CVSROOT
14258	  echo '# do nothing' >verifymsg
14259	  dotest info-cleanup-verifymsg "${testcvs} -q ci -m nuke-verifymsg" \
14260"Checking in verifymsg;
14261${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v  <--  verifymsg
14262new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14263done
14264${PROG} [a-z]*: Rebuilding administrative file database"
14265	  cd ..
14266
14267	  dotest_fail info-cleanup-0 "${testcvs} -n release -d CVSROOT" \
14268"${PROG} \[release aborted\]: cannot run command ${DOTSTAR}"
14269
14270	  if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
14271	    pass info-cleanup
14272	  else
14273	    fail info-cleanup
14274	  fi
14275	  if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
14276	    pass info-cleanup-2
14277	  else
14278	    fail info-cleanup-2
14279	  fi
14280	  cd ..
14281	  rm -r wnt
14282	  rm $HOME/.cvsrc
14283	  rm -rf ${CVSROOT_DIRNAME}/first-dir
14284	  ;;
14285
14286	taginfo)
14287	  # Tests of the CVSROOT/taginfo file.  See the comment at the
14288	  # "info" tests for a full list of administrative file tests.
14289
14290	  # Tests to add:
14291	  #   -F to move
14292
14293	  mkdir 1; cd 1
14294	  dotest taginfo-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
14295	  cd CVSROOT
14296	  cat >${TESTDIR}/1/loggit <<EOF
14297#!${TESTSHELL}
14298if test "\$1" = rejectme; then
14299  exit 1
14300else
14301  echo "\$@" >>${TESTDIR}/1/taglog
14302  exit 0
14303fi
14304EOF
14305	  chmod +x ${TESTDIR}/1/loggit
14306	  echo "ALL ${TESTDIR}/1/loggit" >taginfo
14307	  dotest taginfo-2 "${testcvs} -q ci -m check-in-taginfo" \
14308"Checking in taginfo;
14309${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
14310new revision: 1\.2; previous revision: 1\.1
14311done
14312${PROG} [a-z]*: Rebuilding administrative file database"
14313	  cd ..
14314
14315	  # taginfo-3 used to rely on the top-level CVS directory
14316	  # being created to add "first-dir" to the repository.  Since
14317	  # that won't happen anymore, we create the directory in the
14318	  # repository.
14319	  mkdir ${CVSROOT_DIRNAME}/first-dir
14320	  dotest taginfo-3 "${testcvs} -q co first-dir" ''
14321
14322	  cd first-dir
14323	  echo first >file1
14324	  dotest taginfo-4 "${testcvs} add file1" \
14325"${PROG} [a-z]*: scheduling file .file1. for addition
14326${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
14327	  dotest taginfo-5 "${testcvs} -q ci -m add-it" \
14328"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14329done
14330Checking in file1;
14331${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14332initial revision: 1\.1
14333done"
14334	  dotest taginfo-6 "${testcvs} -q tag tag1" "T file1"
14335	  dotest taginfo-7 "${testcvs} -q tag -b br" "T file1"
14336	  dotest taginfo-8 "${testcvs} -q update -r br" ""
14337	  echo add text on branch >>file1
14338	  dotest taginfo-9 "${testcvs} -q ci -m modify-on-br" \
14339"Checking in file1;
14340${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14341new revision: 1\.1\.2\.1; previous revision: 1\.1
14342done"
14343	  dotest taginfo-10 "${testcvs} -q tag -F -c brtag" "T file1"
14344
14345	  dotest_fail taginfo-11 "${testcvs} -q tag rejectme" \
14346"${PROG} [a-z]*: Pre-tag check failed
14347${PROG} \[[a-z]* aborted\]: correct the above errors first!"
14348
14349	  # When we are using taginfo to allow/disallow, it would be
14350	  # convenient to be able to use "cvs -n tag" to test whether
14351	  # the allow/disallow functionality is working as expected.
14352	  dotest taginfo-12 "${testcvs} -nq tag rejectme" "T file1"
14353
14354	  # But when taginfo is used for logging, it is a pain for -n
14355	  # to call taginfo, since taginfo doesn't know whether -n was
14356	  # specified or not.
14357	  dotest taginfo-13 "${testcvs} -nq tag would-be-tag" "T file1"
14358
14359	  # Deleting: the cases are basically either the tag existed,
14360	  # or it didn't exist.
14361	  dotest taginfo-14 "${testcvs} -q tag -d tag1" "D file1"
14362	  dotest taginfo-15 "${testcvs} -q tag -d tag1" ""
14363
14364	  # Likewise with rtag.
14365	  dotest taginfo-16 "${testcvs} -q rtag tag1 first-dir" ""
14366	  dotest taginfo-17 "${testcvs} -q rtag -d tag1 first-dir" ""
14367	  dotest taginfo-18 "${testcvs} -q rtag -d tag1 first-dir" ""
14368
14369	  # The "br" example should be passing 1.1.2 or 1.1.0.2.
14370	  # But it turns out that is very hard to implement, since
14371	  # check_fileproc doesn't know what branch number it will
14372	  # get.  Probably the whole thing should be re-architected
14373	  # so that taginfo only allows/denies tagging, and a new
14374	  # hook, which is done from tag_fileproc, does logging.
14375	  # That would solve this, some more subtle races, and also
14376	  # the fact that it is nice for users to run "-n tag foo" to
14377	  # see whether a tag would be allowed.  Failing that,
14378	  # I suppose passing "1.1.branch" or "branch" for "br"
14379	  # would be an improvement.
14380	  dotest taginfo-examine "cat ${TESTDIR}/1/taglog" \
14381"tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
14382br add ${CVSROOT_DIRNAME}/first-dir file1 1.1
14383brtag mov ${CVSROOT_DIRNAME}/first-dir file1 1.1.2.1
14384tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
14385tag1 del ${CVSROOT_DIRNAME}/first-dir
14386tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
14387tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
14388tag1 del ${CVSROOT_DIRNAME}/first-dir"
14389
14390	  cd ..
14391	  cd CVSROOT
14392	  echo '# Keep life simple' > taginfo
14393	  dotest taginfo-cleanup-1 "${testcvs} -q ci -m check-in-taginfo" \
14394"Checking in taginfo;
14395${CVSROOT_DIRNAME}/CVSROOT/taginfo,v  <--  taginfo
14396new revision: 1\.3; previous revision: 1\.2
14397done
14398${PROG} [a-z]*: Rebuilding administrative file database"
14399	  cd ..
14400	  cd ..
14401	  rm -r 1
14402	  rm -rf ${CVSROOT_DIRNAME}/first-dir
14403	  ;;
14404
14405	config)
14406	  # Tests of the CVSROOT/config file.  See the comment at the
14407	  # "info" tests for a full list of administrative file tests.
14408
14409	  # On Windows, we can't check out CVSROOT, because the case
14410	  # insensitivity means that this conflicts with cvsroot.
14411	  mkdir wnt
14412	  cd wnt
14413
14414	  dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
14415	  cd CVSROOT
14416	  echo 'bogus line' >config
14417	  # We can't rely on specific revisions, since other tests
14418	  # might need to modify CVSROOT/config
14419	  dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
14420"Checking in config;
14421${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
14422new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14423done
14424${PROG} [a-z]*: Rebuilding administrative file database"
14425	  echo 'BogusOption=yes' >config
14426	  dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
14427"${PROG} [a-z]*: syntax error in ${CVSROOT_DIRNAME}/CVSROOT/config: line 'bogus line' is missing '='
14428Checking in config;
14429${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
14430new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14431done
14432${PROG} [a-z]*: Rebuilding administrative file database"
14433	  echo '# No config is a good config' > config
14434	  dotest config-5 "${testcvs} -q ci -m change-to-comment" \
14435"${PROG} [a-z]*: ${CVSROOT_DIRNAME}/CVSROOT/config: unrecognized keyword 'BogusOption'
14436Checking in config;
14437${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
14438new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
14439done
14440${PROG} [a-z]*: Rebuilding administrative file database"
14441	  dotest config-6 "${testcvs} -q update" ''
14442
14443	  cd ..
14444	  rm -r CVSROOT
14445	  cd ..
14446	  rm -r wnt
14447	  ;;
14448
14449	serverpatch)
14450	  # Test remote CVS handling of unpatchable files.  This isn't
14451	  # much of a test for local CVS.
14452	  # We test this with some keyword expansion games, but the situation
14453	  # also arises if the user modifies the file while CVS is running.
14454	  mkdir ${CVSROOT_DIRNAME}/first-dir
14455	  mkdir 1
14456	  cd 1
14457	  dotest serverpatch-1 "${testcvs} -q co first-dir" ''
14458
14459	  cd first-dir
14460
14461	  # Add a file with an RCS keyword.
14462	  echo '$''Name$' > file1
14463	  echo '1' >> file1
14464	  dotest serverpatch-2 "${testcvs} add file1" \
14465"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
14466'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
14467
14468	  dotest serverpatch-3 "${testcvs} -q commit -m add" \
14469"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14470done
14471Checking in file1;
14472${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14473initial revision: 1\.1
14474done"
14475
14476	  # Tag the file.
14477	  dotest serverpatch-4 "${testcvs} -q tag tag file1" 'T file1'
14478
14479	  # Check out a tagged copy of the file.
14480	  cd ../..
14481	  mkdir 2
14482	  cd 2
14483	  dotest serverpatch-5 "${testcvs} -q co -r tag first-dir" \
14484'U first-dir/file1'
14485
14486	  # Remove the tag.  This will leave the tag string in the
14487	  # expansion of the Name keyword.
14488	  dotest serverpatch-6 "${testcvs} -q update -A first-dir" ''
14489
14490	  # Modify and check in the first copy.
14491	  cd ../1/first-dir
14492	  echo '2' >> file1
14493	  dotest serverpatch-7 "${testcvs} -q ci -mx file1" \
14494"Checking in file1;
14495${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14496new revision: 1\.2; previous revision: 1\.1
14497done"
14498
14499	  # Now update the second copy.  When using remote CVS, the
14500	  # patch will fail, forcing the file to be refetched.
14501	  cd ../../2/first-dir
14502	  dotest serverpatch-8 "${testcvs} -q update" \
14503'U file1' \
14504'P file1
14505'"${PROG}"' [a-z]*: checksum failure after patch to ./file1; will refetch
14506'"${PROG}"' [a-z]*: refetching unpatchable files
14507U file1'
14508
14509	  cd ../..
14510	  rm -r 1 2
14511	  rm -rf ${CVSROOT_DIRNAME}/first-dir
14512	  ;;
14513
14514	log)
14515	  # Test selecting revisions with cvs log.
14516	  # See also log2 tests for more tests.
14517	  # See also branches-14.3 for logging with a branch off of a branch.
14518	  # See also multibranch-14 for logging with several branches off the
14519	  #   same branchpoint.
14520	  # Tests of each option to cvs log:
14521	  #   -h: admin-19a-log
14522	  #   -N: log, log2, admin-19a-log
14523	  #   -b, -r: log
14524	  #   -d: logopt, rcs
14525	  #   -s: logopt, rcs3
14526	  #   -R: logopt, rcs3
14527	  #   -w, -t: not tested yet (TODO)
14528
14529	  # Check in a file with a few revisions and branches.
14530	  mkdir ${CVSROOT_DIRNAME}/first-dir
14531	  dotest log-1 "${testcvs} -q co first-dir" ''
14532	  cd first-dir
14533	  echo 'first revision' > file1
14534	  dotest log-2 "${testcvs} add file1" \
14535"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
14536'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
14537
14538	  # While we're at it, check multi-line comments, input from file,
14539	  # and trailing whitespace trimming
14540	  echo 'line 1     '	 >${TESTDIR}/comment.tmp
14541	  echo '     '		>>${TESTDIR}/comment.tmp
14542	  echo 'line 2	'	>>${TESTDIR}/comment.tmp
14543	  echo '	'	>>${TESTDIR}/comment.tmp
14544	  echo '  	  '	>>${TESTDIR}/comment.tmp
14545	  dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
14546"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14547done
14548Checking in file1;
14549${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14550initial revision: 1\.1
14551done"
14552	  rm -f ${TESTDIR}/comment.tmp
14553
14554	  echo 'second revision' > file1
14555	  dotest log-4 "${testcvs} -q ci -m2 file1" \
14556"Checking in file1;
14557${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14558new revision: 1\.2; previous revision: 1\.1
14559done"
14560
14561	  dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
14562
14563	  echo 'third revision' > file1
14564	  dotest log-6 "${testcvs} -q ci -m3 file1" \
14565"Checking in file1;
14566${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14567new revision: 1\.3; previous revision: 1\.2
14568done"
14569
14570	  dotest log-7 "${testcvs} -q update -r branch" '[UP] file1'
14571
14572	  echo 'first branch revision' > file1
14573	  dotest log-8 "${testcvs} -q ci -m1b file1" \
14574"Checking in file1;
14575${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14576new revision: 1\.2\.2\.1; previous revision: 1\.2
14577done"
14578
14579	  dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
14580
14581	  echo 'second branch revision' > file1
14582	  dotest log-10 "${testcvs} -q ci -m2b file1" \
14583"Checking in file1;
14584${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
14585new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
14586done"
14587
14588	  # Set up a bunch of shell variables to make the later tests
14589	  # easier to describe.=
14590	  log_header="
14591RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14592Working file: file1
14593head: 1\.3
14594branch:
14595locks: strict
14596access list:"
14597	  rlog_header="
14598RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
14599head: 1\.3
14600branch:
14601locks: strict
14602access list:"
14603	  log_tags='symbolic names:
14604	tag: 1\.2\.2\.1
14605	branch: 1\.2\.0\.2'
14606	  log_header2='keyword substitution: kv'
14607	  log_dash='----------------------------
14608revision'
14609	  log_date="date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;"
14610	  log_lines="  lines: ${PLUS}1 -1"
14611	  log_rev1="${log_dash} 1\.1
14612${log_date}
14613line 1
14614
14615line 2"
14616	  log_rev2="${log_dash} 1\.2
14617${log_date}${log_lines}
14618branches:  1\.2\.2;
146192"
14620	  log_rev3="${log_dash} 1\.3
14621${log_date}${log_lines}
146223"
14623	  log_rev1b="${log_dash} 1\.2\.2\.1
14624${log_date}${log_lines}
146251b"
14626	  log_rev2b="${log_dash} 1\.2\.2\.2
14627${log_date}${log_lines}
146282b"
14629	  log_trailer='============================================================================='
14630
14631	  # Now, finally, test the log output.
14632
14633	  dotest log-11 "${testcvs} log file1" \
14634"${log_header}
14635${log_tags}
14636${log_header2}
14637total revisions: 5;	selected revisions: 5
14638description:
14639${log_rev3}
14640${log_rev2}
14641${log_rev1}
14642${log_rev2b}
14643${log_rev1b}
14644${log_trailer}"
14645
14646	  dotest log-12 "${testcvs} log -N file1" \
14647"${log_header}
14648${log_header2}
14649total revisions: 5;	selected revisions: 5
14650description:
14651${log_rev3}
14652${log_rev2}
14653${log_rev1}
14654${log_rev2b}
14655${log_rev1b}
14656${log_trailer}"
14657
14658	  dotest log-13 "${testcvs} log -b file1" \
14659"${log_header}
14660${log_tags}
14661${log_header2}
14662total revisions: 5;	selected revisions: 3
14663description:
14664${log_rev3}
14665${log_rev2}
14666${log_rev1}
14667${log_trailer}"
14668
14669	  dotest log-14 "${testcvs} log -r file1" \
14670"${log_header}
14671${log_tags}
14672${log_header2}
14673total revisions: 5;	selected revisions: 1
14674description:
14675${log_rev3}
14676${log_trailer}"
14677
14678	  dotest log-14a "${testcvs} log -rHEAD file1" \
14679"${log_header}
14680${log_tags}
14681${log_header2}
14682total revisions: 5;	selected revisions: 1
14683description:
14684${log_rev3}
14685${log_trailer}"
14686
14687	  # The user might not realize that "-r" must not take a space.
14688	  # In the error message, HEAD is a file name, not a tag name (which
14689	  # might be confusing itself).
14690	  dotest_fail log-14b "${testcvs} log -r HEAD file1" \
14691"${PROG} [a-z]*: nothing known about HEAD
14692${log_header}
14693${log_tags}
14694${log_header2}
14695total revisions: 5;	selected revisions: 1
14696description:
14697${log_rev3}
14698${log_trailer}"
14699
14700#	  Check that unusual syntax works correctly.
14701
14702	  dotest log-14c "${testcvs} log -r: file1" \
14703"${log_header}
14704${log_tags}
14705${log_header2}
14706total revisions: 5;	selected revisions: 1
14707description:
14708${log_rev3}
14709${log_trailer}"
14710	  dotest log-14d "${testcvs} log -r, file1" \
14711"${log_header}
14712${log_tags}
14713${log_header2}
14714total revisions: 5;	selected revisions: 1
14715description:
14716${log_rev3}
14717${log_trailer}"
14718	  dotest log-14e "${testcvs} log -r. file1" \
14719"${log_header}
14720${log_tags}
14721${log_header2}
14722total revisions: 5;	selected revisions: 1
14723description:
14724${log_rev3}
14725${log_trailer}"
14726	  dotest log-14f "${testcvs} log -r:: file1" \
14727"${log_header}
14728${log_tags}
14729${log_header2}
14730total revisions: 5;	selected revisions: 0
14731description:
14732${log_trailer}"
14733
14734	  dotest log-15 "${testcvs} log -r1.2 file1" \
14735"${log_header}
14736${log_tags}
14737${log_header2}
14738total revisions: 5;	selected revisions: 1
14739description:
14740${log_rev2}
14741${log_trailer}"
14742
14743	  dotest log-16 "${testcvs} log -r1.2.2 file1" \
14744"${log_header}
14745${log_tags}
14746${log_header2}
14747total revisions: 5;	selected revisions: 2
14748description:
14749${log_rev2b}
14750${log_rev1b}
14751${log_trailer}"
14752
14753	  # This test would fail with the old invocation of rlog, but it
14754	  # works with the builtin log support.
14755	  dotest log-17 "${testcvs} log -rbranch file1" \
14756"${log_header}
14757${log_tags}
14758${log_header2}
14759total revisions: 5;	selected revisions: 2
14760description:
14761${log_rev2b}
14762${log_rev1b}
14763${log_trailer}"
14764
14765	  dotest log-18 "${testcvs} log -r1.2.2. file1" \
14766"${log_header}
14767${log_tags}
14768${log_header2}
14769total revisions: 5;	selected revisions: 1
14770description:
14771${log_rev2b}
14772${log_trailer}"
14773
14774	  # Multiple -r options are undocumented; see comments in
14775	  # cvs.texinfo about whether they should be deprecated.
14776	  dotest log-18a "${testcvs} log -r1.2.2.2 -r1.3:1.3 file1" \
14777"${log_header}
14778${log_tags}
14779${log_header2}
14780total revisions: 5;	selected revisions: 2
14781description:
14782${log_rev3}
14783${log_rev2b}
14784${log_trailer}"
14785
14786	  # This test would fail with the old invocation of rlog, but it
14787	  # works with the builtin log support.
14788	  dotest log-19 "${testcvs} log -rbranch. file1" \
14789"${log_header}
14790${log_tags}
14791${log_header2}
14792total revisions: 5;	selected revisions: 1
14793description:
14794${log_rev2b}
14795${log_trailer}"
14796
14797	  dotest log-20 "${testcvs} log -r1.2: file1" \
14798"${log_header}
14799${log_tags}
14800${log_header2}
14801total revisions: 5;	selected revisions: 2
14802description:
14803${log_rev3}
14804${log_rev2}
14805${log_trailer}"
14806
14807	  dotest log-20a "${testcvs} log -r1.2:: file1" \
14808"${log_header}
14809${log_tags}
14810${log_header2}
14811total revisions: 5;	selected revisions: 1
14812description:
14813${log_rev3}
14814${log_trailer}"
14815
14816	  dotest log-21 "${testcvs} log -r:1.2 file1" \
14817"${log_header}
14818${log_tags}
14819${log_header2}
14820total revisions: 5;	selected revisions: 2
14821description:
14822${log_rev2}
14823${log_rev1}
14824${log_trailer}"
14825
14826	  dotest log-21a "${testcvs} log -r::1.2 file1" \
14827"${log_header}
14828${log_tags}
14829${log_header2}
14830total revisions: 5;	selected revisions: 1
14831description:
14832${log_rev1}
14833${log_trailer}"
14834
14835	  dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
14836"${log_header}
14837${log_tags}
14838${log_header2}
14839total revisions: 5;	selected revisions: 2
14840description:
14841${log_rev2}
14842${log_rev1}
14843${log_trailer}"
14844
14845	  dotest log-22a "${testcvs} log -r1.1::1.2 file1" \
14846"${log_header}
14847${log_tags}
14848${log_header2}
14849total revisions: 5;	selected revisions: 0
14850description:
14851${log_trailer}"
14852
14853	  dotest log-22b "${testcvs} log -r1.1::1.3 file1" \
14854"${log_header}
14855${log_tags}
14856${log_header2}
14857total revisions: 5;	selected revisions: 1
14858description:
14859${log_rev2}
14860${log_trailer}"
14861
14862	  # Now the same tests but with rlog
14863
14864	  dotest log-r11 "${testcvs} rlog first-dir/file1" \
14865"${rlog_header}
14866${log_tags}
14867${log_header2}
14868total revisions: 5;	selected revisions: 5
14869description:
14870${log_rev3}
14871${log_rev2}
14872${log_rev1}
14873${log_rev2b}
14874${log_rev1b}
14875${log_trailer}"
14876
14877	  dotest log-r12 "${testcvs} rlog -N first-dir/file1" \
14878"${rlog_header}
14879${log_header2}
14880total revisions: 5;	selected revisions: 5
14881description:
14882${log_rev3}
14883${log_rev2}
14884${log_rev1}
14885${log_rev2b}
14886${log_rev1b}
14887${log_trailer}"
14888
14889	  dotest log-r13 "${testcvs} rlog -b first-dir/file1" \
14890"${rlog_header}
14891${log_tags}
14892${log_header2}
14893total revisions: 5;	selected revisions: 3
14894description:
14895${log_rev3}
14896${log_rev2}
14897${log_rev1}
14898${log_trailer}"
14899
14900	  dotest log-r14 "${testcvs} rlog -r first-dir/file1" \
14901"${rlog_header}
14902${log_tags}
14903${log_header2}
14904total revisions: 5;	selected revisions: 1
14905description:
14906${log_rev3}
14907${log_trailer}"
14908
14909	  dotest log-r14a "${testcvs} rlog -rHEAD first-dir/file1" \
14910"${rlog_header}
14911${log_tags}
14912${log_header2}
14913total revisions: 5;	selected revisions: 1
14914description:
14915${log_rev3}
14916${log_trailer}"
14917
14918	  dotest_fail log-r14b "${testcvs} rlog -r HEAD first-dir/file1" \
14919"${PROG} [a-z]*: cannot find module .HEAD. - ignored
14920${rlog_header}
14921${log_tags}
14922${log_header2}
14923total revisions: 5;	selected revisions: 1
14924description:
14925${log_rev3}
14926${log_trailer}"
14927
14928	  dotest log-r14c "${testcvs} rlog -r: first-dir/file1" \
14929"${rlog_header}
14930${log_tags}
14931${log_header2}
14932total revisions: 5;	selected revisions: 1
14933description:
14934${log_rev3}
14935${log_trailer}"
14936	  dotest log-r14d "${testcvs} rlog -r, first-dir/file1" \
14937"${rlog_header}
14938${log_tags}
14939${log_header2}
14940total revisions: 5;	selected revisions: 1
14941description:
14942${log_rev3}
14943${log_trailer}"
14944	  dotest log-r14e "${testcvs} rlog -r. first-dir/file1" \
14945"${rlog_header}
14946${log_tags}
14947${log_header2}
14948total revisions: 5;	selected revisions: 1
14949description:
14950${log_rev3}
14951${log_trailer}"
14952	  dotest log-r14f "${testcvs} rlog -r:: first-dir/file1" \
14953"${rlog_header}
14954${log_tags}
14955${log_header2}
14956total revisions: 5;	selected revisions: 0
14957description:
14958${log_trailer}"
14959
14960	  dotest log-r15 "${testcvs} rlog -r1.2 first-dir/file1" \
14961"${rlog_header}
14962${log_tags}
14963${log_header2}
14964total revisions: 5;	selected revisions: 1
14965description:
14966${log_rev2}
14967${log_trailer}"
14968
14969	  dotest log-r16 "${testcvs} rlog -r1.2.2 first-dir/file1" \
14970"${rlog_header}
14971${log_tags}
14972${log_header2}
14973total revisions: 5;	selected revisions: 2
14974description:
14975${log_rev2b}
14976${log_rev1b}
14977${log_trailer}"
14978
14979	  dotest log-r17 "${testcvs} rlog -rbranch first-dir/file1" \
14980"${rlog_header}
14981${log_tags}
14982${log_header2}
14983total revisions: 5;	selected revisions: 2
14984description:
14985${log_rev2b}
14986${log_rev1b}
14987${log_trailer}"
14988
14989	  dotest log-r18 "${testcvs} rlog -r1.2.2. first-dir/file1" \
14990"${rlog_header}
14991${log_tags}
14992${log_header2}
14993total revisions: 5;	selected revisions: 1
14994description:
14995${log_rev2b}
14996${log_trailer}"
14997
14998	  dotest log-r18a "${testcvs} rlog -r1.2.2.2 -r1.3:1.3 first-dir/file1" \
14999"${rlog_header}
15000${log_tags}
15001${log_header2}
15002total revisions: 5;	selected revisions: 2
15003description:
15004${log_rev3}
15005${log_rev2b}
15006${log_trailer}"
15007
15008	  dotest log-r19 "${testcvs} rlog -rbranch. first-dir/file1" \
15009"${rlog_header}
15010${log_tags}
15011${log_header2}
15012total revisions: 5;	selected revisions: 1
15013description:
15014${log_rev2b}
15015${log_trailer}"
15016
15017	  dotest log-r20 "${testcvs} rlog -r1.2: first-dir/file1" \
15018"${rlog_header}
15019${log_tags}
15020${log_header2}
15021total revisions: 5;	selected revisions: 2
15022description:
15023${log_rev3}
15024${log_rev2}
15025${log_trailer}"
15026
15027	  dotest log-r20a "${testcvs} rlog -r1.2:: first-dir/file1" \
15028"${rlog_header}
15029${log_tags}
15030${log_header2}
15031total revisions: 5;	selected revisions: 1
15032description:
15033${log_rev3}
15034${log_trailer}"
15035
15036	  dotest log-r21 "${testcvs} rlog -r:1.2 first-dir/file1" \
15037"${rlog_header}
15038${log_tags}
15039${log_header2}
15040total revisions: 5;	selected revisions: 2
15041description:
15042${log_rev2}
15043${log_rev1}
15044${log_trailer}"
15045
15046	  dotest log-r21a "${testcvs} rlog -r::1.2 first-dir/file1" \
15047"${rlog_header}
15048${log_tags}
15049${log_header2}
15050total revisions: 5;	selected revisions: 1
15051description:
15052${log_rev1}
15053${log_trailer}"
15054
15055	  dotest log-r22 "${testcvs} rlog -r1.1:1.2 first-dir/file1" \
15056"${rlog_header}
15057${log_tags}
15058${log_header2}
15059total revisions: 5;	selected revisions: 2
15060description:
15061${log_rev2}
15062${log_rev1}
15063${log_trailer}"
15064
15065	  dotest log-r22a "${testcvs} rlog -r1.1::1.2 first-dir/file1" \
15066"${rlog_header}
15067${log_tags}
15068${log_header2}
15069total revisions: 5;	selected revisions: 0
15070description:
15071${log_trailer}"
15072
15073	  dotest log-r22b "${testcvs} rlog -r1.1::1.3 first-dir/file1" \
15074"${rlog_header}
15075${log_tags}
15076${log_header2}
15077total revisions: 5;	selected revisions: 1
15078description:
15079${log_rev2}
15080${log_trailer}"
15081
15082	  # Now test outdating revisions
15083
15084	  dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
15085"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15086done"
15087	  dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
15088"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15089done"
15090	  dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
15091"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15092deleting revision 1\.2\.2\.2
15093done"
15094	  dotest log-o3 "${testcvs} log file1" \
15095"${log_header}
15096${log_tags}
15097${log_header2}
15098total revisions: 4;	selected revisions: 4
15099description:
15100${log_rev3}
15101${log_rev2}
15102${log_rev1}
15103${log_rev1b}
15104${log_trailer}"
15105	  dotest log-ro3 "${testcvs} rlog first-dir/file1" \
15106"${rlog_header}
15107${log_tags}
15108${log_header2}
15109total revisions: 4;	selected revisions: 4
15110description:
15111${log_rev3}
15112${log_rev2}
15113${log_rev1}
15114${log_rev1b}
15115${log_trailer}"
15116	  dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
15117"first branch revision"
15118	  cd ..
15119	  rm -r first-dir
15120	  rm -rf ${CVSROOT_DIRNAME}/first-dir
15121	  ;;
15122
15123	log2)
15124	  # More "cvs log" tests, for example the file description.
15125
15126	  # Check in a file
15127	  mkdir ${CVSROOT_DIRNAME}/first-dir
15128	  dotest log2-1 "${testcvs} -q co first-dir" ''
15129	  cd first-dir
15130	  echo 'first revision' > file1
15131	  dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
15132"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
15133'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
15134	  dotest log2-3 "${testcvs} -q commit -m 1" \
15135"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15136done
15137Checking in file1;
15138${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15139initial revision: 1\.1
15140done"
15141	  # Setting the file description with add -m doesn't yet work
15142	  # client/server, so skip log2-4 for remote.
15143	  if $remote; then :; else
15144
15145	    dotest log2-4 "${testcvs} log -N file1" "
15146RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15147Working file: file1
15148head: 1\.1
15149branch:
15150locks: strict
15151access list:
15152keyword substitution: kv
15153total revisions: 1;	selected revisions: 1
15154description:
15155file1-is-for-testing
15156----------------------------
15157revision 1\.1
15158date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
151591
15160============================================================================="
15161
15162	  fi # end of tests skipped for remote
15163
15164	  dotest log2-5 "${testcvs} admin -t-change-description file1" \
15165"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15166done"
15167	  dotest log2-6 "${testcvs} log -N file1" "
15168RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15169Working file: file1
15170head: 1\.1
15171branch:
15172locks: strict
15173access list:
15174keyword substitution: kv
15175total revisions: 1;	selected revisions: 1
15176description:
15177change-description
15178----------------------------
15179revision 1\.1
15180date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
151811
15182============================================================================="
15183
15184	  echo 'longer description' >${TESTDIR}/descrip
15185	  echo 'with two lines' >>${TESTDIR}/descrip
15186	  dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
15187"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15188done"
15189	  dotest_fail log2-7a "${testcvs} admin -t${TESTDIR}/nonexist file1" \
15190"${PROG} \[[a-z]* aborted\]: can't stat ${TESTDIR}/nonexist: No such file or directory"
15191	  dotest log2-8 "${testcvs} log -N file1" "
15192RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15193Working file: file1
15194head: 1\.1
15195branch:
15196locks: strict
15197access list:
15198keyword substitution: kv
15199total revisions: 1;	selected revisions: 1
15200description:
15201longer description
15202with two lines
15203----------------------------
15204revision 1\.1
15205date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
152061
15207============================================================================="
15208
15209	  # TODO: `cvs admin -t "my message" file1' is a request to
15210	  # read the message from stdin and to operate on two files.
15211	  # Should test that there is an error because "my message"
15212	  # doesn't exist.
15213
15214	  dotest log2-9 "echo change from stdin | ${testcvs} admin -t -q file1" ""
15215	  dotest log2-10 "${testcvs} log -N file1" "
15216RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15217Working file: file1
15218head: 1\.1
15219branch:
15220locks: strict
15221access list:
15222keyword substitution: kv
15223total revisions: 1;	selected revisions: 1
15224description:
15225change from stdin
15226----------------------------
15227revision 1\.1
15228date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
152291
15230============================================================================="
15231
15232	  cd ..
15233	  rm ${TESTDIR}/descrip
15234	  rm -r first-dir
15235	  rm -rf ${CVSROOT_DIRNAME}/first-dir
15236
15237	  ;;
15238
15239	logopt)
15240	  # Some tests of log.c's option parsing and such things.
15241	  mkdir 1; cd 1
15242	  dotest logopt-1 "${testcvs} -q co -l ." ''
15243	  mkdir first-dir
15244	  dotest logopt-2 "${testcvs} add first-dir" \
15245"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15246	  cd first-dir
15247	  echo hi >file1
15248	  dotest logopt-3 "${testcvs} add file1" \
15249"${PROG} [a-z]*: scheduling file .file1. for addition
15250${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
15251	  dotest logopt-4 "${testcvs} -q ci -m add file1" \
15252"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15253done
15254Checking in file1;
15255${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15256initial revision: 1\.1
15257done"
15258	  cd ..
15259
15260	  dotest logopt-5 "${testcvs} log -R -d 2038-01-01" \
15261"${PROG} [a-z]*: Logging \.
15262${PROG} [a-z]*: Logging first-dir
15263${CVSROOT_DIRNAME}/first-dir/file1,v"
15264	  dotest logopt-6 "${testcvs} log -d 2038-01-01 -R" \
15265"${PROG} [a-z]*: Logging \.
15266${PROG} [a-z]*: Logging first-dir
15267${CVSROOT_DIRNAME}/first-dir/file1,v"
15268	  dotest logopt-6a "${testcvs} log -Rd 2038-01-01" \
15269"${PROG} [a-z]*: Logging \.
15270${PROG} [a-z]*: Logging first-dir
15271${CVSROOT_DIRNAME}/first-dir/file1,v"
15272	  dotest logopt-7 "${testcvs} log -s Exp -R" \
15273"${PROG} [a-z]*: Logging \.
15274${PROG} [a-z]*: Logging first-dir
15275${CVSROOT_DIRNAME}/first-dir/file1,v"
15276
15277	  cd ..
15278	  rm -r 1
15279	  rm -rf ${CVSROOT_DIRNAME}/first-dir
15280	  ;;
15281
15282	ann)
15283	  # Tests of "cvs annotate".  See also:
15284	  #   basica-10  A simple annotate test
15285	  #   rcs        Annotate and the year 2000
15286	  #   keywordlog Annotate and $Log.
15287	  mkdir 1; cd 1
15288	  dotest ann-1 "${testcvs} -q co -l ." ''
15289	  mkdir first-dir
15290	  dotest ann-2 "${testcvs} add first-dir" \
15291"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15292	  cd first-dir
15293	  cat >file1 <<EOF
15294this
15295is
15296the
15297ancestral
15298file
15299EOF
15300	  dotest ann-3 "${testcvs} add file1" \
15301"${PROG} [a-z]*: scheduling file .file1. for addition
15302${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
15303	  dotest ann-4 "${testcvs} -q ci -m add file1" \
15304"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15305done
15306Checking in file1;
15307${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15308initial revision: 1\.1
15309done"
15310	  cat >file1 <<EOF
15311this
15312is
15313a
15314file
15315
15316with
15317a
15318blank
15319line
15320EOF
15321	  dotest ann-5 "${testcvs} -q ci -m modify file1" \
15322"Checking in file1;
15323${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15324new revision: 1\.2; previous revision: 1\.1
15325done"
15326	  dotest ann-6 "${testcvs} -q tag -b br" "T file1"
15327	  cat >file1 <<EOF
15328this
15329is
15330a
15331trunk file
15332
15333with
15334a
15335blank
15336line
15337EOF
15338	  dotest ann-7 "${testcvs} -q ci -m modify file1" \
15339"Checking in file1;
15340${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15341new revision: 1\.3; previous revision: 1\.2
15342done"
15343	  dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
15344	  cat >file1 <<EOF
15345this
15346is
15347a
15348file
15349
15350with
15351a
15352blank
15353line
15354and some
15355branched content
15356EOF
15357	  dotest ann-9 "${testcvs} -q ci -m modify" \
15358"Checking in file1;
15359${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15360new revision: 1\.2\.2\.1; previous revision: 1\.2
15361done"
15362	  # Note that this annotates the trunk despite the presence
15363	  # of a sticky tag in the current directory.  This is
15364	  # fairly bogus, but it is the longstanding behavior for
15365	  # whatever that is worth.
15366	  dotest ann-10 "${testcvs} ann" \
15367"Annotations for file1
15368\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
153691\.1          (${username} *[0-9a-zA-Z-]*): this
153701\.1          (${username} *[0-9a-zA-Z-]*): is
153711\.2          (${username} *[0-9a-zA-Z-]*): a
153721\.3          (${username} *[0-9a-zA-Z-]*): trunk file
153731\.2          (${username} *[0-9a-zA-Z-]*):
153741\.2          (${username} *[0-9a-zA-Z-]*): with
153751\.2          (${username} *[0-9a-zA-Z-]*): a
153761\.2          (${username} *[0-9a-zA-Z-]*): blank
153771\.2          (${username} *[0-9a-zA-Z-]*): line"
15378	  dotest ann-11 "${testcvs} ann -r br" \
15379"Annotations for file1
15380\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
153811\.1          (${username} *[0-9a-zA-Z-]*): this
153821\.1          (${username} *[0-9a-zA-Z-]*): is
153831\.2          (${username} *[0-9a-zA-Z-]*): a
153841\.1          (${username} *[0-9a-zA-Z-]*): file
153851\.2          (${username} *[0-9a-zA-Z-]*):
153861\.2          (${username} *[0-9a-zA-Z-]*): with
153871\.2          (${username} *[0-9a-zA-Z-]*): a
153881\.2          (${username} *[0-9a-zA-Z-]*): blank
153891\.2          (${username} *[0-9a-zA-Z-]*): line
153901\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
153911\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
15392	  # FIXCVS: shouldn't "-r 1.2.0.2" be the same as "-r br"?
15393	  dotest ann-12 "${testcvs} ann -r 1.2.0.2 file1" ""
15394	  dotest ann-13 "${testcvs} ann -r 1.2.2 file1" \
15395"Annotations for file1
15396\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
153971\.1          (${username} *[0-9a-zA-Z-]*): this
153981\.1          (${username} *[0-9a-zA-Z-]*): is
153991\.2          (${username} *[0-9a-zA-Z-]*): a
154001\.1          (${username} *[0-9a-zA-Z-]*): file
154011\.2          (${username} *[0-9a-zA-Z-]*):
154021\.2          (${username} *[0-9a-zA-Z-]*): with
154031\.2          (${username} *[0-9a-zA-Z-]*): a
154041\.2          (${username} *[0-9a-zA-Z-]*): blank
154051\.2          (${username} *[0-9a-zA-Z-]*): line
154061\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
154071\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
15408	  dotest_fail ann-14 "${testcvs} ann -r bill-clintons-chastity file1" \
15409"${PROG} \[[a-z]* aborted\]: no such tag bill-clintons-chastity"
15410
15411	  # Now get rid of the working directory and test rannotate
15412
15413	  cd ../..
15414	  rm -r 1
15415	  dotest ann-r10 "${testcvs} rann first-dir" \
15416"Annotations for first-dir/file1
15417\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
154181\.1          (${username} *[0-9a-zA-Z-]*): this
154191\.1          (${username} *[0-9a-zA-Z-]*): is
154201\.2          (${username} *[0-9a-zA-Z-]*): a
154211\.3          (${username} *[0-9a-zA-Z-]*): trunk file
154221\.2          (${username} *[0-9a-zA-Z-]*):
154231\.2          (${username} *[0-9a-zA-Z-]*): with
154241\.2          (${username} *[0-9a-zA-Z-]*): a
154251\.2          (${username} *[0-9a-zA-Z-]*): blank
154261\.2          (${username} *[0-9a-zA-Z-]*): line"
15427	  dotest ann-r11 "${testcvs} rann -r br first-dir" \
15428"Annotations for first-dir/file1
15429\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
154301\.1          (${username} *[0-9a-zA-Z-]*): this
154311\.1          (${username} *[0-9a-zA-Z-]*): is
154321\.2          (${username} *[0-9a-zA-Z-]*): a
154331\.1          (${username} *[0-9a-zA-Z-]*): file
154341\.2          (${username} *[0-9a-zA-Z-]*):
154351\.2          (${username} *[0-9a-zA-Z-]*): with
154361\.2          (${username} *[0-9a-zA-Z-]*): a
154371\.2          (${username} *[0-9a-zA-Z-]*): blank
154381\.2          (${username} *[0-9a-zA-Z-]*): line
154391\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
154401\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
15441	  dotest ann-r12 "${testcvs} rann -r 1.2.0.2 first-dir/file1" ""
15442	  dotest ann-r13 "${testcvs} rann -r 1.2.2 first-dir/file1" \
15443"Annotations for first-dir/file1
15444\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
154451\.1          (${username} *[0-9a-zA-Z-]*): this
154461\.1          (${username} *[0-9a-zA-Z-]*): is
154471\.2          (${username} *[0-9a-zA-Z-]*): a
154481\.1          (${username} *[0-9a-zA-Z-]*): file
154491\.2          (${username} *[0-9a-zA-Z-]*):
154501\.2          (${username} *[0-9a-zA-Z-]*): with
154511\.2          (${username} *[0-9a-zA-Z-]*): a
154521\.2          (${username} *[0-9a-zA-Z-]*): blank
154531\.2          (${username} *[0-9a-zA-Z-]*): line
154541\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): and some
154551\.2\.2\.1      (${username} *[0-9a-zA-Z-]*): branched content"
15456	  dotest_fail ann-r14 "${testcvs} rann -r bill-clintons-chastity first-dir/file1" \
15457"${PROG} \[[a-z]* aborted\]: no such tag bill-clintons-chastity"
15458
15459	  rm -rf ${CVSROOT_DIRNAME}/first-dir
15460	  ;;
15461
15462	ann-id)
15463	  # Demonstrate that cvs-1.9.28.1 improperly expands rcs keywords in
15464	  # the output of `cvs annotate' -- it uses values from the previous
15465	  # delta.  In this case, `1.1' instead of `1.2', even though it puts
15466	  # the proper version number on the prefix to each line of output.
15467	  mkdir 1; cd 1
15468	  dotest ann-id-1 "${testcvs} -q co -l ." ''
15469	  module=x
15470	  mkdir $module
15471	  dotest ann-id-2 "${testcvs} add $module" \
15472"Directory ${CVSROOT_DIRNAME}/$module added to the repository"
15473	  cd $module
15474
15475	  file=m
15476	  echo '$Id''$' > $file
15477
15478	  dotest ann-id-3 "$testcvs add $file" \
15479"${PROG} [a-z]*: scheduling file .$file. for addition
15480${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
15481	  dotest ann-id-4 "$testcvs -Q ci -m . $file" \
15482"RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
15483done
15484Checking in $file;
15485${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
15486initial revision: 1\.1
15487done"
15488
15489	  echo line2 >> $file
15490	  dotest ann-id-5 "$testcvs -Q ci -m . $file" \
15491"Checking in $file;
15492${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
15493new revision: 1\.2; previous revision: 1\.1
15494done"
15495
15496	  # The version number after $file,v should be `1.2'.
15497	  # 1.9.28.1 puts `1.1' there.
15498	  dotest ann-id-6 "$testcvs -Q ann $file" \
15499"Annotations for $file
15500\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
155011.2          ($username *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'"
155021.2          ($username *[0-9a-zA-Z-]*): line2"
15503
15504	  cd ../..
15505	  rm -rf 1
15506	  rm -rf ${CVSROOT_DIRNAME}/$module
15507	  ;;
15508
15509	crerepos)
15510	  # Various tests relating to creating repositories, operating
15511	  # on repositories created with old versions of CVS, etc.
15512
15513	  # Because this test is all about -d options and such, it
15514	  # at least to some extent needs to be different for remote vs.
15515	  # local.
15516	  if $remote; then
15517
15518	    # For remote, just create the repository.  We don't yet do
15519	    # the various other tests above for remote but that should be
15520	    # changed.
15521	    mkdir crerepos
15522	    mkdir crerepos/CVSROOT
15523
15524	    # Use :ext: rather than :fork:.  Most of the tests use :fork:,
15525	    # so we want to make sure that we test :ext: _somewhere_.
15526
15527	    # Maybe a bit dubious in the sense that people need to
15528	    # have rsh working to run the tests, but at least it
15529	    # isn't inetd :-).  Might want to think harder about this -
15530	    # maybe try :ext:, and if it fails, print a (single, nice)
15531	    # message and fall back to :fork:.  Maybe testing :ext:
15532	    # with our own CVS_RSH rather than worrying about a system one
15533	    # would do the trick.
15534
15535	    # Note that we set CVS_SERVER at the beginning.
15536	    CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos
15537
15538	    # If we're going to do remote testing, make sure 'rsh' works first.
15539	    host="`hostname`"
15540	    if test "x`${CVS_RSH-rsh} $host -n 'echo hi'`" != "xhi"; then
15541		echo "ERROR: cannot test remote CVS, because \`${CVS_RSH-rsh} $host' fails." >&2
15542		exit 1
15543	    fi
15544
15545	  else
15546
15547	    # First, if the repository doesn't exist at all...
15548	    dotest_fail crerepos-1 \
15549"${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
15550"${PROG} \[[a-z]* aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
15551	    mkdir crerepos
15552
15553	    # The repository exists but CVSROOT doesn't.
15554	    dotest_fail crerepos-2 \
15555"${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
15556"${PROG} \[[a-z]* aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
15557	    mkdir crerepos/CVSROOT
15558
15559	    # Checkout of nonexistent module
15560	    dotest_fail crerepos-3 \
15561"${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
15562"${PROG} [a-z]*: cannot find module .cvs-sanity. - ignored"
15563
15564	    # Now test that CVS works correctly without a modules file
15565	    # or any of that other stuff.  In particular, it *must*
15566	    # function if administrative files added to CVS recently (since
15567	    # CVS 1.3) do not exist, because the repository might have
15568	    # been created with an old version of CVS.
15569	    mkdir tmp; cd tmp
15570	    dotest crerepos-4 \
15571"${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
15572''
15573	    if echo yes | \
15574${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
15575	      pass crerepos-5
15576	    else
15577	      fail crerepos-5
15578	    fi
15579	    rm -rf CVS
15580	    cd ..
15581	    # The directory tmp should be empty
15582	    dotest crerepos-6 "rmdir tmp" ''
15583
15584	    CREREPOS_ROOT=${TESTDIR}/crerepos
15585
15586	  fi
15587
15588	  if $remote; then
15589	    # Test that CVS rejects a relative path in CVSROOT.
15590	    mkdir 1; cd 1
15591	    # Note that having the client reject the pathname (as :fork:
15592	    # does), does _not_ test for the bugs we are trying to catch
15593	    # here.  The point is that malicious clients might send all
15594	    # manner of things and the server better protect itself.
15595	    dotest_fail crerepos-6a-r \
15596"${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
15597"${PROG} [a-z]*: CVSROOT (\":ext:${hostname}:\.\./crerepos\")
15598${PROG} [a-z]*: may only specify a positive, non-zero, integer port (not \"\.\.\")\.
15599${PROG} [a-z]*: perhaps you entered a relative pathname${QUESTION}
15600${PROG} \[[a-z]* aborted\]: Bad CVSROOT\."
15601	    cd ..
15602	    rm -r 1
15603
15604	    mkdir 1; cd 1
15605	    dotest_fail crerepos-6b-r \
15606"${testcvs} -d :ext:`hostname`:crerepos init" \
15607"${PROG} [a-z]*: CVSROOT (\":ext:${hostname}:crerepos\")
15608${PROG} [a-z]*: requires a path spec
15609${PROG} [a-z]*: :(gserver|kserver|pserver):\[\[user\]\[:password\]@\]host\[:\[port\]\]/path
15610${PROG} [a-z]*: \[:(ext|server):\]\[\[user\]@\]host\[:\]/path
15611${PROG} \[[a-z]* aborted\]: Bad CVSROOT\."
15612	    cd ..
15613	    rm -r 1
15614	  else # local
15615	    # Test that CVS rejects a relative path in CVSROOT.
15616	    mkdir 1; cd 1
15617	    # piping the output of this test to /dev/null since we have no way of knowing
15618	    # what error messages different rsh implementations will output.
15619	    dotest_fail crerepos-6a "${testcvs} -q -d ../crerepos get . >/dev/null 2>&1" ""
15620	    cd ..
15621	    rm -r 1
15622
15623	    mkdir 1; cd 1
15624	    dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
15625"${PROG} [a-z]*: CVSROOT \"crerepos\" must be an absolute pathname
15626${PROG} \[[a-z]* aborted\]: Bad CVSROOT\."
15627	    cd ..
15628	    rm -r 1
15629	  fi # end of tests to be skipped for remote
15630
15631	  # CVS better not create a history file--if the administrator
15632	  # doesn't need it and wants to save on disk space, they just
15633	  # delete it.
15634	  dotest_fail crerepos-7 \
15635"test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
15636
15637	  # Now test mixing repositories.  This kind of thing tends to
15638	  # happen accidentally when people work with several repositories.
15639	  mkdir 1; cd 1
15640	  dotest crerepos-8 "${testcvs} -q co -l ." ''
15641	  mkdir first-dir
15642	  dotest crerepos-9 "${testcvs} add first-dir" \
15643"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
15644	  cd first-dir
15645	  touch file1
15646	  dotest crerepos-10 "${testcvs} add file1" \
15647"${PROG} [a-z]*: scheduling file .file1. for addition
15648${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
15649	  dotest crerepos-11 "${testcvs} -q ci -m add-it" \
15650"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15651done
15652Checking in file1;
15653${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
15654initial revision: 1\.1
15655done"
15656	  cd ../..
15657	  rm -r 1
15658
15659	  mkdir 1; cd 1
15660	  dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
15661	  mkdir crerepos-dir
15662	  dotest crerepos-13 "${testcvs} add crerepos-dir" \
15663"Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
15664	  cd crerepos-dir
15665	  touch cfile
15666	  dotest crerepos-14 "${testcvs} add cfile" \
15667"${PROG} [a-z]*: scheduling file .cfile. for addition
15668${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
15669	  dotest crerepos-15 "${testcvs} -q ci -m add-it" \
15670"RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
15671done
15672Checking in cfile;
15673${TESTDIR}/crerepos/crerepos-dir/cfile,v  <--  cfile
15674initial revision: 1\.1
15675done"
15676	  cd ../..
15677	  rm -r 1
15678
15679	  mkdir 1; cd 1
15680	  dotest crerepos-16 "${testcvs} co first-dir" \
15681"${PROG} [a-z]*: Updating first-dir
15682U first-dir/file1"
15683	  dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
15684"${PROG} [a-z]*: Updating crerepos-dir
15685U crerepos-dir/cfile"
15686	  dotest crerepos-18 "${testcvs} update" \
15687"${PROG} [a-z]*: Updating first-dir
15688${PROG} [a-z]*: Updating crerepos-dir"
15689
15690	  cd ..
15691
15692	  if $keep; then
15693	    echo Keeping ${TESTDIR} and exiting due to --keep
15694	    exit 0
15695	  fi
15696
15697	  rm -r 1
15698	  rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
15699	  ;;
15700
15701	rcs)
15702	  # Test ability to import an RCS file.  Note that this format
15703	  # is fixed--files written by RCS5, and other software which
15704	  # implements this format, will be out there "forever" and
15705	  # CVS must always be able to import such files.
15706
15707	  # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
15708
15709	  mkdir ${CVSROOT_DIRNAME}/first-dir
15710
15711	  # Currently the way to import an RCS file is to copy it
15712	  # directly into the repository.
15713	  #
15714	  # This file was written by RCS 5.7, and then the dates were
15715	  # hacked so that we test year 2000 stuff.  Note also that
15716	  # "author" names are just strings, as far as importing
15717	  # RCS files is concerned--they need not correspond to user
15718	  # IDs on any particular system.
15719	  #
15720	  # I also tried writing a file with the RCS supplied with
15721	  # HPUX A.09.05.  According to "man rcsintro" this is
15722	  # "Revision Number: 3.0; Release Date: 83/05/11".  There
15723	  # were a few minor differences like whitespace but at least
15724	  # in simple cases like this everything else seemed the same
15725	  # as the file written by RCS 5.7 (so I won't try to make it
15726	  # a separate test case).
15727
15728	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
15729head	1.3;
15730access;
15731symbols;
15732locks; strict;
15733comment	@# @;
15734
15735
157361.3
15737date	2000.11.24.15.58.37;	author kingdon;	state Exp;
15738branches;
15739next	1.2;
15740
157411.2
15742date	96.11.24.15.57.41;	author kingdon;	state Exp;
15743branches;
15744next	1.1;
15745
157461.1
15747date	96.11.24.15.56.05;	author kingdon;	state Exp;
15748branches;
15749next	;
15750
15751
15752desc
15753@file1 is for testing CVS
15754@
15755
15756
157571.3
15758log
15759@delete second line; modify twelfth line
15760@
15761text
15762@This is the first line
15763This is the third line
15764This is the fourth line
15765This is the fifth line
15766This is the sixth line
15767This is the seventh line
15768This is the eighth line
15769This is the ninth line
15770This is the tenth line
15771This is the eleventh line
15772This is the twelfth line (and what a line it is)
15773This is the thirteenth line
15774@
15775
15776
157771.2
15778log
15779@add more lines
15780@
15781text
15782@a1 1
15783This is the second line
15784d11 1
15785a11 1
15786This is the twelfth line
15787@
15788
15789
157901.1
15791log
15792@add file1
15793@
15794text
15795@d2 12
15796@
15797EOF
15798	  dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
15799	  cd first-dir
15800	  dotest rcs-2 "${testcvs} -q log" "
15801RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15802Working file: file1
15803head: 1\.3
15804branch:
15805locks: strict
15806access list:
15807symbolic names:
15808keyword substitution: kv
15809total revisions: 3;	selected revisions: 3
15810description:
15811file1 is for testing CVS
15812----------------------------
15813revision 1\.3
15814date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
15815delete second line; modify twelfth line
15816----------------------------
15817revision 1\.2
15818date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
15819add more lines
15820----------------------------
15821revision 1\.1
15822date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
15823add file1
15824============================================================================="
15825
15826	  # Note that the dates here are chosen so that (a) we test
15827	  # at least one date after 2000, (b) we will notice if the
15828	  # month and day are getting mixed up with each other.
15829	  # TODO: also test that year isn't getting mixed up with month
15830	  # or day, for example 01-02-03.
15831
15832	  # ISO8601 format.  There are many, many, other variations
15833	  # specified by ISO8601 which we should be testing too.
15834	  dotest rcs-3 "${testcvs} -q log -d '1996-12-11<'" "
15835RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15836Working file: file1
15837head: 1\.3
15838branch:
15839locks: strict
15840access list:
15841symbolic names:
15842keyword substitution: kv
15843total revisions: 3;	selected revisions: 1
15844description:
15845file1 is for testing CVS
15846----------------------------
15847revision 1\.3
15848date: 2000/11/24 15:58:37;  author: kingdon;  state: Exp;  lines: ${PLUS}1 -2
15849delete second line; modify twelfth line
15850============================================================================="
15851
15852	  # RFC822 format (as amended by RFC1123).
15853	  dotest rcs-4 "${testcvs} -q log -d '<3 Apr 2000 00:00'" \
15854"
15855RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
15856Working file: file1
15857head: 1\.3
15858branch:
15859locks: strict
15860access list:
15861symbolic names:
15862keyword substitution: kv
15863total revisions: 3;	selected revisions: 2
15864description:
15865file1 is for testing CVS
15866----------------------------
15867revision 1\.2
15868date: 1996/11/24 15:57:41;  author: kingdon;  state: Exp;  lines: ${PLUS}12 -0
15869add more lines
15870----------------------------
15871revision 1\.1
15872date: 1996/11/24 15:56:05;  author: kingdon;  state: Exp;
15873add file1
15874============================================================================="
15875
15876	  # Intended behavior for "cvs annotate" is that it displays the
15877	  # last two digits of the year.  Make sure it does that rather
15878	  # than some bogosity like "100".
15879	  dotest rcs-4a "${testcvs} annotate file1" \
15880"Annotations for file1
15881\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
158821\.1          (kingdon  24-Nov-96): This is the first line
158831\.2          (kingdon  24-Nov-96): This is the third line
158841\.2          (kingdon  24-Nov-96): This is the fourth line
158851\.2          (kingdon  24-Nov-96): This is the fifth line
158861\.2          (kingdon  24-Nov-96): This is the sixth line
158871\.2          (kingdon  24-Nov-96): This is the seventh line
158881\.2          (kingdon  24-Nov-96): This is the eighth line
158891\.2          (kingdon  24-Nov-96): This is the ninth line
158901\.2          (kingdon  24-Nov-96): This is the tenth line
158911\.2          (kingdon  24-Nov-96): This is the eleventh line
158921\.3          (kingdon  24-Nov-00): This is the twelfth line (and what a line it is)
158931\.2          (kingdon  24-Nov-96): This is the thirteenth line"
15894
15895	  # Probably should split this test into two at this point (file1
15896	  # above this line and file2 below), as the two share little
15897	  # data/setup.
15898
15899	  # OK, here is another one.  This one was written by hand based on
15900	  # doc/RCSFILES and friends.  One subtle point is that none of
15901	  # the lines end with newlines; that is a feature which we
15902	  # should be testing.
15903	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
15904head			 	1.5                 ;
15905     branch        1.2.6;
15906access ;
15907symbols branch:1.2.6;
15908locks;
15909testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
159101.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
159111.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
159121.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
159131.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
159141.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
159151.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
15916desc @@
159171.5 log @@ newphrase1; newphrase2 42; text @head revision@
159181.4 log @@ text @d1 1
15919a1 1
15920new year revision@
159211.3 log @@ text @d1 1
15922a1 1
15923old year revision@
159241.2 log @@ text @d1 1
15925a1 1
15926mid revision@ 1.1
15927
15928log           @@ text @d1 1
15929a1 1
15930start revision@
159311.2.6.1 log @@ text @d1 1
15932a1 1
15933branch revision@
15934EOF
15935	  # ' Match the single quote in above here doc -- for font-lock mode.
15936
15937	  # First test the default branch.
15938	  dotest rcs-5 "${testcvs} -q update file2" "U file2"
15939	  dotest rcs-6 "cat file2" "branch revision"
15940
15941	  # Check in a revision on the branch to force CVS to
15942	  # interpret every revision in the file.
15943	  dotest rcs-6a "${testcvs} -q update -r branch file2" ""
15944	  echo "next branch revision" > file2
15945	  dotest rcs-6b "${testcvs} -q ci -m mod file2" \
15946"Checking in file2;
15947${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
15948new revision: 1\.2\.6\.2; previous revision: 1\.2\.6\.1
15949done"
15950
15951	  # Now get rid of the default branch, it will get in the way.
15952	  dotest rcs-7 "${testcvs} admin -b file2" \
15953"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
15954done"
15955	  # But we do want to make sure that "cvs admin" leaves the newphrases
15956	  # in the file.
15957	  # The extra whitespace regexps are for the RCS library, which does
15958	  # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
15959	  dotest rcs-8 \
15960"grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
15961"testofanewphrase[	 ][ 	]*@without newphrase we'd have trouble extending @@ all@[	 ]*;"
15962	  # The easiest way to test for newphrases in deltas and deltatexts
15963	  # is to just look at the whole file, I guess.
15964	  dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
15965"head	1\.5;
15966access;
15967symbols
15968	branch:1.2.6;
15969locks;
15970
15971testofanewphrase	@without newphrase we'd have trouble extending @@ all@;
15972
159731\.5
15974date	71\.01\.01\.01\.00\.00;	author joe;	state bogus;
15975branches;
15976next	1\.4;
15977
159781\.4
15979date	71\.01\.01\.00\.00\.05;	author joe;	state bogus;
15980branches;
15981next	1\.3;
15982
159831\.3
15984date	70\.12\.31\.15\.00\.05;	author joe;	state bogus;
15985branches;
15986next	1\.2;
15987
159881\.2
15989date	70\.12\.31\.12\.15\.05;	author me;	state bogus;
15990branches
15991	1\.2\.6\.1;
15992next	1\.1;
15993
159941\.1
15995date	70\.12\.31\.11\.00\.05;	author joe;	state bogus;
15996branches;
15997next	;
15998newph	;
15999
160001\.2\.6\.1
16001date	71\.01\.01\.08\.00\.05;	author joe;	state Exp;
16002branches;
16003next	1\.2\.6\.2;
16004
160051\.2\.6\.2
16006date	[0-9.]*;	author ${username};	state Exp;
16007branches;
16008next	;
16009
16010
16011desc
16012@@
16013
16014
160151\.5
16016log
16017@@
16018newphrase1	;
16019newphrase2	42;
16020text
16021@head revision@
16022
16023
160241\.4
16025log
16026@@
16027text
16028@d1 1
16029a1 1
16030new year revision@
16031
16032
160331\.3
16034log
16035@@
16036text
16037@d1 1
16038a1 1
16039old year revision@
16040
16041
160421\.2
16043log
16044@@
16045text
16046@d1 1
16047a1 1
16048mid revision@
16049
16050
160511\.1
16052log
16053@@
16054text
16055@d1 1
16056a1 1
16057start revision@
16058
16059
160601\.2\.6\.1
16061log
16062@@
16063text
16064@d1 1
16065a1 1
16066branch revision@
16067
16068
160691\.2\.6\.2
16070log
16071@mod
16072@
16073text
16074@d1 1
16075a1 1
16076next branch revision
16077@"
16078
16079	  dotest rcs-9 "${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2" \
16080"start revision"
16081
16082	  dotest rcs-10 "${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2" \
16083"mid revision"
16084
16085	  dotest rcs-11 "${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2" \
16086"new year revision"
16087
16088	  # Same test as rcs-10, but with am/pm.
16089	  dotest rcs-12 "${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2" \
16090"mid revision"
16091
16092	  # Same test as rcs-11, but with am/pm.
16093	  dotest rcs-13 "${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2" \
16094"new year revision"
16095
16096	  # OK, now make sure cvs log doesn't have any trouble with the
16097	  # newphrases and such.
16098	  dotest rcs-14 "${testcvs} -q log file2" "
16099RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
16100Working file: file2
16101head: 1\.5
16102branch:
16103locks:
16104access list:
16105symbolic names:
16106	branch: 1\.2\.6
16107keyword substitution: kv
16108total revisions: 7;	selected revisions: 7
16109description:
16110----------------------------
16111revision 1\.5
16112date: 1971/01/01 01:00:00;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
16113\*\*\* empty log message \*\*\*
16114----------------------------
16115revision 1\.4
16116date: 1971/01/01 00:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
16117\*\*\* empty log message \*\*\*
16118----------------------------
16119revision 1\.3
16120date: 1970/12/31 15:00:05;  author: joe;  state: bogus;  lines: ${PLUS}1 -1
16121\*\*\* empty log message \*\*\*
16122----------------------------
16123revision 1\.2
16124date: 1970/12/31 12:15:05;  author: me;  state: bogus;  lines: ${PLUS}1 -1
16125branches:  1\.2\.6;
16126\*\*\* empty log message \*\*\*
16127----------------------------
16128revision 1\.1
16129date: 1970/12/31 11:00:05;  author: joe;  state: bogus;
16130\*\*\* empty log message \*\*\*
16131----------------------------
16132revision 1\.2\.6\.2
16133date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -1
16134mod
16135----------------------------
16136revision 1\.2\.6\.1
16137date: 1971/01/01 08:00:05;  author: joe;  state: Exp;  lines: ${PLUS}1 -1
16138\*\*\* empty log message \*\*\*
16139============================================================================="
16140	  # Now test each date format for "cvs log -d".
16141	  # Earlier than 1971-01-01
16142	  dotest rcs-15 "${testcvs} -q log -d '<1971-01-01 00:00 GMT' file2 \
16143	    | grep revision" \
16144"total revisions: 7;	selected revisions: 3
16145revision 1\.3
16146revision 1\.2
16147revision 1\.1"
16148	  # Later than 1971-01-01
16149	  dotest rcs-16 "${testcvs} -q log -d '1971-01-01 00:00 GMT<' file2 \
16150	    | grep revision" \
16151"total revisions: 7;	selected revisions: 4
16152revision 1\.5
16153revision 1\.4
16154revision 1\.2\.6\.2
16155revision 1\.2\.6\.1"
16156	  # Alternate syntaxes for later and earlier; multiple -d options
16157	  dotest rcs-17 "${testcvs} -q log -d '>1971-01-01 00:00 GMT' \
16158	    -d '1970-12-31 12:15 GMT>' file2 | grep revision" \
16159"total revisions: 7;	selected revisions: 5
16160revision 1\.5
16161revision 1\.4
16162revision 1\.1
16163revision 1\.2\.6\.2
16164revision 1\.2\.6\.1"
16165	  # Range, and single date
16166	  dotest rcs-18 "${testcvs} -q log -d '1970-12-31 11:30 GMT' \
16167	    -d '1971-01-01 00:00:05 GMT<1971-01-01 01:00:01 GMT' \
16168	    file2 | grep revision" \
16169"total revisions: 7;	selected revisions: 2
16170revision 1\.5
16171revision 1\.1"
16172	  # Alternate range syntax; equality
16173	  dotest rcs-19 "${testcvs} -q log \
16174	    -d '1971-01-01 01:00:01 GMT>=1971-01-01 00:00:05 GMT' \
16175	    file2 | grep revision" \
16176"total revisions: 7;	selected revisions: 2
16177revision 1\.5
16178revision 1\.4"
16179
16180	  cd ..
16181
16182	  rm -r first-dir
16183	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16184	  ;;
16185
16186	rcs2)
16187	  # More date tests.  Might as well do this as a separate
16188	  # test from "rcs", so that we don't need to perturb the
16189	  # "written by RCS 5.7" RCS file.
16190	  mkdir ${CVSROOT_DIRNAME}/first-dir
16191	  # Significance of various dates:
16192	  # * At least one Y2K standard refers to recognizing 9 Sep 1999
16193	  #   (as an example of a pre-2000 date, I guess).
16194	  # * At least one Y2K standard refers to recognizing 1 Jan 2001
16195	  #   (as an example of a post-2000 date, I guess).
16196	  # * Many Y2K standards refer to 2000 being a leap year.
16197	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
16198head 1.7; access; symbols; locks; strict;
161991.7 date 2004.08.31.01.01.01; author sue; state; branches; next 1.6;
162001.6 date 2004.02.29.01.01.01; author sue; state; branches; next 1.5;
162011.5 date 2003.02.28.01.01.01; author sue; state; branches; next 1.4;
162021.4 date 2001.01.01.01.01.01; author sue; state; branches; next 1.3;
162031.3 date 2000.02.29.01.01.01; author sue; state; branches; next 1.2;
162041.2 date 99.09.09.01.01.01; author sue; state; branches; next 1.1;
162051.1 date 98.09.10.01.01.01; author sue; state; branches; next;
16206desc @a test file@
162071.7 log @@ text @head revision@
162081.6 log @@ text @d1 1
16209a1 1
162102004 was a great year for leaping@
162111.5 log @@ text @d1 1
16212a1 1
162132003 wasn't@
162141.4 log @@ text @d1 1
16215a1 1
16216two year hiatus@
162171.3 log @@ text @d1 1
16218a1 1
162192000 is also a good year for leaping@
162201.2 log @@ text @d1 1
16221a1 1
16222Tonight we're going to party like it's a certain year@
162231.1 log @@ text @d1 1
16224a1 1
16225Need to start somewhere@
16226EOF
16227	  # ' Match the 3rd single quote in the here doc -- for font-lock mode.
16228
16229	  dotest rcs2-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
16230	  cd first-dir
16231
16232	  # 9 Sep 1999
16233	  dotest rcs2-2 "${testcvs} -q update -p -D '1999-09-09 11:30 UT' file1" \
16234"Tonight we're going to party like it's a certain year"
16235	  # 1 Jan 2001.
16236	  dotest rcs2-3 "${testcvs} -q update -p -D '2001-01-01 11:30 UT' file1" \
16237"two year hiatus"
16238	  # 29 Feb 2000
16239	  dotest rcs2-4 "${testcvs} -q update -p -D '2000-02-29 11:30 UT' file1" \
16240"2000 is also a good year for leaping"
16241	  # 29 Feb 2003 is invalid
16242	  dotest_fail rcs2-5 "${testcvs} -q update -p -D '2003-02-29 11:30 UT' file1" \
16243"${PROG} \[[a-z]* aborted\]: Can't parse date/time: 2003-02-29 11:30 UT"
16244
16245	  dotest rcs2-6 "${testcvs} -q update -p -D 2007-01-07 file1" \
16246"head revision"
16247	  # This assumes that the clock of the machine running the tests
16248	  # is set to at least the year 1998 or so.  There don't seem
16249	  # to be a lot of ways to test the relative date code (short
16250	  # of something like LD_LIBRARY_PRELOAD'ing in our own
16251	  # getttimeofday, or hacking the CVS source with testing
16252	  # features, which always seems to be problematic since then
16253	  # someone feels like documenting them and things go downhill
16254	  # from there).
16255	  #
16256	  # Hmm, if this test is run on the 31st of the month, and 100
16257	  # months from now is a month with only 30 days (e.g. run on
16258	  # 31 May 1999), it seems to fail.
16259	  #
16260	  # Sigh.
16261	  dotest rcs2-7 "${testcvs} -q update -p -D '100 months' file1" \
16262"head revision"
16263	  dotest rcs2-8 "${testcvs} -q update -p -D '8 years' file1" \
16264"head revision"
16265
16266	  cd ..
16267	  rm -r first-dir
16268	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16269	  ;;
16270
16271	rcs3)
16272	  # More RCS file tests, in particular at least some of the
16273	  # error handling issues.
16274	  mkdir ${CVSROOT_DIRNAME}/first-dir
16275	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
16276head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
16277; author jeremiah ;state ;  branches; next;desc@@1.1log@@text@head@
16278EOF
16279	  mkdir 1; cd 1
16280	  # CVS requires whitespace between "desc" and its value.
16281	  # The rcsfile(5) manpage doesn't really seem to answer the
16282	  # question one way or the other (it has a grammar but almost
16283	  # nothing about lexical analysis).
16284	  dotest_fail rcs3-1 "${testcvs} -q co first-dir" \
16285"${PROG} \[[a-z]* aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
16286	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
16287head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
16288; author jeremiah ;state ;  branches; next;desc @@1.1log@@text@head@
16289EOF
16290	  # Whitespace issues, likewise.
16291	  dotest_fail rcs3-2 "${testcvs} -q co first-dir" \
16292"${PROG} \[[a-z]* aborted\]: unexpected '.x6c' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
16293	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
16294head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
16295; author jeremiah ;state ;  branches; next;desc @@1.1 log@@text@head@
16296EOF
16297	  # Charming array of different messages for similar
16298	  # whitespace issues (depending on where the whitespace is).
16299	  dotest_fail rcs3-3 "${testcvs} -q co first-dir" \
16300"${PROG} \[[a-z]* aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
16301	  cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
16302head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
16303; author jeremiah ;state ;  branches; next;desc @@1.1 log @@text @head@
16304EOF
16305	  dotest rcs3-4 "${testcvs} -q co first-dir" 'U first-dir/file1'
16306
16307	  # Ouch, didn't expect this one.  FIXCVS.  Or maybe just remove
16308	  # the feature, if this is a -s problem?
16309	  dotest_fail rcs3-5 "${testcvs} log -s nostate first-dir/file1" \
16310"${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
16311	  cd first-dir
16312	  dotest_fail rcs3-5a "${testcvs} log -s nostate file1" \
16313"${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
16314	  cd ..
16315
16316	  # See remote code above for rationale for cd.
16317	  cd first-dir
16318	  dotest rcs3-6 "${testcvs} log -R file1" \
16319"${CVSROOT_DIRNAME}/first-dir/file1,v"
16320
16321	  # OK, now put an extraneous '\0' at the end.
16322	  ${AWK} </dev/null 'BEGIN { printf "@%c", 10 }' | ${TR} '@' '\000' \
16323	    >>${CVSROOT_DIRNAME}/first-dir/file1,v
16324	  dotest_fail rcs3-7 "${testcvs} log -s nostate file1" \
16325"${PROG} \[[a-z]* aborted\]: unexpected '.x0' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
16326
16327	  cd ../..
16328	  rm -r 1
16329	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16330	  ;;
16331
16332	lockfiles)
16333	  # Tests of CVS lock files.
16334	  # TODO-maybe: Add a test where we arrange for a loginfo
16335	  # script (or some such) to ensure that locks are in place
16336	  # so then we can see how they are behaving.
16337
16338	  mkdir 1; cd 1
16339	  mkdir sdir
16340	  mkdir sdir/ssdir
16341	  echo file >sdir/ssdir/file1
16342	  dotest lockfiles-1 \
16343"${testcvs} -Q import -m import-it first-dir bar baz" ""
16344	  cd ..
16345
16346	  mkdir 2; cd 2
16347	  dotest lockfiles-2 "${testcvs} -q co first-dir" \
16348"U first-dir/sdir/ssdir/file1"
16349	  dotest lockfiles-3 "${testcvs} -Q co CVSROOT" ""
16350	  cd CVSROOT
16351	  echo "LockDir=${TESTDIR}/locks" >config
16352	  dotest lockfiles-4 "${testcvs} -q ci -m config-it" \
16353"Checking in config;
16354${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16355new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16356done
16357${PROG} [a-z]*: Rebuilding administrative file database"
16358	  cd ../first-dir/sdir/ssdir
16359	  # The error message appears twice because Lock_Cleanup only
16360	  # stops recursing after the first attempt.
16361	  dotest_fail lockfiles-5 "${testcvs} -q update" \
16362"${PROG} \[[a-z]* aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory
16363${PROG} \[[a-z]* aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory"
16364	  mkdir ${TESTDIR}/locks
16365	  chmod u=rwx,g=r,o= ${TESTDIR}/locks
16366	  umask 0077
16367	  CVSUMASK=0077; export CVSUMASK
16368	  dotest lockfiles-6 "${testcvs} -q update" ""
16369	  # TODO: should also be testing that CVS continues to honor the
16370	  # umask and CVSUMASK normally.  In the case of the umask, CVS
16371	  # doesn't seem to use it for much (although it perhaps should).
16372	  dotest lockfiles-7 "ls ${TESTDIR}/locks/first-dir/sdir/ssdir" ""
16373
16374	  # The policy is that when CVS creates new lock directories, they
16375	  # inherit the permissions from the parent directory.  CVSUMASK
16376	  # isn't right, because typically the reason for LockDir is to
16377	  # use a different set of permissions.
16378	  dotest lockfiles-7a "ls -ld ${TESTDIR}/locks/first-dir" \
16379"drwxr----- .*first-dir"
16380	  dotest lockfiles-7b "ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir" \
16381"drwxr----- .*first-dir/sdir/ssdir"
16382
16383	  cd ../../..
16384	  dotest lockfiles-8 "${testcvs} -q update" ""
16385	  dotest lockfiles-9 "${testcvs} -q co -l ." ""
16386
16387	  cd CVSROOT
16388	  echo "# nobody here but us comments" >config
16389	  dotest lockfiles-cleanup-1 "${testcvs} -q ci -m config-it" \
16390"Checking in config;
16391${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
16392new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
16393done
16394${PROG} [a-z]*: Rebuilding administrative file database"
16395	  cd ../..
16396	  # Perhaps should restore the umask and CVSUMASK to what they
16397	  # were before.  But the other tests "should" not care about them...
16398	  umask 0077
16399	  unset CVSUMASK
16400	  rm -r ${TESTDIR}/locks
16401	  rm -r 1 2
16402	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16403	  ;;
16404
16405	backuprecover)
16406	  # Tests to make sure we get the expected behavior
16407	  # when we recover a repository from an old backup
16408	  #
16409	  # Details:
16410	  #   Backup will be older than some developer's workspaces
16411	  #	This means the first attempt at an update will fail
16412	  #	The workaround for this is to replace the CVS
16413	  #	  directories with those from a "new" checkout from
16414	  #	  the recovered repository.  Due to this, multiple
16415	  #	  merges should cause conflicts (the same data
16416	  #	  will be merged more than once).
16417	  #	A workspace updated before the date of the recovered
16418	  #	  copy will not need any extra attention
16419	  #
16420	  # Note that backuprecover-15 is probably a failure case
16421	  #   If nobody else had a more recent update, the data would be lost
16422	  #	permanently
16423	  #   Granted, the developer should have been notified not to do this
16424	  #	by now, but still...
16425	  #
16426	  mkdir backuprecover; cd backuprecover
16427	  mkdir 1; cd 1
16428	  dotest backuprecover-1 "${testcvs} -q co -l ." ''
16429	  mkdir first-dir
16430	  dotest backuprecover-2 "${testcvs} add first-dir" \
16431"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16432          cd first-dir
16433	  mkdir dir
16434	  dotest backuprecover-3 "${testcvs} add dir" \
16435"Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository"
16436	  touch file1 dir/file2
16437	  dotest backuprecover-4 "${testcvs} -q add file1 dir/file2" \
16438"${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
16439	  dotest backuprecover-5 "${testcvs} -q ci -mtest" \
16440"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16441done
16442Checking in file1;
16443${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16444initial revision: 1\.1
16445done
16446RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
16447done
16448Checking in dir/file2;
16449${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16450initial revision: 1\.1
16451done"
16452	  echo "Line one" >>file1
16453	  echo "  is the place" >>file1
16454	  echo "    we like to begin" >>file1
16455	  echo "Anything else" >>file1
16456	  echo "  looks like" >>file1
16457	  echo "    a sin" >>file1
16458	  echo "File 2" >>dir/file2
16459	  echo "  is the place" >>dir/file2
16460	  echo "    the rest of it goes"  >>dir/file2
16461	  echo "Why I don't use" >>dir/file2
16462	  echo "  something like 'foo'" >>dir/file2
16463	  echo "    God only knows" >>dir/file2
16464	  dotest backuprecover-6 "${testcvs} -q ci -mtest" \
16465"Checking in file1;
16466${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16467new revision: 1\.2; previous revision: 1\.1
16468done
16469Checking in dir/file2;
16470${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16471new revision: 1\.2; previous revision: 1\.1
16472done"
16473
16474	  # Simulate the lazy developer
16475	  # (he did some work but didn't check it in...)
16476	  cd ../..
16477	  mkdir 2; cd 2
16478	  dotest backuprecover-7 "${testcvs} -Q co first-dir" ''
16479	  cd first-dir
16480	  sed -e "s/looks like/just looks like/" file1 >tmp; mv tmp file1
16481	  sed -e "s/don't use/don't just use/" dir/file2 >tmp; mv tmp dir/file2
16482
16483	  # developer 1 is on a roll
16484	  cd ../../1/first-dir
16485	  echo "I need some more words" >>file1
16486	  echo "  to fill up this space" >>file1
16487	  echo "    anything else would be a disgrace" >>file1
16488	  echo "My rhymes cross many boundries" >>dir/file2
16489	  echo "  this time it's files" >>dir/file2
16490	  echo "    a word that fits here would be something like dials" >>dir/file2
16491	  dotest backuprecover-8 "${testcvs} -q ci -mtest" \
16492"Checking in file1;
16493${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16494new revision: 1\.3; previous revision: 1\.2
16495done
16496Checking in dir/file2;
16497${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16498new revision: 1\.3; previous revision: 1\.2
16499done"
16500
16501	  # Save a backup copy
16502	  cp -r ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/cvsroot/backup
16503
16504	  # Simulate developer 3
16505	  cd ../..
16506	  mkdir 3; cd 3
16507	  dotest backuprecover-9a "${testcvs} -Q co first-dir" ''
16508	  cd first-dir
16509	  echo >>file1
16510	  echo >>dir/file2
16511	  echo "Developer 1 makes very lame rhymes" >>file1
16512	  echo "  I think he should quit and become a mime" >>file1
16513	  echo "What the %*^# kind of rhyme crosses a boundry?" >>dir/file2
16514	  echo "  I think you should quit and get a job in the foundry" >>dir/file2
16515	  dotest backuprecover-9b "${testcvs} -q ci -mtest" \
16516"Checking in file1;
16517${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16518new revision: 1\.4; previous revision: 1\.3
16519done
16520Checking in dir/file2;
16521${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16522new revision: 1\.4; previous revision: 1\.3
16523done"
16524
16525	  # Developer 4 so we can simulate a conflict later...
16526	  cd ../..
16527	  mkdir 4; cd 4
16528	  dotest backuprecover-10 "${testcvs} -Q co first-dir" ''
16529	  cd first-dir
16530	  sed -e "s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
16531
16532	  # And back to developer 1
16533	  cd ../../1/first-dir
16534	  dotest backuprecover-11 "${testcvs} -Q update" ''
16535	  echo >>file1
16536	  echo >>dir/file2
16537	  echo "Oh yeah, well rhyme this" >>file1
16538	  echo "  developer three" >>file1
16539	  echo "    you want opposition" >>file1
16540	  echo "      you found some in me!" >>file1
16541	  echo "I'll give you mimes" >>dir/file2
16542	  echo "  and foundries galore!"  >>dir/file2
16543	  echo "    your head will spin" >>dir/file2
16544	  echo "      once you find what's in store!" >>dir/file2
16545	  dotest backuprecover-12 "${testcvs} -q ci -mtest" \
16546"Checking in file1;
16547${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16548new revision: 1\.5; previous revision: 1\.4
16549done
16550Checking in dir/file2;
16551${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16552new revision: 1\.5; previous revision: 1\.4
16553done"
16554
16555	  # developer 3'll do a bit of work that never gets checked in
16556	  cd ../../3/first-dir
16557	  dotest backuprecover-13 "${testcvs} -Q update" ''
16558	  sed -e "s/very/some extremely/" file1 >tmp; mv tmp file1
16559	  dotest backuprecover-14 "${testcvs} -q ci -mtest" \
16560"Checking in file1;
16561${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16562new revision: 1\.6; previous revision: 1\.5
16563done"
16564	  echo >>file1
16565	  echo "Tee hee hee hee" >>file1
16566	  echo >>dir/file2
16567	  echo "Find what's in store?" >>dir/file2
16568	  echo "  Oh, I'm so sure!" >>dir/file2
16569	  echo "    You've got an ill, and I have the cure!"  >>dir/file2
16570
16571	  # Slag the original and restore it a few revisions back
16572	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16573	  mv ${CVSROOT_DIRNAME}/backup ${TESTDIR}/cvsroot/first-dir
16574
16575	  # Have developer 1 try an update and lose some data
16576	  #
16577	  # Feel free to imagine the horrific scream of despair
16578	  cd ../../1/first-dir
16579	  dotest backuprecover-15 "${testcvs} update" \
16580"${PROG} [a-z]*: Updating .
16581U file1
16582${PROG} [a-z]*: Updating dir
16583U dir/file2"
16584
16585	  # Developer 3 tries the same thing (he has an office)
16586	  # but fails without losing data since all of his files have
16587	  # uncommitted changes
16588	  cd ../../3/first-dir
16589	  dotest_fail backuprecover-16 "${testcvs} update" \
16590"${PROG} [a-z]*: Updating \.
16591${PROG} \[[a-z]* aborted\]: could not find desired version 1\.6 in ${CVSROOT_DIRNAME}/first-dir/file1,v"
16592
16593	  # create our workspace fixin' script
16594	  cd ../..
16595	  echo \
16596"#!/bin/sh
16597
16598# This script will copy the CVS database dirs from the checked out
16599# version of a newly recovered repository and replace the CVS
16600# database dirs in a workspace with later revisions than those in the
16601# recovered repository
16602cd repos-first-dir
16603DATADIRS=\`find . -name CVS -print\`
16604cd ../first-dir
16605find . -name CVS -print | xargs rm -rf
16606for file in \${DATADIRS}; do
16607	cp -r ../repos-first-dir/\${file} \${file}
16608done" >fixit
16609
16610	  # We only need to fix the workspaces of developers 3 and 4
16611	  # (1 lost all her data and 2 has an update date from
16612	  # before the date the backup was made)
16613	  cd 3
16614	  dotest backuprecover-17 \
16615		"${testcvs} -Q co -d repos-first-dir first-dir" ''
16616	  cd ../4
16617	  dotest backuprecover-18 \
16618		"${testcvs} -Q co -d repos-first-dir first-dir" ''
16619	  sh ../fixit
16620	  cd ../3; sh ../fixit
16621
16622	  # (re)commit developer 3's stuff
16623	  cd first-dir
16624	  dotest backuprecover-19 "${testcvs} -q ci -mrecover/merge" \
16625"Checking in file1;
16626${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16627new revision: 1\.4; previous revision: 1\.3
16628done
16629Checking in dir/file2;
16630${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16631new revision: 1\.4; previous revision: 1\.3
16632done"
16633
16634	  # and we should get a conflict on developer 4's stuff
16635	  cd ../../4/first-dir
16636	  dotest backuprecover-20 "${testcvs} update" \
16637"${PROG} [a-z]*: Updating \.
16638RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16639retrieving revision 1\.3
16640retrieving revision 1\.4
16641Merging differences between 1\.3 and 1\.4 into file1
16642rcsmerge: warning: conflicts during merge
16643${PROG} [a-z]*: conflicts found in file1
16644C file1
16645${PROG} [a-z]*: Updating dir
16646RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
16647retrieving revision 1\.3
16648retrieving revision 1\.4
16649Merging differences between 1\.3 and 1\.4 into file2
16650rcsmerge: warning: conflicts during merge
16651${PROG} [a-z]*: conflicts found in dir/file2
16652C dir/file2"
16653	  sed -e \
16654"/^<<<<<<</,/^=======/d
16655/^>>>>>>>/d" file1 >tmp; mv tmp file1
16656	  sed -e \
16657"/^<<<<<<</,/^=======/d
16658/^>>>>>>>/d
16659s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
16660	  dotest backuprecover-21 "${testcvs} -q ci -mrecover/merge" \
16661"Checking in dir/file2;
16662${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16663new revision: 1\.5; previous revision: 1\.4
16664done"
16665
16666	  # go back and commit developer 2's stuff to prove it can still be done
16667	  cd ../../2/first-dir
16668	  dotest backuprecover-22 "${testcvs} -Q update" \
16669"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16670retrieving revision 1\.2
16671retrieving revision 1\.4
16672Merging differences between 1\.2 and 1\.4 into file1
16673RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
16674retrieving revision 1\.2
16675retrieving revision 1\.5
16676Merging differences between 1\.2 and 1\.5 into file2"
16677	  dotest backuprecover-23 "${testcvs} -q ci -mtest" \
16678"Checking in file1;
16679${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16680new revision: 1\.5; previous revision: 1\.4
16681done
16682Checking in dir/file2;
16683${CVSROOT_DIRNAME}/first-dir/dir/file2,v  <--  file2
16684new revision: 1\.6; previous revision: 1\.5
16685done"
16686
16687	  # and restore the data to developer 1
16688	  cd ../../1/first-dir
16689	  dotest backuprecover-24 "${testcvs} -Q update" ''
16690
16691	  cd ../../..
16692	  rm -r backuprecover
16693	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16694	  ;;
16695
16696	history)
16697	  # CVSROOT/history tests:
16698	  # history: various "cvs history" invocations
16699	  # basic2: Generating the CVSROOT/history file via CVS commands.
16700
16701	  # Put in some data for the history file (discarding what was
16702	  # there before).  Note that this file format is fixed; the
16703	  # user may wish to analyze data from a previous version of
16704	  # CVS.  If we phase out this format, it should be done
16705	  # slowly and carefully.
16706	  cat >${CVSROOT_DIRNAME}/CVSROOT/history <<EOF
16707O3395c677|anonymous|<remote>/*0|ccvs||ccvs
16708O3396c677|anonymous|<remote>/src|ccvs||src
16709O3397c677|kingdon|<remote>/*0|ccvs||ccvs
16710M339cafae|nk|<remote>|ccvs/src|1.229|sanity.sh
16711M339cafff|anonymous|<remote>|ccvs/src|1.23|Makefile
16712M339dc339|kingdon|~/work/*0|ccvs/src|1.231|sanity.sh
16713W33a6eada|anonymous|<remote>*4|ccvs/emx||Makefile.in
16714C3b235f50|kingdon|<remote>|ccvs/emx|1.3|README
16715M3b23af50|kingdon|~/work/*0|ccvs/doc|1.281|cvs.texinfo
16716EOF
16717	  dotest history-1 "${testcvs} history -e -a" \
16718"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs     =ccvs= <remote>/\*
16719O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs     =src=  <remote>/\*
16720M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
16721W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
16722O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs     =ccvs= <remote>/\*
16723M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
16724C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
16725M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc
16726M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity\.sh   ccvs/src == <remote>"
16727
16728	  dotest history-2 "${testcvs} history -e -a -D '10 Jun 1997 13:00 UT'" \
16729"W 1997-06-17 19:51 ${PLUS}0000 anonymous       Makefile\.in ccvs/emx == <remote>/emx
16730M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity\.sh   ccvs/src == ~/work/ccvs/src
16731C 2001-06-10 11:51 ${PLUS}0000 kingdon   1\.3   README      ccvs/emx == <remote>
16732M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
16733
16734	  dotest history-3 "${testcvs} history -e -a -D '10 Jun 2001 13:00 UT'" \
16735"M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
16736
16737	  dotest history-4 "${testcvs} history -ac sanity.sh" \
16738"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
16739M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
16740
16741	  dotest history-5 "${testcvs} history -a -xCGUWAMR README sanity.sh" \
16742"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
16743C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
16744M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
16745
16746	  dotest history-6 "${testcvs} history -xCGUWAMR -a -f README -f sanity.sh" \
16747"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
16748C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
16749M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
16750
16751	  dotest history-7 "${testcvs} history -xCGUWAMR -a -f sanity.sh README" \
16752"M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
16753C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3   README    ccvs/emx == <remote>
16754M 1997-06-10 01:36 ${PLUS}0000 nk      1\.229 sanity\.sh ccvs/src == <remote>"
16755
16756	  dotest history-8 "${testcvs} history -ca -D '1970-01-01 00:00 UT'" \
16757"M 1997-06-10 01:36 ${PLUS}0000 nk        1\.229 sanity.sh   ccvs/src == <remote>
16758M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
16759M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src
16760M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc"
16761
16762	  dotest history-9 "${testcvs} history -acl" \
16763"M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
16764M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
16765M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
16766
16767	  dotest history-10 "${testcvs} history -lca -D '1970-01-01 00:00 UT'" \
16768"M 2001-06-10 17:33 ${PLUS}0000 kingdon   1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
16769M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23  Makefile    ccvs/src == <remote>
16770M 1997-06-10 21:12 ${PLUS}0000 kingdon   1\.231 sanity.sh   ccvs/src == ~/work/ccvs/src"
16771
16772	  dotest history-11 "${testcvs} history -aw" \
16773"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
16774O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
16775O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
16776
16777	  dotest history-12 "${testcvs} history -aw -D'1970-01-01 00:00 UT'" \
16778"O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
16779O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src=  <remote>/\*
16780O 1997-06-06 08:12 ${PLUS}0000 kingdon   ccvs =ccvs= <remote>/\*"
16781	  ;;
16782
16783	big)
16784
16785	  # Test ability to operate on big files.  Intention is to
16786	  # test various realloc'ing code in RCS_deltas, rcsgetkey,
16787	  # etc.  "big" is currently defined to be 1000 lines (64000
16788	  # bytes), which in terms of files that users will use is not
16789	  # large, merely average, but my reasoning is that this
16790	  # should be big enough to make sure realloc'ing is going on
16791	  # and that raising it a lot would start to stress resources
16792	  # on machines which run the tests, without any significant
16793	  # benefit.
16794
16795	  mkdir ${CVSROOT_DIRNAME}/first-dir
16796	  dotest big-1 "${testcvs} -q co first-dir" ''
16797	  cd first-dir
16798	  for i in 0 1 2 3 4 5 6 7 8 9; do
16799	    for j in 0 1 2 3 4 5 6 7 8 9; do
16800	      for k in 0 1 2 3 4 5 6 7 8 9; do
16801		echo \
16802"This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
16803	      done
16804	    done
16805	  done
16806	  dotest big-2 "${testcvs} add file1" \
16807"${PROG} [a-z]*: scheduling file .file1. for addition
16808${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
16809	  dotest big-3 "${testcvs} -q ci -m add" \
16810"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
16811done
16812Checking in file1;
16813${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16814initial revision: 1\.1
16815done"
16816	  cd ..
16817	  mkdir 2
16818	  cd 2
16819	  dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
16820	  cd ../first-dir
16821	  echo "add a line to the end" >>file1
16822	  dotest big-5 "${testcvs} -q ci -m modify" \
16823"Checking in file1;
16824${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
16825new revision: 1\.2; previous revision: 1\.1
16826done"
16827	  cd ../2/first-dir
16828	  # The idea here is particularly to test the Rcs-diff response
16829	  # and the reallocing thereof, for remote.
16830	  dotest big-6 "${testcvs} -q update" "[UP] file1"
16831	  cd ../..
16832
16833	  if $keep; then
16834	    echo Keeping ${TESTDIR} and exiting due to --keep
16835	    exit 0
16836	  fi
16837
16838	  rm -r first-dir 2
16839	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16840	  ;;
16841
16842	modes)
16843	  # Test repository permissions (CVSUMASK and so on).
16844	  # Although the tests in this section "cheat" by testing
16845	  # repository permissions, which are sort of not a user-visible
16846	  # sort of thing, the modes do have user-visible consequences,
16847	  # such as whether a second user can check out the files.  But
16848	  # it would be awkward to test the consequences, so we don't.
16849
16850	  # Solaris /bin/sh doesn't support export -n.  I'm not sure
16851	  # what we can do about this, other than hope that whoever
16852	  # is running the tests doesn't have CVSUMASK set.
16853	  #export -n CVSUMASK # if unset, defaults to 002
16854
16855	  umask 077
16856	  mkdir 1; cd 1
16857	  dotest modes-1 "${testcvs} -q co -l ." ''
16858	  mkdir first-dir
16859	  dotest modes-2 "${testcvs} add first-dir" \
16860"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16861	  cd first-dir
16862	  touch aa
16863	  dotest modes-3 "${testcvs} add aa" \
16864"${PROG} [a-z]*: scheduling file .aa. for addition
16865${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
16866	  dotest modes-4 "${testcvs} -q ci -m add" \
16867"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
16868done
16869Checking in aa;
16870${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16871initial revision: 1\.1
16872done"
16873	  dotest modes-5 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
16874"-r--r--r-- .*"
16875
16876	  # Test for whether we can set the execute bit.
16877	  chmod +x aa
16878	  echo change it >>aa
16879	  dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
16880"Checking in aa;
16881${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16882new revision: 1\.2; previous revision: 1\.1
16883done"
16884	  # If CVS let us update the execute bit, it would be set here.
16885	  # But it doesn't, and as far as I know that is longstanding
16886	  # CVS behavior.
16887	  dotest modes-7 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
16888"-r--r--r-- .*"
16889
16890	  # OK, now manually change the modes and see what happens.
16891	  chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v
16892	  echo second line >>aa
16893	  dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
16894"Checking in aa;
16895${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16896new revision: 1\.3; previous revision: 1\.2
16897done"
16898	  dotest modes-7b "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
16899"-r--r----- .*"
16900
16901	  CVSUMASK=007
16902	  export CVSUMASK
16903	  touch ab
16904	  # Might as well test the execute bit too.
16905	  chmod +x ab
16906	  dotest modes-8 "${testcvs} add ab" \
16907"${PROG} [a-z]*: scheduling file .ab. for addition
16908${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
16909	  dotest modes-9 "${testcvs} -q ci -m add" \
16910"RCS file: ${CVSROOT_DIRNAME}/first-dir/ab,v
16911done
16912Checking in ab;
16913${CVSROOT_DIRNAME}/first-dir/ab,v  <--  ab
16914initial revision: 1\.1
16915done"
16916	  if $remote; then
16917	    # The problem here is that the CVSUMASK environment variable
16918	    # needs to be set on the server (e.g. .bashrc).  This is, of
16919	    # course, bogus, but that is the way it is currently.
16920	    dotest modes-10r "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
16921"-r-xr-x---.*" "-r-xr-xr-x.*"
16922	  else
16923	    dotest modes-10 "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
16924"-r-xr-x---.*"
16925	  fi
16926
16927	  # OK, now add a file on a branch.  Check that the mode gets
16928	  # set the same way (it is a different code path in CVS).
16929	  dotest modes-11 "${testcvs} -q tag -b br" 'T aa
16930T ab'
16931	  dotest modes-12 "${testcvs} -q update -r br" ''
16932	  touch ac
16933	  dotest modes-13 "${testcvs} add ac" \
16934"${PROG} [a-z]*: scheduling file .ac. for addition on branch .br.
16935${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
16936	  # Not sure it really makes sense to refer to a "previous revision"
16937	  # when we are just now adding the file; as far as I know
16938	  # that is longstanding CVS behavior, for what it's worth.
16939	  dotest modes-14 "${testcvs} -q ci -m add" \
16940"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v
16941done
16942Checking in ac;
16943${CVSROOT_DIRNAME}/first-dir/Attic/ac,v  <--  ac
16944new revision: 1\.1\.2\.1; previous revision: 1\.1
16945done"
16946	  if $remote; then
16947	    # The problem here is that the CVSUMASK environment variable
16948	    # needs to be set on the server (e.g. .bashrc).  This is, of
16949	    # course, bogus, but that is the way it is currently.  The
16950	    # first match is for the :ext: method (where the CVSUMASK
16951	    # won't be set), while the second is for the :fork: method
16952	    # (where it will be).
16953	    dotest modes-15r \
16954"ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
16955"-r--r--r--.*" "-r--r-----.*"
16956	  else
16957	    dotest modes-15 \
16958"ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
16959"-r--r-----.*"
16960	  fi
16961
16962	  cd ../..
16963	  rm -r 1
16964	  rm -rf ${CVSROOT_DIRNAME}/first-dir
16965	  # Perhaps should restore the umask and CVSUMASK.  But the other
16966	  # tests "should" not care about them...
16967	  ;;
16968
16969	modes2)
16970	  # More tests of file permissions in the working directory
16971	  # and that sort of thing.
16972
16973	  # The usual setup, file first-dir/aa with two revisions.
16974	  mkdir 1; cd 1
16975	  dotest modes2-1 "${testcvs} -q co -l ." ''
16976	  mkdir first-dir
16977	  dotest modes2-2 "${testcvs} add first-dir" \
16978"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
16979	  cd first-dir
16980	  touch aa
16981	  dotest modes2-3 "${testcvs} add aa" \
16982"${PROG} [a-z]*: scheduling file .aa. for addition
16983${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
16984	  dotest modes2-4 "${testcvs} -q ci -m add" \
16985"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
16986done
16987Checking in aa;
16988${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16989initial revision: 1\.1
16990done"
16991	  echo "more money" >> aa
16992	  dotest modes2-5 "${testcvs} -q ci -m add" \
16993"Checking in aa;
16994${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
16995new revision: 1\.2; previous revision: 1\.1
16996done"
16997
16998	  # OK, here is the test.  The idea is to see what
16999	  # No_Difference does if it can't open the file.
17000	  # If we don't change the st_mtime, CVS doesn't even try to read
17001	  # the file.  Note that some versions of "touch" require that we
17002	  # do this while the file is still writable.
17003	  touch aa
17004	  chmod a= aa
17005	  dotest_fail modes2-6 "${testcvs} -q update -r 1.1 aa" \
17006"${PROG} \[update aborted\]: cannot open file aa for comparing: Permission denied" \
17007"${PROG} \[update aborted\]: reading aa: Permission denied"
17008
17009	  chmod u+rwx aa
17010	  cd ../..
17011	  rm -r 1
17012	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17013	  ;;
17014
17015	modes3)
17016	  # Repository permissions.  Particularly, what happens if we
17017	  # can't read/write in the repository.
17018	  # TODO: the case where we can access the repository, just not
17019	  # the attic (may that one can remain a fatal error, seems less
17020	  # useful for access control).
17021	  mkdir 1; cd 1
17022	  dotest modes3-1 "${testcvs} -q co -l ." ''
17023	  mkdir first-dir second-dir
17024	  dotest modes3-2 "${testcvs} add first-dir second-dir" \
17025"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
17026Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
17027	  touch first-dir/aa second-dir/ab
17028	  dotest modes3-3 "${testcvs} add first-dir/aa second-dir/ab" \
17029"${PROG} [a-z]*: scheduling file .first-dir/aa. for addition
17030${PROG} [a-z]*: scheduling file .second-dir/ab. for addition
17031${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
17032	  dotest modes3-4 "${testcvs} -q ci -m add" \
17033"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
17034done
17035Checking in first-dir/aa;
17036${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
17037initial revision: 1\.1
17038done
17039RCS file: ${CVSROOT_DIRNAME}/second-dir/ab,v
17040done
17041Checking in second-dir/ab;
17042${CVSROOT_DIRNAME}/second-dir/ab,v  <--  ab
17043initial revision: 1\.1
17044done"
17045	  chmod a= ${CVSROOT_DIRNAME}/first-dir
17046	  dotest modes3-5 "${testcvs} update" \
17047"${PROG} [a-z]*: Updating \.
17048${PROG} [a-z]*: Updating first-dir
17049${PROG} [a-z]*: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
17050${PROG} [a-z]*: skipping directory first-dir
17051${PROG} [a-z]*: Updating second-dir"
17052
17053	  # OK, I can see why one might say the above case could be a
17054	  # fatal error, because normally users without access to first-dir
17055	  # won't have it in their working directory.  But the next
17056	  # one is more of a problem if it is fatal.
17057	  rm -r first-dir
17058	  dotest modes3-6 "${testcvs} update -dP" \
17059"${PROG} [a-z]*: Updating .
17060${PROG} [a-z]*: Updating CVSROOT
17061U ${DOTSTAR}
17062${PROG} [a-z]*: Updating first-dir
17063${PROG} [a-z]*: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
17064${PROG} [a-z]*: skipping directory first-dir
17065${PROG} [a-z]*: Updating second-dir"
17066
17067	  cd ..
17068	  rm -r 1
17069	  chmod u+rwx ${CVSROOT_DIRNAME}/first-dir
17070	  rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/cvsroot/second-dir
17071	  ;;
17072
17073	stamps)
17074	  # Test timestamps.
17075	  mkdir 1; cd 1
17076	  dotest stamps-1 "${testcvs} -q co -l ." ''
17077	  mkdir first-dir
17078	  dotest stamps-2 "${testcvs} add first-dir" \
17079"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17080	  cd first-dir
17081	  touch aa
17082	  echo '$''Id$' >kw
17083	  ls -l aa >${TESTDIR}/1/stamp.aa.touch
17084	  ls -l kw >${TESTDIR}/1/stamp.kw.touch
17085	  # "sleep 1" would suffice if we could assume ls --full-time, but
17086	  # that is as far as I know unique to GNU ls.  Is there some POSIX.2
17087	  # way to get the timestamp of a file, including the seconds?
17088	  sleep 60
17089	  dotest stamps-3 "${testcvs} add aa kw" \
17090"${PROG} [a-z]*: scheduling file .aa. for addition
17091${PROG} [a-z]*: scheduling file .kw. for addition
17092${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
17093	  ls -l aa >${TESTDIR}/1/stamp.aa.add
17094	  ls -l kw >${TESTDIR}/1/stamp.kw.add
17095	  # "cvs add" should not muck with the timestamp.
17096	  dotest stamps-4aa \
17097"cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
17098	  dotest stamps-4kw \
17099"cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
17100	  sleep 60
17101	  dotest stamps-5 "${testcvs} -q ci -m add" \
17102"RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
17103done
17104Checking in aa;
17105${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
17106initial revision: 1\.1
17107done
17108RCS file: ${CVSROOT_DIRNAME}/first-dir/kw,v
17109done
17110Checking in kw;
17111${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
17112initial revision: 1\.1
17113done"
17114	  ls -l aa >${TESTDIR}/1/stamp.aa.ci
17115	  ls -l kw >${TESTDIR}/1/stamp.kw.ci
17116	  # If there are no keywords, "cvs ci" leaves the timestamp alone
17117	  # If there are, it sets the timestamp to the date of the commit.
17118	  # I'm not sure how logical this is, but it is intentional.
17119	  # If we wanted to get fancy we would make sure the time as
17120	  # reported in "cvs log kw" matched stamp.kw.ci.  But that would
17121	  # be a lot of work.
17122	  dotest stamps-6aa \
17123	    "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
17124	  if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
17125	  then
17126	    fail stamps-6kw
17127	  else
17128	    pass stamps-6kw
17129	  fi
17130	  cd ../..
17131	  sleep 60
17132	  mkdir 2
17133	  cd 2
17134	  dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
17135U first-dir/kw"
17136	  cd first-dir
17137	  ls -l aa >${TESTDIR}/1/stamp.aa.get
17138	  ls -l kw >${TESTDIR}/1/stamp.kw.get
17139	  # On checkout, CVS should set the timestamp to the date that the
17140	  # file was committed.  Could check that the time as reported in
17141	  # "cvs log aa" matches stamp.aa.get, but that would be a lot of
17142	  # work.
17143	  if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
17144	  then
17145	    fail stamps-8aa
17146	  else
17147	    pass stamps-8aa
17148	  fi
17149	  dotest stamps-8kw \
17150	    "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
17151
17152	  # Now we want to see what "cvs update" does.
17153	  sleep 60
17154	  echo add a line >>aa
17155	  echo add a line >>kw
17156	  dotest stamps-9 "${testcvs} -q ci -m change-them" \
17157"Checking in aa;
17158${CVSROOT_DIRNAME}/first-dir/aa,v  <--  aa
17159new revision: 1\.2; previous revision: 1\.1
17160done
17161Checking in kw;
17162${CVSROOT_DIRNAME}/first-dir/kw,v  <--  kw
17163new revision: 1\.2; previous revision: 1\.1
17164done"
17165	  ls -l aa >${TESTDIR}/1/stamp.aa.ci2
17166	  ls -l kw >${TESTDIR}/1/stamp.kw.ci2
17167	  cd ../..
17168	  cd 1/first-dir
17169	  sleep 60
17170	  dotest stamps-10 "${testcvs} -q update" '[UP] aa
17171[UP] kw'
17172	  # this doesn't serve any function other than being able to
17173	  # look at it manually, as we have no machinery for dates being
17174	  # newer or older than other dates.
17175	  date >${TESTDIR}/1/stamp.debug.update
17176	  ls -l aa >${TESTDIR}/1/stamp.aa.update
17177	  ls -l kw >${TESTDIR}/1/stamp.kw.update
17178	  # stamp.aa.update and stamp.kw.update should both be approximately
17179	  # the same as stamp.debug.update.  Perhaps we could be testing
17180	  # this in a more fancy fashion by "touch stamp.before" before
17181	  # stamps-10, "touch stamp.after" after, and then using ls -t
17182	  # to check them.  But for now we just make sure that the *.update
17183	  # stamps differ from the *.ci2 ones.
17184	  # As for the rationale, this is so that if one updates and gets
17185	  # a new revision, then "make" will be sure to regard those files
17186	  # as newer than .o files which may be sitting around.
17187	  if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
17188	     >/dev/null
17189	  then
17190	    fail stamps-11aa
17191	  else
17192	    pass stamps-11aa
17193	  fi
17194	  if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
17195	     >/dev/null
17196	  then
17197	    fail stamps-11kw
17198	  else
17199	    pass stamps-11kw
17200	  fi
17201
17202	  cd ../..
17203
17204	  if $keep; then
17205	    echo Keeping ${TESTDIR} and exiting due to --keep
17206	    exit 0
17207	  fi
17208
17209	  rm -r 1 2
17210	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17211	  ;;
17212
17213	perms)
17214	  # short cut around checking out and committing CVSROOT
17215	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17216	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
17217	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17218
17219	  mkdir 1; cd 1
17220	  dotest perms-1 "${testcvs} -q co -l ." ''
17221	  mkdir first-dir
17222	  dotest perms-2 "${testcvs} add first-dir" \
17223"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17224	  cd first-dir
17225
17226	  touch foo
17227	  chmod 431 foo
17228	  dotest perms-3 "${testcvs} add foo" \
17229"${PROG} [a-z]*: scheduling file .foo. for addition
17230${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17231	  dotest perms-4 "${testcvs} -q ci -m ''" \
17232"RCS file: ${CVSROOT_DIRNAME}/first-dir/foo,v
17233done
17234Checking in foo;
17235${CVSROOT_DIRNAME}/first-dir/foo,v  <--  foo
17236initial revision: 1\.1
17237done"
17238
17239	  # Test checking out files with different permissions.
17240	  cd ../..
17241	  mkdir 2; cd 2
17242	  dotest perms-5 "${testcvs} -q co first-dir" "U first-dir/foo"
17243	  cd first-dir
17244	  if $remote; then :; else
17245	    # PreservePermissions not yet implemented for remote.
17246	    dotest perms-6 "ls -l foo" "-r---wx--x .* foo"
17247	  fi
17248
17249	  cd ../..
17250	  rm -rf 1 2
17251	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17252
17253	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17254	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
17255	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17256	  ;;
17257
17258	symlinks)
17259	  # short cut around checking out and committing CVSROOT
17260	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17261	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
17262	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17263
17264	  mkdir 1; cd 1
17265	  dotest symlinks-1 "${testcvs} -q co -l ." ''
17266	  mkdir first-dir
17267	  dotest symlinks-2 "${testcvs} add first-dir" \
17268"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17269	  cd first-dir
17270
17271	  dotest symlinks-2.1 "ln -s ${TESTDIR}/fumble slink" ""
17272	  dotest symlinks-3 "${testcvs} add slink" \
17273"${PROG} [a-z]*: scheduling file .slink. for addition
17274${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17275	  if $remote; then
17276	    # Remote doesn't implement PreservePermissions, and in its
17277	    # absence the correct behavior is to follow the symlink.
17278	    dotest_fail symlinks-4r "${testcvs} -q ci -m ''" \
17279"${PROG} \[commit aborted\]: reading slink: No such file or directory"
17280	  else
17281	    dotest symlinks-4 "${testcvs} -q ci -m ''" \
17282"RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
17283done
17284Checking in slink;
17285${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
17286initial revision: 1\.1
17287done"
17288
17289	    # Test checking out symbolic links.
17290	    cd ../..
17291	    mkdir 2; cd 2
17292	    dotest symlinks-5 "${testcvs} -q co first-dir" "U first-dir/slink"
17293	    cd first-dir
17294	    dotest symlinks-6 "ls -l slink" \
17295"l[rwx\-]* .* slink -> ${TESTDIR}/fumble"
17296	  fi
17297
17298	  cd ../..
17299	  rm -rf 1 2
17300	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17301
17302	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17303	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
17304	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17305	  ;;
17306
17307	symlinks2)
17308	  # Symlinks in working directory without PreservePermissions.
17309	  # Also see: symlinks: with PreservePermissions
17310	  # rcslib-symlink-*: symlinks in repository.
17311	  mkdir 1; cd 1
17312	  dotest symlinks2-1 "${testcvs} -q co -l ." ''
17313	  mkdir first-dir
17314	  dotest symlinks2-2 "${testcvs} add first-dir" \
17315"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17316	  cd first-dir
17317	  echo nonsymlink > slink
17318	  dotest symlinks2-3 "${testcvs} add slink" \
17319"${PROG} [a-z]*: scheduling file .slink. for addition
17320${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17321	  dotest symlinks2-4 "${testcvs} -q ci -m ''" \
17322"RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
17323done
17324Checking in slink;
17325${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
17326initial revision: 1\.1
17327done"
17328	  rm slink
17329	  # Choose name cvslog.* so it is in default ignore list.
17330	  echo second file >cvslog.file2
17331	  dotest symlinks2-5 "ln -s cvslog.file2 slink" ""
17332	  dotest symlinks2-6 "${testcvs} -q ci -m linkify" \
17333"Checking in slink;
17334${CVSROOT_DIRNAME}/first-dir/slink,v  <--  slink
17335new revision: 1\.2; previous revision: 1\.1
17336done"
17337	  dotest symlinks2-7 "${testcvs} -q update -r 1.1 slink" "[UP] slink"
17338	  dotest symlinks2-8 "cat slink" "nonsymlink"
17339	  dotest symlinks2-9 "ls -l slink" "-[-rwx]* .* slink"
17340	  cd ../..
17341
17342	  rm -rf 1
17343	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17344	  ;;
17345
17346	hardlinks)
17347	  # short cut around checking out and committing CVSROOT
17348	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17349	  echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
17350	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17351
17352	  mkdir 1; cd 1
17353	  dotest hardlinks-1 "${testcvs} -q co -l ." ''
17354	  mkdir first-dir
17355	  dotest hardlinks-2 "${testcvs} add first-dir" \
17356"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17357	  cd first-dir
17358
17359	  # Make up some ugly filenames, to test that they get
17360	  # encoded properly in the delta nodes.  Note that `dotest' screws
17361	  # up if some arguments have embedded spaces.
17362	  if touch aaaa
17363	  then
17364	    pass hardlinks-2.1
17365	  else
17366	    fail hardlinks-2.1
17367	  fi
17368
17369	  if ln aaaa b.b.b.b
17370	  then
17371	    pass hardlinks-2.2
17372	  else
17373	    fail hardlinks-2.2
17374	  fi
17375
17376	  if ln aaaa 'dd dd dd'
17377	  then
17378	    pass hardlinks-2.3
17379	  else
17380	    fail hardlinks-2.3
17381	  fi
17382
17383	  dotest hardlinks-3 "${testcvs} add [abd]*" \
17384"${PROG} [a-z]*: scheduling file .aaaa. for addition
17385${PROG} [a-z]*: scheduling file .b\.b\.b\.b. for addition
17386${PROG} [a-z]*: scheduling file .dd dd dd. for addition
17387${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
17388	  dotest hardlinks-4 "${testcvs} -q ci -m ''" \
17389"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaaa,v
17390done
17391Checking in aaaa;
17392${CVSROOT_DIRNAME}/first-dir/aaaa,v  <--  aaaa
17393initial revision: 1\.1
17394done
17395RCS file: ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v
17396done
17397Checking in b\.b\.b\.b;
17398${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v  <--  b\.b\.b\.b
17399initial revision: 1\.1
17400done
17401RCS file: ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v
17402done
17403Checking in dd dd dd;
17404${CVSROOT_DIRNAME}/first-dir/dd dd dd,v  <--  dd dd dd
17405initial revision: 1\.1
17406done"
17407	  # Test checking out hardlinked files.
17408	  cd ../..
17409	  mkdir 2; cd 2
17410	  if $remote; then
17411	    # Remote does not implement PreservePermissions.
17412	    dotest hardlinks-5r "${testcvs} -q co first-dir" \
17413"U first-dir/aaaa
17414U first-dir/b\.b\.b\.b
17415U first-dir/dd dd dd"
17416	    cd first-dir
17417	    dotest hardlinks-6r "ls -l [abd]*" \
17418"-[rwx\-]* *1 .* aaaa
17419-[rwx\-]* *1 .* b\.b\.b\.b
17420-[rwx\-]* *1 .* dd dd dd"
17421	  else
17422	    dotest hardlinks-5 "${testcvs} -q co first-dir" \
17423"U first-dir/aaaa
17424U first-dir/b\.b\.b\.b
17425U first-dir/dd dd dd"
17426	    cd first-dir
17427	    # To make sure that the files are properly hardlinked, it
17428	    # would be nice to do `ls -i' and make sure all the inodes
17429	    # match.  But I think that would require expr to support
17430	    # tagged regexps, and I don't think we can rely on that.
17431	    # So instead we just see that each file has the right
17432	    # number of links. -twp
17433	    dotest hardlinks-6 "ls -l [abd]*" \
17434"-[rwx\-]* *3 .* aaaa
17435-[rwx\-]* *3 .* b\.b\.b\.b
17436-[rwx\-]* *3 .* dd dd dd"
17437	  fi
17438
17439	  cd ../..
17440	  rm -rf 1 2
17441	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17442
17443	  rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
17444	  touch ${CVSROOT_DIRNAME}/CVSROOT/config
17445	  chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
17446	  ;;
17447
17448	sticky)
17449	  # More tests of sticky tags, particularly non-branch sticky tags.
17450	  # See many tests (e.g. multibranch) for ordinary sticky tag
17451	  # operations such as adding files on branches.
17452	  # See "head" test for interaction between stick tags and HEAD.
17453	  mkdir 1; cd 1
17454	  dotest sticky-1 "${testcvs} -q co -l ." ''
17455	  mkdir first-dir
17456	  dotest sticky-2 "${testcvs} add first-dir" \
17457"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17458	  cd first-dir
17459
17460	  touch file1
17461	  dotest sticky-3 "${testcvs} add file1" \
17462"${PROG} [a-z]*: scheduling file .file1. for addition
17463${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17464	  dotest sticky-4 "${testcvs} -q ci -m add" \
17465"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17466done
17467Checking in file1;
17468${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17469initial revision: 1\.1
17470done"
17471	  dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
17472	  echo add a line >>file1
17473	  dotest sticky-6 "${testcvs} -q ci -m modify" \
17474"Checking in file1;
17475${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17476new revision: 1\.2; previous revision: 1\.1
17477done"
17478	  dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
17479	  dotest sticky-8 "cat file1" ''
17480	  dotest sticky-9 "${testcvs} -q update" ''
17481	  dotest sticky-10 "cat file1" ''
17482	  touch file2
17483	  dotest_fail sticky-11 "${testcvs} add file2" \
17484"${PROG} [a-z]*: cannot add file on non-branch tag tag1"
17485	  dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
17486${QUESTION} file2" "${QUESTION} file2
17487[UP] file1"
17488	  dotest sticky-13 "${testcvs} add file2" \
17489"${PROG} [a-z]*: scheduling file .file2. for addition
17490${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17491	  dotest sticky-14 "${testcvs} -q ci -m add" \
17492"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
17493done
17494Checking in file2;
17495${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
17496initial revision: 1\.1
17497done"
17498
17499	  # Now back to tag1
17500	  dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
17501${PROG} [a-z]*: file2 is no longer in the repository"
17502
17503	  rm file1
17504	  dotest sticky-16 "${testcvs} rm file1" \
17505"${PROG} [a-z]*: scheduling .file1. for removal
17506${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
17507	  # Hmm, this command seems to silently remove the tag from
17508	  # the file.  This appears to be intentional.
17509	  # The silently part especially strikes me as odd, though.
17510	  dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
17511	  dotest sticky-18 "${testcvs} -q update -A" "U file1
17512U file2"
17513	  dotest sticky-19 "${testcvs} -q update -r tag1" \
17514"${PROG} [a-z]*: file1 is no longer in the repository
17515${PROG} [a-z]*: file2 is no longer in the repository"
17516	  dotest sticky-20 "${testcvs} -q update -A" "U file1
17517U file2"
17518
17519	  # Now try with a numeric revision.
17520	  dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
17521	  rm file1
17522	  dotest sticky-22 "${testcvs} rm file1" \
17523"${PROG} [a-z]*: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
17524	  # The old behavior was that remove allowed this and then commit
17525	  # gave an error, which was somewhat hard to clear.  I mean, you
17526	  # could get into a long elaborate discussion of this being a
17527	  # conflict and two ways to resolve it, but I don't really see
17528	  # why CVS should have a concept of conflict that arises, not from
17529	  # parallel development, but from CVS's own sticky tags.
17530
17531	  # I'm kind of surprised that the "file1 was lost" doesn't crop
17532	  # up elsewhere in the testsuite.  It is a long-standing
17533	  # discrepency between local and remote CVS and should probably
17534	  # be cleaned up at some point.
17535	  dotest sticky-23 "${testcvs} -q update -A" \
17536"${PROG} [a-z]*: warning: file1 was lost
17537U file1" "U file1"
17538
17539	  cd ../..
17540	  rm -r 1
17541	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17542	  ;;
17543
17544	keyword)
17545	  # Test keyword expansion.
17546	  # Various other tests relate to our ability to correctly
17547	  # set the keyword expansion mode.
17548	  # "binfiles" tests "cvs admin -k".
17549	  # "binfiles" and "binfiles2" test "cvs add -k".
17550	  # "rdiff" tests "cvs co -k".
17551	  # "binfiles" (and this test) test "cvs update -k".
17552	  # "binwrap" tests setting the mode from wrappers.
17553	  # "keyword2" tests "cvs update -kk -j" with text and binary files
17554	  # I don't think any test is testing "cvs import -k".
17555	  # Other keyword expansion tests:
17556	  #   keywordlog - $Log.
17557	  mkdir 1; cd 1
17558	  dotest keyword-1 "${testcvs} -q co -l ." ''
17559	  mkdir first-dir
17560	  dotest keyword-2 "${testcvs} add first-dir" \
17561"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17562          cd first-dir
17563
17564	  echo '$''Author$' > file1
17565	  echo '$''Date$' >> file1
17566	  echo '$''Header$' >> file1
17567	  echo '$''Id$' >> file1
17568	  echo '$''Locker$' >> file1
17569	  echo '$''Name$' >> file1
17570	  echo '$''RCSfile$' >> file1
17571	  echo '$''Revision$' >> file1
17572	  echo '$''Source$' >> file1
17573	  echo '$''State$' >> file1
17574	  echo '$''Nonkey$' >> file1
17575	  # Omit the trailing dollar sign
17576	  echo '$''Date' >> file1
17577	  # Put two keywords on one line
17578	  echo '$''State$' '$''State$' >> file1
17579	  # Use a header for Log
17580	  echo 'xx $''Log$' >> file1
17581
17582	  dotest keyword-3 "${testcvs} add file1" \
17583"${PROG} [a-z]*: scheduling file .file1. for addition
17584${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17585	  dotest keyword-4 "${testcvs} -q ci -m add" \
17586"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17587done
17588Checking in file1;
17589${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17590initial revision: 1\.1
17591done"
17592	  dotest keyword-5 "cat file1" \
17593'\$'"Author: ${username} "'\$'"
17594"'\$'"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] "'\$'"
17595"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
17596"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
17597"'\$'"Locker:  "'\$'"
17598"'\$'"Name:  "'\$'"
17599"'\$'"RCSfile: file1,v "'\$'"
17600"'\$'"Revision: 1\.1 "'\$'"
17601"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
17602"'\$'"State: Exp "'\$'"
17603"'\$'"Nonkey"'\$'"
17604"'\$'"Date
17605"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
17606xx "'\$'"Log: file1,v "'\$'"
17607xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
17608xx add
17609xx"
17610
17611	  # Use cvs admin to lock the RCS file in order to check -kkvl
17612	  # vs. -kkv.  CVS does not normally lock RCS files, but some
17613	  # people use cvs admin to enforce reserved checkouts.
17614	  dotest keyword-6 "${testcvs} admin -l file1" \
17615"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
176161\.1 locked
17617done"
17618
17619	  dotest keyword-7 "${testcvs} update -kkv file1" "U file1"
17620	  dotest keyword-8 "cat file1" \
17621'\$'"Author: ${username} "'\$'"
17622"'\$'"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] "'\$'"
17623"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
17624"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
17625"'\$'"Locker:  "'\$'"
17626"'\$'"Name:  "'\$'"
17627"'\$'"RCSfile: file1,v "'\$'"
17628"'\$'"Revision: 1\.1 "'\$'"
17629"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
17630"'\$'"State: Exp "'\$'"
17631"'\$'"Nonkey"'\$'"
17632"'\$'"Date
17633"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
17634xx "'\$'"Log: file1,v "'\$'"
17635xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
17636xx add
17637xx"
17638
17639	  dotest keyword-9 "${testcvs} update -kkvl file1" "U file1"
17640	  dotest keyword-10 "cat file1" \
17641'\$'"Author: ${username} "'\$'"
17642"'\$'"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] "'\$'"
17643"'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
17644"'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
17645"'\$'"Locker: ${username} "'\$'"
17646"'\$'"Name:  "'\$'"
17647"'\$'"RCSfile: file1,v "'\$'"
17648"'\$'"Revision: 1\.1 "'\$'"
17649"'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
17650"'\$'"State: Exp "'\$'"
17651"'\$'"Nonkey"'\$'"
17652"'\$'"Date
17653"'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
17654xx "'\$'"Log: file1,v "'\$'"
17655xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
17656xx add
17657xx"
17658
17659	  dotest keyword-11 "${testcvs} update -kk file1" "U file1"
17660	  dotest keyword-12 "cat file1" \
17661'\$'"Author"'\$'"
17662"'\$'"Date"'\$'"
17663"'\$'"Header"'\$'"
17664"'\$'"Id"'\$'"
17665"'\$'"Locker"'\$'"
17666"'\$'"Name"'\$'"
17667"'\$'"RCSfile"'\$'"
17668"'\$'"Revision"'\$'"
17669"'\$'"Source"'\$'"
17670"'\$'"State"'\$'"
17671"'\$'"Nonkey"'\$'"
17672"'\$'"Date
17673"'\$'"State"'\$'" "'\$'"State"'\$'"
17674xx "'\$'"Log"'\$'"
17675xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
17676xx add
17677xx"
17678
17679	  dotest keyword-13 "${testcvs} update -kv file1" "U file1"
17680	  dotest keyword-14 "cat file1" \
17681"${username}
17682[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]
17683${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
17684file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
17685
17686
17687file1,v
176881\.1
17689${CVSROOT_DIRNAME}/first-dir/file1,v
17690Exp
17691"'\$'"Nonkey"'\$'"
17692"'\$'"Date
17693Exp Exp
17694xx file1,v
17695xx Revision 1\.1  [0-9/]* [0-9:]*  ${username}
17696xx add
17697xx"
17698
17699	  dotest keyword-15 "${testcvs} update -ko file1" "U file1"
17700	  dotest keyword-16 "cat file1" \
17701'\$'"Author"'\$'"
17702"'\$'"Date"'\$'"
17703"'\$'"Header"'\$'"
17704"'\$'"Id"'\$'"
17705"'\$'"Locker"'\$'"
17706"'\$'"Name"'\$'"
17707"'\$'"RCSfile"'\$'"
17708"'\$'"Revision"'\$'"
17709"'\$'"Source"'\$'"
17710"'\$'"State"'\$'"
17711"'\$'"Nonkey"'\$'"
17712"'\$'"Date
17713"'\$'"State"'\$'" "'\$'"State"'\$'"
17714xx "'\$'"Log"'\$'
17715
17716	  # Test the Name keyword.  First go back to normal expansion.
17717
17718	  dotest keyword-17 "${testcvs} update -A file1" "U file1"
17719
17720	  echo '$''Name$' > file1
17721	  dotest keyword-18 "${testcvs} ci -m modify file1" \
17722"Checking in file1;
17723${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17724new revision: 1\.2; previous revision: 1\.1
17725done"
17726	  dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
17727	  echo "change" >> file1
17728	  dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
17729"Checking in file1;
17730${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17731new revision: 1\.3; previous revision: 1\.2
17732done"
17733	  dotest keyword-21 "${testcvs} -q update -r tag1" "[UP] file1"
17734
17735	  dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$'
17736
17737	  if $remote; then
17738	    # Like serverpatch-8.  Not sure there is anything much we
17739	    # can or should do about this.
17740	    dotest keyword-23r "${testcvs} update -A file1" "P file1
17741${PROG} update: checksum failure after patch to \./file1; will refetch
17742${PROG} client: refetching unpatchable files
17743U file1"
17744	  else
17745	    dotest keyword-23 "${testcvs} update -A file1" "[UP] file1"
17746	  fi
17747	  dotest keyword-24 "cat file1" '\$'"Name:  "'\$'"
17748change"
17749
17750	  cd ../..
17751	  rm -r 1
17752	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17753	  ;;
17754
17755	keywordlog)
17756	  # Test the Log keyword.
17757	  mkdir 1; cd 1
17758	  dotest keywordlog-1 "${testcvs} -q co -l ." ''
17759	  mkdir first-dir
17760	  dotest keywordlog-2 "${testcvs} add first-dir" \
17761"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17762	  cd first-dir
17763	  echo initial >file1
17764	  dotest keywordlog-3 "${testcvs} add file1" \
17765"${PROG} [a-z]*: scheduling file .file1. for addition
17766${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
17767
17768	  # See "rmadd" for a list of other tests of cvs ci -r.
17769	  dotest keywordlog-4 "${testcvs} -q ci -r 1.3 -m add file1" \
17770"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17771done
17772Checking in file1;
17773${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17774initial revision: 1\.3
17775done"
17776
17777	  cd ../..
17778	  mkdir 2; cd 2
17779	  dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
17780	  cd ../1/first-dir
17781
17782	  echo 'xx $''Log$' >> file1
17783	  cat >${TESTDIR}/comment.tmp <<EOF
17784First log line
17785Second log line
17786EOF
17787	  # As with rmadd-25, "cvs ci -r" sets a sticky tag.
17788	  dotest_fail keywordlog-4b \
17789"${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
17790"${PROG} [a-z]*: sticky tag .1\.3. for file .file1. is not a branch
17791${PROG} \[[a-z]* aborted\]: correct above errors first!"
17792	  dotest keywordlog-4c "${testcvs} -q update -A" "M file1"
17793
17794	  dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
17795"Checking in file1;
17796${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17797new revision: 1\.4; previous revision: 1\.3
17798done"
17799	  rm -f ${TESTDIR}/comment.tmp
17800	  dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
17801	  dotest keywordlog-7 "cat file1" \
17802"initial
17803xx "'\$'"Log: file1,v "'\$'"
17804xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17805xx First log line
17806xx Second log line
17807xx"
17808
17809	  cd ../../2/first-dir
17810	  dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
17811	  dotest keywordlog-9 "cat file1" \
17812"initial
17813xx "'\$'"Log: file1,v "'\$'"
17814xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17815xx First log line
17816xx Second log line
17817xx"
17818	  cd ../../1/first-dir
17819
17820	  echo "change" >> file1
17821	  dotest keywordlog-10 "${testcvs} ci -m modify file1" \
17822"Checking in file1;
17823${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17824new revision: 1\.5; previous revision: 1\.4
17825done"
17826	  dotest keywordlog-11 "cat file1" \
17827"initial
17828xx "'\$'"Log: file1,v "'\$'"
17829xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
17830xx modify
17831xx
17832xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17833xx First log line
17834xx Second log line
17835xx
17836change"
17837
17838	  cd ../../2/first-dir
17839	  dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
17840	  dotest keywordlog-13 "cat file1" \
17841"initial
17842xx "'\$'"Log: file1,v "'\$'"
17843xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
17844xx modify
17845xx
17846xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17847xx First log line
17848xx Second log line
17849xx
17850change"
17851
17852	  cd ../../1/first-dir
17853	  dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
17854	  echo br-change >>file1
17855	  dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
17856"Checking in file1;
17857${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
17858new revision: 1\.4\.2\.1; previous revision: 1\.4
17859done"
17860	  dotest keywordlog-16 "cat file1" \
17861"initial
17862xx "'\$'"Log: file1,v "'\$'"
17863xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
17864xx br-modify
17865xx
17866xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17867xx First log line
17868xx Second log line
17869xx
17870br-change"
17871	  cd ../../2/first-dir
17872	  dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
17873	  dotest keywordlog-18 "cat file1" \
17874"initial
17875xx "'\$'"Log: file1,v "'\$'"
17876xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
17877xx br-modify
17878xx
17879xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17880xx First log line
17881xx Second log line
17882xx
17883br-change"
17884	  cd ../..
17885	  dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
17886"initial
17887xx "'\$'"Log: file1,v "'\$'"
17888xx Revision 1\.4\.2\.1  [0-9/]* [0-9:]*  ${username}
17889xx br-modify
17890xx
17891xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17892xx First log line
17893xx Second log line
17894xx
17895br-change"
17896	  dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
17897"initial
17898xx "'\$'"Log: file1,v "'\$'"
17899xx Revision 1\.5  [0-9/]* [0-9:]*  ${username}
17900xx modify
17901xx
17902xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17903xx First log line
17904xx Second log line
17905xx
17906change"
17907	  dotest keywordlog-21 "${testcvs} -q co -p -r 1.4 first-dir/file1" \
17908"initial
17909xx "'\$'"Log: file1,v "'\$'"
17910xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17911xx First log line
17912xx Second log line
17913xx"
17914
17915	  cd 2/first-dir
17916	  # OK, the basic rule for keyword expansion is that it
17917	  # happens on checkout.  And the rule for annotate is that
17918	  # it annotates a checked-in revision, rather than a checked-out
17919	  # file.  So, although it is kind of confusing that the latest
17920	  # revision does not appear in the annotated output, and the
17921	  # annotated output does not quite match what you'd get with
17922	  # update or checkout, the behavior is more or less logical.
17923	  # The same issue occurs with annotate and other keywords,
17924	  # I think, although it is particularly noticeable for $Log.
17925	  dotest keywordlog-22 "${testcvs} ann -r br file1" \
17926"Annotations for file1
17927\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
179281\.3          (${username} *[0-9a-zA-Z-]*): initial
179291\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
179301\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
179311\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx First log line
179321\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx Second log line
179331\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): xx
179341\.4\.2\.1      (${username} *[0-9a-zA-Z-]*): br-change"
17935	  dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \
17936"Annotations for file1
17937\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
179381\.3          (${username} *[0-9a-zA-Z-]*): initial
179391\.5          (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
179401\.5          (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
179411\.5          (${username} *[0-9a-zA-Z-]*): xx First log line
179421\.5          (${username} *[0-9a-zA-Z-]*): xx Second log line
179431\.5          (${username} *[0-9a-zA-Z-]*): xx
179441\.5          (${username} *[0-9a-zA-Z-]*): change"
17945	  cd ../..
17946
17947	  #
17948	  # test the operation of 'admin -o' in conjunction with keywords
17949	  # (especially Log - this used to munge the RCS file for all time)
17950	  #
17951
17952	  dotest keywordlog-24 \
17953"${testcvs} admin -oHEAD 1/first-dir/file1" \
17954"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
17955deleting revision 1\.5
17956done"
17957
17958	  dotest keywordlog-25 \
17959"${testcvs} -q co -p first-dir/file1" \
17960"initial
17961xx "'\$'"Log: file1,v "'\$'"
17962xx Revision 1\.4  [0-9/]* [0-9:]*  ${username}
17963xx First log line
17964xx Second log line
17965xx"
17966
17967	  if $keep; then
17968	    echo Keeping ${TESTDIR} and exiting due to --keep
17969	    exit 0
17970	  fi
17971
17972	  rm -r 1 2
17973	  rm -rf ${CVSROOT_DIRNAME}/first-dir
17974	  ;;
17975
17976	keyword2)
17977	  # Test merging on files with keywords:
17978	  #   without -kk
17979	  #   with -kk
17980	  #     on text files
17981	  #     on binary files
17982	  # Note:  This test assumes that CVS has already passed the binfiles
17983	  #    test sequence
17984	  # Note2:  We are testing positive on binary corruption here
17985	  #    we probably really DON'T want to 'cvs update -kk' a binary file...
17986	  mkdir 1; cd 1
17987	  dotest keyword2-1 "${testcvs} -q co -l ." ''
17988	  mkdir first-dir
17989	  dotest keyword2-2 "${testcvs} add first-dir" \
17990"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
17991          cd first-dir
17992
17993	  echo '$''Revision$' >> file1
17994	  echo "I" >>file1
17995	  echo "like" >>file1
17996	  echo "long" >>file1
17997	  echo "files!" >>file1
17998	  echo "" >>file1
17999	  echo "a test line for our times" >>file1
18000	  echo "" >>file1
18001	  echo "They" >>file1
18002	  echo "make" >>file1
18003	  echo "diff" >>file1
18004	  echo "look like it" >>file1
18005	  echo "did a much better" >>file1
18006	  echo "job." >>file1
18007	  dotest keyword2-3 "${testcvs} add file1" \
18008"${PROG} [a-z]*: scheduling file .file1. for addition
18009${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
18010
18011	  ${AWK} 'BEGIN { printf "%c%c%c%sRevision: 1.1 $@%c%c", \
18012	    2, 10, 137, "$", 13, 10 }' \
18013	    </dev/null | ${TR} '@' '\000' >../binfile.dat
18014	  cp ../binfile.dat .
18015	  dotest keyword2-5 "${testcvs} add -kb binfile.dat" \
18016"${PROG} [a-z]*: scheduling file .binfile\.dat. for addition
18017${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
18018
18019	  dotest keyword2-6 "${testcvs} -q ci -m add" \
18020"RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
18021done
18022Checking in binfile\.dat;
18023${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
18024initial revision: 1\.1
18025done
18026RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18027done
18028Checking in file1;
18029${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18030initial revision: 1\.1
18031done"
18032
18033	  dotest keyword2-7 "${testcvs} -q tag -b branch" \
18034"T binfile\.dat
18035T file1"
18036
18037	  sed -e 's/our/the best of and the worst of/' file1 >f; mv f file1
18038	  dotest keyword2-8 "${testcvs} -q ci -m change" \
18039"Checking in file1;
18040${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18041new revision: 1\.2; previous revision: 1\.1
18042done"
18043
18044	  dotest keyword2-9 "${testcvs} -q update -r branch" '[UP] file1'
18045
18046	  echo "what else do we have?" >>file1
18047	  dotest keyword2-10 "${testcvs} -q ci -m change" \
18048"Checking in file1;
18049${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18050new revision: 1\.1\.2\.1; previous revision: 1\.1
18051done"
18052
18053	  # Okay, first a conflict in file1 - should be okay with binfile.dat
18054	  dotest keyword2-11 "${testcvs} -q update -A -j branch" \
18055"U file1
18056RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18057retrieving revision 1\.1
18058retrieving revision 1\.1\.2\.1
18059Merging differences between 1\.1 and 1\.1\.2\.1 into file1
18060rcsmerge: warning: conflicts during merge"
18061
18062	  dotest_fail keyword2-12 "${testcvs} diff file1" \
18063"Index: file1
18064===================================================================
18065RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18066retrieving revision 1\.2
18067diff -r1\.2 file1
180680a1
18069> <<<<<<< file1
180701a3,5
18071> =======
18072> \\\$""Revision: 1\.1\.2\.1 \\\$
18073> >>>>>>> 1\.1\.2\.1
1807414a19
18075> what else do we have${QUESTION}"
18076
18077	  # Here's the problem... shouldn't -kk a binary file...
18078	  rm file1
18079	  if $remote; then
18080	    dotest keyword2-13r "${testcvs} -q update -A -kk -j branch" \
18081"U binfile.dat
18082U file1
18083RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18084retrieving revision 1\.1
18085retrieving revision 1\.1\.2\.1
18086Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
18087	  else
18088	    dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \
18089"U binfile.dat
18090${PROG} [a-z]*: warning: file1 was lost
18091U file1
18092RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18093retrieving revision 1\.1
18094retrieving revision 1\.1\.2\.1
18095Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
18096	  fi
18097
18098	  # binfile won't get checked in, but it is now corrupt and could
18099	  # have been checked in if it had changed on the branch...
18100	  dotest keyword2-14 "${testcvs} -q ci -m change" \
18101"Checking in file1;
18102${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18103new revision: 1\.3; previous revision: 1\.2
18104done"
18105
18106	  dotest_fail keyword2-15 "cmp binfile.dat ../binfile.dat" \
18107"binfile\.dat \.\./binfile\.dat differ: char 13, line 2"
18108
18109	  # Okay, restore everything and make CVS try and merge a binary file...
18110	  dotest keyword2-16 "${testcvs} -q update -A" \
18111"[UP] binfile.dat
18112[UP] file1"
18113	  dotest keyword2-17 "${testcvs} -q tag -b branch2" \
18114"T binfile\.dat
18115T file1"
18116	  dotest keyword2-18 "${testcvs} -q update -r branch2" ''
18117
18118	  ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
18119	    </dev/null | ${TR} '@' '\000' >>binfile.dat
18120	  dotest keyword2-19 "${testcvs} -q ci -m badbadbad" \
18121"Checking in binfile\.dat;
18122${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v  <--  binfile\.dat
18123new revision: 1\.1\.4\.1; previous revision: 1\.1
18124done"
18125	  dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \
18126"U binfile\.dat
18127RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
18128retrieving revision 1\.1
18129retrieving revision 1\.1\.4\.1
18130Merging differences between 1\.1 and 1\.1\.4\.1 into binfile\.dat
18131U file1"
18132
18133	  # Yep, it's broke, 'cept for that gal in Hodunk who uses -kk
18134	  # so that some files only merge when she says so.  Time to clean up...
18135	  cd ../..
18136	  rm -r 1
18137	  rm -rf ${CVSROOT_DIRNAME}/first-dir
18138	  ;;
18139
18140	head)
18141	  # Testing handling of the HEAD special tag.
18142	  # There are many cases involving added and removed files
18143	  # which we don't yet try to deal with.
18144	  # TODO: We also could be paying much closer attention to
18145	  # "head of the trunk" versus "head of the default branch".
18146	  # That is what "cvs import" is doing here (but I didn't really
18147	  # fully follow through on writing the tests for that case).
18148	  mkdir imp-dir
18149	  cd imp-dir
18150	  echo 'imported contents' >file1
18151	  # It may seem like we don't do much with file2, but do note that
18152	  # the "cvs diff" invocations do also diff file2 (and come up empty).
18153	  echo 'imported contents' >file2
18154	  dotest_sort head-1 "${testcvs} import -m add first-dir tag1 tag2" \
18155"
18156
18157N first-dir/file1
18158N first-dir/file2
18159No conflicts created by this import"
18160	  cd ..
18161	  rm -r imp-dir
18162	  mkdir 1
18163	  cd 1
18164	  dotest head-2 "${testcvs} -q co first-dir" \
18165"U first-dir/file1
18166U first-dir/file2"
18167	  cd first-dir
18168	  echo 'add a line on trunk' >> file1
18169	  dotest head-3 "${testcvs} -q ci -m modify" \
18170"Checking in file1;
18171${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18172new revision: 1\.2; previous revision: 1\.1
18173done"
18174	  dotest head-4 "${testcvs} -q tag trunktag" "T file1
18175T file2"
18176	  echo 'add a line on trunk after trunktag' >> file1
18177	  dotest head-5 "${testcvs} -q ci -m modify" \
18178"Checking in file1;
18179${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18180new revision: 1\.3; previous revision: 1\.2
18181done"
18182	  dotest head-6 "${testcvs} -q tag -b br1" "T file1
18183T file2"
18184	  dotest head-7 "${testcvs} -q update -r br1" ""
18185	  echo 'modify on branch' >>file1
18186	  dotest head-8 "${testcvs} -q ci -m modify" \
18187"Checking in file1;
18188${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18189new revision: 1\.3\.2\.1; previous revision: 1\.3
18190done"
18191	  dotest head-9 "${testcvs} -q tag brtag" "T file1
18192T file2"
18193	  echo 'modify on branch after brtag' >>file1
18194	  dotest head-10 "${testcvs} -q ci -m modify" \
18195"Checking in file1;
18196${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18197new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
18198done"
18199	  # With no sticky tags, HEAD is the head of the trunk.
18200	  dotest head-trunk-setup "${testcvs} -q update -A" "[UP] file1"
18201	  dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
18202"imported contents
18203add a line on trunk
18204add a line on trunk after trunktag"
18205	  # and diff thinks so too.  Case (a) from the comment in
18206	  # cvs.texinfo (Common options).
18207	  dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
18208"Index: file1
18209===================================================================
18210RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18211retrieving revision 1\.3
18212retrieving revision 1\.3\.2\.2
18213diff -c -r1\.3 -r1\.3\.2\.2
18214\*\*\* file1	${RFCDATE}	1\.3
18215--- file1	${RFCDATE}	1\.3\.2\.2
18216\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18217\*\*\* 1,3 \*\*\*\*
18218--- 1,5 ----
18219  imported contents
18220  add a line on trunk
18221  add a line on trunk after trunktag
18222${PLUS} modify on branch
18223${PLUS} modify on branch after brtag"
18224
18225	  # With a branch sticky tag, HEAD is the head of the trunk.
18226	  dotest head-br1-setup "${testcvs} -q update -r br1" "[UP] file1"
18227	  dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
18228"imported contents
18229add a line on trunk
18230add a line on trunk after trunktag"
18231	  # But diff thinks that HEAD is "br1".  Case (b) from cvs.texinfo.
18232	  # Probably people are relying on it.
18233	  dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
18234
18235	  # With a nonbranch sticky tag on a branch,
18236	  # HEAD is the head of the trunk
18237	  dotest head-brtag-setup "${testcvs} -q update -r brtag" "[UP] file1"
18238	  dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
18239"imported contents
18240add a line on trunk
18241add a line on trunk after trunktag"
18242
18243	  # CVS 1.9 and older thought that HEAD is "brtag" (this was
18244	  # noted as "strange, maybe accidental").  But "br1" makes a
18245	  # whole lot more sense.
18246	  dotest head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
18247
18248	  # With a nonbranch sticky tag on the trunk, HEAD is the head
18249	  # of the trunk, I think.
18250	  dotest head-trunktag-setup "${testcvs} -q update -r trunktag" \
18251"[UP] file1"
18252	  dotest head-trunktag-check "cat file1" "imported contents
18253add a line on trunk"
18254	  dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
18255"imported contents
18256add a line on trunk
18257add a line on trunk after trunktag"
18258	  # Like head-brtag-diff, there is a non-branch sticky tag.
18259	  dotest_fail head-trunktag-diff \
18260	    "${testcvs} -q diff -c -r HEAD -r br1" \
18261"Index: file1
18262===================================================================
18263RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18264retrieving revision 1\.3
18265retrieving revision 1\.3\.2\.2
18266diff -c -r1\.3 -r1\.3\.2\.2
18267\*\*\* file1	${RFCDATE}	1\.3
18268--- file1	${RFCDATE}	1\.3\.2\.2
18269\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
18270\*\*\* 1,3 \*\*\*\*
18271--- 1,5 ----
18272  imported contents
18273  add a line on trunk
18274  add a line on trunk after trunktag
18275${PLUS} modify on branch
18276${PLUS} modify on branch after brtag"
18277
18278	  # Also might test what happens if we setup with update -r
18279	  # HEAD.  In general, if sticky tags matter, does the
18280	  # behavior of "update -r <foo>" (without -p) depend on the
18281	  # sticky tags before or after the update?
18282
18283	  # Note that we are testing both the case where this deletes
18284	  # a revision (file1) and the case where it does not (file2)
18285	  dotest_fail head-o0a "${testcvs} admin -o ::br1" \
18286"${PROG} [a-z]*: Administrating \.
18287RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18288${PROG} [a-z]*: cannot remove revision 1\.3\.2\.1 because it has tags
18289${PROG} [a-z]*: RCS file for .file1. not modified\.
18290RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18291done"
18292	  dotest head-o0b "${testcvs} tag -d brtag" \
18293"${PROG} [a-z]*: Untagging \.
18294D file1
18295D file2"
18296	  dotest head-o1 "${testcvs} admin -o ::br1" \
18297"${PROG} [a-z]*: Administrating \.
18298RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18299deleting revision 1\.3\.2\.1
18300done
18301RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18302done"
18303	  cd ../..
18304	  rm -r 1
18305	  rm -rf ${CVSROOT_DIRNAME}/first-dir
18306	  ;;
18307
18308	tagdate)
18309	  # Test combining -r and -D.
18310	  #
18311	  # Note that this is not a complete test.  It relies on the fact
18312	  # that update, checkout and export have a LOT of shared code.
18313	  # Notice:
18314	  #	1)  checkout is never tested at all with -r -D
18315	  #	2)  update never uses an argument to '-D' besides 'now'
18316	  #		(this test does not provide enough data to prove
18317	  #		that 'cvs update' with both a '-r' and a '-D'
18318	  #		specified does not ignore '-D': a 'cvs up
18319	  #		-r<branch> -Dnow' and a 'cvs up -r<branch>'
18320	  #		should specify the same file revision).
18321	  #	3)  export uses '-r<branch> -D<when there was a different
18322	  #		revision>', hopefully completing this behavior test
18323	  #		for checkout and update as well.
18324	  #
18325	  mkdir 1; cd 1
18326	  dotest tagdate-1 "${testcvs} -q co -l ." ''
18327	  mkdir first-dir
18328	  dotest tagdate-2 "${testcvs} add first-dir" \
18329"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18330	  cd first-dir
18331
18332	  echo trunk-1 >file1
18333	  dotest tagdate-3 "${testcvs} add file1" \
18334"${PROG} [a-z]*: scheduling file .file1. for addition
18335${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
18336	  dotest tagdate-4 "${testcvs} -q ci -m add" \
18337"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18338done
18339Checking in file1;
18340${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18341initial revision: 1\.1
18342done"
18343	  dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
18344	  dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
18345	  echo trunk-2 >file1
18346	  dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
18347"Checking in file1;
18348${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18349new revision: 1\.2; previous revision: 1\.1
18350done"
18351	  # We are testing -r -D where br1 is a (magic) branch without
18352	  # any revisions.  First the case where br2 doesn't have any
18353	  # revisions either:
18354	  dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
18355	  dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
18356	  echo br2-1 >file1
18357	  dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
18358"Checking in file1;
18359${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18360new revision: 1\.1\.4\.1; previous revision: 1\.1
18361done"
18362
18363	  # Then the case where br2 does have revisions:
18364	  dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
18365
18366	  # For some reason, doing this on a branch seems to be relevant.
18367	  dotest_fail tagdate-12 "${testcvs} -q update -j:yesterday" \
18368"${PROG} \[[a-z]* aborted\]: argument to join may not contain a date specifier without a tag"
18369	  # And check export
18370
18371	  # Wish some shorter sleep interval would suffice, but I need to
18372	  # guarantee that the point in time specified by the argument to -D
18373	  # in tagdate-14 and tagdate-16
18374	  # falls in the space of time between commits to br2 and I
18375	  # figure 60 seconds is probably a large enough range to
18376	  # account for most network file system delays and such...
18377	  # as it stands, it takes between 1 and 2 seconds between
18378	  # calling CVS on my machine and the -D argument being used to
18379	  # recall the file revision and this timing will certainly vary
18380	  # by several seconds between machines - dependant on CPUspeeds,
18381	  # I/O speeds, load, etc.
18382	  sleep 60
18383
18384	  echo br2-2 >file1
18385	  dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \
18386"Checking in file1;
18387${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18388new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1
18389done"
18390	  cd ../..
18391	  mkdir 2; cd
18392	  dotest tagdate-14 "${testcvs} -q export -r br2 -D'1 minute ago' first-dir" \
18393"[UP] first-dir/file1"
18394	  dotest tagdate-15 "cat first-dir/file1" "br2-1"
18395
18396	  # Now for annotate
18397	  cd ../1/first-dir
18398	  dotest tagdate-16 "${testcvs} annotate -rbr2 -D'1 minute ago'" \
18399"Annotations for file1
18400\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
184011\.1\.4\.1      (${username} *[0-9a-zA-Z-]*): br2-1"
18402
18403	  dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \
18404"Annotations for file1
18405\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
184061\.1\.4\.2      (${username} *[0-9a-zA-Z-]*): br2-2"
18407
18408	  if $keep; then
18409	    echo Keeping ${TESTDIR} and exiting due to --keep
18410	    exit 0
18411	  fi
18412
18413	  cd ../..
18414	  rm -r 1 2
18415	  rm -rf ${CVSROOT_DIRNAME}/first-dir
18416	  ;;
18417
18418	multibranch2)
18419	  # Commit the first delta on branch A when there is an older
18420	  # branch, B, that already has a delta.  A and B come from the
18421	  # same branch point.  Then verify that branches A and B are
18422	  # in the right order.
18423	  mkdir 1; cd 1
18424	  dotest multibranch2-1 "${testcvs} -q co -l ." ''
18425	  mkdir first-dir
18426	  dotest multibranch2-2 "${testcvs} add first-dir" \
18427"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18428	  cd first-dir
18429
18430	  echo trunk-1 >file1
18431	  echo trunk-1 >file2
18432	  dotest multibranch2-3 "${testcvs} add file1 file2" \
18433"${PROG} [a-z]*: scheduling file .file1. for addition
18434${PROG} [a-z]*: scheduling file .file2. for addition
18435${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
18436	  dotest multibranch2-4 "${testcvs} -q ci -m add" \
18437"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18438done
18439Checking in file1;
18440${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18441initial revision: 1\.1
18442done
18443RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18444done
18445Checking in file2;
18446${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18447initial revision: 1\.1
18448done"
18449	  dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1
18450T file2"
18451	  dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1
18452T file2"
18453
18454	  dotest multibranch2-7 "${testcvs} -q update -r B" ''
18455	  echo branch-B >file1
18456	  echo branch-B >file2
18457	  dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
18458"Checking in file1;
18459${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18460new revision: 1\.1\.4\.1; previous revision: 1\.1
18461done
18462Checking in file2;
18463${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18464new revision: 1\.1\.4\.1; previous revision: 1\.1
18465done"
18466
18467	  dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1
18468[UP] file2'
18469	  echo branch-A >file1
18470	  # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
18471	  dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
18472"Checking in file1;
18473${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18474new revision: 1\.1\.2\.1; previous revision: 1\.1
18475done"
18476
18477	  dotest multibranch2-11 "${testcvs} -q log file1" \
18478"
18479RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18480Working file: file1
18481head: 1\.1
18482branch:
18483locks: strict
18484access list:
18485symbolic names:
18486	B: 1\.1\.0\.4
18487	A: 1\.1\.0\.2
18488keyword substitution: kv
18489total revisions: 3;	selected revisions: 3
18490description:
18491----------------------------
18492revision 1\.1
18493date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
18494branches:  1\.1\.2;  1\.1\.4;
18495add
18496----------------------------
18497revision 1\.1\.4\.1
18498date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
18499modify-on-B
18500----------------------------
18501revision 1\.1\.2\.1
18502date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;  lines: ${PLUS}1 -1
18503modify-on-A
18504============================================================================="
18505
18506	  # This one is more concise.
18507	  dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \
18508"
18509RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18510Working file: file1
18511head: 1\.1
18512branch:
18513locks: strict
18514access list:
18515symbolic names:
18516	B: 1\.1\.0\.4
18517	A: 1\.1\.0\.2
18518keyword substitution: kv
18519total revisions: 3;	selected revisions: 1
18520description:
18521----------------------------
18522revision 1\.1
18523date: [0-9/]* [0-9:]*;  author: $username;  state: Exp;
18524branches:  1\.1\.2;  1\.1\.4;
18525add
18526============================================================================="
18527
18528	  # OK, try very much the same thing except we run update -j to
18529	  # bring the changes from B to A.  Probably tests many of the
18530	  # same code paths but might as well keep it separate, I guess.
18531
18532	  dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1
18533[UP] file2"
18534	  dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \
18535"[UP] file2
18536RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18537retrieving revision 1.1
18538retrieving revision 1.1.4.1
18539Merging differences between 1.1 and 1.1.4.1 into file2"
18540	  dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \
18541"Checking in file2;
18542${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18543new revision: 1\.1\.2\.1; previous revision: 1\.1
18544done"
18545	  cd ../..
18546	  rm -r 1
18547	  rm -rf ${CVSROOT_DIRNAME}/first-dir
18548	  ;;
18549
18550	tag8k)
18551	  # In cvs-1.9.27, there is a bug that can cause an abort.
18552	  # It happens when you commit a change to a ,v file that has
18553	  # just the right amount of tag/branch info to align one of the
18554	  # semicolons in the branch info to be on a 8k-byte boundary.
18555	  # The result: rcsbuf_getkey got an abort.  This failure doesn't
18556	  # corrupt the ,v file -- that would be really serious.  But it
18557	  # does leave stale write locks that have to be removed manually.
18558
18559	  mkdir 1
18560	  cd 1
18561
18562	  module=x
18563
18564	  : > junk
18565	  dotest tag8k-1 "$testcvs -Q import -m . $module X Y" ''
18566	  dotest tag8k-2 "$testcvs -Q co $module" ''
18567	  cd $module
18568
18569	  file=m
18570	  : > $file
18571	  dotest tag8k-3 "$testcvs add $file" \
18572"${PROG} [a-z]*: scheduling file .$file. for addition
18573${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
18574	  dotest tag8k-4 "$testcvs -Q ci -m . $file" \
18575"RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
18576done
18577Checking in $file;
18578${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
18579initial revision: 1\.1
18580done"
18581
18582	  # It seems there have to be at least two versions.
18583	  echo a > $file
18584	  dotest tag8k-5 "$testcvs -Q ci -m . $file" \
18585"Checking in $file;
18586${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
18587new revision: 1\.2; previous revision: 1\.1
18588done"
18589
18590	  # Add just under 8K worth of tags.
18591	  t=TAG---------------------------------------------------------------------
18592	  t=$t$t
18593	  t=$t$t$t$t$t
18594	  # Now $t is 720 bytes long.
18595
18596	  # Apply some tags with that long prefix.
18597	  dotest tag8k-6  "$testcvs -Q tag $t-0 $file" ''
18598	  dotest tag8k-7  "$testcvs -Q tag $t-1 $file" ''
18599	  dotest tag8k-8  "$testcvs -Q tag $t-2 $file" ''
18600	  dotest tag8k-9  "$testcvs -Q tag $t-3 $file" ''
18601	  dotest tag8k-10 "$testcvs -Q tag $t-4 $file" ''
18602	  dotest tag8k-11 "$testcvs -Q tag $t-5 $file" ''
18603	  dotest tag8k-12 "$testcvs -Q tag $t-6 $file" ''
18604	  dotest tag8k-13 "$testcvs -Q tag $t-7 $file" ''
18605	  dotest tag8k-14 "$testcvs -Q tag $t-8 $file" ''
18606	  dotest tag8k-15 "$testcvs -Q tag $t-9 $file" ''
18607	  dotest tag8k-16 "$testcvs -Q tag $t-a $file" ''
18608
18609	  # Extract the author value.
18610	  name=`sed -n 's/.*;	author \([^;]*\);.*/\1/p' ${CVSROOT_DIRNAME}/$module/$file,v|head -1`
18611
18612	  # Form a suffix string of length (16 - length($name)).
18613	  # CAREFUL: this will lose if $name is longer than 16.
18614	  sed_pattern=`echo $name|sed s/././g`
18615	  suffix=`echo 1234567890123456|sed s/$sed_pattern//`
18616
18617	  # Add a final tag with length chosen so that it will push the
18618	  # offset of the `;' in the 2nd occurrence of `;\tauthor' in the
18619	  # ,v file to exactly 8192.
18620	  dotest tag8k-17 "$testcvs -Q tag "x8bytes-$suffix" $file" ''
18621
18622	  # This commit would fail with 1.9.27.
18623	  echo a >> $file
18624	  dotest tag8k-18 "$testcvs -Q ci -m . $file" \
18625"Checking in $file;
18626${CVSROOT_DIRNAME}/$module/$file,v  <--  $file
18627new revision: 1\.3; previous revision: 1\.2
18628done"
18629	  cd ../..
18630	  rm -r 1
18631	  rm -rf ${CVSROOT_DIRNAME}/$module
18632	  ;;
18633
18634
18635	admin)
18636	  # More "cvs admin" tests.
18637	  # The basicb-21 test tests rejecting an illegal option.
18638	  # For -l and -u, see "reserved" and "keyword" tests.
18639	  # "binfiles" test has a test of "cvs admin -k".
18640	  # "log2" test has tests of -t and -q options to cvs admin.
18641	  # "rcs" tests -b option also.
18642	  # For -o, see:
18643	  #   admin-22-o1 through admin-23 (various cases not involving ::)
18644	  #   binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
18645	  #   basicb-o* (attempt to delete all revisions)
18646	  #   basica-o1 through basica-o3 (basic :: usage)
18647	  #   head-o1 (::branch, where this deletes a revision or is noop)
18648	  #   branches-o1 (::branch, similar, with different branch topology)
18649	  #   log-o1 (1.3.2.1::)
18650	  #   binfiles-o1 (1.3:: and ::1.3; binary files)
18651	  #   binfiles3-9 (binary files)
18652	  #   Also could be testing:
18653	  #     1.3.2.6::1.3.2.8
18654	  #     1.3.2.6::1.3.2
18655	  #     1.3.2.1::1.3.2.6
18656	  #     1.3::1.3.2.6 (error?  or synonym for ::1.3.2.6?)
18657	  # -n: admin, tagf tests.
18658
18659	  mkdir 1; cd 1
18660	  dotest admin-1 "${testcvs} -q co -l ." ''
18661	  mkdir first-dir
18662	  dotest admin-2 "${testcvs} add first-dir" \
18663"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
18664          cd first-dir
18665
18666	  dotest_fail admin-3 "${testcvs} -q admin -i file1" \
18667"${PROG} admin: the -i option to admin is not supported
18668${PROG} admin: run add or import to create an RCS file
18669${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
18670	  dotest_fail admin-4 "${testcvs} -q log file1" \
18671"${PROG} [a-z]*: nothing known about file1"
18672
18673	  # Set up some files, file2 a plain one and file1 with a revision
18674	  # on a branch.
18675	  touch file1 file2
18676	  dotest admin-5 "${testcvs} add file1 file2" \
18677"${PROG} [a-z]*: scheduling file .file1. for addition
18678${PROG} [a-z]*: scheduling file .file2. for addition
18679${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
18680	  dotest admin-6 "${testcvs} -q ci -m add" \
18681"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18682done
18683Checking in file1;
18684${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18685initial revision: 1\.1
18686done
18687RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18688done
18689Checking in file2;
18690${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18691initial revision: 1\.1
18692done"
18693	  dotest admin-7 "${testcvs} -q tag -b br" "T file1
18694T file2"
18695	  dotest admin-8 "${testcvs} -q update -r br" ""
18696	  echo 'add a line on the branch' >> file1
18697	  dotest admin-9 "${testcvs} -q ci -m modify-on-branch" \
18698"Checking in file1;
18699${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
18700new revision: 1\.1\.2\.1; previous revision: 1\.1
18701done"
18702	  dotest admin-10 "${testcvs} -q update -A" "U file1"
18703
18704	  # Try to recurse with a numeric revision arg.
18705	  # If we wanted to comprehensive about this, we would also test
18706	  # this for -l, -u, and all the different -o syntaxes.
18707	  dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
18708"${PROG} [a-z]*: while processing more than one file:
18709${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
18710	  dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
18711"${PROG} [a-z]*: while processing more than one file:
18712${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
18713
18714	  # try a bad symbolic revision
18715	  dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \
18716"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18717${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file1,v: Symbolic name BOGUS is undefined.
18718${PROG} [a-z]*: RCS file for .file1. not modified\.
18719RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18720${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name BOGUS is undefined.
18721${PROG} [a-z]*: RCS file for .file2. not modified\."
18722
18723	  # Note that -s option applies to the new default branch, not
18724	  # the old one.
18725	  # Also note that the implementation of -a via "rcs" requires
18726	  # no space between -a and the argument.  However, we expect
18727	  # to change that once CVS parses options.
18728	  dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
18729-b1.1.2 -cxx -U -sfoo file1" \
18730"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18731done"
18732	  dotest admin-11a "${testcvs} log -N file1" "
18733RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18734Working file: file1
18735head: 1\.1
18736branch: 1\.1\.2
18737locks:
18738access list:
18739	foo
18740	bar
18741	baz
18742keyword substitution: kv
18743total revisions: 2;	selected revisions: 2
18744description:
18745----------------------------
18746revision 1\.1
18747date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18748branches:  1\.1\.2;
18749add
18750----------------------------
18751revision 1\.1\.2\.1
18752date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
18753modify-on-branch
18754============================================================================="
18755	  dotest admin-12 "${testcvs} -q admin -bbr file1" \
18756"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18757done"
18758	  dotest admin-12a "${testcvs} log -N file1" "
18759RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18760Working file: file1
18761head: 1\.1
18762branch: 1\.1\.2
18763locks:
18764access list:
18765	foo
18766	bar
18767	baz
18768keyword substitution: kv
18769total revisions: 2;	selected revisions: 2
18770description:
18771----------------------------
18772revision 1\.1
18773date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18774branches:  1\.1\.2;
18775add
18776----------------------------
18777revision 1\.1\.2\.1
18778date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
18779modify-on-branch
18780============================================================================="
18781
18782	  # "cvs log" doesn't print the comment leader.  RCS 5.7 will print
18783	  # the comment leader only if one specifies "-V4" to rlog.  So it
18784	  # seems like the only way to test it is by looking at the RCS file
18785	  # directly.  This also serves as a test of exporting RCS files
18786	  # (analogous to the import tests in "rcs").
18787	  # Rather than try to write a rigorous check for whether the
18788	  # file CVS exports is legal, we just write a simpler
18789	  # test for what CVS actually exports, and figure we can revise
18790	  # the check as needed (within the confines of the RCS5 format as
18791	  # documented in RCSFILES).
18792	  # Note that we must accept either 2 or 4 digit year.
18793	  dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
18794"head	1\.1;
18795branch	1\.1\.2;
18796access
18797	foo
18798	bar
18799	baz;
18800symbols
18801	br:1\.1\.0\.2;
18802locks;
18803comment	@xx@;
18804
18805
188061\.1
18807date	[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;
18808branches
18809	1\.1\.2\.1;
18810next	;
18811
188121\.1\.2\.1
18813date	[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;
18814branches;
18815next	;
18816
18817
18818desc
18819@@
18820
18821
188221\.1
18823log
18824@add
18825@
18826text
18827@@
18828
18829
188301\.1\.2\.1
18831log
18832@modify-on-branch
18833@
18834text
18835@a0 1
18836add a line on the branch
18837@"
18838	  dotest admin-14 "${testcvs} -q admin -aauth3 -aauth2,foo \
18839-soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
18840"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18841done"
18842	  dotest admin-15 "${testcvs} -q log file2" "
18843RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18844Working file: file2
18845head: 1\.1
18846branch:
18847locks: strict
18848access list:
18849	auth3
18850	auth2
18851	foo
18852symbolic names:
18853	tagone: 1\.1
18854	br: 1\.1\.0\.2
18855keyword substitution: kv
18856total revisions: 1;	selected revisions: 1
18857description:
18858----------------------------
18859revision 1\.1
18860date: [0-9/]* [0-9:]*;  author: ${username};  state: oneone;
18861changed-log-message
18862============================================================================="
18863
18864	  dotest admin-16 "${testcvs} -q admin \
18865-A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
18866"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18867done"
18868	  dotest admin-17 "${testcvs} -q log file1" "
18869RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18870Working file: file1
18871head: 1\.1
18872branch:
18873locks: strict
18874access list:
18875	foo
18876	bar
18877	baz
18878	auth3
18879	auth2
18880symbolic names:
18881	br: 1\.1
18882keyword substitution: kv
18883total revisions: 2;	selected revisions: 2
18884description:
18885----------------------------
18886revision 1\.1
18887date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18888branches:  1\.1\.2;
18889add
18890----------------------------
18891revision 1\.1\.2\.1
18892date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
18893modify-on-branch
18894============================================================================="
18895
18896	  dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
18897"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18898${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file1,v: symbolic name br already bound to 1\.1
18899${PROG} [a-z]*: RCS file for .file1. not modified\."
18900	  dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
18901"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18902done"
18903	  dotest admin-20 "${testcvs} -q log file1" "
18904RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18905Working file: file1
18906head: 1\.1
18907branch:
18908locks: strict
18909access list:
18910	foo
18911	auth2
18912symbolic names:
18913keyword substitution: kv
18914total revisions: 2;	selected revisions: 2
18915description:
18916----------------------------
18917revision 1\.1
18918date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
18919branches:  1\.1\.2;
18920add
18921----------------------------
18922revision 1.1.2.1
18923date: [0-9/]* [0-9:]*;  author: ${username};  state: foo;  lines: ${PLUS}1 -0
18924modify-on-branch
18925============================================================================="
18926
18927	  # OK, this is starting to get ridiculous, in terms of
18928	  # testing a feature (access lists) which doesn't do anything
18929	  # useful, but what about nonexistent files and
18930	  # relative pathnames in admin -A?
18931	  dotest_fail admin-19a-nonexist \
18932"${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
18933"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18934${PROG} [a-z]*: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
18935${PROG} \[[a-z]* aborted\]: cannot continue"
18936
18937	  # In the remote case, we are cd'd off into the temp directory
18938	  # and so these tests give "No such file or directory" errors.
18939	  if $remote; then :; else
18940	    dotest admin-19a-admin "${testcvs} -q admin -A../../cvsroot/first-dir/file2,v file1" \
18941"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18942done"
18943	    dotest admin-19a-log "${testcvs} -q log -h -N file1" "
18944RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18945Working file: file1
18946head: 1\.1
18947branch:
18948locks: strict
18949access list:
18950	foo
18951	auth2
18952	auth3
18953keyword substitution: kv
18954total revisions: 2
18955============================================================================="
18956	  fi # end of tests skipped for remote
18957
18958	  # Now test that plain -e works right.
18959	  dotest admin-19a-2 "${testcvs} -q admin -e file1" \
18960"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18961done"
18962	  dotest admin-19a-3 "${testcvs} -q log -h -N file1" "
18963RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18964Working file: file1
18965head: 1\.1
18966branch:
18967locks: strict
18968access list:
18969keyword substitution: kv
18970total revisions: 2
18971============================================================================="
18972
18973	  # Put the access list back, to avoid special cases later.
18974	  dotest admin-19a-4 "${testcvs} -q admin -afoo,auth2 file1" \
18975"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
18976done"
18977
18978	  # Add another revision to file2, so we can delete one.
18979	  echo 'add a line' >> file2
18980	  dotest admin-21 "${testcvs} -q ci -m modify file2" \
18981"Checking in file2;
18982${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
18983new revision: 1\.2; previous revision: 1\.1
18984done"
18985	  dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
18986"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
18987deleting revision 1\.1
18988done"
18989	  # Test admin -o.  More variants that we could be testing:
18990	  # * REV: [on branch]
18991	  # * REV1:REV2 [deleting whole branch]
18992	  # * high branch numbers (e.g. 1.2.2.3.2.3)
18993	  # ... and probably others.  See RCS_delete_revs for ideas.
18994
18995	  echo first rev > aaa
18996	  dotest admin-22-o1 "${testcvs} add aaa" \
18997"${PROG} [a-z]*: scheduling file .aaa. for addition
18998${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
18999	  dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
19000"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19001done
19002Checking in aaa;
19003${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19004initial revision: 1\.1
19005done"
19006	  echo second rev >> aaa
19007	  dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
19008"Checking in aaa;
19009${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19010new revision: 1\.2; previous revision: 1\.1
19011done"
19012	  echo third rev >> aaa
19013	  dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
19014"Checking in aaa;
19015${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19016new revision: 1\.3; previous revision: 1\.2
19017done"
19018	  echo fourth rev >> aaa
19019	  dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
19020"Checking in aaa;
19021${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19022new revision: 1\.4; previous revision: 1\.3
19023done"
19024	  echo fifth rev >>aaa
19025	  dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
19026"Checking in aaa;
19027${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19028new revision: 1\.5; previous revision: 1\.4
19029done"
19030	  echo sixth rev >> aaa
19031	  dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
19032"Checking in aaa;
19033${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19034new revision: 1\.6; previous revision: 1\.5
19035done"
19036	  dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
19037"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
190381\.6 locked
19039done"
19040	  dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
19041RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19042Working file: aaa
19043head: 1\.6
19044branch:
19045locks: strict
19046	${username}: 1\.6
19047access list:
19048symbolic names:
19049keyword substitution: kv
19050total revisions: 6;	selected revisions: 1
19051description:
19052----------------------------
19053revision 1\.6	locked by: ${username};
19054date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19055sixth
19056============================================================================="
19057	  dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
19058"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19059${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove locked revision 1\.6
19060${PROG} [a-z]*: RCS file for .aaa. not modified\."
19061	  dotest admin-22-o11 "${testcvs} admin -u aaa" \
19062"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
190631\.6 unlocked
19064done"
19065	  dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
19066"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19067deleting revision 1\.6
19068deleting revision 1\.5
19069done"
19070	  dotest admin-22-o13 "${testcvs} log aaa" "
19071RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19072Working file: aaa
19073head: 1\.4
19074branch:
19075locks: strict
19076access list:
19077symbolic names:
19078keyword substitution: kv
19079total revisions: 4;	selected revisions: 4
19080description:
19081----------------------------
19082revision 1\.4
19083date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19084fourth
19085----------------------------
19086revision 1\.3
19087date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19088third
19089----------------------------
19090revision 1\.2
19091date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19092second
19093----------------------------
19094revision 1\.1
19095date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19096first
19097============================================================================="
19098
19099	  dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
19100	  dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
19101	  echo new branch rev >> aaa
19102	  dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
19103"Checking in aaa;
19104${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19105new revision: 1\.3\.2\.1; previous revision: 1\.3
19106done"
19107	  dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
19108"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19109deleting revision 1\.4
19110${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove branch point 1\.3
19111${PROG} [a-z]*: RCS file for .aaa. not modified\."
19112	  dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
19113"===================================================================
19114Checking out aaa
19115RCS:  ${CVSROOT_DIRNAME}/first-dir/aaa,v
19116VERS: 1\.4
19117\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
19118first rev
19119second rev
19120third rev
19121fourth rev"
19122	  echo second branch rev >> aaa
19123	  dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
19124"Checking in aaa;
19125${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19126new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
19127done"
19128	  echo third branch rev >> aaa
19129	  dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
19130"Checking in aaa;
19131${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19132new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
19133done"
19134	  echo fourth branch rev >> aaa
19135	  dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
19136"Checking in aaa;
19137${CVSROOT_DIRNAME}/first-dir/aaa,v  <--  aaa
19138new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
19139done"
19140	  dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
19141"RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19142deleting revision 1\.3\.2\.1
19143deleting revision 1\.3\.2\.2
19144deleting revision 1\.3\.2\.3
19145done"
19146	  dotest admin-22-o23 "${testcvs} log aaa" "
19147RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
19148Working file: aaa
19149head: 1\.4
19150branch:
19151locks: strict
19152access list:
19153symbolic names:
19154	br1: 1\.3\.0\.2
19155keyword substitution: kv
19156total revisions: 5;	selected revisions: 5
19157description:
19158----------------------------
19159revision 1\.4
19160date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19161fourth
19162----------------------------
19163revision 1\.3
19164date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19165branches:  1\.3\.2;
19166third
19167----------------------------
19168revision 1\.2
19169date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
19170second
19171----------------------------
19172revision 1\.1
19173date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19174first
19175----------------------------
19176revision 1\.3\.2\.4
19177date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}4 -0
19178branch-four
19179============================================================================="
19180
19181	  dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
19182"first rev
19183second rev
19184third rev
19185new branch rev
19186second branch rev
19187third branch rev
19188fourth branch rev"
19189
19190	  # The bit here about how there is a "tagone" tag pointing to
19191	  # a nonexistent revision is documented by rcs.  I dunno, I
19192	  # wonder whether the "cvs admin -o" should give a warning in
19193	  # this case.
19194	  dotest admin-23 "${testcvs} -q log file2" "
19195RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19196Working file: file2
19197head: 1\.2
19198branch:
19199locks: strict
19200access list:
19201	auth3
19202	auth2
19203	foo
19204symbolic names:
19205	tagone: 1\.1
19206	br: 1\.1\.0\.2
19207keyword substitution: kv
19208total revisions: 1;	selected revisions: 1
19209description:
19210----------------------------
19211revision 1\.2
19212date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19213modify
19214============================================================================="
19215
19216	  dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
19217"head	1\.1;
19218access
19219	foo
19220	auth2;
19221symbols;
19222locks; strict;
19223comment	@xx@;
19224
19225
192261\.1
19227date	[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;
19228branches
19229	1\.1\.2\.1;
19230next	;
19231
192321\.1\.2\.1
19233date	[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;
19234branches;
19235next	;
19236
19237
19238desc
19239@@
19240
19241
192421\.1
19243log
19244@add
19245@
19246text
19247@@
19248
19249
192501\.1\.2\.1
19251log
19252@modify-on-branch
19253@
19254text
19255@a0 1
19256add a line on the branch
19257@"
19258
19259	  # Tests of cvs admin -n.  Make use of the results of
19260	  # admin-1 through admin-25.
19261	  # FIXME: We probably shouldn't make use of those results;
19262	  # this test is way too long as it is.
19263
19264	  # tagtwo should be a revision
19265	  #
19266	  dotest admin-26-1 "${testcvs} admin -ntagtwo:tagone file2" \
19267"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19268done"
19269
19270	  # br1 should be a branch
19271	  #
19272	  dotest admin-26-2 "${testcvs} admin -nbr1:br file2" \
19273"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19274done"
19275
19276	  # Attach some tags using RCS versions
19277	  #
19278	  dotest admin-26-3 "${testcvs} admin -ntagthree:1.1 file2" \
19279"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19280done"
19281
19282	  dotest admin-26-4 "${testcvs} admin -nbr2:1.1.2 file2"  \
19283"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19284done"
19285
19286	  dotest admin-26-5 "${testcvs} admin -nbr4:1.1.0.2 file2"  \
19287"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19288done"
19289
19290	  # Check results so far
19291	  #
19292	  dotest admin-26-6 "${testcvs} status -v file2" \
19293"===================================================================
19294File: file2            	Status: Up-to-date
19295
19296   Working revision:	1\.2.*
19297   Repository revision:	1\.2	${CVSROOT_DIRNAME}/first-dir/file2,v
19298   Sticky Tag:		(none)
19299   Sticky Date:		(none)
19300   Sticky Options:	(none)
19301
19302   Existing Tags:
19303	br4                      	(branch: 1\.1\.2)
19304	br2                      	(branch: 1\.1\.2)
19305	tagthree                 	(revision: 1\.1)
19306	br1                      	(branch: 1\.1\.2)
19307	tagtwo                   	(revision: 1\.1)
19308	tagone                   	(revision: 1\.1)
19309	br                       	(branch: 1\.1\.2)"
19310
19311
19312	  # Add a couple more revisions
19313	  #
19314	  echo "nuthr_line" >> file2
19315	  dotest admin-27-1 "${testcvs} commit -m nuthr_line file2"  \
19316"Checking in file2;
19317${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
19318new revision: 1\.3; previous revision: 1\.2
19319done"
19320
19321	  echo "yet_another" >> file2
19322	  dotest admin-27-2 "${testcvs} commit -m yet_another file2"  \
19323"Checking in file2;
19324${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
19325new revision: 1\.4; previous revision: 1\.3
19326done"
19327
19328	  # Fail trying to reattach existing tag with -n
19329	  #
19330	  dotest admin-27-3 "${testcvs} admin -ntagfour:1.1 file2"  \
19331"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19332done"
19333
19334	  dotest_fail admin-27-4 "${testcvs} admin -ntagfour:1.3 file2"  \
19335"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19336${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file2,v: symbolic name tagfour already bound to 1\.1
19337${PROG} [a-z]*: RCS file for .file2. not modified\."
19338
19339	  # Succeed at reattaching existing tag, using -N
19340	  #
19341	  dotest admin-27-5 "${testcvs} admin -Ntagfour:1.3 file2"  \
19342"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19343done"
19344
19345	  # Fail on some bogus operations
19346	  # Try to attach to nonexistant tag
19347	  #
19348	  dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \
19349"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19350${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision tagfive is undefined\.
19351${PROG} [a-z]*: RCS file for .file2. not modified\."
19352
19353	  # Try a some nonexisting numeric target tags
19354	  #
19355	  dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2"  \
19356"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19357${PROG} \[[a-z]* aborted\]: revision .2\.1. does not exist"
19358
19359	  dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2"  \
19360"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19361${PROG} \[[a-z]* aborted\]: revision .2\.1\.2. does not exist"
19362
19363	  # Try some invalid targets
19364	  #
19365	  dotest_fail admin-28-4 "${testcvs} admin -ntagnine:1.a.2 file2"  \
19366"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19367${PROG} \[[a-z]* aborted\]: tag .1\.a\.2. must start with a letter"
19368
19369	  # Confirm that a missing tag is not a fatal error.
19370	  dotest admin-28-5.1 "${testcvs} -Q tag BO+GUS file1" ''
19371	  dotest_fail admin-28-5.2 "${testcvs} admin -ntagten:BO+GUS file2 file1"  \
19372"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19373${PROG} [a-z]*: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision BO${PLUS}GUS is undefined\.
19374${PROG} [a-z]*: RCS file for .file2. not modified\.
19375RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19376done"
19377
19378	  dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2"  \
19379"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
19380${PROG} \[[a-z]* aborted\]: tag .q\.werty. must not contain the characters ..*"
19381
19382	  # Verify the archive
19383	  #
19384	  dotest admin-29 "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
19385"head	1\.4;
19386access
19387	auth3
19388	auth2
19389	foo;
19390symbols
19391	tagfour:1\.3
19392	br4:1\.1\.0\.2
19393	br2:1\.1\.0\.2
19394	tagthree:1\.1
19395	br1:1\.1\.0\.2
19396	tagtwo:1\.1
19397	tagone:1\.1
19398	br:1\.1\.0\.2;
19399locks; strict;
19400comment	@# @;
19401
19402
194031\.4
19404date	[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;
19405branches;
19406next	1\.3;
19407
194081\.3
19409date	[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;
19410branches;
19411next	1\.2;
19412
194131\.2
19414date	[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;
19415branches;
19416next	;
19417
19418
19419desc
19420@@
19421
19422
194231\.4
19424log
19425@yet_another
19426@
19427text
19428@add a line
19429nuthr_line
19430yet_another
19431@
19432
19433
194341\.3
19435log
19436@nuthr_line
19437@
19438text
19439@d3 1
19440@
19441
19442
194431\.2
19444log
19445@modify
19446@
19447text
19448@d2 1
19449@"
19450
19451	  cd ../..
19452	  rm -r 1
19453	  rm -rf ${CVSROOT_DIRNAME}/first-dir
19454	  ;;
19455
19456	reserved)
19457	  # Tests of reserved checkouts.  Eventually this will test
19458	  # rcslock.pl (or equivalent) and all kinds of stuff.  Right
19459	  # now it just does some very basic checks on cvs admin -u
19460	  # and cvs admin -l.
19461	  # Also should test locking on a branch (and making sure that
19462	  # locks from one branch don't get mixed up with those from
19463	  # another.  Both the case where one of the branches is the
19464	  # main branch, and in which neither one is).
19465	  # See also test keyword, which tests that keywords and -kkvl
19466	  # do the right thing in the presence of locks.
19467
19468	  # The usual setup, directory first-dir containing file file1.
19469	  mkdir 1; cd 1
19470	  dotest reserved-1 "${testcvs} -q co -l ." ''
19471	  mkdir first-dir
19472	  dotest reserved-2 "${testcvs} add first-dir" \
19473"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
19474          cd first-dir
19475	  touch file1
19476	  dotest reserved-3 "${testcvs} add file1" \
19477"${PROG} [a-z]*: scheduling file .file1. for addition
19478${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
19479	  dotest reserved-4 "${testcvs} -q ci -m add" \
19480"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19481done
19482Checking in file1;
19483${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
19484initial revision: 1\.1
19485done"
19486
19487	  dotest reserved-5 "${testcvs} -q admin -l file1" \
19488"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
194891\.1 locked
19490done"
19491	  dotest reserved-6 "${testcvs} log -N file1" "
19492RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19493Working file: file1
19494head: 1\.1
19495branch:
19496locks: strict
19497	${username}: 1\.1
19498access list:
19499keyword substitution: kv
19500total revisions: 1;	selected revisions: 1
19501description:
19502----------------------------
19503revision 1\.1	locked by: ${username};
19504date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19505add
19506============================================================================="
19507
19508	  # Note that this just tests the owner of the lock giving
19509	  # it up.  It doesn't test breaking a lock.
19510	  dotest reserved-7 "${testcvs} -q admin -u file1" \
19511"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
195121\.1 unlocked
19513done"
19514
19515	  dotest reserved-8 "${testcvs} log -N file1" "
19516RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
19517Working file: file1
19518head: 1\.1
19519branch:
19520locks: strict
19521access list:
19522keyword substitution: kv
19523total revisions: 1;	selected revisions: 1
19524description:
19525----------------------------
19526revision 1\.1
19527date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
19528add
19529============================================================================="
19530
19531	  # rcslock.pl tests.  Of course, the point isn't to test
19532	  # rcslock.pl from the distribution but equivalent
19533	  # functionality (for example, many sites may have an old
19534	  # rcslock.pl).  The functionality of this hook falls
19535	  # short of the real rcslock.pl though.
19536	  # Note that we can use rlog or look at the RCS file directly,
19537	  # but we can't use "cvs log" because "cvs commit" has a lock.
19538
19539	  cat >${TESTDIR}/lockme <<EOF
19540#!${TESTSHELL}
19541line=\`grep <\$1/\$2,v 'locks ${author}:1\.[0-9];'\`
19542if test -z "\$line"; then
19543  # It isn't locked
19544  exit 0
19545else
19546  user=\`echo \$line | sed -e 's/locks \\(${author}\\):[0-9.]*;.*/\\1/'\`
19547  version=\`echo \$line | sed -e 's/locks ${author}:\\([0-9.]*\\);.*/\\1/'\`
19548  echo "\$user has file a-lock locked for version  \$version" >&2
19549  exit 1
19550fi
19551EOF
19552	  chmod +x ${TESTDIR}/lockme
19553
19554	  echo stuff > a-lock
19555	  dotest reserved-9 "${testcvs} add a-lock" \
19556"${PROG} [a-z]*: scheduling file .a-lock. for addition
19557${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
19558	  dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
19559"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19560done
19561Checking in a-lock;
19562${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
19563initial revision: 1\.1
19564done"
19565	  # FIXME: the contents of CVSROOT fluctuate a lot
19566	  # here. Maybe the expect pattern should just
19567	  # confirm that commitinfo is one of the files checked out,
19568	  # but for now we just check that CVS exited with success.
19569	  cd ..
19570	  if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
19571	    pass reserved-11
19572	  else
19573	    fail reserved-11
19574	  fi
19575	  cd CVSROOT
19576	  echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
19577	  dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
19578"Checking in commitinfo;
19579${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
19580new revision: 1\.2; previous revision: 1\.1
19581done
19582${PROG} [a-z]*: Rebuilding administrative file database"
19583	  cd ..; cd first-dir
19584
19585	  # Simulate (approximately) what a-lock would look like
19586	  # if someone else had locked revision 1.1.
19587	  sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
19588	  chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19589	  dotest reserved-13 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
19590	  chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19591	  echo more stuff >> a-lock
19592	  dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
19593"fred has file a-lock locked for version  1\.1
19594${PROG} [a-z]*: Pre-commit check failed
19595${PROG} \[[a-z]* aborted\]: correct above errors first!"
19596	  # OK, now test "cvs admin -l" in the case where someone
19597	  # else has the file locked.
19598	  dotest_fail reserved-13c "${testcvs} admin -l a-lock" \
19599"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19600${PROG} \[[a-z]* aborted\]: Revision 1\.1 is already locked by fred"
19601
19602	  dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
19603"RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
196041\.1 unlocked
19605done"
19606	  dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
19607"Checking in a-lock;
19608${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
19609new revision: 1\.2; previous revision: 1\.1
19610done"
19611
19612	  # Now test for a bug involving branches and locks
19613	  sed -e 's/locks; strict;/locks fred:1.2; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
19614	  chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19615	  dotest reserved-16 \
19616"mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v" ""
19617	  chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
19618	  dotest reserved-17 "${testcvs} -q tag -b br a-lock" "T a-lock"
19619	  dotest reserved-18 "${testcvs} -q update -r br a-lock" ""
19620	  echo edit it >>a-lock
19621	  dotest reserved-19 "${testcvs} -q ci -m modify a-lock" \
19622"Checking in a-lock;
19623${CVSROOT_DIRNAME}/first-dir/a-lock,v  <--  a-lock
19624new revision: 1\.2\.2\.1; previous revision: 1\.2
19625done"
19626
19627	  # undo commitinfo changes
19628	  cd ../CVSROOT
19629	  echo '# vanilla commitinfo' >commitinfo
19630	  dotest reserved-cleanup-1 "${testcvs} -q ci -m back commitinfo" \
19631"Checking in commitinfo;
19632${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v  <--  commitinfo
19633new revision: 1\.3; previous revision: 1\.2
19634done
19635${PROG} [a-z]*: Rebuilding administrative file database"
19636	  cd ..; rm -r CVSROOT; cd first-dir
19637
19638	  cd ../..
19639	  rm -r 1
19640	  rm ${TESTDIR}/lockme
19641	  rm -rf ${CVSROOT_DIRNAME}/first-dir
19642	  ;;
19643
19644        diffmerge1)
19645	  # Make sure CVS can merge correctly in circumstances where it
19646	  # used to mess up (due to a bug which existed in diffutils 2.7
19647	  # and 2.6, but not 2.5, and which has been fixed in CVS's diff
19648	  # lib by Paul Eggert, bless his bitty heart).
19649
19650	  # This first test involves two working copies, "mine" and
19651	  # "yours", checked out from the same repository at the same
19652	  # time.  In yours, you remove some text from the end of the
19653	  # file and check it in; meanwhile, "me" has commented out some
19654	  # lines earlier in the file, and I go to check it in right
19655	  # after you checked yours in.  CVS naturally tells me the file
19656	  # is not up-to-date, so I run cvs update, but it updates
19657	  # incorrectly, leaving in the lines of text you just deleted.
19658	  # Bad!  I'm in too much of a hurry to actually look at the
19659	  # file, so I check it in and go home, and so your changes have
19660	  # been lost.  Later you discover this, and you suspect me of
19661	  # deliberately sabotaging your work, so you let all the air
19662	  # out of my tires.  Only after a series of expensive lawsuits
19663	  # and countersuits do we discover it this was all CVS's
19664	  # fault.
19665	  #
19666	  # Luckily, this problem has been fixed now, as our test will
19667	  # handily confirm, no doubt:
19668
19669	  # First make a repository containing the original text:
19670
19671	  # We should be here anyway, but cd to it just in case:
19672	  cd ${TESTDIR}
19673
19674	  mkdir diffmerge1
19675	  cd diffmerge1
19676
19677	  # These are the files we both start out with:
19678	  mkdir import
19679	  cd import
19680	  diffmerge_create_older_files
19681
19682	  dotest diffmerge1_import \
19683	    "${testcvs} import -m import diffmerge1 tag1 tag2" \
19684	    "${DOTSTAR}No conflicts created by this import"
19685	  cd ..
19686
19687	  # Check out two working copies, one for "you" and one for
19688	  # "me".  If no branch is used and cvs detects that only one
19689	  # of the two people made changes, then cvs does not run the
19690	  # merge algorithm.  But if a branch is used, then cvs does run
19691	  # the merge algorithm (even in this case of only one of the two
19692	  # people having made changes).  CVS used to have a bug in this
19693	  # case.  Therefore, it is important to test this case by
19694	  # using a branch:
19695	  ${testcvs} rtag     -b tag diffmerge1 >/dev/null 2>&1
19696	  ${testcvs} checkout -r tag diffmerge1 >/dev/null 2>&1
19697	  mv diffmerge1 yours
19698	  ${testcvs} checkout diffmerge1 >/dev/null 2>&1
19699	  mv diffmerge1 mine
19700
19701	  # In your working copy, you'll make changes, and
19702	  # then check in your changes before I check in mine:
19703	  cd yours
19704	  diffmerge_create_your_files
19705          dotest diffmerge1_yours "${testcvs} -q ci -m yours" \
19706"Checking in testcase01;
19707${CVSROOT_DIRNAME}/diffmerge1/testcase01,v  <--  testcase01
19708new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19709done
19710Checking in testcase02;
19711${CVSROOT_DIRNAME}/diffmerge1/testcase02,v  <--  testcase02
19712new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19713done
19714Checking in testcase03;
19715${CVSROOT_DIRNAME}/diffmerge1/testcase03,v  <--  testcase03
19716new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19717done
19718Checking in testcase04;
19719${CVSROOT_DIRNAME}/diffmerge1/testcase04,v  <--  testcase04
19720new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19721done
19722Checking in testcase05;
19723${CVSROOT_DIRNAME}/diffmerge1/testcase05,v  <--  testcase05
19724new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19725done
19726Checking in testcase06;
19727${CVSROOT_DIRNAME}/diffmerge1/testcase06,v  <--  testcase06
19728new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19729done
19730Checking in testcase07;
19731${CVSROOT_DIRNAME}/diffmerge1/testcase07,v  <--  testcase07
19732new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19733done
19734Checking in testcase08;
19735${CVSROOT_DIRNAME}/diffmerge1/testcase08,v  <--  testcase08
19736new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19737done
19738Checking in testcase09;
19739${CVSROOT_DIRNAME}/diffmerge1/testcase09,v  <--  testcase09
19740new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19741done
19742Checking in testcase10;
19743${CVSROOT_DIRNAME}/diffmerge1/testcase10,v  <--  testcase10
19744new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
19745done"
19746
19747	  # Change my copy.  Then I
19748	  # update, after both my modifications and your checkin:
19749	  cd ../mine
19750	  diffmerge_create_my_files
19751	  dotest diffmerge1_mine "${testcvs} -q update -j tag" \
19752"M testcase01
19753RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v
19754retrieving revision 1\.1\.1\.1
19755retrieving revision 1\.1\.1\.1\.2\.1
19756Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase01
19757M testcase02
19758RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v
19759retrieving revision 1\.1\.1\.1
19760retrieving revision 1\.1\.1\.1\.2\.1
19761Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase02
19762M testcase03
19763RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v
19764retrieving revision 1\.1\.1\.1
19765retrieving revision 1\.1\.1\.1\.2\.1
19766Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase03
19767M testcase04
19768RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v
19769retrieving revision 1\.1\.1\.1
19770retrieving revision 1\.1\.1\.1\.2\.1
19771Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase04
19772RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v
19773retrieving revision 1\.1\.1\.1
19774retrieving revision 1\.1\.1\.1\.2\.1
19775Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase05
19776RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v
19777retrieving revision 1\.1\.1\.1
19778retrieving revision 1\.1\.1\.1\.2\.1
19779Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase06
19780M testcase07
19781RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v
19782retrieving revision 1\.1\.1\.1
19783retrieving revision 1\.1\.1\.1\.2\.1
19784Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase07
19785M testcase08
19786RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
19787retrieving revision 1\.1\.1\.1
19788retrieving revision 1\.1\.1\.1\.2\.1
19789Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase08
19790M testcase09
19791RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v
19792retrieving revision 1\.1\.1\.1
19793retrieving revision 1\.1\.1\.1\.2\.1
19794Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase09
19795M testcase10
19796RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v
19797retrieving revision 1\.1\.1\.1
19798retrieving revision 1\.1\.1\.1\.2\.1
19799Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase10"
19800
19801	  # So if your changes didn't make it into my working copy, or
19802	  # in any case if the files do not look like the final text
19803	  # in the files in directory comp_me, then the test flunks:
19804	  cd ..
19805	  mkdir comp_me
19806	  cd comp_me
19807	  diffmerge_create_expected_files
19808	  cd ..
19809	  rm mine/.#*
19810
19811	  # If you have GNU's version of diff, you may try
19812	  # uncommenting the following line which will give more
19813	  # fine-grained information about how cvs differed from the
19814	  # correct result:
19815	  #dotest diffmerge1_cmp "diff -u --recursive --exclude=CVS comp_me mine" ''
19816	  dotest diffmerge1_cmp "directory_cmp comp_me mine"
19817
19818	  # Clean up after ourselves:
19819	  cd ..
19820	  if $keep; then :; else
19821	    rm -rf diffmerge1 ${CVSROOT_DIRNAME}/diffmerge1
19822	  fi
19823	  ;;
19824
19825        diffmerge2)
19826
19827	  # FIXME: This test should be rewritten to be much more concise.
19828	  # It currently weighs in at something like 600 lines, but the
19829	  # same thing could probably be tested in more like 50-100 lines.
19830	  mkdir diffmerge2
19831
19832	  # This tests for another diffmerge bug reported by Martin
19833	  # Tomes; actually, his bug was probably caused by an initial
19834	  # fix for the bug in test diffmerge1, and likely wasn't ever
19835	  # a problem in CVS as long as one was using a normal
19836	  # distribution of diff or a version of CVS that has the diff
19837	  # lib in it.
19838	  #
19839	  # Nevertheless, once burned twice cautious, so we test for his
19840	  # bug here.
19841	  #
19842	  # Here is his report, more or less verbatim:
19843	  # ------------------------------------------
19844	  #
19845	  # Put the attached file (sgrid.h,v) into your repository
19846	  # somewhere, check out the module and do this:
19847	  #
19848	  # cvs update -j Review_Phase_2_Enhancements sgrid.h
19849	  # cvs diff -r Review_V1p3 sgrid.h
19850	  #
19851	  # As there have been no changes made on the trunk there
19852	  # should be no differences, however this is output:
19853	  #
19854	  # % cvs diff -r Review_V1p3 sgrid.h
19855	  # Index: sgrid.h
19856	  # ===================================================================
19857	  # RCS file: /usr/local/repository/play/fred/sgrid.h,v
19858	  # retrieving revision 1.1.2.1
19859	  # diff -r1.1.2.1 sgrid.h
19860	  # 178a179,184
19861	  # > /*--------------------------------------------------------------
19862	  # > INLINE FUNCTION    :    HORIZONTALLINES
19863	  # > NOTES              :    Description at the end of the file
19864	  # > ----------------------------------------------------------------*/
19865	  # >         uint16 horizontalLines( void );
19866	  # >
19867	  #
19868	  # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
19869	  # differences to sgrid.h version 1.1 and got the correct result
19870	  # so it looks like the built in patch is faulty.
19871	  # -------------------------------------------------------------------
19872	  #
19873	  # This is the RCS file, sgrid.h,v, that he sent:
19874
19875	  echo "head	1.1;
19876access;
19877symbols
19878	Review_V1p3:1.1.2.1
19879	Review_V1p3C:1.1.2.1
19880	Review_1p3A:1.1.2.1
19881	Review_V1p3A:1.1.2.1
19882	Review_Phase_2_Enhancements:1.1.0.2
19883	Review_V1p2:1.1
19884	Review_V1p2B:1.1
19885	Review_V1p2A:1.1
19886	Review_V1p1:1.1
19887	Review_1p1:1.1;
19888locks; strict;
19889comment	@ * @;
19890
19891
198921.1
19893date	97.04.02.11.20.05;	author colinl;	state Exp;
19894branches
19895	1.1.2.1;
19896next	;
19897
198981.1.2.1
19899date	97.06.09.10.00.07;	author colinl;	state Exp;
19900branches;
19901next	;
19902
19903
19904desc
19905@@
19906
19907
199081.1
19909log
19910@Project:     DEV1175
19911DCN:
19912Tested By:   Colin Law
19913Reviewed By:
19914Reason for Change: Initial Revision of all files
19915
19916Design Change Details:
19917
19918Implications:
19919@
19920text
19921@/* \$""Header:   L:/gpanels/dis/sgrid.h_v   1.1.1.0   24 Jan 1996 14:59:20   PAULT  \$ */
19922/*
19923 * \$""Log:   L:/gpanels/dis/sgrid.h_v  \$
19924 *
19925 *    Rev 1.1.1.0   24 Jan 1996 14:59:20   PAULT
19926 * Branched
19927 *
19928 *    Rev 1.1   24 Jan 1996 12:09:52   PAULT
19929 * Consolidated 4100 code merged to trunk
19930 *
19931 *    Rev 1.0.2.0   01 Jun 1995 14:18:58   DAVEH
19932 * Branched
19933 *
19934 *    Rev 1.0   19 Apr 1995 16:32:48   COLINL
19935 * Initial revision.
19936*/
19937/*****************************************************************************
19938FILE        :   SGRID.H
19939VERSION     :   2.1
19940AUTHOR      :   Dave Hartley
19941SYSTEM      :   Borland C++
19942DESCRIPTION :   The declaration of the scrolling grid class
19943
19944*****************************************************************************/
19945#if !defined(__SGRID_H)
19946#define __SGRID_H
19947
19948#if !defined(__SCROLL_H)
19949#include <scroll.h>
19950#endif
19951
19952#if !defined(__GKI_H)
19953#include \"gki.h\"
19954#endif
19955
19956#if defined PRINTING_SUPPORT
19957class Printer;
19958#endif
19959
19960/*****************************************************************************
19961CLASS      :    ScrollingGrid
19962DESCRIPTION:    This class inherits from a grid and a scrollable, and
19963                can therefore use all the PUBLIC services provided by these
19964                classes. A description of these can be found in
19965                GRID.H and SCROLL.H.
19966                A scrolling grid is a set of horizontal and vertical lines
19967                that scroll and continually update to provide a complete grid
19968
19969*****************************************************************************/
19970
19971class ScrollingGrid : public Scrollable
19972{
19973    public:
19974#if defined _WINDOWS
19975/*---------------------------------------------------------------------------
19976FUNCTION    :   CONSTRUCTOR
19977DESCRIPTION :   sets up the details of the grid, ready for painting
19978ARGUMENTS   :   name  : sgColour
19979                        - the colour of the grid
19980                        sgLineType
19981                        - the syle of line
19982                        sgHorizontalTotal
19983                        - the total number of horizontal grid lines
19984                        verticalSpacingMin
19985                        - the min distance between the vertical grid lines
19986                          on the scrolling axis
19987                        currentTimestamp
19988                        - timestamp value now
19989                        ticksPerSecond
19990                        - number of timestamp ticks per second
19991                        ticksPerPixel
19992                        - number of timestamp ticks per pixel required
19993
19994RETURN      :   None
19995NOTES       :
19996---------------------------------------------------------------------------*/
19997        ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType,
19998            uint16 sgHorizontalTotal,
19999            uint16 verticalSpacingMin, uint32 currentTimestamp,
20000            uint16 ticksPerSecond, uint32 ticksPerPixel );
20001#else
20002/*---------------------------------------------------------------------------
20003FUNCTION    :   CONSTRUCTOR
20004DESCRIPTION :   sets up the details of the grid, ready for painting
20005ARGUMENTS   :   name  : sgColour
20006                        - the colour of the grid
20007                        sgLineType
20008                        - the syle of line
20009                        sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
20010                        - the total number of horizontal grid lines
20011                        sgVerticalSpacing
20012                        - the distance between the vertical grid lines
20013                        on the scrolling axis
20014
20015RETURN      :   None
20016NOTES       :   If the caller does not get the total grid lines value, synced
20017                with the overall size of the viewport, the spacing between
20018                grid lines will not be consistent.
20019
20020---------------------------------------------------------------------------*/
20021        ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
20022                     , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
20023#endif
20024/*---------------------------------------------------------------------------
20025FUNCTION    :   DESTRUCTOR
20026DESCRIPTION :   tidies it all up
20027ARGUMENTS   :   name  :
20028
20029RETURN      :   None
20030NOTES       :
20031---------------------------------------------------------------------------*/
20032        ~ScrollingGrid( void );
20033
20034/*---------------------------------------------------------------------------
20035FUNCTION    :   ATTACH
20036DESCRIPTION :   This service overloads the base class service, as it does
20037                additional work at the time of attachment.
20038
20039ARGUMENTS   :   name  : tDrawingArea
20040                        - the scrolled viewport to attach this trend to
20041
20042RETURN      :   None
20043NOTES       :
20044---------------------------------------------------------------------------*/
20045        void attach( SViewport *tDrawingArea );
20046
20047#if defined _WINDOWS
20048/*---------------------------------------------------------------------------
20049FUNCTION    :   calculateVerticalSpacing
20050DESCRIPTION :   determines optimum spacing along time axis
20051ARGUMENTS   :
20052RETURN      :   None
20053NOTES       :
20054---------------------------------------------------------------------------*/
20055        void calculateVerticalSpacing();
20056
20057/*---------------------------------------------------------------------------
20058FUNCTION    :   gridSpacingTicks
20059DESCRIPTION :   Provides the grid spacing in the time axis in ticks
20060ARGUMENTS   :
20061RETURN      :   Number of ticks
20062NOTES       :
20063---------------------------------------------------------------------------*/
20064        uint32 gridSpacingTicks();
20065
20066#endif
20067
20068/*---------------------------------------------------------------------------
20069INLINE FUNCTION    :    HORIZONTALLINES
20070NOTES              :    Description at the end of the file
20071---------------------------------------------------------------------------*/
20072        uint16 horizontalLines( void );
20073
20074#if defined _WINDOWS
20075// In Windows the OnDraw() function replaces paint()
20076/*---------------------------------------------------------------------------
20077FUNCTION    :   ScrollingGrid OnDraw
20078DESCRIPTION :   Paints the given area of the grid.
20079                Pure virtual
20080ARGUMENTS   :   pDC     pointer to the device context to use for display
20081                        Note that the device context operates in the coords
20082                        of the window owning the viewport
20083RETURN      :   None
20084NOTES       :
20085---------------------------------------------------------------------------*/
20086        virtual void OnDraw( CDC *pDC );
20087
20088#else   // not Windows
20089
20090/*---------------------------------------------------------------------------
20091FUNCTION    :   PAINT
20092DESCRIPTION :   This extends the standard grid paint method to paint the
20093                viewport relative to its current position.
20094
20095ARGUMENTS   :   name  :
20096
20097RETURN      :   None
20098NOTES       :
20099---------------------------------------------------------------------------*/
20100        void paint( void );
20101#endif
20102
20103/*---------------------------------------------------------------------------
20104FUNCTION    :   P A I N T   T E X T   M A R K E R S
20105DESCRIPTION :   this service allow the text markers to be painted seperatley
20106                from the grid lines
20107
20108ARGUMENTS   :   name :
20109
20110RETURN      :   None
20111NOTES       :
20112---------------------------------------------------------------------------*/
20113        void paintTextMarkers();
20114
20115#if defined PRINTING_SUPPORT
20116/*---------------------------------------------------------------------------
20117FUNCTION    :   P R I N T
20118DESCRIPTION :   This print service prints a grid marker ( being either a
20119                timestamp or a date, IF there is one at the plot position
20120                given
20121
20122ARGUMENTS   :   name :
20123                        displayPosition
20124                        - Where in the log to look to see if there is an
20125                          entry to print
20126
20127                        - printerPtr
20128                          the printer to print to
20129
20130RETURN      :   None
20131NOTES       :
20132---------------------------------------------------------------------------*/
20133        void print( uint16 currentPrintPos, Printer *printerPtr );
20134#endif
20135
20136/*---------------------------------------------------------------------------
20137FUNCTION    :   S E T  D R I V E  D I R E C T I O N
20138DESCRIPTION :   Sets direction for update and scrolling forwards or backwards
20139ARGUMENTS   :   direction  - required direction
20140RETURN      :   None
20141NOTES       :
20142---------------------------------------------------------------------------*/
20143        void setDriveDirection( ScrollDirection direction );
20144
20145/*---------------------------------------------------------------------------
20146FUNCTION    :   S E T U P
20147DESCRIPTION :   service that will setup the grid prior to a paint
20148
20149ARGUMENTS   :   name :
20150                        - newTimestamp
20151
20152
20153                        - newTimeBase
20154                        the number of ticks that represent a plot point on
20155                        the trendgraph.
20156
20157RETURN      :   None
20158NOTES       :
20159---------------------------------------------------------------------------*/
20160        void setup( uint32 newTimestamp, uint32 newTimeBase );
20161
20162#if defined PRINTING_SUPPORT
20163/*---------------------------------------------------------------------------
20164FUNCTION    :   S E T U P   F O R   P R I N T
20165DESCRIPTION :   This service iis to be called prior to printing. It allows
20166                the grid to prepare its markers ready for the print
20167                commands
20168
20169ARGUMENTS   :   name :
20170
20171RETURN      :   None
20172NOTES       :
20173---------------------------------------------------------------------------*/
20174        void setupForPrint();
20175#endif
20176
20177/*---------------------------------------------------------------------------
20178FUNCTION    :   UPDATE
20179DESCRIPTION :   When this service is called it will calculate what needs to
20180                be painted and fill in the display again.
20181
20182ARGUMENTS   :   name  :     timeStamp
20183                            - the reference time of this update.
20184
20185RETURN      :   None
20186NOTES       :
20187---------------------------------------------------------------------------*/
20188        void update( uint32 timeStamp );
20189
20190/*---------------------------------------------------------------------------
20191FUNCTION    :   U P D A T E   B U F F E R
20192DESCRIPTION :   When a display update is not required, use this method. It
20193                updates the internal data ready for a call to paint that
20194                will then show the grid in the right position
20195
20196ARGUMENTS   :   name  :
20197
20198RETURN      :   None
20199NOTES       :
20200---------------------------------------------------------------------------*/
20201        void updateBuffer( void );
20202
20203    private:
20204
20205/*---------------------------------------------------------------------------
20206FUNCTION    :   M A K E   G R I D   M A R K E R
20207DESCRIPTION :   service that perpares a string for display. The string will
20208                either be a short date, or short time. this is determined
20209                by the current setting of the dateMarker flag
20210
20211ARGUMENTS   :   name :  timestampVal
20212                        - the value to convert
20213
20214                        storePtr
20215                        - the place to put the string
20216
20217RETURN      :   None
20218NOTES       :
20219---------------------------------------------------------------------------*/
20220        void makeGridMarker( uint32 timestampVal, char *storePtr );
20221
20222/*---------------------------------------------------------------------------
20223FUNCTION    :   P A I N T   G R I D   M A R K E R
20224DESCRIPTION :   given a position will put the string on the display
20225
20226ARGUMENTS   :   name :
20227                        yPos
20228                        - were it goes on the Y-axis
20229
20230                        gridMarkerPtr
20231                        - what it is
20232
20233RETURN      :   None
20234NOTES       :
20235---------------------------------------------------------------------------*/
20236        void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
20237
20238#if defined _WINDOWS
20239/*---------------------------------------------------------------------------
20240FUNCTION    :   PAINTHORIZONTALLINES
20241DESCRIPTION :   responsible for painting the grids horizontal lines
20242ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
20243                                in viewport coords
20244                pDC             pointer to device context to use
20245
20246RETURN      : None
20247NOTES       :
20248---------------------------------------------------------------------------*/
20249        void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
20250#else
20251/*---------------------------------------------------------------------------
20252FUNCTION    :   PAINTHORIZONTALLINES
20253DESCRIPTION :   responsible for painting the grids horizontal lines
20254ARGUMENTS   : name: xStart
20255                    - the starting X co-ordinate for the horizontal line
20256                    xEnd
20257                    - the ending X co-ordinate for the horizontal line
20258
20259RETURN      : None
20260NOTES       : Remember lines are drawn from origin. The origin in a
20261              horizontal viewport will be the top.
20262---------------------------------------------------------------------------*/
20263        void paintHorizontalLines( uint16 xStart, uint16 xEnd );
20264#endif
20265
20266#if defined _WINDOWS
20267/*---------------------------------------------------------------------------
20268FUNCTION    :   PAINTVERTICALLINES
20269DESCRIPTION :   responsible for painting the grids vertical lines
20270ARGUMENTS   :   pRectToDraw     pointer to rectangle that needs refreshing.
20271                                in viewport coords
20272                offset          offset from rhs that rightmost line would be
20273                                drawn if rectangle included whole viewport
20274                pDC             pointer to device context to use
20275RETURN      : None
20276NOTES       :
20277---------------------------------------------------------------------------*/
20278        void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
20279            CDC* pDC );
20280#else
20281/*---------------------------------------------------------------------------
20282FUNCTION    :   PAINTVERTICALLINES
20283DESCRIPTION :   responsible for painting the grids vertical lines
20284ARGUMENTS   : name  :   yStart
20285                        - the starting Y co-ordinate for the vertical line
20286                        yEnd
20287                        - the ending Y co-ordinate for the vertical line
20288                        offset
20289                        - a starting point offset that determines at what X
20290                        position the first line will be drawn
20291
20292
20293RETURN      : None
20294NOTES       :
20295---------------------------------------------------------------------------*/
20296        void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
20297#endif
20298
20299#if defined _WINDOWS
20300/*---------------------------------------------------------------------------
20301FUNCTION    :   PAINTVERTICALLINE
20302DESCRIPTION :   paints one line at the position specified, and length
20303ARGUMENTS   :   name  : yStart
20304                        - the starting point on the y axis for the line
20305                        yEnd
20306                        - the end point on the y axis for the line
20307                        xPosition
20308                        - The horizontal offset from the start of the viewport
20309                pDC             pointer to device context to use
20310
20311RETURN      :   None
20312NOTES       :   There is not an equivalent horizontal method as yet. This
20313                is a seperate method because the service is useful to a
20314                derivation of this class
20315---------------------------------------------------------------------------*/
20316        void paintVerticalLine( uint16 yStart, uint16 yEnd
20317                              , uint16 xPosition, CDC *pDC );
20318#else
20319/*---------------------------------------------------------------------------
20320FUNCTION    :   PAINTVERTICALLINE
20321DESCRIPTION :   paints one line at the position specified, and length
20322ARGUMENTS   :   name  : yStart
20323                        - the starting point on the y axis for the line
20324                        yEnd
20325                        - the end point on the y axis for the line
20326                        xPosition
20327                        - The horizontal offset from the start of the viewport
20328
20329RETURN      :   None
20330NOTES       :   There is not an equivalent horizontal method as yet. This
20331                is a seperate method because the service is useful to a
20332                derivation of this class
20333---------------------------------------------------------------------------*/
20334        void paintVerticalLine( uint16 yStart, uint16 yEnd
20335                              , uint16 xPosition );
20336#endif
20337
20338/*---------------------------------------------------------------------------
20339INLINE FUNCTION    :    VERTICALSPACING
20340NOTES              :    Description at the end of the file
20341---------------------------------------------------------------------------*/
20342        uint16 verticalSpacing( void );
20343
20344
20345        // Position in viewport that we are now writing to if going forwards
20346        // Note that if this is greater than viewport length then we have
20347        // just scrolled and value must be adjusted before use.
20348        sint16 forwardsOutputPosition;
20349
20350        // Position in viewport that we are now writing to if going backwards
20351        // Note that if this is less than zero then we have
20352        // just scrolled and value must be adjusted before use.
20353        sint16 backwardsOutputPosition;
20354
20355        // position in grid cycle of forwards output position.
20356        // if zero then it is time to output a grid line
20357        sint16 forwardsIntervalCount;
20358
20359        // position in grid cycle of forwards output position.
20360        // if zero then it is time to output a grid line
20361        sint16 backwardsIntervalCount;
20362
20363        uint32  lastUpdateTimestamp;
20364        uint32  timeBase;       // ticks per pixel
20365        uint16  currentOutputPosition;
20366        uint16  gridTimestampSpacing;
20367        uint16  intervalCount;
20368        uint16  horizontalTotal;
20369        uint16  vSpacing;
20370#if defined PRINTING_SUPPORT
20371        uint16  numberOfGridMarkersPrinted;
20372#endif
20373        bool    firstTime;       // indicates first time through
20374        bool    dateMarker;
20375
20376        GkiLineType lineType;
20377        GkiColour   gridColour;
20378
20379    #if defined _WINDOWS
20380        uint16 ticksPerSec;     // number of time ticks per second
20381        uint16 vSpacingMin;     // minimum pixels per division along time axis
20382        CPen *pPen;             // the pen to use for drawing in windows
20383    #endif
20384
20385};
20386
20387
20388/*****************************************************************************
20389                        I N L I N E   F U N C T I O N S
20390*****************************************************************************/
20391
20392/*---------------------------------------------------------------------------
20393FUNCTION    :   HORIZONTALLINES
20394DESCRIPTION :   supplies the number of horizontal lines in the grid
20395ARGUMENTS   :   name  :
20396
20397RETURN      :
20398NOTES       :
20399---------------------------------------------------------------------------*/
20400inline uint16 ScrollingGrid::horizontalLines( void )
20401{
20402    return( horizontalTotal );
20403}
20404/*---------------------------------------------------------------------------
20405FUNCTION    :   VERTICALSPACING
20406DESCRIPTION :   returns the distance between adjacent vertical lines
20407ARGUMENTS   :   name  :
20408
20409RETURN      :   None
20410NOTES       :
20411---------------------------------------------------------------------------*/
20412inline uint16 ScrollingGrid::verticalSpacing( void )
20413{
20414    return( vSpacing );
20415}
20416
20417#endif
20418@
20419
20420
204211.1.2.1
20422log
20423@DEV1194:DS4    Provision of major and minor grid lines
20424@
20425text
20426@d1 1
20427a1 1
20428/* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
20429d3 1
20430a3 12
20431 * \$""Log: sgrid.h,v \$
20432 * Revision 1.1  1997/04/02 11:20:05  colinl
20433 * Project:     DEV1175
20434 * DCN:
20435 * Tested By:   Colin Law
20436 * Reviewed By:
20437 * Reason for Change: Initial Revision of all files
20438 *
20439 * Design Change Details:
20440 *
20441 * Implications:
20442 *
20443d58 6
20444a63 5
20445ARGUMENTS   :   name  : majorColour         colour for major grid lines
20446                        minorColour         colour for minor grid lines
20447                        sgLineType          line type for minor grid lines
20448                        yMajorGridLines     number of major y lines on grid
20449                        yMinorGridLines     number of major y lines on grid
20450d77 2
20451a78 3
20452        ScrollingGrid( GkiColour majorColour, GkiColour minorColour,
20453            GkiLineType sgLineType,
20454            uint16 yMajorGridLines, uint16 yMinorGridLines,
20455a137 17
20456FUNCTION    :   DrawHorizontalGridLines
20457
20458DESCRIPTION :   Draws major or minor grid lines
20459ARGUMENTS   :   pDC         device context
20460                pPen        pen to use
20461                numLines    total lines required
20462                yLow, yHigh, xLow, xHigh   rectangle to draw in
20463                yMax        max y value
20464RETURN      :   None
20465NOTES       :
20466---------------------------------------------------------------------------*/
20467        void DrawHorizontalGridLines( CDC* pDC, CPen* pPen,
20468            uint16 numLines,
20469            uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh,
20470            uint16 yMax );
20471
20472/*---------------------------------------------------------------------------
20473d148 6
20474d448 1
20475a448 2
20476        uint16  m_yMajorGridLines;
20477        uint16  m_yMinorGridLines;
20478d456 2
20479a457 3
20480        GkiLineType lineType;    // line type for minor grid lines
20481        GkiColour   m_majorColour;
20482        GkiColour   m_minorColour;
20483d462 1
20484a462 2
20485        CPen *pMajorPen;        // pen to use for drawing major grid lines
20486        CPen *pMinorPen;        // pen to use for drawing minor grid lines
20487d472 12
20488@" > diffmerge2/sgrid.h,v
20489
20490	  # We have to put the RCS file in the repository by hand for
20491	  # this test:
20492	  mkdir ${CVSROOT_DIRNAME}/diffmerge2
20493	  cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
20494	  rm -rf diffmerge2
20495	  dotest diffmerge2_co \
20496	    "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
20497	  cd diffmerge2
20498	  dotest diffmerge2_update \
20499	    "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
20500	    "${DOTSTAR}erging ${DOTSTAR}"
20501	  # This is the one that counts -- there should be no output:
20502	  dotest diffmerge2_diff \
20503	    "${testcvs} diff -r Review_V1p3 sgrid.h" ''
20504
20505	  cd ..
20506	  rm -rf diffmerge2
20507	  rm -rf ${CVSROOT_DIRNAME}/diffmerge2
20508	  ;;
20509
20510	release)
20511	  # Tests of "cvs release", particularly multiple arguments.
20512	  # Other CVS release tests:
20513	  #   info-cleanup-0 for "cvs -n release".
20514	  #   ignore-193 for the text of the question that cvs release asks.
20515	  #     Also for interactions with cvsignore.
20516	  #   basicc: "-d .", global -Q, no arguments (is a noop),
20517	  #     "cvs release" without -d, multiple arguments.
20518	  #   dirs-4: repository directory has been deleted.
20519	  #   modules2-6: multiple arguments.
20520
20521	  # First the usual setup; create a directory first-dir.
20522	  mkdir 1; cd 1
20523	  dotest release-1 "${testcvs} -q co -l ." ''
20524	  mkdir first-dir
20525	  dotest release-2 "${testcvs} add first-dir" \
20526"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
20527          cd first-dir
20528	  mkdir dir1
20529	  dotest release-3 "${testcvs} add dir1" \
20530"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
20531	  mkdir dir2
20532	  dotest release-4 "${testcvs} add dir2" \
20533"Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository"
20534          cd dir2
20535	  mkdir dir3
20536	  dotest release-5 "${testcvs} add dir3" \
20537"Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
20538
20539          cd ../..
20540	  dotest release-6 "${testcvs} release -d first-dir/dir2/dir3 first-dir/dir1" \
20541"You have .0. altered files in this repository.
20542Are you sure you want to release (and delete) directory .first-dir/dir2/dir3.: \
20543You have .0. altered files in this repository.
20544Are you sure you want to release (and delete) directory .first-dir/dir1.: " <<EOF
20545yes
20546yes
20547EOF
20548	  dotest_fail release-7 "test -d first-dir/dir1" ''
20549	  dotest_fail release-8 "test -d first-dir/dir2/dir3" ''
20550	  dotest release-9 "${testcvs} update" \
20551"${PROG} [a-z]*: Updating \.
20552${PROG} [a-z]*: Updating first-dir
20553${PROG} [a-z]*: Updating first-dir/dir2"
20554
20555          cd first-dir
20556	  mkdir dir1
20557	  dotest release-10 "${testcvs} add dir1" \
20558"Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
20559          cd dir2
20560	  mkdir dir3
20561	  dotest release-11 "${testcvs} add dir3" \
20562"Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
20563
20564          cd ../..
20565	  dotest release-12 "${testcvs} release first-dir/dir2/dir3 first-dir/dir1" \
20566"You have .0. altered files in this repository.
20567Are you sure you want to release directory .first-dir/dir2/dir3.: .. .release. aborted by user choice.
20568You have .0. altered files in this repository.
20569Are you sure you want to release directory .first-dir/dir1.: " <<EOF
20570no
20571yes
20572EOF
20573	  dotest release-13 "${testcvs} release first-dir/dir2/dir3 first-dir/dir2" \
20574"You have .0. altered files in this repository.
20575Are you sure you want to release directory .first-dir/dir2/dir3.: \
20576You have .0. altered files in this repository.
20577Are you sure you want to release directory .first-dir/dir2.: " <<EOF
20578yes
20579yes
20580EOF
20581	  dotest release-14 "test -d first-dir/dir1" ''
20582	  dotest release-15 "test -d first-dir/dir2/dir3" ''
20583	  rm -rf first-dir/dir1 first-dir/dir2
20584
20585	  dotest release-16 "${testcvs} update" \
20586"${PROG} [a-z]*: Updating \.
20587${PROG} [a-z]*: Updating first-dir"
20588	  cd ..
20589	  rm -rf 1
20590	  ;;
20591
20592	multiroot)
20593
20594	  #
20595	  # set up two repositories
20596	  #
20597
20598	  CVSROOT1_DIRNAME=${TESTDIR}/root1
20599	  CVSROOT2_DIRNAME=${TESTDIR}/root2
20600	  CVSROOT1=${CVSROOT1_DIRNAME} ; export CVSROOT1
20601	  CVSROOT2=${CVSROOT2_DIRNAME} ; export CVSROOT2
20602	  if $remote; then
20603	      CVSROOT1=:fork:${CVSROOT1_DIRNAME} ; export CVSROOT1
20604	      CVSROOT2=:fork:${CVSROOT2_DIRNAME} ; export CVSROOT2
20605	  fi
20606	  testcvs1="${testcvs} -d ${CVSROOT1}"
20607	  testcvs2="${testcvs} -d ${CVSROOT2}"
20608
20609	  dotest multiroot-setup-1 "mkdir ${CVSROOT1_DIRNAME} ${CVSROOT2_DIRNAME}" ""
20610	  dotest multiroot-setup-2 "${testcvs1} init" ""
20611	  dotest multiroot-setup-3 "${testcvs2} init" ""
20612
20613	  #
20614	  # create some directories in root1
20615	  #
20616	  mkdir 1; cd 1
20617	  dotest multiroot-setup-4 "${testcvs1} co -l ." "${PROG} [a-z]*: Updating ."
20618	  mkdir mod1-1 mod1-2
20619	  dotest multiroot-setup-5 "${testcvs1} add mod1-1 mod1-2" \
20620"Directory ${CVSROOT1_DIRNAME}/mod1-1 added to the repository
20621Directory ${CVSROOT1_DIRNAME}/mod1-2 added to the repository"
20622	  echo file1-1 > mod1-1/file1-1
20623	  echo file1-2 > mod1-2/file1-2
20624	  dotest multiroot-setup-6 "${testcvs1} add mod1-1/file1-1 mod1-2/file1-2" \
20625"${PROG} [a-z]*: scheduling file .mod1-1/file1-1. for addition
20626${PROG} [a-z]*: scheduling file .mod1-2/file1-2. for addition
20627${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
20628	  dotest multiroot-setup-7 "${testcvs1} commit -m is" \
20629"${PROG} [a-z]*: Examining \.
20630${PROG} [a-z]*: Examining mod1-1
20631${PROG} [a-z]*: Examining mod1-2
20632RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
20633done
20634Checking in mod1-1/file1-1;
20635${CVSROOT1_DIRNAME}/mod1-1/file1-1,v  <--  file1-1
20636initial revision: 1.1
20637done
20638RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
20639done
20640Checking in mod1-2/file1-2;
20641${CVSROOT1_DIRNAME}/mod1-2/file1-2,v  <--  file1-2
20642initial revision: 1.1
20643done"
20644	  cd ..
20645	  rm -rf 1
20646
20647	  #
20648	  # create some directories in root2
20649	  #
20650	  mkdir 1; cd 1
20651	  dotest multiroot-setup-8 "${testcvs2} co -l ." "${PROG} [a-z]*: Updating ."
20652	  mkdir mod2-1 mod2-2
20653	  dotest multiroot-setup-9 "${testcvs2} add mod2-1 mod2-2" \
20654"Directory ${CVSROOT2_DIRNAME}/mod2-1 added to the repository
20655Directory ${CVSROOT2_DIRNAME}/mod2-2 added to the repository"
20656	  echo file2-1 > mod2-1/file2-1
20657	  echo file2-2 > mod2-2/file2-2
20658	  dotest multiroot-setup-6 "${testcvs2} add mod2-1/file2-1 mod2-2/file2-2" \
20659"${PROG} [a-z]*: scheduling file .mod2-1/file2-1. for addition
20660${PROG} [a-z]*: scheduling file .mod2-2/file2-2. for addition
20661${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
20662	  dotest multiroot-setup-10 "${testcvs2} commit -m anyone" \
20663"${PROG} [a-z]*: Examining \.
20664${PROG} [a-z]*: Examining mod2-1
20665${PROG} [a-z]*: Examining mod2-2
20666RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
20667done
20668Checking in mod2-1/file2-1;
20669${CVSROOT2_DIRNAME}/mod2-1/file2-1,v  <--  file2-1
20670initial revision: 1.1
20671done
20672RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
20673done
20674Checking in mod2-2/file2-2;
20675${CVSROOT2_DIRNAME}/mod2-2/file2-2,v  <--  file2-2
20676initial revision: 1.1
20677done"
20678	  cd ..
20679	  rm -rf 1
20680
20681	  # check out a few directories, from simple/shallow to
20682	  # complex/deep
20683	  mkdir 1; cd 1
20684
20685	  # OK, this case is kind of weird.  If we just run things from
20686	  # here, without CVS/Root, then CVS will contact the server
20687	  # mentioned in CVSROOT (which is irrelevant) which will print
20688	  # some messages.  Our workaround is to make sure we have a
20689	  # CVS/Root file at top level.  In the future, it is possible
20690	  # the best behavior will be to extend the existing behavior
20691	  # ("being called from a directory without CVS administration
20692	  # has always meant to process each of the sub-dirs") to also
20693	  # do that if there is no CVSROOT, CVS/Root, or -d at top level.
20694	  #
20695	  # The local case could stumble through the tests without creating
20696	  # the top-level CVS/Root, but we create it for local and for
20697	  # remote to reduce special cases later in the test.
20698	  dotest multiroot-workaround "${testcvs1} -q co -l ." ""
20699
20700	  dotest multiroot-setup-11 "${testcvs1} co mod1-1 mod1-2" \
20701"${PROG} [a-z]*: Updating mod1-1
20702U mod1-1/file1-1
20703${PROG} [a-z]*: Updating mod1-2
20704U mod1-2/file1-2"
20705	  dotest multiroot-setup-12 "${testcvs2} co mod2-1 mod2-2" \
20706"${PROG} [a-z]*: Updating mod2-1
20707U mod2-1/file2-1
20708${PROG} [a-z]*: Updating mod2-2
20709U mod2-2/file2-2"
20710	  cd mod1-2
20711	  dotest multiroot-setup-13 "${testcvs2} co mod2-2" \
20712"${PROG} [a-z]*: Updating mod2-2
20713U mod2-2/file2-2"
20714	  cd ..
20715	  cd mod2-2
20716	  dotest multiroot-setup-14 "${testcvs1} co mod1-2" \
20717"${PROG} [a-z]*: Updating mod1-2
20718U mod1-2/file1-2"
20719	  cd ..
20720
20721	  # Try to determine whether RELATIVE_REPOS is defined
20722	  # so that we can make the following a lot less
20723	  # verbose.
20724
20725	  echo "${CVSROOT1_DIRNAME}/mod1-1" > dotest.abs
20726	  echo "mod1-1" > dotest.rel
20727	  if cmp dotest.abs mod1-1/CVS/Repository >/dev/null 2>&1; then
20728	    AREP1="${CVSROOT1_DIRNAME}/"
20729	    AREP2="${CVSROOT2_DIRNAME}/"
20730	  elif cmp dotest.rel mod1-1/CVS/Repository >/dev/null 2>&1; then
20731	    AREP1=""
20732	    AREP2=""
20733	  else
20734	    fail "Cannot figure out if RELATIVE_REPOS is defined."
20735	  fi
20736	  rm -f dotest.abs dotest.rel
20737
20738	  #
20739	  # Make sure that the Root and Repository files contain the
20740	  # correct information.
20741	  #
20742	  dotest multiroot-cvsadm-1a "cat mod1-1/CVS/Root" "${CVSROOT1}"
20743	  dotest multiroot-cvsadm-1b "cat mod1-1/CVS/Repository" "${AREP1}mod1-1"
20744	  dotest multiroot-cvsadm-2a "cat mod2-1/CVS/Root" "${CVSROOT2}"
20745	  dotest multiroot-cvsadm-2b "cat mod2-1/CVS/Repository" "${AREP2}mod2-1"
20746	  dotest multiroot-cvsadm-3a "cat mod1-2/CVS/Root" "${CVSROOT1}"
20747	  dotest multiroot-cvsadm-3b "cat mod1-2/CVS/Repository" "${AREP1}mod1-2"
20748	  dotest multiroot-cvsadm-3c "cat mod1-2/mod2-2/CVS/Root" "${CVSROOT2}"
20749	  dotest multiroot-cvsadm-3d "cat mod1-2/mod2-2/CVS/Repository" "${AREP2}mod2-2"
20750	  dotest multiroot-cvsadm-4a "cat mod2-2/CVS/Root" "${CVSROOT2}"
20751	  dotest multiroot-cvsadm-4b "cat mod2-2/CVS/Repository" "${AREP2}mod2-2"
20752	  dotest multiroot-cvsadm-4c "cat mod2-2/mod1-2/CVS/Root" "${CVSROOT1}"
20753	  dotest multiroot-cvsadm-4d "cat mod2-2/mod1-2/CVS/Repository" "${AREP1}mod1-2"
20754
20755	  #
20756	  # Start testing various cvs commands.  Begin with commands
20757	  # without extra arguments (e.g. "cvs update", "cvs diff",
20758	  # etc.
20759	  #
20760
20761	  # Do at least one command with both CVSROOTs to make sure
20762	  # that there's not some kind of unexpected dependency on the
20763	  # choice of which CVSROOT is specified on the command line.
20764
20765	  if test "${AREP1}" = ""; then
20766	    # RELATIVE_REPOS.
20767	    dotest multiroot-update-1a "${testcvs1} update" \
20768"${PROG} [a-z]*: Updating \.
20769${PROG} [a-z]*: Updating mod1-1
20770${PROG} [a-z]*: Updating mod1-2
20771${PROG} [a-z]*: Updating mod1-2/mod2-2
20772${PROG} [a-z]*: cannot open directory ${TESTDIR}/root1/mod2-2: No such file or directory
20773${PROG} [a-z]*: skipping directory mod1-2/mod2-2
20774${PROG} [a-z]*: Updating mod2-1
20775${PROG} [a-z]*: cannot open directory ${TESTDIR}/root1/mod2-1: No such file or directory
20776${PROG} [a-z]*: skipping directory mod2-1
20777${PROG} [a-z]*: Updating mod2-2
20778${PROG} [a-z]*: cannot open directory ${TESTDIR}/root1/mod2-2: No such file or directory
20779${PROG} [a-z]*: skipping directory mod2-2"
20780
20781	    # Same deal but with -d ${CVSROOT2}.
20782	    dotest multiroot-update-1b "${testcvs2} update" \
20783"${PROG} [a-z]*: Updating \.
20784${PROG} [a-z]*: Updating mod1-1
20785${PROG} [a-z]*: cannot open directory ${TESTDIR}/root2/mod1-1: No such file or directory
20786${PROG} [a-z]*: skipping directory mod1-1
20787${PROG} [a-z]*: Updating mod1-2
20788${PROG} [a-z]*: cannot open directory ${TESTDIR}/root2/mod1-2: No such file or directory
20789${PROG} [a-z]*: skipping directory mod1-2
20790${PROG} [a-z]*: Updating mod2-1
20791${PROG} [a-z]*: Updating mod2-2
20792${PROG} [a-z]*: Updating mod2-2/mod1-2
20793${PROG} [a-z]*: cannot open directory ${TESTDIR}/root2/mod1-2: No such file or directory
20794${PROG} [a-z]*: skipping directory mod2-2/mod1-2"
20795	  else
20796	    # non-RELATIVE_REPOS.
20797	    if $remote; then
20798	      # Hmm, this one is specific to non-RELATIVE_REPOS too I think.
20799	      dotest_fail multiroot-update-1ar "${testcvs1} update" \
20800"protocol error: directory '${TESTDIR}/root2/mod2-2' not within root '${TESTDIR}/root1'"
20801	    else
20802	      # The basic idea is that -d overrides CVS/Root.
20803	      # With RELATIVE_REPOS, CVS could print an error when it
20804	      # tries to recurse to mod2-2, which doesn't exist in
20805	      # this repository (?)  With absolute, CVS will just look at the
20806	      # CVS/Repository for the other root (and log to the wrong
20807	      # history file and that sort of thing).
20808	      dotest multiroot-update-1a "${testcvs1} update" \
20809"${PROG} update: Updating \.
20810${PROG} [a-z]*: Updating mod1-1
20811${PROG} [a-z]*: Updating mod1-2
20812${PROG} [a-z]*: Updating mod1-2/mod2-2
20813${PROG} [a-z]*: Updating mod2-1
20814${PROG} [a-z]*: Updating mod2-2
20815${PROG} [a-z]*: Updating mod2-2/mod1-2"
20816	    fi # remote
20817
20818	    # Same deal but with -d ${CVSROOT2}.
20819	    if $remote; then
20820	      dotest_fail multiroot-update-1b "${testcvs2} update" \
20821"protocol error: directory '${TESTDIR}/root1' not within root '${TESTDIR}/root2'"
20822	    else
20823	      dotest multiroot-update-1b "${testcvs2} update" \
20824"${PROG} update: Updating \.
20825${PROG} [a-z]*: Updating mod1-1
20826${PROG} [a-z]*: Updating mod1-2
20827${PROG} [a-z]*: Updating mod1-2/mod2-2
20828${PROG} [a-z]*: Updating mod2-1
20829${PROG} [a-z]*: Updating mod2-2
20830${PROG} [a-z]*: Updating mod2-2/mod1-2"
20831	    fi # remote
20832	  fi # non-RELATIVE_REPOS
20833
20834	  # modify all files and do a diff
20835
20836	  echo bobby >> mod1-1/file1-1
20837	  echo brown >> mod1-2/file1-2
20838	  echo goes >> mod2-1/file2-1
20839	  echo down >> mod2-2/file2-2
20840
20841	  dotest_status multiroot-diff-1 1 "${testcvs} diff" \
20842"${PROG} diff: Diffing \.
20843${PROG} [a-z]*: Diffing mod1-1
20844Index: mod1-1/file1-1
20845===================================================================
20846RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
20847retrieving revision 1\.1
20848diff -r1\.1 file1-1
208491a2
20850> bobby
20851${PROG} [a-z]*: Diffing mod1-2
20852Index: mod1-2/file1-2
20853===================================================================
20854RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
20855retrieving revision 1\.1
20856diff -r1\.1 file1-2
208571a2
20858> brown
20859${PROG} [a-z]*: Diffing mod2-2/mod1-2
20860${PROG} [a-z]*: Diffing mod1-2/mod2-2
20861${PROG} [a-z]*: Diffing mod2-1
20862Index: mod2-1/file2-1
20863===================================================================
20864RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
20865retrieving revision 1\.1
20866diff -r1\.1 file2-1
208671a2
20868> goes
20869${PROG} [a-z]*: Diffing mod2-2
20870Index: mod2-2/file2-2
20871===================================================================
20872RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
20873retrieving revision 1\.1
20874diff -r1\.1 file2-2
208751a2
20876> down" \
20877"${PROG} server: Diffing \.
20878${PROG} [a-z]*: Diffing mod1-1
20879Index: mod1-1/file1-1
20880===================================================================
20881RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
20882retrieving revision 1\.1
20883diff -r1\.1 file1-1
208841a2
20885> bobby
20886${PROG} [a-z]*: Diffing mod1-2
20887Index: mod1-2/file1-2
20888===================================================================
20889RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
20890retrieving revision 1\.1
20891diff -r1\.1 file1-2
208921a2
20893> brown
20894${PROG} [a-z]*: Diffing mod2-2
20895${PROG} [a-z]*: Diffing mod2-2/mod1-2
20896${PROG} [a-z]*: Diffing mod1-2
20897${PROG} [a-z]*: Diffing mod1-2/mod2-2
20898${PROG} [a-z]*: Diffing mod2-1
20899Index: mod2-1/file2-1
20900===================================================================
20901RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
20902retrieving revision 1\.1
20903diff -r1\.1 file2-1
209041a2
20905> goes
20906${PROG} [a-z]*: Diffing mod2-2
20907Index: mod2-2/file2-2
20908===================================================================
20909RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
20910retrieving revision 1\.1
20911diff -r1\.1 file2-2
209121a2
20913> down"
20914
20915
20916	  dotest multiroot-commit-1 "${testcvs} commit -m actually" \
20917"${PROG} [a-z]*: Examining \.
20918${PROG} [a-z]*: Examining mod1-1
20919${PROG} [a-z]*: Examining mod1-2
20920${PROG} [a-z]*: Examining mod2-2/mod1-2
20921Checking in mod1-1/file1-1;
20922${TESTDIR}/root1/mod1-1/file1-1,v  <--  file1-1
20923new revision: 1.2; previous revision: 1.1
20924done
20925Checking in mod1-2/file1-2;
20926${TESTDIR}/root1/mod1-2/file1-2,v  <--  file1-2
20927new revision: 1.2; previous revision: 1.1
20928done
20929${PROG} [a-z]*: Examining mod1-2/mod2-2
20930${PROG} [a-z]*: Examining mod2-1
20931${PROG} [a-z]*: Examining mod2-2
20932Checking in mod2-1/file2-1;
20933${TESTDIR}/root2/mod2-1/file2-1,v  <--  file2-1
20934new revision: 1.2; previous revision: 1.1
20935done
20936Checking in mod2-2/file2-2;
20937${TESTDIR}/root2/mod2-2/file2-2,v  <--  file2-2
20938new revision: 1.2; previous revision: 1.1
20939done"
20940
20941	  dotest multiroot-update-2 "${testcvs} update" \
20942"${PROG} update: Updating \.
20943${PROG} [a-z]*: Updating mod1-1
20944${PROG} [a-z]*: Updating mod1-2
20945${PROG} [a-z]*: Updating mod2-2/mod1-2
20946U mod2-2/mod1-2/file1-2
20947${PROG} [a-z]*: Updating mod1-2/mod2-2
20948U mod1-2/mod2-2/file2-2
20949${PROG} [a-z]*: Updating mod2-1
20950${PROG} [a-z]*: Updating mod2-2" \
20951"${PROG} server: Updating \.
20952${PROG} [a-z]*: Updating mod1-1
20953${PROG} [a-z]*: Updating mod1-2
20954${PROG} [a-z]*: Updating mod2-2
20955${PROG} [a-z]*: Updating mod2-2/mod1-2
20956P mod2-2/mod1-2/file1-2
20957${PROG} [a-z]*: Updating mod1-2
20958${PROG} [a-z]*: Updating mod1-2/mod2-2
20959P mod1-2/mod2-2/file2-2
20960${PROG} [a-z]*: Updating mod2-1
20961${PROG} [a-z]*: Updating mod2-2"
20962
20963	  dotest multiroot-tag-1 "${testcvs} tag cattle" \
20964"${PROG} tag: Tagging \.
20965${PROG} [a-z]*: Tagging mod1-1
20966T mod1-1/file1-1
20967${PROG} [a-z]*: Tagging mod1-2
20968T mod1-2/file1-2
20969${PROG} [a-z]*: Tagging mod2-2/mod1-2
20970${PROG} [a-z]*: Tagging mod1-2/mod2-2
20971T mod1-2/mod2-2/file2-2
20972${PROG} [a-z]*: Tagging mod2-1
20973T mod2-1/file2-1
20974${PROG} [a-z]*: Tagging mod2-2" \
20975"${PROG} server: Tagging \.
20976${PROG} [a-z]*: Tagging mod1-1
20977T mod1-1/file1-1
20978${PROG} [a-z]*: Tagging mod1-2
20979T mod1-2/file1-2
20980${PROG} [a-z]*: Tagging mod2-2
20981${PROG} [a-z]*: Tagging mod2-2/mod1-2
20982${PROG} [a-z]*: Tagging mod1-2
20983${PROG} [a-z]*: Tagging mod1-2/mod2-2
20984T mod1-2/mod2-2/file2-2
20985${PROG} [a-z]*: Tagging mod2-1
20986T mod2-1/file2-1
20987${PROG} [a-z]*: Tagging mod2-2"
20988
20989	  echo anotherfile1-1 > mod1-1/anotherfile1-1
20990	  echo anotherfile2-1 > mod2-1/anotherfile2-1
20991	  echo anotherfile1-2 > mod2-2/mod1-2/anotherfile1-2
20992	  echo anotherfile2-2 > mod1-2/mod2-2/anotherfile2-2
20993
20994	  if $remote; then
20995	    cd mod1-1
20996	    dotest multiroot-add-1ar "${testcvs} add anotherfile1-1" \
20997"${PROG} [a-z]*: scheduling file .anotherfile1-1. for addition
20998${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
20999	    cd ../mod2-1
21000	    dotest multiroot-add-1br "${testcvs} add anotherfile2-1" \
21001"${PROG} [a-z]*: scheduling file .anotherfile2-1. for addition
21002${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
21003	    cd ../mod2-2/mod1-2
21004	    dotest multiroot-add-1cr "${testcvs} add anotherfile1-2" \
21005"${PROG} [a-z]*: scheduling file .anotherfile1-2. for addition
21006${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
21007	    cd ../../mod1-2/mod2-2
21008	    dotest multiroot-add-1dr "${testcvs} add anotherfile2-2" \
21009"${PROG} [a-z]*: scheduling file .anotherfile2-2. for addition
21010${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
21011	    cd ../..
21012          else
21013	    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" \
21014"${PROG} [a-z]*: scheduling file .mod1-1/anotherfile1-1. for addition
21015${PROG} [a-z]*: scheduling file .mod2-1/anotherfile2-1. for addition
21016${PROG} [a-z]*: scheduling file .mod2-2/mod1-2/anotherfile1-2. for addition
21017${PROG} [a-z]*: scheduling file .mod1-2/mod2-2/anotherfile2-2. for addition
21018${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
21019          fi
21020
21021	  dotest multiroot-status-1 "${testcvs} status -v" \
21022"${PROG} status: Examining \.
21023${PROG} [a-z]*: Examining mod1-1
21024===================================================================
21025File: anotherfile1-1   	Status: Locally Added
21026
21027   Working revision:	New file!
21028   Repository revision:	No revision control file
21029   Sticky Tag:		(none)
21030   Sticky Date:		(none)
21031   Sticky Options:	(none)
21032
21033===================================================================
21034File: file1-1          	Status: Up-to-date
21035
21036   Working revision:	1\.2.*
21037   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
21038   Sticky Tag:		(none)
21039   Sticky Date:		(none)
21040   Sticky Options:	(none)
21041
21042   Existing Tags:
21043	cattle                   	(revision: 1\.2)
21044
21045${PROG} [a-z]*: Examining mod1-2
21046===================================================================
21047File: file1-2          	Status: Up-to-date
21048
21049   Working revision:	1\.2.*
21050   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21051   Sticky Tag:		(none)
21052   Sticky Date:		(none)
21053   Sticky Options:	(none)
21054
21055   Existing Tags:
21056	cattle                   	(revision: 1\.2)
21057
21058${PROG} [a-z]*: Examining mod2-2/mod1-2
21059===================================================================
21060File: anotherfile1-2   	Status: Locally Added
21061
21062   Working revision:	New file!
21063   Repository revision:	No revision control file
21064   Sticky Tag:		(none)
21065   Sticky Date:		(none)
21066   Sticky Options:	(none)
21067
21068===================================================================
21069File: file1-2          	Status: Up-to-date
21070
21071   Working revision:	1\.2.*
21072   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21073   Sticky Tag:		(none)
21074   Sticky Date:		(none)
21075   Sticky Options:	(none)
21076
21077   Existing Tags:
21078	cattle                   	(revision: 1\.2)
21079
21080${PROG} [a-z]*: Examining mod1-2/mod2-2
21081===================================================================
21082File: anotherfile2-2   	Status: Locally Added
21083
21084   Working revision:	New file!
21085   Repository revision:	No revision control file
21086   Sticky Tag:		(none)
21087   Sticky Date:		(none)
21088   Sticky Options:	(none)
21089
21090===================================================================
21091File: file2-2          	Status: Up-to-date
21092
21093   Working revision:	1\.2.*
21094   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21095   Sticky Tag:		(none)
21096   Sticky Date:		(none)
21097   Sticky Options:	(none)
21098
21099   Existing Tags:
21100	cattle                   	(revision: 1\.2)
21101
21102${PROG} [a-z]*: Examining mod2-1
21103===================================================================
21104File: anotherfile2-1   	Status: Locally Added
21105
21106   Working revision:	New file!
21107   Repository revision:	No revision control file
21108   Sticky Tag:		(none)
21109   Sticky Date:		(none)
21110   Sticky Options:	(none)
21111
21112===================================================================
21113File: file2-1          	Status: Up-to-date
21114
21115   Working revision:	1\.2.*
21116   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
21117   Sticky Tag:		(none)
21118   Sticky Date:		(none)
21119   Sticky Options:	(none)
21120
21121   Existing Tags:
21122	cattle                   	(revision: 1\.2)
21123
21124${PROG} [a-z]*: Examining mod2-2
21125===================================================================
21126File: file2-2          	Status: Up-to-date
21127
21128   Working revision:	1\.2.*
21129   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21130   Sticky Tag:		(none)
21131   Sticky Date:		(none)
21132   Sticky Options:	(none)
21133
21134   Existing Tags:
21135	cattle                   	(revision: 1\.2)" \
21136"${PROG} server: Examining \.
21137${PROG} [a-z]*: Examining mod1-1
21138===================================================================
21139File: anotherfile1-1   	Status: Locally Added
21140
21141   Working revision:	New file!
21142   Repository revision:	No revision control file
21143   Sticky Tag:		(none)
21144   Sticky Date:		(none)
21145   Sticky Options:	(none)
21146
21147===================================================================
21148File: file1-1          	Status: Up-to-date
21149
21150   Working revision:	1\.2.*
21151   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
21152   Sticky Tag:		(none)
21153   Sticky Date:		(none)
21154   Sticky Options:	(none)
21155
21156   Existing Tags:
21157	cattle                   	(revision: 1\.2)
21158
21159${PROG} [a-z]*: Examining mod1-2
21160===================================================================
21161File: file1-2          	Status: Up-to-date
21162
21163   Working revision:	1\.2.*
21164   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21165   Sticky Tag:		(none)
21166   Sticky Date:		(none)
21167   Sticky Options:	(none)
21168
21169   Existing Tags:
21170	cattle                   	(revision: 1\.2)
21171
21172${PROG} [a-z]*: Examining mod2-2
21173${PROG} [a-z]*: Examining mod2-2/mod1-2
21174===================================================================
21175File: anotherfile1-2   	Status: Locally Added
21176
21177   Working revision:	New file!
21178   Repository revision:	No revision control file
21179   Sticky Tag:		(none)
21180   Sticky Date:		(none)
21181   Sticky Options:	(none)
21182
21183===================================================================
21184File: file1-2          	Status: Up-to-date
21185
21186   Working revision:	1\.2.*
21187   Repository revision:	1\.2	${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21188   Sticky Tag:		(none)
21189   Sticky Date:		(none)
21190   Sticky Options:	(none)
21191
21192   Existing Tags:
21193	cattle                   	(revision: 1\.2)
21194
21195${PROG} [a-z]*: Examining mod1-2
21196${PROG} [a-z]*: Examining mod1-2/mod2-2
21197===================================================================
21198File: anotherfile2-2   	Status: Locally Added
21199
21200   Working revision:	New file!
21201   Repository revision:	No revision control file
21202   Sticky Tag:		(none)
21203   Sticky Date:		(none)
21204   Sticky Options:	(none)
21205
21206===================================================================
21207File: file2-2          	Status: Up-to-date
21208
21209   Working revision:	1\.2.*
21210   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21211   Sticky Tag:		(none)
21212   Sticky Date:		(none)
21213   Sticky Options:	(none)
21214
21215   Existing Tags:
21216	cattle                   	(revision: 1\.2)
21217
21218${PROG} [a-z]*: Examining mod2-1
21219===================================================================
21220File: anotherfile2-1   	Status: Locally Added
21221
21222   Working revision:	New file!
21223   Repository revision:	No revision control file
21224   Sticky Tag:		(none)
21225   Sticky Date:		(none)
21226   Sticky Options:	(none)
21227
21228===================================================================
21229File: file2-1          	Status: Up-to-date
21230
21231   Working revision:	1\.2.*
21232   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
21233   Sticky Tag:		(none)
21234   Sticky Date:		(none)
21235   Sticky Options:	(none)
21236
21237   Existing Tags:
21238	cattle                   	(revision: 1\.2)
21239
21240${PROG} [a-z]*: Examining mod2-2
21241===================================================================
21242File: file2-2          	Status: Up-to-date
21243
21244   Working revision:	1\.2.*
21245   Repository revision:	1\.2	${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21246   Sticky Tag:		(none)
21247   Sticky Date:		(none)
21248   Sticky Options:	(none)
21249
21250   Existing Tags:
21251	cattle                   	(revision: 1\.2)"
21252
21253	  dotest multiroot-commit-2 "${testcvs} commit -m reading" \
21254"${PROG} [a-z]*: Examining \.
21255${PROG} [a-z]*: Examining mod1-1
21256${PROG} [a-z]*: Examining mod1-2
21257${PROG} [a-z]*: Examining mod2-2/mod1-2
21258RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
21259done
21260Checking in mod1-1/anotherfile1-1;
21261${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v  <--  anotherfile1-1
21262initial revision: 1\.1
21263done
21264RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
21265done
21266Checking in mod2-2/mod1-2/anotherfile1-2;
21267${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v  <--  anotherfile1-2
21268initial revision: 1\.1
21269done
21270${PROG} [a-z]*: Examining mod1-2/mod2-2
21271${PROG} [a-z]*: Examining mod2-1
21272${PROG} [a-z]*: Examining mod2-2
21273RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
21274done
21275Checking in mod1-2/mod2-2/anotherfile2-2;
21276${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v  <--  anotherfile2-2
21277initial revision: 1\.1
21278done
21279RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
21280done
21281Checking in mod2-1/anotherfile2-1;
21282${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v  <--  anotherfile2-1
21283initial revision: 1\.1
21284done"
21285
21286	  dotest multiroot-update-3 "${testcvs} update" \
21287"${PROG} update: Updating \.
21288${PROG} [a-z]*: Updating mod1-1
21289${PROG} [a-z]*: Updating mod1-2
21290U mod1-2/anotherfile1-2
21291${PROG} [a-z]*: Updating mod2-2/mod1-2
21292${PROG} [a-z]*: Updating mod1-2/mod2-2
21293${PROG} [a-z]*: Updating mod2-1
21294${PROG} [a-z]*: Updating mod2-2
21295U mod2-2/anotherfile2-2" \
21296"${PROG} server: Updating \.
21297${PROG} [a-z]*: Updating mod1-1
21298${PROG} [a-z]*: Updating mod1-2
21299U mod1-2/anotherfile1-2
21300${PROG} [a-z]*: Updating mod2-2
21301${PROG} [a-z]*: Updating mod2-2/mod1-2
21302${PROG} [a-z]*: Updating mod1-2
21303${PROG} [a-z]*: Updating mod1-2/mod2-2
21304${PROG} [a-z]*: Updating mod2-1
21305${PROG} [a-z]*: Updating mod2-2
21306U mod2-2/anotherfile2-2"
21307
21308	  dotest multiroot-log-1 "${testcvs} log" \
21309"${PROG} log: Logging \.
21310${PROG} [a-z]*: Logging mod1-1
21311
21312RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
21313Working file: mod1-1/anotherfile1-1
21314head: 1\.1
21315branch:
21316locks: strict
21317access list:
21318symbolic names:
21319keyword substitution: kv
21320total revisions: 1;	selected revisions: 1
21321description:
21322----------------------------
21323revision 1\.1
21324date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21325reading
21326=============================================================================
21327
21328RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
21329Working file: mod1-1/file1-1
21330head: 1\.2
21331branch:
21332locks: strict
21333access list:
21334symbolic names:
21335	cattle: 1\.2
21336keyword substitution: kv
21337total revisions: 2;	selected revisions: 2
21338description:
21339----------------------------
21340revision 1\.2
21341date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21342actually
21343----------------------------
21344revision 1\.1
21345date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21346is
21347=============================================================================
21348${PROG} [a-z]*: Logging mod1-2
21349
21350RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
21351Working file: mod1-2/anotherfile1-2
21352head: 1\.1
21353branch:
21354locks: strict
21355access list:
21356symbolic names:
21357keyword substitution: kv
21358total revisions: 1;	selected revisions: 1
21359description:
21360----------------------------
21361revision 1\.1
21362date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21363reading
21364=============================================================================
21365
21366RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21367Working file: mod1-2/file1-2
21368head: 1\.2
21369branch:
21370locks: strict
21371access list:
21372symbolic names:
21373	cattle: 1\.2
21374keyword substitution: kv
21375total revisions: 2;	selected revisions: 2
21376description:
21377----------------------------
21378revision 1\.2
21379date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21380actually
21381----------------------------
21382revision 1\.1
21383date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21384is
21385=============================================================================
21386${PROG} [a-z]*: Logging mod2-2/mod1-2
21387
21388RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
21389Working file: mod2-2/mod1-2/anotherfile1-2
21390head: 1\.1
21391branch:
21392locks: strict
21393access list:
21394symbolic names:
21395keyword substitution: kv
21396total revisions: 1;	selected revisions: 1
21397description:
21398----------------------------
21399revision 1\.1
21400date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21401reading
21402=============================================================================
21403
21404RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21405Working file: mod2-2/mod1-2/file1-2
21406head: 1\.2
21407branch:
21408locks: strict
21409access list:
21410symbolic names:
21411	cattle: 1\.2
21412keyword substitution: kv
21413total revisions: 2;	selected revisions: 2
21414description:
21415----------------------------
21416revision 1\.2
21417date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21418actually
21419----------------------------
21420revision 1\.1
21421date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21422is
21423=============================================================================
21424${PROG} [a-z]*: Logging mod1-2/mod2-2
21425
21426RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
21427Working file: mod1-2/mod2-2/anotherfile2-2
21428head: 1\.1
21429branch:
21430locks: strict
21431access list:
21432symbolic names:
21433keyword substitution: kv
21434total revisions: 1;	selected revisions: 1
21435description:
21436----------------------------
21437revision 1\.1
21438date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21439reading
21440=============================================================================
21441
21442RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21443Working file: mod1-2/mod2-2/file2-2
21444head: 1\.2
21445branch:
21446locks: strict
21447access list:
21448symbolic names:
21449	cattle: 1\.2
21450keyword substitution: kv
21451total revisions: 2;	selected revisions: 2
21452description:
21453----------------------------
21454revision 1\.2
21455date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21456actually
21457----------------------------
21458revision 1\.1
21459date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21460anyone
21461=============================================================================
21462${PROG} [a-z]*: Logging mod2-1
21463
21464RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
21465Working file: mod2-1/anotherfile2-1
21466head: 1\.1
21467branch:
21468locks: strict
21469access list:
21470symbolic names:
21471keyword substitution: kv
21472total revisions: 1;	selected revisions: 1
21473description:
21474----------------------------
21475revision 1\.1
21476date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21477reading
21478=============================================================================
21479
21480RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
21481Working file: mod2-1/file2-1
21482head: 1\.2
21483branch:
21484locks: strict
21485access list:
21486symbolic names:
21487	cattle: 1\.2
21488keyword substitution: kv
21489total revisions: 2;	selected revisions: 2
21490description:
21491----------------------------
21492revision 1\.2
21493date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21494actually
21495----------------------------
21496revision 1\.1
21497date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21498anyone
21499=============================================================================
21500${PROG} [a-z]*: Logging mod2-2
21501
21502RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
21503Working file: mod2-2/anotherfile2-2
21504head: 1\.1
21505branch:
21506locks: strict
21507access list:
21508symbolic names:
21509keyword substitution: kv
21510total revisions: 1;	selected revisions: 1
21511description:
21512----------------------------
21513revision 1\.1
21514date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21515reading
21516=============================================================================
21517
21518RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21519Working file: mod2-2/file2-2
21520head: 1\.2
21521branch:
21522locks: strict
21523access list:
21524symbolic names:
21525	cattle: 1\.2
21526keyword substitution: kv
21527total revisions: 2;	selected revisions: 2
21528description:
21529----------------------------
21530revision 1\.2
21531date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21532actually
21533----------------------------
21534revision 1\.1
21535date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21536anyone
21537=============================================================================" \
21538"${PROG} server: Logging \.
21539${PROG} [a-z]*: Logging mod1-1
21540
21541RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
21542Working file: mod1-1/anotherfile1-1
21543head: 1\.1
21544branch:
21545locks: strict
21546access list:
21547symbolic names:
21548keyword substitution: kv
21549total revisions: 1;	selected revisions: 1
21550description:
21551----------------------------
21552revision 1\.1
21553date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21554reading
21555=============================================================================
21556
21557RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
21558Working file: mod1-1/file1-1
21559head: 1\.2
21560branch:
21561locks: strict
21562access list:
21563symbolic names:
21564	cattle: 1\.2
21565keyword substitution: kv
21566total revisions: 2;	selected revisions: 2
21567description:
21568----------------------------
21569revision 1\.2
21570date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21571actually
21572----------------------------
21573revision 1\.1
21574date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21575is
21576=============================================================================
21577${PROG} [a-z]*: Logging mod1-2
21578
21579RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
21580Working file: mod1-2/anotherfile1-2
21581head: 1\.1
21582branch:
21583locks: strict
21584access list:
21585symbolic names:
21586keyword substitution: kv
21587total revisions: 1;	selected revisions: 1
21588description:
21589----------------------------
21590revision 1\.1
21591date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21592reading
21593=============================================================================
21594
21595RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21596Working file: mod1-2/file1-2
21597head: 1\.2
21598branch:
21599locks: strict
21600access list:
21601symbolic names:
21602	cattle: 1\.2
21603keyword substitution: kv
21604total revisions: 2;	selected revisions: 2
21605description:
21606----------------------------
21607revision 1\.2
21608date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21609actually
21610----------------------------
21611revision 1\.1
21612date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21613is
21614=============================================================================
21615${PROG} [a-z]*: Logging mod2-2
21616${PROG} [a-z]*: Logging mod2-2/mod1-2
21617
21618RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
21619Working file: mod2-2/mod1-2/anotherfile1-2
21620head: 1\.1
21621branch:
21622locks: strict
21623access list:
21624symbolic names:
21625keyword substitution: kv
21626total revisions: 1;	selected revisions: 1
21627description:
21628----------------------------
21629revision 1\.1
21630date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21631reading
21632=============================================================================
21633
21634RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
21635Working file: mod2-2/mod1-2/file1-2
21636head: 1\.2
21637branch:
21638locks: strict
21639access list:
21640symbolic names:
21641	cattle: 1\.2
21642keyword substitution: kv
21643total revisions: 2;	selected revisions: 2
21644description:
21645----------------------------
21646revision 1\.2
21647date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21648actually
21649----------------------------
21650revision 1\.1
21651date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21652is
21653=============================================================================
21654${PROG} [a-z]*: Logging mod1-2
21655${PROG} [a-z]*: Logging mod1-2/mod2-2
21656
21657RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
21658Working file: mod1-2/mod2-2/anotherfile2-2
21659head: 1\.1
21660branch:
21661locks: strict
21662access list:
21663symbolic names:
21664keyword substitution: kv
21665total revisions: 1;	selected revisions: 1
21666description:
21667----------------------------
21668revision 1\.1
21669date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21670reading
21671=============================================================================
21672
21673RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21674Working file: mod1-2/mod2-2/file2-2
21675head: 1\.2
21676branch:
21677locks: strict
21678access list:
21679symbolic names:
21680	cattle: 1\.2
21681keyword substitution: kv
21682total revisions: 2;	selected revisions: 2
21683description:
21684----------------------------
21685revision 1\.2
21686date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21687actually
21688----------------------------
21689revision 1\.1
21690date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21691anyone
21692=============================================================================
21693${PROG} [a-z]*: Logging mod2-1
21694
21695RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
21696Working file: mod2-1/anotherfile2-1
21697head: 1\.1
21698branch:
21699locks: strict
21700access list:
21701symbolic names:
21702keyword substitution: kv
21703total revisions: 1;	selected revisions: 1
21704description:
21705----------------------------
21706revision 1\.1
21707date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21708reading
21709=============================================================================
21710
21711RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
21712Working file: mod2-1/file2-1
21713head: 1\.2
21714branch:
21715locks: strict
21716access list:
21717symbolic names:
21718	cattle: 1\.2
21719keyword substitution: kv
21720total revisions: 2;	selected revisions: 2
21721description:
21722----------------------------
21723revision 1\.2
21724date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21725actually
21726----------------------------
21727revision 1\.1
21728date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21729anyone
21730=============================================================================
21731${PROG} [a-z]*: Logging mod2-2
21732
21733RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
21734Working file: mod2-2/anotherfile2-2
21735head: 1\.1
21736branch:
21737locks: strict
21738access list:
21739symbolic names:
21740keyword substitution: kv
21741total revisions: 1;	selected revisions: 1
21742description:
21743----------------------------
21744revision 1\.1
21745date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21746reading
21747=============================================================================
21748
21749RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
21750Working file: mod2-2/file2-2
21751head: 1\.2
21752branch:
21753locks: strict
21754access list:
21755symbolic names:
21756	cattle: 1\.2
21757keyword substitution: kv
21758total revisions: 2;	selected revisions: 2
21759description:
21760----------------------------
21761revision 1\.2
21762date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;  lines: ${PLUS}1 -0
21763actually
21764----------------------------
21765revision 1\.1
21766date: [0-9/]* [0-9:]*;  author: ${username};  state: Exp;
21767anyone
21768============================================================================="
21769
21770
21771	  # After the simple cases, let's execute some commands which
21772	  # refer to parts of our checked-out tree (e.g. "cvs update
21773	  # mod1-1 mod2-2")
21774
21775	  if $keep; then
21776	    echo Keeping ${TESTDIR} and exiting due to --keep
21777	    exit 0
21778	  fi
21779
21780	  # clean up after ourselves
21781	  cd ..
21782	  rm -r 1
21783
21784	  # clean up our repositories
21785	  rm -rf root1 root2
21786	  ;;
21787
21788	multiroot2)
21789	  # More multiroot tests.  In particular, nested directories.
21790
21791	  CVSROOT1_DIRNAME=${TESTDIR}/root1
21792	  CVSROOT2_DIRNAME=${TESTDIR}/root2
21793	  CVSROOT1=${CVSROOT1_DIRNAME} ; export CVSROOT1
21794	  CVSROOT2=${CVSROOT2_DIRNAME} ; export CVSROOT2
21795	  if $remote; then
21796	      CVSROOT1=:fork:${CVSROOT1_DIRNAME} ; export CVSROOT1
21797	      CVSROOT2=:fork:${CVSROOT2_DIRNAME} ; export CVSROOT2
21798	  fi
21799
21800	  dotest multiroot2-1 "${testcvs} -d ${CVSROOT1} init" ""
21801	  dotest multiroot2-2 "${testcvs} -d ${CVSROOT2} init" ""
21802
21803	  mkdir imp-dir; cd imp-dir
21804	  echo file1 >file1
21805	  mkdir sdir
21806	  echo sfile >sdir/sfile
21807	  mkdir sdir/ssdir
21808	  echo ssfile >sdir/ssdir/ssfile
21809	  dotest_sort multiroot2-3 \
21810"${testcvs} -d ${CVSROOT1} import -m import-to-root1 dir1 vend rel" "
21811
21812N dir1/file1
21813N dir1/sdir/sfile
21814N dir1/sdir/ssdir/ssfile
21815No conflicts created by this import
21816${PROG} [a-z]*: Importing ${TESTDIR}/root1/dir1/sdir
21817${PROG} [a-z]*: Importing ${TESTDIR}/root1/dir1/sdir/ssdir"
21818	  cd sdir
21819	  dotest_sort multiroot2-4 \
21820"${testcvs} -d ${CVSROOT2} import -m import-to-root2 sdir vend2 rel2" "
21821
21822N sdir/sfile
21823N sdir/ssdir/ssfile
21824No conflicts created by this import
21825${PROG} [a-z]*: Importing ${TESTDIR}/root2/sdir/ssdir"
21826	  cd ../..
21827
21828	  mkdir 1; cd 1
21829	  # Get TopLevelAdmin-like behavior.
21830	  dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co -l ."
21831	  dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co dir1" \
21832"U dir1/file1
21833U dir1/sdir/sfile
21834U dir1/sdir/ssdir/ssfile"
21835	  cd dir1
21836	  dotest multiroot2-6 "${testcvs} -Q release -d sdir" ""
21837	  dotest multiroot2-7 "${testcvs} -d ${CVSROOT2} -q co sdir" \
21838"U sdir/sfile
21839U sdir/ssdir/ssfile"
21840	  cd ..
21841	  # This has one subtle effect - it deals with Entries.Log
21842	  # so that the next test doesn't get trace messages for
21843	  # Entries.Log
21844	  dotest multiroot2-8 "${testcvs} update" \
21845"${PROG} update: Updating \.
21846${PROG} update: Updating dir1
21847${PROG} update: Updating dir1/sdir
21848${PROG} update: Updating dir1/sdir/ssdir" \
21849"${PROG} server: Updating \.
21850${PROG} server: Updating dir1
21851${PROG} server: Updating dir1
21852${PROG} server: Updating dir1/sdir
21853${PROG} server: Updating dir1/sdir/ssdir"
21854	  # Two reasons we don't run this on the server: (1) the server
21855	  # also prints some trace messages, and (2) the server trace
21856	  # messages are subject to out-of-order bugs (this one is hard
21857	  # to work around).
21858	  if $remote; then :; else
21859	    dotest multiroot2-9 "${testcvs} -t update" \
21860" -> main loop with CVSROOT=${TESTDIR}/root1
21861${PROG} update: Updating \.
21862${PROG} update: Updating dir1
21863 -> main loop with CVSROOT=${TESTDIR}/root2
21864${PROG} update: Updating dir1/sdir
21865${PROG} update: Updating dir1/sdir/ssdir"
21866	  fi
21867
21868	  dotest multiroot2-9 "${testcvs} -q tag tag1" \
21869"T dir1/file1
21870T dir1/sdir/sfile
21871T dir1/sdir/ssdir/ssfile"
21872	  echo "change it" >>dir1/file1
21873	  echo "change him too" >>dir1/sdir/sfile
21874	  dotest multiroot2-10 "${testcvs} -q ci -m modify" \
21875"Checking in dir1/file1;
21876${TESTDIR}/root1/dir1/file1,v  <--  file1
21877new revision: 1\.2; previous revision: 1\.1
21878done
21879Checking in dir1/sdir/sfile;
21880${TESTDIR}/root2/sdir/sfile,v  <--  sfile
21881new revision: 1\.2; previous revision: 1\.1
21882done"
21883	  dotest multiroot2-11 "${testcvs} -q tag tag2" \
21884"T dir1/file1
21885T dir1/sdir/sfile
21886T dir1/sdir/ssdir/ssfile"
21887	  dotest_status multiroot2-12 1 \
21888"${testcvs} -q diff -u -r tag1 -r tag2" \
21889"Index: dir1/file1
21890===================================================================
21891RCS file: ${TESTDIR}/root1/dir1/file1,v
21892retrieving revision 1\.1\.1\.1
21893retrieving revision 1\.2
21894diff -u -r1\.1\.1\.1 -r1\.2
21895--- dir1/file1	${RFCDATE}	1\.1\.1\.1
21896${PLUS}${PLUS}${PLUS} dir1/file1	${RFCDATE}	1\.2
21897@@ -1 ${PLUS}1,2 @@
21898 file1
21899${PLUS}change it
21900Index: dir1/sdir/sfile
21901===================================================================
21902RCS file: ${TESTDIR}/root2/sdir/sfile,v
21903retrieving revision 1\.1\.1\.1
21904retrieving revision 1\.2
21905diff -u -r1\.1\.1\.1 -r1\.2
21906--- dir1/sdir/sfile	${RFCDATE}	1\.1\.1\.1
21907${PLUS}${PLUS}${PLUS} dir1/sdir/sfile	${RFCDATE}	1\.2
21908@@ -1 ${PLUS}1,2 @@
21909 sfile
21910${PLUS}change him too"
21911
21912	  if $keep; then
21913	    echo Keeping ${TESTDIR} and exiting due to --keep
21914	    exit 0
21915	  fi
21916
21917	  # clean up after ourselves
21918	  cd ..
21919	  rm -r imp-dir 1
21920
21921	  # clean up our repositories
21922	  rm -rf root1 root2
21923	  ;;
21924
21925	multiroot3)
21926	  # More multiroot tests.  Directories are side-by-side, not nested.
21927	  # Not drastically different from multiroot but it covers somewhat
21928	  # different stuff.
21929
21930	  if $remote; then
21931	    CVSROOT1=:fork:${TESTDIR}/root1 ; export CVSROOT1
21932	    CVSROOT2=:fork:${TESTDIR}/root2 ; export CVSROOT2
21933	  else
21934	    CVSROOT1=${TESTDIR}/root1 ; export CVSROOT1
21935	    CVSROOT2=${TESTDIR}/root2 ; export CVSROOT2
21936	  fi
21937
21938	  mkdir 1; cd 1
21939	  dotest multiroot3-1 "${testcvs} -d ${CVSROOT1} init" ""
21940	  dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
21941	  mkdir dir1
21942	  dotest multiroot3-3 "${testcvs} add dir1" \
21943"Directory ${TESTDIR}/root1/dir1 added to the repository"
21944	  dotest multiroot3-4 "${testcvs} -d ${CVSROOT2} init" ""
21945	  rm -r CVS
21946	  dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
21947	  mkdir dir2
21948
21949	  # OK, the problem is that CVS/Entries doesn't look quite right,
21950	  # I suppose because of the "rm -r".
21951	  # For local this fixes it up.
21952	  dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
21953	  if $remote; then
21954	    # For remote that doesn't do it.  Use the quick and dirty fix.
21955	    echo "D/dir1////" >CVS/Entries
21956	    echo "D/dir2////" >>CVS/Entries
21957	  fi
21958
21959	  dotest multiroot3-7 "${testcvs} add dir2" \
21960"Directory ${TESTDIR}/root2/dir2 added to the repository"
21961
21962	  touch dir1/file1 dir2/file2
21963	  if $remote; then
21964	    # Trying to add them both in one command doesn't work,
21965	    # because add.c doesn't do multiroot (it doesn't use recurse.c).
21966	    # Furthermore, it can't deal with the parent directory
21967	    # having a different root from the child, hence the cd.
21968	    cd dir1
21969	    dotest multiroot3-8 "${testcvs} add file1" \
21970"${PROG} [a-z]*: scheduling file .file1. for addition
21971${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
21972	    cd ..
21973	    dotest multiroot3-8a "${testcvs} add dir2/file2" \
21974"${PROG} [a-z]*: scheduling file .dir2/file2. for addition
21975${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
21976	  else
21977	    dotest multiroot3-8 "${testcvs} add dir1/file1 dir2/file2" \
21978"${PROG} [a-z]*: scheduling file .dir1/file1. for addition
21979${PROG} [a-z]*: scheduling file .dir2/file2. for addition
21980${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
21981	  fi
21982
21983	  dotest multiroot3-9 "${testcvs} -q ci -m add-them" \
21984"RCS file: ${TESTDIR}/root2/dir2/file2,v
21985done
21986Checking in dir2/file2;
21987${TESTDIR}/root2/dir2/file2,v  <--  file2
21988initial revision: 1\.1
21989done
21990RCS file: ${TESTDIR}/root1/dir1/file1,v
21991done
21992Checking in dir1/file1;
21993${TESTDIR}/root1/dir1/file1,v  <--  file1
21994initial revision: 1\.1
21995done"
21996
21997	  if test "`cat dir1/CVS/Repository`" = "dir1"; then
21998	    # RELATIVE_REPOS
21999	    # That this is an error is good - we are asking CVS to do
22000	    # something which doesn't make sense.
22001	    dotest_fail multiroot3-10 \
22002"${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
22003"${PROG} [a-z]*: failed to create lock directory for .${TESTDIR}/root1/dir2' (${TESTDIR}/root1/dir2/#cvs.lock): No such file or directory
22004${PROG} [a-z]*: failed to obtain dir lock in repository .${TESTDIR}/root1/dir2'
22005${PROG} \[[a-z]* aborted\]: read lock failed - giving up"
22006	  else
22007	    # Not RELATIVE_REPOS.
22008	    if $remote; then
22009	      # This is good behavior - we are asking CVS to do something
22010	      # which doesn't make sense.
22011	      dotest_fail multiroot3-10 \
22012"${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
22013"protocol error: directory '${TESTDIR}/root2/dir2' not within root '${TESTDIR}/root1'"
22014	    else
22015	      # Local isn't as picky as we'd want in terms of getting
22016	      # the wrong root.
22017	      dotest multiroot3-10 \
22018"${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" ""
22019	    fi
22020	  fi
22021	  # This one is supposed to work.
22022	  dotest multiroot3-11 "${testcvs} -q diff dir1/file1 dir2/file2" ""
22023
22024	  # make sure we can't access across repositories
22025	  # FIXCVS: we probably shouldn't even create the local directories
22026	  # in this case, but we do, so deal with it.
22027	  mkdir 1a
22028	  cd 1a
22029	  dotest_fail multiroot3-12 \
22030"${testcvs} -d ${CVSROOT1} -q co ../root2/dir2" \
22031"${PROG} [a-z]*: in directory \.\./root2/dir2:
22032${PROG} [a-z]*: .\.\..-relative repositories are not supported.
22033${PROG} \[[a-z]* aborted\]: illegal source repository"
22034	  rm -rf ../root2
22035	  dotest_fail multiroot3-13 \
22036"${testcvs} -d ${CVSROOT2} -q co ../root1/dir1" \
22037"${PROG} [a-z]*: in directory \.\./root1/dir1:
22038${PROG} [a-z]*: .\.\..-relative repositories are not supported.
22039${PROG} \[[a-z]* aborted\]: illegal source repository"
22040	  rm -rf ../root1
22041	  dotest_fail multiroot3-14 \
22042"${testcvs} -d ${CVSROOT1} -q co ./../root2/dir2" \
22043"${PROG} [a-z]*: in directory \./\.\./root2/dir2:
22044${PROG} [a-z]*: .\.\..-relative repositories are not supported.
22045${PROG} \[[a-z]* aborted\]: illegal source repository"
22046	  rm -rf ../root2
22047	  dotest_fail multiroot3-15 \
22048"${testcvs} -d ${CVSROOT2} -q co ./../root1/dir1" \
22049"${PROG} [a-z]*: in directory \./\.\./root1/dir1:
22050${PROG} [a-z]*: .\.\..-relative repositories are not supported.
22051${PROG} \[[a-z]* aborted\]: illegal source repository"
22052	  rm -rf ../root1
22053
22054	  cd ../..
22055
22056	  if $keep; then
22057	    echo Keeping ${TESTDIR} and exiting due to --keep
22058	    exit 0
22059	  fi
22060
22061	  rm -r 1
22062	  rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
22063	  unset CVSROOT1
22064	  unset CVSROOT2
22065	  ;;
22066
22067	multiroot4)
22068	  # More multiroot tests, in particular we have two roots with
22069	  # similarly-named directories and we try to see that CVS can
22070	  # keep them separate.
22071	  if $remote; then
22072	    CVSROOT1=:fork:${TESTDIR}/root1 ; export CVSROOT1
22073	    CVSROOT2=:fork:${TESTDIR}/root2 ; export CVSROOT2
22074	  else
22075	    CVSROOT1=${TESTDIR}/root1 ; export CVSROOT1
22076	    CVSROOT2=${TESTDIR}/root2 ; export CVSROOT2
22077	  fi
22078
22079	  mkdir 1; cd 1
22080	  dotest multiroot4-1 "${testcvs} -d ${CVSROOT1} init" ""
22081	  dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
22082	  mkdir dircom
22083	  dotest multiroot4-3 "${testcvs} add dircom" \
22084"Directory ${TESTDIR}/root1/dircom added to the repository"
22085	  cd dircom
22086	  touch file1
22087	  dotest multiroot4-4 "${testcvs} add file1" \
22088"${PROG} [a-z]*: scheduling file .file1. for addition
22089${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
22090	  dotest multiroot4-5 "${testcvs} -q ci -m add" \
22091"RCS file: ${TESTDIR}/root1/dircom/file1,v
22092done
22093Checking in file1;
22094${TESTDIR}/root1/dircom/file1,v  <--  file1
22095initial revision: 1\.1
22096done"
22097	  cd ../..
22098	  mkdir 2; cd 2
22099	  dotest multiroot4-6 "${testcvs} -d ${CVSROOT2} init" ""
22100	  dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
22101	  mkdir dircom
22102	  dotest multiroot4-8 "${testcvs} add dircom" \
22103"Directory ${TESTDIR}/root2/dircom added to the repository"
22104	  cd dircom
22105	  touch file2
22106	  dotest multiroot4-9 "${testcvs} add file2" \
22107"${PROG} [a-z]*: scheduling file .file2. for addition
22108${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
22109	  dotest multiroot4-10 "${testcvs} -q ci -m add" \
22110"RCS file: ${TESTDIR}/root2/dircom/file2,v
22111done
22112Checking in file2;
22113${TESTDIR}/root2/dircom/file2,v  <--  file2
22114initial revision: 1\.1
22115done"
22116
22117	  cd ../..
22118	  cd 1/dircom
22119	  # This may look contrived; the real world example which inspired
22120	  # it was that a user was changing from local to remote.  Cases
22121	  # like switching servers (among those mounting the same
22122	  # repository) and so on would also look the same.
22123	  mkdir sdir2
22124	  dotest multiroot4-11 "${testcvs} -d ${CVSROOT2} add sdir2" \
22125"Directory ${TESTDIR}/root2/dircom/sdir2 added to the repository"
22126
22127	  dotest multiroot4-12 "${testcvs} -q update" ""
22128	  cd ..
22129	  dotest multiroot4-13 "${testcvs} -q update dircom" ""
22130	  cd ..
22131
22132	  rm -r 1 2
22133	  rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
22134	  unset CVSROOT1
22135	  unset CVSROOT2
22136	  ;;
22137
22138	rmroot)
22139	  # When the Entries/Root file is removed from an existing
22140	  # workspace, CVS should assume $CVSROOT instead
22141	  #
22142	  # Right now only checking that CVS exits normally on an
22143	  # update once CVS/Root is deleted
22144	  #
22145	  # There was a time when this would core dump when run in
22146	  # client/server mode
22147
22148	  mkdir 1; cd 1
22149	  dotest rmroot-setup-1 "${testcvs} -q co -l ." ''
22150	  mkdir first-dir
22151	  dotest rmroot-setup-2 "${testcvs} add first-dir" \
22152"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
22153          cd first-dir
22154	  touch file1 file2
22155	  dotest rmroot-setup-3 "${testcvs} add file1 file2" \
22156"${PROG} [a-z]*: scheduling file .file1. for addition
22157${PROG} [a-z]*: scheduling file .file2. for addition
22158${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
22159	  dotest rmroot-setup-4 "${testcvs} -q commit -minit" \
22160"RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
22161done
22162Checking in file1;
22163${CVSROOT_DIRNAME}/first-dir/file1,v  <--  file1
22164initial revision: 1\.1
22165done
22166RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
22167done
22168Checking in file2;
22169${CVSROOT_DIRNAME}/first-dir/file2,v  <--  file2
22170initial revision: 1\.1
22171done"
22172	  rm CVS/Root
22173	  dotest rmroot-1 "${testcvs} -q update" ''
22174
22175	  cd ../..
22176	  rm -rf 1
22177	  ;;
22178
22179	reposmv)
22180	  # More tests of repositories and specifying them.
22181	  # Similar to crerepos but that test is probably getting big
22182	  # enough.
22183
22184	  if $remote; then
22185	    CVSROOT1=:fork:${TESTDIR}/root1 ; export CVSROOT1
22186	    CVSROOT_MOVED=:fork:${TESTDIR}/root-moved ; export CVSROOT1
22187	  else
22188	    CVSROOT1=${TESTDIR}/root1 ; export CVSROOT1
22189	    CVSROOT_MOVED=${TESTDIR}/root-moved ; export CVSROOT1
22190	  fi
22191
22192	  dotest reposmv-setup-1 "${testcvs} -d ${CVSROOT1} init" ""
22193	  mkdir imp-dir; cd imp-dir
22194	  echo file1 >file1
22195	  dotest reposmv-setup-2 \
22196"${testcvs} -d ${CVSROOT1} import -m add dir1 vendor release" \
22197"N dir1/file1
22198
22199No conflicts created by this import"
22200	  cd ..
22201
22202	  mkdir 1; cd 1
22203	  dotest reposmv-1 "${testcvs} -d ${CVSROOT1} -Q co dir1" ""
22204	  mv ${TESTDIR}/root1 ${TESTDIR}/root-moved
22205	  cd dir1
22206
22207	  # If we didn't have a relative repository, get one now.
22208	  dotest reposmv-1a "cat CVS/Repository" \
22209"${TESTDIR}/root1/dir1" "dir1"
22210	  echo dir1 >CVS/Repository
22211
22212	  # There were some duplicated warnings and such; only test
22213	  # for the part of the error message which makes sense.
22214	  # Bug: "skipping directory " without filename.
22215	  if $remote; then
22216	    dotest_fail reposmv-2r "${testcvs} update" \
22217"Cannot access ${TESTDIR}/root1/CVSROOT
22218No such file or directory"
22219	  else
22220	    dotest reposmv-2 "${testcvs} update" "${DOTSTAR}
22221${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
22222${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1: No such file or directory
22223${PROG} update: skipping directory "
22224	  fi
22225
22226	  # CVS/Root overrides $CVSROOT
22227	  if $remote; then
22228	    CVSROOT_SAVED=${CVSROOT}
22229	    CVSROOT=:fork:${TESTDIR}/root-moved; export CVSROOT
22230	    dotest_fail reposmv-3r "${testcvs} update" \
22231"Cannot access ${TESTDIR}/root1/CVSROOT
22232No such file or directory"
22233	    CVSROOT=${CVSROOT_SAVED}; export CVSROOT
22234	  else
22235	    CVSROOT_SAVED=${CVSROOT}
22236	    CVSROOT=${TESTDIR}/root-moved; export CVSROOT
22237	    dotest reposmv-3 "${testcvs} update" \
22238"${DOTSTAR}
22239${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
22240${PROG} update: Updating \.
22241${DOTSTAR}"
22242	    CVSROOT=${CVSROOT_SAVED}; export CVSROOT
22243	  fi
22244
22245	  if $remote; then
22246	    CVSROOT_SAVED=${CVSROOT}
22247	    CVSROOT=:fork:${TESTDIR}/root-none; export CVSROOT
22248	    dotest_fail reposmv-4 "${testcvs} update" \
22249"Cannot access ${TESTDIR}/root1/CVSROOT
22250No such file or directory"
22251	    CVSROOT=${CVSROOT_SAVED}; export CVSROOT
22252	  else
22253	    # CVS/Root doesn't seem to quite completely override $CVSROOT
22254	    # Bug?  Not necessarily a big deal if it only affects error
22255	    # messages.
22256	    CVSROOT_SAVED=${CVSROOT}
22257	    CVSROOT=${TESTDIR}/root-none; export CVSROOT
22258	    dotest_fail reposmv-4 "${testcvs} update" \
22259"${PROG} update: in directory \.:
22260${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
22261${PROG} \[update aborted\]: ${TESTDIR}/root-none/CVSROOT: No such file or directory"
22262	    CVSROOT=${CVSROOT_SAVED}; export CVSROOT
22263	  fi
22264
22265	  # -d overrides CVS/Root
22266	  #
22267	  # Oddly enough, with CVS 1.10 I think this didn't work for
22268	  # local (that is, it would appear that CVS/Root would not
22269	  # get used, but would produce an error if it didn't exist).
22270	  dotest reposmv-5 "${testcvs} -d ${CVSROOT_MOVED} update" \
22271"${PROG} [a-z]*: Updating \."
22272
22273	  # TODO: could also test various other things, like what if the
22274	  # user removes CVS/Root (which is legit).  Or another set of
22275	  # tests would be if both repositories exist but we want to make
22276	  # sure that CVS is using the correct one.
22277
22278	  cd ../..
22279	  rm -r imp-dir 1
22280	  rm -rf root1 root2
22281	  unset CVSROOT1
22282	  ;;
22283
22284	pserver)
22285	  # Test basic pserver functionality.
22286	  if $remote; then
22287   	    # First set SystemAuth=no.  Not really necessary, I don't
22288	    # think, but somehow it seems like the clean thing for
22289	    # the testsuite.
22290	    mkdir 1; cd 1
22291	    dotest pserver-1 "${testcvs} -Q co CVSROOT" ""
22292	    cd CVSROOT
22293	    echo "SystemAuth=no" >config
22294	    dotest pserver-2 "${testcvs} -q ci -m config-it" \
22295"Checking in config;
22296${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
22297new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
22298done
22299${PROG} [a-z]*: Rebuilding administrative file database"
22300	    cat >${CVSROOT_DIRNAME}/CVSROOT/passwd <<EOF
22301testme:q6WV9d2t848B2:$username
22302anonymous::$username
22303$username:
22304willfail:   :whocares
22305EOF
22306	    dotest_fail pserver-3 "${testcvs} pserver" \
22307"error 0 Server configuration missing --allow-root in inetd.conf" <<EOF
22308BEGIN AUTH REQUEST
22309${CVSROOT_DIRNAME}
22310testme
22311Ay::'d
22312END AUTH REQUEST
22313EOF
22314
22315	    # Sending the Root and noop before waiting for the
22316	    # "I LOVE YOU" is bogus, but hopefully we can get
22317	    # away with it.
22318	    dotest pserver-4 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22319"${DOTSTAR} LOVE YOU
22320ok" <<EOF
22321BEGIN AUTH REQUEST
22322${CVSROOT_DIRNAME}
22323testme
22324Ay::'d
22325END AUTH REQUEST
22326Root ${CVSROOT_DIRNAME}
22327noop
22328EOF
22329
22330	    dotest pserver-5 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22331"${DOTSTAR} LOVE YOU
22332E Protocol error: Root says \"${TESTDIR}/1\" but pserver says \"${CVSROOT_DIRNAME}\"
22333error  " <<EOF
22334BEGIN AUTH REQUEST
22335${CVSROOT_DIRNAME}
22336testme
22337Ay::'d
22338END AUTH REQUEST
22339Root ${TESTDIR}/1
22340noop
22341EOF
22342
22343	    dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22344"I HATE YOU" <<EOF
22345BEGIN AUTH REQUEST
22346${CVSROOT_DIRNAME}
22347testme
22348Ay::'d^b?hd
22349END AUTH REQUEST
22350EOF
22351
22352	    dotest_fail pserver-7 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22353"I HATE YOU" <<EOF
22354BEGIN VERIFICATION REQUEST
22355${CVSROOT_DIRNAME}
22356testme
22357Ay::'d^b?hd
22358END VERIFICATION REQUEST
22359EOF
22360
22361	    dotest pserver-8 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22362"${DOTSTAR} LOVE YOU" <<EOF
22363BEGIN VERIFICATION REQUEST
22364${CVSROOT_DIRNAME}
22365testme
22366Ay::'d
22367END VERIFICATION REQUEST
22368EOF
22369
22370# Tests pserver-9 through pserver-13 are about empty passwords
22371
22372            # Test empty password (both sides) for aliased user
22373	    dotest pserver-9 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22374"${DOTSTAR} LOVE YOU" <<EOF
22375BEGIN AUTH REQUEST
22376${CVSROOT_DIRNAME}
22377anonymous
22378A
22379END AUTH REQUEST
22380EOF
22381
22382            # Test empty password (server side only) for aliased user
22383	    dotest pserver-10 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22384"${DOTSTAR} LOVE YOU" <<EOF
22385BEGIN AUTH REQUEST
22386${CVSROOT_DIRNAME}
22387anonymous
22388Aanythingwouldworkhereittrulydoesnotmatter
22389END AUTH REQUEST
22390EOF
22391
22392            # Test empty (both sides) password for non-aliased user
22393	    dotest pserver-11 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22394"${DOTSTAR} LOVE YOU" <<EOF
22395BEGIN AUTH REQUEST
22396${CVSROOT_DIRNAME}
22397${username}
22398A
22399END AUTH REQUEST
22400EOF
22401
22402            # Test empty (server side only) password for non-aliased user
22403	    dotest pserver-12 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22404"${DOTSTAR} LOVE YOU" <<EOF
22405BEGIN AUTH REQUEST
22406${CVSROOT_DIRNAME}
22407${username}
22408Anypasswordwouldworkwhynotthisonethen
22409END AUTH REQUEST
22410EOF
22411
22412            # Test failure of whitespace password
22413	    dotest_fail pserver-13 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
22414"${DOTSTAR} HATE YOU" <<EOF
22415BEGIN AUTH REQUEST
22416${CVSROOT_DIRNAME}
22417willfail
22418Amquiteunabletocomeupwithinterestingpasswordsanymore
22419END AUTH REQUEST
22420EOF
22421
22422	    # Clean up.
22423	    echo "# comments only" >config
22424	    dotest pserver-cleanup-1 "${testcvs} -q ci -m config-it" \
22425"Checking in config;
22426${CVSROOT_DIRNAME}/CVSROOT/config,v  <--  config
22427new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
22428done
22429${PROG} [a-z]*: Rebuilding administrative file database"
22430	    cd ../..
22431	    rm -r 1
22432	    rm ${CVSROOT_DIRNAME}/CVSROOT/passwd
22433	  fi # skip the whole thing for local
22434	  ;;
22435
22436	server)
22437	  # Some tests of the server (independent of the client).
22438	  if $remote; then
22439	    dotest server-1 "${testcvs} server" \
22440"E Protocol error: Root request missing
22441error  " <<EOF
22442Directory bogus
22443mumble/bar
22444update
22445EOF
22446
22447	    # Could also test for relative pathnames here (so that crerepos-6a
22448	    # and crerepos-6b can use :fork:).
22449	    dotest server-2 "${testcvs} server" "ok" <<EOF
22450Set OTHER=variable
22451Set MYENV=env-value
22452init ${TESTDIR}/crerepos
22453EOF
22454	    dotest server-3 "test -d ${TESTDIR}/crerepos/CVSROOT" ""
22455
22456	    # Now some tests of gzip-file-contents (used by jCVS).
22457	    ${AWK} 'BEGIN { \
22458printf "%c%c%c%c%c%c.6%c%c+I-.%c%c%c%c5%c;%c%c%c%c", \
2245931, 139, 8, 64, 5, 7, 64, 3, 225, 2, 64, 198, 185, 5, 64, 64, 64}' \
22460	      </dev/null | ${TR} '\100' '\000' >gzipped.dat
22461	    # Note that the CVS client sends "-b 1.1.1", and this
22462	    # test doesn't.  But the server also defaults to that.
22463	    cat <<EOF >session.dat
22464Root ${TESTDIR}/crerepos
22465UseUnchanged
22466gzip-file-contents 3
22467Argument -m
22468Argument msg
22469Argumentx 
22470Argument dir1
22471Argument tag1
22472Argument tag2
22473Directory .
22474${TESTDIR}/crerepos
22475Modified file1
22476u=rw,g=r,o=r
22477z25
22478EOF
22479	    cat gzipped.dat >>session.dat
22480	    echo import >>session.dat
22481	    dotest server-4 "${testcvs} server" \
22482"M N dir1/file1
22483M
22484M No conflicts created by this import
22485M
22486ok" <session.dat
22487	    dotest server-5 \
22488"${testcvs} -q -d ${TESTDIR}/crerepos co -p dir1/file1" "test"
22489
22490	    # OK, here are some notify tests.
22491	    dotest server-6 "${testcvs} server" \
22492"Notified \./
22493${TESTDIR}/crerepos/dir1/file1
22494ok" <<EOF
22495Root ${TESTDIR}/crerepos
22496Directory .
22497${TESTDIR}/crerepos/dir1
22498Notify file1
22499E	Fri May  7 13:21:09 1999 GMT	myhost	some-work-dir	EUC
22500noop
22501EOF
22502	    # Sending the second "noop" before waiting for the output
22503	    # from the first is bogus but hopefully we can get away
22504	    # with it.
22505	    dotest server-7 "${testcvs} server" \
22506"Notified \./
22507${TESTDIR}/crerepos/dir1/file1
22508ok
22509Notified \./
22510${TESTDIR}/crerepos/dir1/file1
22511ok" <<EOF
22512Root ${TESTDIR}/crerepos
22513Directory .
22514${TESTDIR}/crerepos/dir1
22515Notify file1
22516E	Fri May  7 13:21:09 1999 GMT	myhost	some-work-dir	EUC
22517noop
22518Notify file1
22519E	The 57th day of Discord in the YOLD 3165	myhost	some-work-dir	EUC
22520noop
22521EOF
22522
22523	    # OK, now test a few error conditions.
22524	    # FIXCVS: should give "error" and no "Notified", like server-9
22525	    dotest server-8 "${testcvs} server" \
22526"E ${PROG} server: invalid character in editor value
22527Notified \./
22528${TESTDIR}/crerepos/dir1/file1
22529ok" <<EOF
22530Root ${TESTDIR}/crerepos
22531Directory .
22532${TESTDIR}/crerepos/dir1
22533Notify file1
22534E	Setting Orange, the 52th day of Discord in the YOLD 3165	myhost	some-work-dir	EUC
22535noop
22536EOF
22537
22538	    dotest server-9 "${testcvs} server" \
22539"E Protocol error; misformed Notify request
22540error  " <<EOF
22541Root ${TESTDIR}/crerepos
22542Directory .
22543${TESTDIR}/crerepos/dir1
22544Notify file1
22545E	Setting Orange+57th day of Discord	myhost	some-work-dir	EUC
22546noop
22547EOF
22548
22549	    # First demonstrate an interesting quirk in the protocol.
22550	    # The "watchers" request selects the files to operate based
22551	    # on files which exist in the working directory.  So if we
22552	    # don't send "Entry" or the like, it won't do anything.
22553	    # Wants to be documented in cvsclient.texi...
22554	    dotest server-10 "${testcvs} server" "ok" <<EOF
22555Root ${TESTDIR}/crerepos
22556Directory .
22557${TESTDIR}/crerepos/dir1
22558watchers
22559EOF
22560	    # See if "watchers" and "editors" display the right thing.
22561	    dotest server-11 "${testcvs} server" \
22562"M file1	${username}	tedit	tunedit	tcommit
22563ok" <<EOF
22564Root ${TESTDIR}/crerepos
22565Directory .
22566${TESTDIR}/crerepos/dir1
22567Entry /file1/1.1////
22568watchers
22569EOF
22570	    dotest server-12 "${testcvs} server" \
22571"M file1	${username}	The 57th day of Discord in the YOLD 3165	myhost	some-work-dir
22572ok" <<EOF
22573Root ${TESTDIR}/crerepos
22574Directory .
22575${TESTDIR}/crerepos/dir1
22576Entry /file1/1.1////
22577editors
22578EOF
22579
22580	    # Now do an unedit.
22581	    dotest server-13 "${testcvs} server" \
22582"Notified \./
22583${TESTDIR}/crerepos/dir1/file1
22584ok" <<EOF
22585Root ${TESTDIR}/crerepos
22586Directory .
22587${TESTDIR}/crerepos/dir1
22588Notify file1
22589U	7 May 1999 15:00 GMT	myhost	some-work-dir	EUC
22590noop
22591EOF
22592
22593	    # Now try "watchers" and "editors" again.
22594	    dotest server-14 "${testcvs} server" "ok" <<EOF
22595Root ${TESTDIR}/crerepos
22596Directory .
22597${TESTDIR}/crerepos/dir1
22598watchers
22599EOF
22600	    dotest server-15 "${testcvs} server" "ok" <<EOF
22601Root ${TESTDIR}/crerepos
22602Directory .
22603${TESTDIR}/crerepos/dir1
22604editors
22605EOF
22606
22607	    if $keep; then
22608	      echo Keeping ${TESTDIR} and exiting due to --keep
22609	      exit 0
22610	    fi
22611
22612	    rm -rf ${TESTDIR}/crerepos
22613	    rm gzipped.dat session.dat
22614	  fi # skip the whole thing for local
22615	  ;;
22616
22617	server2)
22618	  # More server tests, in particular testing that various
22619	  # possible security holes are plugged.
22620	  if $remote; then
22621	    dotest server2-1 "${testcvs} server" \
22622"E protocol error: directory '${CVSROOT_DIRNAME}/\.\./dir1' not within root '${TESTDIR}/cvsroot'
22623error  " <<EOF
22624Root ${CVSROOT_DIRNAME}
22625Directory .
22626${CVSROOT_DIRNAME}/../dir1
22627noop
22628EOF
22629
22630	    dotest server2-2 "${testcvs} server" \
22631"E protocol error: directory '${CVSROOT_DIRNAME}dir1' not within root '${TESTDIR}/cvsroot'
22632error  " <<EOF
22633Root ${CVSROOT_DIRNAME}
22634Directory .
22635${CVSROOT_DIRNAME}dir1
22636noop
22637EOF
22638
22639	    dotest 2-3 "${testcvs} server" \
22640"E protocol error: directory '${TESTDIR}' not within root '${CVSROOT_DIRNAME}'
22641error  " <<EOF
22642Root ${CVSROOT_DIRNAME}
22643Directory .
22644${TESTDIR}
22645noop
22646EOF
22647
22648	    # OK, now a few tests for the rule that one cannot pass a
22649	    # filename containing a slash to Modified, Is-modified,
22650	    # Notify, Questionable, or Unchanged.  For completeness
22651	    # we'd try them all.  For lazyness/conciseness we don't.
22652	    dotest server2-4 "${testcvs} server" \
22653"E protocol error: directory 'foo/bar' not within current directory
22654error  " <<EOF
22655Root ${CVSROOT_DIRNAME}
22656Directory .
22657${CVSROOT_DIRNAME}
22658Unchanged foo/bar
22659noop
22660EOF
22661	  fi
22662	  ;;
22663
22664	client)
22665	  # Some tests of the client (independent of the server).
22666	  if $remote; then
22667	    cat >${TESTDIR}/serveme <<EOF
22668#!${TESTSHELL}
22669# This is admittedly a bit cheezy, in the sense that we make lots
22670# of assumptions about what the client is going to send us.
22671# We don't mention Repository, because current clients don't require it.
22672# Sending these at our own pace, rather than waiting for the client to
22673# make the requests, is bogus, but hopefully we can get away with it.
22674echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
22675echo "ok"
22676echo "M special message"
22677echo "Created first-dir/"
22678echo "${CVSROOT_DIRNAME}/first-dir/file1"
22679echo "/file1/1.1///"
22680echo "u=rw,g=rw,o=rw"
22681echo "4"
22682echo "xyz"
22683echo "ok"
22684cat >/dev/null
22685EOF
22686	    chmod +x ${TESTDIR}/serveme
22687	    CVS_SERVER=${TESTDIR}/serveme; export CVS_SERVER
22688	    mkdir 1; cd 1
22689	    dotest_fail client-1 "${testcvs} -q co first-dir" \
22690"${PROG} \[checkout aborted\]: This server does not support the global -q option${DOTSTAR}"
22691	    dotest client-2 "${testcvs} co first-dir" "special message"
22692
22693	    cat >${TESTDIR}/serveme <<EOF
22694#!${TESTSHELL}
22695echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
22696echo "ok"
22697echo "M merge-it"
22698echo "Copy-file ./"
22699echo "${CVSROOT_DIRNAME}/first-dir/file1"
22700echo "${TESTDIR}/bogus/.#file1.1.1"
22701echo "Merged ./"
22702echo "${CVSROOT_DIRNAME}/first-dir/file1"
22703echo "/file1/1.2///"
22704echo "u=rw,g=rw,o=rw"
22705echo "4"
22706echo "abd"
22707echo "ok"
22708cat >/dev/null
22709EOF
22710	    cd first-dir
22711	    mkdir ${TESTDIR}/bogus
22712	    # The ${DOTSTAR} is to match a potential "broken pipe" if the
22713	    # client exits before the server script sends everything
22714	    dotest_fail client-3 "${testcvs} update" "merge-it
22715${PROG} \[update aborted\]: protocol error: Copy-file tried to specify director${DOTSTAR}"
22716	    cat >${TESTDIR}/serveme <<EOF
22717#!${TESTSHELL}
22718echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
22719echo "ok"
22720echo "M merge-it"
22721echo "Copy-file ./"
22722echo "${CVSROOT_DIRNAME}/first-dir/file1"
22723echo ".#file1.1.1"
22724echo "Merged ./"
22725echo "${CVSROOT_DIRNAME}/first-dir/file1"
22726echo "/file1/1.2///"
22727echo "u=rw,g=rw,o=rw"
22728echo "4"
22729echo "abc"
22730echo "ok"
22731cat >/dev/null
22732EOF
22733	    dotest client-4 "${testcvs} update" "merge-it"
22734	    dotest client-5 "cat .#file1.1.1" "xyz"
22735	    dotest client-6 "cat CVS/Entries" "/file1/1.2/[A-Za-z0-9 :]*//
22736D"
22737	    dotest client-7 "cat file1" "abc"
22738
22739	    cat >${TESTDIR}/serveme <<EOF
22740#!${TESTSHELL}
22741echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
22742echo "ok"
22743echo "M OK, whatever"
22744echo "ok"
22745cat >${TESTDIR}/client.tmp
22746EOF
22747	    chmod u=rw,go= file1
22748	    # By specifying the time zone in local time, we don't
22749	    # know exactly how that will translate to GMT.
22750	    dotest client-8 "${testcvs} update -D 99-10-04" "OK, whatever"
22751	    dotest client-9 "cat ${TESTDIR}/client.tmp" \
22752"Root ${CVSROOT_DIRNAME}
22753Valid-responses [-a-zA-Z ]*
22754valid-requests
22755Argument -D
22756Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
22757Directory \.
22758${CVSROOT_DIRNAME}/first-dir
22759Entry /file1/1\.2///
22760Modified file1
22761u=rw,g=,o=
227624
22763abc
22764update"
22765
22766	    cd ../..
22767	    rm -r 1
22768	    rmdir ${TESTDIR}/bogus
22769	    rm ${TESTDIR}/serveme
22770	    CVS_SERVER=${testcvs}; export CVS_SERVER
22771	  fi # skip the whole thing for local
22772	  ;;
22773
22774	fork)
22775	  # Test that the server defaults to the correct executable in :fork:
22776	  # mode.  See the note in the TODO at the end of this file about this.
22777	  #
22778	  # This test and client should be left after all other references to
22779	  # CVS_SERVER are removed from this script.
22780	  #
22781	  # The client series of tests already tests that CVS_SERVER is
22782	  # working, but that test might be better here.
22783	  if $remote; then
22784	    mkdir fork; cd fork
22785	    unset CVS_SERVER
22786	    # So looking through $PATH for cvs won't work...
22787	    echo "echo junk" >cvs
22788	    chmod a+x cvs
22789	    save_PATH=$PATH; PATH=.:$PATH
22790	    dotest fork-1 "$testcvs -d:fork:$CVSROOT_DIRNAME version" \
22791'Client: \(.*\)
22792Server: \1'
22793	    CVS_SERVER=${testcvs}; export CVS_SERVER
22794	    PATH=$save_PATH; unset save_PATH
22795	    cd ..
22796	    if $keep; then :; else
22797	      rm -rf fork
22798	    fi
22799	  fi
22800	  ;;
22801
22802	*)
22803	   echo $what is not the name of a test -- ignored
22804	   ;;
22805	esac
22806done
22807
22808# Sanity check sanity.sh.  :)
22809#
22810# Test our exit directory so that tests that exit in an incorrect directory are
22811# noticed during single test runs.
22812if test "x$TESTDIR" != "x`pwd`"; then
22813	fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')"
22814fi
22815
22816echo "OK, all tests completed."
22817
22818# TODO:
22819# * Test `cvs update -d foo' (where foo does not exist).
22820# * Test `cvs update foo bar' (where foo and bar are both from the
22821#   same directory in the repository).  Suppose one is a branch--make
22822#   sure that both directories get updated with the respective correct
22823#   thing.
22824# * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
22825#   foo/.././../bar foo/../bar etc.
22826# * Test all flags in modules file.
22827#   Test that ciprog gets run both on checkin in that directory, or a
22828#     higher-level checkin which recurses into it.
22829# * Test operations on a directory that contains other directories but has
22830#   no files of its own.
22831# * -t global option
22832# * cvs rm followed by cvs add or vice versa (with no checkin in between).
22833# * cvs rm twice (should be a nice error message).
22834# * -P option to checkout--(a) refrains from checking out new empty dirs,
22835#   (b) prunes empty dirs already there.
22836# * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
22837#   gives an appropriate error (e.g.
22838#     Cannot access ${TESTDIR}/non-existent/CVSROOT
22839#     No such file or directory).
22840#   (like basica-9, but for remote).
22841# * Test ability to send notifications in response to watches.  (currently
22842#   hard to test because CVS doesn't send notifications if username is the
22843#   same).
22844# * Test the contents of adm files other than Root and Repository.
22845#   Entries seems the next most important thing.
22846# * Test the following compatibility issues:
22847#   - The filler fields in "D" entries in CVS/Entries get preserved
22848#     (per cvs.texinfo).
22849#   - Unrecognized entry types in CVS/Entries get ignored (looks like
22850#     this needs to be documented in cvs.texinfo, but is not)
22851#   - Test that unrecognized files in CVS directories (e.g. CVS/Foobar)
22852#     are ignored (per cvs.texinfo).
22853#   - Test 'cvs history' with symlinks in the path to the working directory.
22854#   - Remove most of the CVS_SERVER stuff after a reasonable amount of time.
22855#     The "fork" & "client" series of tests should be left.  4/2/00, CVS
22856#     1.11.0.1 was altered so that it would default to program_name (set from
22857#     argv[0]) rather than "cvs", but I'd like this script to work on legacy
22858#     versions of CVS for awhile.
22859#   - Testsuite doesn't work with usernames over eight characters in length.
22860#     Fix it.
22861# End of TODO list.
22862
22863# Exit if keep set
22864if $keep; then
22865  echo "Keeping ${TESTDIR} and exiting due to -k (keep) option."
22866  exit 0
22867fi
22868
22869# Remove the test directory, but first change out of it.
22870cd `dirname ${TESTDIR}`
22871rm -rf ${TESTDIR}
22872
22873# end of sanity.sh
22874