1211
1212
:param a_bzrdir: The bzrdir to put the new repository in it.
1212
1213
:param shared: The repository should be initialized as a sharable one.
1214
:returns: The new repository object.
1214
1216
This may raise UninitializableFormat if shared repository are not
1215
1217
compatible the a_bzrdir.
1219
raise NotImplementedError(self.initialize)
1218
1221
def is_supported(self):
1219
1222
"""Is this format supported?
1687
1690
return f.count_copied, f.failed_revisions
1693
class InterRemoteRepository(InterRepository):
1694
"""Code for converting between RemoteRepository objects.
1696
This just gets an non-remote repository from the RemoteRepository, and calls
1697
InterRepository.get again.
1700
def __init__(self, source, target):
1701
if isinstance(source, remote.RemoteRepository):
1702
source._ensure_real()
1703
real_source = source._real_repository
1705
real_source = source
1706
if isinstance(target, remote.RemoteRepository):
1707
target._ensure_real()
1708
real_target = target._real_repository
1710
real_target = target
1711
self.real_inter = InterRepository.get(real_source, real_target)
1714
def is_compatible(source, target):
1715
if isinstance(source, remote.RemoteRepository):
1717
if isinstance(target, remote.RemoteRepository):
1721
def copy_content(self, revision_id=None):
1722
self.real_inter.copy_content(revision_id=revision_id)
1724
def fetch(self, revision_id=None, pb=None):
1725
self.real_inter.fetch(revision_id=revision_id, pb=pb)
1728
def _get_repo_format_to_test(self):
1690
1732
InterRepository.register_optimiser(InterSameDataRepository)
1691
1733
InterRepository.register_optimiser(InterWeaveRepo)
1692
1734
InterRepository.register_optimiser(InterKnitRepo)
1693
1735
InterRepository.register_optimiser(InterModel1and2)
1694
1736
InterRepository.register_optimiser(InterKnit1and2)
1737
InterRepository.register_optimiser(InterRemoteRepository)
1697
1740
class RepositoryTestProviderAdapter(object):
1703
1746
to make it easy to identify.
1706
def __init__(self, transport_server, transport_readonly_server, formats):
1749
def __init__(self, transport_server, transport_readonly_server, formats,
1750
vfs_transport_factory=None):
1707
1751
self._transport_server = transport_server
1708
1752
self._transport_readonly_server = transport_readonly_server
1753
self._vfs_transport_factory = vfs_transport_factory
1709
1754
self._formats = formats
1711
1756
def adapt(self, test):
1715
1760
new_test = deepcopy(test)
1716
1761
new_test.transport_server = self._transport_server
1717
1762
new_test.transport_readonly_server = self._transport_readonly_server
1763
# Only override the test's vfs_transport_factory if one was
1764
# specified, otherwise just leave the default in place.
1765
if self._vfs_transport_factory:
1766
new_test.vfs_transport_factory = self._vfs_transport_factory
1718
1767
new_test.bzrdir_format = bzrdir_format
1719
1768
new_test.repository_format = repository_format
1720
1769
def make_new_test_id():