1
# Copyright (C) 2010 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Weave-era branch implementations."""
20
from bzrlib.branch import (
26
class BzrBranchFormat4(BranchFormat):
27
"""Bzr branch format 4.
30
- a revision-history file.
31
- a branch-lock lock file [ to be shared with the bzrdir ]
34
def get_format_description(self):
35
"""See BranchFormat.get_format_description()."""
36
return "Branch format 4"
38
def initialize(self, a_bzrdir, name=None, repository=None):
39
"""Create a branch of this format in a_bzrdir."""
40
if repository is not None:
41
raise NotImplementedError(
42
"initialize(repository=<not None>) on %r" % (self,))
43
utf8_files = [('revision-history', ''),
46
return self._initialize_helper(a_bzrdir, utf8_files, name=name,
47
lock_type='branch4', set_format=False)
50
super(BzrBranchFormat4, self).__init__()
51
from bzrlib.plugins.weave_fmt.bzrdir import BzrDirFormat6
52
self._matchingbzrdir = BzrDirFormat6()
54
def network_name(self):
55
"""The network name for this format is the control dirs disk label."""
56
return self._matchingbzrdir.get_format_string()
58
def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
59
found_repository=None):
60
"""See BranchFormat.open()."""
62
# we are being called directly and must probe.
63
raise NotImplementedError
64
if found_repository is None:
65
found_repository = a_bzrdir.open_repository()
66
return BzrBranch(_format=self,
67
_control_files=a_bzrdir._control_files,
70
_repository=found_repository)
73
return "Bazaar-NG branch format 4"
76
_legacy_formats = [BzrBranchFormat4() ]