1042
1042
def test_creation(self):
1043
1043
tree = self.make_branch_and_tree('tree')
1044
1044
self.build_tree(['tree/file'])
1045
tree.add('file', 'fileid-2')
1046
1046
tree.commit('added file', rev_id='rev1')
1048
1048
serializer = BundleSerializerV10('1.0')
1049
1049
serializer.write(tree.branch.repository, ['rev1'], {}, s)
1051
bundle_info = serializer.read(s)
1051
tree2 = self.make_branch_and_tree('target')
1052
target_repo = tree2.branch.repository
1053
install_bundle(target_repo, serializer.read(s))
1054
vf = target_repo.weave_store.get_weave('fileid-2',
1055
target_repo.get_transaction())
1056
self.assertEqual(tree.get_file_text('fileid-2'), vf.get_text('rev1'))
1058
def test_name_encode(self):
1059
self.assertEqual('revision:rev1',
1060
BundleSerializerV10.encode_name('revision', 'rev1'))
1061
self.assertEqual('file:rev1/file-id-1',
1062
BundleSerializerV10.encode_name('file', 'rev1', 'file-id-1'))
1064
def test_name_decode(self):
1065
self.assertEqual(('revision', 'rev1', None),
1066
BundleSerializerV10.decode_name('revision:rev1'))
1067
self.assertEqual(('file', 'rev1', 'file-id-1'),
1068
BundleSerializerV10.decode_name('file:rev1/file-id-1'))
1054
1071
class MungedBundleTester(TestCaseWithTransport):