3 # Copyright (c) 2012 Felipe Contreras
6 test_description
='Test remote-bzr'
10 if ! test_have_prereq PYTHON
; then
11 skip_all
='skipping remote-bzr tests; python not available'
15 if ! "$PYTHON_PATH" -c 'import bzrlib'; then
16 skip_all
='skipping remote-bzr tests; bzr not available'
22 git log
--format='%s' -1 &&
23 git symbolic-ref HEAD
) > actual
&&
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' '
39 git clone "bzr::$PWD/bzrrepo" gitrepo &&
40 check gitrepo one master
43 test_expect_success
'pulling' '
49 (cd gitrepo && git pull) &&
51 check gitrepo two master
54 test_expect_success
'pushing' '
56 echo three > content &&
57 git commit -a -m three &&
61 echo three > expected &&
62 cat bzrrepo/content > actual &&
63 test_cmp expected actual
66 test_expect_success
'roundtrip' '
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) &&
76 echo four > content &&
80 (cd gitrepo && git pull && git push) &&
82 check gitrepo four master &&
85 echo five > content &&
86 git commit -a -m five &&
90 (cd bzrrepo && bzr revert) &&
92 echo five > expected &&
93 cat bzrrepo/content > actual &&
94 test_cmp expected actual
98 100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
99 100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
100 120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
103 test_expect_success
'special modes' '
105 echo exec > executable
106 chmod +x executable &&
108 bzr commit -m exec &&
111 bzr commit -m link &&
114 bzr commit -m dir) &&
118 git ls-tree HEAD > ../actual) &&
120 test_cmp expected actual &&
123 git cat-file -p HEAD:link > ../actual) &&
125 printf content > expected &&
126 test_cmp expected actual
130 100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
131 100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
132 120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
133 040000 tree 35c0caa46693cef62247ac89a680f0c5ce32b37b movedir-new
136 test_expect_success
'moving directory' '
139 echo one > movedir/one &&
140 echo two > movedir/two &&
142 bzr commit -m movedir &&
143 bzr mv movedir movedir-new &&
144 bzr commit -m movedir-new) &&
148 git ls-tree HEAD > ../actual) &&
150 test_cmp expected actual
153 test_expect_success
'different authors' '
155 echo john >> content &&
157 --author "Jane Rey <jrey@example.com>" \
158 --author "John Doe <jdoe@example.com>") &&
162 git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
164 echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
165 test_cmp expected actual
168 test_expect_success
'fetch utf-8 filenames' '
169 mkdir -p tmp && cd tmp &&
170 test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
172 export LC_ALL=en_US.UTF-8
178 echo test >> "áéíóú" &&
180 echo test >> "îø∫∆" &&
182 bzr commit -m utf-8 &&
183 echo test >> "áéíóú" &&
184 bzr commit -m utf-8 &&
186 bzr mv "áéíóú" "åß∂" &&
191 git clone "bzr::$PWD/bzrrepo" gitrepo &&
193 git ls-files > ../actual
196 echo "\"\\303\\245\\303\\237\\342\\210\\202\"" > expected &&
197 test_cmp expected actual
200 test_expect_success
'push utf-8 filenames' '
201 mkdir -p tmp && cd tmp &&
202 test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
204 export LC_ALL=en_US.UTF-8
210 echo one >> content &&
216 git clone "bzr::$PWD/bzrrepo" gitrepo &&
219 echo test >> "áéíóú" &&
221 git commit -m utf-8 &&
226 (cd bzrrepo && bzr ls > ../actual) &&
227 echo -e "content\náéíóú" > expected &&
228 test_cmp expected actual