Merge 'install-wincred' into HEAD
[git/mingw/4msysgit.git] / t / lib-cvs.sh
blob5076718916388d6abf483220cd35f9f61394abc4
1 # Shell library sourced instead of ./test-lib.sh by cvsimport tests.
3 . ./test-lib.sh
5 unset CVS_SERVER
7 if ! type cvs >/dev/null 2>&1
8 then
9 skip_all='skipping cvsimport tests, cvs not found'
10 test_done
13 CVS="cvs -f"
14 export CVS
16 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
17 case "$cvsps_version" in
18 2.1 | 2.2*)
20 '')
21 skip_all='skipping cvsimport tests, cvsps not found'
22 test_done
25 skip_all='skipping cvsimport tests, unsupported cvsps version'
26 test_done
28 esac
30 setup_cvs_test_repository () {
31 CVSROOT="$(pwd)/.cvsroot" &&
32 cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
33 export CVSROOT
36 test_cvs_co () {
37 # Usage: test_cvs_co BRANCH_NAME
38 rm -rf module-cvs-"$1"
39 if [ "$1" = "master" ]
40 then
41 $CVS co -P -d module-cvs-"$1" -A module
42 else
43 $CVS co -P -d module-cvs-"$1" -r "$1" module
47 test_git_co () {
48 # Usage: test_git_co BRANCH_NAME
49 (cd module-git && git checkout "$1")
52 test_cmp_branch_file () {
53 # Usage: test_cmp_branch_file BRANCH_NAME PATH
54 # The branch must already be checked out of CVS and git.
55 test_cmp module-cvs-"$1"/"$2" module-git/"$2"
58 test_cmp_branch_tree () {
59 # Usage: test_cmp_branch_tree BRANCH_NAME
60 # Check BRANCH_NAME out of CVS and git and make sure that all
61 # of the files and directories are identical.
63 test_cvs_co "$1" &&
64 test_git_co "$1" &&
66 cd module-cvs-"$1"
67 find . -type d -name CVS -prune -o -type f -print
68 ) | sort >module-cvs-"$1".list &&
70 cd module-git
71 find . -type d -name .git -prune -o -type f -print
72 ) | sort >module-git-"$1".list &&
73 test_cmp module-cvs-"$1".list module-git-"$1".list &&
74 cat module-cvs-"$1".list | while read f
76 test_cmp_branch_file "$1" "$f" || return 1
77 done