~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Aaron Bentley
  • Date: 2007-06-11 14:59:52 UTC
  • mto: (2520.5.2 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070611145952-cwt4480gphdhen6l
Get installation started

Show diffs side-by-side

added added

removed removed

Lines of Context:
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')
 
1045
        tree.add('file', 'fileid-2')
1046
1046
        tree.commit('added file', rev_id='rev1')
1047
1047
        s = StringIO()
1048
1048
        serializer = BundleSerializerV10('1.0')
1049
1049
        serializer.write(tree.branch.repository, ['rev1'], {}, s)
1050
1050
        s.seek(0)
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'))
 
1057
 
 
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'))
 
1063
 
 
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'))
1052
1069
 
1053
1070
 
1054
1071
class MungedBundleTester(TestCaseWithTransport):