~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-02 12:55:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5389.
  • Revision ID: jelmer@samba.org-20100802125510-xc0a63b0i0c3fvob
Add dummy foreign prober.

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
    """BzrDirFormat for the dummy foreign VCS."""
193
193
 
194
194
    @classmethod
195
 
    def get_format_string(cls):
196
 
        return "A Dummy VCS Dir"
197
 
 
198
 
    @classmethod
199
195
    def get_format_description(cls):
200
196
        return "A Dummy VCS Dir"
201
197
 
206
202
    def get_branch_format(self):
207
203
        return DummyForeignVcsBranchFormat()
208
204
 
209
 
    @classmethod
210
 
    def probe_transport(klass, transport):
211
 
        """Return the .bzrdir style format present in a directory."""
212
 
        if not transport.has('.dummy'):
213
 
            raise errors.NotBranchError(path=transport.base)
214
 
        return klass()
215
 
 
216
205
    def initialize_on_transport(self, transport):
217
206
        """Initialize a new bzrdir in the base directory of a Transport."""
218
207
        # Since we don't have a .bzr directory, inherit the
270
259
    controldir.ControlDirFormat.register_format(DummyForeignVcsDirFormat)
271
260
    testcase.addCleanup(controldir.ControlDirFormat.unregister_format,
272
261
                        DummyForeignVcsDirFormat)
 
262
    controldir.probers.append(DummyForeignProber)
 
263
    testcase.addCleanup(controldir.probers.remove, DummyForeignProber)
273
264
    # We need to register the optimiser to make the dummy appears really
274
265
    # different from a regular bzr repository.
275
266
    branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
277
268
                        InterToDummyVcsBranch)
278
269
 
279
270
 
 
271
class DummyForeignProber(controldir.Prober):
 
272
 
 
273
    @classmethod
 
274
    def probe_transport(klass, transport):
 
275
        """Return the .bzrdir style format present in a directory."""
 
276
        if not transport.has('.dummy'):
 
277
            raise errors.NotBranchError(path=transport.base)
 
278
        return DummyForeignVcsDirFormat()
 
279
 
 
280
 
280
281
class ForeignVcsRegistryTests(tests.TestCase):
281
282
    """Tests for the ForeignVcsRegistry class."""
282
283