/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 breezy/tests/test_repository.py

Merge bzrrepository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    )
45
45
from breezy import (
46
46
    bzrdir,
 
47
    bzrrepository,
47
48
    controldir,
48
49
    errors,
49
50
    inventory,
92
93
                              old_format.__class__)
93
94
 
94
95
 
95
 
class SampleRepositoryFormat(repository.RepositoryFormatMetaDir):
 
96
class SampleRepositoryFormat(bzrrepository.RepositoryFormatMetaDir):
96
97
    """A sample format
97
98
 
98
99
    this format is initializable, unsupported to aid in testing the
138
139
            dir = format._matchingbzrdir.initialize(url)
139
140
            format.initialize(dir)
140
141
            t = transport.get_transport_from_path(url)
141
 
            found_format = repository.RepositoryFormatMetaDir.find_format(dir)
 
142
            found_format = bzrrepository.RepositoryFormatMetaDir.find_format(dir)
142
143
            self.assertIsInstance(found_format, format.__class__)
143
144
        check_format(repository.format_registry.get_default(), "bar")
144
145
 
145
146
    def test_find_format_no_repository(self):
146
147
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
147
148
        self.assertRaises(errors.NoRepositoryPresent,
148
 
                          repository.RepositoryFormatMetaDir.find_format,
 
149
                          bzrrepository.RepositoryFormatMetaDir.find_format,
149
150
                          dir)
150
151
 
151
152
    def test_from_string(self):
161
162
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
162
163
        SampleRepositoryFormat().initialize(dir)
163
164
        self.assertRaises(UnknownFormatError,
164
 
                          repository.RepositoryFormatMetaDir.find_format,
 
165
                          bzrrepository.RepositoryFormatMetaDir.find_format,
165
166
                          dir)
166
167
 
167
168
    def test_find_format_with_features(self):
168
169
        tree = self.make_branch_and_tree('.', format='2a')
169
170
        tree.branch.repository.update_feature_flags({"name": "necessity"})
170
 
        found_format = repository.RepositoryFormatMetaDir.find_format(tree.bzrdir)
171
 
        self.assertIsInstance(found_format, repository.RepositoryFormatMetaDir)
 
171
        found_format = bzrrepository.RepositoryFormatMetaDir.find_format(tree.bzrdir)
 
172
        self.assertIsInstance(found_format, bzrrepository.RepositoryFormatMetaDir)
172
173
        self.assertEqual(found_format.features.get("name"), "necessity")
173
174
        self.assertRaises(errors.MissingFeature, found_format.check_support_status,
174
175
            True)
175
 
        self.addCleanup(repository.RepositoryFormatMetaDir.unregister_feature,
 
176
        self.addCleanup(bzrrepository.RepositoryFormatMetaDir.unregister_feature,
176
177
            "name")
177
 
        repository.RepositoryFormatMetaDir.register_feature("name")
 
178
        bzrrepository.RepositoryFormatMetaDir.register_feature("name")
178
179
        found_format.check_support_status(True)
179
180
 
180
181
 
1704
1705
 
1705
1706
    def test_open_with_present_feature(self):
1706
1707
        self.addCleanup(
1707
 
            repository.RepositoryFormatMetaDir.unregister_feature,
 
1708
            bzrrepository.RepositoryFormatMetaDir.unregister_feature,
1708
1709
            "makes-cheese-sandwich")
1709
 
        repository.RepositoryFormatMetaDir.register_feature(
 
1710
        bzrrepository.RepositoryFormatMetaDir.register_feature(
1710
1711
            "makes-cheese-sandwich")
1711
1712
        repo = self.make_repository('.')
1712
1713
        repo.lock_write()