1824
1825
def initialize(self, url, possible_transports=None):
1825
1826
"""Create a bzr control dir at this url and return an opened copy.
1828
While not deprecated, this method is very specific and its use will
1829
lead to many round trips to setup a working environment. See
1830
initialize_on_transport_ex for a [nearly] all-in-one method.
1827
1832
Subclasses should typically override initialize_on_transport
1828
1833
instead of this method.
1851
1856
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
1852
1857
create_prefix=False, force_new_repo=False, stacked_on=None,
1853
stack_on_pwd=None, repo_format_name=None, make_working_trees=False,
1858
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
1854
1859
shared_repo=False):
1855
1860
"""Create this format on transport.
1868
1873
the repo_format_name is used to select the format of repository to
1870
1875
:param make_working_trees: Control the setting of make_working_trees
1871
for a new shared repository when one is made.
1876
for a new shared repository when one is made. None to use whatever
1877
default the format has.
1872
1878
:param shared_repo: Control whether made repositories are shared or
1874
:return: repo, bzrdir, require_stacking. repo is None if none was
1875
created or found, bzrdir is always valid. require_stacking is the
1876
result of examining the stacked_on parameter and any stacking
1877
policy found for the target.
1880
:return: repo, bzrdir, require_stacking, repository_policy. repo is
1881
None if none was created or found, bzrdir is always valid.
1882
require_stacking is the result of examining the stacked_on
1883
parameter and any stacking policy found for the target.
1879
1885
# XXX: Refactor the create_prefix/no_create_prefix code into a
1880
1886
# common helper function
1900
1906
# Now the target directory exists, but doesn't have a .bzr
1901
1907
# directory. So we need to create it, along with any work to create
1902
1908
# all of the dependent branches, etc.
1903
1910
result = self.initialize_on_transport(transport)
1904
1911
if repo_format_name:
1913
# use a custom format
1914
result._format.repository_format = \
1915
repository.network_format_registry.get(repo_format_name)
1916
except AttributeError:
1917
# The format didn't permit it to be set.
1905
1919
# A repository is desired, either in-place or shared.
1906
1920
repository_policy = result.determine_repository_policy(
1907
1921
force_new_repo, stacked_on, stack_on_pwd,
2133
2147
repository_format = property(__return_repository_format)
2136
class BzrDirFormat5(BzrDirFormat):
2150
class BzrDirFormatAllInOne(BzrDirFormat):
2151
"""Common class for formats before meta-dirs."""
2153
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
2154
create_prefix=False, force_new_repo=False, stacked_on=None,
2155
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
2157
"""See BzrDirFormat.initialize_on_transport_ex."""
2158
require_stacking = (stacked_on is not None)
2159
# Format 5 cannot stack, but we've been asked do - actually init
2161
if require_stacking:
2162
format = BzrDirMetaFormat1()
2163
return format.initialize_on_transport_ex(transport,
2164
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2165
force_new_repo=force_new_repo, stacked_on=stacked_on,
2166
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2167
make_working_trees=make_working_trees, shared_repo=shared_repo)
2168
return BzrDirFormat.initialize_on_transport_ex(self, transport,
2169
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2170
force_new_repo=force_new_repo, stacked_on=stacked_on,
2171
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2172
make_working_trees=make_working_trees, shared_repo=shared_repo)
2175
class BzrDirFormat5(BzrDirFormatAllInOne):
2137
2176
"""Bzr control format 5.
2139
2178
This format is a combined format for working tree, branch and repository.
2194
2233
repository_format = property(__return_repository_format)
2197
class BzrDirFormat6(BzrDirFormat):
2236
class BzrDirFormat6(BzrDirFormatAllInOne):
2198
2237
"""Bzr control format 6.
2200
2239
This format is a combined format for working tree, branch and repository.