230
210
errors.UnstackableRepositoryFormat,
231
211
errors.NotStacked):
233
# Bug: We create a metadir without knowing if it can support stacking,
234
# we should look up the policy needs first, or just use it as a hint,
215
# may need to copy content in
216
repository_policy = result.determine_repository_policy(
217
force_new_repo, stacked_on, self.root_transport.base,
218
require_stacking=require_stacking)
237
219
make_working_trees = local_repo.make_working_trees()
238
want_shared = local_repo.is_shared()
239
repo_format_name = format.repository_format.network_name()
241
make_working_trees = False
243
repo_format_name = None
245
result_repo, result, require_stacking, repository_policy = \
246
format.initialize_on_transport_ex(transport,
247
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
248
force_new_repo=force_new_repo, stacked_on=stacked_on,
249
stack_on_pwd=self.root_transport.base,
250
repo_format_name=repo_format_name,
251
make_working_trees=make_working_trees, shared_repo=want_shared)
254
# If the result repository is in the same place as the
255
# resulting bzr dir, it will have no content, further if the
256
# result is not stacked then we know all content should be
257
# copied, and finally if we are copying up to a specific
258
# revision_id then we can use the pending-ancestry-result which
259
# does not require traversing all of history to describe it.
260
if (result_repo.user_url == result.user_url
261
and not require_stacking and
262
revision_id is not None):
263
fetch_spec = graph.PendingAncestryResult(
264
[revision_id], local_repo)
265
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
267
result_repo.fetch(local_repo, revision_id=revision_id)
271
if result_repo is not None:
272
raise AssertionError('result_repo not None(%r)' % result_repo)
220
result_repo, is_new_repo = repository_policy.acquire_repository(
221
make_working_trees, local_repo.is_shared())
222
if not require_stacking and repository_policy._require_stacking:
223
require_stacking = True
224
result._format.require_stacking()
225
if is_new_repo and not require_stacking and revision_id is not None:
226
fetch_spec = graph.PendingAncestryResult(
227
[revision_id], local_repo)
228
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
230
result_repo.fetch(local_repo, revision_id=revision_id)
273
233
# 1 if there is a branch present
274
234
# make sure its content is available in the target repository
912
1056
format, repository = self._cloning_metadir()
913
1057
if format._workingtree_format is None:
915
1058
if repository is None:
916
# No repository either
918
# We have a repository, so set a working tree? (Why? This seems to
919
# contradict the stated return value in the docstring).
920
1060
tree_format = repository._format._matchingbzrdir.workingtree_format
921
1061
format.workingtree_format = tree_format.__class__()
922
1062
if require_stacking:
923
1063
format.require_stacking()
927
def create(cls, base, format=None, possible_transports=None):
928
"""Create a new BzrDir at the url 'base'.
930
:param format: If supplied, the format of branch to create. If not
931
supplied, the default is used.
932
:param possible_transports: If supplied, a list of transports that
933
can be reused to share a remote connection.
935
if cls is not BzrDir:
936
raise AssertionError("BzrDir.create always creates the"
937
"default format, not one of %r" % cls)
938
t = get_transport(base, possible_transports)
941
format = controldir.ControlDirFormat.get_default_format()
942
return format.initialize_on_transport(t)
946
class BzrDirHooks(hooks.Hooks):
947
"""Hooks for BzrDir operations."""
950
"""Create the default hooks."""
951
hooks.Hooks.__init__(self)
952
self.create_hook(hooks.HookPoint('pre_open',
953
"Invoked before attempting to open a BzrDir with the transport "
954
"that the open will use.", (1, 14), None))
955
self.create_hook(hooks.HookPoint('post_repo_init',
956
"Invoked after a repository has been initialized. "
957
"post_repo_init is called with a "
958
"bzrlib.bzrdir.RepoInitHookParams.",
961
# install the default hooks
962
BzrDir.hooks = BzrDirHooks()
965
class RepoInitHookParams(object):
966
"""Object holding parameters passed to *_repo_init hooks.
968
There are 4 fields that hooks may wish to access:
970
:ivar repository: Repository created
971
:ivar format: Repository format
972
:ivar bzrdir: The bzrdir for the repository
973
:ivar shared: The repository is shared
976
def __init__(self, repository, format, a_bzrdir, shared):
977
"""Create a group of RepoInitHook parameters.
979
:param repository: Repository created
980
:param format: Repository format
981
:param bzrdir: The bzrdir for the repository
982
:param shared: The repository is shared
984
self.repository = repository
986
self.bzrdir = a_bzrdir
989
def __eq__(self, other):
990
return self.__dict__ == other.__dict__
994
return "<%s for %s>" % (self.__class__.__name__,
997
return "<%s for %s>" % (self.__class__.__name__,
1066
def checkout_metadir(self):
1067
return self.cloning_metadir()
1069
def sprout(self, url, revision_id=None, force_new_repo=False,
1070
recurse='down', possible_transports=None,
1071
accelerator_tree=None, hardlink=False, stacked=False,
1072
source_branch=None, create_tree_if_local=True):
1073
"""Create a copy of this bzrdir prepared for use as a new line of
1076
If url's last component does not exist, it will be created.
1078
Attributes related to the identity of the source branch like
1079
branch nickname will be cleaned, a working tree is created
1080
whether one existed before or not; and a local branch is always
1083
if revision_id is not None, then the clone operation may tune
1084
itself to download less data.
1085
:param accelerator_tree: A tree which can be used for retrieving file
1086
contents more quickly than the revision tree, i.e. a workingtree.
1087
The revision tree will be used for cases where accelerator_tree's
1088
content is different.
1089
:param hardlink: If true, hard-link files from accelerator_tree,
1091
:param stacked: If true, create a stacked branch referring to the
1092
location of this control directory.
1093
:param create_tree_if_local: If true, a working-tree will be created
1094
when working locally.
1096
target_transport = get_transport(url, possible_transports)
1097
target_transport.ensure_base()
1098
cloning_format = self.cloning_metadir(stacked)
1099
# Create/update the result branch
1100
result = cloning_format.initialize_on_transport(target_transport)
1101
# if a stacked branch wasn't requested, we don't create one
1102
# even if the origin was stacked
1103
stacked_branch_url = None
1104
if source_branch is not None:
1106
stacked_branch_url = self.root_transport.base
1107
source_repository = source_branch.repository
1110
source_branch = self.open_branch()
1111
source_repository = source_branch.repository
1113
stacked_branch_url = self.root_transport.base
1114
except errors.NotBranchError:
1115
source_branch = None
1117
source_repository = self.open_repository()
1118
except errors.NoRepositoryPresent:
1119
source_repository = None
1120
repository_policy = result.determine_repository_policy(
1121
force_new_repo, stacked_branch_url, require_stacking=stacked)
1122
result_repo, is_new_repo = repository_policy.acquire_repository()
1123
if is_new_repo and revision_id is not None and not stacked:
1124
fetch_spec = graph.PendingAncestryResult(
1125
[revision_id], source_repository)
1128
if source_repository is not None:
1129
# Fetch while stacked to prevent unstacked fetch from
1131
if fetch_spec is None:
1132
result_repo.fetch(source_repository, revision_id=revision_id)
1134
result_repo.fetch(source_repository, fetch_spec=fetch_spec)
1136
if source_branch is None:
1137
# this is for sprouting a bzrdir without a branch; is that
1139
# Not especially, but it's part of the contract.
1140
result_branch = result.create_branch()
1142
result_branch = source_branch.sprout(result,
1143
revision_id=revision_id, repository_policy=repository_policy)
1144
mutter("created new branch %r" % (result_branch,))
1146
# Create/update the result working tree
1147
if (create_tree_if_local and
1148
isinstance(target_transport, local.LocalTransport) and
1149
(result_repo is None or result_repo.make_working_trees())):
1150
wt = result.create_workingtree(accelerator_tree=accelerator_tree,
1154
if wt.path2id('') is None:
1156
wt.set_root_id(self.open_workingtree.get_root_id())
1157
except errors.NoWorkingTree:
1163
if recurse == 'down':
1165
basis = wt.basis_tree()
1167
subtrees = basis.iter_references()
1168
elif result_branch is not None:
1169
basis = result_branch.basis_tree()
1171
subtrees = basis.iter_references()
1172
elif source_branch is not None:
1173
basis = source_branch.basis_tree()
1175
subtrees = basis.iter_references()
1180
for path, file_id in subtrees:
1181
target = urlutils.join(url, urlutils.escape(path))
1182
sublocation = source_branch.reference_parent(file_id, path)
1183
sublocation.bzrdir.sprout(target,
1184
basis.get_reference_revision(file_id, path),
1185
force_new_repo=force_new_repo, recurse=recurse,
1188
if basis is not None:
1001
1193
class BzrDirPreSplitOut(BzrDir):
1456
1612
return format.open(self, _found=True)
1458
1614
def _get_config(self):
1459
return config.TransportConfig(self.transport, 'control.conf')
1462
class BzrProber(controldir.Prober):
1463
"""Prober for formats that use a .bzr/ control directory."""
1466
"""The known .bzr formats."""
1469
def register_bzrdir_format(klass, format):
1470
klass._formats[format.get_format_string()] = format
1473
def unregister_bzrdir_format(klass, format):
1474
del klass._formats[format.get_format_string()]
1477
def probe_transport(klass, transport):
1478
"""Return the .bzrdir style format present in a directory."""
1480
format_string = transport.get_bytes(".bzr/branch-format")
1481
except errors.NoSuchFile:
1482
raise errors.NotBranchError(path=transport.base)
1484
return klass._formats[format_string]
1486
raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1489
controldir.ControlDirFormat.register_prober(BzrProber)
1492
class RemoteBzrProber(controldir.Prober):
1493
"""Prober for remote servers that provide a Bazaar smart server."""
1496
def probe_transport(klass, transport):
1497
"""Return a RemoteBzrDirFormat object if it looks possible."""
1499
medium = transport.get_smart_medium()
1500
except (NotImplementedError, AttributeError,
1501
errors.TransportNotPossible, errors.NoSmartMedium,
1502
errors.SmartProtocolError):
1503
# no smart server, so not a branch for this format type.
1504
raise errors.NotBranchError(path=transport.base)
1506
# Decline to open it if the server doesn't support our required
1507
# version (3) so that the VFS-based transport will do it.
1508
if medium.should_probe():
1510
server_version = medium.protocol_version()
1511
except errors.SmartProtocolError:
1512
# Apparently there's no usable smart server there, even though
1513
# the medium supports the smart protocol.
1514
raise errors.NotBranchError(path=transport.base)
1515
if server_version != '2':
1516
raise errors.NotBranchError(path=transport.base)
1517
return RemoteBzrDirFormat()
1520
class BzrDirFormat(controldir.ControlDirFormat):
1521
"""ControlDirFormat base class for .bzr/ directories.
1615
return config.BzrDirConfig(self.transport)
1618
class BzrDirFormat(object):
1619
"""An encapsulation of the initialization and open routines for a format.
1621
Formats provide three things:
1622
* An initialization routine,
1523
1626
Formats are placed in a dict by their format string for reference
1524
1627
during bzrdir opening. These should be subclasses of BzrDirFormat
1529
1632
object will be created every system load.
1635
_default_format = None
1636
"""The default format used for new .bzr dirs."""
1639
"""The known formats."""
1641
_control_formats = []
1642
"""The registered control formats - .bzr, ....
1644
This is a list of BzrDirFormat objects.
1647
_control_server_formats = []
1648
"""The registered control server formats, e.g. RemoteBzrDirs.
1650
This is a list of BzrDirFormat objects.
1532
1653
_lock_file_name = 'branch-lock'
1534
1655
# _lock_class must be set in subclasses to the lock type, typ.
1535
1656
# TransportLock or LockDir
1659
def find_format(klass, transport, _server_formats=True):
1660
"""Return the format present at transport."""
1662
formats = klass._control_server_formats + klass._control_formats
1664
formats = klass._control_formats
1665
for format in formats:
1667
return format.probe_transport(transport)
1668
except errors.NotBranchError:
1669
# this format does not find a control dir here.
1671
raise errors.NotBranchError(path=transport.base)
1674
def probe_transport(klass, transport):
1675
"""Return the .bzrdir style format present in a directory."""
1677
format_string = transport.get(".bzr/branch-format").read()
1678
except errors.NoSuchFile:
1679
raise errors.NotBranchError(path=transport.base)
1682
return klass._formats[format_string]
1684
raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1687
def get_default_format(klass):
1688
"""Return the current default format."""
1689
return klass._default_format
1537
1691
def get_format_string(self):
1538
1692
"""Return the ASCII format string that identifies this format."""
1539
1693
raise NotImplementedError(self.get_format_string)
1695
def get_format_description(self):
1696
"""Return the short description for this format."""
1697
raise NotImplementedError(self.get_format_description)
1699
def get_converter(self, format=None):
1700
"""Return the converter to use to convert bzrdirs needing converts.
1702
This returns a bzrlib.bzrdir.Converter object.
1704
This should return the best upgrader to step this format towards the
1705
current default format. In the case of plugins we can/should provide
1706
some means for them to extend the range of returnable converters.
1708
:param format: Optional format to override the default format of the
1711
raise NotImplementedError(self.get_converter)
1713
def initialize(self, url, possible_transports=None):
1714
"""Create a bzr control dir at this url and return an opened copy.
1716
Subclasses should typically override initialize_on_transport
1717
instead of this method.
1719
return self.initialize_on_transport(get_transport(url,
1720
possible_transports))
1541
1722
def initialize_on_transport(self, transport):
1542
1723
"""Initialize a new bzrdir in the base directory of a Transport."""
1556
1737
self._supply_sub_formats_to(remote_format)
1557
1738
return remote_format.initialize_on_transport(transport)
1559
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
1560
create_prefix=False, force_new_repo=False, stacked_on=None,
1561
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
1562
shared_repo=False, vfs_only=False):
1563
"""Create this format on transport.
1565
The directory to initialize will be created.
1567
:param force_new_repo: Do not use a shared repository for the target,
1568
even if one is available.
1569
:param create_prefix: Create any missing directories leading up to
1571
:param use_existing_dir: Use an existing directory if one exists.
1572
:param stacked_on: A url to stack any created branch on, None to follow
1573
any target stacking policy.
1574
:param stack_on_pwd: If stack_on is relative, the location it is
1576
:param repo_format_name: If non-None, a repository will be
1577
made-or-found. Should none be found, or if force_new_repo is True
1578
the repo_format_name is used to select the format of repository to
1580
:param make_working_trees: Control the setting of make_working_trees
1581
for a new shared repository when one is made. None to use whatever
1582
default the format has.
1583
:param shared_repo: Control whether made repositories are shared or
1585
:param vfs_only: If True do not attempt to use a smart server
1586
:return: repo, bzrdir, require_stacking, repository_policy. repo is
1587
None if none was created or found, bzrdir is always valid.
1588
require_stacking is the result of examining the stacked_on
1589
parameter and any stacking policy found for the target.
1592
# Try to hand off to a smart server
1594
client_medium = transport.get_smart_medium()
1595
except errors.NoSmartMedium:
1598
# TODO: lookup the local format from a server hint.
1599
remote_dir_format = RemoteBzrDirFormat()
1600
remote_dir_format._network_name = self.network_name()
1601
self._supply_sub_formats_to(remote_dir_format)
1602
return remote_dir_format.initialize_on_transport_ex(transport,
1603
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
1604
force_new_repo=force_new_repo, stacked_on=stacked_on,
1605
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
1606
make_working_trees=make_working_trees, shared_repo=shared_repo)
1607
# XXX: Refactor the create_prefix/no_create_prefix code into a
1608
# common helper function
1609
# The destination may not exist - if so make it according to policy.
1610
def make_directory(transport):
1611
transport.mkdir('.')
1613
def redirected(transport, e, redirection_notice):
1614
note(redirection_notice)
1615
return transport._redirected_to(e.source, e.target)
1617
transport = do_catching_redirections(make_directory, transport,
1619
except errors.FileExists:
1620
if not use_existing_dir:
1622
except errors.NoSuchFile:
1623
if not create_prefix:
1625
transport.create_prefix()
1627
require_stacking = (stacked_on is not None)
1628
# Now the target directory exists, but doesn't have a .bzr
1629
# directory. So we need to create it, along with any work to create
1630
# all of the dependent branches, etc.
1632
result = self.initialize_on_transport(transport)
1633
if repo_format_name:
1635
# use a custom format
1636
result._format.repository_format = \
1637
repository.network_format_registry.get(repo_format_name)
1638
except AttributeError:
1639
# The format didn't permit it to be set.
1641
# A repository is desired, either in-place or shared.
1642
repository_policy = result.determine_repository_policy(
1643
force_new_repo, stacked_on, stack_on_pwd,
1644
require_stacking=require_stacking)
1645
result_repo, is_new_repo = repository_policy.acquire_repository(
1646
make_working_trees, shared_repo)
1647
if not require_stacking and repository_policy._require_stacking:
1648
require_stacking = True
1649
result._format.require_stacking()
1650
result_repo.lock_write()
1653
repository_policy = None
1654
return result_repo, result, require_stacking, repository_policy
1656
1740
def _initialize_on_transport_vfs(self, transport):
1657
1741
"""Initialize a new bzrdir using VFS calls.
1981
2114
def set_branch_format(self, format):
1982
2115
self._branch_format = format
1984
def require_stacking(self, stack_on=None, possible_transports=None,
1986
"""We have a request to stack, try to ensure the formats support it.
1988
:param stack_on: If supplied, it is the URL to a branch that we want to
1989
stack on. Check to see if that format supports stacking before
1992
# Stacking is desired. requested by the target, but does the place it
1993
# points at support stacking? If it doesn't then we should
1994
# not implicitly upgrade. We check this here.
1995
new_repo_format = None
1996
new_branch_format = None
1998
# a bit of state for get_target_branch so that we don't try to open it
1999
# 2 times, for both repo *and* branch
2000
target = [None, False, None] # target_branch, checked, upgrade anyway
2001
def get_target_branch():
2003
# We've checked, don't check again
2005
if stack_on is None:
2006
# No target format, that means we want to force upgrading
2007
target[:] = [None, True, True]
2010
target_dir = BzrDir.open(stack_on,
2011
possible_transports=possible_transports)
2012
except errors.NotBranchError:
2013
# Nothing there, don't change formats
2014
target[:] = [None, True, False]
2016
except errors.JailBreak:
2017
# JailBreak, JFDI and upgrade anyway
2018
target[:] = [None, True, True]
2021
target_branch = target_dir.open_branch()
2022
except errors.NotBranchError:
2023
# No branch, don't upgrade formats
2024
target[:] = [None, True, False]
2026
target[:] = [target_branch, True, False]
2029
if (not _skip_repo and
2030
not self.repository_format.supports_external_lookups):
2031
# We need to upgrade the Repository.
2032
target_branch, _, do_upgrade = get_target_branch()
2033
if target_branch is None:
2034
# We don't have a target branch, should we upgrade anyway?
2036
# stack_on is inaccessible, JFDI.
2037
# TODO: bad monkey, hard-coded formats...
2038
if self.repository_format.rich_root_data:
2039
new_repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2041
new_repo_format = pack_repo.RepositoryFormatKnitPack5()
2043
# If the target already supports stacking, then we know the
2044
# project is already able to use stacking, so auto-upgrade
2046
new_repo_format = target_branch.repository._format
2047
if not new_repo_format.supports_external_lookups:
2048
# target doesn't, source doesn't, so don't auto upgrade
2050
new_repo_format = None
2051
if new_repo_format is not None:
2052
self.repository_format = new_repo_format
2053
note('Source repository format does not support stacking,'
2054
' using format:\n %s',
2055
new_repo_format.get_format_description())
2117
def require_stacking(self):
2057
2118
if not self.get_branch_format().supports_stacking():
2058
# We just checked the repo, now lets check if we need to
2059
# upgrade the branch format
2060
target_branch, _, do_upgrade = get_target_branch()
2061
if target_branch is None:
2063
# TODO: bad monkey, hard-coded formats...
2064
new_branch_format = branch.BzrBranchFormat7()
2119
# We need to make a stacked branch, but the default format for the
2120
# target doesn't support stacking. So force a branch that *can*
2122
from bzrlib.branch import BzrBranchFormat7
2123
branch_format = BzrBranchFormat7()
2124
self.set_branch_format(branch_format)
2125
mutter("using %r for stacking" % (branch_format,))
2126
from bzrlib.repofmt import pack_repo
2127
if self.repository_format.rich_root_data:
2128
bzrdir_format_name = '1.6.1-rich-root'
2129
repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2066
new_branch_format = target_branch._format
2067
if not new_branch_format.supports_stacking():
2068
new_branch_format = None
2069
if new_branch_format is not None:
2070
# Does support stacking, use its format.
2071
self.set_branch_format(new_branch_format)
2072
note('Source branch format does not support stacking,'
2073
' using format:\n %s',
2074
new_branch_format.get_format_description())
2131
bzrdir_format_name = '1.6'
2132
repo_format = pack_repo.RepositoryFormatKnitPack5()
2133
note('Source format does not support stacking, using format:'
2135
bzrdir_format_name, repo_format.get_format_description())
2136
self.repository_format = repo_format
2076
2138
def get_converter(self, format=None):
2077
2139
"""See BzrDirFormat.get_converter()."""
2740
2795
return local_dir_format.initialize_on_transport(transport)
2741
2796
client = _SmartClient(client_medium)
2742
2797
path = client.remote_path_from_transport(transport)
2744
response = client.call('BzrDirFormat.initialize', path)
2745
except errors.ErrorFromSmartServer, err:
2746
remote._translate_error(err, path=path)
2798
response = client.call('BzrDirFormat.initialize', path)
2747
2799
if response[0] != 'ok':
2748
2800
raise errors.SmartProtocolError('unexpected response code %s' % (response,))
2749
2801
format = RemoteBzrDirFormat()
2750
2802
self._supply_sub_formats_to(format)
2751
2803
return remote.RemoteBzrDir(transport, format)
2753
def parse_NoneTrueFalse(self, arg):
2760
raise AssertionError("invalid arg %r" % arg)
2762
def _serialize_NoneTrueFalse(self, arg):
2769
def _serialize_NoneString(self, arg):
2772
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
2773
create_prefix=False, force_new_repo=False, stacked_on=None,
2774
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
2777
# hand off the request to the smart server
2778
client_medium = transport.get_smart_medium()
2779
except errors.NoSmartMedium:
2782
# Decline to open it if the server doesn't support our required
2783
# version (3) so that the VFS-based transport will do it.
2784
if client_medium.should_probe():
2786
server_version = client_medium.protocol_version()
2787
if server_version != '2':
2791
except errors.SmartProtocolError:
2792
# Apparently there's no usable smart server there, even though
2793
# the medium supports the smart protocol.
2798
client = _SmartClient(client_medium)
2799
path = client.remote_path_from_transport(transport)
2800
if client_medium._is_remote_before((1, 16)):
2803
# TODO: lookup the local format from a server hint.
2804
local_dir_format = BzrDirMetaFormat1()
2805
self._supply_sub_formats_to(local_dir_format)
2806
return local_dir_format.initialize_on_transport_ex(transport,
2807
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2808
force_new_repo=force_new_repo, stacked_on=stacked_on,
2809
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2810
make_working_trees=make_working_trees, shared_repo=shared_repo,
2812
return self._initialize_on_transport_ex_rpc(client, path, transport,
2813
use_existing_dir, create_prefix, force_new_repo, stacked_on,
2814
stack_on_pwd, repo_format_name, make_working_trees, shared_repo)
2816
def _initialize_on_transport_ex_rpc(self, client, path, transport,
2817
use_existing_dir, create_prefix, force_new_repo, stacked_on,
2818
stack_on_pwd, repo_format_name, make_working_trees, shared_repo):
2820
args.append(self._serialize_NoneTrueFalse(use_existing_dir))
2821
args.append(self._serialize_NoneTrueFalse(create_prefix))
2822
args.append(self._serialize_NoneTrueFalse(force_new_repo))
2823
args.append(self._serialize_NoneString(stacked_on))
2824
# stack_on_pwd is often/usually our transport
2827
stack_on_pwd = transport.relpath(stack_on_pwd)
2828
if not stack_on_pwd:
2830
except errors.PathNotChild:
2832
args.append(self._serialize_NoneString(stack_on_pwd))
2833
args.append(self._serialize_NoneString(repo_format_name))
2834
args.append(self._serialize_NoneTrueFalse(make_working_trees))
2835
args.append(self._serialize_NoneTrueFalse(shared_repo))
2836
request_network_name = self._network_name or \
2837
BzrDirFormat.get_default_format().network_name()
2839
response = client.call('BzrDirFormat.initialize_ex_1.16',
2840
request_network_name, path, *args)
2841
except errors.UnknownSmartMethod:
2842
client._medium._remember_remote_is_before((1,16))
2843
local_dir_format = BzrDirMetaFormat1()
2844
self._supply_sub_formats_to(local_dir_format)
2845
return local_dir_format.initialize_on_transport_ex(transport,
2846
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2847
force_new_repo=force_new_repo, stacked_on=stacked_on,
2848
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2849
make_working_trees=make_working_trees, shared_repo=shared_repo,
2851
except errors.ErrorFromSmartServer, err:
2852
remote._translate_error(err, path=path)
2853
repo_path = response[0]
2854
bzrdir_name = response[6]
2855
require_stacking = response[7]
2856
require_stacking = self.parse_NoneTrueFalse(require_stacking)
2857
format = RemoteBzrDirFormat()
2858
format._network_name = bzrdir_name
2859
self._supply_sub_formats_to(format)
2860
bzrdir = remote.RemoteBzrDir(transport, format, _client=client)
2862
repo_format = remote.response_tuple_to_repo_format(response[1:])
2863
if repo_path == '.':
2866
repo_bzrdir_format = RemoteBzrDirFormat()
2867
repo_bzrdir_format._network_name = response[5]
2868
repo_bzr = remote.RemoteBzrDir(transport.clone(repo_path),
2872
final_stack = response[8] or None
2873
final_stack_pwd = response[9] or None
2875
final_stack_pwd = urlutils.join(
2876
transport.base, final_stack_pwd)
2877
remote_repo = remote.RemoteRepository(repo_bzr, repo_format)
2878
if len(response) > 10:
2879
# Updated server verb that locks remotely.
2880
repo_lock_token = response[10] or None
2881
remote_repo.lock_write(repo_lock_token, _skip_rpc=True)
2883
remote_repo.dont_leave_lock_in_place()
2885
remote_repo.lock_write()
2886
policy = UseExistingRepository(remote_repo, final_stack,
2887
final_stack_pwd, require_stacking)
2888
policy.acquire_repository()
2892
bzrdir._format.set_branch_format(self.get_branch_format())
2893
if require_stacking:
2894
# The repo has already been created, but we need to make sure that
2895
# we'll make a stackable branch.
2896
bzrdir._format.require_stacking(_skip_repo=True)
2897
return remote_repo, bzrdir, require_stacking, policy
2899
2805
def _open(self, transport):
2900
2806
return remote.RemoteBzrDir(transport, self)
2934
2840
BzrDirMetaFormat1._set_repository_format) #.im_func)
2937
controldir.ControlDirFormat.register_server_prober(RemoteBzrProber)
2843
BzrDirFormat.register_control_server_format(RemoteBzrDirFormat)
2846
class BzrDirFormatInfo(object):
2848
def __init__(self, native, deprecated, hidden, experimental):
2849
self.deprecated = deprecated
2850
self.native = native
2851
self.hidden = hidden
2852
self.experimental = experimental
2855
class BzrDirFormatRegistry(registry.Registry):
2856
"""Registry of user-selectable BzrDir subformats.
2858
Differs from BzrDirFormat._control_formats in that it provides sub-formats,
2859
e.g. BzrDirMeta1 with weave repository. Also, it's more user-oriented.
2863
"""Create a BzrDirFormatRegistry."""
2864
self._aliases = set()
2865
self._registration_order = list()
2866
super(BzrDirFormatRegistry, self).__init__()
2869
"""Return a set of the format names which are aliases."""
2870
return frozenset(self._aliases)
2872
def register_metadir(self, key,
2873
repository_format, help, native=True, deprecated=False,
2879
"""Register a metadir subformat.
2881
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
2882
by the Repository/Branch/WorkingTreeformats.
2884
:param repository_format: The fully-qualified repository format class
2886
:param branch_format: Fully-qualified branch format class name as
2888
:param tree_format: Fully-qualified tree format class name as
2891
# This should be expanded to support setting WorkingTree and Branch
2892
# formats, once BzrDirMetaFormat1 supports that.
2893
def _load(full_name):
2894
mod_name, factory_name = full_name.rsplit('.', 1)
2896
mod = __import__(mod_name, globals(), locals(),
2898
except ImportError, e:
2899
raise ImportError('failed to load %s: %s' % (full_name, e))
2901
factory = getattr(mod, factory_name)
2902
except AttributeError:
2903
raise AttributeError('no factory %s in module %r'
2908
bd = BzrDirMetaFormat1()
2909
if branch_format is not None:
2910
bd.set_branch_format(_load(branch_format))
2911
if tree_format is not None:
2912
bd.workingtree_format = _load(tree_format)
2913
if repository_format is not None:
2914
bd.repository_format = _load(repository_format)
2916
self.register(key, helper, help, native, deprecated, hidden,
2917
experimental, alias)
2919
def register(self, key, factory, help, native=True, deprecated=False,
2920
hidden=False, experimental=False, alias=False):
2921
"""Register a BzrDirFormat factory.
2923
The factory must be a callable that takes one parameter: the key.
2924
It must produce an instance of the BzrDirFormat when called.
2926
This function mainly exists to prevent the info object from being
2929
registry.Registry.register(self, key, factory, help,
2930
BzrDirFormatInfo(native, deprecated, hidden, experimental))
2932
self._aliases.add(key)
2933
self._registration_order.append(key)
2935
def register_lazy(self, key, module_name, member_name, help, native=True,
2936
deprecated=False, hidden=False, experimental=False, alias=False):
2937
registry.Registry.register_lazy(self, key, module_name, member_name,
2938
help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
2940
self._aliases.add(key)
2941
self._registration_order.append(key)
2943
def set_default(self, key):
2944
"""Set the 'default' key to be a clone of the supplied key.
2946
This method must be called once and only once.
2948
registry.Registry.register(self, 'default', self.get(key),
2949
self.get_help(key), info=self.get_info(key))
2950
self._aliases.add('default')
2952
def set_default_repository(self, key):
2953
"""Set the FormatRegistry default and Repository default.
2955
This is a transitional method while Repository.set_default_format
2958
if 'default' in self:
2959
self.remove('default')
2960
self.set_default(key)
2961
format = self.get('default')()
2963
def make_bzrdir(self, key):
2964
return self.get(key)()
2966
def help_topic(self, topic):
2968
default_realkey = None
2969
default_help = self.get_help('default')
2971
for key in self._registration_order:
2972
if key == 'default':
2974
help = self.get_help(key)
2975
if help == default_help:
2976
default_realkey = key
2978
help_pairs.append((key, help))
2980
def wrapped(key, help, info):
2982
help = '(native) ' + help
2983
return ':%s:\n%s\n\n' % (key,
2984
textwrap.fill(help, initial_indent=' ',
2985
subsequent_indent=' '))
2986
if default_realkey is not None:
2987
output += wrapped(default_realkey, '(default) %s' % default_help,
2988
self.get_info('default'))
2989
deprecated_pairs = []
2990
experimental_pairs = []
2991
for key, help in help_pairs:
2992
info = self.get_info(key)
2995
elif info.deprecated:
2996
deprecated_pairs.append((key, help))
2997
elif info.experimental:
2998
experimental_pairs.append((key, help))
3000
output += wrapped(key, help, info)
3001
output += "\nSee ``bzr help formats`` for more about storage formats."
3003
if len(experimental_pairs) > 0:
3004
other_output += "Experimental formats are shown below.\n\n"
3005
for key, help in experimental_pairs:
3006
info = self.get_info(key)
3007
other_output += wrapped(key, help, info)
3010
"No experimental formats are available.\n\n"
3011
if len(deprecated_pairs) > 0:
3012
other_output += "\nDeprecated formats are shown below.\n\n"
3013
for key, help in deprecated_pairs:
3014
info = self.get_info(key)
3015
other_output += wrapped(key, help, info)
3018
"\nNo deprecated formats are available.\n\n"
3020
"\nSee ``bzr help formats`` for more about storage formats."
3022
if topic == 'other-formats':
2940
3028
class RepositoryAcquisitionPolicy(object):
3094
3163
return self._repository, False
3097
def register_metadir(registry, key,
3098
repository_format, help, native=True, deprecated=False,
3104
"""Register a metadir subformat.
3106
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
3107
by the Repository/Branch/WorkingTreeformats.
3109
:param repository_format: The fully-qualified repository format class
3111
:param branch_format: Fully-qualified branch format class name as
3113
:param tree_format: Fully-qualified tree format class name as
3116
# This should be expanded to support setting WorkingTree and Branch
3117
# formats, once BzrDirMetaFormat1 supports that.
3118
def _load(full_name):
3119
mod_name, factory_name = full_name.rsplit('.', 1)
3121
mod = __import__(mod_name, globals(), locals(),
3123
except ImportError, e:
3124
raise ImportError('failed to load %s: %s' % (full_name, e))
3126
factory = getattr(mod, factory_name)
3127
except AttributeError:
3128
raise AttributeError('no factory %s in module %r'
3133
bd = BzrDirMetaFormat1()
3134
if branch_format is not None:
3135
bd.set_branch_format(_load(branch_format))
3136
if tree_format is not None:
3137
bd.workingtree_format = _load(tree_format)
3138
if repository_format is not None:
3139
bd.repository_format = _load(repository_format)
3141
registry.register(key, helper, help, native, deprecated, hidden,
3142
experimental, alias)
3166
# Please register new formats after old formats so that formats
3167
# appear in chronological order and format descriptions can build
3169
format_registry = BzrDirFormatRegistry()
3144
3170
# The pre-0.8 formats have their repository format network name registered in
3145
3171
# repository.py. MetaDir formats have their repository format network name
3146
3172
# inferred from their disk format string.
3147
controldir.format_registry.register('weave', BzrDirFormat6,
3173
format_registry.register('weave', BzrDirFormat6,
3148
3174
'Pre-0.8 format. Slower than knit and does not'
3149
3175
' support checkouts or shared repositories.',
3151
3176
deprecated=True)
3152
register_metadir(controldir.format_registry, 'metaweave',
3177
format_registry.register_metadir('metaweave',
3153
3178
'bzrlib.repofmt.weaverepo.RepositoryFormat7',
3154
3179
'Transitional format in 0.8. Slower than knit.',
3155
3180
branch_format='bzrlib.branch.BzrBranchFormat5',
3156
3181
tree_format='bzrlib.workingtree.WorkingTreeFormat3',
3158
3182
deprecated=True)
3159
register_metadir(controldir.format_registry, 'knit',
3183
format_registry.register_metadir('knit',
3160
3184
'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
3161
3185
'Format using knits. Recommended for interoperation with bzr <= 0.14.',
3162
3186
branch_format='bzrlib.branch.BzrBranchFormat5',
3163
3187
tree_format='bzrlib.workingtree.WorkingTreeFormat3',
3165
3188
deprecated=True)
3166
register_metadir(controldir.format_registry, 'dirstate',
3189
format_registry.register_metadir('dirstate',
3167
3190
'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
3168
3191
help='New in 0.15: Fast local operations. Compatible with bzr 0.8 and '
3169
3192
'above when accessed over the network.',
3200
3220
experimental=True,
3203
register_metadir(controldir.format_registry, 'pack-0.92',
3223
format_registry.register_metadir('pack-0.92',
3204
3224
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack1',
3205
3225
help='New in 0.92: Pack-based format with data compatible with '
3206
3226
'dirstate-tags format repositories. Interoperates with '
3207
3227
'bzr repositories before 0.92 but cannot be read by bzr < 0.92. '
3228
'Previously called knitpack-experimental. '
3229
'For more information, see '
3230
'http://doc.bazaar-vcs.org/latest/developers/packrepo.html.',
3209
3231
branch_format='bzrlib.branch.BzrBranchFormat6',
3210
3232
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3212
register_metadir(controldir.format_registry, 'pack-0.92-subtree',
3234
format_registry.register_metadir('pack-0.92-subtree',
3213
3235
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack3',
3214
3236
help='New in 0.92: Pack-based format with data compatible with '
3215
3237
'dirstate-with-subtree format repositories. Interoperates with '
3216
3238
'bzr repositories before 0.92 but cannot be read by bzr < 0.92. '
3239
'Previously called knitpack-experimental. '
3240
'For more information, see '
3241
'http://doc.bazaar-vcs.org/latest/developers/packrepo.html.',
3218
3242
branch_format='bzrlib.branch.BzrBranchFormat6',
3219
3243
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3221
3245
experimental=True,
3223
register_metadir(controldir.format_registry, 'rich-root-pack',
3247
format_registry.register_metadir('rich-root-pack',
3224
3248
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
3225
3249
help='New in 1.0: A variant of pack-0.92 that supports rich-root data '
3226
'(needed for bzr-svn and bzr-git).',
3250
'(needed for bzr-svn).',
3227
3251
branch_format='bzrlib.branch.BzrBranchFormat6',
3228
3252
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3231
register_metadir(controldir.format_registry, '1.6',
3254
format_registry.register_metadir('1.6',
3232
3255
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5',
3233
3256
help='A format that allows a branch to indicate that there is another '
3234
3257
'(stacked) repository that should be used to access data that is '
3235
3258
'not present locally.',
3236
3259
branch_format='bzrlib.branch.BzrBranchFormat7',
3237
3260
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3240
register_metadir(controldir.format_registry, '1.6.1-rich-root',
3262
format_registry.register_metadir('1.6.1-rich-root',
3241
3263
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5RichRoot',
3242
3264
help='A variant of 1.6 that supports rich-root data '
3243
'(needed for bzr-svn and bzr-git).',
3265
'(needed for bzr-svn).',
3244
3266
branch_format='bzrlib.branch.BzrBranchFormat7',
3245
3267
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3248
register_metadir(controldir.format_registry, '1.9',
3269
format_registry.register_metadir('1.9',
3249
3270
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3250
3271
help='A repository format using B+tree indexes. These indexes '
3251
3272
'are smaller in size, have smarter caching and provide faster '
3252
3273
'performance for most operations.',
3253
3274
branch_format='bzrlib.branch.BzrBranchFormat7',
3254
3275
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3257
register_metadir(controldir.format_registry, '1.9-rich-root',
3277
format_registry.register_metadir('1.9-rich-root',
3258
3278
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3259
3279
help='A variant of 1.9 that supports rich-root data '
3260
'(needed for bzr-svn and bzr-git).',
3280
'(needed for bzr-svn).',
3261
3281
branch_format='bzrlib.branch.BzrBranchFormat7',
3262
3282
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3265
register_metadir(controldir.format_registry, '1.14',
3284
format_registry.register_metadir('development-wt5',
3266
3285
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3267
help='A working-tree format that supports content filtering.',
3286
help='A working-tree format that supports views and content filtering.',
3268
3287
branch_format='bzrlib.branch.BzrBranchFormat7',
3269
3288
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3271
register_metadir(controldir.format_registry, '1.14-rich-root',
3291
format_registry.register_metadir('development-wt5-rich-root',
3272
3292
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3273
help='A variant of 1.14 that supports rich-root data '
3274
'(needed for bzr-svn and bzr-git).',
3293
help='A variant of development-wt5 that supports rich-root data '
3294
'(needed for bzr-svn).',
3275
3295
branch_format='bzrlib.branch.BzrBranchFormat7',
3276
3296
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3278
# The following un-numbered 'development' formats should always just be aliases.
3279
register_metadir(controldir.format_registry, 'development-rich-root',
3280
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3281
help='Current development format. Supports rich roots. Can convert data '
3282
'to and from rich-root-pack (and anything compatible with '
3283
'rich-root-pack) format repositories. Repositories and branches in '
3284
'this format can only be read by bzr.dev. Please read '
3285
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3299
# The following two formats should always just be aliases.
3300
format_registry.register_metadir('development',
3301
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3302
help='Current development format. Can convert data to and from pack-0.92 '
3303
'(and anything compatible with pack-0.92) format repositories. '
3304
'Repositories and branches in this format can only be read by bzr.dev. '
3306
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3287
3308
branch_format='bzrlib.branch.BzrBranchFormat7',
3288
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3309
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3289
3310
experimental=True,
3293
register_metadir(controldir.format_registry, 'development-subtree',
3313
format_registry.register_metadir('development-subtree',
3294
3314
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3295
3315
help='Current development format, subtree variant. Can convert data to and '
3296
3316
'from pack-0.92-subtree (and anything compatible with '
3297
3317
'pack-0.92-subtree) format repositories. Repositories and branches in '
3298
3318
'this format can only be read by bzr.dev. Please read '
3299
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3319
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3301
3321
branch_format='bzrlib.branch.BzrBranchFormat7',
3302
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3322
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3303
3323
experimental=True,
3305
alias=False, # Restore to being an alias when an actual development subtree format is added
3306
# This current non-alias status is simply because we did not introduce a
3307
# chk based subtree format.
3310
3326
# And the development formats above will have aliased one of the following:
3311
register_metadir(controldir.format_registry, 'development6-rich-root',
3312
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3313
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3315
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3317
branch_format='bzrlib.branch.BzrBranchFormat7',
3318
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3323
register_metadir(controldir.format_registry, 'development7-rich-root',
3324
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK2',
3325
help='pack-1.9 with 255-way hashed CHK inv, bencode revision, group compress, '
3326
'rich roots. Please read '
3327
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3329
branch_format='bzrlib.branch.BzrBranchFormat7',
3330
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3335
register_metadir(controldir.format_registry, '2a',
3336
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3337
help='First format for bzr 2.0 series.\n'
3338
'Uses group-compress storage.\n'
3339
'Provides rich roots which are a one-way transition.\n',
3340
# 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, '
3341
# 'rich roots. Supported by bzr 1.16 and later.',
3342
branch_format='bzrlib.branch.BzrBranchFormat7',
3343
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3347
# The following format should be an alias for the rich root equivalent
3348
# of the default format
3349
register_metadir(controldir.format_registry, 'default-rich-root',
3350
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
3351
branch_format='bzrlib.branch.BzrBranchFormat7',
3352
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3327
format_registry.register_metadir('development2',
3328
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3329
help='1.6.1 with B+Tree based index. '
3331
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3333
branch_format='bzrlib.branch.BzrBranchFormat7',
3334
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3338
format_registry.register_metadir('development2-subtree',
3339
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3340
help='1.6.1-subtree with B+Tree based index. '
3342
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3344
branch_format='bzrlib.branch.BzrBranchFormat7',
3345
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3349
format_registry.register_metadir('development5',
3350
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5',
3351
help='1.9 with CHK inventories with parent_id index. '
3353
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3355
branch_format='bzrlib.branch.BzrBranchFormat7',
3356
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3360
format_registry.register_metadir('development5-subtree',
3361
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Subtree',
3362
help='1.9-subtree with CHK Inventories with parent_id index. '
3364
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3366
branch_format='bzrlib.branch.BzrBranchFormat7',
3367
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3371
format_registry.register_metadir('development5-hash16',
3372
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash16',
3373
help='1.9 with CHK inventories with parent_id index and 16-way hash trie. '
3375
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3377
branch_format='bzrlib.branch.BzrBranchFormat7',
3378
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3382
format_registry.register_metadir('development5-hash255',
3383
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash255',
3384
help='1.9 with CHK inventories with parent_id index and 255-way hash trie. '
3386
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3388
branch_format='bzrlib.branch.BzrBranchFormat7',
3389
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3393
format_registry.register_metadir('gc-no-rich-root',
3394
'bzrlib.repofmt.gc_repo.RepositoryFormatPackGCPlain',
3395
help='pack-1.9 with xml inv, group compress '
3397
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3399
branch_format='bzrlib.branch.BzrBranchFormat7',
3400
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3404
format_registry.register_metadir('gc-chk16',
3405
'bzrlib.repofmt.gc_repo.RepositoryFormatPackGCCHK16',
3406
help='pack-1.9 with 16-way hashed CHK inv, group compress, rich roots. '
3408
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3410
branch_format='bzrlib.branch.BzrBranchFormat7',
3411
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3415
format_registry.register_metadir('gc-chk255',
3416
'bzrlib.repofmt.gc_repo.RepositoryFormatPackGCCHK255',
3417
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3419
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3421
branch_format='bzrlib.branch.BzrBranchFormat7',
3422
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3426
format_registry.register_metadir('gc-chk255-big',
3427
'bzrlib.repofmt.gc_repo.RepositoryFormatPackGCCHK255Big',
3428
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3430
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3432
branch_format='bzrlib.branch.BzrBranchFormat7',
3433
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3357
3438
# The current format that is made on 'bzr init'.
3358
controldir.format_registry.set_default('2a')
3360
# XXX 2010-08-20 JRV: There is still a lot of code relying on
3361
# bzrlib.bzrdir.format_registry existing. When BzrDir.create/BzrDir.open/etc
3362
# get changed to ControlDir.create/ControlDir.open/etc this should be removed.
3363
format_registry = controldir.format_registry
3439
format_registry.set_default('pack-0.92')