~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

Merge lockable-config-files into remove-gratuitous-ensure-config-dir-exist-calls resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    branch,
23
23
    bzrdir,
24
 
    controldir,
25
24
    errors,
26
25
    foreign,
27
26
    lockable_files,
206
205
    def get_branch_format(self):
207
206
        return DummyForeignVcsBranchFormat()
208
207
 
 
208
    @classmethod
 
209
    def probe_transport(klass, transport):
 
210
        """Return the .bzrdir style format present in a directory."""
 
211
        if not transport.has('.dummy'):
 
212
            raise errors.NotBranchError(path=transport.base)
 
213
        return klass()
 
214
 
209
215
    def initialize_on_transport(self, transport):
210
216
        """Initialize a new bzrdir in the base directory of a Transport."""
211
217
        # Since we don't have a .bzr directory, inherit the
260
266
 
261
267
 
262
268
def register_dummy_foreign_for_test(testcase):
263
 
    controldir.ControlDirFormat.register_format(DummyForeignVcsDirFormat)
264
 
    testcase.addCleanup(controldir.ControlDirFormat.unregister_format,
 
269
    bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
 
270
    testcase.addCleanup(bzrdir.BzrDirFormat.unregister_control_format,
265
271
                        DummyForeignVcsDirFormat)
266
 
    controldir.ControlDirFormat.register_prober(DummyForeignProber)
267
 
    testcase.addCleanup(controldir.ControlDirFormat.unregister_prober,
268
 
        DummyForeignProber)
269
272
    # We need to register the optimiser to make the dummy appears really
270
273
    # different from a regular bzr repository.
271
274
    branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
273
276
                        InterToDummyVcsBranch)
274
277
 
275
278
 
276
 
class DummyForeignProber(controldir.Prober):
277
 
 
278
 
    @classmethod
279
 
    def probe_transport(klass, transport):
280
 
        """Return the .bzrdir style format present in a directory."""
281
 
        if not transport.has('.dummy'):
282
 
            raise errors.NotBranchError(path=transport.base)
283
 
        return DummyForeignVcsDirFormat()
284
 
 
285
 
 
286
279
class ForeignVcsRegistryTests(tests.TestCase):
287
280
    """Tests for the ForeignVcsRegistry class."""
288
281