~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-08-24 21:59:21 UTC
  • mfrom: (5363.2.22 controldir-1)
  • Revision ID: pqm@pqm.ubuntu.com-20100824215921-p4nheij9k4x6i1jw
(jelmer) Split generic interface code out of bzrlib.bzrdir.BzrDir into
 bzrlib.controldir.ControlDir. (Jelmer Vernooij)

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,
24
25
    errors,
25
26
    foreign,
26
27
    lockable_files,
205
206
    def get_branch_format(self):
206
207
        return DummyForeignVcsBranchFormat()
207
208
 
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
 
 
215
209
    def initialize_on_transport(self, transport):
216
210
        """Initialize a new bzrdir in the base directory of a Transport."""
217
211
        # Since we don't have a .bzr directory, inherit the
266
260
 
267
261
 
268
262
def register_dummy_foreign_for_test(testcase):
269
 
    bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
270
 
    testcase.addCleanup(bzrdir.BzrDirFormat.unregister_control_format,
 
263
    controldir.ControlDirFormat.register_format(DummyForeignVcsDirFormat)
 
264
    testcase.addCleanup(controldir.ControlDirFormat.unregister_format,
271
265
                        DummyForeignVcsDirFormat)
 
266
    controldir.ControlDirFormat.register_prober(DummyForeignProber)
 
267
    testcase.addCleanup(controldir.ControlDirFormat.unregister_prober,
 
268
        DummyForeignProber)
272
269
    # We need to register the optimiser to make the dummy appears really
273
270
    # different from a regular bzr repository.
274
271
    branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
276
273
                        InterToDummyVcsBranch)
277
274
 
278
275
 
 
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
 
279
286
class ForeignVcsRegistryTests(tests.TestCase):
280
287
    """Tests for the ForeignVcsRegistry class."""
281
288