1380
1380
"""Return the most suitable metadir for a checkout of this branch.
1381
1381
Weaves are used if this branch's repository uses weaves.
1383
if isinstance(self.bzrdir, bzrdir.BzrDirPreSplitOut):
1384
from bzrlib.repofmt import weaverepo
1383
from bzrlib.plugins.weave_fmt.bzrdir import BzrDirPreSplitOut
1384
if isinstance(self.bzrdir, BzrDirPreSplitOut):
1385
from bzrlib.plugins.weave_fmt.repository import RepositoryFormat7
1385
1386
format = bzrdir.BzrDirMetaFormat1()
1386
format.repository_format = weaverepo.RepositoryFormat7()
1387
format.repository_format = RepositoryFormat7()
1388
1389
format = self.repository.bzrdir.checkout_metadir()
1389
1390
format.set_branch_format(self._format)
2018
2019
self.revision_id)
2021
class BzrBranchFormat4(BranchFormat):
2022
"""Bzr branch format 4.
2025
- a revision-history file.
2026
- a branch-lock lock file [ to be shared with the bzrdir ]
2029
def get_format_description(self):
2030
"""See BranchFormat.get_format_description()."""
2031
return "Branch format 4"
2033
def initialize(self, a_bzrdir, name=None, repository=None):
2034
"""Create a branch of this format in a_bzrdir."""
2035
if repository is not None:
2036
raise NotImplementedError(
2037
"initialize(repository=<not None>) on %r" % (self,))
2038
utf8_files = [('revision-history', ''),
2039
('branch-name', ''),
2041
return self._initialize_helper(a_bzrdir, utf8_files, name=name,
2042
lock_type='branch4', set_format=False)
2045
super(BzrBranchFormat4, self).__init__()
2046
self._matchingbzrdir = bzrdir.BzrDirFormat6()
2048
def network_name(self):
2049
"""The network name for this format is the control dirs disk label."""
2050
return self._matchingbzrdir.get_format_string()
2052
def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
2053
found_repository=None):
2054
"""See BranchFormat.open()."""
2056
# we are being called directly and must probe.
2057
raise NotImplementedError
2058
if found_repository is None:
2059
found_repository = a_bzrdir.open_repository()
2060
return BzrBranch(_format=self,
2061
_control_files=a_bzrdir._control_files,
2064
_repository=found_repository)
2067
return "Bazaar-NG branch format 4"
2070
2022
class BranchFormatMetadir(BranchFormat):
2071
2023
"""Common logic for meta-dir based branch formats."""
2384
2336
BranchFormat.register_format(__format7)
2385
2337
BranchFormat.register_format(__format8)
2386
2338
BranchFormat.set_default_format(__format7)
2387
_legacy_formats = [BzrBranchFormat4(),
2389
network_format_registry.register(
2390
_legacy_formats[0].network_name(), _legacy_formats[0].__class__)
2393
2341
class BranchWriteLockResult(LogicalLockResult):