~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Robert Collins
  • Date: 2006-01-12 01:02:32 UTC
  • mto: (1534.1.6 integration)
  • mto: This revision was merged to the branch mainline in revision 1543.
  • Revision ID: robertc@robertcollins.net-20060112010232-32d7a5b35bbc94df
Review feedback fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
227
227
        you may check via is_listable to determine if it will.
228
228
        """
229
229
        raise errors.TransportNotPossible("This transport has not "
230
 
                                          "implemented iter_files_recursive."
 
230
                                          "implemented iter_files_recursive "
231
231
                                          "(but must claim to be listable "
232
232
                                          "to trigger this error).")
233
233
 
405
405
        it if at all possible.
406
406
        """
407
407
        raise errors.TransportNotPossible("This transport has not "
408
 
                                          "implemented list_dir."
 
408
                                          "implemented list_dir "
409
409
                                          "(but must claim to be listable "
410
410
                                          "to trigger this error).")
411
411
 
466
466
 
467
467
 
468
468
class Server(object):
469
 
    """Basic server API for paths."""
 
469
    """A Transport Server.
 
470
    
 
471
    The Server interface provides a server for a given transport. We use
 
472
    these servers as loopback testing tools. For any given transport the
 
473
    Servers it provides must either allow writing, or serve the contents
 
474
    of os.getcwdu() at the time setUp is called.
 
475
    
 
476
    Note that these are real servers - they must implement all the things
 
477
    that we want bzr transports to take advantage of.
 
478
    """
470
479
 
471
480
    def setUp(self):
472
481
        """Setup the server to service requests."""
475
484
        """Remove the server and cleanup any resources it owns."""
476
485
 
477
486
    def get_url(self):
478
 
        """Return a url for this server to os.getcwdu.
 
487
        """Return a url for this server.
479
488
        
480
489
        If the transport does not represent a disk directory (i.e. it is 
481
 
        a databse like svn, or a memory only transport, it should return
 
490
        a database like svn, or a memory only transport, it should return
482
491
        a connection to a newly established resource for this Server.
 
492
        Otherwise it should return a url that will provide access to the path
 
493
        that was os.getcwdu() when setUp() was called.
483
494
        
484
495
        Subsequent calls will return the same resource.
485
496
        """
491
502
 
492
503
 
493
504
class TransportTestProviderAdapter(object):
494
 
    """A class which can setup transport interface tests."""
 
505
    """A tool to generate a suite testing all transports for a single test.
 
506
 
 
507
    This is done by copying the test once for each transport and injecting
 
508
    the transport_class and transport_server classes into each copy. Each copy
 
509
    is also given a new id() to make it easy to identify.
 
510
    """
495
511
 
496
512
    def adapt(self, test):
497
513
        result = TestSuite()