47
47
from bzrlib.testament import Testament
50
from bzrlib import registry
51
50
from bzrlib.decorators import needs_read_lock, needs_write_lock
52
51
from bzrlib.inter import InterObject
53
52
from bzrlib.inventory import Inventory, InventoryDirectory, ROOT_ID
53
from bzrlib import registry
54
54
from bzrlib.symbol_versioning import (
2210
class RepositoryFormatRegistry(registry.Registry):
2211
"""Registry of RepositoryFormats."""
2213
def __init__(self, other_registry=None):
2214
registry.Registry.__init__(self)
2215
self._other_registry = other_registry
2217
def register_lazy(self, key, module_name, member_name,
2218
help=None, info=None,
2219
override_existing=False):
2220
# Overridden to allow capturing registrations to two seperate
2221
# registries in a single call.
2222
registry.Registry.register_lazy(self, key, module_name, member_name,
2223
help=help, info=info, override_existing=override_existing)
2224
if self._other_registry is not None:
2225
self._other_registry.register_lazy(key, module_name, member_name,
2226
help=help, info=info, override_existing=override_existing)
2228
def get(self, format_string):
2229
r = registry.Registry.get(self, format_string)
2235
network_format_registry = RepositoryFormatRegistry()
2210
network_format_registry = registry.FormatRegistry()
2236
2211
"""Registry of formats indexed by their network name.
2238
2213
The network name for a repository format is an identifier that can be used when
2244
format_registry = RepositoryFormatRegistry(network_format_registry)
2219
format_registry = registry.FormatRegistry(network_format_registry)
2245
2220
"""Registry of formats, indexed by their BzrDirMetaFormat format string.
2247
2222
This can contain either format instances themselves, or classes/factories that