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'
24 bzrlib.plugin.load_plugins()
25 import bzrlib.plugins.fastimport
28 if ! "$PYTHON_PATH" -c "$cmd"; then
29 echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
30 skip_all
='skipping remote-bzr tests; bzr-fastimport not available'
36 git log
--format='%s' -1 &&
37 git symbolic-ref HEAD
) > actual
&&
39 echo "refs/heads/$3") > expected
&&
40 test_cmp expected actual
43 bzr whoami
"A U Thor <author@example.com>"
45 test_expect_success
'cloning' '
53 git clone "bzr::$PWD/bzrrepo" gitrepo &&
54 check gitrepo one master
57 test_expect_success
'pulling' '
63 (cd gitrepo && git pull) &&
65 check gitrepo two master
68 test_expect_success
'pushing' '
70 echo three > content &&
71 git commit -a -m three &&
75 echo three > expected &&
76 cat bzrrepo/content > actual &&
77 test_cmp expected actual
80 test_expect_success
'roundtrip' '
83 git log --format="%s" -1 origin/master > actual) &&
84 echo three > expected &&
85 test_cmp expected actual &&
87 (cd gitrepo && git push && git pull) &&
90 echo four > content &&
94 (cd gitrepo && git pull && git push) &&
96 check gitrepo four master &&
99 echo five > content &&
100 git commit -a -m five &&
104 (cd bzrrepo && bzr revert) &&
106 echo five > expected &&
107 cat bzrrepo/content > actual &&
108 test_cmp expected actual
112 100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
113 100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
114 120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
117 test_expect_success
'special modes' '
119 echo exec > executable
120 chmod +x executable &&
122 bzr commit -m exec &&
125 bzr commit -m link &&
128 bzr commit -m dir) &&
132 git ls-tree HEAD > ../actual) &&
134 test_cmp expected actual &&
137 git cat-file -p HEAD:link > ../actual) &&
139 echo -n content > expected &&
140 test_cmp expected actual
144 100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
145 100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
146 120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
147 040000 tree 35c0caa46693cef62247ac89a680f0c5ce32b37b movedir-new
150 test_expect_success
'moving directory' '
153 echo one > movedir/one &&
154 echo two > movedir/two &&
156 bzr commit -m movedir &&
157 bzr mv movedir movedir-new &&
158 bzr commit -m movedir-new) &&
162 git ls-tree HEAD > ../actual) &&
164 test_cmp expected actual
167 test_expect_success
'different authors' '
169 echo john >> content &&
171 --author "Jane Rey <jrey@example.com>" \
172 --author "John Doe <jdoe@example.com>") &&
176 git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
178 echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
179 test_cmp expected actual
182 test_expect_success
'fetch utf-8 filenames' '
183 mkdir -p tmp && cd tmp &&
184 test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
186 export LC_ALL=en_US.UTF-8
192 echo test >> "áéíóú" &&
198 git clone "bzr::$PWD/bzrrepo" gitrepo &&
200 git ls-files > ../actual
203 echo "\"\\303\\241\\303\\251\\303\\255\\303\\263\\303\\272\"" > expected &&
204 test_cmp expected actual