211
218
errors.UnstackableRepositoryFormat,
212
219
errors.NotStacked):
214
# Bug: We create a metadir without knowing if it can support stacking,
215
# we should look up the policy needs first, or just use it as a hint,
223
# may need to copy content in
224
repository_policy = result.determine_repository_policy(
225
force_new_repo, stacked_on, self.root_transport.base,
226
require_stacking=require_stacking)
218
227
make_working_trees = local_repo.make_working_trees()
219
want_shared = local_repo.is_shared()
220
repo_format_name = format.repository_format.network_name()
222
make_working_trees = False
224
repo_format_name = None
226
result_repo, result, require_stacking, repository_policy = \
227
format.initialize_on_transport_ex(transport,
228
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
229
force_new_repo=force_new_repo, stacked_on=stacked_on,
230
stack_on_pwd=self.root_transport.base,
231
repo_format_name=repo_format_name,
232
make_working_trees=make_working_trees, shared_repo=want_shared)
235
# If the result repository is in the same place as the
236
# resulting bzr dir, it will have no content, further if the
237
# result is not stacked then we know all content should be
238
# copied, and finally if we are copying up to a specific
239
# revision_id then we can use the pending-ancestry-result which
240
# does not require traversing all of history to describe it.
241
if (result_repo.user_url == result.user_url
242
and not require_stacking and
243
revision_id is not None):
244
fetch_spec = graph.PendingAncestryResult(
245
[revision_id], local_repo)
246
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
248
result_repo.fetch(local_repo, revision_id=revision_id)
252
if result_repo is not None:
253
raise AssertionError('result_repo not None(%r)' % result_repo)
228
result_repo, is_new_repo = repository_policy.acquire_repository(
229
make_working_trees, local_repo.is_shared())
230
if not require_stacking and repository_policy._require_stacking:
231
require_stacking = True
232
result._format.require_stacking()
233
if is_new_repo and not require_stacking and revision_id is not None:
234
fetch_spec = graph.PendingAncestryResult(
235
[revision_id], local_repo)
236
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
238
result_repo.fetch(local_repo, revision_id=revision_id)
254
241
# 1 if there is a branch present
255
242
# make sure its content is available in the target repository
893
1066
format, repository = self._cloning_metadir()
894
1067
if format._workingtree_format is None:
896
1068
if repository is None:
897
# No repository either
899
# We have a repository, so set a working tree? (Why? This seems to
900
# contradict the stated return value in the docstring).
901
1070
tree_format = repository._format._matchingbzrdir.workingtree_format
902
1071
format.workingtree_format = tree_format.__class__()
903
1072
if require_stacking:
904
1073
format.require_stacking()
908
def create(cls, base, format=None, possible_transports=None):
909
"""Create a new BzrDir at the url 'base'.
911
:param format: If supplied, the format of branch to create. If not
912
supplied, the default is used.
913
:param possible_transports: If supplied, a list of transports that
914
can be reused to share a remote connection.
1076
def checkout_metadir(self):
1077
return self.cloning_metadir()
1079
def sprout(self, url, revision_id=None, force_new_repo=False,
1080
recurse='down', possible_transports=None,
1081
accelerator_tree=None, hardlink=False, stacked=False,
1082
source_branch=None, create_tree_if_local=True):
1083
"""Create a copy of this bzrdir prepared for use as a new line of
1086
If url's last component does not exist, it will be created.
1088
Attributes related to the identity of the source branch like
1089
branch nickname will be cleaned, a working tree is created
1090
whether one existed before or not; and a local branch is always
1093
if revision_id is not None, then the clone operation may tune
1094
itself to download less data.
1095
:param accelerator_tree: A tree which can be used for retrieving file
1096
contents more quickly than the revision tree, i.e. a workingtree.
1097
The revision tree will be used for cases where accelerator_tree's
1098
content is different.
1099
:param hardlink: If true, hard-link files from accelerator_tree,
1101
:param stacked: If true, create a stacked branch referring to the
1102
location of this control directory.
1103
:param create_tree_if_local: If true, a working-tree will be created
1104
when working locally.
916
if cls is not BzrDir:
917
raise AssertionError("BzrDir.create always creates the"
918
"default format, not one of %r" % cls)
919
t = get_transport(base, possible_transports)
922
format = controldir.ControlDirFormat.get_default_format()
923
return format.initialize_on_transport(t)
1106
target_transport = get_transport(url, possible_transports)
1107
target_transport.ensure_base()
1108
cloning_format = self.cloning_metadir(stacked)
1109
# Create/update the result branch
1110
result = cloning_format.initialize_on_transport(target_transport)
1111
# if a stacked branch wasn't requested, we don't create one
1112
# even if the origin was stacked
1113
stacked_branch_url = None
1114
if source_branch is not None:
1116
stacked_branch_url = self.root_transport.base
1117
source_repository = source_branch.repository
1120
source_branch = self.open_branch()
1121
source_repository = source_branch.repository
1123
stacked_branch_url = self.root_transport.base
1124
except errors.NotBranchError:
1125
source_branch = None
1127
source_repository = self.open_repository()
1128
except errors.NoRepositoryPresent:
1129
source_repository = None
1130
repository_policy = result.determine_repository_policy(
1131
force_new_repo, stacked_branch_url, require_stacking=stacked)
1132
result_repo, is_new_repo = repository_policy.acquire_repository()
1133
if is_new_repo and revision_id is not None and not stacked:
1134
fetch_spec = graph.PendingAncestryResult(
1135
[revision_id], source_repository)
1138
if source_repository is not None:
1139
# Fetch while stacked to prevent unstacked fetch from
1141
if fetch_spec is None:
1142
result_repo.fetch(source_repository, revision_id=revision_id)
1144
result_repo.fetch(source_repository, fetch_spec=fetch_spec)
1146
if source_branch is None:
1147
# this is for sprouting a bzrdir without a branch; is that
1149
# Not especially, but it's part of the contract.
1150
result_branch = result.create_branch()
1152
result_branch = source_branch.sprout(result,
1153
revision_id=revision_id, repository_policy=repository_policy)
1154
mutter("created new branch %r" % (result_branch,))
1156
# Create/update the result working tree
1157
if (create_tree_if_local and
1158
isinstance(target_transport, local.LocalTransport) and
1159
(result_repo is None or result_repo.make_working_trees())):
1160
wt = result.create_workingtree(accelerator_tree=accelerator_tree,
1164
if wt.path2id('') is None:
1166
wt.set_root_id(self.open_workingtree.get_root_id())
1167
except errors.NoWorkingTree:
1173
if recurse == 'down':
1175
basis = wt.basis_tree()
1177
subtrees = basis.iter_references()
1178
elif result_branch is not None:
1179
basis = result_branch.basis_tree()
1181
subtrees = basis.iter_references()
1182
elif source_branch is not None:
1183
basis = source_branch.basis_tree()
1185
subtrees = basis.iter_references()
1190
for path, file_id in subtrees:
1191
target = urlutils.join(url, urlutils.escape(path))
1192
sublocation = source_branch.reference_parent(file_id, path)
1193
sublocation.bzrdir.sprout(target,
1194
basis.get_reference_revision(file_id, path),
1195
force_new_repo=force_new_repo, recurse=recurse,
1198
if basis is not None:
1202
def push_branch(self, source, revision_id=None, overwrite=False,
1204
"""Push the source branch into this BzrDir."""
1206
# If we can open a branch, use its direct repository, otherwise see
1207
# if there is a repository without a branch.
1209
br_to = self.open_branch()
1210
except errors.NotBranchError:
1211
# Didn't find a branch, can we find a repository?
1212
repository_to = self.find_repository()
1214
# Found a branch, so we must have found a repository
1215
repository_to = br_to.repository
1217
push_result = PushResult()
1218
push_result.source_branch = source
1220
# We have a repository but no branch, copy the revisions, and then
1222
repository_to.fetch(source.repository, revision_id=revision_id)
1223
br_to = source.clone(self, revision_id=revision_id)
1224
if source.get_push_location() is None or remember:
1225
source.set_push_location(br_to.base)
1226
push_result.stacked_on = None
1227
push_result.branch_push_result = None
1228
push_result.old_revno = None
1229
push_result.old_revid = _mod_revision.NULL_REVISION
1230
push_result.target_branch = br_to
1231
push_result.master_branch = None
1232
push_result.workingtree_updated = False
1234
# We have successfully opened the branch, remember if necessary:
1235
if source.get_push_location() is None or remember:
1236
source.set_push_location(br_to.base)
1238
tree_to = self.open_workingtree()
1239
except errors.NotLocalUrl:
1240
push_result.branch_push_result = source.push(br_to,
1241
overwrite, stop_revision=revision_id)
1242
push_result.workingtree_updated = False
1243
except errors.NoWorkingTree:
1244
push_result.branch_push_result = source.push(br_to,
1245
overwrite, stop_revision=revision_id)
1246
push_result.workingtree_updated = None # Not applicable
1248
tree_to.lock_write()
1250
push_result.branch_push_result = source.push(
1251
tree_to.branch, overwrite, stop_revision=revision_id)
1255
push_result.workingtree_updated = True
1256
push_result.old_revno = push_result.branch_push_result.old_revno
1257
push_result.old_revid = push_result.branch_push_result.old_revid
1258
push_result.target_branch = \
1259
push_result.branch_push_result.target_branch
927
1263
class BzrDirHooks(hooks.Hooks):
1437
1696
return format.open(self, _found=True)
1439
1698
def _get_config(self):
1440
return config.TransportConfig(self.transport, 'control.conf')
1443
class BzrProber(controldir.Prober):
1444
"""Prober for formats that use a .bzr/ control directory."""
1447
"""The known .bzr formats."""
1450
def register_bzrdir_format(klass, format):
1451
klass._formats[format.get_format_string()] = format
1454
def unregister_bzrdir_format(klass, format):
1455
del klass._formats[format.get_format_string()]
1458
def probe_transport(klass, transport):
1459
"""Return the .bzrdir style format present in a directory."""
1461
format_string = transport.get_bytes(".bzr/branch-format")
1462
except errors.NoSuchFile:
1463
raise errors.NotBranchError(path=transport.base)
1465
return klass._formats[format_string]
1467
raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1470
controldir.ControlDirFormat.register_prober(BzrProber)
1473
class RemoteBzrProber(controldir.Prober):
1474
"""Prober for remote servers that provide a Bazaar smart server."""
1477
def probe_transport(klass, transport):
1478
"""Return a RemoteBzrDirFormat object if it looks possible."""
1480
medium = transport.get_smart_medium()
1481
except (NotImplementedError, AttributeError,
1482
errors.TransportNotPossible, errors.NoSmartMedium,
1483
errors.SmartProtocolError):
1484
# no smart server, so not a branch for this format type.
1485
raise errors.NotBranchError(path=transport.base)
1487
# Decline to open it if the server doesn't support our required
1488
# version (3) so that the VFS-based transport will do it.
1489
if medium.should_probe():
1491
server_version = medium.protocol_version()
1492
except errors.SmartProtocolError:
1493
# Apparently there's no usable smart server there, even though
1494
# the medium supports the smart protocol.
1495
raise errors.NotBranchError(path=transport.base)
1496
if server_version != '2':
1497
raise errors.NotBranchError(path=transport.base)
1498
return RemoteBzrDirFormat()
1501
class BzrDirFormat(controldir.ControlDirFormat):
1502
"""ControlDirFormat base class for .bzr/ directories.
1699
return config.BzrDirConfig(self.transport)
1702
class BzrDirFormat(object):
1703
"""An encapsulation of the initialization and open routines for a format.
1705
Formats provide three things:
1706
* An initialization routine,
1504
1710
Formats are placed in a dict by their format string for reference
1505
1711
during bzrdir opening. These should be subclasses of BzrDirFormat
1510
1716
object will be created every system load.
1719
_default_format = None
1720
"""The default format used for new .bzr dirs."""
1723
"""The known formats."""
1725
_control_formats = []
1726
"""The registered control formats - .bzr, ....
1728
This is a list of BzrDirFormat objects.
1731
_control_server_formats = []
1732
"""The registered control server formats, e.g. RemoteBzrDirs.
1734
This is a list of BzrDirFormat objects.
1513
1737
_lock_file_name = 'branch-lock'
1515
1739
# _lock_class must be set in subclasses to the lock type, typ.
1516
1740
# TransportLock or LockDir
1743
def find_format(klass, transport, _server_formats=True):
1744
"""Return the format present at transport."""
1746
formats = klass._control_server_formats + klass._control_formats
1748
formats = klass._control_formats
1749
for format in formats:
1751
return format.probe_transport(transport)
1752
except errors.NotBranchError:
1753
# this format does not find a control dir here.
1755
raise errors.NotBranchError(path=transport.base)
1758
def probe_transport(klass, transport):
1759
"""Return the .bzrdir style format present in a directory."""
1761
format_string = transport.get(".bzr/branch-format").read()
1762
except errors.NoSuchFile:
1763
raise errors.NotBranchError(path=transport.base)
1766
return klass._formats[format_string]
1768
raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1771
def get_default_format(klass):
1772
"""Return the current default format."""
1773
return klass._default_format
1518
1775
def get_format_string(self):
1519
1776
"""Return the ASCII format string that identifies this format."""
1520
1777
raise NotImplementedError(self.get_format_string)
1779
def get_format_description(self):
1780
"""Return the short description for this format."""
1781
raise NotImplementedError(self.get_format_description)
1783
def get_converter(self, format=None):
1784
"""Return the converter to use to convert bzrdirs needing converts.
1786
This returns a bzrlib.bzrdir.Converter object.
1788
This should return the best upgrader to step this format towards the
1789
current default format. In the case of plugins we can/should provide
1790
some means for them to extend the range of returnable converters.
1792
:param format: Optional format to override the default format of the
1795
raise NotImplementedError(self.get_converter)
1797
def initialize(self, url, possible_transports=None):
1798
"""Create a bzr control dir at this url and return an opened copy.
1800
Subclasses should typically override initialize_on_transport
1801
instead of this method.
1803
return self.initialize_on_transport(get_transport(url,
1804
possible_transports))
1522
1806
def initialize_on_transport(self, transport):
1523
1807
"""Initialize a new bzrdir in the base directory of a Transport."""
1537
1821
self._supply_sub_formats_to(remote_format)
1538
1822
return remote_format.initialize_on_transport(transport)
1540
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
1541
create_prefix=False, force_new_repo=False, stacked_on=None,
1542
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
1543
shared_repo=False, vfs_only=False):
1544
"""Create this format on transport.
1546
The directory to initialize will be created.
1548
:param force_new_repo: Do not use a shared repository for the target,
1549
even if one is available.
1550
:param create_prefix: Create any missing directories leading up to
1552
:param use_existing_dir: Use an existing directory if one exists.
1553
:param stacked_on: A url to stack any created branch on, None to follow
1554
any target stacking policy.
1555
:param stack_on_pwd: If stack_on is relative, the location it is
1557
:param repo_format_name: If non-None, a repository will be
1558
made-or-found. Should none be found, or if force_new_repo is True
1559
the repo_format_name is used to select the format of repository to
1561
:param make_working_trees: Control the setting of make_working_trees
1562
for a new shared repository when one is made. None to use whatever
1563
default the format has.
1564
:param shared_repo: Control whether made repositories are shared or
1566
:param vfs_only: If True do not attempt to use a smart server
1567
:return: repo, bzrdir, require_stacking, repository_policy. repo is
1568
None if none was created or found, bzrdir is always valid.
1569
require_stacking is the result of examining the stacked_on
1570
parameter and any stacking policy found for the target.
1573
# Try to hand off to a smart server
1575
client_medium = transport.get_smart_medium()
1576
except errors.NoSmartMedium:
1579
# TODO: lookup the local format from a server hint.
1580
remote_dir_format = RemoteBzrDirFormat()
1581
remote_dir_format._network_name = self.network_name()
1582
self._supply_sub_formats_to(remote_dir_format)
1583
return remote_dir_format.initialize_on_transport_ex(transport,
1584
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
1585
force_new_repo=force_new_repo, stacked_on=stacked_on,
1586
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
1587
make_working_trees=make_working_trees, shared_repo=shared_repo)
1588
# XXX: Refactor the create_prefix/no_create_prefix code into a
1589
# common helper function
1590
# The destination may not exist - if so make it according to policy.
1591
def make_directory(transport):
1592
transport.mkdir('.')
1594
def redirected(transport, e, redirection_notice):
1595
note(redirection_notice)
1596
return transport._redirected_to(e.source, e.target)
1598
transport = do_catching_redirections(make_directory, transport,
1600
except errors.FileExists:
1601
if not use_existing_dir:
1603
except errors.NoSuchFile:
1604
if not create_prefix:
1606
transport.create_prefix()
1608
require_stacking = (stacked_on is not None)
1609
# Now the target directory exists, but doesn't have a .bzr
1610
# directory. So we need to create it, along with any work to create
1611
# all of the dependent branches, etc.
1613
result = self.initialize_on_transport(transport)
1614
if repo_format_name:
1616
# use a custom format
1617
result._format.repository_format = \
1618
repository.network_format_registry.get(repo_format_name)
1619
except AttributeError:
1620
# The format didn't permit it to be set.
1622
# A repository is desired, either in-place or shared.
1623
repository_policy = result.determine_repository_policy(
1624
force_new_repo, stacked_on, stack_on_pwd,
1625
require_stacking=require_stacking)
1626
result_repo, is_new_repo = repository_policy.acquire_repository(
1627
make_working_trees, shared_repo)
1628
if not require_stacking and repository_policy._require_stacking:
1629
require_stacking = True
1630
result._format.require_stacking()
1631
result_repo.lock_write()
1634
repository_policy = None
1635
return result_repo, result, require_stacking, repository_policy
1637
1824
def _initialize_on_transport_vfs(self, transport):
1638
1825
"""Initialize a new bzrdir using VFS calls.
1962
2198
def set_branch_format(self, format):
1963
2199
self._branch_format = format
1965
def require_stacking(self, stack_on=None, possible_transports=None,
1967
"""We have a request to stack, try to ensure the formats support it.
1969
:param stack_on: If supplied, it is the URL to a branch that we want to
1970
stack on. Check to see if that format supports stacking before
1973
# Stacking is desired. requested by the target, but does the place it
1974
# points at support stacking? If it doesn't then we should
1975
# not implicitly upgrade. We check this here.
1976
new_repo_format = None
1977
new_branch_format = None
1979
# a bit of state for get_target_branch so that we don't try to open it
1980
# 2 times, for both repo *and* branch
1981
target = [None, False, None] # target_branch, checked, upgrade anyway
1982
def get_target_branch():
1984
# We've checked, don't check again
1986
if stack_on is None:
1987
# No target format, that means we want to force upgrading
1988
target[:] = [None, True, True]
1991
target_dir = BzrDir.open(stack_on,
1992
possible_transports=possible_transports)
1993
except errors.NotBranchError:
1994
# Nothing there, don't change formats
1995
target[:] = [None, True, False]
1997
except errors.JailBreak:
1998
# JailBreak, JFDI and upgrade anyway
1999
target[:] = [None, True, True]
2002
target_branch = target_dir.open_branch()
2003
except errors.NotBranchError:
2004
# No branch, don't upgrade formats
2005
target[:] = [None, True, False]
2007
target[:] = [target_branch, True, False]
2010
if (not _skip_repo and
2011
not self.repository_format.supports_external_lookups):
2012
# We need to upgrade the Repository.
2013
target_branch, _, do_upgrade = get_target_branch()
2014
if target_branch is None:
2015
# We don't have a target branch, should we upgrade anyway?
2017
# stack_on is inaccessible, JFDI.
2018
# TODO: bad monkey, hard-coded formats...
2019
if self.repository_format.rich_root_data:
2020
new_repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2022
new_repo_format = pack_repo.RepositoryFormatKnitPack5()
2024
# If the target already supports stacking, then we know the
2025
# project is already able to use stacking, so auto-upgrade
2027
new_repo_format = target_branch.repository._format
2028
if not new_repo_format.supports_external_lookups:
2029
# target doesn't, source doesn't, so don't auto upgrade
2031
new_repo_format = None
2032
if new_repo_format is not None:
2033
self.repository_format = new_repo_format
2034
note('Source repository format does not support stacking,'
2035
' using format:\n %s',
2036
new_repo_format.get_format_description())
2201
def require_stacking(self):
2038
2202
if not self.get_branch_format().supports_stacking():
2039
# We just checked the repo, now lets check if we need to
2040
# upgrade the branch format
2041
target_branch, _, do_upgrade = get_target_branch()
2042
if target_branch is None:
2044
# TODO: bad monkey, hard-coded formats...
2045
new_branch_format = branch.BzrBranchFormat7()
2203
# We need to make a stacked branch, but the default format for the
2204
# target doesn't support stacking. So force a branch that *can*
2206
from bzrlib.branch import BzrBranchFormat7
2207
branch_format = BzrBranchFormat7()
2208
self.set_branch_format(branch_format)
2209
mutter("using %r for stacking" % (branch_format,))
2210
from bzrlib.repofmt import pack_repo
2211
if self.repository_format.rich_root_data:
2212
bzrdir_format_name = '1.6.1-rich-root'
2213
repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2047
new_branch_format = target_branch._format
2048
if not new_branch_format.supports_stacking():
2049
new_branch_format = None
2050
if new_branch_format is not None:
2051
# Does support stacking, use its format.
2052
self.set_branch_format(new_branch_format)
2053
note('Source branch format does not support stacking,'
2054
' using format:\n %s',
2055
new_branch_format.get_format_description())
2215
bzrdir_format_name = '1.6'
2216
repo_format = pack_repo.RepositoryFormatKnitPack5()
2217
note('Source format does not support stacking, using format:'
2219
bzrdir_format_name, repo_format.get_format_description())
2220
self.repository_format = repo_format
2057
2222
def get_converter(self, format=None):
2058
2223
"""See BzrDirFormat.get_converter()."""
2714
2879
return local_dir_format.initialize_on_transport(transport)
2715
2880
client = _SmartClient(client_medium)
2716
2881
path = client.remote_path_from_transport(transport)
2718
response = client.call('BzrDirFormat.initialize', path)
2719
except errors.ErrorFromSmartServer, err:
2720
remote._translate_error(err, path=path)
2882
response = client.call('BzrDirFormat.initialize', path)
2721
2883
if response[0] != 'ok':
2722
2884
raise errors.SmartProtocolError('unexpected response code %s' % (response,))
2723
2885
format = RemoteBzrDirFormat()
2724
2886
self._supply_sub_formats_to(format)
2725
2887
return remote.RemoteBzrDir(transport, format)
2727
def parse_NoneTrueFalse(self, arg):
2734
raise AssertionError("invalid arg %r" % arg)
2736
def _serialize_NoneTrueFalse(self, arg):
2743
def _serialize_NoneString(self, arg):
2746
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
2747
create_prefix=False, force_new_repo=False, stacked_on=None,
2748
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
2751
# hand off the request to the smart server
2752
client_medium = transport.get_smart_medium()
2753
except errors.NoSmartMedium:
2756
# Decline to open it if the server doesn't support our required
2757
# version (3) so that the VFS-based transport will do it.
2758
if client_medium.should_probe():
2760
server_version = client_medium.protocol_version()
2761
if server_version != '2':
2765
except errors.SmartProtocolError:
2766
# Apparently there's no usable smart server there, even though
2767
# the medium supports the smart protocol.
2772
client = _SmartClient(client_medium)
2773
path = client.remote_path_from_transport(transport)
2774
if client_medium._is_remote_before((1, 16)):
2777
# TODO: lookup the local format from a server hint.
2778
local_dir_format = BzrDirMetaFormat1()
2779
self._supply_sub_formats_to(local_dir_format)
2780
return local_dir_format.initialize_on_transport_ex(transport,
2781
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2782
force_new_repo=force_new_repo, stacked_on=stacked_on,
2783
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2784
make_working_trees=make_working_trees, shared_repo=shared_repo,
2786
return self._initialize_on_transport_ex_rpc(client, path, transport,
2787
use_existing_dir, create_prefix, force_new_repo, stacked_on,
2788
stack_on_pwd, repo_format_name, make_working_trees, shared_repo)
2790
def _initialize_on_transport_ex_rpc(self, client, path, transport,
2791
use_existing_dir, create_prefix, force_new_repo, stacked_on,
2792
stack_on_pwd, repo_format_name, make_working_trees, shared_repo):
2794
args.append(self._serialize_NoneTrueFalse(use_existing_dir))
2795
args.append(self._serialize_NoneTrueFalse(create_prefix))
2796
args.append(self._serialize_NoneTrueFalse(force_new_repo))
2797
args.append(self._serialize_NoneString(stacked_on))
2798
# stack_on_pwd is often/usually our transport
2801
stack_on_pwd = transport.relpath(stack_on_pwd)
2802
if not stack_on_pwd:
2804
except errors.PathNotChild:
2806
args.append(self._serialize_NoneString(stack_on_pwd))
2807
args.append(self._serialize_NoneString(repo_format_name))
2808
args.append(self._serialize_NoneTrueFalse(make_working_trees))
2809
args.append(self._serialize_NoneTrueFalse(shared_repo))
2810
request_network_name = self._network_name or \
2811
BzrDirFormat.get_default_format().network_name()
2813
response = client.call('BzrDirFormat.initialize_ex_1.16',
2814
request_network_name, path, *args)
2815
except errors.UnknownSmartMethod:
2816
client._medium._remember_remote_is_before((1,16))
2817
local_dir_format = BzrDirMetaFormat1()
2818
self._supply_sub_formats_to(local_dir_format)
2819
return local_dir_format.initialize_on_transport_ex(transport,
2820
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2821
force_new_repo=force_new_repo, stacked_on=stacked_on,
2822
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2823
make_working_trees=make_working_trees, shared_repo=shared_repo,
2825
except errors.ErrorFromSmartServer, err:
2826
remote._translate_error(err, path=path)
2827
repo_path = response[0]
2828
bzrdir_name = response[6]
2829
require_stacking = response[7]
2830
require_stacking = self.parse_NoneTrueFalse(require_stacking)
2831
format = RemoteBzrDirFormat()
2832
format._network_name = bzrdir_name
2833
self._supply_sub_formats_to(format)
2834
bzrdir = remote.RemoteBzrDir(transport, format, _client=client)
2836
repo_format = remote.response_tuple_to_repo_format(response[1:])
2837
if repo_path == '.':
2840
repo_bzrdir_format = RemoteBzrDirFormat()
2841
repo_bzrdir_format._network_name = response[5]
2842
repo_bzr = remote.RemoteBzrDir(transport.clone(repo_path),
2846
final_stack = response[8] or None
2847
final_stack_pwd = response[9] or None
2849
final_stack_pwd = urlutils.join(
2850
transport.base, final_stack_pwd)
2851
remote_repo = remote.RemoteRepository(repo_bzr, repo_format)
2852
if len(response) > 10:
2853
# Updated server verb that locks remotely.
2854
repo_lock_token = response[10] or None
2855
remote_repo.lock_write(repo_lock_token, _skip_rpc=True)
2857
remote_repo.dont_leave_lock_in_place()
2859
remote_repo.lock_write()
2860
policy = UseExistingRepository(remote_repo, final_stack,
2861
final_stack_pwd, require_stacking)
2862
policy.acquire_repository()
2866
bzrdir._format.set_branch_format(self.get_branch_format())
2867
if require_stacking:
2868
# The repo has already been created, but we need to make sure that
2869
# we'll make a stackable branch.
2870
bzrdir._format.require_stacking(_skip_repo=True)
2871
return remote_repo, bzrdir, require_stacking, policy
2873
2889
def _open(self, transport):
2874
2890
return remote.RemoteBzrDir(transport, self)
2908
2924
BzrDirMetaFormat1._set_repository_format) #.im_func)
2911
controldir.ControlDirFormat.register_server_prober(RemoteBzrProber)
2927
BzrDirFormat.register_control_server_format(RemoteBzrDirFormat)
2930
class BzrDirFormatInfo(object):
2932
def __init__(self, native, deprecated, hidden, experimental):
2933
self.deprecated = deprecated
2934
self.native = native
2935
self.hidden = hidden
2936
self.experimental = experimental
2939
class BzrDirFormatRegistry(registry.Registry):
2940
"""Registry of user-selectable BzrDir subformats.
2942
Differs from BzrDirFormat._control_formats in that it provides sub-formats,
2943
e.g. BzrDirMeta1 with weave repository. Also, it's more user-oriented.
2947
"""Create a BzrDirFormatRegistry."""
2948
self._aliases = set()
2949
self._registration_order = list()
2950
super(BzrDirFormatRegistry, self).__init__()
2953
"""Return a set of the format names which are aliases."""
2954
return frozenset(self._aliases)
2956
def register_metadir(self, key,
2957
repository_format, help, native=True, deprecated=False,
2963
"""Register a metadir subformat.
2965
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
2966
by the Repository/Branch/WorkingTreeformats.
2968
:param repository_format: The fully-qualified repository format class
2970
:param branch_format: Fully-qualified branch format class name as
2972
:param tree_format: Fully-qualified tree format class name as
2975
# This should be expanded to support setting WorkingTree and Branch
2976
# formats, once BzrDirMetaFormat1 supports that.
2977
def _load(full_name):
2978
mod_name, factory_name = full_name.rsplit('.', 1)
2980
mod = __import__(mod_name, globals(), locals(),
2982
except ImportError, e:
2983
raise ImportError('failed to load %s: %s' % (full_name, e))
2985
factory = getattr(mod, factory_name)
2986
except AttributeError:
2987
raise AttributeError('no factory %s in module %r'
2992
bd = BzrDirMetaFormat1()
2993
if branch_format is not None:
2994
bd.set_branch_format(_load(branch_format))
2995
if tree_format is not None:
2996
bd.workingtree_format = _load(tree_format)
2997
if repository_format is not None:
2998
bd.repository_format = _load(repository_format)
3000
self.register(key, helper, help, native, deprecated, hidden,
3001
experimental, alias)
3003
def register(self, key, factory, help, native=True, deprecated=False,
3004
hidden=False, experimental=False, alias=False):
3005
"""Register a BzrDirFormat factory.
3007
The factory must be a callable that takes one parameter: the key.
3008
It must produce an instance of the BzrDirFormat when called.
3010
This function mainly exists to prevent the info object from being
3013
registry.Registry.register(self, key, factory, help,
3014
BzrDirFormatInfo(native, deprecated, hidden, experimental))
3016
self._aliases.add(key)
3017
self._registration_order.append(key)
3019
def register_lazy(self, key, module_name, member_name, help, native=True,
3020
deprecated=False, hidden=False, experimental=False, alias=False):
3021
registry.Registry.register_lazy(self, key, module_name, member_name,
3022
help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
3024
self._aliases.add(key)
3025
self._registration_order.append(key)
3027
def set_default(self, key):
3028
"""Set the 'default' key to be a clone of the supplied key.
3030
This method must be called once and only once.
3032
registry.Registry.register(self, 'default', self.get(key),
3033
self.get_help(key), info=self.get_info(key))
3034
self._aliases.add('default')
3036
def set_default_repository(self, key):
3037
"""Set the FormatRegistry default and Repository default.
3039
This is a transitional method while Repository.set_default_format
3042
if 'default' in self:
3043
self.remove('default')
3044
self.set_default(key)
3045
format = self.get('default')()
3047
def make_bzrdir(self, key):
3048
return self.get(key)()
3050
def help_topic(self, topic):
3052
default_realkey = None
3053
default_help = self.get_help('default')
3055
for key in self._registration_order:
3056
if key == 'default':
3058
help = self.get_help(key)
3059
if help == default_help:
3060
default_realkey = key
3062
help_pairs.append((key, help))
3064
def wrapped(key, help, info):
3066
help = '(native) ' + help
3067
return ':%s:\n%s\n\n' % (key,
3068
textwrap.fill(help, initial_indent=' ',
3069
subsequent_indent=' '))
3070
if default_realkey is not None:
3071
output += wrapped(default_realkey, '(default) %s' % default_help,
3072
self.get_info('default'))
3073
deprecated_pairs = []
3074
experimental_pairs = []
3075
for key, help in help_pairs:
3076
info = self.get_info(key)
3079
elif info.deprecated:
3080
deprecated_pairs.append((key, help))
3081
elif info.experimental:
3082
experimental_pairs.append((key, help))
3084
output += wrapped(key, help, info)
3085
output += "\nSee ``bzr help formats`` for more about storage formats."
3087
if len(experimental_pairs) > 0:
3088
other_output += "Experimental formats are shown below.\n\n"
3089
for key, help in experimental_pairs:
3090
info = self.get_info(key)
3091
other_output += wrapped(key, help, info)
3094
"No experimental formats are available.\n\n"
3095
if len(deprecated_pairs) > 0:
3096
other_output += "\nDeprecated formats are shown below.\n\n"
3097
for key, help in deprecated_pairs:
3098
info = self.get_info(key)
3099
other_output += wrapped(key, help, info)
3102
"\nNo deprecated formats are available.\n\n"
3104
"\nSee ``bzr help formats`` for more about storage formats."
3106
if topic == 'other-formats':
2914
3112
class RepositoryAcquisitionPolicy(object):
3068
3292
return self._repository, False
3071
def register_metadir(registry, key,
3072
repository_format, help, native=True, deprecated=False,
3078
"""Register a metadir subformat.
3080
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
3081
by the Repository/Branch/WorkingTreeformats.
3083
:param repository_format: The fully-qualified repository format class
3085
:param branch_format: Fully-qualified branch format class name as
3087
:param tree_format: Fully-qualified tree format class name as
3090
# This should be expanded to support setting WorkingTree and Branch
3091
# formats, once BzrDirMetaFormat1 supports that.
3092
def _load(full_name):
3093
mod_name, factory_name = full_name.rsplit('.', 1)
3095
mod = __import__(mod_name, globals(), locals(),
3097
except ImportError, e:
3098
raise ImportError('failed to load %s: %s' % (full_name, e))
3100
factory = getattr(mod, factory_name)
3101
except AttributeError:
3102
raise AttributeError('no factory %s in module %r'
3107
bd = BzrDirMetaFormat1()
3108
if branch_format is not None:
3109
bd.set_branch_format(_load(branch_format))
3110
if tree_format is not None:
3111
bd.workingtree_format = _load(tree_format)
3112
if repository_format is not None:
3113
bd.repository_format = _load(repository_format)
3115
registry.register(key, helper, help, native, deprecated, hidden,
3116
experimental, alias)
3295
# Please register new formats after old formats so that formats
3296
# appear in chronological order and format descriptions can build
3298
format_registry = BzrDirFormatRegistry()
3118
3299
# The pre-0.8 formats have their repository format network name registered in
3119
3300
# repository.py. MetaDir formats have their repository format network name
3120
3301
# inferred from their disk format string.
3121
controldir.format_registry.register('weave', BzrDirFormat6,
3302
format_registry.register('weave', BzrDirFormat6,
3122
3303
'Pre-0.8 format. Slower than knit and does not'
3123
3304
' support checkouts or shared repositories.',
3125
3305
deprecated=True)
3126
register_metadir(controldir.format_registry, 'metaweave',
3306
format_registry.register_metadir('metaweave',
3127
3307
'bzrlib.repofmt.weaverepo.RepositoryFormat7',
3128
3308
'Transitional format in 0.8. Slower than knit.',
3129
3309
branch_format='bzrlib.branch.BzrBranchFormat5',
3130
3310
tree_format='bzrlib.workingtree.WorkingTreeFormat3',
3132
3311
deprecated=True)
3133
register_metadir(controldir.format_registry, 'knit',
3312
format_registry.register_metadir('knit',
3134
3313
'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
3135
3314
'Format using knits. Recommended for interoperation with bzr <= 0.14.',
3136
3315
branch_format='bzrlib.branch.BzrBranchFormat5',
3137
3316
tree_format='bzrlib.workingtree.WorkingTreeFormat3',
3139
3317
deprecated=True)
3140
register_metadir(controldir.format_registry, 'dirstate',
3318
format_registry.register_metadir('dirstate',
3141
3319
'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
3142
3320
help='New in 0.15: Fast local operations. Compatible with bzr 0.8 and '
3143
3321
'above when accessed over the network.',
3174
3349
experimental=True,
3177
register_metadir(controldir.format_registry, 'pack-0.92',
3352
format_registry.register_metadir('pack-0.92',
3178
3353
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack1',
3179
3354
help='New in 0.92: Pack-based format with data compatible with '
3180
3355
'dirstate-tags format repositories. Interoperates with '
3181
3356
'bzr repositories before 0.92 but cannot be read by bzr < 0.92. '
3357
'Previously called knitpack-experimental. '
3358
'For more information, see '
3359
'http://doc.bazaar-vcs.org/latest/developers/packrepo.html.',
3183
3360
branch_format='bzrlib.branch.BzrBranchFormat6',
3184
3361
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3186
register_metadir(controldir.format_registry, 'pack-0.92-subtree',
3363
format_registry.register_metadir('pack-0.92-subtree',
3187
3364
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack3',
3188
3365
help='New in 0.92: Pack-based format with data compatible with '
3189
3366
'dirstate-with-subtree format repositories. Interoperates with '
3190
3367
'bzr repositories before 0.92 but cannot be read by bzr < 0.92. '
3368
'Previously called knitpack-experimental. '
3369
'For more information, see '
3370
'http://doc.bazaar-vcs.org/latest/developers/packrepo.html.',
3192
3371
branch_format='bzrlib.branch.BzrBranchFormat6',
3193
3372
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3195
3374
experimental=True,
3197
register_metadir(controldir.format_registry, 'rich-root-pack',
3376
format_registry.register_metadir('rich-root-pack',
3198
3377
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
3199
3378
help='New in 1.0: A variant of pack-0.92 that supports rich-root data '
3200
3379
'(needed for bzr-svn and bzr-git).',
3201
3380
branch_format='bzrlib.branch.BzrBranchFormat6',
3202
3381
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3205
register_metadir(controldir.format_registry, '1.6',
3383
format_registry.register_metadir('1.6',
3206
3384
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5',
3207
3385
help='A format that allows a branch to indicate that there is another '
3208
3386
'(stacked) repository that should be used to access data that is '
3209
3387
'not present locally.',
3210
3388
branch_format='bzrlib.branch.BzrBranchFormat7',
3211
3389
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3214
register_metadir(controldir.format_registry, '1.6.1-rich-root',
3391
format_registry.register_metadir('1.6.1-rich-root',
3215
3392
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5RichRoot',
3216
3393
help='A variant of 1.6 that supports rich-root data '
3217
3394
'(needed for bzr-svn and bzr-git).',
3218
3395
branch_format='bzrlib.branch.BzrBranchFormat7',
3219
3396
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3222
register_metadir(controldir.format_registry, '1.9',
3398
format_registry.register_metadir('1.9',
3223
3399
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3224
3400
help='A repository format using B+tree indexes. These indexes '
3225
3401
'are smaller in size, have smarter caching and provide faster '
3226
3402
'performance for most operations.',
3227
3403
branch_format='bzrlib.branch.BzrBranchFormat7',
3228
3404
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3231
register_metadir(controldir.format_registry, '1.9-rich-root',
3406
format_registry.register_metadir('1.9-rich-root',
3232
3407
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3233
3408
help='A variant of 1.9 that supports rich-root data '
3234
3409
'(needed for bzr-svn and bzr-git).',
3235
3410
branch_format='bzrlib.branch.BzrBranchFormat7',
3236
3411
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3239
register_metadir(controldir.format_registry, '1.14',
3413
format_registry.register_metadir('1.14',
3240
3414
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3241
3415
help='A working-tree format that supports content filtering.',
3242
3416
branch_format='bzrlib.branch.BzrBranchFormat7',
3243
3417
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3245
register_metadir(controldir.format_registry, '1.14-rich-root',
3419
format_registry.register_metadir('1.14-rich-root',
3246
3420
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3247
3421
help='A variant of 1.14 that supports rich-root data '
3248
3422
'(needed for bzr-svn and bzr-git).',
3249
3423
branch_format='bzrlib.branch.BzrBranchFormat7',
3250
3424
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3252
# The following un-numbered 'development' formats should always just be aliases.
3253
register_metadir(controldir.format_registry, 'development-rich-root',
3254
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3255
help='Current development format. Supports rich roots. Can convert data '
3256
'to and from rich-root-pack (and anything compatible with '
3257
'rich-root-pack) format repositories. Repositories and branches in '
3258
'this format can only be read by bzr.dev. Please read '
3259
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3426
# The following two formats should always just be aliases.
3427
format_registry.register_metadir('development',
3428
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3429
help='Current development format. Can convert data to and from pack-0.92 '
3430
'(and anything compatible with pack-0.92) format repositories. '
3431
'Repositories and branches in this format can only be read by bzr.dev. '
3433
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3261
3435
branch_format='bzrlib.branch.BzrBranchFormat7',
3262
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3436
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3263
3437
experimental=True,
3267
register_metadir(controldir.format_registry, 'development5-subtree',
3440
format_registry.register_metadir('development-subtree',
3268
3441
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3269
help='Development format, subtree variant. Can convert data to and '
3270
'from pack-0.92-subtree (and anything compatible with '
3271
'pack-0.92-subtree) format repositories. Repositories and branches in '
3272
'this format can only be read by bzr.dev. Please read '
3273
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3275
branch_format='bzrlib.branch.BzrBranchFormat7',
3276
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3283
register_metadir(controldir.format_registry, 'development-subtree',
3284
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2aSubtree',
3285
3442
help='Current development format, subtree variant. Can convert data to and '
3286
3443
'from pack-0.92-subtree (and anything compatible with '
3287
3444
'pack-0.92-subtree) format repositories. Repositories and branches in '
3288
3445
'this format can only be read by bzr.dev. Please read '
3289
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3446
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3291
3448
branch_format='bzrlib.branch.BzrBranchFormat7',
3292
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3449
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3293
3450
experimental=True,
3295
alias=False, # Restore to being an alias when an actual development subtree format is added
3296
# This current non-alias status is simply because we did not introduce a
3297
# chk based subtree format.
3300
3453
# And the development formats above will have aliased one of the following:
3301
register_metadir(controldir.format_registry, 'development6-rich-root',
3302
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3303
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3305
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3307
branch_format='bzrlib.branch.BzrBranchFormat7',
3308
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3313
register_metadir(controldir.format_registry, 'development7-rich-root',
3314
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK2',
3315
help='pack-1.9 with 255-way hashed CHK inv, bencode revision, group compress, '
3316
'rich roots. Please read '
3317
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3319
branch_format='bzrlib.branch.BzrBranchFormat7',
3320
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3325
register_metadir(controldir.format_registry, '2a',
3326
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3327
help='First format for bzr 2.0 series.\n'
3328
'Uses group-compress storage.\n'
3329
'Provides rich roots which are a one-way transition.\n',
3330
# 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, '
3331
# 'rich roots. Supported by bzr 1.16 and later.',
3332
branch_format='bzrlib.branch.BzrBranchFormat7',
3333
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3454
format_registry.register_metadir('development2',
3455
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3456
help='1.6.1 with B+Tree based index. '
3458
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3460
branch_format='bzrlib.branch.BzrBranchFormat7',
3461
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3465
format_registry.register_metadir('development2-subtree',
3466
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3467
help='1.6.1-subtree with B+Tree based index. '
3469
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3471
branch_format='bzrlib.branch.BzrBranchFormat7',
3472
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3476
# These next two formats should be removed when the gc formats are
3477
# updated to use WorkingTreeFormat6 and are merged into bzr.dev
3478
format_registry.register_metadir('development-wt6',
3479
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3480
help='1.14 with filtered views. '
3482
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3484
branch_format='bzrlib.branch.BzrBranchFormat7',
3485
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3489
format_registry.register_metadir('development-wt6-rich-root',
3490
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3491
help='A variant of development-wt6 that supports rich-root data '
3492
'(needed for bzr-svn and bzr-git).',
3493
branch_format='bzrlib.branch.BzrBranchFormat7',
3494
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3337
3498
# The following format should be an alias for the rich root equivalent
3338
3499
# of the default format
3339
register_metadir(controldir.format_registry, 'default-rich-root',
3340
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3341
branch_format='bzrlib.branch.BzrBranchFormat7',
3342
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3500
format_registry.register_metadir('default-rich-root',
3501
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
3502
help='Default format, rich root variant. (needed for bzr-svn and bzr-git).',
3503
branch_format='bzrlib.branch.BzrBranchFormat6',
3504
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3347
3507
# The current format that is made on 'bzr init'.
3348
controldir.format_registry.set_default('2a')
3350
# XXX 2010-08-20 JRV: There is still a lot of code relying on
3351
# bzrlib.bzrdir.format_registry existing. When BzrDir.create/BzrDir.open/etc
3352
# get changed to ControlDir.create/ControlDir.open/etc this should be removed.
3353
format_registry = controldir.format_registry
3508
format_registry.set_default('pack-0.92')