~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Weave-era branch implementations."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from bzrlib import (
20
22
    errors,
21
23
    lockable_files,
32
34
class BzrBranch4(FullHistoryBzrBranch):
33
35
    """Branch format 4."""
34
36
 
35
 
    def _get_checkout_format(self):
 
37
    def _get_checkout_format(self, lightweight=False):
36
38
        """Return the most suitable metadir for a checkout of this branch.
37
39
        """
38
40
        from bzrlib.plugins.weave_fmt.repository import RepositoryFormat7
39
41
        from bzrlib.bzrdir import BzrDirMetaFormat1
40
42
        format = BzrDirMetaFormat1()
41
 
        format.repository_format = RepositoryFormat7()
 
43
        if lightweight:
 
44
            format.set_branch_format(self._format)
 
45
            format.repository_format = self.bzrdir._format.repository_format
 
46
        else:
 
47
            format.repository_format = RepositoryFormat7()
42
48
        return format
43
49
 
44
50
    def unbind(self):
70
76
    It does not support binding.
71
77
    """
72
78
 
73
 
    def initialize(self, a_bzrdir, name=None, repository=None):
 
79
    def initialize(self, a_bzrdir, name=None, repository=None,
 
80
                   append_revisions_only=None):
74
81
        """Create a branch of this format in a_bzrdir.
75
82
 
76
83
        :param a_bzrdir: The bzrdir to initialize the branch in
77
84
        :param name: Name of colocated branch to create, if any
78
85
        :param repository: Repository for this branch (unused)
79
86
        """
 
87
        if append_revisions_only:
 
88
            raise errors.UpgradeRequired(a_bzrdir.user_url)
80
89
        if repository is not None:
81
90
            raise NotImplementedError(
82
91
                "initialize(repository=<not None>) on %r" % (self,))
127
136
        return "Branch format 4"
128
137
 
129
138
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
130
 
            found_repository=None):
 
139
            found_repository=None, possible_transports=None):
131
140
        """See BranchFormat.open()."""
132
 
        if name is not None:
 
141
        if name is None:
 
142
            name = a_bzrdir._get_selected_branch()
 
143
        if name != "":
133
144
            raise errors.NoColocatedBranchSupport(self)
134
145
        if not _found:
135
146
            # we are being called directly and must probe.
140
151
                         _control_files=a_bzrdir._control_files,
141
152
                         a_bzrdir=a_bzrdir,
142
153
                         name=name,
143
 
                         _repository=found_repository)
 
154
                         _repository=found_repository,
 
155
                         possible_transports=possible_transports)
144
156
 
145
157
    def __str__(self):
146
158
        return "Bazaar-NG branch format 4"