/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 bzrlib/bzrdir.py

  • Committer: Andrew Bennetts
  • Date: 2007-04-18 11:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: andrew.bennetts@canonical.com-20070418112756-0sqsp5yxemwt3mrg
Add a _server_formats flag to BzrDir.open_from_transport and BzrDirFormat.find_format, make RemoteBranch.control_files into a property.

Show diffs side-by-side

added added

removed removed

Lines of Context:
527
527
        return BzrDir.open_from_transport(t, _unsupported=_unsupported)
528
528
 
529
529
    @staticmethod
530
 
    def open_from_transport(transport, _unsupported=False):
 
530
    def open_from_transport(transport, _unsupported=False,
 
531
                            _server_formats=True):
531
532
        """Open a bzrdir within a particular directory.
532
533
 
533
534
        :param transport: Transport containing the bzrdir.
536
537
        base = transport.base
537
538
 
538
539
        def find_format(transport):
539
 
            return transport, BzrDirFormat.find_format(transport)
 
540
            return transport, BzrDirFormat.find_format(
 
541
                transport, _server_formats=_server_formats)
540
542
 
541
543
        def redirected(transport, e, redirection_notice):
542
544
            qualified_source = e.get_source_url()
1213
1215
    This is a list of BzrDirFormat objects.
1214
1216
    """
1215
1217
 
 
1218
    _control_server_formats = []
 
1219
    """The registered control server formats, e.g. RemoteBzrDirs.
 
1220
 
 
1221
    This is a list of BzrDirFormat objects.
 
1222
    """
 
1223
 
1216
1224
    _lock_file_name = 'branch-lock'
1217
1225
 
1218
1226
    # _lock_class must be set in subclasses to the lock type, typ.
1219
1227
    # TransportLock or LockDir
1220
1228
 
1221
1229
    @classmethod
1222
 
    def find_format(klass, transport):
 
1230
    def find_format(klass, transport, _server_formats=True):
1223
1231
        """Return the format present at transport."""
1224
 
        for format in klass._control_formats:
 
1232
        if _server_formats:
 
1233
            formats = klass._control_server_formats + klass._control_formats
 
1234
        else:
 
1235
            formats = klass._control_formats
 
1236
        for format in formats:
1225
1237
            try:
1226
1238
                return format.probe_transport(transport)
1227
1239
            except errors.NotBranchError:
1385
1397
        chance to grab it before anything looks at the contents of the format
1386
1398
        file.
1387
1399
        """
1388
 
        klass._control_formats.insert(0, format)
 
1400
        klass._control_server_formats.append(format)
1389
1401
 
1390
1402
    @classmethod
1391
1403
    @symbol_versioning.deprecated_method(symbol_versioning.zero_fourteen)