remote-bzr: remove stale check code for tests
[alt-git.git] / contrib / remote-helpers / test-bzr.sh
blob8450432018aa5d10044884af729cf437e7d25202
1 #!/bin/sh
3 # Copyright (c) 2012 Felipe Contreras
6 test_description='Test remote-bzr'
8 . ./test-lib.sh
10 if ! test_have_prereq PYTHON; then
11 skip_all='skipping remote-bzr tests; python not available'
12 test_done
15 if ! "$PYTHON_PATH" -c 'import bzrlib'; then
16 skip_all='skipping remote-bzr tests; bzr not available'
17 test_done
20 check () {
21 (cd $1 &&
22 git log --format='%s' -1 &&
23 git symbolic-ref HEAD) > actual &&
24 (echo $2 &&
25 echo "refs/heads/$3") > expected &&
26 test_cmp expected actual
29 bzr whoami "A U Thor <author@example.com>"
31 test_expect_success 'cloning' '
32 (bzr init bzrrepo &&
33 cd bzrrepo &&
34 echo one > content &&
35 bzr add content &&
36 bzr commit -m one
37 ) &&
39 git clone "bzr::$PWD/bzrrepo" gitrepo &&
40 check gitrepo one master
43 test_expect_success 'pulling' '
44 (cd bzrrepo &&
45 echo two > content &&
46 bzr commit -m two
47 ) &&
49 (cd gitrepo && git pull) &&
51 check gitrepo two master
54 test_expect_success 'pushing' '
55 (cd gitrepo &&
56 echo three > content &&
57 git commit -a -m three &&
58 git push
59 ) &&
61 echo three > expected &&
62 cat bzrrepo/content > actual &&
63 test_cmp expected actual
66 test_expect_success 'roundtrip' '
67 (cd gitrepo &&
68 git pull &&
69 git log --format="%s" -1 origin/master > actual) &&
70 echo three > expected &&
71 test_cmp expected actual &&
73 (cd gitrepo && git push && git pull) &&
75 (cd bzrrepo &&
76 echo four > content &&
77 bzr commit -m four
78 ) &&
80 (cd gitrepo && git pull && git push) &&
82 check gitrepo four master &&
84 (cd gitrepo &&
85 echo five > content &&
86 git commit -a -m five &&
87 git push && git pull
88 ) &&
90 (cd bzrrepo && bzr revert) &&
92 echo five > expected &&
93 cat bzrrepo/content > actual &&
94 test_cmp expected actual
97 cat > expected <<EOF
98 100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
99 100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
100 120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
103 test_expect_success 'special modes' '
104 (cd bzrrepo &&
105 echo exec > executable
106 chmod +x executable &&
107 bzr add executable
108 bzr commit -m exec &&
109 ln -s content link
110 bzr add link
111 bzr commit -m link &&
112 mkdir dir &&
113 bzr add dir &&
114 bzr commit -m dir) &&
116 (cd gitrepo &&
117 git pull
118 git ls-tree HEAD > ../actual) &&
120 test_cmp expected actual &&
122 (cd gitrepo &&
123 git cat-file -p HEAD:link > ../actual) &&
125 printf content > expected &&
126 test_cmp expected actual
129 test_done