748
748
def _get_tree_branch(self):
749
749
"""Return the branch and tree, if any, for this bzrdir.
751
Return None for tree if not present.
751
Return None for tree if not present or inaccessible.
752
752
Raise NotBranchError if no branch is present.
753
753
:return: (tree, branch)
2447
2447
e.g. BzrDirMeta1 with weave repository. Also, it's more user-oriented.
2451
"""Create a BzrDirFormatRegistry."""
2452
self._aliases = set()
2453
super(BzrDirFormatRegistry, self).__init__()
2456
"""Return a set of the format names which are aliases."""
2457
return frozenset(self._aliases)
2450
2459
def register_metadir(self, key,
2451
2460
repository_format, help, native=True, deprecated=False,
2452
2461
branch_format=None,
2453
2462
tree_format=None,
2455
experimental=False):
2456
2466
"""Register a metadir subformat.
2458
2468
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
2491
2501
bd.repository_format = _load(repository_format)
2493
2503
self.register(key, helper, help, native, deprecated, hidden,
2504
experimental, alias)
2496
2506
def register(self, key, factory, help, native=True, deprecated=False,
2497
hidden=False, experimental=False):
2507
hidden=False, experimental=False, alias=False):
2498
2508
"""Register a BzrDirFormat factory.
2500
2510
The factory must be a callable that takes one parameter: the key.
2503
2513
This function mainly exists to prevent the info object from being
2504
2514
supplied directly.
2506
registry.Registry.register(self, key, factory, help,
2516
registry.Registry.register(self, key, factory, help,
2507
2517
BzrDirFormatInfo(native, deprecated, hidden, experimental))
2519
self._aliases.add(key)
2509
2521
def register_lazy(self, key, module_name, member_name, help, native=True,
2510
deprecated=False, hidden=False, experimental=False):
2511
registry.Registry.register_lazy(self, key, module_name, member_name,
2522
deprecated=False, hidden=False, experimental=False, alias=False):
2523
registry.Registry.register_lazy(self, key, module_name, member_name,
2512
2524
help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
2526
self._aliases.add(key)
2514
2528
def set_default(self, key):
2515
2529
"""Set the 'default' key to be a clone of the supplied key.
2517
2531
This method must be called once and only once.
2519
registry.Registry.register(self, 'default', self.get(key),
2533
registry.Registry.register(self, 'default', self.get(key),
2520
2534
self.get_help(key), info=self.get_info(key))
2535
self._aliases.add('default')
2522
2537
def set_default_repository(self, key):
2523
2538
"""Set the FormatRegistry default and Repository default.
2669
2684
branch_format='bzrlib.branch.BzrBranchFormat6',
2670
2685
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2687
# The following two formats should always just be aliases.
2688
format_registry.register_metadir('development',
2689
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
2690
help='Current development format. Can convert data to and from pack-0.92 '
2691
'(and anything compatible with pack-0.92) format repositories. '
2692
'Repositories in this format can only be read by bzr.dev. '
2694
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
2696
branch_format='bzrlib.branch.BzrBranchFormat6',
2697
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2701
format_registry.register_metadir('development-subtree',
2702
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0Subtree',
2703
help='Current development format, subtree variant. Can convert data to and '
2704
'from pack-0.92 (and anything compatible with pack-0.92) format '
2705
'repositories. Repositories in this format can only be read by '
2706
'bzr.dev. Please read '
2707
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
2709
branch_format='bzrlib.branch.BzrBranchFormat6',
2710
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2714
# And the development formats which the will have aliased one of follow:
2715
format_registry.register_metadir('development0',
2716
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
2717
help='Trivial rename of pack-0.92 to provide a development format. '
2719
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
2721
branch_format='bzrlib.branch.BzrBranchFormat6',
2722
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2726
format_registry.register_metadir('development0-subtree',
2727
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0Subtree',
2728
help='Trivial rename of pack-0.92-subtree to provide a development format. '
2730
'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
2732
branch_format='bzrlib.branch.BzrBranchFormat6',
2733
tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2672
2737
format_registry.set_default('pack-0.92')