215
267
errors.UnstackableRepositoryFormat,
216
268
errors.NotStacked):
270
# Bug: We create a metadir without knowing if it can support stacking,
271
# we should look up the policy needs first, or just use it as a hint,
220
# may need to copy content in
221
repository_policy = result.determine_repository_policy(
222
force_new_repo, stacked_on, self.root_transport.base,
223
require_stacking=require_stacking)
224
274
make_working_trees = local_repo.make_working_trees()
225
result_repo, is_new_repo = repository_policy.acquire_repository(
226
make_working_trees, local_repo.is_shared())
227
if not require_stacking and repository_policy._require_stacking:
228
require_stacking = True
229
result._format.require_stacking()
230
if is_new_repo and not require_stacking and revision_id is not None:
231
fetch_spec = graph.PendingAncestryResult(
232
[revision_id], local_repo)
233
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
235
result_repo.fetch(local_repo, revision_id=revision_id)
275
want_shared = local_repo.is_shared()
276
repo_format_name = format.repository_format.network_name()
278
make_working_trees = False
280
repo_format_name = None
282
result_repo, result, require_stacking, repository_policy = \
283
format.initialize_on_transport_ex(transport,
284
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
285
force_new_repo=force_new_repo, stacked_on=stacked_on,
286
stack_on_pwd=self.root_transport.base,
287
repo_format_name=repo_format_name,
288
make_working_trees=make_working_trees, shared_repo=want_shared)
291
# If the result repository is in the same place as the
292
# resulting bzr dir, it will have no content, further if the
293
# result is not stacked then we know all content should be
294
# copied, and finally if we are copying up to a specific
295
# revision_id then we can use the pending-ancestry-result which
296
# does not require traversing all of history to describe it.
297
if (result_repo.user_url == result.user_url
298
and not require_stacking and
299
revision_id is not None):
300
fetch_spec = graph.PendingAncestryResult(
301
[revision_id], local_repo)
302
result_repo.fetch(local_repo, fetch_spec=fetch_spec)
304
result_repo.fetch(local_repo, revision_id=revision_id)
308
if result_repo is not None:
309
raise AssertionError('result_repo not None(%r)' % result_repo)
238
310
# 1 if there is a branch present
239
311
# make sure its content is available in the target repository
333
414
except errors.NoRepositoryPresent:
336
return False, (None, repository)
338
branch = bzrdir.open_branch()
339
except errors.NotBranchError:
340
return True, (None, None)
342
return True, (branch, None)
344
for branch, repo in BzrDir.find_bzrdirs(transport, evaluate=evaluate):
417
return False, ([], repository)
418
return True, (bzrdir.list_branches(), None)
420
for branches, repo in BzrDir.find_bzrdirs(transport,
345
422
if repo is not None:
346
branches.extend(repo.find_branches())
347
if branch is not None:
348
branches.append(branch)
423
ret.extend(repo.find_branches())
424
if branches is not None:
351
428
def destroy_repository(self):
352
429
"""Destroy the repository in this BzrDir"""
353
430
raise NotImplementedError(self.destroy_repository)
355
def create_branch(self):
432
def create_branch(self, name=None):
356
433
"""Create a branch in this BzrDir.
435
:param name: Name of the colocated branch to create, None for
358
438
The bzrdir's format will control what branch format is created.
359
439
For more control see BranchFormatXX.create(a_bzrdir).
361
441
raise NotImplementedError(self.create_branch)
363
def destroy_branch(self):
364
"""Destroy the branch in this BzrDir"""
443
def destroy_branch(self, name=None):
444
"""Destroy a branch in this BzrDir.
446
:param name: Name of the branch to destroy, None for the default
365
449
raise NotImplementedError(self.destroy_branch)
1317
def push_branch(self, source, revision_id=None, overwrite=False,
1318
remember=False, create_prefix=False):
1319
"""Push the source branch into this BzrDir."""
1321
# If we can open a branch, use its direct repository, otherwise see
1322
# if there is a repository without a branch.
1324
br_to = self.open_branch()
1325
except errors.NotBranchError:
1326
# Didn't find a branch, can we find a repository?
1327
repository_to = self.find_repository()
1329
# Found a branch, so we must have found a repository
1330
repository_to = br_to.repository
1332
push_result = PushResult()
1333
push_result.source_branch = source
1335
# We have a repository but no branch, copy the revisions, and then
1337
repository_to.fetch(source.repository, revision_id=revision_id)
1338
br_to = source.clone(self, revision_id=revision_id)
1339
if source.get_push_location() is None or remember:
1340
source.set_push_location(br_to.base)
1341
push_result.stacked_on = None
1342
push_result.branch_push_result = None
1343
push_result.old_revno = None
1344
push_result.old_revid = _mod_revision.NULL_REVISION
1345
push_result.target_branch = br_to
1346
push_result.master_branch = None
1347
push_result.workingtree_updated = False
1349
# We have successfully opened the branch, remember if necessary:
1350
if source.get_push_location() is None or remember:
1351
source.set_push_location(br_to.base)
1353
tree_to = self.open_workingtree()
1354
except errors.NotLocalUrl:
1355
push_result.branch_push_result = source.push(br_to,
1356
overwrite, stop_revision=revision_id)
1357
push_result.workingtree_updated = False
1358
except errors.NoWorkingTree:
1359
push_result.branch_push_result = source.push(br_to,
1360
overwrite, stop_revision=revision_id)
1361
push_result.workingtree_updated = None # Not applicable
1363
tree_to.lock_write()
1365
push_result.branch_push_result = source.push(
1366
tree_to.branch, overwrite, stop_revision=revision_id)
1370
push_result.workingtree_updated = True
1371
push_result.old_revno = push_result.branch_push_result.old_revno
1372
push_result.old_revid = push_result.branch_push_result.old_revid
1373
push_result.target_branch = \
1374
push_result.branch_push_result.target_branch
1200
1378
class BzrDirHooks(hooks.Hooks):
1201
1379
"""Hooks for BzrDir operations."""
1206
1384
self.create_hook(hooks.HookPoint('pre_open',
1207
1385
"Invoked before attempting to open a BzrDir with the transport "
1208
1386
"that the open will use.", (1, 14), None))
1387
self.create_hook(hooks.HookPoint('post_repo_init',
1388
"Invoked after a repository has been initialized. "
1389
"post_repo_init is called with a "
1390
"bzrlib.bzrdir.RepoInitHookParams.",
1210
1393
# install the default hooks
1211
1394
BzrDir.hooks = BzrDirHooks()
1397
class RepoInitHookParams(object):
1398
"""Object holding parameters passed to *_repo_init hooks.
1400
There are 4 fields that hooks may wish to access:
1402
:ivar repository: Repository created
1403
:ivar format: Repository format
1404
:ivar bzrdir: The bzrdir for the repository
1405
:ivar shared: The repository is shared
1408
def __init__(self, repository, format, a_bzrdir, shared):
1409
"""Create a group of RepoInitHook parameters.
1411
:param repository: Repository created
1412
:param format: Repository format
1413
:param bzrdir: The bzrdir for the repository
1414
:param shared: The repository is shared
1416
self.repository = repository
1417
self.format = format
1418
self.bzrdir = a_bzrdir
1419
self.shared = shared
1421
def __eq__(self, other):
1422
return self.__dict__ == other.__dict__
1426
return "<%s for %s>" % (self.__class__.__name__,
1429
return "<%s for %s>" % (self.__class__.__name__,
1214
1433
class BzrDirPreSplitOut(BzrDir):
1215
1434
"""A common class for the all-in-one formats."""
1758
2022
self._supply_sub_formats_to(remote_format)
1759
2023
return remote_format.initialize_on_transport(transport)
2025
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
2026
create_prefix=False, force_new_repo=False, stacked_on=None,
2027
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
2028
shared_repo=False, vfs_only=False):
2029
"""Create this format on transport.
2031
The directory to initialize will be created.
2033
:param force_new_repo: Do not use a shared repository for the target,
2034
even if one is available.
2035
:param create_prefix: Create any missing directories leading up to
2037
:param use_existing_dir: Use an existing directory if one exists.
2038
:param stacked_on: A url to stack any created branch on, None to follow
2039
any target stacking policy.
2040
:param stack_on_pwd: If stack_on is relative, the location it is
2042
:param repo_format_name: If non-None, a repository will be
2043
made-or-found. Should none be found, or if force_new_repo is True
2044
the repo_format_name is used to select the format of repository to
2046
:param make_working_trees: Control the setting of make_working_trees
2047
for a new shared repository when one is made. None to use whatever
2048
default the format has.
2049
:param shared_repo: Control whether made repositories are shared or
2051
:param vfs_only: If True do not attempt to use a smart server
2052
:return: repo, bzrdir, require_stacking, repository_policy. repo is
2053
None if none was created or found, bzrdir is always valid.
2054
require_stacking is the result of examining the stacked_on
2055
parameter and any stacking policy found for the target.
2058
# Try to hand off to a smart server
2060
client_medium = transport.get_smart_medium()
2061
except errors.NoSmartMedium:
2064
# TODO: lookup the local format from a server hint.
2065
remote_dir_format = RemoteBzrDirFormat()
2066
remote_dir_format._network_name = self.network_name()
2067
self._supply_sub_formats_to(remote_dir_format)
2068
return remote_dir_format.initialize_on_transport_ex(transport,
2069
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2070
force_new_repo=force_new_repo, stacked_on=stacked_on,
2071
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2072
make_working_trees=make_working_trees, shared_repo=shared_repo)
2073
# XXX: Refactor the create_prefix/no_create_prefix code into a
2074
# common helper function
2075
# The destination may not exist - if so make it according to policy.
2076
def make_directory(transport):
2077
transport.mkdir('.')
2079
def redirected(transport, e, redirection_notice):
2080
note(redirection_notice)
2081
return transport._redirected_to(e.source, e.target)
2083
transport = do_catching_redirections(make_directory, transport,
2085
except errors.FileExists:
2086
if not use_existing_dir:
2088
except errors.NoSuchFile:
2089
if not create_prefix:
2091
transport.create_prefix()
2093
require_stacking = (stacked_on is not None)
2094
# Now the target directory exists, but doesn't have a .bzr
2095
# directory. So we need to create it, along with any work to create
2096
# all of the dependent branches, etc.
2098
result = self.initialize_on_transport(transport)
2099
if repo_format_name:
2101
# use a custom format
2102
result._format.repository_format = \
2103
repository.network_format_registry.get(repo_format_name)
2104
except AttributeError:
2105
# The format didn't permit it to be set.
2107
# A repository is desired, either in-place or shared.
2108
repository_policy = result.determine_repository_policy(
2109
force_new_repo, stacked_on, stack_on_pwd,
2110
require_stacking=require_stacking)
2111
result_repo, is_new_repo = repository_policy.acquire_repository(
2112
make_working_trees, shared_repo)
2113
if not require_stacking and repository_policy._require_stacking:
2114
require_stacking = True
2115
result._format.require_stacking()
2116
result_repo.lock_write()
2119
repository_policy = None
2120
return result_repo, result, require_stacking, repository_policy
1761
2122
def _initialize_on_transport_vfs(self, transport):
1762
2123
"""Initialize a new bzrdir using VFS calls.
1975
2336
repository_format = property(__return_repository_format)
1978
class BzrDirFormat5(BzrDirFormat):
2339
class BzrDirFormatAllInOne(BzrDirFormat):
2340
"""Common class for formats before meta-dirs."""
2342
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
2343
create_prefix=False, force_new_repo=False, stacked_on=None,
2344
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
2346
"""See BzrDirFormat.initialize_on_transport_ex."""
2347
require_stacking = (stacked_on is not None)
2348
# Format 5 cannot stack, but we've been asked to - actually init
2350
if require_stacking:
2351
format = BzrDirMetaFormat1()
2352
return format.initialize_on_transport_ex(transport,
2353
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2354
force_new_repo=force_new_repo, stacked_on=stacked_on,
2355
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2356
make_working_trees=make_working_trees, shared_repo=shared_repo)
2357
return BzrDirFormat.initialize_on_transport_ex(self, transport,
2358
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
2359
force_new_repo=force_new_repo, stacked_on=stacked_on,
2360
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
2361
make_working_trees=make_working_trees, shared_repo=shared_repo)
2364
class BzrDirFormat5(BzrDirFormatAllInOne):
1979
2365
"""Bzr control format 5.
1981
2367
This format is a combined format for working tree, branch and repository.
2135
2521
def set_branch_format(self, format):
2136
2522
self._branch_format = format
2138
def require_stacking(self):
2524
def require_stacking(self, stack_on=None, possible_transports=None,
2526
"""We have a request to stack, try to ensure the formats support it.
2528
:param stack_on: If supplied, it is the URL to a branch that we want to
2529
stack on. Check to see if that format supports stacking before
2532
# Stacking is desired. requested by the target, but does the place it
2533
# points at support stacking? If it doesn't then we should
2534
# not implicitly upgrade. We check this here.
2535
new_repo_format = None
2536
new_branch_format = None
2538
# a bit of state for get_target_branch so that we don't try to open it
2539
# 2 times, for both repo *and* branch
2540
target = [None, False, None] # target_branch, checked, upgrade anyway
2541
def get_target_branch():
2543
# We've checked, don't check again
2545
if stack_on is None:
2546
# No target format, that means we want to force upgrading
2547
target[:] = [None, True, True]
2550
target_dir = BzrDir.open(stack_on,
2551
possible_transports=possible_transports)
2552
except errors.NotBranchError:
2553
# Nothing there, don't change formats
2554
target[:] = [None, True, False]
2556
except errors.JailBreak:
2557
# JailBreak, JFDI and upgrade anyway
2558
target[:] = [None, True, True]
2561
target_branch = target_dir.open_branch()
2562
except errors.NotBranchError:
2563
# No branch, don't upgrade formats
2564
target[:] = [None, True, False]
2566
target[:] = [target_branch, True, False]
2569
if (not _skip_repo and
2570
not self.repository_format.supports_external_lookups):
2571
# We need to upgrade the Repository.
2572
target_branch, _, do_upgrade = get_target_branch()
2573
if target_branch is None:
2574
# We don't have a target branch, should we upgrade anyway?
2576
# stack_on is inaccessible, JFDI.
2577
# TODO: bad monkey, hard-coded formats...
2578
if self.repository_format.rich_root_data:
2579
new_repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2581
new_repo_format = pack_repo.RepositoryFormatKnitPack5()
2583
# If the target already supports stacking, then we know the
2584
# project is already able to use stacking, so auto-upgrade
2586
new_repo_format = target_branch.repository._format
2587
if not new_repo_format.supports_external_lookups:
2588
# target doesn't, source doesn't, so don't auto upgrade
2590
new_repo_format = None
2591
if new_repo_format is not None:
2592
self.repository_format = new_repo_format
2593
note('Source repository format does not support stacking,'
2594
' using format:\n %s',
2595
new_repo_format.get_format_description())
2139
2597
if not self.get_branch_format().supports_stacking():
2140
# We need to make a stacked branch, but the default format for the
2141
# target doesn't support stacking. So force a branch that *can*
2143
from bzrlib.branch import BzrBranchFormat7
2144
branch_format = BzrBranchFormat7()
2145
self.set_branch_format(branch_format)
2146
mutter("using %r for stacking" % (branch_format,))
2147
from bzrlib.repofmt import pack_repo
2148
if self.repository_format.rich_root_data:
2149
bzrdir_format_name = '1.6.1-rich-root'
2150
repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
2598
# We just checked the repo, now lets check if we need to
2599
# upgrade the branch format
2600
target_branch, _, do_upgrade = get_target_branch()
2601
if target_branch is None:
2603
# TODO: bad monkey, hard-coded formats...
2604
new_branch_format = branch.BzrBranchFormat7()
2152
bzrdir_format_name = '1.6'
2153
repo_format = pack_repo.RepositoryFormatKnitPack5()
2154
note('Source format does not support stacking, using format:'
2156
bzrdir_format_name, repo_format.get_format_description())
2157
self.repository_format = repo_format
2606
new_branch_format = target_branch._format
2607
if not new_branch_format.supports_stacking():
2608
new_branch_format = None
2609
if new_branch_format is not None:
2610
# Does support stacking, use its format.
2611
self.set_branch_format(new_branch_format)
2612
note('Source branch format does not support stacking,'
2613
' using format:\n %s',
2614
new_branch_format.get_format_description())
2159
2616
def get_converter(self, format=None):
2160
2617
"""See BzrDirFormat.get_converter()."""
2811
3308
return local_dir_format.initialize_on_transport(transport)
2812
3309
client = _SmartClient(client_medium)
2813
3310
path = client.remote_path_from_transport(transport)
2814
response = client.call('BzrDirFormat.initialize', path)
3312
response = client.call('BzrDirFormat.initialize', path)
3313
except errors.ErrorFromSmartServer, err:
3314
remote._translate_error(err, path=path)
2815
3315
if response[0] != 'ok':
2816
3316
raise errors.SmartProtocolError('unexpected response code %s' % (response,))
2817
3317
format = RemoteBzrDirFormat()
2818
3318
self._supply_sub_formats_to(format)
2819
3319
return remote.RemoteBzrDir(transport, format)
3321
def parse_NoneTrueFalse(self, arg):
3328
raise AssertionError("invalid arg %r" % arg)
3330
def _serialize_NoneTrueFalse(self, arg):
3337
def _serialize_NoneString(self, arg):
3340
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
3341
create_prefix=False, force_new_repo=False, stacked_on=None,
3342
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
3345
# hand off the request to the smart server
3346
client_medium = transport.get_smart_medium()
3347
except errors.NoSmartMedium:
3350
# Decline to open it if the server doesn't support our required
3351
# version (3) so that the VFS-based transport will do it.
3352
if client_medium.should_probe():
3354
server_version = client_medium.protocol_version()
3355
if server_version != '2':
3359
except errors.SmartProtocolError:
3360
# Apparently there's no usable smart server there, even though
3361
# the medium supports the smart protocol.
3366
client = _SmartClient(client_medium)
3367
path = client.remote_path_from_transport(transport)
3368
if client_medium._is_remote_before((1, 16)):
3371
# TODO: lookup the local format from a server hint.
3372
local_dir_format = BzrDirMetaFormat1()
3373
self._supply_sub_formats_to(local_dir_format)
3374
return local_dir_format.initialize_on_transport_ex(transport,
3375
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3376
force_new_repo=force_new_repo, stacked_on=stacked_on,
3377
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3378
make_working_trees=make_working_trees, shared_repo=shared_repo,
3380
return self._initialize_on_transport_ex_rpc(client, path, transport,
3381
use_existing_dir, create_prefix, force_new_repo, stacked_on,
3382
stack_on_pwd, repo_format_name, make_working_trees, shared_repo)
3384
def _initialize_on_transport_ex_rpc(self, client, path, transport,
3385
use_existing_dir, create_prefix, force_new_repo, stacked_on,
3386
stack_on_pwd, repo_format_name, make_working_trees, shared_repo):
3388
args.append(self._serialize_NoneTrueFalse(use_existing_dir))
3389
args.append(self._serialize_NoneTrueFalse(create_prefix))
3390
args.append(self._serialize_NoneTrueFalse(force_new_repo))
3391
args.append(self._serialize_NoneString(stacked_on))
3392
# stack_on_pwd is often/usually our transport
3395
stack_on_pwd = transport.relpath(stack_on_pwd)
3396
if not stack_on_pwd:
3398
except errors.PathNotChild:
3400
args.append(self._serialize_NoneString(stack_on_pwd))
3401
args.append(self._serialize_NoneString(repo_format_name))
3402
args.append(self._serialize_NoneTrueFalse(make_working_trees))
3403
args.append(self._serialize_NoneTrueFalse(shared_repo))
3404
request_network_name = self._network_name or \
3405
BzrDirFormat.get_default_format().network_name()
3407
response = client.call('BzrDirFormat.initialize_ex_1.16',
3408
request_network_name, path, *args)
3409
except errors.UnknownSmartMethod:
3410
client._medium._remember_remote_is_before((1,16))
3411
local_dir_format = BzrDirMetaFormat1()
3412
self._supply_sub_formats_to(local_dir_format)
3413
return local_dir_format.initialize_on_transport_ex(transport,
3414
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3415
force_new_repo=force_new_repo, stacked_on=stacked_on,
3416
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3417
make_working_trees=make_working_trees, shared_repo=shared_repo,
3419
except errors.ErrorFromSmartServer, err:
3420
remote._translate_error(err, path=path)
3421
repo_path = response[0]
3422
bzrdir_name = response[6]
3423
require_stacking = response[7]
3424
require_stacking = self.parse_NoneTrueFalse(require_stacking)
3425
format = RemoteBzrDirFormat()
3426
format._network_name = bzrdir_name
3427
self._supply_sub_formats_to(format)
3428
bzrdir = remote.RemoteBzrDir(transport, format, _client=client)
3430
repo_format = remote.response_tuple_to_repo_format(response[1:])
3431
if repo_path == '.':
3434
repo_bzrdir_format = RemoteBzrDirFormat()
3435
repo_bzrdir_format._network_name = response[5]
3436
repo_bzr = remote.RemoteBzrDir(transport.clone(repo_path),
3440
final_stack = response[8] or None
3441
final_stack_pwd = response[9] or None
3443
final_stack_pwd = urlutils.join(
3444
transport.base, final_stack_pwd)
3445
remote_repo = remote.RemoteRepository(repo_bzr, repo_format)
3446
if len(response) > 10:
3447
# Updated server verb that locks remotely.
3448
repo_lock_token = response[10] or None
3449
remote_repo.lock_write(repo_lock_token, _skip_rpc=True)
3451
remote_repo.dont_leave_lock_in_place()
3453
remote_repo.lock_write()
3454
policy = UseExistingRepository(remote_repo, final_stack,
3455
final_stack_pwd, require_stacking)
3456
policy.acquire_repository()
3460
bzrdir._format.set_branch_format(self.get_branch_format())
3461
if require_stacking:
3462
# The repo has already been created, but we need to make sure that
3463
# we'll make a stackable branch.
3464
bzrdir._format.require_stacking(_skip_repo=True)
3465
return remote_repo, bzrdir, require_stacking, policy
2821
3467
def _open(self, transport):
2822
3468
return remote.RemoteBzrDir(transport, self)
3149
3805
stack_on = self._get_full_stack_on()
3151
# Stacking is desired. requested by the target, but does the place it
3152
# points at support stacking? If it doesn't then we should
3153
# not implicitly upgrade. We check this here.
3154
3807
format = self._bzrdir._format
3155
if not (format.repository_format.supports_external_lookups
3156
and format.get_branch_format().supports_stacking()):
3157
# May need to upgrade - but only do if the target also
3158
# supports stacking. Note that this currently wastes
3159
# network round trips to check - but we only do this
3160
# when the source can't stack so it will fade away
3161
# as people do upgrade.
3163
target_dir = BzrDir.open(stack_on,
3164
possible_transports=[self._bzrdir.root_transport])
3165
except errors.NotBranchError:
3166
# Nothing there, don't change formats
3170
target_branch = target_dir.open_branch()
3171
except errors.NotBranchError:
3172
# No branch, don't change formats
3175
branch_format = target_branch._format
3176
repo_format = target_branch.repository._format
3177
if not (branch_format.supports_stacking()
3178
and repo_format.supports_external_lookups):
3179
# Doesn't stack itself, don't force an upgrade
3182
# Does support stacking, use its format.
3183
format.repository_format = repo_format
3184
format.set_branch_format(branch_format)
3185
note('Source format does not support stacking, '
3186
'using format: \'%s\'\n %s\n',
3187
branch_format.get_format_description(),
3188
repo_format.get_format_description())
3808
format.require_stacking(stack_on=stack_on,
3809
possible_transports=[self._bzrdir.root_transport])
3189
3810
if not self._require_stacking:
3190
3811
# We have picked up automatic stacking somewhere.
3191
3812
note('Using default stacking branch %s at %s', self._stack_on,
3341
3968
'(needed for bzr-svn and bzr-git).',
3342
3969
branch_format='bzrlib.branch.BzrBranchFormat7',
3343
3970
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3345
format_registry.register_metadir('development-wt5',
3973
format_registry.register_metadir('1.14',
3346
3974
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6',
3347
help='A working-tree format that supports views and content filtering.',
3975
help='A working-tree format that supports content filtering.',
3348
3976
branch_format='bzrlib.branch.BzrBranchFormat7',
3349
3977
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3352
format_registry.register_metadir('development-wt5-rich-root',
3979
format_registry.register_metadir('1.14-rich-root',
3353
3980
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack6RichRoot',
3354
help='A variant of development-wt5 that supports rich-root data '
3981
help='A variant of 1.14 that supports rich-root data '
3355
3982
'(needed for bzr-svn and bzr-git).',
3356
3983
branch_format='bzrlib.branch.BzrBranchFormat7',
3357
3984
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3360
# The following two formats should always just be aliases.
3361
format_registry.register_metadir('development',
3362
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3363
help='Current development format. Can convert data to and from pack-0.92 '
3364
'(and anything compatible with pack-0.92) format repositories. '
3365
'Repositories and branches in this format can only be read by bzr.dev. '
3367
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3986
# The following un-numbered 'development' formats should always just be aliases.
3987
format_registry.register_metadir('development-rich-root',
3988
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
3989
help='Current development format. Supports rich roots. Can convert data '
3990
'to and from rich-root-pack (and anything compatible with '
3991
'rich-root-pack) format repositories. Repositories and branches in '
3992
'this format can only be read by bzr.dev. Please read '
3993
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3369
3995
branch_format='bzrlib.branch.BzrBranchFormat7',
3370
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3996
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3371
3997
experimental=True,
3374
4001
format_registry.register_metadir('development-subtree',
3375
4002
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3377
4004
'from pack-0.92-subtree (and anything compatible with '
3378
4005
'pack-0.92-subtree) format repositories. Repositories and branches in '
3379
4006
'this format can only be read by bzr.dev. Please read '
3380
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
4007
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
3382
4009
branch_format='bzrlib.branch.BzrBranchFormat7',
3383
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
4010
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3384
4011
experimental=True,
4013
alias=False, # Restore to being an alias when an actual development subtree format is added
4014
# This current non-alias status is simply because we did not introduce a
4015
# chk based subtree format.
3387
4018
# And the development formats above will have aliased one of the following:
3388
format_registry.register_metadir('development2',
3389
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
3390
help='1.6.1 with B+Tree based index. '
3392
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3394
branch_format='bzrlib.branch.BzrBranchFormat7',
3395
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3399
format_registry.register_metadir('development2-subtree',
3400
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
3401
help='1.6.1-subtree with B+Tree based index. '
3403
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3405
branch_format='bzrlib.branch.BzrBranchFormat7',
3406
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
3410
format_registry.register_metadir('development5',
3411
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5',
3412
help='1.9 with CHK inventories with parent_id index. '
3414
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3416
branch_format='bzrlib.branch.BzrBranchFormat7',
3417
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3421
format_registry.register_metadir('development5-subtree',
3422
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Subtree',
3423
help='1.9-subtree with CHK Inventories with parent_id index. '
3425
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3427
branch_format='bzrlib.branch.BzrBranchFormat7',
3428
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3432
format_registry.register_metadir('development5-hash16',
3433
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash16',
3434
help='1.9 with CHK inventories with parent_id index and 16-way hash trie. '
3436
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3438
branch_format='bzrlib.branch.BzrBranchFormat7',
3439
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3443
format_registry.register_metadir('development5-hash255',
3444
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash255',
3445
help='1.9 with CHK inventories with parent_id index and 255-way hash trie. '
3447
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3449
branch_format='bzrlib.branch.BzrBranchFormat7',
3450
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3454
# XXX: This format is scheduled for termination
3455
# format_registry.register_metadir('gc-no-rich-root',
3456
# 'bzrlib.repofmt.groupcompress_repo.RepositoryFormatPackGCPlain',
3457
# help='pack-1.9 with xml inv, group compress '
3459
# 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3461
# branch_format='bzrlib.branch.BzrBranchFormat7',
3462
# tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3464
# experimental=True,
3466
format_registry.register_metadir('gc-chk16',
3467
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatPackGCCHK16',
3468
help='pack-1.9 with 16-way hashed CHK inv, group compress, rich roots. '
3470
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3472
branch_format='bzrlib.branch.BzrBranchFormat7',
3473
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3477
format_registry.register_metadir('gc-chk255',
3478
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatPackGCCHK255',
3479
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3481
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3483
branch_format='bzrlib.branch.BzrBranchFormat7',
3484
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3488
format_registry.register_metadir('gc-chk255-big',
3489
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatPackGCCHK255Big',
3490
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
3492
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
3494
branch_format='bzrlib.branch.BzrBranchFormat7',
3495
tree_format='bzrlib.workingtree.WorkingTreeFormat5',
3500
# The following format should be an alias for the rich root equivalent
4019
format_registry.register_metadir('development6-rich-root',
4020
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK1',
4021
help='pack-1.9 with 255-way hashed CHK inv, group compress, rich roots '
4023
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
4025
branch_format='bzrlib.branch.BzrBranchFormat7',
4026
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
4031
format_registry.register_metadir('development7-rich-root',
4032
'bzrlib.repofmt.groupcompress_repo.RepositoryFormatCHK2',
4033
help='pack-1.9 with 255-way hashed CHK inv, bencode revision, group compress, '
4034
'rich roots. Please read '
4035
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
4037
branch_format='bzrlib.branch.BzrBranchFormat7',
4038
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
4043
format_registry.register_metadir('2a',
4044
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
4045
help='First format for bzr 2.0 series.\n'
4046
'Uses group-compress storage.\n'
4047
'Provides rich roots which are a one-way transition.\n',
4048
# 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, '
4049
# 'rich roots. Supported by bzr 1.16 and later.',
4050
branch_format='bzrlib.branch.BzrBranchFormat7',
4051
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
4055
# The following format should be an alias for the rich root equivalent
3501
4056
# of the default format
3502
4057
format_registry.register_metadir('default-rich-root',
3503
'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
3504
help='Default format, rich root variant. (needed for bzr-svn and bzr-git).',
3505
branch_format='bzrlib.branch.BzrBranchFormat6',
3506
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
4058
'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a',
4059
branch_format='bzrlib.branch.BzrBranchFormat7',
4060
tree_format='bzrlib.workingtree.WorkingTreeFormat6',
3509
4065
# The current format that is made on 'bzr init'.
3510
format_registry.set_default('pack-0.92')
4066
format_registry.set_default('2a')