/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-20 09:46:28 UTC
  • mfrom: (5609.33.4 2.3)
  • mto: (5609.33.5 2.3)
  • mto: This revision was merged to the branch mainline in revision 5811.
  • Revision ID: john@arbash-meinel.com-20110420094628-l0bafq1lwb6ib1v2
Merge lp:bzr/2.3 @ 5640 so we can update the release notes (aka NEWS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
27
27
    inventory,
28
28
    merge,
29
29
    osutils,
30
 
    repository,
31
30
    revision as _mod_revision,
32
31
    tests,
33
32
    treebuilder,
35
34
from bzrlib.bundle import read_mergeable_from_url
36
35
from bzrlib.bundle.apply_bundle import install_bundle, merge_bundle
37
36
from bzrlib.bundle.bundle_data import BundleTree
38
 
from bzrlib.bzrdir import BzrDir
39
37
from bzrlib.directory_service import directories
40
38
from bzrlib.bundle.serializer import write_bundle, read_bundle, v09, v4
41
39
from bzrlib.bundle.serializer.v08 import BundleSerializerV08
42
40
from bzrlib.bundle.serializer.v09 import BundleSerializerV09
43
41
from bzrlib.bundle.serializer.v4 import BundleSerializerV4
44
 
from bzrlib.branch import Branch
45
42
from bzrlib.repofmt import knitrepo
46
43
from bzrlib.tests import (
47
44
    test_read_bundle,
114
111
            ie = InventoryDirectory(file_id, name, parent_id)
115
112
        elif kind == 'file':
116
113
            ie = InventoryFile(file_id, name, parent_id)
 
114
            ie.text_sha1 = text_sha_1
 
115
            ie.text_size = text_size
117
116
        elif kind == 'symlink':
118
117
            ie = InventoryLink(file_id, name, parent_id)
119
118
        else:
120
119
            raise errors.BzrError('unknown kind %r' % kind)
121
 
        ie.text_sha1 = text_sha_1
122
 
        ie.text_size = text_size
123
120
        return ie
124
121
 
125
122
    def add_dir(self, file_id, path):
1039
1036
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1040
1037
        repo = self.make_repository('repo', format='dirstate-with-subtree')
1041
1038
        bundle.install_revisions(repo)
1042
 
        inv_text = repo.get_inventory_xml('rev2')
 
1039
        inv_text = repo._get_inventory_xml('rev2')
1043
1040
        self.assertNotContainsRe(inv_text, 'format="5"')
1044
1041
        self.assertContainsRe(inv_text, 'format="7"')
1045
1042
 
1065
1062
 
1066
1063
    def test_inv_hash_across_serializers(self):
1067
1064
        repo = self.make_repo_with_installed_revisions()
1068
 
        recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
1069
 
        xml = repo.get_inventory_xml('rev2')
 
1065
        recorded_inv_sha1 = repo.get_revision('rev2').inventory_sha1
 
1066
        xml = repo._get_inventory_xml('rev2')
1070
1067
        self.assertEqual(osutils.sha_string(xml), recorded_inv_sha1)
1071
1068
 
1072
1069
    def test_across_models_incompatible(self):
1820
1817
            def look_up(self, name, url):
1821
1818
                return 'source'
1822
1819
        directories.register('foo:', FooService, 'Testing directory service')
1823
 
        self.addCleanup(lambda: directories.remove('foo:'))
 
1820
        self.addCleanup(directories.remove, 'foo:')
1824
1821
        self.build_tree_contents([('./foo:bar', out.getvalue())])
1825
1822
        self.assertRaises(errors.NotABundle, read_mergeable_from_url,
1826
1823
                          'foo:bar')