622
622
raise NotImplementedError(self.clone_on_transport)
625
class MetaComponentFormat(object):
626
"""A component that can live inside of a .bzr meta directory."""
628
def get_format_string(self):
629
"""The format string to be used."""
630
raise NotImplementedError(self.get_format_string)
633
class ControlDirComponentFormatRegistry(registry.FormatRegistry):
634
"""A registry for BzrDirMeta components."""
636
def __init__(self, other_registry=None):
637
super(ControlDirComponentFormatRegistry, self).__init__(other_registry)
638
self._extra_formats = []
640
def register(self, format):
641
"""Register a new format."""
642
super(ControlDirComponentFormatRegistry, self).register(
643
format.get_format_string(), format)
645
def remove(self, format):
646
"""Remove a registered format."""
647
super(ControlDirComponentFormatRegistry, self).remove(
648
format.get_format_string())
650
def register_extra(self, format):
651
"""Register a format that can not be used in a metadir.
653
This is mainly useful to allow custom repository formats, such as older
654
Bazaar formats and foreign formats, to be tested.
656
self._extra_formats.append(registry._ObjectGetter(format))
658
def remove_extra(self, format):
659
"""Remove an extra format.
661
self._extra_formats.remove(registry._ObjectGetter(format))
663
def register_extra_lazy(self, module_name, member_name):
664
"""Register a format lazily.
666
self._extra_formats.append(
667
registry._LazyObjectGetter(module_name, member_name))
669
def _get_extra(self):
670
"""Return all "extra" formats, not usable in meta directories."""
672
for getter in self._extra_formats:
680
"""Return all formats, even those not usable in metadirs.
683
for name in self.keys():
688
return result + self._get_extra()
625
691
class ControlDirFormat(object):
626
692
"""An encapsulation of the initialization and open routines for a format.
879
945
"""Registry of user-selectable ControlDir subformats.
881
947
Differs from ControlDirFormat._formats in that it provides sub-formats,
882
e.g. ControlDirMeta1 with weave repository. Also, it's more user-oriented.
948
e.g. BzrDirMeta1 with weave repository. Also, it's more user-oriented.
885
951
def __init__(self):