remote-bzr: add utf-8 support for fetching

[fc: added tests] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Timotheus Pokorra committed Apr 5, 2013 at 21:49 UTC 5445b24e22eea96995f4015e4dadb120ff277c1e
2 files changed +27 -2
contrib/remote-helpers/git-remote-bzr
+2 -2
@@ -223,7 +223,7 @@ def export_files(tree, files):
223 # is the blog already exported?
224 if h in filenodes:
225 mark = filenodes[h]
226 - final.append((mode, mark, path))
226 + final.append((mode, mark, path.encode('utf-8')))
227 continue
228
229 d = tree.get_file_text(fid)
@@ -240,7 +240,7 @@ def export_files(tree, files):
240 print "data %d" % len(d)
241 print d
242
243 - final.append((mode, mark, path))
243 + final.append((mode, mark, path.encode('utf-8')))
244
245 return final
246
contrib/remote-helpers/test-bzr.sh
+25
@@ -179,4 +179,29 @@ test_expect_success 'different authors' '
179 test_cmp expected actual
180 '
181
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" &&
185 +
186 + export LC_ALL=en_US.UTF-8
187 +
188 + (
189 + bzr init bzrrepo &&
190 + cd bzrrepo &&
191 +
192 + echo test >> "áéíóú" &&
193 + bzr add "áéíóú" &&
194 + bzr commit -m utf-8
195 + ) &&
196 +
197 + (
198 + git clone "bzr::$PWD/bzrrepo" gitrepo &&
199 + cd gitrepo &&
200 + git ls-files > ../actual
201 + ) &&
202 +
203 + echo "\"\\303\\241\\303\\251\\303\\255\\303\\263\\303\\272\"" > expected &&
204 + test_cmp expected actual
205 +'
206 +
207 test_done