/contrib/cvs/src/sanity.sh

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 30254 lines · 24091 code · 2587 blank · 3576 comment · 795 complexity · cceaf0e0b88c0126424fe2fefc488af9 MD5 · raw file

  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. # usage:
  21. usage ()
  22. {
  23. echo "Usage: `basename $0` --help"
  24. echo "Usage: `basename $0` [-eklrv] [-f FROM-TEST] [-h HOSTNAME] CVS-TO-TEST [TESTS-TO-RUN...]"
  25. }
  26. exit_usage ()
  27. {
  28. usage 1>&2
  29. exit 2
  30. }
  31. exit_help ()
  32. {
  33. usage
  34. echo
  35. echo "-H|--help Display this text."
  36. echo "-e|--skipfail Treat tests that would otherwise be nonfatally skipped"
  37. echo " for reasons like missing tools as failures, exiting"
  38. echo " with an error message. Also treat warnings as"
  39. echo " failures."
  40. echo "-f FROM-TEST Run TESTS-TO-RUN, skipping all tests in the list before"
  41. echo " FROM-TEST."
  42. echo "-h HOSTNAME Use :ext:HOSTNAME to run remote tests rather than"
  43. echo " :fork:. Implies --remote and assumes that \$TESTDIR"
  44. echo " resolves to the same directory on both the client and"
  45. echo " the server."
  46. echo "-k|--keep Try to keep directories created by individual tests"
  47. echo " around, exiting after the first test which supports"
  48. echo " --keep."
  49. echo "-l|--link-root"
  50. echo " Test CVS using a symlink to a real CVSROOT."
  51. echo "-r|--remote Test remote instead of local cvs."
  52. echo "-v|--verbose List test names as they are executed."
  53. echo
  54. echo "CVS-TO-TEST The path to the CVS executable to be tested."
  55. echo "TESTS-TO-RUN The names of the tests to run (defaults to all tests)."
  56. exit 2
  57. }
  58. # See TODO list at end of file.
  59. # required to make this script work properly.
  60. unset CVSREAD
  61. # This will cause malloc to run slower but should also catch some common errors
  62. # when CVS is linked with glibc 2.x.
  63. MALLOC_CHECK_=2; export MALLOC_CHECK_
  64. # We want to invoke a predictable set of i18n behaviors, not whatever
  65. # the user running this script might have set.
  66. # In particular:
  67. # 'sort' and tabs and spaces (LC_COLLATE).
  68. # Messages from getopt (LC_MESSAGES) (in the future, CVS itself might
  69. # also alter its messages based on LC_MESSAGES).
  70. LANG=C
  71. export LANG
  72. LC_ALL=C
  73. export LC_ALL
  74. #
  75. # Initialize the test counts.
  76. #
  77. passed=0
  78. skipped=0
  79. warnings=0
  80. #
  81. # read our options
  82. #
  83. unset fromtest
  84. unset remotehost
  85. keep=false
  86. linkroot=false
  87. remote=false
  88. skipfail=false
  89. verbose=false
  90. while getopts ef:h:Hklrv-: option ; do
  91. # convert the long opts to short opts
  92. if test x$option = x-; then
  93. case "$OPTARG" in
  94. [hH]|[hH][eE]|[hH][eE][lL]|[hH][eE][lL][pP])
  95. option=H;
  96. OPTARG=
  97. ;;
  98. [kK]|[kK][eE]|[kK][eE][eE]|[kK][eE][eE][pP])
  99. option=k;
  100. OPTARG=
  101. ;;
  102. l|li|lin|link|link-|link-r]|link-ro|link-roo|link-root)
  103. option=l;
  104. OPTARG=
  105. ;;
  106. [rR]|[rR][eE]|[rR][eE][mM]|[rR][eE][mM][oO]|[rR][eE][mM][oO][tT]|[rR][eE][mM][oO][tT][eE])
  107. option=k;
  108. OPTARG=
  109. ;;
  110. s|sk|ski|skip|skipf|skipfa|skipfai|skipfail)
  111. option=e
  112. OPTARG=
  113. ;;
  114. v|ve|ver|verb|verbo|verbos|verbose)
  115. option=v
  116. OPTARG=
  117. ;;
  118. *)
  119. option=\?
  120. OPTARG=
  121. esac
  122. fi
  123. case "$option" in
  124. e)
  125. skipfail=:
  126. ;;
  127. f)
  128. fromtest="$OPTARG"
  129. ;;
  130. h)
  131. # Set a remotehost to run the remote tests on via :ext:
  132. # Implies `-r' and assumes that $TESTDIR resolves to the same
  133. # directory on the client and the server.
  134. remotehost="$OPTARG"
  135. remote=:
  136. ;;
  137. H)
  138. exit_help
  139. ;;
  140. k)
  141. # The -k (keep) option will eventually cause all the tests to
  142. # leave around the contents of the /tmp directory; right now only
  143. # some implement it. Not originally intended to be useful with
  144. # more than one test, but this should work if each test uses a
  145. # uniquely named dir (use the name of the test).
  146. keep=:
  147. ;;
  148. l)
  149. linkroot=:
  150. ;;
  151. r)
  152. remote=:
  153. ;;
  154. v)
  155. verbose=:
  156. ;;
  157. \?)
  158. exit_usage
  159. ;;
  160. esac
  161. done
  162. # boot the arguments we used above
  163. while test $OPTIND -gt 1 ; do
  164. shift
  165. OPTIND=`expr $OPTIND - 1`
  166. done
  167. # Use full path for CVS executable, so that CVS_SERVER gets set properly
  168. # for remote.
  169. case $1 in
  170. "")
  171. exit_usage
  172. ;;
  173. /*)
  174. testcvs=$1
  175. ;;
  176. *)
  177. testcvs=`pwd`/$1
  178. ;;
  179. esac
  180. shift
  181. # If $remotehost is set, warn if $TESTDIR isn't since we are pretty sure
  182. # that its default value of `/tmp/cvs-sanity' will not resolve to the same
  183. # directory on two different machines.
  184. if test -n "$remotehost" && test -z "$TESTDIR"; then
  185. echo "WARNING: CVS server hostname is set and \$TESTDIR is not. If" >&2
  186. echo "$remotehost is not the local machine, then it is unlikely that" >&2
  187. echo "the default value assigned to \$TESTDIR will resolve to the same" >&2
  188. echo "directory on both this client and the CVS server." >&2
  189. fi
  190. ###
  191. ### GUTS
  192. ###
  193. # "debugger"
  194. #set -x
  195. echo 'This test should produce no other output than this message, and a final "OK".'
  196. echo '(Note that the test can take an hour or more to run and periodically stops'
  197. echo 'for as long as one minute. Do not assume there is a problem just because'
  198. echo 'nothing seems to happen for a long time. If you cannot live without'
  199. echo 'running status, use the -v option or try the command:'
  200. echo "\`tail -f check.log' from another window.)"
  201. # Regexp to match what CVS will call itself in output that it prints.
  202. # FIXME: we don't properly quote this--if the name contains . we'll
  203. # just spuriously match a few things; if the name contains other regexp
  204. # special characters we are probably in big trouble.
  205. PROG=`basename ${testcvs}`
  206. # Match the hostname
  207. hostname="[-_.a-zA-Z0-9]*"
  208. # Regexp to match the name of a temporary file (from cvs_temp_name).
  209. # This appears in certain diff output.
  210. tempname="[-a-zA-Z0-9/.%_]*"
  211. # Regexp to match a date in RFC822 format (as amended by RFC1123).
  212. RFCDATE="[a-zA-Z0-9 ][a-zA-Z0-9 ]* [0-9:][0-9:]* -0000"
  213. RFCDATE_EPOCH="1 Jan 1970 00:00:00 -0000"
  214. # Regexp to match a date in standard Unix format as used by rdiff
  215. # FIXCVS: There's no reason for rdiff to use a different date format
  216. # than diff does
  217. DATE="[a-zA-Z]* [a-zA-Z]* [ 1-3][0-9] [0-9:]* [0-9]*"
  218. # Which directories should Which and find_tool search for executables?
  219. SEARCHPATH=$PATH:/usr/local/bin:/usr/contrib/bin:/usr/contrib:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin:/sw/bin:/usr/pkg/bin
  220. # Do not assume that `type -p cmd` is portable
  221. # Usage: Which [-a] [-x|-f|-r] prog [$SEARCHPATH:/with/directories:/to/search]
  222. Which() {
  223. # Optional first argument for file type, defaults to -x.
  224. # Second argument is the file or directory to be found.
  225. # Third argument is the PATH to search.
  226. # By default, print only the first file that matches,
  227. # -a will cause all matches to be printed.
  228. notevery=:
  229. if [ "x$1" = "x-a" ]; then notevery=false; shift; fi
  230. case "$1" in
  231. -*) t=$1; shift ;;
  232. *) t=-x ;;
  233. esac
  234. case "$1" in
  235. # FIXME: Someday this may need to be fixed
  236. # to deal better with C:\some\path\to\ssh values...
  237. /*) test $t $1 && echo $1 ;;
  238. *) for d in `IFS=:; echo ${2-$SEARCHPATH}`
  239. do
  240. test $t $d/$1 && { echo $d/$1; if $notevery; then break; fi; }
  241. done
  242. ;;
  243. esac
  244. }
  245. # On cygwin32, we may not have /bin/sh.
  246. if test -r /bin/sh; then
  247. TESTSHELL="/bin/sh"
  248. else
  249. TESTSHELL=`Which -f sh`
  250. if test ! -r "$TESTSHELL"; then
  251. TESTSHELL="/bin/sh"
  252. fi
  253. fi
  254. # FIXME: try things (what things? checkins?) without -m.
  255. #
  256. # Some of these tests are written to expect -Q. But testing with
  257. # -Q is kind of bogus, it is not the way users actually use CVS (usually).
  258. # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
  259. # and then they've obviously got to do something with the output....
  260. #
  261. CVS="${testcvs} -Q"
  262. LOGFILE=`pwd`/check.log
  263. # Save the previous log in case the person running the tests decides
  264. # they want to look at it. The extension ".plog" is chosen for consistency
  265. # with dejagnu.
  266. if test -f check.log; then
  267. mv check.log check.plog
  268. fi
  269. # Create the log file so check.log can be tailed almost immediately after
  270. # this script is started. Otherwise it can take up to a minute or two before
  271. # the log file gets created when $remotehost is specified on some systems,
  272. # which makes for a lot of failed `tail -f' attempts.
  273. touch check.log
  274. # Workaround any X11Forwarding by ssh. Otherwise this text:
  275. # Warning: No xauth data; using fake authentication data for X11 forwarding.
  276. # has been known to end up in the test results below
  277. # causing the test to fail.
  278. [ -n "$DISPLAY" ] && unset DISPLAY
  279. # The default value of /tmp/cvs-sanity for TESTDIR is dubious,
  280. # because it loses if two people/scripts try to run the tests
  281. # at the same time. Some possible solutions:
  282. # 1. Use /tmp/cvs-test$$. One disadvantage is that the old
  283. # cvs-test* directories would pile up, because they wouldn't
  284. # necessarily get removed.
  285. # 2. Have everyone/everything running the testsuite set
  286. # TESTDIR to some appropriate directory.
  287. # 3. Have the default value of TESTDIR be some variation of
  288. # `pwd`/cvs-sanity. The biggest problem here is that we have
  289. # been fairly careful to test that CVS prints in messages the
  290. # actual pathnames that we pass to it, rather than a different
  291. # pathname for the same directory, as may come out of `pwd`.
  292. # So this would be lost if everything was `pwd`-based. I suppose
  293. # if we wanted to get baroque we could start making symlinks
  294. # to ensure the two are different.
  295. : ${CVS_RSH=rsh}; export CVS_RSH
  296. if test -n "$remotehost"; then
  297. # We need to set $tmp on the server since $TMPDIR is compared against
  298. # messages generated by the server.
  299. tmp=`$CVS_RSH $remotehost 'cd /tmp; /bin/pwd || pwd' 2>/dev/null`
  300. if test $? != 0; then
  301. echo "$CVS_RSH $remotehost failed." >&2
  302. exit 1
  303. fi
  304. else
  305. tmp=`(cd /tmp; /bin/pwd || pwd) 2>/dev/null`
  306. fi
  307. # Now:
  308. # 1) Set TESTDIR if it's not set already
  309. # 2) Remove any old test remnants
  310. # 3) Create $TESTDIR
  311. # 4) Normalize TESTDIR with `cd && (/bin/pwd || pwd)`
  312. # (This will match CVS output later)
  313. : ${TESTDIR=$tmp/cvs-sanity}
  314. # clean any old remnants (we need the chmod because some tests make
  315. # directories read-only)
  316. if test -d ${TESTDIR}; then
  317. chmod -R a+wx ${TESTDIR}
  318. rm -rf ${TESTDIR}
  319. fi
  320. # These exits are important. The first time I tried this, if the `mkdir && cd`
  321. # failed then the build directory would get blown away. Some people probably
  322. # wouldn't appreciate that.
  323. mkdir ${TESTDIR} || exit 1
  324. cd ${TESTDIR} || exit 1
  325. # Ensure $TESTDIR is absolute
  326. if echo "${TESTDIR}" |grep '^[^/]'; then
  327. # Don't resolve this unless we have to. This keeps symlinks intact. This
  328. # is important at least when testing using -h $remotehost, because the same
  329. # value for $TESTDIR must resolve to the same directory on the client and
  330. # the server and we likely used Samba, and possibly symlinks, to do this.
  331. TESTDIR=`(/bin/pwd || pwd) 2>/dev/null`
  332. fi
  333. if test -z "${TESTDIR}" || echo "${TESTDIR}" |grep '^[^/]'; then
  334. echo "Unable to resolve TESTDIR to an absolute directory." >&2
  335. exit 1
  336. fi
  337. cd ${TESTDIR}
  338. # Now set $TMPDIR if the user hasn't overridden it.
  339. #
  340. # We use a $TMPDIR under $TESTDIR by default so that two tests may be run at
  341. # the same time without bumping heads without requiring the user to specify
  342. # more than $TESTDIR. See the test for leftover cvs-serv* directories near the
  343. # end of this script at the end of "The big loop".
  344. : ${TMPDIR=$TESTDIR/tmp}
  345. export TMPDIR
  346. if test -d $TMPDIR; then :; else
  347. mkdir $TMPDIR
  348. fi
  349. # Make sure various tools work the way we expect, or try to find
  350. # versions that do.
  351. : ${AWK=awk}
  352. : ${EXPR=expr}
  353. : ${ID=id}
  354. : ${TR=tr}
  355. # Keep track of tools that are found, but do NOT work as we hope
  356. # in order to avoid them in future
  357. badtools=
  358. set_bad_tool ()
  359. {
  360. badtools=$badtools:$1
  361. }
  362. is_bad_tool ()
  363. {
  364. case ":$badtools:" in *:$1:*) return 0 ;; *) return 1 ; esac
  365. }
  366. version_test ()
  367. {
  368. vercmd=$1
  369. verbad=:
  370. if RES=`$vercmd --version </dev/null 2>&1`; then
  371. if test "X$RES" != "X--version" && test "X$RES" != "X" ; then
  372. echo "$RES"
  373. verbad=false
  374. fi
  375. fi
  376. if $verbad; then
  377. echo "The command \`$vercmd' does not support the --version option."
  378. fi
  379. # It does not really matter that --version is not supported
  380. return 0
  381. }
  382. # Try to find a tool that satisfies all of the tests.
  383. # Usage: list:of:colon:separated:alternatives test1 test2 test3 test4...
  384. # Example: find_tool awk:gawk:nawk awk_tooltest1 awk_tooltest2
  385. find_tool ()
  386. {
  387. default_TOOL=$1
  388. echo find_tool: ${1+"$@"} >>$LOGFILE
  389. cmds="`IFS=:; echo $1`"; shift; tooltests="${1+$@}"
  390. if test -z "$tooltests"; then tooltests=version_test; fi
  391. clist=; for cmd in $cmds; do clist="$clist `Which -a $cmd`"; done
  392. # Make sure the default tool is just the first real command name
  393. for default_TOOL in $clist `IFS=:; echo $default_TOOL`; do break; done
  394. TOOL=""
  395. for trytool in $clist ; do
  396. pass=:
  397. for tooltest in $tooltests; do
  398. result=`eval $tooltest $trytool`
  399. rc=$?
  400. echo "Running $tooltest $trytool" >>$LOGFILE
  401. if test -n "$result"; then
  402. echo "$result" >>$LOGFILE
  403. fi
  404. if test "$rc" = "0"; then
  405. echo "PASS: $tooltest $trytool" >>$LOGFILE
  406. elif test "$rc" = "77"; then
  407. echo "MARGINAL: $tooltest $trytool; rc=$rc" >>$LOGFILE
  408. TOOL=$trytool
  409. pass=false
  410. else
  411. set_bad_tool $trytool
  412. echo "FAIL: $tooltest $trytool; rc=$rc" >>$LOGFILE
  413. pass=false
  414. fi
  415. done
  416. if $pass; then
  417. echo $trytool
  418. return 0
  419. fi
  420. done
  421. if test -n "$TOOL"; then
  422. echo "Notice: The default version of \`$default_TOOL' is defective." >>$LOGFILE
  423. echo "using \`$TOOL' and hoping for the best." >>$LOGFILE
  424. echo "Notice: The default version of \`$default_TOOL' is defective." >&2
  425. echo "using \`$TOOL' and hoping for the best." >&2
  426. echo $TOOL
  427. else
  428. echo $default_TOOL
  429. fi
  430. }
  431. id_tool_test ()
  432. {
  433. id=$1
  434. if $id -u >/dev/null 2>&1 && $id -un >/dev/null 2>&1; then
  435. return 0
  436. else
  437. echo "Running these tests requires an \`id' program that understands the"
  438. echo "-u and -n flags. Make sure that such an id (GNU, or many but not"
  439. echo "all vendor-supplied versions) is in your path."
  440. return 1
  441. fi
  442. }
  443. ID=`find_tool id version_test id_tool_test`
  444. echo "Using ID=$ID" >>$LOGFILE
  445. # You can't run CVS as root; print a nice error message here instead
  446. # of somewhere later, after making a mess.
  447. for pass in false :; do
  448. case "`$ID -u 2>/dev/null`" in
  449. "0")
  450. echo "Test suite does not work correctly when run as root" >&2
  451. exit 1
  452. ;;
  453. *)
  454. break
  455. ;;
  456. esac
  457. done
  458. # Cause NextStep 3.3 users to lose in a more graceful fashion.
  459. expr_tooltest1 ()
  460. {
  461. expr=$1
  462. if $expr 'abc
  463. def' : 'abc
  464. def' >/dev/null; then
  465. # good, it works
  466. return 0
  467. else
  468. echo 'Running these tests requires an "expr" program that can handle'
  469. echo 'multi-line patterns. Make sure that such an expr (GNU, or many but'
  470. echo 'not all vendor-supplied versions) is in your path.'
  471. return 1
  472. fi
  473. }
  474. # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
  475. # if we can't find a GNU expr to ease their troubles...
  476. expr_tooltest2 ()
  477. {
  478. expr=$1
  479. if $expr 'a
  480. b' : 'a
  481. c' >/dev/null; then
  482. echo 'WARNING: you are using a version of expr that does not correctly'
  483. echo 'match multi-line patterns. Some tests may spuriously pass or fail.'
  484. echo 'You may wish to make sure GNU expr is in your path.'
  485. return 1
  486. else
  487. return 0
  488. fi
  489. }
  490. expr_create_bar ()
  491. {
  492. echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo
  493. cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
  494. cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo
  495. cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar
  496. rm -f ${TESTDIR}/foo
  497. }
  498. expr_tooltest3 ()
  499. {
  500. expr=$1
  501. # More SunOS lossage...
  502. test ! -f ${TESTDIR}/bar && expr_create_bar
  503. if $expr "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then
  504. : good, it works
  505. else
  506. echo 'WARNING: you are using a version of expr that does not correctly'
  507. echo 'match large patterns. Some tests may spuriously pass or fail.'
  508. echo 'You may wish to make sure GNU expr is in your path.'
  509. return 1
  510. fi
  511. if $expr "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then
  512. echo 'WARNING: you are using a version of expr that does not correctly'
  513. echo 'match large patterns. Some tests may spuriously pass or fail.'
  514. echo 'You may wish to make sure GNU expr is in your path.'
  515. return 1
  516. fi
  517. # good, it works
  518. return 0
  519. }
  520. # That we should have to do this is total bogosity, but GNU expr
  521. # version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix
  522. # (e.g. SunOS 4.1.3 expr) one. Rumor has it this will be fixed in the
  523. # next release of GNU expr after 1.12 (but we still have to cater to the old
  524. # ones for some time because they are in many linux distributions).
  525. ENDANCHOR="$"
  526. expr_set_ENDANCHOR ()
  527. {
  528. expr=$1
  529. ENDANCHOR="$"
  530. if $expr 'abc
  531. def' : 'abc$' >/dev/null; then
  532. ENDANCHOR='\'\'
  533. echo "Notice: An ENDANCHOR of dollar does not work."
  534. echo "Using a workaround for GNU expr versions 1.9.4 thru 1.12"
  535. fi
  536. return 0
  537. }
  538. # Work around another GNU expr (version 1.10-1.12) bug/incompatibility.
  539. # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
  540. # Note that the workaround is not a complete equivalent of .* because
  541. # the first parenthesized expression in the regexp must match something
  542. # in order for expr to return a successful exit status.
  543. # Rumor has it this will be fixed in the
  544. # next release of GNU expr after 1.12 (but we still have to cater to the old
  545. # ones for some time because they are in many linux distributions).
  546. DOTSTAR='.*'
  547. expr_set_DOTSTAR ()
  548. {
  549. expr=$1
  550. DOTSTAR='.*'
  551. if $expr 'abc
  552. def' : "a${DOTSTAR}f" >/dev/null; then
  553. : good, it works
  554. else
  555. DOTSTAR='\(.\|
  556. \)*'
  557. echo "Notice: DOTSTAR changed from sane \`.*' value to \`$DOTSTAR\`"
  558. echo "to workaround GNU expr version 1.10 thru 1.12 bug where \`.'"
  559. echo "does not match a newline."
  560. fi
  561. return 0
  562. }
  563. # Now that we have DOTSTAR, make sure it works with big matches
  564. expr_tooltest_DOTSTAR ()
  565. {
  566. expr=$1
  567. test ! -f ${TESTDIR}/bar && expr_create_bar
  568. if $expr "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then
  569. # good, it works
  570. return 0
  571. else
  572. echo 'WARNING: you are using a version of expr that does not correctly'
  573. echo 'match large patterns. Some tests may spuriously pass or fail.'
  574. echo 'You may wish to make sure GNU expr is in your path.'
  575. return 77
  576. fi
  577. }
  578. # FreeBSD 5.2 and 6.1 support 'expr [-e] expression'
  579. # They get confused unless '--' is used before the expressions
  580. # when those expressions begin with a '-' character, such as the
  581. # output of an ls -l command. The EXPR_COMPAT environment variable may
  582. # be used to go back to the non-POSIX behavior as an alternative.
  583. # (GNU expr appears to accept the '--' argument and work correctly or
  584. # not have it and still get the results we want.)
  585. exprDASHDASH='false'
  586. expr_set_DASHDASH ()
  587. {
  588. expr=$1
  589. exprDASHDASH='false'
  590. # Not POSIX, but works on a lot of expr versions.
  591. if $expr "-rw-rw-r--" : "-rw-rw-r--" >/dev/null 2>&1; then
  592. # good, it works
  593. return 0
  594. else
  595. # Do things in the POSIX manner.
  596. if $expr -- "-rw-rw-r--" : "-rw-rw-r--" >/dev/null 2>&1; then
  597. exprDASHDASH=':'
  598. return 0
  599. else
  600. echo 'WARNING: Your $expr does not correctly handle'
  601. echo 'leading "-" characters in regular expressions to'
  602. echo 'be matched. You may wish to see if there is an'
  603. echo 'environment variable or other setting to allow'
  604. echo 'POSIX functionality to be enabled.'
  605. return 77
  606. fi
  607. fi
  608. }
  609. EXPR=`find_tool ${EXPR}:gexpr \
  610. version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \
  611. expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR`
  612. # Set the ENDANCHOR and DOTSTAR for the chosen expr version.
  613. expr_set_ENDANCHOR ${EXPR} >/dev/null
  614. expr_tooltest_DOTSTAR ${EXPR} >/dev/null
  615. # Is $EXPR a POSIX or non-POSIX implementation
  616. # with regard to command-line arguments?
  617. expr_set_DASHDASH ${EXPR}
  618. $exprDASHDASH && EXPR="$EXPR --"
  619. echo "Using EXPR=$EXPR" >>$LOGFILE
  620. echo "Using ENDANCHOR=$ENDANCHOR" >>$LOGFILE
  621. echo "Using DOTSTAR=$DOTSTAR" >>$LOGFILE
  622. # Cleanup
  623. rm -f ${TESTDIR}/bar
  624. # Work around yet another GNU expr (version 1.10) bug/incompatibility.
  625. # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
  626. # it is not. I doubt that POSIX allows us to use \+ and assume it means
  627. # (non-special) +, so here is another workaround
  628. # Rumor has it this will be fixed in the
  629. # next release of GNU expr after 1.12 (but we still have to cater to the old
  630. # ones for some time because they are in many linux distributions).
  631. PLUS='+'
  632. if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
  633. : good, it works
  634. else
  635. PLUS='\+'
  636. fi
  637. # Likewise, for ?
  638. QUESTION='?'
  639. if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
  640. : good, it works
  641. else
  642. QUESTION='\?'
  643. fi
  644. # Now test the username to make sure it contains only valid characters
  645. username=`$ID -un`
  646. if $EXPR "${username}" : "${username}" >/dev/null; then
  647. : good, it works
  648. else
  649. echo "Test suite does not work correctly when run by a username" >&2
  650. echo "containing regular expression meta-characters." >&2
  651. exit 1
  652. fi
  653. # Only 8 characters of $username appear in some output.
  654. if test `echo $username |wc -c` -gt 8; then
  655. username8=`echo $username |sed 's/^\(........\).*/\1/'`
  656. else
  657. username8=$username
  658. fi
  659. # Rarely, we need to match any username, not just the name of the user
  660. # running this test.
  661. #
  662. # I'm not really sure what characters should be here. a-zA-Z obviously.
  663. # People complained when 0-9 were not allowed in usernames. Other than that
  664. # I'm not sure.
  665. anyusername="[-a-zA-Z0-9][-a-zA-Z0-9]*"
  666. # now make sure that tr works on NULs
  667. tr_tooltest1 ()
  668. {
  669. tr=$1
  670. if $EXPR `echo "123" | $tr '2' '\0'` : "123" >/dev/null 2>&1; then
  671. echo 'Warning: you are using a version of tr which does not correctly'
  672. echo 'handle NUL bytes. Some tests may spuriously pass or fail.'
  673. echo 'You may wish to make sure GNU tr is in your path.'
  674. return 77
  675. fi
  676. # good, it works
  677. return 0
  678. }
  679. TR=`find_tool ${TR}:gtr version_test tr_tooltest1`
  680. echo "Using TR=$TR" >>$LOGFILE
  681. # Awk testing
  682. awk_tooltest1 ()
  683. {
  684. awk=$1
  685. $awk 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
  686. if $EXPR "`cat abc`" : \
  687. 'one
  688. two
  689. three
  690. four
  691. five
  692. six'; then
  693. rm abc
  694. return 0
  695. else
  696. rm abc
  697. echo "Notice: awk BEGIN clause or printf is not be working properly."
  698. return 1
  699. fi
  700. }
  701. # Format item %c check
  702. awk_tooltest2 ()
  703. {
  704. awk=$1
  705. $awk 'BEGIN { printf "%c%c%c", 2, 3, 4 }' </dev/null \
  706. | ${TR} '\002\003\004' '123' >abc
  707. if $EXPR "`cat abc`" : "123" ; then
  708. : good, found it
  709. else
  710. echo "Notice: awk format %c string may not be working properly."
  711. rm abc
  712. return 77
  713. fi
  714. rm abc
  715. return 0
  716. }
  717. AWK=`find_tool gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2`
  718. echo "Using AWK=$AWK" >>$LOGFILE
  719. # Test that $1 works as a remote shell. If so, set $host, $CVS_RSH, &
  720. # $save_CVS_RSH to match and return 0. Otherwise, set $skipreason and return
  721. # 77.
  722. depends_on_rsh ()
  723. {
  724. host=${remotehost-"`hostname`"}
  725. result=`$1 $host 'echo test'`
  726. rc=$?
  727. if test $? != 0 || test "x$result" != "xtest"; then
  728. skipreason="\`$1 $host' failed rc=$rc result=$result"
  729. return 77
  730. fi
  731. save_CVS_RSH=$CVS_RSH
  732. CVS_RSH=$1; export CVS_RSH
  733. return 0
  734. }
  735. # Find a usable SSH. When a usable ssh is found, set $host, $CVS_RSH, and
  736. # $save_CVS_RSH and return 0. Otherwise, set $skipreason and return 77.
  737. depends_on_ssh ()
  738. {
  739. case "$CVS_RSH" in
  740. *ssh*|*putty*)
  741. tryssh=`Which $CVS_RSH`
  742. if [ ! -n "$tryssh" ]; then
  743. skipreason="Unable to find CVS_RSH=$CVS_RSH executable"
  744. return 77
  745. elif [ ! -x "$tryssh" ]; then
  746. skipreason="Unable to execute $tryssh program"
  747. return 77
  748. fi
  749. ;;
  750. *)
  751. # Look in the user's PATH for "ssh"
  752. tryssh=`Which ssh`
  753. if test ! -r "$tryssh"; then
  754. skipreason="Unable to find ssh program"
  755. return 77
  756. fi
  757. ;;
  758. esac
  759. depends_on_rsh "$tryssh"
  760. return $?
  761. }
  762. pass ()
  763. {
  764. echo "PASS: $1" >>${LOGFILE}
  765. passed=`expr $passed + 1`
  766. }
  767. # Like skip(), but don't fail when $skipfail is set.
  768. skip_always ()
  769. {
  770. echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
  771. skipped=`expr $skipped + 1`
  772. }
  773. skip ()
  774. {
  775. if $skipfail; then
  776. fail "$1${2+ ($2)}"
  777. else
  778. echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
  779. fi
  780. skipped=`expr $skipped + 1`
  781. }
  782. warn ()
  783. {
  784. if $skipfail; then
  785. fail "$1${2+ ($2)}"
  786. else
  787. echo "WARNING: $1${2+ ($2)}" >>$LOGFILE
  788. fi
  789. warnings=`expr $warnings + 1`
  790. }
  791. # Convenience function for skipping tests run only in local mode.
  792. localonly ()
  793. {
  794. skip_always $1 "only tested in local mode"
  795. }
  796. fail ()
  797. {
  798. echo "FAIL: $1" | tee -a ${LOGFILE}
  799. echo "*** Please see the \`TESTS' and \`check.log' files for more information." >&2
  800. # This way the tester can go and see what remnants were left
  801. exit 1
  802. }
  803. verify_tmp_empty ()
  804. {
  805. # Test our temp directory for cvs-serv* directories and cvsXXXXXX temp
  806. # files. We would like to not leave any behind.
  807. if $remote && ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
  808. # A true value means ls found files/directories with these names.
  809. # Give the server some time to finish, then retry.
  810. sleep 1
  811. if ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then
  812. warn "$1" "Found cvs-serv* directories in $TMPDIR."
  813. # The above will exit if $skipfail
  814. rm -rf $TMPDIR/cvs-serv*
  815. fi
  816. fi
  817. if ls $TMPDIR/cvs?????? >/dev/null 2>&1; then
  818. # A true value means ls found files/directories with these names.
  819. warn "$1" "Found cvsXXXXXX temp files in $TMPDIR."
  820. # The above will exit if $skipfail
  821. rm -f ls $TMPDIR/cvs??????
  822. fi
  823. }
  824. # Restore changes to CVSROOT admin files.
  825. restore_adm ()
  826. {
  827. rm -rf $CVSROOT_DIRNAME/CVSROOT
  828. cp -Rp $TESTDIR/CVSROOT.save $CVSROOT_DIRNAME/CVSROOT
  829. }
  830. # See dotest and dotest_fail for explanation (this is the parts
  831. # of the implementation common to the two).
  832. dotest_internal ()
  833. {
  834. if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$3${ENDANCHOR}" >/dev/null; then
  835. # Why, I hear you ask, do we write this to the logfile
  836. # even when the test passes? The reason is that the test
  837. # may give us the regexp which we were supposed to match,
  838. # but sometimes it may be useful to look at the exact
  839. # text which was output. For example, suppose one wants
  840. # to grep for a particular warning, and make _sure_ that
  841. # CVS never hits it (even in cases where the tests might
  842. # match it with .*). Or suppose one wants to see the exact
  843. # date format output in a certain case (where the test will
  844. # surely use a somewhat non-specific pattern).
  845. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  846. pass "$1"
  847. verify_tmp_empty "$1"
  848. # expr can't distinguish between "zero characters matched" and "no match",
  849. # so special-case it.
  850. elif test -z "$3" && test ! -s ${TESTDIR}/dotest.tmp; then
  851. pass "$1"
  852. verify_tmp_empty "$1"
  853. elif test x"$4" != x; then
  854. if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$4${ENDANCHOR}" >/dev/null; then
  855. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  856. pass "$1"
  857. verify_tmp_empty "$1"
  858. else
  859. echo "** expected: " >>${LOGFILE}
  860. echo "$3" >>${LOGFILE}
  861. echo "$3" > ${TESTDIR}/dotest.ex1
  862. echo "** or: " >>${LOGFILE}
  863. echo "$4" >>${LOGFILE}
  864. echo "$4" > ${TESTDIR}/dotest.ex2
  865. echo "** got: " >>${LOGFILE}
  866. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  867. fail "$1"
  868. fi
  869. else
  870. echo "** expected: " >>${LOGFILE}
  871. echo "$3" >>${LOGFILE}
  872. echo "$3" > ${TESTDIR}/dotest.exp
  873. echo "** got: " >>${LOGFILE}
  874. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  875. fail "$1"
  876. fi
  877. }
  878. dotest_all_in_one ()
  879. {
  880. if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
  881. "`cat ${TESTDIR}/dotest.exp`" >/dev/null; then
  882. return 0
  883. fi
  884. return 1
  885. }
  886. # WARNING: this won't work with REs that match newlines....
  887. #
  888. dotest_line_by_line ()
  889. {
  890. line=1
  891. while [ $line -le `wc -l <${TESTDIR}/dotest.tmp` ] ; do
  892. if $EXPR "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" : \
  893. "`sed -n ${line}p ${TESTDIR}/dotest.exp`" >/dev/null; then
  894. :
  895. elif test -z "`sed -n ${line}p ${TESTDIR}/dotest.tmp`" &&
  896. test -z "`sed -n ${line}p ${TESTDIR}/dotest.exp`"; then
  897. :
  898. else
  899. echo "Line $line:" >> ${LOGFILE}
  900. echo "**** expected: " >>${LOGFILE}
  901. sed -n ${line}p ${TESTDIR}/dotest.exp >>${LOGFILE}
  902. echo "**** got: " >>${LOGFILE}
  903. sed -n ${line}p ${TESTDIR}/dotest.tmp >>${LOGFILE}
  904. unset line
  905. return 1
  906. fi
  907. line=`expr $line + 1`
  908. done
  909. unset line
  910. return 0
  911. }
  912. # If you are having trouble telling which line of a multi-line
  913. # expression is not being matched, replace calls to dotest_internal()
  914. # with calls to this function:
  915. #
  916. dotest_internal_debug ()
  917. {
  918. if test -z "$3"; then
  919. if test -s ${TESTDIR}/dotest.tmp; then
  920. echo "** expected: " >>${LOGFILE}
  921. echo "$3" >>${LOGFILE}
  922. echo "$3" > ${TESTDIR}/dotest.exp
  923. rm -f ${TESTDIR}/dotest.ex2
  924. echo "** got: " >>${LOGFILE}
  925. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  926. fail "$1"
  927. else
  928. pass "$1"
  929. verify_tmp_empty "$1"
  930. fi
  931. else
  932. echo "$3" > ${TESTDIR}/dotest.exp
  933. if dotest_line_by_line "$1" "$2"; then
  934. pass "$1"
  935. verify_tmp_empty "$1"
  936. else
  937. if test x"$4" != x; then
  938. mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1
  939. echo "$4" > ${TESTDIR}/dotest.exp
  940. if dotest_line_by_line "$1" "$2"; then
  941. pass "$1"
  942. verify_tmp_empty "$1"
  943. else
  944. mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2
  945. echo "** expected: " >>${LOGFILE}
  946. echo "$3" >>${LOGFILE}
  947. echo "** or: " >>${LOGFILE}
  948. echo "$4" >>${LOGFILE}
  949. echo "** got: " >>${LOGFILE}
  950. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  951. fail "$1"
  952. fi
  953. else
  954. echo "** expected: " >>${LOGFILE}
  955. echo "$3" >>${LOGFILE}
  956. echo "** got: " >>${LOGFILE}
  957. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  958. fail "$1"
  959. fi
  960. fi
  961. fi
  962. }
  963. # Usage:
  964. # dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
  965. # TESTNAME is the name used in the log to identify the test.
  966. # COMMAND is the command to run; for the test to pass, it exits with
  967. # exitstatus zero.
  968. # OUTPUT is a regexp which is compared against the output (stdout and
  969. # stderr combined) from the test. It is anchored to the start and end
  970. # of the output, so should start or end with ".*" if that is what is desired.
  971. # Trailing newlines are stripped from the command's actual output before
  972. # matching against OUTPUT.
  973. # If OUTPUT2 is specified and the output matches it, then it is also
  974. # a pass (partial workaround for the fact that some versions of expr
  975. # lack \|).
  976. dotest ()
  977. {
  978. rm -f ${TESTDIR}/dotest.ex? 2>&1
  979. eval "$2" >${TESTDIR}/dotest.tmp 2>&1
  980. status=$?
  981. if test "$status" != 0; then
  982. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  983. echo "exit status was $status" >>${LOGFILE}
  984. fail "$1"
  985. fi
  986. dotest_internal "$@"
  987. }
  988. # Like dotest except only 2 args and result must exactly match stdin
  989. dotest_lit ()
  990. {
  991. rm -f ${TESTDIR}/dotest.ex? 2>&1
  992. eval "$2" >${TESTDIR}/dotest.tmp 2>&1
  993. status=$?
  994. if test "$status" != 0; then
  995. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  996. echo "exit status was $status" >>${LOGFILE}
  997. fail "$1"
  998. fi
  999. cat >${TESTDIR}/dotest.exp
  1000. if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
  1001. pass "$1"
  1002. verify_tmp_empty "$1"
  1003. else
  1004. echo "** expected: " >>${LOGFILE}
  1005. cat ${TESTDIR}/dotest.exp >>${LOGFILE}
  1006. echo "** got: " >>${LOGFILE}
  1007. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  1008. fail "$1"
  1009. fi
  1010. }
  1011. # Like dotest except exitstatus should be nonzero.
  1012. dotest_fail ()
  1013. {
  1014. rm -f ${TESTDIR}/dotest.ex? 2>&1
  1015. eval "$2" >${TESTDIR}/dotest.tmp 2>&1
  1016. status=$?
  1017. if test "$status" = 0; then
  1018. cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  1019. echo "exit status was $status" >>${LOGFILE}
  1020. fail "$1"
  1021. fi
  1022. dotest_internal "$@"
  1023. }
  1024. # Like dotest except output is sorted.
  1025. dotest_sort ()
  1026. {
  1027. rm -f ${TESTDIR}/dotest.ex? 2>&1
  1028. eval "$2" >${TESTDIR}/dotest.tmp1 2>&1
  1029. status=$?
  1030. if test "$status" != 0; then
  1031. cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
  1032. echo "exit status was $status" >>${LOGFILE}
  1033. fail "$1"
  1034. fi
  1035. ${TR} ' ' ' ' < ${TESTDIR}/dotest.tmp1 | sort > ${TESTDIR}/dotest.tmp
  1036. dotest_internal "$@"
  1037. }
  1038. # A function for fetching the timestamp of a revison of a file
  1039. getrlogdate () {
  1040. ${testcvs} -n rlog -N ${1+"$@"} |
  1041. while read token value; do
  1042. case "$token" in
  1043. date:)
  1044. echo $value | sed "s,;.*,,"
  1045. break;
  1046. ;;
  1047. esac
  1048. done
  1049. }
  1050. # Avoid picking up any stray .cvsrc, etc., from the user running the tests
  1051. mkdir home
  1052. HOME=${TESTDIR}/home; export HOME
  1053. # Make sure this variable is not defined to anything that would
  1054. # change the format of rcs dates. Otherwise people using e.g.,
  1055. # RCSINIT=-zLT get lots of spurious failures.
  1056. RCSINIT=; export RCSINIT
  1057. # Remaining arguments are the names of tests to run.
  1058. #
  1059. # The testsuite is broken up into (hopefully manageably-sized)
  1060. # independently runnable tests, so that one can quickly get a result
  1061. # from a cvs or testsuite change, and to facilitate understanding the
  1062. # tests.
  1063. if test x"$*" = x; then
  1064. # Basic/miscellaneous functionality
  1065. tests="version basica basicb basicc basic1 deep basic2"
  1066. tests="${tests} parseroot parseroot2 files spacefiles commit-readonly"
  1067. tests="${tests} commit-add-missing"
  1068. tests="$tests add-restricted"
  1069. tests="${tests} status"
  1070. # Branching, tagging, removing, adding, multiple directories
  1071. tests="${tests} rdiff rdiff-short"
  1072. tests="${tests} rdiff2 diff diffnl death death2 death-rtag"
  1073. tests="${tests} rm-update-message rmadd rmadd2 rmadd3 resurrection"
  1074. tests="${tests} dirs dirs2 branches branches2 tagc tagf "
  1075. tests="${tests} tag-log tag-space"
  1076. tests="${tests} rcslib multibranch import importb importc import-CVS"
  1077. tests="$tests import-quirks"
  1078. tests="${tests} update-p import-after-initial branch-after-import"
  1079. tests="${tests} join join2 join3 join4 join5 join6 join7 join8 join9"
  1080. tests="${tests} join-readonly-conflict join-admin join-admin-2"
  1081. tests="${tests} join-rm"
  1082. tests="${tests} new newb conflicts conflicts2 conflicts3 conflicts4"
  1083. tests="${tests} clean"
  1084. # Checking out various places (modules, checkout -d, &c)
  1085. tests="${tests} modules modules2 modules3 modules4 modules5 modules6"
  1086. tests="${tests} modules7 mkmodules co-d"
  1087. tests="${tests} cvsadm emptydir abspath abspath2 toplevel toplevel2"
  1088. tests="${tests} rstar-toplevel trailingslashes checkout_repository"
  1089. # Log messages, error messages.
  1090. tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg opterrmsg"
  1091. # Watches, binary files, history browsing, &c.
  1092. tests="${tests} devcom devcom2 devcom3 watch4 watch5 watch6"
  1093. tests="${tests} unedit-without-baserev"
  1094. tests="${tests} ignore ignore-on-branch binfiles binfiles2 binfiles3"
  1095. tests="${tests} mcopy binwrap binwrap2"
  1096. tests="${tests} binwrap3 mwrap info taginfo config"
  1097. tests="${tests} serverpatch log log2 logopt ann ann-id"
  1098. # Repository Storage (RCS file format, CVS lock files, creating
  1099. # a repository without "cvs init", &c).
  1100. tests="${tests} crerepos crerepos-extssh rcs rcs2 rcs3 rcs4 rcs5 rcs6"
  1101. tests="$tests lockfiles backuprecover"
  1102. tests="${tests} sshstdio"
  1103. # More history browsing, &c.
  1104. tests="${tests} history"
  1105. tests="${tests} big modes modes2 modes3 stamps"
  1106. # PreservePermissions stuff: permissions, symlinks et al.
  1107. # tests="${tests} perms symlinks symlinks2 hardlinks"
  1108. # More tag and branch tests, keywords.
  1109. tests="${tests} sticky keyword keywordlog keywordname keyword2"
  1110. tests="${tests} head tagdate multibranch2 tag8k"
  1111. # "cvs admin", reserved checkouts.
  1112. tests="${tests} admin reserved"
  1113. # Nuts and bolts of diffing/merging (diff library, &c)
  1114. tests="${tests} diffmerge1 diffmerge2"
  1115. # Release of multiple directories
  1116. tests="${tests} release"
  1117. tests="${tests} recase"
  1118. # Multiple root directories and low-level protocol tests.
  1119. tests="${tests} multiroot multiroot2 multiroot3 multiroot4"
  1120. tests="$tests rmroot reposmv pserver server server2 server3"
  1121. tests="$tests client client2"
  1122. tests="${tests} dottedroot fork commit-d"
  1123. else
  1124. tests="$*"
  1125. fi
  1126. # Now check the -f argument for validity.
  1127. if test -n "$fromtest"; then
  1128. # Don't allow spaces - they are our delimiters in tests
  1129. count=0
  1130. for sub in $fromtest; do
  1131. count=`expr $count + 1`
  1132. done
  1133. if test $count != 1; then
  1134. echo "No such test \`$fromtest'." >&2
  1135. exit 2
  1136. fi
  1137. # make sure it is in $tests
  1138. case " $tests " in
  1139. *" $fromtest "*)
  1140. ;;
  1141. *)
  1142. echo "No such test \`$fromtest'." >&2
  1143. exit 2
  1144. ;;
  1145. esac
  1146. fi
  1147. # a simple function to compare directory contents
  1148. #
  1149. # Returns: 0 for same, 1 for different
  1150. #
  1151. directory_cmp ()
  1152. {
  1153. OLDPWD=`pwd`
  1154. DIR_1=$1
  1155. DIR_2=$2
  1156. cd $DIR_1
  1157. find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d1
  1158. # go back where we were to avoid symlink hell...
  1159. cd $OLDPWD
  1160. cd $DIR_2
  1161. find . -print | fgrep -v /CVS | sort > $TESTDIR/dc$$d2
  1162. if diff $TESTDIR/dc$$d1 $TESTDIR/dc$$d2 >/dev/null 2>&1
  1163. then
  1164. :
  1165. else
  1166. return 1
  1167. fi
  1168. cd $OLDPWD
  1169. while read a
  1170. do
  1171. if test -f $DIR_1/"$a" ; then
  1172. cmp -s $DIR_1/"$a" $DIR_2/"$a"
  1173. if test $? -ne 0 ; then
  1174. return 1
  1175. fi
  1176. fi
  1177. done < $TESTDIR/dc$$d1
  1178. rm -f $TESTDIR/dc$$*
  1179. return 0
  1180. }
  1181. #
  1182. # The following 4 functions are used by the diffmerge1 test case. They set up,
  1183. # respectively, the four versions of the files necessary:
  1184. #
  1185. # 1. Ancestor revisions.
  1186. # 2. "Your" changes.
  1187. # 3. "My" changes.
  1188. # 4. Expected merge result.
  1189. #
  1190. # Create ancestor revisions for diffmerge1
  1191. diffmerge_create_older_files() {
  1192. # This test case was supplied by Noah Friedman:
  1193. cat >testcase01 <<EOF
  1194. // Button.java
  1195. package random.application;
  1196. import random.util.*;
  1197. public class Button
  1198. {
  1199. /* Instantiates a Button with origin (0, 0) and zero width and height.
  1200. * You must call an initializer method to properly initialize the Button.
  1201. */
  1202. public Button ()
  1203. {
  1204. super ();
  1205. _titleColor = Color.black;
  1206. _disabledTitleColor = Color.gray;
  1207. _titleFont = Font.defaultFont ();
  1208. }
  1209. /* Convenience constructor for instantiating a Button with
  1210. * bounds x, y, width, and height. Equivalent to
  1211. * foo = new Button ();
  1212. * foo.init (x, y, width, height);
  1213. */
  1214. public Button (int x, int y, int width, int height)
  1215. {
  1216. this ();
  1217. init (x, y, width, height);
  1218. }
  1219. }
  1220. EOF
  1221. # This test case was supplied by Jacob Burckhardt:
  1222. cat >testcase02 <<EOF
  1223. a
  1224. a
  1225. a
  1226. a
  1227. a
  1228. EOF
  1229. # This test case was supplied by Karl Tomlinson who also wrote the
  1230. # patch which lets CVS correctly handle this and several other cases:
  1231. cat >testcase03 <<EOF
  1232. x
  1233. s
  1234. a
  1235. b
  1236. s
  1237. y
  1238. EOF
  1239. # This test case was supplied by Karl Tomlinson:
  1240. cat >testcase04 <<EOF
  1241. s
  1242. x
  1243. m
  1244. m
  1245. x
  1246. s
  1247. v
  1248. s
  1249. x
  1250. m
  1251. m
  1252. x
  1253. s
  1254. EOF
  1255. # This test case was supplied by Karl Tomlinson:
  1256. cat >testcase05 <<EOF
  1257. s
  1258. x
  1259. m
  1260. m
  1261. x
  1262. x
  1263. x
  1264. x
  1265. x
  1266. x
  1267. x
  1268. x
  1269. x
  1270. x
  1271. s
  1272. s
  1273. s
  1274. s
  1275. s
  1276. s
  1277. s
  1278. s
  1279. s
  1280. s
  1281. v
  1282. EOF
  1283. # This test case was supplied by Jacob Burckhardt:
  1284. cat >testcase06 <<EOF
  1285. g
  1286. i
  1287. EOF
  1288. # This test is supposed to verify that the horizon lines are the same
  1289. # for both 2-way diffs, but unfortunately, it does not fail with the
  1290. # old version of cvs. However, Karl Tomlinson still thought it would
  1291. # be good to test it anyway:
  1292. cat >testcase07 <<EOF
  1293. h
  1294. f
  1295. g
  1296. r
  1297. i
  1298. i
  1299. EOF
  1300. # This test case was supplied by Jacob Burckhardt:
  1301. cat >testcase08 <<EOF
  1302. Both changes move this line to the end of the file.
  1303. no
  1304. changes
  1305. here
  1306. First change will delete this line.
  1307. First change will also delete this line.
  1308. no
  1309. changes
  1310. here
  1311. Second change will change it here.
  1312. no
  1313. changes
  1314. here
  1315. EOF
  1316. # This test case was supplied by Jacob Burckhardt. Note that I do not
  1317. # think cvs has ever failed with this case, but I include it anyway,
  1318. # since I think it is a hard case. It is hard because Peter Miller's
  1319. # fmerge utility fails on it:
  1320. cat >testcase09 <<EOF
  1321. m
  1322. a
  1323. {
  1324. }
  1325. b
  1326. {
  1327. }
  1328. EOF
  1329. # This test case was supplied by Martin Dorey and simplified by Jacob
  1330. # Burckhardt:
  1331. cat >testcase10 <<EOF
  1332. petRpY ( MtatRk );
  1333. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1334. MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
  1335. OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
  1336. Bloke_GttpfIRte_MtpeaL ( &acI );
  1337. MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
  1338. {
  1339. fV ( Y < 16 )
  1340. {
  1341. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1342. Y * jfle_Uecopd_MfJe_fY_Mectopk,
  1343. jfle_Uecopd_MfJe_fY_Mectopk,
  1344. nRVVep ) );
  1345. }
  1346. elke
  1347. {
  1348. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1349. ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
  1350. jfle_Uecopd_MfJe_fY_Mectopk,
  1351. nRVVep ) );
  1352. }
  1353. }
  1354. /****************************************************************************
  1355. * *
  1356. * Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY ) *
  1357. * *
  1358. ****************************************************************************/
  1359. MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
  1360. {
  1361. MTGTXM MtatRk = Zy;
  1362. MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
  1363. petRpY ( MtatRk );
  1364. }
  1365. HfkQipfte ( waYdle, /* waYdle */
  1366. waYdleFok, /* ZVVket VpoL ktapt oV dfkQ */
  1367. (coYkt RfYt8*) nRVVep, /* nRVVep */
  1368. 0, /* MRrepVlRoRk KfxoYfkL */
  1369. beYgtz /* nEtek to Apfte */
  1370. );
  1371. petRpY ( Zy );
  1372. }
  1373. EOF
  1374. }
  1375. # Create "your" revisions for diffmerge1
  1376. diffmerge_create_your_files() {
  1377. # remove the Button() method
  1378. cat >testcase01 <<\EOF
  1379. // Button.java
  1380. package random.application;
  1381. import random.util.*;
  1382. public class Button
  1383. {
  1384. /* Instantiates a Button with origin (0, 0) and zero width and height.
  1385. * You must call an initializer method to properly initialize the Button.
  1386. */
  1387. public Button ()
  1388. {
  1389. super ();
  1390. _titleColor = Color.black;
  1391. _disabledTitleColor = Color.gray;
  1392. _titleFont = Font.defaultFont ();
  1393. }
  1394. }
  1395. EOF
  1396. cat >testcase02 <<\EOF
  1397. y
  1398. a
  1399. a
  1400. a
  1401. a
  1402. EOF
  1403. cat >testcase03 <<\EOF
  1404. x
  1405. s
  1406. a
  1407. b
  1408. s
  1409. b
  1410. s
  1411. y
  1412. EOF
  1413. cat >testcase04 <<\EOF
  1414. s
  1415. m
  1416. s
  1417. v
  1418. s
  1419. m
  1420. s
  1421. EOF
  1422. cat >testcase05 <<\EOF
  1423. v
  1424. s
  1425. m
  1426. s
  1427. s
  1428. s
  1429. s
  1430. s
  1431. s
  1432. s
  1433. s
  1434. s
  1435. s
  1436. v
  1437. EOF
  1438. # Test case 6 and test case 7 both use the same input files, but they
  1439. # order the input files differently. In one case, a certain file is
  1440. # used as the older file, but in the other test case, that same file
  1441. # is used as the file which has changes. I could have put echo
  1442. # commands here, but since the echo lines would be the same as those
  1443. # in the previous function, I decided to save space and avoid repeating
  1444. # several lines of code. Instead, I merely swap the files:
  1445. mv testcase07 tmp
  1446. mv testcase06 testcase07
  1447. mv tmp testcase06
  1448. # Make the date newer so that cvs thinks that the files are changed:
  1449. touch testcase06 testcase07
  1450. cat >testcase08 <<\EOF
  1451. no
  1452. changes
  1453. here
  1454. First change has now added this in.
  1455. no
  1456. changes
  1457. here
  1458. Second change will change it here.
  1459. no
  1460. changes
  1461. here
  1462. Both changes move this line to the end of the file.
  1463. EOF
  1464. cat >testcase09 <<\EOF
  1465. m
  1466. a
  1467. {
  1468. }
  1469. b
  1470. {
  1471. }
  1472. c
  1473. {
  1474. }
  1475. EOF
  1476. cat >testcase10 <<\EOF
  1477. fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
  1478. petRpY ( MtatRk );
  1479. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1480. fV ( jfle_Uecopd_KRLIep < 16 )
  1481. {
  1482. MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
  1483. }
  1484. elke
  1485. {
  1486. MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
  1487. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1488. MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
  1489. OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
  1490. Bloke_GttpfIRte_MtpeaL ( &acI );
  1491. MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
  1492. {
  1493. MTGTXM MtatRk = Zy;
  1494. fV ( Y < 16 )
  1495. {
  1496. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1497. Y * jfle_Uecopd_MfJe_fY_Mectopk,
  1498. jfle_Uecopd_MfJe_fY_Mectopk,
  1499. nRVVep ) );
  1500. }
  1501. elke
  1502. {
  1503. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1504. ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
  1505. jfle_Uecopd_MfJe_fY_Mectopk,
  1506. nRVVep ) );
  1507. }
  1508. petRpY ( MtatRk );
  1509. }
  1510. /****************************************************************************
  1511. * *
  1512. * Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY ) *
  1513. * *
  1514. ****************************************************************************/
  1515. MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
  1516. {
  1517. MTGTXM MtatRk = Zy;
  1518. MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
  1519. petRpY ( MtatRk );
  1520. }
  1521. HfkQipfte ( waYdle, /* waYdle */
  1522. waYdleFok, /* ZVVket VpoL ktapt oV dfkQ */
  1523. (coYkt RfYt8*) nRVVep, /* nRVVep */
  1524. 0, /* MRrepVlRoRk KfxoYfkL */
  1525. beYgtz /* nEtek to Apfte */
  1526. );
  1527. petRpY ( Zy );
  1528. }
  1529. EOF
  1530. }
  1531. # Create "my" revisions for diffmerge1
  1532. diffmerge_create_my_files() {
  1533. # My working copy still has the Button() method, but I
  1534. # comment out some code at the top of the class.
  1535. cat >testcase01 <<\EOF
  1536. // Button.java
  1537. package random.application;
  1538. import random.util.*;
  1539. public class Button
  1540. {
  1541. /* Instantiates a Button with origin (0, 0) and zero width and height.
  1542. * You must call an initializer method to properly initialize the Button.
  1543. */
  1544. public Button ()
  1545. {
  1546. super ();
  1547. // _titleColor = Color.black;
  1548. // _disabledTitleColor = Color.gray;
  1549. // _titleFont = Font.defaultFont ();
  1550. }
  1551. /* Convenience constructor for instantiating a Button with
  1552. * bounds x, y, width, and height. Equivalent to
  1553. * foo = new Button ();
  1554. * foo.init (x, y, width, height);
  1555. */
  1556. public Button (int x, int y, int width, int height)
  1557. {
  1558. this ();
  1559. init (x, y, width, height);
  1560. }
  1561. }
  1562. EOF
  1563. cat >testcase02 <<\EOF
  1564. a
  1565. a
  1566. a
  1567. a
  1568. m
  1569. EOF
  1570. cat >testcase03 <<\EOF
  1571. x
  1572. s
  1573. c
  1574. s
  1575. b
  1576. s
  1577. y
  1578. EOF
  1579. cat >testcase04 <<\EOF
  1580. v
  1581. s
  1582. x
  1583. m
  1584. m
  1585. x
  1586. s
  1587. v
  1588. s
  1589. x
  1590. m
  1591. m
  1592. x
  1593. s
  1594. v
  1595. EOF
  1596. # Note that in test case 5, there are no changes in the "mine"
  1597. # section, which explains why there is no command here which writes to
  1598. # file testcase05.
  1599. # no changes for testcase06
  1600. # The two branches make the same changes:
  1601. cp ../yours/testcase07 .
  1602. cat >testcase08 <<\EOF
  1603. no
  1604. changes
  1605. here
  1606. First change will delete this line.
  1607. First change will also delete this line.
  1608. no
  1609. changes
  1610. here
  1611. Second change has now changed it here.
  1612. no
  1613. changes
  1614. here
  1615. Both changes move this line to the end of the file.
  1616. EOF
  1617. cat >testcase09 <<\EOF
  1618. m
  1619. a
  1620. {
  1621. }
  1622. b
  1623. {
  1624. }
  1625. c
  1626. {
  1627. }
  1628. EOF
  1629. cat >testcase10 <<\EOF
  1630. petRpY ( MtatRk );
  1631. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1632. MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
  1633. OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
  1634. Bloke_GttpfIRte_MtpeaL ( &acI );
  1635. MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
  1636. {
  1637. fV ( Y < 16 )
  1638. {
  1639. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1640. Y * jfle_Uecopd_MfJe_fY_Mectopk,
  1641. jfle_Uecopd_MfJe_fY_Mectopk,
  1642. nRVVep ) );
  1643. }
  1644. elke
  1645. {
  1646. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1647. ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
  1648. jfle_Uecopd_MfJe_fY_Mectopk,
  1649. nRVVep ) );
  1650. }
  1651. }
  1652. /****************************************************************************
  1653. * *
  1654. * Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY ) *
  1655. * *
  1656. ****************************************************************************/
  1657. MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
  1658. {
  1659. MTGTXM MtatRk = Zy;
  1660. MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
  1661. petRpY ( MtatRk );
  1662. }
  1663. HfkQipfte ( waYdle, /* waYdle */
  1664. waYdleFok, /* ZVVket VpoL ktapt oV dfkQ */
  1665. (coYkt RfYt8*) nRVVep, /* nRVVep */
  1666. beYgtz /* nEtek to Apfte */
  1667. );
  1668. petRpY ( Zy );
  1669. }
  1670. EOF
  1671. }
  1672. # Create expected results of merge for diffmerge1
  1673. diffmerge_create_expected_files() {
  1674. cat >testcase01 <<\EOF
  1675. // Button.java
  1676. package random.application;
  1677. import random.util.*;
  1678. public class Button
  1679. {
  1680. /* Instantiates a Button with origin (0, 0) and zero width and height.
  1681. * You must call an initializer method to properly initialize the Button.
  1682. */
  1683. public Button ()
  1684. {
  1685. super ();
  1686. // _titleColor = Color.black;
  1687. // _disabledTitleColor = Color.gray;
  1688. // _titleFont = Font.defaultFont ();
  1689. }
  1690. }
  1691. EOF
  1692. cat >testcase02 <<\EOF
  1693. y
  1694. a
  1695. a
  1696. a
  1697. m
  1698. EOF
  1699. cat >testcase03 <<\EOF
  1700. x
  1701. s
  1702. c
  1703. s
  1704. b
  1705. s
  1706. b
  1707. s
  1708. y
  1709. EOF
  1710. cat >testcase04 <<\EOF
  1711. v
  1712. s
  1713. m
  1714. s
  1715. v
  1716. s
  1717. m
  1718. s
  1719. v
  1720. EOF
  1721. # Since there are no changes in the "mine" section, just take exactly
  1722. # the version in the "yours" section:
  1723. cp ../yours/testcase05 .
  1724. cp ../yours/testcase06 .
  1725. # Since the two branches make the same changes, the result should be
  1726. # the same as both branches. Here, I happen to pick yours to copy from,
  1727. # but I could have also picked mine, since the source of the copy is
  1728. # the same in either case. However, the mine has already been
  1729. # altered by the update command, so don't use it. Instead, use the
  1730. # yours section which has not had an update on it and so is unchanged:
  1731. cp ../yours/testcase07 .
  1732. cat >testcase08 <<\EOF
  1733. no
  1734. changes
  1735. here
  1736. First change has now added this in.
  1737. no
  1738. changes
  1739. here
  1740. Second change has now changed it here.
  1741. no
  1742. changes
  1743. here
  1744. Both changes move this line to the end of the file.
  1745. EOF
  1746. cat >testcase09 <<\EOF
  1747. m
  1748. a
  1749. {
  1750. }
  1751. b
  1752. {
  1753. }
  1754. c
  1755. {
  1756. }
  1757. EOF
  1758. cat >testcase10 <<\EOF
  1759. fV ( BzQkV_URYYfYg ) (*jfle_Uecopdk)[0].jfle_Uecopd_KRLIep = ZpfgfYal_jUK;
  1760. petRpY ( MtatRk );
  1761. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1762. fV ( jfle_Uecopd_KRLIep < 16 )
  1763. {
  1764. MtatRk = Uead_Ktz_qjT_jfle_Uecopd ( jfle_Uecopd_KRLIep, (uofd*)nRVVep );
  1765. }
  1766. elke
  1767. {
  1768. MtatRk = ZreY_GttpfIRte_MtpeaL ( qjT_jfle_Uecopdk, qjT_jfle_Uecopd_BoRYt, HGTG_TvFD, KXbb, KXbb, &acI );
  1769. fV ( MtatRk != Zy ) UDTXUK_DUUZU ( BGKT_ZFDK_qjT_HGTG );
  1770. MtatRk = MQfr_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_KRLIep * jfle_Uecopd_MfJe_fY_nEtek );
  1771. OjZy MtatRk = Uead_GttpfIRte_MtpeaL ( &acI, jfle_Uecopd_MfJe_fY_nEtek, nRVVep );
  1772. Bloke_GttpfIRte_MtpeaL ( &acI );
  1773. MTGTXM Uead_Ktz_qjT_jfle_Uecopd ( fYt Y, uofd *nRVVep )
  1774. {
  1775. MTGTXM MtatRk = Zy;
  1776. fV ( Y < 16 )
  1777. {
  1778. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1779. Y * jfle_Uecopd_MfJe_fY_Mectopk,
  1780. jfle_Uecopd_MfJe_fY_Mectopk,
  1781. nRVVep ) );
  1782. }
  1783. elke
  1784. {
  1785. petRpY ( Uead_Mectopk ( noot_Uecopd.qVtqfppHatabcY0 * noot_Uecopd.MectopkFepBlRktep +
  1786. ( Y - 16 ) * jfle_Uecopd_MfJe_fY_Mectopk,
  1787. jfle_Uecopd_MfJe_fY_Mectopk,
  1788. nRVVep ) );
  1789. }
  1790. petRpY ( MtatRk );
  1791. }
  1792. /****************************************************************************
  1793. * *
  1794. * Uead Mectopk ( Uelatfue to tze cRppeYt raptftfoY ) *
  1795. * *
  1796. ****************************************************************************/
  1797. MTGTXM Uead_Mectopk ( RfYt64 Mtapt_Mectop, RfYt64 KRL_Mectopk, uofd *nRVVep )
  1798. {
  1799. MTGTXM MtatRk = Zy;
  1800. MtatRk = Uead_HfkQ ( FaptftfoY_TaIle.Uelatfue_Mectop + Mtapt_Mectop, KRL_Mectopk, nRVVep );
  1801. petRpY ( MtatRk );
  1802. }
  1803. HfkQipfte ( waYdle, /* waYdle */
  1804. waYdleFok, /* ZVVket VpoL ktapt oV dfkQ */
  1805. (coYkt RfYt8*) nRVVep, /* nRVVep */
  1806. beYgtz /* nEtek to Apfte */
  1807. );
  1808. petRpY ( Zy );
  1809. }
  1810. EOF
  1811. }
  1812. # Echo a new CVSROOT based on $1, $remote, and $remotehost
  1813. newroot() {
  1814. if $remote; then
  1815. if test -n "$remotehost"; then
  1816. echo :ext:$remotehost$1
  1817. else
  1818. echo :fork:$1
  1819. fi
  1820. else
  1821. echo $1
  1822. fi
  1823. }
  1824. # Set up CVSROOT (the crerepos tests will test operating without CVSROOT set).
  1825. #
  1826. # Currently we test :fork: and :ext: (see crerepos test). There is a
  1827. # known difference between the two in modes-15 (see comments there).
  1828. #
  1829. # :ext: can be tested against a remote machine if:
  1830. #
  1831. # 1. $remotehost is set using the `-h' option to this script.
  1832. # 2. ${CVS_RSH=rsh} $remotehost works.
  1833. # 3. The path to $TESTDIR is the same on both machines (symlinks are okay)
  1834. # 4. The path to $testcvs is the same on both machines (symlinks are okay)
  1835. # or $CVS_SERVER is overridden in this script's environment to point to
  1836. # a working CVS exectuable on the remote machine.
  1837. #
  1838. # Testing :pserver: would be hard (inetd issues). (How about using tcpserver
  1839. # and some high port number? DRP)
  1840. # Allow CVS_SERVER to be overridden. This facilitates constructs like
  1841. # testing a local case-insensitive client against a remote case
  1842. # sensitive server and visa versa.
  1843. : ${CVS_SERVER=$testcvs}; export CVS_SERVER
  1844. # Use a name which will be different than CVSROOT on case insensitive
  1845. # filesystems (e.g., HFS+)
  1846. CVSROOTDIR=cvsrootdir
  1847. if $linkroot; then
  1848. mkdir ${TESTDIR}/realcvsroot
  1849. ln -s realcvsroot ${TESTDIR}/${CVSROOTDIR}
  1850. fi
  1851. CVSROOT_DIRNAME=${TESTDIR}/${CVSROOTDIR}
  1852. CVSROOT=`newroot $CVSROOT_DIRNAME`; export CVSROOT
  1853. ###
  1854. ### Init the repository.
  1855. ###
  1856. dotest init-1 "$testcvs -d$CVSROOT_DIRNAME init"
  1857. # Copy the admin files for restore_adm.
  1858. cp -Rp $CVSROOT_DIRNAME/CVSROOT $TESTDIR/CVSROOT.save
  1859. ###
  1860. ### The tests
  1861. ###
  1862. if $remote; then
  1863. localonly init-2
  1864. localonly init-3
  1865. else
  1866. dotest init-2 "$testcvs init"
  1867. dotest_fail init-3 "$testcvs -d $CVSROOT/sdir init" \
  1868. "$PROG \[init aborted\]: Cannot initialize repository under existing CVSROOT: \`$CVSROOT_DIRNAME'"
  1869. fi
  1870. ### The big loop
  1871. for what in $tests; do
  1872. if test -n "$fromtest" ; then
  1873. if test $fromtest = $what ; then
  1874. unset fromtest
  1875. else
  1876. continue
  1877. fi
  1878. fi
  1879. if $verbose; then
  1880. echo "$what:"
  1881. fi
  1882. case $what in
  1883. version)
  1884. # We've had cases where the version command started dumping core,
  1885. # so we might as well test it
  1886. dotest version-1 "${testcvs} --version" \
  1887. '
  1888. Concurrent Versions System (CVS) [0-9.]*.*
  1889. Copyright (C) [0-9]* Free Software Foundation, Inc.
  1890. Senior active maintainers include Larry Jones, Derek R. Price,
  1891. and Mark D. Baushke. Please see the AUTHORS and README files from the CVS
  1892. distribution kit for a complete list of contributors and copyrights.
  1893. CVS may be copied only under the terms of the GNU General Public License,
  1894. a copy of which can be found with the CVS distribution kit.
  1895. Specify the --help option for further information about CVS'
  1896. if $remote; then
  1897. dotest version-2r "${testcvs} version" \
  1898. 'Client: Concurrent Versions System (CVS) [0-9p.]* (client/server)
  1899. Server: Concurrent Versions System (CVS) [0-9p.]* (client/server)'
  1900. else
  1901. dotest version-2 "${testcvs} version" \
  1902. 'Concurrent Versions System (CVS) [0-9.]*.*'
  1903. fi
  1904. ;;
  1905. basica)
  1906. # Similar in spirit to some of the basic1, and basic2
  1907. # tests, but hopefully a lot faster. Also tests operating on
  1908. # files two directories down *without* operating on the parent dirs.
  1909. # Tests basica-0a and basica-0b provide the equivalent of the:
  1910. # mkdir ${CVSROOT_DIRNAME}/first-dir
  1911. # used by many of the tests. It is "more official" in the sense
  1912. # that is does everything through CVS; the reason most of the
  1913. # tests don't use it is mostly historical.
  1914. mkdir 1; cd 1
  1915. dotest basica-0a "${testcvs} -q co -l ." ''
  1916. mkdir first-dir
  1917. dotest basica-0b "${testcvs} add first-dir" \
  1918. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  1919. cd ..
  1920. rm -r 1
  1921. dotest basica-1 "${testcvs} -q co first-dir" ''
  1922. cd first-dir
  1923. # Test a few operations, to ensure they gracefully do
  1924. # nothing in an empty directory.
  1925. dotest basica-1a0 "${testcvs} -q update" ''
  1926. dotest basica-1a1 "${testcvs} -q diff -c" ''
  1927. dotest basica-1a2 "${testcvs} -q status" ''
  1928. dotest basica-1a3 "${testcvs} -q update ." ''
  1929. dotest basica-1a4 "${testcvs} -q update ./" ''
  1930. mkdir sdir
  1931. # Remote CVS gives the "cannot open CVS/Entries" error, which is
  1932. # clearly a bug, but not a simple one to fix.
  1933. dotest basica-1a10 "${testcvs} -n add sdir" \
  1934. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository" \
  1935. "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
  1936. Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
  1937. dotest_fail basica-1a11 \
  1938. "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
  1939. dotest basica-2 "${testcvs} add sdir" \
  1940. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
  1941. cd sdir
  1942. mkdir ssdir
  1943. dotest basica-3 "${testcvs} add ssdir" \
  1944. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir added to the repository"
  1945. cd ssdir
  1946. echo ssfile >ssfile
  1947. # Trying to commit it without a "cvs add" should be an error.
  1948. # The "use `cvs add' to create an entry" message is the one
  1949. # that I consider to be more correct, but local cvs prints the
  1950. # "nothing known" message and noone has gotten around to fixing it.
  1951. dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
  1952. "${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
  1953. ${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
  1954. "${PROG}"' [a-z]*: nothing known about `ssfile'\''
  1955. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  1956. dotest basica-4 "${testcvs} add ssfile" \
  1957. "${PROG}"' add: scheduling file `ssfile'\'' for addition
  1958. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  1959. dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
  1960. "${PROG} tag: nothing known about ssfile
  1961. ${PROG} "'\[tag aborted\]: correct the above errors first!'
  1962. cd ../..
  1963. dotest basica-5 "${testcvs} -q ci -m add-it" \
  1964. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  1965. done
  1966. Checking in sdir/ssdir/ssfile;
  1967. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  1968. initial revision: 1\.1
  1969. done"
  1970. dotest_fail basica-5a \
  1971. "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
  1972. "${PROG} tag: Attempt to add reserved tag name BASE
  1973. ${PROG} \[tag aborted\]: failed to set tag BASE to revision 1\.1 in ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v"
  1974. dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
  1975. 'T sdir/ssdir/ssfile'
  1976. dotest basica-6 "${testcvs} -q update" ''
  1977. echo "ssfile line 2" >>sdir/ssdir/ssfile
  1978. dotest_fail basica-6.2 "${testcvs} -q diff -c" \
  1979. "Index: sdir/ssdir/ssfile
  1980. ===================================================================
  1981. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  1982. retrieving revision 1\.1
  1983. diff -c -r1\.1 ssfile
  1984. \*\*\* sdir/ssdir/ssfile ${RFCDATE} 1\.1
  1985. --- sdir/ssdir/ssfile ${RFCDATE}
  1986. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1987. \*\*\* 1 \*\*\*\*
  1988. --- 1,2 ----
  1989. ssfile
  1990. ${PLUS} ssfile line 2"
  1991. dotest_fail basica-6.3 "${testcvs} -q diff -c -rBASE" \
  1992. "Index: sdir/ssdir/ssfile
  1993. ===================================================================
  1994. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  1995. retrieving revision 1\.1
  1996. diff -c -r1\.1 ssfile
  1997. \*\*\* sdir/ssdir/ssfile ${RFCDATE} 1\.1
  1998. --- sdir/ssdir/ssfile ${RFCDATE}
  1999. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  2000. \*\*\* 1 \*\*\*\*
  2001. --- 1,2 ----
  2002. ssfile
  2003. ${PLUS} ssfile line 2"
  2004. dotest_fail basica-6.4 "${testcvs} -q diff -c -rBASE -C3isacrowd" \
  2005. "Index: sdir/ssdir/ssfile
  2006. ===================================================================
  2007. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2008. retrieving revision 1\.1
  2009. diff -c -C 3isacrowd -r1\.1 ssfile
  2010. ${PROG} diff: invalid context length argument"
  2011. dotest basica-7 "${testcvs} -q ci -m modify-it" \
  2012. "Checking in sdir/ssdir/ssfile;
  2013. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2014. new revision: 1\.2; previous revision: 1\.1
  2015. done"
  2016. dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
  2017. "${PROG}"' [a-z]*: nothing known about `nonexist'\''
  2018. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  2019. dotest basica-8 "${testcvs} -q update ." ''
  2020. # Test the -f option to ci
  2021. cd sdir/ssdir
  2022. dotest basica-8a0 "${testcvs} -q ci -m not-modified ssfile" ''
  2023. dotest basica-8a "${testcvs} -q ci -f -m force-it" \
  2024. "Checking in ssfile;
  2025. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2026. new revision: 1\.3; previous revision: 1\.2
  2027. done"
  2028. dotest basica-8a1 "${testcvs} -q ci -m bump-it -r 2.0" \
  2029. "Checking in ssfile;
  2030. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2031. new revision: 2\.0; previous revision: 1\.3
  2032. done"
  2033. dotest basica-8a1a "${testcvs} -q ci -m bump-it -r 2.9" \
  2034. "Checking in ssfile;
  2035. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2036. new revision: 2\.9; previous revision: 2\.0
  2037. done"
  2038. # Test string-based revion number increment rollover
  2039. dotest basica-8a1b "${testcvs} -q ci -m bump-it -f -r 2" \
  2040. "Checking in ssfile;
  2041. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2042. new revision: 2\.10; previous revision: 2\.9
  2043. done"
  2044. dotest basica-8a1c "${testcvs} -q ci -m bump-it -r 2.99" \
  2045. "Checking in ssfile;
  2046. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2047. new revision: 2\.99; previous revision: 2\.10
  2048. done"
  2049. # Test string-based revion number increment rollover
  2050. dotest basica-8a1d "${testcvs} -q ci -m bump-it -f -r 2" \
  2051. "Checking in ssfile;
  2052. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2053. new revision: 2\.100; previous revision: 2\.99
  2054. done"
  2055. dotest basica-8a1e "${testcvs} -q ci -m bump-it -r 2.1099" \
  2056. "Checking in ssfile;
  2057. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2058. new revision: 2\.1099; previous revision: 2\.100
  2059. done"
  2060. # Test string-based revion number increment rollover
  2061. dotest basica-8a1f "${testcvs} -q ci -m bump-it -f -r 2" \
  2062. "Checking in ssfile;
  2063. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2064. new revision: 2\.1100; previous revision: 2\.1099
  2065. done"
  2066. # -f should not be necessary, but it should be harmless.
  2067. # Also test the "-r 3" (rather than "-r 3.0") usage.
  2068. dotest basica-8a2 "${testcvs} -q ci -m bump-it -f -r 3" \
  2069. "Checking in ssfile;
  2070. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2071. new revision: 3\.1; previous revision: 2\.1100
  2072. done"
  2073. # Test using -r to create a branch
  2074. dotest_fail basica-8a3 "${testcvs} -q ci -m bogus -r 3.0.0" \
  2075. "Checking in ssfile;
  2076. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2077. ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: can't find branch point 3\.0
  2078. ${PROG} commit: could not check in ssfile"
  2079. dotest basica-8a4 "${testcvs} -q ci -m valid -r 3.1.2" \
  2080. "Checking in ssfile;
  2081. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2082. new revision: 3\.1\.2\.1; previous revision: 3\.1
  2083. done"
  2084. # Verify that this file remains unchanged since up -A should not
  2085. # change the contents here.
  2086. cp ssfile $TESTDIR/ssfile.sav
  2087. # now get rid of the sticky tag and go back to the trunk
  2088. dotest basica-8a5 "$testcvs -q up -A ./" '[UP] ssfile'
  2089. dotest basica-8a6 "cmp ssfile $TESTDIR/ssfile.sav"
  2090. rm $TESTDIR/ssfile.sav
  2091. cd ../..
  2092. dotest basica-8b "${testcvs} -q diff -r1.2 -r1.3"
  2093. dotest basica-8b1 "${testcvs} -q diff -r1.2 -r1.3 -C 3isacrowd"
  2094. # The .* here will normally be "No such file or directory",
  2095. # but if memory serves some systems (AIX?) have a different message.
  2096. : dotest_fail basica-9 \
  2097. "${testcvs} -q -d ${TESTDIR}/nonexist update" \
  2098. "${PROG}: cannot access cvs root ${TESTDIR}/nonexist: .*"
  2099. dotest_fail basica-9 \
  2100. "${testcvs} -q -d ${TESTDIR}/nonexist update" \
  2101. "${PROG} \[[a-z]* aborted\]: ${TESTDIR}/nonexist/CVSROOT: .*"
  2102. dotest basica-10 "${testcvs} annotate" \
  2103. '
  2104. Annotations for sdir/ssdir/ssfile
  2105. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  2106. 1\.1 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile
  2107. 1\.2 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile line 2'
  2108. # Test resurrecting with strange revision numbers
  2109. cd sdir/ssdir
  2110. dotest basica-r1 "${testcvs} rm -f ssfile" \
  2111. "${PROG} remove: scheduling .ssfile. for removal
  2112. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  2113. dotest basica-r2 "${testcvs} -q ci -m remove" \
  2114. "Removing ssfile;
  2115. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2116. new revision: delete; previous revision: 3\.1
  2117. done"
  2118. dotest basica-r3 "${testcvs} -q up -p -r 3.1 ./ssfile >ssfile" ""
  2119. dotest basica-r4 "${testcvs} add ssfile" \
  2120. "${PROG} add: Re-adding file .ssfile. (in place of dead revision 3\.2)\.
  2121. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2122. dotest basica-r5 "${testcvs} -q ci -m resurrect" \
  2123. "Checking in ssfile;
  2124. ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v <-- ssfile
  2125. new revision: 3\.3; previous revision: 3\.2
  2126. done"
  2127. cd ../..
  2128. # As long as we have a file with a few revisions, test
  2129. # a few "cvs admin -o" invocations.
  2130. cd sdir/ssdir
  2131. dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
  2132. "${PROG} [a-z]*: while processing more than one file:
  2133. ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
  2134. dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
  2135. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2136. done"
  2137. dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
  2138. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2139. done"
  2140. dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
  2141. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2142. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
  2143. ${PROG} admin: RCS file for .ssfile. not modified\."
  2144. dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
  2145. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2146. done"
  2147. dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
  2148. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2149. deleting revision 3\.3
  2150. deleting revision 3\.2
  2151. done"
  2152. dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
  2153. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2154. done"
  2155. dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
  2156. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2157. deleting revision 2\.1100
  2158. deleting revision 2\.1099
  2159. deleting revision 2\.100
  2160. deleting revision 2\.99
  2161. deleting revision 2\.10
  2162. deleting revision 2\.9
  2163. deleting revision 2\.0
  2164. deleting revision 1\.3
  2165. done"
  2166. dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
  2167. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2168. deleting revision 2\.1100
  2169. deleting revision 2\.1099
  2170. deleting revision 2\.100
  2171. deleting revision 2\.99
  2172. deleting revision 2\.10
  2173. deleting revision 2\.9
  2174. deleting revision 2\.0
  2175. deleting revision 1\.3
  2176. done"
  2177. dotest basica-o6a "${testcvs} admin -o 3.1.2: ssfile" \
  2178. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2179. deleting revision 3\.1\.2\.1
  2180. done"
  2181. dotest basica-o7 "${testcvs} log -N ssfile" "
  2182. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v
  2183. Working file: ssfile
  2184. head: 3\.1
  2185. branch:
  2186. locks: strict
  2187. access list:
  2188. keyword substitution: kv
  2189. total revisions: 3; selected revisions: 3
  2190. description:
  2191. ----------------------------
  2192. revision 3\.1
  2193. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0
  2194. bump-it
  2195. ----------------------------
  2196. revision 1\.2
  2197. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  2198. modify-it
  2199. ----------------------------
  2200. revision 1\.1
  2201. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  2202. add-it
  2203. ============================================================================="
  2204. dotest basica-o8 "${testcvs} -q update -p -r 1.1 ./ssfile" "ssfile"
  2205. cd ../..
  2206. cd ..
  2207. rm -rf ${CVSROOT_DIRNAME}/first-dir
  2208. rm -r first-dir
  2209. ;;
  2210. basicb)
  2211. # More basic tests, including non-branch tags and co -d.
  2212. mkdir 1; cd 1
  2213. dotest basicb-0a "${testcvs} -q co -l ." ''
  2214. touch topfile
  2215. dotest basicb-0b "${testcvs} add topfile" \
  2216. "${PROG} add: scheduling file .topfile. for addition
  2217. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2218. dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
  2219. "RCS file: ${CVSROOT_DIRNAME}/topfile,v
  2220. done
  2221. Checking in topfile;
  2222. ${CVSROOT_DIRNAME}/topfile,v <-- topfile
  2223. initial revision: 1\.1
  2224. done"
  2225. cd ..
  2226. rm -r 1
  2227. mkdir 2; cd 2
  2228. dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
  2229. # Now test the ability to run checkout on an existing working
  2230. # directory without having it lose its mind. I don't know
  2231. # whether this is tested elsewhere in sanity.sh. A more elaborate
  2232. # test might also have modified files, make sure it works if
  2233. # the modules file was modified to add new directories to the
  2234. # module, and such.
  2235. dotest basicb-0d0 "${testcvs} -q co -l ." ""
  2236. mkdir first-dir
  2237. dotest basicb-0e "${testcvs} add first-dir" \
  2238. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  2239. cd ..
  2240. rm -r 2
  2241. dotest basicb-1 "${testcvs} -q co first-dir" ''
  2242. # The top-level CVS directory is not created by default.
  2243. # I'm leaving basicb-1a and basicb-1b untouched, mostly, in
  2244. # case we decide that the default should be reversed...
  2245. dotest_fail basicb-1a "test -d CVS" ''
  2246. dotest basicb-1c "cat first-dir/CVS/Repository" "first-dir"
  2247. cd first-dir
  2248. # Note that the name Emptydir is chosen to test that CVS just
  2249. # treats it like any other directory name. It should be
  2250. # special only when it is directly in $CVSROOT/CVSROOT.
  2251. mkdir Emptydir sdir2
  2252. dotest basicb-2 "${testcvs} add Emptydir sdir2" \
  2253. "Directory ${CVSROOT_DIRNAME}/first-dir/Emptydir added to the repository
  2254. Directory ${CVSROOT_DIRNAME}/first-dir/sdir2 added to the repository"
  2255. cd Emptydir
  2256. echo sfile1 starts >sfile1
  2257. dotest basicb-2a10 "${testcvs} -n add sfile1" \
  2258. "${PROG} add: scheduling file .sfile1. for addition
  2259. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2260. dotest basicb-2a11 "${testcvs} status sfile1" \
  2261. "${PROG} status: use .${PROG} add. to create an entry for sfile1
  2262. ===================================================================
  2263. File: sfile1 Status: Unknown
  2264. Working revision: No entry for sfile1
  2265. Repository revision: No revision control file"
  2266. dotest basicb-3 "${testcvs} add sfile1" \
  2267. "${PROG} add: scheduling file .sfile1. for addition
  2268. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2269. dotest basicb-3a1 "${testcvs} status sfile1" \
  2270. "===================================================================
  2271. File: sfile1 Status: Locally Added
  2272. Working revision: New file!
  2273. Repository revision: No revision control file
  2274. Sticky Tag: (none)
  2275. Sticky Date: (none)
  2276. Sticky Options: (none)"
  2277. cd ../sdir2
  2278. echo sfile2 starts >sfile2
  2279. dotest basicb-4 "${testcvs} add sfile2" \
  2280. "${PROG} add: scheduling file .sfile2. for addition
  2281. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2282. dotest basicb-4a "${testcvs} -q ci CVS" \
  2283. "${PROG} [a-z]*: warning: directory CVS specified in argument
  2284. ${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
  2285. cd ..
  2286. dotest basicb-5 "${testcvs} -q ci -m add" \
  2287. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v
  2288. done
  2289. Checking in Emptydir/sfile1;
  2290. ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v <-- sfile1
  2291. initial revision: 1\.1
  2292. done
  2293. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
  2294. done
  2295. Checking in sdir2/sfile2;
  2296. ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v <-- sfile2
  2297. initial revision: 1\.1
  2298. done"
  2299. echo sfile1 develops >Emptydir/sfile1
  2300. dotest basicb-6 "${testcvs} -q ci -m modify" \
  2301. "Checking in Emptydir/sfile1;
  2302. ${CVSROOT_DIRNAME}/first-dir/Emptydir/sfile1,v <-- sfile1
  2303. new revision: 1\.2; previous revision: 1\.1
  2304. done"
  2305. dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
  2306. T sdir2/sfile2'
  2307. echo not in time for release-1 >sdir2/sfile2
  2308. dotest basicb-8 "${testcvs} -q ci -m modify-2" \
  2309. "Checking in sdir2/sfile2;
  2310. ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v <-- sfile2
  2311. new revision: 1\.2; previous revision: 1\.1
  2312. done"
  2313. # See if CVS can correctly notice when an invalid numeric
  2314. # revision is specified.
  2315. # Commented out until we get around to fixing CVS
  2316. : dotest basicb-8a0 "${testcvs} diff -r 1.5 -r 1.7 sfile2" 'error msg'
  2317. cd ..
  2318. # Test that we recurse into the correct directory when checking
  2319. # for existing files, even if co -d is in use.
  2320. touch first-dir/extra
  2321. dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
  2322. 'U first-dir1/Emptydir/sfile1
  2323. U first-dir1/sdir2/sfile2'
  2324. rm -r first-dir1
  2325. rm -r first-dir
  2326. # FIXME? basicb-9 used to check things out like this:
  2327. # U newdir/Emptydir/sfile1
  2328. # U newdir/sdir2/sfile2
  2329. # but that's difficult to do. The whole "shorten" thing
  2330. # is pretty bogus, because it will break on things
  2331. # like "cvs co foo/bar baz/quux". Unless there's some
  2332. # pretty detailed expansion and analysis of the command-line
  2333. # arguments, we shouldn't do "shorten" stuff at all.
  2334. dotest basicb-9 \
  2335. "${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
  2336. 'U newdir/first-dir/Emptydir/sfile1
  2337. U newdir/first-dir/sdir2/sfile2'
  2338. # basicb-9a and basicb-9b: see note about basicb-1a
  2339. dotest_fail basicb-9a "test -d CVS" ''
  2340. dotest basicb-9c "cat newdir/CVS/Repository" "\."
  2341. dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
  2342. "${CVSROOT_DIRNAME}/first-dir" \
  2343. "first-dir"
  2344. dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
  2345. "${CVSROOT_DIRNAME}/first-dir/Emptydir" \
  2346. "first-dir/Emptydir"
  2347. dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
  2348. "${CVSROOT_DIRNAME}/first-dir/sdir2" \
  2349. "first-dir/sdir2"
  2350. dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
  2351. "sfile1 develops
  2352. sfile2 starts"
  2353. rm -r newdir
  2354. # Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
  2355. # seem to deal with it...
  2356. if false; then
  2357. dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
  2358. "U sub1/sub2/Emptydir/sfile1
  2359. U sub1/sub2/sdir2/sfile2"
  2360. cd sub1
  2361. dotest basicb-12 "${testcvs} -q update ./." ''
  2362. touch xx
  2363. dotest basicb-13 "${testcvs} add xx" fixme
  2364. cd ..
  2365. rm -r sub1
  2366. # to test: sub1/sub2/sub3
  2367. fi # end of tests commented out.
  2368. # Create a second directory.
  2369. mkdir 1
  2370. cd 1
  2371. dotest basicb-14 "${testcvs} -q co -l ." 'U topfile'
  2372. mkdir second-dir
  2373. dotest basicb-15 "${testcvs} add second-dir" \
  2374. "Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
  2375. cd second-dir
  2376. touch aa
  2377. dotest basicb-16 "${testcvs} add aa" \
  2378. "${PROG} add: scheduling file .aa. for addition
  2379. ${PROG} add: use .${PROG} commit. to add this file permanently"
  2380. dotest basicb-17 "${testcvs} -q ci -m add" \
  2381. "RCS file: ${CVSROOT_DIRNAME}/second-dir/aa,v
  2382. done
  2383. Checking in aa;
  2384. ${CVSROOT_DIRNAME}/second-dir/aa,v <-- aa
  2385. initial revision: 1\.1
  2386. done"
  2387. cd ..
  2388. # Try to remove all revisions in a file.
  2389. dotest_fail basicb-o1 "${testcvs} admin -o1.1 topfile" \
  2390. "RCS file: ${CVSROOT_DIRNAME}/topfile,v
  2391. deleting revision 1\.1
  2392. ${PROG} \[admin aborted\]: attempt to delete all revisions"
  2393. dotest basicb-o2 "${testcvs} -q update -d first-dir" \
  2394. "U first-dir/Emptydir/sfile1
  2395. U first-dir/sdir2/sfile2"
  2396. dotest_fail basicb-o3 \
  2397. "${testcvs} admin -o1.1:1.2 first-dir/sdir2/sfile2" \
  2398. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir2/sfile2,v
  2399. deleting revision 1\.2
  2400. deleting revision 1\.1
  2401. ${PROG} \[admin aborted\]: attempt to delete all revisions"
  2402. cd ..
  2403. rm -r 1
  2404. mkdir 1; cd 1
  2405. # Note that -H is an illegal option.
  2406. # I suspect that the choice between "illegal" and "invalid"
  2407. # depends on the user's environment variables, the phase
  2408. # of the moon (weirdness with optind), and who knows what else.
  2409. # I've been seeing "illegal"...
  2410. dotest_fail basicb-21 "${testcvs} -q admin -H" \
  2411. "admin: illegal option -- H
  2412. ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
  2413. "admin: invalid option -- H
  2414. ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
  2415. cd ..
  2416. rmdir 1
  2417. if $keep; then
  2418. echo Keeping ${TESTDIR} and exiting due to --keep
  2419. exit 0
  2420. fi
  2421. rm -rf ${CVSROOT_DIRNAME}/first-dir
  2422. rm -rf ${CVSROOT_DIRNAME}/second-dir
  2423. rm -f ${CVSROOT_DIRNAME}/topfile,v
  2424. ;;
  2425. basicc)
  2426. # More tests of basic/miscellaneous functionality.
  2427. mkdir 1; cd 1
  2428. dotest_fail basicc-1 "${testcvs} diff" \
  2429. "${PROG} [a-z]*: in directory \.:
  2430. ${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
  2431. dotest basicc-2 "${testcvs} -q co -l ." ''
  2432. mkdir first-dir second-dir
  2433. dotest basicc-3 "${testcvs} add first-dir second-dir" \
  2434. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
  2435. Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
  2436. # Old versions of CVS often didn't create this top-level CVS
  2437. # directory in the first place. I think that maybe the only
  2438. # way to get it to work currently is to let CVS create it,
  2439. # and then blow it away (don't complain if it does not
  2440. # exist). But that is perfectly legal; people who are used
  2441. # to the old behavior especially may be interested.
  2442. # FIXME: this test is intended for the TopLevelAdmin=yes case;
  2443. # should adjust/move it accordingly.
  2444. rm -rf CVS
  2445. dotest basicc-4 "echo *" "first-dir second-dir"
  2446. dotest basicc-5 "${testcvs} update" \
  2447. "${PROG} update: Updating first-dir
  2448. ${PROG} update: Updating second-dir" \
  2449. "${PROG} update: Updating \.
  2450. ${PROG} update: Updating first-dir
  2451. ${PROG} update: Updating second-dir"
  2452. cd first-dir
  2453. dotest basicc-6 "${testcvs} release -d" ""
  2454. dotest basicc-7 "test -d ../first-dir" ""
  2455. # The Linux 2.2 kernel lets you delete ".". That's OK either way,
  2456. # the point is that CVS must not mess with anything *outside* "."
  2457. # the way that CVS 1.10 and older tried to.
  2458. dotest basicc-8 "${testcvs} -Q release -d ." \
  2459. "" "${PROG} release: deletion of directory \. failed: .*"
  2460. dotest basicc-9 "test -d ../second-dir" ""
  2461. # For CVS to make a syntactic check for "." wouldn't suffice.
  2462. # On Linux 2.2 systems, the cwd may be gone, so we recreate it
  2463. # to allow basicc-11 to actually happen
  2464. if test ! -d ../first-dir; then
  2465. # Apparently `cd ..' doesn't work with Linux 2.2 & Bash 2.05b.
  2466. cd $TESTDIR/1
  2467. mkdir ./first-dir
  2468. cd ./first-dir
  2469. fi
  2470. dotest basicc-11 "${testcvs} -Q release -d ./." \
  2471. "" "${PROG} release: deletion of directory \./\. failed: .*"
  2472. dotest basicc-11a "test -d ../second-dir" ""
  2473. cd ../..
  2474. mkdir 2; cd 2
  2475. dotest basicc-12 "${testcvs} -Q co ." ""
  2476. # actual entries can be in either Entries or Entries.log, do
  2477. # an update to get them consolidated into Entries
  2478. dotest basicc-12a "${testcvs} -Q up" ""
  2479. dotest basicc-12b "cat CVS/Entries" \
  2480. "D/CVSROOT////
  2481. D/first-dir////
  2482. D/second-dir////"
  2483. dotest basicc-13 "echo *" "CVS CVSROOT first-dir second-dir"
  2484. dotest basicc-14 "${testcvs} -Q release first-dir second-dir" ""
  2485. # a normal release shouldn't affect the Entries file
  2486. dotest basicc-14b "cat CVS/Entries" \
  2487. "D/CVSROOT////
  2488. D/first-dir////
  2489. D/second-dir////"
  2490. # FIXCVS: but release -d probably should
  2491. dotest basicc-15 "${testcvs} -Q release -d first-dir second-dir" ""
  2492. dotest basicc-16 "echo *" "CVS CVSROOT"
  2493. dotest basicc-17 "cat CVS/Entries" \
  2494. "D/CVSROOT////
  2495. D/first-dir////
  2496. D/second-dir////"
  2497. # FIXCVS: if not, update should notice the missing directories
  2498. # and update Entries accordingly
  2499. dotest basicc-18 "${testcvs} -Q up" ""
  2500. dotest basicc-19 "cat CVS/Entries" \
  2501. "D/CVSROOT////
  2502. D/first-dir////
  2503. D/second-dir////"
  2504. cd ..
  2505. rm -r 1 2
  2506. rm -rf ${CVSROOT_DIRNAME}/first-dir
  2507. ;;
  2508. basic1)
  2509. # first dive - add a files, first singly, then in a group.
  2510. mkdir ${CVSROOT_DIRNAME}/first-dir
  2511. mkdir basic1; cd basic1
  2512. # check out an empty directory
  2513. dotest basic1-1 "${testcvs} -q co first-dir" ''
  2514. cd first-dir
  2515. echo file2 >file2
  2516. echo file3 >file3
  2517. echo file4 >file4
  2518. echo file5 >file5
  2519. dotest basic1-14-add-add "${testcvs} add file2 file3 file4 file5" \
  2520. "${PROG} add: scheduling file \`file2' for addition
  2521. ${PROG} add: scheduling file \`file3' for addition
  2522. ${PROG} add: scheduling file \`file4' for addition
  2523. ${PROG} add: scheduling file \`file5' for addition
  2524. ${PROG} add: use .${PROG} commit. to add these files permanently"
  2525. dotest basic1-15-add-add \
  2526. "${testcvs} -q update file2 file3 file4 file5" \
  2527. "A file2
  2528. A file3
  2529. A file4
  2530. A file5"
  2531. dotest basic1-16-add-add "${testcvs} -q update" \
  2532. "A file2
  2533. A file3
  2534. A file4
  2535. A file5"
  2536. dotest basic1-17-add-add "${testcvs} -q status" \
  2537. "===================================================================
  2538. File: file2 Status: Locally Added
  2539. Working revision: New file!
  2540. Repository revision: No revision control file
  2541. Sticky Tag: (none)
  2542. Sticky Date: (none)
  2543. Sticky Options: (none)
  2544. ===================================================================
  2545. File: file3 Status: Locally Added
  2546. Working revision: New file!
  2547. Repository revision: No revision control file
  2548. Sticky Tag: (none)
  2549. Sticky Date: (none)
  2550. Sticky Options: (none)
  2551. ===================================================================
  2552. File: file4 Status: Locally Added
  2553. Working revision: New file!
  2554. Repository revision: No revision control file
  2555. Sticky Tag: (none)
  2556. Sticky Date: (none)
  2557. Sticky Options: (none)
  2558. ===================================================================
  2559. File: file5 Status: Locally Added
  2560. Working revision: New file!
  2561. Repository revision: No revision control file
  2562. Sticky Tag: (none)
  2563. Sticky Date: (none)
  2564. Sticky Options: (none)"
  2565. dotest basic1-18-add-add "${testcvs} -q log" \
  2566. "${PROG} log: file2 has been added, but not committed
  2567. ${PROG} log: file3 has been added, but not committed
  2568. ${PROG} log: file4 has been added, but not committed
  2569. ${PROG} log: file5 has been added, but not committed"
  2570. cd ..
  2571. dotest basic1-21-add-add "${testcvs} -q update" \
  2572. "A first-dir/file2
  2573. A first-dir/file3
  2574. A first-dir/file4
  2575. A first-dir/file5"
  2576. # FIXCVS? Shouldn't this read first-dir/file2 instead of file2?
  2577. dotest basic1-22-add-add "${testcvs} log first-dir" \
  2578. "${PROG} log: Logging first-dir
  2579. ${PROG} log: file2 has been added, but not committed
  2580. ${PROG} log: file3 has been added, but not committed
  2581. ${PROG} log: file4 has been added, but not committed
  2582. ${PROG} log: file5 has been added, but not committed"
  2583. dotest basic1-23-add-add "${testcvs} status first-dir" \
  2584. "${PROG} status: Examining first-dir
  2585. ===================================================================
  2586. File: file2 Status: Locally Added
  2587. Working revision: New file!
  2588. Repository revision: No revision control file
  2589. Sticky Tag: (none)
  2590. Sticky Date: (none)
  2591. Sticky Options: (none)
  2592. ===================================================================
  2593. File: file3 Status: Locally Added
  2594. Working revision: New file!
  2595. Repository revision: No revision control file
  2596. Sticky Tag: (none)
  2597. Sticky Date: (none)
  2598. Sticky Options: (none)
  2599. ===================================================================
  2600. File: file4 Status: Locally Added
  2601. Working revision: New file!
  2602. Repository revision: No revision control file
  2603. Sticky Tag: (none)
  2604. Sticky Date: (none)
  2605. Sticky Options: (none)
  2606. ===================================================================
  2607. File: file5 Status: Locally Added
  2608. Working revision: New file!
  2609. Repository revision: No revision control file
  2610. Sticky Tag: (none)
  2611. Sticky Date: (none)
  2612. Sticky Options: (none)"
  2613. dotest basic1-24-add-add "${testcvs} update first-dir" \
  2614. "${PROG} update: Updating first-dir
  2615. A first-dir/file2
  2616. A first-dir/file3
  2617. A first-dir/file4
  2618. A first-dir/file5"
  2619. dotest basic1-27-add-add "${testcvs} co first-dir" \
  2620. "${PROG} checkout: Updating first-dir
  2621. A first-dir/file2
  2622. A first-dir/file3
  2623. A first-dir/file4
  2624. A first-dir/file5"
  2625. cd first-dir
  2626. dotest basic1-14-add-ci \
  2627. "${testcvs} commit -m test file2 file3 file4 file5" \
  2628. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  2629. done
  2630. Checking in file2;
  2631. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  2632. initial revision: 1\.1
  2633. done
  2634. RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  2635. done
  2636. Checking in file3;
  2637. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  2638. initial revision: 1\.1
  2639. done
  2640. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  2641. done
  2642. Checking in file4;
  2643. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  2644. initial revision: 1\.1
  2645. done
  2646. RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
  2647. done
  2648. Checking in file5;
  2649. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  2650. initial revision: 1\.1
  2651. done"
  2652. dotest basic1-15-add-ci \
  2653. "${testcvs} -q update file2 file3 file4 file5" ''
  2654. dotest basic1-16-add-ci "${testcvs} -q update" ''
  2655. dotest basic1-17-add-ci "${testcvs} -q status" \
  2656. "===================================================================
  2657. File: file2 Status: Up-to-date
  2658. Working revision: 1\.1.*
  2659. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file2,v
  2660. Sticky Tag: (none)
  2661. Sticky Date: (none)
  2662. Sticky Options: (none)
  2663. ===================================================================
  2664. File: file3 Status: Up-to-date
  2665. Working revision: 1\.1.*
  2666. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file3,v
  2667. Sticky Tag: (none)
  2668. Sticky Date: (none)
  2669. Sticky Options: (none)
  2670. ===================================================================
  2671. File: file4 Status: Up-to-date
  2672. Working revision: 1\.1.*
  2673. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file4,v
  2674. Sticky Tag: (none)
  2675. Sticky Date: (none)
  2676. Sticky Options: (none)
  2677. ===================================================================
  2678. File: file5 Status: Up-to-date
  2679. Working revision: 1\.1.*
  2680. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file5,v
  2681. Sticky Tag: (none)
  2682. Sticky Date: (none)
  2683. Sticky Options: (none)"
  2684. # The "log" tests and friends probably already test the output
  2685. # from log quite adequately.
  2686. # Note: using dotest fails here. It seems to be related
  2687. # to the output being sufficiently large (Red Hat 4.1).
  2688. # dotest basic1-18-add-ci "${testcvs} log" "${DOTSTAR}"
  2689. if ${testcvs} -q log >>${LOGFILE}; then
  2690. pass basic1-18-add-ci
  2691. else
  2692. pass basic1-18-add-ci
  2693. fi
  2694. cd ..
  2695. dotest basic1-21-add-ci "${testcvs} -q update" ''
  2696. # See test basic1-18-add-ci for explanation of non-use of dotest.
  2697. if ${testcvs} -q log first-dir >>${LOGFILE}; then
  2698. pass basic1-22-add-ci
  2699. else
  2700. pass basic1-22-add-ci
  2701. fi
  2702. # At least for the moment I am going to consider 17-add-ci
  2703. # an adequate test of the output here.
  2704. # See test basic1-18-add-ci for explanation of non-use of dotest.
  2705. if ${testcvs} -q status first-dir >>${LOGFILE}; then
  2706. pass basic1-23-add-ci
  2707. else
  2708. pass basic1-23-add-ci
  2709. fi
  2710. dotest basic1-24-add-ci "${testcvs} -q update first-dir" ''
  2711. dotest basic1-27-add-ci "${testcvs} -q co first-dir" ''
  2712. cd first-dir
  2713. rm file2 file3 file4 file5
  2714. dotest basic1-14-rm-rm "${testcvs} rm file2 file3 file4 file5" \
  2715. "${PROG} remove: scheduling .file2. for removal
  2716. ${PROG} remove: scheduling .file3. for removal
  2717. ${PROG} remove: scheduling .file4. for removal
  2718. ${PROG} remove: scheduling .file5. for removal
  2719. ${PROG} remove: use .${PROG} commit. to remove these files permanently"
  2720. # 15-rm-rm was commented out. Why?
  2721. dotest basic1-15-rm-rm \
  2722. "${testcvs} -q update file2 file3 file4 file5" \
  2723. "R file2
  2724. R file3
  2725. R file4
  2726. R file5"
  2727. dotest basic1-16-rm-rm "${testcvs} -q update" \
  2728. "R file2
  2729. R file3
  2730. R file4
  2731. R file5"
  2732. dotest basic1-17-rm-rm "${testcvs} -q status" \
  2733. "===================================================================
  2734. File: no file file2 Status: Locally Removed
  2735. Working revision: -1\.1.*
  2736. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file2,v
  2737. Sticky Tag: (none)
  2738. Sticky Date: (none)
  2739. Sticky Options: (none)
  2740. ===================================================================
  2741. File: no file file3 Status: Locally Removed
  2742. Working revision: -1\.1.*
  2743. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file3,v
  2744. Sticky Tag: (none)
  2745. Sticky Date: (none)
  2746. Sticky Options: (none)
  2747. ===================================================================
  2748. File: no file file4 Status: Locally Removed
  2749. Working revision: -1\.1.*
  2750. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file4,v
  2751. Sticky Tag: (none)
  2752. Sticky Date: (none)
  2753. Sticky Options: (none)
  2754. ===================================================================
  2755. File: no file file5 Status: Locally Removed
  2756. Working revision: -1\.1.*
  2757. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file5,v
  2758. Sticky Tag: (none)
  2759. Sticky Date: (none)
  2760. Sticky Options: (none)"
  2761. # Would be nice to test that real logs appear (with dead state
  2762. # and all), either here or someplace like log2 tests.
  2763. if ${testcvs} -q log >>${LOGFILE}; then
  2764. pass basic1-18-rm-rm
  2765. else
  2766. fail basic1-18-rm-rm
  2767. fi
  2768. cd ..
  2769. dotest basic1-21-rm-rm "${testcvs} -q update" \
  2770. "R first-dir/file2
  2771. R first-dir/file3
  2772. R first-dir/file4
  2773. R first-dir/file5"
  2774. if ${testcvs} -q log first-dir >>${LOGFILE}; then
  2775. pass basic1-22-rm-rm
  2776. else
  2777. fail basic1-22-rm-rm
  2778. fi
  2779. if ${testcvs} -q status first-dir >>${LOGFILE}; then
  2780. pass basic1-23-rm-rm
  2781. else
  2782. fail basic1-23-rm-rm
  2783. fi
  2784. dotest basic1-24-rm-rm "${testcvs} -q update first-dir" \
  2785. "R first-dir/file2
  2786. R first-dir/file3
  2787. R first-dir/file4
  2788. R first-dir/file5"
  2789. dotest basic1-27-rm-rm "${testcvs} -q co first-dir" \
  2790. "R first-dir/file2
  2791. R first-dir/file3
  2792. R first-dir/file4
  2793. R first-dir/file5"
  2794. cd first-dir
  2795. dotest basic1-14-rm-ci "${testcvs} -q commit -m test" \
  2796. "Removing file2;
  2797. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  2798. new revision: delete; previous revision: 1\.1
  2799. done
  2800. Removing file3;
  2801. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  2802. new revision: delete; previous revision: 1\.1
  2803. done
  2804. Removing file4;
  2805. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  2806. new revision: delete; previous revision: 1\.1
  2807. done
  2808. Removing file5;
  2809. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  2810. new revision: delete; previous revision: 1\.1
  2811. done"
  2812. dotest basic1-15-rm-ci \
  2813. "${testcvs} -q update file2 file3 file4 file5" ''
  2814. dotest basic1-16-rm-ci "${testcvs} -q update" ''
  2815. dotest basic1-17-rm-ci "${testcvs} -q status" ''
  2816. # Would be nice to test that real logs appear (with dead state
  2817. # and all), either here or someplace like log2 tests.
  2818. if ${testcvs} -q log >>${LOGFILE}; then
  2819. pass basic1-18-rm-ci
  2820. else
  2821. fail basic1-18-rm-ci
  2822. fi
  2823. cd ..
  2824. dotest basic1-21-rm-ci "${testcvs} -q update" ''
  2825. if ${testcvs} -q log first-dir >>${LOGFILE}; then
  2826. pass basic1-22-rm-ci
  2827. else
  2828. fail basic1-22-rm-ci
  2829. fi
  2830. if ${testcvs} -q status first-dir >>${LOGFILE}; then
  2831. pass basic1-23-rm-ci
  2832. else
  2833. fail basic1-23-rm-ci
  2834. fi
  2835. dotest basic1-24-rm-ci "${testcvs} -q update first-dir" ''
  2836. dotest basic1-27-rm-ci "${testcvs} -q co first-dir" ''
  2837. cd first-dir
  2838. # All the files are removed, so nothing gets tagged.
  2839. dotest basic1-28 "${testcvs} -q tag first-dive" ''
  2840. cd ..
  2841. cd ..
  2842. if $keep; then
  2843. echo Keeping ${TESTDIR} and exiting due to --keep
  2844. exit 0
  2845. fi
  2846. rm -r basic1
  2847. rm -rf ${CVSROOT_DIRNAME}/first-dir
  2848. ;;
  2849. deep)
  2850. # Test the ability to operate on directories nested rather deeply.
  2851. mkdir ${CVSROOT_DIRNAME}/first-dir
  2852. dotest deep-1 "${testcvs} -q co first-dir" ''
  2853. cd first-dir
  2854. for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
  2855. mkdir $i
  2856. dotest deep-2-$i "${testcvs} add $i" \
  2857. "Directory ${CVSROOT_DIRNAME}/first-dir/dir1[/dir0-9]* added to the repository"
  2858. cd $i
  2859. echo file1 >file1
  2860. dotest deep-3-$i "${testcvs} add file1" \
  2861. "${PROG}"' add: scheduling file `file1'\'' for addition
  2862. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  2863. done
  2864. cd ../../../../../../../../..
  2865. dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
  2866. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v
  2867. done
  2868. Checking in first-dir/dir1/file1;
  2869. ${CVSROOT_DIRNAME}/first-dir/dir1/file1,v <-- file1
  2870. initial revision: 1.1
  2871. done
  2872. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v
  2873. done
  2874. Checking in first-dir/dir1/dir2/file1;
  2875. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file1,v <-- file1
  2876. initial revision: 1.1
  2877. done
  2878. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v
  2879. done
  2880. Checking in first-dir/dir1/dir2/dir3/file1;
  2881. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/file1,v <-- file1
  2882. initial revision: 1.1
  2883. done
  2884. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v
  2885. done
  2886. Checking in first-dir/dir1/dir2/dir3/dir4/file1;
  2887. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/file1,v <-- file1
  2888. initial revision: 1.1
  2889. done
  2890. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
  2891. done
  2892. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
  2893. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v <-- file1
  2894. initial revision: 1.1
  2895. done
  2896. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
  2897. done
  2898. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
  2899. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v <-- file1
  2900. initial revision: 1.1
  2901. done
  2902. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
  2903. done
  2904. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
  2905. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v <-- file1
  2906. initial revision: 1.1
  2907. done
  2908. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
  2909. done
  2910. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
  2911. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v <-- file1
  2912. initial revision: 1.1
  2913. done
  2914. HERE
  2915. cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
  2916. rm file1
  2917. dotest deep-4a0 "${testcvs} rm file1" \
  2918. "${PROG} remove: scheduling .file1. for removal
  2919. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  2920. dotest deep-4a1 "${testcvs} -q ci -m rm-it" "Removing file1;
  2921. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v <-- file1
  2922. new revision: delete; previous revision: 1\.1
  2923. done"
  2924. cd ../../..
  2925. dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
  2926. # Should be using "test -e" if that is portable enough.
  2927. dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
  2928. # Test that if we remove the working directory, CVS does not
  2929. # recreate it. (I realize that this behavior is what the
  2930. # users expect, but in the longer run we might want to
  2931. # re-think it. The corresponding behavior for a file is that
  2932. # CVS *will* recreate it, and we might want to make it so
  2933. # that "cvs release -d" is the way to delete the directory
  2934. # and have it stay gone -kingdon, Oct1996).
  2935. rm -r dir6
  2936. dotest deep-4b0a "${testcvs} -q diff" ''
  2937. dotest deep-4b0b "${testcvs} -q ci" ''
  2938. dotest deep-4b1 "${testcvs} -q update" ''
  2939. dotest deep-4b2 "${testcvs} -q update -d -P" \
  2940. 'U dir6/file1
  2941. U dir6/dir7/file1'
  2942. # Test what happens if one uses -P when there are files removed
  2943. # but not committed.
  2944. cd dir6/dir7
  2945. dotest deep-rm1 "${testcvs} rm -f file1" \
  2946. "${PROG} remove: scheduling .file1. for removal
  2947. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  2948. cd ..
  2949. dotest deep-rm2 "${testcvs} -q update -d -P" 'R dir7/file1'
  2950. dotest deep-rm3 "test -d dir7" ''
  2951. dotest deep-rm4 "${testcvs} -q ci -m rm-it" "Removing dir7/file1;
  2952. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v <-- file1
  2953. new revision: delete; previous revision: 1\.1
  2954. done"
  2955. dotest deep-rm5 "${testcvs} -q update -d -P" ''
  2956. dotest_fail deep-rm6 "test -d dir7" ''
  2957. # Test rm -f -R.
  2958. cd ../..
  2959. dotest deep-rm7 "${testcvs} rm -f -R dir5" \
  2960. "${PROG} remove: Removing dir5
  2961. ${PROG} remove: scheduling .dir5/file1. for removal
  2962. ${PROG} remove: Removing dir5/dir6
  2963. ${PROG} remove: scheduling .dir5/dir6/file1. for removal
  2964. ${PROG} remove: use .${PROG} commit. to remove these files permanently"
  2965. dotest deep-rm8 "${testcvs} -q ci -m rm-it" \
  2966. "Removing dir5/file1;
  2967. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v <-- file1
  2968. new revision: delete; previous revision: 1\.1
  2969. done
  2970. Removing dir5/dir6/file1;
  2971. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v <-- file1
  2972. new revision: delete; previous revision: 1\.1
  2973. done"
  2974. dotest deep-rm9 "${testcvs} -q update -d -P" ''
  2975. dotest_fail deep-rm10 "test -d dir5"
  2976. cd ../../../../..
  2977. if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
  2978. pass deep-5
  2979. else
  2980. fail deep-5
  2981. fi
  2982. rm -rf ${CVSROOT_DIRNAME}/first-dir
  2983. ;;
  2984. basic2)
  2985. # Test rtag, import, history, various miscellaneous operations
  2986. # NOTE: this section has reached the size and
  2987. # complexity where it is getting to be a good idea to
  2988. # add new tests to a new section rather than
  2989. # continuing to piggyback them onto the tests here.
  2990. # First empty the history file
  2991. rm ${CVSROOT_DIRNAME}/CVSROOT/history
  2992. touch ${CVSROOT_DIRNAME}/CVSROOT/history
  2993. ### XXX maybe should use 'cvs imprt -b1 -m new-module first-dir F F1' in an
  2994. ### empty directory to do this instead of hacking directly into $CVSROOT
  2995. mkdir ${CVSROOT_DIRNAME}/first-dir
  2996. dotest basic2-1 "${testcvs} -q co first-dir" ''
  2997. for i in first-dir dir1 dir2 ; do
  2998. if test ! -d $i ; then
  2999. mkdir $i
  3000. dotest basic2-2-$i "${testcvs} add $i" \
  3001. "Directory ${CVSROOT_DIRNAME}/.*/$i added to the repository"
  3002. fi
  3003. cd $i
  3004. for j in file6 file7; do
  3005. echo $j > $j
  3006. done
  3007. dotest basic2-3-$i "${testcvs} add file6 file7" \
  3008. "${PROG} add: scheduling file .file6. for addition
  3009. ${PROG} add: scheduling file .file7. for addition
  3010. ${PROG} add: use .${PROG} commit. to add these files permanently"
  3011. done
  3012. cd ../../..
  3013. dotest basic2-4 "${testcvs} update first-dir" \
  3014. "${PROG} update: Updating first-dir
  3015. A first-dir/file6
  3016. A first-dir/file7
  3017. ${PROG} update: Updating first-dir/dir1
  3018. A first-dir/dir1/file6
  3019. A first-dir/dir1/file7
  3020. ${PROG} update: Updating first-dir/dir1/dir2
  3021. A first-dir/dir1/dir2/file6
  3022. A first-dir/dir1/dir2/file7"
  3023. # fixme: doesn't work right for added files.
  3024. dotest basic2-5 "${testcvs} log first-dir" \
  3025. "${PROG} log: Logging first-dir
  3026. ${PROG} log: file6 has been added, but not committed
  3027. ${PROG} log: file7 has been added, but not committed
  3028. ${PROG} log: Logging first-dir/dir1
  3029. ${PROG} log: file6 has been added, but not committed
  3030. ${PROG} log: file7 has been added, but not committed
  3031. ${PROG} log: Logging first-dir/dir1/dir2
  3032. ${PROG} log: file6 has been added, but not committed
  3033. ${PROG} log: file7 has been added, but not committed"
  3034. dotest basic2-6 "${testcvs} status first-dir" \
  3035. "${PROG} status: Examining first-dir
  3036. ===================================================================
  3037. File: file6 Status: Locally Added
  3038. Working revision: New file!
  3039. Repository revision: No revision control file
  3040. Sticky Tag: (none)
  3041. Sticky Date: (none)
  3042. Sticky Options: (none)
  3043. ===================================================================
  3044. File: file7 Status: Locally Added
  3045. Working revision: New file!
  3046. Repository revision: No revision control file
  3047. Sticky Tag: (none)
  3048. Sticky Date: (none)
  3049. Sticky Options: (none)
  3050. ${PROG} status: Examining first-dir/dir1
  3051. ===================================================================
  3052. File: file6 Status: Locally Added
  3053. Working revision: New file!
  3054. Repository revision: No revision control file
  3055. Sticky Tag: (none)
  3056. Sticky Date: (none)
  3057. Sticky Options: (none)
  3058. ===================================================================
  3059. File: file7 Status: Locally Added
  3060. Working revision: New file!
  3061. Repository revision: No revision control file
  3062. Sticky Tag: (none)
  3063. Sticky Date: (none)
  3064. Sticky Options: (none)
  3065. ${PROG} status: Examining first-dir/dir1/dir2
  3066. ===================================================================
  3067. File: file6 Status: Locally Added
  3068. Working revision: New file!
  3069. Repository revision: No revision control file
  3070. Sticky Tag: (none)
  3071. Sticky Date: (none)
  3072. Sticky Options: (none)
  3073. ===================================================================
  3074. File: file7 Status: Locally Added
  3075. Working revision: New file!
  3076. Repository revision: No revision control file
  3077. Sticky Tag: (none)
  3078. Sticky Date: (none)
  3079. Sticky Options: (none)"
  3080. # XXX why is this commented out???
  3081. # if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then
  3082. # pass 34
  3083. # else
  3084. # fail 34
  3085. # fi
  3086. dotest basic2-8 "${testcvs} -q ci -m 'second dive' first-dir" \
  3087. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
  3088. done
  3089. Checking in first-dir/file6;
  3090. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  3091. initial revision: 1\.1
  3092. done
  3093. RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
  3094. done
  3095. Checking in first-dir/file7;
  3096. ${CVSROOT_DIRNAME}/first-dir/file7,v <-- file7
  3097. initial revision: 1\.1
  3098. done
  3099. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
  3100. done
  3101. Checking in first-dir/dir1/file6;
  3102. ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v <-- file6
  3103. initial revision: 1\.1
  3104. done
  3105. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
  3106. done
  3107. Checking in first-dir/dir1/file7;
  3108. ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v <-- file7
  3109. initial revision: 1\.1
  3110. done
  3111. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
  3112. done
  3113. Checking in first-dir/dir1/dir2/file6;
  3114. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v <-- file6
  3115. initial revision: 1\.1
  3116. done
  3117. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
  3118. done
  3119. Checking in first-dir/dir1/dir2/file7;
  3120. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v <-- file7
  3121. initial revision: 1\.1
  3122. done"
  3123. dotest basic2-9 "${testcvs} tag second-dive first-dir" \
  3124. "${PROG} tag: Tagging first-dir
  3125. T first-dir/file6
  3126. T first-dir/file7
  3127. ${PROG} tag: Tagging first-dir/dir1
  3128. T first-dir/dir1/file6
  3129. T first-dir/dir1/file7
  3130. ${PROG} tag: Tagging first-dir/dir1/dir2
  3131. T first-dir/dir1/dir2/file6
  3132. T first-dir/dir1/dir2/file7"
  3133. # third dive - in bunch o' directories, add bunch o' files,
  3134. # delete some, change some.
  3135. for i in first-dir dir1 dir2 ; do
  3136. cd $i
  3137. # modify a file
  3138. echo file6 >>file6
  3139. # delete a file
  3140. rm file7
  3141. dotest basic2-10-$i "${testcvs} rm file7" \
  3142. "${PROG} remove: scheduling .file7. for removal
  3143. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  3144. # and add a new file
  3145. echo file14 >file14
  3146. dotest basic2-11-$i "${testcvs} add file14" \
  3147. "${PROG} add: scheduling file .file14. for addition
  3148. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3149. done
  3150. cd ../../..
  3151. dotest basic2-12 "${testcvs} update first-dir" \
  3152. "${PROG} update: Updating first-dir
  3153. A first-dir/file14
  3154. M first-dir/file6
  3155. R first-dir/file7
  3156. ${PROG} update: Updating first-dir/dir1
  3157. A first-dir/dir1/file14
  3158. M first-dir/dir1/file6
  3159. R first-dir/dir1/file7
  3160. ${PROG} update: Updating first-dir/dir1/dir2
  3161. A first-dir/dir1/dir2/file14
  3162. M first-dir/dir1/dir2/file6
  3163. R first-dir/dir1/dir2/file7"
  3164. # FIXME: doesn't work right for added files
  3165. dotest basic2-13 "${testcvs} log first-dir" \
  3166. "${PROG} log: Logging first-dir
  3167. ${PROG} log: file14 has been added, but not committed
  3168. RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
  3169. Working file: first-dir/file6
  3170. head: 1\.1
  3171. branch:
  3172. locks: strict
  3173. access list:
  3174. symbolic names:
  3175. second-dive: 1\.1
  3176. keyword substitution: kv
  3177. total revisions: 1; selected revisions: 1
  3178. description:
  3179. ----------------------------
  3180. revision 1\.1
  3181. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3182. second dive
  3183. =============================================================================
  3184. RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
  3185. Working file: first-dir/file7
  3186. head: 1\.1
  3187. branch:
  3188. locks: strict
  3189. access list:
  3190. symbolic names:
  3191. second-dive: 1\.1
  3192. keyword substitution: kv
  3193. total revisions: 1; selected revisions: 1
  3194. description:
  3195. ----------------------------
  3196. revision 1\.1
  3197. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3198. second dive
  3199. =============================================================================
  3200. ${PROG} log: Logging first-dir/dir1
  3201. ${PROG} log: file14 has been added, but not committed
  3202. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
  3203. Working file: first-dir/dir1/file6
  3204. head: 1\.1
  3205. branch:
  3206. locks: strict
  3207. access list:
  3208. symbolic names:
  3209. second-dive: 1\.1
  3210. keyword substitution: kv
  3211. total revisions: 1; selected revisions: 1
  3212. description:
  3213. ----------------------------
  3214. revision 1\.1
  3215. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3216. second dive
  3217. =============================================================================
  3218. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
  3219. Working file: first-dir/dir1/file7
  3220. head: 1\.1
  3221. branch:
  3222. locks: strict
  3223. access list:
  3224. symbolic names:
  3225. second-dive: 1\.1
  3226. keyword substitution: kv
  3227. total revisions: 1; selected revisions: 1
  3228. description:
  3229. ----------------------------
  3230. revision 1\.1
  3231. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3232. second dive
  3233. =============================================================================
  3234. ${PROG} log: Logging first-dir/dir1/dir2
  3235. ${PROG} log: file14 has been added, but not committed
  3236. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
  3237. Working file: first-dir/dir1/dir2/file6
  3238. head: 1\.1
  3239. branch:
  3240. locks: strict
  3241. access list:
  3242. symbolic names:
  3243. second-dive: 1\.1
  3244. keyword substitution: kv
  3245. total revisions: 1; selected revisions: 1
  3246. description:
  3247. ----------------------------
  3248. revision 1\.1
  3249. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3250. second dive
  3251. =============================================================================
  3252. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
  3253. Working file: first-dir/dir1/dir2/file7
  3254. head: 1\.1
  3255. branch:
  3256. locks: strict
  3257. access list:
  3258. symbolic names:
  3259. second-dive: 1\.1
  3260. keyword substitution: kv
  3261. total revisions: 1; selected revisions: 1
  3262. description:
  3263. ----------------------------
  3264. revision 1\.1
  3265. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  3266. second dive
  3267. ============================================================================="
  3268. dotest basic2-14 "${testcvs} status first-dir" \
  3269. "${PROG} status: Examining first-dir
  3270. ===================================================================
  3271. File: file14 Status: Locally Added
  3272. Working revision: New file!
  3273. Repository revision: No revision control file
  3274. Sticky Tag: (none)
  3275. Sticky Date: (none)
  3276. Sticky Options: (none)
  3277. ===================================================================
  3278. File: file6 Status: Locally Modified
  3279. Working revision: 1\.1.*
  3280. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file6,v
  3281. Sticky Tag: (none)
  3282. Sticky Date: (none)
  3283. Sticky Options: (none)
  3284. ===================================================================
  3285. File: no file file7 Status: Locally Removed
  3286. Working revision: -1\.1.*
  3287. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file7,v
  3288. Sticky Tag: (none)
  3289. Sticky Date: (none)
  3290. Sticky Options: (none)
  3291. ${PROG} status: Examining first-dir/dir1
  3292. ===================================================================
  3293. File: file14 Status: Locally Added
  3294. Working revision: New file!
  3295. Repository revision: No revision control file
  3296. Sticky Tag: (none)
  3297. Sticky Date: (none)
  3298. Sticky Options: (none)
  3299. ===================================================================
  3300. File: file6 Status: Locally Modified
  3301. Working revision: 1\.1.*
  3302. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v
  3303. Sticky Tag: (none)
  3304. Sticky Date: (none)
  3305. Sticky Options: (none)
  3306. ===================================================================
  3307. File: no file file7 Status: Locally Removed
  3308. Working revision: -1\.1.*
  3309. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v
  3310. Sticky Tag: (none)
  3311. Sticky Date: (none)
  3312. Sticky Options: (none)
  3313. ${PROG} status: Examining first-dir/dir1/dir2
  3314. ===================================================================
  3315. File: file14 Status: Locally Added
  3316. Working revision: New file!
  3317. Repository revision: No revision control file
  3318. Sticky Tag: (none)
  3319. Sticky Date: (none)
  3320. Sticky Options: (none)
  3321. ===================================================================
  3322. File: file6 Status: Locally Modified
  3323. Working revision: 1\.1.*
  3324. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v
  3325. Sticky Tag: (none)
  3326. Sticky Date: (none)
  3327. Sticky Options: (none)
  3328. ===================================================================
  3329. File: no file file7 Status: Locally Removed
  3330. Working revision: -1\.1.*
  3331. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v
  3332. Sticky Tag: (none)
  3333. Sticky Date: (none)
  3334. Sticky Options: (none)"
  3335. # XXX why is this commented out?
  3336. # if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then
  3337. # pass 42
  3338. # else
  3339. # fail 42
  3340. # fi
  3341. dotest basic2-16 "${testcvs} ci -m 'third dive' first-dir" \
  3342. "${PROG} [a-z]*: Examining first-dir
  3343. ${PROG} [a-z]*: Examining first-dir/dir1
  3344. ${PROG} [a-z]*: Examining first-dir/dir1/dir2
  3345. RCS file: ${CVSROOT_DIRNAME}/first-dir/file14,v
  3346. done
  3347. Checking in first-dir/file14;
  3348. ${CVSROOT_DIRNAME}/first-dir/file14,v <-- file14
  3349. initial revision: 1\.1
  3350. done
  3351. Checking in first-dir/file6;
  3352. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  3353. new revision: 1\.2; previous revision: 1\.1
  3354. done
  3355. Removing first-dir/file7;
  3356. ${CVSROOT_DIRNAME}/first-dir/file7,v <-- file7
  3357. new revision: delete; previous revision: 1\.1
  3358. done
  3359. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v
  3360. done
  3361. Checking in first-dir/dir1/file14;
  3362. ${CVSROOT_DIRNAME}/first-dir/dir1/file14,v <-- file14
  3363. initial revision: 1\.1
  3364. done
  3365. Checking in first-dir/dir1/file6;
  3366. ${CVSROOT_DIRNAME}/first-dir/dir1/file6,v <-- file6
  3367. new revision: 1\.2; previous revision: 1\.1
  3368. done
  3369. Removing first-dir/dir1/file7;
  3370. ${CVSROOT_DIRNAME}/first-dir/dir1/file7,v <-- file7
  3371. new revision: delete; previous revision: 1\.1
  3372. done
  3373. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v
  3374. done
  3375. Checking in first-dir/dir1/dir2/file14;
  3376. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file14,v <-- file14
  3377. initial revision: 1\.1
  3378. done
  3379. Checking in first-dir/dir1/dir2/file6;
  3380. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file6,v <-- file6
  3381. new revision: 1\.2; previous revision: 1\.1
  3382. done
  3383. Removing first-dir/dir1/dir2/file7;
  3384. ${CVSROOT_DIRNAME}/first-dir/dir1/dir2/file7,v <-- file7
  3385. new revision: delete; previous revision: 1\.1
  3386. done"
  3387. dotest basic2-17 "${testcvs} -q update first-dir" ''
  3388. dotest basic2-18 "${testcvs} tag third-dive first-dir" \
  3389. "${PROG} tag: Tagging first-dir
  3390. T first-dir/file14
  3391. T first-dir/file6
  3392. ${PROG} tag: Tagging first-dir/dir1
  3393. T first-dir/dir1/file14
  3394. T first-dir/dir1/file6
  3395. ${PROG} tag: Tagging first-dir/dir1/dir2
  3396. T first-dir/dir1/dir2/file14
  3397. T first-dir/dir1/dir2/file6"
  3398. dotest basic2-19 "echo yes | ${testcvs} release -d first-dir" \
  3399. "You have \[0\] altered files in this repository\.
  3400. Are you sure you want to release (and delete) directory .first-dir.: "
  3401. # end of third dive
  3402. dotest_fail basic2-20 "test -d first-dir" ""
  3403. # now try some rtags
  3404. # rtag HEADS
  3405. dotest basic2-21 "${testcvs} rtag rtagged-by-head first-dir" \
  3406. "${PROG} rtag: Tagging first-dir
  3407. ${PROG} rtag: Tagging first-dir/dir1
  3408. ${PROG} rtag: Tagging first-dir/dir1/dir2"
  3409. # The next test used to cause an assert failure
  3410. # something like:
  3411. # cvs: ./recurse.c:667: do_recursion: Assertion `repository != ((void *)0)' failed.
  3412. dotest basic2-21b "${testcvs} co -p -r rtagged-by-head first-dir/file6" \
  3413. "===================================================================
  3414. Checking out first-dir/file6
  3415. RCS: $CVSROOT_DIRNAME/first-dir/file6,v
  3416. VERS: 1\.2
  3417. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3418. file6
  3419. file6"
  3420. # tag by tag
  3421. dotest basic2-22 "${testcvs} rtag -r rtagged-by-head rtagged-by-tag first-dir" \
  3422. "${PROG} rtag: Tagging first-dir
  3423. ${PROG} rtag: Tagging first-dir/dir1
  3424. ${PROG} rtag: Tagging first-dir/dir1/dir2"
  3425. # tag by revision
  3426. dotest basic2-23 "${testcvs} rtag -r1.1 rtagged-by-revision first-dir" \
  3427. "${PROG} rtag: Tagging first-dir
  3428. ${PROG} rtag: Tagging first-dir/dir1
  3429. ${PROG} rtag: Tagging first-dir/dir1/dir2"
  3430. # rdiff by revision
  3431. dotest basic2-24 "${testcvs} rdiff -r1.1 -rrtagged-by-head first-dir" \
  3432. "${PROG} rdiff: Diffing first-dir
  3433. Index: first-dir/file6
  3434. diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
  3435. \*\*\* first-dir/file6:1\.1 ${DATE}
  3436. --- first-dir/file6 ${DATE}
  3437. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3438. \*\*\* 1 \*\*\*\*
  3439. --- 1,2 ----
  3440. file6
  3441. ${PLUS} file6
  3442. Index: first-dir/file7
  3443. diff -c first-dir/file7:1\.1 first-dir/file7:removed
  3444. \*\*\* first-dir/file7:1.1 ${DATE}
  3445. --- first-dir/file7 ${DATE}
  3446. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3447. \*\*\* 1 \*\*\*\*
  3448. - file7
  3449. --- 0 ----
  3450. ${PROG} rdiff: Diffing first-dir/dir1
  3451. Index: first-dir/dir1/file6
  3452. diff -c first-dir/dir1/file6:1\.1 first-dir/dir1/file6:1\.2
  3453. \*\*\* first-dir/dir1/file6:1\.1 ${DATE}
  3454. --- first-dir/dir1/file6 ${DATE}
  3455. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3456. \*\*\* 1 \*\*\*\*
  3457. --- 1,2 ----
  3458. file6
  3459. ${PLUS} file6
  3460. Index: first-dir/dir1/file7
  3461. diff -c first-dir/dir1/file7:1\.1 first-dir/dir1/file7:removed
  3462. \*\*\* first-dir/dir1/file7:1\.1 ${DATE}
  3463. --- first-dir/dir1/file7 ${DATE}
  3464. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3465. \*\*\* 1 \*\*\*\*
  3466. - file7
  3467. --- 0 ----
  3468. ${PROG} rdiff: Diffing first-dir/dir1/dir2
  3469. Index: first-dir/dir1/dir2/file6
  3470. diff -c first-dir/dir1/dir2/file6:1\.1 first-dir/dir1/dir2/file6:1\.2
  3471. \*\*\* first-dir/dir1/dir2/file6:1\.1 ${DATE}
  3472. --- first-dir/dir1/dir2/file6 ${DATE}
  3473. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3474. \*\*\* 1 \*\*\*\*
  3475. --- 1,2 ----
  3476. file6
  3477. ${PLUS} file6
  3478. Index: first-dir/dir1/dir2/file7
  3479. diff -c first-dir/dir1/dir2/file7:1\.1 first-dir/dir1/dir2/file7:removed
  3480. \*\*\* first-dir/dir1/dir2/file7:1\.1 ${DATE}
  3481. --- first-dir/dir1/dir2/file7 ${DATE}
  3482. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3483. \*\*\* 1 \*\*\*\*
  3484. - file7
  3485. --- 0 ----"
  3486. dotest basic2-24a "${testcvs} rdiff -l -r1.1 -rrtagged-by-head first-dir" \
  3487. "${PROG} rdiff: Diffing first-dir
  3488. Index: first-dir/file6
  3489. diff -c first-dir/file6:1\.1 first-dir/file6:1\.2
  3490. \*\*\* first-dir/file6:1\.1 ${DATE}
  3491. --- first-dir/file6 ${DATE}
  3492. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3493. \*\*\* 1 \*\*\*\*
  3494. --- 1,2 ----
  3495. file6
  3496. ${PLUS} file6
  3497. Index: first-dir/file7
  3498. diff -c first-dir/file7:1\.1 first-dir/file7:removed
  3499. \*\*\* first-dir/file7:1.1 ${DATE}
  3500. --- first-dir/file7 ${DATE}
  3501. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  3502. \*\*\* 1 \*\*\*\*
  3503. - file7
  3504. --- 0 ----"
  3505. # now export by rtagged-by-head and rtagged-by-tag and compare.
  3506. dotest basic2-25 "${testcvs} export -r rtagged-by-head -d 1dir first-dir" \
  3507. "${PROG} export: Updating 1dir
  3508. U 1dir/file14
  3509. U 1dir/file6
  3510. ${PROG} export: Updating 1dir/dir1
  3511. U 1dir/dir1/file14
  3512. U 1dir/dir1/file6
  3513. ${PROG} export: Updating 1dir/dir1/dir2
  3514. U 1dir/dir1/dir2/file14
  3515. U 1dir/dir1/dir2/file6"
  3516. dotest_fail basic2-25a "test -d 1dir/CVS"
  3517. dotest_fail basic2-25b "test -d 1dir/dir1/CVS"
  3518. dotest_fail basic2-25c "test -d 1dir/dir1/dir2/CVS"
  3519. dotest basic2-26 "${testcvs} export -r rtagged-by-tag first-dir" \
  3520. "${PROG} export: Updating first-dir
  3521. U first-dir/file14
  3522. U first-dir/file6
  3523. ${PROG} export: Updating first-dir/dir1
  3524. U first-dir/dir1/file14
  3525. U first-dir/dir1/file6
  3526. ${PROG} export: Updating first-dir/dir1/dir2
  3527. U first-dir/dir1/dir2/file14
  3528. U first-dir/dir1/dir2/file6"
  3529. dotest_fail basic2-26a "test -d first-dir/CVS"
  3530. dotest_fail basic2-26b "test -d first-dir/dir1/CVS"
  3531. dotest_fail basic2-26c "test -d first-dir/dir1/dir2/CVS"
  3532. dotest basic2-27 "directory_cmp 1dir first-dir"
  3533. rm -r 1dir first-dir
  3534. # checkout by revision vs export by rtagged-by-revision and compare.
  3535. mkdir export-dir
  3536. dotest basic2-28 "${testcvs} export -rrtagged-by-revision -d export-dir first-dir" \
  3537. "${PROG} export: Updating export-dir
  3538. U export-dir/file14
  3539. U export-dir/file6
  3540. U export-dir/file7
  3541. ${PROG} export: Updating export-dir/dir1
  3542. U export-dir/dir1/file14
  3543. U export-dir/dir1/file6
  3544. U export-dir/dir1/file7
  3545. ${PROG} export: Updating export-dir/dir1/dir2
  3546. U export-dir/dir1/dir2/file14
  3547. U export-dir/dir1/dir2/file6
  3548. U export-dir/dir1/dir2/file7"
  3549. dotest_fail basic2-28a "test -d export-dir/CVS"
  3550. dotest_fail basic2-28b "test -d export-dir/dir1/CVS"
  3551. dotest_fail basic2-28c "test -d export-dir/dir1/dir2/CVS"
  3552. dotest basic2-29 "${testcvs} co -r1.1 first-dir" \
  3553. "${PROG} checkout: Updating first-dir
  3554. U first-dir/file14
  3555. U first-dir/file6
  3556. U first-dir/file7
  3557. ${PROG} checkout: Updating first-dir/dir1
  3558. U first-dir/dir1/file14
  3559. U first-dir/dir1/file6
  3560. U first-dir/dir1/file7
  3561. ${PROG} checkout: Updating first-dir/dir1/dir2
  3562. U first-dir/dir1/dir2/file14
  3563. U first-dir/dir1/dir2/file6
  3564. U first-dir/dir1/dir2/file7"
  3565. # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
  3566. mkdir first-dir.cpy ; (cd first-dir ; tar cf - . | (cd ../first-dir.cpy ; tar xf -))
  3567. dotest basic2-30 "directory_cmp first-dir export-dir"
  3568. # interrupt, while we've got a clean 1.1 here, let's import it
  3569. # into a couple of other modules.
  3570. cd export-dir
  3571. dotest_sort basic2-31 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
  3572. "
  3573. N second-dir/dir1/dir2/file14
  3574. N second-dir/dir1/dir2/file6
  3575. N second-dir/dir1/dir2/file7
  3576. N second-dir/dir1/file14
  3577. N second-dir/dir1/file6
  3578. N second-dir/dir1/file7
  3579. N second-dir/file14
  3580. N second-dir/file6
  3581. N second-dir/file7
  3582. No conflicts created by this import
  3583. ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1
  3584. ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/dir1/dir2"
  3585. cd ..
  3586. dotest basic2-32 "${testcvs} export -r HEAD second-dir" \
  3587. "${PROG} export: Updating second-dir
  3588. U second-dir/file14
  3589. U second-dir/file6
  3590. U second-dir/file7
  3591. ${PROG} export: Updating second-dir/dir1
  3592. U second-dir/dir1/file14
  3593. U second-dir/dir1/file6
  3594. U second-dir/dir1/file7
  3595. ${PROG} export: Updating second-dir/dir1/dir2
  3596. U second-dir/dir1/dir2/file14
  3597. U second-dir/dir1/dir2/file6
  3598. U second-dir/dir1/dir2/file7"
  3599. dotest basic2-33 "directory_cmp first-dir second-dir"
  3600. rm -r second-dir
  3601. rm -r export-dir first-dir
  3602. mkdir first-dir
  3603. (cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
  3604. # update the top, cancelling sticky tags, retag, update other copy, compare.
  3605. cd first-dir
  3606. dotest basic2-34 "${testcvs} update -A -l *file*" \
  3607. "[UP] file6
  3608. ${PROG} update: file7 is no longer in the repository"
  3609. # If we don't delete the tag first, cvs won't retag it.
  3610. # This would appear to be a feature.
  3611. dotest basic2-35 "${testcvs} tag -l -d rtagged-by-revision" \
  3612. "${PROG} tag: Untagging \.
  3613. D file14
  3614. D file6"
  3615. dotest basic2-36 "${testcvs} tag -l rtagged-by-revision" \
  3616. "${PROG} tag: Tagging \.
  3617. T file14
  3618. T file6"
  3619. cd ..
  3620. mv first-dir 1dir
  3621. mv first-dir.cpy first-dir
  3622. cd first-dir
  3623. dotest basic2-37 "${testcvs} -q diff -u" ''
  3624. dotest basic2-38 "${testcvs} update" \
  3625. "${PROG} update: Updating .
  3626. ${PROG} update: Updating dir1
  3627. ${PROG} update: Updating dir1/dir2"
  3628. cd ..
  3629. #### FIXME: is this expected to work??? Need to investigate
  3630. #### and fix or remove the test.
  3631. # dotest basic2-39 "directory_cmp 1dir first-dir"
  3632. rm -r 1dir first-dir
  3633. # Test the cvs history command.
  3634. # The reason that there are two patterns rather than using
  3635. # \(${TESTDIR}\|<remote>\) is that we are trying to
  3636. # make this portable. Perhaps at some point we should
  3637. # ditch that notion and require GNU expr (or dejagnu or....)
  3638. # since it seems to be so painful.
  3639. # why are there two lines at the end of the local output
  3640. # which don't exist in the remote output? would seem to be
  3641. # a CVS bug.
  3642. dotest basic2-64 "${testcvs} his -x TOFWUPCGMAR -a" \
  3643. "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= ${TESTDIR}/\*
  3644. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == ${TESTDIR}
  3645. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == ${TESTDIR}
  3646. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == ${TESTDIR}
  3647. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == ${TESTDIR}
  3648. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == ${TESTDIR}
  3649. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == ${TESTDIR}
  3650. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == ${TESTDIR}
  3651. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TESTDIR}
  3652. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir == ${TESTDIR}
  3653. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == ${TESTDIR}
  3654. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == ${TESTDIR}
  3655. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir/dir1 == ${TESTDIR}
  3656. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == ${TESTDIR}
  3657. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == ${TESTDIR}
  3658. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir/dir1/dir2 == ${TESTDIR}
  3659. F [0-9-]* [0-9:]* ${PLUS}0000 ${username} =first-dir= ${TESTDIR}/\*
  3660. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
  3661. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
  3662. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
  3663. O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= ${TESTDIR}/\*
  3664. U [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TESTDIR}/first-dir
  3665. W [0-9-]* [0-9:]* ${PLUS}0000 ${username} file7 first-dir == ${TESTDIR}/first-dir" \
  3666. "O [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= <remote>/\*
  3667. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == <remote>
  3668. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == <remote>
  3669. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == <remote>
  3670. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == <remote>
  3671. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == <remote>
  3672. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == <remote>
  3673. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == <remote>
  3674. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == <remote>
  3675. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir == <remote>
  3676. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == <remote>
  3677. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == <remote>
  3678. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir/dir1 == <remote>
  3679. A [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == <remote>
  3680. M [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == <remote>
  3681. R [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir/dir1/dir2 == <remote>
  3682. F [0-9-]* [0-9:]* ${PLUS}0000 ${username} =first-dir= <remote>/\*
  3683. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
  3684. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
  3685. T [0-9-]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
  3686. O [0-9-]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= <remote>/\*
  3687. P [0-9-]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == <remote>
  3688. W [0-9-]* [0-9:]* ${PLUS}0000 ${username} file7 first-dir == <remote>"
  3689. rm -rf ${CVSROOT_DIRNAME}/first-dir
  3690. rm -rf ${CVSROOT_DIRNAME}/second-dir
  3691. ;;
  3692. parseroot)
  3693. mkdir 1; cd 1
  3694. # Test odd cases involving CVSROOT. At the moment, that means we
  3695. # are testing roots with '/'s on the end, which CVS should parse off.
  3696. CVSROOT_save=${CVSROOT}
  3697. CVSROOT="${CVSROOT}/////"
  3698. dotest parseroot-1 "${testcvs} -q co CVSROOT/modules" \
  3699. "U CVSROOT/modules"
  3700. dotest parseroot-2 "${testcvs} -q ci -fmnull-change CVSROOT/modules" \
  3701. "Checking in CVSROOT/modules;
  3702. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  3703. new revision: 1\.2; previous revision: 1\.1
  3704. done
  3705. ${PROG} commit: Rebuilding administrative file database"
  3706. if $remote; then
  3707. # I only test these when testing remote in case CVS was compiled
  3708. # without client support.
  3709. # logout does not try to contact the server.
  3710. CVSROOT=":pserver;proxy=localhost;proxyport=8080:localhost/dev/null"
  3711. dotest parseroot-3r "$testcvs -d'$CVSROOT' logout" \
  3712. "$PROG logout: WARNING: Ignoring method options found in CVSROOT: \`proxy=localhost;proxyport=8080'\.
  3713. $PROG logout: Use CVS version 1\.12\.7 or later to handle method options\.
  3714. Logging out of :pserver:$username@localhost:2401/dev/null
  3715. $PROG logout: warning: failed to open $HOME/\.cvspass for reading: No such file or directory
  3716. $PROG logout: Entry not found\."
  3717. fi
  3718. if $keep; then
  3719. echo Keeping $TESTDIR and exiting due to --keep
  3720. exit 0
  3721. fi
  3722. CVSROOT=$CVSROOT_save
  3723. cd ..
  3724. rm -r 1
  3725. ;;
  3726. files)
  3727. # Test of how we specify files on the command line
  3728. # (recurse.c and that sort of thing). Vaguely similar to
  3729. # tests like basic* and deep. See modules and such tests
  3730. # for what happens when we throw in modules and co -d, &c.
  3731. # This particular test is fairly carefully crafted, to spot
  3732. # one particular issue with remote.
  3733. mkdir 1; cd 1
  3734. dotest files-1 "${testcvs} -q co -l ." ""
  3735. mkdir first-dir
  3736. dotest files-2 "${testcvs} add first-dir" \
  3737. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  3738. cd first-dir
  3739. touch tfile
  3740. dotest files-3 "${testcvs} add tfile" \
  3741. "${PROG} add: scheduling file .tfile. for addition
  3742. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3743. dotest files-4 "${testcvs} -q ci -m add" \
  3744. "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
  3745. done
  3746. Checking in tfile;
  3747. ${CVSROOT_DIRNAME}/first-dir/tfile,v <-- tfile
  3748. initial revision: 1\.1
  3749. done"
  3750. dotest files-5 "${testcvs} -q tag -b C" "T tfile"
  3751. dotest files-6 "$testcvs -q update -r C" "U tfile"
  3752. mkdir dir
  3753. dotest files-7 "${testcvs} add dir" \
  3754. "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository
  3755. --> Using per-directory sticky tag .C'"
  3756. cd dir
  3757. touch .file
  3758. dotest files-6 "${testcvs} add .file" \
  3759. "${PROG} add: scheduling file .\.file' for addition on branch .C.
  3760. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3761. mkdir sdir
  3762. dotest files-7 "${testcvs} add sdir" \
  3763. "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir added to the repository
  3764. --> Using per-directory sticky tag .C'"
  3765. cd sdir
  3766. mkdir ssdir
  3767. dotest files-8 "${testcvs} add ssdir" \
  3768. "Directory ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir added to the repository
  3769. --> Using per-directory sticky tag .C'"
  3770. cd ssdir
  3771. touch .file
  3772. dotest files-9 "${testcvs} add .file" \
  3773. "${PROG} add: scheduling file .\.file' for addition on branch .C.
  3774. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3775. cd ../..
  3776. dotest files-10 "${testcvs} -q ci -m test" \
  3777. "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v
  3778. done
  3779. Checking in \.file;
  3780. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file
  3781. new revision: 1\.1\.2\.1; previous revision: 1\.1
  3782. done
  3783. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v
  3784. done
  3785. Checking in sdir/ssdir/\.file;
  3786. ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file
  3787. new revision: 1\.1\.2\.1; previous revision: 1\.1
  3788. done"
  3789. dotest files-11 \
  3790. "${testcvs} commit -m test -f ./.file ./sdir/ssdir/.file" \
  3791. "Checking in \.file;
  3792. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file
  3793. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  3794. done
  3795. Checking in \./sdir/ssdir/\.file;
  3796. ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file
  3797. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  3798. done"
  3799. if $remote; then
  3800. # FIXCVS:
  3801. # This is a bug, looks like that toplevel_repos cruft in
  3802. # client.c is coming back to haunt us.
  3803. # May want to think about the whole issue, toplevel_repos
  3804. # has always been crufty and trying to patch it up again
  3805. # might be a mistake.
  3806. dotest files-12 \
  3807. "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
  3808. "Checking in \./sdir/ssdir/\.file;
  3809. ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file
  3810. new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
  3811. done"
  3812. # Sync up the version numbers so that the rest of the
  3813. # tests don't need to expect different numbers based
  3814. # local or remote.
  3815. dotest files-12-workaround \
  3816. "${testcvs} commit -f -m test .file" \
  3817. "Checking in \.file;
  3818. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file
  3819. new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
  3820. done"
  3821. else
  3822. dotest files-12 \
  3823. "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \
  3824. "Checking in \./sdir/ssdir/\.file;
  3825. ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file
  3826. new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
  3827. done
  3828. Checking in \.file;
  3829. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file
  3830. new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2
  3831. done"
  3832. fi
  3833. dotest files-13 \
  3834. "${testcvs} commit -fmtest ./sdir/../sdir/ssdir/..///ssdir/.file" \
  3835. "Checking in \./sdir/\.\./sdir/ssdir/\.\.///ssdir/\.file;
  3836. ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file
  3837. new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
  3838. done"
  3839. if $remote; then
  3840. dotest files-14 \
  3841. "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
  3842. "Checking in \.\./\.\./first-dir/dir/\.file;
  3843. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- .file
  3844. new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
  3845. done"
  3846. else
  3847. dotest files-14 \
  3848. "${testcvs} commit -fmtest ../../first-dir/dir/.file" \
  3849. "Checking in \.\./\.\./first-dir/dir/\.file;
  3850. ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file
  3851. new revision: 1\.1\.2\.4; previous revision: 1\.1\.2\.3
  3852. done"
  3853. fi
  3854. cd ../../..
  3855. rm -r 1
  3856. rm -rf ${CVSROOT_DIRNAME}/first-dir
  3857. ;;
  3858. spacefiles)
  3859. # More filename tests, in particular spaces in file names.
  3860. # (it might be better to just change a few of the names in
  3861. # basica or some other test instead, always good to keep the
  3862. # testsuite concise).
  3863. mkdir 1; cd 1
  3864. dotest spacefiles-1 "${testcvs} -q co -l ." ""
  3865. touch ./-c
  3866. dotest spacefiles-2 "${testcvs} add -- -c" \
  3867. "${PROG} add: scheduling file .-c. for addition
  3868. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3869. dotest spacefiles-3 "${testcvs} -q ci -m add" \
  3870. "RCS file: ${CVSROOT_DIRNAME}/-c,v
  3871. done
  3872. Checking in -c;
  3873. ${CVSROOT_DIRNAME}/-c,v <-- -c
  3874. initial revision: 1\.1
  3875. done"
  3876. mkdir 'first dir'
  3877. dotest spacefiles-4 "${testcvs} add 'first dir'" \
  3878. "Directory ${CVSROOT_DIRNAME}/first dir added to the repository"
  3879. mkdir ./-b
  3880. dotest spacefiles-5 "${testcvs} add -- -b" \
  3881. "Directory ${CVSROOT_DIRNAME}/-b added to the repository"
  3882. cd 'first dir'
  3883. touch 'a file'
  3884. dotest spacefiles-6 "${testcvs} add 'a file'" \
  3885. "${PROG} add: scheduling file .a file. for addition
  3886. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3887. dotest spacefiles-7 "${testcvs} -q ci -m add" \
  3888. "RCS file: ${CVSROOT_DIRNAME}/first dir/a file,v
  3889. done
  3890. Checking in a file;
  3891. ${CVSROOT_DIRNAME}/first dir/a file,v <-- a file
  3892. initial revision: 1\.1
  3893. done"
  3894. dotest spacefiles-8 "${testcvs} -q tag new-tag" "T a file"
  3895. cd ../..
  3896. mkdir 2; cd 2
  3897. dotest spacefiles-10 "${testcvs} co -- -b" \
  3898. "${PROG} checkout: Updating -b"
  3899. dotest spacefiles-11 "${testcvs} -q co -- -c" "U \./-c"
  3900. rm ./-c
  3901. dotest spacefiles-13 "${testcvs} -q co 'first dir'" \
  3902. "U first dir/a file"
  3903. cd ..
  3904. mkdir 3; cd 3
  3905. dotest spacefiles-14 "${testcvs} -q co 'first dir/a file'" \
  3906. "U first dir/a file"
  3907. cd ..
  3908. rm -r 1 2 3
  3909. rm -rf "${CVSROOT_DIRNAME}/first dir"
  3910. rm -r ${CVSROOT_DIRNAME}/-b
  3911. rm -f ${CVSROOT_DIRNAME}/-c,v
  3912. ;;
  3913. commit-readonly)
  3914. mkdir 1; cd 1
  3915. module=x
  3916. : > junk
  3917. dotest commit-readonly-1 "$testcvs -Q import -m . $module X Y" ''
  3918. dotest commit-readonly-2 "$testcvs -Q co $module" ''
  3919. cd $module
  3920. file=m
  3921. # Include an rcs keyword to be expanded.
  3922. echo '$Id''$' > $file
  3923. dotest commit-readonly-3 "$testcvs add $file" \
  3924. "${PROG} add: scheduling file .$file. for addition
  3925. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3926. dotest commit-readonly-4 "$testcvs -Q ci -m . $file" \
  3927. "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
  3928. done
  3929. Checking in $file;
  3930. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  3931. initial revision: 1\.1
  3932. done"
  3933. echo line2 >> $file
  3934. # Make the file read-only.
  3935. chmod a-w $file
  3936. dotest commit-readonly-5 "$testcvs -Q ci -m . $file" \
  3937. "Checking in $file;
  3938. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  3939. new revision: 1\.2; previous revision: 1\.1
  3940. done"
  3941. cd ../..
  3942. rm -rf 1
  3943. rm -rf ${CVSROOT_DIRNAME}/$module
  3944. ;;
  3945. status)
  3946. # This tests for a bug in the status command which failed to
  3947. # notice resolved conflicts.
  3948. mkdir status; cd status
  3949. dotest status-init-1 "${testcvs} -q co -l ." ""
  3950. mkdir first-dir
  3951. dotest status-init-2 "${testcvs} add first-dir" \
  3952. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  3953. cd first-dir
  3954. echo a line >tfile
  3955. dotest status-init-3 "${testcvs} add tfile" \
  3956. "${PROG} add: scheduling file .tfile. for addition
  3957. ${PROG} add: use .${PROG} commit. to add this file permanently"
  3958. dotest status-init-4 "${testcvs} -q ci -m add" \
  3959. "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
  3960. done
  3961. Checking in tfile;
  3962. ${CVSROOT_DIRNAME}/first-dir/tfile,v <-- tfile
  3963. initial revision: 1\.1
  3964. done"
  3965. cd ..
  3966. dotest status-init-5 "${testcvs} -q co -dsecond-dir first-dir" \
  3967. "U second-dir/tfile"
  3968. cd second-dir
  3969. echo some junk >>tfile
  3970. dotest status-init-6 "${testcvs} -q ci -maline" \
  3971. "Checking in tfile;
  3972. ${CVSROOT_DIRNAME}/first-dir/tfile,v <-- tfile
  3973. new revision: 1\.2; previous revision: 1\.1
  3974. done"
  3975. cd ../first-dir
  3976. echo force a conflict >>tfile
  3977. dotest status-init-7 "${testcvs} -q up" \
  3978. "RCS file: ${CVSROOT_DIRNAME}/first-dir/tfile,v
  3979. retrieving revision 1\.1
  3980. retrieving revision 1\.2
  3981. Merging differences between 1\.1 and 1\.2 into tfile
  3982. rcsmerge: warning: conflicts during merge
  3983. ${PROG} update: conflicts found in tfile
  3984. C tfile"
  3985. # Now note our status
  3986. dotest status-1 "${testcvs} status tfile" \
  3987. "===================================================================
  3988. File: tfile Status: Unresolved Conflict
  3989. Working revision: 1\.2.*
  3990. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v
  3991. Sticky Tag: (none)
  3992. Sticky Date: (none)
  3993. Sticky Options: (none)"
  3994. # touch the file, leaving conflict markers in place
  3995. # and note our status
  3996. touch tfile
  3997. dotest status-2 "${testcvs} status tfile" \
  3998. "===================================================================
  3999. File: tfile Status: File had conflicts on merge
  4000. Working revision: 1\.2.*
  4001. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v
  4002. Sticky Tag: (none)
  4003. Sticky Date: (none)
  4004. Sticky Options: (none)"
  4005. # resolve the conflict
  4006. echo resolution >tfile
  4007. dotest status-3 "${testcvs} status tfile" \
  4008. "===================================================================
  4009. File: tfile Status: Locally Modified
  4010. Working revision: 1\.2.*
  4011. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v
  4012. Sticky Tag: (none)
  4013. Sticky Date: (none)
  4014. Sticky Options: (none)"
  4015. # Check that there are no problems just using CVS/Root too.
  4016. save_CVSROOT=$CVSROOT
  4017. unset CVSROOT
  4018. dotest status-3a "${testcvs} status tfile" \
  4019. "===================================================================
  4020. File: tfile Status: Locally Modified
  4021. Working revision: 1\.2.*
  4022. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v
  4023. Sticky Tag: (none)
  4024. Sticky Date: (none)
  4025. Sticky Options: (none)"
  4026. CVSROOT=$save_CVSROOT
  4027. export CVSROOT
  4028. # FIXCVS:
  4029. # Update is supposed to re-Register() the file when it
  4030. # finds resolved conflicts:
  4031. dotest status-4 "grep 'Result of merge' CVS/Entries" \
  4032. "/tfile/1\.2/Result of merge${PLUS}[a-zA-Z0-9 :]*//"
  4033. cd ..
  4034. mkdir fourth-dir
  4035. dotest status-init-8 "$testcvs add fourth-dir" \
  4036. "Directory $CVSROOT_DIRNAME/fourth-dir added to the repository"
  4037. cd fourth-dir
  4038. echo yet another line >t3file
  4039. dotest status-init-9 "$testcvs add t3file" \
  4040. "$PROG add: scheduling file .t3file. for addition
  4041. $PROG add: use .$PROG commit. to add this file permanently"
  4042. dotest status-init-10 "$testcvs -q ci -m add" \
  4043. "RCS file: $CVSROOT_DIRNAME/fourth-dir/t3file,v
  4044. done
  4045. Checking in t3file;
  4046. $CVSROOT_DIRNAME/fourth-dir/t3file,v <-- t3file
  4047. initial revision: 1\.1
  4048. done"
  4049. cd ../first-dir
  4050. mkdir third-dir
  4051. dotest status-init-11 "$testcvs add third-dir" \
  4052. "Directory $CVSROOT_DIRNAME/first-dir/third-dir added to the repository"
  4053. cd third-dir
  4054. echo another line >t2file
  4055. dotest status-init-12 "$testcvs add t2file" \
  4056. "$PROG add: scheduling file .t2file. for addition
  4057. $PROG add: use .$PROG commit. to add this file permanently"
  4058. dotest status-init-13 "$testcvs -q ci -m add" \
  4059. "RCS file: $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v
  4060. done
  4061. Checking in t2file;
  4062. $CVSROOT_DIRNAME/first-dir/third-dir/t2file,v <-- t2file
  4063. initial revision: 1\.1
  4064. done"
  4065. dotest status-5 "$testcvs status ../tfile" \
  4066. "===================================================================
  4067. File: tfile Status: Locally Modified
  4068. Working revision: 1\.2.*
  4069. Repository revision: 1\.2 $CVSROOT_DIRNAME/first-dir/tfile,v
  4070. Sticky Tag: (none)
  4071. Sticky Date: (none)
  4072. Sticky Options: (none)"
  4073. dotest status-6 "$testcvs status ../../fourth-dir/t3file" \
  4074. "===================================================================
  4075. File: t3file Status: Up-to-date
  4076. Working revision: 1\.1.*
  4077. Repository revision: 1\.1 $CVSROOT_DIRNAME/fourth-dir/t3file,v
  4078. Sticky Tag: (none)
  4079. Sticky Date: (none)
  4080. Sticky Options: (none)"
  4081. if $keep; then
  4082. echo Keeping $TESTDIR and exiting due to --keep
  4083. exit 0
  4084. fi
  4085. cd ../../..
  4086. rm -rf status
  4087. rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/fourth-dir
  4088. ;;
  4089. rdiff)
  4090. # Test rdiff
  4091. # XXX for now this is just the most essential test...
  4092. cd ${TESTDIR}
  4093. mkdir testimport
  4094. cd testimport
  4095. echo '$''Id$' > foo
  4096. echo '$''Name$' >> foo
  4097. echo '$''Id$' > bar
  4098. echo '$''Name$' >> bar
  4099. dotest_sort rdiff-1 \
  4100. "${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
  4101. '
  4102. N trdiff/bar
  4103. N trdiff/foo
  4104. No conflicts created by this import'
  4105. dotest rdiff-2 \
  4106. "${testcvs} co -ko trdiff" \
  4107. "${PROG} checkout: Updating trdiff
  4108. U trdiff/bar
  4109. U trdiff/foo"
  4110. cd trdiff
  4111. echo something >> foo
  4112. dotest rdiff-3 \
  4113. "${testcvs} ci -m added-something foo" \
  4114. "Checking in foo;
  4115. ${CVSROOT_DIRNAME}/trdiff/foo,v <-- foo
  4116. new revision: 1\.2; previous revision: 1\.1
  4117. done"
  4118. echo '#ident "@(#)trdiff:$''Name$:$''Id$"' > new
  4119. echo "new file" >> new
  4120. dotest rdiff-4 \
  4121. "${testcvs} add -m new-file-description new" \
  4122. "${PROG} add: scheduling file \`new' for addition
  4123. ${PROG} add: use .${PROG} commit. to add this file permanently"
  4124. dotest rdiff-5 \
  4125. "${testcvs} commit -m added-new-file new" \
  4126. "RCS file: ${CVSROOT_DIRNAME}/trdiff/new,v
  4127. done
  4128. Checking in new;
  4129. ${CVSROOT_DIRNAME}/trdiff/new,v <-- new
  4130. initial revision: 1\.1
  4131. done"
  4132. dotest rdiff-6 \
  4133. "${testcvs} tag local-v0" \
  4134. "${PROG} tag: Tagging .
  4135. T bar
  4136. T foo
  4137. T new"
  4138. dotest rdiff-7 \
  4139. "${testcvs} status -v foo" \
  4140. "===================================================================
  4141. File: foo Status: Up-to-date
  4142. Working revision: 1\.2.*
  4143. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/trdiff/foo,v
  4144. Sticky Tag: (none)
  4145. Sticky Date: (none)
  4146. Sticky Options: -ko
  4147. Existing Tags:
  4148. local-v0 (revision: 1\.2)
  4149. T1 (revision: 1\.1\.1\.1)
  4150. TRDIFF (branch: 1\.1\.1)"
  4151. cd ..
  4152. rm -r trdiff
  4153. dotest rdiff-8 \
  4154. "${testcvs} rdiff -r T1 -r local-v0 trdiff" \
  4155. "${PROG}"' rdiff: Diffing trdiff
  4156. Index: trdiff/foo
  4157. diff -c trdiff/foo:1\.1\.1\.1 trdiff/foo:1\.2
  4158. \*\*\* trdiff/foo:1\.1\.1\.1 '"${DATE}"'
  4159. --- trdiff/foo '"${DATE}"'
  4160. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4161. \*\*\* 1,2 \*\*\*\*
  4162. ! \$''Id: foo,v 1\.1\.1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$
  4163. ! \$''Name: T1 \$
  4164. --- 1,3 ----
  4165. ! \$''Id: foo,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
  4166. ! \$''Name: local-v0 \$
  4167. ! something
  4168. Index: trdiff/new
  4169. diff -c /dev/null trdiff/new:1\.1
  4170. \*\*\* /dev/null '"${DATE}"'
  4171. --- trdiff/new '"${DATE}"'
  4172. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4173. \*\*\* 0 \*\*\*\*
  4174. --- 1,2 ----
  4175. '"${PLUS}"' #ident "@(#)trdiff:\$''Name: local-v0 \$:\$''Id: new,v 1\.1 [0-9/]* [0-9:]* '"${username}"' Exp \$"
  4176. '"${PLUS}"' new file'
  4177. if $keep; then
  4178. echo Keeping ${TESTDIR} and exiting due to --keep
  4179. exit 0
  4180. fi
  4181. cd ..
  4182. rm -r testimport
  4183. rm -rf ${CVSROOT_DIRNAME}/trdiff
  4184. ;;
  4185. rdiff-short)
  4186. # Test that the short patch behaves as expected
  4187. # 1) Added file.
  4188. # 2) Removed file.
  4189. # 3) Different revision number with no difference.
  4190. # 4) Different revision number with changes.
  4191. # 5) Against trunk.
  4192. # 6) Same revision number (no difference).
  4193. mkdir rdiff-short; cd rdiff-short
  4194. mkdir abc
  4195. dotest rdiff-short-init-1 \
  4196. "${testcvs} -q import -I ! -m initial-import abc vendor initial" \
  4197. '
  4198. No conflicts created by this import'
  4199. dotest rdiff-short-init-2 "${testcvs} -q get abc" ''
  4200. cd abc
  4201. echo "abc" >file1.txt
  4202. dotest rdiff-short-init-3 "${testcvs} add file1.txt" \
  4203. "${PROG} add: scheduling file .file1\.txt' for addition
  4204. ${PROG} add: use .${PROG} commit. to add this file permanently"
  4205. dotest rdiff-short-init-4 \
  4206. "${testcvs} commit -madd-file1 file1.txt" \
  4207. "RCS file: ${CVSROOT_DIRNAME}/abc/file1\.txt,v
  4208. done
  4209. Checking in file1\.txt;
  4210. ${CVSROOT_DIRNAME}/abc/file1\.txt,v <-- file1\.txt
  4211. initial revision: 1\.1
  4212. done"
  4213. echo def >>file1.txt
  4214. dotest rdiff-short-init-5 \
  4215. "${testcvs} commit -mchange-file1 file1.txt" \
  4216. "Checking in file1\.txt;
  4217. ${CVSROOT_DIRNAME}/abc/file1\.txt,v <-- file1\.txt
  4218. new revision: 1\.2; previous revision: 1\.1
  4219. done"
  4220. echo "abc" >file1.txt
  4221. dotest rdiff-short-init-6 \
  4222. "${testcvs} commit -mrestore-file1-rev1 file1.txt" \
  4223. "Checking in file1\.txt;
  4224. ${CVSROOT_DIRNAME}/abc/file1\.txt,v <-- file1\.txt
  4225. new revision: 1\.3; previous revision: 1\.2
  4226. done"
  4227. dotest rdiff-short-init-7 \
  4228. "${testcvs} tag -r 1.1 tag1 file1.txt" \
  4229. "T file1\.txt"
  4230. dotest rdiff-short-init-8 \
  4231. "${testcvs} tag -r 1.2 tag2 file1.txt" \
  4232. "T file1\.txt"
  4233. dotest rdiff-short-init-9 \
  4234. "${testcvs} tag -r 1.3 tag3 file1.txt" \
  4235. "T file1\.txt"
  4236. echo "abc" >file2.txt
  4237. dotest rdiff-short-init-10 \
  4238. "${testcvs} add file2.txt" \
  4239. "${PROG} add: scheduling file .file2\.txt' for addition
  4240. ${PROG} add: use .${PROG} commit. to add this file permanently"
  4241. dotest rdiff-add-remove-nodiff-init-11 \
  4242. "${testcvs} commit -madd-file2 file2.txt" \
  4243. "RCS file: ${CVSROOT_DIRNAME}/abc/file2\.txt,v
  4244. done
  4245. Checking in file2\.txt;
  4246. ${CVSROOT_DIRNAME}/abc/file2\.txt,v <-- file2\.txt
  4247. initial revision: 1\.1
  4248. done"
  4249. dotest rdiff-short-init-12 \
  4250. "${testcvs} tag -r 1.1 tag4 file2.txt" \
  4251. "T file2\.txt"
  4252. dotest rdiff-short-init-13 \
  4253. "${testcvs} tag -r 1.1 tag5 file2.txt" \
  4254. "T file2\.txt"
  4255. cd ../..
  4256. rm -fr rdiff-short
  4257. # 3) Different revision number with no difference.
  4258. dotest rdiff-short-no-real-change \
  4259. "${testcvs} -q rdiff -s -r tag1 -r tag3 abc"
  4260. # 4) Different revision number with changes.
  4261. dotest rdiff-short-real-change \
  4262. "${testcvs} -q rdiff -s -r tag1 -r tag2 abc" \
  4263. 'File abc/file1.txt changed from revision 1\.1 to 1\.2'
  4264. # 1) Added file.
  4265. # 2) Removed file.
  4266. dotest_sort rdiff-short-remove-add \
  4267. "${testcvs} -q rdiff -s -r tag2 -r tag4 abc" \
  4268. 'File abc/file1\.txt is removed; tag2 revision 1\.2
  4269. File abc/file2\.txt is new; tag4 revision 1\.1'
  4270. # 6) Same revision number (no difference).
  4271. dotest rdiff-short-no-change \
  4272. "${testcvs} -q rdiff -s -r tag4 -r tag5 abc"
  4273. # 5) Against trunk.
  4274. # Check that the messages change when we diff against the trunk
  4275. # rather than a tag or date.
  4276. dotest rdiff-short-against-trunk-1 \
  4277. "${testcvs} -q rdiff -s -rtag4 abc" \
  4278. "File abc/file1\.txt is new; current revision 1\.3"
  4279. dotest rdiff-short-against-trunk-2 \
  4280. "${testcvs} -q rdiff -s -rtag2 abc" \
  4281. "File abc/file1\.txt changed from revision 1\.2 to 1\.3
  4282. File abc/file2\.txt is new; current revision 1\.1"
  4283. rm -rf ${CVSROOT_DIRNAME}/abc
  4284. ;;
  4285. rdiff2)
  4286. # Test for the segv problem reported by James Cribb
  4287. # Somewhere to work
  4288. mkdir rdiff2; cd rdiff2
  4289. # Create a module "m" with files "foo" and "d/bar"
  4290. mkdir m; cd m
  4291. echo foo >foo
  4292. mkdir d
  4293. echo bar >d/bar
  4294. dotest_sort rdiff2-1 \
  4295. "${testcvs} -q import -I ! -m initial-import m vendor initial" \
  4296. '
  4297. N m/d/bar
  4298. N m/foo
  4299. No conflicts created by this import'
  4300. cd ..
  4301. rm -r m
  4302. # Remove "foo"
  4303. dotest rdiff2-2 "${testcvs} get m" \
  4304. "${PROG} checkout: Updating m
  4305. U m/foo
  4306. ${PROG} checkout: Updating m/d
  4307. U m/d/bar"
  4308. cd m
  4309. dotest rdiff2-3 "${testcvs} rm -f foo" \
  4310. "${PROG} remove: scheduling .foo. for removal
  4311. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  4312. dotest rdiff2-4 "${testcvs} commit -m Removed foo" \
  4313. "Removing foo;
  4314. ${CVSROOT_DIRNAME}/m/foo,v <-- foo
  4315. new revision: delete; previous revision: 1\.1\.1\.1
  4316. done"
  4317. # Modify "d/bar"
  4318. echo foo >d/bar
  4319. dotest rdiff2-5 "${testcvs} commit -m Changed d/bar" \
  4320. "Checking in d/bar;
  4321. ${CVSROOT_DIRNAME}/m/d/bar,v <-- bar
  4322. new revision: 1\.2; previous revision: 1\.1
  4323. done"
  4324. # Crash before showing d/bar diffs
  4325. dotest_fail rdiff2-6 "${testcvs} rdiff -t m" \
  4326. "${PROG} rdiff: Diffing m
  4327. ${PROG} rdiff: Diffing m/d
  4328. Index: m/d/bar
  4329. diff -c m/d/bar:1\.1\.1\.1 m/d/bar:1\.2
  4330. \*\*\* m/d/bar:1\.1\.1\.1 ${DATE}
  4331. --- m/d/bar ${DATE}
  4332. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4333. \*\*\* 1 \*\*\*\*
  4334. ! bar
  4335. --- 1 ----
  4336. ! foo"
  4337. if $keep; then
  4338. echo Keeping ${TESTDIR} and exiting due to --keep
  4339. exit 0
  4340. fi
  4341. cd ../..
  4342. rm -rf rdiff2
  4343. rm -rf ${CVSROOT_DIRNAME}/m
  4344. ;;
  4345. diff)
  4346. # Various tests specific to the "cvs diff" command.
  4347. # Related tests:
  4348. # death2: -N
  4349. # rcslib: cvs diff and $Name.
  4350. # rdiff: cvs rdiff.
  4351. # diffmerge*: nuts and bolts (stuff within diff library)
  4352. mkdir 1; cd 1
  4353. dotest diff-1 "${testcvs} -q co -l ." ''
  4354. mkdir first-dir
  4355. dotest diff-2 "${testcvs} add first-dir" \
  4356. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  4357. cd first-dir
  4358. # diff is anomalous. Most CVS commands print the "nothing
  4359. # known" message (or worse yet, no message in some cases) but
  4360. # diff says "I know nothing". Shrug.
  4361. dotest_fail diff-3 "${testcvs} diff xyzpdq" \
  4362. "${PROG} diff: I know nothing about xyzpdq"
  4363. touch abc
  4364. dotest diff-4 "${testcvs} add abc" \
  4365. "${PROG} add: scheduling file .abc. for addition
  4366. ${PROG} add: use .${PROG} commit. to add this file permanently"
  4367. dotest diff-5 "${testcvs} -q ci -mtest" \
  4368. "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4369. done
  4370. Checking in abc;
  4371. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4372. initial revision: 1\.1
  4373. done"
  4374. echo "extern int gethostname ();" >abc
  4375. dotest diff-6 "${testcvs} -q ci -mtest" \
  4376. "Checking in abc;
  4377. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4378. new revision: 1\.2; previous revision: 1\.1
  4379. done"
  4380. echo "#include <winsock.h>" >abc
  4381. # check the behavior of the --ifdef=MACRO option
  4382. dotest_fail diff-7 "${testcvs} -q diff --ifdef=HAVE_WINSOCK_H" \
  4383. "Index: abc
  4384. ===================================================================
  4385. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4386. retrieving revision 1\.2
  4387. diff --ifdef HAVE_WINSOCK_H -r1\.2 abc
  4388. #ifndef HAVE_WINSOCK_H
  4389. extern int gethostname ();
  4390. #else /\* HAVE_WINSOCK_H \*/
  4391. #include <winsock\.h>
  4392. #endif /\* HAVE_WINSOCK_H \*/"
  4393. if $keep; then
  4394. echo Keeping ${TESTDIR} and exiting due to --keep
  4395. exit 0
  4396. fi
  4397. cd ../..
  4398. rm -rf ${CVSROOT_DIRNAME}/first-dir
  4399. rm -r 1
  4400. ;;
  4401. diffnl)
  4402. # Test handling of 'cvs diff' of files without newlines
  4403. mkdir 1; cd 1
  4404. dotest diffnl-000 "${testcvs} -q co -l ." ''
  4405. mkdir first-dir
  4406. dotest diffnl-001 "${testcvs} add first-dir" \
  4407. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  4408. cd first-dir
  4409. ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc
  4410. dotest diffnl-002 "${testcvs} add abc" \
  4411. "${PROG} add: scheduling file .abc. for addition
  4412. ${PROG} add: use .${PROG} commit. to add this file permanently"
  4413. dotest diffnl-003 "${testcvs} -q ci -mtest" \
  4414. "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4415. done
  4416. Checking in abc;
  4417. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4418. initial revision: 1\.1
  4419. done"
  4420. # change to line near EOF
  4421. ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nsix")}' </dev/null >abc
  4422. dotest_fail diffnl-100 "${testcvs} diff abc" \
  4423. "Index: abc
  4424. ===================================================================
  4425. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4426. retrieving revision 1\.1
  4427. diff -r1\.1 abc
  4428. 5d4
  4429. < five"
  4430. dotest_fail diffnl-101 "${testcvs} diff -u abc" \
  4431. "Index: abc
  4432. ===================================================================
  4433. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4434. retrieving revision 1\.1
  4435. diff -u -r1\.1 abc
  4436. --- abc ${RFCDATE} 1\.1
  4437. +++ abc ${RFCDATE}
  4438. @@ -2,5 +2,4 @@
  4439. two
  4440. three
  4441. four
  4442. -five
  4443. six
  4444. \\\\ No newline at end of file"
  4445. dotest diffnl-102 "${testcvs} -q ci -mtest abc" \
  4446. "Checking in abc;
  4447. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4448. new revision: 1\.2; previous revision: 1\.1
  4449. done"
  4450. # Change to last line
  4451. ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
  4452. dotest_fail diffnl-200 "${testcvs} diff abc" \
  4453. "Index: abc
  4454. ===================================================================
  4455. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4456. retrieving revision 1\.2
  4457. diff -r1\.2 abc
  4458. 5c5
  4459. < six
  4460. \\\\ No newline at end of file
  4461. ---
  4462. > seven
  4463. \\\\ No newline at end of file"
  4464. dotest_fail diffnl-201 "${testcvs} diff -u abc" \
  4465. "Index: abc
  4466. ===================================================================
  4467. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4468. retrieving revision 1\.2
  4469. diff -u -r1\.2 abc
  4470. --- abc ${RFCDATE} 1\.2
  4471. +++ abc ${RFCDATE}
  4472. @@ -2,4 +2,4 @@
  4473. two
  4474. three
  4475. four
  4476. -six
  4477. \\\\ No newline at end of file
  4478. +seven
  4479. \\\\ No newline at end of file"
  4480. dotest diffnl-202 "${testcvs} ci -mtest abc" \
  4481. "Checking in abc;
  4482. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4483. new revision: 1\.3; previous revision: 1\.2
  4484. done"
  4485. # Addition of newline
  4486. echo "one
  4487. two
  4488. three
  4489. four
  4490. seven" > abc
  4491. dotest_fail diffnl-300 "${testcvs} diff abc" \
  4492. "Index: abc
  4493. ===================================================================
  4494. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4495. retrieving revision 1\.3
  4496. diff -r1\.3 abc
  4497. 5c5
  4498. < seven
  4499. \\\\ No newline at end of file
  4500. ---
  4501. > seven"
  4502. dotest_fail diffnl-301 "${testcvs} diff -u abc" \
  4503. "Index: abc
  4504. ===================================================================
  4505. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4506. retrieving revision 1\.3
  4507. diff -u -r1\.3 abc
  4508. --- abc ${RFCDATE} 1\.3
  4509. +++ abc ${RFCDATE}
  4510. @@ -2,4 +2,4 @@
  4511. two
  4512. three
  4513. four
  4514. -seven
  4515. \\\\ No newline at end of file
  4516. +seven"
  4517. dotest diffnl-302 "${testcvs} ci -mtest abc" \
  4518. "Checking in abc;
  4519. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  4520. new revision: 1\.4; previous revision: 1\.3
  4521. done"
  4522. # Removal of newline
  4523. ${AWK} 'BEGIN {printf("one\ntwo\nthree\nfour\nseven")}' </dev/null >abc
  4524. dotest_fail diffnl-400 "${testcvs} diff abc" \
  4525. "Index: abc
  4526. ===================================================================
  4527. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4528. retrieving revision 1\.4
  4529. diff -r1\.4 abc
  4530. 5c5
  4531. < seven
  4532. ---
  4533. > seven
  4534. \\\\ No newline at end of file"
  4535. dotest_fail diffnl-401 "${testcvs} diff -u abc" \
  4536. "Index: abc
  4537. ===================================================================
  4538. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  4539. retrieving revision 1\.4
  4540. diff -u -r1\.4 abc
  4541. --- abc ${RFCDATE} 1\.4
  4542. +++ abc ${RFCDATE}
  4543. @@ -2,4 +2,4 @@
  4544. two
  4545. three
  4546. four
  4547. -seven
  4548. +seven
  4549. \\\\ No newline at end of file"
  4550. cd ../..
  4551. rm -r 1
  4552. rm -rf ${CVSROOT_DIRNAME}/first-dir
  4553. ;;
  4554. death)
  4555. # next dive. test death support.
  4556. # NOTE: this section has reached the size and
  4557. # complexity where it is getting to be a good idea to
  4558. # add new death support tests to a new section rather
  4559. # than continuing to piggyback them onto the tests here.
  4560. mkdir ${CVSROOT_DIRNAME}/first-dir
  4561. if ${CVS} co first-dir ; then
  4562. pass 65
  4563. else
  4564. fail 65
  4565. fi
  4566. cd first-dir
  4567. # Create a directory with only dead files, to make sure CVS
  4568. # doesn't get confused by it.
  4569. mkdir subdir
  4570. dotest 65a0 "${testcvs} add subdir" \
  4571. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
  4572. cd subdir
  4573. echo file in subdir >sfile
  4574. dotest 65a1 "${testcvs} add sfile" \
  4575. "${PROG}"' add: scheduling file `sfile'\'' for addition
  4576. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  4577. dotest 65a2 "${testcvs} -q ci -m add-it" \
  4578. "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
  4579. done
  4580. Checking in sfile;
  4581. ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v <-- sfile
  4582. initial revision: 1\.1
  4583. done"
  4584. rm sfile
  4585. dotest 65a3 "${testcvs} rm sfile" \
  4586. "${PROG}"' remove: scheduling `sfile'\'' for removal
  4587. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
  4588. dotest 65a4 "${testcvs} -q ci -m remove-it" \
  4589. "Removing sfile;
  4590. ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v <-- sfile
  4591. new revision: delete; previous revision: 1\.1
  4592. done"
  4593. cd ..
  4594. dotest 65a5 "${testcvs} -q update -P" ''
  4595. dotest_fail 65a6 "test -d subdir" ''
  4596. # add a file.
  4597. touch file1
  4598. if ${CVS} add file1 2>> ${LOGFILE}; then
  4599. pass 66
  4600. else
  4601. fail 66
  4602. fi
  4603. # commit
  4604. if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
  4605. pass 67
  4606. else
  4607. fail 67
  4608. fi
  4609. # remove
  4610. rm file1
  4611. if ${CVS} rm file1 2>> ${LOGFILE}; then
  4612. pass 68
  4613. else
  4614. fail 68
  4615. fi
  4616. # commit
  4617. if ${CVS} ci -m test >>${LOGFILE} ; then
  4618. pass 69
  4619. else
  4620. fail 69
  4621. fi
  4622. dotest_fail 69a0 "test -f file1" ''
  4623. # get the old contents of file1 back
  4624. if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
  4625. pass 69a1
  4626. else
  4627. fail 69a1
  4628. fi
  4629. dotest 69a2 "cat file1" ''
  4630. # create second file
  4631. touch file2
  4632. if ${CVS} add file1 file2 2>> ${LOGFILE}; then
  4633. pass 70
  4634. else
  4635. fail 70
  4636. fi
  4637. # commit
  4638. if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
  4639. pass 71
  4640. else
  4641. fail 71
  4642. fi
  4643. # log
  4644. if ${CVS} log file1 >> ${LOGFILE}; then
  4645. pass 72
  4646. else
  4647. fail 72
  4648. fi
  4649. # file4 will be dead at the time of branching and stay dead.
  4650. echo file4 > file4
  4651. dotest death-file4-add "${testcvs} add file4" \
  4652. "${PROG}"' add: scheduling file `file4'\'' for addition
  4653. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  4654. dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
  4655. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  4656. done
  4657. Checking in file4;
  4658. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  4659. initial revision: 1\.1
  4660. done"
  4661. rm file4
  4662. dotest death-file4-rm "${testcvs} remove file4" \
  4663. "${PROG}"' remove: scheduling `file4'\'' for removal
  4664. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
  4665. dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
  4666. "Removing file4;
  4667. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  4668. new revision: delete; previous revision: 1\.1
  4669. done"
  4670. # Tag the branchpoint.
  4671. dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
  4672. T file2'
  4673. # branch1
  4674. if ${CVS} tag -b branch1 ; then
  4675. pass 73
  4676. else
  4677. fail 73
  4678. fi
  4679. # and move to the branch.
  4680. if ${CVS} update -r branch1 ; then
  4681. pass 74
  4682. else
  4683. fail 74
  4684. fi
  4685. dotest_fail death-file4-3 "test -f file4" ''
  4686. # add a file in the branch
  4687. echo line1 from branch1 >> file3
  4688. if ${CVS} add file3 2>> ${LOGFILE}; then
  4689. pass 75
  4690. else
  4691. fail 75
  4692. fi
  4693. # commit
  4694. if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
  4695. pass 76
  4696. else
  4697. fail 76
  4698. fi
  4699. dotest death-76a0 \
  4700. "${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
  4701. "Index: first-dir/file3
  4702. diff -c /dev/null first-dir/file3:1\.1\.2\.1
  4703. \*\*\* /dev/null ${DATE}
  4704. --- first-dir/file3 ${DATE}
  4705. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4706. \*\*\* 0 \*\*\*\*
  4707. --- 1 ----
  4708. ${PLUS} line1 from branch1"
  4709. dotest death-76a1 \
  4710. "${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
  4711. "Index: first-dir/file3
  4712. diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
  4713. \*\*\* first-dir/file3:1\.1\.2\.1 ${DATE}
  4714. --- first-dir/file3 ${DATE}
  4715. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4716. \*\*\* 1 \*\*\*\*
  4717. - line1 from branch1
  4718. --- 0 ----"
  4719. # remove
  4720. rm file3
  4721. if ${CVS} rm file3 2>> ${LOGFILE}; then
  4722. pass 77
  4723. else
  4724. fail 77
  4725. fi
  4726. # commit
  4727. if ${CVS} ci -m test >>${LOGFILE} ; then
  4728. pass 78
  4729. else
  4730. fail 78
  4731. fi
  4732. # add again
  4733. echo line1 from branch1 >> file3
  4734. if ${CVS} add file3 2>> ${LOGFILE}; then
  4735. pass 79
  4736. else
  4737. fail 79
  4738. fi
  4739. # commit
  4740. if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
  4741. pass 80
  4742. else
  4743. fail 80
  4744. fi
  4745. # change the first file
  4746. echo line2 from branch1 >> file1
  4747. # commit
  4748. if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
  4749. pass 81
  4750. else
  4751. fail 81
  4752. fi
  4753. # remove the second
  4754. rm file2
  4755. if ${CVS} rm file2 2>> ${LOGFILE}; then
  4756. pass 82
  4757. else
  4758. fail 82
  4759. fi
  4760. # commit
  4761. if ${CVS} ci -m test >>${LOGFILE}; then
  4762. pass 83
  4763. else
  4764. fail 83
  4765. fi
  4766. # back to the trunk.
  4767. if ${CVS} update -A 2>> ${LOGFILE}; then
  4768. pass 84
  4769. else
  4770. fail 84
  4771. fi
  4772. dotest_fail death-file4-4 "test -f file4" ''
  4773. if test -f file3 ; then
  4774. fail 85
  4775. else
  4776. pass 85
  4777. fi
  4778. # join
  4779. dotest 86 "${testcvs} -q update -j branch1" \
  4780. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  4781. retrieving revision 1\.3
  4782. retrieving revision 1\.3\.2\.1
  4783. Merging differences between 1\.3 and 1\.3\.2\.1 into file1
  4784. ${PROG} update: scheduling file2 for removal
  4785. U file3"
  4786. dotest_fail death-file4-5 "test -f file4" ''
  4787. if test -f file3 ; then
  4788. pass 87
  4789. else
  4790. fail 87
  4791. fi
  4792. # Make sure that we joined the correct change to file1
  4793. if echo line2 from branch1 | cmp - file1 >/dev/null; then
  4794. pass 87a
  4795. else
  4796. fail 87a
  4797. fi
  4798. # update
  4799. if ${CVS} update ; then
  4800. pass 88
  4801. else
  4802. fail 88
  4803. fi
  4804. # commit
  4805. dotest 89 "${testcvs} -q ci -m test" \
  4806. "Checking in file1;
  4807. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  4808. new revision: 1\.4; previous revision: 1\.3
  4809. done
  4810. Removing file2;
  4811. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  4812. new revision: delete; previous revision: 1\.1
  4813. done
  4814. Checking in file3;
  4815. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  4816. new revision: 1\.2; previous revision: 1\.1
  4817. done"
  4818. cd ..
  4819. mkdir 2
  4820. cd 2
  4821. dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
  4822. U first-dir/file3'
  4823. cd ..
  4824. rm -r 2
  4825. cd first-dir
  4826. # remove first file.
  4827. rm file1
  4828. if ${CVS} rm file1 2>> ${LOGFILE}; then
  4829. pass 90
  4830. else
  4831. fail 90
  4832. fi
  4833. # commit
  4834. if ${CVS} ci -m test >>${LOGFILE}; then
  4835. pass 91
  4836. else
  4837. fail 91
  4838. fi
  4839. if test -f file1 ; then
  4840. fail 92
  4841. else
  4842. pass 92
  4843. fi
  4844. # typo; try to get to the branch and fail
  4845. dotest_fail 92.1a "${testcvs} update -r brnach1" \
  4846. "${PROG}"' \[update aborted\]: no such tag brnach1'
  4847. # Make sure we are still on the trunk
  4848. if test -f file1 ; then
  4849. fail 92.1b
  4850. else
  4851. pass 92.1b
  4852. fi
  4853. if test -f file3 ; then
  4854. pass 92.1c
  4855. else
  4856. fail 92.1c
  4857. fi
  4858. # back to branch1
  4859. if ${CVS} update -r branch1 2>> ${LOGFILE}; then
  4860. pass 93
  4861. else
  4862. fail 93
  4863. fi
  4864. dotest_fail death-file4-6 "test -f file4" ''
  4865. if test -f file1 ; then
  4866. pass 94
  4867. else
  4868. fail 94
  4869. fi
  4870. # and join
  4871. dotest 95 "$testcvs -q update -j HEAD" \
  4872. "$PROG update: file file1 has been removed in revision HEAD, but the destination is incompatibly modified
  4873. C file1
  4874. $PROG update: file file3 exists, but has been added in revision HEAD"
  4875. dotest_fail death-file4-7 "test -f file4" ''
  4876. # file2 should not have been recreated. It was
  4877. # deleted on the branch, and has not been modified on
  4878. # the trunk. That means that there have been no
  4879. # changes between the greatest common ancestor (the
  4880. # trunk version) and HEAD.
  4881. dotest_fail death-file2-1 "test -f file2" ''
  4882. cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  4883. ;;
  4884. death2)
  4885. # More tests of death support.
  4886. mkdir ${CVSROOT_DIRNAME}/first-dir
  4887. dotest death2-1 "${testcvs} -q co first-dir" ''
  4888. cd first-dir
  4889. # Add two files on the trunk.
  4890. echo "first revision" > file1
  4891. echo "file4 first revision" > file4
  4892. dotest death2-2 "${testcvs} add file1 file4" \
  4893. "${PROG}"' add: scheduling file `file1'\'' for addition
  4894. '"${PROG}"' add: scheduling file `file4'\'' for addition
  4895. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  4896. dotest death2-3 "${testcvs} -q commit -m add" \
  4897. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  4898. done
  4899. Checking in file1;
  4900. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  4901. initial revision: 1\.1
  4902. done
  4903. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  4904. done
  4905. Checking in file4;
  4906. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  4907. initial revision: 1\.1
  4908. done"
  4909. # Make a branch and a non-branch tag.
  4910. dotest death2-4 "${testcvs} -q tag -b branch" \
  4911. 'T file1
  4912. T file4'
  4913. dotest death2-5 "${testcvs} -q tag tag" \
  4914. 'T file1
  4915. T file4'
  4916. # Switch over to the branch.
  4917. dotest death2-6 "$testcvs -q update -r branch" \
  4918. '[UP] file1
  4919. [UP] file4'
  4920. # Delete the file on the branch.
  4921. rm file1
  4922. dotest death2-7 "${testcvs} rm file1" \
  4923. "${PROG} remove: scheduling .file1. for removal
  4924. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  4925. # Test diff of the removed file before it is committed.
  4926. dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
  4927. "${PROG} diff: file1 was removed, no comparison available"
  4928. dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
  4929. "Index: file1
  4930. ===================================================================
  4931. RCS file: file1
  4932. diff -N file1
  4933. \*\*\* file1 ${RFCDATE} [0-9.]*
  4934. --- /dev/null ${RFCDATE_EPOCH}
  4935. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4936. \*\*\* 1 \*\*\*\*
  4937. - first revision
  4938. --- 0 ----"
  4939. dotest death2-8 "${testcvs} -q ci -m removed" \
  4940. "Removing file1;
  4941. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  4942. new revision: delete; previous revision: 1\.1
  4943. done"
  4944. # Test diff of a dead file.
  4945. dotest_fail death2-diff-3 \
  4946. "${testcvs} -q diff -r1.1 -rbranch -c file1" \
  4947. "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
  4948. ${PROG} diff: No comparison available\. Pass .-N. to .${PROG} diff.${QUESTION}"
  4949. # and in reverse
  4950. dotest_fail death2-diff-3a \
  4951. "${testcvs} -q diff -rbranch -r1.1 -c file1" \
  4952. "${PROG} diff: Tag branch refers to a dead (removed) revision in file .file1.\.
  4953. ${PROG} diff: No comparison available\. Pass .-N. to .${PROG} diff.${QUESTION}"
  4954. dotest_fail death2-diff-4 \
  4955. "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
  4956. "Index: file1
  4957. ===================================================================
  4958. RCS file: file1
  4959. diff -N file1
  4960. \*\*\* file1 ${RFCDATE} [0-9.]*
  4961. --- /dev/null ${RFCDATE_EPOCH}
  4962. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4963. \*\*\* 1 \*\*\*\*
  4964. - first revision
  4965. --- 0 ----"
  4966. # and in reverse
  4967. dotest_fail death2-diff-4a \
  4968. "${testcvs} -q diff -rbranch -r1.1 -N -c file1" \
  4969. "Index: file1
  4970. ===================================================================
  4971. RCS file: file1
  4972. diff -N file1
  4973. \*\*\* /dev/null ${RFCDATE_EPOCH}
  4974. --- file1 ${RFCDATE} [0-9.]*
  4975. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4976. \*\*\* 0 \*\*\*\*
  4977. --- 1 ----
  4978. + first revision"
  4979. dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c ." \
  4980. "${PROG} diff: file1 no longer exists, no comparison available"
  4981. dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c ." \
  4982. "Index: file1
  4983. ===================================================================
  4984. RCS file: file1
  4985. diff -N file1
  4986. \*\*\* file1 [-a-zA-Z0-9: ]* [0-9.]*
  4987. --- /dev/null ${RFCDATE_EPOCH}
  4988. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  4989. \*\*\* 1 \*\*\*\*
  4990. - first revision
  4991. --- 0 ----"
  4992. # Test rdiff of a dead file.
  4993. dotest death2-rdiff-1 \
  4994. "${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
  4995. dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
  4996. "Index: first-dir/file1
  4997. diff -c first-dir/file1:1\.1 first-dir/file1:removed
  4998. \*\*\* first-dir/file1:1\.1 [a-zA-Z0-9: ]*
  4999. --- first-dir/file1 [a-zA-Z0-9: ]*
  5000. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5001. \*\*\* 1 \*\*\*\*
  5002. - first revision
  5003. --- 0 ----"
  5004. # Readd the file to the branch.
  5005. echo "second revision" > file1
  5006. dotest death2-9 "${testcvs} add file1" \
  5007. "${PROG}"' add: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
  5008. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  5009. # Test diff of the added file before it is committed.
  5010. dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
  5011. "${PROG} diff: file1 is a new entry, no comparison available"
  5012. dotest_fail death2-diff-8 "${testcvs} -q diff -N -c file1" \
  5013. "Index: file1
  5014. ===================================================================
  5015. RCS file: file1
  5016. diff -N file1
  5017. \*\*\* /dev/null ${RFCDATE_EPOCH}
  5018. --- file1 ${RFCDATE}
  5019. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5020. \*\*\* 0 \*\*\*\*
  5021. --- 1 ----
  5022. ${PLUS} second revision"
  5023. dotest death2-10 "${testcvs} -q commit -m add" \
  5024. "Checking in file1;
  5025. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5026. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  5027. done"
  5028. # Delete file4 from the branch
  5029. dotest death2-10a "${testcvs} rm -f file4" \
  5030. "${PROG} remove: scheduling .file4. for removal
  5031. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  5032. dotest death2-10b "${testcvs} -q ci -m removed" \
  5033. "Removing file4;
  5034. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  5035. new revision: delete; previous revision: 1\.1
  5036. done"
  5037. # Back to the trunk.
  5038. dotest death2-11 "${testcvs} -q update -A" \
  5039. "[UP] file1
  5040. U file4"
  5041. # Add another file on the trunk.
  5042. echo "first revision" > file2
  5043. dotest death2-12 "${testcvs} add file2" \
  5044. "${PROG}"' add: scheduling file `file2'\'' for addition
  5045. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  5046. dotest death2-13 "${testcvs} -q commit -m add" \
  5047. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  5048. done
  5049. Checking in file2;
  5050. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5051. initial revision: 1\.1
  5052. done"
  5053. # Modify file4 on the trunk.
  5054. echo "new file4 revision" > file4
  5055. dotest death2-13a "${testcvs} -q commit -m mod" \
  5056. "Checking in file4;
  5057. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  5058. new revision: 1\.2; previous revision: 1\.1
  5059. done"
  5060. # Back to the branch.
  5061. # The ``no longer in the repository'' message doesn't really
  5062. # look right to me, but that's what CVS currently prints for
  5063. # this case.
  5064. dotest death2-14 "${testcvs} -q update -r branch" \
  5065. "[UP] file1
  5066. ${PROG} update: file2 is no longer in the repository
  5067. ${PROG} update: file4 is no longer in the repository"
  5068. # Add a file on the branch with the same name.
  5069. echo "branch revision" > file2
  5070. dotest death2-15 "${testcvs} add file2" \
  5071. "${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
  5072. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  5073. dotest death2-16 "${testcvs} -q commit -m add" \
  5074. "Checking in file2;
  5075. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5076. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  5077. done"
  5078. # Add a new file on the branch.
  5079. echo "first revision" > file3
  5080. dotest death2-17 "${testcvs} add file3" \
  5081. "${PROG}"' add: scheduling file `file3'\'' for addition on branch `branch'\''
  5082. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  5083. dotest death2-18 "${testcvs} -q commit -m add" \
  5084. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  5085. done
  5086. Checking in file3;
  5087. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  5088. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5089. done"
  5090. # Test diff of a nonexistent tag
  5091. dotest_fail death2-diff-9 "${testcvs} -q diff -rtag -c file3" \
  5092. "${PROG} diff: tag tag is not in file file3"
  5093. dotest_fail death2-diff-10 "${testcvs} -q diff -rtag -N -c file3" \
  5094. "Index: file3
  5095. ===================================================================
  5096. RCS file: file3
  5097. diff -N file3
  5098. \*\*\* /dev/null ${RFCDATE_EPOCH}
  5099. --- file3 ${RFCDATE} [0-9.]*
  5100. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5101. \*\*\* 0 \*\*\*\*
  5102. --- 1 ----
  5103. ${PLUS} first revision"
  5104. dotest_fail death2-diff-11 "${testcvs} -q diff -rtag -c ." \
  5105. "Index: file1
  5106. ===================================================================
  5107. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5108. retrieving revision 1\.1
  5109. retrieving revision 1\.1\.2\.2
  5110. diff -c -r1\.1 -r1\.1\.2\.2
  5111. \*\*\* file1 ${RFCDATE} [0-9.]*
  5112. --- file1 ${RFCDATE} [0-9.]*
  5113. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5114. \*\*\* 1 \*\*\*\*
  5115. ! first revision
  5116. --- 1 ----
  5117. ! second revision
  5118. ${PROG} diff: tag tag is not in file file2
  5119. ${PROG} diff: tag tag is not in file file3
  5120. ${PROG} diff: file4 no longer exists, no comparison available"
  5121. dotest_fail death2-diff-12 "${testcvs} -q diff -rtag -c -N ." \
  5122. "Index: file1
  5123. ===================================================================
  5124. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5125. retrieving revision 1\.1
  5126. retrieving revision 1\.1\.2\.2
  5127. diff -c -r1\.1 -r1\.1\.2\.2
  5128. \*\*\* file1 ${RFCDATE} [0-9.]*
  5129. --- file1 ${RFCDATE} [0-9.]*
  5130. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5131. \*\*\* 1 \*\*\*\*
  5132. ! first revision
  5133. --- 1 ----
  5134. ! second revision
  5135. Index: file2
  5136. ===================================================================
  5137. RCS file: file2
  5138. diff -N file2
  5139. \*\*\* /dev/null ${RFCDATE_EPOCH}
  5140. --- file2 ${RFCDATE} [0-9.]*
  5141. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5142. \*\*\* 0 \*\*\*\*
  5143. --- 1 ----
  5144. ${PLUS} branch revision
  5145. Index: file3
  5146. ===================================================================
  5147. RCS file: file3
  5148. diff -N file3
  5149. \*\*\* /dev/null ${RFCDATE_EPOCH}
  5150. --- file3 ${RFCDATE} [0-9.]*
  5151. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5152. \*\*\* 0 \*\*\*\*
  5153. --- 1 ----
  5154. ${PLUS} first revision
  5155. Index: file4
  5156. ===================================================================
  5157. RCS file: file4
  5158. diff -N file4
  5159. \*\*\* file4 ${RFCDATE} [0-9.]*
  5160. --- /dev/null ${RFCDATE_EPOCH}
  5161. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5162. \*\*\* 1 \*\*\*\*
  5163. - file4 first revision
  5164. --- 0 ----"
  5165. # Switch to the nonbranch tag.
  5166. dotest death2-19 "${testcvs} -q update -r tag" \
  5167. "[UP] file1
  5168. ${PROG} update: file2 is no longer in the repository
  5169. ${PROG} update: file3 is no longer in the repository
  5170. U file4"
  5171. dotest_fail death2-20 "test -f file2"
  5172. # Make sure diff only reports appropriate files.
  5173. dotest_fail death2-diff-13 "${testcvs} -q diff -r rdiff-tag" \
  5174. "${PROG} diff: Tag rdiff-tag refers to a dead (removed) revision in file .file1.\.
  5175. ${PROG} diff: No comparison available\. Pass .-N. to .${PROG} diff.${QUESTION}"
  5176. dotest_fail death2-diff-14 "${testcvs} -q diff -r rdiff-tag -c -N" \
  5177. "Index: file1
  5178. ===================================================================
  5179. RCS file: file1
  5180. diff -N file1
  5181. \*\*\* /dev/null ${RFCDATE_EPOCH}
  5182. --- file1 ${RFCDATE} [0-9.]*
  5183. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  5184. \*\*\* 0 \*\*\*\*
  5185. --- 1 ----
  5186. ${PLUS} first revision"
  5187. # now back to the trunk
  5188. dotest death2-21 "$testcvs -q update -A" \
  5189. '[UP] file1
  5190. U file2
  5191. U file4'
  5192. # test merging with a dead file
  5193. dotest death2-22 "${testcvs} -q co first-dir" \
  5194. "U first-dir/file1
  5195. U first-dir/file2
  5196. U first-dir/file4"
  5197. cd first-dir
  5198. dotest death2-23 "${testcvs} rm -f file4" \
  5199. "${PROG} remove: scheduling .file4. for removal
  5200. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  5201. dotest death2-24 "${testcvs} -q ci -m removed file4" \
  5202. "Removing file4;
  5203. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  5204. new revision: delete; previous revision: 1\.2
  5205. done"
  5206. cd ..
  5207. echo "new stuff" >file4
  5208. dotest_fail death2-25 "${testcvs} up file4" \
  5209. "${PROG} update: conflict: file4 is modified but no longer in the repository
  5210. C file4"
  5211. cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  5212. ;;
  5213. death-rtag)
  5214. # This documents a bug in CVS that prevents rtag from tagging files
  5215. # in the Attic.
  5216. mkdir $CVSROOT_DIRNAME/death-rtag
  5217. dotest death-rtag-init-1 "$testcvs -Q co death-rtag"
  5218. cd death-rtag
  5219. echo "This is the file foo" > foo
  5220. echo "This is the file bar" > bar
  5221. dotest death-rtag-init-2 "$testcvs -Q add foo bar"
  5222. dotest death-rtag-init-3 "$testcvs -Q ci -m 'Add foo and bar.'" \
  5223. "RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v
  5224. done
  5225. Checking in bar;
  5226. $CVSROOT_DIRNAME/death-rtag/bar,v <-- bar
  5227. initial revision: 1\.[0-9]*
  5228. done
  5229. RCS file: $CVSROOT_DIRNAME/death-rtag/foo,v
  5230. done
  5231. Checking in foo;
  5232. $CVSROOT_DIRNAME/death-rtag/foo,v <-- foo
  5233. initial revision: 1\.[0-9]*
  5234. done"
  5235. dotest death-rtag-init-5 "$testcvs -Q tag -b mybranch"
  5236. dotest death-rtag-1 "$testcvs -q rtag -rmybranch willtag death-rtag"
  5237. dotest death-rtag-2 "$testcvs -Q rm -f foo"
  5238. dotest death-rtag-3 "$testcvs -Q ci -m 'Remove foo.'" \
  5239. "Removing foo;
  5240. $CVSROOT_DIRNAME/death-rtag/foo,v <-- foo
  5241. new revision: delete; previous revision: 1\.[0-9]*
  5242. done"
  5243. # commit something on the branch so that the moving tag is visible.
  5244. dotest death-rtag-3.2 "$testcvs -Q up -rmybranch"
  5245. echo some branch content >>foo
  5246. echo some branch content >>bar
  5247. dotest death-rtag-3.3 "$testcvs -Q ci -m 'Change foo.'" \
  5248. "Checking in bar;
  5249. $CVSROOT_DIRNAME/death-rtag/bar,v <-- bar
  5250. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5251. done
  5252. Checking in foo;
  5253. $CVSROOT_DIRNAME/death-rtag/Attic/foo,v <-- foo
  5254. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5255. done"
  5256. dotest death-rtag-3.4 \
  5257. "$testcvs -q rtag -rmybranch wontmove death-rtag"
  5258. dotest death-rtag-3.5 "$testcvs -q rtag -F wontmove death-rtag"
  5259. cd ..
  5260. # Removing -f below avoids this bug.
  5261. dotest death-rtag-4 "$testcvs -q rtag -frmybranch wonttag death-rtag"
  5262. # When the bug existed, `wonttag' would not have been present in
  5263. # foo,v.
  5264. #
  5265. # A second bug prevented `wontmove' from moving from the branch to
  5266. # the dead revision on the trunk (death-rtag-3.4 & death-rtag-3.5).
  5267. dotest death-rtag-5 "$testcvs -q rlog death-rtag" \
  5268. "
  5269. RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v
  5270. head: 1.[0-9]*
  5271. branch:
  5272. locks: strict
  5273. access list:
  5274. symbolic names:
  5275. wonttag: 1\.1\.2\.1
  5276. wontmove: 1\.1
  5277. willtag: 1\.1
  5278. mybranch: 1\.1.0\.2
  5279. keyword substitution: kv
  5280. $DOTSTAR
  5281. RCS file: $CVSROOT_DIRNAME/death-rtag/Attic/foo,v
  5282. head: 1.[0-9]*
  5283. branch:
  5284. locks: strict
  5285. access list:
  5286. symbolic names:
  5287. wonttag: 1\.1\.2\.1
  5288. wontmove: 1\.2
  5289. willtag: 1\.1
  5290. mybranch: 1\.1.0\.2
  5291. keyword substitution: kv
  5292. $DOTSTAR"
  5293. if $keep; then
  5294. echo Keeping $TESTDIR and exiting due to --keep
  5295. exit 0
  5296. fi
  5297. rm -r death-rtag
  5298. rm -rf $CVSROOT_DIRNAME/death-rtag
  5299. ;;
  5300. rm-update-message)
  5301. # FIXME
  5302. # local CVS prints a warning message when update notices a missing
  5303. # file and client/server CVS doesn't. These should be identical.
  5304. mkdir rm-update-message; cd rm-update-message
  5305. mkdir $CVSROOT_DIRNAME/rm-update-message
  5306. dotest rm-update-message-setup-1 "$testcvs -q co rm-update-message" ''
  5307. cd rm-update-message
  5308. file=x
  5309. echo >$file
  5310. dotest rm-update-message-setup-2 "$testcvs -q add $file" \
  5311. "${PROG} add: use .${PROG} commit. to add this file permanently"
  5312. dotest rm-update-message-setup-3 "$testcvs -q ci -mcreate $file" \
  5313. "RCS file: $CVSROOT_DIRNAME/rm-update-message/$file,v
  5314. done
  5315. Checking in $file;
  5316. $CVSROOT_DIRNAME/rm-update-message/$file,v <-- $file
  5317. initial revision: 1\.1
  5318. done"
  5319. rm $file
  5320. dotest rm-update-message-1 "$testcvs up $file" \
  5321. "${PROG} update: warning: $file was lost
  5322. U $file"
  5323. cd ../..
  5324. if $keep; then :; else
  5325. rm -rf rm-update-message
  5326. rm -rf $CVSROOT_DIRNAME/rm-update-message
  5327. fi
  5328. ;;
  5329. rmadd)
  5330. # More tests of adding and removing files.
  5331. # In particular ci -r.
  5332. # Other ci -r tests:
  5333. # * editor-9: checking in a modified file,
  5334. # where "ci -r" means a branch.
  5335. # * basica-8a1: checking in a modified file with numeric revision.
  5336. # * basica-8a2: likewise.
  5337. # * keywordlog-4: adding a new file with numeric revision.
  5338. mkdir 1; cd 1
  5339. dotest rmadd-1 "${testcvs} -q co -l ." ''
  5340. mkdir first-dir
  5341. dotest rmadd-2 "${testcvs} add first-dir" \
  5342. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  5343. cd first-dir
  5344. echo first file1 >file1
  5345. dotest rmadd-3 "${testcvs} add file1" \
  5346. "${PROG} add: scheduling file .file1. for addition
  5347. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5348. dotest_fail rmadd-4 "${testcvs} -q ci -r 1.2.2.4 -m add" \
  5349. "${PROG} commit: cannot add file .file1' with revision .1\.2\.2\.4'; must be on trunk
  5350. ${PROG} \[commit aborted\]: correct above errors first!"
  5351. dotest_fail rmadd-5 "${testcvs} -q ci -r 1.2.2 -m add" \
  5352. "${PROG} commit: cannot add file .file1' with revision .1\.2\.2'; must be on trunk
  5353. ${PROG} \[commit aborted\]: correct above errors first!"
  5354. dotest_fail rmadd-6 "${testcvs} -q ci -r mybranch -m add" \
  5355. "${PROG} \[commit aborted\]: no such tag mybranch"
  5356. # The thing with the trailing periods strikes me as a very
  5357. # bizarre behavior, but it would seem to be intentional
  5358. # (see commit.c). It probably could go away....
  5359. dotest rmadd-7 "${testcvs} -q ci -r 7.... -m add" \
  5360. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5361. done
  5362. Checking in file1;
  5363. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5364. initial revision: 7\.1
  5365. done"
  5366. if $remote; then
  5367. # I guess remote doesn't set a sticky tag in this case.
  5368. # Kind of odd, in the sense that rmadd-24a does set one
  5369. # both local and remote.
  5370. dotest_fail rmadd-7a "test -f CVS/Tag"
  5371. echo T7 >CVS/Tag
  5372. else
  5373. dotest rmadd-7a "cat CVS/Tag" "T7"
  5374. fi
  5375. dotest rmadd-8 "${testcvs} -q tag -b mybranch" "T file1"
  5376. dotest rmadd-9 "${testcvs} -q tag mynonbranch" "T file1"
  5377. touch file2
  5378. # The previous "cvs ci -r" set a sticky tag of '7'. Seems a
  5379. # bit odd, and I guess commit.c (findmaxrev) makes '7' sticky
  5380. # tags unnecessary (?). I kind of suspect that it should be
  5381. # saying "sticky tag is not a branch" like keywordlog-4b.
  5382. # Or something.
  5383. dotest rmadd-10 "${testcvs} add file2" \
  5384. "${PROG} add: scheduling file .file2. for addition on branch .7'
  5385. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5386. # As in the previous example, CVS is confused....
  5387. dotest rmadd-11 "${testcvs} -q ci -m add" \
  5388. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  5389. done
  5390. Checking in file2;
  5391. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5392. initial revision: 7\.1
  5393. done"
  5394. dotest rmadd-12 "${testcvs} -q update -A" ""
  5395. touch file3
  5396. dotest rmadd-13 "${testcvs} add file3" \
  5397. "${PROG} add: scheduling file .file3. for addition
  5398. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5399. # Huh? file2 is not up to date? Seems buggy to me....
  5400. dotest_fail rmadd-14 "${testcvs} -q ci -r mybranch -m add" \
  5401. "${PROG} commit: Up-to-date check failed for .file2'
  5402. ${PROG} \[commit aborted\]: correct above errors first!"
  5403. # Whatever, let's not let file2 distract us....
  5404. dotest rmadd-15 "${testcvs} -q ci -r mybranch -m add file3" \
  5405. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  5406. done
  5407. Checking in file3;
  5408. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  5409. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5410. done"
  5411. touch file4
  5412. dotest rmadd-16 "${testcvs} add file4" \
  5413. "${PROG} add: scheduling file .file4. for addition
  5414. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5415. # Same "Up-to-date check" issues as in rmadd-14.
  5416. # The "no such tag" thing is due to the fact that we only
  5417. # update val-tags when the tag is used (might be more of a
  5418. # bug than a feature, I dunno).
  5419. dotest_fail rmadd-17 \
  5420. "${testcvs} -q ci -r mynonbranch -m add file4" \
  5421. "${PROG} \[commit aborted\]: no such tag mynonbranch"
  5422. # Try to make CVS write val-tags.
  5423. dotest rmadd-18 "${testcvs} -q update -p -r mynonbranch file1" \
  5424. "first file1"
  5425. # Oops, -p suppresses writing val-tags (probably a questionable
  5426. # behavior).
  5427. dotest_fail rmadd-19 \
  5428. "${testcvs} -q ci -r mynonbranch -m add file4" \
  5429. "${PROG} \[commit aborted\]: no such tag mynonbranch"
  5430. # Now make CVS write val-tags for real.
  5431. dotest rmadd-20 "$testcvs -q update -r mynonbranch file1" '[UP] file1'
  5432. # Oops - CVS isn't distinguishing between a branch tag and
  5433. # a non-branch tag.
  5434. dotest rmadd-21 \
  5435. "${testcvs} -q ci -r mynonbranch -m add file4" \
  5436. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v
  5437. done
  5438. Checking in file4;
  5439. ${CVSROOT_DIRNAME}/first-dir/Attic/file4,v <-- file4
  5440. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5441. done"
  5442. # OK, we add this one in a vanilla way, but then check in
  5443. # a modification with ci -r and sniff around for sticky tags.
  5444. echo file5 >file5
  5445. dotest rmadd-22 "${testcvs} add file5" \
  5446. "${PROG} add: scheduling file .file5. for addition
  5447. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5448. if $remote; then
  5449. # Interesting bug (or missing feature) here. findmaxrev
  5450. # gets the major revision from the Entries. Well, remote
  5451. # doesn't send the entries for files which are not involved.
  5452. dotest rmadd-23r "${testcvs} -q ci -m add" \
  5453. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
  5454. done
  5455. Checking in file5;
  5456. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5457. initial revision: 1\.1
  5458. done"
  5459. dotest rmadd-23-workaroundr \
  5460. "${testcvs} -q ci -r 7 -m bump-it file5" \
  5461. "Checking in file5;
  5462. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5463. new revision: 7\.1; previous revision: 1\.1
  5464. done"
  5465. else
  5466. dotest rmadd-23 "${testcvs} -q ci -m add" \
  5467. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file5,v
  5468. done
  5469. Checking in file5;
  5470. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5471. initial revision: 7\.1
  5472. done"
  5473. fi
  5474. echo change it >file5
  5475. dotest_fail rmadd-24 "${testcvs} -q ci -r 4.8 -m change file5" \
  5476. "Checking in file5;
  5477. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5478. ${PROG} commit: ${CVSROOT_DIRNAME}/first-dir/file5,v: revision 4\.8 too low; must be higher than 7\.1
  5479. ${PROG} commit: could not check in file5"
  5480. dotest rmadd-24a "${testcvs} -q ci -r 8.4 -m change file5" \
  5481. "Checking in file5;
  5482. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5483. new revision: 8\.4; previous revision: 7\.1
  5484. done"
  5485. # I'm not really sure that a sticky tag make sense here.
  5486. # It seems to be longstanding behavior for what that is worth.
  5487. dotest rmadd-25 "${testcvs} status file5" \
  5488. "===================================================================
  5489. File: file5 Status: Up-to-date
  5490. Working revision: 8\.4.*
  5491. Repository revision: 8\.4 ${CVSROOT_DIRNAME}/first-dir/file5,v
  5492. Sticky Tag: 8\.4
  5493. Sticky Date: (none)
  5494. Sticky Options: (none)"
  5495. # now try forced revision with recursion
  5496. mkdir sub
  5497. dotest rmadd-26 "${testcvs} -q add sub" \
  5498. "Directory ${CVSROOT_DIRNAME}/first-dir/sub added to the repository"
  5499. echo hello >sub/subfile
  5500. dotest rmadd-27 "${testcvs} -q add sub/subfile" \
  5501. "${PROG} add: use .${PROG} commit. to add this file permanently"
  5502. dotest rmadd-28 "${testcvs} -q ci -m. sub" \
  5503. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v
  5504. done
  5505. Checking in sub/subfile;
  5506. ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v <-- subfile
  5507. initial revision: 1\.1
  5508. done"
  5509. # lose the branch
  5510. dotest rmadd-29 "$testcvs -q up -A" \
  5511. "[UP] file1
  5512. $PROG update: file3 is no longer in the repository
  5513. $PROG update: file4 is no longer in the repository"
  5514. # -f disables recursion
  5515. dotest rmadd-30 "${testcvs} -q ci -f -r9 -m." \
  5516. "Checking in file1;
  5517. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5518. new revision: 9\.1; previous revision: 7\.1
  5519. done
  5520. Checking in file2;
  5521. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5522. new revision: 9\.1; previous revision: 7\.1
  5523. done
  5524. Checking in file5;
  5525. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5526. new revision: 9\.1; previous revision: 8\.4
  5527. done"
  5528. # add -R to force recursion
  5529. dotest rmadd-31 "${testcvs} -q ci -f -r9 -R -m." \
  5530. "Checking in file1;
  5531. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5532. new revision: 9\.2; previous revision: 9\.1
  5533. done
  5534. Checking in file2;
  5535. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5536. new revision: 9\.2; previous revision: 9\.1
  5537. done
  5538. Checking in file5;
  5539. ${CVSROOT_DIRNAME}/first-dir/file5,v <-- file5
  5540. new revision: 9\.2; previous revision: 9\.1
  5541. done
  5542. Checking in sub/subfile;
  5543. ${CVSROOT_DIRNAME}/first-dir/sub/subfile,v <-- subfile
  5544. new revision: 9\.1; previous revision: 1\.1
  5545. done"
  5546. if $remote; then
  5547. # as noted above, remote doesn't set a sticky tag
  5548. :
  5549. else
  5550. dotest rmadd-32 "cat CVS/Tag" "T9"
  5551. dotest rmadd-33 "cat sub/CVS/Tag" "T9"
  5552. fi
  5553. cd ../..
  5554. rm -r 1
  5555. rm -rf ${CVSROOT_DIRNAME}/first-dir
  5556. ;;
  5557. rmadd2)
  5558. # Tests of undoing commits, including in the presence of
  5559. # adding and removing files. See join for a list of -j tests.
  5560. mkdir 1; cd 1
  5561. dotest rmadd2-1 "${testcvs} -q co -l ." ''
  5562. mkdir first-dir
  5563. dotest rmadd2-2 "${testcvs} add first-dir" \
  5564. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  5565. cd first-dir
  5566. echo 'initial contents' >file1
  5567. dotest rmadd2-3 "${testcvs} add file1" \
  5568. "${PROG} add: scheduling file .file1. for addition
  5569. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5570. dotest rmadd2-4 "${testcvs} -q ci -m add" \
  5571. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5572. done
  5573. Checking in file1;
  5574. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5575. initial revision: 1\.1
  5576. done"
  5577. dotest rmadd2-4a "${testcvs} -Q tag tagone" ""
  5578. dotest rmadd2-5 "${testcvs} rm -f file1" \
  5579. "${PROG} remove: scheduling .file1. for removal
  5580. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  5581. dotest rmadd2-6 "${testcvs} -q ci -m remove" \
  5582. "Removing file1;
  5583. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5584. new revision: delete; previous revision: 1\.1
  5585. done"
  5586. dotest rmadd2-7 "${testcvs} -q update -j 1.2 -j 1.1 file1" "U file1"
  5587. dotest rmadd2-8 "${testcvs} -q ci -m readd" \
  5588. "Checking in file1;
  5589. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5590. new revision: 1\.3; previous revision: 1\.2
  5591. done"
  5592. echo 'new contents' >file1
  5593. dotest rmadd2-9 "${testcvs} -q ci -m modify" \
  5594. "Checking in file1;
  5595. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5596. new revision: 1\.4; previous revision: 1\.3
  5597. done"
  5598. dotest rmadd2-10 "${testcvs} -q update -j 1.4 -j 1.3 file1" \
  5599. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5600. retrieving revision 1\.4
  5601. retrieving revision 1\.3
  5602. Merging differences between 1\.4 and 1\.3 into file1"
  5603. dotest rmadd2-11 "${testcvs} -q ci -m undo" \
  5604. "Checking in file1;
  5605. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5606. new revision: 1\.5; previous revision: 1\.4
  5607. done"
  5608. dotest rmadd2-12 "cat file1" "initial contents"
  5609. dotest rmadd2-13 "${testcvs} -q update -p -r 1.3" "initial contents"
  5610. # Hmm, might be a bit odd that this works even if 1.3 is not
  5611. # the head.
  5612. dotest rmadd2-14 "${testcvs} -q update -j 1.3 -j 1.2 file1" \
  5613. "${PROG} update: scheduling file1 for removal"
  5614. # Check that -p can get arbitrary revisions of a removed file
  5615. dotest rmadd2-14a "${testcvs} -q update -p" "initial contents"
  5616. dotest rmadd2-14b "${testcvs} -q update -p -r 1.5" "initial contents"
  5617. dotest rmadd2-14c "${testcvs} -q update -p -r 1.3" "initial contents"
  5618. dotest rmadd2-15 "${testcvs} -q ci -m re-remove" \
  5619. "Removing file1;
  5620. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5621. new revision: delete; previous revision: 1\.5
  5622. done"
  5623. dotest rmadd2-16 "${testcvs} log -h file1" "
  5624. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  5625. Working file: file1
  5626. head: 1\.6
  5627. branch:
  5628. locks: strict
  5629. access list:
  5630. symbolic names:
  5631. tagone: 1\.1
  5632. keyword substitution: kv
  5633. total revisions: 6
  5634. ============================================================================="
  5635. dotest rmadd2-17 "${testcvs} status -v file1" \
  5636. "===================================================================
  5637. File: no file file1 Status: Up-to-date
  5638. Working revision: No entry for file1
  5639. Repository revision: 1\.6 ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  5640. Existing Tags:
  5641. tagone (revision: 1.1)"
  5642. cd ../..
  5643. rm -r 1
  5644. rm -rf ${CVSROOT_DIRNAME}/first-dir
  5645. ;;
  5646. rmadd3)
  5647. # This test demonstrates that CVS notices that file1 exists rather
  5648. # that deleting or writing over it after:
  5649. #
  5650. # cvs remove -f file1; touch file1; cvs add file1.
  5651. #
  5652. # According to the manual, this should work for:
  5653. #
  5654. # rm file1; cvs remove file1; cvs add file1
  5655. #
  5656. # but in past version of CVS, new content in file1 would be
  5657. # erroneously deleted when file1 reappeared between the remove and
  5658. # the add.
  5659. #
  5660. # Later versions of CVS would refuse to perform the add, but still
  5661. # allow a subsequent local commit to erase the file from the
  5662. # workspace, possibly losing data.
  5663. mkdir 1; cd 1
  5664. dotest rmadd3-init1 "${testcvs} -q co -l ." ''
  5665. mkdir first-dir
  5666. dotest rmadd3-init2 "${testcvs} add first-dir" \
  5667. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  5668. cd first-dir
  5669. echo initial content for file1 >file1
  5670. dotest rmadd3-init3 "${testcvs} add file1" \
  5671. "${PROG} add: scheduling file \`file1' for addition
  5672. ${PROG} add: use '${PROG} commit' to add this file permanently"
  5673. dotest rmadd3-init4 "${testcvs} -q ci -m add" \
  5674. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5675. done
  5676. Checking in file1;
  5677. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5678. initial revision: 1\.1
  5679. done"
  5680. # Here begins the guts of this test, as detailed above.
  5681. dotest rmadd3-1 "${testcvs} rm -f file1" \
  5682. "${PROG} remove: scheduling \`file1' for removal
  5683. ${PROG} remove: use '${PROG} commit' to remove this file permanently"
  5684. # Now recreate the file:
  5685. echo desired future contents for file1 >file1
  5686. # And attempt to resurrect it at the same time:
  5687. dotest_fail rmadd3-2 "${testcvs} add file1" \
  5688. "${PROG} add: file1 should be removed and is still there (or is back again)"
  5689. # Now prove that commit knows that it shouldn't erase files.
  5690. dotest_fail rmadd3-3 "${testcvs} -q ci -m." \
  5691. "$PROG commit: \`file1' should be removed and is still there (or is back again)
  5692. $PROG \[commit aborted\]: correct above errors first!"
  5693. # Then these should pass too:
  5694. dotest rmadd3-4 "test -f file1"
  5695. dotest rmadd3-5 "cat file1" "desired future contents for file1"
  5696. if $keep; then
  5697. echo Keeping ${TESTDIR} and exiting due to --keep
  5698. exit 0
  5699. fi
  5700. cd ../..
  5701. rm -r 1
  5702. rm -rf ${CVSROOT_DIRNAME}/first-dir
  5703. ;;
  5704. resurrection)
  5705. # This test tests a few file resurrection scenarios.
  5706. mkdir 1; cd 1
  5707. dotest resurrection-init1 "$testcvs -q co -l ." ''
  5708. mkdir first-dir
  5709. dotest resurrection-init2 "$testcvs add first-dir" \
  5710. "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
  5711. cd first-dir
  5712. echo initial content for file1 >file1
  5713. dotest resurrection-init3 "$testcvs add file1" \
  5714. "$PROG add: scheduling file \`file1' for addition
  5715. $PROG add: use '$PROG commit' to add this file permanently"
  5716. dotest resurrection-init4 "$testcvs -q ci -m add" \
  5717. "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
  5718. done
  5719. Checking in file1;
  5720. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  5721. initial revision: 1\.1
  5722. done"
  5723. dotest resurrection-init5 "$testcvs -Q rm -f file1"
  5724. # The first test is that `cvs add' will resurrect a file before its
  5725. # removal has been committed.
  5726. dotest_sort resurrection-1 "$testcvs add file1" \
  5727. "U file1
  5728. $PROG add: file1, version 1\.1, resurrected"
  5729. dotest resurrection-2 "$testcvs -Q diff file1" ""
  5730. dotest resurrection-init6 "$testcvs -Q tag -b resurrection"
  5731. dotest resurrection-init7 "$testcvs -Q rm -f file1"
  5732. dotest resurrection-init8 "$testcvs -Q ci -mrm" \
  5733. "Removing file1;
  5734. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  5735. new revision: delete; previous revision: 1\.1
  5736. done"
  5737. # The next test is that CVS will resurrect a committed removal.
  5738. dotest_sort resurrection-3 "$testcvs add file1" \
  5739. "U file1
  5740. $PROG add: Re-adding file \`file1' (in place of dead revision 1\.2)\.
  5741. $PROG add: Resurrecting file \`file1' from revision 1\.1\.
  5742. $PROG add: use 'cvs commit' to add this file permanently"
  5743. dotest resurrection-4 "$testcvs -q diff -r1.1 file1" ""
  5744. dotest resurrection-5 "$testcvs -q ci -mreadd" \
  5745. "Checking in file1;
  5746. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  5747. new revision: 1\.3; previous revision: 1\.2
  5748. done"
  5749. dotest resurrection-init9 "$testcvs -Q up -rresurrection"
  5750. dotest resurrection-init10 "$testcvs -Q rm -f file1"
  5751. dotest resurrection-init11 "$testcvs -Q ci -mrm-on-resurrection" \
  5752. "Removing file1;
  5753. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  5754. new revision: delete; previous revision: 1\.1
  5755. done"
  5756. # The next test is that CVS will resurrect a committed removal to a
  5757. # branch.
  5758. dotest_sort resurrection-6 "$testcvs add file1" \
  5759. "U file1
  5760. $PROG add: Resurrecting file \`file1' from revision 1\.1\.
  5761. $PROG add: file \`file1' will be added on branch \`resurrection' from version 1\.1\.2\.1
  5762. $PROG add: use 'cvs commit' to add this file permanently"
  5763. dotest resurrection-7 "$testcvs -Q diff -r1.1 file1" ""
  5764. dotest resurrection-8 "$testcvs -q ci -mreadd" \
  5765. "Checking in file1;
  5766. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  5767. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  5768. done"
  5769. # The next few tests verify that an attempted resurrection of a file
  5770. # with no previous revision on the trunk fails.
  5771. touch file2
  5772. dotest resurrection-9 "$testcvs -Q add file2"
  5773. dotest resurrection-10 "$testcvs -Q ci -mnew-file2" \
  5774. "RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file2,v
  5775. done
  5776. Checking in file2;
  5777. $CVSROOT_DIRNAME/first-dir/Attic/file2,v <-- file2
  5778. new revision: 1\.1\.2\.1; previous revision: 1\.1
  5779. done"
  5780. dotest resurrection-11 "$testcvs -Q up -A"
  5781. # This command once caused an assertion failure.
  5782. dotest resurrection-12 "$testcvs add file2" \
  5783. "$PROG add: File \`file2' has no previous revision to resurrect\."
  5784. if $keep; then
  5785. echo Keeping $TESTDIR and exiting due to --keep
  5786. exit 0
  5787. fi
  5788. cd ../..
  5789. rm -r 1
  5790. rm -rf $CVSROOT_DIRNAME/first-dir
  5791. ;;
  5792. dirs)
  5793. # Tests related to removing and adding directories.
  5794. # See also:
  5795. # conflicts (especially dir1 in conflicts-130): What happens if
  5796. # directory exists in repository and a non-CVS-controlled
  5797. # directory in the working directory?
  5798. # conflicts3-15. More cases, especially where CVS directory
  5799. # exists but without CVS/Repository and friends.
  5800. # conflicts3-22. Similar to conflicts-130 but there is a file
  5801. # in the directory.
  5802. # dirs2. Sort of similar to conflicts3-22 but somewhat different.
  5803. mkdir imp-dir; cd imp-dir
  5804. echo file1 >file1
  5805. mkdir sdir
  5806. echo sfile >sdir/sfile
  5807. dotest_sort dirs-1 \
  5808. "${testcvs} import -m import-it dir1 vend rel" "
  5809. N dir1/file1
  5810. N dir1/sdir/sfile
  5811. No conflicts created by this import
  5812. ${PROG} import: Importing ${CVSROOT_DIRNAME}/dir1/sdir"
  5813. cd ..
  5814. mkdir 1; cd 1
  5815. dotest dirs-2 "${testcvs} -Q co dir1" ""
  5816. # Various CVS administrators are in the habit of removing
  5817. # the repository directory for things they don't want any
  5818. # more. I've even been known to do it myself (on rare
  5819. # occasions). Not the usual recommended practice, but we want
  5820. # to try to come up with some kind of reasonable/documented/sensible
  5821. # behavior.
  5822. rm -rf ${CVSROOT_DIRNAME}/dir1/sdir
  5823. dotest dirs-3 "${testcvs} update" \
  5824. "${PROG} update: Updating dir1
  5825. ${PROG} update: Updating dir1/sdir
  5826. ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
  5827. ${PROG} update: skipping directory dir1/sdir"
  5828. dotest dirs-3a "${testcvs} update -d" \
  5829. "${PROG} update*: Updating dir1
  5830. ${PROG} update: Updating dir1/sdir
  5831. ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
  5832. ${PROG} update: skipping directory dir1/sdir"
  5833. # If we say "yes", then CVS gives errors about not being able to
  5834. # create lock files.
  5835. # The fact that it says "skipping directory " rather than
  5836. # "skipping directory dir1/sdir" is some kind of bug.
  5837. dotest dirs-4 "echo no | ${testcvs} release -d dir1/sdir" \
  5838. "${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1/sdir: No such file or directory
  5839. ${PROG} update: skipping directory
  5840. You have \[0\] altered files in this repository\.
  5841. Are you sure you want to release (and delete) directory .dir1/sdir': .. .release' aborted by user choice."
  5842. # OK, if "cvs release" won't help, we'll try it the other way...
  5843. rm -r dir1/sdir
  5844. dotest dirs-5 "cat dir1/CVS/Entries" \
  5845. "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
  5846. D/sdir////"
  5847. dotest dirs-6 "${testcvs} update" "${PROG} update: Updating dir1"
  5848. dotest dirs-7 "cat dir1/CVS/Entries" \
  5849. "/file1/1.1.1.1/[a-zA-Z0-9 :]*//
  5850. D/sdir////"
  5851. dotest dirs-8 "${testcvs} update -d dir1" \
  5852. "${PROG} update: Updating dir1"
  5853. cd ..
  5854. rm -r imp-dir 1
  5855. # clean up our repositories
  5856. rm -rf ${CVSROOT_DIRNAME}/dir1
  5857. ;;
  5858. dirs2)
  5859. # See "dirs" for a list of tests involving adding and
  5860. # removing directories.
  5861. mkdir 1; cd 1
  5862. dotest dirs2-1 "${testcvs} -q co -l ." ''
  5863. mkdir first-dir
  5864. dotest dirs2-2 "${testcvs} add first-dir" \
  5865. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  5866. cd first-dir
  5867. mkdir sdir
  5868. dotest dirs2-3 "${testcvs} add sdir" \
  5869. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
  5870. touch sdir/file1
  5871. dotest dirs2-4 "${testcvs} add sdir/file1" \
  5872. "${PROG} add: scheduling file .sdir/file1. for addition
  5873. ${PROG} add: use .${PROG} commit. to add this file permanently"
  5874. dotest dirs2-5 "${testcvs} -q ci -m add" \
  5875. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v
  5876. done
  5877. Checking in sdir/file1;
  5878. ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v <-- file1
  5879. initial revision: 1\.1
  5880. done"
  5881. rm -r sdir/CVS
  5882. if $remote; then
  5883. # This is just like conflicts3-23
  5884. dotest_fail dirs2-6 "${testcvs} update -d" \
  5885. "${QUESTION} sdir
  5886. ${PROG} update: Updating \.
  5887. ${PROG} update: Updating sdir
  5888. ${PROG} update: move away sdir/file1; it is in the way
  5889. C sdir/file1"
  5890. rm sdir/file1
  5891. rm -r sdir/CVS
  5892. # This is where things are not just like conflicts3-23
  5893. dotest dirs2-7 "${testcvs} update -d" \
  5894. "${QUESTION} sdir
  5895. ${PROG} update: Updating \.
  5896. ${PROG} update: Updating sdir
  5897. U sdir/file1"
  5898. else
  5899. dotest dirs2-6 "${testcvs} update -d" \
  5900. "${PROG} update: Updating \.
  5901. ${QUESTION} sdir"
  5902. rm sdir/file1
  5903. dotest dirs2-7 "${testcvs} update -d" \
  5904. "${PROG} update: Updating \.
  5905. ${QUESTION} sdir"
  5906. fi
  5907. cd ../..
  5908. # Now, the same thing (more or less) on a branch.
  5909. mkdir 2; cd 2
  5910. dotest dirs2-8 "${testcvs} -q co first-dir" 'U first-dir/sdir/file1'
  5911. cd first-dir
  5912. dotest dirs2-9 "${testcvs} -q tag -b br" "T sdir/file1"
  5913. rm -r sdir/CVS
  5914. if $remote; then
  5915. # Cute little quirk of val-tags; if we don't recurse into
  5916. # the directories where the tag is defined, val-tags won't
  5917. # get updated.
  5918. dotest_fail dirs2-10 "${testcvs} update -d -r br" \
  5919. "${QUESTION} sdir
  5920. ${PROG} \[update aborted\]: no such tag br"
  5921. dotest dirs2-10ar \
  5922. "${testcvs} -q rdiff -u -r 1.1 -r br first-dir/sdir/file1"
  5923. dotest_fail dirs2-10-again "${testcvs} update -d -r br" \
  5924. "${QUESTION} sdir
  5925. ${PROG} update: Updating \.
  5926. ${PROG} update: Updating sdir
  5927. ${PROG} update: move away sdir/file1; it is in the way
  5928. C sdir/file1"
  5929. else
  5930. dotest_fail dirs2-10 "${testcvs} update -d -r br" \
  5931. "${PROG} update: in directory sdir:
  5932. ${PROG} \[update aborted\]: there is no version here; do '${PROG} checkout' first"
  5933. fi
  5934. cd ../..
  5935. # OK, the above tests make the situation somewhat harder
  5936. # than it might be, in the sense that they actually have a
  5937. # file which is alive on the branch we are updating. Let's
  5938. # try it where it is just a directory where all the files
  5939. # have been removed.
  5940. mkdir 3; cd 3
  5941. dotest dirs2-11 "${testcvs} -q co -r br first-dir" \
  5942. "U first-dir/sdir/file1"
  5943. cd first-dir
  5944. # Hmm, this doesn't mention the branch like add does. That's
  5945. # an odd non-orthogonality.
  5946. dotest dirs2-12 "${testcvs} rm -f sdir/file1" \
  5947. "${PROG} remove: scheduling .sdir/file1. for removal
  5948. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  5949. dotest dirs2-13 "${testcvs} -q ci -m remove" \
  5950. "Removing sdir/file1;
  5951. ${CVSROOT_DIRNAME}/first-dir/sdir/file1,v <-- file1
  5952. new revision: delete; previous revision: 1\.1
  5953. done"
  5954. cd ../../2/first-dir
  5955. if $remote; then
  5956. dotest dirs2-14 "${testcvs} update -d -r br" \
  5957. "${QUESTION} sdir/file1
  5958. ${PROG} update: Updating \.
  5959. ${PROG} update: Updating sdir"
  5960. else
  5961. dotest dirs2-14 "${testcvs} update -d -r br" \
  5962. "${PROG} update: Updating \.
  5963. ${QUESTION} sdir"
  5964. fi
  5965. cd ../..
  5966. rm -r 1 2 3
  5967. rm -rf ${CVSROOT_DIRNAME}/first-dir
  5968. ;;
  5969. branches)
  5970. # More branch tests, including branches off of branches
  5971. mkdir ${CVSROOT_DIRNAME}/first-dir
  5972. dotest branches-1 "${testcvs} -q co first-dir" ''
  5973. cd first-dir
  5974. echo 1:ancest >file1
  5975. echo 2:ancest >file2
  5976. echo 3:ancest >file3
  5977. echo 4:trunk-1 >file4
  5978. dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
  5979. "${PROG}"' add: scheduling file `file1'\'' for addition
  5980. '"${PROG}"' add: scheduling file `file2'\'' for addition
  5981. '"${PROG}"' add: scheduling file `file3'\'' for addition
  5982. '"${PROG}"' add: scheduling file `file4'\'' for addition
  5983. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  5984. dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
  5985. dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
  5986. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  5987. done
  5988. Checking in file1;
  5989. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  5990. initial revision: 1.1
  5991. done
  5992. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  5993. done
  5994. Checking in file2;
  5995. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  5996. initial revision: 1.1
  5997. done
  5998. RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  5999. done
  6000. Checking in file3;
  6001. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  6002. initial revision: 1.1
  6003. done
  6004. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  6005. done
  6006. Checking in file4;
  6007. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6008. initial revision: 1.1
  6009. done
  6010. HERE
  6011. echo 4:trunk-2 >file4
  6012. dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
  6013. "Checking in file4;
  6014. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6015. new revision: 1\.2; previous revision: 1\.1
  6016. done"
  6017. # The "cvs log file4" in test branches-14.3 will test that we
  6018. # didn't really add the tag.
  6019. dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
  6020. "T file1
  6021. T file2
  6022. T file3
  6023. T file4"
  6024. # Modify this file before branching, to deal with the case where
  6025. # someone is hacking along, says "oops, I should be doing this on
  6026. # a branch", and only then creates the branch.
  6027. echo 1:br1 >file1
  6028. dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' tag: Tagging \.
  6029. T file1
  6030. T file2
  6031. T file3
  6032. T file4'
  6033. dotest branches-5 "$testcvs update -r br1" \
  6034. "$PROG update: Updating \.
  6035. M file1
  6036. [UP] file2
  6037. [UP] file3
  6038. [UP] file4"
  6039. echo 2:br1 >file2
  6040. echo 4:br1 >file4
  6041. dotest branches-6 "${testcvs} -q ci -m modify" \
  6042. "Checking in file1;
  6043. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6044. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6045. done
  6046. Checking in file2;
  6047. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6048. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6049. done
  6050. Checking in file4;
  6051. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6052. new revision: 1\.2\.2\.1; previous revision: 1\.2
  6053. done"
  6054. dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
  6055. T file2
  6056. T file3
  6057. T file4'
  6058. dotest branches-8 "$testcvs -q update -r brbr" \
  6059. '[UP] file1
  6060. [UP] file2
  6061. [UP] file3
  6062. [UP] file4'
  6063. echo 1:brbr >file1
  6064. echo 4:brbr >file4
  6065. dotest branches-9 "${testcvs} -q ci -m modify" \
  6066. "Checking in file1;
  6067. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6068. new revision: 1\.1\.2\.1\.2\.1; previous revision: 1\.1\.2\.1
  6069. done
  6070. Checking in file4;
  6071. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6072. new revision: 1\.2\.2\.1\.2\.1; previous revision: 1\.2\.2\.1
  6073. done"
  6074. dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
  6075. 2:br1
  6076. 3:ancest
  6077. 4:brbr'
  6078. dotest branches-11 "$testcvs -q update -r br1" \
  6079. 'U file1
  6080. [UP] file2
  6081. [UP] file3
  6082. U file4'
  6083. dotest branches-12 "cat file1 file2 file3 file4" '1:br1
  6084. 2:br1
  6085. 3:ancest
  6086. 4:br1'
  6087. echo 4:br1-2 >file4
  6088. dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
  6089. "Checking in file4;
  6090. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6091. new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
  6092. done"
  6093. dotest branches-13 "${testcvs} -q update -A" \
  6094. 'U file1
  6095. U file2
  6096. [UP] file3
  6097. U file4'
  6098. dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
  6099. 2:ancest
  6100. 3:ancest
  6101. 4:trunk-2'
  6102. echo 4:trunk-3 >file4
  6103. dotest branches-14.2 \
  6104. "${testcvs} -q ci -m trunk-change-after-branch" \
  6105. "Checking in file4;
  6106. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  6107. new revision: 1\.3; previous revision: 1\.2
  6108. done"
  6109. dotest branches-14.3 "${testcvs} log file4" \
  6110. "
  6111. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  6112. Working file: file4
  6113. head: 1\.3
  6114. branch:
  6115. locks: strict
  6116. access list:
  6117. symbolic names:
  6118. brbr: 1\.2\.2\.1\.0\.2
  6119. br1: 1\.2\.0\.2
  6120. keyword substitution: kv
  6121. total revisions: 6; selected revisions: 6
  6122. description:
  6123. ----------------------------
  6124. revision 1\.3
  6125. date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  6126. trunk-change-after-branch
  6127. ----------------------------
  6128. revision 1\.2
  6129. date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  6130. branches: 1\.2\.2;
  6131. trunk-before-branch
  6132. ----------------------------
  6133. revision 1\.1
  6134. date: [0-9/: ]*; author: ${username}; state: Exp;
  6135. add-it
  6136. ----------------------------
  6137. revision 1\.2\.2\.2
  6138. date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  6139. change-on-br1
  6140. ----------------------------
  6141. revision 1\.2\.2\.1
  6142. date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  6143. branches: 1\.2\.2\.1\.2;
  6144. modify
  6145. ----------------------------
  6146. revision 1\.2\.2\.1\.2\.1
  6147. date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  6148. modify
  6149. ============================================================================="
  6150. dotest_fail branches-14.4 \
  6151. "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
  6152. "Index: file4
  6153. ===================================================================
  6154. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  6155. retrieving revision 1\.1
  6156. retrieving revision 1\.3
  6157. diff -c -r1\.1 -r1\.3
  6158. \*\*\* file4 ${RFCDATE} 1\.1
  6159. --- file4 ${RFCDATE} 1\.3
  6160. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  6161. \*\*\* 1 \*\*\*\*
  6162. ! 4:trunk-1
  6163. --- 1 ----
  6164. ! 4:trunk-3"
  6165. dotest_fail branches-14.5 \
  6166. "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
  6167. "Index: file4
  6168. ===================================================================
  6169. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  6170. retrieving revision 1\.1
  6171. retrieving revision 1\.2\.2\.1
  6172. diff -c -r1\.1 -r1\.2\.2\.1
  6173. \*\*\* file4 ${RFCDATE} 1\.1
  6174. --- file4 ${RFCDATE} 1\.2\.2\.1
  6175. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  6176. \*\*\* 1 \*\*\*\*
  6177. ! 4:trunk-1
  6178. --- 1 ----
  6179. ! 4:br1"
  6180. dotest branches-15 \
  6181. "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
  6182. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6183. retrieving revision 1\.1\.2\.1
  6184. retrieving revision 1\.1\.2\.1\.2\.1
  6185. Merging differences between 1\.1\.2\.1 and 1\.1\.2\.1\.2\.1 into file1
  6186. rcsmerge: warning: conflicts during merge"
  6187. dotest branches-16 "cat file1" '<<<<<<< file1
  6188. 1:ancest
  6189. [=]======
  6190. 1:brbr
  6191. [>]>>>>>> 1\.1\.2\.1\.2\.1'
  6192. dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
  6193. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6194. done
  6195. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  6196. done
  6197. RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  6198. done
  6199. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  6200. done"
  6201. cd ..
  6202. if $keep; then
  6203. echo Keeping ${TESTDIR} and exiting due to --keep
  6204. exit 0
  6205. fi
  6206. rm -rf ${CVSROOT_DIRNAME}/first-dir
  6207. rm -r first-dir
  6208. ;;
  6209. branches2)
  6210. # More branch tests.
  6211. # Test that when updating a new subdirectory in a directory
  6212. # which was checked out on a branch, the new subdirectory is
  6213. # created on the appropriate branch. Test this when joining
  6214. # as well.
  6215. mkdir ${CVSROOT_DIRNAME}/first-dir
  6216. mkdir trunk; cd trunk
  6217. # Create a file.
  6218. dotest branches2-1 "${testcvs} -q co first-dir"
  6219. cd first-dir
  6220. echo "file1 first revision" > file1
  6221. dotest branches2-2 "${testcvs} add file1" \
  6222. "${PROG} add: scheduling file .file1. for addition
  6223. ${PROG} add: use .${PROG} commit. to add this file permanently"
  6224. dotest branches2-3 "${testcvs} commit -m add file1" \
  6225. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6226. done
  6227. Checking in file1;
  6228. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6229. initial revision: 1\.1
  6230. done"
  6231. # Tag the file.
  6232. dotest branches2-4 "${testcvs} -q tag tag1" 'T file1'
  6233. # Make two branches.
  6234. dotest branches2-5 "${testcvs} -q rtag -b -r tag1 b1 first-dir" ''
  6235. dotest branches2-6 "${testcvs} -q rtag -b -r tag1 b2 first-dir" ''
  6236. # Create some files and a subdirectory on branch b1.
  6237. cd ../..
  6238. mkdir b1; cd b1
  6239. dotest branches2-7 "${testcvs} -q co -r b1 first-dir" \
  6240. "U first-dir/file1"
  6241. cd first-dir
  6242. echo "file2 first revision" > file2
  6243. dotest branches2-8 "${testcvs} add file2" \
  6244. "${PROG}"' add: scheduling file `file2'\'' for addition on branch `b1'\''
  6245. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  6246. mkdir dir1
  6247. dotest branches2-9 "${testcvs} add dir1" \
  6248. "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository
  6249. --> Using per-directory sticky tag "'`'"b1'"
  6250. echo "file3 first revision" > dir1/file3
  6251. dotest branches2-10 "${testcvs} add dir1/file3" \
  6252. "${PROG}"' add: scheduling file `dir1/file3'\'' for addition on branch `b1'\''
  6253. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  6254. dotest branches2-11 "${testcvs} -q ci -madd ." \
  6255. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
  6256. done
  6257. Checking in file2;
  6258. ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v <-- file2
  6259. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6260. done
  6261. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
  6262. done
  6263. Checking in dir1/file3;
  6264. ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v <-- file3
  6265. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6266. done"
  6267. # Check out the second branch, and update the working
  6268. # directory to the first branch, to make sure the right
  6269. # happens with dir1.
  6270. cd ../..
  6271. mkdir b2; cd b2
  6272. dotest branches2-12 "${testcvs} -q co -r b2 first-dir" \
  6273. 'U first-dir/file1'
  6274. cd first-dir
  6275. dotest branches2-13 "${testcvs} update -d -r b1 dir1" \
  6276. "${PROG} update: Updating dir1
  6277. U dir1/file3"
  6278. dotest branches2-14 "${testcvs} -q status" \
  6279. "===================================================================
  6280. File: file1 Status: Up-to-date
  6281. Working revision: 1\.1.*
  6282. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  6283. Sticky Tag: b2 (branch: 1\.1\.4)
  6284. Sticky Date: (none)
  6285. Sticky Options: (none)
  6286. ===================================================================
  6287. File: file3 Status: Up-to-date
  6288. Working revision: 1\.1\.2\.1.*
  6289. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
  6290. Sticky Tag: b1 (branch: 1\.1\.2)
  6291. Sticky Date: (none)
  6292. Sticky Options: (none)"
  6293. # FIXME: Just clobbering the directory like this is a bit
  6294. # tacky, although people generally expect it to work. Maybe
  6295. # we should release it instead. We do it a few other places
  6296. # below as well.
  6297. rm -r dir1
  6298. dotest branches2-15 "${testcvs} update -d -j b1 dir1" \
  6299. "${PROG} update: Updating dir1
  6300. U dir1/file3"
  6301. # FIXCVS: The `No revision control file' stuff seems to be
  6302. # CVS's way of telling us that we're adding the file on a
  6303. # branch, and the file is not on that branch yet. This
  6304. # should be nicer.
  6305. dotest branches2-16 "${testcvs} -q status" \
  6306. "===================================================================
  6307. File: file1 Status: Up-to-date
  6308. Working revision: 1\.1.*
  6309. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  6310. Sticky Tag: b2 (branch: 1\.1\.4)
  6311. Sticky Date: (none)
  6312. Sticky Options: (none)
  6313. ===================================================================
  6314. File: file3 Status: Locally Added
  6315. Working revision: New file!
  6316. Repository revision: No revision control file
  6317. Sticky Tag: b2 - MISSING from RCS file!
  6318. Sticky Date: (none)
  6319. Sticky Options: (none)"
  6320. cd ../../trunk/first-dir
  6321. dotest branches2-17 "${testcvs} update -d -P dir1" \
  6322. "${PROG} update: Updating dir1"
  6323. dotest_fail branches2-18 "test -d dir1"
  6324. dotest branches2-19 "${testcvs} update -d -P -r b1 dir1" \
  6325. "${PROG} update: Updating dir1
  6326. U dir1/file3"
  6327. dotest branches2-20 "${testcvs} -q status" \
  6328. "===================================================================
  6329. File: file1 Status: Up-to-date
  6330. Working revision: 1\.1.*
  6331. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  6332. Sticky Tag: (none)
  6333. Sticky Date: (none)
  6334. Sticky Options: (none)
  6335. ===================================================================
  6336. File: file3 Status: Up-to-date
  6337. Working revision: 1\.1\.2\.1.*
  6338. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
  6339. Sticky Tag: b1 (branch: 1\.1\.2)
  6340. Sticky Date: (none)
  6341. Sticky Options: (none)"
  6342. rm -r dir1
  6343. dotest branches2-21 "${testcvs} update -d -P -j b1 dir1" \
  6344. "${PROG} update: Updating dir1
  6345. U dir1/file3"
  6346. dotest branches2-22 "${testcvs} -q status" \
  6347. "===================================================================
  6348. File: file1 Status: Up-to-date
  6349. Working revision: 1\.1.*
  6350. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  6351. Sticky Tag: (none)
  6352. Sticky Date: (none)
  6353. Sticky Options: (none)
  6354. ===================================================================
  6355. File: file3 Status: Locally Added
  6356. Working revision: New file!
  6357. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir1/Attic/file3,v
  6358. Sticky Tag: (none)
  6359. Sticky Date: (none)
  6360. Sticky Options: (none)"
  6361. cd ../..
  6362. rm -r b1 b2
  6363. # Check out branch b1 twice. Crate a new directory in one
  6364. # working directory, then do a cvs update in the other
  6365. # working directory and see if the tags are right.
  6366. mkdir b1a
  6367. mkdir b1b
  6368. cd b1b
  6369. dotest branches2-23 "${testcvs} -q co -r b1 first-dir" \
  6370. 'U first-dir/file1
  6371. U first-dir/file2
  6372. U first-dir/dir1/file3'
  6373. cd ../b1a
  6374. dotest branches2-24 "${testcvs} -q co -r b1 first-dir" \
  6375. 'U first-dir/file1
  6376. U first-dir/file2
  6377. U first-dir/dir1/file3'
  6378. cd first-dir
  6379. mkdir dir2
  6380. dotest branches2-25 "${testcvs} add dir2" \
  6381. "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository
  6382. --> Using per-directory sticky tag "'`'"b1'"
  6383. echo "file4 first revision" > dir2/file4
  6384. dotest branches2-26 "${testcvs} add dir2/file4" \
  6385. "${PROG}"' add: scheduling file `dir2/file4'\'' for addition on branch `b1'\''
  6386. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  6387. dotest branches2-27 "${testcvs} -q commit -madd" \
  6388. "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
  6389. done
  6390. Checking in dir2/file4;
  6391. ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v <-- file4
  6392. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6393. done"
  6394. cd ../../b1b/first-dir
  6395. dotest branches2-28 "${testcvs} update -d dir2" \
  6396. "${PROG} update: Updating dir2
  6397. U dir2/file4"
  6398. cd dir2
  6399. dotest branches2-29 "${testcvs} -q status" \
  6400. "===================================================================
  6401. File: file4 Status: Up-to-date
  6402. Working revision: 1\.1\.2\.1.*
  6403. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/dir2/Attic/file4,v
  6404. Sticky Tag: b1 (branch: 1\.1\.2)
  6405. Sticky Date: (none)
  6406. Sticky Options: (none)"
  6407. dotest branches2-30 "cat CVS/Tag" 'Tb1'
  6408. # Test update -A on a subdirectory
  6409. cd ..
  6410. rm -r dir2
  6411. dotest branches2-31 "${testcvs} update -A -d dir2" \
  6412. "${PROG} update: Updating dir2"
  6413. cd dir2
  6414. dotest branches2-32 "${testcvs} -q status" ''
  6415. dotest_fail branches2-33 "test -f CVS/Tag"
  6416. # Add a file on the trunk.
  6417. echo "file5 first revision" > file5
  6418. dotest branches2-34 "${testcvs} add file5" \
  6419. "${PROG}"' add: scheduling file `file5'\'' for addition
  6420. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  6421. dotest branches2-35 "${testcvs} -q commit -madd" \
  6422. "RCS file: ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
  6423. done
  6424. Checking in file5;
  6425. ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v <-- file5
  6426. initial revision: 1\.1
  6427. done"
  6428. cd ../../../trunk/first-dir
  6429. dotest branches2-36 "${testcvs} -q update -d dir2" 'U dir2/file5'
  6430. cd dir2
  6431. dotest branches2-37 "${testcvs} -q status" \
  6432. "===================================================================
  6433. File: file5 Status: Up-to-date
  6434. Working revision: 1\.1.*
  6435. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/dir2/file5,v
  6436. Sticky Tag: (none)
  6437. Sticky Date: (none)
  6438. Sticky Options: (none)"
  6439. dotest_fail branches2-38 "test -f CVS/status"
  6440. cd ../../..
  6441. rm -rf ${CVSROOT_DIRNAME}/first-dir
  6442. rm -r trunk b1a b1b
  6443. ;;
  6444. tagc)
  6445. # Test the tag -c option.
  6446. mkdir 1; cd 1
  6447. dotest tagc-1 "${testcvs} -q co -l ." ''
  6448. mkdir first-dir
  6449. dotest tagc-2 "${testcvs} add first-dir" \
  6450. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  6451. cd first-dir
  6452. touch file1 file2
  6453. dotest tagc-3 "${testcvs} add file1 file2" \
  6454. "${PROG} add: scheduling file .file1. for addition
  6455. ${PROG} add: scheduling file .file2. for addition
  6456. ${PROG} add: use .${PROG} commit. to add these files permanently"
  6457. dotest tagc-4 "${testcvs} -q ci -m add" \
  6458. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6459. done
  6460. Checking in file1;
  6461. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6462. initial revision: 1\.1
  6463. done
  6464. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  6465. done
  6466. Checking in file2;
  6467. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6468. initial revision: 1\.1
  6469. done"
  6470. dotest tagc-5 "${testcvs} -q tag -c tag1" \
  6471. "T file1
  6472. T file2"
  6473. touch file1 file2
  6474. dotest tagc-6 "${testcvs} -q tag -c tag2" \
  6475. "T file1
  6476. T file2"
  6477. # Avoid timestamp granularity bugs (FIXME: CVS should be
  6478. # doing the sleep, right?).
  6479. sleep 1
  6480. echo myedit >>file1
  6481. dotest tagc-6a "${testcvs} rm -f file2" \
  6482. "${PROG} remove: scheduling .file2. for removal
  6483. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  6484. touch file3
  6485. dotest tagc-6b "${testcvs} add file3" \
  6486. "${PROG} add: scheduling file .file3. for addition
  6487. ${PROG} add: use .${PROG} commit. to add this file permanently"
  6488. dotest_fail tagc-7 "${testcvs} -q tag -c tag3" \
  6489. "${PROG} tag: file1 is locally modified
  6490. ${PROG} tag: file2 is locally modified
  6491. ${PROG} tag: file3 is locally modified
  6492. ${PROG} \[tag aborted\]: correct the above errors first!"
  6493. cd ../..
  6494. mkdir 2
  6495. cd 2
  6496. dotest tagc-8 "${testcvs} -q co first-dir" \
  6497. "U first-dir/file1
  6498. U first-dir/file2"
  6499. cd ../1/first-dir
  6500. dotest tagc-9 "${testcvs} -q ci -m modify" \
  6501. "Checking in file1;
  6502. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6503. new revision: 1\.2; previous revision: 1\.1
  6504. done
  6505. Removing file2;
  6506. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6507. new revision: delete; previous revision: 1\.1
  6508. done
  6509. RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  6510. done
  6511. Checking in file3;
  6512. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  6513. initial revision: 1\.1
  6514. done"
  6515. cd ../../2/first-dir
  6516. dotest tagc-10 "${testcvs} -q tag -c tag4" \
  6517. "${PROG} tag: file2 is no longer in the repository
  6518. T file1
  6519. T file2"
  6520. cd ../..
  6521. rm -r 1 2
  6522. rm -rf ${CVSROOT_DIRNAME}/first-dir
  6523. ;;
  6524. update-p)
  6525. # Make sure `cvs update -p -rT FILE' works from a branch when
  6526. # FILE is already on the trunk and is being added to that branch.
  6527. mkdir 1; cd 1
  6528. module=x
  6529. echo > unused-file
  6530. # Create the module.
  6531. dotest update-p-1 \
  6532. "$testcvs -Q import -m. $module X Y" ''
  6533. file=F
  6534. # Check it out and tag it.
  6535. dotest update-p-2 "$testcvs -Q co $module" ''
  6536. cd $module
  6537. dotest update-p-3 "$testcvs -Q tag -b B" ''
  6538. echo v1 > $file
  6539. dotest update-p-4 "$testcvs -Q add $file" ''
  6540. dotest update-p-5 "$testcvs -Q ci -m. $file" \
  6541. "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
  6542. done
  6543. Checking in $file;
  6544. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  6545. initial revision: 1\.1
  6546. done"
  6547. dotest update-p-6 "$testcvs -Q tag T $file" ''
  6548. dotest update-p-7 "$testcvs -Q update -rB" ''
  6549. # This merge effectively adds file F on branch B.
  6550. dotest update-p-8 "$testcvs -Q update -jT" ''
  6551. # Before the fix that prompted the addition of this test,
  6552. # the following command would fail with this diagnostic:
  6553. # cvs update: conflict: F created independently by second party
  6554. dotest update-p-9 "$testcvs update -p -rT $file" \
  6555. "===================================================================
  6556. Checking out $file
  6557. RCS: ${CVSROOT_DIRNAME}/$module/$file,v
  6558. VERS: 1\.1
  6559. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  6560. v1"
  6561. # Repeat the above, but with $file removed.
  6562. # This exercises a slightly different code path.
  6563. rm $file
  6564. # Before the fix that prompted the addition of this test,
  6565. # the following command would fail with this diagnostic:
  6566. # cvs update: warning: new-born F has disappeared
  6567. dotest update-p-10 "$testcvs update -p -rT $file" \
  6568. "===================================================================
  6569. Checking out $file
  6570. RCS: ${CVSROOT_DIRNAME}/$module/$file,v
  6571. VERS: 1\.1
  6572. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  6573. v1"
  6574. # Exercise yet another code path:
  6575. # the one that involves reviving a `dead' file.
  6576. # And a little more, for good measure...
  6577. touch new
  6578. dotest update-p-a1 "$testcvs -Q add new" ''
  6579. dotest update-p-a2 "$testcvs -Q update -p new" ''
  6580. dotest update-p-a3 "$testcvs -Q rm -f new" ''
  6581. # Both an update -A, *and* the following update are required
  6582. # to return to the state of being on the trunk with a $file
  6583. # that we can then remove.
  6584. dotest update-p-undead-0 "$testcvs update -A" \
  6585. "$PROG update: Updating \.
  6586. $PROG update: warning: new-born $file has disappeared
  6587. [UP] unused-file"
  6588. dotest update-p-undead-1 "$testcvs update" \
  6589. "${PROG} update: Updating \.
  6590. U $file"
  6591. dotest update-p-undead-2 "$testcvs -Q update -p -rT $file" v1
  6592. dotest update-p-undead-3 "$testcvs -Q rm -f $file" ''
  6593. dotest update-p-undead-4 "$testcvs -Q update -p -rT $file" v1
  6594. dotest update-p-undead-5 "$testcvs -Q ci -m. $file" \
  6595. "Removing $file;
  6596. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  6597. new revision: delete; previous revision: 1\.1
  6598. done"
  6599. dotest update-p-undead-6 "$testcvs -Q update -p -rT $file" v1
  6600. echo v2 > $file
  6601. dotest update-p-undead-7 "$testcvs -Q update -p -rT $file" v1
  6602. dotest update-p-undead-8 "$testcvs add $file" \
  6603. "${PROG} add: Re-adding file .$file. (in place of dead revision 1\.2)\.
  6604. ${PROG} add: use .${PROG} commit. to add this file permanently"
  6605. dotest update-p-undead-9 "$testcvs -Q update -p -rT $file" v1
  6606. cd ../..
  6607. rm -rf 1
  6608. rm -rf ${CVSROOT_DIRNAME}/$module
  6609. ;;
  6610. tagf)
  6611. # More tagging tests, including using tag -F -B to convert a
  6612. # branch tag to a regular tag and recovering thereof.
  6613. # Setup; check in first-dir/file1
  6614. mkdir 1; cd 1
  6615. dotest tagf-1 "${testcvs} -q co -l ." ''
  6616. mkdir first-dir
  6617. dotest tagf-2 "${testcvs} add first-dir" \
  6618. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  6619. cd first-dir
  6620. touch file1 file2
  6621. dotest tagf-3 "${testcvs} add file1 file2" \
  6622. "${PROG} add: scheduling file .file1. for addition
  6623. ${PROG} add: scheduling file .file2. for addition
  6624. ${PROG} add: use .${PROG} commit. to add these files permanently"
  6625. dotest tagf-4 "${testcvs} -q ci -m add" \
  6626. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6627. done
  6628. Checking in file1;
  6629. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6630. initial revision: 1\.1
  6631. done
  6632. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  6633. done
  6634. Checking in file2;
  6635. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6636. initial revision: 1\.1
  6637. done"
  6638. # Now create a branch and commit a revision there.
  6639. dotest tagf-5 "${testcvs} -q tag -b br" "T file1
  6640. T file2"
  6641. dotest tagf-6 "$testcvs -q update -r br" \
  6642. 'U file1
  6643. U file2'
  6644. echo brmod >> file1
  6645. echo brmod >> file2
  6646. dotest tagf-7 "${testcvs} -q ci -m modify" \
  6647. "Checking in file1;
  6648. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6649. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6650. done
  6651. Checking in file2;
  6652. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6653. new revision: 1\.1\.2\.1; previous revision: 1\.1
  6654. done"
  6655. # Here we try to make it a non-branch tag, but will
  6656. # succeed in getting only warnings, even with -F
  6657. # because converting a branch tag to non-branch
  6658. # is potentially catastrophic.
  6659. dotest tagf-8a "${testcvs} -q tag -F br" \
  6660. "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\\.2\.1\.
  6661. ${PROG} tag: file2: Not moving branch tag .br. from 1\.1\.2\.1 to 1\.1\.2\.1\."
  6662. # however, if we *really* are sure we want to move a branch tag,
  6663. # "-F -B" will do the trick
  6664. dotest tagf-8 "${testcvs} -q tag -F -B br" "T file1
  6665. T file2"
  6666. echo moremod >> file1
  6667. echo moremod >> file2
  6668. dotest tagf-9 "${testcvs} -q status -v file1" \
  6669. "===================================================================
  6670. File: file1 Status: Locally Modified
  6671. Working revision: 1\.1\.2\.1.*
  6672. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  6673. Sticky Tag: br (revision: 1\.1\.2\.1)
  6674. Sticky Date: (none)
  6675. Sticky Options: (none)
  6676. Existing Tags:
  6677. br (revision: 1\.1\.2\.1)"
  6678. # Now, how do we recover?
  6679. dotest tagf-10 "${testcvs} -q tag -d br" "D file1
  6680. D file2"
  6681. # This creates a new branch, 1.1.4. See the code in RCS_magicrev
  6682. # which will notice that there is a (non-magic) 1.1.2 and thus
  6683. # skip that number.
  6684. dotest tagf-11 "${testcvs} -q tag -r 1.1 -b br file1" "T file1"
  6685. # Fix it with admin -n (cf admin-18, admin-26-4).
  6686. dotest tagf-12 "${testcvs} -q admin -nbr:1.1.2 file2" \
  6687. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  6688. done"
  6689. # Another variation on the file2 test would be to use two working
  6690. # directories so that the update -r br would need to
  6691. # a merge to get from 1.1.2.1 to the head of the 1.1.2 branch.
  6692. dotest tagf-13 "${testcvs} -q update -r br" \
  6693. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6694. retrieving revision 1\.1\.2\.1
  6695. retrieving revision 1\.1
  6696. Merging differences between 1\.1\.2\.1 and 1\.1 into file1
  6697. rcsmerge: warning: conflicts during merge
  6698. ${PROG} update: conflicts found in file1
  6699. C file1
  6700. M file2"
  6701. # CVS is giving a conflict because we are trying to get back to
  6702. # 1.1.4. I'm not sure why it is a conflict rather than just
  6703. # "M file1".
  6704. dotest tagf-14 "cat file1" \
  6705. "<<<<<<< file1
  6706. brmod
  6707. moremod
  6708. [=]======
  6709. [>]>>>>>> 1\.1"
  6710. echo resolve >file1
  6711. dotest tagf-15 "${testcvs} -q ci -m recovered" \
  6712. "Checking in file1;
  6713. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6714. new revision: 1\.1\.4\.1; previous revision: 1\.1
  6715. done
  6716. Checking in file2;
  6717. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6718. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  6719. done"
  6720. # try accidentally deleting branch tag, "tag -d"
  6721. dotest_fail tagf-16 "${testcvs} tag -d br" \
  6722. "${PROG} tag: Untagging \.
  6723. ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
  6724. ${PROG} tag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
  6725. # try accidentally deleting branch tag, "rtag -d"
  6726. dotest_fail tagf-17 "${testcvs} rtag -d br first-dir" \
  6727. "${PROG} rtag: Untagging first-dir
  6728. ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file1,v.\.
  6729. ${PROG} rtag: Not removing branch tag .br. from .${CVSROOT_DIRNAME}/first-dir/file2,v.\."
  6730. # try accidentally converting branch tag to non-branch tag "tag -F"
  6731. dotest tagf-18 "${testcvs} tag -r1.1 -F br file1" \
  6732. "${PROG} tag: file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\."
  6733. # try accidentally converting branch tag to non-branch tag "rtag -F"
  6734. dotest tagf-19 "${testcvs} rtag -r1.1 -F br first-dir" \
  6735. "${PROG} rtag: Tagging first-dir
  6736. ${PROG} rtag: first-dir/file1: Not moving branch tag .br. from 1\.1\.4\.1 to 1\.1\.
  6737. ${PROG} rtag: first-dir/file2: Not moving branch tag .br. from 1\.1\.2\.2 to 1\.1\."
  6738. # create a non-branch tag
  6739. dotest tagf-20 "${testcvs} rtag regulartag first-dir" \
  6740. "${PROG} rtag: Tagging first-dir"
  6741. # try accidentally converting non-branch tag to branch tag (tag -F -B -b)
  6742. dotest tagf-21 "${testcvs} tag -F -B -b regulartag file1" \
  6743. "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1\.0\.2 due to .-B. option\."
  6744. # try accidentally converting non-branch tag to branch rtag (rtag -F -B -b)
  6745. dotest tagf-22 "${testcvs} rtag -F -B -b regulartag first-dir" \
  6746. "${PROG} rtag: Tagging first-dir
  6747. ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.6 due to .-B. option\.
  6748. ${PROG} rtag: first-dir/file2: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.0\.4 due to .-B. option\."
  6749. # Try accidentally deleting non-branch: (tag -d -B)
  6750. dotest_fail tagf-23 "${testcvs} tag -d -B regulartag file1" \
  6751. "${PROG} tag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\."
  6752. # Try accidentally deleting non-branch: (rtag -d -B)
  6753. dotest_fail tagf-24 \
  6754. "${testcvs} rtag -d -B regulartag first-dir" \
  6755. "${PROG} rtag: Untagging first-dir
  6756. ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file1,v. due to .-B. option\.
  6757. ${PROG} rtag: Not removing non-branch tag .regulartag. from .${CVSROOT_DIRNAME}/first-dir/file2,v. due to .-B. option\."
  6758. # the following tests (throught the next commit) keep moving the same
  6759. # tag back and forth between 1.1.6 & 1.1.8 in file1 and between
  6760. # 1.1.4 and 1.1.6 in file2 since nothing was checked in on some of
  6761. # these branches and CVS only tracks branches via tags unless they contain data.
  6762. # try intentionally converting non-branch tag to branch tag (tag -F -b)
  6763. dotest tagf-25a "${testcvs} tag -F -b regulartag file1" "T file1"
  6764. # try intentionally moving a branch tag to a newly created branch (tag -F -b -B)
  6765. dotest tagf-25b "${testcvs} tag -F -B -b -r1.1 regulartag file1" \
  6766. "T file1"
  6767. # try intentionally converting mixed tags to branch tags (rtag -F -b)
  6768. dotest tagf-26a "${testcvs} rtag -F -b regulartag first-dir" \
  6769. "${PROG} rtag: Tagging first-dir
  6770. ${PROG} rtag: first-dir/file1: Not moving branch tag .regulartag. from 1\.1 to 1\.1\.0\.8\."
  6771. # try intentionally converting a branch to a new branch tag (rtag -F -b -B)
  6772. dotest tagf-26b "${testcvs} rtag -F -B -b -r1.1 regulartag first-dir" \
  6773. "${PROG} rtag: Tagging first-dir"
  6774. # update to our new branch
  6775. dotest tagf-27 "${testcvs} update -r regulartag" \
  6776. "${PROG} update: Updating \.
  6777. U file1
  6778. U file2"
  6779. # commit some changes and see that all rev numbers look right
  6780. echo changes >> file1
  6781. echo changes >> file2
  6782. dotest tagf-28 "${testcvs} ci -m changes" \
  6783. "${PROG} [a-z]*: Examining \.
  6784. Checking in file1;
  6785. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6786. new revision: 1\.1\.8\.1; previous revision: 1\.1
  6787. done
  6788. Checking in file2;
  6789. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  6790. new revision: 1\.1\.6\.1; previous revision: 1\.1
  6791. done"
  6792. # try intentional branch to non-branch (tag -F -B)
  6793. dotest tagf-29 "${testcvs} tag -F -B -r1.1 regulartag file1" \
  6794. "T file1"
  6795. # try non-branch to non-branch (tag -F -B)
  6796. dotest tagf-29a "${testcvs} tag -F -B -r br regulartag file1" \
  6797. "${PROG} tag: file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
  6798. # try mixed-branch to non-branch (rtag -F -B )
  6799. dotest tagf-29b "${testcvs} rtag -F -B -r br regulartag first-dir" \
  6800. "${PROG} rtag: Tagging first-dir
  6801. ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 to 1\.1\.4\.1 due to .-B. option\."
  6802. # at this point, regulartag is a regular tag within
  6803. # file1 and file2
  6804. # try intentional branch to non-branch (rtag -F -B)
  6805. dotest tagf-30 "${testcvs} rtag -F -B -r1.1 br first-dir" \
  6806. "${PROG} rtag: Tagging first-dir"
  6807. # create a branch tag so we can try to delete it.
  6808. dotest tagf-31 "${testcvs} rtag -b brtag first-dir" \
  6809. "${PROG} rtag: Tagging first-dir"
  6810. # try intentinal deletion of branch tag (tag -d -B)
  6811. dotest tagf-32 "${testcvs} tag -d -B brtag file1" "D file1"
  6812. # try intentinal deletion of branch tag (rtag -d -B)
  6813. dotest tagf-33 "${testcvs} rtag -d -B brtag first-dir" \
  6814. "${PROG} rtag: Untagging first-dir"
  6815. cd ../..
  6816. rm -r 1
  6817. rm -rf ${CVSROOT_DIRNAME}/first-dir
  6818. ;;
  6819. tag-log)
  6820. # Test log output for tags
  6821. mkdir 1; cd 1
  6822. dotest tag-log-init-1 "$testcvs -q co -l ."
  6823. mkdir first-dir
  6824. dotest tag-log-init-2 "$testcvs add first-dir" \
  6825. "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
  6826. cd first-dir
  6827. touch file1
  6828. dotest tag-log-init-3 "$testcvs add file1" \
  6829. "${PROG}"' add: scheduling file `file1'\'' for addition
  6830. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  6831. dotest tag-log-init-4 "$testcvs -Q ci -m add" \
  6832. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6833. done
  6834. Checking in file1;
  6835. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  6836. initial revision: 1\.1
  6837. done"
  6838. dotest tag-log-1 "$testcvs -Q tag mytag file1" ''
  6839. dotest tag-log-2 "$testcvs log -N file1" \
  6840. "
  6841. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6842. Working file: file1
  6843. head: 1\.1
  6844. branch:
  6845. locks: strict
  6846. access list:
  6847. keyword substitution: kv
  6848. total revisions: 1; selected revisions: 1
  6849. description:
  6850. ----------------------------
  6851. revision 1\.1
  6852. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  6853. add
  6854. ============================================================================="
  6855. dotest tag-log-3 "$testcvs log -N -n file1" \
  6856. "
  6857. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6858. Working file: file1
  6859. head: 1\.1
  6860. branch:
  6861. locks: strict
  6862. access list:
  6863. symbolic names:
  6864. mytag: 1\.1
  6865. keyword substitution: kv
  6866. total revisions: 1; selected revisions: 1
  6867. description:
  6868. ----------------------------
  6869. revision 1\.1
  6870. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  6871. add
  6872. ============================================================================="
  6873. dotest tag-log-4 "$testcvs log file1" \
  6874. "
  6875. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6876. Working file: file1
  6877. head: 1\.1
  6878. branch:
  6879. locks: strict
  6880. access list:
  6881. symbolic names:
  6882. mytag: 1\.1
  6883. keyword substitution: kv
  6884. total revisions: 1; selected revisions: 1
  6885. description:
  6886. ----------------------------
  6887. revision 1\.1
  6888. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  6889. add
  6890. ============================================================================="
  6891. dotest tag-log-5 "$testcvs log -n file1" \
  6892. "
  6893. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  6894. Working file: file1
  6895. head: 1\.1
  6896. branch:
  6897. locks: strict
  6898. access list:
  6899. symbolic names:
  6900. mytag: 1\.1
  6901. keyword substitution: kv
  6902. total revisions: 1; selected revisions: 1
  6903. description:
  6904. ----------------------------
  6905. revision 1\.1
  6906. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  6907. add
  6908. ============================================================================="
  6909. cd ../..
  6910. rm -fr 1
  6911. rm -rf ${CVSROOT_DIRNAME}/first-dir
  6912. ;;
  6913. tag-space)
  6914. # Test tags with spaces in the names.
  6915. #
  6916. # Prior to releases 1.11.18 & 1.12.10, some commands used with
  6917. # tags with spaces in the names could hang CVS.
  6918. # Setup; check in first-dir/file1
  6919. mkdir 1; cd 1
  6920. dotest tag-space-init-1 "$testcvs -q co -l ."
  6921. mkdir first-dir
  6922. dotest tag-space-init-2 "$testcvs add first-dir" \
  6923. "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
  6924. cd first-dir
  6925. touch file1
  6926. dotest tag-space-init-3 "$testcvs add file1" \
  6927. "$PROG add: scheduling file \`file1' for addition
  6928. $PROG add: use '$PROG commit' to add this file permanently"
  6929. dotest tag-space-init-4 "$testcvs -Q ci -m add" \
  6930. "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
  6931. done
  6932. Checking in file1;
  6933. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  6934. initial revision: 1\.1
  6935. done"
  6936. # Reportedly, the following two tags make it past WinCVS.
  6937. dotest_fail tag-space-1 "$testcvs tag ' spacetag '" \
  6938. "$PROG \[tag aborted\]: tag \` spacetag ' must start with a letter"
  6939. dotest_fail tag-space-2 "$testcvs tag 'spacetag '" \
  6940. "$PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters"
  6941. if $remote; then
  6942. # Verify that this isn't a client check.
  6943. dotest tag-space-3 "$testcvs server" \
  6944. "E $PROG \[tag aborted\]: tag \` spacetag ' must start with a letter
  6945. error " <<EOF
  6946. Root $CVSROOT_DIRNAME
  6947. UseUnchanged
  6948. Argument --
  6949. Argument spacetag
  6950. Directory .
  6951. $CVSROOT_DIRNAME/first-dir
  6952. Entry /file1/1.1///
  6953. Unchanged file1
  6954. tag
  6955. EOF
  6956. dotest tag-space-4 "$testcvs server" \
  6957. "E $PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters
  6958. error " <<EOF
  6959. Root $CVSROOT_DIRNAME
  6960. UseUnchanged
  6961. Argument --
  6962. Argument spacetag
  6963. Directory .
  6964. $CVSROOT_DIRNAME/first-dir
  6965. Entry /file1/1.1///
  6966. Unchanged file1
  6967. tag
  6968. EOF
  6969. fi # $remote
  6970. # Any number of normal tags and branches were handled correctly.
  6971. dotest tag-space-5 "$testcvs -Q tag t1"
  6972. dotest tag-space-5b "$testcvs -Q tag t2"
  6973. dotest tag-space-5c "$testcvs -Q tag -b b1"
  6974. cd ../..
  6975. mkdir 2; cd 2
  6976. # But once a vendor branch exists, it's all over.
  6977. mkdir project; cd project
  6978. touch file1
  6979. dotest tag-space-init-4 \
  6980. "$testcvs -Q import -mimport second-dir VENDOR RELEASE"
  6981. cd ..
  6982. dotest_fail tag-space-6 "$testcvs -Q co -r ' spacetag ' first-dir" \
  6983. "$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter"
  6984. # But when any files were imported, this test hung prior to CVS
  6985. # versions 1.11.18 & 1.12.10.
  6986. dotest_fail tag-space-7 "$testcvs -Q co -r ' spacetag ' second-dir" \
  6987. "$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter"
  6988. if $remote; then
  6989. # I based the client input in the next two tests on actual input
  6990. # from WinCVS 1.2.
  6991. dotest tag-space-8 "$testcvs server" \
  6992. "E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter
  6993. error " <<EOF
  6994. Root $CVSROOT_DIRNAME
  6995. Argument -P
  6996. Argument -r
  6997. Argument spacetag
  6998. Argument first-dir
  6999. Directory .
  7000. $CVSROOT_DIRNAME
  7001. co
  7002. EOF
  7003. # Verify the test is not on the client side.
  7004. dotest tag-space-9 "$testcvs server" \
  7005. "E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter
  7006. error " <<EOF
  7007. Root $CVSROOT_DIRNAME
  7008. Argument -P
  7009. Argument -r
  7010. Argument spacetag
  7011. Argument second-dir
  7012. Directory .
  7013. $CVSROOT_DIRNAME
  7014. co
  7015. EOF
  7016. fi # $remote
  7017. dotest tag-space-10 "$testcvs -Q co second-dir"
  7018. cd second-dir
  7019. # This test would also hang.
  7020. dotest_fail tag-space-11 "$testcvs -Q up -r ' spacetag '" \
  7021. "$PROG \[update aborted\]: tag \` spacetag ' must start with a letter"
  7022. if $remote; then
  7023. dotest tag-space-12 "$testcvs server" \
  7024. "E $PROG \[update aborted\]: tag \` spacetag ' must start with a letter
  7025. error " <<EOF
  7026. Root $CVSROOT_DIRNAME
  7027. Argument -r
  7028. Argument spacetag
  7029. Argument -u
  7030. Argument --
  7031. Directory .
  7032. $CVSROOT_DIRNAME
  7033. Unchanged file1
  7034. update
  7035. EOF
  7036. fi # $remote
  7037. # I'm skipping tests for other commands that may have had the same
  7038. # problem. Hopefully, if a new issue arises, one of the above tests
  7039. # will catch the problem.
  7040. if $keep; then
  7041. echo Keeping $TESTDIR and exiting due to --keep
  7042. exit 0
  7043. fi
  7044. cd ../..
  7045. rm -r 1 2
  7046. rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir
  7047. ;;
  7048. rcslib)
  7049. # Test librarification of RCS.
  7050. # First: test whether `cvs diff' handles $Name expansion
  7051. # correctly. We diff two revisions with their symbolic tags;
  7052. # neither tag should be expanded in the output. Also diff
  7053. # one revision with the working copy.
  7054. mkdir ${CVSROOT_DIRNAME}/first-dir
  7055. dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
  7056. cd first-dir
  7057. echo "I am the first foo, and my name is $""Name$." > foo.c
  7058. dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
  7059. "${PROG} add: scheduling file .foo\.c. for addition
  7060. ${PROG} add: use .${PROG} commit. to add this file permanently"
  7061. dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
  7062. "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  7063. done
  7064. Checking in foo\.c;
  7065. ${CVSROOT_DIRNAME}/first-dir/foo.c,v <-- foo\.c
  7066. initial revision: 1\.1
  7067. done"
  7068. dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
  7069. dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
  7070. "===================================================================
  7071. Checking out foo\.c
  7072. RCS: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  7073. VERS: 1\.1
  7074. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  7075. I am the first foo, and my name is \$""Name: first \$\."
  7076. echo "I am the second foo, and my name is $""Name$." > foo.c
  7077. dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
  7078. "Checking in foo\.c;
  7079. ${CVSROOT_DIRNAME}/first-dir/foo\.c,v <-- foo\.c
  7080. new revision: 1\.2; previous revision: 1\.1
  7081. done"
  7082. dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
  7083. dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
  7084. "===================================================================
  7085. Checking out foo\.c
  7086. RCS: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  7087. VERS: 1\.2
  7088. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  7089. I am the second foo, and my name is \$""Name: second \$\."
  7090. dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
  7091. "${PROG} diff: Diffing \.
  7092. Index: foo\.c
  7093. ===================================================================
  7094. RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  7095. retrieving revision 1\.1
  7096. retrieving revision 1\.2
  7097. diff -r1\.1 -r1\.2
  7098. 1c1
  7099. < I am the first foo, and my name is \$""Name: \$\.
  7100. ---
  7101. > I am the second foo, and my name is \$""Name: \$\."
  7102. echo "I am the once and future foo, and my name is $""Name$." > foo.c
  7103. dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
  7104. "${PROG} diff: Diffing \.
  7105. Index: foo\.c
  7106. ===================================================================
  7107. RCS file: ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  7108. retrieving revision 1\.1
  7109. diff -r1\.1 foo\.c
  7110. 1c1
  7111. < I am the first foo, and my name is \$""Name: \$\.
  7112. ---
  7113. > I am the once and future foo, and my name is \$""Name\$\."
  7114. # Test handling of libdiff options. diff gets quite enough
  7115. # of a workout elsewhere in sanity.sh, so we assume that it's
  7116. # mostly working properly if it passes all the other tests.
  7117. # The main one we want to try is regex handling, since we are
  7118. # using CVS's regex matcher and not diff's.
  7119. cat >rgx.c <<EOF
  7120. test_regex (whiz, bang)
  7121. {
  7122. foo;
  7123. bar;
  7124. baz;
  7125. grumble;
  7126. }
  7127. EOF
  7128. dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
  7129. "${PROG} add: use .${PROG} commit. to add this file permanently"
  7130. dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
  7131. "RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
  7132. done
  7133. Checking in rgx\.c;
  7134. ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v <-- rgx\.c
  7135. initial revision: 1\.1
  7136. done"
  7137. cat >rgx.c <<EOF
  7138. test_regex (whiz, bang)
  7139. {
  7140. foo;
  7141. bar;
  7142. baz;
  7143. mumble;
  7144. }
  7145. EOF
  7146. # Use dotest_fail because exit status from `cvs diff' must be 1.
  7147. dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.* (' rgx.c" \
  7148. "Index: rgx\.c
  7149. ===================================================================
  7150. RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v
  7151. retrieving revision 1\.1
  7152. diff -c -F \.\* ( -r1\.1 rgx\.c
  7153. \*\*\* rgx\.c ${RFCDATE} 1\.1
  7154. --- rgx\.c ${RFCDATE}
  7155. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
  7156. \*\*\* 3,7 \*\*\*\*
  7157. foo;
  7158. bar;
  7159. baz;
  7160. ! grumble;
  7161. }
  7162. --- 3,7 ----
  7163. foo;
  7164. bar;
  7165. baz;
  7166. ! mumble;
  7167. }"
  7168. # Tests of rcsmerge/diff3. Merge operations get a good general
  7169. # workout elsewhere; we want to make sure that options are still
  7170. # handled properly. Try merging two branches with -kv, to test
  7171. # both -j and -k switches.
  7172. cd ..
  7173. rm -rf ${CVSROOT_DIRNAME}/first-dir
  7174. rm -r first-dir
  7175. mkdir 1; cd 1
  7176. dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
  7177. mkdir first-dir
  7178. dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
  7179. "Directory ${CVSROOT_DIRNAME}.*/first-dir added to the repository"
  7180. cd ..; rm -r 1
  7181. dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
  7182. cd first-dir
  7183. echo '$''Revision$' > file1
  7184. echo '2' >> file1
  7185. echo '3' >> file1
  7186. dotest rcslib-merge-4 "${testcvs} -q add file1" \
  7187. "${PROG} add: use .${PROG} commit. to add this file permanently"
  7188. dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
  7189. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  7190. done
  7191. Checking in file1;
  7192. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7193. initial revision: 1\.1
  7194. done"
  7195. sed -e 's/2/two/' file1 > f; mv f file1
  7196. dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
  7197. "Checking in file1;
  7198. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7199. new revision: 1\.2; previous revision: 1\.1
  7200. done"
  7201. dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
  7202. dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
  7203. dotest rcslib-merge-9 "${testcvs} -q status" \
  7204. "===================================================================
  7205. File: file1 Status: Up-to-date
  7206. Working revision: 1\.1.*
  7207. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  7208. Sticky Tag: patch1 (branch: 1\.1\.2)
  7209. Sticky Date: (none)
  7210. Sticky Options: (none)"
  7211. dotest rcslib-merge-10 "cat file1" \
  7212. '$''Revision: 1\.1 $
  7213. 2
  7214. 3'
  7215. sed -e 's/3/three/' file1 > f; mv f file1
  7216. dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
  7217. "Checking in file1;
  7218. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7219. new revision: 1\.1\.2\.1; previous revision: 1\.1
  7220. done"
  7221. dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
  7222. "U file1
  7223. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  7224. retrieving revision 1\.1
  7225. retrieving revision 1\.2
  7226. Merging differences between 1\.1 and 1\.2 into file1
  7227. rcsmerge: warning: conflicts during merge"
  7228. dotest rcslib-merge-13 "cat file1" \
  7229. "<<<<<<< file1
  7230. 1\.1\.2\.1
  7231. 2
  7232. three
  7233. [=]======
  7234. 1\.2
  7235. two
  7236. 3
  7237. [>]>>>>>> 1\.2"
  7238. # Test behavior of symlinks in the repository.
  7239. if test -n "$remotehost"; then
  7240. # Create the link on the remote system. This is because Cygwin's
  7241. # Windows support creates *.lnk files for Windows. When creating
  7242. # these in an SMB share from UNIX, these links won't work from the
  7243. # UNIX side.
  7244. dotest rcslib-symlink-1remotehost "${CVS_RSH} $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
  7245. else
  7246. dotest rcslib-symlink-1 "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
  7247. fi
  7248. dotest rcslib-symlink-2 "${testcvs} update file2" "U file2"
  7249. echo "This is a change" >> file2
  7250. dotest rcslib-symlink-3 "${testcvs} ci -m because file2" \
  7251. "Checking in file2;
  7252. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file2
  7253. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  7254. done"
  7255. # Switch as for rcslib-symlink-1
  7256. if test -n "$remotehost"; then
  7257. dotest rcslib-symlink-4 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
  7258. ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
  7259. else
  7260. dotest rcslib-symlink-4 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
  7261. ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
  7262. fi
  7263. # CVS was failing to check both the symlink and the file
  7264. # for timestamp changes for a while. Test that.
  7265. rm file1
  7266. dotest rcslib-symlink-3a "${testcvs} -q up file1" \
  7267. "${PROG} update: warning: file1 was lost
  7268. U file1"
  7269. echo "This is a change" >> file1
  7270. dotest rcslib-symlink-3b "${testcvs} ci -m because file1" \
  7271. "Checking in file1;
  7272. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7273. new revision: 1\.1\.2\.[0-9]*; previous revision: 1\.1\.2\.[0-9]*
  7274. done"
  7275. dotest rcslib-symlink-3c "${testcvs} update file2" "[UP] file2"
  7276. echo some new text >file3
  7277. dotest rcslib-symlink-3d "${testcvs} -Q add file3" ''
  7278. dotest rcslib-symlink-3e "${testcvs} -Q ci -mtest file3" \
  7279. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  7280. done
  7281. Checking in file3;
  7282. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  7283. new revision: 1\.1\.2\.1; previous revision: 1\.1
  7284. done"
  7285. rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
  7286. # As for rcslib-symlink-1
  7287. if test -n "$remotehost"; then
  7288. dotest rcslib-symlink-3f "$CVS_RSH $remotehost 'ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
  7289. else
  7290. dotest rcslib-symlink-3f "ln -s Attic/file3,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
  7291. fi
  7292. dotest rcslib-symlink-3g "${testcvs} update file2" "U file2"
  7293. # restore the link to file1 for the following tests
  7294. dotest rcslib-symlink-3i "${testcvs} -Q rm -f file3" ''
  7295. dotest rcslib-symlink-3j "${testcvs} -Q ci -mwhatever file3" \
  7296. "Removing file3;
  7297. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  7298. new revision: delete; previous revision: 1\.1\.2\.1
  7299. done"
  7300. rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v
  7301. rm -f ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  7302. # As for rcslib-symlink-1
  7303. if test -n "$remotehost"; then
  7304. dotest rcslib-symlink-3h "$CVS_RSH $remotehost 'ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v'"
  7305. else
  7306. dotest rcslib-symlink-3h "ln -s file1,v ${CVSROOT_DIRNAME}/first-dir/file2,v"
  7307. fi
  7308. # Test 5 reveals a problem with having symlinks in the
  7309. # repository. CVS will try to tag both of the files
  7310. # separately. After processing one, it will do the same
  7311. # operation to the other, which is actually the same file,
  7312. # so the tag will already be there. FIXME: do we bother
  7313. # changing operations to notice cases like this? This
  7314. # strikes me as a difficult problem. -Noel
  7315. dotest rcslib-symlink-5 "${testcvs} tag the_tag" \
  7316. "${PROG} tag: Tagging .
  7317. T file1
  7318. W file2 : the_tag already exists on version 1.1.2.3 : NOT MOVING tag to version 1.1.2.1"
  7319. # As for rcslib-symlink-1
  7320. if test -n "$remotehost"; then
  7321. dotest rcslib-symlink-6 "$CVS_RSH $remotehost 'ls -l $CVSROOT_DIRNAME/first-dir/file2,v'" \
  7322. ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
  7323. else
  7324. dotest rcslib-symlink-6 "ls -l $CVSROOT_DIRNAME/first-dir/file2,v" \
  7325. ".*$CVSROOT_DIRNAME/first-dir/file2,v -> file1,v"
  7326. fi
  7327. # Symlinks tend to interact poorly with the Attic.
  7328. cd ..
  7329. mkdir 2; cd 2
  7330. dotest rcslib-symlink-7 "${testcvs} -q co first-dir" \
  7331. "U first-dir/file1
  7332. U first-dir/file2"
  7333. cd first-dir
  7334. dotest rcslib-symlink-8 "${testcvs} rm -f file2" \
  7335. "${PROG} remove: scheduling .file2. for removal
  7336. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  7337. dotest rcslib-symlink-9 "${testcvs} -q ci -m rm-it" \
  7338. "Removing file2;
  7339. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file2
  7340. new revision: delete; previous revision: 1\.2
  7341. done"
  7342. # OK, why this message happens twice is relatively clear
  7343. # (the check_* and rtag_* calls to start_recursion).
  7344. # Why it happens a third time I didn't try to find out.
  7345. dotest rcslib-symlink-10 \
  7346. "${testcvs} -q rtag -b -r the_tag brtag first-dir" \
  7347. "${PROG} rtag: could not read RCS file for file2
  7348. ${PROG} rtag: could not read RCS file for first-dir/file2
  7349. ${PROG} rtag: could not read RCS file for first-dir/file2"
  7350. # Restore file1 for the next test.
  7351. dotest rcslib-long-symlink-init-1 "$testcvs -Q up -A"
  7352. dotest rcslib-long-symlink-init-2 "$testcvs -Q add file1"
  7353. dotest rcslib-long-symlink-init-3 "$testcvs -Q ci -mback" \
  7354. "Checking in file1;
  7355. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  7356. new revision: 1\.4; previous revision: 1\.3
  7357. done"
  7358. cd ../.. # $TESTDIR
  7359. # CVS has a hard-coded default link path size of 127 characters.
  7360. # Make sure it knows how to exceed that.
  7361. longpath=$CVSROOT_DIRNAME
  7362. count=0
  7363. while test $count -lt 10; do
  7364. count=`expr $count + 1`
  7365. longpath=$longpath/123456789012345678901234567890
  7366. mkdir $longpath
  7367. done
  7368. cp $CVSROOT_DIRNAME/first-dir/file1,v $longpath
  7369. mkdir $CVSROOT_DIRNAME/second-dir
  7370. # Switch as for rcslib-symlink-1
  7371. if test -n "$remotehost"; then
  7372. dotest rcslib-long-symlink-1rh \
  7373. "$CVS_RSH $remotehost 'ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v'"
  7374. else
  7375. dotest rcslib-long-symlink-1 \
  7376. "ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v"
  7377. fi
  7378. dotest rcslib-long-symlink-2 "$testcvs co second-dir" \
  7379. "$PROG checkout: Updating second-dir
  7380. U second-dir/fileX"
  7381. cd second-dir
  7382. echo change-it >>fileX
  7383. # Writes actually cause symlinks to be resolved.
  7384. dotest rcslib-long-symlink-3 "$testcvs -q ci -mwrite-it" \
  7385. "Checking in fileX;
  7386. $CVSROOT_DIRNAME/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/file1,v <-- fileX
  7387. new revision: 1\.5; previous revision: 1\.4
  7388. done"
  7389. if $keep; then
  7390. echo Keeping ${TESTDIR} and exiting due to --keep
  7391. exit 0
  7392. fi
  7393. cd ..
  7394. # Must remove the symlink first. Samba doesn't appear to show
  7395. # broken symlink across the SMB share, and rm -rf by itself
  7396. # will remove file1,v first and leave file2,v a broken link and the
  7397. # rm -rf will fail since it doesn't find file2,v and it still gets
  7398. # directory not empty errors removing cvsroot/first-dir.
  7399. #
  7400. # I'm not sure why I need to do this on $remotehost. The rm above
  7401. # rcslib-symlink-3j works fine, but the next one doesn't unless run
  7402. # remotely under Cygwin and using a TESTDIR on a Samba share.
  7403. if test -n "$remotehost"; then
  7404. $CVS_RSH $remotehost \
  7405. "rm -f $CVSROOT_DIRNAME/first-dir/file2,v $CVSROOT_DIRNAME/second-dir/fileX,v"
  7406. fi
  7407. rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir \
  7408. $CVSROOT_DIRNAME/123456789012345678901234567890
  7409. rm -r first-dir second-dir 2
  7410. ;;
  7411. multibranch)
  7412. # Test the ability to have several branchpoints coming off the
  7413. # same revision.
  7414. mkdir ${CVSROOT_DIRNAME}/first-dir
  7415. dotest multibranch-1 "${testcvs} -q co first-dir" ''
  7416. cd first-dir
  7417. echo 1:trunk-1 >file1
  7418. dotest multibranch-2 "${testcvs} add file1" \
  7419. "${PROG}"' add: scheduling file `file1'\'' for addition
  7420. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  7421. dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
  7422. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  7423. done
  7424. Checking in file1;
  7425. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7426. initial revision: 1.1
  7427. done
  7428. HERE
  7429. dotest multibranch-4 "${testcvs} tag -b br1" \
  7430. "${PROG} tag: Tagging \.
  7431. T file1"
  7432. dotest multibranch-5 "${testcvs} tag -b br2" \
  7433. "${PROG} tag: Tagging \.
  7434. T file1"
  7435. dotest multibranch-6 "$testcvs -q update -r br1" '[UP] file1'
  7436. echo on-br1 >file1
  7437. dotest multibranch-7 "${testcvs} -q ci -m modify-on-br1" \
  7438. "Checking in file1;
  7439. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7440. new revision: 1\.1\.2\.1; previous revision: 1\.1
  7441. done"
  7442. dotest multibranch-8 "${testcvs} -q update -r br2" '[UP] file1'
  7443. echo br2 adds a line >>file1
  7444. dotest multibranch-9 "${testcvs} -q ci -m modify-on-br2" \
  7445. "Checking in file1;
  7446. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  7447. new revision: 1\.1\.4\.1; previous revision: 1\.1
  7448. done"
  7449. dotest multibranch-10 "${testcvs} -q update -r br1" '[UP] file1'
  7450. dotest multibranch-11 "cat file1" 'on-br1'
  7451. dotest multibranch-12 "${testcvs} -q update -r br2" '[UP] file1'
  7452. dotest multibranch-13 "cat file1" '1:trunk-1
  7453. br2 adds a line'
  7454. dotest multibranch-14 "${testcvs} log file1" \
  7455. "
  7456. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  7457. Working file: file1
  7458. head: 1\.1
  7459. branch:
  7460. locks: strict
  7461. access list:
  7462. symbolic names:
  7463. br2: 1\.1\.0\.4
  7464. br1: 1\.1\.0\.2
  7465. keyword substitution: kv
  7466. total revisions: 3; selected revisions: 3
  7467. description:
  7468. ----------------------------
  7469. revision 1\.1
  7470. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  7471. branches: 1\.1\.2; 1\.1\.4;
  7472. add-it
  7473. ----------------------------
  7474. revision 1\.1\.4\.1
  7475. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  7476. modify-on-br2
  7477. ----------------------------
  7478. revision 1\.1\.2\.1
  7479. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  7480. modify-on-br1
  7481. ============================================================================="
  7482. cd ..
  7483. if $keep; then
  7484. echo Keeping ${TESTDIR} and exiting due to --keep
  7485. exit 0
  7486. fi
  7487. rm -rf ${CVSROOT_DIRNAME}/first-dir
  7488. rm -r first-dir
  7489. ;;
  7490. import) # test death after import
  7491. # Tests of "cvs import":
  7492. # basic2
  7493. # rdiff -- imports with keywords
  7494. # import -- more tests of imports with keywords
  7495. # importb -- -b option.
  7496. # importc -- bunch o' files in bunch o' directories
  7497. # modules3
  7498. # mflag -- various -m messages
  7499. # ignore -- import and cvsignore
  7500. # binwrap -- import and -k wrappers
  7501. # info -- imports which are rejected by verifymsg
  7502. # head -- intended to test vendor branches and HEAD,
  7503. # although it doesn't really do it yet.
  7504. # import-CVS -- refuse to import directories named "CVS".
  7505. # import-quirks -- short tests of import quirks.
  7506. # import
  7507. mkdir import-dir ; cd import-dir
  7508. for i in 1 2 3 4 ; do
  7509. echo imported file"$i" > imported-f"$i"
  7510. done
  7511. # This directory should be on the default ignore list,
  7512. # so it shouldn't get imported.
  7513. mkdir RCS
  7514. echo ignore.me >RCS/ignore.me
  7515. echo 'import should not expand $''Id$' >>imported-f2
  7516. cp imported-f2 ../imported-f2-orig.tmp
  7517. dotest_sort import-96 \
  7518. "${testcvs} import -m first-import first-dir vendor-branch junk-1_0" \
  7519. "
  7520. I first-dir/RCS
  7521. N first-dir/imported-f1
  7522. N first-dir/imported-f2
  7523. N first-dir/imported-f3
  7524. N first-dir/imported-f4
  7525. No conflicts created by this import"
  7526. dotest import-96.5 "cmp ../imported-f2-orig.tmp imported-f2" ''
  7527. cd ..
  7528. # co
  7529. dotest import-97 "${testcvs} -q co first-dir" \
  7530. "U first-dir/imported-f1
  7531. U first-dir/imported-f2
  7532. U first-dir/imported-f3
  7533. U first-dir/imported-f4"
  7534. cd first-dir
  7535. for i in 1 2 3 4 ; do
  7536. dotest import-98-$i "test -f imported-f$i" ''
  7537. done
  7538. dotest_fail import-98.5 "test -d RCS" ''
  7539. # remove
  7540. rm imported-f1
  7541. dotest import-99 "${testcvs} rm imported-f1" \
  7542. "${PROG}"' remove: scheduling `imported-f1'\'' for removal
  7543. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
  7544. # change
  7545. echo local-change >> imported-f2
  7546. # commit
  7547. dotest import-100 "${testcvs} ci -m local-changes" \
  7548. "${PROG} [a-z]*: Examining .
  7549. Removing imported-f1;
  7550. ${CVSROOT_DIRNAME}/first-dir/imported-f1,v <-- imported-f1
  7551. new revision: delete; previous revision: 1\.1\.1\.1
  7552. done
  7553. Checking in imported-f2;
  7554. ${CVSROOT_DIRNAME}/first-dir/imported-f2,v <-- imported-f2
  7555. new revision: 1\.2; previous revision: 1\.1
  7556. done"
  7557. # log
  7558. dotest import-101 "${testcvs} log imported-f1" \
  7559. "
  7560. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/imported-f1,v
  7561. Working file: imported-f1
  7562. head: 1\.2
  7563. branch:
  7564. locks: strict
  7565. access list:
  7566. symbolic names:
  7567. junk-1_0: 1\.1\.1\.1
  7568. vendor-branch: 1\.1\.1
  7569. keyword substitution: kv
  7570. total revisions: 3; selected revisions: 3
  7571. description:
  7572. ----------------------------
  7573. revision 1\.2
  7574. date: [0-9/]* [0-9:]*; author: ${username}; state: dead; lines: ${PLUS}0 -0
  7575. local-changes
  7576. ----------------------------
  7577. revision 1\.1
  7578. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  7579. branches: 1\.1\.1;
  7580. Initial revision
  7581. ----------------------------
  7582. revision 1\.1\.1\.1
  7583. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0
  7584. first-import
  7585. ============================================================================="
  7586. # update into the vendor branch.
  7587. dotest import-102 "$testcvs update -rvendor-branch" \
  7588. "$PROG update: Updating .
  7589. U imported-f1
  7590. [UP] imported-f2
  7591. [UP] imported-f3
  7592. [UP] imported-f4"
  7593. # remove file4 on the vendor branch
  7594. rm imported-f4
  7595. dotest import-103 "${testcvs} rm imported-f4" \
  7596. "${PROG}"' remove: scheduling `imported-f4'\'' for removal
  7597. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
  7598. # commit
  7599. dotest import-104 \
  7600. "${testcvs} ci -m vendor-removed imported-f4" \
  7601. "Removing imported-f4;
  7602. ${CVSROOT_DIRNAME}/first-dir/imported-f4,v <-- imported-f4
  7603. new revision: delete; previous revision: 1\.1\.1\.1
  7604. done"
  7605. # update to main line
  7606. dotest import-105 "$testcvs -q update -A" \
  7607. "$PROG update: imported-f1 is no longer in the repository
  7608. [UP] imported-f2
  7609. [UP] imported-f3"
  7610. # second import - file4 deliberately unchanged
  7611. cd ../import-dir
  7612. for i in 1 2 3 ; do
  7613. echo rev 2 of file $i >> imported-f"$i"
  7614. done
  7615. cp imported-f2 ../imported-f2-orig.tmp
  7616. dotest_sort import-106 \
  7617. "${testcvs} import -m second-import first-dir vendor-branch junk-2_0" \
  7618. "
  7619. ${PROG} checkout -j<prev_rel_tag> -jjunk-2_0 first-dir
  7620. 2 conflicts created by this import.
  7621. C first-dir/imported-f1
  7622. C first-dir/imported-f2
  7623. I first-dir/RCS
  7624. U first-dir/imported-f3
  7625. U first-dir/imported-f4
  7626. Use the following command to help the merge:"
  7627. dotest import-106.5 "cmp ../imported-f2-orig.tmp imported-f2" \
  7628. ''
  7629. cd ..
  7630. rm imported-f2-orig.tmp
  7631. # co
  7632. dotest import-107 "${testcvs} co first-dir" \
  7633. "${PROG} checkout: Updating first-dir
  7634. [UP] first-dir/imported-f3
  7635. [UP] first-dir/imported-f4"
  7636. cd first-dir
  7637. dotest_fail import-108 "test -f imported-f1" ''
  7638. for i in 2 3 ; do
  7639. dotest import-109-$i "test -f imported-f$i" ''
  7640. done
  7641. # check vendor branch for file4
  7642. dotest import-110 "$testcvs -q update -rvendor-branch" \
  7643. 'U imported-f1
  7644. [UP] imported-f2
  7645. [UP] imported-f3
  7646. [UP] imported-f4'
  7647. dotest import-111 "test -f imported-f4" ''
  7648. # update to main line
  7649. dotest import-112 "$testcvs -q update -A" \
  7650. "$PROG update: imported-f1 is no longer in the repository
  7651. [UP] imported-f2
  7652. [UP] imported-f3
  7653. [UP] imported-f4"
  7654. cd ..
  7655. dotest import-113 \
  7656. "${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
  7657. "${PROG} checkout: file first-dir/imported-f1 does not exist, but is present in revision junk-2_0
  7658. RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f2,v
  7659. retrieving revision 1\.1\.1\.1
  7660. retrieving revision 1\.1\.1\.2
  7661. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
  7662. rcsmerge: warning: conflicts during merge
  7663. first-dir/imported-f3 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.2
  7664. first-dir/imported-f4 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.3"
  7665. cd first-dir
  7666. dotest_fail import-114 "test -f imported-f1" ''
  7667. for i in 2 3 ; do
  7668. dotest import-115-$i "test -f imported-f$i" ''
  7669. done
  7670. dotest import-116 'cat imported-f2' \
  7671. 'imported file2
  7672. [<]<<<<<< imported-f2
  7673. import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
  7674. local-change
  7675. [=]======
  7676. import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
  7677. rev 2 of file 2
  7678. [>]>>>>>> 1\.1\.1\.2'
  7679. cd ..
  7680. rm -r first-dir
  7681. rm -rf ${CVSROOT_DIRNAME}/first-dir
  7682. rm -r import-dir
  7683. ;;
  7684. importb)
  7685. # More cvs import tests, especially -b option.
  7686. # OK, first we get some sources from the NetMunger project, and
  7687. # import them into the 1.1.1 vendor branch.
  7688. mkdir imp-dir
  7689. cd imp-dir
  7690. echo 'OpenMunger sources' >file1
  7691. echo 'OpenMunger sources' >file2
  7692. dotest_sort importb-1 \
  7693. "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
  7694. "
  7695. N first-dir/file1
  7696. N first-dir/file2
  7697. No conflicts created by this import"
  7698. cd ..
  7699. rm -r imp-dir
  7700. # Now we put the sources we get from FreeMunger into 1.1.3
  7701. mkdir imp-dir
  7702. cd imp-dir
  7703. echo 'FreeMunger sources' >file1
  7704. echo 'FreeMunger sources' >file2
  7705. # Not completely sure how the conflict detection is supposed to
  7706. # be working here (haven't really thought about it).
  7707. # We use an explicit -d option to test that it is reflected
  7708. # in the suggested checkout.
  7709. dotest_sort importb-2 \
  7710. "${testcvs} -d ${CVSROOT} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
  7711. "
  7712. ${PROG} -d ${CVSROOT} checkout -j<prev_rel_tag> -jfreemunger-1_0 first-dir
  7713. 2 conflicts created by this import.
  7714. C first-dir/file1
  7715. C first-dir/file2
  7716. Use the following command to help the merge:"
  7717. cd ..
  7718. rm -r imp-dir
  7719. # Now a test of main branch import (into second-dir, not first-dir).
  7720. mkdir imp-dir
  7721. cd imp-dir
  7722. echo 'my own stuff' >mine1.c
  7723. echo 'my own stuff' >mine2.c
  7724. dotest_fail importb-3 \
  7725. "${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
  7726. "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
  7727. supported by import, not \`1'\. For example: \`1\.1\.1'\."
  7728. : when we implement main-branch import, should be \
  7729. "N second-dir/mine1\.c
  7730. N second-dir/mine2\.c
  7731. No conflicts created by this import"
  7732. cd ..
  7733. rm -r imp-dir
  7734. mkdir 1
  7735. cd 1
  7736. # when we implement main branch import, will want to
  7737. # add "second-dir" here.
  7738. dotest importb-4 "${testcvs} -q co first-dir" \
  7739. "U first-dir/file1
  7740. U first-dir/file2"
  7741. cd first-dir
  7742. dotest importb-5 "${testcvs} -q log file1" "
  7743. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  7744. Working file: file1
  7745. head: 1\.1
  7746. branch: 1\.1\.1
  7747. locks: strict
  7748. access list:
  7749. symbolic names:
  7750. freemunger-1_0: 1\.1\.3\.1
  7751. freemunger: 1\.1\.3
  7752. openmunger-1_0: 1\.1\.1\.1
  7753. openmunger: 1\.1\.1
  7754. keyword substitution: kv
  7755. total revisions: 3; selected revisions: 3
  7756. description:
  7757. ----------------------------
  7758. revision 1\.1
  7759. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  7760. branches: 1\.1\.1; 1\.1\.3;
  7761. Initial revision
  7762. ----------------------------
  7763. revision 1\.1\.3\.1
  7764. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  7765. add
  7766. ----------------------------
  7767. revision 1\.1\.1\.1
  7768. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0
  7769. add
  7770. ============================================================================="
  7771. cd ../..
  7772. rm -r 1
  7773. rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
  7774. ;;
  7775. importc)
  7776. # Test importing a bunch o' files in a bunch o' directories.
  7777. # Also the -d option.
  7778. mkdir 1; cd 1
  7779. mkdir adir bdir cdir
  7780. mkdir adir/sub1 adir/sub2
  7781. mkdir adir/sub1/ssdir
  7782. mkdir bdir/subdir
  7783. touch adir/sub1/file1 adir/sub2/file2 adir/sub1/ssdir/ssfile
  7784. touch -t 197107040343 bdir/subdir/file1
  7785. touch -t 203412251801 cdir/cfile
  7786. dotest_sort importc-1 \
  7787. "${testcvs} import -d -m import-it first-dir vendor release" \
  7788. "
  7789. N first-dir/adir/sub1/file1
  7790. N first-dir/adir/sub1/ssdir/ssfile
  7791. N first-dir/adir/sub2/file2
  7792. N first-dir/bdir/subdir/file1
  7793. N first-dir/cdir/cfile
  7794. No conflicts created by this import
  7795. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir
  7796. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1
  7797. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub1/ssdir
  7798. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/adir/sub2
  7799. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir
  7800. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/bdir/subdir
  7801. ${PROG} import: Importing ${CVSROOT_DIRNAME}/first-dir/cdir"
  7802. cd ..
  7803. mkdir 2; cd 2
  7804. dotest importc-2 "${testcvs} -q co first-dir" \
  7805. "U first-dir/adir/sub1/file1
  7806. U first-dir/adir/sub1/ssdir/ssfile
  7807. U first-dir/adir/sub2/file2
  7808. U first-dir/bdir/subdir/file1
  7809. U first-dir/cdir/cfile"
  7810. cd first-dir
  7811. dotest importc-3 "${testcvs} update adir/sub1" \
  7812. "${PROG} update: Updating adir/sub1
  7813. ${PROG} update: Updating adir/sub1/ssdir"
  7814. dotest importc-4 "${testcvs} update adir/sub1 bdir/subdir" \
  7815. "${PROG} update: Updating adir/sub1
  7816. ${PROG} update: Updating adir/sub1/ssdir
  7817. ${PROG} update: Updating bdir/subdir"
  7818. echo modify >>cdir/cfile
  7819. dotest importc-5 \
  7820. "${testcvs} -q rtag -b -r release wip_test first-dir" ""
  7821. dotest importc-6 "$testcvs -q update -r wip_test" \
  7822. 'U adir/sub1/file1
  7823. U adir/sub1/ssdir/ssfile
  7824. U adir/sub2/file2
  7825. U bdir/subdir/file1
  7826. M cdir/cfile'
  7827. # This used to fail in local mode
  7828. dotest importc-7 "${testcvs} -q ci -m modify -r wip_test" \
  7829. "Checking in cdir/cfile;
  7830. ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v <-- cfile
  7831. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  7832. done"
  7833. # TODO: should also be testing "import -d" when we update
  7834. # an existing file.
  7835. dotest importc-8 "${testcvs} -q log cdir/cfile" "
  7836. RCS file: ${CVSROOT_DIRNAME}/first-dir/cdir/cfile,v
  7837. Working file: cdir/cfile
  7838. head: 1\.1
  7839. branch: 1\.1\.1
  7840. locks: strict
  7841. access list:
  7842. symbolic names:
  7843. wip_test: 1\.1\.1\.1\.0\.2
  7844. release: 1\.1\.1\.1
  7845. vendor: 1\.1\.1
  7846. keyword substitution: kv
  7847. total revisions: 3; selected revisions: 3
  7848. description:
  7849. ----------------------------
  7850. revision 1\.1
  7851. date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9]; author: ${username}; state: Exp;
  7852. branches: 1\.1\.1;
  7853. Initial revision
  7854. ----------------------------
  7855. revision 1\.1\.1\.1
  7856. date: 2034/12/2[4-6] [0-9][0-9]:01:[0-9][0-9]; author: ${username}; state: Exp; lines: ${PLUS}0 -0
  7857. branches: 1\.1\.1\.1\.2;
  7858. import-it
  7859. ----------------------------
  7860. revision 1\.1\.1\.1\.2\.1
  7861. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  7862. modify
  7863. ============================================================================="
  7864. dotest importc-9 "${testcvs} -q log bdir/subdir/file1" "
  7865. RCS file: ${CVSROOT_DIRNAME}/first-dir/bdir/subdir/file1,v
  7866. Working file: bdir/subdir/file1
  7867. head: 1\.1
  7868. branch: 1\.1\.1
  7869. locks: strict
  7870. access list:
  7871. symbolic names:
  7872. wip_test: 1\.1\.1\.1\.0\.2
  7873. release: 1\.1\.1\.1
  7874. vendor: 1\.1\.1
  7875. keyword substitution: kv
  7876. total revisions: 2; selected revisions: 2
  7877. description:
  7878. ----------------------------
  7879. revision 1\.1
  7880. date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9]; author: ${username}; state: Exp;
  7881. branches: 1\.1\.1;
  7882. Initial revision
  7883. ----------------------------
  7884. revision 1\.1\.1\.1
  7885. date: 1971/07/0[3-5] [0-9][0-9]:43:[0-9][0-9]; author: ${username}; state: Exp; lines: ${PLUS}0 -0
  7886. import-it
  7887. ============================================================================="
  7888. cd ..
  7889. # Now tests of absolute pathnames and .. as repository directory.
  7890. cd ../1
  7891. dotest_fail importc-10 \
  7892. "${testcvs} import -m imp ../other vendor release2" \
  7893. "${PROG} \[[a-z]* aborted\]: directory \.\./other not relative within the repository"
  7894. dotest_fail importc-11 \
  7895. "${testcvs} import -m imp ${TESTDIR}/other vendor release3" \
  7896. "${PROG} \[[a-z]* aborted\]: directory ${TESTDIR}/other not relative within the repository"
  7897. dotest_fail importc-12 "test -d ${TESTDIR}/other" ""
  7898. cd ..
  7899. rm -r 1 2
  7900. rm -rf ${CVSROOT_DIRNAME}/first-dir
  7901. ;;
  7902. import-CVS)
  7903. mkdir import-CVS
  7904. cd import-CVS
  7905. touch file1 file2 file3
  7906. dotest_fail import-CVS-1 "$testcvs import -mimport CVS vtag rtag" \
  7907. "$PROG import: The word \`CVS' is reserved by CVS and may not be used
  7908. $PROG \[import aborted\]: as a directory in a path or as a file name\."
  7909. dotest_fail import-CVS-1b \
  7910. "$testcvs import -mimport CVS-/CVS vtag rtag" \
  7911. "$PROG import: The word \`CVS' is reserved by CVS and may not be used
  7912. $PROG \[import aborted\]: as a directory in a path or as a file name\."
  7913. mkdir sdir
  7914. mkdir sdir/CVS
  7915. touch CVS sdir/CVS/file4 sdir/CVS/file5 sdir/file6 sdir/file7
  7916. # Calling the imported directory import-CVS is dual purpose in the
  7917. # following test. It makes sure the path test which matched above
  7918. # wasn't too strict.
  7919. dotest_sort import-CVS-2 \
  7920. "$testcvs import -I! -mimport import-CVS vtag rtag" \
  7921. "
  7922. I import-CVS/CVS
  7923. I import-CVS/sdir/CVS
  7924. N import-CVS/file1
  7925. N import-CVS/file2
  7926. N import-CVS/file3
  7927. N import-CVS/sdir/file6
  7928. N import-CVS/sdir/file7
  7929. No conflicts created by this import
  7930. $PROG import: Importing $CVSROOT_DIRNAME/import-CVS/sdir"
  7931. if $keep; then
  7932. echo Keeping ${TESTDIR} and exiting due to --keep
  7933. exit 0
  7934. fi
  7935. cd ..
  7936. rm -r import-CVS
  7937. rm -rf $CVSROOT_DIRNAME/import-CVS
  7938. ;;
  7939. import-quirks)
  7940. # Short tests of quirky import behavior.
  7941. #
  7942. # For a list of other import tests with short descriptions, see the
  7943. # comment header of the "import" test.
  7944. mkdir import-quirks
  7945. cd import-quirks
  7946. touch file1 file2 file3
  7947. # CVS prior to 1.11.18 and 1.12.10 used to happily import to
  7948. # "branch 1.1", creating RCS archives with revisions like,
  7949. # "1.1..1". That double-dot is *not* a typo.
  7950. dotest_fail import-quirks-1 \
  7951. "$testcvs import -b1.1. -mbad-bad-bad import-quirks VB RT" \
  7952. "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
  7953. supported by import, not \`1\.1\.'\. For example: \`1\.1\.1'\."
  7954. dotest_fail import-quirks-2 \
  7955. "$testcvs import -b1.1.1.. -mbad-bad-bad import-quirks VB RT" \
  7956. "$PROG \[import aborted\]: Only numeric branch specifications with two dots are
  7957. supported by import, not \`1\.1\.1\.\.'\. For example: \`1\.1\.1'\."
  7958. # Try a few odd numbers. This is hardly comprehensive.
  7959. dotest_sort import-quirks-2 \
  7960. "$testcvs import -b10.10.101 -mthis-ones-ok import-quirks-2 VB RT" \
  7961. "
  7962. N import-quirks-2/file1
  7963. N import-quirks-2/file2
  7964. N import-quirks-2/file3
  7965. No conflicts created by this import"
  7966. dotest_sort import-quirks-3 \
  7967. "$testcvs import -b2345678901.2345678901.2345678901 -mthis-ones-ok import-quirks-3 VB RT" \
  7968. "
  7969. N import-quirks-3/file1
  7970. N import-quirks-3/file2
  7971. N import-quirks-3/file3
  7972. No conflicts created by this import"
  7973. dotest_sort import-quirks-4 \
  7974. "$testcvs import -b1.1.2 -mthis-ones-ok import-quirks-4 VB RT" \
  7975. "
  7976. N import-quirks-4/file1
  7977. N import-quirks-4/file2
  7978. N import-quirks-4/file3
  7979. No conflicts created by this import"
  7980. if $keep; then
  7981. echo Keeping $TESTDIR and exiting due to --keep
  7982. exit 0
  7983. fi
  7984. cd ..
  7985. rm -r import-quirks
  7986. rm -rf $CVSROOT_DIRNAME/import-quirks-2 \
  7987. $CVSROOT_DIRNAME/import-quirks-3 \
  7988. $CVSROOT_DIRNAME/import-quirks-4
  7989. ;;
  7990. import-after-initial)
  7991. # Properly handle the case in which the first version of a
  7992. # file is created by a regular cvs add and commit, and there
  7993. # is a subsequent cvs import of the same file. cvs update with
  7994. # a date tag must resort to searching the vendor branch only if
  7995. # the initial version of the file was created at the same time
  7996. # as the initial version on the vendor branch.
  7997. mkdir 1; cd 1
  7998. module=x
  7999. echo > unused-file
  8000. # Create the module.
  8001. dotest import-after-initial-1 \
  8002. "$testcvs -Q import -m. $module X Y" ''
  8003. file=m
  8004. # Check it out and add a file.
  8005. dotest import-after-initial-2 "$testcvs -Q co $module" ''
  8006. cd $module
  8007. echo original > $file
  8008. dotest import-after-initial-3 "${testcvs} -Q add $file" ""
  8009. dotest import-after-initial-4 "${testcvs} -Q ci -m. $file" \
  8010. "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
  8011. done
  8012. Checking in $file;
  8013. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  8014. initial revision: 1\.1
  8015. done"
  8016. # Delay a little so the following import isn't done in the same
  8017. # second as the preceding commit.
  8018. sleep 2
  8019. # Do the first import of $file *after* $file already has an
  8020. # initial version.
  8021. mkdir sub
  8022. cd sub
  8023. echo newer-via-import > $file
  8024. dotest import-after-initial-5 \
  8025. "$testcvs -Q import -m. $module X Y2" ''
  8026. cd ..
  8027. # Sleep a second so we're sure to be after the second of the import.
  8028. sleep 1
  8029. dotest import-after-initial-6 \
  8030. "$testcvs -Q update -p -D now $file" 'original'
  8031. cd ../..
  8032. rm -rf 1
  8033. rm -rf ${CVSROOT_DIRNAME}/$module
  8034. ;;
  8035. branch-after-import)
  8036. # Test branching after an import via both cvs tag -b and
  8037. # cvs add to verify that the HEAD remains at 1.1.1.1
  8038. # This was a FreeBSD bug documented at the URL:
  8039. # http://www.freebsd.org/cgi/query-pr.cgi?pr=4033
  8040. mkdir branch-after-import
  8041. cd branch-after-import
  8042. # OK, first we get some sources from the NetMunger project,
  8043. # and import them into the 1.1.1 vendor branch.
  8044. mkdir imp-dir
  8045. cd imp-dir
  8046. echo 'OpenMunger sources' >file1
  8047. echo 'OpenMunger sources' >file2
  8048. dotest_sort branch-after-import-1 \
  8049. "${testcvs} import -m add first-dir openmunger openmunger-1_0" \
  8050. '
  8051. N first-dir/file1
  8052. N first-dir/file2
  8053. No conflicts created by this import'
  8054. cd ..
  8055. # Next checkout the new module
  8056. dotest branch-after-import-2 \
  8057. "${testcvs} -q co first-dir" \
  8058. 'U first-dir/file1
  8059. U first-dir/file2'
  8060. cd first-dir
  8061. # Branch tag the file1 and cvs add file2,
  8062. # the branch should remain the same in both cases
  8063. # such that a new import will not require a conflict
  8064. # resolution.
  8065. dotest branch-after-import-3 \
  8066. "${testcvs} tag -b TESTTOTRON file1" \
  8067. 'T file1'
  8068. dotest branch-after-import-4 \
  8069. "$testcvs -q update -r TESTTOTRON" \
  8070. "[UP] file1
  8071. $PROG update: file2 is no longer in the repository"
  8072. cp ../imp-dir/file2 .
  8073. dotest branch-after-import-5 \
  8074. "${testcvs} add file2" \
  8075. "${PROG} add: scheduling file .file2. for addition on branch .TESTTOTRON.
  8076. ${PROG} add: use .${PROG} commit. to add this file permanently"
  8077. dotest branch-after-import-6 \
  8078. "${testcvs} commit -m cvs-add file2" \
  8079. "Checking in file2;
  8080. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  8081. new revision: 1\.1\.1\.1\.2\.2; previous revision: 1\.1\.1\.1\.2\.1
  8082. done"
  8083. if $keep; then
  8084. echo Keeping ${TESTDIR} and exiting due to --keep
  8085. exit 0
  8086. fi
  8087. cd ../..
  8088. rm -r branch-after-import
  8089. rm -rf ${CVSROOT_DIRNAME}/first-dir
  8090. ;;
  8091. join)
  8092. # Test doing joins which involve adding and removing files.
  8093. # Variety of scenarios (see list below), in the context of:
  8094. # * merge changes from T1 to T2 into the main line
  8095. # * merge changes from branch 'branch' into the main line
  8096. # * merge changes from branch 'branch' into branch 'br2'.
  8097. # See also binfile2, which does similar things with binary files.
  8098. # See also join2, which tests joining (and update -A) on only
  8099. # a single file, rather than a directory.
  8100. # See also rmadd2, which tests -j cases not involving branches
  8101. # (e.g. undoing a commit)
  8102. # See also join3, which tests some cases involving the greatest
  8103. # common ancestor. Here is a list of tests according to branch
  8104. # topology:
  8105. #
  8106. # --->bp---->trunk too many to mention
  8107. # \----->branch
  8108. #
  8109. # /----->branch1
  8110. # --->bp---->trunk multibranch, multibranch2
  8111. # \----->branch2
  8112. #
  8113. # --->bp1----->bp2---->trunk join3
  8114. # \->br1 \->br2
  8115. #
  8116. # --->bp1----->trunk
  8117. # \----bp2---->branch branches
  8118. # \------>branch-of-branch
  8119. # We check merging changes from T1 to T2 into the main line.
  8120. # Here are the interesting cases I can think of:
  8121. # 1) File added between T1 and T2, not on main line.
  8122. # File should be marked for addition.
  8123. # 2) File added between T1 and T2, also added on main line.
  8124. # Conflict.
  8125. # 3) File removed between T1 and T2, unchanged on main line.
  8126. # File should be marked for removal.
  8127. # 4) File removed between T1 and T2, modified on main line.
  8128. # If mod checked in, file should be marked for removal.
  8129. # If mod still in working directory, conflict.
  8130. # 5) File removed between T1 and T2, was never on main line.
  8131. # Nothing should happen.
  8132. # 6) File removed between T1 and T2, also removed on main line.
  8133. # Nothing should happen.
  8134. # 7) File not added between T1 and T2, added on main line.
  8135. # Nothing should happen.
  8136. # 8) File not modified between T1 and T2, removed on main line.
  8137. # Nothing should happen.
  8138. # 9) File modified between T1 and T2, removed on main line.
  8139. # Conflict.
  8140. # 10) File was never on branch, removed on main line.
  8141. # Nothing should happen.
  8142. # We also check merging changes from a branch into the main
  8143. # line. Here are the interesting cases:
  8144. # 1) File added on branch, not on main line.
  8145. # File should be marked for addition.
  8146. # 2) File added on branch, also added on main line.
  8147. # Conflict.
  8148. # 3) File removed on branch, unchanged on main line.
  8149. # File should be marked for removal.
  8150. # 4) File removed on branch, modified on main line.
  8151. # Conflict.
  8152. # 5) File removed on branch, was never on main line.
  8153. # Nothing should happen.
  8154. # 6) File removed on branch, also removed on main line.
  8155. # Nothing should happen.
  8156. # 7) File added on main line, not added on branch.
  8157. # Nothing should happen.
  8158. # 8) File removed on main line, not modified on branch.
  8159. # Nothing should happen.
  8160. # 9) File modified on branch, removed on main line.
  8161. # Conflict.
  8162. # 10) File was never on branch, removed on main line.
  8163. # Nothing should happen.
  8164. # In the tests below, fileN represents case N in the above
  8165. # lists.
  8166. mkdir ${CVSROOT_DIRNAME}/first-dir
  8167. mkdir 1
  8168. cd 1
  8169. dotest join-1 "${testcvs} -q co first-dir" ''
  8170. cd first-dir
  8171. # Add two files.
  8172. echo 'first revision of file3' > file3
  8173. echo 'first revision of file4' > file4
  8174. echo 'first revision of file6' > file6
  8175. echo 'first revision of file8' > file8
  8176. echo 'first revision of file9' > file9
  8177. dotest join-2 "${testcvs} add file3 file4 file6 file8 file9" \
  8178. "${PROG}"' add: scheduling file `file3'\'' for addition
  8179. '"${PROG}"' add: scheduling file `file4'\'' for addition
  8180. '"${PROG}"' add: scheduling file `file6'\'' for addition
  8181. '"${PROG}"' add: scheduling file `file8'\'' for addition
  8182. '"${PROG}"' add: scheduling file `file9'\'' for addition
  8183. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8184. dotest join-3 "${testcvs} -q commit -m add" \
  8185. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  8186. done
  8187. Checking in file3;
  8188. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  8189. initial revision: 1\.1
  8190. done
  8191. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  8192. done
  8193. Checking in file4;
  8194. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8195. initial revision: 1\.1
  8196. done
  8197. RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
  8198. done
  8199. Checking in file6;
  8200. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  8201. initial revision: 1\.1
  8202. done
  8203. RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
  8204. done
  8205. Checking in file8;
  8206. ${CVSROOT_DIRNAME}/first-dir/file8,v <-- file8
  8207. initial revision: 1\.1
  8208. done
  8209. RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
  8210. done
  8211. Checking in file9;
  8212. ${CVSROOT_DIRNAME}/first-dir/file9,v <-- file9
  8213. initial revision: 1\.1
  8214. done"
  8215. # Make a branch.
  8216. dotest join-4 "${testcvs} -q tag -b branch ." \
  8217. 'T file3
  8218. T file4
  8219. T file6
  8220. T file8
  8221. T file9'
  8222. # Add file2, file7, and file10, modify file4, and remove
  8223. # file6, file8, and file9.
  8224. echo 'first revision of file2' > file2
  8225. echo 'second revision of file4' > file4
  8226. echo 'first revision of file7' > file7
  8227. rm file6 file8 file9
  8228. echo 'first revision of file10' > file10
  8229. dotest join-5 "${testcvs} add file2 file7 file10" \
  8230. "${PROG}"' add: scheduling file `file2'\'' for addition
  8231. '"${PROG}"' add: scheduling file `file7'\'' for addition
  8232. '"${PROG}"' add: scheduling file `file10'\'' for addition
  8233. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8234. dotest join-6 "${testcvs} rm file6 file8 file9" \
  8235. "${PROG}"' remove: scheduling `file6'\'' for removal
  8236. '"${PROG}"' remove: scheduling `file8'\'' for removal
  8237. '"${PROG}"' remove: scheduling `file9'\'' for removal
  8238. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
  8239. dotest join-7 "${testcvs} -q ci -mx ." \
  8240. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
  8241. done
  8242. Checking in file10;
  8243. ${CVSROOT_DIRNAME}/first-dir/file10,v <-- file10
  8244. initial revision: 1\.1
  8245. done
  8246. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  8247. done
  8248. Checking in file2;
  8249. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  8250. initial revision: 1\.1
  8251. done
  8252. Checking in file4;
  8253. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8254. new revision: 1\.2; previous revision: 1\.1
  8255. done
  8256. Removing file6;
  8257. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  8258. new revision: delete; previous revision: 1\.1
  8259. done
  8260. RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
  8261. done
  8262. Checking in file7;
  8263. ${CVSROOT_DIRNAME}/first-dir/file7,v <-- file7
  8264. initial revision: 1\.1
  8265. done
  8266. Removing file8;
  8267. ${CVSROOT_DIRNAME}/first-dir/file8,v <-- file8
  8268. new revision: delete; previous revision: 1\.1
  8269. done
  8270. Removing file9;
  8271. ${CVSROOT_DIRNAME}/first-dir/file9,v <-- file9
  8272. new revision: delete; previous revision: 1\.1
  8273. done"
  8274. # Remove file10
  8275. dotest join-7a "${testcvs} rm -f file10" \
  8276. "${PROG}"' remove: scheduling `file10'\'' for removal
  8277. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove this file permanently'
  8278. dotest join-7b "${testcvs} -q ci -mx ." \
  8279. "Removing file10;
  8280. ${CVSROOT_DIRNAME}/first-dir/file10,v <-- file10
  8281. new revision: delete; previous revision: 1\.1
  8282. done"
  8283. # Check out the branch.
  8284. cd ../..
  8285. mkdir 2
  8286. cd 2
  8287. dotest join-8 "${testcvs} -q co -r branch first-dir" \
  8288. 'U first-dir/file3
  8289. U first-dir/file4
  8290. U first-dir/file6
  8291. U first-dir/file8
  8292. U first-dir/file9'
  8293. cd first-dir
  8294. # Modify the files on the branch, so that T1 is not an
  8295. # ancestor of the main line, and add file5
  8296. echo 'first branch revision of file3' > file3
  8297. echo 'first branch revision of file4' > file4
  8298. echo 'first branch revision of file5' > file5
  8299. echo 'first branch revision of file6' > file6
  8300. echo 'first branch revision of file9' > file9
  8301. dotest join-9 "${testcvs} add file5" \
  8302. "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
  8303. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  8304. dotest join-10 "${testcvs} -q ci -mx ." \
  8305. "Checking in file3;
  8306. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  8307. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8308. done
  8309. Checking in file4;
  8310. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8311. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8312. done
  8313. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
  8314. done
  8315. Checking in file5;
  8316. ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v <-- file5
  8317. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8318. done
  8319. Checking in file6;
  8320. ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v <-- file6
  8321. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8322. done
  8323. Checking in file9;
  8324. ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v <-- file9
  8325. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8326. done"
  8327. # Tag the current revisions on the branch.
  8328. dotest join-11 "${testcvs} -q tag T1 ." \
  8329. 'T file3
  8330. T file4
  8331. T file5
  8332. T file6
  8333. T file8
  8334. T file9'
  8335. # Add file1 and file2, modify file9, and remove the other files.
  8336. echo 'first branch revision of file1' > file1
  8337. echo 'first branch revision of file2' > file2
  8338. echo 'second branch revision of file9' > file9
  8339. rm file3 file4 file5 file6
  8340. dotest join-12 "${testcvs} add file1 file2" \
  8341. "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
  8342. '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
  8343. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8344. dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
  8345. "${PROG}"' remove: scheduling `file3'\'' for removal
  8346. '"${PROG}"' remove: scheduling `file4'\'' for removal
  8347. '"${PROG}"' remove: scheduling `file5'\'' for removal
  8348. '"${PROG}"' remove: scheduling `file6'\'' for removal
  8349. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
  8350. dotest join-14 "${testcvs} -q ci -mx ." \
  8351. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  8352. done
  8353. Checking in file1;
  8354. ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v <-- file1
  8355. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8356. done
  8357. Checking in file2;
  8358. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  8359. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  8360. done
  8361. Removing file3;
  8362. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  8363. new revision: delete; previous revision: 1\.1\.2\.1
  8364. done
  8365. Removing file4;
  8366. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8367. new revision: delete; previous revision: 1\.1\.2\.1
  8368. done
  8369. Removing file5;
  8370. ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v <-- file5
  8371. new revision: delete; previous revision: 1\.1\.2\.1
  8372. done
  8373. Removing file6;
  8374. ${CVSROOT_DIRNAME}/first-dir/Attic/file6,v <-- file6
  8375. new revision: delete; previous revision: 1\.1\.2\.1
  8376. done
  8377. Checking in file9;
  8378. ${CVSROOT_DIRNAME}/first-dir/Attic/file9,v <-- file9
  8379. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  8380. done"
  8381. # Tag the current revisions on the branch.
  8382. dotest join-15 "${testcvs} -q tag T2 ." \
  8383. 'T file1
  8384. T file2
  8385. T file8
  8386. T file9'
  8387. # Do a checkout with a merge.
  8388. cd ../..
  8389. mkdir 3
  8390. cd 3
  8391. dotest join-16 "$testcvs -q co -jT1 -jT2 first-dir" \
  8392. "U first-dir/file1
  8393. U first-dir/file2
  8394. $PROG checkout: file first-dir/file2 exists, but has been added in revision T2
  8395. U first-dir/file3
  8396. $PROG checkout: scheduling first-dir/file3 for removal
  8397. U first-dir/file4
  8398. $PROG checkout: file first-dir/file4 has been removed in revision T2, but the destination is incompatibly modified
  8399. C first-dir/file4
  8400. U first-dir/file7
  8401. $PROG checkout: file first-dir/file9 does not exist, but is present in revision T2"
  8402. # Verify that the right changes have been scheduled.
  8403. cd first-dir
  8404. dotest_fail join-17 "$testcvs -q update" \
  8405. 'A file1
  8406. R file3
  8407. C file4'
  8408. # Modify file4 locally, and do an update with a merge.
  8409. cd ../../1/first-dir
  8410. echo 'third revision of file4' > file4
  8411. dotest join-18 "$testcvs -q update -jT1 -jT2 ." \
  8412. "U file1
  8413. $PROG update: file file2 exists, but has been added in revision T2
  8414. $PROG update: scheduling file3 for removal
  8415. M file4
  8416. $PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
  8417. C file4
  8418. $PROG update: file file9 does not exist, but is present in revision T2"
  8419. # Verify that the right changes have been scheduled.
  8420. dotest_fail join-19 "$testcvs -q update" \
  8421. 'A file1
  8422. R file3
  8423. C file4'
  8424. # Do a checkout with a merge from a single revision.
  8425. # FIXME: CVS currently gets this wrong. file2 has been
  8426. # added on both the branch and the main line, and so should
  8427. # be regarded as a conflict. However, given the way that
  8428. # CVS sets up the RCS file, there is no way to distinguish
  8429. # this case from the case of file2 having existed before the
  8430. # branch was made. This could be fixed by reserving
  8431. # a revision somewhere, perhaps 1.1, as an always dead
  8432. # revision which can be used as the source for files added
  8433. # on branches.
  8434. cd ../../3
  8435. rm -r first-dir
  8436. dotest join-20 "$testcvs -q co -jbranch first-dir" \
  8437. "U first-dir/file1
  8438. U first-dir/file2
  8439. RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
  8440. retrieving revision 1\.1
  8441. retrieving revision 1\.1\.2\.2
  8442. Merging differences between 1\.1 and 1\.1\.2\.2 into file2
  8443. U first-dir/file3
  8444. $PROG checkout: scheduling first-dir/file3 for removal
  8445. U first-dir/file4
  8446. $PROG checkout: file first-dir/file4 has been removed in revision branch, but the destination is incompatibly modified
  8447. C first-dir/file4
  8448. U first-dir/file7
  8449. $PROG checkout: file first-dir/file9 does not exist, but is present in revision branch"
  8450. # Verify that the right changes have been scheduled.
  8451. # The M file2 line is a bug; see above join-20.
  8452. cd first-dir
  8453. dotest_fail join-21 "$testcvs -q update" \
  8454. 'A file1
  8455. M file2
  8456. R file3
  8457. C file4'
  8458. # Checkout the main line again.
  8459. cd ../../1
  8460. rm -r first-dir
  8461. dotest join-22 "${testcvs} -q co first-dir" \
  8462. 'U first-dir/file2
  8463. U first-dir/file3
  8464. U first-dir/file4
  8465. U first-dir/file7'
  8466. # Modify file4 locally, and do an update with a merge from a
  8467. # single revision.
  8468. # The file2 handling is a bug; see above join-20.
  8469. cd first-dir
  8470. echo 'third revision of file4' > file4
  8471. dotest join-23 "$testcvs -q update -jbranch ." \
  8472. "U file1
  8473. RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
  8474. retrieving revision 1\.1
  8475. retrieving revision 1\.1\.2\.2
  8476. Merging differences between 1\.1 and 1\.1\.2\.2 into file2
  8477. $PROG update: scheduling file3 for removal
  8478. M file4
  8479. $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
  8480. C file4
  8481. $PROG update: file file9 does not exist, but is present in revision branch"
  8482. # Verify that the right changes have been scheduled.
  8483. # The M file2 line is a bug; see above join-20
  8484. dotest_fail join-24 "$testcvs -q update" \
  8485. 'A file1
  8486. M file2
  8487. R file3
  8488. C file4'
  8489. cd ..
  8490. # Checkout the main line again and make a new branch which we
  8491. # merge to.
  8492. rm -r first-dir
  8493. dotest join-25 "${testcvs} -q co first-dir" \
  8494. 'U first-dir/file2
  8495. U first-dir/file3
  8496. U first-dir/file4
  8497. U first-dir/file7'
  8498. cd first-dir
  8499. dotest join-26 "${testcvs} -q tag -b br2" \
  8500. "T file2
  8501. T file3
  8502. T file4
  8503. T file7"
  8504. dotest join-27 "$testcvs -q update -r br2" \
  8505. '[UP] file2
  8506. [UP] file3
  8507. [UP] file4
  8508. [UP] file7'
  8509. # The handling of file8 and file9 here look fishy to me. I don't
  8510. # see why it should be different from the case where we merge to
  8511. # the trunk (e.g. join-23).
  8512. dotest join-28 "$testcvs -q update -j branch" \
  8513. "U file1
  8514. RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
  8515. retrieving revision 1\.1
  8516. retrieving revision 1\.1\.2\.2
  8517. Merging differences between 1\.1 and 1\.1\.2\.2 into file2
  8518. $PROG update: scheduling file3 for removal
  8519. $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
  8520. C file4
  8521. U file8
  8522. U file9"
  8523. # Verify that the right changes have been scheduled.
  8524. dotest_fail join-29 "$testcvs -q update" \
  8525. "A file1
  8526. M file2
  8527. R file3
  8528. C file4
  8529. A file8
  8530. A file9"
  8531. # Checkout the mainline again to try updating and merging between two
  8532. # branches in the same step
  8533. # this seems a likely scenario - the user finishes up on branch and
  8534. # updates to br2 and merges in the same step - and there was a bug
  8535. # once that if the file was removed in the update then it wouldn't be
  8536. # readded in the merge
  8537. cd ..
  8538. rm -rf first-dir
  8539. dotest join-twobranch-1 "${testcvs} -q co -rbranch first-dir" \
  8540. 'U first-dir/file1
  8541. U first-dir/file2
  8542. U first-dir/file8
  8543. U first-dir/file9'
  8544. cd first-dir
  8545. dotest join-twobranch-2 "$testcvs -q update -rbr2 -jbranch" \
  8546. "$PROG update: file1 is no longer in the repository
  8547. U file1
  8548. U file2
  8549. RCS file: $CVSROOT_DIRNAME/first-dir/file2,v
  8550. retrieving revision 1\.1
  8551. retrieving revision 1\.1\.2\.2
  8552. Merging differences between 1\.1 and 1\.1\.2\.2 into file2
  8553. U file3
  8554. $PROG update: scheduling file3 for removal
  8555. U file4
  8556. $PROG update: file file4 has been removed in revision branch, but the destination is incompatibly modified
  8557. C file4
  8558. U file7
  8559. $PROG update: file8 is no longer in the repository
  8560. U file8
  8561. $PROG update: file9 is no longer in the repository
  8562. U file9"
  8563. # Verify that the right changes have been scheduled.
  8564. dotest_fail join-twobranch-3 "$testcvs -q update" \
  8565. "A file1
  8566. M file2
  8567. R file3
  8568. C file4
  8569. A file8
  8570. A file9"
  8571. # Checkout the mainline again to try merging from the trunk
  8572. # to a branch.
  8573. cd ..
  8574. rm -r first-dir
  8575. dotest join-30 "${testcvs} -q co first-dir" \
  8576. 'U first-dir/file2
  8577. U first-dir/file3
  8578. U first-dir/file4
  8579. U first-dir/file7'
  8580. cd first-dir
  8581. # Tag the current revisions on the trunk.
  8582. dotest join-31 "${testcvs} -q tag T3 ." \
  8583. 'T file2
  8584. T file3
  8585. T file4
  8586. T file7'
  8587. # Modify file7.
  8588. echo 'second revision of file7' > file7
  8589. dotest join-32 "${testcvs} -q ci -mx ." \
  8590. "Checking in file7;
  8591. ${CVSROOT_DIRNAME}/first-dir/file7,v <-- file7
  8592. new revision: 1\.2; previous revision: 1\.1
  8593. done"
  8594. # And Tag again.
  8595. dotest join-33 "${testcvs} -q tag T4 ." \
  8596. 'T file2
  8597. T file3
  8598. T file4
  8599. T file7'
  8600. # Now update branch to T3.
  8601. cd ../../2/first-dir
  8602. dotest join-34 "${testcvs} -q up -jT3" \
  8603. "${PROG} update: file file4 does not exist, but is present in revision T3
  8604. U file7"
  8605. # Verify that the right changes have been scheduled.
  8606. dotest join-35 "${testcvs} -q update" \
  8607. 'A file7'
  8608. # Now update to T4.
  8609. # This is probably a bug, although in this particular case it just
  8610. # happens to do the right thing; see above join-20.
  8611. dotest join-36 "${testcvs} -q up -j T3 -j T4" \
  8612. "A file7
  8613. RCS file: ${CVSROOT_DIRNAME}/first-dir/file7,v
  8614. retrieving revision 1\.1
  8615. retrieving revision 1\.2
  8616. Merging differences between 1\.1 and 1\.2 into file7"
  8617. # Verify that the right changes have been scheduled.
  8618. dotest join-37 "${testcvs} -q update" \
  8619. 'A file7'
  8620. cd ../..
  8621. rm -r 1 2 3
  8622. rm -rf ${CVSROOT_DIRNAME}/first-dir
  8623. ;;
  8624. join2)
  8625. # More joining tests.
  8626. # First the usual setup; create a directory first-dir, a file
  8627. # first-dir/file1, and a branch br1.
  8628. mkdir 1; cd 1
  8629. dotest join2-1 "${testcvs} -q co -l ." ''
  8630. mkdir first-dir
  8631. dotest join2-2 "${testcvs} add first-dir" \
  8632. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  8633. cd first-dir
  8634. echo 'initial contents of file1' >file1
  8635. dotest join2-3 "${testcvs} add file1" \
  8636. "${PROG} add: scheduling file .file1. for addition
  8637. ${PROG} add: use .${PROG} commit. to add this file permanently"
  8638. dotest join2-4 "${testcvs} -q ci -m add" \
  8639. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  8640. done
  8641. Checking in file1;
  8642. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8643. initial revision: 1\.1
  8644. done"
  8645. dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
  8646. dotest join2-6 "$testcvs -q update -r br1" '[UP] file1'
  8647. echo 'modify on branch' >>file1
  8648. touch bradd
  8649. dotest join2-6a "${testcvs} add bradd" \
  8650. "${PROG} add: scheduling file .bradd. for addition on branch .br1.
  8651. ${PROG} add: use .${PROG} commit. to add this file permanently"
  8652. dotest join2-7 "${testcvs} -q ci -m modify" \
  8653. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
  8654. done
  8655. Checking in bradd;
  8656. ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v <-- bradd
  8657. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8658. done
  8659. Checking in file1;
  8660. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8661. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8662. done"
  8663. # Here is the unusual/pathological part. We switch back to
  8664. # the trunk *for file1 only*, not for the whole directory.
  8665. dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
  8666. dotest join2-9 "${testcvs} -q status file1" \
  8667. "===================================================================
  8668. File: file1 Status: Up-to-date
  8669. Working revision: 1\.1.*
  8670. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  8671. Sticky Tag: (none)
  8672. Sticky Date: (none)
  8673. Sticky Options: (none)"
  8674. dotest join2-10 "cat CVS/Tag" "Tbr1"
  8675. dotest join2-11 "${testcvs} -q update -j br1 file1" \
  8676. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  8677. retrieving revision 1\.1
  8678. retrieving revision 1\.1\.2\.1
  8679. Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
  8680. dotest join2-12 "cat file1" "initial contents of file1
  8681. modify on branch"
  8682. # We should have no sticky tag on file1
  8683. dotest join2-13 "${testcvs} -q status file1" \
  8684. "===================================================================
  8685. File: file1 Status: Locally Modified
  8686. Working revision: 1\.1.*
  8687. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  8688. Sticky Tag: (none)
  8689. Sticky Date: (none)
  8690. Sticky Options: (none)"
  8691. dotest join2-14 "cat CVS/Tag" "Tbr1"
  8692. # And the checkin should go to the trunk
  8693. dotest join2-15 "${testcvs} -q ci -m modify file1" \
  8694. "Checking in file1;
  8695. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8696. new revision: 1\.2; previous revision: 1\.1
  8697. done"
  8698. # OK, the above is all well and good and has worked for some
  8699. # time. Now try the case where the file had been added on
  8700. # the branch.
  8701. dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
  8702. # The workaround is to update the whole directory.
  8703. # The non-circumvented version won't work. The reason is that
  8704. # update removes the entry from CVS/Entries, so of course we get
  8705. # the tag from CVS/Tag and not Entries. I suppose maybe
  8706. # we could invent some new format in Entries which would handle
  8707. # this, but doing so, and handling it properly throughout
  8708. # CVS, would be a lot of work and I'm not sure this case justifies
  8709. # it.
  8710. dotest join2-17-circumvent "${testcvs} -q update -A" \
  8711. "${PROG} update: bradd is no longer in the repository
  8712. [UP] file1"
  8713. : dotest join2-17 "${testcvs} -q update -A bradd" \
  8714. "${PROG} update: warning: bradd is not (any longer) pertinent"
  8715. dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
  8716. dotest join2-19 "${testcvs} -q status bradd" \
  8717. "===================================================================
  8718. File: bradd Status: Locally Added
  8719. Working revision: New file!
  8720. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/bradd,v
  8721. Sticky Tag: (none)
  8722. Sticky Date: (none)
  8723. Sticky Options: (none)"
  8724. dotest join2-20 "${testcvs} -q ci -m modify bradd" \
  8725. "Checking in bradd;
  8726. ${CVSROOT_DIRNAME}/first-dir/bradd,v <-- bradd
  8727. new revision: 1\.2; previous revision: 1\.1
  8728. done"
  8729. cd ../..
  8730. rm -r 1
  8731. rm -rf ${CVSROOT_DIRNAME}/first-dir
  8732. ;;
  8733. join3)
  8734. # See "join" for a list of other joining/branching tests.
  8735. # First the usual setup; create a directory first-dir, a file
  8736. # first-dir/file1, and a branch br1.
  8737. mkdir 1; cd 1
  8738. dotest join3-1 "${testcvs} -q co -l ." ''
  8739. mkdir first-dir
  8740. dotest join3-2 "${testcvs} add first-dir" \
  8741. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  8742. cd first-dir
  8743. echo 'initial contents of file1' >file1
  8744. dotest join3-3 "${testcvs} add file1" \
  8745. "${PROG} add: scheduling file .file1. for addition
  8746. ${PROG} add: use .${PROG} commit. to add this file permanently"
  8747. dotest join3-4 "${testcvs} -q ci -m add" \
  8748. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  8749. done
  8750. Checking in file1;
  8751. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8752. initial revision: 1\.1
  8753. done"
  8754. dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
  8755. dotest join3-6 "$testcvs -q update -r br1" '[UP] file1'
  8756. echo 'br1:line1' >>file1
  8757. dotest join3-7 "${testcvs} -q ci -m modify" \
  8758. "Checking in file1;
  8759. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8760. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8761. done"
  8762. # Now back to the trunk for:
  8763. # another revision and another branch for file1.
  8764. # add file2, which will exist on trunk and br2 but not br1.
  8765. dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
  8766. echo 'trunk:line1' > file2
  8767. dotest join3-8a "${testcvs} add file2" \
  8768. "${PROG} add: scheduling file .file2. for addition
  8769. ${PROG} add: use .${PROG} commit. to add this file permanently"
  8770. echo 'trunk:line1' >>file1
  8771. dotest join3-9 "${testcvs} -q ci -m modify" \
  8772. "Checking in file1;
  8773. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8774. new revision: 1\.2; previous revision: 1\.1
  8775. done
  8776. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  8777. done
  8778. Checking in file2;
  8779. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  8780. initial revision: 1\.1
  8781. done"
  8782. dotest join3-10 "${testcvs} -q tag -b br2" "T file1
  8783. T file2"
  8784. # Before we actually have any revision on br2, let's try a join
  8785. dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
  8786. ${PROG} update: file2 is no longer in the repository"
  8787. dotest join3-12 "${testcvs} -q update -j br2" \
  8788. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  8789. retrieving revision 1\.1
  8790. retrieving revision 1\.2
  8791. Merging differences between 1\.1 and 1\.2 into file1
  8792. rcsmerge: warning: conflicts during merge
  8793. U file2"
  8794. dotest join3-13 "cat file1" \
  8795. "initial contents of file1
  8796. [<]<<<<<< file1
  8797. br1:line1
  8798. [=]======
  8799. trunk:line1
  8800. [>]>>>>>> 1\.2"
  8801. rm file1
  8802. # OK, we'll try the same thing with a revision on br2.
  8803. dotest join3-14 "${testcvs} -q update -r br2 file1" \
  8804. "${PROG} update: warning: file1 was lost
  8805. U file1" "U file1"
  8806. echo 'br2:line1' >>file1
  8807. dotest join3-15 "${testcvs} -q ci -m modify file1" \
  8808. "Checking in file1;
  8809. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  8810. new revision: 1\.2\.2\.1; previous revision: 1\.2
  8811. done"
  8812. # OK, now we can join br2 to br1
  8813. dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
  8814. # It may seem odd, to merge a higher branch into a lower
  8815. # branch, but in fact CVS defines the ancestor as 1.1
  8816. # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
  8817. # This seems like a reasonably plausible behavior.
  8818. dotest join3-17 "${testcvs} -q update -j br2 file1" \
  8819. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  8820. retrieving revision 1\.1
  8821. retrieving revision 1\.2\.2\.1
  8822. Merging differences between 1\.1 and 1\.2\.2\.1 into file1
  8823. rcsmerge: warning: conflicts during merge"
  8824. dotest join3-18 "cat file1" \
  8825. "initial contents of file1
  8826. [<]<<<<<< file1
  8827. br1:line1
  8828. [=]======
  8829. trunk:line1
  8830. br2:line1
  8831. [>]>>>>>> 1\.2\.2\.1"
  8832. cd ../..
  8833. rm -r 1
  8834. rm -rf ${CVSROOT_DIRNAME}/first-dir
  8835. ;;
  8836. join4)
  8837. # Like join, but with local (uncommitted) modifications.
  8838. mkdir ${CVSROOT_DIRNAME}/first-dir
  8839. mkdir 1
  8840. cd 1
  8841. dotest join4-1 "${testcvs} -q co first-dir" ''
  8842. cd first-dir
  8843. # Add two files.
  8844. echo 'first revision of file3' > file3
  8845. echo 'first revision of file4' > file4
  8846. echo 'first revision of file6' > file6
  8847. echo 'first revision of file8' > file8
  8848. echo 'first revision of file9' > file9
  8849. dotest join4-2 "${testcvs} add file3 file4 file6 file8 file9" \
  8850. "${PROG}"' add: scheduling file `file3'\'' for addition
  8851. '"${PROG}"' add: scheduling file `file4'\'' for addition
  8852. '"${PROG}"' add: scheduling file `file6'\'' for addition
  8853. '"${PROG}"' add: scheduling file `file8'\'' for addition
  8854. '"${PROG}"' add: scheduling file `file9'\'' for addition
  8855. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8856. dotest join4-3 "${testcvs} -q commit -m add" \
  8857. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file3,v
  8858. done
  8859. Checking in file3;
  8860. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  8861. initial revision: 1\.1
  8862. done
  8863. RCS file: ${CVSROOT_DIRNAME}/first-dir/file4,v
  8864. done
  8865. Checking in file4;
  8866. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8867. initial revision: 1\.1
  8868. done
  8869. RCS file: ${CVSROOT_DIRNAME}/first-dir/file6,v
  8870. done
  8871. Checking in file6;
  8872. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  8873. initial revision: 1\.1
  8874. done
  8875. RCS file: ${CVSROOT_DIRNAME}/first-dir/file8,v
  8876. done
  8877. Checking in file8;
  8878. ${CVSROOT_DIRNAME}/first-dir/file8,v <-- file8
  8879. initial revision: 1\.1
  8880. done
  8881. RCS file: ${CVSROOT_DIRNAME}/first-dir/file9,v
  8882. done
  8883. Checking in file9;
  8884. ${CVSROOT_DIRNAME}/first-dir/file9,v <-- file9
  8885. initial revision: 1\.1
  8886. done"
  8887. # Make a branch.
  8888. dotest join4-4 "${testcvs} -q tag -b branch ." \
  8889. 'T file3
  8890. T file4
  8891. T file6
  8892. T file8
  8893. T file9'
  8894. # Add file10
  8895. echo 'first revision of file10' > file10
  8896. dotest join4-7a "${testcvs} add file10" \
  8897. "${PROG}"' add: scheduling file `file10'\'' for addition
  8898. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  8899. dotest join4-7b "${testcvs} -q ci -mx ." \
  8900. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
  8901. done
  8902. Checking in file10;
  8903. ${CVSROOT_DIRNAME}/first-dir/file10,v <-- file10
  8904. initial revision: 1\.1
  8905. done"
  8906. # Add file2 and file7, modify file4, and remove
  8907. # file6, file8, file9, and file10.
  8908. echo 'first revision of file2' > file2
  8909. echo 'second revision of file4' > file4
  8910. echo 'first revision of file7' > file7
  8911. rm file6 file8 file9 file10
  8912. dotest join4-5 "${testcvs} add file2 file7" \
  8913. "${PROG}"' add: scheduling file `file2'\'' for addition
  8914. '"${PROG}"' add: scheduling file `file7'\'' for addition
  8915. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8916. dotest join4-6 "${testcvs} rm file6 file8 file9 file10" \
  8917. "${PROG}"' remove: scheduling `file6'\'' for removal
  8918. '"${PROG}"' remove: scheduling `file8'\'' for removal
  8919. '"${PROG}"' remove: scheduling `file9'\'' for removal
  8920. '"${PROG}"' remove: scheduling `file10'\'' for removal
  8921. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
  8922. # Check out the branch.
  8923. cd ../..
  8924. mkdir 2
  8925. cd 2
  8926. dotest join4-8 "${testcvs} -q co -r branch first-dir" \
  8927. 'U first-dir/file3
  8928. U first-dir/file4
  8929. U first-dir/file6
  8930. U first-dir/file8
  8931. U first-dir/file9'
  8932. cd first-dir
  8933. # Modify the files on the branch, so that T1 is not an
  8934. # ancestor of the main line, and add file5
  8935. echo 'first branch revision of file3' > file3
  8936. echo 'first branch revision of file4' > file4
  8937. echo 'first branch revision of file5' > file5
  8938. echo 'first branch revision of file6' > file6
  8939. echo 'first branch revision of file9' > file9
  8940. dotest join4-9 "${testcvs} add file5" \
  8941. "${PROG}"' add: scheduling file `file5'\'' for addition on branch `branch'\''
  8942. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  8943. dotest join4-10 "${testcvs} -q ci -mx ." \
  8944. "Checking in file3;
  8945. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  8946. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8947. done
  8948. Checking in file4;
  8949. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  8950. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8951. done
  8952. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v
  8953. done
  8954. Checking in file5;
  8955. ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v <-- file5
  8956. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8957. done
  8958. Checking in file6;
  8959. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  8960. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8961. done
  8962. Checking in file9;
  8963. ${CVSROOT_DIRNAME}/first-dir/file9,v <-- file9
  8964. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8965. done"
  8966. # Tag the current revisions on the branch.
  8967. dotest join4-11 "${testcvs} -q tag T1 ." \
  8968. 'T file3
  8969. T file4
  8970. T file5
  8971. T file6
  8972. T file8
  8973. T file9'
  8974. # Add file1 and file2, modify file9, and remove the other files.
  8975. echo 'first branch revision of file1' > file1
  8976. echo 'first branch revision of file2' > file2
  8977. echo 'second branch revision of file9' > file9
  8978. rm file3 file4 file5 file6
  8979. dotest join4-12 "${testcvs} add file1 file2" \
  8980. "${PROG}"' add: scheduling file `file1'\'' for addition on branch `branch'\''
  8981. '"${PROG}"' add: scheduling file `file2'\'' for addition on branch `branch'\''
  8982. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  8983. dotest join4-13 "${testcvs} rm file3 file4 file5 file6" \
  8984. "${PROG}"' remove: scheduling `file3'\'' for removal
  8985. '"${PROG}"' remove: scheduling `file4'\'' for removal
  8986. '"${PROG}"' remove: scheduling `file5'\'' for removal
  8987. '"${PROG}"' remove: scheduling `file6'\'' for removal
  8988. '"${PROG}"' remove: use .'"${PROG}"' commit. to remove these files permanently'
  8989. dotest join4-14 "${testcvs} -q ci -mx ." \
  8990. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  8991. done
  8992. Checking in file1;
  8993. ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v <-- file1
  8994. new revision: 1\.1\.2\.1; previous revision: 1\.1
  8995. done
  8996. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v
  8997. done
  8998. Checking in file2;
  8999. ${CVSROOT_DIRNAME}/first-dir/Attic/file2,v <-- file2
  9000. new revision: 1\.1\.2\.1; previous revision: 1\.1
  9001. done
  9002. Removing file3;
  9003. ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3
  9004. new revision: delete; previous revision: 1\.1\.2\.1
  9005. done
  9006. Removing file4;
  9007. ${CVSROOT_DIRNAME}/first-dir/file4,v <-- file4
  9008. new revision: delete; previous revision: 1\.1\.2\.1
  9009. done
  9010. Removing file5;
  9011. ${CVSROOT_DIRNAME}/first-dir/Attic/file5,v <-- file5
  9012. new revision: delete; previous revision: 1\.1\.2\.1
  9013. done
  9014. Removing file6;
  9015. ${CVSROOT_DIRNAME}/first-dir/file6,v <-- file6
  9016. new revision: delete; previous revision: 1\.1\.2\.1
  9017. done
  9018. Checking in file9;
  9019. ${CVSROOT_DIRNAME}/first-dir/file9,v <-- file9
  9020. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  9021. done"
  9022. # Tag the current revisions on the branch.
  9023. dotest join4-15 "${testcvs} -q tag T2 ." \
  9024. 'T file1
  9025. T file2
  9026. T file8
  9027. T file9'
  9028. # Modify file4 locally, and do an update with a merge.
  9029. cd ../../1/first-dir
  9030. echo 'third revision of file4' > file4
  9031. dotest join4-18 "$testcvs -q update -jT1 -jT2 ." \
  9032. "U file1
  9033. R file10
  9034. A file2
  9035. $PROG update: file file2 exists, but has been added in revision T2
  9036. $PROG update: scheduling file3 for removal
  9037. M file4
  9038. $PROG update: file file4 has been removed in revision T2, but the destination is incompatibly modified
  9039. C file4
  9040. R file6
  9041. A file7
  9042. R file8
  9043. R file9
  9044. $PROG update: file file9 does not exist, but is present in revision T2"
  9045. # Verify that the right changes have been scheduled.
  9046. dotest_fail join4-19 "${testcvs} -q update" \
  9047. 'A file1
  9048. R file10
  9049. A file2
  9050. R file3
  9051. C file4
  9052. R file6
  9053. A file7
  9054. R file8
  9055. R file9'
  9056. cd ../..
  9057. rm -r 1 2
  9058. rm -rf ${CVSROOT_DIRNAME}/first-dir
  9059. ;;
  9060. join5)
  9061. # This test verifies that CVS can handle filenames starting with a
  9062. # dash (`-') properly. What used to happen was that CVS handled it
  9063. # just fine, until it went to pass them as arguments to the diff
  9064. # library, at which point it neglected to pass `--' before the file
  9065. # list, causing the diff library to attempt to interpret the file
  9066. # name as an argument.
  9067. mkdir join5; cd join5
  9068. mkdir 1; cd 1
  9069. dotest join5-init-1 "${testcvs} -Q co -l ."
  9070. mkdir join5
  9071. dotest join5-init-2 "${testcvs} -Q add join5"
  9072. cd join5
  9073. echo "there once was a file from harrisburg" >-file
  9074. echo "who's existance it seems was quiteabsurd" >>-file
  9075. dotest join5-init-3 "${testcvs} -Q add -- -file"
  9076. dotest join5-init-4 "${testcvs} -q ci -minitial" \
  9077. "RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
  9078. done
  9079. Checking in -file;
  9080. ${CVSROOT_DIRNAME}/join5/-file,v <-- -file
  9081. initial revision: 1\.1
  9082. done"
  9083. cd ../..
  9084. mkdir 2; cd 2
  9085. dotest join5-init-5 "${testcvs} -Q co join5"
  9086. cd join5
  9087. echo "it tested for free" >>-file
  9088. echo "when paid it should be" >>-file
  9089. dotest join5-init-4 "${testcvs} -q ci -msecond" \
  9090. "Checking in -file;
  9091. ${CVSROOT_DIRNAME}/join5/-file,v <-- -file
  9092. new revision: 1\.2; previous revision: 1\.1
  9093. done"
  9094. cd ../..
  9095. cd 1/join5
  9096. echo "but maybe it could charge bytheword" >>-file
  9097. # This is the test that used to spew complaints from diff3:
  9098. dotest join5 "${testcvs} up" \
  9099. "${PROG} update: Updating \.
  9100. RCS file: ${CVSROOT_DIRNAME}/join5/-file,v
  9101. retrieving revision 1\.1
  9102. retrieving revision 1\.2
  9103. Merging differences between 1\.1 and 1\.2 into -file
  9104. rcsmerge: warning: conflicts during merge
  9105. ${PROG} update: conflicts found in -file
  9106. C -file"
  9107. cd ../..
  9108. if $keep; then
  9109. echo Keeping ${TESTDIR} and exiting due to --keep
  9110. exit 0
  9111. fi
  9112. cd ..
  9113. rm -r join5
  9114. rm -rf ${CVSROOT_DIRNAME}/join5
  9115. ;;
  9116. join6)
  9117. mkdir join6; cd join6
  9118. mkdir 1; cd 1
  9119. dotest join6-init-1 "${testcvs} -Q co -l ."
  9120. mkdir join6
  9121. dotest join6-init-2 "${testcvs} -Q add join6"
  9122. cd join6
  9123. echo aaa >temp.txt
  9124. echo bbb >>temp.txt
  9125. echo ccc >>temp.txt
  9126. dotest join6-1 "${testcvs} -Q add temp.txt"
  9127. dotest join6-2 "${testcvs} -q commit -minitial temp.txt" \
  9128. "RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9129. done
  9130. Checking in temp\.txt;
  9131. ${CVSROOT_DIRNAME}/join6/temp.txt,v <-- temp\.txt
  9132. initial revision: 1\.1
  9133. done"
  9134. cp temp.txt temp2.txt
  9135. echo ddd >>temp.txt
  9136. dotest join6-3 "${testcvs} -q commit -madd temp.txt" \
  9137. "Checking in temp\.txt;
  9138. ${CVSROOT_DIRNAME}/join6/temp.txt,v <-- temp\.txt
  9139. new revision: 1\.2; previous revision: 1\.1
  9140. done"
  9141. # The case where the merge target is up-to-date and its base revision
  9142. # matches the second argument to -j: CVS doesn't bother attempting
  9143. # the merge since it already knows that the target contains the
  9144. # change.
  9145. dotest join6-3.3 "${testcvs} update -j1.1 -j1.2 temp.txt" \
  9146. "temp\.txt already contains the differences between 1\.1 and 1\.2"
  9147. dotest join6-3.4 "${testcvs} diff temp.txt" ""
  9148. # The case where the merge target is modified but already contains
  9149. # the change.
  9150. echo bbb >temp.txt
  9151. echo ccc >>temp.txt
  9152. echo ddd >>temp.txt
  9153. dotest join6-3.5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
  9154. "M temp\.txt
  9155. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9156. retrieving revision 1\.1
  9157. retrieving revision 1\.2
  9158. Merging differences between 1\.1 and 1\.2 into temp\.txt
  9159. temp\.txt already contains the differences between 1\.1 and 1\.2"
  9160. dotest_fail join6-3.6 "${testcvs} diff temp.txt" \
  9161. "Index: temp\.txt
  9162. ===================================================================
  9163. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9164. retrieving revision 1\.2
  9165. diff -r1\.2 temp.txt
  9166. 1d0
  9167. < aaa"
  9168. cp temp2.txt temp.txt
  9169. dotest_fail join6-4 "${testcvs} diff temp.txt" \
  9170. "Index: temp.txt
  9171. ===================================================================
  9172. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9173. retrieving revision 1\.2
  9174. diff -r1\.2 temp\.txt
  9175. 4d3
  9176. < ddd"
  9177. dotest join6-5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
  9178. "M temp\.txt
  9179. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9180. retrieving revision 1\.1
  9181. retrieving revision 1\.2
  9182. Merging differences between 1\.1 and 1\.2 into temp\.txt"
  9183. dotest join6-6 "${testcvs} diff temp.txt" ""
  9184. mv temp.txt temp3.txt
  9185. dotest join6-7 "sed 's/ddd/dddd/' < temp3.txt > temp.txt" ""
  9186. dotest join6-8 "${testcvs} update -j1.1 -j1.2 temp.txt" \
  9187. "M temp\.txt
  9188. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9189. retrieving revision 1\.1
  9190. retrieving revision 1\.2
  9191. Merging differences between 1\.1 and 1\.2 into temp\.txt
  9192. rcsmerge: warning: conflicts during merge"
  9193. dotest_fail join6-9 "${testcvs} diff temp.txt" \
  9194. "Index: temp\.txt
  9195. ===================================================================
  9196. RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
  9197. retrieving revision 1\.2
  9198. diff -r1\.2 temp\.txt
  9199. 3a4,6
  9200. > <<<<<<< temp\.txt
  9201. > dddd
  9202. > =======
  9203. 4a8
  9204. > >>>>>>> 1\.2"
  9205. cp temp2.txt temp.txt
  9206. dotest join6-10 "${testcvs} -q ci -m del temp.txt" \
  9207. "Checking in temp\.txt;
  9208. ${CVSROOT_DIRNAME}/join6/temp.txt,v <-- temp\.txt
  9209. new revision: 1\.3; previous revision: 1\.2
  9210. done"
  9211. cp temp3.txt temp.txt
  9212. dotest_fail join6-11 "${testcvs} diff temp.txt" \
  9213. "Index: temp\.txt
  9214. ===================================================================
  9215. RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
  9216. retrieving revision 1\.3
  9217. diff -r1\.3 temp\.txt
  9218. 3a4
  9219. > ddd"
  9220. dotest join6-12 "${testcvs} update -j1.2 -j1.3 temp.txt" \
  9221. "M temp\.txt
  9222. RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
  9223. retrieving revision 1\.2
  9224. retrieving revision 1\.3
  9225. Merging differences between 1\.2 and 1\.3 into temp\.txt"
  9226. dotest join6-13 "${testcvs} diff temp.txt" ""
  9227. # The case where the merge target wasn't created until after the
  9228. # first tag was applied
  9229. rm temp2.txt temp3.txt
  9230. dotest join6-20 "${testcvs} -q tag -r1.1 t1" \
  9231. "T temp.txt"
  9232. echo xxx >temp2.txt
  9233. dotest join6-21 "${testcvs} -Q add temp2.txt"
  9234. dotest join6-22 "${testcvs} -q ci -m." \
  9235. "RCS file: ${CVSROOT_DIRNAME}/join6/temp2.txt,v
  9236. done
  9237. Checking in temp2\.txt;
  9238. ${CVSROOT_DIRNAME}/join6/temp2\.txt,v <-- temp2\.txt
  9239. initial revision: 1\.1
  9240. done"
  9241. dotest join6-23 "${testcvs} -q tag t2" \
  9242. "T temp.txt
  9243. T temp2.txt"
  9244. echo xxx >>temp.txt
  9245. dotest join6-24 "${testcvs} -q ci -m." \
  9246. "Checking in temp\.txt;
  9247. ${CVSROOT_DIRNAME}/join6/temp.txt,v <-- temp\.txt
  9248. new revision: 1\.4; previous revision: 1\.3
  9249. done"
  9250. dotest join6-25 "${testcvs} -q up -jt1 -jt2" \
  9251. "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
  9252. retrieving revision 1\.1
  9253. retrieving revision 1\.3
  9254. Merging differences between 1\.1 and 1\.3 into temp.txt
  9255. temp.txt already contains the differences between 1\.1 and 1\.3
  9256. temp2.txt already contains the differences between creation and 1\.1"
  9257. # Now for my next trick: delete the file, recreate it, and
  9258. # try to merge
  9259. dotest join6-30 "${testcvs} -q rm -f temp2.txt" \
  9260. "${PROG} remove: use .${PROG} commit. to remove this file permanently"
  9261. dotest join6-31 "${testcvs} -q ci -m. temp2.txt" \
  9262. "Removing temp2\.txt;
  9263. ${CVSROOT_DIRNAME}/join6/temp2\.txt,v <-- temp2\.txt
  9264. new revision: delete; previous revision: 1\.1
  9265. done"
  9266. echo new >temp2.txt
  9267. # FIXCVS: Local and remote really shouldn't be different and there
  9268. # really shouldn't be two different status lines for temp2.txt
  9269. if $remote; then
  9270. dotest_fail join6-32 "${testcvs} -q up -jt1 -jt2" \
  9271. "? temp2\.txt
  9272. RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
  9273. retrieving revision 1\.1
  9274. retrieving revision 1\.3
  9275. Merging differences between 1\.1 and 1\.3 into temp.txt
  9276. temp.txt already contains the differences between 1\.1 and 1\.3
  9277. ${PROG} update: move away \./temp2\.txt; it is in the way
  9278. C temp2\.txt"
  9279. else
  9280. dotest join6-32 "${testcvs} -q up -jt1 -jt2" \
  9281. "RCS file: ${CVSROOT_DIRNAME}/join6/temp.txt,v
  9282. retrieving revision 1\.1
  9283. retrieving revision 1\.3
  9284. Merging differences between 1\.1 and 1\.3 into temp.txt
  9285. temp.txt already contains the differences between 1\.1 and 1\.3
  9286. ${PROG} update: use .${PROG} add. to create an entry for temp2\.txt
  9287. U temp2\.txt
  9288. ? temp2\.txt"
  9289. fi
  9290. cd ../../..
  9291. if $keep; then
  9292. echo Keeping ${TESTDIR} and exiting due to --keep
  9293. exit 0
  9294. fi
  9295. rm -r join6
  9296. rm -rf ${CVSROOT_DIRNAME}/join6
  9297. ;;
  9298. join7)
  9299. # This test deals with joins that happen with the -n switch
  9300. mkdir join7; cd join7
  9301. mkdir impdir; cd impdir
  9302. echo aaa >temp.txt
  9303. echo bbb >>temp.txt
  9304. echo ccc >>temp.txt
  9305. dotest join7-1 \
  9306. "${testcvs} -Q import -minitial join7 vendor vers-1" \
  9307. ""
  9308. cd ..
  9309. dotest join7-2 "${testcvs} -Q co join7" ""
  9310. cd join7
  9311. echo ddd >> temp.txt
  9312. dotest join7-3 "${testcvs} -Q ci -madded-line temp.txt" \
  9313. "Checking in temp.txt;
  9314. $CVSROOT_DIRNAME/join7/temp.txt,v <-- temp.txt
  9315. new revision: 1\.2; previous revision: 1\.1
  9316. done"
  9317. cd ../impdir
  9318. echo aaaa >temp.txt
  9319. echo bbbb >>temp.txt
  9320. echo ccc >>temp.txt
  9321. echo eee >>temp.txt
  9322. dotest join7-4 \
  9323. "${testcvs} -Q import -minitial join7 vendor vers-2" \
  9324. ""
  9325. cd ../join7
  9326. dotest join7-5 \
  9327. "${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \
  9328. "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
  9329. retrieving revision 1\.1\.1\.1
  9330. retrieving revision 1\.1\.1\.2
  9331. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
  9332. rcsmerge: warning: conflicts during merge"
  9333. touch temp.txt
  9334. dotest join7-6 "${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \
  9335. "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
  9336. retrieving revision 1\.1\.1\.1
  9337. retrieving revision 1\.1\.1\.2
  9338. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
  9339. rcsmerge: warning: conflicts during merge" \
  9340. "RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v
  9341. retrieving revision 1\.1\.1\.1
  9342. retrieving revision 1\.1\.1\.2
  9343. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt
  9344. rcsmerge: warning: conflicts during merge"
  9345. if $keep; then
  9346. echo Keeping ${TESTDIR} and exiting due to --keep
  9347. exit 0
  9348. fi
  9349. cd ../..
  9350. rm -r join7
  9351. rm -rf $CVSROOT_DIRNAME/join7
  9352. ;;
  9353. join8)
  9354. # In this test case, we have 2 projects, one called "pvcs" and one
  9355. # called "project". The "pvcs" project has modified the file, while
  9356. # the "project" project has caused a deletion. When "project" is
  9357. # merged into "pvcs", we expect CVS to detect a conflict.
  9358. mkdir join8; cd join8
  9359. mkdir combine
  9360. mkdir base
  9361. mkdir pvcs
  9362. mkdir project
  9363. echo "aaa" >base/file.txt
  9364. echo "bbb" >pvcs/file.txt
  9365. echo "ccc" >project/xxx.txt
  9366. cd base
  9367. dotest join8-1 \
  9368. "$testcvs import -b 1.1.101 -ko -m 'base import' join8 base base-1" \
  9369. "N join8/file\.txt
  9370. No conflicts created by this import"
  9371. cd ../pvcs
  9372. dotest join8-2 \
  9373. "$testcvs import -b 1.1.201 -ko -m 'pvcs import' join8 pvcs pvcs-1" \
  9374. "C join8/file\.txt
  9375. 1 conflicts created by this import.
  9376. Use the following command to help the merge:
  9377. $PROG checkout -j<prev_rel_tag> -jpvcs-1 join8"
  9378. cd ../project
  9379. dotest join8-3 \
  9380. "$testcvs import -b 1.1.301 -ko -m 'project import' join8 project project-1" \
  9381. "N join8/xxx\.txt
  9382. No conflicts created by this import"
  9383. cd ..
  9384. dotest join8-4 \
  9385. "$testcvs checkout -r pvcs-1 -j base-1 -j project-1 -d combine join8" \
  9386. "$PROG checkout: Updating combine
  9387. U combine/file\.txt
  9388. $PROG checkout: file combine/file\.txt has been removed in revision project-1, but the destination is incompatibly modified
  9389. C combine/file.txt
  9390. U combine/xxx\.txt"
  9391. dotest join8-5 \
  9392. "$testcvs -Q up -pr base-1 combine/file.txt >combine/file.txt"
  9393. dotest join8-6 \
  9394. "$testcvs up -j base-1 -j project-1 combine" \
  9395. "$PROG update: Updating combine
  9396. M combine/file\.txt
  9397. $PROG update: scheduling combine/file\.txt for removal
  9398. A combine/xxx\.txt
  9399. $PROG update: file combine/xxx\.txt exists, but has been added in revision project-1"
  9400. cd ..
  9401. if $keep; then
  9402. echo Keeping $TESTDIR and exiting due to --keep
  9403. exit 0
  9404. fi
  9405. rm -r join8
  9406. rm -rf $CVSROOT_DIRNAME/join8
  9407. ;;
  9408. join9)
  9409. # In this test case, we have 2 projects, one called "pvcs" and one
  9410. # called "project". The "pvcs" project has not modified the file,
  9411. # while the "project" project has caused a deletion. When "project"
  9412. # is merged into "pvcs", we expect CVS to remove the file without
  9413. # fuss, as there is no conflict.
  9414. mkdir join9; cd join9
  9415. mkdir combine
  9416. mkdir base
  9417. mkdir pvcs
  9418. mkdir project
  9419. echo "aaa" >base/file.txt
  9420. echo "aaa" >pvcs/file.txt
  9421. echo "ccc" >project/xxx.txt
  9422. cd base
  9423. dotest join9-1 \
  9424. "$testcvs import -b 1.1.101 -ko -m 'base import' join9 base base-1" \
  9425. "N join9/file\.txt
  9426. No conflicts created by this import"
  9427. cd ../pvcs
  9428. dotest join9-2 \
  9429. "$testcvs import -b 1.1.201 -ko -m 'pvcs import' join9 pvcs pvcs-1" \
  9430. "C join9/file\.txt
  9431. 1 conflicts created by this import.
  9432. Use the following command to help the merge:
  9433. $PROG checkout -j<prev_rel_tag> -jpvcs-1 join9"
  9434. cd ../project
  9435. dotest join9-3 \
  9436. "$testcvs import -b 1.1.301 -ko -m 'project import' join9 project project-1" \
  9437. "N join9/xxx\.txt
  9438. No conflicts created by this import"
  9439. cd ..
  9440. dotest join9-4 \
  9441. "$testcvs checkout -r pvcs-1 -j base-1 -j project-1 -d combine join9" \
  9442. "$PROG checkout: Updating combine
  9443. U combine/file\.txt
  9444. $PROG checkout: scheduling combine/file\.txt for removal
  9445. U combine/xxx\.txt"
  9446. cd ..
  9447. if $keep; then
  9448. echo Keeping $TESTDIR and exiting due to --keep
  9449. exit 0
  9450. fi
  9451. rm -r join9
  9452. rm -rf $CVSROOT_DIRNAME/join9
  9453. ;;
  9454. join-readonly-conflict)
  9455. # Previously, only tests 1 & 11 were being tested. I added the
  9456. # intermediate dotest's to try and diagnose a different failure
  9457. #
  9458. # Demonstrate that cvs-1.9.29 can fail on 2nd and subsequent
  9459. # conflict-evoking join attempts.
  9460. # Even with that version of CVS, This test failed only in
  9461. # client-server mode, and would have been noticed in normal
  9462. # operation only for files that were read-only (either due to
  9463. # use of cvs' global -r option, setting the CVSREAD envvar,
  9464. # or use of watch lists).
  9465. mkdir join-readonly-conflict; cd join-readonly-conflict
  9466. dotest join-readonly-conflict-1 "$testcvs -q co -l ." ''
  9467. module=join-readonly-conflict
  9468. mkdir $module
  9469. $testcvs -q add $module >>$LOGFILE 2>&1
  9470. cd $module
  9471. file=m
  9472. echo trunk > $file
  9473. dotest join-readonly-conflict-2 "$testcvs -Q add $file" ''
  9474. dotest join-readonly-conflict-3 "$testcvs -q ci -m . $file" \
  9475. "RCS file: $CVSROOT_DIRNAME/$module/$file,v
  9476. done
  9477. Checking in $file;
  9478. $CVSROOT_DIRNAME/$module/$file,v <-- $file
  9479. initial revision: 1\.1
  9480. done"
  9481. dotest join-readonly-conflict-4 "$testcvs tag -b B $file" "T $file"
  9482. dotest join-readonly-conflict-5 "$testcvs -q update -rB $file" \
  9483. "[UP] $file"
  9484. echo branch B > $file
  9485. dotest join-readonly-conflict-6 "$testcvs -q ci -m . $file" \
  9486. "Checking in $file;
  9487. $CVSROOT_DIRNAME/$module/$file,v <-- $file
  9488. new revision: 1\.1\.2\.1; previous revision: 1\.1
  9489. done"
  9490. rm $file
  9491. dotest join-readonly-conflict-7 "$testcvs -Q update -A $file" ''
  9492. # Make sure $file is read-only. This can happen more realistically
  9493. # via patch -- which could be used to apply a delta, yet would
  9494. # preserve a file's read-only permissions.
  9495. echo conflict > $file; chmod u-w $file
  9496. dotest join-readonly-conflict-8 "$testcvs update -r B $file" \
  9497. "RCS file: $CVSROOT_DIRNAME/$module/$file,v
  9498. retrieving revision 1\.1
  9499. retrieving revision 1\.1\.2\.1
  9500. Merging differences between 1\.1 and 1\.1\.2\.1 into $file
  9501. rcsmerge: warning: conflicts during merge
  9502. ${PROG} update: conflicts found in $file
  9503. C $file"
  9504. # restore to the trunk
  9505. rm -f $file
  9506. dotest join-readonly-conflict-9 "$testcvs -Q update -A $file" ''
  9507. # This one would fail because cvs couldn't open the existing
  9508. # (and read-only) .# file for writing.
  9509. echo conflict > $file
  9510. # verify that the backup file is not writable
  9511. if test -w ".#$file.1.1"; then
  9512. fail "join-readonly-conflict-10 : .#$file.1.1 is writable"
  9513. else
  9514. pass "join-readonly-conflict-10"
  9515. fi
  9516. dotest join-readonly-conflict-11 "$testcvs update -r B $file" \
  9517. "RCS file: $CVSROOT_DIRNAME/$module/$file,v
  9518. retrieving revision 1\.1
  9519. retrieving revision 1\.1\.2\.1
  9520. Merging differences between 1\.1 and 1\.1\.2\.1 into $file
  9521. rcsmerge: warning: conflicts during merge
  9522. ${PROG} update: conflicts found in $file
  9523. C m"
  9524. cd ../..
  9525. if $keep; then :; else
  9526. rm -rf join-readonly-conflict
  9527. rm -rf $CVSROOT_DIRNAME/$module
  9528. fi
  9529. ;;
  9530. join-admin)
  9531. mkdir 1; cd 1
  9532. dotest join-admin-1 "$testcvs -q co -l ." ''
  9533. module=x
  9534. mkdir $module
  9535. $testcvs -q add $module >>$LOGFILE 2>&1
  9536. cd $module
  9537. # Create a file so applying the first tag works.
  9538. echo foo > a
  9539. $testcvs -Q add a > /dev/null 2>&1
  9540. $testcvs -Q ci -m. a > /dev/null 2>&1
  9541. $testcvs -Q tag -b B
  9542. $testcvs -Q tag -b M1
  9543. echo '$''Id$' > b
  9544. $testcvs -Q add b > /dev/null 2>&1
  9545. $testcvs -Q ci -m. b > /dev/null 2>&1
  9546. $testcvs -Q tag -b M2
  9547. $testcvs -Q update -r B
  9548. $testcvs -Q update -kk -jM1 -jM2
  9549. $testcvs -Q ci -m. b >/dev/null 2>&1
  9550. $testcvs -Q update -A
  9551. # Verify that the -kk flag from the update did not
  9552. # propagate to the repository.
  9553. dotest join-admin-1 "$testcvs status b" \
  9554. "===================================================================
  9555. File: b Status: Up-to-date
  9556. Working revision: 1\.1.*
  9557. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/x/b,v
  9558. Sticky Tag: (none)
  9559. Sticky Date: (none)
  9560. Sticky Options: (none)"
  9561. cd ../..
  9562. rm -rf 1
  9563. rm -rf ${CVSROOT_DIRNAME}/$module
  9564. ;;
  9565. join-admin-2)
  9566. # Show that when a merge (via update -kk -jtag1 -jtag2) first
  9567. # removes a file, then modifies another containing an $Id...$ line,
  9568. # the resulting file contains the unexpanded `$Id.$' string, as
  9569. # -kk requires.
  9570. mkdir 1; cd 1
  9571. dotest join-admin-2-1 "$testcvs -q co -l ." ''
  9572. module=x
  9573. mkdir $module
  9574. dotest join-admin-2-2 "$testcvs -q add $module" \
  9575. "Directory ${CVSROOT_DIRNAME}/x added to the repository"
  9576. cd $module
  9577. # Create a file so applying the first tag works.
  9578. echo '$''Id$' > e0
  9579. cp e0 e
  9580. dotest join-admin-2-3 "$testcvs -Q add e" ''
  9581. dotest join-admin-2-4 "$testcvs -Q ci -m. e" \
  9582. "RCS file: ${CVSROOT_DIRNAME}/x/e,v
  9583. done
  9584. Checking in e;
  9585. ${CVSROOT_DIRNAME}/x/e,v <-- e
  9586. initial revision: 1\.1
  9587. done"
  9588. dotest join-admin-2-5 "$testcvs -Q tag -b T" '' "${QUESTION} e0"
  9589. dotest join-admin-2-6 "$testcvs -Q update -r T" '' "${QUESTION} e0"
  9590. cp e0 e
  9591. dotest join-admin-2-7 "$testcvs -Q ci -m. e" \
  9592. "Checking in e;
  9593. ${CVSROOT_DIRNAME}/x/e,v <-- e
  9594. new revision: 1\.1\.2\.1; previous revision: 1\.1
  9595. done"
  9596. dotest join-admin-2-8 "$testcvs -Q update -A" '' "${QUESTION} e0"
  9597. dotest join-admin-2-9 "$testcvs -Q tag -b M1" '' "${QUESTION} e0"
  9598. echo '$''Id$' > b
  9599. dotest join-admin-2-10 "$testcvs -Q add b" ''
  9600. cp e0 e
  9601. dotest join-admin-2-11 "$testcvs -Q ci -m. b e" \
  9602. "RCS file: ${CVSROOT_DIRNAME}/x/b,v
  9603. done
  9604. Checking in b;
  9605. ${CVSROOT_DIRNAME}/x/b,v <-- b
  9606. initial revision: 1\.1
  9607. done
  9608. Checking in e;
  9609. ${CVSROOT_DIRNAME}/x/e,v <-- e
  9610. new revision: 1\.2; previous revision: 1\.1
  9611. done"
  9612. dotest join-admin-2-12 "$testcvs -Q tag -b M2" '' "${QUESTION} e0"
  9613. dotest join-admin-2-13 "$testcvs -Q update -r T" '' "${QUESTION} e0"
  9614. dotest join-admin-2-14 "$testcvs update -kk -jM1 -jM2" \
  9615. "${PROG} update: Updating .
  9616. U b
  9617. U e
  9618. RCS file: ${CVSROOT_DIRNAME}/x/e,v
  9619. retrieving revision 1\.1
  9620. retrieving revision 1\.2
  9621. Merging differences between 1\.1 and 1\.2 into e
  9622. e already contains the differences between 1\.1 and 1\.2
  9623. ${QUESTION} e0" \
  9624. "${QUESTION} e0
  9625. ${PROG} update: Updating .
  9626. U b
  9627. U e
  9628. RCS file: ${CVSROOT_DIRNAME}/x/e,v
  9629. retrieving revision 1\.1
  9630. retrieving revision 1\.2
  9631. Merging differences between 1\.1 and 1\.2 into e
  9632. e already contains the differences between 1\.1 and 1\.2"
  9633. # Verify that the $Id.$ string is not expanded.
  9634. dotest join-admin-2-15 "cat e" '$''Id$'
  9635. cd ../..
  9636. rm -rf 1
  9637. rm -rf ${CVSROOT_DIRNAME}/$module
  9638. ;;
  9639. join-rm)
  9640. # This first half of this test checks that a single-argument merge
  9641. # from a branch is capable of removing files.
  9642. #
  9643. # The second half verifies that an update to another location with an
  9644. # uncommitted removal will transfer the destination branch of the
  9645. # removal.
  9646. module=join-rm
  9647. mkdir $module; cd $module
  9648. dotest join-rm-init-1 "$testcvs -q co -l ." ''
  9649. mkdir $module
  9650. dotest join-rm-init-2 "$testcvs -q add $module" \
  9651. "Directory $CVSROOT_DIRNAME/$module added to the repository"
  9652. cd $module
  9653. # add some files.
  9654. touch a b c d e f g
  9655. dotest join-rm-init-3 "$testcvs -Q add a b c d e f g"
  9656. dotest join-rm-init-4 "$testcvs -Q ci -m add-em" \
  9657. "RCS file: $CVSROOT_DIRNAME/join-rm/a,v
  9658. done
  9659. Checking in a;
  9660. $CVSROOT_DIRNAME/join-rm/a,v <-- a
  9661. initial revision: 1\.1
  9662. done
  9663. RCS file: $CVSROOT_DIRNAME/join-rm/b,v
  9664. done
  9665. Checking in b;
  9666. $CVSROOT_DIRNAME/join-rm/b,v <-- b
  9667. initial revision: 1\.1
  9668. done
  9669. RCS file: $CVSROOT_DIRNAME/join-rm/c,v
  9670. done
  9671. Checking in c;
  9672. $CVSROOT_DIRNAME/join-rm/c,v <-- c
  9673. initial revision: 1\.1
  9674. done
  9675. RCS file: $CVSROOT_DIRNAME/join-rm/d,v
  9676. done
  9677. Checking in d;
  9678. $CVSROOT_DIRNAME/join-rm/d,v <-- d
  9679. initial revision: 1\.1
  9680. done
  9681. RCS file: $CVSROOT_DIRNAME/join-rm/e,v
  9682. done
  9683. Checking in e;
  9684. $CVSROOT_DIRNAME/join-rm/e,v <-- e
  9685. initial revision: 1\.1
  9686. done
  9687. RCS file: $CVSROOT_DIRNAME/join-rm/f,v
  9688. done
  9689. Checking in f;
  9690. $CVSROOT_DIRNAME/join-rm/f,v <-- f
  9691. initial revision: 1\.1
  9692. done
  9693. RCS file: $CVSROOT_DIRNAME/join-rm/g,v
  9694. done
  9695. Checking in g;
  9696. $CVSROOT_DIRNAME/join-rm/g,v <-- g
  9697. initial revision: 1\.1
  9698. done"
  9699. # create the branch and update to it
  9700. dotest join-rm-init-5 "$testcvs -Q tag -b br"
  9701. dotest join-rm-init-6 "$testcvs -Q up -rbr"
  9702. # remove a few files from the branch
  9703. dotest join-rm-init-7 "$testcvs -Q rm -f b d g"
  9704. dotest join-rm-init-8 "$testcvs -Q ci -mrm" \
  9705. "Removing b;
  9706. $CVSROOT_DIRNAME/join-rm/b,v <-- b
  9707. new revision: delete; previous revision: 1\.1
  9708. done
  9709. Removing d;
  9710. $CVSROOT_DIRNAME/join-rm/d,v <-- d
  9711. new revision: delete; previous revision: 1\.1
  9712. done
  9713. Removing g;
  9714. $CVSROOT_DIRNAME/join-rm/g,v <-- g
  9715. new revision: delete; previous revision: 1\.1
  9716. done"
  9717. # update to the trunk
  9718. dotest join-rm-init-9 "$testcvs -Q up -A"
  9719. # now for the test - try and merge the removals.
  9720. dotest join-rm-1 "$testcvs -q up -jbr" \
  9721. "$PROG update: scheduling b for removal
  9722. $PROG update: scheduling d for removal
  9723. $PROG update: scheduling g for removal"
  9724. # And make sure the merge took
  9725. dotest join-rm-2 "$testcvs -qn up" \
  9726. "R b
  9727. R d
  9728. R g"
  9729. dotest join-rm-3 "$testcvs -q ci -m 'save the merge'" \
  9730. "Removing b;
  9731. $CVSROOT_DIRNAME/join-rm/b,v <-- b
  9732. new revision: delete; previous revision: 1\.1
  9733. done
  9734. Removing d;
  9735. $CVSROOT_DIRNAME/join-rm/d,v <-- d
  9736. new revision: delete; previous revision: 1\.1
  9737. done
  9738. Removing g;
  9739. $CVSROOT_DIRNAME/join-rm/g,v <-- g
  9740. new revision: delete; previous revision: 1\.1
  9741. done"
  9742. # and verify that it was the head revision which was removed.
  9743. dotest join-rm-4 "$testcvs -q log b" "
  9744. RCS file: $CVSROOT_DIRNAME/join-rm/Attic/b,v
  9745. Working file: b
  9746. head: 1\.2
  9747. branch:
  9748. locks: strict
  9749. access list:
  9750. symbolic names:
  9751. br: 1\.1\.0\.2
  9752. keyword substitution: kv
  9753. total revisions: 3; selected revisions: 3
  9754. description:
  9755. ----------------------------
  9756. revision 1\.2
  9757. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: ${PLUS}0 -0
  9758. save the merge
  9759. ----------------------------
  9760. revision 1\.1
  9761. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  9762. branches: 1.1.2;
  9763. add-em
  9764. ----------------------------
  9765. revision 1\.1\.2\.1
  9766. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: ${PLUS}0 -0
  9767. rm
  9768. ============================================================================="
  9769. # go back to the branch to set up for the second set of tests
  9770. dotest join-rm-init-10 "$testcvs -Q up -rbr"
  9771. dotest join-rm-init-11 "$testcvs -Q rm -f a"
  9772. dotest join-rm-init-12 "$testcvs -Q ci -m rma" \
  9773. "Removing a;
  9774. $CVSROOT_DIRNAME/join-rm/a,v <-- a
  9775. new revision: delete; previous revision: 1\.1
  9776. done"
  9777. # now the test: update to the trunk
  9778. #
  9779. # FIXCVS: This update should merge the removal to the trunk. It does
  9780. # not.
  9781. dotest join-rm-5 "$testcvs -q up -A" \
  9782. 'U a
  9783. U c
  9784. U e
  9785. U f'
  9786. # and verify that there is no sticky tag
  9787. dotest join-rm-6 "$testcvs status a" \
  9788. "===================================================================
  9789. File: a Status: Up-to-date
  9790. Working revision: 1\.1.*
  9791. Repository revision: 1\.1 $CVSROOT_DIRNAME/join-rm/a,v
  9792. Sticky Tag: (none)
  9793. Sticky Date: (none)
  9794. Sticky Options: (none)"
  9795. if $keep; then
  9796. echo Keeping $TESTDIR and exiting due to --keep
  9797. exit 0
  9798. fi
  9799. cd ../..
  9800. rm -rf $CVSROOT_DIRNAME/$module
  9801. rm -r $module
  9802. ;;
  9803. new) # look for stray "no longer pertinent" messages.
  9804. mkdir ${CVSROOT_DIRNAME}/first-dir
  9805. if ${CVS} co first-dir ; then
  9806. pass 117
  9807. else
  9808. fail 117
  9809. fi
  9810. cd first-dir
  9811. touch a
  9812. if ${CVS} add a 2>>${LOGFILE}; then
  9813. pass 118
  9814. else
  9815. fail 118
  9816. fi
  9817. if ${CVS} ci -m added >>${LOGFILE} 2>&1; then
  9818. pass 119
  9819. else
  9820. fail 119
  9821. fi
  9822. rm a
  9823. if ${CVS} rm a 2>>${LOGFILE}; then
  9824. pass 120
  9825. else
  9826. fail 120
  9827. fi
  9828. if ${CVS} ci -m removed >>${LOGFILE} ; then
  9829. pass 121
  9830. else
  9831. fail 121
  9832. fi
  9833. if ${CVS} update -A 2>&1 | grep longer ; then
  9834. fail 122
  9835. else
  9836. pass 122
  9837. fi
  9838. if ${CVS} update -rHEAD 2>&1 | grep longer ; then
  9839. fail 123
  9840. else
  9841. pass 123
  9842. fi
  9843. cd ..
  9844. rm -r first-dir
  9845. rm -rf ${CVSROOT_DIRNAME}/first-dir
  9846. ;;
  9847. newb)
  9848. # Test removing a file on a branch and then checking it out.
  9849. # We call this "newb" only because it, like the "new" tests,
  9850. # has something to do with "no longer pertinent" messages.
  9851. # Not necessarily the most brilliant nomenclature.
  9852. # Create file 'a'.
  9853. mkdir ${CVSROOT_DIRNAME}/first-dir
  9854. dotest newb-123a "${testcvs} -q co first-dir" ''
  9855. cd first-dir
  9856. touch a
  9857. dotest newb-123b "${testcvs} add a" \
  9858. "${PROG} add: scheduling file .a. for addition
  9859. ${PROG} add: use .${PROG} commit. to add this file permanently"
  9860. dotest newb-123c "${testcvs} -q ci -m added" \
  9861. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  9862. done
  9863. Checking in a;
  9864. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  9865. initial revision: 1\.1
  9866. done"
  9867. # Make a branch.
  9868. dotest newb-123d "${testcvs} -q tag -b branch" "T a"
  9869. # Check out the branch.
  9870. cd ..
  9871. rm -r first-dir
  9872. mkdir 1
  9873. cd 1
  9874. dotest newb-123e "${testcvs} -q co -r branch first-dir" \
  9875. "U first-dir/a"
  9876. # Remove 'a' on another copy of the branch.
  9877. cd ..
  9878. mkdir 2
  9879. cd 2
  9880. dotest newb-123f "${testcvs} -q co -r branch first-dir" \
  9881. "U first-dir/a"
  9882. cd first-dir
  9883. rm a
  9884. dotest newb-123g "${testcvs} rm a" \
  9885. "${PROG} remove: scheduling .a. for removal
  9886. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  9887. dotest newb-123h "${testcvs} -q ci -m removed" \
  9888. "Removing a;
  9889. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  9890. new revision: delete; previous revision: 1\.1
  9891. done"
  9892. # Check out the file on the branch. This should report
  9893. # that the file is not pertinent, but it should not
  9894. # say anything else.
  9895. cd ..
  9896. rm -r first-dir
  9897. dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
  9898. "${PROG} checkout: warning: first-dir/a is not (any longer) pertinent"
  9899. # Update the other copy, and make sure that a is removed.
  9900. cd ../1/first-dir
  9901. # "Entry Invalid" is a rather strange output here. Something like
  9902. # "Removed in Repository" would make more sense.
  9903. dotest newb-123j0 "${testcvs} status a" \
  9904. "${PROG} status: a is no longer in the repository
  9905. ===================================================================
  9906. File: a Status: Entry Invalid
  9907. Working revision: 1\.1.*
  9908. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/a,v
  9909. Sticky Tag: branch (branch: 1\.1\.2)
  9910. Sticky Date: (none)
  9911. Sticky Options: (none)"
  9912. dotest newb-123j "${testcvs} -q update" \
  9913. "${PROG} update: a is no longer in the repository"
  9914. if test -f a; then
  9915. fail newb-123k
  9916. else
  9917. pass newb-123k
  9918. fi
  9919. cd ../..
  9920. rm -r 1 2
  9921. rm -rf ${CVSROOT_DIRNAME}/first-dir
  9922. ;;
  9923. conflicts)
  9924. mkdir ${CVSROOT_DIRNAME}/first-dir
  9925. mkdir 1
  9926. cd 1
  9927. dotest conflicts-124 "${testcvs} -q co first-dir" ''
  9928. cd first-dir
  9929. touch a
  9930. dotest conflicts-125 "${testcvs} add a" \
  9931. "${PROG} add: scheduling file .a. for addition
  9932. ${PROG} add: use .${PROG} commit. to add this file permanently"
  9933. dotest conflicts-126 "${testcvs} -q ci -m added" \
  9934. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  9935. done
  9936. Checking in a;
  9937. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  9938. initial revision: 1\.1
  9939. done"
  9940. cd ../..
  9941. mkdir 2
  9942. cd 2
  9943. dotest conflicts-126.5 "${testcvs} co -p first-dir" \
  9944. "${PROG} checkout: Updating first-dir
  9945. ===================================================================
  9946. Checking out first-dir/a
  9947. RCS: ${CVSROOT_DIRNAME}/first-dir/a,v
  9948. VERS: 1\.1
  9949. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
  9950. if ${CVS} co first-dir ; then
  9951. pass 127
  9952. else
  9953. fail 127
  9954. fi
  9955. cd first-dir
  9956. if test -f a; then
  9957. pass 127a
  9958. else
  9959. fail 127a
  9960. fi
  9961. cd ../../1/first-dir
  9962. echo add a line >>a
  9963. mkdir dir1
  9964. dotest conflicts-127b "${testcvs} add dir1" \
  9965. "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
  9966. dotest conflicts-128 "${testcvs} -q ci -m changed" \
  9967. "Checking in a;
  9968. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  9969. new revision: 1\.2; previous revision: 1\.1
  9970. done"
  9971. cd ../..
  9972. # Similar to conflicts-126.5, but now the file has nonempty
  9973. # contents.
  9974. mkdir 3
  9975. cd 3
  9976. dotest conflicts-128.5 "${testcvs} co -p -l first-dir" \
  9977. "${PROG} checkout: Updating first-dir
  9978. ===================================================================
  9979. Checking out first-dir/a
  9980. RCS: ${CVSROOT_DIRNAME}/first-dir/a,v
  9981. VERS: 1\.2
  9982. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  9983. add a line"
  9984. cd ..
  9985. rmdir 3
  9986. # Now go over the to the other working directory and
  9987. # start testing conflicts
  9988. cd 2/first-dir
  9989. echo add a conflicting line >>a
  9990. dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
  9991. "${PROG}"' commit: Up-to-date check failed for `a'\''
  9992. '"${PROG}"' \[commit aborted\]: correct above errors first!'
  9993. mkdir dir1
  9994. mkdir sdir
  9995. dotest conflicts-status-0 "${testcvs} status a" \
  9996. "===================================================================
  9997. File: a Status: Needs Merge
  9998. Working revision: 1\.1.*
  9999. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/a,v
  10000. Sticky Tag: (none)
  10001. Sticky Date: (none)
  10002. Sticky Options: (none)"
  10003. dotest conflicts-129a "${testcvs} -nq update a" \
  10004. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  10005. retrieving revision 1\.1
  10006. retrieving revision 1\.2
  10007. Merging differences between 1\.1 and 1\.2 into a
  10008. rcsmerge: warning: conflicts during merge
  10009. ${PROG} update: conflicts found in a
  10010. C a"
  10011. dotest conflicts-130 "${testcvs} -q update" \
  10012. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  10013. retrieving revision 1\.1
  10014. retrieving revision 1\.2
  10015. Merging differences between 1\.1 and 1\.2 into a
  10016. rcsmerge: warning: conflicts during merge
  10017. ${PROG} update: conflicts found in a
  10018. C a
  10019. ${QUESTION} dir1
  10020. ${QUESTION} sdir" \
  10021. "${QUESTION} dir1
  10022. ${QUESTION} sdir
  10023. RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  10024. retrieving revision 1\.1
  10025. retrieving revision 1\.2
  10026. Merging differences between 1\.1 and 1\.2 into a
  10027. rcsmerge: warning: conflicts during merge
  10028. ${PROG} update: conflicts found in a
  10029. C a"
  10030. rmdir dir1 sdir
  10031. dotest conflicts-status-1 "${testcvs} status a" \
  10032. "===================================================================
  10033. File: a Status: Unresolved Conflict
  10034. Working revision: 1\.2.*
  10035. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/a,v
  10036. Sticky Tag: (none)
  10037. Sticky Date: (none)
  10038. Sticky Options: (none)"
  10039. dotest_fail conflicts-131 "${testcvs} -q ci -m try" \
  10040. "${PROG} commit: file .a. had a conflict and has not been modified
  10041. ${PROG} \[commit aborted\]: correct above errors first!"
  10042. # Try to check in the file with the conflict markers in it.
  10043. # Make sure we detect any one of the three conflict markers
  10044. mv a aa
  10045. grep '^<<<<<<<' aa >a
  10046. dotest conflicts-status-2 "${testcvs} -nq ci -m try a" \
  10047. "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
  10048. grep '^=======' aa >a
  10049. dotest conflicts-status-3 "${testcvs} -nq ci -m try a" \
  10050. "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
  10051. grep '^>>>>>>>' aa >a
  10052. dotest conflicts-status-4 "${testcvs} -qn ci -m try a" \
  10053. "${PROG} commit: warning: file .a. seems to still contain conflict indicators"
  10054. mv aa a
  10055. echo lame attempt at resolving it >>a
  10056. dotest conflicts-status-5 "${testcvs} status a" \
  10057. "===================================================================
  10058. File: a Status: File had conflicts on merge
  10059. Working revision: 1\.2.*
  10060. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/a,v
  10061. Sticky Tag: (none)
  10062. Sticky Date: (none)
  10063. Sticky Options: (none)"
  10064. dotest conflicts-132 "${testcvs} -q ci -m try" \
  10065. "${PROG} commit: warning: file .a. seems to still contain conflict indicators
  10066. Checking in a;
  10067. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  10068. new revision: 1\.3; previous revision: 1\.2
  10069. done"
  10070. # OK, the user saw the warning (good user), and now
  10071. # resolves it for real.
  10072. echo resolve conflict >a
  10073. dotest conflicts-status-6 "${testcvs} status a" \
  10074. "===================================================================
  10075. File: a Status: Locally Modified
  10076. Working revision: 1\.3.*
  10077. Repository revision: 1\.3 ${CVSROOT_DIRNAME}/first-dir/a,v
  10078. Sticky Tag: (none)
  10079. Sticky Date: (none)
  10080. Sticky Options: (none)"
  10081. dotest conflicts-133 "${testcvs} -q ci -m resolved" \
  10082. "Checking in a;
  10083. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  10084. new revision: 1\.4; previous revision: 1\.3
  10085. done"
  10086. dotest conflicts-status-7 "${testcvs} status a" \
  10087. "===================================================================
  10088. File: a Status: Up-to-date
  10089. Working revision: 1\.4.*
  10090. Repository revision: 1\.4 ${CVSROOT_DIRNAME}/first-dir/a,v
  10091. Sticky Tag: (none)
  10092. Sticky Date: (none)
  10093. Sticky Options: (none)"
  10094. # Now test that we can add a file in one working directory
  10095. # and have an update in another get it.
  10096. cd ../../1/first-dir
  10097. echo abc >abc
  10098. if ${testcvs} add abc >>${LOGFILE} 2>&1; then
  10099. pass 134
  10100. else
  10101. fail 134
  10102. fi
  10103. if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
  10104. pass 135
  10105. else
  10106. fail 135
  10107. fi
  10108. cd ../../2
  10109. mkdir first-dir/dir1 first-dir/sdir
  10110. dotest conflicts-136 "${testcvs} -q update first-dir" \
  10111. '[UP] first-dir/abc
  10112. '"${QUESTION}"' first-dir/dir1
  10113. '"${QUESTION}"' first-dir/sdir' \
  10114. ''"${QUESTION}"' first-dir/dir1
  10115. '"${QUESTION}"' first-dir/sdir
  10116. [UP] first-dir/abc'
  10117. dotest conflicts-137 'test -f first-dir/abc' ''
  10118. rmdir first-dir/dir1 first-dir/sdir
  10119. # Now test something similar, but in which the parent directory
  10120. # (not the directory in question) has the Entries.Static flag
  10121. # set.
  10122. cd ../1/first-dir
  10123. mkdir subdir
  10124. if ${testcvs} add subdir >>${LOGFILE}; then
  10125. pass 138
  10126. else
  10127. fail 138
  10128. fi
  10129. cd ../..
  10130. mkdir 3
  10131. cd 3
  10132. if ${testcvs} -q co first-dir/abc first-dir/subdir \
  10133. >>${LOGFILE}; then
  10134. pass 139
  10135. else
  10136. fail 139
  10137. fi
  10138. cd ../1/first-dir/subdir
  10139. echo sss >sss
  10140. if ${testcvs} add sss >>${LOGFILE} 2>&1; then
  10141. pass 140
  10142. else
  10143. fail 140
  10144. fi
  10145. if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
  10146. pass 140
  10147. else
  10148. fail 140
  10149. fi
  10150. cd ../../../3/first-dir
  10151. if ${testcvs} -q update >>${LOGFILE}; then
  10152. pass 141
  10153. else
  10154. fail 141
  10155. fi
  10156. if test -f subdir/sss; then
  10157. pass 142
  10158. else
  10159. fail 142
  10160. fi
  10161. cd ../..
  10162. rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  10163. ;;
  10164. conflicts2)
  10165. # More conflicts tests; separate from conflicts to keep each
  10166. # test a manageable size.
  10167. mkdir ${CVSROOT_DIRNAME}/first-dir
  10168. mkdir 1
  10169. cd 1
  10170. dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
  10171. cd first-dir
  10172. touch a abc
  10173. dotest conflicts2-142a2 "${testcvs} add a abc" \
  10174. "${PROG} add: scheduling file .a. for addition
  10175. ${PROG} add: scheduling file .abc. for addition
  10176. ${PROG} add: use .${PROG} commit. to add these files permanently"
  10177. dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
  10178. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a,v
  10179. done
  10180. Checking in a;
  10181. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  10182. initial revision: 1\.1
  10183. done
  10184. RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  10185. done
  10186. Checking in abc;
  10187. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  10188. initial revision: 1\.1
  10189. done"
  10190. cd ../..
  10191. mkdir 2
  10192. cd 2
  10193. dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
  10194. U first-dir/abc'
  10195. cd ..
  10196. # BEGIN TESTS USING THE FILE A
  10197. # FIXME: would be cleaner to separate them out into their own
  10198. # tests; conflicts2 is getting long.
  10199. # Now test that if one person modifies and commits a
  10200. # file and a second person removes it, it is a
  10201. # conflict
  10202. cd 1/first-dir
  10203. echo modify a >>a
  10204. dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
  10205. "Checking in a;
  10206. ${CVSROOT_DIRNAME}/first-dir/a,v <-- a
  10207. new revision: 1\.2; previous revision: 1\.1
  10208. done"
  10209. cd ../../2/first-dir
  10210. rm a
  10211. dotest conflicts2-142b3 "${testcvs} rm a" \
  10212. "${PROG} remove: scheduling .a. for removal
  10213. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10214. dotest_fail conflicts2-142b4 "${testcvs} -q update" \
  10215. "${PROG} update: conflict: removed a was modified by second party
  10216. C a"
  10217. # Resolve the conflict by deciding not to remove the file
  10218. # after all.
  10219. dotest_sort conflicts2-142b5 "${testcvs} add a" "U a
  10220. ${PROG} add: a, version 1\.1, resurrected"
  10221. dotest conflicts2-142b5b1 "$testcvs status a" \
  10222. "===================================================================
  10223. File: a Status: Needs Patch
  10224. Working revision: 1\.1.*
  10225. Repository revision: 1\.2 $CVSROOT_DIRNAME/first-dir/a,v
  10226. Sticky Tag: (none)
  10227. Sticky Date: (none)
  10228. Sticky Options: (none)"
  10229. dotest conflicts2-142b6 "${testcvs} -q update" 'U a'
  10230. # Now one level up.
  10231. cd ..
  10232. dotest conflicts2-142b7 "${testcvs} rm -f first-dir/a" \
  10233. "${PROG} remove: scheduling .first-dir/a. for removal
  10234. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10235. if $remote; then
  10236. # Haven't investigated this one.
  10237. dotest_fail conflicts2-142b8r "$testcvs add first-dir/a" \
  10238. "${PROG} add: in directory \.:
  10239. ${PROG} \[add aborted\]: there is no version here; do '${PROG} checkout' first"
  10240. cd first-dir
  10241. else
  10242. dotest conflicts2-142b8 "${testcvs} add first-dir/a" \
  10243. "U first-dir/a
  10244. ${PROG} add: first-dir/a, version 1\.2, resurrected"
  10245. cd first-dir
  10246. # Now recover from the damage that the 142b8 test did.
  10247. dotest conflicts2-142b9 "${testcvs} rm -f a" \
  10248. "${PROG} remove: scheduling .a. for removal
  10249. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10250. fi
  10251. dotest_sort conflicts2-142b10 "${testcvs} add a" "U a
  10252. ${PROG} add: a, version 1\.2, resurrected"
  10253. # As with conflicts2-142b6, check that things are normal again.
  10254. dotest conflicts2-142b11 "${testcvs} -q update" ''
  10255. cd ../..
  10256. # END TESTS USING THE FILE A
  10257. # Now test that if one person removes a file and
  10258. # commits it, and a second person removes it, is it
  10259. # not a conflict.
  10260. cd 1/first-dir
  10261. rm abc
  10262. dotest conflicts2-142c0 "${testcvs} rm abc" \
  10263. "${PROG} remove: scheduling .abc. for removal
  10264. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10265. dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
  10266. "Removing abc;
  10267. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  10268. new revision: delete; previous revision: 1\.1
  10269. done"
  10270. cd ../../2/first-dir
  10271. rm abc
  10272. dotest conflicts2-142c2 "${testcvs} rm abc" \
  10273. "${PROG} remove: scheduling .abc. for removal
  10274. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10275. dotest conflicts2-142c3 "${testcvs} update" \
  10276. "${PROG} update: Updating \."
  10277. cd ../..
  10278. # conflicts2-142d*: test that if one party adds a file, and another
  10279. # party has a file of the same name, cvs notices
  10280. cd 1/first-dir
  10281. touch aa.c
  10282. echo 'contents unchanged' >same.c
  10283. dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
  10284. "${PROG} add: scheduling file .aa\.c. for addition
  10285. ${PROG} add: scheduling file .same\.c. for addition
  10286. ${PROG} add: use .${PROG} commit. to add these files permanently"
  10287. dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
  10288. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa\.c,v
  10289. done
  10290. Checking in aa\.c;
  10291. ${CVSROOT_DIRNAME}/first-dir/aa\.c,v <-- aa\.c
  10292. initial revision: 1\.1
  10293. done
  10294. RCS file: ${CVSROOT_DIRNAME}/first-dir/same\.c,v
  10295. done
  10296. Checking in same\.c;
  10297. ${CVSROOT_DIRNAME}/first-dir/same\.c,v <-- same\.c
  10298. initial revision: 1\.1
  10299. done"
  10300. cd ../../2/first-dir
  10301. echo "don't you dare obliterate this text" >aa.c
  10302. echo 'contents unchanged' >same.c
  10303. # Note the discrepancy between local and remote in the handling
  10304. # of same.c. I kind
  10305. # of suspect that the local CVS behavior is the more useful one
  10306. # although I do sort of wonder whether we should make people run
  10307. # cvs add just to get them in that habit (also, trying to implement
  10308. # the local CVS behavior for remote without the cvs add seems
  10309. # pretty difficult).
  10310. if $remote; then
  10311. dotest_fail conflicts2-142d2 "${testcvs} -q update" \
  10312. "${QUESTION} aa\.c
  10313. ${QUESTION} same\.c
  10314. ${PROG} update: move away \./aa\.c; it is in the way
  10315. C aa\.c
  10316. ${PROG} update: move away \./same\.c; it is in the way
  10317. C same\.c"
  10318. else
  10319. dotest_fail conflicts2-142d2 "${testcvs} -q update" \
  10320. "${PROG} [a-z]*: move away aa\.c; it is in the way
  10321. C aa\.c
  10322. U same\.c"
  10323. fi
  10324. dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
  10325. "${PROG} status: move away aa\.c; it is in the way
  10326. ===================================================================
  10327. File: aa\.c Status: Unresolved Conflict
  10328. Working revision: No entry for aa\.c
  10329. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/aa\.c,v"
  10330. # Could also be testing the case in which the cvs add happened
  10331. # before the commit by the other user.
  10332. # This message seems somewhat bogus. I mean, parallel development
  10333. # means that we get to work in parallel if we choose, right? And
  10334. # then at commit time it would be a conflict.
  10335. dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
  10336. "${PROG} add: aa.c added independently by second party"
  10337. # The user might want to see just what the conflict is.
  10338. # Don't bother, diff seems to kind of lose its mind, with or
  10339. # without -N. This is a CVS bug(s).
  10340. #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
  10341. # Now: "how can the user resolve this conflict", I hear you cry.
  10342. # Well, one way is to forget about the file in the working
  10343. # directory.
  10344. # Since it didn't let us do the add in conflicts2-142d4, there
  10345. # is no need to run cvs rm here.
  10346. #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
  10347. dotest conflicts2-142d6 "rm aa.c" ''
  10348. dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
  10349. dotest conflicts2-142d8 "cat aa.c" ''
  10350. # The other way is to use the version from the working directory
  10351. # instead of the version from the repository. Unfortunately,
  10352. # there doesn't seem to be any particularly clear way to do
  10353. # this (?).
  10354. cd ../..
  10355. rm -r 1 2; rm -rf ${CVSROOT_DIRNAME}/first-dir
  10356. ;;
  10357. conflicts3)
  10358. # More tests of conflicts and/or multiple working directories
  10359. # in general.
  10360. mkdir 1; cd 1
  10361. dotest conflicts3-1 "${testcvs} -q co -l ." ''
  10362. mkdir first-dir
  10363. dotest conflicts3-2 "${testcvs} add first-dir" \
  10364. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  10365. cd ..
  10366. mkdir 2; cd 2
  10367. dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
  10368. cd ../1/first-dir
  10369. touch file1 file2
  10370. dotest conflicts3-4 "${testcvs} add file1 file2" \
  10371. "${PROG} add: scheduling file .file1. for addition
  10372. ${PROG} add: scheduling file .file2. for addition
  10373. ${PROG} add: use .${PROG} commit. to add these files permanently"
  10374. dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
  10375. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  10376. done
  10377. Checking in file1;
  10378. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  10379. initial revision: 1\.1
  10380. done
  10381. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  10382. done
  10383. Checking in file2;
  10384. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  10385. initial revision: 1\.1
  10386. done"
  10387. cd ../../2/first-dir
  10388. # Check that -n doesn't make CVS lose its mind as it creates
  10389. # (or rather, doesn't) a new file.
  10390. dotest conflicts3-6 "${testcvs} -nq update" \
  10391. "U file1
  10392. U file2"
  10393. dotest_fail conflicts3-7 "test -f file1" ''
  10394. dotest conflicts3-8 "${testcvs} -q update" \
  10395. "U file1
  10396. U file2"
  10397. dotest conflicts3-9 "test -f file2" ''
  10398. # OK, now remove two files at once
  10399. dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
  10400. "${PROG} remove: scheduling .file1. for removal
  10401. ${PROG} remove: scheduling .file2. for removal
  10402. ${PROG} remove: use .${PROG} commit. to remove these files permanently"
  10403. dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
  10404. "Removing file1;
  10405. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  10406. new revision: delete; previous revision: 1\.1
  10407. done
  10408. Removing file2;
  10409. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  10410. new revision: delete; previous revision: 1\.1
  10411. done"
  10412. cd ../../1/first-dir
  10413. dotest conflicts3-12 "${testcvs} -n -q update" \
  10414. "${PROG} update: file1 is no longer in the repository
  10415. ${PROG} update: file2 is no longer in the repository"
  10416. dotest conflicts3-13 "${testcvs} -q update" \
  10417. "${PROG} update: file1 is no longer in the repository
  10418. ${PROG} update: file2 is no longer in the repository"
  10419. # OK, now add a directory to both working directories
  10420. # and see that CVS doesn't lose its mind.
  10421. mkdir sdir
  10422. dotest conflicts3-14 "${testcvs} add sdir" \
  10423. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
  10424. touch sdir/sfile
  10425. dotest conflicts3-14a "${testcvs} add sdir/sfile" \
  10426. "${PROG} add: scheduling file .sdir/sfile. for addition
  10427. ${PROG} add: use .${PROG} commit. to add this file permanently"
  10428. dotest conflicts3-14b "${testcvs} -q ci -m add" \
  10429. "RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v
  10430. done
  10431. Checking in sdir/sfile;
  10432. ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v <-- sfile
  10433. initial revision: 1\.1
  10434. done"
  10435. cd ../../2/first-dir
  10436. # Create a CVS directory without the proper administrative
  10437. # files in it. This can happen for example if you hit ^C
  10438. # in the middle of a checkout.
  10439. mkdir sdir
  10440. mkdir sdir/CVS
  10441. # OK, in the local case CVS sees that the directory exists
  10442. # in the repository and recurses into it. In the remote case
  10443. # CVS can't see the repository and has no way of knowing
  10444. # that sdir is even a directory (stat'ing everything would be
  10445. # too slow). The remote behavior makes more sense to me (but
  10446. # would this affect other cases?).
  10447. if $remote; then
  10448. dotest conflicts3-15 "${testcvs} -q update" \
  10449. "${QUESTION} sdir"
  10450. else
  10451. dotest conflicts3-15 "${testcvs} -q update" \
  10452. "${QUESTION} sdir
  10453. ${PROG} update: ignoring sdir (CVS/Repository missing)"
  10454. touch sdir/CVS/Repository
  10455. dotest conflicts3-16 "${testcvs} -q update" \
  10456. "${QUESTION} sdir
  10457. ${PROG} update: ignoring sdir (CVS/Entries missing)"
  10458. cd ..
  10459. dotest conflicts3-16a "${testcvs} -q update first-dir" \
  10460. "${QUESTION} first-dir/sdir
  10461. ${PROG} update: ignoring first-dir/sdir (CVS/Entries missing)"
  10462. cd first-dir
  10463. fi
  10464. rm -r sdir
  10465. # OK, now the same thing, but the directory doesn't exist
  10466. # in the repository.
  10467. mkdir newdir
  10468. mkdir newdir/CVS
  10469. dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
  10470. echo "D/newdir////" >> CVS/Entries
  10471. dotest conflicts3-18 "${testcvs} -q update" \
  10472. "${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
  10473. touch newdir/CVS/Repository
  10474. dotest conflicts3-19 "${testcvs} -q update" \
  10475. "${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
  10476. cd ..
  10477. dotest conflicts3-20 "${testcvs} -q update first-dir" \
  10478. "${PROG} [a-z]*: ignoring first-dir/newdir (CVS/Entries missing)"
  10479. cd first-dir
  10480. rm -r newdir
  10481. # The previous tests have left CVS/Entries in something of a mess.
  10482. # While we "should" be able to deal with that (maybe), for now
  10483. # we just start over.
  10484. cd ..
  10485. rm -r first-dir
  10486. dotest conflicts3-20a "${testcvs} -q co -l first-dir" ''
  10487. cd first-dir
  10488. dotest conflicts3-21 "${testcvs} -q update -d sdir" "U sdir/sfile"
  10489. rm -r sdir/CVS
  10490. dotest conflicts3-22 "${testcvs} -q update" "${QUESTION} sdir"
  10491. if $remote; then
  10492. dotest_fail conflicts3-23 "${testcvs} -q update -PdA" \
  10493. "${QUESTION} sdir
  10494. ${PROG} update: move away sdir/sfile; it is in the way
  10495. C sdir/sfile"
  10496. else
  10497. dotest conflicts3-23 "${testcvs} -q update -PdA" \
  10498. "${QUESTION} sdir"
  10499. fi
  10500. # Not that it should really affect much, but let's do the case
  10501. # where sfile has been removed. For example, suppose that sdir
  10502. # had been a CVS-controlled directory which was then removed
  10503. # by removing each file (and using update -P or some such). Then
  10504. # suppose that the build process creates an sdir directory which
  10505. # is not supposed to be under CVS.
  10506. rm -r sdir
  10507. dotest conflicts3-24 "${testcvs} -q update -d sdir" "U sdir/sfile"
  10508. rm sdir/sfile
  10509. dotest conflicts3-25 "${testcvs} rm sdir/sfile" \
  10510. "${PROG} remove: scheduling .sdir/sfile. for removal
  10511. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  10512. dotest conflicts3-26 "${testcvs} ci -m remove sdir/sfile" \
  10513. "Removing sdir/sfile;
  10514. ${CVSROOT_DIRNAME}/first-dir/sdir/sfile,v <-- sfile
  10515. new revision: delete; previous revision: 1\.1
  10516. done"
  10517. rm -r sdir/CVS
  10518. dotest conflicts3-27 "${testcvs} -q update" "${QUESTION} sdir"
  10519. dotest conflicts3-28 "${testcvs} -q update -PdA" \
  10520. "${QUESTION} sdir"
  10521. cd ../..
  10522. rm -r 1 2
  10523. rm -rf ${CVSROOT_DIRNAME}/first-dir
  10524. ;;
  10525. conflicts4)
  10526. mkdir conflicts4; cd conflicts4
  10527. mkdir 1; cd 1
  10528. dotest conflicts4-1 "$testcvs -q co -l ."
  10529. mkdir first-dir
  10530. dotest conflicts4-2 "${testcvs} add first-dir" \
  10531. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  10532. cd ..
  10533. mkdir 2; cd 2
  10534. dotest conflicts4-3 "${testcvs} -q co -l first-dir" ''
  10535. cd ../1/first-dir
  10536. echo baseline >file1
  10537. dotest conflicts4-4 "${testcvs} -q add file1" \
  10538. "$PROG add: use .$PROG commit. to add this file permanently"
  10539. dotest conflicts4-5 "${testcvs} -q ci -m add-it" \
  10540. "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
  10541. done
  10542. Checking in file1;
  10543. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  10544. initial revision: 1\.1
  10545. done"
  10546. cd ../../2/first-dir
  10547. dotest conflicts4-6 "${testcvs} -q update" "U file1"
  10548. # Make a local change
  10549. echo wibble2 >> file1
  10550. dotest conflicts4-7 "${testcvs} -q ci -m update2" \
  10551. "Checking in file1;
  10552. $CVSROOT_DIRNAME/first-dir/file1,v <-- file1
  10553. new revision: 1\.2; previous revision: 1\.1
  10554. done"
  10555. cd ../../1/first-dir
  10556. echo wibble1 >>file1
  10557. dotest conflicts4-8 "${testcvs} -Q update" \
  10558. "RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
  10559. retrieving revision 1\.1
  10560. retrieving revision 1\.2
  10561. Merging differences between 1\.1 and 1\.2 into file1
  10562. rcsmerge: warning: conflicts during merge
  10563. cvs update: conflicts found in file1"
  10564. dotest_fail conflicts4-9 "${testcvs} -q update" \
  10565. "C file1"
  10566. if $remote; then
  10567. cat >$TESTDIR/conflicts4/serveme <<EOF
  10568. #!$TESTSHELL
  10569. # This is admittedly a bit cheezy, in the sense that we make lots
  10570. # of assumptions about what the client is going to send us.
  10571. # We don't mention Repository, because current clients don't require it.
  10572. # Sending these at our own pace, rather than waiting for the client to
  10573. # make the requests, is bogus, but hopefully we can get away with it.
  10574. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option"
  10575. echo "ok"
  10576. echo "MT text C "
  10577. echo "MT fname file1"
  10578. echo "MT newline"
  10579. echo "error "
  10580. cat >$TESTDIR/conflicts4/client.out
  10581. EOF
  10582. # Cygwin. Pthffffffffft!
  10583. if test -n "$remotehost"; then
  10584. $CVS_RSH $remotehost "chmod +x $TESTDIR/conflicts4/serveme"
  10585. else
  10586. chmod +x $TESTDIR/conflicts4/serveme
  10587. fi
  10588. save_CVS_SERVER=$CVS_SERVER
  10589. CVS_SERVER=$TESTDIR/conflicts4/serveme; export CVS_SERVER
  10590. dotest_fail conflicts4-10r "$testcvs -q up" "C file1"
  10591. dotest conflicts4-11r "cat $TESTDIR/conflicts4/client.out" \
  10592. "$DOTSTAR
  10593. Argument --
  10594. Directory .
  10595. $CVSROOT_DIRNAME/first-dir
  10596. Entry /file1/1.2/$PLUS=//
  10597. Modified file1
  10598. u=.*,g=.*,o=.*
  10599. 59
  10600. baseline
  10601. ""<<<<<<< file1
  10602. wibble1
  10603. ""=======
  10604. wibble2
  10605. "">>>>>>> 1.2
  10606. update"
  10607. cat >$TESTDIR/conflicts4/serveme <<EOF
  10608. #!$TESTSHELL
  10609. # This is admittedly a bit cheezy, in the sense that we make lots
  10610. # of assumptions about what the client is going to send us.
  10611. # We don't mention Repository, because current clients don't require it.
  10612. # Sending these at our own pace, rather than waiting for the client to
  10613. # make the requests, is bogus, but hopefully we can get away with it.
  10614. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option Empty-conflicts"
  10615. echo "ok"
  10616. echo "MT text C "
  10617. echo "MT fname file1"
  10618. echo "MT newline"
  10619. echo "error "
  10620. cat >$TESTDIR/conflicts4/client.out
  10621. EOF
  10622. dotest_fail conflicts4-12r "$testcvs -q up" "C file1"
  10623. dotest conflicts4-13r "cat $TESTDIR/conflicts4/client.out" \
  10624. "$DOTSTAR
  10625. Argument --
  10626. Directory .
  10627. $CVSROOT_DIRNAME/first-dir
  10628. Entry /file1/1.2/$PLUS=//
  10629. Unchanged file1
  10630. update"
  10631. CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER
  10632. fi
  10633. if $keep; then
  10634. echo Keeping $TESTDIR and exiting due to --keep
  10635. exit 0
  10636. fi
  10637. cd ../../..
  10638. rm -rf conflicts4
  10639. rm -rf $CVSROOT_DIRNAME/first-dir
  10640. ;;
  10641. clean)
  10642. # Test update -C (overwrite local mods w/ repository copies)
  10643. mkdir 1; cd 1
  10644. dotest clean-1 "${testcvs} -q co -l ." ''
  10645. mkdir first-dir
  10646. dotest clean-2 "${testcvs} add first-dir" \
  10647. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  10648. cd first-dir
  10649. echo "The usual boring test text." > cleanme.txt
  10650. dotest clean-3 "${testcvs} add cleanme.txt" \
  10651. "${PROG} add: scheduling file .cleanme\.txt. for addition
  10652. ${PROG} add: use .${PROG} commit. to add this file permanently"
  10653. dotest clean-4 "${testcvs} -q ci -m clean-3" \
  10654. "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
  10655. done
  10656. Checking in cleanme\.txt;
  10657. ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v <-- cleanme\.txt
  10658. initial revision: 1\.1
  10659. done"
  10660. # Okay, preparation is done, now test.
  10661. # Check that updating an unmodified copy works.
  10662. dotest clean-5 "${testcvs} -q update" ''
  10663. # Check that updating -C an unmodified copy works.
  10664. dotest clean-6 "${testcvs} -q update -C" ''
  10665. # Check that updating a modified copy works.
  10666. echo "fish" >> cleanme.txt
  10667. dotest clean-7 "${testcvs} -q update" 'M cleanme\.txt'
  10668. # Check that updating -C a modified copy works.
  10669. dotest clean-8 "${testcvs} -q update -C" \
  10670. "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
  10671. U cleanme\.txt"
  10672. # And check that the backup copy really was made.
  10673. dotest clean-9 "cat .#cleanme.txt.1.1" \
  10674. "The usual boring test text\.
  10675. fish"
  10676. # Do it all again, this time naming the file explicitly.
  10677. rm .#cleanme.txt.1.1
  10678. dotest clean-10 "${testcvs} -q update cleanme.txt" ''
  10679. dotest clean-11 "${testcvs} -q update -C cleanme.txt" ''
  10680. echo "bluegill" >> cleanme.txt
  10681. dotest clean-12 "${testcvs} -q update cleanme.txt" 'M cleanme\.txt'
  10682. dotest clean-13 "${testcvs} -q update -C cleanme.txt" \
  10683. "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
  10684. U cleanme\.txt"
  10685. # And check that the backup copy really was made.
  10686. dotest clean-14 "cat .#cleanme.txt.1.1" \
  10687. "The usual boring test text\.
  10688. bluegill"
  10689. # Now try with conflicts
  10690. cd ..
  10691. dotest clean-15 "${testcvs} -q co -d second-dir first-dir" \
  10692. 'U second-dir/cleanme\.txt'
  10693. cd second-dir
  10694. echo "conflict test" >> cleanme.txt
  10695. dotest clean-16 "${testcvs} -q ci -m." \
  10696. "Checking in cleanme\.txt;
  10697. ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v <-- cleanme\.txt
  10698. new revision: 1\.2; previous revision: 1\.1
  10699. done"
  10700. cd ../first-dir
  10701. echo "fish" >> cleanme.txt
  10702. dotest clean-17 "${testcvs} -nq update" \
  10703. "RCS file: ${CVSROOT_DIRNAME}/first-dir/cleanme\.txt,v
  10704. retrieving revision 1\.1
  10705. retrieving revision 1\.2
  10706. Merging differences between 1\.1 and 1\.2 into cleanme\.txt
  10707. rcsmerge: warning: conflicts during merge
  10708. ${PROG} update: conflicts found in cleanme\.txt
  10709. C cleanme\.txt"
  10710. dotest clean-18 "${testcvs} -q update -C" \
  10711. "(Locally modified cleanme\.txt moved to \.#cleanme\.txt\.1\.1)
  10712. U cleanme\.txt"
  10713. dotest clean-19 "cat .#cleanme.txt.1.1" \
  10714. "The usual boring test text\.
  10715. fish"
  10716. # Done. Clean up.
  10717. cd ../..
  10718. rm -rf 1
  10719. rm -rf ${CVSROOT_DIRNAME}/first-dir
  10720. ;;
  10721. modules)
  10722. # Tests of various ways to define and use modules.
  10723. # Roadmap to various modules tests:
  10724. # -a:
  10725. # error on incorrect placement: modules
  10726. # error combining with other options: modules2-a*
  10727. # infinite loops: modules148a1.1 - modules148a1.2
  10728. # use to specify a file more than once: modules3
  10729. # use with ! feature: modules4
  10730. # regular modules: modules, modules2, cvsadm
  10731. # ampersand modules: modules2
  10732. # -s: modules.
  10733. # -d: modules, modules3, cvsadm
  10734. # -i, -o, -u, -e, -t: modules5
  10735. # slashes in module names: modules3
  10736. # invalid module definitions: modules6
  10737. ############################################################
  10738. # These tests are to make sure that administrative files get
  10739. # rebuilt, regardless of how and where files are checked
  10740. # out.
  10741. ############################################################
  10742. # Check out the whole repository
  10743. mkdir 1; cd 1
  10744. dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
  10745. U CVSROOT/commitinfo
  10746. U CVSROOT/config
  10747. U CVSROOT/cvswrappers
  10748. U CVSROOT/editinfo
  10749. U CVSROOT/loginfo
  10750. U CVSROOT/modules
  10751. U CVSROOT/notify
  10752. U CVSROOT/rcsinfo
  10753. U CVSROOT/taginfo
  10754. U CVSROOT/verifymsg'
  10755. echo "# made a change" >>CVSROOT/modules
  10756. dotest modules-1d "${testcvs} -q ci -m add-modules" \
  10757. "Checking in CVSROOT/modules;
  10758. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  10759. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  10760. done
  10761. ${PROG} commit: Rebuilding administrative file database"
  10762. cd ..
  10763. rm -rf 1
  10764. ############################################################
  10765. # Check out CVSROOT
  10766. mkdir 1; cd 1
  10767. dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
  10768. U CVSROOT/commitinfo
  10769. U CVSROOT/config
  10770. U CVSROOT/cvswrappers
  10771. U CVSROOT/editinfo
  10772. U CVSROOT/loginfo
  10773. U CVSROOT/modules
  10774. U CVSROOT/notify
  10775. U CVSROOT/rcsinfo
  10776. U CVSROOT/taginfo
  10777. U CVSROOT/verifymsg'
  10778. echo "# made a change" >>CVSROOT/modules
  10779. dotest modules-2d "${testcvs} -q ci -m add-modules" \
  10780. "Checking in CVSROOT/modules;
  10781. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  10782. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  10783. done
  10784. ${PROG} commit: Rebuilding administrative file database"
  10785. cd ..
  10786. rm -rf 1
  10787. ############################################################
  10788. # Check out CVSROOT in some other directory
  10789. mkdir ${CVSROOT_DIRNAME}/somedir
  10790. mkdir 1; cd 1
  10791. dotest modules-3 "${testcvs} -q co somedir" ''
  10792. cd somedir
  10793. dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
  10794. U CVSROOT/commitinfo
  10795. U CVSROOT/config
  10796. U CVSROOT/cvswrappers
  10797. U CVSROOT/editinfo
  10798. U CVSROOT/loginfo
  10799. U CVSROOT/modules
  10800. U CVSROOT/notify
  10801. U CVSROOT/rcsinfo
  10802. U CVSROOT/taginfo
  10803. U CVSROOT/verifymsg'
  10804. echo "# made a change" >>CVSROOT/modules
  10805. dotest modules-3g "${testcvs} -q ci -m add-modules" \
  10806. "Checking in CVSROOT/modules;
  10807. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  10808. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  10809. done
  10810. ${PROG} commit: Rebuilding administrative file database"
  10811. cd ../..
  10812. rm -rf 1
  10813. rm -rf ${CVSROOT_DIRNAME}/somedir
  10814. ############################################################
  10815. # end rebuild tests
  10816. ############################################################
  10817. mkdir ${CVSROOT_DIRNAME}/first-dir
  10818. mkdir 1
  10819. cd 1
  10820. dotest modules-143 "${testcvs} -q co first-dir" ""
  10821. cd first-dir
  10822. mkdir subdir
  10823. dotest modules-143a "${testcvs} add subdir" \
  10824. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
  10825. cd subdir
  10826. mkdir ssdir
  10827. dotest modules-143b "${testcvs} add ssdir" \
  10828. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
  10829. touch a b
  10830. dotest modules-144 "${testcvs} add a b" \
  10831. "${PROG} add: scheduling file .a. for addition
  10832. ${PROG} add: scheduling file .b. for addition
  10833. ${PROG} add: use .${PROG} commit. to add these files permanently"
  10834. dotest modules-145 "${testcvs} ci -m added" \
  10835. "${PROG} [a-z]*: Examining .
  10836. ${PROG} [a-z]*: Examining ssdir
  10837. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
  10838. done
  10839. Checking in a;
  10840. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  10841. initial revision: 1\.1
  10842. done
  10843. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
  10844. done
  10845. Checking in b;
  10846. ${CVSROOT_DIRNAME}/first-dir/subdir/b,v <-- b
  10847. initial revision: 1\.1
  10848. done"
  10849. cd ..
  10850. dotest modules-146 "${testcvs} -q co CVSROOT" \
  10851. "U CVSROOT/checkoutlist
  10852. U CVSROOT/commitinfo
  10853. U CVSROOT/config
  10854. U CVSROOT/cvswrappers
  10855. U CVSROOT/editinfo
  10856. U CVSROOT/loginfo
  10857. U CVSROOT/modules
  10858. U CVSROOT/notify
  10859. U CVSROOT/rcsinfo
  10860. U CVSROOT/taginfo
  10861. U CVSROOT/verifymsg"
  10862. # Here we test that CVS can deal with CVSROOT (whose repository
  10863. # is at top level) in the same directory as subdir (whose repository
  10864. # is a subdirectory of first-dir). TODO: Might want to check that
  10865. # files can actually get updated in this state.
  10866. dotest modules-147 "${testcvs} -q update" ""
  10867. cat >CVSROOT/modules <<EOF
  10868. realmodule first-dir/subdir a
  10869. dirmodule first-dir/subdir
  10870. namedmodule -d nameddir first-dir/subdir
  10871. aliasmodule -a first-dir/subdir/a
  10872. aliasnested -a first-dir/subdir/ssdir
  10873. topfiles -a first-dir/file1 first-dir/file2
  10874. world -a .
  10875. statusmod -s Mungeable
  10876. # Check for ability to block infinite loops.
  10877. infinitealias -a infinitealias
  10878. # Prior to 1.11.12 & 1.12.6, the infinite alias loop check didn't strip
  10879. # slashes or work if a module called a module which then called itself
  10880. # (A -> A was blocked, but not A -> B -> A or deeper).
  10881. infinitealias2 -a infinitealias2/
  10882. infinitealias3 -a infinitealias4/
  10883. infinitealias4 -a aliasmodule infinitealias5
  10884. infinitealias5 -a infinitealias3/
  10885. # Options must come before arguments. It is possible this should
  10886. # be relaxed at some point (though the result would be bizarre for
  10887. # -a); for now test the current behavior.
  10888. bogusalias first-dir/subdir/a -a
  10889. EOF
  10890. dotest modules-148 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
  10891. "Checking in CVSROOT/modules;
  10892. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  10893. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  10894. done
  10895. ${PROG} commit: Rebuilding administrative file database"
  10896. cd ..
  10897. # The "statusmod" module contains an error; trying to use it
  10898. # will produce "modules file missing directory" I think.
  10899. # However, that shouldn't affect the ability of "cvs co -c" or
  10900. # "cvs co -s" to do something reasonable with it.
  10901. dotest modules-148a0 "${testcvs} co -c" 'aliasmodule -a first-dir/subdir/a
  10902. aliasnested -a first-dir/subdir/ssdir
  10903. bogusalias first-dir/subdir/a -a
  10904. dirmodule first-dir/subdir
  10905. infinitealias -a infinitealias
  10906. infinitealias2 -a infinitealias2/
  10907. infinitealias3 -a infinitealias4/
  10908. infinitealias4 -a aliasmodule infinitealias5
  10909. infinitealias5 -a infinitealias3/
  10910. namedmodule -d nameddir first-dir/subdir
  10911. realmodule first-dir/subdir a
  10912. statusmod -s Mungeable
  10913. topfiles -a first-dir/file1 first-dir/file2
  10914. world -a \.'
  10915. # There is code in modules.c:save_d which explicitly skips
  10916. # modules defined with -a, which is why aliasmodule is not
  10917. # listed.
  10918. dotest modules-148a1 "${testcvs} co -s" \
  10919. 'statusmod Mungeable
  10920. bogusalias NONE first-dir/subdir/a -a
  10921. dirmodule NONE first-dir/subdir
  10922. namedmodule NONE first-dir/subdir
  10923. realmodule NONE first-dir/subdir a'
  10924. # Check that infinite loops are avoided
  10925. dotest modules-148a1.1 "${testcvs} co infinitealias" \
  10926. "$PROG checkout: module \`infinitealias' in modules file contains infinite loop" \
  10927. "$PROG server: module \`infinitealias' in modules file contains infinite loop
  10928. $PROG checkout: module \`infinitealias' in modules file contains infinite loop"
  10929. # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
  10930. # strip slashes.
  10931. dotest modules-148a1.2 "${testcvs} co infinitealias2" \
  10932. "$PROG checkout: module \`infinitealias2' in modules file contains infinite loop" \
  10933. "$PROG server: module \`infinitealias2' in modules file contains infinite loop
  10934. $PROG checkout: module \`infinitealias2' in modules file contains infinite loop"
  10935. # Prior to 1.11.12 & 1.12.6, the inifinte alias loop check did not
  10936. # notice when A -> B -> A, it only noticed A -> A.
  10937. dotest modules-148a1.3 "${testcvs} co infinitealias3/" \
  10938. "$PROG checkout: module \`infinitealias3' in modules file contains infinite loop" \
  10939. "$PROG server: module \`infinitealias3' in modules file contains infinite loop
  10940. $PROG checkout: module \`infinitealias3' in modules file contains infinite loop"
  10941. # Test that real modules check out to realmodule/a, not subdir/a.
  10942. dotest modules-149a1 "${testcvs} co realmodule" "U realmodule/a"
  10943. dotest modules-149a2 "test -d realmodule && test -f realmodule/a" ""
  10944. dotest_fail modules-149a3 "test -f realmodule/b" ""
  10945. dotest modules-149a4 "${testcvs} -q co realmodule" ""
  10946. dotest modules-149a5 "echo yes | ${testcvs} release -d realmodule" \
  10947. "You have \[0\] altered files in this repository\.
  10948. Are you sure you want to release (and delete) directory .realmodule.: "
  10949. dotest_fail modules-149b1 "${testcvs} co realmodule/a" \
  10950. "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
  10951. "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
  10952. '"${PROG}"' \[checkout aborted\]: cannot expand modules'
  10953. # Now test the ability to check out a single file from a directory
  10954. dotest modules-150c "${testcvs} co dirmodule/a" "U dirmodule/a"
  10955. dotest modules-150d "test -d dirmodule && test -f dirmodule/a" ""
  10956. dotest_fail modules-150e "test -f dirmodule/b" ""
  10957. dotest modules-150f "echo yes | ${testcvs} release -d dirmodule" \
  10958. "You have \[0\] altered files in this repository\.
  10959. Are you sure you want to release (and delete) directory .dirmodule.: "
  10960. # Now test the ability to correctly reject a non-existent filename.
  10961. # For maximum studliness we would check that an error message is
  10962. # being output.
  10963. # We accept a zero exit status because it is what CVS does
  10964. # (Dec 95). Probably the exit status should be nonzero,
  10965. # however.
  10966. dotest modules-150g1 "${testcvs} co dirmodule/nonexist" \
  10967. "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared"
  10968. # We tolerate the creation of the dirmodule directory, since that
  10969. # is what CVS does, not because we view that as preferable to not
  10970. # creating it.
  10971. dotest_fail modules-150g2 "test -f dirmodule/a || test -f dirmodule/b" ""
  10972. rm -r dirmodule
  10973. # Now test that a module using -d checks out to the specified
  10974. # directory.
  10975. dotest modules-150h1 "${testcvs} -q co namedmodule" \
  10976. 'U nameddir/a
  10977. U nameddir/b'
  10978. dotest modules-150h2 "test -f nameddir/a && test -f nameddir/b" ""
  10979. echo add line >>nameddir/a
  10980. dotest modules-150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
  10981. rm nameddir/a
  10982. dotest modules-150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
  10983. dotest modules-150h99 "echo yes | ${testcvs} release -d nameddir" \
  10984. "You have \[0\] altered files in this repository\.
  10985. Are you sure you want to release (and delete) directory .nameddir.: "
  10986. # Now test that alias modules check out to subdir/a, not
  10987. # aliasmodule/a.
  10988. dotest modules-151 "${testcvs} co aliasmodule" ""
  10989. dotest_fail modules-152 "test -d aliasmodule" ""
  10990. echo abc >>first-dir/subdir/a
  10991. dotest modules-153 "${testcvs} -q co aliasmodule" "M first-dir/subdir/a"
  10992. cd ..
  10993. rm -r 1
  10994. mkdir 2
  10995. cd 2
  10996. dotest modules-155a0 "${testcvs} co aliasnested" \
  10997. "${PROG} checkout: Updating first-dir/subdir/ssdir"
  10998. dotest modules-155a1 "test -d first-dir" ''
  10999. dotest modules-155a2 "test -d first-dir/subdir" ''
  11000. dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
  11001. # Test that nothing extraneous got created.
  11002. dotest modules-155a4 "ls" "first-dir" \
  11003. "CVS
  11004. first-dir"
  11005. cd ..
  11006. rm -r 2
  11007. # Test checking out everything.
  11008. mkdir 1
  11009. cd 1
  11010. dotest modules-155b "${testcvs} -q co world" \
  11011. "U CVSROOT/${DOTSTAR}
  11012. U first-dir/subdir/a
  11013. U first-dir/subdir/b"
  11014. cd ..
  11015. rm -r 1
  11016. # Test checking out a module which lists at least two
  11017. # specific files twice. At one time, this failed over
  11018. # remote CVS.
  11019. mkdir 1
  11020. cd 1
  11021. dotest modules-155c1 "${testcvs} -q co first-dir" \
  11022. "U first-dir/subdir/a
  11023. U first-dir/subdir/b"
  11024. cd first-dir
  11025. echo 'first revision' > file1
  11026. echo 'first revision' > file2
  11027. dotest modules-155c2 "${testcvs} add file1 file2" \
  11028. "${PROG}"' add: scheduling file `file1'\'' for addition
  11029. '"${PROG}"' add: scheduling file `file2'\'' for addition
  11030. '"${PROG}"' add: use .'"${PROG}"' commit. to add these files permanently'
  11031. dotest modules-155c3 "${testcvs} -q ci -m add-it" \
  11032. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  11033. done
  11034. Checking in file1;
  11035. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  11036. initial revision: 1\.1
  11037. done
  11038. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  11039. done
  11040. Checking in file2;
  11041. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  11042. initial revision: 1\.1
  11043. done"
  11044. cd ..
  11045. rm -r first-dir
  11046. dotest modules-155c4 "${testcvs} -q co topfiles" \
  11047. "U first-dir/file1
  11048. U first-dir/file2"
  11049. dotest modules-155c5 "${testcvs} -q co topfiles" ""
  11050. # Make sure the right thing happens if we remove a file.
  11051. cd first-dir
  11052. dotest modules-155c6 "${testcvs} -q rm -f file1" \
  11053. "${PROG} remove: use .${PROG} commit. to remove this file permanently"
  11054. dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
  11055. "Removing file1;
  11056. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  11057. new revision: delete; previous revision: 1\.1
  11058. done"
  11059. cd ..
  11060. rm -r first-dir
  11061. dotest modules-155c8 "${testcvs} -q co topfiles" \
  11062. "${PROG} checkout: warning: first-dir/file1 is not (any longer) pertinent
  11063. U first-dir/file2"
  11064. cd ..
  11065. rm -r 1
  11066. rm -rf ${CVSROOT_DIRNAME}/first-dir
  11067. ;;
  11068. modules2)
  11069. # More tests of modules, in particular the & feature.
  11070. mkdir 1; cd 1
  11071. dotest modules2-setup-1 "${testcvs} -q co -l ." ''
  11072. mkdir first-dir second-dir third-dir
  11073. dotest modules2-setup-2 \
  11074. "${testcvs} add first-dir second-dir third-dir" \
  11075. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
  11076. Directory ${CVSROOT_DIRNAME}/second-dir added to the repository
  11077. Directory ${CVSROOT_DIRNAME}/third-dir added to the repository"
  11078. cd third-dir
  11079. touch file3
  11080. dotest modules2-setup-3 "${testcvs} add file3" \
  11081. "${PROG} add: scheduling file .file3. for addition
  11082. ${PROG} add: use .${PROG} commit. to add this file permanently"
  11083. dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
  11084. "RCS file: ${CVSROOT_DIRNAME}/third-dir/file3,v
  11085. done
  11086. Checking in file3;
  11087. ${CVSROOT_DIRNAME}/third-dir/file3,v <-- file3
  11088. initial revision: 1\.1
  11089. done"
  11090. cd ../..
  11091. rm -r 1
  11092. mkdir 1
  11093. cd 1
  11094. dotest modules2-1 "${testcvs} -q co CVSROOT/modules" \
  11095. 'U CVSROOT/modules'
  11096. cd CVSROOT
  11097. cat >> modules << EOF
  11098. ampermodule &first-dir &second-dir
  11099. combmodule third-dir file3 &first-dir
  11100. ampdirmod -d newdir &first-dir &second-dir
  11101. badmod -d newdir
  11102. messymod first-dir &messymodchild
  11103. messymodchild -d sdir/child second-dir
  11104. EOF
  11105. # Depending on whether the user also ran the modules test
  11106. # we will be checking in revision 1.2 or 1.3.
  11107. dotest modules2-2 "${testcvs} -q ci -m add-modules" \
  11108. "Checking in modules;
  11109. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  11110. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  11111. done
  11112. ${PROG} commit: Rebuilding administrative file database"
  11113. cd ..
  11114. dotest modules2-3 "${testcvs} -q co ampermodule" ''
  11115. dotest modules2-4 "test -d ampermodule/first-dir" ''
  11116. dotest modules2-5 "test -d ampermodule/second-dir" ''
  11117. # Test ability of cvs release to handle multiple arguments
  11118. # See comment at "release" for list of other cvs release tests.
  11119. cd ampermodule
  11120. if ${testcvs} release -d first-dir second-dir <<EOF >>${LOGFILE}
  11121. yes
  11122. yes
  11123. EOF
  11124. then
  11125. pass modules2-6
  11126. else
  11127. fail modules2-6
  11128. fi
  11129. dotest_fail modules2-7 "test -d first-dir" ''
  11130. dotest_fail modules2-8 "test -d second-dir" ''
  11131. cd ..
  11132. # There used to be a nasty-hack that made CVS skip creation of the
  11133. # module dir (in this case ampermodule) when -n was specified
  11134. dotest modules2-ampermod-1 "${testcvs} -q co -n ampermodule" ''
  11135. dotest modules2-ampermod-2 "test -d ampermodule/first-dir" ''
  11136. dotest modules2-ampermod-3 "test -d ampermodule/second-dir" ''
  11137. # Test release of a module
  11138. if echo yes |${testcvs} release -d ampermodule >>${LOGFILE}; then
  11139. pass modules2-ampermod-release-1
  11140. else
  11141. fail modules2-ampermod-release-1
  11142. fi
  11143. dotest_fail modules2-ampermod-release-2 "test -d ampermodule" ''
  11144. # and the '-n' test again, but in conjunction with '-d'
  11145. dotest modules2-ampermod-4 "${testcvs} -q co -n -d newname ampermodule" ''
  11146. dotest modules2-ampermod-5 "test -d newname/first-dir" ''
  11147. dotest modules2-ampermod-6 "test -d newname/second-dir" ''
  11148. rm -rf newname
  11149. # Now we create another directory named first-dir and make
  11150. # sure that CVS doesn't get them mixed up.
  11151. mkdir first-dir
  11152. # Note that this message should say "Updating ampermodule/first-dir"
  11153. # I suspect. This is a long-standing behavior/bug....
  11154. dotest modules2-9 "${testcvs} co ampermodule" \
  11155. "${PROG} checkout: Updating first-dir
  11156. ${PROG} checkout: Updating second-dir"
  11157. touch ampermodule/first-dir/amper1
  11158. cd ampermodule
  11159. dotest modules2-10 "${testcvs} add first-dir/amper1" \
  11160. "${PROG} add: scheduling file .first-dir/amper1. for addition
  11161. ${PROG} add: use .${PROG} commit. to add this file permanently"
  11162. cd ..
  11163. # As with the "Updating xxx" message, the "U first-dir/amper1"
  11164. # message (instead of "U ampermodule/first-dir/amper1") is
  11165. # rather fishy.
  11166. dotest modules2-12 "${testcvs} co ampermodule" \
  11167. "${PROG} checkout: Updating first-dir
  11168. A first-dir/amper1
  11169. ${PROG} checkout: Updating second-dir"
  11170. if $remote; then
  11171. dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
  11172. "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
  11173. done
  11174. Checking in ampermodule/first-dir/amper1;
  11175. ${CVSROOT_DIRNAME}/first-dir/amper1,v <-- amper1
  11176. initial revision: 1\.1
  11177. done"
  11178. else
  11179. # Trying this as above led to a "protocol error" message.
  11180. # Work around this bug.
  11181. cd ampermodule
  11182. dotest modules2-13 "${testcvs} -q ci -m add-it" \
  11183. "RCS file: ${CVSROOT_DIRNAME}/first-dir/amper1,v
  11184. done
  11185. Checking in first-dir/amper1;
  11186. ${CVSROOT_DIRNAME}/first-dir/amper1,v <-- amper1
  11187. initial revision: 1\.1
  11188. done"
  11189. cd ..
  11190. fi
  11191. cd ..
  11192. rm -r 1
  11193. # Now test the "combmodule" module (combining regular modules
  11194. # and ampersand modules in the same module definition).
  11195. mkdir 1; cd 1
  11196. dotest modules2-14 "${testcvs} co combmodule" \
  11197. "U combmodule/file3
  11198. ${PROG} checkout: Updating first-dir
  11199. U first-dir/amper1"
  11200. dotest modules2-15 "test -f combmodule/file3" ""
  11201. dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
  11202. cd combmodule
  11203. rm -r first-dir
  11204. # At least for now there is no way to tell CVS that
  11205. # some files/subdirectories come from one repository directory,
  11206. # and others from another.
  11207. # This seems like a pretty sensible behavior to me, in the
  11208. # sense that first-dir doesn't "really" exist within
  11209. # third-dir, so CVS just acts as if there is nothing there
  11210. # to do.
  11211. dotest modules2-17 "${testcvs} update -d" \
  11212. "${PROG} update: Updating \."
  11213. cd ..
  11214. dotest modules2-18 "${testcvs} -q co combmodule" \
  11215. "U first-dir/amper1"
  11216. dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
  11217. cd ..
  11218. rm -r 1
  11219. # Now test the "ampdirmod" and "badmod" modules to be sure that
  11220. # options work with ampersand modules but don't prevent the
  11221. # "missing directory" error message.
  11222. mkdir 1; cd 1
  11223. dotest modules2-20 "${testcvs} co ampdirmod" \
  11224. "${PROG} checkout: Updating first-dir
  11225. U first-dir/amper1
  11226. ${PROG} checkout: Updating second-dir"
  11227. dotest modules2-21 "test -f newdir/first-dir/amper1" ""
  11228. dotest modules2-22 "test -d newdir/second-dir" ""
  11229. dotest_fail modules2-23 "${testcvs} co badmod" \
  11230. "${PROG} checkout: modules file missing directory for module badmod" \
  11231. "${PROG} server: modules file missing directory for module badmod
  11232. ${PROG} \[checkout aborted\]: cannot expand modules"
  11233. cd ..
  11234. rm -r 1
  11235. # Confirm that a rename with added depth nested in an ampersand
  11236. # module works.
  11237. mkdir 1; cd 1
  11238. dotest modules2-nestedrename-1 "${testcvs} -q co messymod" \
  11239. "U messymod/amper1"
  11240. dotest modules2-nestedrename-2 "test -d messymod/sdir" ''
  11241. dotest modules2-nestedrename-3 "test -d messymod/sdir/CVS" ''
  11242. dotest modules2-nestedrename-4 "test -d messymod/sdir/child" ''
  11243. dotest modules2-nestedrename-5 "test -d messymod/sdir/child/CVS" ''
  11244. cd ..; rm -r 1
  11245. # FIXME: client/server has a bug. It should be working like a local
  11246. # repository in this case, but fails to check out the second module
  11247. # in the list when a branch is specified.
  11248. mkdir 1; cd 1
  11249. dotest modules2-ampertag-setup-1 \
  11250. "${testcvs} -Q rtag tag first-dir second-dir third-dir" \
  11251. ''
  11252. dotest modules2-ampertag-1 "${testcvs} -q co -rtag ampermodule" \
  11253. "U first-dir/amper1"
  11254. if $remote; then
  11255. dotest_fail modules2-ampertag-2 "test -d ampermodule/second-dir" ''
  11256. dotest_fail modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
  11257. else
  11258. dotest modules2-ampertag-2 "test -d ampermodule/second-dir" ''
  11259. dotest modules2-ampertag-3 "test -d ampermodule/second-dir/CVS" ''
  11260. fi
  11261. cd ..; rm -r 1
  11262. # Test for tag files when an ampermod is renamed with more path
  11263. # elements than it started with.
  11264. #
  11265. # FIXME: This is currently broken in the remote case, possibly only
  11266. # because the messymodchild isn't being checked out at all.
  11267. mkdir 1; cd 1
  11268. # dotest modules2-tagfiles-setup-1 \
  11269. #"${testcvs} -Q rtag -b branch first-dir second-dir" \
  11270. #''
  11271. dotest modules2-tagfiles-1 "${testcvs} -q co -rtag messymod" \
  11272. "U messymod/amper1"
  11273. if $remote; then
  11274. dotest_fail modules2-tagfiles-2r "test -d messymod/sdir" ''
  11275. else
  11276. dotest modules2-tagfiles-2 "cat messymod/sdir/CVS/Tag" 'Ttag'
  11277. fi
  11278. cd ..; rm -r 1
  11279. # Test that CVS gives an error if one combines -a with
  11280. # other options.
  11281. # Probably would be better to break this out into a separate
  11282. # test. Although it is short, it shares no files/state with
  11283. # the rest of the modules2 tests.
  11284. mkdir 1; cd 1
  11285. dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
  11286. 'U CVSROOT/modules'
  11287. cd CVSROOT
  11288. echo 'aliasopt -a -d onedir first-dir' >modules
  11289. dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
  11290. "Checking in modules;
  11291. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  11292. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  11293. done
  11294. ${PROG} commit: Rebuilding administrative file database"
  11295. cd ..
  11296. dotest_fail modules2-a1 "${testcvs} -q co aliasopt" \
  11297. "${PROG} checkout: -a cannot be specified in the modules file along with other options" \
  11298. "${PROG} server: -a cannot be specified in the modules file along with other options
  11299. ${PROG} \[checkout aborted\]: cannot expand modules"
  11300. cd ..; rm -r 1
  11301. # Clean up.
  11302. rm -rf ${CVSROOT_DIRNAME}/first-dir
  11303. rm -rf ${CVSROOT_DIRNAME}/second-dir
  11304. rm -rf ${CVSROOT_DIRNAME}/third-dir
  11305. ;;
  11306. modules3)
  11307. # More tests of modules, in particular what happens if several
  11308. # modules point to the same file.
  11309. # First just set up a directory first-dir and a file file1 in it.
  11310. mkdir 1; cd 1
  11311. dotest modules3-0 "${testcvs} -q co -l ." ''
  11312. mkdir first-dir
  11313. dotest modules3-1 "${testcvs} add first-dir" \
  11314. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  11315. cd first-dir
  11316. echo file1 >file1
  11317. dotest modules3-2 "${testcvs} add file1" \
  11318. "${PROG} add: scheduling file \`file1' for addition
  11319. ${PROG} add: use '${PROG} commit' to add this file permanently"
  11320. dotest modules3-3 "${testcvs} -q ci -m add-it" \
  11321. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  11322. done
  11323. Checking in file1;
  11324. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  11325. initial revision: 1\.1
  11326. done"
  11327. cd ..
  11328. dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
  11329. "U CVSROOT${DOTSTAR}"
  11330. cd CVSROOT
  11331. cat >modules <<EOF
  11332. mod1 -a first-dir/file1
  11333. bigmod -a mod1 first-dir/file1
  11334. namednest -d src/sub/dir first-dir
  11335. nestdeeper -d src/sub1/sub2/sub3/dir first-dir
  11336. nestshallow -d src/dir second-dir/suba/subb
  11337. path/in/modules &mod1
  11338. another/path/test -d another/path/test first-dir
  11339. EOF
  11340. dotest modules3-5 "${testcvs} -q ci -m add-modules" \
  11341. "Checking in modules;
  11342. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  11343. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  11344. done
  11345. ${PROG} commit: Rebuilding administrative file database"
  11346. cd ..
  11347. dotest modules3-6 "${testcvs} -q co bigmod" ''
  11348. rm -r first-dir
  11349. dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
  11350. cd ..
  11351. rm -r 1
  11352. mkdir 1; cd 1
  11353. mkdir suba
  11354. mkdir suba/subb
  11355. # This fails to work remote (it doesn't notice the directories,
  11356. # I suppose because they contain no files). Bummer, especially
  11357. # considering this is a documented technique and everything.
  11358. dotest modules3-7a \
  11359. "${testcvs} import -m add-dirs second-dir tag1 tag2" \
  11360. "${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba
  11361. ${PROG} import: Importing ${CVSROOT_DIRNAME}/second-dir/suba/subb
  11362. No conflicts created by this import" "
  11363. No conflicts created by this import"
  11364. cd ..; rm -r 1
  11365. mkdir 1; cd 1
  11366. dotest modules3-7b "${testcvs} co second-dir" \
  11367. "${PROG} checkout: Updating second-dir
  11368. ${PROG} checkout: Updating second-dir/suba
  11369. ${PROG} checkout: Updating second-dir/suba/subb" \
  11370. "${PROG} checkout: Updating second-dir"
  11371. if $remote; then
  11372. cd second-dir
  11373. mkdir suba
  11374. dotest modules3-7-workaround1 "${testcvs} add suba" \
  11375. "Directory ${CVSROOT_DIRNAME}/second-dir/suba added to the repository"
  11376. cd suba
  11377. mkdir subb
  11378. dotest modules3-7-workaround2 "${testcvs} add subb" \
  11379. "Directory ${CVSROOT_DIRNAME}/second-dir/suba/subb added to the repository"
  11380. cd ../..
  11381. fi
  11382. cd second-dir/suba/subb
  11383. touch fileb
  11384. dotest modules3-7c "${testcvs} add fileb" \
  11385. "${PROG} add: scheduling file .fileb. for addition
  11386. ${PROG} add: use .${PROG} commit. to add this file permanently"
  11387. dotest modules3-7d "${testcvs} -q ci -m add-it" \
  11388. "RCS file: ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v
  11389. done
  11390. Checking in fileb;
  11391. ${CVSROOT_DIRNAME}/second-dir/suba/subb/fileb,v <-- fileb
  11392. initial revision: 1\.1
  11393. done"
  11394. cd ../../..
  11395. cd ..; rm -r 1
  11396. mkdir 1
  11397. cd 1
  11398. dotest modules3-8 "${testcvs} -q co namednest" \
  11399. 'U src/sub/dir/file1'
  11400. dotest modules3-9 "test -f src/sub/dir/file1" ''
  11401. cd ..
  11402. rm -r 1
  11403. # Try the same thing, but with the directories nested even
  11404. # deeper (deeply enough so they are nested more deeply than
  11405. # the number of directories from / to ${TESTDIR}).
  11406. mkdir 1
  11407. cd 1
  11408. dotest modules3-10 "${testcvs} -q co nestdeeper" \
  11409. 'U src/sub1/sub2/sub3/dir/file1'
  11410. dotest modules3-11 "test -f src/sub1/sub2/sub3/dir/file1" ''
  11411. # While we are doing things like twisted uses of '/' (e.g.
  11412. # modules3-12), try this one.
  11413. if $remote; then
  11414. dotest_fail modules3-11b \
  11415. "${testcvs} -q update ${TESTDIR}/1/src/sub1/sub2/sub3/dir/file1" \
  11416. "absolute pathname .${TESTDIR}/1/src/sub1/sub2/sub3/dir. illegal for server"
  11417. fi # end of remote-only tests
  11418. cd ..
  11419. rm -r 1
  11420. # This one is almost too twisted for words. The pathname output
  11421. # in the message from "co" doesn't include the "path/in/modules",
  11422. # but those directories do get created (with no CVSADM except
  11423. # in "modules" which has a CVSNULLREPOS).
  11424. # I'm not sure anyone is relying on this nonsense or whether we
  11425. # need to keep doing it, but it is what CVS currently does...
  11426. # Skip it for remote; the remote code has the good sense to
  11427. # not deal with it (on the minus side it gives
  11428. # "internal error: repository string too short." (CVS 1.9) or
  11429. # "warning: server is not creating directories one at a time" (now)
  11430. # instead of a real error).
  11431. # I'm tempted to just make it a fatal error to have '/' in a
  11432. # module name. But see comments at modules3-16.
  11433. if $remote; then :; else
  11434. mkdir 1; cd 1
  11435. dotest modules3-12 "${testcvs} -q co path/in/modules" \
  11436. "U first-dir/file1"
  11437. dotest modules3-13 "test -f path/in/modules/first-dir/file1" ''
  11438. cd ..; rm -r 1
  11439. fi # end of tests skipped for remote
  11440. # Now here is where it used to get seriously bogus.
  11441. mkdir 1; cd 1
  11442. dotest modules3-14 \
  11443. "${testcvs} -q rtag tag1 path/in/modules" ''
  11444. # CVS used to create this even though rtag should *never* affect
  11445. # the directory current when it is called!
  11446. dotest_fail modules3-15 "test -d path/in/modules" ''
  11447. # Just for trivia's sake, rdiff was not similarly vulnerable
  11448. # because it passed 0 for run_module_prog to do_module.
  11449. cd ..; rm -r 1
  11450. # Some people seem to want this to work. I still suspect there
  11451. # are dark corners in slashes in module names. This probably wants
  11452. # more thought before we start hacking on CVS (one way or the other)
  11453. # or documenting this.
  11454. mkdir 2; cd 2
  11455. dotest modules3-16 "${testcvs} -q co another/path/test" \
  11456. "U another/path/test/file1"
  11457. dotest modules3-17 "cat another/path/test/file1" 'file1'
  11458. cd ..; rm -r 2
  11459. rm -rf ${CVSROOT_DIRNAME}/first-dir
  11460. rm -rf ${CVSROOT_DIRNAME}/second-dir
  11461. ;;
  11462. modules4)
  11463. # Some tests using the modules file with aliases that
  11464. # exclude particular directories.
  11465. mkdir 1; cd 1
  11466. dotest modules4-1 "${testcvs} -q co -l ." ''
  11467. mkdir first-dir
  11468. dotest modules4-2 "${testcvs} add first-dir" \
  11469. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  11470. cd first-dir
  11471. mkdir subdir subdir_long
  11472. dotest modules4-3 "${testcvs} add subdir subdir_long" \
  11473. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository
  11474. Directory ${CVSROOT_DIRNAME}/first-dir/subdir_long added to the repository"
  11475. echo file1 > file1
  11476. dotest modules4-4 "${testcvs} add file1" \
  11477. "${PROG}"' add: scheduling file `file1'\'' for addition
  11478. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  11479. echo file2 > subdir/file2
  11480. dotest modules4-5 "${testcvs} add subdir/file2" \
  11481. "${PROG}"' add: scheduling file `subdir/file2'\'' for addition
  11482. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  11483. echo file3 > subdir_long/file3
  11484. dotest modules4-6 "${testcvs} add subdir_long/file3" \
  11485. "${PROG}"' add: scheduling file `subdir_long/file3'\'' for addition
  11486. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  11487. dotest modules4-7 "${testcvs} -q ci -m add-it" \
  11488. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  11489. done
  11490. Checking in file1;
  11491. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  11492. initial revision: 1\.1
  11493. done
  11494. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
  11495. done
  11496. Checking in subdir/file2;
  11497. ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v <-- file2
  11498. initial revision: 1\.1
  11499. done
  11500. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v
  11501. done
  11502. Checking in subdir_long/file3;
  11503. ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v <-- file3
  11504. initial revision: 1\.1
  11505. done"
  11506. cd ..
  11507. dotest modules4-8 "${testcvs} -q update -d CVSROOT" \
  11508. "U CVSROOT${DOTSTAR}"
  11509. cd CVSROOT
  11510. cat >modules <<EOF
  11511. all -a first-dir
  11512. some -a !first-dir/subdir first-dir
  11513. other -a !first-dir/subdir !first-dir/subdir_long first-dir
  11514. somewhat -a first-dir !first-dir/subdir
  11515. EOF
  11516. dotest modules4-9 "${testcvs} -q ci -m add-modules" \
  11517. "Checking in modules;
  11518. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  11519. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  11520. done
  11521. ${PROG} commit: Rebuilding administrative file database"
  11522. cd ..
  11523. cd ..
  11524. mkdir 2; cd 2
  11525. dotest modules4-10 "${testcvs} -q co all" \
  11526. "U first-dir/file1
  11527. U first-dir/subdir/file2
  11528. U first-dir/subdir_long/file3"
  11529. rm -r first-dir
  11530. dotest modules4-11 "${testcvs} -q co some" \
  11531. "U first-dir/file1
  11532. U first-dir/subdir_long/file3"
  11533. dotest_fail modules4-12 "test -d first-dir/subdir" ''
  11534. dotest modules4-13 "test -d first-dir/subdir_long" ''
  11535. rm -r first-dir
  11536. if $remote; then
  11537. # But remote seems to do it the other way.
  11538. dotest modules4-14r-1 "${testcvs} -q co somewhat" \
  11539. "U first-dir/file1
  11540. U first-dir/subdir_long/file3"
  11541. dotest_fail modules4-14r-2 "test -d first-dir/subdir" ''
  11542. dotest modules4-14r-3 "test -d first-dir/subdir_long" ''
  11543. else
  11544. # This is strange behavior, in that the order of the
  11545. # "!first-dir/subdir" and "first-dir" matter, and it isn't
  11546. # clear that they should. I suspect it is long-standing
  11547. # strange behavior but I haven't verified that.
  11548. dotest modules4-14-1 "${testcvs} -q co somewhat" \
  11549. "U first-dir/file1
  11550. U first-dir/subdir/file2
  11551. U first-dir/subdir_long/file3"
  11552. dotest modules4-14-2 "test -d first-dir/subdir" ''
  11553. dotest modules4-14-3 "test -d first-dir/subdir_long" ''
  11554. fi
  11555. rm -r first-dir
  11556. dotest modules4-15 "${testcvs} -q co other" \
  11557. "U first-dir/file1"
  11558. dotest_fail modules4-16 "test -d first-dir/subdir" ''
  11559. dotest_fail modules4-17 "test -d first-dir/subdir_long" ''
  11560. rm -r first-dir
  11561. cd ..
  11562. rm -r 2
  11563. dotest modules4-18 "${testcvs} rtag tag some" \
  11564. "${PROG} rtag: Tagging first-dir
  11565. ${PROG} rtag: Ignoring first-dir/subdir
  11566. ${PROG} rtag: Tagging first-dir/subdir_long"
  11567. cd 1/first-dir/subdir
  11568. dotest modules4-19 "${testcvs} log file2" "
  11569. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v
  11570. Working file: file2
  11571. head: 1\.1
  11572. branch:
  11573. locks: strict
  11574. access list:
  11575. symbolic names:
  11576. keyword substitution: kv
  11577. total revisions: 1; selected revisions: 1
  11578. description:
  11579. ----------------------------
  11580. revision 1\.1
  11581. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  11582. add-it
  11583. ============================================================================="
  11584. if $keep; then
  11585. echo Keeping $TESTDIR and exiting due to --keep
  11586. exit 0
  11587. fi
  11588. cd ../../..
  11589. rm -r 1
  11590. rm -rf ${CVSROOT_DIRNAME}/first-dir
  11591. ;;
  11592. modules5)
  11593. # Test module programs
  11594. mkdir ${CVSROOT_DIRNAME}/first-dir
  11595. mkdir 1
  11596. cd 1
  11597. dotest modules5-1 "${testcvs} -q co first-dir" ""
  11598. cd first-dir
  11599. mkdir subdir
  11600. dotest modules5-2 "${testcvs} add subdir" \
  11601. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
  11602. cd subdir
  11603. mkdir ssdir
  11604. dotest modules5-3 "${testcvs} add ssdir" \
  11605. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir/ssdir added to the repository"
  11606. touch a b
  11607. dotest modules5-4 "${testcvs} add a b" \
  11608. "${PROG} add: scheduling file .a. for addition
  11609. ${PROG} add: scheduling file .b. for addition
  11610. ${PROG} add: use .${PROG} commit. to add these files permanently"
  11611. dotest modules5-5 "${testcvs} ci -m added" \
  11612. "${PROG} [a-z]*: Examining .
  11613. ${PROG} [a-z]*: Examining ssdir
  11614. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/a,v
  11615. done
  11616. Checking in a;
  11617. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  11618. initial revision: 1\.1
  11619. done
  11620. RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/b,v
  11621. done
  11622. Checking in b;
  11623. ${CVSROOT_DIRNAME}/first-dir/subdir/b,v <-- b
  11624. initial revision: 1\.1
  11625. done"
  11626. cd ..
  11627. dotest modules5-6 "${testcvs} -q co CVSROOT" \
  11628. "U CVSROOT/checkoutlist
  11629. U CVSROOT/commitinfo
  11630. U CVSROOT/config
  11631. U CVSROOT/cvswrappers
  11632. U CVSROOT/editinfo
  11633. U CVSROOT/loginfo
  11634. U CVSROOT/modules
  11635. U CVSROOT/notify
  11636. U CVSROOT/rcsinfo
  11637. U CVSROOT/taginfo
  11638. U CVSROOT/verifymsg"
  11639. # FIXCVS: The sleep in the following script helps avoid out of
  11640. # order messages, but we really need to figure out how to fix
  11641. # cvs to prevent them in the first place.
  11642. for i in checkout export tag; do
  11643. cat >> ${CVSROOT_DIRNAME}/$i.sh <<EOF
  11644. #! /bin/sh
  11645. sleep 1
  11646. echo "$i script invoked in \`pwd\`"
  11647. echo "args: \$@"
  11648. EOF
  11649. # Cygwin doesn't set premissions correctly over the Samba share.
  11650. if test -n "$remotehost"; then
  11651. $CVS_RSH $remotehost "chmod +x ${CVSROOT_DIRNAME}/$i.sh"
  11652. else
  11653. chmod +x ${CVSROOT_DIRNAME}/$i.sh
  11654. fi
  11655. done
  11656. OPTS="-o${CVSROOT_DIRNAME}/checkout.sh -e ${CVSROOT_DIRNAME}/export.sh -t${CVSROOT_DIRNAME}/tag.sh"
  11657. cat >CVSROOT/modules <<EOF
  11658. realmodule ${OPTS} first-dir/subdir a
  11659. dirmodule ${OPTS} first-dir/subdir
  11660. namedmodule -d nameddir ${OPTS} first-dir/subdir
  11661. EOF
  11662. dotest modules5-7 "${testcvs} ci -m 'add modules' CVSROOT/modules" \
  11663. "" \
  11664. "Checking in CVSROOT/modules;
  11665. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  11666. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  11667. done
  11668. ${PROG} commit: Rebuilding administrative file database"
  11669. cd ..
  11670. rm -rf first-dir
  11671. # Test that real modules check out to realmodule/a, not subdir/a.
  11672. if $remote; then
  11673. # FIXCVS?
  11674. # Mac OSX 10.3 (Darwin ppc-osx1 5.5) fails here when $TMPDIR
  11675. # contains a symlink (it does not fail the local modules5-8).
  11676. # Since no other platforms are exhibiting the same problem, I
  11677. # suspect an issue with OSX and fork() or the like dereferencing
  11678. # the symlink, but it is possible it is something that could be
  11679. # fixed or worked around in CVS.
  11680. dotest modules5-8r "$testcvs co realmodule" \
  11681. "U realmodule/a
  11682. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
  11683. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11684. args: realmodule"
  11685. else
  11686. dotest modules5-8 "${testcvs} co realmodule" \
  11687. "U realmodule/a
  11688. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule..
  11689. checkout script invoked in ${TESTDIR}/1
  11690. args: realmodule"
  11691. fi
  11692. dotest modules5-9 "test -d realmodule && test -f realmodule/a" ""
  11693. dotest_fail modules5-10 "test -f realmodule/b" ""
  11694. if $remote; then
  11695. dotest modules5-11 "${testcvs} -q co realmodule" \
  11696. "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11697. args: realmodule"
  11698. dotest modules5-12 "${testcvs} -q update" ''
  11699. echo "change" >>realmodule/a
  11700. dotest modules5-13 "${testcvs} -q ci -m." \
  11701. "Checking in realmodule/a;
  11702. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  11703. new revision: 1\.2; previous revision: 1\.1
  11704. done"
  11705. else
  11706. dotest modules5-11 "${testcvs} -q co realmodule" \
  11707. "checkout script invoked in ${TESTDIR}/1
  11708. args: realmodule"
  11709. dotest modules5-12 "${testcvs} -q update" ''
  11710. echo "change" >>realmodule/a
  11711. dotest modules5-13 "${testcvs} -q ci -m." \
  11712. "Checking in realmodule/a;
  11713. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  11714. new revision: 1\.2; previous revision: 1\.1
  11715. done"
  11716. fi
  11717. dotest modules5-14 "echo yes | ${testcvs} release -d realmodule" \
  11718. "You have \[0\] altered files in this repository\.
  11719. Are you sure you want to release (and delete) directory .realmodule.: "
  11720. dotest modules5-15 "${testcvs} -q rtag -Dnow MYTAG realmodule" \
  11721. "tag script invoked in ${TESTDIR}/1
  11722. args: realmodule MYTAG" \
  11723. "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11724. args: realmodule MYTAG"
  11725. if $remote; then
  11726. dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
  11727. "U realmodule/a
  11728. export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11729. args: realmodule"
  11730. else
  11731. dotest modules5-16 "${testcvs} -q export -r MYTAG realmodule" \
  11732. "U realmodule/a
  11733. export script invoked in ${TESTDIR}/1
  11734. args: realmodule"
  11735. fi
  11736. rm -r realmodule
  11737. dotest_fail modules5-17 "${testcvs} co realmodule/a" \
  11738. "${PROG}"' checkout: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
  11739. "${PROG}"' server: module `realmodule/a'\'' is a request for a file in a module which is not a directory
  11740. '"${PROG}"' \[checkout aborted\]: cannot expand modules'
  11741. # Now test the ability to check out a single file from a directory
  11742. if $remote; then
  11743. dotest modules5-18 "${testcvs} co dirmodule/a" \
  11744. "U dirmodule/a
  11745. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
  11746. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11747. args: dirmodule"
  11748. else
  11749. dotest modules5-18 "${testcvs} co dirmodule/a" \
  11750. "U dirmodule/a
  11751. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
  11752. checkout script invoked in ${TESTDIR}/1
  11753. args: dirmodule"
  11754. fi
  11755. dotest modules5-19 "test -d dirmodule && test -f dirmodule/a" ""
  11756. dotest_fail modules5-20 "test -f dirmodule/b" ""
  11757. dotest modules5-21 "echo yes | ${testcvs} release -d dirmodule" \
  11758. "You have \[0\] altered files in this repository\.
  11759. Are you sure you want to release (and delete) directory .dirmodule.: "
  11760. # Now test the ability to correctly reject a non-existent filename.
  11761. # For maximum studliness we would check that an error message is
  11762. # being output.
  11763. # We accept a zero exit status because it is what CVS does
  11764. # (Dec 95). Probably the exit status should be nonzero,
  11765. # however.
  11766. if $remote; then
  11767. dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
  11768. "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
  11769. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
  11770. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11771. args: dirmodule"
  11772. else
  11773. dotest modules5-22 "${testcvs} co dirmodule/nonexist" \
  11774. "${PROG} checkout: warning: new-born dirmodule/nonexist has disappeared
  11775. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .dirmodule..
  11776. checkout script invoked in ${TESTDIR}/1
  11777. args: dirmodule"
  11778. fi
  11779. # We tolerate the creation of the dirmodule directory, since that
  11780. # is what CVS does, not because we view that as preferable to not
  11781. # creating it.
  11782. dotest_fail modules5-23 "test -f dirmodule/a || test -f dirmodule/b" ""
  11783. rm -r dirmodule
  11784. # Now test that a module using -d checks out to the specified
  11785. # directory.
  11786. if $remote; then
  11787. dotest modules5-24 "${testcvs} -q co namedmodule" \
  11788. "U nameddir/a
  11789. U nameddir/b
  11790. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11791. args: nameddir"
  11792. else
  11793. dotest modules5-24 "${testcvs} -q co namedmodule" \
  11794. "U nameddir/a
  11795. U nameddir/b
  11796. checkout script invoked in ${TESTDIR}/1
  11797. args: nameddir"
  11798. fi
  11799. dotest modules5-25 "test -f nameddir/a && test -f nameddir/b" ""
  11800. echo add line >>nameddir/a
  11801. # This seems suspicious: when we checkout an existing directory,
  11802. # the checkout script gets executed in addition to the update
  11803. # script. Is that by design or accident?
  11804. if $remote; then
  11805. dotest modules5-26 "${testcvs} -q co namedmodule" \
  11806. "M nameddir/a
  11807. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11808. args: nameddir"
  11809. else
  11810. dotest modules5-26 "${testcvs} -q co namedmodule" \
  11811. "M nameddir/a
  11812. checkout script invoked in ${TESTDIR}/1
  11813. args: nameddir"
  11814. fi
  11815. rm nameddir/a
  11816. if $remote; then
  11817. dotest modules5-27 "${testcvs} -q co namedmodule" \
  11818. "U nameddir/a
  11819. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11820. args: nameddir"
  11821. else
  11822. dotest modules5-27 "${testcvs} -q co namedmodule" \
  11823. "U nameddir/a
  11824. checkout script invoked in ${TESTDIR}/1
  11825. args: nameddir"
  11826. fi
  11827. dotest modules5-28 "echo yes | ${testcvs} release -d nameddir" \
  11828. "You have \[0\] altered files in this repository\.
  11829. Are you sure you want to release (and delete) directory .nameddir.: "
  11830. # Now try the same tests with -d on command line
  11831. # FIXCVS? The manual says the modules programs get the module name,
  11832. # but they really get the directory name.
  11833. if $remote; then
  11834. dotest modules5-29 "${testcvs} co -d mydir realmodule" \
  11835. "U mydir/a
  11836. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11837. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11838. args: mydir"
  11839. else
  11840. dotest modules5-29 "${testcvs} co -d mydir realmodule" \
  11841. "U mydir/a
  11842. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11843. checkout script invoked in ${TESTDIR}/1
  11844. args: mydir"
  11845. fi
  11846. dotest modules5-30 "test -d mydir && test -f mydir/a" ""
  11847. dotest_fail modules5-31 "test -d realmodule || test -f mydir/b" ""
  11848. if $remote; then
  11849. dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
  11850. "checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11851. args: mydir"
  11852. dotest modules5-33 "${testcvs} -q update" ''
  11853. echo "change" >>mydir/a
  11854. dotest modules5-34 "${testcvs} -q ci -m." \
  11855. "Checking in mydir/a;
  11856. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  11857. new revision: 1\.3; previous revision: 1\.2
  11858. done"
  11859. else
  11860. dotest modules5-32 "${testcvs} -q co -d mydir realmodule" \
  11861. "checkout script invoked in ${TESTDIR}/1
  11862. args: mydir"
  11863. dotest modules5-33 "${testcvs} -q update" ''
  11864. echo "change" >>mydir/a
  11865. dotest modules5-34 "${testcvs} -q ci -m." \
  11866. "Checking in mydir/a;
  11867. ${CVSROOT_DIRNAME}/first-dir/subdir/a,v <-- a
  11868. new revision: 1\.3; previous revision: 1\.2
  11869. done"
  11870. fi
  11871. dotest modules5-35 "echo yes | ${testcvs} release -d mydir" \
  11872. "You have \[0\] altered files in this repository\.
  11873. Are you sure you want to release (and delete) directory .mydir.: "
  11874. if $remote; then
  11875. dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
  11876. "tag script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11877. args: realmodule MYTAG2"
  11878. dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
  11879. "U mydir/a
  11880. export script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11881. args: mydir"
  11882. else
  11883. dotest modules5-36 "${testcvs} -q rtag -Dnow MYTAG2 realmodule" \
  11884. "tag script invoked in ${TESTDIR}/1
  11885. args: realmodule MYTAG2"
  11886. dotest modules5-37 "${testcvs} -q export -r MYTAG2 -d mydir realmodule" \
  11887. "U mydir/a
  11888. export script invoked in ${TESTDIR}/1
  11889. args: mydir"
  11890. fi
  11891. rm -r mydir
  11892. # Now test the ability to check out a single file from a directory
  11893. if $remote; then
  11894. dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
  11895. "U mydir/a
  11896. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11897. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11898. args: mydir"
  11899. else
  11900. dotest modules5-38 "${testcvs} co -d mydir dirmodule/a" \
  11901. "U mydir/a
  11902. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11903. checkout script invoked in ${TESTDIR}/1
  11904. args: mydir"
  11905. fi
  11906. dotest modules5-39 "test -d mydir && test -f mydir/a" ""
  11907. dotest_fail modules5-40 "test -d dirmodule || test -f mydir/b" ""
  11908. dotest modules5-41 "echo yes | ${testcvs} release -d mydir" \
  11909. "You have \[0\] altered files in this repository\.
  11910. Are you sure you want to release (and delete) directory .mydir.: "
  11911. # Now test the ability to correctly reject a non-existent filename.
  11912. # For maximum studliness we would check that an error message is
  11913. # being output.
  11914. # We accept a zero exit status because it is what CVS does
  11915. # (Dec 95). Probably the exit status should be nonzero,
  11916. # however.
  11917. if $remote; then
  11918. dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
  11919. "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
  11920. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11921. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11922. args: mydir"
  11923. else
  11924. dotest modules5-42 "${testcvs} co -d mydir dirmodule/nonexist" \
  11925. "${PROG} checkout: warning: new-born mydir/nonexist has disappeared
  11926. ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .mydir..
  11927. checkout script invoked in ${TESTDIR}/1
  11928. args: mydir"
  11929. fi
  11930. # We tolerate the creation of the mydir directory, since that
  11931. # is what CVS does, not because we view that as preferable to not
  11932. # creating it.
  11933. dotest_fail modules5-43 "test -f mydir/a || test -f mydir/b" ""
  11934. rm -r mydir
  11935. if $remote; then
  11936. dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
  11937. "U mydir/a
  11938. U mydir/b
  11939. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11940. args: mydir"
  11941. else
  11942. dotest modules5-44 "${testcvs} -q co -d mydir namedmodule" \
  11943. "U mydir/a
  11944. U mydir/b
  11945. checkout script invoked in ${TESTDIR}/1
  11946. args: mydir"
  11947. fi
  11948. dotest modules5-45 "test -f mydir/a && test -f mydir/b" ""
  11949. dotest_fail modules5-46 "test -d namedir"
  11950. echo add line >>mydir/a
  11951. # This seems suspicious: when we checkout an existing directory,
  11952. # the checkout script gets executed in addition to the update
  11953. # script. Is that by design or accident?
  11954. if $remote; then
  11955. dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
  11956. "M mydir/a
  11957. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11958. args: mydir"
  11959. else
  11960. dotest modules5-47 "${testcvs} -q co -d mydir namedmodule" \
  11961. "M mydir/a
  11962. checkout script invoked in ${TESTDIR}/1
  11963. args: mydir"
  11964. fi
  11965. rm mydir/a
  11966. if $remote; then
  11967. dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
  11968. "U mydir/a
  11969. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]*
  11970. args: mydir"
  11971. else
  11972. dotest modules5-48 "${testcvs} -q co -d mydir namedmodule" \
  11973. "U mydir/a
  11974. checkout script invoked in ${TESTDIR}/1
  11975. args: mydir"
  11976. fi
  11977. dotest modules5-49 "echo yes | ${testcvs} release -d mydir" \
  11978. "You have \[0\] altered files in this repository\.
  11979. Are you sure you want to release (and delete) directory .mydir.: "
  11980. cd ..
  11981. rm -rf 1 ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/*.sh
  11982. ;;
  11983. modules6)
  11984. #
  11985. # Test invalid module definitions
  11986. #
  11987. # See the header comment for the `modules' test for an index of
  11988. # the complete suite of modules tests.
  11989. #
  11990. #
  11991. # There was a bug in CVS through 1.11.1p1 where a bad module name
  11992. # would cause the previous line to be parsed as the module
  11993. # definition. This test proves this doesn't happen anymore.
  11994. #
  11995. mkdir modules6
  11996. cd modules6
  11997. dotest module6-setup-1 "${testcvs} -Q co CVSROOT" ""
  11998. cd CVSROOT
  11999. echo "longmodulename who cares" >modules
  12000. echo "badname" >>modules
  12001. # This test almost isn't setup since it generates the error message
  12002. # we are looking for if `-Q' isn't specified, but I want to test the
  12003. # filename in the message later.
  12004. dotest modules6-setup-2 "${testcvs} -Q ci -mbad-modules" \
  12005. "Checking in modules;
  12006. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  12007. new revision: [0-9.]*; previous revision: [0-9.]*
  12008. done
  12009. ${PROG} commit: Rebuilding administrative file database"
  12010. # Here's where CVS would report not being able to find `lename'
  12011. cd ..
  12012. dotest_fail modules6-1 "${testcvs} -q co badname" \
  12013. "${PROG} checkout: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
  12014. ${PROG} checkout: cannot find module .badname. - ignored" \
  12015. "${PROG} server: warning: NULL value for key .badname. at line 2 of .${CVSROOT_DIRNAME}/CVSROOT/modules.
  12016. ${PROG} server: cannot find module .badname. - ignored
  12017. ${PROG} \[checkout aborted\]: cannot expand modules"
  12018. # cleanup
  12019. cd CVSROOT
  12020. echo "# empty modules file" >modules
  12021. dotest modules6-cleanup-1 "${testcvs} -Q ci -mempty-modules" \
  12022. "Checking in modules;
  12023. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  12024. new revision: [0-9.]*; previous revision: [0-9.]*
  12025. done
  12026. ${PROG} commit: Rebuilding administrative file database"
  12027. cd ../..
  12028. if $keep; then :; else
  12029. rm -r modules6
  12030. fi
  12031. ;;
  12032. modules7)
  12033. #
  12034. # Test tag problems vs an empty CVSROOT/val-tags file
  12035. #
  12036. # See the header comment for the `modules' test for an index of
  12037. # the complete suite of modules tests.
  12038. #
  12039. mkdir modules7
  12040. cd modules7
  12041. dotest modules7-1 "$testcvs -Q co -d top ."
  12042. cd top
  12043. mkdir zero one
  12044. dotest modules7-2 "$testcvs -Q add zero one"
  12045. cd one
  12046. echo 'file1 contents' > file1
  12047. dotest modules7-2 "$testcvs -Q add file1"
  12048. dotest modules7-3 "$testcvs -Q ci -mnew file1" \
  12049. "RCS file: $CVSROOT_DIRNAME/one/file1,v
  12050. done
  12051. Checking in file1;
  12052. $CVSROOT_DIRNAME/one/file1,v <-- file1
  12053. initial revision: 1\.1
  12054. done"
  12055. dotest modules7-4 "$testcvs -Q tag mytag file1"
  12056. cd ../CVSROOT
  12057. echo 'all -a zero one' > modules
  12058. dotest modules7-5 "$testcvs -Q ci -mall-module" \
  12059. "Checking in modules;
  12060. $CVSROOT_DIRNAME/CVSROOT/modules,v <-- modules
  12061. new revision: [0-9.]*; previous revision: [0-9.]*
  12062. done
  12063. $PROG commit: Rebuilding administrative file database"
  12064. cd ../..
  12065. mkdir myexport
  12066. cd myexport
  12067. # FIXCVS: The export should NOT be aborted here
  12068. dotest_fail modules7-6 "$testcvs export -rmytag all" \
  12069. "$PROG \[export aborted\]: no such tag mytag"
  12070. cd ..
  12071. rm -fr myexport
  12072. mkdir myexport
  12073. cd myexport
  12074. # FIXCVS: Workaround is to have mytag listed in val-tags
  12075. echo 'mytag y' > $CVSROOT_DIRNAME/CVSROOT/val-tags
  12076. dotest modules7-7 "$testcvs export -rmytag all" \
  12077. "$PROG export: Updating zero
  12078. $PROG export: Updating one
  12079. U one/file1"
  12080. dotest modules7-8 'cat one/file1' 'file1 contents'
  12081. if $keep; then
  12082. echo Keeping $TESTDIR and exiting due to --keep
  12083. exit 0
  12084. fi
  12085. # cleanup
  12086. cd ../top/CVSROOT
  12087. echo "# empty modules file" >modules
  12088. dotest modules7-cleanup-1 "$testcvs -Q ci -mempty-modules" \
  12089. "Checking in modules;
  12090. $CVSROOT_DIRNAME/CVSROOT/modules,v <-- modules
  12091. new revision: [0-9.]*; previous revision: [0-9.]*
  12092. done
  12093. $PROG commit: Rebuilding administrative file database"
  12094. cd ../../..
  12095. rm -fr modules7
  12096. rm -rf $CVSROOT_DIRNAME/zero $CVSROOT_DIRNAME/one
  12097. ;;
  12098. mkmodules)
  12099. # When a file listed in checkoutlist doesn't exist, cvs-1.10.4
  12100. # would fail to remove the CVSROOT/.#[0-9]* temporary file it
  12101. # creates while mkmodules is in the process of trying to check
  12102. # out the missing file.
  12103. mkdir 1; cd 1
  12104. dotest mkmodules-temp-file-removal-1 "${testcvs} -Q co CVSROOT" ''
  12105. cd CVSROOT
  12106. echo no-such-file >> checkoutlist
  12107. dotest mkmodules-temp-file-removal-2 "${testcvs} -Q ci -m. checkoutlist" \
  12108. "Checking in checkoutlist;
  12109. $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v <-- checkoutlist
  12110. new revision: 1\.2; previous revision: 1\.1
  12111. done
  12112. ${PROG} commit: Rebuilding administrative file database"
  12113. dotest mkmodules-temp-file-removal-3 "echo $CVSROOT_DIRNAME/CVSROOT/.#[0-9]*" \
  12114. "$CVSROOT_DIRNAME/CVSROOT/\.#\[0-9\]\*"
  12115. # Versions 1.11.6 & 1.12.1 and earlier of CVS printed most of the
  12116. # white space included before error messages in checkoutlist.
  12117. echo "no-such-file Failed to update no-such-file." >checkoutlist
  12118. dotest mkmodules-error-message-1 "${testcvs} -Q ci -m. checkoutlist" \
  12119. "Checking in checkoutlist;
  12120. $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v <-- checkoutlist
  12121. new revision: 1\.3; previous revision: 1\.2
  12122. done
  12123. ${PROG} commit: Rebuilding administrative file database
  12124. ${PROG} commit: Failed to update no-such-file\."
  12125. # Versions 1.11.6 & 1.12.1 and earlier of CVS used the error string
  12126. # from the checkoutlist file as the format string passed to error()'s
  12127. # printf. Check that this is no longer the case by verifying that
  12128. # printf format patterns remain unchanged.
  12129. echo "no-such-file Failed to update %s %lx times because %s happened %d times." >checkoutlist
  12130. dotest mkmodules-error-message-2 "${testcvs} -Q ci -m. checkoutlist" \
  12131. "Checking in checkoutlist;
  12132. $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v <-- checkoutlist
  12133. new revision: 1\.4; previous revision: 1\.3
  12134. done
  12135. ${PROG} commit: Rebuilding administrative file database
  12136. ${PROG} commit: Failed to update %s %lx times because %s happened %d times\."
  12137. dotest mkmodules-cleanup-1 "${testcvs} -Q up -pr1.1 checkoutlist >checkoutlist"
  12138. dotest mkmodules-cleanup-2 "${testcvs} -Q ci -m. checkoutlist" \
  12139. "Checking in checkoutlist;
  12140. $CVSROOT_DIRNAME/CVSROOT/checkoutlist,v <-- checkoutlist
  12141. new revision: 1\.5; previous revision: 1\.4
  12142. done
  12143. ${PROG} commit: Rebuilding administrative file database"
  12144. cd ../..
  12145. rm -rf 1
  12146. ;;
  12147. co-d)
  12148. # Some tests of various permutations of co-d when directories exist
  12149. # and checkouts lengthen.
  12150. #
  12151. # Interestingly enough, these same tests pass when the directory
  12152. # lengthening happens via the modules file. Go figure.
  12153. module=co-d
  12154. mkdir $module; cd $module
  12155. mkdir top; cd top
  12156. dotest co-d-init-1 "$testcvs -Q co -l ."
  12157. mkdir $module
  12158. dotest co-d-init-2 "$testcvs -Q add $module"
  12159. cd $module
  12160. echo content >file1
  12161. echo different content >file2
  12162. dotest co-d-init-3 "$testcvs -Q add file1 file2"
  12163. dotest co-d-init-4 "$testcvs -Q ci -madd-em" \
  12164. "RCS file: $CVSROOT_DIRNAME/co-d/file1,v
  12165. done
  12166. Checking in file1;
  12167. $CVSROOT_DIRNAME/co-d/file1,v <-- file1
  12168. initial revision: 1\.1
  12169. done
  12170. RCS file: $CVSROOT_DIRNAME/co-d/file2,v
  12171. done
  12172. Checking in file2;
  12173. $CVSROOT_DIRNAME/co-d/file2,v <-- file2
  12174. initial revision: 1\.1
  12175. done"
  12176. cd ../..
  12177. mkdir 2; cd 2
  12178. dotest co-d-1 "$testcvs -q co -d dir $module" \
  12179. "U dir/file1
  12180. U dir/file2"
  12181. dotest co-d-1.2 "cat dir/CVS/Repository" "$module"
  12182. # FIXCVS: This should work. Correct expected result:
  12183. #
  12184. #"U dir2/sdir/file1
  12185. #U dir2/sdir/file2"
  12186. dotest_fail co-d-2 "$testcvs -q co -d dir2/sdir $module" \
  12187. "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir2': No such file or directory"
  12188. # FIXCVS:
  12189. # dotest co-d-2.2 "cat dir4/CVS/Repository" "CVSROOT/Emptydir"
  12190. # dotest co-d-2.3 "cat dir5/CVS/Repository" "$module"
  12191. mkdir dir3
  12192. dotest co-d-3 "$testcvs -q co -d dir3 $module" \
  12193. "U dir3/file1
  12194. U dir3/file2"
  12195. dotest co-d-3.2 "cat dir3/CVS/Repository" "$module"
  12196. if $remote; then
  12197. # FIXCVS: As for co-d-2.
  12198. mkdir dir4
  12199. dotest_fail co-d-4r "$testcvs -q co -d dir4/sdir $module" \
  12200. "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir4': No such file or directory"
  12201. # FIXCVS: As for co-d-2.
  12202. mkdir dir5
  12203. mkdir dir5/sdir
  12204. dotest_fail co-d-5r "$testcvs -q co -d dir5/sdir $module" \
  12205. "$PROG \[checkout aborted\]: could not change directory to requested checkout directory \`dir5': No such file or directory"
  12206. else
  12207. mkdir dir4
  12208. dotest co-d-4 "$testcvs -q co -d dir4/sdir $module" \
  12209. "U dir4/sdir/file1
  12210. U dir4/sdir/file2"
  12211. # CVS only creates administration directories for directories it
  12212. # creates, and the last portion of the path passed to -d
  12213. # regardless.
  12214. dotest_fail co-d-4.2 "test -d dir4/CVS"
  12215. dotest co-d-4.3 "cat dir4/sdir/CVS/Repository" "$module"
  12216. mkdir dir5
  12217. mkdir dir5/sdir
  12218. dotest co-d-5 "$testcvs -q co -d dir5/sdir $module" \
  12219. "U dir5/sdir/file1
  12220. U dir5/sdir/file2"
  12221. # CVS only creates administration directories for directories it
  12222. # creates, and the last portion of the path passed to -d
  12223. # regardless.
  12224. dotest_fail co-d-5.2 "test -d dir5/CVS"
  12225. dotest co-d-5.3 "cat dir5/sdir/CVS/Repository" "$module"
  12226. fi
  12227. # clean up
  12228. if $keep; then
  12229. echo Keeping ${TESTDIR} and exiting due to --keep
  12230. exit 0
  12231. fi
  12232. cd ../..
  12233. rm -rf $CVSROOT_DIRNAME/$module
  12234. rm -r $module
  12235. ;;
  12236. cvsadm)
  12237. # These test check the content of CVS' administrative
  12238. # files as they are checked out in various configurations.
  12239. # (As a side note, I'm not using the "-q" flag in any of
  12240. # this code, which should provide some extra checking for
  12241. # those messages which don't seem to be checked thoroughly
  12242. # anywhere else.) To do a thorough test, we need to make
  12243. # a bunch of modules in various configurations.
  12244. #
  12245. # <1mod> is a directory at the top level of cvsroot
  12246. # ``foo bar''
  12247. # <2mod> is a directory at the second level of cvsroot
  12248. # ``foo bar/baz''
  12249. # <1d1mod> is a directory at the top level which is
  12250. # checked out into another directory
  12251. # ``foo -d bar baz''
  12252. # <1d2mod> is a directory at the second level which is
  12253. # checked out into another directory
  12254. # ``foo -d bar baz/quux''
  12255. # <2d1mod> is a directory at the top level which is
  12256. # checked out into a directory that is two deep
  12257. # ``foo -d bar/baz quux''
  12258. # <2d2mod> is a directory at the second level which is
  12259. # checked out into a directory that is two deep
  12260. # ``foo -d bar/baz quux''
  12261. #
  12262. # The tests do each of these types separately and in twos.
  12263. # We also repeat each test -d flag for 1-deep and 2-deep
  12264. # directories.
  12265. #
  12266. # Each test should check the output for the Repository
  12267. # file, since that is the one which varies depending on
  12268. # the directory and how it was checked out.
  12269. #
  12270. # Yes, this is verbose, but at least it's very thorough.
  12271. # convenience variables
  12272. REP=${CVSROOT}
  12273. # First, set TopLevelAdmin=yes so we're sure to get
  12274. # top-level CVS directories.
  12275. mkdir 1; cd 1
  12276. dotest cvsadm-setup-1 "${testcvs} -q co CVSROOT/config" \
  12277. "U CVSROOT/config"
  12278. cd CVSROOT
  12279. echo "TopLevelAdmin=yes" >config
  12280. dotest cvsadm-setup-2 "${testcvs} -q ci -m yes-top-level" \
  12281. "Checking in config;
  12282. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  12283. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  12284. done
  12285. ${PROG} commit: Rebuilding administrative file database"
  12286. cd ../..
  12287. rm -r 1
  12288. # Second, check out the modules file and edit it.
  12289. mkdir 1; cd 1
  12290. dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
  12291. "U CVSROOT/modules"
  12292. # Test CVS/Root once. Since there is only one part of
  12293. # the code which writes CVS/Root files (Create_Admin),
  12294. # there is no point in testing this every time.
  12295. dotest cvsadm-1a "cat CVS/Root" ${REP}
  12296. dotest cvsadm-1b "cat CVS/Repository" "\."
  12297. dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
  12298. dotest cvsadm-1d "cat CVSROOT/CVS/Repository" "CVSROOT"
  12299. # All of the defined module names begin with a number.
  12300. # All of the top-level directory names begin with "dir".
  12301. # All of the subdirectory names begin with "sub".
  12302. # All of the top-level modules begin with "mod".
  12303. echo "# Module defs for cvsadm tests" > CVSROOT/modules
  12304. echo "1mod mod1" >> CVSROOT/modules
  12305. echo "1mod-2 mod1-2" >> CVSROOT/modules
  12306. echo "2mod mod2/sub2" >> CVSROOT/modules
  12307. echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
  12308. echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
  12309. echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
  12310. echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
  12311. echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
  12312. echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
  12313. echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
  12314. echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
  12315. echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
  12316. dotest cvsadm-1e "${testcvs} ci -m add-modules" \
  12317. "${PROG} [a-z]*: Examining .
  12318. ${PROG} [a-z]*: Examining CVSROOT
  12319. Checking in CVSROOT/modules;
  12320. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  12321. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  12322. done
  12323. ${PROG} commit: Rebuilding administrative file database" \
  12324. "${PROG} commit: Examining .
  12325. ${PROG} commit: Examining CVSROOT"
  12326. rm -rf CVS CVSROOT;
  12327. # Create the various modules
  12328. dotest cvsadm-2 "${testcvs} -q co -l ." ''
  12329. mkdir mod1
  12330. mkdir mod1-2
  12331. mkdir mod2
  12332. mkdir mod2/sub2
  12333. mkdir mod2-2
  12334. mkdir mod2-2/sub2-2
  12335. dotest cvsadm-2a "${testcvs} add mod1 mod1-2 mod2 mod2/sub2 mod2-2 mod2-2/sub2-2" \
  12336. "Directory ${CVSROOT_DIRNAME}/mod1 added to the repository
  12337. Directory ${CVSROOT_DIRNAME}/mod1-2 added to the repository
  12338. Directory ${CVSROOT_DIRNAME}/mod2 added to the repository
  12339. Directory ${CVSROOT_DIRNAME}/mod2/sub2 added to the repository
  12340. Directory ${CVSROOT_DIRNAME}/mod2-2 added to the repository
  12341. Directory ${CVSROOT_DIRNAME}/mod2-2/sub2-2 added to the repository"
  12342. # Populate the directories for the halibut
  12343. echo "file1" > mod1/file1
  12344. echo "file1-2" > mod1-2/file1-2
  12345. echo "file2" > mod2/sub2/file2
  12346. echo "file2-2" > mod2-2/sub2-2/file2-2
  12347. dotest cvsadm-2aa "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
  12348. "${PROG} add: scheduling file .mod1/file1. for addition
  12349. ${PROG} add: scheduling file .mod1-2/file1-2. for addition
  12350. ${PROG} add: scheduling file .mod2/sub2/file2. for addition
  12351. ${PROG} add: scheduling file .mod2-2/sub2-2/file2-2. for addition
  12352. ${PROG} add: use .${PROG} commit. to add these files permanently"
  12353. dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
  12354. "${PROG} [a-z]*: Examining mod1
  12355. ${PROG} [a-z]*: Examining mod1-2
  12356. ${PROG} [a-z]*: Examining mod2
  12357. ${PROG} [a-z]*: Examining mod2/sub2
  12358. ${PROG} [a-z]*: Examining mod2-2
  12359. ${PROG} [a-z]*: Examining mod2-2/sub2-2
  12360. RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
  12361. done
  12362. Checking in mod1/file1;
  12363. ${CVSROOT_DIRNAME}/mod1/file1,v <-- file1
  12364. initial revision: 1.1
  12365. done
  12366. RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
  12367. done
  12368. Checking in mod1-2/file1-2;
  12369. ${CVSROOT_DIRNAME}/mod1-2/file1-2,v <-- file1-2
  12370. initial revision: 1.1
  12371. done
  12372. RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
  12373. done
  12374. Checking in mod2/sub2/file2;
  12375. ${CVSROOT_DIRNAME}/mod2/sub2/file2,v <-- file2
  12376. initial revision: 1.1
  12377. done
  12378. RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
  12379. done
  12380. Checking in mod2-2/sub2-2/file2-2;
  12381. ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v <-- file2-2
  12382. initial revision: 1.1
  12383. done"
  12384. # Finished creating the modules -- clean up.
  12385. rm -rf CVS mod1 mod1-2 mod2 mod2-2
  12386. # Done.
  12387. ##################################################
  12388. ## Start the dizzying array of possibilities.
  12389. ## Begin with each module type separately.
  12390. ##################################################
  12391. # Pattern -- after each checkout, first check the top-level
  12392. # CVS directory. Then, check the directories in numerical
  12393. # order.
  12394. dotest cvsadm-3 "${testcvs} co 1mod" \
  12395. "${PROG} checkout: Updating 1mod
  12396. U 1mod/file1"
  12397. dotest cvsadm-3b "cat CVS/Repository" "\."
  12398. dotest cvsadm-3d "cat 1mod/CVS/Repository" "mod1"
  12399. rm -rf CVS 1mod
  12400. dotest cvsadm-4 "${testcvs} co 2mod" \
  12401. "${PROG} checkout: Updating 2mod
  12402. U 2mod/file2"
  12403. dotest cvsadm-4b "cat CVS/Repository" "\."
  12404. dotest cvsadm-4d "cat 2mod/CVS/Repository" "mod2/sub2"
  12405. rm -rf CVS 2mod
  12406. dotest cvsadm-5 "${testcvs} co 1d1mod" \
  12407. "${PROG} checkout: Updating dir1d1
  12408. U dir1d1/file1"
  12409. dotest cvsadm-5b "cat CVS/Repository" "\."
  12410. dotest cvsadm-5d "cat dir1d1/CVS/Repository" "mod1"
  12411. rm -rf CVS dir1d1
  12412. dotest cvsadm-6 "${testcvs} co 1d2mod" \
  12413. "${PROG} checkout: Updating dir1d2
  12414. U dir1d2/file2"
  12415. dotest cvsadm-6b "cat CVS/Repository" "\."
  12416. dotest cvsadm-6d "cat dir1d2/CVS/Repository" "mod2/sub2"
  12417. rm -rf CVS dir1d2
  12418. dotest cvsadm-7 "${testcvs} co 2d1mod" \
  12419. "${PROG} checkout: Updating dir2d1/sub2d1
  12420. U dir2d1/sub2d1/file1"
  12421. dotest cvsadm-7b "cat CVS/Repository" "\."
  12422. dotest cvsadm-7d "cat dir2d1/CVS/Repository" "\."
  12423. dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12424. rm -rf CVS dir2d1
  12425. dotest cvsadm-8 "${testcvs} co 2d2mod" \
  12426. "${PROG} checkout: Updating dir2d2/sub2d2
  12427. U dir2d2/sub2d2/file2"
  12428. dotest cvsadm-8b "cat CVS/Repository" "\."
  12429. dotest cvsadm-8d "cat dir2d2/CVS/Repository" "mod2"
  12430. dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12431. rm -rf CVS dir2d2
  12432. ##################################################
  12433. ## You are in a shell script of twisted little
  12434. ## module combination statements, all alike.
  12435. ##################################################
  12436. ### 1mod
  12437. dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
  12438. "${PROG} checkout: Updating 1mod
  12439. U 1mod/file1
  12440. ${PROG} checkout: Updating 1mod-2
  12441. U 1mod-2/file1-2"
  12442. # the usual for the top level
  12443. dotest cvsadm-9b "cat CVS/Repository" "\."
  12444. # the usual for 1mod
  12445. dotest cvsadm-9d "cat 1mod/CVS/Repository" "mod1"
  12446. # the usual for 1mod copy
  12447. dotest cvsadm-9f "cat 1mod-2/CVS/Repository" "mod1-2"
  12448. rm -rf CVS 1mod 1mod-2
  12449. # 1mod 2mod redmod bluemod
  12450. dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
  12451. "${PROG} checkout: Updating 1mod
  12452. U 1mod/file1
  12453. ${PROG} checkout: Updating 2mod
  12454. U 2mod/file2"
  12455. # the usual for the top level
  12456. dotest cvsadm-10b "cat CVS/Repository" "\."
  12457. # the usual for 1mod
  12458. dotest cvsadm-10d "cat 1mod/CVS/Repository" "mod1"
  12459. # the usual for 2dmod
  12460. dotest cvsadm-10f "cat 2mod/CVS/Repository" "mod2/sub2"
  12461. rm -rf CVS 1mod 2mod
  12462. dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
  12463. "${PROG} checkout: Updating 1mod
  12464. U 1mod/file1
  12465. ${PROG} checkout: Updating dir1d1
  12466. U dir1d1/file1"
  12467. # the usual for the top level
  12468. dotest cvsadm-11b "cat CVS/Repository" "\."
  12469. # the usual for 1mod
  12470. dotest cvsadm-11d "cat 1mod/CVS/Repository" "mod1"
  12471. # the usual for 1d1mod
  12472. dotest cvsadm-11f "cat dir1d1/CVS/Repository" "mod1"
  12473. rm -rf CVS 1mod dir1d1
  12474. dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
  12475. "${PROG} checkout: Updating 1mod
  12476. U 1mod/file1
  12477. ${PROG} checkout: Updating dir1d2
  12478. U dir1d2/file2"
  12479. # the usual for the top level
  12480. dotest cvsadm-12b "cat CVS/Repository" "\."
  12481. # the usual for 1mod
  12482. dotest cvsadm-12d "cat 1mod/CVS/Repository" "mod1"
  12483. # the usual for 1d2mod
  12484. dotest cvsadm-12f "cat dir1d2/CVS/Repository" "mod2/sub2"
  12485. rm -rf CVS 1mod dir1d2
  12486. dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
  12487. "${PROG} checkout: Updating 1mod
  12488. U 1mod/file1
  12489. ${PROG} checkout: Updating dir2d1/sub2d1
  12490. U dir2d1/sub2d1/file1"
  12491. # the usual for the top level
  12492. dotest cvsadm-13b "cat CVS/Repository" "\."
  12493. # the usual for 1mod
  12494. dotest cvsadm-13d "cat 1mod/CVS/Repository" "mod1"
  12495. # the usual for 2d1mod
  12496. dotest cvsadm-13f "cat dir2d1/CVS/Repository" "\."
  12497. dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12498. rm -rf CVS 1mod dir2d1
  12499. dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
  12500. "${PROG} checkout: Updating 1mod
  12501. U 1mod/file1
  12502. ${PROG} checkout: Updating dir2d2/sub2d2
  12503. U dir2d2/sub2d2/file2"
  12504. # the usual for the top level
  12505. dotest cvsadm-14b "cat CVS/Repository" "\."
  12506. # the usual for 1mod
  12507. dotest cvsadm-14d "cat 1mod/CVS/Repository" "mod1"
  12508. # the usual for 2d2mod
  12509. dotest cvsadm-14f "cat dir2d2/CVS/Repository" "mod2"
  12510. dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12511. rm -rf CVS 1mod dir2d2
  12512. ### 2mod
  12513. dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
  12514. "${PROG} checkout: Updating 2mod
  12515. U 2mod/file2
  12516. ${PROG} checkout: Updating 2mod-2
  12517. U 2mod-2/file2-2"
  12518. # the usual for the top level
  12519. dotest cvsadm-15b "cat CVS/Repository" "\."
  12520. # the usual for 2mod
  12521. dotest cvsadm-15d "cat 2mod/CVS/Repository" "mod2/sub2"
  12522. # the usual for 2mod copy
  12523. dotest cvsadm-15f "cat 2mod-2/CVS/Repository" "mod2-2/sub2-2"
  12524. rm -rf CVS 2mod 2mod-2
  12525. dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
  12526. "${PROG} checkout: Updating 2mod
  12527. U 2mod/file2
  12528. ${PROG} checkout: Updating dir1d1
  12529. U dir1d1/file1"
  12530. # the usual for the top level
  12531. dotest cvsadm-16b "cat CVS/Repository" "\."
  12532. # the usual for 2mod
  12533. dotest cvsadm-16d "cat 2mod/CVS/Repository" "mod2/sub2"
  12534. # the usual for 1d1mod
  12535. dotest cvsadm-16f "cat dir1d1/CVS/Repository" "mod1"
  12536. rm -rf CVS 2mod dir1d1
  12537. dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
  12538. "${PROG} checkout: Updating 2mod
  12539. U 2mod/file2
  12540. ${PROG} checkout: Updating dir1d2
  12541. U dir1d2/file2"
  12542. # the usual for the top level
  12543. dotest cvsadm-17b "cat CVS/Repository" "\."
  12544. # the usual for 2mod
  12545. dotest cvsadm-17d "cat 2mod/CVS/Repository" "mod2/sub2"
  12546. # the usual for 1d2mod
  12547. dotest cvsadm-17f "cat dir1d2/CVS/Repository" "mod2/sub2"
  12548. rm -rf CVS 2mod dir1d2
  12549. dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
  12550. "${PROG} checkout: Updating 2mod
  12551. U 2mod/file2
  12552. ${PROG} checkout: Updating dir2d1/sub2d1
  12553. U dir2d1/sub2d1/file1"
  12554. # the usual for the top level
  12555. dotest cvsadm-18b "cat CVS/Repository" "\."
  12556. # the usual for 2mod
  12557. dotest cvsadm-18d "cat 2mod/CVS/Repository" "mod2/sub2"
  12558. # the usual for 2d1mod
  12559. dotest cvsadm-18f "cat dir2d1/CVS/Repository" "\."
  12560. dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12561. rm -rf CVS 2mod dir2d1
  12562. dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
  12563. "${PROG} checkout: Updating 2mod
  12564. U 2mod/file2
  12565. ${PROG} checkout: Updating dir2d2/sub2d2
  12566. U dir2d2/sub2d2/file2"
  12567. # the usual for the top level
  12568. dotest cvsadm-19b "cat CVS/Repository" "\."
  12569. # the usual for 2mod
  12570. dotest cvsadm-19d "cat 2mod/CVS/Repository" "mod2/sub2"
  12571. # the usual for 2d2mod
  12572. dotest cvsadm-19f "cat dir2d2/CVS/Repository" "mod2"
  12573. dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12574. rm -rf CVS 2mod dir2d2
  12575. ### 1d1mod
  12576. dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
  12577. "${PROG} checkout: Updating dir1d1
  12578. U dir1d1/file1
  12579. ${PROG} checkout: Updating dir1d1-2
  12580. U dir1d1-2/file1-2"
  12581. # the usual for the top level
  12582. dotest cvsadm-20b "cat CVS/Repository" "\."
  12583. # the usual for 1d1mod
  12584. dotest cvsadm-20d "cat dir1d1/CVS/Repository" "mod1"
  12585. # the usual for 1d1mod copy
  12586. dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" "mod1-2"
  12587. rm -rf CVS dir1d1 dir1d1-2
  12588. dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
  12589. "${PROG} checkout: Updating dir1d1
  12590. U dir1d1/file1
  12591. ${PROG} checkout: Updating dir1d2
  12592. U dir1d2/file2"
  12593. # the usual for the top level
  12594. dotest cvsadm-21b "cat CVS/Repository" "\."
  12595. # the usual for 1d1mod
  12596. dotest cvsadm-21d "cat dir1d1/CVS/Repository" "mod1"
  12597. # the usual for 1d2mod
  12598. dotest cvsadm-21f "cat dir1d2/CVS/Repository" "mod2/sub2"
  12599. rm -rf CVS dir1d1 dir1d2
  12600. dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
  12601. "${PROG} checkout: Updating dir1d1
  12602. U dir1d1/file1
  12603. ${PROG} checkout: Updating dir2d1/sub2d1
  12604. U dir2d1/sub2d1/file1"
  12605. # the usual for the top level
  12606. dotest cvsadm-22b "cat CVS/Repository" "\."
  12607. # the usual for 1d1mod
  12608. dotest cvsadm-22d "cat dir1d1/CVS/Repository" "mod1"
  12609. # the usual for 2d1mod
  12610. dotest cvsadm-22f "cat dir2d1/CVS/Repository" "\."
  12611. dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12612. rm -rf CVS dir1d1 dir2d1
  12613. dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
  12614. "${PROG} checkout: Updating dir1d1
  12615. U dir1d1/file1
  12616. ${PROG} checkout: Updating dir2d2/sub2d2
  12617. U dir2d2/sub2d2/file2"
  12618. # the usual for the top level
  12619. dotest cvsadm-23b "cat CVS/Repository" "\."
  12620. # the usual for 1d1mod
  12621. dotest cvsadm-23d "cat dir1d1/CVS/Repository" "mod1"
  12622. # the usual for 2d2mod
  12623. dotest cvsadm-23f "cat dir2d2/CVS/Repository" "mod2"
  12624. dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12625. rm -rf CVS dir1d1 dir2d2
  12626. ### 1d2mod
  12627. dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
  12628. "${PROG} checkout: Updating dir1d2
  12629. U dir1d2/file2
  12630. ${PROG} checkout: Updating dir1d2-2
  12631. U dir1d2-2/file2-2"
  12632. # the usual for the top level
  12633. dotest cvsadm-24b "cat CVS/Repository" "\."
  12634. # the usual for 1d2mod
  12635. dotest cvsadm-24d "cat dir1d2/CVS/Repository" "mod2/sub2"
  12636. # the usual for 1d2mod copy
  12637. dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
  12638. rm -rf CVS dir1d2 dir1d2-2
  12639. dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
  12640. "${PROG} checkout: Updating dir1d2
  12641. U dir1d2/file2
  12642. ${PROG} checkout: Updating dir2d1/sub2d1
  12643. U dir2d1/sub2d1/file1"
  12644. # the usual for the top level
  12645. dotest cvsadm-25b "cat CVS/Repository" "\."
  12646. # the usual for 1d2mod
  12647. dotest cvsadm-25d "cat dir1d2/CVS/Repository" "mod2/sub2"
  12648. # the usual for 2d1mod
  12649. dotest cvsadm-25f "cat dir2d1/CVS/Repository" "\."
  12650. dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12651. rm -rf CVS dir1d2 dir2d1
  12652. dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
  12653. "${PROG} checkout: Updating dir1d2
  12654. U dir1d2/file2
  12655. ${PROG} checkout: Updating dir2d2/sub2d2
  12656. U dir2d2/sub2d2/file2"
  12657. # the usual for the top level
  12658. dotest cvsadm-26b "cat CVS/Repository" "\."
  12659. # the usual for 1d2mod
  12660. dotest cvsadm-26d "cat dir1d2/CVS/Repository" "mod2/sub2"
  12661. # the usual for 2d2mod
  12662. dotest cvsadm-26f "cat dir2d2/CVS/Repository" "mod2"
  12663. dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12664. rm -rf CVS dir1d2 dir2d2
  12665. # 2d1mod
  12666. dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
  12667. "${PROG} checkout: Updating dir2d1/sub2d1
  12668. U dir2d1/sub2d1/file1
  12669. ${PROG} checkout: Updating dir2d1-2/sub2d1-2
  12670. U dir2d1-2/sub2d1-2/file1-2"
  12671. # the usual for the top level
  12672. dotest cvsadm-27b "cat CVS/Repository" "\."
  12673. # the usual for 2d1mod
  12674. dotest cvsadm-27d "cat dir2d1/CVS/Repository" "\."
  12675. dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12676. # the usual for 2d1mod
  12677. dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" "\."
  12678. dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" "mod1-2"
  12679. rm -rf CVS dir2d1 dir2d1-2
  12680. dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
  12681. "${PROG} checkout: Updating dir2d1/sub2d1
  12682. U dir2d1/sub2d1/file1
  12683. ${PROG} checkout: Updating dir2d2/sub2d2
  12684. U dir2d2/sub2d2/file2"
  12685. # the usual for the top level
  12686. dotest cvsadm-28b "cat CVS/Repository" "\."
  12687. # the usual for 2d1mod
  12688. dotest cvsadm-28d "cat dir2d1/CVS/Repository" "\."
  12689. dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  12690. # the usual for 2d2mod
  12691. dotest cvsadm-28h "cat dir2d2/CVS/Repository" "mod2"
  12692. dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12693. rm -rf CVS dir2d1 dir2d2
  12694. # 2d2mod
  12695. dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
  12696. "${PROG} checkout: Updating dir2d2/sub2d2
  12697. U dir2d2/sub2d2/file2
  12698. ${PROG} checkout: Updating dir2d2-2/sub2d2-2
  12699. U dir2d2-2/sub2d2-2/file2-2"
  12700. # the usual for the top level
  12701. dotest cvsadm-29b "cat CVS/Repository" "\."
  12702. # the usual for 2d2mod
  12703. dotest cvsadm-29d "cat dir2d2/CVS/Repository" "mod2"
  12704. dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12705. # the usual for 2d2mod
  12706. dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" "mod2-2"
  12707. dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
  12708. "mod2-2/sub2-2"
  12709. rm -rf CVS dir2d2 dir2d2-2
  12710. ##################################################
  12711. ## And now, all of that again using the "-d" flag
  12712. ## on the command line.
  12713. ##################################################
  12714. dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
  12715. "${PROG} checkout: Updating dir
  12716. U dir/file1"
  12717. dotest cvsadm-1d3b "cat CVS/Repository" "\."
  12718. dotest cvsadm-1d3d "cat dir/CVS/Repository" "mod1"
  12719. rm -rf CVS dir
  12720. dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
  12721. "${PROG} checkout: Updating dir
  12722. U dir/file2"
  12723. dotest cvsadm-1d4b "cat CVS/Repository" "\."
  12724. dotest cvsadm-1d4d "cat dir/CVS/Repository" "mod2/sub2"
  12725. rm -rf CVS dir
  12726. dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
  12727. "${PROG} checkout: Updating dir
  12728. U dir/file1"
  12729. dotest cvsadm-1d5b "cat CVS/Repository" "\."
  12730. dotest cvsadm-1d5d "cat dir/CVS/Repository" "mod1"
  12731. rm -rf CVS dir
  12732. dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
  12733. "${PROG} checkout: Updating dir
  12734. U dir/file2"
  12735. dotest cvsadm-1d6b "cat CVS/Repository" "\."
  12736. dotest cvsadm-1d6d "cat dir/CVS/Repository" "mod2/sub2"
  12737. rm -rf CVS dir
  12738. dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
  12739. "${PROG} checkout: Updating dir
  12740. U dir/file1"
  12741. dotest cvsadm-1d7b "cat CVS/Repository" "\."
  12742. dotest cvsadm-1d7d "cat dir/CVS/Repository" "mod1"
  12743. rm -rf CVS dir
  12744. dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
  12745. "${PROG} checkout: Updating dir
  12746. U dir/file2"
  12747. dotest cvsadm-1d8b "cat CVS/Repository" "\."
  12748. dotest cvsadm-1d8d "cat dir/CVS/Repository" "mod2/sub2"
  12749. rm -rf CVS dir
  12750. ##################################################
  12751. ## Los Combonaciones
  12752. ##################################################
  12753. ### 1mod
  12754. dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
  12755. "${PROG} checkout: Updating dir/1mod
  12756. U dir/1mod/file1
  12757. ${PROG} checkout: Updating dir/1mod-2
  12758. U dir/1mod-2/file1-2"
  12759. # the usual for the top level
  12760. dotest cvsadm-1d9b "cat CVS/Repository" "\."
  12761. # the usual for the dir level
  12762. dotest cvsadm-1d9d "cat dir/CVS/Repository" "\."
  12763. # the usual for 1mod
  12764. dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" "mod1"
  12765. # the usual for 1mod copy
  12766. dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" "mod1-2"
  12767. rm -rf CVS dir
  12768. # 1mod 2mod redmod bluemod
  12769. dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
  12770. "${PROG} checkout: Updating dir/1mod
  12771. U dir/1mod/file1
  12772. ${PROG} checkout: Updating dir/2mod
  12773. U dir/2mod/file2"
  12774. dotest cvsadm-1d10b "cat CVS/Repository" "\."
  12775. # the usual for the dir level
  12776. dotest cvsadm-1d10d "cat dir/CVS/Repository" "\."
  12777. # the usual for 1mod
  12778. dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" "mod1"
  12779. # the usual for 2dmod
  12780. dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12781. rm -rf CVS dir
  12782. dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
  12783. "${PROG} checkout: Updating dir/1mod
  12784. U dir/1mod/file1
  12785. ${PROG} checkout: Updating dir/dir1d1
  12786. U dir/dir1d1/file1"
  12787. dotest cvsadm-1d11b "cat CVS/Repository" "\."
  12788. # the usual for the dir level
  12789. dotest cvsadm-1d11d "cat dir/CVS/Repository" "\."
  12790. # the usual for 1mod
  12791. dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" "mod1"
  12792. # the usual for 1d1mod
  12793. dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" "mod1"
  12794. rm -rf CVS dir
  12795. dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
  12796. "${PROG} checkout: Updating dir/1mod
  12797. U dir/1mod/file1
  12798. ${PROG} checkout: Updating dir/dir1d2
  12799. U dir/dir1d2/file2"
  12800. dotest cvsadm-1d12b "cat CVS/Repository" "\."
  12801. # the usual for the dir level
  12802. dotest cvsadm-1d12d "cat dir/CVS/Repository" "\."
  12803. # the usual for 1mod
  12804. dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" "mod1"
  12805. # the usual for 1d2mod
  12806. dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12807. rm -rf CVS dir
  12808. dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
  12809. "${PROG} checkout: Updating dir/1mod
  12810. U dir/1mod/file1
  12811. ${PROG} checkout: Updating dir/dir2d1/sub2d1
  12812. U dir/dir2d1/sub2d1/file1"
  12813. dotest cvsadm-1d13b "cat CVS/Repository" "\."
  12814. # the usual for the dir level
  12815. dotest cvsadm-1d13d "cat dir/CVS/Repository" "\."
  12816. # the usual for 1mod
  12817. dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" "mod1"
  12818. # the usual for 2d1mod
  12819. dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" "\."
  12820. dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  12821. rm -rf CVS dir
  12822. dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
  12823. "${PROG} checkout: Updating dir/1mod
  12824. U dir/1mod/file1
  12825. ${PROG} checkout: Updating dir/dir2d2/sub2d2
  12826. U dir/dir2d2/sub2d2/file2"
  12827. dotest cvsadm-1d14b "cat CVS/Repository" "\."
  12828. # the usual for the dir level
  12829. dotest cvsadm-1d14d "cat dir/CVS/Repository" "\."
  12830. # the usual for 1mod
  12831. dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" "mod1"
  12832. # the usual for 2d2mod
  12833. dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" "mod2"
  12834. dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12835. rm -rf CVS dir
  12836. ### 2mod
  12837. dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
  12838. "${PROG} checkout: Updating dir/2mod
  12839. U dir/2mod/file2
  12840. ${PROG} checkout: Updating dir/2mod-2
  12841. U dir/2mod-2/file2-2"
  12842. dotest cvsadm-1d15b "cat CVS/Repository" "\."
  12843. # the usual for the dir level
  12844. dotest cvsadm-1d15d "cat dir/CVS/Repository" "mod2"
  12845. # the usual for 2mod
  12846. dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12847. # the usual for 2mod copy
  12848. dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" "mod2-2/sub2-2"
  12849. rm -rf CVS dir
  12850. dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
  12851. "${PROG} checkout: Updating dir/2mod
  12852. U dir/2mod/file2
  12853. ${PROG} checkout: Updating dir/dir1d1
  12854. U dir/dir1d1/file1"
  12855. dotest cvsadm-1d16b "cat CVS/Repository" "\."
  12856. # the usual for the dir level
  12857. dotest cvsadm-1d16d "cat dir/CVS/Repository" "mod2"
  12858. # the usual for 2mod
  12859. dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12860. # the usual for 1d1mod
  12861. dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" "mod1"
  12862. rm -rf CVS dir
  12863. dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
  12864. "${PROG} checkout: Updating dir/2mod
  12865. U dir/2mod/file2
  12866. ${PROG} checkout: Updating dir/dir1d2
  12867. U dir/dir1d2/file2"
  12868. dotest cvsadm-1d17b "cat CVS/Repository" "\."
  12869. # the usual for the dir level
  12870. dotest cvsadm-1d17d "cat dir/CVS/Repository" "mod2"
  12871. # the usual for 2mod
  12872. dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12873. # the usual for 1d2mod
  12874. dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12875. rm -rf CVS dir
  12876. dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
  12877. "${PROG} checkout: Updating dir/2mod
  12878. U dir/2mod/file2
  12879. ${PROG} checkout: Updating dir/dir2d1/sub2d1
  12880. U dir/dir2d1/sub2d1/file1"
  12881. dotest cvsadm-1d18b "cat CVS/Repository" "\."
  12882. # the usual for the dir level
  12883. dotest cvsadm-1d18d "cat dir/CVS/Repository" "mod2"
  12884. # the usual for 2mod
  12885. dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12886. # the usual for 2d1mod
  12887. dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" "\."
  12888. dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  12889. rm -rf CVS dir
  12890. dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
  12891. "${PROG} checkout: Updating dir/2mod
  12892. U dir/2mod/file2
  12893. ${PROG} checkout: Updating dir/dir2d2/sub2d2
  12894. U dir/dir2d2/sub2d2/file2"
  12895. dotest cvsadm-1d19b "cat CVS/Repository" "\."
  12896. # the usual for the dir level
  12897. dotest cvsadm-1d19d "cat dir/CVS/Repository" "mod2"
  12898. # the usual for 2mod
  12899. dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  12900. # the usual for 2d2mod
  12901. dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" "mod2"
  12902. dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12903. rm -rf CVS dir
  12904. ### 1d1mod
  12905. dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
  12906. "${PROG} checkout: Updating dir/dir1d1
  12907. U dir/dir1d1/file1
  12908. ${PROG} checkout: Updating dir/dir1d1-2
  12909. U dir/dir1d1-2/file1-2"
  12910. dotest cvsadm-1d20b "cat CVS/Repository" "\."
  12911. # the usual for the dir level
  12912. dotest cvsadm-1d20d "cat dir/CVS/Repository" "\."
  12913. # the usual for 1d1mod
  12914. dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" "mod1"
  12915. # the usual for 1d1mod copy
  12916. dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" "mod1-2"
  12917. rm -rf CVS dir
  12918. dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
  12919. "${PROG} checkout: Updating dir/dir1d1
  12920. U dir/dir1d1/file1
  12921. ${PROG} checkout: Updating dir/dir1d2
  12922. U dir/dir1d2/file2"
  12923. dotest cvsadm-1d21b "cat CVS/Repository" "\."
  12924. # the usual for the dir level
  12925. dotest cvsadm-1d21d "cat dir/CVS/Repository" "\."
  12926. # the usual for 1d1mod
  12927. dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" "mod1"
  12928. # the usual for 1d2mod
  12929. dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12930. rm -rf CVS dir
  12931. dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
  12932. "${PROG} checkout: Updating dir/dir1d1
  12933. U dir/dir1d1/file1
  12934. ${PROG} checkout: Updating dir/dir2d1/sub2d1
  12935. U dir/dir2d1/sub2d1/file1"
  12936. dotest cvsadm-1d22b "cat CVS/Repository" "\."
  12937. # the usual for the dir level
  12938. dotest cvsadm-1d22d "cat dir/CVS/Repository" "\."
  12939. # the usual for 1d1mod
  12940. dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" "mod1"
  12941. # the usual for 2d1mod
  12942. dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" "\."
  12943. dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  12944. rm -rf CVS dir
  12945. dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
  12946. "${PROG} checkout: Updating dir/dir1d1
  12947. U dir/dir1d1/file1
  12948. ${PROG} checkout: Updating dir/dir2d2/sub2d2
  12949. U dir/dir2d2/sub2d2/file2"
  12950. dotest cvsadm-1d23b "cat CVS/Repository" "\."
  12951. # the usual for the dir level
  12952. dotest cvsadm-1d23d "cat dir/CVS/Repository" "\."
  12953. # the usual for 1d1mod
  12954. dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" "mod1"
  12955. # the usual for 2d2mod
  12956. dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" "mod2"
  12957. dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  12958. rm -rf CVS dir
  12959. ### 1d2mod
  12960. dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
  12961. "${PROG} checkout: Updating dir/dir1d2
  12962. U dir/dir1d2/file2
  12963. ${PROG} checkout: Updating dir/dir1d2-2
  12964. U dir/dir1d2-2/file2-2"
  12965. dotest cvsadm-1d24b "cat CVS/Repository" "\."
  12966. # the usual for the dir level
  12967. dotest cvsadm-1d24d "cat dir/CVS/Repository" "mod2"
  12968. # the usual for 1d2mod
  12969. dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12970. # the usual for 1d2mod copy
  12971. dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" "mod2-2/sub2-2"
  12972. rm -rf CVS dir
  12973. dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
  12974. "${PROG} checkout: Updating dir/dir1d2
  12975. U dir/dir1d2/file2
  12976. ${PROG} checkout: Updating dir/dir2d1/sub2d1
  12977. U dir/dir2d1/sub2d1/file1"
  12978. dotest cvsadm-1d25b "cat CVS/Repository" "\."
  12979. # the usual for the dir level
  12980. dotest cvsadm-1d25d "cat dir/CVS/Repository" "mod2"
  12981. # the usual for 1d2mod
  12982. dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12983. # the usual for 2d1mod
  12984. dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" "\."
  12985. dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  12986. rm -rf CVS dir
  12987. dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
  12988. "${PROG} checkout: Updating dir/dir1d2
  12989. U dir/dir1d2/file2
  12990. ${PROG} checkout: Updating dir/dir2d2/sub2d2
  12991. U dir/dir2d2/sub2d2/file2"
  12992. dotest cvsadm-1d26b "cat CVS/Repository" "\."
  12993. # the usual for the dir level
  12994. dotest cvsadm-1d26d "cat dir/CVS/Repository" "mod2"
  12995. # the usual for 1d2mod
  12996. dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  12997. # the usual for 2d2mod
  12998. dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" "mod2"
  12999. dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  13000. rm -rf CVS dir
  13001. # 2d1mod
  13002. dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
  13003. "${PROG} checkout: Updating dir/dir2d1/sub2d1
  13004. U dir/dir2d1/sub2d1/file1
  13005. ${PROG} checkout: Updating dir/dir2d1-2/sub2d1-2
  13006. U dir/dir2d1-2/sub2d1-2/file1-2"
  13007. dotest cvsadm-1d27b "cat CVS/Repository" "\."
  13008. # the usual for the dir level
  13009. dotest cvsadm-1d27d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
  13010. # the usual for 2d1mod
  13011. dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" "\."
  13012. dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  13013. # the usual for 2d1mod
  13014. dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" "\."
  13015. dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
  13016. "mod1-2"
  13017. rm -rf CVS dir
  13018. dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
  13019. "${PROG} checkout: Updating dir/dir2d1/sub2d1
  13020. U dir/dir2d1/sub2d1/file1
  13021. ${PROG} checkout: Updating dir/dir2d2/sub2d2
  13022. U dir/dir2d2/sub2d2/file2"
  13023. dotest cvsadm-1d28b "cat CVS/Repository" "\."
  13024. # the usual for the dir level
  13025. dotest cvsadm-1d28d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
  13026. # the usual for 2d1mod
  13027. dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" "\."
  13028. dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  13029. # the usual for 2d2mod
  13030. dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" "mod2"
  13031. dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  13032. rm -rf CVS dir
  13033. # 2d2mod
  13034. dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
  13035. "${PROG} checkout: Updating dir/dir2d2/sub2d2
  13036. U dir/dir2d2/sub2d2/file2
  13037. ${PROG} checkout: Updating dir/dir2d2-2/sub2d2-2
  13038. U dir/dir2d2-2/sub2d2-2/file2-2"
  13039. dotest cvsadm-1d29b "cat CVS/Repository" "\."
  13040. # the usual for the dir level
  13041. dotest cvsadm-1d29d "cat dir/CVS/Repository" "\."
  13042. # the usual for 2d2mod
  13043. dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" "mod2"
  13044. dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  13045. # the usual for 2d2mod
  13046. dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" "mod2-2"
  13047. dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
  13048. "mod2-2/sub2-2"
  13049. rm -rf CVS dir
  13050. ##################################################
  13051. ## And now, some of that again using the "-d" flag
  13052. ## on the command line, but use a longer path.
  13053. ##################################################
  13054. dotest_fail cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
  13055. "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .dir.: No such file or directory"
  13056. if $remote; then :; else
  13057. # Remote can't handle this, even with the "mkdir dir".
  13058. # This was also true of CVS 1.9.
  13059. mkdir dir
  13060. dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
  13061. "${PROG} checkout: Updating dir/dir2
  13062. U dir/dir2/file1"
  13063. dotest cvsadm-2d3b "cat CVS/Repository" "\."
  13064. dotest_fail cvsadm-2d3d "test -f dir/CVS/Repository" ""
  13065. dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" "mod1"
  13066. rm -rf CVS dir
  13067. mkdir dir
  13068. dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
  13069. "${PROG} checkout: Updating dir/dir2
  13070. U dir/dir2/file2"
  13071. dotest cvsadm-2d4b "cat CVS/Repository" "\."
  13072. dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" "mod2/sub2"
  13073. rm -rf CVS dir
  13074. mkdir dir
  13075. dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
  13076. "${PROG} checkout: Updating dir/dir2
  13077. U dir/dir2/file1"
  13078. dotest cvsadm-2d5b "cat CVS/Repository" "\."
  13079. dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" "mod1"
  13080. rm -rf CVS dir
  13081. mkdir dir
  13082. dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
  13083. "${PROG} checkout: Updating dir/dir2
  13084. U dir/dir2/file2"
  13085. dotest cvsadm-2d6b "cat CVS/Repository" "\."
  13086. dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" "mod2/sub2"
  13087. rm -rf CVS dir
  13088. mkdir dir
  13089. dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
  13090. "${PROG} checkout: Updating dir/dir2
  13091. U dir/dir2/file1"
  13092. dotest cvsadm-2d7b "cat CVS/Repository" "\."
  13093. dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" "mod1"
  13094. rm -rf CVS dir
  13095. mkdir dir
  13096. dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
  13097. "${PROG} checkout: Updating dir/dir2
  13098. U dir/dir2/file2"
  13099. dotest cvsadm-2d8b "cat CVS/Repository" "\."
  13100. dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" "mod2/sub2"
  13101. rm -rf CVS dir
  13102. ##################################################
  13103. ## And now, a few of those tests revisited to
  13104. ## test the behavior of the -N flag.
  13105. ##################################################
  13106. dotest cvsadm-N3 "${testcvs} co -N 1mod" \
  13107. "${PROG} checkout: Updating 1mod
  13108. U 1mod/file1"
  13109. dotest cvsadm-N3b "cat CVS/Repository" "\."
  13110. dotest cvsadm-N3d "cat 1mod/CVS/Repository" "mod1"
  13111. rm -rf CVS 1mod
  13112. dotest cvsadm-N4 "${testcvs} co -N 2mod" \
  13113. "${PROG} checkout: Updating 2mod
  13114. U 2mod/file2"
  13115. dotest cvsadm-N4b "cat CVS/Repository" "\."
  13116. dotest cvsadm-N4d "cat 2mod/CVS/Repository" "mod2/sub2"
  13117. rm -rf CVS 2mod
  13118. dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
  13119. "${PROG} checkout: Updating dir1d1
  13120. U dir1d1/file1"
  13121. dotest cvsadm-N5b "cat CVS/Repository" "\."
  13122. dotest cvsadm-N5d "cat dir1d1/CVS/Repository" "mod1"
  13123. rm -rf CVS dir1d1
  13124. dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
  13125. "${PROG} checkout: Updating dir1d2
  13126. U dir1d2/file2"
  13127. dotest cvsadm-N6b "cat CVS/Repository" "\."
  13128. dotest cvsadm-N6d "cat dir1d2/CVS/Repository" "mod2/sub2"
  13129. rm -rf CVS dir1d2
  13130. dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
  13131. "${PROG} checkout: Updating dir2d1/sub2d1
  13132. U dir2d1/sub2d1/file1"
  13133. dotest cvsadm-N7b "cat CVS/Repository" "\."
  13134. dotest cvsadm-N7d "cat dir2d1/CVS/Repository" "\."
  13135. dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
  13136. rm -rf CVS dir2d1
  13137. dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
  13138. "${PROG} checkout: Updating dir2d2/sub2d2
  13139. U dir2d2/sub2d2/file2"
  13140. dotest cvsadm-N8b "cat CVS/Repository" "\."
  13141. dotest cvsadm-N8d "cat dir2d2/CVS/Repository" "mod2"
  13142. dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
  13143. rm -rf CVS dir2d2
  13144. ## the ones in one-deep directories
  13145. dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
  13146. "${PROG} checkout: Updating dir/1mod
  13147. U dir/1mod/file1"
  13148. dotest cvsadm-N1d3b "cat CVS/Repository" "\."
  13149. dotest cvsadm-N1d3d "cat dir/CVS/Repository" "\."
  13150. dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" "mod1"
  13151. rm -rf CVS dir
  13152. dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
  13153. "${PROG} checkout: Updating dir/2mod
  13154. U dir/2mod/file2"
  13155. dotest cvsadm-N1d4b "cat CVS/Repository" "\."
  13156. dotest cvsadm-N1d4d "cat dir/CVS/Repository" "mod2"
  13157. dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" "mod2/sub2"
  13158. rm -rf CVS dir
  13159. dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
  13160. "${PROG} checkout: Updating dir/dir1d1
  13161. U dir/dir1d1/file1"
  13162. dotest cvsadm-N1d5b "cat CVS/Repository" "\."
  13163. dotest cvsadm-N1d5d "cat dir/CVS/Repository" "\."
  13164. dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" "mod1"
  13165. rm -rf CVS dir
  13166. dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
  13167. "${PROG} checkout: Updating dir/dir1d2
  13168. U dir/dir1d2/file2"
  13169. dotest cvsadm-N1d6b "cat CVS/Repository" "\."
  13170. dotest cvsadm-N1d6d "cat dir/CVS/Repository" "mod2"
  13171. dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
  13172. rm -rf CVS dir
  13173. dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
  13174. "${PROG} checkout: Updating dir/dir2d1/sub2d1
  13175. U dir/dir2d1/sub2d1/file1"
  13176. dotest cvsadm-N1d7b "cat CVS/Repository" "\."
  13177. dotest cvsadm-N1d7d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
  13178. dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" "\."
  13179. dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
  13180. rm -rf CVS dir
  13181. dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
  13182. "${PROG} checkout: Updating dir/dir2d2/sub2d2
  13183. U dir/dir2d2/sub2d2/file2"
  13184. dotest cvsadm-N1d8b "cat CVS/Repository" "\."
  13185. dotest cvsadm-N1d8d "cat dir/CVS/Repository" "\."
  13186. dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" "mod2"
  13187. dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
  13188. "mod2/sub2"
  13189. rm -rf CVS dir
  13190. ## the ones in two-deep directories
  13191. mkdir dir
  13192. dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
  13193. "${PROG} checkout: Updating dir/dir2/1mod
  13194. U dir/dir2/1mod/file1"
  13195. dotest cvsadm-N2d3b "cat CVS/Repository" "\."
  13196. dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" "\."
  13197. dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" "mod1"
  13198. rm -rf CVS dir
  13199. mkdir dir
  13200. dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
  13201. "${PROG} checkout: Updating dir/dir2/2mod
  13202. U dir/dir2/2mod/file2"
  13203. dotest cvsadm-N2d4b "cat CVS/Repository" "\."
  13204. dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" "mod2"
  13205. dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" "mod2/sub2"
  13206. rm -rf CVS dir
  13207. mkdir dir
  13208. dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
  13209. "${PROG} checkout: Updating dir/dir2/dir1d1
  13210. U dir/dir2/dir1d1/file1"
  13211. dotest cvsadm-N2d5b "cat CVS/Repository" "\."
  13212. dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" "\."
  13213. dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" "mod1"
  13214. rm -rf CVS dir
  13215. mkdir dir
  13216. dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
  13217. "${PROG} checkout: Updating dir/dir2/dir1d2
  13218. U dir/dir2/dir1d2/file2"
  13219. dotest cvsadm-N2d6b "cat CVS/Repository" "\."
  13220. dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" "mod2"
  13221. dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" "mod2/sub2"
  13222. rm -rf CVS dir
  13223. mkdir dir
  13224. dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
  13225. "${PROG} checkout: Updating dir/dir2/dir2d1/sub2d1
  13226. U dir/dir2/dir2d1/sub2d1/file1"
  13227. dotest cvsadm-N2d7b "cat CVS/Repository" "\."
  13228. dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" "CVSROOT/Emptydir"
  13229. dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" "\."
  13230. dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
  13231. "mod1"
  13232. rm -rf CVS dir
  13233. mkdir dir
  13234. dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
  13235. "${PROG} checkout: Updating dir/dir2/dir2d2/sub2d2
  13236. U dir/dir2/dir2d2/sub2d2/file2"
  13237. dotest cvsadm-N2d8b "cat CVS/Repository" "\."
  13238. dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" "\."
  13239. dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" "mod2"
  13240. dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
  13241. "mod2/sub2"
  13242. rm -rf CVS dir
  13243. fi # end of tests to be skipped for remote
  13244. ##################################################
  13245. ## That's enough of that, thank you very much.
  13246. ##################################################
  13247. dotest cvsadm-cleanup-1 "${testcvs} -q co CVSROOT/config" \
  13248. "U CVSROOT/config"
  13249. cd CVSROOT
  13250. echo "# empty file" >config
  13251. dotest cvsadm-cleanup-2 "${testcvs} -q ci -m cvsadm-cleanup" \
  13252. "Checking in config;
  13253. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  13254. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13255. done
  13256. ${PROG} commit: Rebuilding administrative file database"
  13257. cd ..
  13258. rm -rf CVSROOT CVS
  13259. # remove our junk
  13260. cd ..
  13261. rm -rf 1
  13262. rm -rf ${CVSROOT_DIRNAME}/1mod
  13263. rm -rf ${CVSROOT_DIRNAME}/1mod-2
  13264. rm -rf ${CVSROOT_DIRNAME}/2mod
  13265. rm -rf ${CVSROOT_DIRNAME}/2mod-2
  13266. rm -rf ${CVSROOT_DIRNAME}/mod1
  13267. rm -rf ${CVSROOT_DIRNAME}/mod1-2
  13268. rm -rf ${CVSROOT_DIRNAME}/mod2
  13269. rm -rf ${CVSROOT_DIRNAME}/mod2-2
  13270. ;;
  13271. emptydir)
  13272. # Various tests of the Emptydir (CVSNULLREPOS) code. See also:
  13273. # cvsadm: tests of Emptydir in various module definitions
  13274. # basicb: Test that "Emptydir" is non-special in ordinary contexts
  13275. mkdir 1; cd 1
  13276. dotest emptydir-1 "${testcvs} co CVSROOT/modules" \
  13277. "U CVSROOT/modules"
  13278. echo "# Module defs for emptydir tests" > CVSROOT/modules
  13279. echo "2d1mod -d dir2d1/sub/sub2d1 mod1" >> CVSROOT/modules
  13280. echo "2d1moda -d dir2d1/suba moda/modasub" >> CVSROOT/modules
  13281. echo "2d1modb -d dir2d1/suba mod1" >> CVSROOT/modules
  13282. echo "comb -a 2d1modb 2d1moda" >> CVSROOT/modules
  13283. dotest emptydir-2 "${testcvs} ci -m add-modules" \
  13284. "${PROG} [a-z]*: Examining CVSROOT
  13285. Checking in CVSROOT/modules;
  13286. ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
  13287. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13288. done
  13289. ${PROG} commit: Rebuilding administrative file database" \
  13290. "${PROG} commit: Examining CVSROOT"
  13291. rm -rf CVS CVSROOT
  13292. mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
  13293. # Populate. Not sure we really need to do this.
  13294. dotest emptydir-3 "${testcvs} -q co -l ." ""
  13295. dotest emptydir-3a "${testcvs} co mod1 moda" \
  13296. "${PROG} checkout: Updating mod1
  13297. ${PROG} checkout: Updating moda"
  13298. echo "file1" > mod1/file1
  13299. mkdir moda/modasub
  13300. dotest emptydir-3b "${testcvs} add moda/modasub" \
  13301. "Directory ${CVSROOT_DIRNAME}/moda/modasub added to the repository"
  13302. echo "filea" > moda/modasub/filea
  13303. dotest emptydir-4 "${testcvs} add mod1/file1 moda/modasub/filea" \
  13304. "${PROG} add: scheduling file .mod1/file1. for addition
  13305. ${PROG} add: scheduling file .moda/modasub/filea. for addition
  13306. ${PROG} add: use .${PROG} commit. to add these files permanently"
  13307. dotest emptydir-5 "${testcvs} -q ci -m yup" \
  13308. "RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
  13309. done
  13310. Checking in mod1/file1;
  13311. ${CVSROOT_DIRNAME}/mod1/file1,v <-- file1
  13312. initial revision: 1\.1
  13313. done
  13314. RCS file: ${CVSROOT_DIRNAME}/moda/modasub/filea,v
  13315. done
  13316. Checking in moda/modasub/filea;
  13317. ${CVSROOT_DIRNAME}/moda/modasub/filea,v <-- filea
  13318. initial revision: 1\.1
  13319. done"
  13320. rm -rf mod1 moda CVS
  13321. # End Populate.
  13322. dotest emptydir-6 "${testcvs} co 2d1mod" \
  13323. "${PROG} checkout: Updating dir2d1/sub/sub2d1
  13324. U dir2d1/sub/sub2d1/file1"
  13325. cd dir2d1
  13326. touch emptyfile
  13327. # It doesn't make any sense to add a file (or do much of anything
  13328. # else) in Emptydir; Emptydir is a placeholder indicating that
  13329. # the working directory doesn't correspond to anything in
  13330. # the repository.
  13331. dotest_fail emptydir-7 "${testcvs} add emptyfile" \
  13332. "${PROG} \[add aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
  13333. mkdir emptydir
  13334. dotest_fail emptydir-8 "${testcvs} add emptydir" \
  13335. "${PROG} \[[a-z]* aborted\]: cannot add to ${CVSROOT_DIRNAME}/CVSROOT/Emptydir"
  13336. cd ..
  13337. rm -rf CVS dir2d1
  13338. # OK, while we have an Emptydir around, test a few obscure
  13339. # things about it.
  13340. mkdir edir; cd edir
  13341. dotest emptydir-9 "${testcvs} -q co -l CVSROOT" \
  13342. "U CVSROOT${DOTSTAR}"
  13343. cd CVSROOT
  13344. dotest_fail emptydir-10 "test -d Emptydir" ''
  13345. # This tests the code in find_dirs which skips Emptydir.
  13346. dotest emptydir-11 "${testcvs} -q -n update -d -P" ''
  13347. cd ../..
  13348. rm -r edir
  13349. cd ..
  13350. # Now start playing with moda.
  13351. mkdir 2; cd 2
  13352. dotest emptydir-12 "${testcvs} -q co 2d1moda" \
  13353. "U dir2d1/suba/filea"
  13354. # OK, this is the crux of the matter. This used to show "Emptydir",
  13355. # but everyone seemed to think it should show "moda". This
  13356. # usually works better, but not always as shown by the following
  13357. # test.
  13358. dotest emptydir-13 "cat dir2d1/CVS/Repository" "moda"
  13359. dotest_fail emptydir-14 "${testcvs} co comb" \
  13360. "${PROG} checkout: existing repository ${CVSROOT_DIRNAME}/moda/modasub does not match ${CVSROOT_DIRNAME}/mod1
  13361. ${PROG} checkout: ignoring module 2d1modb
  13362. ${PROG} checkout: Updating dir2d1/suba"
  13363. dotest emptydir-15 "cat dir2d1/CVS/Repository" "moda"
  13364. cd ..
  13365. # Test the effect of a non-cvs directory already existing with the
  13366. # same name as one in the modules file.
  13367. mkdir 3; cd 3
  13368. mkdir dir2d1
  13369. dotest emptydir-16 "${testcvs} co 2d1mod" \
  13370. "${PROG} checkout: Updating dir2d1/sub/sub2d1
  13371. U dir2d1/sub/sub2d1/file1"
  13372. dotest emptydir-17 "test -d dir2d1/CVS"
  13373. # clean up
  13374. if $keep; then
  13375. echo Keeping ${TESTDIR} and exiting due to --keep
  13376. exit 0
  13377. fi
  13378. cd ..
  13379. rm -r 1 2 3
  13380. rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/moda
  13381. # I guess for the moment the convention is going to be
  13382. # that we don't need to remove ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
  13383. ;;
  13384. abspath)
  13385. # These tests test the thituations thin thwitch thoo theck
  13386. # things thout twith thabsolute thaths. Threally.
  13387. #
  13388. # CHECKOUTS
  13389. #
  13390. # Create a few modules to use
  13391. mkdir ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
  13392. dotest abspath-1a "${testcvs} co mod1 mod2" \
  13393. "${PROG} checkout: Updating mod1
  13394. ${PROG} checkout: Updating mod2"
  13395. # Populate the module
  13396. echo "file1" > mod1/file1
  13397. echo "file2" > mod2/file2
  13398. cd mod1
  13399. dotest abspath-1ba "${testcvs} add file1" \
  13400. "${PROG} add: scheduling file .file1. for addition
  13401. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13402. cd ..
  13403. cd mod2
  13404. dotest abspath-1bb "${testcvs} add file2" \
  13405. "${PROG} add: scheduling file .file2. for addition
  13406. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13407. cd ..
  13408. dotest abspath-1c "${testcvs} ci -m yup mod1 mod2" \
  13409. "${PROG} [a-z]*: Examining mod1
  13410. ${PROG} [a-z]*: Examining mod2
  13411. RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
  13412. done
  13413. Checking in mod1/file1;
  13414. ${CVSROOT_DIRNAME}/mod1/file1,v <-- file1
  13415. initial revision: 1.1
  13416. done
  13417. RCS file: ${CVSROOT_DIRNAME}/mod2/file2,v
  13418. done
  13419. Checking in mod2/file2;
  13420. ${CVSROOT_DIRNAME}/mod2/file2,v <-- file2
  13421. initial revision: 1.1
  13422. done"
  13423. # Finished creating the module -- clean up.
  13424. rm -rf CVS mod1 mod2
  13425. # Done.
  13426. # Try checking out the module in a local directory
  13427. if $remote; then
  13428. dotest_fail abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
  13429. "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/1. illegal for server"
  13430. dotest abspath-2a-try2 "${testcvs} co -d 1 mod1" \
  13431. "${PROG} checkout: Updating 1
  13432. U 1/file1"
  13433. else
  13434. dotest abspath-2a "${testcvs} co -d ${TESTDIR}/1 mod1" \
  13435. "${PROG} checkout: Updating ${TESTDIR}/1
  13436. U ${TESTDIR}/1/file1"
  13437. fi # remote workaround
  13438. dotest abspath-2b "cat ${TESTDIR}/1/CVS/Repository" "mod1"
  13439. # Done. Clean up.
  13440. rm -rf ${TESTDIR}/1
  13441. # Now try in a subdirectory. We're not covering any more
  13442. # code here, but we might catch a future error if someone
  13443. # changes the checkout code.
  13444. # Note that for the same reason that the shell command
  13445. # "touch 1/2/3" requires directories 1 and 1/2 to already
  13446. # exist, we expect ${TESTDIR}/1 to already exist. I believe
  13447. # this is the behavior of CVS 1.9 and earlier.
  13448. if $remote; then :; else
  13449. dotest_fail abspath-3.1 "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
  13450. "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .${TESTDIR}/1.: No such file or directory"
  13451. fi
  13452. dotest_fail abspath-3.2 "${testcvs} co -d 1/2 mod1" \
  13453. "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
  13454. mkdir 1
  13455. if $remote; then
  13456. # The server wants the directory to exist, but that is
  13457. # a bug, it should only need to exist on the client side.
  13458. # See also cvsadm-2d3.
  13459. dotest_fail abspath-3a "${testcvs} co -d 1/2 mod1" \
  13460. "${PROG} \[checkout aborted\]: could not change directory to requested checkout directory .1.: No such file or directory"
  13461. cd 1
  13462. dotest abspath-3a-try2 "${testcvs} co -d 2 mod1" \
  13463. "${PROG} checkout: Updating 2
  13464. U 2/file1"
  13465. cd ..
  13466. rm -rf 1/CVS
  13467. else
  13468. dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
  13469. "${PROG} checkout: Updating ${TESTDIR}/1/2
  13470. U ${TESTDIR}/1/2/file1"
  13471. fi # remote workaround
  13472. dotest abspath-3b "cat ${TESTDIR}/1/2/CVS/Repository" "mod1"
  13473. # For all the same reasons that we want "1" to already
  13474. # exist, we don't to mess with it to traverse it, for
  13475. # example by creating a CVS directory.
  13476. dotest_fail abspath-3c "test -d ${TESTDIR}/1/CVS" ''
  13477. # Done. Clean up.
  13478. rm -rf ${TESTDIR}/1
  13479. # Now try someplace where we don't have permission.
  13480. mkdir ${TESTDIR}/barf
  13481. chmod -w ${TESTDIR}/barf
  13482. dotest_fail abspath-4r "${testcvs} co -d ${TESTDIR}/barf/sub mod1" \
  13483. "${PROG} \[checkout aborted\]: absolute pathname .${TESTDIR}/barf/sub. illegal for server" \
  13484. "${PROG} \[checkout aborted\]: cannot make directory sub: Permission denied"
  13485. chmod +w ${TESTDIR}/barf
  13486. rmdir ${TESTDIR}/barf
  13487. # Done. Nothing to clean up.
  13488. # Try checking out two modules into the same directory.
  13489. if $remote; then
  13490. dotest abspath-5ar "${testcvs} co -d 1 mod1 mod2" \
  13491. "${PROG} checkout: Updating 1/mod1
  13492. U 1/mod1/file1
  13493. ${PROG} checkout: Updating 1/mod2
  13494. U 1/mod2/file2"
  13495. else
  13496. dotest abspath-5a "${testcvs} co -d ${TESTDIR}/1 mod1 mod2" \
  13497. "${PROG} checkout: Updating ${TESTDIR}/1/mod1
  13498. U ${TESTDIR}/1/mod1/file1
  13499. ${PROG} checkout: Updating ${TESTDIR}/1/mod2
  13500. U ${TESTDIR}/1/mod2/file2"
  13501. fi # end remote workaround
  13502. dotest abspath-5b "cat ${TESTDIR}/1/CVS/Repository" "\."
  13503. dotest abspath-5c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
  13504. dotest abspath-5d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
  13505. # Done. Clean up.
  13506. rm -rf ${TESTDIR}/1
  13507. # Try checking out the top-level module.
  13508. if $remote; then
  13509. dotest abspath-6ar "${testcvs} co -d 1 ." \
  13510. "${PROG} checkout: Updating 1
  13511. ${PROG} checkout: Updating 1/CVSROOT
  13512. ${DOTSTAR}
  13513. ${PROG} checkout: Updating 1/mod1
  13514. U 1/mod1/file1
  13515. ${PROG} checkout: Updating 1/mod2
  13516. U 1/mod2/file2"
  13517. else
  13518. dotest abspath-6a "${testcvs} co -d ${TESTDIR}/1 ." \
  13519. "${PROG} checkout: Updating ${TESTDIR}/1
  13520. ${PROG} checkout: Updating ${TESTDIR}/1/CVSROOT
  13521. ${DOTSTAR}
  13522. ${PROG} checkout: Updating ${TESTDIR}/1/mod1
  13523. U ${TESTDIR}/1/mod1/file1
  13524. ${PROG} checkout: Updating ${TESTDIR}/1/mod2
  13525. U ${TESTDIR}/1/mod2/file2"
  13526. fi # end of remote workaround
  13527. dotest abspath-6b "cat ${TESTDIR}/1/CVS/Repository" "\."
  13528. dotest abspath-6c "cat ${TESTDIR}/1/CVSROOT/CVS/Repository" "CVSROOT"
  13529. dotest abspath-6c "cat ${TESTDIR}/1/mod1/CVS/Repository" "mod1"
  13530. dotest abspath-6d "cat ${TESTDIR}/1/mod2/CVS/Repository" "mod2"
  13531. # Done. Clean up.
  13532. rm -rf ${TESTDIR}/1
  13533. # Test that an absolute pathname to some other directory
  13534. # doesn't mess with the current working directory.
  13535. mkdir 1
  13536. cd 1
  13537. if $remote; then
  13538. dotest_fail abspath-7ar "${testcvs} -q co -d ../2 mod2" \
  13539. "${PROG} checkout: protocol error: .\.\./2. contains more leading \.\.
  13540. ${PROG} \[checkout aborted\]: than the 0 which Max-dotdot specified"
  13541. cd ..
  13542. dotest abspath-7a-try2r "${testcvs} -q co -d 2 mod2" \
  13543. "U 2/file2"
  13544. cd 1
  13545. else
  13546. dotest abspath-7a "${testcvs} -q co -d ${TESTDIR}/2 mod2" \
  13547. "U ${TESTDIR}/2/file2"
  13548. fi # remote workaround
  13549. dotest abspath-7b "ls" ""
  13550. dotest abspath-7c "${testcvs} -q co mod1" \
  13551. "U mod1/file1"
  13552. cd mod1
  13553. if $remote; then
  13554. cd ../..
  13555. dotest abspath-7dr "${testcvs} -q co -d 3 mod2" \
  13556. "U 3/file2"
  13557. cd 1/mod1
  13558. else
  13559. dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
  13560. "U ${TESTDIR}/3/file2"
  13561. fi # remote workaround
  13562. dotest abspath-7e "${testcvs} -q update -d" ""
  13563. cd ../..
  13564. rm -r 1 2 3
  13565. #
  13566. # FIXME: do other functions here (e.g. update /tmp/foo)
  13567. #
  13568. # Finished with all tests. Remove the module.
  13569. rm -rf ${CVSROOT_DIRNAME}/mod1 ${CVSROOT_DIRNAME}/mod2
  13570. ;;
  13571. abspath2)
  13572. # More absolute path checks. The following used to attempt to create
  13573. # directories in /:
  13574. #
  13575. # $ cvs -d:fork:/cvsroot co /foo
  13576. # cvs checkout: warning: cannot make directory CVS in /: Permission denied
  13577. # cvs [checkout aborted]: cannot make directory /foo: Permission denied
  13578. # $
  13579. #
  13580. # The -z9 in this test also checks for an old server bug where the
  13581. # server would block indefinitely attempting to read an EOF from the
  13582. # client in the compression buffer shutdown routine.
  13583. dotest_fail abspath2-1 "$testcvs -z9 co /foo" \
  13584. "$PROG \[checkout aborted\]: Absolute module reference invalid: \`/foo'" \
  13585. "$PROG \[server aborted\]: Absolute module reference invalid: \`/foo'
  13586. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  13587. ;;
  13588. toplevel)
  13589. # test the feature that cvs creates a CVS subdir also for
  13590. # the toplevel directory
  13591. # First set the TopLevelAdmin setting.
  13592. mkdir 1; cd 1
  13593. dotest toplevel-1a "${testcvs} -q co CVSROOT/config" \
  13594. "U CVSROOT/config"
  13595. cd CVSROOT
  13596. echo "TopLevelAdmin=yes" >config
  13597. dotest toplevel-1b "${testcvs} -q ci -m yes-top-level" \
  13598. "Checking in config;
  13599. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  13600. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13601. done
  13602. ${PROG} commit: Rebuilding administrative file database"
  13603. cd ../..
  13604. rm -r 1
  13605. mkdir 1; cd 1
  13606. dotest toplevel-1 "${testcvs} -q co -l ." ''
  13607. mkdir top-dir second-dir
  13608. dotest toplevel-2 "${testcvs} add top-dir second-dir" \
  13609. "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
  13610. Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
  13611. cd top-dir
  13612. touch file1
  13613. dotest toplevel-3 "${testcvs} add file1" \
  13614. "${PROG} add: scheduling file .file1. for addition
  13615. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13616. dotest toplevel-4 "${testcvs} -q ci -m add" \
  13617. "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
  13618. done
  13619. Checking in file1;
  13620. ${CVSROOT_DIRNAME}/top-dir/file1,v <-- file1
  13621. initial revision: 1\.1
  13622. done"
  13623. cd ..
  13624. cd second-dir
  13625. touch file2
  13626. dotest toplevel-3s "${testcvs} add file2" \
  13627. "${PROG} add: scheduling file .file2. for addition
  13628. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13629. dotest toplevel-4s "${testcvs} -q ci -m add" \
  13630. "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
  13631. done
  13632. Checking in file2;
  13633. ${CVSROOT_DIRNAME}/second-dir/file2,v <-- file2
  13634. initial revision: 1\.1
  13635. done"
  13636. cd ../..
  13637. rm -r 1; mkdir 1; cd 1
  13638. dotest toplevel-5 "${testcvs} co top-dir" \
  13639. "${PROG} checkout: Updating top-dir
  13640. U top-dir/file1"
  13641. dotest toplevel-6 "${testcvs} update top-dir" \
  13642. "${PROG} update: Updating top-dir"
  13643. dotest toplevel-7 "${testcvs} update" \
  13644. "${PROG} update: Updating \.
  13645. ${PROG} update: Updating top-dir"
  13646. dotest toplevel-8 "${testcvs} update -d top-dir" \
  13647. "${PROG} update: Updating top-dir"
  13648. # There is some sentiment that
  13649. # "${PROG} update: Updating \.
  13650. # ${PROG} update: Updating top-dir"
  13651. # is correct but it isn't clear why that would be correct instead
  13652. # of the remote CVS behavior (which also updates CVSROOT).
  13653. #
  13654. # The DOTSTAR matches of a bunch of lines like
  13655. # "U CVSROOT/checkoutlist". Trying to match them more precisely
  13656. # seemed to cause trouble. For example CVSROOT/cvsignore will
  13657. # be present or absent depending on whether we ran the "ignore"
  13658. # test or not.
  13659. dotest toplevel-9 "${testcvs} update -d" \
  13660. "${PROG} update: Updating \.
  13661. ${PROG} update: Updating CVSROOT
  13662. ${DOTSTAR}
  13663. ${PROG} update: Updating top-dir"
  13664. cd ..
  13665. rm -r 1; mkdir 1; cd 1
  13666. dotest toplevel-10 "${testcvs} co top-dir" \
  13667. "${PROG} checkout: Updating top-dir
  13668. U top-dir/file1"
  13669. # This tests more or less the same thing, in a particularly
  13670. # "real life" example.
  13671. dotest toplevel-11 "${testcvs} -q update -d second-dir" \
  13672. "U second-dir/file2"
  13673. # Now remove the CVS directory (people may do this manually,
  13674. # especially if they formed their habits with CVS
  13675. # 1.9 and older, which didn't create it. Or perhaps the working
  13676. # directory itself was created with 1.9 or older).
  13677. rm -r CVS
  13678. # Now set the permissions so we can't recreate it.
  13679. if test -n "$remotehost"; then
  13680. # Cygwin again.
  13681. $CVS_RSH $remotehost "chmod -w $TESTDIR/1"
  13682. else
  13683. chmod -w ../1
  13684. fi
  13685. # Now see whether CVS has trouble because it can't create CVS.
  13686. # First string is for local, second is for remote.
  13687. dotest toplevel-12 "${testcvs} co top-dir" \
  13688. "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
  13689. ${PROG} checkout: Updating top-dir" \
  13690. "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied
  13691. ${PROG} checkout: in directory \.:
  13692. ${PROG} checkout: cannot open CVS/Entries for reading: No such file or directory
  13693. ${PROG} checkout: Updating top-dir"
  13694. chmod +w ../1
  13695. dotest toplevel-cleanup-1 "${testcvs} -q co CVSROOT/config" \
  13696. "U CVSROOT/config"
  13697. cd CVSROOT
  13698. echo "# empty file" >config
  13699. dotest toplevel-cleanup-2 "${testcvs} -q ci -m toplevel-cleanup" \
  13700. "Checking in config;
  13701. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  13702. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13703. done
  13704. ${PROG} commit: Rebuilding administrative file database"
  13705. cd ../..
  13706. rm -r 1
  13707. rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
  13708. ;;
  13709. toplevel2)
  13710. # Similar to toplevel, but test the case where TopLevelAdmin=no.
  13711. # First set the TopLevelAdmin setting.
  13712. mkdir 1; cd 1
  13713. dotest toplevel2-1a "${testcvs} -q co CVSROOT/config" \
  13714. "U CVSROOT/config"
  13715. cd CVSROOT
  13716. echo "TopLevelAdmin=no" >config
  13717. dotest toplevel2-1b "${testcvs} -q ci -m no-top-level" \
  13718. "Checking in config;
  13719. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  13720. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13721. done
  13722. ${PROG} commit: Rebuilding administrative file database"
  13723. cd ../..
  13724. rm -r 1
  13725. # Now set up some directories and subdirectories
  13726. mkdir 1; cd 1
  13727. dotest toplevel2-1 "${testcvs} -q co -l ." ''
  13728. mkdir top-dir second-dir
  13729. dotest toplevel2-2 "${testcvs} add top-dir second-dir" \
  13730. "Directory ${CVSROOT_DIRNAME}/top-dir added to the repository
  13731. Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
  13732. cd top-dir
  13733. touch file1
  13734. dotest toplevel2-3 "${testcvs} add file1" \
  13735. "${PROG} add: scheduling file .file1. for addition
  13736. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13737. dotest toplevel2-4 "${testcvs} -q ci -m add" \
  13738. "RCS file: ${CVSROOT_DIRNAME}/top-dir/file1,v
  13739. done
  13740. Checking in file1;
  13741. ${CVSROOT_DIRNAME}/top-dir/file1,v <-- file1
  13742. initial revision: 1\.1
  13743. done"
  13744. cd ..
  13745. cd second-dir
  13746. touch file2
  13747. dotest toplevel2-3s "${testcvs} add file2" \
  13748. "${PROG} add: scheduling file .file2. for addition
  13749. ${PROG} add: use .${PROG} commit. to add this file permanently"
  13750. dotest toplevel2-4s "${testcvs} -q ci -m add" \
  13751. "RCS file: ${CVSROOT_DIRNAME}/second-dir/file2,v
  13752. done
  13753. Checking in file2;
  13754. ${CVSROOT_DIRNAME}/second-dir/file2,v <-- file2
  13755. initial revision: 1\.1
  13756. done"
  13757. cd ../..
  13758. rm -r 1; mkdir 1; cd 1
  13759. dotest toplevel2-5 "${testcvs} co top-dir" \
  13760. "${PROG} checkout: Updating top-dir
  13761. U top-dir/file1"
  13762. dotest toplevel2-6 "${testcvs} update top-dir" \
  13763. "${PROG} update: Updating top-dir"
  13764. dotest toplevel2-7 "${testcvs} update" \
  13765. "${PROG} update: Updating top-dir"
  13766. dotest toplevel2-8 "${testcvs} update -d top-dir" \
  13767. "${PROG} update: Updating top-dir"
  13768. # Contrast this with toplevel-9, which has TopLevelAdmin=yes.
  13769. dotest toplevel2-9 "${testcvs} update -d" \
  13770. "${PROG} update: Updating top-dir"
  13771. cd ..
  13772. rm -r 1; mkdir 1; cd 1
  13773. dotest toplevel2-10 "${testcvs} co top-dir" \
  13774. "${PROG} checkout: Updating top-dir
  13775. U top-dir/file1"
  13776. # This tests more or less the same thing, in a particularly
  13777. # "real life" example. With TopLevelAdmin=yes, this command
  13778. # would give us second-dir and CVSROOT directories too.
  13779. dotest toplevel2-11 "${testcvs} -q update -d" ""
  13780. dotest toplevel2-cleanup-1 "${testcvs} -q co CVSROOT/config" \
  13781. "U CVSROOT/config"
  13782. cd CVSROOT
  13783. echo "# empty file" >config
  13784. dotest toplevel2-cleanup-2 "${testcvs} -q ci -m toplevel2-cleanup" \
  13785. "Checking in config;
  13786. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  13787. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  13788. done
  13789. ${PROG} commit: Rebuilding administrative file database"
  13790. cd ../..
  13791. rm -r 1
  13792. rm -rf ${CVSROOT_DIRNAME}/top-dir ${CVSROOT_DIRNAME}/second-dir
  13793. ;;
  13794. rstar-toplevel)
  13795. # This test used to confirm a bug that existed in the r* commands
  13796. # run against the top-level project prior to CVS 1.11.18 & 1.12.10.
  13797. #
  13798. # The assertion failure was something like:
  13799. # do_recursion: Assertion \`strstr (repository, \"/\./\") == ((void \*)0)' failed\..*"
  13800. dotest rstar-toplevel-1 "$testcvs -q rlog ." \
  13801. "
  13802. RCS file: $CVSROOT_DIRNAME/CVSROOT$DOTSTAR"
  13803. if $keep; then
  13804. echo Keeping ${TESTDIR} and exiting due to --keep
  13805. exit 0
  13806. fi
  13807. ;;
  13808. trailingslashes)
  13809. # Some tests of CVS's reactions to path specifications containing
  13810. # trailing slashes.
  13811. mkdir trailingslashes; cd trailingslashes
  13812. dotest trailingslashes-init-1 "$testcvs -Q co -ldt ."
  13813. dotest trailingslashes-init-2 "$testcvs -Q co -dt2 ."
  13814. cd t
  13815. echo "Ahh'll be baaack." >topfile
  13816. dotest trailingslashes-init-3 "$testcvs -Q add topfile"
  13817. dotest trailingslashes-init-4 "$testcvs -Q ci -mto-top" \
  13818. "RCS file: $CVSROOT_DIRNAME/topfile,v
  13819. done
  13820. Checking in topfile;
  13821. $CVSROOT_DIRNAME/topfile,v <-- topfile
  13822. initial revision: 1\.1
  13823. done"
  13824. # First, demonstrate the usual case.
  13825. cd ../t2
  13826. dotest trailingslashes-1 "$testcvs -q up CVSROOT"
  13827. dotest_fail trailingslashes-1a "test -f topfile"
  13828. # Now the one that used to fail in remote mode prior to 1.11.24
  13829. # & 1.12.14. Formerly TODO item #205.
  13830. dotest trailingslashes-2 "$testcvs -q up CVSROOT/"
  13831. dotest_fail trailingslashes-2a "test -f topfile"
  13832. if $keep; then
  13833. echo Keeping $TESTDIR and exiting due to --keep
  13834. exit 0
  13835. fi
  13836. cd ../..
  13837. rm -rf trailingslashes $CVSROOT_DIRNAME/topfile,v
  13838. ;;
  13839. checkout_repository)
  13840. dotest_fail checkout_repository-1 \
  13841. "${testcvs} co -d ${CVSROOT_DIRNAME} CVSROOT" \
  13842. "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
  13843. "${PROG} \[checkout aborted\]: absolute pathname \`${CVSROOT_DIRNAME}' illegal for server"
  13844. # The behavior of the client/server test below should be correct.
  13845. # The CVS client currently has no way of knowing that the client and
  13846. # server are the same machine and thus skips the $CVSROOT checks.
  13847. # I think checking for this case in CVS would be bloat since this
  13848. # should be a fairly rare occurance.
  13849. cd ${CVSROOT_DIRNAME}
  13850. dotest_fail checkout_repository-2 "${testcvs} co CVSROOT" \
  13851. "${PROG} \[checkout aborted\]: Cannot check out files into the repository itself" \
  13852. "${PROG} checkout: Updating CVSROOT
  13853. ${PROG} checkout: move away CVSROOT/checkoutlist; it is in the way
  13854. C CVSROOT/checkoutlist
  13855. ${PROG} checkout: move away CVSROOT/commitinfo; it is in the way
  13856. C CVSROOT/commitinfo
  13857. ${PROG} checkout: move away CVSROOT/config; it is in the way
  13858. C CVSROOT/config
  13859. ${PROG} checkout: move away CVSROOT/cvswrappers; it is in the way
  13860. C CVSROOT/cvswrappers
  13861. ${PROG} checkout: move away CVSROOT/editinfo; it is in the way
  13862. C CVSROOT/editinfo
  13863. ${PROG} checkout: move away CVSROOT/loginfo; it is in the way
  13864. C CVSROOT/loginfo
  13865. ${PROG} checkout: move away CVSROOT/modules; it is in the way
  13866. C CVSROOT/modules
  13867. ${PROG} checkout: move away CVSROOT/notify; it is in the way
  13868. C CVSROOT/notify
  13869. ${PROG} checkout: move away CVSROOT/rcsinfo; it is in the way
  13870. C CVSROOT/rcsinfo
  13871. ${PROG} checkout: move away CVSROOT/taginfo; it is in the way
  13872. C CVSROOT/taginfo
  13873. ${PROG} checkout: move away CVSROOT/verifymsg; it is in the way
  13874. C CVSROOT/verifymsg"
  13875. dotest checkout_repository-3 \
  13876. "${testcvs} co -p CVSROOT/modules >/dev/null" \
  13877. "===================================================================
  13878. Checking out CVSROOT/modules
  13879. RCS: ${CVSROOT_DIRNAME}/CVSROOT/modules,v
  13880. VERS: 1\.[0-9]*
  13881. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
  13882. cd ${TESTDIR}
  13883. ;;
  13884. mflag)
  13885. for message in '' ' ' '
  13886. ' ' test' ; do
  13887. # Set up
  13888. mkdir a-dir; cd a-dir
  13889. # Test handling of -m during import
  13890. echo testa >>test
  13891. if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
  13892. pass 156
  13893. else
  13894. fail 156
  13895. fi
  13896. # Must import twice since the first time uses inline code that
  13897. # avoids RCS call.
  13898. echo testb >>test
  13899. if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
  13900. pass 157
  13901. else
  13902. fail 157
  13903. fi
  13904. # Test handling of -m during ci
  13905. cd ..; rm -r a-dir
  13906. if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
  13907. pass 158
  13908. else
  13909. fail 158
  13910. fi
  13911. cd a-dir
  13912. echo testc >>test
  13913. if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  13914. pass 159
  13915. else
  13916. fail 159
  13917. fi
  13918. # Test handling of -m during rm/ci
  13919. rm test;
  13920. if ${testcvs} rm test >>${LOGFILE} 2>&1; then
  13921. pass 160
  13922. else
  13923. fail 160
  13924. fi
  13925. if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  13926. pass 161
  13927. else
  13928. fail 161
  13929. fi
  13930. # Clean up
  13931. cd ..
  13932. rm -r a-dir
  13933. rm -rf ${CVSROOT_DIRNAME}/a-dir
  13934. done
  13935. ;;
  13936. editor)
  13937. # More tests of log messages, in this case the ability to
  13938. # run an external editor.
  13939. # TODO:
  13940. # * also test $EDITOR, $CVSEDITOR, &c.
  13941. # * test what happens if up-to-date check fails.
  13942. # Our "editor" puts "x" at the start of each line, so we
  13943. # can see the "CVS:" lines.
  13944. cat >${TESTDIR}/editme <<EOF
  13945. #!${TESTSHELL}
  13946. sleep 1
  13947. sed <\$1 -e 's/^/x/' >${TESTDIR}/edit.new
  13948. mv ${TESTDIR}/edit.new \$1
  13949. exit 0
  13950. EOF
  13951. chmod +x ${TESTDIR}/editme
  13952. mkdir 1; cd 1
  13953. dotest editor-1 "${testcvs} -q co -l ." ''
  13954. mkdir first-dir
  13955. dotest editor-2 "${testcvs} add first-dir" \
  13956. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  13957. cd first-dir
  13958. touch file1 file2
  13959. dotest editor-3 "${testcvs} add file1 file2" \
  13960. "${PROG} add: scheduling file .file1. for addition
  13961. ${PROG} add: scheduling file .file2. for addition
  13962. ${PROG} add: use .${PROG} commit. to add these files permanently"
  13963. dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
  13964. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  13965. done
  13966. Checking in file1;
  13967. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  13968. initial revision: 1\.1
  13969. done
  13970. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  13971. done
  13972. Checking in file2;
  13973. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  13974. initial revision: 1\.1
  13975. done"
  13976. dotest editor-5 "${testcvs} -q tag -b br" "T file1
  13977. T file2"
  13978. dotest editor-6 "$testcvs -q update -r br" \
  13979. 'U file1
  13980. U file2'
  13981. echo modify >>file1
  13982. dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
  13983. "Checking in file1;
  13984. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  13985. new revision: 1\.1\.2\.1; previous revision: 1\.1
  13986. done"
  13987. # OK, now we want to make sure "ci -r" puts in the branch
  13988. # where appropriate. Note that we can check in on the branch
  13989. # without being on the branch, because there is not a revision
  13990. # already on the branch. If there were a revision on the branch,
  13991. # CVS would correctly give an up-to-date check failed.
  13992. dotest editor-8 "$testcvs -q update -A" \
  13993. 'U file1
  13994. U file2'
  13995. echo add a line >>file2
  13996. dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
  13997. "Checking in file2;
  13998. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  13999. new revision: 1\.1\.2\.1; previous revision: 1\.1
  14000. done"
  14001. dotest editor-log-file1 "${testcvs} log -N file1" "
  14002. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14003. Working file: file1
  14004. head: 1\.1
  14005. branch:
  14006. locks: strict
  14007. access list:
  14008. keyword substitution: kv
  14009. total revisions: 2; selected revisions: 2
  14010. description:
  14011. ----------------------------
  14012. revision 1\.1
  14013. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  14014. branches: 1\.1\.2;
  14015. xCVS: ----------------------------------------------------------------------
  14016. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14017. xCVS:
  14018. xCVS: Committing in .
  14019. xCVS:
  14020. xCVS: Added Files:
  14021. xCVS: file1 file2
  14022. xCVS: ----------------------------------------------------------------------
  14023. ----------------------------
  14024. revision 1\.1\.2\.1
  14025. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  14026. xCVS: ----------------------------------------------------------------------
  14027. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14028. xCVS:
  14029. xCVS: Committing in .
  14030. xCVS:
  14031. xCVS: Modified Files:
  14032. xCVS: Tag: br
  14033. xCVS: file1
  14034. xCVS: ----------------------------------------------------------------------
  14035. ============================================================================="
  14036. # The only difference between the two expect strings is the
  14037. # presence or absence of "Committing in ." for 1.1.2.1.
  14038. dotest editor-log-file2 "${testcvs} log -N file2" "
  14039. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  14040. Working file: file2
  14041. head: 1\.1
  14042. branch:
  14043. locks: strict
  14044. access list:
  14045. keyword substitution: kv
  14046. total revisions: 2; selected revisions: 2
  14047. description:
  14048. ----------------------------
  14049. revision 1\.1
  14050. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  14051. branches: 1\.1\.2;
  14052. xCVS: ----------------------------------------------------------------------
  14053. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14054. xCVS:
  14055. xCVS: Committing in .
  14056. xCVS:
  14057. xCVS: Added Files:
  14058. xCVS: file1 file2
  14059. xCVS: ----------------------------------------------------------------------
  14060. ----------------------------
  14061. revision 1\.1\.2\.1
  14062. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  14063. xCVS: ----------------------------------------------------------------------
  14064. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14065. xCVS:
  14066. xCVS: Modified Files:
  14067. xCVS: Tag: br
  14068. xCVS: file2
  14069. xCVS: ----------------------------------------------------------------------
  14070. =============================================================================" "
  14071. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  14072. Working file: file2
  14073. head: 1\.1
  14074. branch:
  14075. locks: strict
  14076. access list:
  14077. keyword substitution: kv
  14078. total revisions: 2; selected revisions: 2
  14079. description:
  14080. ----------------------------
  14081. revision 1\.1
  14082. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  14083. branches: 1\.1\.2;
  14084. xCVS: ----------------------------------------------------------------------
  14085. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14086. xCVS:
  14087. xCVS: Committing in .
  14088. xCVS:
  14089. xCVS: Added Files:
  14090. xCVS: file1 file2
  14091. xCVS: ----------------------------------------------------------------------
  14092. ----------------------------
  14093. revision 1\.1\.2\.1
  14094. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  14095. xCVS: ----------------------------------------------------------------------
  14096. xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
  14097. xCVS:
  14098. xCVS: Committing in .
  14099. xCVS:
  14100. xCVS: Modified Files:
  14101. xCVS: Tag: br
  14102. xCVS: file2
  14103. xCVS: ----------------------------------------------------------------------
  14104. ============================================================================="
  14105. # Test CVS's response to an unchanged log message
  14106. cat >${TESTDIR}/editme <<EOF
  14107. #!${TESTSHELL}
  14108. sleep 1
  14109. exit 0
  14110. EOF
  14111. chmod +x ${TESTDIR}/editme
  14112. dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
  14113. "
  14114. Log message unchanged or not specified
  14115. a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
  14116. Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
  14117. # Test CVS's response to an empty log message
  14118. cat >${TESTDIR}/editme <<EOF
  14119. #!${TESTSHELL}
  14120. sleep 1
  14121. cat /dev/null >\$1
  14122. exit 0
  14123. EOF
  14124. chmod +x ${TESTDIR}/editme
  14125. dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
  14126. "
  14127. Log message unchanged or not specified
  14128. a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
  14129. Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
  14130. # Test CVS's response to a log message with one blank line
  14131. cat >${TESTDIR}/editme <<EOF
  14132. #!${TESTSHELL}
  14133. sleep 1
  14134. echo >\$1
  14135. exit 0
  14136. EOF
  14137. chmod +x ${TESTDIR}/editme
  14138. dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
  14139. "
  14140. Log message unchanged or not specified
  14141. a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
  14142. Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
  14143. # Test CVS's response to a log message with only comments
  14144. cat >${TESTDIR}/editme <<EOF
  14145. #!${TESTSHELL}
  14146. sleep 1
  14147. cat \$1 >${TESTDIR}/edit.new
  14148. mv ${TESTDIR}/edit.new \$1
  14149. exit 0
  14150. EOF
  14151. chmod +x ${TESTDIR}/editme
  14152. dotest_fail editor-emptylog-1 "echo a |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
  14153. "
  14154. Log message unchanged or not specified
  14155. a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
  14156. Action: (continue) ${PROG} \[[a-z]* aborted\]: aborted by user"
  14157. # Test CVS's response to a log message that is zero bytes
  14158. # in length. This caused core dumps in cvs 1.11.5 on Solaris
  14159. # hosts.
  14160. cd ..
  14161. dotest editor-emptylog-continue-1 "${testcvs} -q co CVSROOT/loginfo" \
  14162. "U CVSROOT/loginfo"
  14163. cd CVSROOT
  14164. echo 'DEFAULT (echo Start-Log;cat;echo End-Log) >> \$CVSROOT/CVSROOT/commitlog' > loginfo
  14165. dotest editor-emptylog-continue-2 "${testcvs} commit -m add loginfo" \
  14166. "Checking in loginfo;
  14167. ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v <-- loginfo
  14168. new revision: 1\.2; previous revision: 1\.1
  14169. done
  14170. ${PROG} commit: Rebuilding administrative file database"
  14171. cd ../first-dir
  14172. cat >${TESTDIR}/editme <<EOF
  14173. #!${TESTSHELL}
  14174. sleep 1
  14175. cp /dev/null \$1
  14176. exit 1
  14177. EOF
  14178. chmod +x ${TESTDIR}/editme
  14179. dotest editor-emptylog-continue-3 "echo c |${testcvs} -e ${TESTDIR}/editme ci -f file1" \
  14180. "${PROG} [a-z]*: warning: editor session failed
  14181. Log message unchanged or not specified
  14182. a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs
  14183. Action: (continue) Checking in file1;
  14184. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  14185. new revision: 1\.2; previous revision: 1\.1
  14186. done"
  14187. # The loginfo Log message should be an empty line and not "(null)"
  14188. # which is what some fprintf() implementations do with "%s"
  14189. # format and a NULL pointer...
  14190. if $remote; then
  14191. dotest editor-emptylog-continue-4r \
  14192. "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
  14193. "Start-Log
  14194. Update of ${CVSROOT_DIRNAME}/first-dir
  14195. In directory ${hostname}:${TMPDIR}/cvs-serv[0-9a-z]*
  14196. Modified Files:
  14197. file1
  14198. Log Message:
  14199. End-Log"
  14200. else
  14201. dotest editor-emptylog-continue-4 \
  14202. "cat ${CVSROOT_DIRNAME}/CVSROOT/commitlog" \
  14203. "Start-Log
  14204. Update of ${CVSROOT_DIRNAME}/first-dir
  14205. In directory ${hostname}:${TESTDIR}/1/first-dir
  14206. Modified Files:
  14207. file1
  14208. Log Message:
  14209. End-Log"
  14210. fi
  14211. # There should have an empty log message at this point
  14212. dotest editor-emptylog-continue-5 "${testcvs} log -N -r1.2 file1" \
  14213. "
  14214. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14215. Working file: file1
  14216. head: 1\.2
  14217. branch:
  14218. locks: strict
  14219. access list:
  14220. keyword substitution: kv
  14221. total revisions: 3; selected revisions: 1
  14222. description:
  14223. ----------------------------
  14224. revision 1\.2
  14225. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: +0 -0
  14226. \*\*\* empty log message \*\*\*
  14227. ============================================================================="
  14228. # clean up
  14229. if $keep; then
  14230. echo Keeping ${TESTDIR} and exiting due to --keep
  14231. exit 0
  14232. fi
  14233. restore_adm
  14234. cd ../..
  14235. rm -r 1
  14236. rm ${TESTDIR}/editme
  14237. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14238. ;;
  14239. errmsg1)
  14240. mkdir ${CVSROOT_DIRNAME}/1dir
  14241. mkdir 1
  14242. cd 1
  14243. if ${testcvs} -q co 1dir; then
  14244. pass 162
  14245. else
  14246. fail 162
  14247. fi
  14248. cd 1dir
  14249. touch foo
  14250. if ${testcvs} add foo 2>>${LOGFILE}; then
  14251. pass 163
  14252. else
  14253. fail 163
  14254. fi
  14255. if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  14256. pass 164
  14257. else
  14258. fail 164
  14259. fi
  14260. cd ../..
  14261. mkdir 2
  14262. cd 2
  14263. if ${testcvs} -q co 1dir >>${LOGFILE}; then
  14264. pass 165
  14265. else
  14266. fail 165
  14267. fi
  14268. chmod a-w 1dir
  14269. cd ../1/1dir
  14270. rm foo;
  14271. if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
  14272. pass 166
  14273. else
  14274. fail 166
  14275. fi
  14276. if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
  14277. pass 167
  14278. else
  14279. fail 167
  14280. fi
  14281. cd ../../2/1dir
  14282. # The second case in the local and remote versions of errmsg1-168
  14283. # below happens on Cygwin under Windows, where write privileges
  14284. # aren't enforced properly.
  14285. if $remote; then
  14286. dotest errmsg1-168r "${testcvs} -q update" \
  14287. "${PROG} update: foo is no longer in the repository
  14288. ${PROG} update: unable to remove \./foo: Permission denied" \
  14289. "${PROG} update: foo is no longer in the repository"
  14290. else
  14291. dotest errmsg1-168 "${testcvs} -q update" \
  14292. "${PROG} update: foo is no longer in the repository
  14293. ${PROG} update: unable to remove foo: Permission denied" \
  14294. "${PROG} update: foo is no longer in the repository"
  14295. fi
  14296. cd ..
  14297. chmod u+w 1dir
  14298. cd ..
  14299. rm -r 1 2
  14300. rm -rf ${CVSROOT_DIRNAME}/1dir
  14301. ;;
  14302. errmsg2)
  14303. # More tests of various miscellaneous error handling,
  14304. # and cvs add behavior in general.
  14305. # See also test basicb-4a, concerning "cvs ci CVS".
  14306. # Too many tests to mention test the simple cases of
  14307. # adding files and directories.
  14308. # Test basicb-2a10 tests cvs -n add.
  14309. # First the usual setup; create a directory first-dir.
  14310. mkdir 1; cd 1
  14311. dotest errmsg2-1 "${testcvs} -q co -l ." ''
  14312. mkdir first-dir
  14313. dotest errmsg2-2 "${testcvs} add first-dir" \
  14314. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  14315. cd first-dir
  14316. dotest_fail errmsg2-3 "${testcvs} add CVS" \
  14317. "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
  14318. touch file1
  14319. # For the most part add returns a failure exitstatus if
  14320. # there are any errors, even if the remaining files are
  14321. # processed without incident. The "cannot add
  14322. # special file" message fits this pattern, at
  14323. # least currently.
  14324. dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
  14325. "${PROG} add: cannot add special file .CVS.; skipping
  14326. ${PROG} add: scheduling file .file1. for addition
  14327. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14328. # I'm not sure these tests completely convey the various strange
  14329. # behaviors that CVS had before it specially checked for "." and
  14330. # "..". Suffice it to say that these are unlikely to work right
  14331. # without a special case.
  14332. dotest_fail errmsg2-5 "${testcvs} add ." \
  14333. "${PROG} [a-z]*: cannot add special file .\..; skipping"
  14334. dotest_fail errmsg2-6 "${testcvs} add .." \
  14335. "${PROG} [a-z]*: cannot add special file .\.\..; skipping"
  14336. # Make sure that none of the error messages left droppings
  14337. # which interfere with normal operation.
  14338. dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
  14339. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14340. done
  14341. Checking in file1;
  14342. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  14343. initial revision: 1\.1
  14344. done"
  14345. mkdir sdir
  14346. cd ..
  14347. dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
  14348. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir added to the repository"
  14349. # while we're here... check commit with no CVS directory
  14350. dotest_fail errmsg2-8a "${testcvs} -q ci first-dir nonexistant" \
  14351. "${PROG} [a-z]*: nothing known about .nonexistant'
  14352. ${PROG} \[[a-z]* aborted\]: correct above errors first!"
  14353. dotest_fail errmsg2-8b "${testcvs} -q ci nonexistant first-dir" \
  14354. "${PROG} [a-z]*: nothing known about .nonexistant'
  14355. ${PROG} \[[a-z]* aborted\]: correct above errors first!"
  14356. dotest errmsg2-8c "${testcvs} -q ci first-dir" ""
  14357. cd first-dir
  14358. touch file10
  14359. mkdir sdir10
  14360. dotest errmsg2-10 "${testcvs} add file10 sdir10" \
  14361. "${PROG} add: scheduling file .file10. for addition
  14362. Directory ${CVSROOT_DIRNAME}/first-dir/sdir10 added to the repository
  14363. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14364. dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
  14365. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file10,v
  14366. done
  14367. Checking in file10;
  14368. ${CVSROOT_DIRNAME}/first-dir/file10,v <-- file10
  14369. initial revision: 1\.1
  14370. done"
  14371. # Try to see that there are no droppings left by
  14372. # any of the previous tests.
  14373. dotest errmsg2-12 "${testcvs} -q update" ""
  14374. # Now test adding files with '/' in the name, both one level
  14375. # down and more than one level down.
  14376. cd ..
  14377. mkdir first-dir/sdir10/ssdir
  14378. dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
  14379. "Directory ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir added to the repository"
  14380. touch first-dir/sdir10/ssdir/ssfile
  14381. dotest errmsg2-14 \
  14382. "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
  14383. "${PROG} add: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
  14384. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14385. touch first-dir/file15
  14386. dotest errmsg2-15 "${testcvs} add first-dir/file15" \
  14387. "${PROG} add: scheduling file .first-dir/file15. for addition
  14388. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14389. # Now the case where we try to give it a directory which is not
  14390. # under CVS control.
  14391. mkdir bogus-dir
  14392. touch bogus-dir/file16
  14393. # The first message, from local CVS, is nice. The second one
  14394. # is not nice; would be good to fix remote CVS to give a clearer
  14395. # message (e.g. the one from local CVS). But at least it is an
  14396. # error message.
  14397. dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
  14398. "${PROG} add: in directory bogus-dir:
  14399. ${PROG} \[add aborted\]: there is no version here; do .${PROG} checkout. first" \
  14400. "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
  14401. ${PROG} \[add aborted\]: no repository"
  14402. rm -r bogus-dir
  14403. # One error condition we don't test for is trying to add a file
  14404. # or directory which already is there.
  14405. dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
  14406. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file15,v
  14407. done
  14408. Checking in first-dir/file15;
  14409. ${CVSROOT_DIRNAME}/first-dir/file15,v <-- file15
  14410. initial revision: 1\.1
  14411. done
  14412. RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v
  14413. done
  14414. Checking in first-dir/sdir10/ssdir/ssfile;
  14415. ${CVSROOT_DIRNAME}/first-dir/sdir10/ssdir/ssfile,v <-- ssfile
  14416. initial revision: 1\.1
  14417. done"
  14418. dotest errmsg2-18 "${testcvs} -Q tag test" ''
  14419. # trying to import the repository
  14420. if $remote; then :; else
  14421. cd ${CVSROOT_DIRNAME}
  14422. dotest_fail errmsg2-20 "${testcvs} import -mtest . A B" \
  14423. "${PROG} \[import aborted\]: attempt to import the repository"
  14424. dotest_fail errmsg2-21 "${testcvs} import -mtest first-dir A B" \
  14425. "${PROG} \[import aborted\]: attempt to import the repository"
  14426. fi
  14427. cd ..
  14428. rm -r 1
  14429. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14430. ;;
  14431. adderrmsg)
  14432. # Test some of the error messages the 'add' command can return and
  14433. # their reactions to '-q'.
  14434. # First the usual setup; create a directory first-dir.
  14435. mkdir 1; cd 1
  14436. dotest adderrmsg-init1 "${testcvs} -q co -l ." ''
  14437. mkdir adderrmsg-dir
  14438. dotest adderrmsg-init2 "${testcvs} add adderrmsg-dir" \
  14439. "Directory ${CVSROOT_DIRNAME}/adderrmsg-dir added to the repository"
  14440. cd adderrmsg-dir
  14441. # try to add the admin dir
  14442. dotest_fail adderrmsg-1 "${testcvs} add CVS" \
  14443. "${PROG} [a-z]*: cannot add special file .CVS.; skipping"
  14444. # might not want to see this message when you 'cvs add *'
  14445. dotest_fail adderrmsg-2 "${testcvs} -q add CVS" ""
  14446. # to test some other messages
  14447. touch file1
  14448. dotest adderrmsg-3 "${testcvs} add file1" \
  14449. "${PROG} add: scheduling file .file1. for addition
  14450. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14451. # add it twice
  14452. dotest_fail adderrmsg-4 "${testcvs} add file1" \
  14453. "${PROG} add: file1 has already been entered"
  14454. dotest_fail adderrmsg-5 "${testcvs} -q add file1" ""
  14455. dotest adderrmsg-6 "${testcvs} -q ci -madd" \
  14456. "RCS file: ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v
  14457. done
  14458. Checking in file1;
  14459. ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v <-- file1
  14460. initial revision: 1\.1
  14461. done"
  14462. # file in Entries & repository
  14463. dotest_fail adderrmsg-7 "${testcvs} add file1" \
  14464. "${PROG} add: file1 already exists, with version number 1\.1"
  14465. dotest_fail adderrmsg-8 "${testcvs} -q add file1" ""
  14466. # clean up
  14467. cd ../..
  14468. if $keep; then :; else
  14469. rm -r 1
  14470. rm -rf ${CVSROOT_DIRNAME}/adderrmsg-dir
  14471. fi
  14472. ;;
  14473. opterrmsg)
  14474. # Test some option parsing error messages
  14475. # No init is necessary since these error messages are printed b4
  14476. # CVS looks for a sandbox or repository
  14477. # -z used to accept non-numeric arguments. This bit someone who
  14478. # attempted `cvs -z -n up' when the -n was read as the argument to
  14479. # -z.
  14480. dotest_fail opterrmsg-1 "${testcvs} -z -n up" \
  14481. "${PROG}: gzip compression level must be between 0 and 9"
  14482. # Some general -z checks
  14483. dotest_fail opterrmsg-2 "${testcvs} -z -1 up" \
  14484. "${PROG}: gzip compression level must be between 0 and 9"
  14485. dotest_fail opterrmsg-3 "${testcvs} -z10 up" \
  14486. "${PROG}: gzip compression level must be between 0 and 9"
  14487. ;;
  14488. devcom)
  14489. mkdir ${CVSROOT_DIRNAME}/first-dir
  14490. mkdir 1
  14491. cd 1
  14492. dotest devcom-1 "${testcvs} -q co first-dir"
  14493. cd first-dir
  14494. echo abb >abb
  14495. dotest devcom-2 "${testcvs} add abb" \
  14496. "$PROG add: scheduling file \`abb' for addition
  14497. $PROG add: use '$PROG commit' to add this file permanently"
  14498. dotest devcom-3 "${testcvs} -q ci -m added" \
  14499. "RCS file: ${CVSROOT_DIRNAME}/first-dir/abb,v
  14500. done
  14501. Checking in abb;
  14502. ${CVSROOT_DIRNAME}/first-dir/abb,v <-- abb
  14503. initial revision: 1\.1
  14504. done"
  14505. dotest_fail devcom-4 "${testcvs} watch" "Usage${DOTSTAR}"
  14506. dotest devcom-5 "${testcvs} watch on"
  14507. echo abc >abc
  14508. dotest devcom-6 "${testcvs} add abc" \
  14509. "$PROG add: scheduling file \`abc' for addition
  14510. $PROG add: use '$PROG commit' to add this file permanently"
  14511. dotest devcom-7 "${testcvs} -q ci -m added" \
  14512. "RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v
  14513. done
  14514. Checking in abc;
  14515. ${CVSROOT_DIRNAME}/first-dir/abc,v <-- abc
  14516. initial revision: 1\.1
  14517. done"
  14518. cd ../..
  14519. mkdir 2
  14520. cd 2
  14521. dotest devcom-8 "${testcvs} -q co first-dir" \
  14522. "U first-dir/abb
  14523. U first-dir/abc"
  14524. cd first-dir
  14525. dotest_fail devcom-9 "test -w abb"
  14526. dotest_fail devcom-9 "test -w abc"
  14527. dotest devcom-10 "${testcvs} editors" ""
  14528. dotest devcom-11 "${testcvs} edit abb"
  14529. # Here we test for the traditional ISO C ctime() date format.
  14530. # We assume the C locale; I guess that works provided we set
  14531. # LC_ALL at the start of this script but whether these
  14532. # strings should vary based on locale does not strike me as
  14533. # self-evident.
  14534. dotest devcom-12 "${testcvs} editors" \
  14535. "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"
  14536. echo aaaa >>abb
  14537. dotest devcom-13 "${testcvs} ci -m modify abb" \
  14538. "Checking in abb;
  14539. ${CVSROOT_DIRNAME}/first-dir/abb,v <-- abb
  14540. new revision: 1\.2; previous revision: 1\.1
  14541. done"
  14542. # Unedit of a file not being edited should be a noop.
  14543. dotest devcom-14 "${testcvs} unedit abb" ''
  14544. dotest devcom-15 "${testcvs} editors" ""
  14545. dotest_fail devcom-16 "test -w abb"
  14546. dotest devcom-17 "${testcvs} edit abc"
  14547. # Unedit of an unmodified file.
  14548. dotest devcom-18 "${testcvs} unedit abc"
  14549. dotest devcom-19 "${testcvs} edit abc"
  14550. echo changedabc >abc
  14551. # Try to unedit a modified file; cvs should ask for confirmation
  14552. dotest devcom-20 "echo no | ${testcvs} unedit abc" \
  14553. "abc has been modified; revert changes? "
  14554. dotest devcom-21 "echo changedabc | cmp - abc"
  14555. # OK, now confirm the unedit
  14556. dotest devcom-22 "echo yes | ${testcvs} unedit abc" \
  14557. "abc has been modified; revert changes? "
  14558. dotest devcom-23 "echo abc | cmp - abc"
  14559. dotest devcom-24 "${testcvs} watchers" ''
  14560. # FIXME: This probably should be an error message instead
  14561. # of silently succeeding and printing nothing.
  14562. dotest devcom-a-nonexist "${testcvs} watchers nonexist" ''
  14563. dotest devcom-a1 "${testcvs} watch add" ''
  14564. dotest devcom-a2 "${testcvs} watchers" \
  14565. "abb ${username} edit unedit commit
  14566. abc ${username} edit unedit commit"
  14567. dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
  14568. dotest devcom-a4 "${testcvs} watchers abb" \
  14569. "abb ${username} edit commit"
  14570. # Check tagging and checking out while we have a CVS
  14571. # directory in the repository.
  14572. dotest devcom-t0 "${testcvs} -q tag tag" \
  14573. 'T abb
  14574. T abc'
  14575. cd ../..
  14576. mkdir 3
  14577. cd 3
  14578. # Test commented out because the bug it tests for is not fixed
  14579. # The error is:
  14580. # cvs watchers: cannot open CVS/Entries for reading: No such file or directory
  14581. # cvs: ../../work/ccvs/src/fileattr.c:75: fileattr_read: Assertion `fileattr_stored_repos != ((void *)0)' failed.
  14582. : dotest devcom-t-nonexist "${testcvs} watchers nonexist" fixme
  14583. dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
  14584. 'U first-dir/abb'
  14585. cd ..
  14586. # Since first-dir/abb is readonly, use -f.
  14587. rm -rf 3
  14588. # Test checking out the directory rather than the file.
  14589. mkdir 3
  14590. cd 3
  14591. dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
  14592. 'U first-dir/abb
  14593. U first-dir/abc'
  14594. cd ..
  14595. # Since the files are readonly, use -f.
  14596. rm -rf 3
  14597. # Now do it again, after removing the val-tags file created
  14598. # by devcom-t1 to force CVS to search the repository
  14599. # containing CVS directories.
  14600. rm -f ${CVSROOT_DIRNAME}/CVSROOT/val-tags
  14601. mkdir 3
  14602. cd 3
  14603. dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
  14604. 'U first-dir/abb
  14605. U first-dir/abc'
  14606. cd ..
  14607. # Since the files are readonly, use -f.
  14608. rm -rf 3
  14609. # Now remove all the file attributes
  14610. cd 2/first-dir
  14611. dotest devcom-b0 "${testcvs} watch off" ''
  14612. dotest devcom-b1 "${testcvs} watch remove" ''
  14613. # Test that CVS 1.6 and earlier can handle the repository.
  14614. dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
  14615. # Now test watching just some, not all, files.
  14616. dotest devcom-some0 "${testcvs} watch on abc" ''
  14617. cd ../..
  14618. mkdir 3
  14619. cd 3
  14620. dotest devcom-some1 "${testcvs} -q co first-dir" 'U first-dir/abb
  14621. U first-dir/abc'
  14622. dotest devcom-some2 "test -w first-dir/abb" ''
  14623. dotest_fail devcom-some3 "test -w first-dir/abc" ''
  14624. cd ..
  14625. if $keep; then
  14626. echo Keeping ${TESTDIR} and exiting due to --keep
  14627. exit 0
  14628. fi
  14629. # Use -f because of the readonly files.
  14630. rm -rf 1 2 3
  14631. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14632. ;;
  14633. devcom2)
  14634. # More watch tests, most notably setting watches on
  14635. # files in various different states.
  14636. mkdir ${CVSROOT_DIRNAME}/first-dir
  14637. mkdir 1
  14638. cd 1
  14639. dotest devcom2-1 "${testcvs} -q co first-dir" ''
  14640. cd first-dir
  14641. # This should probably be an error; setting a watch on a totally
  14642. # unknown file is more likely to be a typo than intentional.
  14643. # But that isn't the currently implemented behavior.
  14644. dotest devcom2-2 "${testcvs} watch on w1" ''
  14645. touch w1 w2 w3 nw1
  14646. dotest devcom2-3 "${testcvs} add w1 w2 w3 nw1" "${DOTSTAR}"
  14647. # Letting the user set the watch here probably can be considered
  14648. # a feature--although it leads to a few potentially strange
  14649. # consequences like one user can set the watch and another actually
  14650. # adds the file.
  14651. dotest devcom2-4 "${testcvs} watch on w2" ''
  14652. dotest devcom2-5 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
  14653. # Note that this test differs in a subtle way from devcom-some0;
  14654. # in devcom-some0 the watch is creating a new fileattr file, and
  14655. # here we are modifying an existing one.
  14656. dotest devcom2-6 "${testcvs} watch on w3" ''
  14657. # Now test that all the watches got set on the correct files
  14658. # FIXME: CVS should have a way to report whether watches are
  14659. # set, I think. The "check it out and see if it read-only" is
  14660. # sort of OK, but is complicated by CVSREAD and doesn't help
  14661. # if the file is added and not yet committed or some such.
  14662. # Probably "cvs status" should report "watch: on" if watch is on
  14663. # (and nothing if watch is off, so existing behavior is preserved).
  14664. cd ../..
  14665. mkdir 2
  14666. cd 2
  14667. dotest devcom2-7 "${testcvs} -q co first-dir" 'U first-dir/nw1
  14668. U first-dir/w1
  14669. U first-dir/w2
  14670. U first-dir/w3'
  14671. dotest devcom2-8 "test -w first-dir/nw1" ''
  14672. dotest_fail devcom2-9 "test -w first-dir/w1" ''
  14673. dotest_fail devcom2-10 "test -w first-dir/w2" ''
  14674. dotest_fail devcom2-11 "test -w first-dir/w3" ''
  14675. cd first-dir
  14676. # OK, now we want to try files in various states with cvs edit.
  14677. dotest devcom2-12 "${testcvs} edit w4" \
  14678. "${PROG} edit: no such file w4; ignored"
  14679. # Try the same thing with a per-directory watch set.
  14680. dotest devcom2-13 "${testcvs} watch on" ''
  14681. dotest devcom2-14 "${testcvs} edit w5" \
  14682. "${PROG} edit: no such file w5; ignored"
  14683. dotest devcom2-15 "${testcvs} editors" ''
  14684. dotest devcom2-16 "${testcvs} editors w4" ''
  14685. # Make sure there are no droppings lying around
  14686. dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
  14687. "Fw1 _watched=
  14688. Fw2 _watched=
  14689. Fw3 _watched=
  14690. Fnw1 _watched=
  14691. D _watched="
  14692. cd ..
  14693. # Do a little error testing
  14694. dotest devcom2-18 "${testcvs} -q co -d first+dir first-dir" \
  14695. "U first${PLUS}dir/nw1
  14696. U first${PLUS}dir/w1
  14697. U first${PLUS}dir/w2
  14698. U first${PLUS}dir/w3"
  14699. cd first+dir
  14700. dotest_fail devcom2-19 "${testcvs} edit" \
  14701. "${PROG} \[[a-z]* aborted\]: current directory (${TESTDIR}/2/first${PLUS}dir) contains an invalid character (${PLUS},>;=\\\\t\\\\n)"
  14702. # Make sure there are no droppings lying around
  14703. dotest devcom2-20 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
  14704. "Fw1 _watched=
  14705. Fw2 _watched=
  14706. Fw3 _watched=
  14707. Fnw1 _watched=
  14708. D _watched="
  14709. cd ../..
  14710. # Use -f because of the readonly files.
  14711. rm -rf 1 2
  14712. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14713. ;;
  14714. devcom3)
  14715. # More watch tests, most notably handling of features designed
  14716. # for future expansion.
  14717. mkdir ${CVSROOT_DIRNAME}/first-dir
  14718. mkdir 1
  14719. cd 1
  14720. dotest devcom3-1 "${testcvs} -q co first-dir" ''
  14721. cd first-dir
  14722. touch w1 w2
  14723. dotest devcom3-2 "${testcvs} add w1 w2" "${DOTSTAR}"
  14724. dotest devcom3-3 "${testcvs} watch on w1 w2" ''
  14725. dotest devcom3-4 "${testcvs} -q ci -m add-them" "${DOTSTAR}"
  14726. # OK, since we are about to delve into CVS's internals, make
  14727. # sure that we seem to be correct about how they work.
  14728. dotest devcom3-5 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
  14729. "Fw1 _watched=
  14730. Fw2 _watched="
  14731. # Now write a few more lines, just as if we were a newer version
  14732. # of CVS implementing some new feature.
  14733. cat <<'EOF' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
  14734. Enew line here
  14735. G@#$^!@#=&
  14736. EOF
  14737. # Now get CVS to write to the fileattr file....
  14738. dotest devcom3-6 "${testcvs} watch off w1" ''
  14739. # ...and make sure that it hasn't clobbered our new lines.
  14740. # Note that writing these lines in another order would be OK
  14741. # too.
  14742. dotest devcom3-7 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
  14743. "Fw2 _watched=
  14744. G@#..!@#=&
  14745. Enew line here"
  14746. # See what CVS does when a file name is duplicated. The
  14747. # behavior of all versions of CVS since file attributes were
  14748. # implemented is that it nukes the duplications. This seems
  14749. # reasonable enough, although it means it isn't clear how
  14750. # useful duplicates would be for purposes of future
  14751. # expansion. But in the interests of keeping behaviors
  14752. # predictable, might as well test for it, I guess.
  14753. echo 'Fw2 duplicate=' >>${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
  14754. dotest devcom3-8 "${testcvs} watch on w1" ''
  14755. dotest devcom3-9 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
  14756. "Fw2 _watched=
  14757. Fw1 _watched=
  14758. Enew line here
  14759. G@#..!@#=&"
  14760. # Now test disconnected "cvs edit" and the format of the
  14761. # CVS/Notify file.
  14762. if $remote; then
  14763. CVS_SERVER_save=${CVS_SERVER}
  14764. CVS_SERVER=${TESTDIR}/cvs-none; export CVS_SERVER
  14765. # The ${DOTSTAR} below matches the exact CVS server error message,
  14766. # which in :fork: mode is:
  14767. # "$PROG \[edit aborted\]: cannot exec $TESTDIR/cvs-none: ${DOTSTAR}",
  14768. # but which is:
  14769. # "bash2: line 1: $TESTDIR/cvs-none: No such file or directory"
  14770. # when testing across an :ext:/ssh link to my Linux 2.4 box.
  14771. #
  14772. # I can't even test for the second part of the error message,
  14773. # from the client, which varies more consistently, usually either
  14774. # "end of file from server" (if the process doing the exec exits
  14775. # before the parent gets around to sending data to it) or
  14776. # "received broken pipe signal" (if it is the other way around),
  14777. # since HP-UX fails to output it.
  14778. dotest_fail devcom3-9ar "${testcvs} edit w1 2>/dev/null"
  14779. dotest devcom3-9br "test -w w1" ""
  14780. dotest devcom3-9cr "cat CVS/Notify" \
  14781. "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"
  14782. CVS_SERVER=${CVS_SERVER_save}; export CVS_SERVER
  14783. dotest devcom3-9dr "${testcvs} -q update" ""
  14784. dotest_fail devcom3-9er "test -f CVS/Notify" ""
  14785. dotest devcom3-9fr "${testcvs} watchers w1" \
  14786. "w1 ${username} tedit tunedit tcommit"
  14787. dotest devcom3-9gr "${testcvs} unedit w1" ""
  14788. dotest devcom3-9hr "${testcvs} watchers w1" ""
  14789. fi
  14790. cd ../..
  14791. # OK, now change the tab to a space, and see that CVS gives
  14792. # a reasonable error (this is database corruption but CVS should
  14793. # not lose its mind).
  14794. sed -e 's/Fw2 /Fw2 /' <${CVSROOT_DIRNAME}/first-dir/CVS/fileattr \
  14795. >${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new
  14796. mv ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr.new \
  14797. ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr
  14798. mkdir 2; cd 2
  14799. dotest_fail devcom3-10 "${testcvs} -Q co ." \
  14800. "${PROG} \[checkout aborted\]: file attribute database corruption: tab missing in ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr"
  14801. cd ..
  14802. # Use -f because of the readonly files.
  14803. rm -rf 1 2
  14804. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14805. ;;
  14806. watch4)
  14807. # More watch tests, including adding directories.
  14808. mkdir 1; cd 1
  14809. dotest watch4-0a "${testcvs} -q co -l ." ''
  14810. mkdir first-dir
  14811. dotest watch4-0b "${testcvs} add first-dir" \
  14812. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  14813. cd first-dir
  14814. dotest watch4-1 "${testcvs} watch on" ''
  14815. # This is just like the 173 test
  14816. touch file1
  14817. dotest watch4-2 "${testcvs} add file1" \
  14818. "${PROG} add: scheduling file .file1. for addition
  14819. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14820. dotest watch4-3 "${testcvs} -q ci -m add" \
  14821. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14822. done
  14823. Checking in file1;
  14824. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  14825. initial revision: 1\.1
  14826. done"
  14827. # Now test the analogous behavior for directories.
  14828. mkdir subdir
  14829. dotest watch4-4 "${testcvs} add subdir" \
  14830. "Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository"
  14831. cd subdir
  14832. touch sfile
  14833. dotest watch4-5 "${testcvs} add sfile" \
  14834. "${PROG} add: scheduling file .sfile. for addition
  14835. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14836. dotest watch4-6 "${testcvs} -q ci -m add" \
  14837. "RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v
  14838. done
  14839. Checking in sfile;
  14840. ${CVSROOT_DIRNAME}/first-dir/subdir/sfile,v <-- sfile
  14841. initial revision: 1\.1
  14842. done"
  14843. cd ../../..
  14844. mkdir 2; cd 2
  14845. dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
  14846. U first-dir/subdir/sfile"
  14847. dotest_fail watch4-8 "test -w first-dir/file1" ''
  14848. dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
  14849. cd first-dir
  14850. dotest watch4-10 "${testcvs} edit file1" ''
  14851. echo 'edited in 2' >file1
  14852. cd ../..
  14853. cd 1/first-dir
  14854. dotest watch4-11 "${testcvs} edit file1" ''
  14855. echo 'edited in 1' >file1
  14856. dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
  14857. "Checking in file1;
  14858. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  14859. new revision: 1\.2; previous revision: 1\.1
  14860. done"
  14861. cd ../..
  14862. cd 2/first-dir
  14863. dotest watch4-13 "${testcvs} -q update" \
  14864. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14865. retrieving revision 1\.1
  14866. retrieving revision 1\.2
  14867. Merging differences between 1\.1 and 1\.2 into file1
  14868. rcsmerge: warning: conflicts during merge
  14869. ${PROG} update: conflicts found in file1
  14870. C file1"
  14871. if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
  14872. pass watch4-14
  14873. else
  14874. fail watch4-15
  14875. fi
  14876. # This could plausibly be defined to either go back to the revision
  14877. # which was cvs edit'd (the status quo), or back to revision 1.2
  14878. # (that is, the merge could update CVS/Base/file1). We pick the
  14879. # former because it is easier to implement, not because we have
  14880. # thought much about which is better.
  14881. dotest watch4-16 "cat file1" ''
  14882. # Make sure CVS really thinks we are at 1.1.
  14883. dotest watch4-17 "${testcvs} -q update" "U file1"
  14884. dotest watch4-18 "cat file1" "edited in 1"
  14885. cd ../..
  14886. # As a sanity check, make sure we are in the right place.
  14887. dotest watch4-cleanup-1 "test -d 1" ''
  14888. dotest watch4-cleanup-1 "test -d 2" ''
  14889. # Specify -f because of the readonly files.
  14890. rm -rf 1 2
  14891. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14892. ;;
  14893. watch5)
  14894. # This test was designed to catch a problem in server
  14895. # mode where an 'cvs edit'd file disappeared from the
  14896. # CVS/Base directory when 'cvs status' or 'cvs update'
  14897. # was called on the file after the file was touched.
  14898. #
  14899. # This test is still here to prevent the bug from
  14900. # being reintroduced.
  14901. #
  14902. # The rationale for having CVS/Base stay around is that
  14903. # CVS/Base should be there if "cvs edit" has been run (this
  14904. # may be helpful as a "cvs editors" analogue, it is
  14905. # client-side and based on working directory not username;
  14906. # but more importantly, it isn't clear why a "cvs status"
  14907. # would act like an unedit, and even if it does, it would
  14908. # need to make the file read-only again).
  14909. mkdir watch5; cd watch5
  14910. dotest watch5-0a "${testcvs} -q co -l ." ''
  14911. mkdir first-dir
  14912. dotest watch5-0b "${testcvs} add first-dir" \
  14913. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  14914. cd first-dir
  14915. dotest watch5-1 "${testcvs} watch on" ''
  14916. # This is just like the 173 test
  14917. touch file1
  14918. dotest watch5-2 "${testcvs} add file1" \
  14919. "${PROG} add: scheduling file .file1. for addition
  14920. ${PROG} add: use .${PROG} commit. to add this file permanently"
  14921. dotest watch5-3 "${testcvs} -q ci -m add" \
  14922. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  14923. done
  14924. Checking in file1;
  14925. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  14926. initial revision: 1\.1
  14927. done"
  14928. dotest watch5-4 "${testcvs} edit file1" ''
  14929. dotest watch5-5 "test -f CVS/Base/file1" ''
  14930. if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
  14931. pass watch5-6
  14932. else
  14933. fail watch5-6
  14934. fi
  14935. dotest watch5-7 "test -f CVS/Base/file1" ''
  14936. # Here's where the file used to dissappear
  14937. touch file1
  14938. if ${testcvs} status file1 >>${LOGFILE} 2>&1; then
  14939. pass watch5-8
  14940. else
  14941. fail watch5-8
  14942. fi
  14943. dotest watch5-10 "test -f CVS/Base/file1" ''
  14944. # Make sure update won't remove the file either
  14945. touch file1
  14946. dotest watch5-11 "${testcvs} -q up" ''
  14947. dotest watch5-12 "test -f CVS/Base/file1" ''
  14948. cd ../..
  14949. rm -r watch5
  14950. rm -rf ${CVSROOT_DIRNAME}/first-dir
  14951. ;;
  14952. watch6)
  14953. # Check that `cvs watch on' does not reset the fileattr file.
  14954. mkdir watch6; cd watch6
  14955. dotest watch6-setup-1 "$testcvs -Q co -ldtop ."
  14956. cd top
  14957. mkdir watch6
  14958. dotest watch6-setup-2 "$testcvs -Q add watch6"
  14959. cd ..
  14960. dotest watch6-setup-3 "$testcvs -Q co watch6"
  14961. cd watch6
  14962. mkdir subdir
  14963. dotest watch6-setup-4 "$testcvs -Q add subdir"
  14964. cd subdir
  14965. # START watch add/remove sequence
  14966. dotest watch6-1 "$testcvs -Q watch add"
  14967. dotest watch6-2 \
  14968. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14969. dotest watch6-3 "$testcvs watch on"
  14970. dotest watch6-4 \
  14971. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14972. dotest watch6-5 \
  14973. "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14974. dotest watch6-6 "$testcvs watch off"
  14975. dotest watch6-7 \
  14976. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14977. dotest_fail watch6-8 \
  14978. "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14979. dotest watch6-9 "$testcvs watch remove"
  14980. dotest_fail watch6-10 \
  14981. "test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS"
  14982. dotest_fail watch6-11 \
  14983. "test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr"
  14984. # END watch add/remove sequence
  14985. echo Hi there >afile
  14986. dotest watch6-12 "$testcvs -Q add afile"
  14987. dotest watch6-13 "$testcvs ci -m 'A file' afile" \
  14988. "RCS file: $CVSROOT_DIRNAME/watch6/subdir/afile,v
  14989. done
  14990. Checking in afile;
  14991. $CVSROOT_DIRNAME/watch6/subdir/afile,v <-- afile
  14992. initial revision: 1\.1
  14993. done"
  14994. # START watch add/remove sequence
  14995. dotest watch6-14 "$testcvs -Q watch add"
  14996. dotest watch6-15 \
  14997. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  14998. dotest watch6-16 "$testcvs watch on"
  14999. dotest watch6-17 \
  15000. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  15001. dotest watch6-18 \
  15002. "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  15003. dotest watch6-19 "$testcvs watch off"
  15004. dotest watch6-20 \
  15005. "grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  15006. dotest_fail watch6-21 \
  15007. "grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null"
  15008. dotest watch6-22 "$testcvs watch remove"
  15009. dotest_fail watch6-23 \
  15010. "test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS"
  15011. dotest_fail watch6-24 \
  15012. "test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr"
  15013. # END watch add/remove sequence
  15014. if $keep; then
  15015. echo Keeping $TESTDIR and exiting due to --keep
  15016. exit 0
  15017. fi
  15018. cd ../../..
  15019. rm -r watch6
  15020. rm -rf $CVSROOT_DIRNAME/watch6
  15021. ;;
  15022. unedit-without-baserev)
  15023. mkdir 1; cd 1
  15024. module=x
  15025. file=m
  15026. echo foo > $file
  15027. dotest unedit-without-baserev-1 \
  15028. "$testcvs -Q import -m . $module X Y" ''
  15029. dotest unedit-without-baserev-2 "$testcvs -Q co $module" ''
  15030. cd $module
  15031. dotest unedit-without-baserev-3 "$testcvs -Q edit $file" ''
  15032. echo add a line >> $file
  15033. rm -f CVS/Baserev
  15034. # This will fail on most systems.
  15035. echo "yes" | dotest unedit-without-baserev-4 "${testcvs} -Q unedit $file" \
  15036. "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
  15037. ${PROG} unedit: run update to complete the unedit"
  15038. # SunOS4.1.4 systems make it this far, but with a corrupted
  15039. # CVS/Entries file. Demonstrate the corruption!
  15040. dotest unedit-without-baserev-5 "cat CVS/Entries" \
  15041. "/$file/1\.1\.1\.1/${DOTSTAR}"
  15042. dotest unedit-without-baserev-6 "${testcvs} -q update" \
  15043. "${PROG} update: warning: m was lost
  15044. U m"
  15045. # OK, those were the easy cases. Now tackle the hard one
  15046. # (the reason that CVS/Baserev was invented rather than just
  15047. # getting the revision from CVS/Entries). This is very
  15048. # similar to watch4-10 through watch4-18 but with Baserev
  15049. # missing.
  15050. cd ../..
  15051. mkdir 2; cd 2
  15052. dotest unedit-without-baserev-7 "${testcvs} -Q co x" ''
  15053. cd x
  15054. dotest unedit-without-baserev-10 "${testcvs} edit m" ''
  15055. echo 'edited in 2' >m
  15056. cd ../..
  15057. cd 1/x
  15058. dotest unedit-without-baserev-11 "${testcvs} edit m" ''
  15059. echo 'edited in 1' >m
  15060. dotest unedit-without-baserev-12 "${testcvs} -q ci -m edit-in-1" \
  15061. "Checking in m;
  15062. ${CVSROOT_DIRNAME}/x/m,v <-- m
  15063. new revision: 1\.2; previous revision: 1\.1
  15064. done"
  15065. cd ../..
  15066. cd 2/x
  15067. dotest unedit-without-baserev-13 "${testcvs} -q update" \
  15068. "RCS file: ${CVSROOT_DIRNAME}/x/m,v
  15069. retrieving revision 1\.1\.1\.1
  15070. retrieving revision 1\.2
  15071. Merging differences between 1\.1\.1\.1 and 1\.2 into m
  15072. rcsmerge: warning: conflicts during merge
  15073. ${PROG} update: conflicts found in m
  15074. C m"
  15075. rm CVS/Baserev
  15076. dotest unedit-without-baserev-14 "echo yes | ${testcvs} unedit m" \
  15077. "m has been modified; revert changes${QUESTION} ${PROG} unedit: m not mentioned in CVS/Baserev
  15078. ${PROG} unedit: run update to complete the unedit"
  15079. dotest unedit-without-baserev-15 "${testcvs} -q update" \
  15080. "${PROG} update: warning: m was lost
  15081. U m"
  15082. # The following tests are kind of degenerate compared with
  15083. # watch4-16 through watch4-18 but might as well make sure that
  15084. # nothing seriously wrong has happened to the working directory.
  15085. dotest unedit-without-baserev-16 "cat m" 'edited in 1'
  15086. # Make sure CVS really thinks we are at 1.2.
  15087. dotest unedit-without-baserev-17 "${testcvs} -q update" ""
  15088. dotest unedit-without-baserev-18 "cat m" "edited in 1"
  15089. cd ../..
  15090. rm -rf 1
  15091. rm -r 2
  15092. rm -rf ${CVSROOT_DIRNAME}/$module
  15093. ;;
  15094. ignore)
  15095. # On Windows, we can't check out CVSROOT, because the case
  15096. # insensitivity means that this conflicts with cvsroot.
  15097. mkdir ignore
  15098. cd ignore
  15099. dotest ignore-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
  15100. cd CVSROOT
  15101. echo rootig.c >cvsignore
  15102. dotest ignore-2 "${testcvs} add cvsignore" \
  15103. "${PROG}"' add: scheduling file `cvsignore'"'"' for addition
  15104. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  15105. # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
  15106. # Accept either.
  15107. dotest ignore-3 " ${testcvs} ci -m added" \
  15108. "${PROG} [a-z]*: Examining \.
  15109. RCS file: ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v
  15110. done
  15111. Checking in cvsignore;
  15112. ${CVSROOT_DIRNAME}/CVSROOT/cvsignore,v <-- cvsignore
  15113. initial revision: 1\.1
  15114. done
  15115. ${PROG} commit: Rebuilding administrative file database"
  15116. cd ..
  15117. if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  15118. pass ignore-4
  15119. else
  15120. fail ignore-4
  15121. fi
  15122. # CVS looks at the home dir from getpwuid, not HOME (is that correct
  15123. # behavior?), so this is hard to test and we won't try.
  15124. # echo foobar.c >${HOME}/.cvsignore
  15125. CVSIGNORE=envig.c; export CVSIGNORE
  15126. mkdir dir-to-import
  15127. cd dir-to-import
  15128. touch foobar.c bar.c rootig.c defig.o envig.c optig.c
  15129. # We use sort because we can't predict the order in which
  15130. # the files will be listed.
  15131. dotest_sort ignore-5 "${testcvs} import -m m -I optig.c ignore/first-dir tag1 tag2" \
  15132. '
  15133. I ignore/first-dir/defig.o
  15134. I ignore/first-dir/envig.c
  15135. I ignore/first-dir/optig.c
  15136. I ignore/first-dir/rootig.c
  15137. N ignore/first-dir/bar.c
  15138. N ignore/first-dir/foobar.c
  15139. No conflicts created by this import'
  15140. dotest_sort ignore-6 "${testcvs} import -m m -I ! ignore/second-dir tag3 tag4" \
  15141. '
  15142. N ignore/second-dir/bar.c
  15143. N ignore/second-dir/defig.o
  15144. N ignore/second-dir/envig.c
  15145. N ignore/second-dir/foobar.c
  15146. N ignore/second-dir/optig.c
  15147. N ignore/second-dir/rootig.c
  15148. No conflicts created by this import'
  15149. cd ..
  15150. rm -r dir-to-import
  15151. mkdir 1
  15152. cd 1
  15153. dotest ignore-7 "${testcvs} -q co -dsecond-dir ignore/second-dir" \
  15154. 'U second-dir/bar.c
  15155. U second-dir/defig.o
  15156. U second-dir/envig.c
  15157. U second-dir/foobar.c
  15158. U second-dir/optig.c
  15159. U second-dir/rootig.c'
  15160. dotest ignore-8 "${testcvs} -q co -dfirst-dir ignore/first-dir" 'U first-dir/bar.c
  15161. U first-dir/foobar.c'
  15162. cd first-dir
  15163. touch rootig.c defig.o envig.c optig.c notig.c
  15164. dotest ignore-9 "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
  15165. # The fact that CVS requires us to specify -I CVS here strikes me
  15166. # as a bug.
  15167. dotest_sort ignore-10 "${testcvs} -q update -I ! -I CVS" \
  15168. "${QUESTION} defig.o
  15169. ${QUESTION} envig.c
  15170. ${QUESTION} notig.c
  15171. ${QUESTION} optig.c
  15172. ${QUESTION} rootig.c"
  15173. # Now test that commands other than update also print "? notig.c"
  15174. # where appropriate. Only test this for remote, because local
  15175. # CVS only prints it on update.
  15176. rm optig.c
  15177. if $remote; then
  15178. dotest ignore-11r "${testcvs} -q diff" "${QUESTION} notig.c"
  15179. # Force the server to be contacted. Ugh. Having CVS
  15180. # contact the server for the sole purpose of checking
  15181. # the CVSROOT/cvsignore file does not seem like such a
  15182. # good idea, so I imagine this will continue to be
  15183. # necessary. Oh well, at least we test CVS's ablity to
  15184. # handle a file with a modified timestamp but unmodified
  15185. # contents.
  15186. touch bar.c
  15187. dotest ignore-11r "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
  15188. fi
  15189. # now test .cvsignore files
  15190. cd ..
  15191. echo notig.c >first-dir/.cvsignore
  15192. echo foobar.c >second-dir/.cvsignore
  15193. touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
  15194. dotest_sort ignore-12 "${testcvs} -qn update" \
  15195. "${QUESTION} first-dir/.cvsignore
  15196. ${QUESTION} second-dir/.cvsignore
  15197. ${QUESTION} second-dir/notig.c"
  15198. dotest_sort ignore-13 "${testcvs} -qn update -I! -I CVS" \
  15199. "${QUESTION} first-dir/.cvsignore
  15200. ${QUESTION} first-dir/defig.o
  15201. ${QUESTION} first-dir/envig.c
  15202. ${QUESTION} first-dir/rootig.c
  15203. ${QUESTION} second-dir/.cvsignore
  15204. ${QUESTION} second-dir/notig.c"
  15205. echo yes | dotest ignore-14 "${testcvs} release -d first-dir" \
  15206. "${QUESTION} \.cvsignore
  15207. You have \[0\] altered files in this repository.
  15208. Are you sure you want to release (and delete) directory .first-dir': "
  15209. echo add a line >>second-dir/foobar.c
  15210. rm second-dir/notig.c second-dir/.cvsignore
  15211. echo yes | dotest ignore-15 "${testcvs} release -d second-dir" \
  15212. "M foobar.c
  15213. You have \[1\] altered files in this repository.
  15214. Are you sure you want to release (and delete) directory .second-dir': "
  15215. cd ../..
  15216. if $keep; then :; else
  15217. rm -r ignore
  15218. rm -rf ${CVSROOT_DIRNAME}/ignore
  15219. fi
  15220. ;;
  15221. ignore-on-branch)
  15222. # Test that CVS _doesn't_ ignore files on branches because they were
  15223. # added to the trunk.
  15224. mkdir ignore-on-branch; cd ignore-on-branch
  15225. mkdir $CVSROOT_DIRNAME/ignore-on-branch
  15226. # create file1 & file2 on trunk
  15227. dotest ignore-on-branch-setup-1 "$testcvs -q co -dsetup ignore-on-branch" ''
  15228. cd setup
  15229. echo file1 >file1
  15230. dotest ignore-on-branch-setup-2 "$testcvs -q add file1" \
  15231. "${PROG} add: use .${PROG} commit. to add this file permanently"
  15232. dotest ignore-on-branch-setup-3 "$testcvs -q ci -mfile1 file1" \
  15233. "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file1,v
  15234. done
  15235. Checking in file1;
  15236. $CVSROOT_DIRNAME/ignore-on-branch/file1,v <-- file1
  15237. initial revision: 1\.1
  15238. done"
  15239. dotest ignore-on-branch-setup-4 "$testcvs -q tag -b branch" 'T file1'
  15240. echo file2 >file2
  15241. dotest ignore-on-branch-setup-5 "$testcvs -q add file2" \
  15242. "${PROG} add: use .${PROG} commit. to add this file permanently"
  15243. dotest ignore-on-branch-setup-6 "$testcvs -q ci -mtrunk file2" \
  15244. "RCS file: $CVSROOT_DIRNAME/ignore-on-branch/file2,v
  15245. done
  15246. Checking in file2;
  15247. $CVSROOT_DIRNAME/ignore-on-branch/file2,v <-- file2
  15248. initial revision: 1\.1
  15249. done"
  15250. cd ..
  15251. # Check out branch.
  15252. #
  15253. # - This was the original failure case - file2 would not be flagged
  15254. # with a '?'
  15255. dotest ignore-on-branch-1 "$testcvs -q co -rbranch ignore-on-branch" \
  15256. 'U ignore-on-branch/file1'
  15257. cd ignore-on-branch
  15258. echo file2 on branch >file2
  15259. dotest ignore-on-branch-2 "$testcvs -nq update" '? file2'
  15260. # Now set up for a join. One of the original fixes for this would
  15261. # print out a 'U' and a '?' during a join which added a file.
  15262. if $remote; then
  15263. dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" \
  15264. '? file2
  15265. T file1'
  15266. else
  15267. dotest ignore-on-branch-3 "$testcvs -q tag -b branch2" 'T file1'
  15268. fi
  15269. dotest ignore-on-branch-4 "$testcvs -q add file2" \
  15270. "${PROG} add: use .${PROG} commit. to add this file permanently"
  15271. dotest ignore-on-branch-5 "$testcvs -q ci -mbranch file2" \
  15272. "Checking in file2;
  15273. $CVSROOT_DIRNAME/ignore-on-branch/file2,v <-- file2
  15274. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  15275. done"
  15276. dotest ignore-on-branch-6 "$testcvs -q up -rbranch2" \
  15277. "[UP] file1
  15278. $PROG update: file2 is no longer in the repository"
  15279. dotest ignore-on-branch-7 "$testcvs -q up -jbranch" 'U file2'
  15280. cd ../..
  15281. if $keep; then :; else
  15282. rm -r ignore-on-branch
  15283. rm -rf $CVSROOT_DIRNAME/ignore-on-branch
  15284. fi
  15285. ;;
  15286. binfiles)
  15287. # Test cvs's ability to handle binary files.
  15288. # List of binary file tests:
  15289. # * conflicts, "cvs admin": binfiles
  15290. # * branching and joining: binfiles2
  15291. # * adding and removing files: binfiles3
  15292. # * -k wrappers: binwrap, binwrap2, binwrap3
  15293. # * "cvs import" and wrappers: binwrap, binwrap2, binwrap3
  15294. # * -k option to "cvs import": none yet, as far as I know.
  15295. mkdir ${CVSROOT_DIRNAME}/first-dir
  15296. mkdir 1; cd 1
  15297. dotest binfiles-1 "${testcvs} -q co first-dir" ''
  15298. ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
  15299. </dev/null | ${TR} '@' '\000' >binfile.dat
  15300. cat binfile.dat binfile.dat >binfile2.dat
  15301. cd first-dir
  15302. cp ../binfile.dat binfile
  15303. dotest binfiles-2 "${testcvs} add -kb binfile" \
  15304. "${PROG}"' add: scheduling file `binfile'\'' for addition
  15305. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  15306. dotest binfiles-3 "${testcvs} -q ci -m add-it" \
  15307. "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15308. done
  15309. Checking in binfile;
  15310. ${CVSROOT_DIRNAME}/first-dir/binfile,v <-- binfile
  15311. initial revision: 1\.1
  15312. done"
  15313. cd ../..
  15314. mkdir 2; cd 2
  15315. dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
  15316. cd first-dir
  15317. dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
  15318. # Testing that sticky options is -kb is the closest thing we have
  15319. # to testing that binary files work right on non-unix machines
  15320. # (until there is automated testing for such machines, of course).
  15321. dotest binfiles-5.5 "${testcvs} status binfile" \
  15322. "===================================================================
  15323. File: binfile Status: Up-to-date
  15324. Working revision: 1\.1.*
  15325. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15326. Sticky Tag: (none)
  15327. Sticky Date: (none)
  15328. Sticky Options: -kb"
  15329. # Test that "-kk" does not override "-kb"
  15330. cd ../..
  15331. mkdir 2a; cd 2a
  15332. dotest binfiles-5.5a0 "${testcvs} -q co -kk first-dir" 'U first-dir/binfile'
  15333. cd first-dir
  15334. # Testing that sticky options is -kb is the closest thing we have
  15335. # to testing that binary files work right on non-unix machines
  15336. # (until there is automated testing for such machines, of course).
  15337. dotest binfiles-5.5a1 "${testcvs} status binfile" \
  15338. "===================================================================
  15339. File: binfile Status: Up-to-date
  15340. Working revision: 1\.1.*
  15341. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15342. Sticky Tag: (none)
  15343. Sticky Date: (none)
  15344. Sticky Options: -kb"
  15345. # Test whether the default options from the RCS file are
  15346. # also used when operating on files instead of whole
  15347. # directories
  15348. cd ../..
  15349. mkdir 3; cd 3
  15350. dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
  15351. 'U first-dir/binfile'
  15352. cd first-dir
  15353. dotest binfiles-5.5b1 "${testcvs} status binfile" \
  15354. "===================================================================
  15355. File: binfile Status: Up-to-date
  15356. Working revision: 1\.1.*
  15357. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15358. Sticky Tag: (none)
  15359. Sticky Date: (none)
  15360. Sticky Options: -kb"
  15361. cd ../..
  15362. rm -r 3
  15363. # test that "-kk" does not override "-kb"
  15364. mkdir 3; cd 3
  15365. dotest binfiles-5.5c0 "${testcvs} -q co -kk first-dir/binfile" \
  15366. 'U first-dir/binfile'
  15367. cd first-dir
  15368. dotest binfiles-5.5c1 "${testcvs} status binfile" \
  15369. "===================================================================
  15370. File: binfile Status: Up-to-date
  15371. Working revision: 1\.1.*
  15372. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15373. Sticky Tag: (none)
  15374. Sticky Date: (none)
  15375. Sticky Options: -kb"
  15376. cd ../..
  15377. rm -r 3
  15378. cd 2/first-dir
  15379. cp ../../1/binfile2.dat binfile
  15380. dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
  15381. "Checking in binfile;
  15382. ${CVSROOT_DIRNAME}/first-dir/binfile,v <-- binfile
  15383. new revision: 1\.2; previous revision: 1\.1
  15384. done"
  15385. cd ../../1/first-dir
  15386. dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
  15387. dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
  15388. # Now test handling of conflicts with binary files.
  15389. cp ../binfile.dat binfile
  15390. dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
  15391. "Checking in binfile;
  15392. ${CVSROOT_DIRNAME}/first-dir/binfile,v <-- binfile
  15393. new revision: 1\.3; previous revision: 1\.2
  15394. done"
  15395. cd ../../2/first-dir
  15396. echo 'edits in dir 2' >binfile
  15397. dotest binfiles-con1 "${testcvs} -q update" \
  15398. "$PROG update: nonmergeable file needs merge
  15399. ${PROG} update: revision 1\.3 from repository is now in binfile
  15400. ${PROG} update: file from working directory is now in \.#binfile\.1\.2
  15401. C binfile"
  15402. dotest_fail binfiles-con1b "$testcvs -q up" "C binfile"
  15403. dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
  15404. dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
  15405. cp ../../1/binfile2.dat binfile
  15406. dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
  15407. "Checking in binfile;
  15408. ${CVSROOT_DIRNAME}/first-dir/binfile,v <-- binfile
  15409. new revision: 1\.4; previous revision: 1\.3
  15410. done"
  15411. cd ../../1/first-dir
  15412. dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
  15413. dotest binfiles-9 "${testcvs} -q update -A" ''
  15414. # "-kk" no longer does anything with "-kb"
  15415. dotest binfiles-10 "${testcvs} -q update -kk" ''
  15416. dotest binfiles-11 "${testcvs} -q update" ''
  15417. # "-kk" no longer does anything with "-kb"
  15418. dotest binfiles-12 "${testcvs} -q update -A" ''
  15419. dotest binfiles-13 "${testcvs} -q update -A" ''
  15420. cd ../..
  15421. mkdir 3
  15422. cd 3
  15423. dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
  15424. 'U first-dir/binfile'
  15425. cd first-dir
  15426. dotest binfiles-13a1 "${testcvs} status binfile" \
  15427. "===================================================================
  15428. File: binfile Status: Up-to-date
  15429. Working revision: 1\.4.*
  15430. Repository revision: 1\.4 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15431. Sticky Tag: HEAD (revision: 1\.4)
  15432. Sticky Date: (none)
  15433. Sticky Options: -kb"
  15434. cd ../..
  15435. rm -r 3
  15436. cd 2/first-dir
  15437. echo 'this file is $''RCSfile$' >binfile
  15438. dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
  15439. "Checking in binfile;
  15440. ${CVSROOT_DIRNAME}/first-dir/binfile,v <-- binfile
  15441. new revision: 1\.5; previous revision: 1\.4
  15442. done"
  15443. dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
  15444. # See binfiles-5.5 for discussion of -kb.
  15445. dotest binfiles-14c "${testcvs} status binfile" \
  15446. "===================================================================
  15447. File: binfile Status: Up-to-date
  15448. Working revision: 1\.5.*
  15449. Repository revision: 1\.5 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15450. Sticky Tag: (none)
  15451. Sticky Date: (none)
  15452. Sticky Options: -kb"
  15453. dotest binfiles-14d "${testcvs} admin -kv binfile" \
  15454. "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15455. done"
  15456. # cvs admin doesn't change the checked-out file or its sticky
  15457. # kopts. There probably should be a way which does (but
  15458. # what if the file is modified? And do we try to version
  15459. # control the kopt setting?)
  15460. dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
  15461. dotest binfiles-14f "${testcvs} status binfile" \
  15462. "===================================================================
  15463. File: binfile Status: Up-to-date
  15464. Working revision: 1\.5.*
  15465. Repository revision: 1\.5 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15466. Sticky Tag: (none)
  15467. Sticky Date: (none)
  15468. Sticky Options: -kb"
  15469. dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
  15470. dotest binfiles-14h "cat binfile" 'this file is binfile,v'
  15471. dotest binfiles-14i "${testcvs} status binfile" \
  15472. "===================================================================
  15473. File: binfile Status: Up-to-date
  15474. Working revision: 1\.5.*
  15475. Repository revision: 1\.5 ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15476. Sticky Tag: (none)
  15477. Sticky Date: (none)
  15478. Sticky Options: -kv"
  15479. # Do sticky options work when used with 'cvs update'?
  15480. echo "Not a binary file." > nibfile
  15481. dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
  15482. "${PROG} add: use .${PROG} commit. to add this file permanently"
  15483. dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
  15484. "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
  15485. done
  15486. Checking in nibfile;
  15487. ${CVSROOT_DIRNAME}/first-dir/nibfile,v <-- nibfile
  15488. initial revision: 1\.1
  15489. done"
  15490. dotest binfiles-sticky3 "${testcvs} -q update -kb nibfile" \
  15491. '[UP] nibfile'
  15492. dotest binfiles-sticky4 "${testcvs} -q status nibfile" \
  15493. "===================================================================
  15494. File: nibfile Status: Up-to-date
  15495. Working revision: 1\.1.*
  15496. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/nibfile,v
  15497. Sticky Tag: (none)
  15498. Sticky Date: (none)
  15499. Sticky Options: -kb"
  15500. # Now test that -A can clear the sticky option.
  15501. dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
  15502. "[UP] nibfile"
  15503. dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
  15504. "===================================================================
  15505. File: nibfile Status: Up-to-date
  15506. Working revision: 1\.1.*
  15507. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/nibfile,v
  15508. Sticky Tag: (none)
  15509. Sticky Date: (none)
  15510. Sticky Options: (none)"
  15511. dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
  15512. "RCS file: ${CVSROOT_DIRNAME}/first-dir/nibfile,v
  15513. done"
  15514. dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
  15515. dotest binfiles-17 "${testcvs} -q status nibfile" \
  15516. "===================================================================
  15517. File: nibfile Status: Up-to-date
  15518. Working revision: 1\.1.*
  15519. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/nibfile,v
  15520. Sticky Tag: (none)
  15521. Sticky Date: (none)
  15522. Sticky Options: -kb"
  15523. dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
  15524. "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15525. deleting revision 1\.5
  15526. deleting revision 1\.4
  15527. done"
  15528. dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
  15529. "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15530. deleting revision 1\.2
  15531. deleting revision 1\.1
  15532. done"
  15533. dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
  15534. RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile,v
  15535. Working file: binfile
  15536. head: 1\.3
  15537. branch:
  15538. locks: strict
  15539. access list:
  15540. keyword substitution: v
  15541. total revisions: 1
  15542. ============================================================================="
  15543. # Check that the contents were right. This isn't the hard case
  15544. # (in which RCS_delete_revs does a diff), but might as well.
  15545. dotest binfiles-o4 "${testcvs} -q update binfile" "U binfile"
  15546. dotest binfiles-o5 "cmp binfile ../../1/binfile.dat" ""
  15547. cd ../..
  15548. rm -rf ${CVSROOT_DIRNAME}/first-dir
  15549. rm -r 1
  15550. rm -r 2
  15551. ;;
  15552. binfiles2)
  15553. # Test cvs's ability to handle binary files, particularly branching
  15554. # and joining. The key thing we are worrying about is that CVS
  15555. # doesn't print "cannot merge binary files" or some such, in
  15556. # situations where no merging is required.
  15557. # See also "join" which does this with non-binary files.
  15558. #
  15559. # Cases (we are merging from the branch to the trunk):
  15560. # binfile.dat) File added on branch, not on trunk.
  15561. # File should be marked for addition.
  15562. # brmod) File modified on branch, not on trunk.
  15563. # File should be copied over to trunk (no merging is needed).
  15564. # brmod-trmod) File modified on branch, also on trunk.
  15565. # This is a conflict. Present the user with both files and
  15566. # let them figure it out.
  15567. # brmod-wdmod) File modified on branch, not modified in the trunk
  15568. # repository, but modified in the (trunk) working directory.
  15569. # This is also a conflict.
  15570. mkdir ${CVSROOT_DIRNAME}/first-dir
  15571. mkdir 1; cd 1
  15572. dotest binfiles2-1 "${testcvs} -q co first-dir" ''
  15573. cd first-dir
  15574. # The most important thing here is that binfile, binfile2, &c
  15575. # each be distinct from each other. We also make sure to include
  15576. # a few likely end-of-line patterns to make sure nothing is
  15577. # being munged as if in text mode.
  15578. ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
  15579. </dev/null | ${TR} '@' '\000' >../binfile
  15580. cat ../binfile ../binfile >../binfile2
  15581. cat ../binfile2 ../binfile >../binfile3
  15582. # FIXCVS: unless a branch has at least one file on it,
  15583. # tag_check_valid won't know it exists. So if brmod didn't
  15584. # exist, we would have to invent it.
  15585. cp ../binfile brmod
  15586. cp ../binfile brmod-trmod
  15587. cp ../binfile brmod-wdmod
  15588. dotest binfiles2-1a \
  15589. "${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
  15590. "${PROG} add: scheduling file .brmod. for addition
  15591. ${PROG} add: scheduling file .brmod-trmod. for addition
  15592. ${PROG} add: scheduling file .brmod-wdmod. for addition
  15593. ${PROG} add: use .${PROG} commit. to add these files permanently"
  15594. dotest binfiles2-1b "${testcvs} -q ci -m add" \
  15595. "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
  15596. done
  15597. Checking in brmod;
  15598. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15599. initial revision: 1\.1
  15600. done
  15601. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15602. done
  15603. Checking in brmod-trmod;
  15604. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15605. initial revision: 1\.1
  15606. done
  15607. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
  15608. done
  15609. Checking in brmod-wdmod;
  15610. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15611. initial revision: 1\.1
  15612. done"
  15613. dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
  15614. T brmod-trmod
  15615. T brmod-wdmod'
  15616. dotest binfiles2-3 "$testcvs -q update -r br" \
  15617. 'U brmod
  15618. U brmod-trmod
  15619. U brmod-wdmod'
  15620. cp ../binfile binfile.dat
  15621. dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
  15622. "${PROG} add: scheduling file .binfile\.dat. for addition on branch .br.
  15623. ${PROG} add: use .${PROG} commit. to add this file permanently"
  15624. cp ../binfile2 brmod
  15625. cp ../binfile2 brmod-trmod
  15626. cp ../binfile2 brmod-wdmod
  15627. dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
  15628. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v
  15629. done
  15630. Checking in binfile\.dat;
  15631. ${CVSROOT_DIRNAME}/first-dir/Attic/binfile\.dat,v <-- binfile\.dat
  15632. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15633. done
  15634. Checking in brmod;
  15635. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15636. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15637. done
  15638. Checking in brmod-trmod;
  15639. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15640. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15641. done
  15642. Checking in brmod-wdmod;
  15643. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15644. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15645. done"
  15646. dotest binfiles2-6 "${testcvs} -q update -A" \
  15647. "${PROG} update: binfile\.dat is no longer in the repository
  15648. [UP] brmod
  15649. [UP] brmod-trmod
  15650. [UP] brmod-wdmod"
  15651. dotest_fail binfiles2-7 "test -f binfile.dat" ''
  15652. dotest binfiles2-7-brmod "cmp ../binfile brmod"
  15653. cp ../binfile3 brmod-trmod
  15654. dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
  15655. "Checking in brmod-trmod;
  15656. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15657. new revision: 1\.2; previous revision: 1\.1
  15658. done"
  15659. cp ../binfile3 brmod-wdmod
  15660. dotest binfiles2-8 "${testcvs} -q update -j br" \
  15661. "U binfile\.dat
  15662. U brmod
  15663. ${PROG} update: nonmergeable file needs merge
  15664. ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
  15665. ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
  15666. C brmod-trmod
  15667. M brmod-wdmod
  15668. ${PROG} update: nonmergeable file needs merge
  15669. ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
  15670. ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
  15671. C brmod-wdmod"
  15672. dotest binfiles2-9 "cmp ../binfile binfile.dat"
  15673. dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
  15674. dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
  15675. dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
  15676. dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
  15677. dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
  15678. # Test that everything was properly scheduled.
  15679. dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
  15680. "Checking in binfile\.dat;
  15681. ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v <-- binfile\.dat
  15682. new revision: 1\.2; previous revision: 1\.1
  15683. done
  15684. Checking in brmod;
  15685. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15686. new revision: 1\.2; previous revision: 1\.1
  15687. done
  15688. Checking in brmod-trmod;
  15689. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15690. new revision: 1\.3; previous revision: 1\.2
  15691. done
  15692. Checking in brmod-wdmod;
  15693. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15694. new revision: 1\.2; previous revision: 1\.1
  15695. done"
  15696. dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
  15697. "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15698. deleting revision 1\.2
  15699. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v: can't remove branch point 1\.1
  15700. ${PROG} admin: RCS file for .brmod-trmod. not modified\."
  15701. dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
  15702. "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15703. deleting revision 1\.1\.2\.1
  15704. done"
  15705. dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
  15706. "RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15707. deleting revision 1\.2
  15708. deleting revision 1\.1
  15709. done"
  15710. dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
  15711. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15712. Working file: brmod-trmod
  15713. head: 1\.3
  15714. branch:
  15715. locks: strict
  15716. access list:
  15717. keyword substitution: b
  15718. total revisions: 1; selected revisions: 1
  15719. description:
  15720. ----------------------------
  15721. revision 1\.3
  15722. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  15723. checkin
  15724. ============================================================================="
  15725. cd ..
  15726. cd ..
  15727. rm -rf ${CVSROOT_DIRNAME}/first-dir
  15728. rm -r 1
  15729. ;;
  15730. binfiles3)
  15731. # More binary file tests, especially removing, adding, &c.
  15732. # See "binfiles" for a list of binary file tests.
  15733. mkdir ${CVSROOT_DIRNAME}/first-dir
  15734. mkdir 1; cd 1
  15735. dotest binfiles3-1 "${testcvs} -q co first-dir" ''
  15736. ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
  15737. </dev/null | ${TR} '@' '\000' >binfile.dat
  15738. cd first-dir
  15739. echo hello >file1
  15740. dotest binfiles3-2 "${testcvs} add file1" \
  15741. "${PROG} add: scheduling file .file1. for addition
  15742. ${PROG} add: use .${PROG} commit. to add this file permanently"
  15743. dotest binfiles3-3 "${testcvs} -q ci -m add-it" \
  15744. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  15745. done
  15746. Checking in file1;
  15747. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  15748. initial revision: 1\.1
  15749. done"
  15750. rm file1
  15751. dotest binfiles3-4 "${testcvs} rm file1" \
  15752. "${PROG} remove: scheduling .file1. for removal
  15753. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  15754. dotest binfiles3-5 "${testcvs} -q ci -m remove-it" \
  15755. "Removing file1;
  15756. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  15757. new revision: delete; previous revision: 1\.1
  15758. done"
  15759. cp ../binfile.dat file1
  15760. dotest binfiles3-6 "${testcvs} add -kb file1" \
  15761. "${PROG} add: Re-adding file .file1. (in place of dead revision 1\.2)\.
  15762. ${PROG} add: use .${PROG} commit. to add this file permanently"
  15763. # The idea behind this test is to make sure that the file
  15764. # gets opened in binary mode to send to "cvs ci".
  15765. dotest binfiles3-6a "cat CVS/Entries" \
  15766. "/file1/0/[A-Za-z0-9 :]*/-kb/
  15767. D"
  15768. # TODO: This just tests the case where the old keyword
  15769. # expansion mode is the default (RCS_getexpand == NULL
  15770. # in checkaddfile()); should also test the case in which
  15771. # we are changing it from one non-default value to another.
  15772. dotest binfiles3-7 "${testcvs} -q ci -m readd-it" \
  15773. "${PROG} commit: changing keyword expansion mode to -kb
  15774. Checking in file1;
  15775. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  15776. new revision: 1\.3; previous revision: 1\.2
  15777. done"
  15778. dotest binfiles3-8 "${testcvs} -q log -h -N file1" "
  15779. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  15780. Working file: file1
  15781. head: 1\.3
  15782. branch:
  15783. locks: strict
  15784. access list:
  15785. keyword substitution: b
  15786. total revisions: 3
  15787. ============================================================================="
  15788. # OK, now test admin -o on a binary file. See "admin"
  15789. # test for a more complete list of admin -o tests.
  15790. cp ${TESTDIR}/1/binfile.dat ${TESTDIR}/1/binfile4.dat
  15791. echo '%%$$##@@!!jjiiuull' | ${TR} j '\000' >>${TESTDIR}/1/binfile4.dat
  15792. cp ${TESTDIR}/1/binfile4.dat ${TESTDIR}/1/binfile5.dat
  15793. echo 'aawwee%$$##@@!!jjil' | ${TR} w '\000' >>${TESTDIR}/1/binfile5.dat
  15794. cp ../binfile4.dat file1
  15795. dotest binfiles3-9 "${testcvs} -q ci -m change" \
  15796. "Checking in file1;
  15797. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  15798. new revision: 1\.4; previous revision: 1\.3
  15799. done"
  15800. cp ../binfile5.dat file1
  15801. dotest binfiles3-10 "${testcvs} -q ci -m change" \
  15802. "Checking in file1;
  15803. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  15804. new revision: 1\.5; previous revision: 1\.4
  15805. done"
  15806. dotest binfiles3-11 "${testcvs} admin -o 1.3::1.5 file1" \
  15807. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  15808. deleting revision 1\.4
  15809. done"
  15810. dotest binfiles3-12 "${testcvs} -q update -r 1.3 file1" "U file1"
  15811. dotest binfiles3-13 "cmp file1 ${TESTDIR}/1/binfile.dat" ""
  15812. cd ../..
  15813. rm -r 1
  15814. rm -rf ${CVSROOT_DIRNAME}/first-dir
  15815. ;;
  15816. mcopy)
  15817. # See comment at "mwrap" test for list of other wrappers tests.
  15818. # Test cvs's ability to handle nonmergeable files specified with
  15819. # -m 'COPY' in wrappers. Similar to the binfiles2 test,
  15820. # which tests the same thing for binary files
  15821. # (which are non-mergeable in the same sense).
  15822. #
  15823. # Cases (we are merging from the branch to the trunk):
  15824. # brmod) File modified on branch, not on trunk.
  15825. # File should be copied over to trunk (no merging is needed).
  15826. # brmod-trmod) File modified on branch, also on trunk.
  15827. # This is a conflict. Present the user with both files and
  15828. # let them figure it out.
  15829. # brmod-wdmod) File modified on branch, not modified in the trunk
  15830. # repository, but modified in the (trunk) working directory.
  15831. # This is also a conflict.
  15832. # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
  15833. # (see wrap_send). So skip these tests for remote.
  15834. if $remote; then :; else
  15835. mkdir ${CVSROOT_DIRNAME}/first-dir
  15836. mkdir 1; cd 1
  15837. dotest mcopy-1 "${testcvs} -q co first-dir" ''
  15838. cd first-dir
  15839. # FIXCVS: unless a branch has at least one file on it,
  15840. # tag_check_valid won't know it exists. So if brmod didn't
  15841. # exist, we would have to invent it.
  15842. echo 'brmod initial contents' >brmod
  15843. echo 'brmod-trmod initial contents' >brmod-trmod
  15844. echo 'brmod-wdmod initial contents' >brmod-wdmod
  15845. echo "* -m 'COPY'" >.cvswrappers
  15846. dotest mcopy-1a \
  15847. "${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
  15848. "${PROG} add: scheduling file .\.cvswrappers. for addition
  15849. ${PROG} add: scheduling file .brmod. for addition
  15850. ${PROG} add: scheduling file .brmod-trmod. for addition
  15851. ${PROG} add: scheduling file .brmod-wdmod. for addition
  15852. ${PROG} add: use .${PROG} commit. to add these files permanently"
  15853. dotest mcopy-1b "${testcvs} -q ci -m add" \
  15854. "RCS file: ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v
  15855. done
  15856. Checking in \.cvswrappers;
  15857. ${CVSROOT_DIRNAME}/first-dir/\.cvswrappers,v <-- \.cvswrappers
  15858. initial revision: 1\.1
  15859. done
  15860. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod,v
  15861. done
  15862. Checking in brmod;
  15863. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15864. initial revision: 1\.1
  15865. done
  15866. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v
  15867. done
  15868. Checking in brmod-trmod;
  15869. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15870. initial revision: 1\.1
  15871. done
  15872. RCS file: ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v
  15873. done
  15874. Checking in brmod-wdmod;
  15875. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15876. initial revision: 1\.1
  15877. done"
  15878. # NOTE: .cvswrappers files are broken (see comment in
  15879. # src/wrapper.c). So doing everything via the environment
  15880. # variable is a workaround. Better would be to test them
  15881. # both.
  15882. CVSWRAPPERS="* -m 'COPY'"
  15883. export CVSWRAPPERS
  15884. dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
  15885. T brmod
  15886. T brmod-trmod
  15887. T brmod-wdmod'
  15888. dotest mcopy-3 "$testcvs -q update -r br" \
  15889. 'U .cvswrappers
  15890. U brmod
  15891. U brmod-trmod
  15892. U brmod-wdmod'
  15893. echo 'modify brmod on br' >brmod
  15894. echo 'modify brmod-trmod on br' >brmod-trmod
  15895. echo 'modify brmod-wdmod on br' >brmod-wdmod
  15896. dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
  15897. "Checking in brmod;
  15898. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15899. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15900. done
  15901. Checking in brmod-trmod;
  15902. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15903. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15904. done
  15905. Checking in brmod-wdmod;
  15906. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15907. new revision: 1\.1\.2\.1; previous revision: 1\.1
  15908. done"
  15909. dotest mcopy-6 "$testcvs -q update -A" \
  15910. 'U .cvswrappers
  15911. U brmod
  15912. U brmod-trmod
  15913. U brmod-wdmod'
  15914. dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
  15915. "brmod initial contents
  15916. brmod-trmod initial contents
  15917. brmod-wdmod initial contents"
  15918. echo 'modify brmod-trmod again on trunk' >brmod-trmod
  15919. dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
  15920. "Checking in brmod-trmod;
  15921. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15922. new revision: 1\.2; previous revision: 1\.1
  15923. done"
  15924. echo 'modify brmod-wdmod in working dir' >brmod-wdmod
  15925. dotest mcopy-8 "${testcvs} -q update -j br" \
  15926. "U brmod
  15927. ${PROG} update: nonmergeable file needs merge
  15928. ${PROG} update: revision 1.1.2.1 from repository is now in brmod-trmod
  15929. ${PROG} update: file from working directory is now in .#brmod-trmod.1.2
  15930. C brmod-trmod
  15931. M brmod-wdmod
  15932. ${PROG} update: nonmergeable file needs merge
  15933. ${PROG} update: revision 1.1.2.1 from repository is now in brmod-wdmod
  15934. ${PROG} update: file from working directory is now in .#brmod-wdmod.1.1
  15935. C brmod-wdmod"
  15936. dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
  15937. "modify brmod on br
  15938. modify brmod-trmod on br
  15939. modify brmod-wdmod on br"
  15940. dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
  15941. "modify brmod-trmod again on trunk
  15942. modify brmod-wdmod in working dir"
  15943. # Test that everything was properly scheduled.
  15944. dotest mcopy-10 "${testcvs} -q ci -m checkin" \
  15945. "Checking in brmod;
  15946. ${CVSROOT_DIRNAME}/first-dir/brmod,v <-- brmod
  15947. new revision: 1\.2; previous revision: 1\.1
  15948. done
  15949. Checking in brmod-trmod;
  15950. ${CVSROOT_DIRNAME}/first-dir/brmod-trmod,v <-- brmod-trmod
  15951. new revision: 1\.3; previous revision: 1\.2
  15952. done
  15953. Checking in brmod-wdmod;
  15954. ${CVSROOT_DIRNAME}/first-dir/brmod-wdmod,v <-- brmod-wdmod
  15955. new revision: 1\.2; previous revision: 1\.1
  15956. done"
  15957. cd ..
  15958. cd ..
  15959. rm -rf ${CVSROOT_DIRNAME}/first-dir
  15960. rm -r 1
  15961. unset CVSWRAPPERS
  15962. fi # end of tests to be skipped for remote
  15963. ;;
  15964. binwrap)
  15965. # Test the ability to specify binary-ness based on file name.
  15966. # See "mwrap" for a list of other wrappers tests.
  15967. mkdir dir-to-import
  15968. cd dir-to-import
  15969. touch foo.c foo.exe
  15970. # While we're here, test for rejection of duplicate tag names.
  15971. dotest_fail binwrap-0 \
  15972. "${testcvs} import -m msg -I ! first-dir dup dup" \
  15973. "${PROG} \[[a-z]* aborted\]: tag .dup. was specified more than once"
  15974. if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
  15975. first-dir tag1 tag2 >>${LOGFILE}; then
  15976. pass binwrap-1
  15977. else
  15978. fail binwrap-1
  15979. fi
  15980. cd ..
  15981. rm -r dir-to-import
  15982. dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
  15983. U first-dir/foo.exe'
  15984. dotest binwrap-3 "${testcvs} -q status first-dir" \
  15985. "===================================================================
  15986. File: foo\.c Status: Up-to-date
  15987. Working revision: 1\.1\.1\.1.*
  15988. Repository revision: 1\.1\.1\.1 ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  15989. Sticky Tag: (none)
  15990. Sticky Date: (none)
  15991. Sticky Options: (none)
  15992. ===================================================================
  15993. File: foo\.exe Status: Up-to-date
  15994. Working revision: 1\.1\.1\.1.*
  15995. Repository revision: 1\.1\.1\.1 ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
  15996. Sticky Tag: (none)
  15997. Sticky Date: (none)
  15998. Sticky Options: -kb"
  15999. rm -r first-dir
  16000. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16001. ;;
  16002. binwrap2)
  16003. # Test the ability to specify binary-ness based on file name.
  16004. # See "mwrap" for a list of other wrappers tests.
  16005. mkdir dir-to-import
  16006. cd dir-to-import
  16007. touch foo.c foo.exe
  16008. # Specify that all files are binary except *.c.
  16009. # The order seems to matter, with the earlier rules taking
  16010. # precedence. I'm not sure whether that is good or not,
  16011. # but it is the current behavior.
  16012. if ${testcvs} import -m message -I ! \
  16013. -W "*.c -k 'o'" -W "* -k 'b'" \
  16014. first-dir tag1 tag2 >>${LOGFILE}; then
  16015. pass binwrap2-1
  16016. else
  16017. fail binwrap2-1
  16018. fi
  16019. cd ..
  16020. rm -r dir-to-import
  16021. dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
  16022. U first-dir/foo.exe'
  16023. dotest binwrap2-3 "${testcvs} -q status first-dir" \
  16024. "===================================================================
  16025. File: foo\.c Status: Up-to-date
  16026. Working revision: 1\.1\.1\.1.*
  16027. Repository revision: 1\.1\.1\.1 ${CVSROOT_DIRNAME}/first-dir/foo\.c,v
  16028. Sticky Tag: (none)
  16029. Sticky Date: (none)
  16030. Sticky Options: -ko
  16031. ===================================================================
  16032. File: foo\.exe Status: Up-to-date
  16033. Working revision: 1\.1\.1\.1.*
  16034. Repository revision: 1\.1\.1\.1 ${CVSROOT_DIRNAME}/first-dir/foo\.exe,v
  16035. Sticky Tag: (none)
  16036. Sticky Date: (none)
  16037. Sticky Options: -kb"
  16038. rm -r first-dir
  16039. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16040. ;;
  16041. binwrap3)
  16042. # Test communication of file-specified -k wrappers between
  16043. # client and server, in `import':
  16044. #
  16045. # 1. Set up a directory tree, populate it with files.
  16046. # 2. Give each directory a different .cvswrappers file.
  16047. # 3. Give the server its own .cvswrappers file.
  16048. # 4. Import the whole tree, see if the right files got set
  16049. # to binary.
  16050. #
  16051. # The tree has a top ("0th") level, and two subdirs, sub1/
  16052. # and sub2/; sub2/ contains directory subsub/. Every
  16053. # directory has a .cvswrappers file as well as regular
  16054. # files.
  16055. #
  16056. # In the file names, "foo-b.*" should end up binary, and
  16057. # "foo-t.*" should end up text. Don't worry about the two
  16058. # letter extensions; they're just there to help me keep
  16059. # things straight.
  16060. #
  16061. # Here's the directory tree:
  16062. #
  16063. # ./
  16064. # .cvswrappers
  16065. # foo-b.c0
  16066. # foo-b.sb
  16067. # foo-t.c1
  16068. # foo-t.st
  16069. #
  16070. # sub1/ sub2/
  16071. # .cvswrappers .cvswrappers
  16072. # foo-b.c1 foo-b.sb
  16073. # foo-b.sb foo-b.st
  16074. # foo-t.c0 foo-t.c0
  16075. # foo-t.st foo-t.c1
  16076. # foo-t.c2
  16077. # foo-t.c3
  16078. #
  16079. # subsub/
  16080. # .cvswrappers
  16081. # foo-b.c3
  16082. # foo-b.sb
  16083. # foo-t.c0
  16084. # foo-t.c1
  16085. # foo-t.c2
  16086. # foo-t.st
  16087. binwrap3_line1="This is a test file "
  16088. binwrap3_line2="containing little of use "
  16089. binwrap3_line3="except this non-haiku"
  16090. binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
  16091. cd ${TESTDIR}
  16092. # On Windows, we can't check out CVSROOT, because the case
  16093. # insensitivity means that this conflicts with cvsroot.
  16094. mkdir wnt
  16095. cd wnt
  16096. mkdir binwrap3 # the 0th dir
  16097. mkdir binwrap3/sub1
  16098. mkdir binwrap3/sub2
  16099. mkdir binwrap3/sub2/subsub
  16100. echo "bar*" > binwrap3/.cvswrappers
  16101. echo "*.c0 -k 'b'" >> binwrap3/.cvswrappers
  16102. echo "whatever -k 'b'" >> binwrap3/.cvswrappers
  16103. echo ${binwrap3_text} > binwrap3/foo-b.c0
  16104. echo ${binwrap3_text} > binwrap3/bar-t.c0
  16105. echo ${binwrap3_text} > binwrap3/foo-b.sb
  16106. echo ${binwrap3_text} > binwrap3/foo-t.sb
  16107. echo ${binwrap3_text} > binwrap3/foo-t.c1
  16108. echo ${binwrap3_text} > binwrap3/foo-t.st
  16109. echo "bar* -k 'kv'" > binwrap3/sub1/.cvswrappers
  16110. echo "*.c1 -k 'b'" >> binwrap3/sub1/.cvswrappers
  16111. echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
  16112. echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
  16113. echo ${binwrap3_text} > binwrap3/sub1/bar-t.c1
  16114. echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
  16115. echo ${binwrap3_text} > binwrap3/sub1/foo-t.sb
  16116. echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
  16117. echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
  16118. echo "bar*" > binwrap3/sub2/.cvswrappers
  16119. echo "*.st -k 'b'" >> binwrap3/sub2/.cvswrappers
  16120. echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
  16121. echo ${binwrap3_text} > binwrap3/sub2/foo-t.sb
  16122. echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
  16123. echo ${binwrap3_text} > binwrap3/sub2/bar-t.st
  16124. echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
  16125. echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
  16126. echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
  16127. echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
  16128. echo "bar* -k 'kv'" > binwrap3/sub2/subsub/.cvswrappers
  16129. echo "*.c3 -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
  16130. echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
  16131. echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
  16132. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
  16133. echo ${binwrap3_text} > binwrap3/sub2/subsub/bar-t.c3
  16134. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
  16135. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.sb
  16136. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
  16137. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
  16138. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
  16139. echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
  16140. # Now set up CVSROOT/cvswrappers, the easy way:
  16141. dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
  16142. cd CVSROOT
  16143. # This destroys anything currently in cvswrappers, but
  16144. # presumably other tests will take care of it themselves if
  16145. # they use cvswrappers:
  16146. echo "foo-t.sb" > cvswrappers
  16147. echo "foo*.sb -k 'b'" >> cvswrappers
  16148. dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
  16149. "Checking in cvswrappers;
  16150. ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v <-- cvswrappers
  16151. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16152. done
  16153. ${PROG} commit: Rebuilding administrative file database"
  16154. cd ..
  16155. # Avoid environmental interference
  16156. CVSWRAPPERS_save=${CVSWRAPPERS}
  16157. unset CVSWRAPPERS
  16158. # Do the import
  16159. cd binwrap3
  16160. # Not importing .cvswrappers tests whether the client is really
  16161. # letting the server know "honestly" whether the file is binary,
  16162. # rather than just letting the server see the .cvswrappers file.
  16163. dotest binwrap3-2a \
  16164. "${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
  16165. "[NI] ${DOTSTAR}"
  16166. # OK, now test "cvs add".
  16167. cd ..
  16168. rm -r binwrap3
  16169. dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
  16170. cd binwrap3
  16171. cd sub2
  16172. echo "*.newbin -k 'b'" > .cvswrappers
  16173. echo .cvswrappers >.cvsignore
  16174. echo .cvsignore >>.cvsignore
  16175. touch file1.newbin file1.txt
  16176. dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
  16177. "${PROG} add: scheduling file .file1\.newbin. for addition
  16178. ${PROG} add: scheduling file .file1\.txt. for addition
  16179. ${PROG} add: use .${PROG} commit. to add these files permanently"
  16180. dotest binwrap3-2d "${testcvs} -q ci -m add" \
  16181. "RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v
  16182. done
  16183. Checking in file1\.newbin;
  16184. ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.newbin,v <-- file1\.newbin
  16185. initial revision: 1\.1
  16186. done
  16187. RCS file: ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v
  16188. done
  16189. Checking in file1\.txt;
  16190. ${CVSROOT_DIRNAME}/binwrap3/sub2/file1\.txt,v <-- file1\.txt
  16191. initial revision: 1\.1
  16192. done"
  16193. cd ..
  16194. # Now check out the module and see which files are binary.
  16195. cd ..
  16196. rm -r binwrap3
  16197. dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
  16198. cd binwrap3
  16199. # Running "cvs status" and matching output is too
  16200. # error-prone, too likely to falsely fail. Instead, we'll
  16201. # just grep the Entries lines:
  16202. dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
  16203. "/foo-b.c0/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16204. dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
  16205. "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16206. dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
  16207. "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
  16208. dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
  16209. "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
  16210. dotest binwrap3-top5 "grep foo-t.sb ./CVS/Entries" \
  16211. "/foo-t.sb/1.1.1.1/[A-Za-z0-9 :]*//"
  16212. dotest binwrap3-top6 "grep bar-t.c0 ./CVS/Entries" \
  16213. "/bar-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
  16214. dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
  16215. "/foo-b.c1/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16216. dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
  16217. "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16218. dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
  16219. "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
  16220. dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
  16221. "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
  16222. dotest binwrap3-sub1-5 "grep foo-t.sb sub1/CVS/Entries" \
  16223. "/foo-t.sb/1.1.1.1/[A-Za-z0-9 :]*//"
  16224. dotest binwrap3-sub1-6 "grep bar-t.c1 sub1/CVS/Entries" \
  16225. "/bar-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
  16226. dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
  16227. "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16228. dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
  16229. "/foo-b.st/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16230. dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
  16231. "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
  16232. dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
  16233. "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
  16234. dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
  16235. "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//"
  16236. dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
  16237. "/foo-t.c3/1.1.1.1/[A-Za-z0-9 :]*//"
  16238. dotest binwrap3-sub2-7 "grep foo-t.sb sub2/CVS/Entries" \
  16239. "/foo-t.sb/1.1.1.1/[A-Za-z0-9 :]*//"
  16240. dotest binwrap3-sub2-8 "grep bar-t.st sub2/CVS/Entries" \
  16241. "/bar-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
  16242. dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
  16243. "/foo-b.c3/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16244. dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
  16245. "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
  16246. dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
  16247. "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
  16248. dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
  16249. "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
  16250. dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
  16251. "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//"
  16252. dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
  16253. "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
  16254. dotest binwrap3-subsub7 "grep foo-t.sb sub2/subsub/CVS/Entries" \
  16255. "/foo-t.sb/1.1.1.1/[A-Za-z0-9 :]*//"
  16256. dotest binwrap3-subsub8 "grep bar-t.c3 sub2/subsub/CVS/Entries" \
  16257. "/bar-t.c3/1.1.1.1/[A-Za-z0-9 :]*//"
  16258. dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
  16259. "/file1.newbin/1.1/[A-Za-z0-9 :]*/-kb/"
  16260. dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
  16261. "/file1.txt/1.1/[A-Za-z0-9 :]*//"
  16262. # Restore and clean up
  16263. cd ..
  16264. rm -r binwrap3 CVSROOT
  16265. cd ..
  16266. rm -r wnt
  16267. rm -rf ${CVSROOT_DIRNAME}/binwrap3
  16268. CVSWRAPPERS=${CVSWRAPPERS_save}
  16269. ;;
  16270. mwrap)
  16271. # Tests of various wrappers features:
  16272. # -m 'COPY' and cvs update: mwrap
  16273. # -m 'COPY' and joining: mcopy
  16274. # -k: binwrap, binwrap2
  16275. # -t/-f: hasn't been written yet.
  16276. #
  16277. # Tests of different ways of specifying wrappers:
  16278. # CVSROOT/cvswrappers: mwrap
  16279. # -W: binwrap, binwrap2
  16280. # .cvswrappers in working directory, local: mcopy
  16281. # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
  16282. # CVSWRAPPERS environment variable: mcopy
  16283. # This test is similar to binfiles-con1; -m 'COPY' specifies
  16284. # non-mergeableness the same way that -kb does.
  16285. # On Windows, we can't check out CVSROOT, because the case
  16286. # insensitivity means that this conflicts with cvsroot.
  16287. mkdir wnt
  16288. cd wnt
  16289. dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
  16290. cd CVSROOT
  16291. echo "* -m 'COPY'" >>cvswrappers
  16292. dotest mwrap-c2 "${testcvs} -q ci -m wrapper-mod" \
  16293. "Checking in cvswrappers;
  16294. ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v <-- cvswrappers
  16295. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16296. done
  16297. ${PROG} commit: Rebuilding administrative file database"
  16298. cd ..
  16299. mkdir m1; cd m1
  16300. dotest mwrap-1 "${testcvs} -q co -l ." ''
  16301. mkdir first-dir
  16302. dotest mwrap-2 "${testcvs} add first-dir" \
  16303. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  16304. cd first-dir
  16305. touch aa
  16306. dotest mwrap-3 "${testcvs} add aa" \
  16307. "${PROG} add: scheduling file .aa. for addition
  16308. ${PROG} add: use .${PROG} commit. to add this file permanently"
  16309. dotest mwrap-4 "${testcvs} -q ci -m add" \
  16310. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
  16311. done
  16312. Checking in aa;
  16313. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  16314. initial revision: 1\.1
  16315. done"
  16316. cd ../..
  16317. mkdir m2; cd m2
  16318. dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
  16319. cd first-dir
  16320. echo "changed in m2" >aa
  16321. dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
  16322. "Checking in aa;
  16323. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  16324. new revision: 1\.2; previous revision: 1\.1
  16325. done"
  16326. cd ../..
  16327. cd m1/first-dir
  16328. echo "changed in m1" >aa
  16329. dotest mwrap-7 "$testcvs -nq update" \
  16330. "${PROG} update: nonmergeable file needs merge
  16331. ${PROG} update: revision 1\.2 from repository is now in aa
  16332. ${PROG} update: file from working directory is now in \.#aa\.1\.1
  16333. C aa"
  16334. dotest mwrap-8 "${testcvs} -q update" \
  16335. "$PROG update: nonmergeable file needs merge
  16336. ${PROG} update: revision 1\.2 from repository is now in aa
  16337. ${PROG} update: file from working directory is now in \.#aa\.1\.1
  16338. C aa"
  16339. dotest mwrap-9 "cat aa" "changed in m2"
  16340. dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
  16341. cd ../..
  16342. cd CVSROOT
  16343. echo '# comment out' >cvswrappers
  16344. dotest mwrap-ce "${testcvs} -q ci -m wrapper-mod" \
  16345. "Checking in cvswrappers;
  16346. ${CVSROOT_DIRNAME}/CVSROOT/cvswrappers,v <-- cvswrappers
  16347. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16348. done
  16349. ${PROG} commit: Rebuilding administrative file database"
  16350. cd ..
  16351. rm -r CVSROOT
  16352. rm -r m1 m2
  16353. cd ..
  16354. rm -r wnt
  16355. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16356. ;;
  16357. info)
  16358. # Administrative file tests.
  16359. # Here is a list of where each administrative file is tested:
  16360. # loginfo: info
  16361. # modules: modules, modules2, modules3
  16362. # cvsignore: ignore
  16363. # verifymsg: info
  16364. # cvswrappers: mwrap
  16365. # taginfo: taginfo
  16366. # config: config
  16367. # On Windows, we can't check out CVSROOT, because the case
  16368. # insensitivity means that this conflicts with cvsroot.
  16369. mkdir wnt
  16370. cd wnt
  16371. dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
  16372. cd CVSROOT
  16373. rm -f $TESTDIR/testlog $TESTDIR/testlog2
  16374. echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
  16375. # The following cases test the format string substitution
  16376. echo "ALL echo %{sVv} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
  16377. echo "ALL echo %{v} >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
  16378. echo "ALL echo %s >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
  16379. echo "ALL echo %{V}AX >>$TESTDIR/testlog2; cat >/dev/null" >> loginfo
  16380. echo "first-dir echo %sux >>$TESTDIR/testlog2; cat >/dev/null" \
  16381. >> loginfo
  16382. # Might be nice to move this to crerepos tests; it should
  16383. # work to create a loginfo file if you didn't create one
  16384. # with "cvs init".
  16385. : dotest info-2 "${testcvs} add loginfo" \
  16386. "${PROG}"' add: scheduling file `loginfo'"'"' for addition
  16387. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  16388. dotest info-3 "${testcvs} -q ci -m new-loginfo" \
  16389. "Checking in loginfo;
  16390. ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v <-- loginfo
  16391. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16392. done
  16393. ${PROG} commit: Rebuilding administrative file database"
  16394. cd ..
  16395. mkdir ${CVSROOT_DIRNAME}/first-dir
  16396. dotest info-5 "${testcvs} -q co first-dir" ''
  16397. cd first-dir
  16398. touch file1
  16399. dotest info-6 "${testcvs} add file1" \
  16400. "${PROG}"' add: scheduling file `file1'\'' for addition
  16401. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  16402. echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
  16403. dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
  16404. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  16405. done
  16406. Checking in file1;
  16407. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16408. initial revision: 1\.1
  16409. done
  16410. ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
  16411. echo line0 >>file1
  16412. dotest info-6b "${testcvs} -q -sOTHER=foo ci -m mod-it" \
  16413. "Checking in file1;
  16414. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16415. new revision: 1\.2; previous revision: 1\.1
  16416. done
  16417. ${PROG} commit: loginfo:1: no such user variable \${=ZEE}"
  16418. echo line1 >>file1
  16419. dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
  16420. "Checking in file1;
  16421. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16422. new revision: 1\.3; previous revision: 1\.2
  16423. done"
  16424. cd ..
  16425. dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${CVSROOT_DIRNAME}="
  16426. dotest info-10 "cat $TESTDIR/testlog2" \
  16427. 'first-dir file1,NONE,1.1
  16428. first-dir 1.1
  16429. first-dir file1
  16430. first-dir NONEAX
  16431. first-dir file1ux
  16432. first-dir file1,1.1,1.2
  16433. first-dir 1.2
  16434. first-dir file1
  16435. first-dir 1.1AX
  16436. first-dir file1ux
  16437. first-dir file1,1.2,1.3
  16438. first-dir 1.3
  16439. first-dir file1
  16440. first-dir 1.2AX
  16441. first-dir file1ux'
  16442. cd CVSROOT
  16443. echo '# do nothing' >loginfo
  16444. dotest info-11 "${testcvs} -q -s ZEE=garbage ci -m nuke-loginfo" \
  16445. "Checking in loginfo;
  16446. ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v <-- loginfo
  16447. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16448. done
  16449. ${PROG} commit: Rebuilding administrative file database"
  16450. # Now test verifymsg
  16451. cat >${TESTDIR}/vscript <<EOF
  16452. #!${TESTSHELL}
  16453. if sed 1q < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
  16454. exit 0
  16455. elif sed 1q < \$1 | grep '^BugId:[ ]*new$' > /dev/null; then
  16456. echo A new bugid was found. >> \$1
  16457. exit 0
  16458. else
  16459. echo "No BugId found."
  16460. sleep 1
  16461. exit 1
  16462. fi
  16463. EOF
  16464. cat >${TESTDIR}/vscript2 <<EOF
  16465. #!${TESTSHELL}
  16466. if test -f CVS/Repository; then
  16467. repo=\`cat CVS/Repository\`
  16468. else
  16469. repo=\`pwd\`
  16470. fi
  16471. echo \$repo
  16472. if echo "\$repo" |grep yet-another/ >/dev/null 2>&1; then
  16473. exit 1
  16474. else
  16475. exit 0
  16476. fi
  16477. EOF
  16478. # Grumble, grumble, mumble, search for "Cygwin".
  16479. if test -n "$remotehost"; then
  16480. $CVS_RSH $remotehost "chmod +x ${TESTDIR}/vscript*"
  16481. else
  16482. chmod +x ${TESTDIR}/vscript*
  16483. fi
  16484. echo "^first-dir/yet-another\\(/\\|\$\\) ${TESTDIR}/vscript2" >>verifymsg
  16485. echo "^first-dir\\(/\\|\$\\) ${TESTDIR}/vscript" >>verifymsg
  16486. echo "^missing-script\$ ${TESTDIR}/bogus" >>verifymsg
  16487. echo "^missing-var\$ ${TESTDIR}/vscript \${=Bogus}" >>verifymsg
  16488. # first test the directory independant verifymsg
  16489. dotest info-v1 "${testcvs} -q ci -m add-verification" \
  16490. "Checking in verifymsg;
  16491. ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v <-- verifymsg
  16492. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16493. done
  16494. ${PROG} commit: Rebuilding administrative file database"
  16495. cd ../first-dir
  16496. echo line2 >>file1
  16497. dotest_fail info-v2 "${testcvs} -q ci -m bogus" \
  16498. "No BugId found\.
  16499. ${PROG} \[commit aborted\]: Message verification failed"
  16500. cat >${TESTDIR}/comment.tmp <<EOF
  16501. BugId: 42
  16502. and many more lines after it
  16503. EOF
  16504. dotest info-v3 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
  16505. "Checking in file1;
  16506. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16507. new revision: 1\.4; previous revision: 1\.3
  16508. done"
  16509. rm ${TESTDIR}/comment.tmp
  16510. cd ..
  16511. mkdir another-dir
  16512. cd another-dir
  16513. touch file2
  16514. dotest_fail info-v4 \
  16515. "${testcvs} import -m bogus first-dir/another x y" \
  16516. "No BugId found\.
  16517. ${PROG} \[import aborted\]: Message verification failed"
  16518. # now verify that directory dependent verifymsgs work
  16519. dotest info-v5 \
  16520. "${testcvs} import -m bogus first-dir/yet-another x y" \
  16521. "${TESTDIR}/wnt/another-dir
  16522. N first-dir/yet-another/file2
  16523. No conflicts created by this import" \
  16524. "${CVSROOT_DIRNAME}/first-dir/yet-another
  16525. N first-dir/yet-another/file2
  16526. No conflicts created by this import"
  16527. # FIXMECVS
  16528. #
  16529. # note that in the local case the error message is the same as
  16530. # info-v5
  16531. #
  16532. # This means that the verifymsg scripts cannot reliably and
  16533. # consistantly obtain information on which directory is being
  16534. # committed to. Thus it is currently useless for them to be
  16535. # running in every dir. They should either be run once or
  16536. # directory information should be passed.
  16537. if $remote; then
  16538. dotest_fail info-v6r \
  16539. "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
  16540. "${CVSROOT_DIRNAME}/first-dir/yet-another/and-another
  16541. ${PROG} \[import aborted\]: Message verification failed"
  16542. else
  16543. dotest info-v6 \
  16544. "${testcvs} import -m bogus first-dir/yet-another/and-another x y" \
  16545. "${TESTDIR}/wnt/another-dir
  16546. N first-dir/yet-another/and-another/file2
  16547. No conflicts created by this import"
  16548. fi
  16549. # check that errors invoking the script cause verification failure
  16550. #
  16551. # The second text below occurs on Cygwin, where I assume execvp
  16552. # does not return to let CVS print the error message when its
  16553. # argument does not exist.
  16554. dotest_fail info-v7 "${testcvs} import -m bogus missing-script x y" \
  16555. "${PROG} import: cannot exec ${TESTDIR}/bogus: No such file or directory
  16556. ${PROG} \[import aborted\]: Message verification failed" \
  16557. "${PROG} \[import aborted\]: Message verification failed"
  16558. dotest_fail info-v8 "${testcvs} import -m bogus missing-var x y" \
  16559. "${PROG} import: verifymsg:25: no such user variable \${=Bogus}
  16560. ${PROG} \[import aborted\]: Message verification failed"
  16561. rm file2
  16562. cd ..
  16563. rmdir another-dir
  16564. cd CVSROOT
  16565. echo "RereadLogAfterVerify=always" >>config
  16566. dotest info-rereadlog-1 "${testcvs} -q ci -m add-RereadLogAfterVerify=always" \
  16567. "Checking in config;
  16568. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16569. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16570. done
  16571. ${PROG} commit: Rebuilding administrative file database"
  16572. cd ../first-dir
  16573. echo line3 >>file1
  16574. cat >${TESTDIR}/comment.tmp <<EOF
  16575. BugId: new
  16576. See what happens next.
  16577. EOF
  16578. dotest info-reread-2 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
  16579. "Checking in file1;
  16580. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16581. new revision: 1\.5; previous revision: 1\.4
  16582. done"
  16583. dotest info-reread-3 "${testcvs} -q log -N -r1.5 file1" "
  16584. .*
  16585. BugId: new
  16586. See what happens next.
  16587. A new bugid was found.
  16588. ============================================================================="
  16589. cd ../CVSROOT
  16590. grep -v "RereadLogAfterVerify" config > config.new
  16591. mv config.new config
  16592. echo "RereadLogAfterVerify=stat" >>config
  16593. dotest info-reread-4 "${testcvs} -q ci -m add-RereadLogAfterVerify=stat" \
  16594. "Checking in config;
  16595. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16596. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16597. done
  16598. ${PROG} commit: Rebuilding administrative file database"
  16599. cd ../first-dir
  16600. echo line4 >>file1
  16601. cat >${TESTDIR}/comment.tmp <<EOF
  16602. BugId: new
  16603. See what happens next with stat.
  16604. EOF
  16605. dotest info-reread-5 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
  16606. "Checking in file1;
  16607. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16608. new revision: 1\.6; previous revision: 1\.5
  16609. done"
  16610. dotest info-reread-6 "${testcvs} -q log -N -r1.6 file1" "
  16611. .*
  16612. BugId: new
  16613. See what happens next with stat.
  16614. A new bugid was found.
  16615. ============================================================================="
  16616. cd ../CVSROOT
  16617. grep -v "RereadLogAfterVerify" config > config.new
  16618. mv config.new config
  16619. echo "RereadLogAfterVerify=never" >>config
  16620. dotest info-reread-7 "${testcvs} -q ci -m add-RereadLogAfterVerify=never" \
  16621. "Checking in config;
  16622. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16623. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16624. done
  16625. ${PROG} commit: Rebuilding administrative file database"
  16626. cd ../first-dir
  16627. echo line5 >>file1
  16628. cat >${TESTDIR}/comment.tmp <<EOF
  16629. BugId: new
  16630. See what happens next.
  16631. EOF
  16632. dotest info-reread-8 "${testcvs} -q ci -F ${TESTDIR}/comment.tmp" \
  16633. "Checking in file1;
  16634. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16635. new revision: 1\.7; previous revision: 1\.6
  16636. done"
  16637. dotest info-reread-6 "${testcvs} -q log -N -r1.7 file1" "
  16638. .*
  16639. BugId: new
  16640. See what happens next.
  16641. ============================================================================="
  16642. cd ../CVSROOT
  16643. echo 'DEFAULT false' >verifymsg
  16644. echo 'DEFAULT true' >>verifymsg
  16645. echo '# defaults' >config
  16646. dotest info-multdef "${testcvs} -q ci -m multdef" \
  16647. "Checking in config;
  16648. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16649. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16650. done
  16651. Checking in verifymsg;
  16652. ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v <-- verifymsg
  16653. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16654. done
  16655. ${PROG} commit: Rebuilding administrative file database"
  16656. cd ../CVSROOT
  16657. echo '# do nothing' >verifymsg
  16658. dotest info-cleanup-verifymsg "${testcvs} -q ci -m nuke-verifymsg" \
  16659. "${PROG} commit: Multiple .DEFAULT. lines (1 and 2) in verifymsg file
  16660. Checking in verifymsg;
  16661. ${CVSROOT_DIRNAME}/CVSROOT/verifymsg,v <-- verifymsg
  16662. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16663. done
  16664. ${PROG} commit: Rebuilding administrative file database"
  16665. rm ${TESTDIR}/vscript*
  16666. cd ..
  16667. dotest_fail info-cleanup-0 "${testcvs} -n release -d CVSROOT" \
  16668. "${PROG} \[release aborted\]: cannot run command ${DOTSTAR}"
  16669. if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  16670. pass info-cleanup
  16671. else
  16672. fail info-cleanup
  16673. fi
  16674. if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
  16675. pass info-cleanup-2
  16676. else
  16677. fail info-cleanup-2
  16678. fi
  16679. cd ..
  16680. rm -r wnt
  16681. rm $HOME/.cvsrc
  16682. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16683. ;;
  16684. taginfo)
  16685. # Tests of the CVSROOT/taginfo file. See the comment at the
  16686. # "info" tests for a full list of administrative file tests.
  16687. # Tests to add:
  16688. # -F to move
  16689. mkdir 1; cd 1
  16690. dotest taginfo-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
  16691. cd CVSROOT
  16692. cat >${TESTDIR}/1/loggit <<EOF
  16693. #!${TESTSHELL}
  16694. if test "\$1" = rejectme; then
  16695. exit 1
  16696. else
  16697. echo "\$@" >>${TESTDIR}/1/taglog
  16698. exit 0
  16699. fi
  16700. EOF
  16701. # #^@&!^@ Cygwin.
  16702. if test -n "$remotehost"; then
  16703. $CVS_RSH $remotehost "chmod +x ${TESTDIR}/1/loggit"
  16704. else
  16705. chmod +x ${TESTDIR}/1/loggit
  16706. fi
  16707. echo "ALL ${TESTDIR}/1/loggit" >taginfo
  16708. dotest taginfo-2 "${testcvs} -q ci -m check-in-taginfo" \
  16709. "Checking in taginfo;
  16710. ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v <-- taginfo
  16711. new revision: 1\.2; previous revision: 1\.1
  16712. done
  16713. ${PROG} commit: Rebuilding administrative file database"
  16714. cd ..
  16715. # taginfo-3 used to rely on the top-level CVS directory
  16716. # being created to add "first-dir" to the repository. Since
  16717. # that won't happen anymore, we create the directory in the
  16718. # repository.
  16719. mkdir ${CVSROOT_DIRNAME}/first-dir
  16720. dotest taginfo-3 "${testcvs} -q co first-dir" ''
  16721. cd first-dir
  16722. echo first >file1
  16723. dotest taginfo-4 "${testcvs} add file1" \
  16724. "${PROG} add: scheduling file .file1. for addition
  16725. ${PROG} add: use .${PROG} commit. to add this file permanently"
  16726. dotest taginfo-5 "${testcvs} -q ci -m add-it" \
  16727. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  16728. done
  16729. Checking in file1;
  16730. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16731. initial revision: 1\.1
  16732. done"
  16733. dotest taginfo-6 "${testcvs} -q tag tag1" "T file1"
  16734. dotest taginfo-7 "${testcvs} -q tag -b br" "T file1"
  16735. dotest taginfo-8 "$testcvs -q update -r br" '[UP] file1'
  16736. echo add text on branch >>file1
  16737. dotest taginfo-9 "${testcvs} -q ci -m modify-on-br" \
  16738. "Checking in file1;
  16739. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16740. new revision: 1\.1\.2\.1; previous revision: 1\.1
  16741. done"
  16742. dotest taginfo-10 "${testcvs} -q tag -F -c brtag" "T file1"
  16743. dotest_fail taginfo-11 "${testcvs} -q tag rejectme" \
  16744. "${PROG} tag: Pre-tag check failed
  16745. ${PROG} \[tag aborted\]: correct the above errors first!"
  16746. # When we are using taginfo to allow/disallow, it would be
  16747. # convenient to be able to use "cvs -n tag" to test whether
  16748. # the allow/disallow functionality is working as expected.
  16749. dotest taginfo-12 "${testcvs} -nq tag rejectme" "T file1"
  16750. # But when taginfo is used for logging, it is a pain for -n
  16751. # to call taginfo, since taginfo doesn't know whether -n was
  16752. # specified or not.
  16753. dotest taginfo-13 "${testcvs} -nq tag would-be-tag" "T file1"
  16754. # Deleting: the cases are basically either the tag existed,
  16755. # or it didn't exist.
  16756. dotest taginfo-14 "${testcvs} -q tag -d tag1" "D file1"
  16757. dotest taginfo-15 "${testcvs} -q tag -d tag1" ""
  16758. # Likewise with rtag.
  16759. dotest taginfo-16 "${testcvs} -q rtag tag1 first-dir" ""
  16760. dotest taginfo-17 "${testcvs} -q rtag -d tag1 first-dir" ""
  16761. dotest taginfo-18 "${testcvs} -q rtag -d tag1 first-dir" ""
  16762. # The "br" example should be passing 1.1.2 or 1.1.0.2.
  16763. # But it turns out that is very hard to implement, since
  16764. # check_fileproc doesn't know what branch number it will
  16765. # get. Probably the whole thing should be re-architected
  16766. # so that taginfo only allows/denies tagging, and a new
  16767. # hook, which is done from tag_fileproc, does logging.
  16768. # That would solve this, some more subtle races, and also
  16769. # the fact that it is nice for users to run "-n tag foo" to
  16770. # see whether a tag would be allowed. Failing that,
  16771. # I suppose passing "1.1.branch" or "branch" for "br"
  16772. # would be an improvement.
  16773. dotest taginfo-examine "cat ${TESTDIR}/1/taglog" \
  16774. "tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
  16775. br add ${CVSROOT_DIRNAME}/first-dir file1 1.1
  16776. brtag mov ${CVSROOT_DIRNAME}/first-dir file1 1.1.2.1
  16777. tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
  16778. tag1 del ${CVSROOT_DIRNAME}/first-dir
  16779. tag1 add ${CVSROOT_DIRNAME}/first-dir file1 1.1
  16780. tag1 del ${CVSROOT_DIRNAME}/first-dir file1 1.1
  16781. tag1 del ${CVSROOT_DIRNAME}/first-dir"
  16782. cd ..
  16783. cd CVSROOT
  16784. echo '# Keep life simple' > taginfo
  16785. dotest taginfo-cleanup-1 "${testcvs} -q ci -m check-in-taginfo" \
  16786. "Checking in taginfo;
  16787. ${CVSROOT_DIRNAME}/CVSROOT/taginfo,v <-- taginfo
  16788. new revision: 1\.3; previous revision: 1\.2
  16789. done
  16790. ${PROG} commit: Rebuilding administrative file database"
  16791. cd ..
  16792. cd ..
  16793. rm -r 1
  16794. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16795. ;;
  16796. config)
  16797. # Tests of the CVSROOT/config file. See the comment at the
  16798. # "info" tests for a full list of administrative file tests.
  16799. # On Windows, we can't check out CVSROOT, because the case
  16800. # insensitivity means that this conflicts with cvsroot.
  16801. mkdir wnt
  16802. cd wnt
  16803. dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
  16804. cd CVSROOT
  16805. echo 'bogus line' >config
  16806. # We can't rely on specific revisions, since other tests
  16807. # might need to modify CVSROOT/config
  16808. dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
  16809. "Checking in config;
  16810. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16811. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16812. done
  16813. ${PROG} commit: Rebuilding administrative file database"
  16814. echo 'BogusOption=yes' >config
  16815. dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
  16816. "${PROG} [a-z]*: syntax error in ${CVSROOT_DIRNAME}/CVSROOT/config: line 'bogus line' is missing '='
  16817. Checking in config;
  16818. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16819. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16820. done
  16821. ${PROG} commit: Rebuilding administrative file database"
  16822. echo '# No config is a good config' > config
  16823. dotest config-5 "${testcvs} -q ci -m change-to-comment" \
  16824. "${PROG} [a-z]*: ${CVSROOT_DIRNAME}/CVSROOT/config: unrecognized keyword 'BogusOption'
  16825. Checking in config;
  16826. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16827. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16828. done
  16829. ${PROG} commit: Rebuilding administrative file database"
  16830. dotest config-6 "${testcvs} -q update" ''
  16831. echo 'IgnoreUnknownConfigKeys=yes' > config
  16832. echo 'BogusOption=yes' >> config
  16833. dotest config-7 "${testcvs} -q ci -m change-to-comment" \
  16834. "Checking in config;
  16835. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16836. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16837. done
  16838. ${PROG} commit: Rebuilding administrative file database"
  16839. dotest config-8 "${testcvs} -q update" ''
  16840. echo '# No config is a good config' > config
  16841. dotest config-9 "${testcvs} -q ci -m change-to-comment" \
  16842. "Checking in config;
  16843. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  16844. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  16845. done
  16846. ${PROG} commit: Rebuilding administrative file database"
  16847. dotest config-10 "${testcvs} -q update" ''
  16848. cd ..
  16849. rm -r CVSROOT
  16850. cd ..
  16851. rm -r wnt
  16852. ;;
  16853. serverpatch)
  16854. # Test remote CVS handling of unpatchable files. This isn't
  16855. # much of a test for local CVS.
  16856. # We test this with some keyword expansion games, but the situation
  16857. # also arises if the user modifies the file while CVS is running.
  16858. mkdir ${CVSROOT_DIRNAME}/first-dir
  16859. mkdir 1
  16860. cd 1
  16861. dotest serverpatch-1 "${testcvs} -q co first-dir" ''
  16862. cd first-dir
  16863. # Add a file with an RCS keyword.
  16864. echo '$''Name$' > file1
  16865. echo '1' >> file1
  16866. dotest serverpatch-2 "${testcvs} add file1" \
  16867. "${PROG}"' add: scheduling file `file1'\'' for addition
  16868. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  16869. dotest serverpatch-3 "${testcvs} -q commit -m add" \
  16870. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  16871. done
  16872. Checking in file1;
  16873. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16874. initial revision: 1\.1
  16875. done"
  16876. # Tag the file.
  16877. dotest serverpatch-4 "${testcvs} -q tag tag file1" 'T file1'
  16878. # Check out a tagged copy of the file.
  16879. cd ../..
  16880. mkdir 2
  16881. cd 2
  16882. dotest serverpatch-5 "${testcvs} -q co -r tag first-dir" \
  16883. 'U first-dir/file1'
  16884. # Remove the tag. Prior to 1.11.23, this left the tag string in the
  16885. # expansion of the Name keyword.
  16886. dotest serverpatch-6 "$testcvs -q update -A first-dir" \
  16887. 'U first-dir/file1'
  16888. # Modify and check in the first copy.
  16889. cd ../1/first-dir
  16890. echo '2' >> file1
  16891. dotest serverpatch-7 "${testcvs} -q ci -mx file1" \
  16892. "Checking in file1;
  16893. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16894. new revision: 1\.2; previous revision: 1\.1
  16895. done"
  16896. # Now update the second copy. Prior to 1.11.23, the patch would fail
  16897. # using remote CVS, forcing the file to be refetched.
  16898. cd ../../2/first-dir
  16899. dotest serverpatch-8 "${testcvs} -q update" \
  16900. '[UP] file1'
  16901. cd ../..
  16902. rm -r 1 2
  16903. rm -rf ${CVSROOT_DIRNAME}/first-dir
  16904. ;;
  16905. log)
  16906. # Test selecting revisions with cvs log.
  16907. # See also log2 tests for more tests.
  16908. # See also branches-14.3 for logging with a branch off of a branch.
  16909. # See also multibranch-14 for logging with several branches off the
  16910. # same branchpoint.
  16911. # Tests of each option to cvs log:
  16912. # -h: admin-19a-log
  16913. # -N: log, log2, admin-19a-log
  16914. # -b, -r: log
  16915. # -d: logopt, rcs
  16916. # -s: logopt, rcs3
  16917. # -R: logopt, rcs3
  16918. # -w, -t: not tested yet (TODO)
  16919. # Check in a file with a few revisions and branches.
  16920. mkdir ${CVSROOT_DIRNAME}/first-dir
  16921. dotest log-1 "${testcvs} -q co first-dir" ''
  16922. cd first-dir
  16923. echo 'first revision' > file1
  16924. echo 'first revision' > file2
  16925. dotest log-2 "${testcvs} add file1 file2" \
  16926. "${PROG} add: scheduling file .file1. for addition
  16927. ${PROG} add: scheduling file .file2. for addition
  16928. ${PROG} add: use .${PROG} commit. to add these files permanently"
  16929. # While we're at it, check multi-line comments, input from file,
  16930. # and trailing whitespace trimming
  16931. echo 'line 1 ' >${TESTDIR}/comment.tmp
  16932. echo ' ' >>${TESTDIR}/comment.tmp
  16933. echo 'line 2 ' >>${TESTDIR}/comment.tmp
  16934. echo ' ' >>${TESTDIR}/comment.tmp
  16935. echo ' ' >>${TESTDIR}/comment.tmp
  16936. dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
  16937. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  16938. done
  16939. Checking in file1;
  16940. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16941. initial revision: 1\.1
  16942. done
  16943. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  16944. done
  16945. Checking in file2;
  16946. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  16947. initial revision: 1\.1
  16948. done"
  16949. rm -f ${TESTDIR}/comment.tmp
  16950. echo 'second revision' > file1
  16951. echo 'second revision' > file2
  16952. dotest log-4 "${testcvs} -q ci -m2 file1 file2" \
  16953. "Checking in file1;
  16954. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16955. new revision: 1\.2; previous revision: 1\.1
  16956. done
  16957. Checking in file2;
  16958. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  16959. new revision: 1\.2; previous revision: 1\.1
  16960. done"
  16961. dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
  16962. dotest log-5a "${testcvs} -q tag tag1 file2" 'T file2'
  16963. echo 'third revision' > file1
  16964. echo 'third revision' > file2
  16965. dotest log-6 "${testcvs} -q ci -m3 file1 file2" \
  16966. "Checking in file1;
  16967. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16968. new revision: 1\.3; previous revision: 1\.2
  16969. done
  16970. Checking in file2;
  16971. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  16972. new revision: 1\.3; previous revision: 1\.2
  16973. done"
  16974. dotest log-6a "${testcvs} -q tag tag2 file2" 'T file2'
  16975. dotest log-7 "${testcvs} -q update -r branch" \
  16976. "[UP] file1
  16977. ${PROG} update: file2 is no longer in the repository"
  16978. echo 'first branch revision' > file1
  16979. dotest log-8 "${testcvs} -q ci -m1b file1" \
  16980. "Checking in file1;
  16981. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16982. new revision: 1\.2\.2\.1; previous revision: 1\.2
  16983. done"
  16984. dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
  16985. echo 'second branch revision' > file1
  16986. dotest log-10 "${testcvs} -q ci -m2b file1" \
  16987. "Checking in file1;
  16988. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  16989. new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
  16990. done"
  16991. # Set up a bunch of shell variables to make the later tests
  16992. # easier to describe.=
  16993. log_header1="
  16994. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  16995. Working file: file1
  16996. head: 1\.3
  16997. branch:
  16998. locks: strict
  16999. access list:"
  17000. rlog_header1="
  17001. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17002. head: 1\.3
  17003. branch:
  17004. locks: strict
  17005. access list:"
  17006. log_tags1='symbolic names:
  17007. tag: 1\.2\.2\.1
  17008. branch: 1\.2\.0\.2'
  17009. log_keyword='keyword substitution: kv'
  17010. log_dash='----------------------------
  17011. revision'
  17012. log_date="date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;"
  17013. log_lines=" lines: ${PLUS}1 -1"
  17014. log_rev1="${log_dash} 1\.1
  17015. ${log_date}
  17016. line 1
  17017. line 2"
  17018. log_rev2="${log_dash} 1\.2
  17019. ${log_date}${log_lines}
  17020. branches: 1\.2\.2;
  17021. 2"
  17022. log_rev3="${log_dash} 1\.3
  17023. ${log_date}${log_lines}
  17024. 3"
  17025. log_rev1b="${log_dash} 1\.2\.2\.1
  17026. ${log_date}${log_lines}
  17027. 1b"
  17028. log_rev2b="${log_dash} 1\.2\.2\.2
  17029. ${log_date}${log_lines}
  17030. 2b"
  17031. log_trailer='============================================================================='
  17032. # Now, finally, test the log output.
  17033. dotest log-11 "${testcvs} log file1" \
  17034. "${log_header1}
  17035. ${log_tags1}
  17036. ${log_keyword}
  17037. total revisions: 5; selected revisions: 5
  17038. description:
  17039. ${log_rev3}
  17040. ${log_rev2}
  17041. ${log_rev1}
  17042. ${log_rev2b}
  17043. ${log_rev1b}
  17044. ${log_trailer}"
  17045. dotest log-12 "${testcvs} log -N file1" \
  17046. "${log_header1}
  17047. ${log_keyword}
  17048. total revisions: 5; selected revisions: 5
  17049. description:
  17050. ${log_rev3}
  17051. ${log_rev2}
  17052. ${log_rev1}
  17053. ${log_rev2b}
  17054. ${log_rev1b}
  17055. ${log_trailer}"
  17056. dotest log-13 "${testcvs} log -b file1" \
  17057. "${log_header1}
  17058. ${log_tags1}
  17059. ${log_keyword}
  17060. total revisions: 5; selected revisions: 3
  17061. description:
  17062. ${log_rev3}
  17063. ${log_rev2}
  17064. ${log_rev1}
  17065. ${log_trailer}"
  17066. dotest log-14 "${testcvs} log -r file1" \
  17067. "${log_header1}
  17068. ${log_tags1}
  17069. ${log_keyword}
  17070. total revisions: 5; selected revisions: 1
  17071. description:
  17072. ${log_rev3}
  17073. ${log_trailer}"
  17074. dotest log-14a "${testcvs} log -rHEAD file1" \
  17075. "${log_header1}
  17076. ${log_tags1}
  17077. ${log_keyword}
  17078. total revisions: 5; selected revisions: 1
  17079. description:
  17080. ${log_rev3}
  17081. ${log_trailer}"
  17082. # The user might not realize that "-r" must not take a space.
  17083. # In the error message, HEAD is a file name, not a tag name (which
  17084. # might be confusing itself).
  17085. dotest_fail log-14b "${testcvs} log -r HEAD file1" \
  17086. "${PROG} log: nothing known about HEAD
  17087. ${log_header1}
  17088. ${log_tags1}
  17089. ${log_keyword}
  17090. total revisions: 5; selected revisions: 1
  17091. description:
  17092. ${log_rev3}
  17093. ${log_trailer}"
  17094. # Check that unusual syntax works correctly.
  17095. dotest log-14c "${testcvs} log -r: file1" \
  17096. "${log_header1}
  17097. ${log_tags1}
  17098. ${log_keyword}
  17099. total revisions: 5; selected revisions: 1
  17100. description:
  17101. ${log_rev3}
  17102. ${log_trailer}"
  17103. dotest log-14d "${testcvs} log -r, file1" \
  17104. "${log_header1}
  17105. ${log_tags1}
  17106. ${log_keyword}
  17107. total revisions: 5; selected revisions: 1
  17108. description:
  17109. ${log_rev3}
  17110. ${log_trailer}"
  17111. dotest log-14e "${testcvs} log -r. file1" \
  17112. "${log_header1}
  17113. ${log_tags1}
  17114. ${log_keyword}
  17115. total revisions: 5; selected revisions: 1
  17116. description:
  17117. ${log_rev3}
  17118. ${log_trailer}"
  17119. dotest log-14f "${testcvs} log -r:: file1" \
  17120. "${log_header1}
  17121. ${log_tags1}
  17122. ${log_keyword}
  17123. total revisions: 5; selected revisions: 0
  17124. description:
  17125. ${log_trailer}"
  17126. dotest log-15 "${testcvs} log -r1.2 file1" \
  17127. "${log_header1}
  17128. ${log_tags1}
  17129. ${log_keyword}
  17130. total revisions: 5; selected revisions: 1
  17131. description:
  17132. ${log_rev2}
  17133. ${log_trailer}"
  17134. dotest log-16 "${testcvs} log -r1.2.2 file1" \
  17135. "${log_header1}
  17136. ${log_tags1}
  17137. ${log_keyword}
  17138. total revisions: 5; selected revisions: 2
  17139. description:
  17140. ${log_rev2b}
  17141. ${log_rev1b}
  17142. ${log_trailer}"
  17143. # This test would fail with the old invocation of rlog, but it
  17144. # works with the builtin log support.
  17145. dotest log-17 "${testcvs} log -rbranch file1" \
  17146. "${log_header1}
  17147. ${log_tags1}
  17148. ${log_keyword}
  17149. total revisions: 5; selected revisions: 2
  17150. description:
  17151. ${log_rev2b}
  17152. ${log_rev1b}
  17153. ${log_trailer}"
  17154. dotest log-18 "${testcvs} log -r1.2.2. file1" \
  17155. "${log_header1}
  17156. ${log_tags1}
  17157. ${log_keyword}
  17158. total revisions: 5; selected revisions: 1
  17159. description:
  17160. ${log_rev2b}
  17161. ${log_trailer}"
  17162. # Multiple -r options are undocumented; see comments in
  17163. # cvs.texinfo about whether they should be deprecated.
  17164. dotest log-18a "${testcvs} log -r1.2.2.2 -r1.3:1.3 file1" \
  17165. "${log_header1}
  17166. ${log_tags1}
  17167. ${log_keyword}
  17168. total revisions: 5; selected revisions: 2
  17169. description:
  17170. ${log_rev3}
  17171. ${log_rev2b}
  17172. ${log_trailer}"
  17173. # This test would fail with the old invocation of rlog, but it
  17174. # works with the builtin log support.
  17175. dotest log-19 "${testcvs} log -rbranch. file1" \
  17176. "${log_header1}
  17177. ${log_tags1}
  17178. ${log_keyword}
  17179. total revisions: 5; selected revisions: 1
  17180. description:
  17181. ${log_rev2b}
  17182. ${log_trailer}"
  17183. dotest log-20 "${testcvs} log -r1.2: file1" \
  17184. "${log_header1}
  17185. ${log_tags1}
  17186. ${log_keyword}
  17187. total revisions: 5; selected revisions: 2
  17188. description:
  17189. ${log_rev3}
  17190. ${log_rev2}
  17191. ${log_trailer}"
  17192. dotest log-20a "${testcvs} log -r1.2:: file1" \
  17193. "${log_header1}
  17194. ${log_tags1}
  17195. ${log_keyword}
  17196. total revisions: 5; selected revisions: 1
  17197. description:
  17198. ${log_rev3}
  17199. ${log_trailer}"
  17200. dotest log-21 "${testcvs} log -r:1.2 file1" \
  17201. "${log_header1}
  17202. ${log_tags1}
  17203. ${log_keyword}
  17204. total revisions: 5; selected revisions: 2
  17205. description:
  17206. ${log_rev2}
  17207. ${log_rev1}
  17208. ${log_trailer}"
  17209. dotest log-21a "${testcvs} log -r::1.2 file1" \
  17210. "${log_header1}
  17211. ${log_tags1}
  17212. ${log_keyword}
  17213. total revisions: 5; selected revisions: 2
  17214. description:
  17215. ${log_rev2}
  17216. ${log_rev1}
  17217. ${log_trailer}"
  17218. dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
  17219. "${log_header1}
  17220. ${log_tags1}
  17221. ${log_keyword}
  17222. total revisions: 5; selected revisions: 2
  17223. description:
  17224. ${log_rev2}
  17225. ${log_rev1}
  17226. ${log_trailer}"
  17227. dotest log-22a "${testcvs} log -r1.1::1.2 file1" \
  17228. "${log_header1}
  17229. ${log_tags1}
  17230. ${log_keyword}
  17231. total revisions: 5; selected revisions: 1
  17232. description:
  17233. ${log_rev2}
  17234. ${log_trailer}"
  17235. dotest log-22b "${testcvs} log -r1.1::1.3 file1" \
  17236. "${log_header1}
  17237. ${log_tags1}
  17238. ${log_keyword}
  17239. total revisions: 5; selected revisions: 2
  17240. description:
  17241. ${log_rev3}
  17242. ${log_rev2}
  17243. ${log_trailer}"
  17244. # Test BASE pseudotag
  17245. dotest log-23 "${testcvs} log -rBASE file1" \
  17246. "${log_header1}
  17247. ${log_tags1}
  17248. ${log_keyword}
  17249. total revisions: 5; selected revisions: 1
  17250. description:
  17251. ${log_rev2b}
  17252. ${log_trailer}"
  17253. dotest log-24 "${testcvs} -q up -r1.2 file1" "[UP] file1"
  17254. dotest log-25 "${testcvs} log -rBASE file1" \
  17255. "${log_header1}
  17256. ${log_tags1}
  17257. ${log_keyword}
  17258. total revisions: 5; selected revisions: 1
  17259. description:
  17260. ${log_rev2}
  17261. ${log_trailer}"
  17262. dotest log-26 "${testcvs} -q up -rbranch file1" "[UP] file1"
  17263. # Now the same tests but with rlog
  17264. dotest log-r11 "${testcvs} rlog first-dir/file1" \
  17265. "${rlog_header1}
  17266. ${log_tags1}
  17267. ${log_keyword}
  17268. total revisions: 5; selected revisions: 5
  17269. description:
  17270. ${log_rev3}
  17271. ${log_rev2}
  17272. ${log_rev1}
  17273. ${log_rev2b}
  17274. ${log_rev1b}
  17275. ${log_trailer}"
  17276. dotest log-r12 "${testcvs} rlog -N first-dir/file1" \
  17277. "${rlog_header1}
  17278. ${log_keyword}
  17279. total revisions: 5; selected revisions: 5
  17280. description:
  17281. ${log_rev3}
  17282. ${log_rev2}
  17283. ${log_rev1}
  17284. ${log_rev2b}
  17285. ${log_rev1b}
  17286. ${log_trailer}"
  17287. dotest log-r13 "${testcvs} rlog -b first-dir/file1" \
  17288. "${rlog_header1}
  17289. ${log_tags1}
  17290. ${log_keyword}
  17291. total revisions: 5; selected revisions: 3
  17292. description:
  17293. ${log_rev3}
  17294. ${log_rev2}
  17295. ${log_rev1}
  17296. ${log_trailer}"
  17297. dotest log-r14 "${testcvs} rlog -r first-dir/file1" \
  17298. "${rlog_header1}
  17299. ${log_tags1}
  17300. ${log_keyword}
  17301. total revisions: 5; selected revisions: 1
  17302. description:
  17303. ${log_rev3}
  17304. ${log_trailer}"
  17305. dotest log-r14a "${testcvs} rlog -rHEAD first-dir/file1" \
  17306. "${rlog_header1}
  17307. ${log_tags1}
  17308. ${log_keyword}
  17309. total revisions: 5; selected revisions: 1
  17310. description:
  17311. ${log_rev3}
  17312. ${log_trailer}"
  17313. dotest_fail log-r14b "${testcvs} rlog -r HEAD first-dir/file1" \
  17314. "${PROG} rlog: cannot find module .HEAD. - ignored
  17315. ${rlog_header1}
  17316. ${log_tags1}
  17317. ${log_keyword}
  17318. total revisions: 5; selected revisions: 1
  17319. description:
  17320. ${log_rev3}
  17321. ${log_trailer}"
  17322. dotest log-r14c "${testcvs} rlog -r: first-dir/file1" \
  17323. "${rlog_header1}
  17324. ${log_tags1}
  17325. ${log_keyword}
  17326. total revisions: 5; selected revisions: 1
  17327. description:
  17328. ${log_rev3}
  17329. ${log_trailer}"
  17330. dotest log-r14d "${testcvs} rlog -r, first-dir/file1" \
  17331. "${rlog_header1}
  17332. ${log_tags1}
  17333. ${log_keyword}
  17334. total revisions: 5; selected revisions: 1
  17335. description:
  17336. ${log_rev3}
  17337. ${log_trailer}"
  17338. dotest log-r14e "${testcvs} rlog -r. first-dir/file1" \
  17339. "${rlog_header1}
  17340. ${log_tags1}
  17341. ${log_keyword}
  17342. total revisions: 5; selected revisions: 1
  17343. description:
  17344. ${log_rev3}
  17345. ${log_trailer}"
  17346. dotest log-r14f "${testcvs} rlog -r:: first-dir/file1" \
  17347. "${rlog_header1}
  17348. ${log_tags1}
  17349. ${log_keyword}
  17350. total revisions: 5; selected revisions: 0
  17351. description:
  17352. ${log_trailer}"
  17353. dotest log-r15 "${testcvs} rlog -r1.2 first-dir/file1" \
  17354. "${rlog_header1}
  17355. ${log_tags1}
  17356. ${log_keyword}
  17357. total revisions: 5; selected revisions: 1
  17358. description:
  17359. ${log_rev2}
  17360. ${log_trailer}"
  17361. dotest log-r16 "${testcvs} rlog -r1.2.2 first-dir/file1" \
  17362. "${rlog_header1}
  17363. ${log_tags1}
  17364. ${log_keyword}
  17365. total revisions: 5; selected revisions: 2
  17366. description:
  17367. ${log_rev2b}
  17368. ${log_rev1b}
  17369. ${log_trailer}"
  17370. dotest log-r17 "${testcvs} rlog -rbranch first-dir/file1" \
  17371. "${rlog_header1}
  17372. ${log_tags1}
  17373. ${log_keyword}
  17374. total revisions: 5; selected revisions: 2
  17375. description:
  17376. ${log_rev2b}
  17377. ${log_rev1b}
  17378. ${log_trailer}"
  17379. dotest log-r18 "${testcvs} rlog -r1.2.2. first-dir/file1" \
  17380. "${rlog_header1}
  17381. ${log_tags1}
  17382. ${log_keyword}
  17383. total revisions: 5; selected revisions: 1
  17384. description:
  17385. ${log_rev2b}
  17386. ${log_trailer}"
  17387. dotest log-r18a "${testcvs} rlog -r1.2.2.2 -r1.3:1.3 first-dir/file1" \
  17388. "${rlog_header1}
  17389. ${log_tags1}
  17390. ${log_keyword}
  17391. total revisions: 5; selected revisions: 2
  17392. description:
  17393. ${log_rev3}
  17394. ${log_rev2b}
  17395. ${log_trailer}"
  17396. dotest log-r19 "${testcvs} rlog -rbranch. first-dir/file1" \
  17397. "${rlog_header1}
  17398. ${log_tags1}
  17399. ${log_keyword}
  17400. total revisions: 5; selected revisions: 1
  17401. description:
  17402. ${log_rev2b}
  17403. ${log_trailer}"
  17404. dotest log-r20 "${testcvs} rlog -r1.2: first-dir/file1" \
  17405. "${rlog_header1}
  17406. ${log_tags1}
  17407. ${log_keyword}
  17408. total revisions: 5; selected revisions: 2
  17409. description:
  17410. ${log_rev3}
  17411. ${log_rev2}
  17412. ${log_trailer}"
  17413. dotest log-r20a "${testcvs} rlog -r1.2:: first-dir/file1" \
  17414. "${rlog_header1}
  17415. ${log_tags1}
  17416. ${log_keyword}
  17417. total revisions: 5; selected revisions: 1
  17418. description:
  17419. ${log_rev3}
  17420. ${log_trailer}"
  17421. dotest log-r21 "${testcvs} rlog -r:1.2 first-dir/file1" \
  17422. "${rlog_header1}
  17423. ${log_tags1}
  17424. ${log_keyword}
  17425. total revisions: 5; selected revisions: 2
  17426. description:
  17427. ${log_rev2}
  17428. ${log_rev1}
  17429. ${log_trailer}"
  17430. dotest log-r21a "${testcvs} rlog -r::1.2 first-dir/file1" \
  17431. "${rlog_header1}
  17432. ${log_tags1}
  17433. ${log_keyword}
  17434. total revisions: 5; selected revisions: 2
  17435. description:
  17436. ${log_rev2}
  17437. ${log_rev1}
  17438. ${log_trailer}"
  17439. dotest log-r22 "${testcvs} rlog -r1.1:1.2 first-dir/file1" \
  17440. "${rlog_header1}
  17441. ${log_tags1}
  17442. ${log_keyword}
  17443. total revisions: 5; selected revisions: 2
  17444. description:
  17445. ${log_rev2}
  17446. ${log_rev1}
  17447. ${log_trailer}"
  17448. dotest log-r22a "${testcvs} rlog -r1.1::1.2 first-dir/file1" \
  17449. "${rlog_header1}
  17450. ${log_tags1}
  17451. ${log_keyword}
  17452. total revisions: 5; selected revisions: 1
  17453. description:
  17454. ${log_rev2}
  17455. ${log_trailer}"
  17456. dotest log-r22b "${testcvs} rlog -r1.1::1.3 first-dir/file1" \
  17457. "${rlog_header1}
  17458. ${log_tags1}
  17459. ${log_keyword}
  17460. total revisions: 5; selected revisions: 2
  17461. description:
  17462. ${log_rev3}
  17463. ${log_rev2}
  17464. ${log_trailer}"
  17465. # Test BASE pseudotag
  17466. dotest log-r23 "${testcvs} rlog -rBASE first-dir/file1" \
  17467. "${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v.
  17468. ${rlog_header1}
  17469. ${log_tags1}
  17470. ${log_keyword}
  17471. total revisions: 5; selected revisions: 0
  17472. description:
  17473. ${log_trailer}"
  17474. dotest log-r24 "${testcvs} -q up -r1.2 file1" "[UP] file1"
  17475. dotest log-r25 "${testcvs} rlog -rBASE first-dir/file1" \
  17476. "${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v.
  17477. ${rlog_header1}
  17478. ${log_tags1}
  17479. ${log_keyword}
  17480. total revisions: 5; selected revisions: 0
  17481. description:
  17482. ${log_trailer}"
  17483. # Test when head is dead
  17484. dotest log-d0 "${testcvs} -q up -A" \
  17485. "[UP] file1
  17486. U file2"
  17487. dotest log-d1 "${testcvs} -q rm -f file1" \
  17488. "${PROG} remove: use .${PROG} commit. to remove this file permanently"
  17489. dotest log-d2 "${testcvs} -q ci -m4" \
  17490. "Removing file1;
  17491. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  17492. new revision: delete; previous revision: 1\.3
  17493. done"
  17494. log_header1="
  17495. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17496. Working file: file1
  17497. head: 1\.4
  17498. branch:
  17499. locks: strict
  17500. access list:"
  17501. rlog_header1="
  17502. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17503. head: 1\.4
  17504. branch:
  17505. locks: strict
  17506. access list:"
  17507. log_header2="
  17508. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  17509. Working file: file2
  17510. head: 1\.3
  17511. branch:
  17512. locks: strict
  17513. access list:"
  17514. rlog_header2="
  17515. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  17516. head: 1\.3
  17517. branch:
  17518. locks: strict
  17519. access list:"
  17520. log_tags2='symbolic names:
  17521. tag2: 1\.3
  17522. tag1: 1\.2'
  17523. log_rev4="${log_dash} 1\.4
  17524. date: [0-9/]* [0-9:]*; author: ${username}; state: dead; lines: ${PLUS}0 -0
  17525. 4"
  17526. log_rev22="${log_dash} 1\.2
  17527. ${log_date}${log_lines}
  17528. 2"
  17529. dotest log-d3 "${testcvs} log -rbranch file1" \
  17530. "${log_header1}
  17531. ${log_tags1}
  17532. ${log_keyword}
  17533. total revisions: 6; selected revisions: 2
  17534. description:
  17535. ${log_rev2b}
  17536. ${log_rev1b}
  17537. ${log_trailer}"
  17538. dotest log-rd3 "${testcvs} rlog -rbranch first-dir/file1" \
  17539. "${rlog_header1}
  17540. ${log_tags1}
  17541. ${log_keyword}
  17542. total revisions: 6; selected revisions: 2
  17543. description:
  17544. ${log_rev2b}
  17545. ${log_rev1b}
  17546. ${log_trailer}"
  17547. dotest log-d4 "${testcvs} -q log -rbranch" \
  17548. "${log_header1}
  17549. ${log_tags1}
  17550. ${log_keyword}
  17551. total revisions: 6; selected revisions: 2
  17552. description:
  17553. ${log_rev2b}
  17554. ${log_rev1b}
  17555. ${log_trailer}
  17556. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17557. ${log_header2}
  17558. ${log_tags2}
  17559. ${log_keyword}
  17560. total revisions: 3; selected revisions: 0
  17561. description:
  17562. ${log_trailer}"
  17563. dotest log-d4a "${testcvs} -q log -t -rbranch" \
  17564. "${log_header1}
  17565. ${log_tags1}
  17566. ${log_keyword}
  17567. total revisions: 6
  17568. description:
  17569. ${log_trailer}
  17570. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17571. ${log_header2}
  17572. ${log_tags2}
  17573. ${log_keyword}
  17574. total revisions: 3
  17575. description:
  17576. ${log_trailer}"
  17577. dotest log-d4b "${testcvs} -q log -tS -rbranch" \
  17578. "${log_header1}
  17579. ${log_tags1}
  17580. ${log_keyword}
  17581. total revisions: 6; selected revisions: 2
  17582. description:
  17583. ${log_trailer}
  17584. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17585. dotest log-d4c "${testcvs} -q log -h -rbranch" \
  17586. "${log_header1}
  17587. ${log_tags1}
  17588. ${log_keyword}
  17589. total revisions: 6
  17590. ${log_trailer}
  17591. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17592. ${log_header2}
  17593. ${log_tags2}
  17594. ${log_keyword}
  17595. total revisions: 3
  17596. ${log_trailer}"
  17597. dotest log-d4d "${testcvs} -q log -hS -rbranch" \
  17598. "${log_header1}
  17599. ${log_tags1}
  17600. ${log_keyword}
  17601. total revisions: 6; selected revisions: 2
  17602. ${log_trailer}
  17603. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17604. dotest log-d4e "${testcvs} -q log -R -rbranch" \
  17605. "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17606. ${CVSROOT_DIRNAME}/first-dir/file2,v"
  17607. dotest log-d4f "${testcvs} -q log -R -S -rbranch" \
  17608. "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17609. ${PROG} log: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17610. dotest log-rd4 "${testcvs} -q rlog -rbranch first-dir" \
  17611. "${rlog_header1}
  17612. ${log_tags1}
  17613. ${log_keyword}
  17614. total revisions: 6; selected revisions: 2
  17615. description:
  17616. ${log_rev2b}
  17617. ${log_rev1b}
  17618. ${log_trailer}
  17619. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17620. ${rlog_header2}
  17621. ${log_tags2}
  17622. ${log_keyword}
  17623. total revisions: 3; selected revisions: 0
  17624. description:
  17625. ${log_trailer}"
  17626. dotest log-rd4a "${testcvs} -q rlog -t -rbranch first-dir" \
  17627. "${rlog_header1}
  17628. ${log_tags1}
  17629. ${log_keyword}
  17630. total revisions: 6
  17631. description:
  17632. ${log_trailer}
  17633. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17634. ${rlog_header2}
  17635. ${log_tags2}
  17636. ${log_keyword}
  17637. total revisions: 3
  17638. description:
  17639. ${log_trailer}"
  17640. dotest log-rd4b "${testcvs} -q rlog -St -rbranch first-dir" \
  17641. "${rlog_header1}
  17642. ${log_tags1}
  17643. ${log_keyword}
  17644. total revisions: 6; selected revisions: 2
  17645. description:
  17646. ${log_trailer}
  17647. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17648. dotest log-rd4c "${testcvs} -q rlog -h -rbranch first-dir" \
  17649. "${rlog_header1}
  17650. ${log_tags1}
  17651. ${log_keyword}
  17652. total revisions: 6
  17653. ${log_trailer}
  17654. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v.
  17655. ${rlog_header2}
  17656. ${log_tags2}
  17657. ${log_keyword}
  17658. total revisions: 3
  17659. ${log_trailer}"
  17660. dotest log-rd4d "${testcvs} -q rlog -Sh -rbranch first-dir" \
  17661. "${rlog_header1}
  17662. ${log_tags1}
  17663. ${log_keyword}
  17664. total revisions: 6; selected revisions: 2
  17665. ${log_trailer}
  17666. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17667. dotest log-rd4e "${testcvs} -q rlog -R -rbranch first-dir" \
  17668. "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17669. ${CVSROOT_DIRNAME}/first-dir/file2,v"
  17670. dotest log-rd4f "${testcvs} -q rlog -R -S -rbranch first-dir" \
  17671. "${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17672. ${PROG} rlog: warning: no revision .branch. in .${CVSROOT_DIRNAME}/first-dir/file2,v."
  17673. dotest log-d5 "${testcvs} log -r1.2.2.1:1.2.2.2 file1" \
  17674. "${log_header1}
  17675. ${log_tags1}
  17676. ${log_keyword}
  17677. total revisions: 6; selected revisions: 2
  17678. description:
  17679. ${log_rev2b}
  17680. ${log_rev1b}
  17681. ${log_trailer}"
  17682. dotest log-rd5 "${testcvs} rlog -r1.2.2.1:1.2.2.2 first-dir/file1" \
  17683. "${rlog_header1}
  17684. ${log_tags1}
  17685. ${log_keyword}
  17686. total revisions: 6; selected revisions: 2
  17687. description:
  17688. ${log_rev2b}
  17689. ${log_rev1b}
  17690. ${log_trailer}"
  17691. dotest log-d6 "${testcvs} -q log -r1.2.2.1:1.2.2.2" \
  17692. "${log_header1}
  17693. ${log_tags1}
  17694. ${log_keyword}
  17695. total revisions: 6; selected revisions: 2
  17696. description:
  17697. ${log_rev2b}
  17698. ${log_rev1b}
  17699. ${log_trailer}
  17700. ${log_header2}
  17701. ${log_tags2}
  17702. ${log_keyword}
  17703. total revisions: 3; selected revisions: 0
  17704. description:
  17705. ${log_trailer}"
  17706. dotest log-rd6 "${testcvs} -q rlog -r1.2.2.1:1.2.2.2 first-dir" \
  17707. "${rlog_header1}
  17708. ${log_tags1}
  17709. ${log_keyword}
  17710. total revisions: 6; selected revisions: 2
  17711. description:
  17712. ${log_rev2b}
  17713. ${log_rev1b}
  17714. ${log_trailer}
  17715. ${rlog_header2}
  17716. ${log_tags2}
  17717. ${log_keyword}
  17718. total revisions: 3; selected revisions: 0
  17719. description:
  17720. ${log_trailer}"
  17721. dotest log-d7 "${testcvs} log -r1.2:1.3 file1" \
  17722. "${log_header1}
  17723. ${log_tags1}
  17724. ${log_keyword}
  17725. total revisions: 6; selected revisions: 2
  17726. description:
  17727. ${log_rev3}
  17728. ${log_rev2}
  17729. ${log_trailer}"
  17730. dotest log-rd7 "${testcvs} -q rlog -r1.2:1.3 first-dir/file1" \
  17731. "${rlog_header1}
  17732. ${log_tags1}
  17733. ${log_keyword}
  17734. total revisions: 6; selected revisions: 2
  17735. description:
  17736. ${log_rev3}
  17737. ${log_rev2}
  17738. ${log_trailer}"
  17739. dotest log-d8 "${testcvs} -q log -rtag1:tag2" \
  17740. "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17741. ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17742. ${log_header1}
  17743. ${log_tags1}
  17744. ${log_keyword}
  17745. total revisions: 6; selected revisions: 0
  17746. description:
  17747. ${log_trailer}
  17748. ${log_header2}
  17749. ${log_tags2}
  17750. ${log_keyword}
  17751. total revisions: 3; selected revisions: 2
  17752. description:
  17753. ${log_rev3}
  17754. ${log_rev22}
  17755. ${log_trailer}"
  17756. dotest log-d8a "${testcvs} -q log -rtag1:tag2 -S" \
  17757. "${PROG} log: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17758. ${PROG} log: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17759. ${log_header2}
  17760. ${log_tags2}
  17761. ${log_keyword}
  17762. total revisions: 3; selected revisions: 2
  17763. description:
  17764. ${log_rev3}
  17765. ${log_rev22}
  17766. ${log_trailer}"
  17767. dotest log-rd8 "${testcvs} -q rlog -rtag1:tag2 first-dir" \
  17768. "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17769. ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17770. ${rlog_header1}
  17771. ${log_tags1}
  17772. ${log_keyword}
  17773. total revisions: 6; selected revisions: 0
  17774. description:
  17775. ${log_trailer}
  17776. ${rlog_header2}
  17777. ${log_tags2}
  17778. ${log_keyword}
  17779. total revisions: 3; selected revisions: 2
  17780. description:
  17781. ${log_rev3}
  17782. ${log_rev22}
  17783. ${log_trailer}"
  17784. dotest log-rd8a "${testcvs} -q rlog -rtag1:tag2 -S first-dir" \
  17785. "${PROG} rlog: warning: no revision .tag1. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17786. ${PROG} rlog: warning: no revision .tag2. in .${CVSROOT_DIRNAME}/first-dir/Attic/file1,v.
  17787. ${rlog_header2}
  17788. ${log_tags2}
  17789. ${log_keyword}
  17790. total revisions: 3; selected revisions: 2
  17791. description:
  17792. ${log_rev3}
  17793. ${log_rev22}
  17794. ${log_trailer}"
  17795. dotest log-d99 "${testcvs} -q up -rbranch" \
  17796. "[UP] file1
  17797. ${PROG} update: file2 is no longer in the repository"
  17798. # Now test outdating revisions
  17799. dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
  17800. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17801. done"
  17802. dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
  17803. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17804. done"
  17805. dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
  17806. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
  17807. deleting revision 1\.2\.2\.2
  17808. done"
  17809. dotest log-o3 "${testcvs} log file1" \
  17810. "${log_header1}
  17811. ${log_tags1}
  17812. ${log_keyword}
  17813. total revisions: 5; selected revisions: 5
  17814. description:
  17815. ${log_rev4}
  17816. ${log_rev3}
  17817. ${log_rev2}
  17818. ${log_rev1}
  17819. ${log_rev1b}
  17820. ${log_trailer}"
  17821. dotest log-ro3 "${testcvs} rlog first-dir/file1" \
  17822. "${rlog_header1}
  17823. ${log_tags1}
  17824. ${log_keyword}
  17825. total revisions: 5; selected revisions: 5
  17826. description:
  17827. ${log_rev4}
  17828. ${log_rev3}
  17829. ${log_rev2}
  17830. ${log_rev1}
  17831. ${log_rev1b}
  17832. ${log_trailer}"
  17833. dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
  17834. "first branch revision"
  17835. cd ..
  17836. rm -r first-dir
  17837. rm -rf ${CVSROOT_DIRNAME}/first-dir
  17838. ;;
  17839. log2)
  17840. # More "cvs log" tests, for example the file description.
  17841. # Check in a file
  17842. mkdir ${CVSROOT_DIRNAME}/first-dir
  17843. dotest log2-1 "${testcvs} -q co first-dir" ''
  17844. cd first-dir
  17845. echo 'first revision' > file1
  17846. dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
  17847. "${PROG}"' add: scheduling file `file1'\'' for addition
  17848. '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently'
  17849. dotest log2-3 "${testcvs} -q commit -m 1" \
  17850. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17851. done
  17852. Checking in file1;
  17853. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  17854. initial revision: 1\.1
  17855. done"
  17856. # Setting the file description with add -m doesn't yet work
  17857. # client/server, so skip log2-4 for remote.
  17858. if $remote; then :; else
  17859. dotest log2-4 "${testcvs} log -N file1" "
  17860. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17861. Working file: file1
  17862. head: 1\.1
  17863. branch:
  17864. locks: strict
  17865. access list:
  17866. keyword substitution: kv
  17867. total revisions: 1; selected revisions: 1
  17868. description:
  17869. file1-is-for-testing
  17870. ----------------------------
  17871. revision 1\.1
  17872. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  17873. 1
  17874. ============================================================================="
  17875. fi # end of tests skipped for remote
  17876. dotest log2-5 "${testcvs} admin -t-change-description file1" \
  17877. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17878. done"
  17879. dotest log2-6 "${testcvs} log -N file1" "
  17880. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17881. Working file: file1
  17882. head: 1\.1
  17883. branch:
  17884. locks: strict
  17885. access list:
  17886. keyword substitution: kv
  17887. total revisions: 1; selected revisions: 1
  17888. description:
  17889. change-description
  17890. ----------------------------
  17891. revision 1\.1
  17892. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  17893. 1
  17894. ============================================================================="
  17895. echo 'longer description' >${TESTDIR}/descrip
  17896. echo 'with two lines' >>${TESTDIR}/descrip
  17897. dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
  17898. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17899. done"
  17900. dotest_fail log2-7a "${testcvs} admin -t${TESTDIR}/nonexist file1" \
  17901. "${PROG} \[[a-z]* aborted\]: can't stat ${TESTDIR}/nonexist: No such file or directory"
  17902. dotest log2-8 "${testcvs} log -N file1" "
  17903. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17904. Working file: file1
  17905. head: 1\.1
  17906. branch:
  17907. locks: strict
  17908. access list:
  17909. keyword substitution: kv
  17910. total revisions: 1; selected revisions: 1
  17911. description:
  17912. longer description
  17913. with two lines
  17914. ----------------------------
  17915. revision 1\.1
  17916. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  17917. 1
  17918. ============================================================================="
  17919. # TODO: `cvs admin -t "my message" file1' is a request to
  17920. # read the message from stdin and to operate on two files.
  17921. # Should test that there is an error because "my message"
  17922. # doesn't exist.
  17923. dotest log2-9 "echo change from stdin | ${testcvs} admin -t -q file1" ""
  17924. dotest log2-10 "${testcvs} log -N file1" "
  17925. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17926. Working file: file1
  17927. head: 1\.1
  17928. branch:
  17929. locks: strict
  17930. access list:
  17931. keyword substitution: kv
  17932. total revisions: 1; selected revisions: 1
  17933. description:
  17934. change from stdin
  17935. ----------------------------
  17936. revision 1\.1
  17937. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  17938. 1
  17939. ============================================================================="
  17940. cd ..
  17941. rm ${TESTDIR}/descrip
  17942. rm -r first-dir
  17943. rm -rf ${CVSROOT_DIRNAME}/first-dir
  17944. ;;
  17945. logopt)
  17946. # Some tests of log.c's option parsing and such things.
  17947. mkdir 1; cd 1
  17948. dotest logopt-1 "${testcvs} -q co -l ." ''
  17949. mkdir first-dir
  17950. dotest logopt-2 "${testcvs} add first-dir" \
  17951. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  17952. cd first-dir
  17953. echo hi >file1
  17954. dotest logopt-3 "${testcvs} add file1" \
  17955. "${PROG} add: scheduling file .file1. for addition
  17956. ${PROG} add: use .${PROG} commit. to add this file permanently"
  17957. dotest logopt-4 "${testcvs} -q ci -m add file1" \
  17958. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  17959. done
  17960. Checking in file1;
  17961. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  17962. initial revision: 1\.1
  17963. done"
  17964. cd ..
  17965. dotest logopt-5 "${testcvs} log -R -d 2038-01-01" \
  17966. "${PROG} log: Logging \.
  17967. ${PROG} log: Logging first-dir
  17968. ${CVSROOT_DIRNAME}/first-dir/file1,v"
  17969. dotest logopt-6 "${testcvs} log -d 2038-01-01 -R" \
  17970. "${PROG} log: Logging \.
  17971. ${PROG} log: Logging first-dir
  17972. ${CVSROOT_DIRNAME}/first-dir/file1,v"
  17973. dotest logopt-6a "${testcvs} log -Rd 2038-01-01" \
  17974. "${PROG} log: Logging \.
  17975. ${PROG} log: Logging first-dir
  17976. ${CVSROOT_DIRNAME}/first-dir/file1,v"
  17977. dotest logopt-7 "${testcvs} log -s Exp -R" \
  17978. "${PROG} log: Logging \.
  17979. ${PROG} log: Logging first-dir
  17980. ${CVSROOT_DIRNAME}/first-dir/file1,v"
  17981. cd ..
  17982. rm -r 1
  17983. rm -rf ${CVSROOT_DIRNAME}/first-dir
  17984. ;;
  17985. ann)
  17986. # Tests of "cvs annotate". See also:
  17987. # basica-10 A simple annotate test
  17988. # rcs Annotate and the year 2000
  17989. # keywordlog Annotate and $Log.
  17990. mkdir 1; cd 1
  17991. dotest ann-1 "${testcvs} -q co -l ." ''
  17992. mkdir first-dir
  17993. dotest ann-2 "${testcvs} add first-dir" \
  17994. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  17995. cd first-dir
  17996. cat >file1 <<EOF
  17997. this
  17998. is
  17999. the
  18000. ancestral
  18001. file
  18002. EOF
  18003. dotest ann-3 "${testcvs} add file1" \
  18004. "${PROG} add: scheduling file .file1. for addition
  18005. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18006. dotest ann-4 "${testcvs} -q ci -m add file1" \
  18007. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18008. done
  18009. Checking in file1;
  18010. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18011. initial revision: 1\.1
  18012. done"
  18013. cat >file1 <<EOF
  18014. this
  18015. is
  18016. a
  18017. file
  18018. with
  18019. a
  18020. blank
  18021. line
  18022. EOF
  18023. dotest ann-5 "${testcvs} -q ci -m modify file1" \
  18024. "Checking in file1;
  18025. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18026. new revision: 1\.2; previous revision: 1\.1
  18027. done"
  18028. dotest ann-6 "${testcvs} -q tag -b br" "T file1"
  18029. cat >file1 <<EOF
  18030. this
  18031. is
  18032. a
  18033. trunk file
  18034. with
  18035. a
  18036. blank
  18037. line
  18038. EOF
  18039. dotest ann-7 "${testcvs} -q ci -m modify file1" \
  18040. "Checking in file1;
  18041. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18042. new revision: 1\.3; previous revision: 1\.2
  18043. done"
  18044. dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
  18045. cat >file1 <<EOF
  18046. this
  18047. is
  18048. a
  18049. file
  18050. with
  18051. a
  18052. blank
  18053. line
  18054. and some
  18055. branched content
  18056. EOF
  18057. dotest ann-9 "${testcvs} -q ci -m modify" \
  18058. "Checking in file1;
  18059. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18060. new revision: 1\.2\.2\.1; previous revision: 1\.2
  18061. done"
  18062. # Note that this annotates the trunk despite the presence
  18063. # of a sticky tag in the current directory. This is
  18064. # fairly bogus, but it is the longstanding behavior for
  18065. # whatever that is worth.
  18066. dotest ann-10 "${testcvs} ann" \
  18067. "
  18068. Annotations for file1
  18069. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18070. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18071. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18072. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18073. 1\.3 ($username8 *[0-9a-zA-Z-]*): trunk file
  18074. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18075. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18076. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18077. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18078. 1\.2 ($username8 *[0-9a-zA-Z-]*): line"
  18079. dotest ann-10blame "${testcvs} blame" \
  18080. "
  18081. Annotations for file1
  18082. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18083. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18084. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18085. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18086. 1\.3 ($username8 *[0-9a-zA-Z-]*): trunk file
  18087. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18088. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18089. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18090. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18091. 1\.2 ($username8 *[0-9a-zA-Z-]*): line"
  18092. dotest ann-11 "${testcvs} ann -r br" \
  18093. "
  18094. Annotations for file1
  18095. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18096. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18097. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18098. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18099. 1\.1 ($username8 *[0-9a-zA-Z-]*): file
  18100. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18101. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18102. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18103. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18104. 1\.2 ($username8 *[0-9a-zA-Z-]*): line
  18105. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some
  18106. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content"
  18107. # FIXCVS: shouldn't "-r 1.2.0.2" be the same as "-r br"?
  18108. dotest ann-12 "${testcvs} ann -r 1.2.0.2 file1" ""
  18109. dotest ann-13 "${testcvs} ann -r 1.2.2 file1" \
  18110. "
  18111. Annotations for file1
  18112. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18113. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18114. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18115. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18116. 1\.1 ($username8 *[0-9a-zA-Z-]*): file
  18117. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18118. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18119. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18120. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18121. 1\.2 ($username8 *[0-9a-zA-Z-]*): line
  18122. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some
  18123. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content"
  18124. dotest_fail ann-14 "${testcvs} ann -r bill-clintons-chastity file1" \
  18125. "${PROG} \[annotate aborted\]: no such tag bill-clintons-chastity"
  18126. # Now get rid of the working directory and test rannotate
  18127. cd ../..
  18128. rm -r 1
  18129. dotest ann-r10 "${testcvs} rann first-dir" \
  18130. "
  18131. Annotations for first-dir/file1
  18132. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18133. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18134. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18135. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18136. 1\.3 ($username8 *[0-9a-zA-Z-]*): trunk file
  18137. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18138. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18139. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18140. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18141. 1\.2 ($username8 *[0-9a-zA-Z-]*): line"
  18142. dotest ann-r11 "${testcvs} rann -r br first-dir" \
  18143. "
  18144. Annotations for first-dir/file1
  18145. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18146. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18147. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18148. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18149. 1\.1 ($username8 *[0-9a-zA-Z-]*): file
  18150. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18151. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18152. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18153. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18154. 1\.2 ($username8 *[0-9a-zA-Z-]*): line
  18155. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some
  18156. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content"
  18157. dotest ann-r12 "${testcvs} rann -r 1.2.0.2 first-dir/file1" ""
  18158. dotest ann-r13 "${testcvs} rann -r 1.2.2 first-dir/file1" \
  18159. "
  18160. Annotations for first-dir/file1
  18161. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18162. 1\.1 ($username8 *[0-9a-zA-Z-]*): this
  18163. 1\.1 ($username8 *[0-9a-zA-Z-]*): is
  18164. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18165. 1\.1 ($username8 *[0-9a-zA-Z-]*): file
  18166. 1\.2 ($username8 *[0-9a-zA-Z-]*):
  18167. 1\.2 ($username8 *[0-9a-zA-Z-]*): with
  18168. 1\.2 ($username8 *[0-9a-zA-Z-]*): a
  18169. 1\.2 ($username8 *[0-9a-zA-Z-]*): blank
  18170. 1\.2 ($username8 *[0-9a-zA-Z-]*): line
  18171. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some
  18172. 1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content"
  18173. dotest_fail ann-r14 "${testcvs} rann -r bill-clintons-chastity first-dir/file1" \
  18174. "${PROG} \[rannotate aborted\]: no such tag bill-clintons-chastity"
  18175. rm -rf ${CVSROOT_DIRNAME}/first-dir
  18176. ;;
  18177. ann-id)
  18178. # Demonstrate that cvs-1.9.28.1 improperly expands rcs keywords in
  18179. # the output of `cvs annotate' -- it uses values from the previous
  18180. # delta. In this case, `1.1' instead of `1.2', even though it puts
  18181. # the proper version number on the prefix to each line of output.
  18182. mkdir 1; cd 1
  18183. dotest ann-id-1 "${testcvs} -q co -l ." ''
  18184. module=x
  18185. mkdir $module
  18186. dotest ann-id-2 "${testcvs} add $module" \
  18187. "Directory ${CVSROOT_DIRNAME}/$module added to the repository"
  18188. cd $module
  18189. file=m
  18190. echo '$Id''$' > $file
  18191. dotest ann-id-3 "$testcvs add $file" \
  18192. "${PROG} add: scheduling file .$file. for addition
  18193. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18194. dotest ann-id-4 "$testcvs -Q ci -m . $file" \
  18195. "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
  18196. done
  18197. Checking in $file;
  18198. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  18199. initial revision: 1\.1
  18200. done"
  18201. echo line2 >> $file
  18202. dotest ann-id-5 "$testcvs -Q ci -m . $file" \
  18203. "Checking in $file;
  18204. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  18205. new revision: 1\.2; previous revision: 1\.1
  18206. done"
  18207. # The version number after $file,v should be `1.2'.
  18208. # 1.9.28.1 puts `1.1' there.
  18209. dotest ann-id-6 "$testcvs -Q ann $file" \
  18210. "
  18211. Annotations for $file
  18212. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18213. 1.2 ($username8 *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'"
  18214. 1.2 ($username8 *[0-9a-zA-Z-]*): line2"
  18215. cd ../..
  18216. rm -rf 1
  18217. rm -rf ${CVSROOT_DIRNAME}/$module
  18218. ;;
  18219. crerepos)
  18220. # Various tests relating to creating repositories, operating
  18221. # on repositories created with old versions of CVS, etc.
  18222. CVS_SERVER_save=$CVS_SERVER
  18223. # Because this test is all about -d options and such, it
  18224. # at least to some extent needs to be different for remote vs.
  18225. # local.
  18226. if $remote; then
  18227. # Use :ext: rather than :fork:. Most of the tests use :fork:,
  18228. # so we want to make sure that we test :ext: _somewhere_.
  18229. # Make sure 'rsh' works first.
  18230. depends_on_rsh "$CVS_RSH"
  18231. if test $? -eq 77; then
  18232. skip crerepos "$skipreason"
  18233. continue
  18234. fi
  18235. # For remote, just create the repository. We don't yet do
  18236. # the various other tests above for remote but that should be
  18237. # changed.
  18238. mkdir crerepos
  18239. mkdir crerepos/CVSROOT
  18240. # Make sure server ignores real ${HOME}/.cvsrc:
  18241. cat >$TESTDIR/cvs-setHome <<EOF
  18242. #!/bin/sh
  18243. HOME=$HOME
  18244. export HOME
  18245. exec $CVS_SERVER_save "\$@"
  18246. EOF
  18247. chmod a+x $TESTDIR/cvs-setHome
  18248. # Note that we set CVS_SERVER at the beginning.
  18249. CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER
  18250. CREREPOS_ROOT=:ext:$host$TESTDIR/crerepos
  18251. else
  18252. # First, if the repository doesn't exist at all...
  18253. dotest_fail crerepos-1 \
  18254. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18255. "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
  18256. mkdir crerepos
  18257. # The repository exists but CVSROOT doesn't.
  18258. dotest_fail crerepos-2 \
  18259. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18260. "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
  18261. mkdir crerepos/CVSROOT
  18262. # Checkout of nonexistent module
  18263. dotest_fail crerepos-3 \
  18264. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18265. "${PROG} checkout: cannot find module .cvs-sanity. - ignored"
  18266. # Now test that CVS works correctly without a modules file
  18267. # or any of that other stuff. In particular, it *must*
  18268. # function if administrative files added to CVS recently (since
  18269. # CVS 1.3) do not exist, because the repository might have
  18270. # been created with an old version of CVS.
  18271. mkdir 1; cd 1
  18272. dotest crerepos-4 \
  18273. "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
  18274. ''
  18275. if echo yes | \
  18276. ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
  18277. pass crerepos-5
  18278. else
  18279. fail crerepos-5
  18280. fi
  18281. rm -rf CVS
  18282. cd ..
  18283. # The directory 1 should be empty
  18284. dotest crerepos-6 "rmdir 1"
  18285. CREREPOS_ROOT=${TESTDIR}/crerepos
  18286. fi
  18287. if $remote; then
  18288. # Test that CVS rejects a relative path in CVSROOT.
  18289. mkdir 1; cd 1
  18290. # Note that having the client reject the pathname (as :fork:
  18291. # does), does _not_ test for the bugs we are trying to catch
  18292. # here. The point is that malicious clients might send all
  18293. # manner of things and the server better protect itself.
  18294. dotest_fail crerepos-6a-r \
  18295. "${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
  18296. "${PROG} [a-z]*: CVSROOT may only specify a positive, non-zero, integer port (not .\.\..)\.
  18297. ${PROG} [a-z]*: Perhaps you entered a relative pathname${QUESTION}
  18298. ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:\.\./crerepos.\."
  18299. cd ..
  18300. rm -r 1
  18301. else # local
  18302. # Test that CVS rejects a relative path in CVSROOT.
  18303. mkdir 1; cd 1
  18304. # Set CVS_RSH=false since ocassionally (e.g. when CVS_RSH=ssh on
  18305. # some systems) some rsh implementations will block because they
  18306. # can look up '..' and want to ask the user about the unknown host
  18307. # key or somesuch. Which error message we get depends on whether
  18308. # false finishes running before we try to talk to it or not.
  18309. dotest_fail crerepos-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \
  18310. "${PROG} \[checkout aborted\]: .*" \
  18311. "${PROG} checkout: CVSROOT is set for a remote access method but your
  18312. ${PROG} checkout: CVS executable doesn't support it\.
  18313. ${PROG} \[checkout aborted\]: Bad CVSROOT: .\.\./crerepos.\."
  18314. cd ..
  18315. rm -r 1
  18316. mkdir 1; cd 1
  18317. dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
  18318. "${PROG} init: CVSROOT must be an absolute pathname (not .crerepos.)
  18319. ${PROG} init: when using local access method\.
  18320. ${PROG} \[init aborted\]: Bad CVSROOT: .crerepos.\."
  18321. cd ..
  18322. rm -r 1
  18323. fi # end of tests to be skipped for remote
  18324. # CVS better not create a history file--if the administrator
  18325. # doesn't need it and wants to save on disk space, they just
  18326. # delete it.
  18327. dotest_fail crerepos-7 \
  18328. "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
  18329. # Now test mixing repositories. This kind of thing tends to
  18330. # happen accidentally when people work with several repositories.
  18331. mkdir 1; cd 1
  18332. dotest crerepos-8 "${testcvs} -q co -l ." ''
  18333. mkdir first-dir
  18334. dotest crerepos-9 "${testcvs} add first-dir" \
  18335. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  18336. cd first-dir
  18337. touch file1
  18338. dotest crerepos-10 "${testcvs} add file1" \
  18339. "${PROG} add: scheduling file .file1. for addition
  18340. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18341. dotest crerepos-11 "${testcvs} -q ci -m add-it" \
  18342. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18343. done
  18344. Checking in file1;
  18345. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18346. initial revision: 1\.1
  18347. done"
  18348. cd ../..
  18349. rm -r 1
  18350. mkdir 1; cd 1
  18351. dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
  18352. mkdir crerepos-dir
  18353. dotest crerepos-13 "${testcvs} add crerepos-dir" \
  18354. "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
  18355. cd crerepos-dir
  18356. touch cfile
  18357. dotest crerepos-14 "${testcvs} add cfile" \
  18358. "${PROG} add: scheduling file .cfile. for addition
  18359. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18360. dotest crerepos-15 "${testcvs} -q ci -m add-it" \
  18361. "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
  18362. done
  18363. Checking in cfile;
  18364. ${TESTDIR}/crerepos/crerepos-dir/cfile,v <-- cfile
  18365. initial revision: 1\.1
  18366. done"
  18367. cd ../..
  18368. rm -r 1
  18369. mkdir 1; cd 1
  18370. dotest crerepos-16 "${testcvs} co first-dir" \
  18371. "${PROG} checkout: Updating first-dir
  18372. U first-dir/file1"
  18373. dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
  18374. "${PROG} checkout: Updating crerepos-dir
  18375. U crerepos-dir/cfile"
  18376. dotest crerepos-18 "${testcvs} update" \
  18377. "${PROG} update: Updating first-dir
  18378. ${PROG} update: Updating crerepos-dir"
  18379. cd ..
  18380. CVS_SERVER=$CVS_SERVER_save; export CVS_SERVER
  18381. if $keep; then
  18382. echo Keeping ${TESTDIR} and exiting due to --keep
  18383. exit 0
  18384. fi
  18385. rm -f $TESTDIR/cvs-setHome
  18386. rm -r 1
  18387. rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
  18388. ;;
  18389. crerepos-extssh)
  18390. # Various tests relating to creating repositories, operating
  18391. # on repositories created with old versions of CVS, etc.
  18392. CVS_SERVER_save=$CVS_SERVER
  18393. # Because this test is all about -d options and such, it
  18394. # at least to some extent needs to be different for remote vs.
  18395. # local.
  18396. if $remote; then
  18397. # Use :extssh: rather than :fork:. Most of the tests use :fork:,
  18398. # so we want to make sure that we test :extssh: _somewhere_.
  18399. # Make sure 'ssh' works first.
  18400. depends_on_rsh "$CVS_RSH"
  18401. if test $? -eq 77; then
  18402. skip crerepos "$skipreason"
  18403. continue
  18404. fi
  18405. # For remote, just create the repository. We don't yet do
  18406. # the various other tests above for remote but that should be
  18407. # changed.
  18408. mkdir crerepos
  18409. mkdir crerepos/CVSROOT
  18410. # Make sure server ignores real ${HOME}/.cvsrc:
  18411. cat >$TESTDIR/cvs-setHome <<EOF
  18412. #!/bin/sh
  18413. HOME=$HOME
  18414. export HOME
  18415. exec $CVS_SERVER_save "\$@"
  18416. EOF
  18417. chmod a+x $TESTDIR/cvs-setHome
  18418. # Note that we set CVS_SERVER at the beginning.
  18419. CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER
  18420. CREREPOS_ROOT=:extssh:$host$TESTDIR/crerepos
  18421. else
  18422. # First, if the repository doesn't exist at all...
  18423. dotest_fail crerepos-extssh-1 \
  18424. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18425. "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
  18426. mkdir crerepos
  18427. # The repository exists but CVSROOT doesn't.
  18428. dotest_fail crerepos-extssh-2 \
  18429. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18430. "${PROG} \[checkout aborted\]: ${TESTDIR}/crerepos/CVSROOT: .*"
  18431. mkdir crerepos/CVSROOT
  18432. # Checkout of nonexistent module
  18433. dotest_fail crerepos-extssh-3 \
  18434. "${testcvs} -d ${TESTDIR}/crerepos co cvs-sanity" \
  18435. "${PROG} checkout: cannot find module .cvs-sanity. - ignored"
  18436. # Now test that CVS works correctly without a modules file
  18437. # or any of that other stuff. In particular, it *must*
  18438. # function if administrative files added to CVS recently (since
  18439. # CVS 1.3) do not exist, because the repository might have
  18440. # been created with an old version of CVS.
  18441. mkdir 1; cd 1
  18442. dotest crerepos-extssh-4 \
  18443. "${testcvs} -q -d ${TESTDIR}/crerepos co CVSROOT" \
  18444. ''
  18445. if echo yes | \
  18446. ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
  18447. pass crerepos-extssh-5
  18448. else
  18449. fail crerepos-extssh-5
  18450. fi
  18451. rm -rf CVS
  18452. cd ..
  18453. # The directory 1 should be empty
  18454. dotest crerepos-extssh-6 "rmdir 1"
  18455. CREREPOS_ROOT=${TESTDIR}/crerepos
  18456. fi
  18457. if $remote; then
  18458. # Test that CVS rejects a relative path in CVSROOT.
  18459. mkdir 1; cd 1
  18460. # Note that having the client reject the pathname (as :fork:
  18461. # does), does _not_ test for the bugs we are trying to catch
  18462. # here. The point is that malicious clients might send all
  18463. # manner of things and the server better protect itself.
  18464. dotest_fail crerepos-extssh-6a-r \
  18465. "${testcvs} -q -d :extssh:`hostname`:../crerepos get ." \
  18466. "${PROG} [a-z]*: CVSROOT may only specify a positive, non-zero, integer port (not .\.\..)\.
  18467. ${PROG} [a-z]*: Perhaps you entered a relative pathname${QUESTION}
  18468. ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:extssh:${hostname}:\.\./crerepos.\."
  18469. cd ..
  18470. rm -r 1
  18471. else # local
  18472. # Test that CVS rejects a relative path in CVSROOT.
  18473. mkdir 1; cd 1
  18474. # Set CVS_RSH=false since ocassionally (e.g. when CVS_RSH=ssh on
  18475. # some systems) some rsh implementations will block because they
  18476. # can look up '..' and want to ask the user about the unknown host
  18477. # key or somesuch. Which error message we get depends on whether
  18478. # false finishes running before we try to talk to it or not.
  18479. dotest_fail crerepos-extssh-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \
  18480. "${PROG} \[checkout aborted\]: .*" \
  18481. "${PROG} checkout: CVSROOT is set for a remote access method but your
  18482. ${PROG} checkout: CVS executable doesn't support it\.
  18483. ${PROG} \[checkout aborted\]: Bad CVSROOT: .\.\./crerepos.\."
  18484. cd ..
  18485. rm -r 1
  18486. mkdir 1; cd 1
  18487. dotest_fail crerepos-extssh-6b "${testcvs} -d crerepos init" \
  18488. "${PROG} init: CVSROOT must be an absolute pathname (not .crerepos.)
  18489. ${PROG} init: when using local access method\.
  18490. ${PROG} \[init aborted\]: Bad CVSROOT: .crerepos.\."
  18491. cd ..
  18492. rm -r 1
  18493. fi # end of tests to be skipped for remote
  18494. # CVS better not create a history file--if the administrator
  18495. # doesn't need it and wants to save on disk space, they just
  18496. # delete it.
  18497. dotest_fail crerepos-extssh-7 \
  18498. "test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
  18499. # Now test mixing repositories. This kind of thing tends to
  18500. # happen accidentally when people work with several repositories.
  18501. mkdir 1; cd 1
  18502. dotest crerepos-extssh-8 "${testcvs} -q co -l ." ''
  18503. mkdir first-dir
  18504. dotest crerepos-extssh-9 "${testcvs} add first-dir" \
  18505. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  18506. cd first-dir
  18507. touch file1
  18508. dotest crerepos-extssh-10 "${testcvs} add file1" \
  18509. "${PROG} add: scheduling file .file1. for addition
  18510. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18511. dotest crerepos-extssh-11 "${testcvs} -q ci -m add-it" \
  18512. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18513. done
  18514. Checking in file1;
  18515. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  18516. initial revision: 1\.1
  18517. done"
  18518. cd ../..
  18519. rm -r 1
  18520. mkdir 1; cd 1
  18521. dotest crerepos-extssh-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
  18522. mkdir crerepos-dir
  18523. dotest crerepos-extssh-13 "${testcvs} add crerepos-dir" \
  18524. "Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
  18525. cd crerepos-dir
  18526. touch cfile
  18527. dotest crerepos-extssh-14 "${testcvs} add cfile" \
  18528. "${PROG} add: scheduling file .cfile. for addition
  18529. ${PROG} add: use .${PROG} commit. to add this file permanently"
  18530. dotest crerepos-extssh-15 "${testcvs} -q ci -m add-it" \
  18531. "RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
  18532. done
  18533. Checking in cfile;
  18534. ${TESTDIR}/crerepos/crerepos-dir/cfile,v <-- cfile
  18535. initial revision: 1\.1
  18536. done"
  18537. cd ../..
  18538. rm -r 1
  18539. mkdir 1; cd 1
  18540. dotest crerepos-extssh-16 "${testcvs} co first-dir" \
  18541. "${PROG} checkout: Updating first-dir
  18542. U first-dir/file1"
  18543. dotest crerepos-extssh-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
  18544. "${PROG} checkout: Updating crerepos-dir
  18545. U crerepos-dir/cfile"
  18546. dotest crerepos-extssh-18 "${testcvs} update" \
  18547. "${PROG} update: Updating first-dir
  18548. ${PROG} update: Updating crerepos-dir"
  18549. cd ..
  18550. CVS_SERVER=$CVS_SERVER_save; export CVS_SERVER
  18551. if $keep; then
  18552. echo Keeping ${TESTDIR} and exiting due to --keep
  18553. exit 0
  18554. fi
  18555. rm -f $TESTDIR/cvs-setHome
  18556. rm -r 1
  18557. rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
  18558. ;;
  18559. rcs)
  18560. # Test ability to import an RCS file. Note that this format
  18561. # is fixed--files written by RCS5, and other software which
  18562. # implements this format, will be out there "forever" and
  18563. # CVS must always be able to import such files.
  18564. # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
  18565. mkdir ${CVSROOT_DIRNAME}/first-dir
  18566. # Currently the way to import an RCS file is to copy it
  18567. # directly into the repository.
  18568. #
  18569. # This file was written by RCS 5.7, and then the dates were
  18570. # hacked so that we test year 2000 stuff. Note also that
  18571. # "author" names are just strings, as far as importing
  18572. # RCS files is concerned--they need not correspond to user
  18573. # IDs on any particular system.
  18574. #
  18575. # I also tried writing a file with the RCS supplied with
  18576. # HPUX A.09.05. According to "man rcsintro" this is
  18577. # "Revision Number: 3.0; Release Date: 83/05/11". There
  18578. # were a few minor differences like whitespace but at least
  18579. # in simple cases like this everything else seemed the same
  18580. # as the file written by RCS 5.7 (so I won't try to make it
  18581. # a separate test case).
  18582. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  18583. head 1.3;
  18584. access;
  18585. symbols;
  18586. locks; strict;
  18587. comment @# @;
  18588. 1.3
  18589. date 2000.11.24.15.58.37; author kingdon; state Exp;
  18590. branches;
  18591. next 1.2;
  18592. 1.2
  18593. date 96.11.24.15.57.41; author kingdon; state Exp;
  18594. branches;
  18595. next 1.1;
  18596. 1.1
  18597. date 96.11.24.15.56.05; author kingdon; state Exp;
  18598. branches;
  18599. next ;
  18600. desc
  18601. @file1 is for testing CVS
  18602. @
  18603. 1.3
  18604. log
  18605. @delete second line; modify twelfth line
  18606. @
  18607. text
  18608. @This is the first line
  18609. This is the third line
  18610. This is the fourth line
  18611. This is the fifth line
  18612. This is the sixth line
  18613. This is the seventh line
  18614. This is the eighth line
  18615. This is the ninth line
  18616. This is the tenth line
  18617. This is the eleventh line
  18618. This is the twelfth line (and what a line it is)
  18619. This is the thirteenth line
  18620. @
  18621. 1.2
  18622. log
  18623. @add more lines
  18624. @
  18625. text
  18626. @a1 1
  18627. This is the second line
  18628. d11 1
  18629. a11 1
  18630. This is the twelfth line
  18631. @
  18632. 1.1
  18633. log
  18634. @add file1
  18635. @
  18636. text
  18637. @d2 12
  18638. @
  18639. EOF
  18640. dotest rcs-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
  18641. cd first-dir
  18642. dotest rcs-2 "${testcvs} -q log" "
  18643. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18644. Working file: file1
  18645. head: 1\.3
  18646. branch:
  18647. locks: strict
  18648. access list:
  18649. symbolic names:
  18650. keyword substitution: kv
  18651. total revisions: 3; selected revisions: 3
  18652. description:
  18653. file1 is for testing CVS
  18654. ----------------------------
  18655. revision 1\.3
  18656. date: 2000/11/24 15:58:37; author: kingdon; state: Exp; lines: ${PLUS}1 -2
  18657. delete second line; modify twelfth line
  18658. ----------------------------
  18659. revision 1\.2
  18660. date: 1996/11/24 15:57:41; author: kingdon; state: Exp; lines: ${PLUS}12 -0
  18661. add more lines
  18662. ----------------------------
  18663. revision 1\.1
  18664. date: 1996/11/24 15:56:05; author: kingdon; state: Exp;
  18665. add file1
  18666. ============================================================================="
  18667. # Note that the dates here are chosen so that (a) we test
  18668. # at least one date after 2000, (b) we will notice if the
  18669. # month and day are getting mixed up with each other.
  18670. # TODO: also test that year isn't getting mixed up with month
  18671. # or day, for example 01-02-03.
  18672. # ISO8601 format. There are many, many, other variations
  18673. # specified by ISO8601 which we should be testing too.
  18674. dotest rcs-3 "${testcvs} -q log -d '1996-12-11<'" "
  18675. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18676. Working file: file1
  18677. head: 1\.3
  18678. branch:
  18679. locks: strict
  18680. access list:
  18681. symbolic names:
  18682. keyword substitution: kv
  18683. total revisions: 3; selected revisions: 1
  18684. description:
  18685. file1 is for testing CVS
  18686. ----------------------------
  18687. revision 1\.3
  18688. date: 2000/11/24 15:58:37; author: kingdon; state: Exp; lines: ${PLUS}1 -2
  18689. delete second line; modify twelfth line
  18690. ============================================================================="
  18691. # RFC822 format (as amended by RFC1123).
  18692. dotest rcs-4 "${testcvs} -q log -d '<3 Apr 2000 00:00'" \
  18693. "
  18694. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  18695. Working file: file1
  18696. head: 1\.3
  18697. branch:
  18698. locks: strict
  18699. access list:
  18700. symbolic names:
  18701. keyword substitution: kv
  18702. total revisions: 3; selected revisions: 2
  18703. description:
  18704. file1 is for testing CVS
  18705. ----------------------------
  18706. revision 1\.2
  18707. date: 1996/11/24 15:57:41; author: kingdon; state: Exp; lines: ${PLUS}12 -0
  18708. add more lines
  18709. ----------------------------
  18710. revision 1\.1
  18711. date: 1996/11/24 15:56:05; author: kingdon; state: Exp;
  18712. add file1
  18713. ============================================================================="
  18714. # Intended behavior for "cvs annotate" is that it displays the
  18715. # last two digits of the year. Make sure it does that rather
  18716. # than some bogosity like "100".
  18717. dotest rcs-4a "${testcvs} annotate file1" \
  18718. "
  18719. Annotations for file1
  18720. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  18721. 1\.1 (kingdon 24-Nov-96): This is the first line
  18722. 1\.2 (kingdon 24-Nov-96): This is the third line
  18723. 1\.2 (kingdon 24-Nov-96): This is the fourth line
  18724. 1\.2 (kingdon 24-Nov-96): This is the fifth line
  18725. 1\.2 (kingdon 24-Nov-96): This is the sixth line
  18726. 1\.2 (kingdon 24-Nov-96): This is the seventh line
  18727. 1\.2 (kingdon 24-Nov-96): This is the eighth line
  18728. 1\.2 (kingdon 24-Nov-96): This is the ninth line
  18729. 1\.2 (kingdon 24-Nov-96): This is the tenth line
  18730. 1\.2 (kingdon 24-Nov-96): This is the eleventh line
  18731. 1\.3 (kingdon 24-Nov-00): This is the twelfth line (and what a line it is)
  18732. 1\.2 (kingdon 24-Nov-96): This is the thirteenth line"
  18733. # Probably should split this test into two at this point (file1
  18734. # above this line and file2 below), as the two share little
  18735. # data/setup.
  18736. # OK, here is another one. This one was written by hand based on
  18737. # doc/RCSFILES and friends. One subtle point is that none of
  18738. # the lines end with newlines; that is a feature which we
  18739. # should be testing.
  18740. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
  18741. head 1.5 ;
  18742. branch 1.2.6;
  18743. access ;
  18744. symbols branch:1.2.6;
  18745. locks;
  18746. testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
  18747. 1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
  18748. 1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
  18749. 1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
  18750. 1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
  18751. 1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
  18752. 1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
  18753. desc @@
  18754. 1.5 log @@ newphrase1; newphrase2 42; text @head revision@
  18755. 1.4 log @@ text @d1 1
  18756. a1 1
  18757. new year revision@
  18758. 1.3 log @@ text @d1 1
  18759. a1 1
  18760. old year revision@
  18761. 1.2 log @@ text @d1 1
  18762. a1 1
  18763. mid revision@ 1.1
  18764. log @@ text @d1 1
  18765. a1 1
  18766. start revision@
  18767. 1.2.6.1 log @@ text @d1 1
  18768. a1 1
  18769. branch revision@
  18770. EOF
  18771. # ' Match the single quote in above here doc -- for font-lock mode.
  18772. # First test the default branch.
  18773. dotest rcs-5 "${testcvs} -q update file2" "U file2"
  18774. dotest rcs-6 "cat file2" "branch revision"
  18775. # Check in a revision on the branch to force CVS to
  18776. # interpret every revision in the file.
  18777. dotest rcs-6a "$testcvs -q update -r branch file2" 'U file2'
  18778. echo "next branch revision" > file2
  18779. dotest rcs-6b "${testcvs} -q ci -m mod file2" \
  18780. "Checking in file2;
  18781. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  18782. new revision: 1\.2\.6\.2; previous revision: 1\.2\.6\.1
  18783. done"
  18784. # Now get rid of the default branch, it will get in the way.
  18785. dotest rcs-7 "${testcvs} admin -b file2" \
  18786. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  18787. done"
  18788. # But we do want to make sure that "cvs admin" leaves the newphrases
  18789. # in the file.
  18790. # The extra whitespace regexps are for the RCS library, which does
  18791. # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
  18792. dotest rcs-8 \
  18793. "grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
  18794. "testofanewphrase[ ][ ]*@without newphrase we'd have trouble extending @@ all@[ ]*;"
  18795. # The easiest way to test for newphrases in deltas and deltatexts
  18796. # is to just look at the whole file, I guess.
  18797. dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
  18798. "head 1\.5;
  18799. access;
  18800. symbols
  18801. branch:1.2.6;
  18802. locks;
  18803. testofanewphrase @without newphrase we'd have trouble extending @@ all@;
  18804. 1\.5
  18805. date 71\.01\.01\.01\.00\.00; author joe; state bogus;
  18806. branches;
  18807. next 1\.4;
  18808. 1\.4
  18809. date 71\.01\.01\.00\.00\.05; author joe; state bogus;
  18810. branches;
  18811. next 1\.3;
  18812. 1\.3
  18813. date 70\.12\.31\.15\.00\.05; author joe; state bogus;
  18814. branches;
  18815. next 1\.2;
  18816. 1\.2
  18817. date 70\.12\.31\.12\.15\.05; author me; state bogus;
  18818. branches
  18819. 1\.2\.6\.1;
  18820. next 1\.1;
  18821. 1\.1
  18822. date 70\.12\.31\.11\.00\.05; author joe; state bogus;
  18823. branches;
  18824. next ;
  18825. newph ;
  18826. 1\.2\.6\.1
  18827. date 71\.01\.01\.08\.00\.05; author joe; state Exp;
  18828. branches;
  18829. next 1\.2\.6\.2;
  18830. 1\.2\.6\.2
  18831. date [0-9.]*; author ${username}; state Exp;
  18832. branches;
  18833. next ;
  18834. desc
  18835. @@
  18836. 1\.5
  18837. log
  18838. @@
  18839. newphrase1 ;
  18840. newphrase2 42;
  18841. text
  18842. @head revision@
  18843. 1\.4
  18844. log
  18845. @@
  18846. text
  18847. @d1 1
  18848. a1 1
  18849. new year revision@
  18850. 1\.3
  18851. log
  18852. @@
  18853. text
  18854. @d1 1
  18855. a1 1
  18856. old year revision@
  18857. 1\.2
  18858. log
  18859. @@
  18860. text
  18861. @d1 1
  18862. a1 1
  18863. mid revision@
  18864. 1\.1
  18865. log
  18866. @@
  18867. text
  18868. @d1 1
  18869. a1 1
  18870. start revision@
  18871. 1\.2\.6\.1
  18872. log
  18873. @@
  18874. text
  18875. @d1 1
  18876. a1 1
  18877. branch revision@
  18878. 1\.2\.6\.2
  18879. log
  18880. @mod
  18881. @
  18882. text
  18883. @d1 1
  18884. a1 1
  18885. next branch revision
  18886. @"
  18887. dotest rcs-9 "${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2" \
  18888. "start revision"
  18889. dotest rcs-10 "${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2" \
  18890. "mid revision"
  18891. dotest rcs-11 "${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2" \
  18892. "new year revision"
  18893. # Same test as rcs-10, but with am/pm.
  18894. dotest rcs-12 "${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2" \
  18895. "mid revision"
  18896. # Same test as rcs-11, but with am/pm.
  18897. dotest rcs-13 "${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2" \
  18898. "new year revision"
  18899. # OK, now make sure cvs log doesn't have any trouble with the
  18900. # newphrases and such.
  18901. dotest rcs-14 "${testcvs} -q log file2" "
  18902. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  18903. Working file: file2
  18904. head: 1\.5
  18905. branch:
  18906. locks:
  18907. access list:
  18908. symbolic names:
  18909. branch: 1\.2\.6
  18910. keyword substitution: kv
  18911. total revisions: 7; selected revisions: 7
  18912. description:
  18913. ----------------------------
  18914. revision 1\.5
  18915. date: 1971/01/01 01:00:00; author: joe; state: bogus; lines: ${PLUS}1 -1
  18916. \*\*\* empty log message \*\*\*
  18917. ----------------------------
  18918. revision 1\.4
  18919. date: 1971/01/01 00:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1
  18920. \*\*\* empty log message \*\*\*
  18921. ----------------------------
  18922. revision 1\.3
  18923. date: 1970/12/31 15:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1
  18924. \*\*\* empty log message \*\*\*
  18925. ----------------------------
  18926. revision 1\.2
  18927. date: 1970/12/31 12:15:05; author: me; state: bogus; lines: ${PLUS}1 -1
  18928. branches: 1\.2\.6;
  18929. \*\*\* empty log message \*\*\*
  18930. ----------------------------
  18931. revision 1\.1
  18932. date: 1970/12/31 11:00:05; author: joe; state: bogus;
  18933. \*\*\* empty log message \*\*\*
  18934. ----------------------------
  18935. revision 1\.2\.6\.2
  18936. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
  18937. mod
  18938. ----------------------------
  18939. revision 1\.2\.6\.1
  18940. date: 1971/01/01 08:00:05; author: joe; state: Exp; lines: ${PLUS}1 -1
  18941. \*\*\* empty log message \*\*\*
  18942. ============================================================================="
  18943. # Now test each date format for "cvs log -d".
  18944. # Earlier than 1971-01-01
  18945. dotest rcs-15 "${testcvs} -q log -d '<1971-01-01 00:00 GMT' file2 \
  18946. | grep revision" \
  18947. "total revisions: 7; selected revisions: 3
  18948. revision 1\.3
  18949. revision 1\.2
  18950. revision 1\.1"
  18951. # Later than 1971-01-01
  18952. dotest rcs-16 "${testcvs} -q log -d '1971-01-01 00:00 GMT<' file2 \
  18953. | grep revision" \
  18954. "total revisions: 7; selected revisions: 4
  18955. revision 1\.5
  18956. revision 1\.4
  18957. revision 1\.2\.6\.2
  18958. revision 1\.2\.6\.1"
  18959. # Alternate syntaxes for later and earlier; multiple -d options
  18960. dotest rcs-17 "${testcvs} -q log -d '>1971-01-01 00:00 GMT' \
  18961. -d '1970-12-31 12:15 GMT>' file2 | grep revision" \
  18962. "total revisions: 7; selected revisions: 5
  18963. revision 1\.5
  18964. revision 1\.4
  18965. revision 1\.1
  18966. revision 1\.2\.6\.2
  18967. revision 1\.2\.6\.1"
  18968. # Range, and single date
  18969. dotest rcs-18 "${testcvs} -q log -d '1970-12-31 11:30 GMT' \
  18970. -d '1971-01-01 00:00:05 GMT<1971-01-01 01:00:01 GMT' \
  18971. file2 | grep revision" \
  18972. "total revisions: 7; selected revisions: 2
  18973. revision 1\.5
  18974. revision 1\.1"
  18975. # Alternate range syntax; equality
  18976. dotest rcs-19 "${testcvs} -q log \
  18977. -d '1971-01-01 01:00:01 GMT>=1971-01-01 00:00:05 GMT' \
  18978. file2 | grep revision" \
  18979. "total revisions: 7; selected revisions: 2
  18980. revision 1\.5
  18981. revision 1\.4"
  18982. cd ..
  18983. rm -r first-dir
  18984. rm -rf ${CVSROOT_DIRNAME}/first-dir
  18985. ;;
  18986. rcs2)
  18987. # More date tests. Might as well do this as a separate
  18988. # test from "rcs", so that we don't need to perturb the
  18989. # "written by RCS 5.7" RCS file.
  18990. mkdir ${CVSROOT_DIRNAME}/first-dir
  18991. # Significance of various dates:
  18992. # * At least one Y2K standard refers to recognizing 9 Sep 1999
  18993. # (as an example of a pre-2000 date, I guess).
  18994. # * At least one Y2K standard refers to recognizing 1 Jan 2001
  18995. # (as an example of a post-2000 date, I guess).
  18996. # * Many Y2K standards refer to 2000 being a leap year.
  18997. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  18998. head 1.7; access; symbols; locks; strict;
  18999. 1.7 date 2004.08.31.01.01.01; author sue; state; branches; next 1.6;
  19000. 1.6 date 2004.02.29.01.01.01; author sue; state; branches; next 1.5;
  19001. 1.5 date 2003.02.28.01.01.01; author sue; state; branches; next 1.4;
  19002. 1.4 date 2001.01.01.01.01.01; author sue; state; branches; next 1.3;
  19003. 1.3 date 2000.02.29.01.01.01; author sue; state; branches; next 1.2;
  19004. 1.2 date 99.09.09.01.01.01; author sue; state; branches; next 1.1;
  19005. 1.1 date 98.09.10.01.01.01; author sue; state; branches; next;
  19006. desc @a test file@
  19007. 1.7 log @@ text @head revision@
  19008. 1.6 log @@ text @d1 1
  19009. a1 1
  19010. 2004 was a great year for leaping@
  19011. 1.5 log @@ text @d1 1
  19012. a1 1
  19013. 2003 wasn't@
  19014. 1.4 log @@ text @d1 1
  19015. a1 1
  19016. two year hiatus@
  19017. 1.3 log @@ text @d1 1
  19018. a1 1
  19019. 2000 is also a good year for leaping@
  19020. 1.2 log @@ text @d1 1
  19021. a1 1
  19022. Tonight we're going to party like it's a certain year@
  19023. 1.1 log @@ text @d1 1
  19024. a1 1
  19025. Need to start somewhere@
  19026. EOF
  19027. # ' Match the 3rd single quote in the here doc -- for font-lock mode.
  19028. dotest rcs2-1 "${testcvs} -q co first-dir" 'U first-dir/file1'
  19029. cd first-dir
  19030. # 9 Sep 1999
  19031. dotest rcs2-2 "${testcvs} -q update -p -D '1999-09-09 11:30 UT' file1" \
  19032. "Tonight we're going to party like it's a certain year"
  19033. # 1 Jan 2001.
  19034. dotest rcs2-3 "${testcvs} -q update -p -D '2001-01-01 11:30 UT' file1" \
  19035. "two year hiatus"
  19036. # 29 Feb 2000
  19037. dotest rcs2-4 "${testcvs} -q update -p -D '2000-02-29 11:30 UT' file1" \
  19038. "2000 is also a good year for leaping"
  19039. # 29 Feb 2003 is invalid
  19040. dotest_fail rcs2-5 "${testcvs} -q update -p -D '2003-02-29 11:30 UT' file1" \
  19041. "${PROG} \[[a-z]* aborted\]: Can't parse date/time: 2003-02-29 11:30 UT"
  19042. dotest rcs2-6 "${testcvs} -q update -p -D 2007-01-07 file1" \
  19043. "head revision"
  19044. # This assumes that the clock of the machine running the tests
  19045. # is set to at least the year 1998 or so. There don't seem
  19046. # to be a lot of ways to test the relative date code (short
  19047. # of something like LD_LIBRARY_PRELOAD'ing in our own
  19048. # getttimeofday, or hacking the CVS source with testing
  19049. # features, which always seems to be problematic since then
  19050. # someone feels like documenting them and things go downhill
  19051. # from there).
  19052. #
  19053. # These tests can be expected to fail 3 times every 400 years
  19054. # starting Feb. 29, 2096 (because 8 years from that date would
  19055. # be Feb. 29, 2100, which is an invalid date -- 2100 isn't a
  19056. # leap year because it's divisible by 100 but not by 400).
  19057. dotest rcs2-7 "${testcvs} -q update -p -D '96 months' file1" \
  19058. "head revision"
  19059. dotest rcs2-8 "${testcvs} -q update -p -D '8 years' file1" \
  19060. "head revision"
  19061. cd ..
  19062. rm -r first-dir
  19063. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19064. ;;
  19065. rcs3)
  19066. # More RCS file tests, in particular at least some of the
  19067. # error handling issues.
  19068. mkdir ${CVSROOT_DIRNAME}/first-dir
  19069. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  19070. head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
  19071. ; author jeremiah ;state ; branches; next;desc@@1.1log@@text@head@
  19072. EOF
  19073. mkdir 1; cd 1
  19074. # CVS requires whitespace between "desc" and its value.
  19075. # The rcsfile(5) manpage doesn't really seem to answer the
  19076. # question one way or the other (it has a grammar but almost
  19077. # nothing about lexical analysis).
  19078. dotest_fail rcs3-1 "${testcvs} -q co first-dir" \
  19079. "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
  19080. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  19081. head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
  19082. ; author jeremiah ;state ; branches; next;desc @@1.1log@@text@head@
  19083. EOF
  19084. # Whitespace issues, likewise.
  19085. dotest_fail rcs3-2 "${testcvs} -q co first-dir" \
  19086. "${PROG} \[checkout aborted\]: unexpected '.x6c' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
  19087. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  19088. head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
  19089. ; author jeremiah ;state ; branches; next;desc @@1.1 log@@text@head@
  19090. EOF
  19091. # Charming array of different messages for similar
  19092. # whitespace issues (depending on where the whitespace is).
  19093. dotest_fail rcs3-3 "${testcvs} -q co first-dir" \
  19094. "${PROG} \[checkout aborted\]: EOF while looking for value in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
  19095. cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
  19096. head 1.1; access; symbols; locks; expand o; 1.1 date 2007.03.20.04.03.02
  19097. ; author jeremiah ;state ; branches; next;desc @@1.1 log @@text @head@
  19098. EOF
  19099. dotest rcs3-4 "${testcvs} -q co first-dir" 'U first-dir/file1'
  19100. # Ouch, didn't expect this one. FIXCVS. Or maybe just remove
  19101. # the feature, if this is a -s problem?
  19102. dotest_fail rcs3-5 "${testcvs} log -s nostate first-dir/file1" \
  19103. "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
  19104. cd first-dir
  19105. dotest_fail rcs3-5a "${testcvs} log -s nostate file1" \
  19106. "${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}"
  19107. cd ..
  19108. # See remote code above for rationale for cd.
  19109. cd first-dir
  19110. dotest rcs3-6 "${testcvs} log -R file1" \
  19111. "${CVSROOT_DIRNAME}/first-dir/file1,v"
  19112. # OK, now put an extraneous '\0' at the end.
  19113. ${AWK} </dev/null 'BEGIN { printf "@%c", 10 }' | ${TR} '@' '\000' \
  19114. >>${CVSROOT_DIRNAME}/first-dir/file1,v
  19115. dotest_fail rcs3-7 "${testcvs} log -s nostate file1" \
  19116. "${PROG} \[log aborted\]: unexpected '.x0' reading revision number in RCS file ${CVSROOT_DIRNAME}/first-dir/file1,v"
  19117. cd ../..
  19118. rm -r 1
  19119. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19120. ;;
  19121. rcs4)
  19122. # Fix a bug that shows up when checking out files by date with the
  19123. # "-D date" command line option. There is code in the original to
  19124. # handle a special case. If the date search finds revision 1.1 it
  19125. # is supposed to check whether revision 1.1.1.1 has the same date
  19126. # stamp, which would indicate that the file was originally brought
  19127. # in with "cvs import". In that case it is supposed to return the
  19128. # vendor branch version 1.1.1.1.
  19129. #
  19130. # However, there is a bug in the code. It actually compares
  19131. # the date of revision 1.1 for equality with the date given
  19132. # on the command line -- clearly wrong. This commit fixes
  19133. # the coding bug.
  19134. #
  19135. # There is an additional bug which is _not_ fixed yet.
  19136. # The date comparison should not be a strict
  19137. # equality test. It should allow a fudge factor of, say, 2-3
  19138. # seconds. Old versions of CVS created the two revisions
  19139. # with two separate invocations of the RCS "ci" command. We
  19140. # have many old files in the tree in which the dates of
  19141. # revisions 1.1 and 1.1.1.1 differ by 1 second.
  19142. mkdir rcs4
  19143. cd rcs4
  19144. mkdir imp-dir
  19145. cd imp-dir
  19146. echo 'OpenMunger sources' >file1
  19147. # choose a time in the past to demonstrate the problem
  19148. TZ=GMT touch -t 200012010123 file1
  19149. dotest_sort rcs4-1 \
  19150. "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_0" \
  19151. '
  19152. N rcs4-dir/file1
  19153. No conflicts created by this import'
  19154. echo 'OpenMunger sources release 1.1 extras' >>file1
  19155. TZ=GMT touch -t 200112011234 file1
  19156. dotest_sort rcs4-2 \
  19157. "${testcvs} import -d -m add rcs4-dir openmunger openmunger-1_1" \
  19158. '
  19159. No conflicts created by this import
  19160. U rcs4-dir/file1'
  19161. cd ..
  19162. # Next checkout the new module
  19163. dotest rcs4-3 \
  19164. "${testcvs} -q co rcs4-dir" \
  19165. 'U rcs4-dir/file1'
  19166. cd rcs4-dir
  19167. echo 'local change' >> file1
  19168. # commit a local change
  19169. dotest rcs4-4 \
  19170. "${testcvs} -q commit -m hack file1" \
  19171. "Checking in file1;
  19172. ${CVSROOT_DIRNAME}/rcs4-dir/file1,v <-- file1
  19173. new revision: 1\.2; previous revision: 1\.1
  19174. done"
  19175. # now see if we get version 1.1 or 1.1.1.1 when we ask for
  19176. # a checkout by time... it really should be 1.1.1.1 as
  19177. # that was indeed the version that was visible at the target
  19178. # time.
  19179. dotest rcs4-5 \
  19180. "${testcvs} -q update -D 'October 1, 2001 UTC' file1" \
  19181. '[UP] file1'
  19182. dotest rcs4-6 \
  19183. "${testcvs} -q status file1" \
  19184. '===================================================================
  19185. File: file1 Status: Up-to-date
  19186. Working revision: 1\.1\.1\.1.*
  19187. Repository revision: 1\.1\.1\.1 '${CVSROOT_DIRNAME}'/rcs4-dir/file1,v
  19188. Sticky Tag: (none)
  19189. Sticky Date: 2001\.10\.01\.00\.00\.00
  19190. Sticky Options: (none)'
  19191. if $keep; then
  19192. echo Keeping ${TESTDIR} and exiting due to --keep
  19193. exit 0
  19194. fi
  19195. cd ../..
  19196. rm -r rcs4
  19197. rm -rf ${CVSROOT_DIRNAME}/rcs4-dir
  19198. ;;
  19199. rcs5)
  19200. # Some tests of the $Log keyword and log message without a trailing
  19201. # EOL. This used to look ugly and, in the worst case, could cause
  19202. # a seg fault due to a buffer overflow.
  19203. #
  19204. # Note that it should not be possible to create this situation via a
  19205. # CVS server (and any client), since the server itself inserts the
  19206. # trailing EOL onto log messages that are missing one. Still, we
  19207. # shouldn't segfault due to a corrupt RCS file and I think that a log
  19208. # message without the trailing EOL doesn't actually violate the RCS
  19209. # spec, though it doesn't appear to be possible to create such a log
  19210. # message using RCS 5.7.
  19211. mkdir $CVSROOT_DIRNAME/rcs5
  19212. cat <<\EOF >$CVSROOT_DIRNAME/rcs5/file1,v
  19213. head 1.1;
  19214. access;
  19215. symbols;
  19216. locks;
  19217. expand kv;
  19218. 1.1 date 2007.03.20.04.03.02; author jeremiah; state Ext; branches; next;
  19219. desc
  19220. @@
  19221. 1.1
  19222. log
  19223. @he always had very fine wine@
  19224. text
  19225. @line1
  19226. /*
  19227. EOF
  19228. echo ' * Revision history: $''Log$' >>$CVSROOT_DIRNAME/rcs5/file1,v
  19229. cat <<\EOF >>$CVSROOT_DIRNAME/rcs5/file1,v
  19230. */
  19231. line5
  19232. @
  19233. EOF
  19234. mkdir rcs5
  19235. cd rcs5
  19236. dotest rcs5-1 "$testcvs -Q co rcs5"
  19237. dotest rcs5-2 "cat rcs5/file1" \
  19238. "line1
  19239. /\\*
  19240. \\* Revision history: "'\$'"Log: file1,v "'\$'"
  19241. \\* Revision history: Revision 1\.1 2007/03/20 04:03:02 jeremiah
  19242. \\* Revision history: he always had very fine wine
  19243. \\* Revision history:
  19244. \\*/
  19245. line5"
  19246. cd ..
  19247. rm -r rcs5
  19248. rm -rf $CVSROOT_DIRNAME/rcs5
  19249. ;;
  19250. rcs6)
  19251. # Test that CVS notices a specific type of corruption in the RCS
  19252. # archive. In the past, this type of corruption had turned up after
  19253. # a user ineptly attempted to delete a revision from an arcvhive
  19254. # manually.
  19255. mkdir rcs6; cd rcs6
  19256. # Make the project.
  19257. dotest rcs6-init-1 "$testcvs -Q co -ld top .; cd top"
  19258. mkdir rcs6
  19259. dotest rcs6-init-2 "$testcvs -Q add rcs6"
  19260. cd rcs6
  19261. # Populate it.
  19262. echo some words >afile
  19263. dotest rcs6-init-3 "$testcvs -Q add afile"
  19264. dotest rcs6-init-4 "$testcvs -Q ci -mnewfile afile" \
  19265. "RCS file: $CVSROOT_DIRNAME/rcs6/afile,v
  19266. done
  19267. Checking in afile;
  19268. $CVSROOT_DIRNAME/rcs6/afile,v <-- afile
  19269. initial revision: 1\.1
  19270. done"
  19271. echo more words >>afile
  19272. dotest rcs6-init-5 "$testcvs -Q ci -mrev2 afile" \
  19273. "Checking in afile;
  19274. $CVSROOT_DIRNAME/rcs6/afile,v <-- afile
  19275. new revision: 1\.2; previous revision: 1\.1
  19276. done"
  19277. # Corrupt the archive.
  19278. sed -e '8,12d' \
  19279. -e 's/^head 1\.2/head 1.1/' \
  19280. <$CVSROOT_DIRNAME/rcs6/afile,v \
  19281. >$CVSROOT_DIRNAME/rcs6/cfile,v
  19282. # Update used to work.
  19283. dotest_fail rcs6-1 "$testcvs -q up" \
  19284. "$PROG \[update aborted\]: Expected head revision 1\.1, found 1\.2\."
  19285. # Then a commit hosed the archive further without any warnings.
  19286. # Updating to an old revision (e.g. 1.1) would have reported the
  19287. # corruption. A second commit would have deleted data from the
  19288. # file.
  19289. if $keep; then
  19290. echo Keeping $TESTDIR and exiting due to --keep
  19291. exit 0
  19292. fi
  19293. cd ../../..
  19294. rm -r rcs6
  19295. rm -rf $CVSROOT_DIRNAME/rcs6
  19296. ;;
  19297. lockfiles)
  19298. # Tests of CVS lock files.
  19299. # TODO-maybe: Add a test where we arrange for a loginfo
  19300. # script (or some such) to ensure that locks are in place
  19301. # so then we can see how they are behaving.
  19302. mkdir 1; cd 1
  19303. mkdir sdir
  19304. mkdir sdir/ssdir
  19305. echo file >sdir/ssdir/file1
  19306. dotest lockfiles-1 \
  19307. "${testcvs} -Q import -m import-it first-dir bar baz" ""
  19308. cd ..
  19309. mkdir 2; cd 2
  19310. dotest lockfiles-2 "${testcvs} -q co first-dir" \
  19311. "U first-dir/sdir/ssdir/file1"
  19312. dotest lockfiles-3 "${testcvs} -Q co CVSROOT" ""
  19313. cd CVSROOT
  19314. echo "LockDir=${TESTDIR}/locks" >config
  19315. dotest lockfiles-4 "${testcvs} -q ci -m config-it" \
  19316. "Checking in config;
  19317. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  19318. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  19319. done
  19320. ${PROG} commit: Rebuilding administrative file database"
  19321. cd ../first-dir/sdir/ssdir
  19322. # The error message appears twice because Lock_Cleanup only
  19323. # stops recursing after the first attempt.
  19324. dotest_fail lockfiles-5 "${testcvs} -q update" \
  19325. "${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory
  19326. ${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or directory"
  19327. mkdir ${TESTDIR}/locks
  19328. # Grumble, mumble. Cygwin.
  19329. if test -n "$remotehost"; then
  19330. $CVS_RSH $remotehost "chmod u=rwx,g=r,o= ${TESTDIR}/locks"
  19331. else
  19332. chmod u=rwx,g=r,o= ${TESTDIR}/locks
  19333. fi
  19334. umask 0077
  19335. CVSUMASK=0077; export CVSUMASK
  19336. dotest lockfiles-6 "${testcvs} -q update" ""
  19337. # TODO: should also be testing that CVS continues to honor the
  19338. # umask and CVSUMASK normally. In the case of the umask, CVS
  19339. # doesn't seem to use it for much (although it perhaps should).
  19340. dotest lockfiles-7 "ls ${TESTDIR}/locks/first-dir/sdir/ssdir" ""
  19341. # The policy is that when CVS creates new lock directories, they
  19342. # inherit the permissions from the parent directory. CVSUMASK
  19343. # isn't right, because typically the reason for LockDir is to
  19344. # use a different set of permissions.
  19345. #
  19346. # Bah! Cygwin!
  19347. if test -n "$remotehost"; then
  19348. dotest lockfiles-7a "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir'" \
  19349. "drwxr-----.*first-dir"
  19350. dotest lockfiles-7b "$CVS_RSH $remotehost 'ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir'" \
  19351. "drwxr-----.*first-dir/sdir/ssdir"
  19352. else
  19353. dotest lockfiles-7a "ls -ld ${TESTDIR}/locks/first-dir" \
  19354. "drwxr-----.*first-dir"
  19355. dotest lockfiles-7b "ls -ld ${TESTDIR}/locks/first-dir/sdir/ssdir" \
  19356. "drwxr-----.*first-dir/sdir/ssdir"
  19357. fi
  19358. cd ../../..
  19359. dotest lockfiles-8 "${testcvs} -q update" ""
  19360. dotest lockfiles-9 "${testcvs} -q co -l ." ""
  19361. ###
  19362. ### There are race conditions in the following tests, but hopefully
  19363. ### the 5 seconds the first process waits to remove the lockdir and
  19364. ### the 30 seconds CVS waits betweens checks will be significant
  19365. ### enough to render the case moot.
  19366. ###
  19367. # Considers the following cases:
  19368. #
  19369. # Lock Present
  19370. # Operation Allowed (case #)
  19371. #
  19372. # Read Write
  19373. # _______ ______
  19374. # Read |Yes (1) No (3)
  19375. # Write |No (7) No (9)
  19376. #
  19377. # Tests do not appear in same ordering as table. The odd numbering
  19378. # scheme maintains correspondance with a larger table on 1.12.x:
  19379. # 1. Read when read locks are present...
  19380. # 3. Don't read when write locks present...
  19381. # 7. Don't write when read locks are present...
  19382. # 9. Don't write when write locks are present...
  19383. # 3. Don't read when write locks present...
  19384. mkdir "$TESTDIR/locks/first-dir/#cvs.lock"
  19385. (sleep 5; rmdir "$TESTDIR/locks/first-dir/#cvs.lock")&
  19386. dotest lockfiles-10 "$testcvs -q co -l first-dir" \
  19387. "$PROG checkout: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir
  19388. $PROG checkout: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir"
  19389. # 1. Read when read locks are present...
  19390. touch "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock"
  19391. dotest lockfiles-11 "$testcvs -q co -l first-dir"
  19392. rm "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock"
  19393. # 7. Don't write when read locks are present...
  19394. echo I always have trouble coming up with witty text for the test files >>first-dir/sdir/ssdir/file1
  19395. touch "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock"
  19396. (sleep 5; rm "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock")&
  19397. dotest lockfiles-13 "$testcvs -q ci -mconflict first-dir" \
  19398. "$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
  19399. $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
  19400. Checking in first-dir/sdir/ssdir/file1;
  19401. $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1
  19402. new revision: 1\.2; previous revision: 1\.1
  19403. done"
  19404. # 9. Don't write when write locks are present...
  19405. echo yet this poem would probably only give longfellow bile >>first-dir/sdir/ssdir/file1
  19406. mkdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock"
  19407. (sleep 5; rmdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock")&
  19408. dotest lockfiles-19 "$testcvs -q ci -mnot-up-to-date first-dir" \
  19409. "$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
  19410. $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir
  19411. Checking in first-dir/sdir/ssdir/file1;
  19412. $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1
  19413. new revision: 1\.3; previous revision: 1\.2
  19414. done"
  19415. # 10. Don't write when history locks are present...
  19416. echo have you ever heard a poem quite so vile\? >>first-dir/sdir/ssdir/file1
  19417. mkdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock"
  19418. (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock")&
  19419. dotest lockfiles-20 "$testcvs -q ci -mnot-up-to-date first-dir" \
  19420. "Checking in first-dir/sdir/ssdir/file1;
  19421. $CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1
  19422. new revision: 1\.4; previous revision: 1\.3
  19423. done
  19424. $PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT
  19425. $PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT"
  19426. dotest lockfiles-21 "$testcvs -Q tag newtag first-dir"
  19427. rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags
  19428. mkdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock"
  19429. (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock")&
  19430. dotest lockfiles-22 "$testcvs -q up -r newtag first-dir" \
  19431. "$PROG update: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT
  19432. $PROG update: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT
  19433. [UP] first-dir/sdir/ssdir/file1"
  19434. cd CVSROOT
  19435. echo "# nobody here but us comments" >config
  19436. dotest lockfiles-cleanup-1 "${testcvs} -q ci -m config-it" \
  19437. "Checking in config;
  19438. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  19439. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  19440. done
  19441. ${PROG} commit: Rebuilding administrative file database"
  19442. cd ../..
  19443. # Perhaps should restore the umask and CVSUMASK to what they
  19444. # were before. But the other tests "should" not care about them...
  19445. umask 0077
  19446. unset CVSUMASK
  19447. rm -r ${TESTDIR}/locks
  19448. rm -r 1 2
  19449. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19450. ;;
  19451. backuprecover)
  19452. # Tests to make sure we get the expected behavior
  19453. # when we recover a repository from an old backup
  19454. #
  19455. # Details:
  19456. # Backup will be older than some developer's workspaces
  19457. # This means the first attempt at an update will fail
  19458. # The workaround for this is to replace the CVS
  19459. # directories with those from a "new" checkout from
  19460. # the recovered repository. Due to this, multiple
  19461. # merges should cause conflicts (the same data
  19462. # will be merged more than once).
  19463. # A workspace updated before the date of the recovered
  19464. # copy will not need any extra attention
  19465. #
  19466. # Note that backuprecover-15 is probably a failure case
  19467. # If nobody else had a more recent update, the data would be lost
  19468. # permanently
  19469. # Granted, the developer should have been notified not to do this
  19470. # by now, but still...
  19471. #
  19472. mkdir backuprecover; cd backuprecover
  19473. mkdir 1; cd 1
  19474. dotest backuprecover-1 "${testcvs} -q co -l ." ''
  19475. mkdir first-dir
  19476. dotest backuprecover-2 "${testcvs} add first-dir" \
  19477. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  19478. cd first-dir
  19479. mkdir dir
  19480. dotest backuprecover-3 "${testcvs} add dir" \
  19481. "Directory ${CVSROOT_DIRNAME}/first-dir/dir added to the repository"
  19482. touch file1 dir/file2
  19483. dotest backuprecover-4 "${testcvs} -q add file1 dir/file2" \
  19484. "${PROG} add: use .${PROG} commit. to add these files permanently"
  19485. dotest backuprecover-5 "${testcvs} -q ci -mtest" \
  19486. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  19487. done
  19488. Checking in file1;
  19489. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19490. initial revision: 1\.1
  19491. done
  19492. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
  19493. done
  19494. Checking in dir/file2;
  19495. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19496. initial revision: 1\.1
  19497. done"
  19498. echo "Line one" >>file1
  19499. echo " is the place" >>file1
  19500. echo " we like to begin" >>file1
  19501. echo "Anything else" >>file1
  19502. echo " looks like" >>file1
  19503. echo " a sin" >>file1
  19504. echo "File 2" >>dir/file2
  19505. echo " is the place" >>dir/file2
  19506. echo " the rest of it goes" >>dir/file2
  19507. echo "Why I don't use" >>dir/file2
  19508. echo " something like 'foo'" >>dir/file2
  19509. echo " God only knows" >>dir/file2
  19510. dotest backuprecover-6 "${testcvs} -q ci -mtest" \
  19511. "Checking in file1;
  19512. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19513. new revision: 1\.2; previous revision: 1\.1
  19514. done
  19515. Checking in dir/file2;
  19516. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19517. new revision: 1\.2; previous revision: 1\.1
  19518. done"
  19519. # Simulate the lazy developer
  19520. # (he did some work but didn't check it in...)
  19521. cd ../..
  19522. mkdir 2; cd 2
  19523. dotest backuprecover-7 "${testcvs} -Q co first-dir" ''
  19524. cd first-dir
  19525. sed -e "s/looks like/just looks like/" file1 >tmp; mv tmp file1
  19526. sed -e "s/don't use/don't just use/" dir/file2 >tmp; mv tmp dir/file2
  19527. # developer 1 is on a roll
  19528. cd ../../1/first-dir
  19529. echo "I need some more words" >>file1
  19530. echo " to fill up this space" >>file1
  19531. echo " anything else would be a disgrace" >>file1
  19532. echo "My rhymes cross many boundries" >>dir/file2
  19533. echo " this time it's files" >>dir/file2
  19534. echo " a word that fits here would be something like dials" >>dir/file2
  19535. dotest backuprecover-8 "${testcvs} -q ci -mtest" \
  19536. "Checking in file1;
  19537. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19538. new revision: 1\.3; previous revision: 1\.2
  19539. done
  19540. Checking in dir/file2;
  19541. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19542. new revision: 1\.3; previous revision: 1\.2
  19543. done"
  19544. # Save a backup copy
  19545. cp -r ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/backup
  19546. # Simulate developer 3
  19547. cd ../..
  19548. mkdir 3; cd 3
  19549. dotest backuprecover-9a "${testcvs} -Q co first-dir" ''
  19550. cd first-dir
  19551. echo >>file1
  19552. echo >>dir/file2
  19553. echo "Developer 1 makes very lame rhymes" >>file1
  19554. echo " I think he should quit and become a mime" >>file1
  19555. echo "What the %*^# kind of rhyme crosses a boundry?" >>dir/file2
  19556. echo " I think you should quit and get a job in the foundry" >>dir/file2
  19557. dotest backuprecover-9b "${testcvs} -q ci -mtest" \
  19558. "Checking in file1;
  19559. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19560. new revision: 1\.4; previous revision: 1\.3
  19561. done
  19562. Checking in dir/file2;
  19563. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19564. new revision: 1\.4; previous revision: 1\.3
  19565. done"
  19566. # Developer 4 so we can simulate a conflict later...
  19567. cd ../..
  19568. mkdir 4; cd 4
  19569. dotest backuprecover-10 "${testcvs} -Q co first-dir" ''
  19570. cd first-dir
  19571. sed -e "s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
  19572. # And back to developer 1
  19573. cd ../../1/first-dir
  19574. dotest backuprecover-11 "${testcvs} -Q update" ''
  19575. echo >>file1
  19576. echo >>dir/file2
  19577. echo "Oh yeah, well rhyme this" >>file1
  19578. echo " developer three" >>file1
  19579. echo " you want opposition" >>file1
  19580. echo " you found some in me!" >>file1
  19581. echo "I'll give you mimes" >>dir/file2
  19582. echo " and foundries galore!" >>dir/file2
  19583. echo " your head will spin" >>dir/file2
  19584. echo " once you find what's in store!" >>dir/file2
  19585. dotest backuprecover-12 "${testcvs} -q ci -mtest" \
  19586. "Checking in file1;
  19587. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19588. new revision: 1\.5; previous revision: 1\.4
  19589. done
  19590. Checking in dir/file2;
  19591. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19592. new revision: 1\.5; previous revision: 1\.4
  19593. done"
  19594. # developer 3'll do a bit of work that never gets checked in
  19595. cd ../../3/first-dir
  19596. dotest backuprecover-13 "${testcvs} -Q update" ''
  19597. sed -e "s/very/some extremely/" file1 >tmp; mv tmp file1
  19598. dotest backuprecover-14 "${testcvs} -q ci -mtest" \
  19599. "Checking in file1;
  19600. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19601. new revision: 1\.6; previous revision: 1\.5
  19602. done"
  19603. echo >>file1
  19604. echo "Tee hee hee hee" >>file1
  19605. echo >>dir/file2
  19606. echo "Find what's in store?" >>dir/file2
  19607. echo " Oh, I'm so sure!" >>dir/file2
  19608. echo " You've got an ill, and I have the cure!" >>dir/file2
  19609. # Slag the original and restore it a few revisions back
  19610. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19611. mv ${CVSROOT_DIRNAME}/backup ${CVSROOT_DIRNAME}/first-dir
  19612. # Have developer 1 try an update and lose some data
  19613. #
  19614. # Feel free to imagine the horrific scream of despair
  19615. cd ../../1/first-dir
  19616. dotest backuprecover-15 "${testcvs} update" \
  19617. "${PROG} update: Updating .
  19618. U file1
  19619. ${PROG} update: Updating dir
  19620. U dir/file2"
  19621. # Developer 3 tries the same thing (he has an office)
  19622. # but fails without losing data since all of his files have
  19623. # uncommitted changes
  19624. cd ../../3/first-dir
  19625. dotest_fail backuprecover-16 "${testcvs} update" \
  19626. "${PROG} update: Updating \.
  19627. ${PROG} \[update aborted\]: could not find desired version 1\.6 in ${CVSROOT_DIRNAME}/first-dir/file1,v"
  19628. # create our workspace fixin' script
  19629. cd ../..
  19630. echo \
  19631. "#!/bin/sh
  19632. # This script will copy the CVS database dirs from the checked out
  19633. # version of a newly recovered repository and replace the CVS
  19634. # database dirs in a workspace with later revisions than those in the
  19635. # recovered repository
  19636. cd repos-first-dir
  19637. DATADIRS=\`find . -name CVS -print\`
  19638. cd ../first-dir
  19639. find . -name CVS -print | xargs rm -rf
  19640. for file in \${DATADIRS}; do
  19641. cp -r ../repos-first-dir/\${file} \${file}
  19642. done" >fixit
  19643. # We only need to fix the workspaces of developers 3 and 4
  19644. # (1 lost all her data and 2 has an update date from
  19645. # before the date the backup was made)
  19646. cd 3
  19647. dotest backuprecover-17 \
  19648. "${testcvs} -Q co -d repos-first-dir first-dir" ''
  19649. cd ../4
  19650. dotest backuprecover-18 \
  19651. "${testcvs} -Q co -d repos-first-dir first-dir" ''
  19652. sh ../fixit
  19653. cd ../3; sh ../fixit
  19654. # (re)commit developer 3's stuff
  19655. cd first-dir
  19656. dotest backuprecover-19 "${testcvs} -q ci -mrecover/merge" \
  19657. "Checking in file1;
  19658. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19659. new revision: 1\.4; previous revision: 1\.3
  19660. done
  19661. Checking in dir/file2;
  19662. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19663. new revision: 1\.4; previous revision: 1\.3
  19664. done"
  19665. # and we should get a conflict on developer 4's stuff
  19666. cd ../../4/first-dir
  19667. dotest backuprecover-20 "${testcvs} update" \
  19668. "${PROG} update: Updating \.
  19669. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  19670. retrieving revision 1\.3
  19671. retrieving revision 1\.4
  19672. Merging differences between 1\.3 and 1\.4 into file1
  19673. rcsmerge: warning: conflicts during merge
  19674. ${PROG} update: conflicts found in file1
  19675. C file1
  19676. ${PROG} update: Updating dir
  19677. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
  19678. retrieving revision 1\.3
  19679. retrieving revision 1\.4
  19680. Merging differences between 1\.3 and 1\.4 into file2
  19681. rcsmerge: warning: conflicts during merge
  19682. ${PROG} update: conflicts found in dir/file2
  19683. C dir/file2"
  19684. sed -e \
  19685. "/^<<<<<<</,/^=======/d
  19686. /^>>>>>>>/d" file1 >tmp; mv tmp file1
  19687. sed -e \
  19688. "/^<<<<<<</,/^=======/d
  19689. /^>>>>>>>/d
  19690. s/quit and/be fired so he can/" dir/file2 >tmp; mv tmp dir/file2
  19691. dotest backuprecover-21 "${testcvs} -q ci -mrecover/merge" \
  19692. "Checking in dir/file2;
  19693. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19694. new revision: 1\.5; previous revision: 1\.4
  19695. done"
  19696. # go back and commit developer 2's stuff to prove it can still be done
  19697. cd ../../2/first-dir
  19698. dotest backuprecover-22 "${testcvs} -Q update" \
  19699. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  19700. retrieving revision 1\.2
  19701. retrieving revision 1\.4
  19702. Merging differences between 1\.2 and 1\.4 into file1
  19703. RCS file: ${CVSROOT_DIRNAME}/first-dir/dir/file2,v
  19704. retrieving revision 1\.2
  19705. retrieving revision 1\.5
  19706. Merging differences between 1\.2 and 1\.5 into file2"
  19707. dotest backuprecover-23 "${testcvs} -q ci -mtest" \
  19708. "Checking in file1;
  19709. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19710. new revision: 1\.5; previous revision: 1\.4
  19711. done
  19712. Checking in dir/file2;
  19713. ${CVSROOT_DIRNAME}/first-dir/dir/file2,v <-- file2
  19714. new revision: 1\.6; previous revision: 1\.5
  19715. done"
  19716. # and restore the data to developer 1
  19717. cd ../../1/first-dir
  19718. dotest backuprecover-24 "${testcvs} -Q update" ''
  19719. cd ../../..
  19720. rm -r backuprecover
  19721. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19722. ;;
  19723. sshstdio)
  19724. # CVS_RSH=ssh can have a problem with a non-blocking stdio
  19725. # in some cases. So, this test is all about testing :ext:
  19726. # with CVS_RSH=ssh. The problem is that not all machines
  19727. # will necessarily have ssh available, so be prepared to
  19728. # skip this test.
  19729. # Are we able to run find and use an ssh?
  19730. if $remote; then :; else
  19731. continue
  19732. fi
  19733. depends_on_ssh
  19734. if test $? -eq 77; then
  19735. skip sshstdio "$skipreason"
  19736. continue
  19737. fi
  19738. SSHSTDIO_ROOT=:ext:$host$CVSROOT_DIRNAME
  19739. mkdir sshstdio; cd sshstdio
  19740. dotest sshstdio-1 "$testcvs -d $SSHSTDIO_ROOT -q co -l ."
  19741. mkdir first-dir
  19742. dotest sshstdio-2 "$testcvs add first-dir" \
  19743. "Directory $CVSROOT_DIRNAME/first-dir added to the repository"
  19744. cd first-dir
  19745. a='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
  19746. c='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
  19747. # Generate 1024 lines of $a
  19748. cnt=0
  19749. echo $a > aaa
  19750. while [ $cnt -lt 5 ] ; do
  19751. cnt=`expr $cnt + 1` ;
  19752. mv aaa aaa.old
  19753. cat aaa.old aaa.old aaa.old aaa.old > aaa
  19754. done
  19755. dotest sshstdio-3 "$testcvs -q add aaa" \
  19756. "$PROG add: use .$PROG commit. to add this file permanently"
  19757. dotest sshstdio-4 "$testcvs -q ci -mcreate aaa" \
  19758. "RCS file: $CVSROOT_DIRNAME/first-dir/aaa,v
  19759. done
  19760. Checking in aaa;
  19761. $CVSROOT_DIRNAME/first-dir/aaa,v <-- aaa
  19762. initial revision: 1\.1
  19763. done"
  19764. # replace lines 1, 512, 513, 1024 with $c
  19765. sed 510q < aaa > aaa.old
  19766. (echo $c; cat aaa.old; echo $c; \
  19767. echo $c; cat aaa.old; echo $c) > aaa
  19768. dotest sshstdio-5 "$testcvs -q ci -mmodify-it aaa" \
  19769. "Checking in aaa;
  19770. $CVSROOT_DIRNAME/first-dir/aaa,v <-- aaa
  19771. new revision: 1\.2; previous revision: 1\.1
  19772. done"
  19773. cat > wrapper.sh <<EOF
  19774. #!$TESTSHELL
  19775. exec "\$@" 2>&1 < /dev/null | cat
  19776. EOF
  19777. chmod +x wrapper.sh
  19778. ./wrapper.sh \
  19779. $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \
  19780. aaa \
  19781. |sed -e \
  19782. '/^Write failed flushing stdout buffer\. $/d;
  19783. /^write stdout: Broken pipe $/d;
  19784. :retry;
  19785. /Write failed flushing stdout buffer\. $/{
  19786. N;
  19787. s/Write failed flushing stdout buffer\. \n//;
  19788. b retry;
  19789. }
  19790. /write stdout: Broken pipe $/{
  19791. N;
  19792. s/write stdout: Broken pipe \n//;
  19793. b retry;
  19794. }' \
  19795. > wrapper.dif
  19796. $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \
  19797. aaa > good.dif
  19798. dotest sshstdio-6 "cmp wrapper.dif good.dif"
  19799. if $keep; then
  19800. echo Keeping $TESTDIR and exiting due to --keep
  19801. exit 0
  19802. fi
  19803. cd ../..
  19804. CVS_RSH=$save_CVS_RSH; export CVS_RSH
  19805. rm -r sshstdio
  19806. rm -rf $CVSROOT_DIRNAME/first-dir
  19807. ;;
  19808. parseroot2)
  19809. # Test some :ext: roots for consistancy.
  19810. if $remote; then :; else
  19811. continue
  19812. fi
  19813. depends_on_rsh "$CVS_RSH"
  19814. if test $? -eq 77; then
  19815. skip parseroot2 "$skipreason"
  19816. continue
  19817. fi
  19818. # Test checking out and subsequently updating with some different
  19819. # CVSROOTs.
  19820. # A standard case, hostname:dirname.
  19821. mkdir parseroot2; cd parseroot2
  19822. save_CVSROOT=$CVSROOT
  19823. CVSROOT=$host:$CVSROOT_DIRNAME
  19824. dotest parseroot2-1 "$testcvs -Q co CVSROOT"
  19825. cd CVSROOT
  19826. dotest parseroot2-2 "$testcvs -Q up"
  19827. cd ..
  19828. # A degenerate remote case, just the server name and the directory
  19829. # name, with no :'s to help parsing. It can be mistaken for a
  19830. # relative directory name.
  19831. rm -r CVSROOT
  19832. CVSROOT=$host$CVSROOT_DIRNAME
  19833. dotest parseroot2-3 "$testcvs -Q co CVSROOT"
  19834. cd CVSROOT
  19835. dotest parseroot2-4 "$testcvs -Q up"
  19836. if $keep; then
  19837. echo Keeping $TESTDIR and exiting due to --keep
  19838. exit 0
  19839. fi
  19840. cd ../..
  19841. CVSROOT=$save_CVSROOT
  19842. rm -r parseroot2
  19843. ;;
  19844. history)
  19845. # CVSROOT/history tests:
  19846. # history: various "cvs history" invocations
  19847. # basic2: Generating the CVSROOT/history file via CVS commands.
  19848. # Put in some data for the history file (discarding what was
  19849. # there before). Note that this file format is fixed; the
  19850. # user may wish to analyze data from a previous version of
  19851. # CVS. If we phase out this format, it should be done
  19852. # slowly and carefully.
  19853. cat >${CVSROOT_DIRNAME}/CVSROOT/history <<EOF
  19854. O3395c677|anonymous|<remote>/*0|ccvs||ccvs
  19855. O3396c677|anonymous|<remote>/src|ccvs||src
  19856. O3397c677|kingdon|<remote>/*0|ccvs||ccvs
  19857. M339cafae|nk|<remote>|ccvs/src|1.229|sanity.sh
  19858. M339cafff|anonymous|<remote>|ccvs/src|1.23|Makefile
  19859. M339dc339|kingdon|~/work/*0|ccvs/src|1.231|sanity.sh
  19860. W33a6eada|anonymous|<remote>*4|ccvs/emx||Makefile.in
  19861. C3b235f50|kingdon|<remote>|ccvs/emx|1.3|README
  19862. M3b23af50|kingdon|~/work/*0|ccvs/doc|1.281|cvs.texinfo
  19863. EOF
  19864. dotest history-1 "${testcvs} history -e -a" \
  19865. "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
  19866. O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src= <remote>/\*
  19867. M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23 Makefile ccvs/src == <remote>
  19868. W 1997-06-17 19:51 ${PLUS}0000 anonymous Makefile\.in ccvs/emx == <remote>/emx
  19869. O 1997-06-06 08:12 ${PLUS}0000 kingdon ccvs =ccvs= <remote>/\*
  19870. M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19871. C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3 README ccvs/emx == <remote>
  19872. M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc
  19873. M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity\.sh ccvs/src == <remote>"
  19874. dotest history-2 "${testcvs} history -e -a -D '10 Jun 1997 13:00 UT'" \
  19875. "W 1997-06-17 19:51 ${PLUS}0000 anonymous Makefile\.in ccvs/emx == <remote>/emx
  19876. M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19877. C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3 README ccvs/emx == <remote>
  19878. M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
  19879. dotest history-3 "${testcvs} history -e -a -D '10 Jun 2001 13:00 UT'" \
  19880. "M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs\.texinfo ccvs/doc == ~/work/ccvs/doc"
  19881. dotest history-4 "${testcvs} history -ac sanity.sh" \
  19882. "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19883. M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity\.sh ccvs/src == <remote>"
  19884. dotest history-5 "${testcvs} history -a -xCGUWAMR README sanity.sh" \
  19885. "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19886. C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3 README ccvs/emx == <remote>
  19887. M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity\.sh ccvs/src == <remote>"
  19888. dotest history-6 "${testcvs} history -xCGUWAMR -a -f README -f sanity.sh" \
  19889. "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19890. C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3 README ccvs/emx == <remote>
  19891. M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity\.sh ccvs/src == <remote>"
  19892. dotest history-7 "${testcvs} history -xCGUWAMR -a -f sanity.sh README" \
  19893. "M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity\.sh ccvs/src == ~/work/ccvs/src
  19894. C 2001-06-10 11:51 ${PLUS}0000 kingdon 1\.3 README ccvs/emx == <remote>
  19895. M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity\.sh ccvs/src == <remote>"
  19896. dotest history-8 "${testcvs} history -ca -D '1970-01-01 00:00 UT'" \
  19897. "M 1997-06-10 01:36 ${PLUS}0000 nk 1\.229 sanity.sh ccvs/src == <remote>
  19898. M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23 Makefile ccvs/src == <remote>
  19899. M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity.sh ccvs/src == ~/work/ccvs/src
  19900. M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc"
  19901. dotest history-9 "${testcvs} history -acl" \
  19902. "M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
  19903. M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23 Makefile ccvs/src == <remote>
  19904. M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity.sh ccvs/src == ~/work/ccvs/src"
  19905. dotest history-10 "${testcvs} history -lca -D '1970-01-01 00:00 UT'" \
  19906. "M 2001-06-10 17:33 ${PLUS}0000 kingdon 1\.281 cvs.texinfo ccvs/doc == ~/work/ccvs/doc
  19907. M 1997-06-10 01:38 ${PLUS}0000 anonymous 1\.23 Makefile ccvs/src == <remote>
  19908. M 1997-06-10 21:12 ${PLUS}0000 kingdon 1\.231 sanity.sh ccvs/src == ~/work/ccvs/src"
  19909. dotest history-11 "${testcvs} history -aw" \
  19910. "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
  19911. O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src= <remote>/\*
  19912. O 1997-06-06 08:12 ${PLUS}0000 kingdon ccvs =ccvs= <remote>/\*"
  19913. dotest history-12 "${testcvs} history -aw -D'1970-01-01 00:00 UT'" \
  19914. "O 1997-06-04 19:48 ${PLUS}0000 anonymous ccvs =ccvs= <remote>/\*
  19915. O 1997-06-05 14:00 ${PLUS}0000 anonymous ccvs =src= <remote>/\*
  19916. O 1997-06-06 08:12 ${PLUS}0000 kingdon ccvs =ccvs= <remote>/\*"
  19917. ;;
  19918. big)
  19919. # Test ability to operate on big files. Intention is to
  19920. # test various realloc'ing code in RCS_deltas, rcsgetkey,
  19921. # etc. "big" is currently defined to be 1000 lines (64000
  19922. # bytes), which in terms of files that users will use is not
  19923. # large, merely average, but my reasoning is that this
  19924. # should be big enough to make sure realloc'ing is going on
  19925. # and that raising it a lot would start to stress resources
  19926. # on machines which run the tests, without any significant
  19927. # benefit.
  19928. mkdir ${CVSROOT_DIRNAME}/first-dir
  19929. dotest big-1 "${testcvs} -q co first-dir" ''
  19930. cd first-dir
  19931. for i in 0 1 2 3 4 5 6 7 8 9; do
  19932. for j in 0 1 2 3 4 5 6 7 8 9; do
  19933. for k in 0 1 2 3 4 5 6 7 8 9; do
  19934. echo \
  19935. "This is line ($i,$j,$k) which goes into the file file1 for testing" >>file1
  19936. done
  19937. done
  19938. done
  19939. dotest big-2 "${testcvs} add file1" \
  19940. "${PROG} add: scheduling file .file1. for addition
  19941. ${PROG} add: use .${PROG} commit. to add this file permanently"
  19942. dotest big-3 "${testcvs} -q ci -m add" \
  19943. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  19944. done
  19945. Checking in file1;
  19946. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19947. initial revision: 1\.1
  19948. done"
  19949. cd ..
  19950. mkdir 2
  19951. cd 2
  19952. dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
  19953. cd ../first-dir
  19954. echo "add a line to the end" >>file1
  19955. dotest big-5 "${testcvs} -q ci -m modify" \
  19956. "Checking in file1;
  19957. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  19958. new revision: 1\.2; previous revision: 1\.1
  19959. done"
  19960. cd ../2/first-dir
  19961. # The idea here is particularly to test the Rcs-diff response
  19962. # and the reallocing thereof, for remote.
  19963. dotest big-6 "${testcvs} -q update" "[UP] file1"
  19964. cd ../..
  19965. if $keep; then
  19966. echo Keeping ${TESTDIR} and exiting due to --keep
  19967. exit 0
  19968. fi
  19969. rm -r first-dir 2
  19970. rm -rf ${CVSROOT_DIRNAME}/first-dir
  19971. ;;
  19972. modes)
  19973. # Test repository permissions (CVSUMASK and so on).
  19974. # Although the tests in this section "cheat" by testing
  19975. # repository permissions, which are sort of not a user-visible
  19976. # sort of thing, the modes do have user-visible consequences,
  19977. # such as whether a second user can check out the files. But
  19978. # it would be awkward to test the consequences, so we don't.
  19979. # Solaris /bin/sh doesn't support export -n. I'm not sure
  19980. # what we can do about this, other than hope that whoever
  19981. # is running the tests doesn't have CVSUMASK set.
  19982. #export -n CVSUMASK # if unset, defaults to 002
  19983. umask 077
  19984. mkdir 1; cd 1
  19985. dotest modes-1 "${testcvs} -q co -l ." ''
  19986. mkdir first-dir
  19987. dotest modes-2 "${testcvs} add first-dir" \
  19988. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  19989. cd first-dir
  19990. touch aa
  19991. dotest modes-3 "${testcvs} add aa" \
  19992. "${PROG} add: scheduling file .aa. for addition
  19993. ${PROG} add: use .${PROG} commit. to add this file permanently"
  19994. dotest modes-4 "${testcvs} -q ci -m add" \
  19995. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
  19996. done
  19997. Checking in aa;
  19998. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  19999. initial revision: 1\.1
  20000. done"
  20001. # Yawn. Cygwin.
  20002. if test -n "$remotehost"; then
  20003. dotest modes-5remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
  20004. "-r--r--r-- .*"
  20005. else
  20006. dotest modes-5 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
  20007. "-r--r--r-- .*"
  20008. fi
  20009. # Test for whether we can set the execute bit.
  20010. chmod +x aa
  20011. echo change it >>aa
  20012. dotest modes-6 "${testcvs} -q ci -m set-execute-bit" \
  20013. "Checking in aa;
  20014. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20015. new revision: 1\.2; previous revision: 1\.1
  20016. done"
  20017. # If CVS let us update the execute bit, it would be set here.
  20018. # But it doesn't, and as far as I know that is longstanding
  20019. # CVS behavior.
  20020. #
  20021. # Yeah, yeah. Search for "Cygwin".
  20022. if test -n "$remotehost"; then
  20023. dotest modes-7remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
  20024. "-r--r--r-- .*"
  20025. else
  20026. dotest modes-7 "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
  20027. "-r--r--r-- .*"
  20028. fi
  20029. # OK, now manually change the modes and see what happens.
  20030. #
  20031. # Cygwin, already.
  20032. if test -n "$remotehost"; then
  20033. $CVS_RSH $remotehost "chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v"
  20034. else
  20035. chmod g=r,o= ${CVSROOT_DIRNAME}/first-dir/aa,v
  20036. fi
  20037. echo second line >>aa
  20038. dotest modes-7a "${testcvs} -q ci -m set-execute-bit" \
  20039. "Checking in aa;
  20040. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20041. new revision: 1\.3; previous revision: 1\.2
  20042. done"
  20043. # Cygwin.
  20044. if test -n "$remotehost"; then
  20045. dotest modes-7bremotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v'" \
  20046. "-r--r----- .*"
  20047. else
  20048. dotest modes-7b "ls -l ${CVSROOT_DIRNAME}/first-dir/aa,v" \
  20049. "-r--r----- .*"
  20050. fi
  20051. CVSUMASK=007
  20052. export CVSUMASK
  20053. touch ab
  20054. # Might as well test the execute bit too.
  20055. chmod +x ab
  20056. dotest modes-8 "${testcvs} add ab" \
  20057. "${PROG} add: scheduling file .ab. for addition
  20058. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20059. dotest modes-9 "${testcvs} -q ci -m add" \
  20060. "RCS file: ${CVSROOT_DIRNAME}/first-dir/ab,v
  20061. done
  20062. Checking in ab;
  20063. ${CVSROOT_DIRNAME}/first-dir/ab,v <-- ab
  20064. initial revision: 1\.1
  20065. done"
  20066. if $remote; then
  20067. # The problem here is that the CVSUMASK environment variable
  20068. # needs to be set on the server (e.g. .bashrc). This is, of
  20069. # course, bogus, but that is the way it is currently.
  20070. if test -n "$remotehost"; then
  20071. dotest modes-10remotehost "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v'" \
  20072. "-r--r--r--.*"
  20073. else
  20074. dotest modes-10r "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
  20075. "-r-xr-x---.*" "-r-xr-xr-x.*"
  20076. fi
  20077. else
  20078. dotest modes-10 "ls -l ${CVSROOT_DIRNAME}/first-dir/ab,v" \
  20079. "-r-xr-x---.*"
  20080. fi
  20081. # OK, now add a file on a branch. Check that the mode gets
  20082. # set the same way (it is a different code path in CVS).
  20083. dotest modes-11 "${testcvs} -q tag -b br" 'T aa
  20084. T ab'
  20085. dotest modes-12 "$testcvs -q update -r br" \
  20086. '[UP] aa
  20087. U ab'
  20088. touch ac
  20089. dotest modes-13 "${testcvs} add ac" \
  20090. "${PROG} add: scheduling file .ac. for addition on branch .br.
  20091. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20092. # Not sure it really makes sense to refer to a "previous revision"
  20093. # when we are just now adding the file; as far as I know
  20094. # that is longstanding CVS behavior, for what it's worth.
  20095. dotest modes-14 "${testcvs} -q ci -m add" \
  20096. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v
  20097. done
  20098. Checking in ac;
  20099. ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v <-- ac
  20100. new revision: 1\.1\.2\.1; previous revision: 1\.1
  20101. done"
  20102. if $remote; then
  20103. # The problem here is that the CVSUMASK environment variable
  20104. # needs to be set on the server (e.g. .bashrc). This is, of
  20105. # course, bogus, but that is the way it is currently. The
  20106. # first match is for the :ext: method (where the CVSUMASK
  20107. # won't be set), while the second is for the :fork: method
  20108. # (where it will be).
  20109. if test -n "$remotehost"; then
  20110. dotest modes-15r \
  20111. "$CVS_RSH $remotehost 'ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v'" \
  20112. "-r--r--r--.*"
  20113. else
  20114. dotest modes-15r \
  20115. "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
  20116. "-r--r--r--.*" "-r--r-----.*"
  20117. fi
  20118. else
  20119. dotest modes-15 \
  20120. "ls -l ${CVSROOT_DIRNAME}/first-dir/Attic/ac,v" \
  20121. "-r--r-----.*"
  20122. fi
  20123. cd ../..
  20124. rm -r 1
  20125. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20126. # Perhaps should restore the umask and CVSUMASK. But the other
  20127. # tests "should" not care about them...
  20128. ;;
  20129. modes2)
  20130. # More tests of file permissions in the working directory
  20131. # and that sort of thing.
  20132. # The usual setup, file first-dir/aa with two revisions.
  20133. mkdir 1; cd 1
  20134. dotest modes2-1 "${testcvs} -q co -l ." ''
  20135. mkdir first-dir
  20136. dotest modes2-2 "${testcvs} add first-dir" \
  20137. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20138. cd first-dir
  20139. touch aa
  20140. dotest modes2-3 "${testcvs} add aa" \
  20141. "${PROG} add: scheduling file .aa. for addition
  20142. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20143. dotest modes2-4 "${testcvs} -q ci -m add" \
  20144. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
  20145. done
  20146. Checking in aa;
  20147. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20148. initial revision: 1\.1
  20149. done"
  20150. echo "more money" >> aa
  20151. dotest modes2-5 "${testcvs} -q ci -m add" \
  20152. "Checking in aa;
  20153. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20154. new revision: 1\.2; previous revision: 1\.1
  20155. done"
  20156. # OK, here is the test. The idea is to see what
  20157. # No_Difference does if it can't open the file.
  20158. # If we don't change the st_mtime, CVS doesn't even try to read
  20159. # the file. Note that some versions of "touch" require that we
  20160. # do this while the file is still writable.
  20161. touch aa
  20162. chmod a= aa
  20163. # Don't try this when permissions are broken, as with Cygwin.
  20164. if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then :; else
  20165. dotest_fail modes2-6 "${testcvs} -q update -r 1.1 aa" \
  20166. "${PROG} \[update aborted\]: cannot open file aa for comparing: Permission denied" \
  20167. "${PROG} \[update aborted\]: reading aa: Permission denied"
  20168. fi
  20169. chmod u+rwx aa
  20170. cd ../..
  20171. rm -r 1
  20172. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20173. ;;
  20174. modes3)
  20175. # Repository permissions. Particularly, what happens if we
  20176. # can't read/write in the repository.
  20177. # TODO: the case where we can access the repository, just not
  20178. # the attic (may that one can remain a fatal error, seems less
  20179. # useful for access control).
  20180. mkdir 1; cd 1
  20181. dotest modes3-1 "${testcvs} -q co -l ." ''
  20182. mkdir first-dir second-dir
  20183. dotest modes3-2 "${testcvs} add first-dir second-dir" \
  20184. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository
  20185. Directory ${CVSROOT_DIRNAME}/second-dir added to the repository"
  20186. touch first-dir/aa second-dir/ab
  20187. dotest modes3-3 "${testcvs} add first-dir/aa second-dir/ab" \
  20188. "${PROG} add: scheduling file .first-dir/aa. for addition
  20189. ${PROG} add: scheduling file .second-dir/ab. for addition
  20190. ${PROG} add: use .${PROG} commit. to add these files permanently"
  20191. dotest modes3-4 "${testcvs} -q ci -m add" \
  20192. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
  20193. done
  20194. Checking in first-dir/aa;
  20195. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20196. initial revision: 1\.1
  20197. done
  20198. RCS file: ${CVSROOT_DIRNAME}/second-dir/ab,v
  20199. done
  20200. Checking in second-dir/ab;
  20201. ${CVSROOT_DIRNAME}/second-dir/ab,v <-- ab
  20202. initial revision: 1\.1
  20203. done"
  20204. if test -n "$remotehost"; then
  20205. $CVS_RSH $remotehost "chmod a= ${CVSROOT_DIRNAME}/first-dir"
  20206. else
  20207. chmod a= ${CVSROOT_DIRNAME}/first-dir
  20208. fi
  20209. if ls ${CVSROOT_DIRNAME}/first-dir >/dev/null 2>&1; then
  20210. # Avoid this test under Cygwin since permissions work differently
  20211. # there.
  20212. #
  20213. # This test also gets avoided under Mac OS X since the system `ls'
  20214. # is broken and exits with a 0 status despite the permission
  20215. # denied error.
  20216. if test -n "$remotehost"; then
  20217. cygwin_hack=false
  20218. else
  20219. cygwin_hack=:
  20220. fi
  20221. else
  20222. cygwin_hack=false
  20223. fi
  20224. cd $TESTDIR/1
  20225. if $cygwin_hack; then :; else
  20226. dotest modes3-5 "${testcvs} update" \
  20227. "${PROG} update: Updating \.
  20228. ${PROG} update: Updating first-dir
  20229. ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
  20230. ${PROG} update: skipping directory first-dir
  20231. ${PROG} update: Updating second-dir"
  20232. fi
  20233. # OK, I can see why one might say the above case could be a
  20234. # fatal error, because normally users without access to first-dir
  20235. # won't have it in their working directory. But the next
  20236. # one is more of a problem if it is fatal.
  20237. #
  20238. # The second text string below is for Cygwin again, and again it
  20239. # should really be XFAIL under Cygwin, but for now deal with the
  20240. # passing opendir by accepting the alternate string.
  20241. rm -r first-dir
  20242. dotest modes3-6 "${testcvs} update -dP" \
  20243. "${PROG} update: Updating .
  20244. ${PROG} update: Updating CVSROOT
  20245. U ${DOTSTAR}
  20246. ${PROG} update: Updating first-dir
  20247. ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/first-dir: Permission denied
  20248. ${PROG} update: skipping directory first-dir
  20249. ${PROG} update: Updating second-dir" \
  20250. "${PROG} update: Updating .
  20251. ${PROG} update: Updating CVSROOT
  20252. U ${DOTSTAR}
  20253. ${PROG} update: Updating first-dir
  20254. ${PROG} update: Updating second-dir"
  20255. cd ..
  20256. rm -r 1
  20257. chmod u+rwx ${CVSROOT_DIRNAME}/first-dir
  20258. rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
  20259. ;;
  20260. stamps)
  20261. # Test timestamps.
  20262. mkdir 1; cd 1
  20263. dotest stamps-1 "${testcvs} -q co -l ." ''
  20264. mkdir first-dir
  20265. dotest stamps-2 "${testcvs} add first-dir" \
  20266. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20267. cd first-dir
  20268. touch aa
  20269. echo '$''Id$' >kw
  20270. # Cygwin, *cough*, puts the year in the time column until the minute
  20271. # is no longer the current minute. Sleep 60 seconds to avoid this
  20272. # problem.
  20273. sleep 60
  20274. ls -l aa >${TESTDIR}/1/stamp.aa.touch
  20275. ls -l kw >${TESTDIR}/1/stamp.kw.touch
  20276. # "sleep 1" would suffice if we could assume ls --full-time, but
  20277. # that is as far as I know unique to GNU ls. Is there some POSIX.2
  20278. # way to get the timestamp of a file, including the seconds?
  20279. sleep 60
  20280. dotest stamps-3 "${testcvs} add aa kw" \
  20281. "${PROG} add: scheduling file .aa. for addition
  20282. ${PROG} add: scheduling file .kw. for addition
  20283. ${PROG} add: use .${PROG} commit. to add these files permanently"
  20284. ls -l aa >${TESTDIR}/1/stamp.aa.add
  20285. ls -l kw >${TESTDIR}/1/stamp.kw.add
  20286. # "cvs add" should not muck with the timestamp.
  20287. dotest stamps-4aa \
  20288. "cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
  20289. dotest stamps-4kw \
  20290. "cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
  20291. sleep 60
  20292. dotest stamps-5 "${testcvs} -q ci -m add" \
  20293. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aa,v
  20294. done
  20295. Checking in aa;
  20296. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20297. initial revision: 1\.1
  20298. done
  20299. RCS file: ${CVSROOT_DIRNAME}/first-dir/kw,v
  20300. done
  20301. Checking in kw;
  20302. ${CVSROOT_DIRNAME}/first-dir/kw,v <-- kw
  20303. initial revision: 1\.1
  20304. done"
  20305. # Cygwin, *cough*, puts the year in the time column until the minute
  20306. # is no longer the current minute. Sleep 60 seconds to avoid this
  20307. # problem.
  20308. sleep 60
  20309. ls -l aa >${TESTDIR}/1/stamp.aa.ci
  20310. ls -l kw >${TESTDIR}/1/stamp.kw.ci
  20311. # If there are no keywords, "cvs ci" leaves the timestamp alone
  20312. # If there are, it sets the timestamp to the date of the commit.
  20313. # I'm not sure how logical this is, but it is intentional.
  20314. # If we wanted to get fancy we would make sure the time as
  20315. # reported in "cvs log kw" matched stamp.kw.ci. But that would
  20316. # be a lot of work.
  20317. dotest stamps-6aa \
  20318. "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
  20319. if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
  20320. then
  20321. fail stamps-6kw
  20322. else
  20323. pass stamps-6kw
  20324. fi
  20325. cd ../..
  20326. sleep 60
  20327. mkdir 2
  20328. cd 2
  20329. dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
  20330. U first-dir/kw"
  20331. cd first-dir
  20332. ls -l aa >${TESTDIR}/1/stamp.aa.get
  20333. ls -l kw >${TESTDIR}/1/stamp.kw.get
  20334. # On checkout, CVS should set the timestamp to the date that the
  20335. # file was committed. Could check that the time as reported in
  20336. # "cvs log aa" matches stamp.aa.get, but that would be a lot of
  20337. # work.
  20338. if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
  20339. then
  20340. fail stamps-8aa
  20341. else
  20342. pass stamps-8aa
  20343. fi
  20344. dotest stamps-8kw \
  20345. "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
  20346. # Now we want to see what "cvs update" does.
  20347. sleep 60
  20348. echo add a line >>aa
  20349. echo add a line >>kw
  20350. dotest stamps-9 "${testcvs} -q ci -m change-them" \
  20351. "Checking in aa;
  20352. ${CVSROOT_DIRNAME}/first-dir/aa,v <-- aa
  20353. new revision: 1\.2; previous revision: 1\.1
  20354. done
  20355. Checking in kw;
  20356. ${CVSROOT_DIRNAME}/first-dir/kw,v <-- kw
  20357. new revision: 1\.2; previous revision: 1\.1
  20358. done"
  20359. # Cygwin, *cough*, puts the year in the time column until the minute
  20360. # is no longer the current minute. Sleep 60 seconds to avoid this
  20361. # problem.
  20362. sleep 60
  20363. ls -l aa >${TESTDIR}/1/stamp.aa.ci2
  20364. ls -l kw >${TESTDIR}/1/stamp.kw.ci2
  20365. cd ../..
  20366. cd 1/first-dir
  20367. sleep 60
  20368. dotest stamps-10 "${testcvs} -q update" '[UP] aa
  20369. [UP] kw'
  20370. # this doesn't serve any function other than being able to
  20371. # look at it manually, as we have no machinery for dates being
  20372. # newer or older than other dates.
  20373. date >${TESTDIR}/1/stamp.debug.update
  20374. ls -l aa >${TESTDIR}/1/stamp.aa.update
  20375. ls -l kw >${TESTDIR}/1/stamp.kw.update
  20376. # stamp.aa.update and stamp.kw.update should both be approximately
  20377. # the same as stamp.debug.update. Perhaps we could be testing
  20378. # this in a more fancy fashion by "touch stamp.before" before
  20379. # stamps-10, "touch stamp.after" after, and then using ls -t
  20380. # to check them. But for now we just make sure that the *.update
  20381. # stamps differ from the *.ci2 ones.
  20382. # As for the rationale, this is so that if one updates and gets
  20383. # a new revision, then "make" will be sure to regard those files
  20384. # as newer than .o files which may be sitting around.
  20385. if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
  20386. >/dev/null
  20387. then
  20388. fail stamps-11aa
  20389. else
  20390. pass stamps-11aa
  20391. fi
  20392. if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
  20393. >/dev/null
  20394. then
  20395. fail stamps-11kw
  20396. else
  20397. pass stamps-11kw
  20398. fi
  20399. cd ../..
  20400. if $keep; then
  20401. echo Keeping ${TESTDIR} and exiting due to --keep
  20402. exit 0
  20403. fi
  20404. rm -r 1 2
  20405. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20406. ;;
  20407. perms)
  20408. # short cut around checking out and committing CVSROOT
  20409. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20410. echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
  20411. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20412. mkdir 1; cd 1
  20413. dotest perms-1 "${testcvs} -q co -l ." ''
  20414. mkdir first-dir
  20415. dotest perms-2 "${testcvs} add first-dir" \
  20416. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20417. cd first-dir
  20418. touch foo
  20419. chmod 431 foo
  20420. dotest perms-3 "${testcvs} add foo" \
  20421. "${PROG} add: scheduling file .foo. for addition
  20422. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20423. dotest perms-4 "${testcvs} -q ci -m ''" \
  20424. "RCS file: ${CVSROOT_DIRNAME}/first-dir/foo,v
  20425. done
  20426. Checking in foo;
  20427. ${CVSROOT_DIRNAME}/first-dir/foo,v <-- foo
  20428. initial revision: 1\.1
  20429. done"
  20430. # Test checking out files with different permissions.
  20431. cd ../..
  20432. mkdir 2; cd 2
  20433. dotest perms-5 "${testcvs} -q co first-dir" "U first-dir/foo"
  20434. cd first-dir
  20435. if $remote; then :; else
  20436. # PreservePermissions not yet implemented for remote.
  20437. dotest perms-6 "ls -l foo" "-r---wx--x .* foo"
  20438. fi
  20439. cd ../..
  20440. rm -rf 1 2
  20441. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20442. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20443. touch ${CVSROOT_DIRNAME}/CVSROOT/config
  20444. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20445. ;;
  20446. symlinks)
  20447. # short cut around checking out and committing CVSROOT
  20448. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20449. echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
  20450. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20451. mkdir 1; cd 1
  20452. dotest symlinks-1 "${testcvs} -q co -l ." ''
  20453. mkdir first-dir
  20454. dotest symlinks-2 "${testcvs} add first-dir" \
  20455. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20456. cd first-dir
  20457. dotest symlinks-2.1 "ln -s ${TESTDIR}/fumble slink" ""
  20458. dotest symlinks-3 "${testcvs} add slink" \
  20459. "${PROG} add: scheduling file .slink. for addition
  20460. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20461. if $remote; then
  20462. # Remote doesn't implement PreservePermissions, and in its
  20463. # absence the correct behavior is to follow the symlink.
  20464. dotest_fail symlinks-4r "${testcvs} -q ci -m ''" \
  20465. "${PROG} \[commit aborted\]: reading slink: No such file or directory"
  20466. else
  20467. dotest symlinks-4 "${testcvs} -q ci -m ''" \
  20468. "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
  20469. done
  20470. Checking in slink;
  20471. ${CVSROOT_DIRNAME}/first-dir/slink,v <-- slink
  20472. initial revision: 1\.1
  20473. done"
  20474. # Test checking out symbolic links.
  20475. cd ../..
  20476. mkdir 2; cd 2
  20477. dotest symlinks-5 "${testcvs} -q co first-dir" "U first-dir/slink"
  20478. cd first-dir
  20479. dotest symlinks-6 "ls -l slink" \
  20480. "l[rwx\-]* .* slink -> ${TESTDIR}/fumble"
  20481. fi
  20482. cd ../..
  20483. rm -rf 1 2
  20484. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20485. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20486. touch ${CVSROOT_DIRNAME}/CVSROOT/config
  20487. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20488. ;;
  20489. symlinks2)
  20490. # Symlinks in working directory without PreservePermissions.
  20491. # Also see: symlinks: with PreservePermissions
  20492. # rcslib-symlink-*: symlinks in repository.
  20493. mkdir 1; cd 1
  20494. dotest symlinks2-1 "${testcvs} -q co -l ." ''
  20495. mkdir first-dir
  20496. dotest symlinks2-2 "${testcvs} add first-dir" \
  20497. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20498. cd first-dir
  20499. echo nonsymlink > slink
  20500. dotest symlinks2-3 "${testcvs} add slink" \
  20501. "${PROG} add: scheduling file .slink. for addition
  20502. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20503. dotest symlinks2-4 "${testcvs} -q ci -m ''" \
  20504. "RCS file: ${CVSROOT_DIRNAME}/first-dir/slink,v
  20505. done
  20506. Checking in slink;
  20507. ${CVSROOT_DIRNAME}/first-dir/slink,v <-- slink
  20508. initial revision: 1\.1
  20509. done"
  20510. rm slink
  20511. # Choose name cvslog.* so it is in default ignore list.
  20512. echo second file >cvslog.file2
  20513. dotest symlinks2-5 "ln -s cvslog.file2 slink" ""
  20514. dotest symlinks2-6 "${testcvs} -q ci -m linkify" \
  20515. "Checking in slink;
  20516. ${CVSROOT_DIRNAME}/first-dir/slink,v <-- slink
  20517. new revision: 1\.2; previous revision: 1\.1
  20518. done"
  20519. dotest symlinks2-7 "${testcvs} -q update -r 1.1 slink" "[UP] slink"
  20520. dotest symlinks2-8 "cat slink" "nonsymlink"
  20521. dotest symlinks2-9 "ls -l slink" "-[-rwx]* .* slink"
  20522. cd ../..
  20523. rm -rf 1
  20524. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20525. ;;
  20526. hardlinks)
  20527. # short cut around checking out and committing CVSROOT
  20528. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20529. echo 'PreservePermissions=yes' > ${CVSROOT_DIRNAME}/CVSROOT/config
  20530. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20531. mkdir 1; cd 1
  20532. dotest hardlinks-1 "${testcvs} -q co -l ." ''
  20533. mkdir first-dir
  20534. dotest hardlinks-2 "${testcvs} add first-dir" \
  20535. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20536. cd first-dir
  20537. # Make up some ugly filenames, to test that they get
  20538. # encoded properly in the delta nodes. Note that `dotest' screws
  20539. # up if some arguments have embedded spaces.
  20540. if touch aaaa
  20541. then
  20542. pass hardlinks-2.1
  20543. else
  20544. fail hardlinks-2.1
  20545. fi
  20546. if ln aaaa b.b.b.b
  20547. then
  20548. pass hardlinks-2.2
  20549. else
  20550. fail hardlinks-2.2
  20551. fi
  20552. if ln aaaa 'dd dd dd'
  20553. then
  20554. pass hardlinks-2.3
  20555. else
  20556. fail hardlinks-2.3
  20557. fi
  20558. dotest hardlinks-3 "${testcvs} add [abd]*" \
  20559. "${PROG} add: scheduling file .aaaa. for addition
  20560. ${PROG} add: scheduling file .b\.b\.b\.b. for addition
  20561. ${PROG} add: scheduling file .dd dd dd. for addition
  20562. ${PROG} add: use .${PROG} commit. to add these files permanently"
  20563. dotest hardlinks-4 "${testcvs} -q ci -m ''" \
  20564. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaaa,v
  20565. done
  20566. Checking in aaaa;
  20567. ${CVSROOT_DIRNAME}/first-dir/aaaa,v <-- aaaa
  20568. initial revision: 1\.1
  20569. done
  20570. RCS file: ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v
  20571. done
  20572. Checking in b\.b\.b\.b;
  20573. ${CVSROOT_DIRNAME}/first-dir/b\.b\.b\.b,v <-- b\.b\.b\.b
  20574. initial revision: 1\.1
  20575. done
  20576. RCS file: ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v
  20577. done
  20578. Checking in dd dd dd;
  20579. ${CVSROOT_DIRNAME}/first-dir/dd dd dd,v <-- dd dd dd
  20580. initial revision: 1\.1
  20581. done"
  20582. # Test checking out hardlinked files.
  20583. cd ../..
  20584. mkdir 2; cd 2
  20585. if $remote; then
  20586. # Remote does not implement PreservePermissions.
  20587. dotest hardlinks-5r "${testcvs} -q co first-dir" \
  20588. "U first-dir/aaaa
  20589. U first-dir/b\.b\.b\.b
  20590. U first-dir/dd dd dd"
  20591. cd first-dir
  20592. dotest hardlinks-6r "ls -l [abd]*" \
  20593. "-[rwx\-]* *1 .* aaaa
  20594. -[rwx\-]* *1 .* b\.b\.b\.b
  20595. -[rwx\-]* *1 .* dd dd dd"
  20596. else
  20597. dotest hardlinks-5 "${testcvs} -q co first-dir" \
  20598. "U first-dir/aaaa
  20599. U first-dir/b\.b\.b\.b
  20600. U first-dir/dd dd dd"
  20601. cd first-dir
  20602. # To make sure that the files are properly hardlinked, it
  20603. # would be nice to do `ls -i' and make sure all the inodes
  20604. # match. But I think that would require expr to support
  20605. # tagged regexps, and I don't think we can rely on that.
  20606. # So instead we just see that each file has the right
  20607. # number of links. -twp
  20608. dotest hardlinks-6 "ls -l [abd]*" \
  20609. "-[rwx\-]* *3 .* aaaa
  20610. -[rwx\-]* *3 .* b\.b\.b\.b
  20611. -[rwx\-]* *3 .* dd dd dd"
  20612. fi
  20613. cd ../..
  20614. rm -rf 1 2
  20615. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20616. rm -f ${CVSROOT_DIRNAME}/CVSROOT/config
  20617. touch ${CVSROOT_DIRNAME}/CVSROOT/config
  20618. chmod 444 ${CVSROOT_DIRNAME}/CVSROOT/config
  20619. ;;
  20620. sticky)
  20621. # More tests of sticky tags, particularly non-branch sticky tags.
  20622. # See many tests (e.g. multibranch) for ordinary sticky tag
  20623. # operations such as adding files on branches.
  20624. # See "head" test for interaction between stick tags and HEAD.
  20625. mkdir 1; cd 1
  20626. dotest sticky-1 "${testcvs} -q co -l ." ''
  20627. mkdir first-dir
  20628. dotest sticky-2 "${testcvs} add first-dir" \
  20629. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20630. cd first-dir
  20631. touch file1
  20632. dotest sticky-3 "${testcvs} add file1" \
  20633. "${PROG} add: scheduling file .file1. for addition
  20634. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20635. dotest sticky-4 "${testcvs} -q ci -m add" \
  20636. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  20637. done
  20638. Checking in file1;
  20639. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20640. initial revision: 1\.1
  20641. done"
  20642. dotest sticky-5 "${testcvs} -q tag tag1" "T file1"
  20643. echo add a line >>file1
  20644. dotest sticky-6 "${testcvs} -q ci -m modify" \
  20645. "Checking in file1;
  20646. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20647. new revision: 1\.2; previous revision: 1\.1
  20648. done"
  20649. dotest sticky-7 "${testcvs} -q update -r tag1" "[UP] file1"
  20650. dotest sticky-8 "cat file1" ''
  20651. dotest sticky-9 "${testcvs} -q update" ''
  20652. dotest sticky-10 "cat file1" ''
  20653. touch file2
  20654. dotest_fail sticky-11 "${testcvs} add file2" \
  20655. "${PROG} add: cannot add file on non-branch tag tag1"
  20656. dotest sticky-12 "${testcvs} -q update -A" "[UP] file1
  20657. ${QUESTION} file2" "${QUESTION} file2
  20658. [UP] file1"
  20659. dotest sticky-13 "${testcvs} add file2" \
  20660. "${PROG} add: scheduling file .file2. for addition
  20661. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20662. dotest sticky-14 "${testcvs} -q ci -m add" \
  20663. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  20664. done
  20665. Checking in file2;
  20666. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  20667. initial revision: 1\.1
  20668. done"
  20669. # Now back to tag1
  20670. dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
  20671. ${PROG} update: file2 is no longer in the repository"
  20672. rm file1
  20673. dotest sticky-16 "${testcvs} rm file1" \
  20674. "${PROG} remove: scheduling .file1. for removal
  20675. ${PROG} remove: use .${PROG} commit. to remove this file permanently"
  20676. # Hmm, this command seems to silently remove the tag from
  20677. # the file. This appears to be intentional.
  20678. # The silently part especially strikes me as odd, though.
  20679. dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
  20680. dotest sticky-18 "${testcvs} -q update -A" "U file1
  20681. U file2"
  20682. dotest sticky-19 "${testcvs} -q update -r tag1" \
  20683. "${PROG} update: file1 is no longer in the repository
  20684. ${PROG} update: file2 is no longer in the repository"
  20685. dotest sticky-20 "${testcvs} -q update -A" "U file1
  20686. U file2"
  20687. # Now try with a numeric revision.
  20688. dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
  20689. dotest sticky-22 "${testcvs} rm -f file1" \
  20690. "${PROG} remove: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
  20691. # The old behavior was that remove allowed this and then commit
  20692. # gave an error, which was somewhat hard to clear. I mean, you
  20693. # could get into a long elaborate discussion of this being a
  20694. # conflict and two ways to resolve it, but I don't really see
  20695. # why CVS should have a concept of conflict that arises, not from
  20696. # parallel development, but from CVS's own sticky tags.
  20697. # Ditto with a sticky date.
  20698. #
  20699. # I'm kind of surprised that the "file1 was lost" doesn't crop
  20700. # up elsewhere in the testsuite. It is a long-standing
  20701. # discrepency between local and remote CVS and should probably
  20702. # be cleaned up at some point.
  20703. dotest sticky-23 "${testcvs} -q update -Dnow file1" \
  20704. "${PROG} update: warning: file1 was lost
  20705. U file1" "U file1"
  20706. dotest sticky-24 "${testcvs} rm -f file1" \
  20707. "${PROG} remove: cannot remove file .file1. which has a sticky date of .[0-9.]*."
  20708. dotest sticky-25 "${testcvs} -q update -A" \
  20709. "${PROG} update: warning: file1 was lost
  20710. U file1" "U file1"
  20711. cd ../..
  20712. rm -r 1
  20713. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20714. ;;
  20715. keyword)
  20716. # Test keyword expansion.
  20717. # Various other tests relate to our ability to correctly
  20718. # set the keyword expansion mode.
  20719. # "binfiles" tests "cvs admin -k".
  20720. # "binfiles" and "binfiles2" test "cvs add -k".
  20721. # "rdiff" tests "cvs co -k".
  20722. # "binfiles" (and this test) test "cvs update -k".
  20723. # "binwrap" tests setting the mode from wrappers.
  20724. # "keyword2" tests "cvs update -kk -j" with text and binary files
  20725. # I don't think any test is testing "cvs import -k".
  20726. # Other keyword expansion tests:
  20727. # keywordlog - $Log.
  20728. mkdir 1; cd 1
  20729. dotest keyword-1 "${testcvs} -q co -l ." ''
  20730. mkdir first-dir
  20731. dotest keyword-2 "${testcvs} add first-dir" \
  20732. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20733. cd first-dir
  20734. echo '$''Author$' > file1
  20735. echo '$''Date$' >> file1
  20736. echo '$''Header$' >> file1
  20737. echo '$''Id$' >> file1
  20738. echo '$''Locker$' >> file1
  20739. echo '$''Name$' >> file1
  20740. echo '$''RCSfile$' >> file1
  20741. echo '$''Revision$' >> file1
  20742. echo '$''Source$' >> file1
  20743. echo '$''State$' >> file1
  20744. echo '$''Nonkey$' >> file1
  20745. # Omit the trailing dollar sign
  20746. echo '$''Date' >> file1
  20747. # Put two keywords on one line
  20748. echo '$''State$' '$''State$' >> file1
  20749. # Use a header for Log
  20750. echo 'xx $''Log$' >> file1
  20751. dotest keyword-3 "${testcvs} add file1" \
  20752. "${PROG} add: scheduling file .file1. for addition
  20753. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20754. dotest keyword-4 "${testcvs} -q ci -m add" \
  20755. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  20756. done
  20757. Checking in file1;
  20758. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20759. initial revision: 1\.1
  20760. done"
  20761. dotest keyword-5 "cat file1" \
  20762. '\$'"Author: ${username} "'\$'"
  20763. "'\$'"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] "'\$'"
  20764. "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
  20765. "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
  20766. "'\$'"Locker: "'\$'"
  20767. "'\$'"Name: "'\$'"
  20768. "'\$'"RCSfile: file1,v "'\$'"
  20769. "'\$'"Revision: 1\.1 "'\$'"
  20770. "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
  20771. "'\$'"State: Exp "'\$'"
  20772. "'\$'"Nonkey"'\$'"
  20773. "'\$'"Date
  20774. "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
  20775. xx "'\$'"Log: file1,v "'\$'"
  20776. xx Revision 1\.1 [0-9/]* [0-9:]* ${username}
  20777. xx add
  20778. xx"
  20779. # Use cvs admin to lock the RCS file in order to check -kkvl
  20780. # vs. -kkv. CVS does not normally lock RCS files, but some
  20781. # people use cvs admin to enforce reserved checkouts.
  20782. dotest keyword-6 "${testcvs} admin -l file1" \
  20783. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  20784. 1\.1 locked
  20785. done"
  20786. dotest keyword-7 "$testcvs update -kkv file1" '[UP] file1'
  20787. dotest keyword-8 "cat file1" \
  20788. '\$'"Author: ${username} "'\$'"
  20789. "'\$'"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] "'\$'"
  20790. "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
  20791. "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp "'\$'"
  20792. "'\$'"Locker: "'\$'"
  20793. "'\$'"Name: "'\$'"
  20794. "'\$'"RCSfile: file1,v "'\$'"
  20795. "'\$'"Revision: 1\.1 "'\$'"
  20796. "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
  20797. "'\$'"State: Exp "'\$'"
  20798. "'\$'"Nonkey"'\$'"
  20799. "'\$'"Date
  20800. "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
  20801. xx "'\$'"Log: file1,v "'\$'"
  20802. xx Revision 1\.1 [0-9/]* [0-9:]* ${username}
  20803. xx add
  20804. xx"
  20805. dotest keyword-9 "$testcvs update -kkvl file1" '[UP] file1'
  20806. dotest keyword-10 "cat file1" \
  20807. '\$'"Author: ${username} "'\$'"
  20808. "'\$'"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] "'\$'"
  20809. "'\$'"Header: ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
  20810. "'\$'"Id: file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp ${username} "'\$'"
  20811. "'\$'"Locker: ${username} "'\$'"
  20812. "'\$'"Name: "'\$'"
  20813. "'\$'"RCSfile: file1,v "'\$'"
  20814. "'\$'"Revision: 1\.1 "'\$'"
  20815. "'\$'"Source: ${CVSROOT_DIRNAME}/first-dir/file1,v "'\$'"
  20816. "'\$'"State: Exp "'\$'"
  20817. "'\$'"Nonkey"'\$'"
  20818. "'\$'"Date
  20819. "'\$'"State: Exp "'\$'" "'\$'"State: Exp "'\$'"
  20820. xx "'\$'"Log: file1,v "'\$'"
  20821. xx Revision 1\.1 [0-9/]* [0-9:]* ${username}
  20822. xx add
  20823. xx"
  20824. dotest keyword-11 "${testcvs} update -kk file1" '[UP] file1'
  20825. dotest keyword-12 "cat file1" \
  20826. '\$'"Author"'\$'"
  20827. "'\$'"Date"'\$'"
  20828. "'\$'"Header"'\$'"
  20829. "'\$'"Id"'\$'"
  20830. "'\$'"Locker"'\$'"
  20831. "'\$'"Name"'\$'"
  20832. "'\$'"RCSfile"'\$'"
  20833. "'\$'"Revision"'\$'"
  20834. "'\$'"Source"'\$'"
  20835. "'\$'"State"'\$'"
  20836. "'\$'"Nonkey"'\$'"
  20837. "'\$'"Date
  20838. "'\$'"State"'\$'" "'\$'"State"'\$'"
  20839. xx "'\$'"Log"'\$'"
  20840. xx Revision 1\.1 [0-9/]* [0-9:]* ${username}
  20841. xx add
  20842. xx"
  20843. dotest keyword-13 "$testcvs update -kv file1" '[UP] file1'
  20844. dotest keyword-14 "cat file1" \
  20845. "${username}
  20846. [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]
  20847. ${CVSROOT_DIRNAME}/first-dir/file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
  20848. file1,v 1\.1 [0-9/]* [0-9:]* ${username} Exp
  20849. file1,v
  20850. 1\.1
  20851. ${CVSROOT_DIRNAME}/first-dir/file1,v
  20852. Exp
  20853. "'\$'"Nonkey"'\$'"
  20854. "'\$'"Date
  20855. Exp Exp
  20856. xx file1,v
  20857. xx Revision 1\.1 [0-9/]* [0-9:]* ${username}
  20858. xx add
  20859. xx"
  20860. dotest keyword-15 "${testcvs} update -ko file1" "U file1"
  20861. dotest keyword-16 "cat file1" \
  20862. '\$'"Author"'\$'"
  20863. "'\$'"Date"'\$'"
  20864. "'\$'"Header"'\$'"
  20865. "'\$'"Id"'\$'"
  20866. "'\$'"Locker"'\$'"
  20867. "'\$'"Name"'\$'"
  20868. "'\$'"RCSfile"'\$'"
  20869. "'\$'"Revision"'\$'"
  20870. "'\$'"Source"'\$'"
  20871. "'\$'"State"'\$'"
  20872. "'\$'"Nonkey"'\$'"
  20873. "'\$'"Date
  20874. "'\$'"State"'\$'" "'\$'"State"'\$'"
  20875. xx "'\$'"Log"'\$'
  20876. # Test the Name keyword. First go back to normal expansion.
  20877. dotest keyword-17 "${testcvs} update -A file1" "U file1"
  20878. echo '$''Name$' > file1
  20879. dotest keyword-18 "${testcvs} ci -m modify file1" \
  20880. "Checking in file1;
  20881. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20882. new revision: 1\.2; previous revision: 1\.1
  20883. done"
  20884. dotest keyword-19 "${testcvs} -q tag tag1" "T file1"
  20885. echo "change" >> file1
  20886. dotest keyword-20 "${testcvs} -q ci -m mod2 file1" \
  20887. "Checking in file1;
  20888. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20889. new revision: 1\.3; previous revision: 1\.2
  20890. done"
  20891. # Prior to 1.11.23, remote CVS would fail the patch checksum test
  20892. # and refetch the file here, failing this test.
  20893. dotest keyword-21 "$testcvs -q update -r tag1" 'U file1'
  20894. dotest keyword-22 "cat file1" '\$'"Name: tag1 "'\$'
  20895. # The update used to fail the first time with a checksum failure
  20896. # here, then the server would send the whole failure. This was fixed
  20897. # in 1.11.23.
  20898. dotest keyword-23 "$testcvs update -A file1" "U file1"
  20899. dotest keyword-24 "cat file1" '\$'"Name: "'\$'"
  20900. change"
  20901. cd ../..
  20902. rm -r 1
  20903. rm -rf ${CVSROOT_DIRNAME}/first-dir
  20904. ;;
  20905. keywordlog)
  20906. # Test the Log keyword.
  20907. mkdir 1; cd 1
  20908. dotest keywordlog-1 "${testcvs} -q co -l ." ''
  20909. mkdir first-dir
  20910. dotest keywordlog-2 "${testcvs} add first-dir" \
  20911. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  20912. cd first-dir
  20913. echo initial >file1
  20914. dotest keywordlog-3 "${testcvs} add file1" \
  20915. "${PROG} add: scheduling file .file1. for addition
  20916. ${PROG} add: use .${PROG} commit. to add this file permanently"
  20917. # See "rmadd" for a list of other tests of cvs ci -r.
  20918. dotest keywordlog-4 "${testcvs} -q ci -r 1.3 -m add file1" \
  20919. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  20920. done
  20921. Checking in file1;
  20922. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20923. initial revision: 1\.3
  20924. done"
  20925. cd ../..
  20926. mkdir 2; cd 2
  20927. dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
  20928. cd ../1/first-dir
  20929. echo 'xx $''Log$' >> file1
  20930. cat >${TESTDIR}/comment.tmp <<EOF
  20931. First log line
  20932. Second log line
  20933. EOF
  20934. # As with rmadd-25, "cvs ci -r" sets a sticky tag.
  20935. dotest_fail keywordlog-4b \
  20936. "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
  20937. "${PROG} commit: sticky tag .1\.3. for file .file1. is not a branch
  20938. ${PROG} \[commit aborted\]: correct above errors first!"
  20939. dotest keywordlog-4c "${testcvs} -q update -A" "M file1"
  20940. dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
  20941. "Checking in file1;
  20942. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20943. new revision: 1\.4; previous revision: 1\.3
  20944. done"
  20945. rm -f ${TESTDIR}/comment.tmp
  20946. dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
  20947. dotest keywordlog-7 "cat file1" \
  20948. "initial
  20949. xx "'\$'"Log: file1,v "'\$'"
  20950. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  20951. xx First log line
  20952. xx Second log line
  20953. xx"
  20954. cd ../../2/first-dir
  20955. dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
  20956. dotest keywordlog-9 "cat file1" \
  20957. "initial
  20958. xx "'\$'"Log: file1,v "'\$'"
  20959. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  20960. xx First log line
  20961. xx Second log line
  20962. xx"
  20963. cd ../../1/first-dir
  20964. echo "change" >> file1
  20965. dotest keywordlog-10 "${testcvs} ci -m modify file1" \
  20966. "Checking in file1;
  20967. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  20968. new revision: 1\.5; previous revision: 1\.4
  20969. done"
  20970. dotest keywordlog-11 "cat file1" \
  20971. "initial
  20972. xx "'\$'"Log: file1,v "'\$'"
  20973. xx Revision 1\.5 [0-9/]* [0-9:]* ${username}
  20974. xx modify
  20975. xx
  20976. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  20977. xx First log line
  20978. xx Second log line
  20979. xx
  20980. change"
  20981. cd ../../2/first-dir
  20982. dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
  20983. dotest keywordlog-13 "cat file1" \
  20984. "initial
  20985. xx "'\$'"Log: file1,v "'\$'"
  20986. xx Revision 1\.5 [0-9/]* [0-9:]* ${username}
  20987. xx modify
  20988. xx
  20989. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  20990. xx First log line
  20991. xx Second log line
  20992. xx
  20993. change"
  20994. cd ../../1/first-dir
  20995. dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
  20996. echo br-change >>file1
  20997. dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
  20998. "Checking in file1;
  20999. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21000. new revision: 1\.4\.2\.1; previous revision: 1\.4
  21001. done"
  21002. dotest keywordlog-16 "cat file1" \
  21003. "initial
  21004. xx "'\$'"Log: file1,v "'\$'"
  21005. xx Revision 1\.4\.2\.1 [0-9/]* [0-9:]* ${username}
  21006. xx br-modify
  21007. xx
  21008. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21009. xx First log line
  21010. xx Second log line
  21011. xx
  21012. br-change"
  21013. cd ../../2/first-dir
  21014. dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
  21015. dotest keywordlog-18 "cat file1" \
  21016. "initial
  21017. xx "'\$'"Log: file1,v "'\$'"
  21018. xx Revision 1\.4\.2\.1 [0-9/]* [0-9:]* ${username}
  21019. xx br-modify
  21020. xx
  21021. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21022. xx First log line
  21023. xx Second log line
  21024. xx
  21025. br-change"
  21026. cd ../..
  21027. dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
  21028. "initial
  21029. xx "'\$'"Log: file1,v "'\$'"
  21030. xx Revision 1\.4\.2\.1 [0-9/]* [0-9:]* ${username}
  21031. xx br-modify
  21032. xx
  21033. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21034. xx First log line
  21035. xx Second log line
  21036. xx
  21037. br-change"
  21038. dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
  21039. "initial
  21040. xx "'\$'"Log: file1,v "'\$'"
  21041. xx Revision 1\.5 [0-9/]* [0-9:]* ${username}
  21042. xx modify
  21043. xx
  21044. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21045. xx First log line
  21046. xx Second log line
  21047. xx
  21048. change"
  21049. dotest keywordlog-21 "${testcvs} -q co -p -r 1.4 first-dir/file1" \
  21050. "initial
  21051. xx "'\$'"Log: file1,v "'\$'"
  21052. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21053. xx First log line
  21054. xx Second log line
  21055. xx"
  21056. cd 2/first-dir
  21057. # OK, the basic rule for keyword expansion is that it
  21058. # happens on checkout. And the rule for annotate is that
  21059. # it annotates a checked-in revision, rather than a checked-out
  21060. # file. So, although it is kind of confusing that the latest
  21061. # revision does not appear in the annotated output, and the
  21062. # annotated output does not quite match what you'd get with
  21063. # update or checkout, the behavior is more or less logical.
  21064. # The same issue occurs with annotate and other keywords,
  21065. # I think, although it is particularly noticeable for $Log.
  21066. dotest keywordlog-22 "${testcvs} ann -r br file1" \
  21067. "
  21068. Annotations for file1
  21069. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21070. 1\.3 ($username8 *[0-9a-zA-Z-]*): initial
  21071. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
  21072. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* $username
  21073. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx First log line
  21074. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx Second log line
  21075. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx
  21076. 1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): br-change"
  21077. dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \
  21078. "
  21079. Annotations for file1
  21080. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21081. 1\.3 ($username8 *[0-9a-zA-Z-]*): initial
  21082. 1\.5 ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'"
  21083. 1\.5 ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* $username
  21084. 1\.5 ($username8 *[0-9a-zA-Z-]*): xx First log line
  21085. 1\.5 ($username8 *[0-9a-zA-Z-]*): xx Second log line
  21086. 1\.5 ($username8 *[0-9a-zA-Z-]*): xx
  21087. 1\.5 ($username8 *[0-9a-zA-Z-]*): change"
  21088. cd ../..
  21089. #
  21090. # test the operation of 'admin -o' in conjunction with keywords
  21091. # (especially Log - this used to munge the RCS file for all time)
  21092. #
  21093. dotest keywordlog-24 \
  21094. "${testcvs} admin -oHEAD 1/first-dir/file1" \
  21095. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21096. deleting revision 1\.5
  21097. done"
  21098. dotest keywordlog-25 \
  21099. "${testcvs} -q co -p first-dir/file1" \
  21100. "initial
  21101. xx "'\$'"Log: file1,v "'\$'"
  21102. xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
  21103. xx First log line
  21104. xx Second log line
  21105. xx"
  21106. if $keep; then
  21107. echo Keeping ${TESTDIR} and exiting due to --keep
  21108. exit 0
  21109. fi
  21110. rm -r 1 2
  21111. rm -rf ${CVSROOT_DIRNAME}/first-dir
  21112. ;;
  21113. keywordname)
  21114. # Test the Name keyword.
  21115. # See the keyword test for a descriptions of some other tests that
  21116. # test keyword expansion modes.
  21117. mkdir keywordname; cd keywordname
  21118. mkdir 1; cd 1
  21119. dotest keywordname-init-1 "${testcvs} -q co -l ." ''
  21120. mkdir first-dir
  21121. dotest keywordname-init-2 "${testcvs} add first-dir" \
  21122. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  21123. cd first-dir
  21124. echo '$'"Name$" >file1
  21125. echo '$'"Name$" >file2
  21126. dotest keywordname-init-3 "${testcvs} add file1 file2" \
  21127. "${PROG} add: scheduling file .file1. for addition
  21128. ${PROG} add: scheduling file .file2. for addition
  21129. ${PROG} add: use .${PROG} commit. to add these files permanently"
  21130. # See "rmadd" for a list of other tests of cvs ci -r.
  21131. dotest keywordname-init-4 "${testcvs} -q ci -r 1.3 -m add" \
  21132. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21133. done
  21134. Checking in file1;
  21135. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21136. initial revision: 1\.3
  21137. done
  21138. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  21139. done
  21140. Checking in file2;
  21141. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  21142. initial revision: 1\.3
  21143. done"
  21144. dotest keywordname-init-5b "cat file1" \
  21145. '\$''Name: \$'
  21146. dotest keywordname-init-5c "cat file2" \
  21147. '\$''Name: \$'
  21148. dotest keywordname-init-6 "$testcvs -q up -A"
  21149. dotest keywordname-init-6b "cat file1" \
  21150. '\$''Name: \$'
  21151. dotest keywordname-init-6c "cat file2" \
  21152. '\$''Name: \$'
  21153. dotest keywordname-init-7 "${testcvs} -q tag -b br" \
  21154. "T file1
  21155. T file2"
  21156. echo new data >>file1
  21157. dotest keywordname-init-8 "${testcvs} -q ci -mchange" \
  21158. "Checking in file1;
  21159. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21160. new revision: 1\.4; previous revision: 1\.3
  21161. done"
  21162. # First check out a branch.
  21163. #
  21164. # There used to be a bug where static tags would be substituted for
  21165. # Name keywords but not branch tags.
  21166. #
  21167. # Prior to 1.11.23, there also used to be a bug where keyword
  21168. # substitutions were not performed unless the file was otherwise
  21169. # updated. When this bug was present, keywordname-update-1 would
  21170. # report a patch checksum failure and refetch file1 in client/server
  21171. # mode and no `br' would have been substituted into Name's value for
  21172. # file2, meaning keywordname-update-3 would also fail.
  21173. dotest keywordname-update-1 "$testcvs -q up -rbr" \
  21174. 'U file1
  21175. U file2'
  21176. dotest keywordname-update-2 "cat file1" '\$''Name: br \$'
  21177. # For the same reason keywordname-update-1 would fail above, no `br'
  21178. # would have been substituted into Name's value here prior to
  21179. # 1.11.23.
  21180. dotest keywordname-update-3 "cat file2" '\$''Name: br \$'
  21181. # Now verify that updating to the trunk leaves no substitution for
  21182. # $Name
  21183. dotest keywordname-update-4 "${testcvs} -q tag firsttag" \
  21184. "T file1
  21185. T file2"
  21186. # This used to fail in the same manner as keywordname-update-1.
  21187. dotest keywordname-update-5 "$testcvs -q up -A" \
  21188. 'U file1
  21189. U file2'
  21190. dotest keywordname-update-6 "cat file1" \
  21191. '\$''Name: \$
  21192. new data'
  21193. dotest keywordname-update-7 "cat file2" '\$''Name: \$'
  21194. # This used to fail in the same manner as keywordname-update-1.
  21195. dotest keywordname-update-8 "$testcvs -q up -rfirsttag" \
  21196. 'U file1
  21197. U file2'
  21198. dotest keywordname-update-9 "cat file1" '\$''Name: firsttag \$'
  21199. # This used to fail in the same manner as keywordname-update-3.
  21200. dotest keywordname-update-10 "cat file2" '\$''Name: firsttag \$'
  21201. # And reverify the trunk update when the change is actually removed.
  21202. dotest keywordname-update-11 "$testcvs -q up -A" \
  21203. 'U file1
  21204. U file2'
  21205. dotest keywordname-update-12 "cat file1" \
  21206. '\$''Name: \$
  21207. new data'
  21208. dotest keywordname-update-13 "cat file2" '\$''Name: \$'
  21209. cd ../..
  21210. # now verify that a fresh checkout substitutes all the $Name fields
  21211. mkdir 2; cd 2
  21212. dotest keywordname-checkout-1 \
  21213. "${testcvs} -q co -rfirsttag first-dir" \
  21214. "U first-dir/file1
  21215. U first-dir/file2"
  21216. cd first-dir
  21217. dotest keywordname-checkout-2 "cat file1" '\$'"Name: firsttag "'\$'
  21218. dotest keywordname-checkout-3 "cat file2" '\$'"Name: firsttag "'\$'
  21219. cd ../..
  21220. if $keep; then
  21221. echo Keeping ${TESTDIR} and exiting due to --keep
  21222. exit 0
  21223. fi
  21224. cd ..
  21225. rm -r keywordname
  21226. rm -rf ${CVSROOT_DIRNAME}/first-dir
  21227. ;;
  21228. keyword2)
  21229. # Test merging on files with keywords:
  21230. # without -kk
  21231. # with -kk
  21232. # on text files
  21233. # on binary files
  21234. # Note: This test assumes that CVS has already passed the binfiles
  21235. # test sequence
  21236. # Note2: We are testing positive on binary corruption here
  21237. # we probably really DON'T want to 'cvs update -kk' a binary file...
  21238. mkdir 1; cd 1
  21239. dotest keyword2-1 "${testcvs} -q co -l ." ''
  21240. mkdir first-dir
  21241. dotest keyword2-2 "${testcvs} add first-dir" \
  21242. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  21243. cd first-dir
  21244. echo '$''Revision$' >> file1
  21245. echo "I" >>file1
  21246. echo "like" >>file1
  21247. echo "long" >>file1
  21248. echo "files!" >>file1
  21249. echo "" >>file1
  21250. echo "a test line for our times" >>file1
  21251. echo "" >>file1
  21252. echo "They" >>file1
  21253. echo "make" >>file1
  21254. echo "diff" >>file1
  21255. echo "look like it" >>file1
  21256. echo "did a much better" >>file1
  21257. echo "job." >>file1
  21258. dotest keyword2-3 "${testcvs} add file1" \
  21259. "${PROG} add: scheduling file .file1. for addition
  21260. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21261. ${AWK} 'BEGIN { printf "%c%c%c%sRevision: 1.1 $@%c%c", \
  21262. 2, 10, 137, "$", 13, 10 }' \
  21263. </dev/null | ${TR} '@' '\000' >../binfile.dat
  21264. cp ../binfile.dat .
  21265. dotest keyword2-5 "${testcvs} add -kb binfile.dat" \
  21266. "${PROG} add: scheduling file .binfile\.dat. for addition
  21267. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21268. dotest keyword2-6 "${testcvs} -q ci -m add" \
  21269. "RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v
  21270. done
  21271. Checking in binfile\.dat;
  21272. ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v <-- binfile\.dat
  21273. initial revision: 1\.1
  21274. done
  21275. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21276. done
  21277. Checking in file1;
  21278. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21279. initial revision: 1\.1
  21280. done"
  21281. dotest keyword2-7 "${testcvs} -q tag -b branch" \
  21282. "T binfile\.dat
  21283. T file1"
  21284. sed -e 's/our/the best of and the worst of/' file1 >f; mv f file1
  21285. dotest keyword2-8 "${testcvs} -q ci -m change" \
  21286. "Checking in file1;
  21287. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21288. new revision: 1\.2; previous revision: 1\.1
  21289. done"
  21290. dotest keyword2-9 "$testcvs -q update -r branch" \
  21291. 'U binfile\.dat
  21292. [UP] file1'
  21293. echo "what else do we have?" >>file1
  21294. dotest keyword2-10 "${testcvs} -q ci -m change" \
  21295. "Checking in file1;
  21296. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21297. new revision: 1\.1\.2\.1; previous revision: 1\.1
  21298. done"
  21299. # Okay, first a conflict in file1 - should be okay with binfile.dat
  21300. dotest keyword2-11 "$testcvs -q update -A -j branch" \
  21301. "U binfile\.dat
  21302. U file1
  21303. RCS file: $CVSROOT_DIRNAME/first-dir/file1,v
  21304. retrieving revision 1\.1
  21305. retrieving revision 1\.1\.2\.1
  21306. Merging differences between 1\.1 and 1\.1\.2\.1 into file1
  21307. rcsmerge: warning: conflicts during merge"
  21308. dotest_fail keyword2-12 "${testcvs} diff file1" \
  21309. "Index: file1
  21310. ===================================================================
  21311. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21312. retrieving revision 1\.2
  21313. diff -r1\.2 file1
  21314. 0a1
  21315. > <<<<<<< file1
  21316. 1a3,5
  21317. > =======
  21318. > \\\$""Revision: 1\.1\.2\.1 \\\$
  21319. > >>>>>>> 1\.1\.2\.1
  21320. 14a19
  21321. > what else do we have${QUESTION}"
  21322. # Here's the problem... shouldn't -kk a binary file...
  21323. rm file1
  21324. dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \
  21325. "${PROG} update: warning: file1 was lost
  21326. U file1
  21327. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21328. retrieving revision 1\.1
  21329. retrieving revision 1\.1\.2\.1
  21330. Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
  21331. # binfile won't get checked in, but it is now corrupt and could
  21332. # have been checked in if it had changed on the branch...
  21333. dotest keyword2-14 "${testcvs} -q ci -m change" \
  21334. "Checking in file1;
  21335. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21336. new revision: 1\.3; previous revision: 1\.2
  21337. done"
  21338. # "-kk" no longer corrupts binary files
  21339. dotest keyword2-15 "cmp binfile.dat ../binfile.dat" ''
  21340. # Okay, restore everything and make CVS try and merge a binary file...
  21341. # "-kk" no longer affects binary files
  21342. dotest keyword2-16 "${testcvs} -q update -A" \
  21343. "[UP] file1"
  21344. dotest keyword2-17 "${testcvs} -q tag -b branch2" \
  21345. "T binfile\.dat
  21346. T file1"
  21347. dotest keyword2-18 "$testcvs -q update -r branch2" \
  21348. 'U binfile\.dat
  21349. [UP] file1'
  21350. ${AWK} 'BEGIN { printf "%c%c%c@%c%c", 2, 10, 137, 13, 10 }' \
  21351. </dev/null | ${TR} '@' '\000' >>binfile.dat
  21352. dotest keyword2-19 "${testcvs} -q ci -m badbadbad" \
  21353. "Checking in binfile\.dat;
  21354. ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v <-- binfile\.dat
  21355. new revision: 1\.1\.4\.1; previous revision: 1\.1
  21356. done"
  21357. # "-kk" no longer affects binary files
  21358. # XXXX: do not ask, why we get the "U binfile.dat" line twice
  21359. # looks like a bug!
  21360. dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \
  21361. "U binfile\.dat
  21362. U binfile\.dat
  21363. U file1"
  21364. cd ../..
  21365. rm -r 1
  21366. rm -rf ${CVSROOT_DIRNAME}/first-dir
  21367. ;;
  21368. head)
  21369. # Testing handling of the HEAD special tag.
  21370. # There are many cases involving added and removed files
  21371. # which we don't yet try to deal with.
  21372. # TODO: We also could be paying much closer attention to
  21373. # "head of the trunk" versus "head of the default branch".
  21374. # That is what "cvs import" is doing here (but I didn't really
  21375. # fully follow through on writing the tests for that case).
  21376. mkdir imp-dir
  21377. cd imp-dir
  21378. echo 'imported contents' >file1
  21379. # It may seem like we don't do much with file2, but do note that
  21380. # the "cvs diff" invocations do also diff file2 (and come up empty).
  21381. echo 'imported contents' >file2
  21382. dotest_sort head-1 "${testcvs} import -m add first-dir tag1 tag2" \
  21383. "
  21384. N first-dir/file1
  21385. N first-dir/file2
  21386. No conflicts created by this import"
  21387. cd ..
  21388. rm -r imp-dir
  21389. mkdir 1
  21390. cd 1
  21391. dotest head-2 "${testcvs} -q co first-dir" \
  21392. "U first-dir/file1
  21393. U first-dir/file2"
  21394. cd first-dir
  21395. echo 'add a line on trunk' >> file1
  21396. dotest head-3 "${testcvs} -q ci -m modify" \
  21397. "Checking in file1;
  21398. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21399. new revision: 1\.2; previous revision: 1\.1
  21400. done"
  21401. dotest head-4 "${testcvs} -q tag trunktag" "T file1
  21402. T file2"
  21403. echo 'add a line on trunk after trunktag' >> file1
  21404. dotest head-5 "${testcvs} -q ci -m modify" \
  21405. "Checking in file1;
  21406. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21407. new revision: 1\.3; previous revision: 1\.2
  21408. done"
  21409. dotest head-6 "${testcvs} -q tag -b br1" "T file1
  21410. T file2"
  21411. dotest head-7 "$testcvs -q update -r br1" \
  21412. '[UP] file1
  21413. [UP] file2'
  21414. echo 'modify on branch' >>file1
  21415. dotest head-8 "${testcvs} -q ci -m modify" \
  21416. "Checking in file1;
  21417. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21418. new revision: 1\.3\.2\.1; previous revision: 1\.3
  21419. done"
  21420. dotest head-9 "${testcvs} -q tag brtag" "T file1
  21421. T file2"
  21422. echo 'modify on branch after brtag' >>file1
  21423. dotest head-10 "${testcvs} -q ci -m modify" \
  21424. "Checking in file1;
  21425. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21426. new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
  21427. done"
  21428. # With no sticky tags, HEAD is the head of the trunk.
  21429. dotest head-trunk-setup "$testcvs -q update -A" \
  21430. '[UP] file1
  21431. [UP] file2'
  21432. dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
  21433. "imported contents
  21434. add a line on trunk
  21435. add a line on trunk after trunktag"
  21436. # and diff thinks so too. Case (a) from the comment in
  21437. # cvs.texinfo (Common options).
  21438. dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
  21439. "Index: file1
  21440. ===================================================================
  21441. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21442. retrieving revision 1\.3
  21443. retrieving revision 1\.3\.2\.2
  21444. diff -c -r1\.3 -r1\.3\.2\.2
  21445. \*\*\* file1 ${RFCDATE} 1\.3
  21446. --- file1 ${RFCDATE} 1\.3\.2\.2
  21447. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21448. \*\*\* 1,3 \*\*\*\*
  21449. --- 1,5 ----
  21450. imported contents
  21451. add a line on trunk
  21452. add a line on trunk after trunktag
  21453. ${PLUS} modify on branch
  21454. ${PLUS} modify on branch after brtag"
  21455. # With a branch sticky tag, HEAD is the head of the trunk.
  21456. dotest head-br1-setup "$testcvs -q update -r br1" \
  21457. '[UP] file1
  21458. [UP] file2'
  21459. dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
  21460. "imported contents
  21461. add a line on trunk
  21462. add a line on trunk after trunktag"
  21463. # But diff thinks that HEAD is "br1". Case (b) from cvs.texinfo.
  21464. # Probably people are relying on it.
  21465. dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
  21466. # With a nonbranch sticky tag on a branch,
  21467. # HEAD is the head of the trunk
  21468. dotest head-brtag-setup "$testcvs -q update -r brtag" \
  21469. '[UP] file1
  21470. [UP] file2'
  21471. dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
  21472. "imported contents
  21473. add a line on trunk
  21474. add a line on trunk after trunktag"
  21475. # CVS 1.9 and older thought that HEAD is "brtag" (this was
  21476. # noted as "strange, maybe accidental"). But "br1" makes a
  21477. # whole lot more sense.
  21478. dotest head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
  21479. # With a nonbranch sticky tag on the trunk, HEAD is the head
  21480. # of the trunk, I think.
  21481. dotest head-trunktag-setup "$testcvs -q update -r trunktag" \
  21482. '[UP] file1
  21483. [UP] file2'
  21484. dotest head-trunktag-check "cat file1" "imported contents
  21485. add a line on trunk"
  21486. dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
  21487. "imported contents
  21488. add a line on trunk
  21489. add a line on trunk after trunktag"
  21490. # Like head-brtag-diff, there is a non-branch sticky tag.
  21491. dotest_fail head-trunktag-diff \
  21492. "${testcvs} -q diff -c -r HEAD -r br1" \
  21493. "Index: file1
  21494. ===================================================================
  21495. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21496. retrieving revision 1\.3
  21497. retrieving revision 1\.3\.2\.2
  21498. diff -c -r1\.3 -r1\.3\.2\.2
  21499. \*\*\* file1 ${RFCDATE} 1\.3
  21500. --- file1 ${RFCDATE} 1\.3\.2\.2
  21501. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21502. \*\*\* 1,3 \*\*\*\*
  21503. --- 1,5 ----
  21504. imported contents
  21505. add a line on trunk
  21506. add a line on trunk after trunktag
  21507. ${PLUS} modify on branch
  21508. ${PLUS} modify on branch after brtag"
  21509. # Also might test what happens if we setup with update -r
  21510. # HEAD. In general, if sticky tags matter, does the
  21511. # behavior of "update -r <foo>" (without -p) depend on the
  21512. # sticky tags before or after the update?
  21513. # Note that we are testing both the case where this deletes
  21514. # a revision (file1) and the case where it does not (file2)
  21515. dotest_fail head-o0a "${testcvs} admin -o ::br1" \
  21516. "${PROG} admin: Administrating \.
  21517. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21518. ${PROG} admin: cannot remove revision 1\.3\.2\.1 because it has tags
  21519. ${PROG} admin: RCS file for .file1. not modified\.
  21520. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  21521. done"
  21522. dotest head-o0b "${testcvs} tag -d brtag" \
  21523. "${PROG} tag: Untagging \.
  21524. D file1
  21525. D file2"
  21526. dotest head-o1 "${testcvs} admin -o ::br1" \
  21527. "${PROG} admin: Administrating \.
  21528. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21529. deleting revision 1\.3\.2\.1
  21530. done
  21531. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  21532. done"
  21533. cd ../..
  21534. rm -r 1
  21535. rm -rf ${CVSROOT_DIRNAME}/first-dir
  21536. ;;
  21537. tagdate)
  21538. # Test combining -r and -D.
  21539. #
  21540. # Note that this is not a complete test. It relies on the fact
  21541. # that update, checkout and export have a LOT of shared code.
  21542. # Notice:
  21543. # 1) checkout is never tested at all with -r -D
  21544. # 2) update never uses an argument to '-D' besides 'now'
  21545. # (this test does not provide enough data to prove
  21546. # that 'cvs update' with both a '-r' and a '-D'
  21547. # specified does not ignore '-D': a 'cvs up
  21548. # -r<branch> -Dnow' and a 'cvs up -r<branch>'
  21549. # should specify the same file revision).
  21550. # 3) export uses '-r<branch> -D<when there was a different
  21551. # revision>', hopefully completing this behavior test
  21552. # for checkout and update as well.
  21553. #
  21554. mkdir 1; cd 1
  21555. save_TZ=$TZ
  21556. TZ=UTC; export TZ
  21557. dotest tagdate-1 "${testcvs} -q co -l ." ''
  21558. mkdir first-dir
  21559. dotest tagdate-2 "${testcvs} add first-dir" \
  21560. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  21561. cd first-dir
  21562. echo trunk-1 >file1
  21563. dotest tagdate-3 "${testcvs} add file1" \
  21564. "${PROG} add: scheduling file .file1. for addition
  21565. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21566. dotest tagdate-4 "${testcvs} -q ci -m add" \
  21567. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21568. done
  21569. Checking in file1;
  21570. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21571. initial revision: 1\.1
  21572. done"
  21573. date_T1=`getrlogdate -r1.1 first-dir/file1`
  21574. dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
  21575. dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
  21576. echo trunk-2 >file1
  21577. dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
  21578. "Checking in file1;
  21579. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21580. new revision: 1\.2; previous revision: 1\.1
  21581. done"
  21582. date_T2=`getrlogdate -r1.2 first-dir/file1`
  21583. # We are testing -r -D where br1 is a (magic) branch without
  21584. # any revisions. First the case where br2 doesn't have any
  21585. # revisions either:
  21586. dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
  21587. dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
  21588. echo br2-1 >file1
  21589. dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
  21590. "Checking in file1;
  21591. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21592. new revision: 1\.1\.4\.1; previous revision: 1\.1
  21593. done"
  21594. date_T3=`getrlogdate -r1.1.4.1 first-dir/file1`
  21595. # Then the case where br2 does have revisions:
  21596. dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
  21597. # For some reason, doing this on a branch seems to be relevant.
  21598. dotest_fail tagdate-12 "${testcvs} -q update -j:yesterday" \
  21599. "${PROG} \[update aborted\]: argument to join may not contain a date specifier without a tag"
  21600. # And check export
  21601. echo br2-2 >file1
  21602. dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \
  21603. "Checking in file1;
  21604. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21605. new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1
  21606. done"
  21607. date_T4=`getrlogdate -r1.1.4.2 first-dir/file1`
  21608. cd ../..
  21609. mkdir 2; cd 2
  21610. dotest tagdate-14 "${testcvs} -q export -r br2 -D'$date_T3' first-dir" \
  21611. "[UP] first-dir/file1"
  21612. dotest tagdate-15 "cat first-dir/file1" "br2-1"
  21613. # Now for annotate
  21614. cd ../1/first-dir
  21615. dotest tagdate-16 "${testcvs} annotate -rbr2 -D'$date_T3'" \
  21616. "
  21617. Annotations for file1
  21618. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21619. 1\.1\.4\.1 ($username8 *[0-9a-zA-Z-]*): br2-1"
  21620. dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \
  21621. "
  21622. Annotations for file1
  21623. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  21624. 1\.1\.4\.2 ($username8 *[0-9a-zA-Z-]*): br2-2"
  21625. # Now check to see what happens when we add files to br2 and trunk
  21626. echo br2-1 > file3
  21627. dotest tagdate-18 "${testcvs} add file3" \
  21628. "${PROG} add: scheduling file \`file3' for addition on branch \`br2'
  21629. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21630. dotest tagdate-19 "${testcvs} -q ci -m add file3" \
  21631. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  21632. done
  21633. Checking in file3;
  21634. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  21635. new revision: 1\.1\.2\.1; previous revision: 1\.1
  21636. done"
  21637. date_T5=`getrlogdate -r1.1 first-dir/file3`
  21638. date_T6=`getrlogdate -r1.1.2.1 first-dir/file3`
  21639. cd ../..
  21640. mkdir 3; cd 3
  21641. dotest tagdate-20 "${testcvs} -Q co first-dir" ''
  21642. cd first-dir
  21643. echo trunk-1 > file2
  21644. dotest tagdate-21 "${testcvs} add file2" \
  21645. "${PROG} add: scheduling file .file2. for addition
  21646. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21647. dotest tagdate-22 "${testcvs} -q ci -m add file2" \
  21648. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  21649. done
  21650. Checking in file2;
  21651. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  21652. initial revision: 1\.1
  21653. done"
  21654. date_T7=`getrlogdate -r1.1 first-dir/file2`
  21655. echo "trunk-2" >file2
  21656. dotest tagdate-23 "${testcvs} -q ci -m update file2" \
  21657. "Checking in file2;
  21658. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  21659. new revision: 1\.2; previous revision: 1\.1
  21660. done"
  21661. date_T8=`getrlogdate -r1.2 first-dir/file2`
  21662. cd ../../1/first-dir
  21663. echo br2-1 > file2
  21664. dotest tagdate-24 "${testcvs} add file2" \
  21665. "${PROG} add: scheduling file \`file2' for addition on branch \`br2'
  21666. ${PROG} add: use .${PROG} commit. to add this file permanently"
  21667. dotest tagdate-25 "${testcvs} -q ci -m add file2" \
  21668. "Checking in file2;
  21669. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  21670. new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1
  21671. done"
  21672. date_T9=`getrlogdate -r1.2.2.2 first-dir/file2`
  21673. cd ../..
  21674. # Time Rev Branch Comments
  21675. # T0 trunk first-dir created
  21676. # T1 1.1 trunk first-dir/file1 committed "trunk-1"
  21677. # br1 branch created
  21678. # br2 branch created
  21679. # T2 1.2 trunk first-dir/file1 committed "trunk-2"
  21680. # T3 1.1.4.1 br2 first-dir/file1 committed "br2-1"
  21681. # +60s
  21682. # T4 1.1.4.2 br2 first-dir/file1 committed "br2-2"
  21683. # T5 1.1 trunk first-dir/file3 dead
  21684. # T6 1.1.2.1 br2 first-dir/file3 committed "br2-1"
  21685. # T7 1.1 trunk first-dir/file2 committed "trunk-1"
  21686. # T8 1.2 trunk first-dir/file2 committed "trunk-2"
  21687. # T8 1.2.2.1 br2 first-dir/file2 dead
  21688. # T9 1.2.2.2 br2 first-dir/file2 committed "br2-1"
  21689. #
  21690. mkdir 4; cd 4
  21691. (echo Dates for tagdate-26-* are:;\
  21692. echo " date_T1='$date_T1'";\
  21693. echo " date_T2='$date_T2'";\
  21694. echo " date_T3='$date_T3'";\
  21695. echo " date_T4='$date_T4'";\
  21696. echo " date_T5='$date_T5'";\
  21697. echo " date_T6='$date_T6'";\
  21698. echo " date_T7='$date_T7'";\
  21699. echo " date_T8='$date_T8'";\
  21700. echo " date_T9='$date_T9'") >>$LOGFILE
  21701. dotest tagdate-26-trunk-t1 \
  21702. "${testcvs} co -D'$date_T1' -d first-dir-trunk-t1 first-dir" \
  21703. "${PROG} checkout: Updating first-dir-trunk-t1
  21704. U first-dir-trunk-t1/file1"
  21705. dotest tagdate-26-br2-t1 \
  21706. "${testcvs} co -r br2 -D'$date_T1' -d first-dir-br2-t1 first-dir" \
  21707. "${PROG} checkout: Updating first-dir-br2-t1
  21708. U first-dir-br2-t1/file1"
  21709. dotest tagdate-26-trunk-t2 \
  21710. "${testcvs} co -D'$date_T2' -d first-dir-trunk-t2 first-dir" \
  21711. "${PROG} checkout: Updating first-dir-trunk-t2
  21712. U first-dir-trunk-t2/file1"
  21713. dotest tagdate-26-br2-t2 \
  21714. "${testcvs} co -r br2 -D'$date_T2' -d first-dir-br2-t2 first-dir" \
  21715. "${PROG} checkout: Updating first-dir-br2-t2
  21716. U first-dir-br2-t2/file1"
  21717. dotest tagdate-26-br2-t3 \
  21718. "${testcvs} co -r br2 -D'$date_T3' -d first-dir-br2-t3 first-dir" \
  21719. "${PROG} checkout: Updating first-dir-br2-t3
  21720. U first-dir-br2-t3/file1"
  21721. dotest tagdate-26-br2-t4 \
  21722. "${testcvs} co -r br2 -D'$date_T4' -d first-dir-br2-t4 first-dir" \
  21723. "${PROG} checkout: Updating first-dir-br2-t4
  21724. U first-dir-br2-t4/file1"
  21725. dotest tagdate-26-br2-t6 \
  21726. "${testcvs} co -r br2 -D'$date_T6' -d first-dir-br2-t6 first-dir" \
  21727. "${PROG} checkout: Updating first-dir-br2-t6
  21728. U first-dir-br2-t6/file1
  21729. U first-dir-br2-t6/file3"
  21730. dotest tagdate-26-trunk-t7 \
  21731. "${testcvs} co -D'$date_T7' -d first-dir-trunk-t7 first-dir" \
  21732. "${PROG} checkout: Updating first-dir-trunk-t7
  21733. U first-dir-trunk-t7/file1
  21734. U first-dir-trunk-t7/file2"
  21735. dotest tagdate-26-br2-t7 \
  21736. "${testcvs} co -r br2 -D'$date_T7' -d first-dir-br2-t7 first-dir" \
  21737. "${PROG} checkout: Updating first-dir-br2-t7
  21738. U first-dir-br2-t7/file1
  21739. U first-dir-br2-t7/file3"
  21740. dotest tagdate-26-trunk-t8 \
  21741. "${testcvs} co -D'$date_T8' -d first-dir-trunk-t8 first-dir" \
  21742. "${PROG} checkout: Updating first-dir-trunk-t8
  21743. U first-dir-trunk-t8/file1
  21744. U first-dir-trunk-t8/file2"
  21745. dotest tagdate-26-br2-t8 \
  21746. "${testcvs} co -r br2 -D'$date_T8' -d first-dir-br2-t8 first-dir" \
  21747. "${PROG} checkout: Updating first-dir-br2-t8
  21748. U first-dir-br2-t8/file1
  21749. U first-dir-br2-t8/file3"
  21750. dotest tagdate-26-br2-t9 \
  21751. "${testcvs} co -r br2 -D'$date_T9' -d first-dir-br2-t9 first-dir" \
  21752. "${PROG} checkout: Updating first-dir-br2-t9
  21753. U first-dir-br2-t9/file1
  21754. U first-dir-br2-t9/file2
  21755. U first-dir-br2-t9/file3"
  21756. dotest tagdate-27-trunk-t1 \
  21757. "${testcvs} status first-dir-trunk-t1" \
  21758. "${PROG} status: Examining first-dir-trunk-t1
  21759. ===================================================================
  21760. File: file1 Status: Up-to-date
  21761. Working revision: 1\.1[^.]*
  21762. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21763. Sticky Tag: (none)
  21764. Sticky Date: [0-9.]*
  21765. Sticky Options: (none)"
  21766. dotest tagdate-27-br2-t1 \
  21767. "${testcvs} status first-dir-br2-t1" \
  21768. "${PROG} status: Examining first-dir-br2-t1
  21769. ===================================================================
  21770. File: file1 Status: Needs Patch
  21771. Working revision: 1\.1[^.]*
  21772. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21773. Sticky Tag: br2 (branch: 1\.1\.4)
  21774. Sticky Date: (none)
  21775. Sticky Options: (none)"
  21776. dotest tagdate-27-trunk-t2 \
  21777. "${testcvs} status first-dir-trunk-t2" \
  21778. "${PROG} status: Examining first-dir-trunk-t2
  21779. ===================================================================
  21780. File: file1 Status: Up-to-date
  21781. Working revision: 1\.2[^.]*
  21782. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21783. Sticky Tag: (none)
  21784. Sticky Date: [0-9.]*
  21785. Sticky Options: (none)"
  21786. dotest tagdate-27-br2-t2 \
  21787. "${testcvs} status first-dir-br2-t2" \
  21788. "${PROG} status: Examining first-dir-br2-t2
  21789. ===================================================================
  21790. File: file1 Status: Needs Patch
  21791. Working revision: 1\.1[^.]*
  21792. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21793. Sticky Tag: br2 (branch: 1\.1\.4)
  21794. Sticky Date: (none)
  21795. Sticky Options: (none)"
  21796. dotest tagdate-27-br2-t3 \
  21797. "${testcvs} status first-dir-br2-t3" \
  21798. "${PROG} status: Examining first-dir-br2-t3
  21799. ===================================================================
  21800. File: file1 Status: Needs Patch
  21801. Working revision: 1\.1\.4\.1[^.]*
  21802. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21803. Sticky Tag: br2 (branch: 1\.1\.4)
  21804. Sticky Date: (none)
  21805. Sticky Options: (none)"
  21806. dotest tagdate-27-br2-t4 \
  21807. "${testcvs} status first-dir-br2-t4" \
  21808. "${PROG} status: Examining first-dir-br2-t4
  21809. ===================================================================
  21810. File: file1 Status: Up-to-date
  21811. Working revision: 1\.1\.4\.2[^.]*
  21812. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21813. Sticky Tag: br2 (branch: 1\.1\.4)
  21814. Sticky Date: (none)
  21815. Sticky Options: (none)"
  21816. dotest tagdate-27-br2-t6 \
  21817. "${testcvs} status first-dir-br2-t6" \
  21818. "${PROG} status: Examining first-dir-br2-t6
  21819. ===================================================================
  21820. File: file1 Status: Up-to-date
  21821. Working revision: 1\.1\.4\.2[^.]*
  21822. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21823. Sticky Tag: br2 (branch: 1\.1\.4)
  21824. Sticky Date: (none)
  21825. Sticky Options: (none)
  21826. ===================================================================
  21827. File: file3 Status: Up-to-date
  21828. Working revision: 1\.1\.2\.1[^.]*
  21829. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  21830. Sticky Tag: br2 (branch: 1\.1\.2)
  21831. Sticky Date: (none)
  21832. Sticky Options: (none)"
  21833. dotest tagdate-27-trunk-t7 \
  21834. "${testcvs} status first-dir-trunk-t7" \
  21835. "${PROG} status: Examining first-dir-trunk-t7
  21836. ===================================================================
  21837. File: file1 Status: Up-to-date
  21838. Working revision: 1\.2[^.]*
  21839. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21840. Sticky Tag: (none)
  21841. Sticky Date: [0-9.]*
  21842. Sticky Options: (none)
  21843. ===================================================================
  21844. File: file2 Status: Up-to-date
  21845. Working revision: 1\.1[^.]*
  21846. Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file2,v
  21847. Sticky Tag: (none)
  21848. Sticky Date: [0-9.]*
  21849. Sticky Options: (none)"
  21850. dotest tagdate-27-br2-t7 \
  21851. "${testcvs} status first-dir-br2-t7" \
  21852. "${PROG} status: Examining first-dir-br2-t7
  21853. ===================================================================
  21854. File: file1 Status: Up-to-date
  21855. Working revision: 1\.1\.4\.2[^.]*
  21856. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21857. Sticky Tag: br2 (branch: 1\.1\.4)
  21858. Sticky Date: (none)
  21859. Sticky Options: (none)
  21860. ===================================================================
  21861. File: file3 Status: Up-to-date
  21862. Working revision: 1\.1\.2\.1[^.]*
  21863. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  21864. Sticky Tag: br2 (branch: 1\.1\.2)
  21865. Sticky Date: (none)
  21866. Sticky Options: (none)"
  21867. dotest tagdate-27-trunk-t8 \
  21868. "${testcvs} status first-dir-trunk-t8" \
  21869. "${PROG} status: Examining first-dir-trunk-t8
  21870. ===================================================================
  21871. File: file1 Status: Up-to-date
  21872. Working revision: 1\.2[^.]*
  21873. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21874. Sticky Tag: (none)
  21875. Sticky Date: [0-9.]*
  21876. Sticky Options: (none)
  21877. ===================================================================
  21878. File: file2 Status: Up-to-date
  21879. Working revision: 1\.2[^.]*
  21880. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file2,v
  21881. Sticky Tag: (none)
  21882. Sticky Date: [0-9.]*
  21883. Sticky Options: (none)"
  21884. dotest tagdate-27-br2-t8 \
  21885. "${testcvs} status first-dir-br2-t8" \
  21886. "${PROG} status: Examining first-dir-br2-t8
  21887. ===================================================================
  21888. File: file1 Status: Up-to-date
  21889. Working revision: 1\.1\.4\.2[^.]*
  21890. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21891. Sticky Tag: br2 (branch: 1\.1\.4)
  21892. Sticky Date: (none)
  21893. Sticky Options: (none)
  21894. ===================================================================
  21895. File: file3 Status: Up-to-date
  21896. Working revision: 1\.1\.2\.1[^.]*
  21897. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  21898. Sticky Tag: br2 (branch: 1\.1\.2)
  21899. Sticky Date: (none)
  21900. Sticky Options: (none)"
  21901. dotest tagdate-27-br2-t9 \
  21902. "${testcvs} status first-dir-br2-t9" \
  21903. "${PROG} status: Examining first-dir-br2-t9
  21904. ===================================================================
  21905. File: file1 Status: Up-to-date
  21906. Working revision: 1\.1\.4\.2[^.]*
  21907. Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v
  21908. Sticky Tag: br2 (branch: 1\.1\.4)
  21909. Sticky Date: (none)
  21910. Sticky Options: (none)
  21911. ===================================================================
  21912. File: file2 Status: Up-to-date
  21913. Working revision: 1\.2\.2\.2[^.]*
  21914. Repository revision: 1\.2\.2\.2 ${CVSROOT_DIRNAME}/first-dir/file2,v
  21915. Sticky Tag: br2 (branch: 1\.2\.2)
  21916. Sticky Date: (none)
  21917. Sticky Options: (none)
  21918. ===================================================================
  21919. File: file3 Status: Up-to-date
  21920. Working revision: 1\.1\.2\.1[^.]*
  21921. Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  21922. Sticky Tag: br2 (branch: 1\.1\.2)
  21923. Sticky Date: (none)
  21924. Sticky Options: (none)"
  21925. # Now check the contents of the files
  21926. dotest tagdate-28-trunk-t1 'cat first-dir-trunk-t1/file1' 'trunk-1'
  21927. dotest tagdate-28-br2-t1 'cat first-dir-br2-t1/file1' 'trunk-1'
  21928. dotest tagdate-28-trunk-t2 'cat first-dir-trunk-t2/file1' 'trunk-2'
  21929. dotest tagdate-28-br2-t2 'cat first-dir-br2-t2/file1' 'trunk-1'
  21930. dotest tagdate-28-br2-t3 'cat first-dir-br2-t3/file1' 'br2-1'
  21931. dotest tagdate-28-br2-t4 'cat first-dir-br2-t4/file1' 'br2-2'
  21932. dotest tagdate-28-br2-t6a 'cat first-dir-br2-t6/file1' "br2-2"
  21933. dotest tagdate-28-br2-t6b 'cat first-dir-br2-t6/file3' "br2-1"
  21934. dotest tagdate-28-trunk-t7a 'cat first-dir-trunk-t7/file1' "trunk-2"
  21935. dotest tagdate-28-trunk-t7b 'cat first-dir-trunk-t7/file2' "trunk-1"
  21936. dotest tagdate-28-br2-t7a 'cat first-dir-br2-t7/file1' "br2-2"
  21937. dotest tagdate-28-br2-t7b 'cat first-dir-br2-t7/file3' "br2-1"
  21938. dotest tagdate-28-trunk-t8a 'cat first-dir-trunk-t8/file1' "trunk-2"
  21939. dotest tagdate-28-trunk-t8b 'cat first-dir-trunk-t8/file2' "trunk-2"
  21940. dotest tagdate-28-br2-t8a 'cat first-dir-br2-t8/file1' "br2-2"
  21941. dotest tagdate-28-br2-t8c 'cat first-dir-br2-t8/file3' "br2-1"
  21942. dotest tagdate-28-br2-t9a 'cat first-dir-br2-t9/file1' "br2-2"
  21943. dotest tagdate-28-br2-t9b 'cat first-dir-br2-t9/file2' "br2-1"
  21944. dotest tagdate-28-br2-t9c 'cat first-dir-br2-t9/file3' "br2-1"
  21945. cd ..
  21946. unset date_T1 date_T2 date_T3 date_T4 date_T5
  21947. unset date_T6 date_T7 date_T8 date_T9
  21948. TZ=$save_TZ
  21949. if $keep; then
  21950. echo Keeping ${TESTDIR} and exiting due to --keep
  21951. exit 0
  21952. fi
  21953. rm -r 1 2 3 4
  21954. rm -rf ${CVSROOT_DIRNAME}/first-dir
  21955. ;;
  21956. multibranch2)
  21957. # Commit the first delta on branch A when there is an older
  21958. # branch, B, that already has a delta. A and B come from the
  21959. # same branch point. Then verify that branches A and B are
  21960. # in the right order.
  21961. mkdir 1; cd 1
  21962. dotest multibranch2-1 "${testcvs} -q co -l ." ''
  21963. mkdir first-dir
  21964. dotest multibranch2-2 "${testcvs} add first-dir" \
  21965. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  21966. cd first-dir
  21967. echo trunk-1 >file1
  21968. echo trunk-1 >file2
  21969. dotest multibranch2-3 "${testcvs} add file1 file2" \
  21970. "${PROG} add: scheduling file .file1. for addition
  21971. ${PROG} add: scheduling file .file2. for addition
  21972. ${PROG} add: use .${PROG} commit. to add these files permanently"
  21973. dotest multibranch2-4 "${testcvs} -q ci -m add" \
  21974. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  21975. done
  21976. Checking in file1;
  21977. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21978. initial revision: 1\.1
  21979. done
  21980. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  21981. done
  21982. Checking in file2;
  21983. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  21984. initial revision: 1\.1
  21985. done"
  21986. dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1
  21987. T file2"
  21988. dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1
  21989. T file2"
  21990. dotest multibranch2-7 "$testcvs -q update -r B" \
  21991. '[UP] file1
  21992. [UP] file2'
  21993. echo branch-B >file1
  21994. echo branch-B >file2
  21995. dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
  21996. "Checking in file1;
  21997. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  21998. new revision: 1\.1\.4\.1; previous revision: 1\.1
  21999. done
  22000. Checking in file2;
  22001. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22002. new revision: 1\.1\.4\.1; previous revision: 1\.1
  22003. done"
  22004. dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1
  22005. [UP] file2'
  22006. echo branch-A >file1
  22007. # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
  22008. dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
  22009. "Checking in file1;
  22010. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  22011. new revision: 1\.1\.2\.1; previous revision: 1\.1
  22012. done"
  22013. dotest multibranch2-11 "${testcvs} -q log file1" \
  22014. "
  22015. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22016. Working file: file1
  22017. head: 1\.1
  22018. branch:
  22019. locks: strict
  22020. access list:
  22021. symbolic names:
  22022. B: 1\.1\.0\.4
  22023. A: 1\.1\.0\.2
  22024. keyword substitution: kv
  22025. total revisions: 3; selected revisions: 3
  22026. description:
  22027. ----------------------------
  22028. revision 1\.1
  22029. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  22030. branches: 1\.1\.2; 1\.1\.4;
  22031. add
  22032. ----------------------------
  22033. revision 1\.1\.4\.1
  22034. date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1
  22035. modify-on-B
  22036. ----------------------------
  22037. revision 1\.1\.2\.1
  22038. date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1
  22039. modify-on-A
  22040. ============================================================================="
  22041. # This one is more concise.
  22042. dotest multibranch2-12 "${testcvs} -q log -r1.1 file1" \
  22043. "
  22044. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22045. Working file: file1
  22046. head: 1\.1
  22047. branch:
  22048. locks: strict
  22049. access list:
  22050. symbolic names:
  22051. B: 1\.1\.0\.4
  22052. A: 1\.1\.0\.2
  22053. keyword substitution: kv
  22054. total revisions: 3; selected revisions: 1
  22055. description:
  22056. ----------------------------
  22057. revision 1\.1
  22058. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  22059. branches: 1\.1\.2; 1\.1\.4;
  22060. add
  22061. ============================================================================="
  22062. # OK, try very much the same thing except we run update -j to
  22063. # bring the changes from B to A. Probably tests many of the
  22064. # same code paths but might as well keep it separate, I guess.
  22065. dotest multibranch2-13 "${testcvs} -q update -r B" "[UP] file1
  22066. [UP] file2"
  22067. dotest multibranch2-14 "${testcvs} -q update -r A -j B file2" \
  22068. "[UP] file2
  22069. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22070. retrieving revision 1.1
  22071. retrieving revision 1.1.4.1
  22072. Merging differences between 1.1 and 1.1.4.1 into file2"
  22073. dotest multibranch2-15 "${testcvs} -q ci -m commit-on-A file2" \
  22074. "Checking in file2;
  22075. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22076. new revision: 1\.1\.2\.1; previous revision: 1\.1
  22077. done"
  22078. cd ../..
  22079. rm -r 1
  22080. rm -rf ${CVSROOT_DIRNAME}/first-dir
  22081. ;;
  22082. tag8k)
  22083. # In cvs-1.9.27, there is a bug that can cause an abort.
  22084. # It happens when you commit a change to a ,v file that has
  22085. # just the right amount of tag/branch info to align one of the
  22086. # semicolons in the branch info to be on a 8k-byte boundary.
  22087. # The result: rcsbuf_getkey got an abort. This failure doesn't
  22088. # corrupt the ,v file -- that would be really serious. But it
  22089. # does leave stale write locks that have to be removed manually.
  22090. mkdir 1
  22091. cd 1
  22092. module=x
  22093. : > junk
  22094. dotest tag8k-1 "$testcvs -Q import -m . $module X Y" ''
  22095. dotest tag8k-2 "$testcvs -Q co $module" ''
  22096. cd $module
  22097. file=m
  22098. : > $file
  22099. dotest tag8k-3 "$testcvs add $file" \
  22100. "${PROG} add: scheduling file .$file. for addition
  22101. ${PROG} add: use .${PROG} commit. to add this file permanently"
  22102. dotest tag8k-4 "$testcvs -Q ci -m . $file" \
  22103. "RCS file: ${CVSROOT_DIRNAME}/$module/$file,v
  22104. done
  22105. Checking in $file;
  22106. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  22107. initial revision: 1\.1
  22108. done"
  22109. # It seems there have to be at least two versions.
  22110. echo a > $file
  22111. dotest tag8k-5 "$testcvs -Q ci -m . $file" \
  22112. "Checking in $file;
  22113. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  22114. new revision: 1\.2; previous revision: 1\.1
  22115. done"
  22116. # Add just under 8K worth of tags.
  22117. t=TAG---------------------------------------------------------------------
  22118. t=$t$t
  22119. t=$t$t$t$t$t
  22120. # Now $t is 720 bytes long.
  22121. # Apply some tags with that long prefix.
  22122. dotest tag8k-6 "$testcvs -Q tag $t-0 $file" ''
  22123. dotest tag8k-7 "$testcvs -Q tag $t-1 $file" ''
  22124. dotest tag8k-8 "$testcvs -Q tag $t-2 $file" ''
  22125. dotest tag8k-9 "$testcvs -Q tag $t-3 $file" ''
  22126. dotest tag8k-10 "$testcvs -Q tag $t-4 $file" ''
  22127. dotest tag8k-11 "$testcvs -Q tag $t-5 $file" ''
  22128. dotest tag8k-12 "$testcvs -Q tag $t-6 $file" ''
  22129. dotest tag8k-13 "$testcvs -Q tag $t-7 $file" ''
  22130. dotest tag8k-14 "$testcvs -Q tag $t-8 $file" ''
  22131. dotest tag8k-15 "$testcvs -Q tag $t-9 $file" ''
  22132. dotest tag8k-16 "$testcvs -Q tag $t-a $file" ''
  22133. # Extract the author value.
  22134. name=`sed -n 's/.*; author \([^;]*\);.*/\1/p' ${CVSROOT_DIRNAME}/$module/$file,v|sed 1q`
  22135. # Form a suffix string of length (16 - length($name)).
  22136. # CAREFUL: this will lose if $name is longer than 16.
  22137. sed_pattern=`echo $name|sed s/././g`
  22138. suffix=`echo 1234567890123456|sed s/$sed_pattern//`
  22139. # Add a final tag with length chosen so that it will push the
  22140. # offset of the `;' in the 2nd occurrence of `;\tauthor' in the
  22141. # ,v file to exactly 8192.
  22142. dotest tag8k-17 "$testcvs -Q tag "x8bytes-$suffix" $file" ''
  22143. # This commit would fail with 1.9.27.
  22144. echo a >> $file
  22145. dotest tag8k-18 "$testcvs -Q ci -m . $file" \
  22146. "Checking in $file;
  22147. ${CVSROOT_DIRNAME}/$module/$file,v <-- $file
  22148. new revision: 1\.3; previous revision: 1\.2
  22149. done"
  22150. cd ../..
  22151. rm -r 1
  22152. rm -rf ${CVSROOT_DIRNAME}/$module
  22153. ;;
  22154. admin)
  22155. # More "cvs admin" tests.
  22156. # The basicb-21 test tests rejecting an illegal option.
  22157. # For -l and -u, see "reserved" and "keyword" tests.
  22158. # "binfiles" test has a test of "cvs admin -k".
  22159. # "log2" test has tests of -t and -q options to cvs admin.
  22160. # "rcs" tests -b option also.
  22161. # For -o, see:
  22162. # admin-22-o1 through admin-23 (various cases not involving ::)
  22163. # binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
  22164. # basicb-o* (attempt to delete all revisions)
  22165. # basica-o1 through basica-o3 (basic :: usage)
  22166. # head-o1 (::branch, where this deletes a revision or is noop)
  22167. # branches-o1 (::branch, similar, with different branch topology)
  22168. # log-o1 (1.3.2.1::)
  22169. # binfiles-o1 (1.3:: and ::1.3; binary files)
  22170. # binfiles3-9 (binary files)
  22171. # Also could be testing:
  22172. # 1.3.2.6::1.3.2.8
  22173. # 1.3.2.6::1.3.2
  22174. # 1.3.2.1::1.3.2.6
  22175. # 1.3::1.3.2.6 (error? or synonym for ::1.3.2.6?)
  22176. # -n: admin, tagf tests.
  22177. mkdir 1; cd 1
  22178. dotest admin-1 "${testcvs} -q co -l ." ''
  22179. mkdir first-dir
  22180. dotest admin-2 "${testcvs} add first-dir" \
  22181. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  22182. cd first-dir
  22183. dotest_fail admin-3 "${testcvs} -q admin -i file1" \
  22184. "${PROG} admin: the -i option to admin is not supported
  22185. ${PROG} admin: run add or import to create an RCS file
  22186. ${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
  22187. dotest_fail admin-4 "${testcvs} -q log file1" \
  22188. "${PROG} log: nothing known about file1"
  22189. dotest_fail admin-4a "${testcvs} -q admin file1" \
  22190. "${PROG} admin: nothing known about file1"
  22191. # Set up some files, file2 a plain one and file1 with a revision
  22192. # on a branch.
  22193. touch file1 file2
  22194. dotest admin-5 "${testcvs} add file1 file2" \
  22195. "${PROG} add: scheduling file .file1. for addition
  22196. ${PROG} add: scheduling file .file2. for addition
  22197. ${PROG} add: use .${PROG} commit. to add these files permanently"
  22198. dotest admin-6 "${testcvs} -q ci -m add" \
  22199. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22200. done
  22201. Checking in file1;
  22202. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  22203. initial revision: 1\.1
  22204. done
  22205. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22206. done
  22207. Checking in file2;
  22208. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22209. initial revision: 1\.1
  22210. done"
  22211. dotest admin-7 "${testcvs} -q tag -b br" "T file1
  22212. T file2"
  22213. dotest admin-8 "$testcvs -q update -r br" \
  22214. 'U file1
  22215. U file2'
  22216. echo 'add a line on the branch' >> file1
  22217. echo 'add a file on the branch' >> file3
  22218. dotest admin-9a "${testcvs} -q add file3" \
  22219. "${PROG} add: use .${PROG} commit. to add this file permanently"
  22220. dotest admin-9b "${testcvs} -q ci -m modify-on-branch" \
  22221. "Checking in file1;
  22222. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  22223. new revision: 1\.1\.2\.1; previous revision: 1\.1
  22224. done
  22225. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  22226. done
  22227. Checking in file3;
  22228. ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3
  22229. new revision: 1\.1\.2\.1; previous revision: 1\.1
  22230. done"
  22231. dotest admin-10 "$testcvs -q update -A" \
  22232. "U file1
  22233. U file2
  22234. $PROG update: file3 is no longer in the repository"
  22235. # Check that we can administer files in the repository that
  22236. # aren't in the working directory.
  22237. dotest admin-10-1 "${testcvs} admin ." \
  22238. "${PROG} admin: Administrating .
  22239. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22240. done
  22241. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22242. done"
  22243. dotest admin-10-2 "${testcvs} -q admin file3" \
  22244. "RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  22245. done"
  22246. # Try to recurse with a numeric revision arg.
  22247. # If we wanted to comprehensive about this, we would also test
  22248. # this for -l, -u, and all the different -o syntaxes.
  22249. dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
  22250. "${PROG} [a-z]*: while processing more than one file:
  22251. ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
  22252. dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
  22253. "${PROG} [a-z]*: while processing more than one file:
  22254. ${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
  22255. # try a bad symbolic revision
  22256. dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \
  22257. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22258. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: Symbolic name BOGUS is undefined.
  22259. ${PROG} admin: RCS file for .file1. not modified\.
  22260. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22261. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name BOGUS is undefined.
  22262. ${PROG} admin: RCS file for .file2. not modified\."
  22263. # Note that -s option applies to the new default branch, not
  22264. # the old one.
  22265. # Also note that the implementation of -a via "rcs" requires
  22266. # no space between -a and the argument. However, we expect
  22267. # to change that once CVS parses options.
  22268. dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
  22269. -b1.1.2 -cxx -U -sfoo file1" \
  22270. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22271. done"
  22272. dotest admin-11a "${testcvs} log -N file1" "
  22273. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22274. Working file: file1
  22275. head: 1\.1
  22276. branch: 1\.1\.2
  22277. locks:
  22278. access list:
  22279. foo
  22280. bar
  22281. baz
  22282. keyword substitution: kv
  22283. total revisions: 2; selected revisions: 2
  22284. description:
  22285. ----------------------------
  22286. revision 1\.1
  22287. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22288. branches: 1\.1\.2;
  22289. add
  22290. ----------------------------
  22291. revision 1\.1\.2\.1
  22292. date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
  22293. modify-on-branch
  22294. ============================================================================="
  22295. dotest admin-12 "${testcvs} -q admin -bbr file1" \
  22296. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22297. done"
  22298. dotest admin-12a "${testcvs} log -N file1" "
  22299. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22300. Working file: file1
  22301. head: 1\.1
  22302. branch: 1\.1\.2
  22303. locks:
  22304. access list:
  22305. foo
  22306. bar
  22307. baz
  22308. keyword substitution: kv
  22309. total revisions: 2; selected revisions: 2
  22310. description:
  22311. ----------------------------
  22312. revision 1\.1
  22313. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22314. branches: 1\.1\.2;
  22315. add
  22316. ----------------------------
  22317. revision 1\.1\.2\.1
  22318. date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
  22319. modify-on-branch
  22320. ============================================================================="
  22321. # "cvs log" doesn't print the comment leader. RCS 5.7 will print
  22322. # the comment leader only if one specifies "-V4" to rlog. So it
  22323. # seems like the only way to test it is by looking at the RCS file
  22324. # directly. This also serves as a test of exporting RCS files
  22325. # (analogous to the import tests in "rcs").
  22326. # Rather than try to write a rigorous check for whether the
  22327. # file CVS exports is legal, we just write a simpler
  22328. # test for what CVS actually exports, and figure we can revise
  22329. # the check as needed (within the confines of the RCS5 format as
  22330. # documented in RCSFILES).
  22331. # Note that we must accept either 2 or 4 digit year.
  22332. dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
  22333. "head 1\.1;
  22334. branch 1\.1\.2;
  22335. access
  22336. foo
  22337. bar
  22338. baz;
  22339. symbols
  22340. br:1\.1\.0\.2;
  22341. locks;
  22342. comment @xx@;
  22343. 1\.1
  22344. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
  22345. branches
  22346. 1\.1\.2\.1;
  22347. next ;
  22348. 1\.1\.2\.1
  22349. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo;
  22350. branches;
  22351. next ;
  22352. desc
  22353. @@
  22354. 1\.1
  22355. log
  22356. @add
  22357. @
  22358. text
  22359. @@
  22360. 1\.1\.2\.1
  22361. log
  22362. @modify-on-branch
  22363. @
  22364. text
  22365. @a0 1
  22366. add a line on the branch
  22367. @"
  22368. dotest_fail admin-14-1 "${testcvs} -q admin \
  22369. -m1.1.1.1:changed-bogus-log-message file2" \
  22370. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22371. cvs admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision 1\.1\.1\.1
  22372. cvs admin: RCS file for .file2. not modified."
  22373. dotest admin-14-2 "${testcvs} -q log file2" "
  22374. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22375. Working file: file2
  22376. head: 1\.1
  22377. branch:
  22378. locks: strict
  22379. access list:
  22380. symbolic names:
  22381. br: 1\.1\.0\.2
  22382. keyword substitution: kv
  22383. total revisions: 1; selected revisions: 1
  22384. description:
  22385. ----------------------------
  22386. revision 1\.1
  22387. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22388. add
  22389. ============================================================================="
  22390. dotest admin-14-3 "${testcvs} -q admin -aauth3 -aauth2,foo \
  22391. -soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
  22392. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22393. done"
  22394. dotest admin-15 "${testcvs} -q log file2" "
  22395. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22396. Working file: file2
  22397. head: 1\.1
  22398. branch:
  22399. locks: strict
  22400. access list:
  22401. auth3
  22402. auth2
  22403. foo
  22404. symbolic names:
  22405. tagone: 1\.1
  22406. br: 1\.1\.0\.2
  22407. keyword substitution: kv
  22408. total revisions: 1; selected revisions: 1
  22409. description:
  22410. ----------------------------
  22411. revision 1\.1
  22412. date: [0-9/]* [0-9:]*; author: ${username}; state: oneone;
  22413. changed-log-message
  22414. ============================================================================="
  22415. dotest admin-16 "${testcvs} -q admin \
  22416. -A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
  22417. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22418. done"
  22419. dotest admin-17 "${testcvs} -q log file1" "
  22420. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22421. Working file: file1
  22422. head: 1\.1
  22423. branch:
  22424. locks: strict
  22425. access list:
  22426. foo
  22427. bar
  22428. baz
  22429. auth3
  22430. auth2
  22431. symbolic names:
  22432. br: 1\.1
  22433. keyword substitution: kv
  22434. total revisions: 2; selected revisions: 2
  22435. description:
  22436. ----------------------------
  22437. revision 1\.1
  22438. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22439. branches: 1\.1\.2;
  22440. add
  22441. ----------------------------
  22442. revision 1\.1\.2\.1
  22443. date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
  22444. modify-on-branch
  22445. ============================================================================="
  22446. dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
  22447. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22448. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file1,v: symbolic name br already bound to 1\.1
  22449. ${PROG} admin: RCS file for .file1. not modified\."
  22450. dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
  22451. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22452. done"
  22453. dotest admin-20 "${testcvs} -q log file1" "
  22454. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22455. Working file: file1
  22456. head: 1\.1
  22457. branch:
  22458. locks: strict
  22459. access list:
  22460. foo
  22461. auth2
  22462. symbolic names:
  22463. keyword substitution: kv
  22464. total revisions: 2; selected revisions: 2
  22465. description:
  22466. ----------------------------
  22467. revision 1\.1
  22468. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22469. branches: 1\.1\.2;
  22470. add
  22471. ----------------------------
  22472. revision 1.1.2.1
  22473. date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
  22474. modify-on-branch
  22475. ============================================================================="
  22476. # OK, this is starting to get ridiculous, in terms of
  22477. # testing a feature (access lists) which doesn't do anything
  22478. # useful, but what about nonexistent files and
  22479. # relative pathnames in admin -A?
  22480. dotest_fail admin-19a-nonexist \
  22481. "${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
  22482. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22483. ${PROG} admin: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
  22484. ${PROG} \[admin aborted\]: cannot continue"
  22485. # In the remote case, we are cd'd off into the temp directory
  22486. # and so these tests give "No such file or directory" errors.
  22487. if $remote; then :; else
  22488. dotest admin-19a-admin "${testcvs} -q admin -A../../${CVSROOTDIR}/first-dir/file2,v file1" \
  22489. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22490. done"
  22491. dotest admin-19a-log "${testcvs} -q log -h -N file1" "
  22492. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22493. Working file: file1
  22494. head: 1\.1
  22495. branch:
  22496. locks: strict
  22497. access list:
  22498. foo
  22499. auth2
  22500. auth3
  22501. keyword substitution: kv
  22502. total revisions: 2
  22503. ============================================================================="
  22504. fi # end of tests skipped for remote
  22505. # Now test that plain -e works right.
  22506. dotest admin-19a-2 "${testcvs} -q admin -e file1" \
  22507. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22508. done"
  22509. dotest admin-19a-3 "${testcvs} -q log -h -N file1" "
  22510. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22511. Working file: file1
  22512. head: 1\.1
  22513. branch:
  22514. locks: strict
  22515. access list:
  22516. keyword substitution: kv
  22517. total revisions: 2
  22518. ============================================================================="
  22519. # Put the access list back, to avoid special cases later.
  22520. dotest admin-19a-4 "${testcvs} -q admin -afoo,auth2 file1" \
  22521. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22522. done"
  22523. # Add another revision to file2, so we can delete one.
  22524. echo 'add a line' >> file2
  22525. dotest admin-21 "${testcvs} -q ci -m modify file2" \
  22526. "Checking in file2;
  22527. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22528. new revision: 1\.2; previous revision: 1\.1
  22529. done"
  22530. dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
  22531. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22532. deleting revision 1\.1
  22533. done"
  22534. # Test admin -o. More variants that we could be testing:
  22535. # * REV: [on branch]
  22536. # * REV1:REV2 [deleting whole branch]
  22537. # * high branch numbers (e.g. 1.2.2.3.2.3)
  22538. # ... and probably others. See RCS_delete_revs for ideas.
  22539. echo first rev > aaa
  22540. dotest admin-22-o1 "${testcvs} add aaa" \
  22541. "${PROG} add: scheduling file .aaa. for addition
  22542. ${PROG} add: use .${PROG} commit. to add this file permanently"
  22543. dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
  22544. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22545. done
  22546. Checking in aaa;
  22547. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22548. initial revision: 1\.1
  22549. done"
  22550. echo second rev >> aaa
  22551. dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
  22552. "Checking in aaa;
  22553. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22554. new revision: 1\.2; previous revision: 1\.1
  22555. done"
  22556. echo third rev >> aaa
  22557. dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
  22558. "Checking in aaa;
  22559. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22560. new revision: 1\.3; previous revision: 1\.2
  22561. done"
  22562. echo fourth rev >> aaa
  22563. dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
  22564. "Checking in aaa;
  22565. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22566. new revision: 1\.4; previous revision: 1\.3
  22567. done"
  22568. echo fifth rev >>aaa
  22569. dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
  22570. "Checking in aaa;
  22571. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22572. new revision: 1\.5; previous revision: 1\.4
  22573. done"
  22574. echo sixth rev >> aaa
  22575. dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
  22576. "Checking in aaa;
  22577. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22578. new revision: 1\.6; previous revision: 1\.5
  22579. done"
  22580. dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
  22581. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22582. 1\.6 locked
  22583. done"
  22584. dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
  22585. RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22586. Working file: aaa
  22587. head: 1\.6
  22588. branch:
  22589. locks: strict
  22590. ${username}: 1\.6
  22591. access list:
  22592. symbolic names:
  22593. keyword substitution: kv
  22594. total revisions: 6; selected revisions: 1
  22595. description:
  22596. ----------------------------
  22597. revision 1\.6 locked by: ${username};
  22598. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22599. sixth
  22600. ============================================================================="
  22601. dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
  22602. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22603. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove locked revision 1\.6
  22604. ${PROG} admin: RCS file for .aaa. not modified\."
  22605. dotest admin-22-o11 "${testcvs} admin -u aaa" \
  22606. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22607. 1\.6 unlocked
  22608. done"
  22609. dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
  22610. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22611. deleting revision 1\.6
  22612. deleting revision 1\.5
  22613. done"
  22614. dotest admin-22-o13 "${testcvs} log aaa" "
  22615. RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22616. Working file: aaa
  22617. head: 1\.4
  22618. branch:
  22619. locks: strict
  22620. access list:
  22621. symbolic names:
  22622. keyword substitution: kv
  22623. total revisions: 4; selected revisions: 4
  22624. description:
  22625. ----------------------------
  22626. revision 1\.4
  22627. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22628. fourth
  22629. ----------------------------
  22630. revision 1\.3
  22631. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22632. third
  22633. ----------------------------
  22634. revision 1\.2
  22635. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22636. second
  22637. ----------------------------
  22638. revision 1\.1
  22639. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22640. first
  22641. ============================================================================="
  22642. dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
  22643. dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
  22644. echo new branch rev >> aaa
  22645. dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
  22646. "Checking in aaa;
  22647. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22648. new revision: 1\.3\.2\.1; previous revision: 1\.3
  22649. done"
  22650. dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
  22651. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22652. deleting revision 1\.4
  22653. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: can't remove branch point 1\.3
  22654. ${PROG} admin: RCS file for .aaa. not modified\."
  22655. dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
  22656. "===================================================================
  22657. Checking out aaa
  22658. RCS: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22659. VERS: 1\.4
  22660. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  22661. first rev
  22662. second rev
  22663. third rev
  22664. fourth rev"
  22665. echo second branch rev >> aaa
  22666. dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
  22667. "Checking in aaa;
  22668. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22669. new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
  22670. done"
  22671. echo third branch rev >> aaa
  22672. dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
  22673. "Checking in aaa;
  22674. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22675. new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
  22676. done"
  22677. echo fourth branch rev >> aaa
  22678. dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
  22679. "Checking in aaa;
  22680. ${CVSROOT_DIRNAME}/first-dir/aaa,v <-- aaa
  22681. new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
  22682. done"
  22683. dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
  22684. "RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22685. deleting revision 1\.3\.2\.1
  22686. deleting revision 1\.3\.2\.2
  22687. deleting revision 1\.3\.2\.3
  22688. done"
  22689. dotest admin-22-o23 "${testcvs} log aaa" "
  22690. RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22691. Working file: aaa
  22692. head: 1\.4
  22693. branch:
  22694. locks: strict
  22695. access list:
  22696. symbolic names:
  22697. br1: 1\.3\.0\.2
  22698. keyword substitution: kv
  22699. total revisions: 5; selected revisions: 5
  22700. description:
  22701. ----------------------------
  22702. revision 1\.4
  22703. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22704. fourth
  22705. ----------------------------
  22706. revision 1\.3
  22707. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22708. branches: 1\.3\.2;
  22709. third
  22710. ----------------------------
  22711. revision 1\.2
  22712. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22713. second
  22714. ----------------------------
  22715. revision 1\.1
  22716. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22717. first
  22718. ----------------------------
  22719. revision 1\.3\.2\.4
  22720. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}4 -0
  22721. branch-four
  22722. ============================================================================="
  22723. dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
  22724. "first rev
  22725. second rev
  22726. third rev
  22727. new branch rev
  22728. second branch rev
  22729. third branch rev
  22730. fourth branch rev"
  22731. # The bit here about how there is a "tagone" tag pointing to
  22732. # a nonexistent revision is documented by rcs. I dunno, I
  22733. # wonder whether the "cvs admin -o" should give a warning in
  22734. # this case.
  22735. dotest admin-23 "${testcvs} -q log file2" "
  22736. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22737. Working file: file2
  22738. head: 1\.2
  22739. branch:
  22740. locks: strict
  22741. access list:
  22742. auth3
  22743. auth2
  22744. foo
  22745. symbolic names:
  22746. tagone: 1\.1
  22747. br: 1\.1\.0\.2
  22748. keyword substitution: kv
  22749. total revisions: 1; selected revisions: 1
  22750. description:
  22751. ----------------------------
  22752. revision 1\.2
  22753. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22754. modify
  22755. ============================================================================="
  22756. dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
  22757. "head 1\.1;
  22758. access
  22759. foo
  22760. auth2;
  22761. symbols;
  22762. locks; strict;
  22763. comment @xx@;
  22764. 1\.1
  22765. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
  22766. branches
  22767. 1\.1\.2\.1;
  22768. next ;
  22769. 1\.1\.2\.1
  22770. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo;
  22771. branches;
  22772. next ;
  22773. desc
  22774. @@
  22775. 1\.1
  22776. log
  22777. @add
  22778. @
  22779. text
  22780. @@
  22781. 1\.1\.2\.1
  22782. log
  22783. @modify-on-branch
  22784. @
  22785. text
  22786. @a0 1
  22787. add a line on the branch
  22788. @"
  22789. # Tests of cvs admin -n. Make use of the results of
  22790. # admin-1 through admin-25.
  22791. # FIXME: We probably shouldn't make use of those results;
  22792. # this test is way too long as it is.
  22793. # tagtwo should be a revision
  22794. #
  22795. dotest admin-26-1 "${testcvs} admin -ntagtwo:tagone file2" \
  22796. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22797. done"
  22798. # br1 should be a branch
  22799. #
  22800. dotest admin-26-2 "${testcvs} admin -nbr1:br file2" \
  22801. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22802. done"
  22803. # Attach some tags using RCS versions
  22804. #
  22805. dotest admin-26-3 "${testcvs} admin -ntagthree:1.1 file2" \
  22806. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22807. done"
  22808. dotest admin-26-4 "${testcvs} admin -nbr2:1.1.2 file2" \
  22809. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22810. done"
  22811. dotest admin-26-5 "${testcvs} admin -nbr4:1.1.0.2 file2" \
  22812. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22813. done"
  22814. # Check results so far
  22815. #
  22816. dotest admin-26-6 "${testcvs} status -v file2" \
  22817. "===================================================================
  22818. File: file2 Status: Up-to-date
  22819. Working revision: 1\.2.*
  22820. Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file2,v
  22821. Sticky Tag: (none)
  22822. Sticky Date: (none)
  22823. Sticky Options: (none)
  22824. Existing Tags:
  22825. br4 (branch: 1\.1\.2)
  22826. br2 (branch: 1\.1\.2)
  22827. tagthree (revision: 1\.1)
  22828. br1 (branch: 1\.1\.2)
  22829. tagtwo (revision: 1\.1)
  22830. tagone (revision: 1\.1)
  22831. br (branch: 1\.1\.2)"
  22832. # Add a couple more revisions
  22833. #
  22834. echo "nuthr_line" >> file2
  22835. dotest admin-27-1 "${testcvs} commit -m nuthr_line file2" \
  22836. "Checking in file2;
  22837. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22838. new revision: 1\.3; previous revision: 1\.2
  22839. done"
  22840. echo "yet_another" >> file2
  22841. dotest admin-27-2 "${testcvs} commit -m yet_another file2" \
  22842. "Checking in file2;
  22843. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  22844. new revision: 1\.4; previous revision: 1\.3
  22845. done"
  22846. # Fail trying to reattach existing tag with -n
  22847. #
  22848. dotest admin-27-3 "${testcvs} admin -ntagfour:1.1 file2" \
  22849. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22850. done"
  22851. dotest_fail admin-27-4 "${testcvs} admin -ntagfour:1.3 file2" \
  22852. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22853. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: symbolic name tagfour already bound to 1\.1
  22854. ${PROG} admin: RCS file for .file2. not modified\."
  22855. # Succeed at reattaching existing tag, using -N
  22856. #
  22857. dotest admin-27-5 "${testcvs} admin -Ntagfour:1.3 file2" \
  22858. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22859. done"
  22860. # Fail on some bogus operations
  22861. # Try to attach to nonexistant tag
  22862. #
  22863. dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \
  22864. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22865. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision tagfive is undefined\.
  22866. ${PROG} admin: RCS file for .file2. not modified\."
  22867. # Try a some nonexisting numeric target tags
  22868. #
  22869. dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2" \
  22870. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22871. ${PROG} \[admin aborted\]: revision .2\.1. does not exist"
  22872. dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2" \
  22873. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22874. ${PROG} \[admin aborted\]: revision .2\.1\.2. does not exist"
  22875. # Try some invalid targets
  22876. #
  22877. dotest_fail admin-28-4 "${testcvs} admin -ntagnine:1.a.2 file2" \
  22878. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22879. ${PROG} \[admin aborted\]: tag .1\.a\.2. must start with a letter"
  22880. # Confirm that a missing tag is not a fatal error.
  22881. dotest admin-28-5.1 "${testcvs} -Q tag BO+GUS file1" ''
  22882. dotest_fail admin-28-5.2 "${testcvs} admin -ntagten:BO+GUS file2 file1" \
  22883. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22884. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: Symbolic name or revision BO${PLUS}GUS is undefined\.
  22885. ${PROG} admin: RCS file for .file2. not modified\.
  22886. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22887. done"
  22888. dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2" \
  22889. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22890. ${PROG} \[admin aborted\]: tag .q\.werty. must not contain the characters ..*"
  22891. # Verify the archive
  22892. #
  22893. dotest admin-29 "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
  22894. "head 1\.4;
  22895. access
  22896. auth3
  22897. auth2
  22898. foo;
  22899. symbols
  22900. tagfour:1\.3
  22901. br4:1\.1\.0\.2
  22902. br2:1\.1\.0\.2
  22903. tagthree:1\.1
  22904. br1:1\.1\.0\.2
  22905. tagtwo:1\.1
  22906. tagone:1\.1
  22907. br:1\.1\.0\.2;
  22908. locks; strict;
  22909. comment @# @;
  22910. 1\.4
  22911. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
  22912. branches;
  22913. next 1\.3;
  22914. 1\.3
  22915. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
  22916. branches;
  22917. next 1\.2;
  22918. 1\.2
  22919. date [0-9][0-9]*\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
  22920. branches;
  22921. next ;
  22922. desc
  22923. @@
  22924. 1\.4
  22925. log
  22926. @yet_another
  22927. @
  22928. text
  22929. @add a line
  22930. nuthr_line
  22931. yet_another
  22932. @
  22933. 1\.3
  22934. log
  22935. @nuthr_line
  22936. @
  22937. text
  22938. @d3 1
  22939. @
  22940. 1\.2
  22941. log
  22942. @modify
  22943. @
  22944. text
  22945. @d2 1
  22946. @"
  22947. dotest_fail admin-30 "${testcvs} admin -mbr:another-log-message \
  22948. file2 aaa file3" \
  22949. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  22950. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision br: 1\.1
  22951. ${PROG} admin: RCS file for .file2. not modified.
  22952. RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22953. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: no such revision br
  22954. ${PROG} admin: RCS file for .aaa. not modified.
  22955. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  22956. done"
  22957. dotest admin-31 "${testcvs} log" \
  22958. "${PROG} log: Logging \.
  22959. RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
  22960. Working file: aaa
  22961. head: 1\.4
  22962. branch:
  22963. locks: strict
  22964. access list:
  22965. symbolic names:
  22966. br1: 1\.3\.0\.2
  22967. keyword substitution: kv
  22968. total revisions: 5; selected revisions: 5
  22969. description:
  22970. ----------------------------
  22971. revision 1\.4
  22972. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22973. fourth
  22974. ----------------------------
  22975. revision 1\.3
  22976. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22977. branches: 1\.3\.2;
  22978. third
  22979. ----------------------------
  22980. revision 1\.2
  22981. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  22982. second
  22983. ----------------------------
  22984. revision 1\.1
  22985. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  22986. first
  22987. ----------------------------
  22988. revision 1\.3\.2\.4
  22989. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}4 -0
  22990. branch-four
  22991. =============================================================================
  22992. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  22993. Working file: file1
  22994. head: 1\.1
  22995. branch:
  22996. locks: strict
  22997. access list:
  22998. foo
  22999. auth2
  23000. symbolic names:
  23001. tagten: 1\.1
  23002. BO${PLUS}GUS: 1\.1
  23003. keyword substitution: kv
  23004. total revisions: 2; selected revisions: 2
  23005. description:
  23006. ----------------------------
  23007. revision 1\.1
  23008. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  23009. branches: 1\.1\.2;
  23010. add
  23011. ----------------------------
  23012. revision 1\.1\.2\.1
  23013. date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
  23014. modify-on-branch
  23015. =============================================================================
  23016. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  23017. Working file: file2
  23018. head: 1\.4
  23019. branch:
  23020. locks: strict
  23021. access list:
  23022. auth3
  23023. auth2
  23024. foo
  23025. symbolic names:
  23026. tagfour: 1\.3
  23027. br4: 1\.1\.0\.2
  23028. br2: 1\.1\.0\.2
  23029. tagthree: 1\.1
  23030. br1: 1\.1\.0\.2
  23031. tagtwo: 1\.1
  23032. tagone: 1\.1
  23033. br: 1\.1\.0\.2
  23034. keyword substitution: kv
  23035. total revisions: 3; selected revisions: 3
  23036. description:
  23037. ----------------------------
  23038. revision 1\.4
  23039. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  23040. yet_another
  23041. ----------------------------
  23042. revision 1\.3
  23043. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  23044. nuthr_line
  23045. ----------------------------
  23046. revision 1\.2
  23047. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  23048. modify
  23049. =============================================================================
  23050. RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
  23051. Working file: file3
  23052. head: 1\.1
  23053. branch:
  23054. locks: strict
  23055. access list:
  23056. symbolic names:
  23057. br: 1\.1\.0\.2
  23058. keyword substitution: kv
  23059. total revisions: 2; selected revisions: 2
  23060. description:
  23061. ----------------------------
  23062. revision 1\.1
  23063. date: [0-9/]* [0-9:]*; author: ${username}; state: dead;
  23064. branches: 1\.1\.2;
  23065. file file3 was initially added on branch br\.
  23066. ----------------------------
  23067. revision 1\.1\.2\.1
  23068. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  23069. another-log-message
  23070. ============================================================================="
  23071. cd ../..
  23072. if $keep; then
  23073. echo Keeping ${TESTDIR} and exiting due to --keep
  23074. exit 0
  23075. fi
  23076. # clean up our after ourselves
  23077. rm -r 1
  23078. rm -rf ${CVSROOT_DIRNAME}/first-dir
  23079. ;;
  23080. reserved)
  23081. # Tests of reserved checkouts. Eventually this will test
  23082. # rcslock.pl (or equivalent) and all kinds of stuff. Right
  23083. # now it just does some very basic checks on cvs admin -u
  23084. # and cvs admin -l.
  23085. # Also should test locking on a branch (and making sure that
  23086. # locks from one branch don't get mixed up with those from
  23087. # another. Both the case where one of the branches is the
  23088. # main branch, and in which neither one is).
  23089. # See also test keyword, which tests that keywords and -kkvl
  23090. # do the right thing in the presence of locks.
  23091. # The usual setup, directory first-dir containing file file1.
  23092. mkdir 1; cd 1
  23093. dotest reserved-1 "${testcvs} -q co -l ." ''
  23094. mkdir first-dir
  23095. dotest reserved-2 "${testcvs} add first-dir" \
  23096. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  23097. cd first-dir
  23098. touch file1
  23099. dotest reserved-3 "${testcvs} add file1" \
  23100. "${PROG} add: scheduling file .file1. for addition
  23101. ${PROG} add: use .${PROG} commit. to add this file permanently"
  23102. dotest reserved-4 "${testcvs} -q ci -m add" \
  23103. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  23104. done
  23105. Checking in file1;
  23106. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  23107. initial revision: 1\.1
  23108. done"
  23109. dotest reserved-5 "${testcvs} -q admin -l file1" \
  23110. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  23111. 1\.1 locked
  23112. done"
  23113. dotest reserved-6 "${testcvs} log -N file1" "
  23114. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  23115. Working file: file1
  23116. head: 1\.1
  23117. branch:
  23118. locks: strict
  23119. ${username}: 1\.1
  23120. access list:
  23121. keyword substitution: kv
  23122. total revisions: 1; selected revisions: 1
  23123. description:
  23124. ----------------------------
  23125. revision 1\.1 locked by: ${username};
  23126. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  23127. add
  23128. ============================================================================="
  23129. # Note that this just tests the owner of the lock giving
  23130. # it up. It doesn't test breaking a lock.
  23131. dotest reserved-7 "${testcvs} -q admin -u file1" \
  23132. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  23133. 1\.1 unlocked
  23134. done"
  23135. dotest reserved-8 "${testcvs} log -N file1" "
  23136. RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  23137. Working file: file1
  23138. head: 1\.1
  23139. branch:
  23140. locks: strict
  23141. access list:
  23142. keyword substitution: kv
  23143. total revisions: 1; selected revisions: 1
  23144. description:
  23145. ----------------------------
  23146. revision 1\.1
  23147. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  23148. add
  23149. ============================================================================="
  23150. # rcslock.pl tests. Of course, the point isn't to test
  23151. # rcslock.pl from the distribution but equivalent
  23152. # functionality (for example, many sites may have an old
  23153. # rcslock.pl). The functionality of this hook falls
  23154. # short of the real rcslock.pl though.
  23155. # Note that we can use rlog or look at the RCS file directly,
  23156. # but we can't use "cvs log" because "cvs commit" has a lock.
  23157. cat >${TESTDIR}/lockme <<EOF
  23158. #!${TESTSHELL}
  23159. line=\`grep <\$1/\$2,v 'locks $anyusername:1\.[0-9];'\`
  23160. if test -z "\$line"; then
  23161. # It isn't locked
  23162. exit 0
  23163. else
  23164. user=\`echo \$line | sed -e 's/locks \\($anyusername\\):[0-9.]*;.*/\\1/'\`
  23165. version=\`echo \$line | sed -e 's/locks $anyusername:\\([0-9.]*\\);.*/\\1/'\`
  23166. echo "\$user has file a-lock locked for version \$version" >&2
  23167. exit 1
  23168. fi
  23169. EOF
  23170. # Cygwin. Blaaarg.
  23171. if test -n "$remotehost"; then
  23172. $CVS_RSH $remotehost "chmod +x ${TESTDIR}/lockme"
  23173. else
  23174. chmod +x ${TESTDIR}/lockme
  23175. fi
  23176. echo stuff > a-lock
  23177. dotest reserved-9 "${testcvs} add a-lock" \
  23178. "${PROG} add: scheduling file .a-lock. for addition
  23179. ${PROG} add: use .${PROG} commit. to add this file permanently"
  23180. dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
  23181. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23182. done
  23183. Checking in a-lock;
  23184. ${CVSROOT_DIRNAME}/first-dir/a-lock,v <-- a-lock
  23185. initial revision: 1\.1
  23186. done"
  23187. # FIXME: the contents of CVSROOT fluctuate a lot
  23188. # here. Maybe the expect pattern should just
  23189. # confirm that commitinfo is one of the files checked out,
  23190. # but for now we just check that CVS exited with success.
  23191. cd ..
  23192. if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
  23193. pass reserved-11
  23194. else
  23195. fail reserved-11
  23196. fi
  23197. cd CVSROOT
  23198. echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
  23199. dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
  23200. "Checking in commitinfo;
  23201. ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v <-- commitinfo
  23202. new revision: 1\.2; previous revision: 1\.1
  23203. done
  23204. ${PROG} commit: Rebuilding administrative file database"
  23205. cd ..; cd first-dir
  23206. # Simulate (approximately) what a-lock would look like
  23207. # if someone else had locked revision 1.1.
  23208. sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
  23209. # Cygwin.
  23210. if test -n "$remotehost"; then
  23211. $CVS_RSH $remotehost "chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
  23212. else
  23213. chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23214. fi
  23215. dotest reserved-13 "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
  23216. # Cygwin. Blah.
  23217. if test -n "$remotehost"; then
  23218. $CVS_RSH $remotehost "chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v"
  23219. else
  23220. chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23221. fi
  23222. echo more stuff >> a-lock
  23223. dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
  23224. "fred has file a-lock locked for version 1\.1
  23225. ${PROG} commit: Pre-commit check failed
  23226. ${PROG} \[commit aborted\]: correct above errors first!"
  23227. # OK, now test "cvs admin -l" in the case where someone
  23228. # else has the file locked.
  23229. dotest_fail reserved-13c "${testcvs} admin -l a-lock" \
  23230. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23231. ${PROG} \[admin aborted\]: Revision 1\.1 is already locked by fred"
  23232. dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
  23233. "RCS file: ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23234. ${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/a-lock,v: revision 1\.1 locked by fred; breaking lock
  23235. 1\.1 unlocked
  23236. done"
  23237. dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
  23238. "Checking in a-lock;
  23239. ${CVSROOT_DIRNAME}/first-dir/a-lock,v <-- a-lock
  23240. new revision: 1\.2; previous revision: 1\.1
  23241. done"
  23242. # Now test for a bug involving branches and locks
  23243. sed -e 's/locks; strict;/locks fred:1.2; strict;/' ${CVSROOT_DIRNAME}/first-dir/a-lock,v > a-lock,v
  23244. chmod 644 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23245. dotest reserved-16 \
  23246. "mv a-lock,v ${CVSROOT_DIRNAME}/first-dir/a-lock,v" ""
  23247. chmod 444 ${CVSROOT_DIRNAME}/first-dir/a-lock,v
  23248. dotest reserved-17 "${testcvs} -q tag -b br a-lock" "T a-lock"
  23249. dotest reserved-18 "$testcvs -q update -r br a-lock" '[UP] a-lock'
  23250. echo edit it >>a-lock
  23251. dotest reserved-19 "${testcvs} -q ci -m modify a-lock" \
  23252. "Checking in a-lock;
  23253. ${CVSROOT_DIRNAME}/first-dir/a-lock,v <-- a-lock
  23254. new revision: 1\.2\.2\.1; previous revision: 1\.2
  23255. done"
  23256. # undo commitinfo changes
  23257. cd ../CVSROOT
  23258. echo '# vanilla commitinfo' >commitinfo
  23259. dotest reserved-cleanup-1 "${testcvs} -q ci -m back commitinfo" \
  23260. "Checking in commitinfo;
  23261. ${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v <-- commitinfo
  23262. new revision: 1\.3; previous revision: 1\.2
  23263. done
  23264. ${PROG} commit: Rebuilding administrative file database"
  23265. cd ..; rm -r CVSROOT; cd first-dir
  23266. cd ../..
  23267. rm -r 1
  23268. rm ${TESTDIR}/lockme
  23269. rm -rf ${CVSROOT_DIRNAME}/first-dir
  23270. ;;
  23271. diffmerge1)
  23272. # Make sure CVS can merge correctly in circumstances where it
  23273. # used to mess up (due to a bug which existed in diffutils 2.7
  23274. # and 2.6, but not 2.5, and which has been fixed in CVS's diff
  23275. # lib by Paul Eggert, bless his bitty heart).
  23276. # This first test involves two working copies, "mine" and
  23277. # "yours", checked out from the same repository at the same
  23278. # time. In yours, you remove some text from the end of the
  23279. # file and check it in; meanwhile, "me" has commented out some
  23280. # lines earlier in the file, and I go to check it in right
  23281. # after you checked yours in. CVS naturally tells me the file
  23282. # is not up-to-date, so I run cvs update, but it updates
  23283. # incorrectly, leaving in the lines of text you just deleted.
  23284. # Bad! I'm in too much of a hurry to actually look at the
  23285. # file, so I check it in and go home, and so your changes have
  23286. # been lost. Later you discover this, and you suspect me of
  23287. # deliberately sabotaging your work, so you let all the air
  23288. # out of my tires. Only after a series of expensive lawsuits
  23289. # and countersuits do we discover that this was all CVS's
  23290. # fault.
  23291. #
  23292. # Luckily, this problem has been fixed now, as our test will
  23293. # handily confirm, no doubt:
  23294. # First make a repository containing the original text:
  23295. # We should be here anyway, but cd to it just in case:
  23296. cd ${TESTDIR}
  23297. mkdir diffmerge1
  23298. cd diffmerge1
  23299. # These are the files we both start out with:
  23300. mkdir import
  23301. cd import
  23302. diffmerge_create_older_files
  23303. dotest diffmerge1_import \
  23304. "${testcvs} import -m import diffmerge1 tag1 tag2" \
  23305. "${DOTSTAR}No conflicts created by this import"
  23306. cd ..
  23307. # Check out two working copies, one for "you" and one for
  23308. # "me". If no branch is used and cvs detects that only one
  23309. # of the two people made changes, then cvs does not run the
  23310. # merge algorithm. But if a branch is used, then cvs does run
  23311. # the merge algorithm (even in this case of only one of the two
  23312. # people having made changes). CVS used to have a bug in this
  23313. # case. Therefore, it is important to test this case by
  23314. # using a branch:
  23315. ${testcvs} rtag -b tag diffmerge1 >/dev/null 2>&1
  23316. ${testcvs} checkout -r tag diffmerge1 >/dev/null 2>&1
  23317. mv diffmerge1 yours
  23318. ${testcvs} checkout diffmerge1 >/dev/null 2>&1
  23319. mv diffmerge1 mine
  23320. # In your working copy, you'll make changes, and
  23321. # then check in your changes before I check in mine:
  23322. cd yours
  23323. diffmerge_create_your_files
  23324. dotest diffmerge1_yours "${testcvs} -q ci -m yours" \
  23325. "Checking in testcase01;
  23326. ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v <-- testcase01
  23327. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23328. done
  23329. Checking in testcase02;
  23330. ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v <-- testcase02
  23331. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23332. done
  23333. Checking in testcase03;
  23334. ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v <-- testcase03
  23335. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23336. done
  23337. Checking in testcase04;
  23338. ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v <-- testcase04
  23339. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23340. done
  23341. Checking in testcase05;
  23342. ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v <-- testcase05
  23343. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23344. done
  23345. Checking in testcase06;
  23346. ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v <-- testcase06
  23347. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23348. done
  23349. Checking in testcase07;
  23350. ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v <-- testcase07
  23351. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23352. done
  23353. Checking in testcase08;
  23354. ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v <-- testcase08
  23355. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23356. done
  23357. Checking in testcase09;
  23358. ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v <-- testcase09
  23359. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23360. done
  23361. Checking in testcase10;
  23362. ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v <-- testcase10
  23363. new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1
  23364. done"
  23365. # Change my copy. Then I
  23366. # update, after both my modifications and your checkin:
  23367. cd ../mine
  23368. diffmerge_create_my_files
  23369. dotest diffmerge1_mine "${testcvs} -q update -j tag" \
  23370. "M testcase01
  23371. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase01,v
  23372. retrieving revision 1\.1\.1\.1
  23373. retrieving revision 1\.1\.1\.1\.2\.1
  23374. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase01
  23375. M testcase02
  23376. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase02,v
  23377. retrieving revision 1\.1\.1\.1
  23378. retrieving revision 1\.1\.1\.1\.2\.1
  23379. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase02
  23380. M testcase03
  23381. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase03,v
  23382. retrieving revision 1\.1\.1\.1
  23383. retrieving revision 1\.1\.1\.1\.2\.1
  23384. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase03
  23385. M testcase04
  23386. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase04,v
  23387. retrieving revision 1\.1\.1\.1
  23388. retrieving revision 1\.1\.1\.1\.2\.1
  23389. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase04
  23390. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase05,v
  23391. retrieving revision 1\.1\.1\.1
  23392. retrieving revision 1\.1\.1\.1\.2\.1
  23393. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase05
  23394. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase06,v
  23395. retrieving revision 1\.1\.1\.1
  23396. retrieving revision 1\.1\.1\.1\.2\.1
  23397. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase06
  23398. M testcase07
  23399. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase07,v
  23400. retrieving revision 1\.1\.1\.1
  23401. retrieving revision 1\.1\.1\.1\.2\.1
  23402. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase07
  23403. testcase07 already contains the differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1
  23404. M testcase08
  23405. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
  23406. retrieving revision 1\.1\.1\.1
  23407. retrieving revision 1\.1\.1\.1\.2\.1
  23408. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase08
  23409. M testcase09
  23410. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase09,v
  23411. retrieving revision 1\.1\.1\.1
  23412. retrieving revision 1\.1\.1\.1\.2\.1
  23413. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase09
  23414. M testcase10
  23415. RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase10,v
  23416. retrieving revision 1\.1\.1\.1
  23417. retrieving revision 1\.1\.1\.1\.2\.1
  23418. Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into testcase10"
  23419. # So if your changes didn't make it into my working copy, or
  23420. # in any case if the files do not look like the final text
  23421. # in the files in directory comp_me, then the test flunks:
  23422. cd ..
  23423. mkdir comp_me
  23424. cd comp_me
  23425. diffmerge_create_expected_files
  23426. cd ..
  23427. rm mine/.#*
  23428. # If you have GNU's version of diff, you may try
  23429. # uncommenting the following line which will give more
  23430. # fine-grained information about how cvs differed from the
  23431. # correct result:
  23432. #dotest diffmerge1_cmp "diff -u --recursive --exclude=CVS comp_me mine" ''
  23433. dotest diffmerge1_cmp "directory_cmp comp_me mine"
  23434. # Clean up after ourselves:
  23435. cd ..
  23436. if $keep; then :; else
  23437. rm -rf diffmerge1 ${CVSROOT_DIRNAME}/diffmerge1
  23438. fi
  23439. ;;
  23440. diffmerge2)
  23441. # FIXME: This test should be rewritten to be much more concise.
  23442. # It currently weighs in at something like 600 lines, but the
  23443. # same thing could probably be tested in more like 50-100 lines.
  23444. mkdir diffmerge2
  23445. # This tests for another diffmerge bug reported by Martin
  23446. # Tomes; actually, his bug was probably caused by an initial
  23447. # fix for the bug in test diffmerge1, and likely wasn't ever
  23448. # a problem in CVS as long as one was using a normal
  23449. # distribution of diff or a version of CVS that has the diff
  23450. # lib in it.
  23451. #
  23452. # Nevertheless, once burned twice cautious, so we test for his
  23453. # bug here.
  23454. #
  23455. # Here is his report, more or less verbatim:
  23456. # ------------------------------------------
  23457. #
  23458. # Put the attached file (sgrid.h,v) into your repository
  23459. # somewhere, check out the module and do this:
  23460. #
  23461. # cvs update -j Review_Phase_2_Enhancements sgrid.h
  23462. # cvs diff -r Review_V1p3 sgrid.h
  23463. #
  23464. # As there have been no changes made on the trunk there
  23465. # should be no differences, however this is output:
  23466. #
  23467. # % cvs diff -r Review_V1p3 sgrid.h
  23468. # Index: sgrid.h
  23469. # ===================================================================
  23470. # RCS file: /usr/local/repository/play/fred/sgrid.h,v
  23471. # retrieving revision 1.1.2.1
  23472. # diff -r1.1.2.1 sgrid.h
  23473. # 178a179,184
  23474. # > /*--------------------------------------------------------------
  23475. # > INLINE FUNCTION : HORIZONTALLINES
  23476. # > NOTES : Description at the end of the file
  23477. # > ----------------------------------------------------------------*/
  23478. # > uint16 horizontalLines( void );
  23479. # >
  23480. #
  23481. # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
  23482. # differences to sgrid.h version 1.1 and got the correct result
  23483. # so it looks like the built in patch is faulty.
  23484. # -------------------------------------------------------------------
  23485. #
  23486. # This is the RCS file, sgrid.h,v, that he sent:
  23487. echo "head 1.1;
  23488. access;
  23489. symbols
  23490. Review_V1p3:1.1.2.1
  23491. Review_V1p3C:1.1.2.1
  23492. Review_1p3A:1.1.2.1
  23493. Review_V1p3A:1.1.2.1
  23494. Review_Phase_2_Enhancements:1.1.0.2
  23495. Review_V1p2:1.1
  23496. Review_V1p2B:1.1
  23497. Review_V1p2A:1.1
  23498. Review_V1p1:1.1
  23499. Review_1p1:1.1;
  23500. locks; strict;
  23501. comment @ * @;
  23502. 1.1
  23503. date 97.04.02.11.20.05; author colinl; state Exp;
  23504. branches
  23505. 1.1.2.1;
  23506. next ;
  23507. 1.1.2.1
  23508. date 97.06.09.10.00.07; author colinl; state Exp;
  23509. branches;
  23510. next ;
  23511. desc
  23512. @@
  23513. 1.1
  23514. log
  23515. @Project: DEV1175
  23516. DCN:
  23517. Tested By: Colin Law
  23518. Reviewed By:
  23519. Reason for Change: Initial Revision of all files
  23520. Design Change Details:
  23521. Implications:
  23522. @
  23523. text
  23524. @/* \$""Header: L:/gpanels/dis/sgrid.h_v 1.1.1.0 24 Jan 1996 14:59:20 PAULT \$ */
  23525. /*
  23526. * \$""Log: L:/gpanels/dis/sgrid.h_v \$
  23527. *
  23528. * Rev 1.1.1.0 24 Jan 1996 14:59:20 PAULT
  23529. * Branched
  23530. *
  23531. * Rev 1.1 24 Jan 1996 12:09:52 PAULT
  23532. * Consolidated 4100 code merged to trunk
  23533. *
  23534. * Rev 1.0.2.0 01 Jun 1995 14:18:58 DAVEH
  23535. * Branched
  23536. *
  23537. * Rev 1.0 19 Apr 1995 16:32:48 COLINL
  23538. * Initial revision.
  23539. */
  23540. /*****************************************************************************
  23541. FILE : SGRID.H
  23542. VERSION : 2.1
  23543. AUTHOR : Dave Hartley
  23544. SYSTEM : Borland C++
  23545. DESCRIPTION : The declaration of the scrolling grid class
  23546. *****************************************************************************/
  23547. #if !defined(__SGRID_H)
  23548. #define __SGRID_H
  23549. #if !defined(__SCROLL_H)
  23550. #include <scroll.h>
  23551. #endif
  23552. #if !defined(__GKI_H)
  23553. #include \"gki.h\"
  23554. #endif
  23555. #if defined PRINTING_SUPPORT
  23556. class Printer;
  23557. #endif
  23558. /*****************************************************************************
  23559. CLASS : ScrollingGrid
  23560. DESCRIPTION: This class inherits from a grid and a scrollable, and
  23561. can therefore use all the PUBLIC services provided by these
  23562. classes. A description of these can be found in
  23563. GRID.H and SCROLL.H.
  23564. A scrolling grid is a set of horizontal and vertical lines
  23565. that scroll and continually update to provide a complete grid
  23566. *****************************************************************************/
  23567. class ScrollingGrid : public Scrollable
  23568. {
  23569. public:
  23570. #if defined _WINDOWS
  23571. /*---------------------------------------------------------------------------
  23572. FUNCTION : CONSTRUCTOR
  23573. DESCRIPTION : sets up the details of the grid, ready for painting
  23574. ARGUMENTS : name : sgColour
  23575. - the colour of the grid
  23576. sgLineType
  23577. - the syle of line
  23578. sgHorizontalTotal
  23579. - the total number of horizontal grid lines
  23580. verticalSpacingMin
  23581. - the min distance between the vertical grid lines
  23582. on the scrolling axis
  23583. currentTimestamp
  23584. - timestamp value now
  23585. ticksPerSecond
  23586. - number of timestamp ticks per second
  23587. ticksPerPixel
  23588. - number of timestamp ticks per pixel required
  23589. RETURN : None
  23590. NOTES :
  23591. ---------------------------------------------------------------------------*/
  23592. ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType,
  23593. uint16 sgHorizontalTotal,
  23594. uint16 verticalSpacingMin, uint32 currentTimestamp,
  23595. uint16 ticksPerSecond, uint32 ticksPerPixel );
  23596. #else
  23597. /*---------------------------------------------------------------------------
  23598. FUNCTION : CONSTRUCTOR
  23599. DESCRIPTION : sets up the details of the grid, ready for painting
  23600. ARGUMENTS : name : sgColour
  23601. - the colour of the grid
  23602. sgLineType
  23603. - the syle of line
  23604. sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
  23605. - the total number of horizontal grid lines
  23606. sgVerticalSpacing
  23607. - the distance between the vertical grid lines
  23608. on the scrolling axis
  23609. RETURN : None
  23610. NOTES : If the caller does not get the total grid lines value, synced
  23611. with the overall size of the viewport, the spacing between
  23612. grid lines will not be consistent.
  23613. ---------------------------------------------------------------------------*/
  23614. ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
  23615. , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
  23616. #endif
  23617. /*---------------------------------------------------------------------------
  23618. FUNCTION : DESTRUCTOR
  23619. DESCRIPTION : tidies it all up
  23620. ARGUMENTS : name :
  23621. RETURN : None
  23622. NOTES :
  23623. ---------------------------------------------------------------------------*/
  23624. ~ScrollingGrid( void );
  23625. /*---------------------------------------------------------------------------
  23626. FUNCTION : ATTACH
  23627. DESCRIPTION : This service overloads the base class service, as it does
  23628. additional work at the time of attachment.
  23629. ARGUMENTS : name : tDrawingArea
  23630. - the scrolled viewport to attach this trend to
  23631. RETURN : None
  23632. NOTES :
  23633. ---------------------------------------------------------------------------*/
  23634. void attach( SViewport *tDrawingArea );
  23635. #if defined _WINDOWS
  23636. /*---------------------------------------------------------------------------
  23637. FUNCTION : calculateVerticalSpacing
  23638. DESCRIPTION : determines optimum spacing along time axis
  23639. ARGUMENTS :
  23640. RETURN : None
  23641. NOTES :
  23642. ---------------------------------------------------------------------------*/
  23643. void calculateVerticalSpacing();
  23644. /*---------------------------------------------------------------------------
  23645. FUNCTION : gridSpacingTicks
  23646. DESCRIPTION : Provides the grid spacing in the time axis in ticks
  23647. ARGUMENTS :
  23648. RETURN : Number of ticks
  23649. NOTES :
  23650. ---------------------------------------------------------------------------*/
  23651. uint32 gridSpacingTicks();
  23652. #endif
  23653. /*---------------------------------------------------------------------------
  23654. INLINE FUNCTION : HORIZONTALLINES
  23655. NOTES : Description at the end of the file
  23656. ---------------------------------------------------------------------------*/
  23657. uint16 horizontalLines( void );
  23658. #if defined _WINDOWS
  23659. // In Windows the OnDraw() function replaces paint()
  23660. /*---------------------------------------------------------------------------
  23661. FUNCTION : ScrollingGrid OnDraw
  23662. DESCRIPTION : Paints the given area of the grid.
  23663. Pure virtual
  23664. ARGUMENTS : pDC pointer to the device context to use for display
  23665. Note that the device context operates in the coords
  23666. of the window owning the viewport
  23667. RETURN : None
  23668. NOTES :
  23669. ---------------------------------------------------------------------------*/
  23670. virtual void OnDraw( CDC *pDC );
  23671. #else // not Windows
  23672. /*---------------------------------------------------------------------------
  23673. FUNCTION : PAINT
  23674. DESCRIPTION : This extends the standard grid paint method to paint the
  23675. viewport relative to its current position.
  23676. ARGUMENTS : name :
  23677. RETURN : None
  23678. NOTES :
  23679. ---------------------------------------------------------------------------*/
  23680. void paint( void );
  23681. #endif
  23682. /*---------------------------------------------------------------------------
  23683. FUNCTION : P A I N T T E X T M A R K E R S
  23684. DESCRIPTION : this service allow the text markers to be painted seperatley
  23685. from the grid lines
  23686. ARGUMENTS : name :
  23687. RETURN : None
  23688. NOTES :
  23689. ---------------------------------------------------------------------------*/
  23690. void paintTextMarkers();
  23691. #if defined PRINTING_SUPPORT
  23692. /*---------------------------------------------------------------------------
  23693. FUNCTION : P R I N T
  23694. DESCRIPTION : This print service prints a grid marker ( being either a
  23695. timestamp or a date, IF there is one at the plot position
  23696. given
  23697. ARGUMENTS : name :
  23698. displayPosition
  23699. - Where in the log to look to see if there is an
  23700. entry to print
  23701. - printerPtr
  23702. the printer to print to
  23703. RETURN : None
  23704. NOTES :
  23705. ---------------------------------------------------------------------------*/
  23706. void print( uint16 currentPrintPos, Printer *printerPtr );
  23707. #endif
  23708. /*---------------------------------------------------------------------------
  23709. FUNCTION : S E T D R I V E D I R E C T I O N
  23710. DESCRIPTION : Sets direction for update and scrolling forwards or backwards
  23711. ARGUMENTS : direction - required direction
  23712. RETURN : None
  23713. NOTES :
  23714. ---------------------------------------------------------------------------*/
  23715. void setDriveDirection( ScrollDirection direction );
  23716. /*---------------------------------------------------------------------------
  23717. FUNCTION : S E T U P
  23718. DESCRIPTION : service that will setup the grid prior to a paint
  23719. ARGUMENTS : name :
  23720. - newTimestamp
  23721. - newTimeBase
  23722. the number of ticks that represent a plot point on
  23723. the trendgraph.
  23724. RETURN : None
  23725. NOTES :
  23726. ---------------------------------------------------------------------------*/
  23727. void setup( uint32 newTimestamp, uint32 newTimeBase );
  23728. #if defined PRINTING_SUPPORT
  23729. /*---------------------------------------------------------------------------
  23730. FUNCTION : S E T U P F O R P R I N T
  23731. DESCRIPTION : This service iis to be called prior to printing. It allows
  23732. the grid to prepare its markers ready for the print
  23733. commands
  23734. ARGUMENTS : name :
  23735. RETURN : None
  23736. NOTES :
  23737. ---------------------------------------------------------------------------*/
  23738. void setupForPrint();
  23739. #endif
  23740. /*---------------------------------------------------------------------------
  23741. FUNCTION : UPDATE
  23742. DESCRIPTION : When this service is called it will calculate what needs to
  23743. be painted and fill in the display again.
  23744. ARGUMENTS : name : timeStamp
  23745. - the reference time of this update.
  23746. RETURN : None
  23747. NOTES :
  23748. ---------------------------------------------------------------------------*/
  23749. void update( uint32 timeStamp );
  23750. /*---------------------------------------------------------------------------
  23751. FUNCTION : U P D A T E B U F F E R
  23752. DESCRIPTION : When a display update is not required, use this method. It
  23753. updates the internal data ready for a call to paint that
  23754. will then show the grid in the right position
  23755. ARGUMENTS : name :
  23756. RETURN : None
  23757. NOTES :
  23758. ---------------------------------------------------------------------------*/
  23759. void updateBuffer( void );
  23760. private:
  23761. /*---------------------------------------------------------------------------
  23762. FUNCTION : M A K E G R I D M A R K E R
  23763. DESCRIPTION : service that perpares a string for display. The string will
  23764. either be a short date, or short time. this is determined
  23765. by the current setting of the dateMarker flag
  23766. ARGUMENTS : name : timestampVal
  23767. - the value to convert
  23768. storePtr
  23769. - the place to put the string
  23770. RETURN : None
  23771. NOTES :
  23772. ---------------------------------------------------------------------------*/
  23773. void makeGridMarker( uint32 timestampVal, char *storePtr );
  23774. /*---------------------------------------------------------------------------
  23775. FUNCTION : P A I N T G R I D M A R K E R
  23776. DESCRIPTION : given a position will put the string on the display
  23777. ARGUMENTS : name :
  23778. yPos
  23779. - were it goes on the Y-axis
  23780. gridMarkerPtr
  23781. - what it is
  23782. RETURN : None
  23783. NOTES :
  23784. ---------------------------------------------------------------------------*/
  23785. void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
  23786. #if defined _WINDOWS
  23787. /*---------------------------------------------------------------------------
  23788. FUNCTION : PAINTHORIZONTALLINES
  23789. DESCRIPTION : responsible for painting the grids horizontal lines
  23790. ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing.
  23791. in viewport coords
  23792. pDC pointer to device context to use
  23793. RETURN : None
  23794. NOTES :
  23795. ---------------------------------------------------------------------------*/
  23796. void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
  23797. #else
  23798. /*---------------------------------------------------------------------------
  23799. FUNCTION : PAINTHORIZONTALLINES
  23800. DESCRIPTION : responsible for painting the grids horizontal lines
  23801. ARGUMENTS : name: xStart
  23802. - the starting X co-ordinate for the horizontal line
  23803. xEnd
  23804. - the ending X co-ordinate for the horizontal line
  23805. RETURN : None
  23806. NOTES : Remember lines are drawn from origin. The origin in a
  23807. horizontal viewport will be the top.
  23808. ---------------------------------------------------------------------------*/
  23809. void paintHorizontalLines( uint16 xStart, uint16 xEnd );
  23810. #endif
  23811. #if defined _WINDOWS
  23812. /*---------------------------------------------------------------------------
  23813. FUNCTION : PAINTVERTICALLINES
  23814. DESCRIPTION : responsible for painting the grids vertical lines
  23815. ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing.
  23816. in viewport coords
  23817. offset offset from rhs that rightmost line would be
  23818. drawn if rectangle included whole viewport
  23819. pDC pointer to device context to use
  23820. RETURN : None
  23821. NOTES :
  23822. ---------------------------------------------------------------------------*/
  23823. void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
  23824. CDC* pDC );
  23825. #else
  23826. /*---------------------------------------------------------------------------
  23827. FUNCTION : PAINTVERTICALLINES
  23828. DESCRIPTION : responsible for painting the grids vertical lines
  23829. ARGUMENTS : name : yStart
  23830. - the starting Y co-ordinate for the vertical line
  23831. yEnd
  23832. - the ending Y co-ordinate for the vertical line
  23833. offset
  23834. - a starting point offset that determines at what X
  23835. position the first line will be drawn
  23836. RETURN : None
  23837. NOTES :
  23838. ---------------------------------------------------------------------------*/
  23839. void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
  23840. #endif
  23841. #if defined _WINDOWS
  23842. /*---------------------------------------------------------------------------
  23843. FUNCTION : PAINTVERTICALLINE
  23844. DESCRIPTION : paints one line at the position specified, and length
  23845. ARGUMENTS : name : yStart
  23846. - the starting point on the y axis for the line
  23847. yEnd
  23848. - the end point on the y axis for the line
  23849. xPosition
  23850. - The horizontal offset from the start of the viewport
  23851. pDC pointer to device context to use
  23852. RETURN : None
  23853. NOTES : There is not an equivalent horizontal method as yet. This
  23854. is a seperate method because the service is useful to a
  23855. derivation of this class
  23856. ---------------------------------------------------------------------------*/
  23857. void paintVerticalLine( uint16 yStart, uint16 yEnd
  23858. , uint16 xPosition, CDC *pDC );
  23859. #else
  23860. /*---------------------------------------------------------------------------
  23861. FUNCTION : PAINTVERTICALLINE
  23862. DESCRIPTION : paints one line at the position specified, and length
  23863. ARGUMENTS : name : yStart
  23864. - the starting point on the y axis for the line
  23865. yEnd
  23866. - the end point on the y axis for the line
  23867. xPosition
  23868. - The horizontal offset from the start of the viewport
  23869. RETURN : None
  23870. NOTES : There is not an equivalent horizontal method as yet. This
  23871. is a seperate method because the service is useful to a
  23872. derivation of this class
  23873. ---------------------------------------------------------------------------*/
  23874. void paintVerticalLine( uint16 yStart, uint16 yEnd
  23875. , uint16 xPosition );
  23876. #endif
  23877. /*---------------------------------------------------------------------------
  23878. INLINE FUNCTION : VERTICALSPACING
  23879. NOTES : Description at the end of the file
  23880. ---------------------------------------------------------------------------*/
  23881. uint16 verticalSpacing( void );
  23882. // Position in viewport that we are now writing to if going forwards
  23883. // Note that if this is greater than viewport length then we have
  23884. // just scrolled and value must be adjusted before use.
  23885. sint16 forwardsOutputPosition;
  23886. // Position in viewport that we are now writing to if going backwards
  23887. // Note that if this is less than zero then we have
  23888. // just scrolled and value must be adjusted before use.
  23889. sint16 backwardsOutputPosition;
  23890. // position in grid cycle of forwards output position.
  23891. // if zero then it is time to output a grid line
  23892. sint16 forwardsIntervalCount;
  23893. // position in grid cycle of forwards output position.
  23894. // if zero then it is time to output a grid line
  23895. sint16 backwardsIntervalCount;
  23896. uint32 lastUpdateTimestamp;
  23897. uint32 timeBase; // ticks per pixel
  23898. uint16 currentOutputPosition;
  23899. uint16 gridTimestampSpacing;
  23900. uint16 intervalCount;
  23901. uint16 horizontalTotal;
  23902. uint16 vSpacing;
  23903. #if defined PRINTING_SUPPORT
  23904. uint16 numberOfGridMarkersPrinted;
  23905. #endif
  23906. bool firstTime; // indicates first time through
  23907. bool dateMarker;
  23908. GkiLineType lineType;
  23909. GkiColour gridColour;
  23910. #if defined _WINDOWS
  23911. uint16 ticksPerSec; // number of time ticks per second
  23912. uint16 vSpacingMin; // minimum pixels per division along time axis
  23913. CPen *pPen; // the pen to use for drawing in windows
  23914. #endif
  23915. };
  23916. /*****************************************************************************
  23917. I N L I N E F U N C T I O N S
  23918. *****************************************************************************/
  23919. /*---------------------------------------------------------------------------
  23920. FUNCTION : HORIZONTALLINES
  23921. DESCRIPTION : supplies the number of horizontal lines in the grid
  23922. ARGUMENTS : name :
  23923. RETURN :
  23924. NOTES :
  23925. ---------------------------------------------------------------------------*/
  23926. inline uint16 ScrollingGrid::horizontalLines( void )
  23927. {
  23928. return( horizontalTotal );
  23929. }
  23930. /*---------------------------------------------------------------------------
  23931. FUNCTION : VERTICALSPACING
  23932. DESCRIPTION : returns the distance between adjacent vertical lines
  23933. ARGUMENTS : name :
  23934. RETURN : None
  23935. NOTES :
  23936. ---------------------------------------------------------------------------*/
  23937. inline uint16 ScrollingGrid::verticalSpacing( void )
  23938. {
  23939. return( vSpacing );
  23940. }
  23941. #endif
  23942. @
  23943. 1.1.2.1
  23944. log
  23945. @DEV1194:DS4 Provision of major and minor grid lines
  23946. @
  23947. text
  23948. @d1 1
  23949. a1 1
  23950. /* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
  23951. d3 1
  23952. a3 12
  23953. * \$""Log: sgrid.h,v \$
  23954. * Revision 1.1 1997/04/02 11:20:05 colinl
  23955. * Project: DEV1175
  23956. * DCN:
  23957. * Tested By: Colin Law
  23958. * Reviewed By:
  23959. * Reason for Change: Initial Revision of all files
  23960. *
  23961. * Design Change Details:
  23962. *
  23963. * Implications:
  23964. *
  23965. d58 6
  23966. a63 5
  23967. ARGUMENTS : name : majorColour colour for major grid lines
  23968. minorColour colour for minor grid lines
  23969. sgLineType line type for minor grid lines
  23970. yMajorGridLines number of major y lines on grid
  23971. yMinorGridLines number of major y lines on grid
  23972. d77 2
  23973. a78 3
  23974. ScrollingGrid( GkiColour majorColour, GkiColour minorColour,
  23975. GkiLineType sgLineType,
  23976. uint16 yMajorGridLines, uint16 yMinorGridLines,
  23977. a137 17
  23978. FUNCTION : DrawHorizontalGridLines
  23979. DESCRIPTION : Draws major or minor grid lines
  23980. ARGUMENTS : pDC device context
  23981. pPen pen to use
  23982. numLines total lines required
  23983. yLow, yHigh, xLow, xHigh rectangle to draw in
  23984. yMax max y value
  23985. RETURN : None
  23986. NOTES :
  23987. ---------------------------------------------------------------------------*/
  23988. void DrawHorizontalGridLines( CDC* pDC, CPen* pPen,
  23989. uint16 numLines,
  23990. uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh,
  23991. uint16 yMax );
  23992. /*---------------------------------------------------------------------------
  23993. d148 6
  23994. d448 1
  23995. a448 2
  23996. uint16 m_yMajorGridLines;
  23997. uint16 m_yMinorGridLines;
  23998. d456 2
  23999. a457 3
  24000. GkiLineType lineType; // line type for minor grid lines
  24001. GkiColour m_majorColour;
  24002. GkiColour m_minorColour;
  24003. d462 1
  24004. a462 2
  24005. CPen *pMajorPen; // pen to use for drawing major grid lines
  24006. CPen *pMinorPen; // pen to use for drawing minor grid lines
  24007. d472 12
  24008. @" > diffmerge2/sgrid.h,v
  24009. # We have to put the RCS file in the repository by hand for
  24010. # this test:
  24011. mkdir ${CVSROOT_DIRNAME}/diffmerge2
  24012. cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
  24013. rm -rf diffmerge2
  24014. dotest diffmerge2_co \
  24015. "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
  24016. cd diffmerge2
  24017. dotest diffmerge2_update \
  24018. "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
  24019. "${DOTSTAR}erging ${DOTSTAR}"
  24020. # This is the one that counts -- there should be no output:
  24021. dotest diffmerge2_diff \
  24022. "${testcvs} diff -r Review_V1p3 sgrid.h" ''
  24023. cd ..
  24024. rm -rf diffmerge2
  24025. rm -rf ${CVSROOT_DIRNAME}/diffmerge2
  24026. ;;
  24027. release)
  24028. # Tests of "cvs release", particularly multiple arguments.
  24029. # Other CVS release tests:
  24030. # info-cleanup-0 for "cvs -n release".
  24031. # ignore-193 for the text of the question that cvs release asks.
  24032. # Also for interactions with cvsignore.
  24033. # basicc: "-d .", global -Q, no arguments (is a noop),
  24034. # "cvs release" without -d, multiple arguments.
  24035. # dirs-4: repository directory has been deleted.
  24036. # modules2-6: multiple arguments.
  24037. # First the usual setup; create a directory first-dir.
  24038. mkdir 1; cd 1
  24039. dotest release-1 "${testcvs} -q co -l ." ''
  24040. mkdir first-dir
  24041. dotest release-2 "${testcvs} add first-dir" \
  24042. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  24043. cd first-dir
  24044. mkdir dir1
  24045. dotest release-3 "${testcvs} add dir1" \
  24046. "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
  24047. mkdir dir2
  24048. dotest release-4 "${testcvs} add dir2" \
  24049. "Directory ${CVSROOT_DIRNAME}/first-dir/dir2 added to the repository"
  24050. cd dir2
  24051. mkdir dir3
  24052. dotest release-5 "${testcvs} add dir3" \
  24053. "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
  24054. cd ../..
  24055. dotest release-6 "${testcvs} release -d first-dir/dir2/dir3 first-dir/dir1" \
  24056. "You have .0. altered files in this repository.
  24057. Are you sure you want to release (and delete) directory .first-dir/dir2/dir3.: \
  24058. You have .0. altered files in this repository.
  24059. Are you sure you want to release (and delete) directory .first-dir/dir1.: " <<EOF
  24060. yes
  24061. yes
  24062. EOF
  24063. dotest_fail release-7 "test -d first-dir/dir1" ''
  24064. dotest_fail release-8 "test -d first-dir/dir2/dir3" ''
  24065. dotest release-9 "${testcvs} update" \
  24066. "${PROG} update: Updating \.
  24067. ${PROG} update: Updating first-dir
  24068. ${PROG} update: Updating first-dir/dir2"
  24069. cd first-dir
  24070. mkdir dir1
  24071. dotest release-10 "${testcvs} add dir1" \
  24072. "Directory ${CVSROOT_DIRNAME}/first-dir/dir1 added to the repository"
  24073. cd dir2
  24074. mkdir dir3
  24075. dotest release-11 "${testcvs} add dir3" \
  24076. "Directory ${CVSROOT_DIRNAME}/first-dir/dir2/dir3 added to the repository"
  24077. cd ../..
  24078. dotest release-12 "${testcvs} release first-dir/dir2/dir3 first-dir/dir1" \
  24079. "You have .0. altered files in this repository.
  24080. Are you sure you want to release directory .first-dir/dir2/dir3.: .. .release. aborted by user choice.
  24081. You have .0. altered files in this repository.
  24082. Are you sure you want to release directory .first-dir/dir1.: " <<EOF
  24083. no
  24084. yes
  24085. EOF
  24086. dotest release-13 "${testcvs} release first-dir/dir2/dir3 first-dir/dir2" \
  24087. "You have .0. altered files in this repository.
  24088. Are you sure you want to release directory .first-dir/dir2/dir3.: \
  24089. You have .0. altered files in this repository.
  24090. Are you sure you want to release directory .first-dir/dir2.: " <<EOF
  24091. yes
  24092. yes
  24093. EOF
  24094. dotest release-14 "test -d first-dir/dir1" ''
  24095. dotest release-15 "test -d first-dir/dir2/dir3" ''
  24096. rm -rf first-dir/dir1 first-dir/dir2
  24097. dotest release-16 "${testcvs} update" \
  24098. "${PROG} update: Updating \.
  24099. ${PROG} update: Updating first-dir"
  24100. # Check to make sure release isn't overwriting a
  24101. # CVS/Entries file in the current directory (using data
  24102. # from the released directory).
  24103. # cvs 1.11 (remote) fails on release-21 (a message about
  24104. # chdir into the removed directory), although it seemingly
  24105. # unedits and removes the directory correctly. If
  24106. # you manually continue, it then fails on release-22 do
  24107. # to the messed up CVS/Entries file from release-21.
  24108. cd first-dir
  24109. mkdir second-dir
  24110. dotest release-18 "$testcvs add second-dir" \
  24111. "Directory $CVSROOT_DIRNAME/first-dir/second-dir added to the repository"
  24112. cd second-dir
  24113. touch file1
  24114. dotest release-19 "$testcvs -Q add file1"
  24115. dotest release-20 '$testcvs -q ci -m add' \
  24116. "RCS file: $CVSROOT_DIRNAME/first-dir/second-dir/file1,v
  24117. done
  24118. Checking in file1;
  24119. $CVSROOT_DIRNAME/first-dir/second-dir/file1,v <-- file1
  24120. initial revision: 1\.1
  24121. done"
  24122. dotest release-21 "$testcvs edit file1"
  24123. cd ..
  24124. dotest release-22 "echo yes | $testcvs release -d second-dir" \
  24125. "You have \[0\] altered files in this repository.
  24126. Are you sure you want to release (and delete) directory \`second-dir': "
  24127. dotest release-23 "$testcvs -q update -d" "U second-dir/file1"
  24128. dotest release-24 "$testcvs edit"
  24129. cd ../..
  24130. rm -rf 1 $CVSROOT_DIRNAME/first-dir
  24131. ;;
  24132. recase)
  24133. #
  24134. # Some tests of behavior which broke at one time or another when run
  24135. # from case insensitive clients against case sensitive servers.
  24136. #
  24137. # These tests are namned according to the following convention:
  24138. #
  24139. # ci Client (sandbox filesystem) case Insensitive
  24140. # cs Client (sandbox filesystem) case Sensitive
  24141. # si Server (repository filesystem) case Insensitive
  24142. # ss Server (repository filesystem) case Sensitive
  24143. #
  24144. mkdir 1; cd 1
  24145. # First, we will expect different results for a few of these tests
  24146. # based on whether the repository is on a case sensitive filesystem
  24147. # or not and whether the sandbox is on a case sensitive filesystem or
  24148. # not, so determine which cases we are dealing with:
  24149. echo file >file
  24150. echo FiLe >FiLe
  24151. if cmp file FiLe >/dev/null; then
  24152. client_sensitive=false
  24153. else
  24154. client_sensitive=:
  24155. fi
  24156. if test -n "$remotehost"; then
  24157. $CVS_RSH $remotehost 'echo file >file'
  24158. $CVS_RSH $remotehost 'echo FiLe >FiLe'
  24159. if $CVS_RSH $remotehost 'cmp file FiLe >/dev/null'; then
  24160. server_sensitive=false
  24161. else
  24162. server_sensitive=:
  24163. fi
  24164. else
  24165. server_sensitive=$client_sensitive
  24166. fi
  24167. # The first test (recase-1 & recase-2) is for a remove of a file then
  24168. # a readd in a different case.
  24169. mkdir $CVSROOT_DIRNAME/first-dir
  24170. dotest recase-init-1 "$testcvs -Q co first-dir"
  24171. cd first-dir
  24172. echo this file has no content >file
  24173. dotest recase-init-2 "$testcvs -Q add file"
  24174. dotest recase-init-3 "$testcvs -Q ci -madd" \
  24175. "RCS file: $CVSROOT_DIRNAME/first-dir/file,v
  24176. done
  24177. Checking in file;
  24178. $CVSROOT_DIRNAME/first-dir/file,v <-- file
  24179. initial revision: 1\.1
  24180. done"
  24181. dotest recase-init-4 "$testcvs -Q tag first"
  24182. # Now remove the file.
  24183. dotest recase-init-5 "$testcvs -Q rm -f file"
  24184. dotest recase-init-6 "$testcvs -Q ci -mrm" \
  24185. "Removing file;
  24186. $CVSROOT_DIRNAME/first-dir/file,v <-- file
  24187. new revision: delete; previous revision: 1\.1
  24188. done"
  24189. # Now the test - readd in a different case.
  24190. echo this file needs some content >FiLe
  24191. if $server_sensitive; then
  24192. dotest recase-1ss "$testcvs add FiLe" \
  24193. "$PROG add: scheduling file \`FiLe' for addition
  24194. $PROG add: use '$PROG commit' to add this file permanently"
  24195. dotest recase-2ss "$testcvs -q ci -mrecase" \
  24196. "RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24197. done
  24198. Checking in FiLe;
  24199. $CVSROOT_DIRNAME/first-dir/FiLe,v <-- FiLe
  24200. initial revision: 1\.1
  24201. done"
  24202. else # server insensitive
  24203. dotest recase-1si "$testcvs add FiLe" \
  24204. "$PROG add: Re-adding file \`FiLe' (in place of dead revision 1\.2)\.
  24205. $PROG add: use '$PROG commit' to add this file permanently"
  24206. dotest recase-2si "$testcvs -q ci -mrecase" \
  24207. "Checking in FiLe;
  24208. $CVSROOT_DIRNAME/first-dir/FiLe,v <-- FiLe
  24209. new revision: 1\.3; previous revision: 1\.2
  24210. done"
  24211. fi
  24212. # Now verify that a checkout will still work
  24213. cd ../..
  24214. mkdir 2; cd 2
  24215. dotest recase-3 "$testcvs -q co first-dir" \
  24216. "U first-dir/FiLe"
  24217. cd first-dir
  24218. # Prove that we can still get status and log information on
  24219. # conflicting case files (1 in Attic, one in parent).
  24220. if $remote; then
  24221. if $client_sensitive; then
  24222. file=file
  24223. fIlE=fIlE
  24224. else # client insensitive
  24225. # Because FiLe is present on a case insensitive client, it is the
  24226. # only one ever found and queried or altered.
  24227. file=FiLe
  24228. fIlE=FiLe
  24229. fi
  24230. else # ! $remote
  24231. file=file
  24232. fIlE=fIlE
  24233. fi
  24234. if $server_sensitive; then
  24235. if $client_sensitive; then
  24236. # Client finds Entry only for FiLe. Others returned by server.
  24237. dotest recase-4sscs "$testcvs status file" \
  24238. "===================================================================
  24239. File: no file file Status: Up-to-date
  24240. Working revision: No entry for file
  24241. Repository revision: 1\.2 $CVSROOT_DIRNAME/first-dir/Attic/file,v"
  24242. dotest recase-5sscs "$testcvs log file" \
  24243. "
  24244. RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
  24245. Working file: file
  24246. head: 1\.2
  24247. branch:
  24248. locks: strict
  24249. access list:
  24250. symbolic names:
  24251. first: 1\.1
  24252. keyword substitution: kv
  24253. total revisions: 2; selected revisions: 2
  24254. description:
  24255. ----------------------------
  24256. revision 1\.2
  24257. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: +0 -0
  24258. rm
  24259. ----------------------------
  24260. revision 1\.1
  24261. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24262. add
  24263. ============================================================================="
  24264. dotest recase-6sscs "$testcvs status FiLe" \
  24265. "===================================================================
  24266. File: FiLe Status: Up-to-date
  24267. Working revision: 1\.1.*
  24268. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24269. Sticky Tag: (none)
  24270. Sticky Date: (none)
  24271. Sticky Options: (none)"
  24272. dotest recase-7sscs "$testcvs log FiLe" \
  24273. "
  24274. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24275. Working file: FiLe
  24276. head: 1\.1
  24277. branch:
  24278. locks: strict
  24279. access list:
  24280. symbolic names:
  24281. keyword substitution: kv
  24282. total revisions: 1; selected revisions: 1
  24283. description:
  24284. ----------------------------
  24285. revision 1\.1
  24286. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24287. recase
  24288. ============================================================================="
  24289. else # server sensitive && client insensitive
  24290. # Client finds same Entry for file & FiLe.
  24291. dotest recase-4ssci "$testcvs status file" \
  24292. "===================================================================
  24293. File: FiLe Status: Up-to-date
  24294. Working revision: 1\.1.*
  24295. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24296. Sticky Tag: (none)
  24297. Sticky Date: (none)
  24298. Sticky Options: (none)"
  24299. dotest recase-5ssci "$testcvs log file" \
  24300. "
  24301. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24302. Working file: FiLe
  24303. head: 1\.1
  24304. branch:
  24305. locks: strict
  24306. access list:
  24307. symbolic names:
  24308. keyword substitution: kv
  24309. total revisions: 1; selected revisions: 1
  24310. description:
  24311. ----------------------------
  24312. revision 1\.1
  24313. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24314. recase
  24315. ============================================================================="
  24316. dotest recase-6ss "$testcvs status FiLe" \
  24317. "===================================================================
  24318. File: FiLe Status: Up-to-date
  24319. Working revision: 1\.1.*
  24320. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24321. Sticky Tag: (none)
  24322. Sticky Date: (none)
  24323. Sticky Options: (none)"
  24324. dotest recase-7ss "$testcvs log FiLe" \
  24325. "
  24326. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24327. Working file: FiLe
  24328. head: 1\.1
  24329. branch:
  24330. locks: strict
  24331. access list:
  24332. symbolic names:
  24333. keyword substitution: kv
  24334. total revisions: 1; selected revisions: 1
  24335. description:
  24336. ----------------------------
  24337. revision 1\.1
  24338. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24339. recase
  24340. ============================================================================="
  24341. fi
  24342. else # server insensitive
  24343. # There is only one archive when the server is insensitive, but the
  24344. # printed file/archive name can vary.
  24345. dotest recase-4si "$testcvs status file" \
  24346. "===================================================================
  24347. File: $file Status: Up-to-date
  24348. Working revision: 1\.3.*
  24349. Repository revision: 1\.3 $CVSROOT_DIRNAME/first-dir/$file,v
  24350. Sticky Tag: (none)
  24351. Sticky Date: (none)
  24352. Sticky Options: (none)"
  24353. dotest recase-5si "$testcvs log file" \
  24354. "
  24355. RCS file: $CVSROOT_DIRNAME/first-dir/$file,v
  24356. Working file: $file
  24357. head: 1\.3
  24358. branch:
  24359. locks: strict
  24360. access list:
  24361. symbolic names:
  24362. first: 1\.1
  24363. keyword substitution: kv
  24364. total revisions: 3; selected revisions: 3
  24365. description:
  24366. ----------------------------
  24367. revision 1\.3
  24368. date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: +1 -1
  24369. recase
  24370. ----------------------------
  24371. revision 1\.2
  24372. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: +0 -0
  24373. rm
  24374. ----------------------------
  24375. revision 1\.1
  24376. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24377. add
  24378. ============================================================================="
  24379. dotest recase-6si "$testcvs status FiLe" \
  24380. "===================================================================
  24381. File: FiLe Status: Up-to-date
  24382. Working revision: 1\.3.*
  24383. Repository revision: 1\.3 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24384. Sticky Tag: (none)
  24385. Sticky Date: (none)
  24386. Sticky Options: (none)"
  24387. dotest recase-7si "$testcvs log FiLe" \
  24388. "
  24389. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24390. Working file: FiLe
  24391. head: 1\.3
  24392. branch:
  24393. locks: strict
  24394. access list:
  24395. symbolic names:
  24396. first: 1\.1
  24397. keyword substitution: kv
  24398. total revisions: 3; selected revisions: 3
  24399. description:
  24400. ----------------------------
  24401. revision 1\.3
  24402. date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: +1 -1
  24403. recase
  24404. ----------------------------
  24405. revision 1\.2
  24406. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: +0 -0
  24407. rm
  24408. ----------------------------
  24409. revision 1\.1
  24410. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24411. add
  24412. ============================================================================="
  24413. fi
  24414. # And when the file does not exist on the client, we go with the
  24415. # client Entries match.
  24416. if $client_sensitive && $server_sensitive; then
  24417. dotest recase-8sscs "$testcvs status fIlE" \
  24418. "$PROG status: nothing known about fIlE
  24419. ===================================================================
  24420. File: no file fIlE Status: Unknown
  24421. Working revision: No entry for fIlE
  24422. Repository revision: No revision control file"
  24423. else # !$client_sensitive || !$server_sensitive
  24424. dotest recase-8anyi "$testcvs status fIlE" \
  24425. "===================================================================
  24426. File: $fIlE Status: Up-to-date
  24427. Working revision: 1\.[0-9]*.*
  24428. Repository revision: 1\.[0-9]* $CVSROOT_DIRNAME/first-dir/$fIlE,v
  24429. Sticky Tag: (none)
  24430. Sticky Date: (none)
  24431. Sticky Options: (none)"
  24432. fi
  24433. # and an update
  24434. if $server_sensitive; then
  24435. dotest recase-9ss "$testcvs -q up -rfirst" \
  24436. "$PROG update: FiLe is no longer in the repository
  24437. U file"
  24438. if $client_sensitive; then
  24439. dotest recase-10sscs "$testcvs -q up -A" \
  24440. "U FiLe
  24441. $PROG update: file is no longer in the repository"
  24442. else # client insensitive
  24443. # FIXCVS: This should remove the offending file first.
  24444. dotest_fail recase-10ssci "$testcvs -q up -A" \
  24445. "$PROG update: move away \./FiLe; it is in the way
  24446. C FiLe
  24447. $PROG update: file is no longer in the repository"
  24448. cd ..
  24449. rm -r first-dir
  24450. dotest recase-11ssci "$testcvs -q co first-dir" \
  24451. "U first-dir/FiLe"
  24452. cd first-dir
  24453. fi
  24454. #
  24455. # See what happens when cased names clash.
  24456. #
  24457. # Copy the archive
  24458. if test -n "$remotehost"; then
  24459. $CVS_RSH $remotehost "cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
  24460. $CVSROOT_DIRNAME/first-dir/FILE,v"
  24461. else
  24462. cp $CVSROOT_DIRNAME/first-dir/FiLe,v \
  24463. $CVSROOT_DIRNAME/first-dir/FILE,v
  24464. fi
  24465. if $client_sensitive; then
  24466. dotest recase-12sscs "$testcvs -q up" "U FILE"
  24467. else # client insensitive
  24468. dotest_fail recase-12ssci "$testcvs -q up" \
  24469. "$PROG update: move away \./FILE; it is in the way
  24470. C FILE"
  24471. fi
  24472. else # server insensitive
  24473. dotest recase-9si "$testcvs -q up -rfirst" "U FiLe"
  24474. dotest recase-10si "$testcvs -q up -A" "U FiLe"
  24475. fi
  24476. # Prove that we can still get status and log information on
  24477. # conflicting case files (1 in Attic, two in parent).
  24478. if $server_sensitive; then
  24479. if $client_sensitive; then
  24480. # Client finds Entry only for FiLe. Others returned by server.
  24481. dotest recase-13sscs "$testcvs status file" \
  24482. "===================================================================
  24483. File: no file file Status: Up-to-date
  24484. Working revision: No entry for file
  24485. Repository revision: 1\.2 $CVSROOT_DIRNAME/first-dir/Attic/file,v"
  24486. dotest recase-14sscs "$testcvs log file" \
  24487. "
  24488. RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file,v
  24489. Working file: file
  24490. head: 1\.2
  24491. branch:
  24492. locks: strict
  24493. access list:
  24494. symbolic names:
  24495. first: 1\.1
  24496. keyword substitution: kv
  24497. total revisions: 2; selected revisions: 2
  24498. description:
  24499. ----------------------------
  24500. revision 1\.2
  24501. date: [0-9/]* [0-9:]*; author: $username; state: dead; lines: +0 -0
  24502. rm
  24503. ----------------------------
  24504. revision 1\.1
  24505. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24506. add
  24507. ============================================================================="
  24508. dotest recase-15sscs "$testcvs status FiLe" \
  24509. "===================================================================
  24510. File: FiLe Status: Up-to-date
  24511. Working revision: 1\.1.*
  24512. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24513. Sticky Tag: (none)
  24514. Sticky Date: (none)
  24515. Sticky Options: (none)"
  24516. dotest recase-16sscs "$testcvs log FiLe" \
  24517. "
  24518. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24519. Working file: FiLe
  24520. head: 1\.1
  24521. branch:
  24522. locks: strict
  24523. access list:
  24524. symbolic names:
  24525. keyword substitution: kv
  24526. total revisions: 1; selected revisions: 1
  24527. description:
  24528. ----------------------------
  24529. revision 1\.1
  24530. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24531. recase
  24532. ============================================================================="
  24533. dotest recase-17sscs "$testcvs status FILE" \
  24534. "===================================================================
  24535. File: FILE Status: Up-to-date
  24536. Working revision: 1.1.*
  24537. Repository revision: 1.1 ${CVSROOT_DIRNAME}/first-dir/FILE,v
  24538. Sticky Tag: (none)
  24539. Sticky Date: (none)
  24540. Sticky Options: (none)"
  24541. dotest recase-18sscs "$testcvs log FILE" \
  24542. "
  24543. RCS file: $CVSROOT_DIRNAME/first-dir/FILE,v
  24544. Working file: FILE
  24545. head: 1\.1
  24546. branch:
  24547. locks: strict
  24548. access list:
  24549. symbolic names:
  24550. keyword substitution: kv
  24551. total revisions: 1; selected revisions: 1
  24552. description:
  24553. ----------------------------
  24554. revision 1\.1
  24555. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24556. recase
  24557. ============================================================================="
  24558. else # $server_sensitive && !$client_sensitive
  24559. # Client finds same Entry for file & FiLe.
  24560. dotest recase-13ssci "$testcvs status file" \
  24561. "===================================================================
  24562. File: FiLe Status: Up-to-date
  24563. Working revision: 1\.1.*
  24564. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24565. Sticky Tag: (none)
  24566. Sticky Date: (none)
  24567. Sticky Options: (none)"
  24568. dotest recase-16ssci "$testcvs log FiLe" \
  24569. "
  24570. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24571. Working file: FiLe
  24572. head: 1\.1
  24573. branch:
  24574. locks: strict
  24575. access list:
  24576. symbolic names:
  24577. keyword substitution: kv
  24578. total revisions: 1; selected revisions: 1
  24579. description:
  24580. ----------------------------
  24581. revision 1\.1
  24582. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24583. recase
  24584. ============================================================================="
  24585. dotest recase-17ssci "$testcvs status FILE" \
  24586. "===================================================================
  24587. File: FiLe Status: Up-to-date
  24588. Working revision: 1\.1.*
  24589. Repository revision: 1\.1 $CVSROOT_DIRNAME/first-dir/FiLe,v
  24590. Sticky Tag: (none)
  24591. Sticky Date: (none)
  24592. Sticky Options: (none)"
  24593. dotest recase-18ssci "$testcvs log FILE" \
  24594. "
  24595. RCS file: $CVSROOT_DIRNAME/first-dir/FiLe,v
  24596. Working file: FiLe
  24597. head: 1\.1
  24598. branch:
  24599. locks: strict
  24600. access list:
  24601. symbolic names:
  24602. keyword substitution: kv
  24603. total revisions: 1; selected revisions: 1
  24604. description:
  24605. ----------------------------
  24606. revision 1\.1
  24607. date: [0-9/]* [0-9:]*; author: $username; state: Exp;
  24608. recase
  24609. ============================================================================="
  24610. fi
  24611. else # !$server_sensitive
  24612. # Skip these when the server is case insensitive - nothing
  24613. # has changed since recase-[4-7]si
  24614. :
  24615. fi
  24616. if $client_sensitive && $server_sensitive; then
  24617. dotest recase-19sscs "$testcvs status fIlE" \
  24618. "$PROG status: nothing known about fIlE
  24619. ===================================================================
  24620. File: no file fIlE Status: Unknown
  24621. Working revision: No entry for fIlE
  24622. Repository revision: No revision control file"
  24623. else # !$client_sensitive || !$server_sensitive
  24624. dotest recase-19anyi "$testcvs status fIlE" \
  24625. "===================================================================
  24626. File: $fIlE Status: Up-to-date
  24627. Working revision: 1\.[0-9]*.*
  24628. Repository revision: 1\.[0-9]* $CVSROOT_DIRNAME/first-dir/$fIlE,v
  24629. Sticky Tag: (none)
  24630. Sticky Date: (none)
  24631. Sticky Options: (none)"
  24632. fi
  24633. # And last but not least, prove that a checkout is still possible.
  24634. cd ../..
  24635. mkdir 3; cd 3
  24636. if $server_sensitive; then
  24637. if $client_sensitive; then
  24638. dotest recase-20sscs "$testcvs -q co first-dir" \
  24639. "U first-dir/FILE
  24640. U first-dir/FiLe"
  24641. else # $server_senstive && !$client_sensitive
  24642. dotest_fail recase-20ssci "$testcvs -q co first-dir" \
  24643. "U first-dir/FILE
  24644. $PROG checkout: move away first-dir/FiLe; it is in the way
  24645. C first-dir/FiLe"
  24646. fi
  24647. else # !$server_sensitive
  24648. # Skip these since nothing has changed.
  24649. :
  24650. fi
  24651. if $keep; then
  24652. echo Keeping ${TESTDIR} and exiting due to --keep
  24653. exit 0
  24654. fi
  24655. cd ..
  24656. rm -r 1 2 3
  24657. if $server_sensitive && test -n "$remotehost"; then
  24658. # It is necessary to remove one of the case-conflicted files before
  24659. # recursively removing the rest under Cygwin on a Samba share or
  24660. # Samba returns a permission denied error due to its case
  24661. # confusion.
  24662. $CVS_RSH $remotehost "rm -f $CVSROOT_DIRNAME/first-dir/FILE,v"
  24663. fi
  24664. rm -rf $CVSROOT_DIRNAME/first-dir
  24665. ;;
  24666. multiroot)
  24667. #
  24668. # set up two repositories
  24669. #
  24670. CVSROOT1_DIRNAME=${TESTDIR}/root1
  24671. CVSROOT2_DIRNAME=${TESTDIR}/root2
  24672. CVSROOT1=`newroot $CVSROOT1_DIRNAME`
  24673. CVSROOT2=`newroot $CVSROOT2_DIRNAME`
  24674. testcvs1="${testcvs} -d ${CVSROOT1}"
  24675. testcvs2="${testcvs} -d ${CVSROOT2}"
  24676. dotest multiroot-setup-1 "mkdir $CVSROOT1_DIRNAME $CVSROOT2_DIRNAME"
  24677. dotest multiroot-setup-2 "$testcvs -d$CVSROOT1_DIRNAME init"
  24678. dotest multiroot-setup-3 "$testcvs -d$CVSROOT2_DIRNAME init"
  24679. #
  24680. # create some directories in root1
  24681. #
  24682. mkdir 1; cd 1
  24683. dotest multiroot-setup-4 "${testcvs1} co -l ." \
  24684. "${PROG} checkout: Updating ."
  24685. mkdir mod1-1 mod1-2
  24686. dotest multiroot-setup-5 "${testcvs1} add mod1-1 mod1-2" \
  24687. "Directory ${CVSROOT1_DIRNAME}/mod1-1 added to the repository
  24688. Directory ${CVSROOT1_DIRNAME}/mod1-2 added to the repository"
  24689. echo file1-1 > mod1-1/file1-1
  24690. echo file1-2 > mod1-2/file1-2
  24691. dotest multiroot-setup-6 "${testcvs1} add mod1-1/file1-1 mod1-2/file1-2" \
  24692. "${PROG} add: scheduling file .mod1-1/file1-1. for addition
  24693. ${PROG} add: scheduling file .mod1-2/file1-2. for addition
  24694. ${PROG} add: use .${PROG} commit. to add these files permanently"
  24695. dotest multiroot-setup-7 "${testcvs1} commit -m is" \
  24696. "${PROG} [a-z]*: Examining \.
  24697. ${PROG} [a-z]*: Examining mod1-1
  24698. ${PROG} [a-z]*: Examining mod1-2
  24699. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
  24700. done
  24701. Checking in mod1-1/file1-1;
  24702. ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v <-- file1-1
  24703. initial revision: 1.1
  24704. done
  24705. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  24706. done
  24707. Checking in mod1-2/file1-2;
  24708. ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v <-- file1-2
  24709. initial revision: 1.1
  24710. done"
  24711. cd ..
  24712. rm -rf 1
  24713. #
  24714. # create some directories in root2
  24715. #
  24716. mkdir 1; cd 1
  24717. dotest multiroot-setup-8 "${testcvs2} co -l ." \
  24718. "${PROG} checkout: Updating ."
  24719. mkdir mod2-1 mod2-2
  24720. dotest multiroot-setup-9 "${testcvs2} add mod2-1 mod2-2" \
  24721. "Directory ${CVSROOT2_DIRNAME}/mod2-1 added to the repository
  24722. Directory ${CVSROOT2_DIRNAME}/mod2-2 added to the repository"
  24723. echo file2-1 > mod2-1/file2-1
  24724. echo file2-2 > mod2-2/file2-2
  24725. dotest multiroot-setup-6 "${testcvs2} add mod2-1/file2-1 mod2-2/file2-2" \
  24726. "${PROG} add: scheduling file .mod2-1/file2-1. for addition
  24727. ${PROG} add: scheduling file .mod2-2/file2-2. for addition
  24728. ${PROG} add: use .${PROG} commit. to add these files permanently"
  24729. dotest multiroot-setup-10 "${testcvs2} commit -m anyone" \
  24730. "${PROG} [a-z]*: Examining \.
  24731. ${PROG} [a-z]*: Examining mod2-1
  24732. ${PROG} [a-z]*: Examining mod2-2
  24733. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
  24734. done
  24735. Checking in mod2-1/file2-1;
  24736. ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v <-- file2-1
  24737. initial revision: 1.1
  24738. done
  24739. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  24740. done
  24741. Checking in mod2-2/file2-2;
  24742. ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v <-- file2-2
  24743. initial revision: 1.1
  24744. done"
  24745. cd ..
  24746. rm -rf 1
  24747. # check out a few directories, from simple/shallow to
  24748. # complex/deep
  24749. mkdir 1; cd 1
  24750. # OK, this case is kind of weird. If we just run things from
  24751. # here, without CVS/Root, then CVS will contact the server
  24752. # mentioned in CVSROOT (which is irrelevant) which will print
  24753. # some messages. Our workaround is to make sure we have a
  24754. # CVS/Root file at top level. In the future, it is possible
  24755. # the best behavior will be to extend the existing behavior
  24756. # ("being called from a directory without CVS administration
  24757. # has always meant to process each of the sub-dirs") to also
  24758. # do that if there is no CVSROOT, CVS/Root, or -d at top level.
  24759. #
  24760. # The local case could stumble through the tests without creating
  24761. # the top-level CVS/Root, but we create it for local and for
  24762. # remote to reduce special cases later in the test.
  24763. dotest multiroot-workaround "${testcvs1} -q co -l ." ""
  24764. dotest multiroot-setup-11 "${testcvs1} co mod1-1 mod1-2" \
  24765. "${PROG} checkout: Updating mod1-1
  24766. U mod1-1/file1-1
  24767. ${PROG} checkout: Updating mod1-2
  24768. U mod1-2/file1-2"
  24769. dotest multiroot-setup-12 "${testcvs2} co mod2-1 mod2-2" \
  24770. "${PROG} checkout: Updating mod2-1
  24771. U mod2-1/file2-1
  24772. ${PROG} checkout: Updating mod2-2
  24773. U mod2-2/file2-2"
  24774. cd mod1-2
  24775. dotest multiroot-setup-13 "${testcvs2} co mod2-2" \
  24776. "${PROG} checkout: Updating mod2-2
  24777. U mod2-2/file2-2"
  24778. cd ..
  24779. cd mod2-2
  24780. dotest multiroot-setup-14 "${testcvs1} co mod1-2" \
  24781. "${PROG} checkout: Updating mod1-2
  24782. U mod1-2/file1-2"
  24783. cd ..
  24784. #
  24785. # Make sure that the Root and Repository files contain the
  24786. # correct information.
  24787. #
  24788. dotest multiroot-cvsadm-1a "cat mod1-1/CVS/Root" "${CVSROOT1}"
  24789. dotest multiroot-cvsadm-1b "cat mod1-1/CVS/Repository" "mod1-1"
  24790. dotest multiroot-cvsadm-2a "cat mod2-1/CVS/Root" "${CVSROOT2}"
  24791. dotest multiroot-cvsadm-2b "cat mod2-1/CVS/Repository" "mod2-1"
  24792. dotest multiroot-cvsadm-3a "cat mod1-2/CVS/Root" "${CVSROOT1}"
  24793. dotest multiroot-cvsadm-3b "cat mod1-2/CVS/Repository" "mod1-2"
  24794. dotest multiroot-cvsadm-3c "cat mod1-2/mod2-2/CVS/Root" "${CVSROOT2}"
  24795. dotest multiroot-cvsadm-3d "cat mod1-2/mod2-2/CVS/Repository" "mod2-2"
  24796. dotest multiroot-cvsadm-4a "cat mod2-2/CVS/Root" "${CVSROOT2}"
  24797. dotest multiroot-cvsadm-4b "cat mod2-2/CVS/Repository" "mod2-2"
  24798. dotest multiroot-cvsadm-4c "cat mod2-2/mod1-2/CVS/Root" "${CVSROOT1}"
  24799. dotest multiroot-cvsadm-4d "cat mod2-2/mod1-2/CVS/Repository" "mod1-2"
  24800. #
  24801. # Start testing various cvs commands. Begin with commands
  24802. # without extra arguments (e.g. "cvs update", "cvs diff",
  24803. # etc.
  24804. #
  24805. # Do at least one command with both CVSROOTs to make sure
  24806. # that there's not some kind of unexpected dependency on the
  24807. # choice of which CVSROOT is specified on the command line.
  24808. dotest multiroot-update-1a "${testcvs1} update" \
  24809. "${PROG} update: Updating \.
  24810. ${PROG} update: Updating mod1-1
  24811. ${PROG} update: Updating mod1-2
  24812. ${PROG} update: Updating mod1-2/mod2-2
  24813. ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
  24814. ${PROG} update: skipping directory mod1-2/mod2-2
  24815. ${PROG} update: Updating mod2-1
  24816. ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-1: No such file or directory
  24817. ${PROG} update: skipping directory mod2-1
  24818. ${PROG} update: Updating mod2-2
  24819. ${PROG} update: cannot open directory ${CVSROOT1_DIRNAME}/mod2-2: No such file or directory
  24820. ${PROG} update: skipping directory mod2-2"
  24821. # Same deal but with -d ${CVSROOT2}.
  24822. dotest multiroot-update-1b "${testcvs2} update" \
  24823. "${PROG} update: Updating \.
  24824. ${PROG} update: Updating mod1-1
  24825. ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-1: No such file or directory
  24826. ${PROG} update: skipping directory mod1-1
  24827. ${PROG} update: Updating mod1-2
  24828. ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
  24829. ${PROG} update: skipping directory mod1-2
  24830. ${PROG} update: Updating mod2-1
  24831. ${PROG} update: Updating mod2-2
  24832. ${PROG} update: Updating mod2-2/mod1-2
  24833. ${PROG} update: cannot open directory ${CVSROOT2_DIRNAME}/mod1-2: No such file or directory
  24834. ${PROG} update: skipping directory mod2-2/mod1-2"
  24835. # modify all files and do a diff
  24836. echo bobby >> mod1-1/file1-1
  24837. echo brown >> mod1-2/file1-2
  24838. echo goes >> mod2-1/file2-1
  24839. echo down >> mod2-2/file2-2
  24840. dotest_fail multiroot-diff-1 "${testcvs} diff" \
  24841. "${PROG} diff: Diffing \.
  24842. ${PROG} diff: Diffing mod1-1
  24843. Index: mod1-1/file1-1
  24844. ===================================================================
  24845. RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
  24846. retrieving revision 1\.1
  24847. diff -r1\.1 file1-1
  24848. 1a2
  24849. > bobby
  24850. ${PROG} diff: Diffing mod1-2
  24851. Index: mod1-2/file1-2
  24852. ===================================================================
  24853. RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
  24854. retrieving revision 1\.1
  24855. diff -r1\.1 file1-2
  24856. 1a2
  24857. > brown
  24858. ${PROG} diff: Diffing mod2-2/mod1-2
  24859. ${PROG} diff: Diffing mod1-2/mod2-2
  24860. ${PROG} diff: Diffing mod2-1
  24861. Index: mod2-1/file2-1
  24862. ===================================================================
  24863. RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
  24864. retrieving revision 1\.1
  24865. diff -r1\.1 file2-1
  24866. 1a2
  24867. > goes
  24868. ${PROG} diff: Diffing mod2-2
  24869. Index: mod2-2/file2-2
  24870. ===================================================================
  24871. RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
  24872. retrieving revision 1\.1
  24873. diff -r1\.1 file2-2
  24874. 1a2
  24875. > down" \
  24876. "${PROG} diff: Diffing \.
  24877. ${PROG} diff: Diffing mod1-1
  24878. Index: mod1-1/file1-1
  24879. ===================================================================
  24880. RCS file: ${TESTDIR}/root1/mod1-1/file1-1,v
  24881. retrieving revision 1\.1
  24882. diff -r1\.1 file1-1
  24883. 1a2
  24884. > bobby
  24885. ${PROG} diff: Diffing mod1-2
  24886. Index: mod1-2/file1-2
  24887. ===================================================================
  24888. RCS file: ${TESTDIR}/root1/mod1-2/file1-2,v
  24889. retrieving revision 1\.1
  24890. diff -r1\.1 file1-2
  24891. 1a2
  24892. > brown
  24893. ${PROG} diff: Diffing mod2-2
  24894. ${PROG} diff: Diffing mod2-2/mod1-2
  24895. ${PROG} diff: Diffing mod1-2
  24896. ${PROG} diff: Diffing mod1-2/mod2-2
  24897. ${PROG} diff: Diffing mod2-1
  24898. Index: mod2-1/file2-1
  24899. ===================================================================
  24900. RCS file: ${TESTDIR}/root2/mod2-1/file2-1,v
  24901. retrieving revision 1\.1
  24902. diff -r1\.1 file2-1
  24903. 1a2
  24904. > goes
  24905. ${PROG} diff: Diffing mod2-2
  24906. Index: mod2-2/file2-2
  24907. ===================================================================
  24908. RCS file: ${TESTDIR}/root2/mod2-2/file2-2,v
  24909. retrieving revision 1\.1
  24910. diff -r1\.1 file2-2
  24911. 1a2
  24912. > down"
  24913. dotest multiroot-commit-1 "${testcvs} commit -m actually" \
  24914. "${PROG} [a-z]*: Examining \.
  24915. ${PROG} [a-z]*: Examining mod1-1
  24916. ${PROG} [a-z]*: Examining mod1-2
  24917. ${PROG} [a-z]*: Examining mod2-2/mod1-2
  24918. Checking in mod1-1/file1-1;
  24919. ${TESTDIR}/root1/mod1-1/file1-1,v <-- file1-1
  24920. new revision: 1.2; previous revision: 1.1
  24921. done
  24922. Checking in mod1-2/file1-2;
  24923. ${TESTDIR}/root1/mod1-2/file1-2,v <-- file1-2
  24924. new revision: 1.2; previous revision: 1.1
  24925. done
  24926. ${PROG} [a-z]*: Examining mod1-2/mod2-2
  24927. ${PROG} [a-z]*: Examining mod2-1
  24928. ${PROG} [a-z]*: Examining mod2-2
  24929. Checking in mod2-1/file2-1;
  24930. ${TESTDIR}/root2/mod2-1/file2-1,v <-- file2-1
  24931. new revision: 1.2; previous revision: 1.1
  24932. done
  24933. Checking in mod2-2/file2-2;
  24934. ${TESTDIR}/root2/mod2-2/file2-2,v <-- file2-2
  24935. new revision: 1.2; previous revision: 1.1
  24936. done"
  24937. dotest multiroot-update-2 "${testcvs} update" \
  24938. "${PROG} update: Updating \.
  24939. ${PROG} [a-z]*: Updating mod1-1
  24940. ${PROG} [a-z]*: Updating mod1-2
  24941. ${PROG} [a-z]*: Updating mod2-2/mod1-2
  24942. U mod2-2/mod1-2/file1-2
  24943. ${PROG} [a-z]*: Updating mod1-2/mod2-2
  24944. U mod1-2/mod2-2/file2-2
  24945. ${PROG} update: Updating mod2-1
  24946. ${PROG} update: Updating mod2-2" \
  24947. "${PROG} update: Updating \.
  24948. ${PROG} update: Updating mod1-1
  24949. ${PROG} update: Updating mod1-2
  24950. ${PROG} update: Updating mod2-2
  24951. ${PROG} update: Updating mod2-2/mod1-2
  24952. P mod2-2/mod1-2/file1-2
  24953. ${PROG} update: Updating mod1-2
  24954. ${PROG} update: Updating mod1-2/mod2-2
  24955. P mod1-2/mod2-2/file2-2
  24956. ${PROG} update: Updating mod2-1
  24957. ${PROG} update: Updating mod2-2"
  24958. dotest multiroot-tag-1 "${testcvs} tag cattle" \
  24959. "${PROG} tag: Tagging \.
  24960. ${PROG} tag: Tagging mod1-1
  24961. T mod1-1/file1-1
  24962. ${PROG} tag: Tagging mod1-2
  24963. T mod1-2/file1-2
  24964. ${PROG} tag: Tagging mod2-2/mod1-2
  24965. ${PROG} tag: Tagging mod1-2/mod2-2
  24966. T mod1-2/mod2-2/file2-2
  24967. ${PROG} tag: Tagging mod2-1
  24968. T mod2-1/file2-1
  24969. ${PROG} tag: Tagging mod2-2" \
  24970. "${PROG} tag: Tagging \.
  24971. ${PROG} tag: Tagging mod1-1
  24972. T mod1-1/file1-1
  24973. ${PROG} tag: Tagging mod1-2
  24974. T mod1-2/file1-2
  24975. ${PROG} tag: Tagging mod2-2
  24976. ${PROG} tag: Tagging mod2-2/mod1-2
  24977. ${PROG} tag: Tagging mod1-2
  24978. ${PROG} tag: Tagging mod1-2/mod2-2
  24979. T mod1-2/mod2-2/file2-2
  24980. ${PROG} tag: Tagging mod2-1
  24981. T mod2-1/file2-1
  24982. ${PROG} tag: Tagging mod2-2"
  24983. echo anotherfile1-1 > mod1-1/anotherfile1-1
  24984. echo anotherfile2-1 > mod2-1/anotherfile2-1
  24985. echo anotherfile1-2 > mod2-2/mod1-2/anotherfile1-2
  24986. echo anotherfile2-2 > mod1-2/mod2-2/anotherfile2-2
  24987. if $remote; then
  24988. cd mod1-1
  24989. dotest multiroot-add-1ar "${testcvs} add anotherfile1-1" \
  24990. "${PROG} add: scheduling file .anotherfile1-1. for addition
  24991. ${PROG} add: use .${PROG} commit. to add this file permanently"
  24992. cd ../mod2-1
  24993. dotest multiroot-add-1br "${testcvs} add anotherfile2-1" \
  24994. "${PROG} add: scheduling file .anotherfile2-1. for addition
  24995. ${PROG} add: use .${PROG} commit. to add this file permanently"
  24996. cd ../mod2-2/mod1-2
  24997. dotest multiroot-add-1cr "${testcvs} add anotherfile1-2" \
  24998. "${PROG} add: scheduling file .anotherfile1-2. for addition
  24999. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25000. cd ../../mod1-2/mod2-2
  25001. dotest multiroot-add-1dr "${testcvs} add anotherfile2-2" \
  25002. "${PROG} add: scheduling file .anotherfile2-2. for addition
  25003. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25004. cd ../..
  25005. else
  25006. 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" \
  25007. "${PROG} add: scheduling file .mod1-1/anotherfile1-1. for addition
  25008. ${PROG} add: scheduling file .mod2-1/anotherfile2-1. for addition
  25009. ${PROG} add: scheduling file .mod2-2/mod1-2/anotherfile1-2. for addition
  25010. ${PROG} add: scheduling file .mod1-2/mod2-2/anotherfile2-2. for addition
  25011. ${PROG} add: use .${PROG} commit. to add these files permanently"
  25012. fi
  25013. dotest multiroot-status-1 "${testcvs} status -v" \
  25014. "${PROG} status: Examining \.
  25015. ${PROG} status: Examining mod1-1
  25016. ===================================================================
  25017. File: anotherfile1-1 Status: Locally Added
  25018. Working revision: New file!
  25019. Repository revision: No revision control file
  25020. Sticky Tag: (none)
  25021. Sticky Date: (none)
  25022. Sticky Options: (none)
  25023. ===================================================================
  25024. File: file1-1 Status: Up-to-date
  25025. Working revision: 1\.2.*
  25026. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
  25027. Sticky Tag: (none)
  25028. Sticky Date: (none)
  25029. Sticky Options: (none)
  25030. Existing Tags:
  25031. cattle (revision: 1\.2)
  25032. ${PROG} status: Examining mod1-2
  25033. ===================================================================
  25034. File: file1-2 Status: Up-to-date
  25035. Working revision: 1\.2.*
  25036. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25037. Sticky Tag: (none)
  25038. Sticky Date: (none)
  25039. Sticky Options: (none)
  25040. Existing Tags:
  25041. cattle (revision: 1\.2)
  25042. ${PROG} status: Examining mod2-2/mod1-2
  25043. ===================================================================
  25044. File: anotherfile1-2 Status: Locally Added
  25045. Working revision: New file!
  25046. Repository revision: No revision control file
  25047. Sticky Tag: (none)
  25048. Sticky Date: (none)
  25049. Sticky Options: (none)
  25050. ===================================================================
  25051. File: file1-2 Status: Up-to-date
  25052. Working revision: 1\.2.*
  25053. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25054. Sticky Tag: (none)
  25055. Sticky Date: (none)
  25056. Sticky Options: (none)
  25057. Existing Tags:
  25058. cattle (revision: 1\.2)
  25059. ${PROG} status: Examining mod1-2/mod2-2
  25060. ===================================================================
  25061. File: anotherfile2-2 Status: Locally Added
  25062. Working revision: New file!
  25063. Repository revision: No revision control file
  25064. Sticky Tag: (none)
  25065. Sticky Date: (none)
  25066. Sticky Options: (none)
  25067. ===================================================================
  25068. File: file2-2 Status: Up-to-date
  25069. Working revision: 1\.2.*
  25070. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25071. Sticky Tag: (none)
  25072. Sticky Date: (none)
  25073. Sticky Options: (none)
  25074. Existing Tags:
  25075. cattle (revision: 1\.2)
  25076. ${PROG} status: Examining mod2-1
  25077. ===================================================================
  25078. File: anotherfile2-1 Status: Locally Added
  25079. Working revision: New file!
  25080. Repository revision: No revision control file
  25081. Sticky Tag: (none)
  25082. Sticky Date: (none)
  25083. Sticky Options: (none)
  25084. ===================================================================
  25085. File: file2-1 Status: Up-to-date
  25086. Working revision: 1\.2.*
  25087. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
  25088. Sticky Tag: (none)
  25089. Sticky Date: (none)
  25090. Sticky Options: (none)
  25091. Existing Tags:
  25092. cattle (revision: 1\.2)
  25093. ${PROG} status: Examining mod2-2
  25094. ===================================================================
  25095. File: file2-2 Status: Up-to-date
  25096. Working revision: 1\.2.*
  25097. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25098. Sticky Tag: (none)
  25099. Sticky Date: (none)
  25100. Sticky Options: (none)
  25101. Existing Tags:
  25102. cattle (revision: 1\.2)" \
  25103. "${PROG} status: Examining \.
  25104. ${PROG} status: Examining mod1-1
  25105. ===================================================================
  25106. File: anotherfile1-1 Status: Locally Added
  25107. Working revision: New file!
  25108. Repository revision: No revision control file
  25109. Sticky Tag: (none)
  25110. Sticky Date: (none)
  25111. Sticky Options: (none)
  25112. ===================================================================
  25113. File: file1-1 Status: Up-to-date
  25114. Working revision: 1\.2.*
  25115. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
  25116. Sticky Tag: (none)
  25117. Sticky Date: (none)
  25118. Sticky Options: (none)
  25119. Existing Tags:
  25120. cattle (revision: 1\.2)
  25121. ${PROG} status: Examining mod1-2
  25122. ===================================================================
  25123. File: file1-2 Status: Up-to-date
  25124. Working revision: 1\.2.*
  25125. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25126. Sticky Tag: (none)
  25127. Sticky Date: (none)
  25128. Sticky Options: (none)
  25129. Existing Tags:
  25130. cattle (revision: 1\.2)
  25131. ${PROG} status: Examining mod2-2
  25132. ${PROG} status: Examining mod2-2/mod1-2
  25133. ===================================================================
  25134. File: anotherfile1-2 Status: Locally Added
  25135. Working revision: New file!
  25136. Repository revision: No revision control file
  25137. Sticky Tag: (none)
  25138. Sticky Date: (none)
  25139. Sticky Options: (none)
  25140. ===================================================================
  25141. File: file1-2 Status: Up-to-date
  25142. Working revision: 1\.2.*
  25143. Repository revision: 1\.2 ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25144. Sticky Tag: (none)
  25145. Sticky Date: (none)
  25146. Sticky Options: (none)
  25147. Existing Tags:
  25148. cattle (revision: 1\.2)
  25149. ${PROG} status: Examining mod1-2
  25150. ${PROG} status: Examining mod1-2/mod2-2
  25151. ===================================================================
  25152. File: anotherfile2-2 Status: Locally Added
  25153. Working revision: New file!
  25154. Repository revision: No revision control file
  25155. Sticky Tag: (none)
  25156. Sticky Date: (none)
  25157. Sticky Options: (none)
  25158. ===================================================================
  25159. File: file2-2 Status: Up-to-date
  25160. Working revision: 1\.2.*
  25161. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25162. Sticky Tag: (none)
  25163. Sticky Date: (none)
  25164. Sticky Options: (none)
  25165. Existing Tags:
  25166. cattle (revision: 1\.2)
  25167. ${PROG} status: Examining mod2-1
  25168. ===================================================================
  25169. File: anotherfile2-1 Status: Locally Added
  25170. Working revision: New file!
  25171. Repository revision: No revision control file
  25172. Sticky Tag: (none)
  25173. Sticky Date: (none)
  25174. Sticky Options: (none)
  25175. ===================================================================
  25176. File: file2-1 Status: Up-to-date
  25177. Working revision: 1\.2.*
  25178. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
  25179. Sticky Tag: (none)
  25180. Sticky Date: (none)
  25181. Sticky Options: (none)
  25182. Existing Tags:
  25183. cattle (revision: 1\.2)
  25184. ${PROG} status: Examining mod2-2
  25185. ===================================================================
  25186. File: file2-2 Status: Up-to-date
  25187. Working revision: 1\.2.*
  25188. Repository revision: 1\.2 ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25189. Sticky Tag: (none)
  25190. Sticky Date: (none)
  25191. Sticky Options: (none)
  25192. Existing Tags:
  25193. cattle (revision: 1\.2)"
  25194. dotest multiroot-commit-2 "${testcvs} commit -m reading" \
  25195. "${PROG} [a-z]*: Examining \.
  25196. ${PROG} [a-z]*: Examining mod1-1
  25197. ${PROG} [a-z]*: Examining mod1-2
  25198. ${PROG} [a-z]*: Examining mod2-2/mod1-2
  25199. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
  25200. done
  25201. Checking in mod1-1/anotherfile1-1;
  25202. ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v <-- anotherfile1-1
  25203. initial revision: 1\.1
  25204. done
  25205. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
  25206. done
  25207. Checking in mod2-2/mod1-2/anotherfile1-2;
  25208. ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v <-- anotherfile1-2
  25209. initial revision: 1\.1
  25210. done
  25211. ${PROG} [a-z]*: Examining mod1-2/mod2-2
  25212. ${PROG} [a-z]*: Examining mod2-1
  25213. ${PROG} [a-z]*: Examining mod2-2
  25214. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
  25215. done
  25216. Checking in mod1-2/mod2-2/anotherfile2-2;
  25217. ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v <-- anotherfile2-2
  25218. initial revision: 1\.1
  25219. done
  25220. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
  25221. done
  25222. Checking in mod2-1/anotherfile2-1;
  25223. ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v <-- anotherfile2-1
  25224. initial revision: 1\.1
  25225. done"
  25226. dotest multiroot-update-3 "${testcvs} update" \
  25227. "${PROG} update: Updating \.
  25228. ${PROG} [a-z]*: Updating mod1-1
  25229. ${PROG} [a-z]*: Updating mod1-2
  25230. U mod1-2/anotherfile1-2
  25231. ${PROG} [a-z]*: Updating mod2-2/mod1-2
  25232. ${PROG} [a-z]*: Updating mod1-2/mod2-2
  25233. ${PROG} [a-z]*: Updating mod2-1
  25234. ${PROG} [a-z]*: Updating mod2-2
  25235. U mod2-2/anotherfile2-2" \
  25236. "${PROG} update: Updating \.
  25237. ${PROG} update: Updating mod1-1
  25238. ${PROG} update: Updating mod1-2
  25239. U mod1-2/anotherfile1-2
  25240. ${PROG} update: Updating mod2-2
  25241. ${PROG} update: Updating mod2-2/mod1-2
  25242. ${PROG} update: Updating mod1-2
  25243. ${PROG} update: Updating mod1-2/mod2-2
  25244. ${PROG} update: Updating mod2-1
  25245. ${PROG} update: Updating mod2-2
  25246. U mod2-2/anotherfile2-2"
  25247. dotest multiroot-log-1 "${testcvs} log" \
  25248. "${PROG} log: Logging \.
  25249. ${PROG} log: Logging mod1-1
  25250. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
  25251. Working file: mod1-1/anotherfile1-1
  25252. head: 1\.1
  25253. branch:
  25254. locks: strict
  25255. access list:
  25256. symbolic names:
  25257. keyword substitution: kv
  25258. total revisions: 1; selected revisions: 1
  25259. description:
  25260. ----------------------------
  25261. revision 1\.1
  25262. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25263. reading
  25264. =============================================================================
  25265. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
  25266. Working file: mod1-1/file1-1
  25267. head: 1\.2
  25268. branch:
  25269. locks: strict
  25270. access list:
  25271. symbolic names:
  25272. cattle: 1\.2
  25273. keyword substitution: kv
  25274. total revisions: 2; selected revisions: 2
  25275. description:
  25276. ----------------------------
  25277. revision 1\.2
  25278. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25279. actually
  25280. ----------------------------
  25281. revision 1\.1
  25282. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25283. is
  25284. =============================================================================
  25285. ${PROG} log: Logging mod1-2
  25286. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
  25287. Working file: mod1-2/anotherfile1-2
  25288. head: 1\.1
  25289. branch:
  25290. locks: strict
  25291. access list:
  25292. symbolic names:
  25293. keyword substitution: kv
  25294. total revisions: 1; selected revisions: 1
  25295. description:
  25296. ----------------------------
  25297. revision 1\.1
  25298. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25299. reading
  25300. =============================================================================
  25301. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25302. Working file: mod1-2/file1-2
  25303. head: 1\.2
  25304. branch:
  25305. locks: strict
  25306. access list:
  25307. symbolic names:
  25308. cattle: 1\.2
  25309. keyword substitution: kv
  25310. total revisions: 2; selected revisions: 2
  25311. description:
  25312. ----------------------------
  25313. revision 1\.2
  25314. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25315. actually
  25316. ----------------------------
  25317. revision 1\.1
  25318. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25319. is
  25320. =============================================================================
  25321. ${PROG} log: Logging mod2-2/mod1-2
  25322. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
  25323. Working file: mod2-2/mod1-2/anotherfile1-2
  25324. head: 1\.1
  25325. branch:
  25326. locks: strict
  25327. access list:
  25328. symbolic names:
  25329. keyword substitution: kv
  25330. total revisions: 1; selected revisions: 1
  25331. description:
  25332. ----------------------------
  25333. revision 1\.1
  25334. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25335. reading
  25336. =============================================================================
  25337. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25338. Working file: mod2-2/mod1-2/file1-2
  25339. head: 1\.2
  25340. branch:
  25341. locks: strict
  25342. access list:
  25343. symbolic names:
  25344. cattle: 1\.2
  25345. keyword substitution: kv
  25346. total revisions: 2; selected revisions: 2
  25347. description:
  25348. ----------------------------
  25349. revision 1\.2
  25350. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25351. actually
  25352. ----------------------------
  25353. revision 1\.1
  25354. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25355. is
  25356. =============================================================================
  25357. ${PROG} log: Logging mod1-2/mod2-2
  25358. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
  25359. Working file: mod1-2/mod2-2/anotherfile2-2
  25360. head: 1\.1
  25361. branch:
  25362. locks: strict
  25363. access list:
  25364. symbolic names:
  25365. keyword substitution: kv
  25366. total revisions: 1; selected revisions: 1
  25367. description:
  25368. ----------------------------
  25369. revision 1\.1
  25370. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25371. reading
  25372. =============================================================================
  25373. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25374. Working file: mod1-2/mod2-2/file2-2
  25375. head: 1\.2
  25376. branch:
  25377. locks: strict
  25378. access list:
  25379. symbolic names:
  25380. cattle: 1\.2
  25381. keyword substitution: kv
  25382. total revisions: 2; selected revisions: 2
  25383. description:
  25384. ----------------------------
  25385. revision 1\.2
  25386. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25387. actually
  25388. ----------------------------
  25389. revision 1\.1
  25390. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25391. anyone
  25392. =============================================================================
  25393. ${PROG} log: Logging mod2-1
  25394. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
  25395. Working file: mod2-1/anotherfile2-1
  25396. head: 1\.1
  25397. branch:
  25398. locks: strict
  25399. access list:
  25400. symbolic names:
  25401. keyword substitution: kv
  25402. total revisions: 1; selected revisions: 1
  25403. description:
  25404. ----------------------------
  25405. revision 1\.1
  25406. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25407. reading
  25408. =============================================================================
  25409. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
  25410. Working file: mod2-1/file2-1
  25411. head: 1\.2
  25412. branch:
  25413. locks: strict
  25414. access list:
  25415. symbolic names:
  25416. cattle: 1\.2
  25417. keyword substitution: kv
  25418. total revisions: 2; selected revisions: 2
  25419. description:
  25420. ----------------------------
  25421. revision 1\.2
  25422. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25423. actually
  25424. ----------------------------
  25425. revision 1\.1
  25426. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25427. anyone
  25428. =============================================================================
  25429. ${PROG} log: Logging mod2-2
  25430. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
  25431. Working file: mod2-2/anotherfile2-2
  25432. head: 1\.1
  25433. branch:
  25434. locks: strict
  25435. access list:
  25436. symbolic names:
  25437. keyword substitution: kv
  25438. total revisions: 1; selected revisions: 1
  25439. description:
  25440. ----------------------------
  25441. revision 1\.1
  25442. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25443. reading
  25444. =============================================================================
  25445. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25446. Working file: mod2-2/file2-2
  25447. head: 1\.2
  25448. branch:
  25449. locks: strict
  25450. access list:
  25451. symbolic names:
  25452. cattle: 1\.2
  25453. keyword substitution: kv
  25454. total revisions: 2; selected revisions: 2
  25455. description:
  25456. ----------------------------
  25457. revision 1\.2
  25458. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25459. actually
  25460. ----------------------------
  25461. revision 1\.1
  25462. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25463. anyone
  25464. =============================================================================" \
  25465. "${PROG} log: Logging \.
  25466. ${PROG} log: Logging mod1-1
  25467. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/anotherfile1-1,v
  25468. Working file: mod1-1/anotherfile1-1
  25469. head: 1\.1
  25470. branch:
  25471. locks: strict
  25472. access list:
  25473. symbolic names:
  25474. keyword substitution: kv
  25475. total revisions: 1; selected revisions: 1
  25476. description:
  25477. ----------------------------
  25478. revision 1\.1
  25479. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25480. reading
  25481. =============================================================================
  25482. RCS file: ${CVSROOT1_DIRNAME}/mod1-1/file1-1,v
  25483. Working file: mod1-1/file1-1
  25484. head: 1\.2
  25485. branch:
  25486. locks: strict
  25487. access list:
  25488. symbolic names:
  25489. cattle: 1\.2
  25490. keyword substitution: kv
  25491. total revisions: 2; selected revisions: 2
  25492. description:
  25493. ----------------------------
  25494. revision 1\.2
  25495. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25496. actually
  25497. ----------------------------
  25498. revision 1\.1
  25499. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25500. is
  25501. =============================================================================
  25502. ${PROG} log: Logging mod1-2
  25503. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
  25504. Working file: mod1-2/anotherfile1-2
  25505. head: 1\.1
  25506. branch:
  25507. locks: strict
  25508. access list:
  25509. symbolic names:
  25510. keyword substitution: kv
  25511. total revisions: 1; selected revisions: 1
  25512. description:
  25513. ----------------------------
  25514. revision 1\.1
  25515. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25516. reading
  25517. =============================================================================
  25518. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25519. Working file: mod1-2/file1-2
  25520. head: 1\.2
  25521. branch:
  25522. locks: strict
  25523. access list:
  25524. symbolic names:
  25525. cattle: 1\.2
  25526. keyword substitution: kv
  25527. total revisions: 2; selected revisions: 2
  25528. description:
  25529. ----------------------------
  25530. revision 1\.2
  25531. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25532. actually
  25533. ----------------------------
  25534. revision 1\.1
  25535. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25536. is
  25537. =============================================================================
  25538. ${PROG} log: Logging mod2-2
  25539. ${PROG} log: Logging mod2-2/mod1-2
  25540. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/anotherfile1-2,v
  25541. Working file: mod2-2/mod1-2/anotherfile1-2
  25542. head: 1\.1
  25543. branch:
  25544. locks: strict
  25545. access list:
  25546. symbolic names:
  25547. keyword substitution: kv
  25548. total revisions: 1; selected revisions: 1
  25549. description:
  25550. ----------------------------
  25551. revision 1\.1
  25552. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25553. reading
  25554. =============================================================================
  25555. RCS file: ${CVSROOT1_DIRNAME}/mod1-2/file1-2,v
  25556. Working file: mod2-2/mod1-2/file1-2
  25557. head: 1\.2
  25558. branch:
  25559. locks: strict
  25560. access list:
  25561. symbolic names:
  25562. cattle: 1\.2
  25563. keyword substitution: kv
  25564. total revisions: 2; selected revisions: 2
  25565. description:
  25566. ----------------------------
  25567. revision 1\.2
  25568. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25569. actually
  25570. ----------------------------
  25571. revision 1\.1
  25572. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25573. is
  25574. =============================================================================
  25575. ${PROG} log: Logging mod1-2
  25576. ${PROG} log: Logging mod1-2/mod2-2
  25577. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
  25578. Working file: mod1-2/mod2-2/anotherfile2-2
  25579. head: 1\.1
  25580. branch:
  25581. locks: strict
  25582. access list:
  25583. symbolic names:
  25584. keyword substitution: kv
  25585. total revisions: 1; selected revisions: 1
  25586. description:
  25587. ----------------------------
  25588. revision 1\.1
  25589. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25590. reading
  25591. =============================================================================
  25592. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25593. Working file: mod1-2/mod2-2/file2-2
  25594. head: 1\.2
  25595. branch:
  25596. locks: strict
  25597. access list:
  25598. symbolic names:
  25599. cattle: 1\.2
  25600. keyword substitution: kv
  25601. total revisions: 2; selected revisions: 2
  25602. description:
  25603. ----------------------------
  25604. revision 1\.2
  25605. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25606. actually
  25607. ----------------------------
  25608. revision 1\.1
  25609. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25610. anyone
  25611. =============================================================================
  25612. ${PROG} log: Logging mod2-1
  25613. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/anotherfile2-1,v
  25614. Working file: mod2-1/anotherfile2-1
  25615. head: 1\.1
  25616. branch:
  25617. locks: strict
  25618. access list:
  25619. symbolic names:
  25620. keyword substitution: kv
  25621. total revisions: 1; selected revisions: 1
  25622. description:
  25623. ----------------------------
  25624. revision 1\.1
  25625. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25626. reading
  25627. =============================================================================
  25628. RCS file: ${CVSROOT2_DIRNAME}/mod2-1/file2-1,v
  25629. Working file: mod2-1/file2-1
  25630. head: 1\.2
  25631. branch:
  25632. locks: strict
  25633. access list:
  25634. symbolic names:
  25635. cattle: 1\.2
  25636. keyword substitution: kv
  25637. total revisions: 2; selected revisions: 2
  25638. description:
  25639. ----------------------------
  25640. revision 1\.2
  25641. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25642. actually
  25643. ----------------------------
  25644. revision 1\.1
  25645. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25646. anyone
  25647. =============================================================================
  25648. ${PROG} log: Logging mod2-2
  25649. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/anotherfile2-2,v
  25650. Working file: mod2-2/anotherfile2-2
  25651. head: 1\.1
  25652. branch:
  25653. locks: strict
  25654. access list:
  25655. symbolic names:
  25656. keyword substitution: kv
  25657. total revisions: 1; selected revisions: 1
  25658. description:
  25659. ----------------------------
  25660. revision 1\.1
  25661. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25662. reading
  25663. =============================================================================
  25664. RCS file: ${CVSROOT2_DIRNAME}/mod2-2/file2-2,v
  25665. Working file: mod2-2/file2-2
  25666. head: 1\.2
  25667. branch:
  25668. locks: strict
  25669. access list:
  25670. symbolic names:
  25671. cattle: 1\.2
  25672. keyword substitution: kv
  25673. total revisions: 2; selected revisions: 2
  25674. description:
  25675. ----------------------------
  25676. revision 1\.2
  25677. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
  25678. actually
  25679. ----------------------------
  25680. revision 1\.1
  25681. date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
  25682. anyone
  25683. ============================================================================="
  25684. # After the simple cases, let's execute some commands which
  25685. # refer to parts of our checked-out tree (e.g. "cvs update
  25686. # mod1-1 mod2-2")
  25687. if $keep; then
  25688. echo Keeping ${TESTDIR} and exiting due to --keep
  25689. exit 0
  25690. fi
  25691. # clean up after ourselves
  25692. cd ..
  25693. rm -r 1
  25694. # clean up our repositories
  25695. rm -rf root1 root2
  25696. ;;
  25697. multiroot2)
  25698. # More multiroot tests. In particular, nested directories.
  25699. CVSROOT1_DIRNAME=${TESTDIR}/root1
  25700. CVSROOT2_DIRNAME=${TESTDIR}/root2
  25701. CVSROOT1=`newroot $CVSROOT1_DIRNAME`
  25702. CVSROOT2=`newroot $CVSROOT2_DIRNAME`
  25703. dotest multiroot2-1 "$testcvs -d$CVSROOT1_DIRNAME init"
  25704. dotest multiroot2-2 "$testcvs -d$CVSROOT2_DIRNAME init"
  25705. mkdir imp-dir; cd imp-dir
  25706. echo file1 >file1
  25707. mkdir sdir
  25708. echo sfile >sdir/sfile
  25709. mkdir sdir/ssdir
  25710. echo ssfile >sdir/ssdir/ssfile
  25711. dotest_sort multiroot2-3 \
  25712. "${testcvs} -d ${CVSROOT1} import -m import-to-root1 dir1 vend rel" "
  25713. N dir1/file1
  25714. N dir1/sdir/sfile
  25715. N dir1/sdir/ssdir/ssfile
  25716. No conflicts created by this import
  25717. ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir
  25718. ${PROG} import: Importing ${TESTDIR}/root1/dir1/sdir/ssdir"
  25719. cd sdir
  25720. dotest_sort multiroot2-4 \
  25721. "${testcvs} -d ${CVSROOT2} import -m import-to-root2 sdir vend2 rel2" "
  25722. N sdir/sfile
  25723. N sdir/ssdir/ssfile
  25724. No conflicts created by this import
  25725. ${PROG} import: Importing ${TESTDIR}/root2/sdir/ssdir"
  25726. cd ../..
  25727. mkdir 1; cd 1
  25728. # Get TopLevelAdmin-like behavior.
  25729. dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co -l ."
  25730. dotest multiroot2-5 "${testcvs} -d ${CVSROOT1} -q co dir1" \
  25731. "U dir1/file1
  25732. U dir1/sdir/sfile
  25733. U dir1/sdir/ssdir/ssfile"
  25734. cd dir1
  25735. dotest multiroot2-6 "${testcvs} -Q release -d sdir" ""
  25736. dotest multiroot2-7 "${testcvs} -d ${CVSROOT2} -q co sdir" \
  25737. "U sdir/sfile
  25738. U sdir/ssdir/ssfile"
  25739. cd ..
  25740. # This has one subtle effect - it deals with Entries.Log
  25741. # so that the next test doesn't get trace messages for
  25742. # Entries.Log
  25743. dotest multiroot2-8 "${testcvs} update" \
  25744. "${PROG} update: Updating \.
  25745. ${PROG} update: Updating dir1
  25746. ${PROG} update: Updating dir1/sdir
  25747. ${PROG} update: Updating dir1/sdir/ssdir" \
  25748. "${PROG} update: Updating \.
  25749. ${PROG} update: Updating dir1
  25750. ${PROG} update: Updating dir1
  25751. ${PROG} update: Updating dir1/sdir
  25752. ${PROG} update: Updating dir1/sdir/ssdir"
  25753. # Two reasons we don't run this on the server: (1) the server
  25754. # also prints some trace messages, and (2) the server trace
  25755. # messages are subject to out-of-order bugs (this one is hard
  25756. # to work around).
  25757. if $remote; then :; else
  25758. dotest multiroot2-9a "${testcvs} -t update" \
  25759. " *-> main loop with CVSROOT=${TESTDIR}/root1
  25760. ${PROG} update: Updating \.
  25761. *-> Reader_Lock(${TESTDIR}/root1)
  25762. *-> Lock_Cleanup()
  25763. ${PROG} update: Updating dir1
  25764. *-> Reader_Lock(${TESTDIR}/root1/dir1)
  25765. *-> Lock_Cleanup()
  25766. *-> main loop with CVSROOT=${TESTDIR}/root2
  25767. ${PROG} update: Updating dir1/sdir
  25768. *-> Reader_Lock(${TESTDIR}/root2/sdir)
  25769. *-> Lock_Cleanup()
  25770. ${PROG} update: Updating dir1/sdir/ssdir
  25771. *-> Reader_Lock(${TESTDIR}/root2/sdir/ssdir)
  25772. *-> Lock_Cleanup()
  25773. *-> Lock_Cleanup()"
  25774. fi
  25775. dotest multiroot2-9 "${testcvs} -q tag tag1" \
  25776. "T dir1/file1
  25777. T dir1/sdir/sfile
  25778. T dir1/sdir/ssdir/ssfile"
  25779. echo "change it" >>dir1/file1
  25780. echo "change him too" >>dir1/sdir/sfile
  25781. dotest multiroot2-10 "${testcvs} -q ci -m modify" \
  25782. "Checking in dir1/file1;
  25783. ${TESTDIR}/root1/dir1/file1,v <-- file1
  25784. new revision: 1\.2; previous revision: 1\.1
  25785. done
  25786. Checking in dir1/sdir/sfile;
  25787. ${TESTDIR}/root2/sdir/sfile,v <-- sfile
  25788. new revision: 1\.2; previous revision: 1\.1
  25789. done"
  25790. dotest multiroot2-11 "${testcvs} -q tag tag2" \
  25791. "T dir1/file1
  25792. T dir1/sdir/sfile
  25793. T dir1/sdir/ssdir/ssfile"
  25794. dotest_fail multiroot2-12 \
  25795. "${testcvs} -q diff -u -r tag1 -r tag2" \
  25796. "Index: dir1/file1
  25797. ===================================================================
  25798. RCS file: ${TESTDIR}/root1/dir1/file1,v
  25799. retrieving revision 1\.1\.1\.1
  25800. retrieving revision 1\.2
  25801. diff -u -r1\.1\.1\.1 -r1\.2
  25802. --- dir1/file1 ${RFCDATE} 1\.1\.1\.1
  25803. ${PLUS}${PLUS}${PLUS} dir1/file1 ${RFCDATE} 1\.2
  25804. @@ -1 ${PLUS}1,2 @@
  25805. file1
  25806. ${PLUS}change it
  25807. Index: dir1/sdir/sfile
  25808. ===================================================================
  25809. RCS file: ${TESTDIR}/root2/sdir/sfile,v
  25810. retrieving revision 1\.1\.1\.1
  25811. retrieving revision 1\.2
  25812. diff -u -r1\.1\.1\.1 -r1\.2
  25813. --- dir1/sdir/sfile ${RFCDATE} 1\.1\.1\.1
  25814. ${PLUS}${PLUS}${PLUS} dir1/sdir/sfile ${RFCDATE} 1\.2
  25815. @@ -1 ${PLUS}1,2 @@
  25816. sfile
  25817. ${PLUS}change him too"
  25818. if $keep; then
  25819. echo Keeping ${TESTDIR} and exiting due to --keep
  25820. exit 0
  25821. fi
  25822. # clean up after ourselves
  25823. cd ..
  25824. rm -r imp-dir 1
  25825. # clean up our repositories
  25826. rm -rf root1 root2
  25827. ;;
  25828. multiroot3)
  25829. # More multiroot tests. Directories are side-by-side, not nested.
  25830. # Not drastically different from multiroot but it covers somewhat
  25831. # different stuff.
  25832. CVSROOT1=`newroot ${TESTDIR}/root1`
  25833. CVSROOT2=`newroot ${TESTDIR}/root2`
  25834. mkdir 1; cd 1
  25835. dotest multiroot3-1 "$testcvs -d$TESTDIR/root1 init"
  25836. dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
  25837. mkdir dir1
  25838. dotest multiroot3-3 "${testcvs} add dir1" \
  25839. "Directory ${TESTDIR}/root1/dir1 added to the repository"
  25840. dotest multiroot3-4 "$testcvs -d$TESTDIR/root2 init"
  25841. rm -r CVS
  25842. dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
  25843. mkdir dir2
  25844. # OK, the problem is that CVS/Entries doesn't look quite right,
  25845. # I suppose because of the "rm -r".
  25846. # For local this fixes it up.
  25847. dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
  25848. if $remote; then
  25849. # For remote that doesn't do it. Use the quick and dirty fix.
  25850. echo "D/dir1////" >CVS/Entries
  25851. echo "D/dir2////" >>CVS/Entries
  25852. fi
  25853. dotest multiroot3-7 "${testcvs} add dir2" \
  25854. "Directory ${TESTDIR}/root2/dir2 added to the repository"
  25855. touch dir1/file1 dir2/file2
  25856. if $remote; then
  25857. # Trying to add them both in one command doesn't work,
  25858. # because add.c doesn't do multiroot (it doesn't use recurse.c).
  25859. # Furthermore, it can't deal with the parent directory
  25860. # having a different root from the child, hence the cd.
  25861. cd dir1
  25862. dotest multiroot3-8 "${testcvs} add file1" \
  25863. "${PROG} add: scheduling file .file1. for addition
  25864. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25865. cd ..
  25866. dotest multiroot3-8a "${testcvs} add dir2/file2" \
  25867. "${PROG} add: scheduling file .dir2/file2. for addition
  25868. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25869. else
  25870. dotest multiroot3-8 "${testcvs} add dir1/file1 dir2/file2" \
  25871. "${PROG} add: scheduling file .dir1/file1. for addition
  25872. ${PROG} add: scheduling file .dir2/file2. for addition
  25873. ${PROG} add: use .${PROG} commit. to add these files permanently"
  25874. fi
  25875. dotest multiroot3-9 "${testcvs} -q ci -m add-them" \
  25876. "RCS file: ${TESTDIR}/root2/dir2/file2,v
  25877. done
  25878. Checking in dir2/file2;
  25879. ${TESTDIR}/root2/dir2/file2,v <-- file2
  25880. initial revision: 1\.1
  25881. done
  25882. RCS file: ${TESTDIR}/root1/dir1/file1,v
  25883. done
  25884. Checking in dir1/file1;
  25885. ${TESTDIR}/root1/dir1/file1,v <-- file1
  25886. initial revision: 1\.1
  25887. done"
  25888. # That this is an error is good - we are asking CVS to do
  25889. # something which doesn't make sense.
  25890. dotest_fail multiroot3-10 \
  25891. "${testcvs} -q -d ${CVSROOT1} diff dir1/file1 dir2/file2" \
  25892. "${PROG} diff: failed to create lock directory for .${TESTDIR}/root1/dir2' (${TESTDIR}/root1/dir2/#cvs.lock): No such file or directory
  25893. ${PROG} diff: failed to obtain dir lock in repository .${TESTDIR}/root1/dir2'
  25894. ${PROG} \[diff aborted\]: read lock failed - giving up"
  25895. # This one is supposed to work.
  25896. dotest multiroot3-11 "${testcvs} -q diff dir1/file1 dir2/file2" ""
  25897. # make sure we can't access across repositories
  25898. mkdir 1a
  25899. cd 1a
  25900. dotest_fail multiroot3-12 \
  25901. "$testcvs -d $CVSROOT1 -q co ../root2/dir2" \
  25902. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
  25903. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
  25904. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25905. dotest_fail multiroot3-13 \
  25906. "$testcvs -d $CVSROOT2 -q co ../root1/dir1" \
  25907. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\." \
  25908. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root1/dir1'\.
  25909. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25910. dotest_fail multiroot3-14 \
  25911. "$testcvs -d $CVSROOT1 -q co ./../root2/dir2" \
  25912. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\." \
  25913. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root2/dir2'\.
  25914. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25915. dotest_fail multiroot3-15 \
  25916. "$testcvs -d $CVSROOT2 -q co ./../root1/dir1" \
  25917. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
  25918. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
  25919. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25920. dotest_fail multiroot3-16 \
  25921. "$testcvs -d $CVSROOT1 -q co -p ../root2/dir2" \
  25922. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\." \
  25923. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\.\./root2/dir2'\.
  25924. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25925. dotest_fail multiroot3-17 \
  25926. "$testcvs -d $CVSROOT1 -q co -p ./../root1/dir1" \
  25927. "$PROG \[checkout aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\." \
  25928. "$PROG \[server aborted\]: up-level in module reference (\`..') invalid: \`\./\.\./root1/dir1'\.
  25929. $PROG \[checkout aborted\]: end of file from server (consult above messages if any)"
  25930. if $keep; then
  25931. echo Keeping $TESTDIR and exiting due to --keep
  25932. exit 0
  25933. fi
  25934. cd ../..
  25935. rm -r 1
  25936. rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
  25937. unset CVSROOT1
  25938. unset CVSROOT2
  25939. ;;
  25940. multiroot4)
  25941. # More multiroot tests, in particular we have two roots with
  25942. # similarly-named directories and we try to see that CVS can
  25943. # keep them separate.
  25944. CVSROOT1=`newroot ${TESTDIR}/root1`
  25945. CVSROOT2=`newroot ${TESTDIR}/root2`
  25946. mkdir 1; cd 1
  25947. dotest multiroot4-1 "$testcvs -d$TESTDIR/root1 init"
  25948. dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
  25949. mkdir dircom
  25950. dotest multiroot4-3 "${testcvs} add dircom" \
  25951. "Directory ${TESTDIR}/root1/dircom added to the repository"
  25952. cd dircom
  25953. touch file1
  25954. dotest multiroot4-4 "${testcvs} add file1" \
  25955. "${PROG} add: scheduling file .file1. for addition
  25956. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25957. dotest multiroot4-5 "${testcvs} -q ci -m add" \
  25958. "RCS file: ${TESTDIR}/root1/dircom/file1,v
  25959. done
  25960. Checking in file1;
  25961. ${TESTDIR}/root1/dircom/file1,v <-- file1
  25962. initial revision: 1\.1
  25963. done"
  25964. cd ../..
  25965. mkdir 2; cd 2
  25966. dotest multiroot4-6 "$testcvs -d$TESTDIR/root2 init"
  25967. dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
  25968. mkdir dircom
  25969. dotest multiroot4-8 "${testcvs} add dircom" \
  25970. "Directory ${TESTDIR}/root2/dircom added to the repository"
  25971. cd dircom
  25972. touch file2
  25973. dotest multiroot4-9 "${testcvs} add file2" \
  25974. "${PROG} add: scheduling file .file2. for addition
  25975. ${PROG} add: use .${PROG} commit. to add this file permanently"
  25976. dotest multiroot4-10 "${testcvs} -q ci -m add" \
  25977. "RCS file: ${TESTDIR}/root2/dircom/file2,v
  25978. done
  25979. Checking in file2;
  25980. ${TESTDIR}/root2/dircom/file2,v <-- file2
  25981. initial revision: 1\.1
  25982. done"
  25983. cd ../..
  25984. cd 1/dircom
  25985. # This may look contrived; the real world example which inspired
  25986. # it was that a user was changing from local to remote. Cases
  25987. # like switching servers (among those mounting the same
  25988. # repository) and so on would also look the same.
  25989. mkdir sdir2
  25990. dotest multiroot4-11 "${testcvs} -d ${CVSROOT2} add sdir2" \
  25991. "Directory ${TESTDIR}/root2/dircom/sdir2 added to the repository"
  25992. dotest multiroot4-12 "${testcvs} -q update" ""
  25993. cd ..
  25994. dotest multiroot4-13 "${testcvs} -q update dircom" ""
  25995. cd ..
  25996. rm -r 1 2
  25997. rm -rf ${TESTDIR}/root1 ${TESTDIR}/root2
  25998. unset CVSROOT1
  25999. unset CVSROOT2
  26000. ;;
  26001. rmroot)
  26002. # When the Entries/Root file is removed from an existing
  26003. # workspace, CVS should assume $CVSROOT instead
  26004. #
  26005. # Right now only checking that CVS exits normally on an
  26006. # update once CVS/Root is deleted
  26007. #
  26008. # There was a time when this would core dump when run in
  26009. # client/server mode
  26010. mkdir 1; cd 1
  26011. dotest rmroot-setup-1 "${testcvs} -q co -l ." ''
  26012. mkdir first-dir
  26013. dotest rmroot-setup-2 "${testcvs} add first-dir" \
  26014. "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository"
  26015. cd first-dir
  26016. touch file1 file2
  26017. dotest rmroot-setup-3 "${testcvs} add file1 file2" \
  26018. "${PROG} add: scheduling file .file1. for addition
  26019. ${PROG} add: scheduling file .file2. for addition
  26020. ${PROG} add: use .${PROG} commit. to add these files permanently"
  26021. dotest rmroot-setup-4 "${testcvs} -q commit -minit" \
  26022. "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v
  26023. done
  26024. Checking in file1;
  26025. ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1
  26026. initial revision: 1\.1
  26027. done
  26028. RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
  26029. done
  26030. Checking in file2;
  26031. ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2
  26032. initial revision: 1\.1
  26033. done"
  26034. rm CVS/Root
  26035. dotest rmroot-1 "${testcvs} -q update" ''
  26036. cd ../..
  26037. rm -rf 1
  26038. ;;
  26039. reposmv)
  26040. # More tests of repositories and specifying them.
  26041. # Similar to crerepos but that test is probably getting big
  26042. # enough.
  26043. CVSROOT1=`newroot ${TESTDIR}/root1`
  26044. CVSROOT_MOVED=`newroot ${TESTDIR}/root-moved`
  26045. dotest reposmv-setup-1 "$testcvs -d$TESTDIR/root1 init"
  26046. mkdir imp-dir; cd imp-dir
  26047. echo file1 >file1
  26048. dotest reposmv-setup-2 \
  26049. "${testcvs} -d ${CVSROOT1} import -m add dir1 vendor release" \
  26050. "N dir1/file1
  26051. No conflicts created by this import"
  26052. cd ..
  26053. mkdir 1; cd 1
  26054. dotest reposmv-1 "${testcvs} -d ${CVSROOT1} -Q co dir1" ""
  26055. mv ${TESTDIR}/root1 ${TESTDIR}/root-moved
  26056. cd dir1
  26057. # If we didn't have a relative repository, get one now.
  26058. dotest reposmv-1a "cat CVS/Repository" \
  26059. "${TESTDIR}/root1/dir1" "dir1"
  26060. echo dir1 >CVS/Repository
  26061. # There were some duplicated warnings and such; only test
  26062. # for the part of the error message which makes sense.
  26063. # Bug: "skipping directory " without filename.
  26064. if $remote; then
  26065. dotest_fail reposmv-2r "${testcvs} update" \
  26066. "Cannot access ${TESTDIR}/root1/CVSROOT
  26067. No such file or directory"
  26068. else
  26069. dotest reposmv-2 "${testcvs} update" "${DOTSTAR}
  26070. ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
  26071. ${PROG} update: cannot open directory ${CVSROOT_DIRNAME}/dir1: No such file or directory
  26072. ${PROG} update: skipping directory "
  26073. fi
  26074. # CVS/Root overrides $CVSROOT
  26075. if $remote; then
  26076. CVSROOT_save=${CVSROOT}
  26077. CVSROOT=:fork:${TESTDIR}/root-moved; export CVSROOT
  26078. dotest_fail reposmv-3r "${testcvs} update" \
  26079. "Cannot access ${TESTDIR}/root1/CVSROOT
  26080. No such file or directory"
  26081. CVSROOT=${CVSROOT_save}; export CVSROOT
  26082. else
  26083. CVSROOT_save=${CVSROOT}
  26084. CVSROOT=${TESTDIR}/root-moved; export CVSROOT
  26085. dotest reposmv-3 "${testcvs} update" \
  26086. "${DOTSTAR}
  26087. ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
  26088. ${PROG} update: Updating \.
  26089. ${DOTSTAR}"
  26090. CVSROOT=${CVSROOT_save}; export CVSROOT
  26091. fi
  26092. if $remote; then
  26093. CVSROOT_save=${CVSROOT}
  26094. CVSROOT=:fork:${TESTDIR}/root-none; export CVSROOT
  26095. dotest_fail reposmv-4 "${testcvs} update" \
  26096. "Cannot access ${TESTDIR}/root1/CVSROOT
  26097. No such file or directory"
  26098. CVSROOT=${CVSROOT_save}; export CVSROOT
  26099. else
  26100. # CVS/Root doesn't seem to quite completely override $CVSROOT
  26101. # Bug? Not necessarily a big deal if it only affects error
  26102. # messages.
  26103. CVSROOT_save=${CVSROOT}
  26104. CVSROOT=${TESTDIR}/root-none; export CVSROOT
  26105. dotest_fail reposmv-4 "${testcvs} update" \
  26106. "${PROG} update: in directory \.:
  26107. ${PROG} update: ignoring CVS/Root because it specifies a non-existent repository ${TESTDIR}/root1
  26108. ${PROG} \[update aborted\]: ${TESTDIR}/root-none/CVSROOT: No such file or directory"
  26109. CVSROOT=${CVSROOT_save}; export CVSROOT
  26110. fi
  26111. # -d overrides CVS/Root
  26112. #
  26113. # Oddly enough, with CVS 1.10 I think this didn't work for
  26114. # local (that is, it would appear that CVS/Root would not
  26115. # get used, but would produce an error if it didn't exist).
  26116. dotest reposmv-5 "${testcvs} -d ${CVSROOT_MOVED} update" \
  26117. "${PROG} update: Updating \."
  26118. # TODO: could also test various other things, like what if the
  26119. # user removes CVS/Root (which is legit). Or another set of
  26120. # tests would be if both repositories exist but we want to make
  26121. # sure that CVS is using the correct one.
  26122. cd ../..
  26123. rm -r imp-dir 1
  26124. rm -rf root1 root2
  26125. unset CVSROOT1
  26126. ;;
  26127. pserver)
  26128. # Test basic pserver functionality.
  26129. if $remote; then
  26130. # First set SystemAuth=no. Not really necessary, I don't
  26131. # think, but somehow it seems like the clean thing for
  26132. # the testsuite.
  26133. mkdir 1; cd 1
  26134. dotest pserver-1 "${testcvs} -Q co CVSROOT" ""
  26135. cd CVSROOT
  26136. echo "SystemAuth=no" >config
  26137. dotest pserver-2 "${testcvs} -q ci -m config-it" \
  26138. "Checking in config;
  26139. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  26140. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  26141. done
  26142. ${PROG} commit: Rebuilding administrative file database"
  26143. cat >${CVSROOT_DIRNAME}/CVSROOT/passwd <<EOF
  26144. testme:q6WV9d2t848B2:$username
  26145. dontroot:q6WV9d2t848B2:root
  26146. anonymous::$username
  26147. $username:
  26148. willfail: :whocares
  26149. EOF
  26150. dotest_fail pserver-3 "${testcvs} pserver" \
  26151. "error 0 Server configuration missing --allow-root in inetd.conf" <<EOF
  26152. BEGIN AUTH REQUEST
  26153. ${CVSROOT_DIRNAME}
  26154. testme
  26155. Ay::'d
  26156. END AUTH REQUEST
  26157. EOF
  26158. dotest_fail pserver-3a "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26159. "error 0 ${CVSROOT_DIRNAME}XXX: no such repository
  26160. I HATE YOU" <<EOF
  26161. BEGIN AUTH REQUEST
  26162. ${CVSROOT_DIRNAME}XXX
  26163. testme
  26164. Ay::'d
  26165. END AUTH REQUEST
  26166. EOF
  26167. # Confirm that not sending a newline during auth cannot constitute
  26168. # a denial-of-service attack. This assumes that PATH_MAX is less
  26169. # than 65536 bytes. If PATH_MAX is larger than 65535 bytes, this
  26170. # test could hang indefinitely.
  26171. ${AWK} 'BEGIN { printf "0123456789abcdef" }' </dev/null >garbageseg
  26172. echo "BEGIN AUTH REQUEST" >garbageinput
  26173. i=0
  26174. while test $i -lt 64; do
  26175. cat <garbageseg >>garbageseg2
  26176. i=`expr $i + 1`
  26177. done
  26178. i=0
  26179. while test $i -lt 64; do
  26180. cat <garbageseg2 >>garbageinput
  26181. i=`expr $i + 1`
  26182. done
  26183. dotest_fail pserver-auth-no-dos \
  26184. "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26185. "${PROG} \\[pserver aborted\\]: Maximum line length exceeded during authentication\." <garbageinput
  26186. unset i
  26187. rm garbageseg garbageseg2 garbageinput
  26188. # Sending the Root and noop before waiting for the
  26189. # "I LOVE YOU" is bogus, but hopefully we can get
  26190. # away with it.
  26191. dotest pserver-4 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26192. "${DOTSTAR} LOVE YOU
  26193. ok" <<EOF
  26194. BEGIN AUTH REQUEST
  26195. ${CVSROOT_DIRNAME}
  26196. testme
  26197. Ay::'d
  26198. END AUTH REQUEST
  26199. Root ${CVSROOT_DIRNAME}
  26200. noop
  26201. EOF
  26202. # The "no such system user" error is occurring on at least one of
  26203. # our BSD 2.0.2 nightly test platforms.
  26204. dotest_fail pserver-4.2 \
  26205. "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26206. "error 0: root not allowed" \
  26207. "E Fatal error, aborting\.
  26208. error 0 root: no such system user" <<EOF
  26209. BEGIN AUTH REQUEST
  26210. ${CVSROOT_DIRNAME}
  26211. dontroot
  26212. Ay::'d
  26213. END AUTH REQUEST
  26214. EOF
  26215. dotest pserver-5 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26216. "${DOTSTAR} LOVE YOU
  26217. E Protocol error: Root says \"${TESTDIR}/1\" but pserver says \"${CVSROOT_DIRNAME}\"
  26218. error " <<EOF
  26219. BEGIN AUTH REQUEST
  26220. ${CVSROOT_DIRNAME}
  26221. testme
  26222. Ay::'d
  26223. END AUTH REQUEST
  26224. Root ${TESTDIR}/1
  26225. noop
  26226. EOF
  26227. dotest pserver-5a "$testcvs --allow-root=$CVSROOT_DIRNAME pserver" \
  26228. "$DOTSTAR LOVE YOU
  26229. E init may not be run remotely
  26230. error " <<EOF
  26231. BEGIN AUTH REQUEST
  26232. $CVSROOT_DIRNAME
  26233. testme
  26234. Ay::'d
  26235. END AUTH REQUEST
  26236. init $TESTDIR/2
  26237. EOF
  26238. dotest_fail pserver-5b "test -d $TESTDIR/2"
  26239. dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26240. "I HATE YOU" <<EOF
  26241. BEGIN AUTH REQUEST
  26242. ${CVSROOT_DIRNAME}
  26243. testme
  26244. Ay::'d^b?hd
  26245. END AUTH REQUEST
  26246. EOF
  26247. dotest_fail pserver-7 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26248. "I HATE YOU" <<EOF
  26249. BEGIN VERIFICATION REQUEST
  26250. ${CVSROOT_DIRNAME}
  26251. testme
  26252. Ay::'d^b?hd
  26253. END VERIFICATION REQUEST
  26254. EOF
  26255. dotest pserver-8 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26256. "${DOTSTAR} LOVE YOU" <<EOF
  26257. BEGIN VERIFICATION REQUEST
  26258. ${CVSROOT_DIRNAME}
  26259. testme
  26260. Ay::'d
  26261. END VERIFICATION REQUEST
  26262. EOF
  26263. # Tests pserver-9 through pserver-13 are about empty passwords
  26264. # Test empty password (both sides) for aliased user
  26265. dotest pserver-9 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26266. "${DOTSTAR} LOVE YOU" <<EOF
  26267. BEGIN AUTH REQUEST
  26268. ${CVSROOT_DIRNAME}
  26269. anonymous
  26270. A
  26271. END AUTH REQUEST
  26272. EOF
  26273. # Test empty password (server side only) for aliased user
  26274. dotest pserver-10 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26275. "${DOTSTAR} LOVE YOU" <<EOF
  26276. BEGIN AUTH REQUEST
  26277. ${CVSROOT_DIRNAME}
  26278. anonymous
  26279. Aanythingwouldworkhereittrulydoesnotmatter
  26280. END AUTH REQUEST
  26281. EOF
  26282. # Test empty (both sides) password for non-aliased user
  26283. dotest pserver-11 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26284. "${DOTSTAR} LOVE YOU" <<EOF
  26285. BEGIN AUTH REQUEST
  26286. ${CVSROOT_DIRNAME}
  26287. ${username}
  26288. A
  26289. END AUTH REQUEST
  26290. EOF
  26291. # Test empty (server side only) password for non-aliased user
  26292. dotest pserver-12 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26293. "${DOTSTAR} LOVE YOU" <<EOF
  26294. BEGIN AUTH REQUEST
  26295. ${CVSROOT_DIRNAME}
  26296. ${username}
  26297. Anypasswordwouldworkwhynotthisonethen
  26298. END AUTH REQUEST
  26299. EOF
  26300. # Test failure of whitespace password
  26301. dotest_fail pserver-13 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26302. "${DOTSTAR} HATE YOU" <<EOF
  26303. BEGIN AUTH REQUEST
  26304. ${CVSROOT_DIRNAME}
  26305. willfail
  26306. Amquiteunabletocomeupwithinterestingpasswordsanymore
  26307. END AUTH REQUEST
  26308. EOF
  26309. # The following tests are for read-only access
  26310. # Check that readers can only read, everyone else can write
  26311. cat >${CVSROOT_DIRNAME}/CVSROOT/readers <<EOF
  26312. anonymous
  26313. EOF
  26314. dotest pserver-14 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26315. "${DOTSTAR} LOVE YOU
  26316. M Concurrent Versions System (CVS) .*
  26317. ok" <<EOF
  26318. BEGIN AUTH REQUEST
  26319. ${CVSROOT_DIRNAME}
  26320. anonymous
  26321. Ay::'d
  26322. END AUTH REQUEST
  26323. Root ${CVSROOT_DIRNAME}
  26324. version
  26325. EOF
  26326. dotest pserver-16 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26327. "${DOTSTAR} LOVE YOU
  26328. M Concurrent Versions System (CVS) .*
  26329. ok" <<EOF
  26330. BEGIN AUTH REQUEST
  26331. ${CVSROOT_DIRNAME}
  26332. testme
  26333. Ay::'d
  26334. END AUTH REQUEST
  26335. Root ${CVSROOT_DIRNAME}
  26336. version
  26337. EOF
  26338. dotest pserver-18 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26339. "${DOTSTAR} LOVE YOU
  26340. M Concurrent Versions System (CVS) .*
  26341. ok" <<EOF
  26342. BEGIN AUTH REQUEST
  26343. ${CVSROOT_DIRNAME}
  26344. ${username}
  26345. Ay::'d
  26346. END AUTH REQUEST
  26347. Root ${CVSROOT_DIRNAME}
  26348. version
  26349. EOF
  26350. # Check that writers can write, everyone else can only read
  26351. # even if not listed in readers
  26352. cat >${CVSROOT_DIRNAME}/CVSROOT/writers <<EOF
  26353. testme
  26354. EOF
  26355. dotest pserver-20 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26356. "${DOTSTAR} LOVE YOU
  26357. M Concurrent Versions System (CVS) .*
  26358. ok" <<EOF
  26359. BEGIN AUTH REQUEST
  26360. ${CVSROOT_DIRNAME}
  26361. anonymous
  26362. Ay::'d
  26363. END AUTH REQUEST
  26364. Root ${CVSROOT_DIRNAME}
  26365. version
  26366. EOF
  26367. dotest pserver-22 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26368. "${DOTSTAR} LOVE YOU
  26369. M Concurrent Versions System (CVS) .*
  26370. ok" <<EOF
  26371. BEGIN AUTH REQUEST
  26372. ${CVSROOT_DIRNAME}
  26373. testme
  26374. Ay::'d
  26375. END AUTH REQUEST
  26376. Root ${CVSROOT_DIRNAME}
  26377. version
  26378. EOF
  26379. dotest pserver-24 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26380. "${DOTSTAR} LOVE YOU
  26381. M Concurrent Versions System (CVS) .*
  26382. ok" <<EOF
  26383. BEGIN AUTH REQUEST
  26384. ${CVSROOT_DIRNAME}
  26385. ${username}
  26386. Ay::'d
  26387. END AUTH REQUEST
  26388. Root ${CVSROOT_DIRNAME}
  26389. version
  26390. EOF
  26391. # Should work the same without readers
  26392. rm ${CVSROOT_DIRNAME}/CVSROOT/readers
  26393. dotest pserver-26 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26394. "${DOTSTAR} LOVE YOU
  26395. M Concurrent Versions System (CVS) .*
  26396. ok" <<EOF
  26397. BEGIN AUTH REQUEST
  26398. ${CVSROOT_DIRNAME}
  26399. anonymous
  26400. Ay::'d
  26401. END AUTH REQUEST
  26402. Root ${CVSROOT_DIRNAME}
  26403. version
  26404. EOF
  26405. dotest pserver-28 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26406. "${DOTSTAR} LOVE YOU
  26407. M Concurrent Versions System (CVS) .*
  26408. ok" <<EOF
  26409. BEGIN AUTH REQUEST
  26410. ${CVSROOT_DIRNAME}
  26411. testme
  26412. Ay::'d
  26413. END AUTH REQUEST
  26414. Root ${CVSROOT_DIRNAME}
  26415. version
  26416. EOF
  26417. dotest pserver-30 "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \
  26418. "${DOTSTAR} LOVE YOU
  26419. M Concurrent Versions System (CVS) .*
  26420. ok" <<EOF
  26421. BEGIN AUTH REQUEST
  26422. ${CVSROOT_DIRNAME}
  26423. ${username}
  26424. Ay::'d
  26425. END AUTH REQUEST
  26426. Root ${CVSROOT_DIRNAME}
  26427. version
  26428. EOF
  26429. # pserver used to try and print from the NULL pointer
  26430. # in this error message in this case
  26431. dotest_fail pserver-bufinit "${testcvs} pserver" \
  26432. "${PROG} \[pserver aborted\]: bad auth protocol start: EOF" </dev/null
  26433. # Clean up.
  26434. echo "# comments only" >config
  26435. dotest pserver-cleanup-1 "${testcvs} -q ci -m config-it" \
  26436. "Checking in config;
  26437. ${CVSROOT_DIRNAME}/CVSROOT/config,v <-- config
  26438. new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
  26439. done
  26440. ${PROG} commit: Rebuilding administrative file database"
  26441. cd ../..
  26442. rm -r 1
  26443. rm ${CVSROOT_DIRNAME}/CVSROOT/passwd ${CVSROOT_DIRNAME}/CVSROOT/writers
  26444. fi # skip the whole thing for local
  26445. ;;
  26446. server)
  26447. # Some tests of the server (independent of the client).
  26448. if $remote; then
  26449. dotest server-1 "${testcvs} server" \
  26450. "E Protocol error: Root request missing
  26451. error " <<EOF
  26452. Directory bogus
  26453. mumble/bar
  26454. update
  26455. EOF
  26456. # Could also test for relative pathnames here (so that crerepos-6a
  26457. # and crerepos-6b can use :fork:).
  26458. dotest server-2 "$testcvs server" \
  26459. "E init may not be run remotely
  26460. error " <<EOF
  26461. Set OTHER=variable
  26462. Set MYENV=env-value
  26463. init ${TESTDIR}/crerepos
  26464. EOF
  26465. dotest_fail server-3 "test -d $TESTDIR/crerepos/CVSROOT"
  26466. dotest server-3a "$testcvs -d$TESTDIR/crerepos init"
  26467. # Now some tests of gzip-file-contents (used by jCVS).
  26468. ${AWK} 'BEGIN { \
  26469. printf "%c%c%c%c%c%c.6%c%c+I-.%c%c%c%c5%c;%c%c%c%c", \
  26470. 31, 139, 8, 64, 5, 7, 64, 3, 225, 2, 64, 198, 185, 5, 64, 64, 64}' \
  26471. </dev/null | ${TR} '\100' '\000' >gzipped.dat
  26472. # Note that the CVS client sends "-b 1.1.1", and this
  26473. # test doesn't. But the server also defaults to that.
  26474. cat <<EOF >session.dat
  26475. Root ${TESTDIR}/crerepos
  26476. UseUnchanged
  26477. gzip-file-contents 3
  26478. Argument -m
  26479. Argument msg
  26480. Argumentx
  26481. Argument dir1
  26482. Argument tag1
  26483. Argument tag2
  26484. Directory .
  26485. ${TESTDIR}/crerepos
  26486. Modified file1
  26487. u=rw,g=r,o=r
  26488. z25
  26489. EOF
  26490. cat gzipped.dat >>session.dat
  26491. echo import >>session.dat
  26492. dotest server-4 "${testcvs} server" \
  26493. "M N dir1/file1
  26494. M
  26495. M No conflicts created by this import
  26496. M
  26497. ok" <session.dat
  26498. dotest server-5 \
  26499. "${testcvs} -q -d ${TESTDIR}/crerepos co -p dir1/file1" "test"
  26500. # OK, here are some notify tests.
  26501. dotest server-6 "${testcvs} server" \
  26502. "Notified \./
  26503. ${TESTDIR}/crerepos/dir1/file1
  26504. ok" <<EOF
  26505. Root ${TESTDIR}/crerepos
  26506. Directory .
  26507. ${TESTDIR}/crerepos/dir1
  26508. Notify file1
  26509. E Fri May 7 13:21:09 1999 GMT myhost some-work-dir EUC
  26510. noop
  26511. EOF
  26512. # Sending the second "noop" before waiting for the output
  26513. # from the first is bogus but hopefully we can get away
  26514. # with it.
  26515. dotest server-7 "${testcvs} server" \
  26516. "Notified \./
  26517. ${TESTDIR}/crerepos/dir1/file1
  26518. ok
  26519. Notified \./
  26520. ${TESTDIR}/crerepos/dir1/file1
  26521. ok" <<EOF
  26522. Root ${TESTDIR}/crerepos
  26523. Directory .
  26524. ${TESTDIR}/crerepos/dir1
  26525. Notify file1
  26526. E Fri May 7 13:21:09 1999 GMT myhost some-work-dir EUC
  26527. noop
  26528. Notify file1
  26529. E The 57th day of Discord in the YOLD 3165 myhost some-work-dir EUC
  26530. noop
  26531. EOF
  26532. # OK, now test a few error conditions.
  26533. # FIXCVS: should give "error" and no "Notified", like server-9
  26534. dotest server-8 "${testcvs} server" \
  26535. "E ${PROG} server: invalid character in editor value
  26536. Notified \./
  26537. ${TESTDIR}/crerepos/dir1/file1
  26538. ok" <<EOF
  26539. Root ${TESTDIR}/crerepos
  26540. Directory .
  26541. ${TESTDIR}/crerepos/dir1
  26542. Notify file1
  26543. E Setting Orange, the 52th day of Discord in the YOLD 3165 myhost some-work-dir EUC
  26544. noop
  26545. EOF
  26546. dotest server-9 "${testcvs} server" \
  26547. "E Protocol error; misformed Notify request
  26548. error " <<EOF
  26549. Root ${TESTDIR}/crerepos
  26550. Directory .
  26551. ${TESTDIR}/crerepos/dir1
  26552. Notify file1
  26553. E Setting Orange+57th day of Discord myhost some-work-dir EUC
  26554. noop
  26555. EOF
  26556. # First demonstrate an interesting quirk in the protocol.
  26557. # The "watchers" request selects the files to operate based
  26558. # on files which exist in the working directory. So if we
  26559. # don't send "Entry" or the like, it won't do anything.
  26560. # Wants to be documented in cvsclient.texi...
  26561. dotest server-10 "${testcvs} server" "ok" <<EOF
  26562. Root ${TESTDIR}/crerepos
  26563. Directory .
  26564. ${TESTDIR}/crerepos/dir1
  26565. watchers
  26566. EOF
  26567. # See if "watchers" and "editors" display the right thing.
  26568. dotest server-11 "${testcvs} server" \
  26569. "M file1 ${username} tedit tunedit tcommit
  26570. ok" <<EOF
  26571. Root ${TESTDIR}/crerepos
  26572. Directory .
  26573. ${TESTDIR}/crerepos/dir1
  26574. Entry /file1/1.1////
  26575. watchers
  26576. EOF
  26577. dotest server-12 "${testcvs} server" \
  26578. "M file1 ${username} The 57th day of Discord in the YOLD 3165 myhost some-work-dir
  26579. ok" <<EOF
  26580. Root ${TESTDIR}/crerepos
  26581. Directory .
  26582. ${TESTDIR}/crerepos/dir1
  26583. Entry /file1/1.1////
  26584. editors
  26585. EOF
  26586. # Now do an unedit.
  26587. dotest server-13 "${testcvs} server" \
  26588. "Notified \./
  26589. ${TESTDIR}/crerepos/dir1/file1
  26590. ok" <<EOF
  26591. Root ${TESTDIR}/crerepos
  26592. Directory .
  26593. ${TESTDIR}/crerepos/dir1
  26594. Notify file1
  26595. U 7 May 1999 15:00 GMT myhost some-work-dir EUC
  26596. noop
  26597. EOF
  26598. # Now try "watchers" and "editors" again.
  26599. dotest server-14 "${testcvs} server" "ok" <<EOF
  26600. Root ${TESTDIR}/crerepos
  26601. Directory .
  26602. ${TESTDIR}/crerepos/dir1
  26603. watchers
  26604. EOF
  26605. dotest server-15 "${testcvs} server" "ok" <<EOF
  26606. Root ${TESTDIR}/crerepos
  26607. Directory .
  26608. ${TESTDIR}/crerepos/dir1
  26609. editors
  26610. EOF
  26611. # Test that the global `-l' option is ignored nonfatally.
  26612. dotest server-16 "${testcvs} server" \
  26613. "E cvs server: WARNING: global \`-l' option ignored\.
  26614. ok" <<EOF
  26615. Global_option -l
  26616. noop
  26617. EOF
  26618. # There used to be some exploits based on malformed Entry requests
  26619. dotest server-17 "$testcvs server" \
  26620. "E protocol error: Malformed Entry
  26621. error " <<EOF
  26622. Root $TESTDIR/crerepos
  26623. Directory .
  26624. $TESTDIR/crerepos/dir1
  26625. Entry X/file1/1.1////
  26626. noop
  26627. EOF
  26628. dotest server-18 "$testcvs server" \
  26629. "E protocol error: Malformed Entry
  26630. error " <<EOF
  26631. Root $TESTDIR/crerepos
  26632. Directory .
  26633. $TESTDIR/crerepos/dir1
  26634. Entry /CC/CC/CC
  26635. noop
  26636. EOF
  26637. if $keep; then
  26638. echo Keeping ${TESTDIR} and exiting due to --keep
  26639. exit 0
  26640. fi
  26641. rm -rf ${TESTDIR}/crerepos
  26642. rm gzipped.dat session.dat
  26643. fi # skip the whole thing for local
  26644. ;;
  26645. server2)
  26646. # More server tests, in particular testing that various
  26647. # possible security holes are plugged.
  26648. if $remote; then
  26649. dotest server2-1 "${testcvs} server" \
  26650. "E protocol error: directory '${CVSROOT_DIRNAME}/\.\./dir1' not within root '${CVSROOT_DIRNAME}'
  26651. error " <<EOF
  26652. Root ${CVSROOT_DIRNAME}
  26653. Directory .
  26654. ${CVSROOT_DIRNAME}/../dir1
  26655. noop
  26656. EOF
  26657. dotest server2-2 "${testcvs} server" \
  26658. "E protocol error: directory '${CVSROOT_DIRNAME}dir1' not within root '${CVSROOT_DIRNAME}'
  26659. error " <<EOF
  26660. Root ${CVSROOT_DIRNAME}
  26661. Directory .
  26662. ${CVSROOT_DIRNAME}dir1
  26663. noop
  26664. EOF
  26665. dotest server2-3 "${testcvs} server" \
  26666. "E protocol error: directory '${TESTDIR}' not within root '${CVSROOT_DIRNAME}'
  26667. error " <<EOF
  26668. Root ${CVSROOT_DIRNAME}
  26669. Directory .
  26670. ${TESTDIR}
  26671. noop
  26672. EOF
  26673. # OK, now a few tests for the rule that one cannot pass a
  26674. # filename containing a slash to Modified, Is-modified,
  26675. # Notify, Questionable, or Unchanged. For completeness
  26676. # we'd try them all. For lazyness/conciseness we don't.
  26677. dotest server2-4 "${testcvs} server" \
  26678. "E protocol error: directory 'foo/bar' not within current directory
  26679. error " <<EOF
  26680. Root ${CVSROOT_DIRNAME}
  26681. Directory .
  26682. ${CVSROOT_DIRNAME}
  26683. Unchanged foo/bar
  26684. noop
  26685. EOF
  26686. dotest server2-5 \
  26687. "$testcvs --allow-root=$CVSROOT_DIRNAME.bad server" \
  26688. "E Bad root $CVSROOT_DIRNAME
  26689. error " <<EOF
  26690. Root $CVSROOT_DIRNAME
  26691. noop
  26692. EOF
  26693. dotest server2-6 \
  26694. "$testcvs --allow-root=$CVSROOT_DIRNAME server" \
  26695. "ok" <<EOF
  26696. Root $CVSROOT_DIRNAME
  26697. noop
  26698. EOF
  26699. fi
  26700. ;;
  26701. server3)
  26702. # Test that various checks on the Root request generate the correct
  26703. # error messages.
  26704. if $remote; then
  26705. # As a control, a valid request.
  26706. dotest server3-1 "$testcvs server" 'ok' <<EOF
  26707. Root $CVSROOT_DIRNAME
  26708. Directory .
  26709. $CVSROOT_DIRNAME
  26710. Unchanged foo
  26711. noop
  26712. EOF
  26713. dotest server3-2 "$testcvs server" \
  26714. "E Root somewhere/over/the/rainbow must be an absolute pathname
  26715. error " <<EOF
  26716. Root somewhere/over/the/rainbow
  26717. noop
  26718. EOF
  26719. dotest server3-3 "$testcvs server" \
  26720. "E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
  26721. error " <<EOF
  26722. Root $CVSROOT_DIRNAME
  26723. Root $CVSROOT_DIRNAME
  26724. noop
  26725. EOF
  26726. dotest server3-4 "$testcvs server" \
  26727. "E Protocol error: Duplicate Root request, for $CVSROOT_DIRNAME
  26728. error " <<EOF
  26729. Root $CVSROOT_DIRNAME
  26730. Root $CVSROOT_DIRNAME
  26731. Directory .
  26732. $CVSROOT_DIRNAME
  26733. Unchanged foo
  26734. noop
  26735. EOF
  26736. # These cascading errors seem odd, but the client should have hung
  26737. # up after the first.
  26738. dotest server3-5 "$testcvs server" \
  26739. "E Root somewhere/over/the/rainbow must be an absolute pathname
  26740. error
  26741. E Protocol error: Root request missing
  26742. error " <<EOF
  26743. Root somewhere/over/the/rainbow
  26744. Directory .
  26745. somewhere/over/the/rainbow
  26746. Unchanged foo
  26747. noop
  26748. EOF
  26749. fi
  26750. ;;
  26751. client)
  26752. # Some tests of the client (independent of the server).
  26753. if $remote; then
  26754. cat >${TESTDIR}/serveme <<EOF
  26755. #!${TESTSHELL}
  26756. # This is admittedly a bit cheezy, in the sense that we make lots
  26757. # of assumptions about what the client is going to send us.
  26758. # We don't mention Repository, because current clients don't require it.
  26759. # Sending these at our own pace, rather than waiting for the client to
  26760. # make the requests, is bogus, but hopefully we can get away with it.
  26761. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26762. echo "ok"
  26763. echo "M special message"
  26764. echo "Created first-dir/"
  26765. echo "${CVSROOT_DIRNAME}/first-dir/file1"
  26766. echo "/file1/1.1///"
  26767. echo "u=rw,g=rw,o=rw"
  26768. echo "4"
  26769. echo "xyz"
  26770. echo "ok"
  26771. cat >/dev/null
  26772. EOF
  26773. # Cygwin. Pthffffffffft!
  26774. if test -n "$remotehost"; then
  26775. $CVS_RSH $remotehost "chmod +x ${TESTDIR}/serveme"
  26776. else
  26777. chmod +x ${TESTDIR}/serveme
  26778. fi
  26779. save_CVS_SERVER=$CVS_SERVER
  26780. CVS_SERVER=${TESTDIR}/serveme; export CVS_SERVER
  26781. mkdir 1; cd 1
  26782. dotest_fail client-1 "${testcvs} -q co first-dir" \
  26783. "${PROG} \[checkout aborted\]: This server does not support the global -q option${DOTSTAR}"
  26784. dotest client-2 "${testcvs} co first-dir" "special message"
  26785. cat >${TESTDIR}/serveme <<EOF
  26786. #!${TESTSHELL}
  26787. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26788. echo "ok"
  26789. echo "M merge-it"
  26790. echo "Copy-file ./"
  26791. echo "${CVSROOT_DIRNAME}/first-dir/file1"
  26792. echo "${TESTDIR}/bogus/.#file1.1.1"
  26793. echo "Merged ./"
  26794. echo "${CVSROOT_DIRNAME}/first-dir/file1"
  26795. echo "/file1/1.2///"
  26796. echo "u=rw,g=rw,o=rw"
  26797. echo "4"
  26798. echo "abd"
  26799. echo "ok"
  26800. cat >/dev/null
  26801. EOF
  26802. cd first-dir
  26803. mkdir ${TESTDIR}/bogus
  26804. # The ${DOTSTAR} is to match a potential "broken pipe" if the
  26805. # client exits before the server script sends everything
  26806. dotest_fail client-3 "${testcvs} update" "merge-it
  26807. ${PROG} \[update aborted\]: protocol error: Copy-file tried to specify director${DOTSTAR}"
  26808. cat >${TESTDIR}/serveme <<EOF
  26809. #!${TESTSHELL}
  26810. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26811. echo "ok"
  26812. echo "M merge-it"
  26813. echo "Copy-file ./"
  26814. echo "${CVSROOT_DIRNAME}/first-dir/file1"
  26815. echo ".#file1.1.1"
  26816. echo "Merged ./"
  26817. echo "${CVSROOT_DIRNAME}/first-dir/file1"
  26818. echo "/file1/1.2///"
  26819. echo "u=rw,g=rw,o=rw"
  26820. echo "4"
  26821. echo "abc"
  26822. echo "ok"
  26823. cat >/dev/null
  26824. EOF
  26825. dotest client-4 "${testcvs} update" "merge-it"
  26826. dotest client-5 "cat .#file1.1.1" "xyz"
  26827. dotest client-6 "cat CVS/Entries" "/file1/1.2/[A-Za-z0-9 :]*//
  26828. D"
  26829. dotest client-7 "cat file1" "abc"
  26830. cat >${TESTDIR}/serveme <<EOF
  26831. #!${TESTSHELL}
  26832. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26833. echo "ok"
  26834. echo "M OK, whatever"
  26835. echo "ok"
  26836. cat >${TESTDIR}/client.tmp
  26837. EOF
  26838. chmod u=rw,go= file1
  26839. # By specifying the time zone in local time, we don't
  26840. # know exactly how that will translate to GMT.
  26841. dotest client-8 "${testcvs} update -D 99-10-04" "OK, whatever"
  26842. # String 2 below is Cygwin again - ptoooey.
  26843. dotest client-9 "cat ${TESTDIR}/client.tmp" \
  26844. "Root ${CVSROOT_DIRNAME}
  26845. Valid-responses [-a-zA-Z ]*
  26846. valid-requests
  26847. Argument -D
  26848. Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
  26849. Argument --
  26850. Directory \.
  26851. ${CVSROOT_DIRNAME}/first-dir
  26852. Entry /file1/1\.2///
  26853. Modified file1
  26854. u=rw,g=,o=
  26855. 4
  26856. abc
  26857. update" \
  26858. "Root ${CVSROOT_DIRNAME}
  26859. Valid-responses [-a-zA-Z ]*
  26860. valid-requests
  26861. Argument -D
  26862. Argument [34] Oct 1999 [0-9][0-9]:00:00 -0000
  26863. Argument --
  26864. Directory \.
  26865. ${CVSROOT_DIRNAME}/first-dir
  26866. Entry /file1/1\.2///
  26867. Modified file1
  26868. u=rw,g=r,o=r
  26869. 4
  26870. abc
  26871. update"
  26872. # The following test tests what was a potential client update in
  26873. # CVS versions 1.11.14 and CVS versions 1.12.6 and earlier. This
  26874. # exploit would allow a trojan server to create arbitrary files,
  26875. # anywhere the user had write permissions, even outside of the
  26876. # user's sandbox.
  26877. cat >$HOME/.bashrc <<EOF
  26878. #!$TESTSHELL
  26879. # This is where login scripts would usually be
  26880. # stored.
  26881. EOF
  26882. cat >$TESTDIR/serveme <<EOF
  26883. #!$TESTSHELL
  26884. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26885. echo "ok"
  26886. echo "Rcs-diff $HOME/"
  26887. echo "$HOME/.bashrc"
  26888. echo "/.bashrc/73.50///"
  26889. echo "u=rw,g=rw,o=rw"
  26890. echo "20"
  26891. echo "a1 1"
  26892. echo "echo 'gotcha!'"
  26893. echo "ok"
  26894. cat >/dev/null
  26895. EOF
  26896. # If I don't run the following sleep between the above cat and
  26897. # the following calls to dotest, sometimes the serveme file isn't
  26898. # completely written yet by the time CVS tries to execute it,
  26899. # causing the shell to intermittantly report syntax errors (usually
  26900. # early EOF). There's probably a new race condition here, but this
  26901. # works.
  26902. #
  26903. # Incidentally, I can reproduce this behavior with Linux 2.4.20 and
  26904. # Bash 2.05 or Bash 2.05b.
  26905. sleep 1
  26906. dotest_fail client-10 "$testcvs update" \
  26907. "$PROG update: Server attempted to update a file via an invalid pathname:
  26908. $PROG \[update aborted\]: \`$HOME/.bashrc'\."
  26909. # A second try at a client exploit. This one never actually
  26910. # failed in the past, but I thought it wouldn't hurt to add a test.
  26911. cat >$TESTDIR/serveme <<EOF
  26912. #!$TESTSHELL
  26913. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26914. echo "ok"
  26915. echo "Rcs-diff ./"
  26916. echo "$HOME/.bashrc"
  26917. echo "/.bashrc/73.50///"
  26918. echo "u=rw,g=rw,o=rw"
  26919. echo "20"
  26920. echo "a1 1"
  26921. echo "echo 'gotcha!'"
  26922. echo "ok"
  26923. cat >/dev/null
  26924. EOF
  26925. sleep 1
  26926. dotest_fail client-11 "$testcvs update" \
  26927. "$PROG \[update aborted\]: patch original file \./\.bashrc does not exist"
  26928. # A third try at a client exploit. This one did used to fail like
  26929. # client-10.
  26930. cat >$TESTDIR/serveme <<EOF
  26931. #!$TESTSHELL
  26932. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26933. echo "ok"
  26934. echo "Rcs-diff ../../home/"
  26935. echo "../../.bashrc"
  26936. echo "/.bashrc/73.50///"
  26937. echo "u=rw,g=rw,o=rw"
  26938. echo "20"
  26939. echo "a1 1"
  26940. echo "echo 'gotcha!'"
  26941. echo "ok"
  26942. cat >/dev/null
  26943. EOF
  26944. sleep 1
  26945. dotest_fail client-12 "$testcvs update" \
  26946. "$PROG update: Server attempted to update a file via an invalid pathname:
  26947. $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
  26948. # Try the same exploit using the Created response.
  26949. cat >$TESTDIR/serveme <<EOF
  26950. #!$TESTSHELL
  26951. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26952. echo "ok"
  26953. echo "Created $HOME/"
  26954. echo "$HOME/.bashrc"
  26955. echo "/.bashrc/73.50///"
  26956. echo "u=rw,g=rw,o=rw"
  26957. echo "26"
  26958. echo "#! /bin/sh"
  26959. echo "echo 'gotcha!'"
  26960. echo "ok"
  26961. cat >/dev/null
  26962. EOF
  26963. sleep 1
  26964. dotest_fail client-13 "$testcvs update" \
  26965. "$PROG update: Server attempted to update a file via an invalid pathname:
  26966. $PROG \[update aborted\]: \`$HOME/.bashrc'\."
  26967. # Now try using the Update-existing response
  26968. cat >$TESTDIR/serveme <<EOF
  26969. #!$TESTSHELL
  26970. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26971. echo "ok"
  26972. echo "Update-existing ../../home/"
  26973. echo "../../home/.bashrc"
  26974. echo "/.bashrc/73.50///"
  26975. echo "u=rw,g=rw,o=rw"
  26976. echo "26"
  26977. echo "#! /bin/sh"
  26978. echo "echo 'gotcha!'"
  26979. echo "ok"
  26980. cat >/dev/null
  26981. EOF
  26982. sleep 1
  26983. dotest_fail client-14 "$testcvs update" \
  26984. "$PROG update: Server attempted to update a file via an invalid pathname:
  26985. $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
  26986. # Try the same exploit using the Merged response.
  26987. cat >$TESTDIR/serveme <<EOF
  26988. #!$TESTSHELL
  26989. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  26990. echo "ok"
  26991. echo "Merged $HOME/"
  26992. echo "$HOME/.bashrc"
  26993. echo "/.bashrc/73.50///"
  26994. echo "u=rw,g=rw,o=rw"
  26995. echo "26"
  26996. echo "#! /bin/sh"
  26997. echo "echo 'gotcha!'"
  26998. echo "ok"
  26999. cat >/dev/null
  27000. EOF
  27001. sleep 1
  27002. dotest_fail client-15 "$testcvs update" \
  27003. "$PROG update: Server attempted to update a file via an invalid pathname:
  27004. $PROG \[update aborted\]: \`$HOME/.bashrc'\."
  27005. # Now try using the Updated response
  27006. cat >$TESTDIR/serveme <<EOF
  27007. #!$TESTSHELL
  27008. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  27009. echo "ok"
  27010. echo "Updated ../../home/"
  27011. echo "../../home/.bashrc"
  27012. echo "/.bashrc/73.50///"
  27013. echo "u=rw,g=rw,o=rw"
  27014. echo "26"
  27015. echo "#! /bin/sh"
  27016. echo "echo 'gotcha!'"
  27017. echo "ok"
  27018. cat >/dev/null
  27019. EOF
  27020. sleep 1
  27021. dotest_fail client-16 "$testcvs update" \
  27022. "$PROG update: Server attempted to update a file via an invalid pathname:
  27023. $PROG \[update aborted\]: \`\.\./\.\./home/.bashrc'\."
  27024. # Try the same exploit using the Copy-file response.
  27025. # As far as I know, Copy-file was never exploitable either.
  27026. cat >$TESTDIR/serveme <<EOF
  27027. #!$TESTSHELL
  27028. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  27029. echo "ok"
  27030. echo "Created ."
  27031. echo "./innocuous"
  27032. echo "/innocuous/73.50///"
  27033. echo "u=rw,g=rw,o=rw"
  27034. echo "26"
  27035. echo "#! /bin/sh"
  27036. echo "echo 'gotcha!'"
  27037. echo "Copy-file ."
  27038. echo "./innocuous"
  27039. echo "$HOME/innocuous"
  27040. echo "ok"
  27041. cat >/dev/null
  27042. EOF
  27043. sleep 1
  27044. dotest_fail client-18 "$testcvs update" \
  27045. "$PROG \[update aborted\]: protocol error: Copy-file tried to specify directory"
  27046. # And verify that none of the exploits was successful.
  27047. dotest client-19 "cat $HOME/.bashrc" \
  27048. "#!$TESTSHELL
  27049. # This is where login scripts would usually be
  27050. # stored\."
  27051. if $keep; then
  27052. echo Keeping ${TESTDIR} and exiting due to --keep
  27053. exit 0
  27054. fi
  27055. cd ../..
  27056. rm -r 1
  27057. rmdir ${TESTDIR}/bogus
  27058. rm $TESTDIR/serveme $HOME/.bashrc
  27059. CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
  27060. fi # skip the whole thing for local
  27061. ;;
  27062. client2)
  27063. # Test how the client handles error messages from the server.
  27064. if $remote; then
  27065. cat >$TESTDIR/serveme <<EOF
  27066. #!$TESTSHELL
  27067. # This is just as cheesy as the "client" tests made it out to be.
  27068. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  27069. echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
  27070. echo "error "
  27071. echo "E Protocol error: Root request missing"
  27072. echo "error "
  27073. cat >/dev/null
  27074. EOF
  27075. # Cygwin. Pthffffffffft!
  27076. if test -n "$remotehost"; then
  27077. $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
  27078. else
  27079. chmod +x $TESTDIR/serveme
  27080. fi
  27081. save_CVS_SERVER=$CVS_SERVER
  27082. CVS_SERVER=$TESTDIR/serveme; export CVS_SERVER
  27083. mkdir client2; cd client2
  27084. dotest_fail client2-1 "$testcvs co first-dir" \
  27085. "Root somewhere/over/the/rainbow must be an absolute pathname"
  27086. cat >$TESTDIR/serveme <<EOF
  27087. #!$TESTSHELL
  27088. # This is just as cheesy as the "client" tests made it out to be.
  27089. echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update"
  27090. echo "E Root somewhere/over/the/rainbow must be an absolute pathname"
  27091. echo
  27092. echo "error "
  27093. echo "E Protocol error: Root request missing"
  27094. echo "error "
  27095. cat >/dev/null
  27096. EOF
  27097. # Cygwin. Pthffffffffft!
  27098. if test -n "$remotehost"; then
  27099. $CVS_RSH $remotehost "chmod +x $TESTDIR/serveme"
  27100. else
  27101. chmod +x $TESTDIR/serveme
  27102. fi
  27103. dotest_fail client2-2 "$testcvs co first-dir" \
  27104. "Root somewhere/over/the/rainbow must be an absolute pathname
  27105. $PROG checkout: warning: unrecognized response \`' from cvs server"
  27106. if $keep; then
  27107. echo Keeping $TESTDIR and exiting due to --keep
  27108. exit 0
  27109. fi
  27110. cd ..
  27111. rm -r client2
  27112. rm $TESTDIR/serveme
  27113. CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER
  27114. fi # skip the whole thing for local
  27115. ;;
  27116. dottedroot)
  27117. # Check that a CVSROOT with a "." in the name will work.
  27118. CVSROOT_save=${CVSROOT}
  27119. CVSROOT_DIRNAME_save=${CVSROOT_DIRNAME}
  27120. CVSROOT_DIRNAME=${TESTDIR}/cvs.root
  27121. CVSROOT=`newroot ${CVSROOT_DIRNAME}`
  27122. dotest dottedroot-init-1 "$testcvs -d$CVSROOT_DIRNAME init"
  27123. mkdir dir1
  27124. mkdir dir1/dir2
  27125. echo version1 >dir1/dir2/file1
  27126. cd dir1
  27127. dotest dottedroot-1 "${testcvs} import -m '' module1 AUTHOR INITIAL" \
  27128. "${PROG} [a-z]*: Importing ${CVSROOT_DIRNAME}/module1/dir2
  27129. N module1/dir2/file1
  27130. No conflicts created by this import"
  27131. cd ..
  27132. # This is the test that used to cause an assertion failure
  27133. # in recurse.c:do_recursion().
  27134. dotest dottedroot-2 "${testcvs} co -rINITIAL module1" \
  27135. "${PROG} [a-z]*: Updating module1
  27136. ${PROG} [a-z]*: Updating module1/dir2
  27137. U module1/dir2/file1"
  27138. # This also triggered the assertion failure above prior to 1.11.23.
  27139. dotest dottedroot-3 \
  27140. "$testcvs -q co -prINITIAL module1/./dir2/file1" \
  27141. 'version1'
  27142. if $keep; then
  27143. echo Keeping $TESTDIR and exiting due to --keep
  27144. exit 0
  27145. fi
  27146. rm -rf ${CVSROOT_DIRNAME}
  27147. rm -r dir1 module1
  27148. CVSROOT_DIRNAME=${CVSROOT_DIRNAME_save}
  27149. CVSROOT=${CVSROOT_save}
  27150. ;;
  27151. fork)
  27152. # Test that the server defaults to the correct executable in :fork:
  27153. # mode. See the note in the TODO at the end of this file about this.
  27154. #
  27155. # This test and client should be left after all other references to
  27156. # CVS_SERVER are removed from this script.
  27157. #
  27158. # The client series of tests already tests that CVS_SERVER is
  27159. # working, but that test might be better here.
  27160. if $remote; then
  27161. mkdir fork; cd fork
  27162. save_CVS_SERVER=$CVS_SERVER
  27163. unset CVS_SERVER
  27164. # So looking through $PATH for cvs won't work...
  27165. echo "echo junk" >cvs
  27166. chmod a+x cvs
  27167. save_PATH=$PATH; PATH=.:$PATH
  27168. dotest fork-1 "$testcvs -d:fork:$CVSROOT_DIRNAME version" \
  27169. 'Client: \(.*\)
  27170. Server: \1'
  27171. CVS_SERVER=${save_CVS_SERVER}; export CVS_SERVER
  27172. unset save_CVS_SERVER
  27173. PATH=$save_PATH; unset save_PATH
  27174. cd ..
  27175. if $keep; then
  27176. echo Keeping ${TESTDIR} and exiting due to --keep
  27177. exit 0
  27178. fi
  27179. fi
  27180. ;;
  27181. commit-add-missing)
  27182. # Make sure that a commit fails when a `cvs add'ed file has
  27183. # been removed from the working directory.
  27184. mkdir 1; cd 1
  27185. module=c-a-m
  27186. echo > unused-file
  27187. dotest commit-add-missing-1 \
  27188. "$testcvs -Q import -m. $module X Y" ''
  27189. file=F
  27190. # Check it out and tag it.
  27191. dotest commit-add-missing-2 "$testcvs -Q co $module" ''
  27192. cd $module
  27193. dotest commit-add-missing-3 "$testcvs -Q tag -b B" ''
  27194. echo v1 > $file
  27195. dotest commit-add-missing-4 "$testcvs -Q add $file" ''
  27196. rm -f $file
  27197. dotest_fail commit-add-missing-5 "$testcvs -Q ci -m. $file" \
  27198. "${PROG} commit: Up-to-date check failed for .$file'
  27199. ${PROG} \[commit aborted\]: correct above errors first!"
  27200. cd ../..
  27201. rm -rf 1
  27202. rm -rf ${CVSROOT_DIRNAME}/$module
  27203. ;;
  27204. add-restricted)
  27205. # Verify that `sdir/CVS' may not be explicitly added.
  27206. mkdir add-restricted; cd add-restricted
  27207. mkdir import; cd import
  27208. : > junk
  27209. dotest add-restricted-init-1 \
  27210. "$testcvs -Q import -m. add-restricted X Y"
  27211. cd ..
  27212. dotest add-restricted-init-2 "$testcvs -Q co add-restricted"
  27213. cd add-restricted
  27214. # errmsg2-3 tests the specific message here.
  27215. dotest_fail add-restricted-1 "$testcvs -Q add CVS"
  27216. mkdir sdir
  27217. dotest add-restricted-2 "$testcvs -Q add sdir"
  27218. dotest_fail add-restricted-3 "$testcvs add sdir/CVS" \
  27219. "$PROG add: cannot add special file \`sdir/CVS'; skipping"
  27220. if $keep; then
  27221. echo Keeping $TESTDIR and exiting due to --keep
  27222. exit 0
  27223. fi
  27224. cd ../..
  27225. rm -rf add-restricted $CVSROOT_DIRNAME/add-restricted
  27226. ;;
  27227. commit-d)
  27228. # Check that top-level commits work when CVS/Root
  27229. # is overridden by cvs -d.
  27230. mkdir -p 1/subdir; cd 1
  27231. touch file1 subdir/file2
  27232. dotest commit-d-1 "$testcvs -Q import -m. c-d-c X Y" ""
  27233. dotest commit-d-2 "$testcvs -Q co c-d-c" ""
  27234. cd c-d-c
  27235. echo change >>file1; echo another change >>subdir/file2
  27236. # Changing working root, then override with -d
  27237. echo nosuchhost:/cvs > CVS/Root
  27238. dotest commit-d-3 "$testcvs -Q -d $CVSROOT commit -m." \
  27239. "Checking in file1;
  27240. ${CVSROOT_DIRNAME}/c-d-c/file1,v <-- file1
  27241. new revision: 1.2; previous revision: 1.1
  27242. done
  27243. Checking in subdir/file2;
  27244. ${CVSROOT_DIRNAME}/c-d-c/subdir/file2,v <-- file2
  27245. new revision: 1.2; previous revision: 1.1
  27246. done"
  27247. cd ../..
  27248. rm -rf 1 cvsroot/c-d-c
  27249. ;;
  27250. *)
  27251. echo $what is not the name of a test -- ignored
  27252. ;;
  27253. esac
  27254. # Sanity check sanity.sh. :)
  27255. #
  27256. # Test our exit directory so that tests that exit in an incorrect directory
  27257. # are noticed during single test runs.
  27258. #
  27259. # FIXME?
  27260. # Sparc Solaris 9 is dereferencing paths here as if /bin/pwd were
  27261. # called when /tmp is a symlink. This might be a new problem with this
  27262. # test, but since this was recently tested I think it more likely to be
  27263. # A Solaris issue.
  27264. if test "x$TESTDIR" != "x`pwd`"; then
  27265. fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')"
  27266. fi
  27267. # Reset val-tags to a pristine state.
  27268. rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags
  27269. verify_tmp_empty "post $what"
  27270. done # The big loop
  27271. # Set up summary data for output.
  27272. skippedoutput=
  27273. warningsoutput=
  27274. extendedinfo=
  27275. if test $skipped -ne 0; then
  27276. skippedoutput="$skipped test group"
  27277. if test $skipped -ne 1; then
  27278. skippedoutput="${skippedoutput}s"
  27279. fi
  27280. skippedoutput="$skippedoutput skipped"
  27281. fi
  27282. if test $warnings -ne 0; then
  27283. warningsoutput="$warnings test"
  27284. if test $warnings -ne 1; then
  27285. warningsoutput="${warningsoutput}s"
  27286. fi
  27287. warningsoutput="$warningsoutput passed with warnings"
  27288. fi
  27289. if test -n "$skippedoutput" || test -n "$warningsoutput"; then
  27290. extendedinfo=" ("
  27291. if test -n "$skippedoutput"; then
  27292. extendedinfo="$extendedinfo$skippedoutput"
  27293. fi
  27294. if test -n "$skippedoutput" && test -n "$warningsoutput"; then
  27295. extendedinfo="$extendedinfo and "
  27296. fi
  27297. if test -n "$warningsoutput"; then
  27298. extendedinfo="$extendedinfo$warningsoutput"
  27299. fi
  27300. extendedinfo="$extendedinfo)"
  27301. fi
  27302. echo "OK, all $passed tests passed$extendedinfo."
  27303. # TODO:
  27304. # * Test `cvs update -d foo' (where foo does not exist).
  27305. # * Test `cvs update foo bar' (where foo and bar are both from the
  27306. # same directory in the repository). Suppose one is a branch--make
  27307. # sure that both directories get updated with the respective correct
  27308. # thing.
  27309. # * `cvs update ../foo'. Also ../../foo ./../foo foo/../../bar /foo/bar
  27310. # foo/.././../bar foo/../bar etc.
  27311. # * Test all flags in modules file.
  27312. # Test that ciprog gets run both on checkin in that directory, or a
  27313. # higher-level checkin which recurses into it.
  27314. # * Test operations on a directory that contains other directories but has
  27315. # no files of its own.
  27316. # * -t global option
  27317. # * cvs rm followed by cvs add or vice versa (with no checkin in between).
  27318. # * cvs rm twice (should be a nice error message).
  27319. # * -P option to checkout--(a) refrains from checking out new empty dirs,
  27320. # (b) prunes empty dirs already there.
  27321. # * Test that cvs -d `hostname`:${TESTDIR}/non/existent co foo
  27322. # gives an appropriate error (e.g.
  27323. # Cannot access ${TESTDIR}/non-existent/CVSROOT
  27324. # No such file or directory).
  27325. # (like basica-9, but for remote).
  27326. # * Test ability to send notifications in response to watches. (currently
  27327. # hard to test because CVS doesn't send notifications if username is the
  27328. # same).
  27329. # * Test the contents of adm files other than Root and Repository.
  27330. # Entries seems the next most important thing.
  27331. # * Test the following compatibility issues:
  27332. # - The filler fields in "D" entries in CVS/Entries get preserved
  27333. # (per cvs.texinfo).
  27334. # - Unrecognized entry types in CVS/Entries get ignored (looks like
  27335. # this needs to be documented in cvs.texinfo, but is not)
  27336. # - Test that unrecognized files in CVS directories (e.g. CVS/Foobar)
  27337. # are ignored (per cvs.texinfo).
  27338. # - Test 'cvs history' with symlinks in the path to the working directory.
  27339. # - Remove most of the CVS_SERVER stuff after a reasonable amount of time.
  27340. # The "fork" & "client" series of tests should be left. 4/2/00, CVS
  27341. # 1.11.0.1 was altered so that it would default to program_name (set from
  27342. # argv[0]) rather than "cvs", but I'd like this script to work on legacy
  27343. # versions of CVS for awhile.
  27344. # - Testsuite doesn't work with usernames over eight characters in length.
  27345. # Fix it.
  27346. # End of TODO list.
  27347. # Exit if keep set
  27348. if $keep; then
  27349. echo "Keeping ${TESTDIR} and exiting due to -k (keep) option."
  27350. exit 0
  27351. fi
  27352. # Remove the test directory, but first change out of it.
  27353. cd `dirname ${TESTDIR}`
  27354. rm -rf ${TESTDIR}
  27355. # end of sanity.sh