1440
1440
return config.TransportConfig(self.transport, 'control.conf')
1443
class BzrDirMetaComponent(object):
1444
"""A component that can live inside of a .bzr meta directory."""
1446
def get_format_string(self):
1447
"""The format string to be used."""
1448
raise NotImplementedError(self.get_format_string)
1451
class BzrDirMetaComponentFormatRegistry(registry.FormatRegistry):
1452
"""A registry for BzrDirMeta components."""
1454
def __init__(self, other_registry=None):
1455
super(BzrDirMetaComponentFormatRegistry, self).__init__(other_registry)
1456
self._extra_formats = []
1458
def register(self, format):
1459
"""Register a new format."""
1460
super(BzrDirMetaComponentFormatRegistry, self).register(
1461
format.get_format_string(), format)
1463
def remove(self, format):
1464
"""Remove a registered format."""
1465
super(BzrDirMetaComponentFormatRegistry, self).remove(
1466
format.get_format_string())
1468
def register_extra(self, format):
1469
"""Register a format that can not be used in a metadir.
1471
This is mainly useful to allow custom repository formats, such as older
1472
Bazaar formats and foreign formats, to be tested.
1474
self._extra_formats.append(registry._ObjectGetter(format))
1476
def remove_extra(self, format):
1477
"""Remove an extra format.
1479
self._extra_formats.remove(registry._ObjectGetter(format))
1481
def register_extra_lazy(self, module_name, member_name):
1482
"""Register a format lazily.
1484
self._extra_formats.append(
1485
registry._LazyObjectGetter(module_name, member_name))
1487
def _get_extra(self):
1488
"""Return all "extra" formats, not usable in meta directories."""
1490
for getter in self._extra_formats:
1491
f = getter.get_obj()
1498
"""Return all formats, even those not usable in metadirs.
1501
for name in self.keys():
1502
fmt = self.get(name)
1506
return result + self._get_extra()
1509
1443
class BzrProber(controldir.Prober):
1510
1444
"""Prober for formats that use a .bzr/ control directory."""