1708
1708
def initialize_on_transport(self, transport):
1709
1709
"""Initialize a new bzrdir in the base directory of a Transport."""
1710
# Since we don't have a .bzr directory, inherit the
1711
# can we hand off the request to the smart server rather than using
1713
client_medium = transport.get_smart_medium()
1714
except errors.NoSmartMedium:
1715
return self._initialize_on_transport_vfs(transport)
1717
# Current RPC's only know how to create bzr metadir1 instances, so
1718
# we still delegate to vfs methods if the requested format is not a
1720
if type(self) != BzrDirMetaFormat1:
1721
return self._initialize_on_transport_vfs(transport)
1722
remote_format = RemoteBzrDirFormat()
1723
self._supply_sub_formats_to(remote_format)
1724
return remote_format.initialize_on_transport(transport)
1726
def _initialize_on_transport_vfs(self, transport):
1727
"""Initialize a new bzrdir using VFS calls.
1729
:param transport: The transport to create the .bzr directory in.
1732
# Since we are creating a .bzr directory, inherit the
1711
1733
# mode from the root directory
1712
1734
temp_control = lockable_files.LockableFiles(transport,
1713
1735
'', lockable_files.TransportLock)
1737
1759
mode=file_mode)
1739
1761
control_files.unlock()
1740
# If we initialized using VFS methods on a RemoteTransport, return a
1741
# Remote object: No need for it to be slower than necessary.
1742
if isinstance(transport, remote_transport.RemoteTransport):
1743
return self.open(transport)
1745
return self.open(transport, _found=True)
1762
return self.open(transport, _found=True)
1747
1764
def is_supported(self):
1748
1765
"""Is this format supported?