6
6
from unittest import makeSuite
8
from bzrlib import osutils
10
revision as _mod_revision,
9
13
from bzrlib.bzrdir import BzrDir
14
from bzrlib.export.tar_exporter import export_tarball
10
15
from bzrlib.plugins.bzrtools.upstream_import import (
246
254
import_tar(tree, tar_file)
247
255
# So long as it did not crash, that should be ok
258
class TestWithStuff(TestCaseWithTransport):
260
def transform_to_tar(self, tt):
262
tarball = tarfile.open(None, 'w|', stream)
263
export_tarball(tt.get_preview_tree(), tarball, '')
266
def get_empty_tt(self):
267
b = self.make_repository('foo')
268
null_tree = b.revision_tree(_mod_revision.NULL_REVISION)
269
tt = transform.TransformPreview(null_tree)
270
root = tt.new_directory('', transform.ROOT_PARENT, 'tree-root')
272
self.addCleanup(tt.finalize)
275
def test_nonascii_paths(self):
276
tt = self.get_empty_tt()
277
encoded_file = tt.new_file(
278
u'\u1234file', tt.root, 'contents', 'new-file')
279
encoded_file = tt.new_file(
280
'other', tt.root, 'contents', 'other-file')
281
tarfile = self.transform_to_tar(tt)
283
tree = self.make_branch_and_tree('bar')
284
import_tar(tree, tarfile)
285
self.assertPathExists(u'bar/\u1234file')
249
288
def test_suite():
250
289
return makeSuite(TestImport)