diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-09-21 12:20:35 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-09-21 12:20:35 +0200 |
commit | 697545af3848c6580ce8596e170f9fcdb1e0f49f (patch) | |
tree | a474148c03989818a3113a4ca3b688451d383b5c /tests/test_generic_processor.py | |
parent | 0357a7b41187f5e283140168f4826703a1ab2885 (diff) | |
download | bzr-fastimport-697545af3848c6580ce8596e170f9fcdb1e0f49f.tar.gz |
Cope with non-utf8 characters in paths when importing.
Diffstat (limited to 'tests/test_generic_processor.py')
-rw-r--r-- | tests/test_generic_processor.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_generic_processor.py b/tests/test_generic_processor.py index 4fc5463..c491c51 100644 --- a/tests/test_generic_processor.py +++ b/tests/test_generic_processor.py @@ -1967,3 +1967,27 @@ class TestCommitCommands(TestCaseForGenericProcessor): handler.process(command_list) rev = branch.repository.get_revision(branch.last_revision()) self.assertEquals(u"This is a funky character: \ufffd", rev.message) + + +class TestAddNonUtf8InBranch(TestCaseForGenericProcessor): + + def file_command_iter(self): + # A add 'foo\x83' + def command_list(): + committer_a = ['', 'a@elmer.com', time.time(), time.timezone] + def files_one(): + yield commands.FileModifyCommand( + 'foo\x83', kind_to_mode('file', False), None, "content A\n") + yield commands.CommitCommand('head', '1', None, + committer_a, "commit 1", None, [], files_one) + return command_list + + def test_add(self): + handler, branch = self.get_handler() + handler.process(self.file_command_iter()) + branch.lock_read() + self.addCleanup(branch.unlock) + rev_a = branch.last_revision() + rtree_a = branch.repository.revision_tree(rev_a) + foo_id = rtree_a.path2id(u'foo\ufffd') + self.assertEqual(rev_a, rtree_a.inventory[foo_id].revision) |