interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / lib-cvs.sh

84 lines · 1798 bytes Raw Blame History
1# Shell library sourced instead of ./test-lib.sh by cvsimport tests.
2
3. ./test-lib.sh
4
5if test -n "$NO_CVS_TESTS"
6then
7 skip_all='skipping git cvs tests, NO_CVS_TESTS defined'
8 test_done
9fi
10
11unset CVS_SERVER
12
13if ! type cvs >/dev/null 2>&1
14then
15 skip_all='skipping cvsimport tests, cvs not found'
16 test_done
17fi
18
19CVS="cvs -f"
20export CVS
21
22cvsps_version=$(cvsps -h 2>&1 | sed -ne 's/cvsps version //p')
23case "$cvsps_version" in
242.1 | 2.2*)
25 ;;
26'')
27 skip_all='skipping cvsimport tests, cvsps not found'
28 test_done
29 ;;
30*)
31 skip_all='skipping cvsimport tests, unsupported cvsps version'
32 test_done
33 ;;
34esac
35
36setup_cvs_test_repository () {
37 CVSROOT="$(pwd)/.cvsroot" &&
38 cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
39 export CVSROOT
40}
41
42test_cvs_co () {
43 # Usage: test_cvs_co BRANCH_NAME
44 rm -rf module-cvs-"$1"
45 if [ "$1" = "main" ]
46 then
47 $CVS co -P -d module-cvs-"$1" -A module
48 else
49 $CVS co -P -d module-cvs-"$1" -r "$1" module
50 fi
51}
52
53test_git_co () {
54 # Usage: test_git_co BRANCH_NAME
55 (cd module-git && git checkout "$1")
56}
57
58test_cmp_branch_file () {
59 # Usage: test_cmp_branch_file BRANCH_NAME PATH
60 # The branch must already be checked out of CVS and git.
61 test_cmp module-cvs-"$1"/"$2" module-git/"$2"
62}
63
64test_cmp_branch_tree () {
65 # Usage: test_cmp_branch_tree BRANCH_NAME
66 # Check BRANCH_NAME out of CVS and git and make sure that all
67 # of the files and directories are identical.
68
69 test_cvs_co "$1" &&
70 test_git_co "$1" &&
71 (
72 cd module-cvs-"$1"
73 find . -type d -name CVS -prune -o -type f -print
74 ) | sort >module-cvs-"$1".list &&
75 (
76 cd module-git
77 find . -type d -name .git -prune -o -type f -print
78 ) | sort >module-git-"$1".list &&
79 test_cmp module-cvs-"$1".list module-git-"$1".list &&
80 while read f
81 do
82 test_cmp_branch_file "$1" "$f" || return 1
83 done <module-cvs-"$1".list
84}