/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
21
 
from ... import (
 
21
from bzrlib import (
22
22
    errors,
23
23
    lockable_files,
24
24
    )
25
25
 
26
 
from ...decorators import (
 
26
from bzrlib.decorators import (
 
27
    needs_read_lock,
 
28
    needs_write_lock,
27
29
    only_raises,
28
30
    )
29
 
from ...lock import LogicalLockResult
30
 
from ...trace import mutter
 
31
from bzrlib.lock import LogicalLockResult
 
32
from bzrlib.trace import mutter
31
33
 
32
 
from ...branch import (
 
34
from bzrlib.branch import (
33
35
    BranchFormat,
34
36
    BranchWriteLockResult,
35
37
    )
36
 
from ...bzr.fullhistory import (
 
38
from bzrlib.branchfmt.fullhistory import (
37
39
    FullHistoryBzrBranch,
38
40
    )
39
41
 
63
65
    def lock_read(self):
64
66
        """Lock the branch for read operations.
65
67
 
66
 
        :return: A breezy.lock.LogicalLockResult.
 
68
        :return: A bzrlib.lock.LogicalLockResult.
67
69
        """
68
70
        if not self.is_locked():
69
71
            self._note_lock('r')
93
95
    def _get_checkout_format(self, lightweight=False):
94
96
        """Return the most suitable metadir for a checkout of this branch.
95
97
        """
96
 
        from .repository import RepositoryFormat7
97
 
        from ...bzr.bzrdir import BzrDirMetaFormat1
 
98
        from bzrlib.plugins.weave_fmt.repository import RepositoryFormat7
 
99
        from bzrlib.bzrdir import BzrDirMetaFormat1
98
100
        format = BzrDirMetaFormat1()
99
101
        if lightweight:
100
102
            format.set_branch_format(self._format)
101
 
            format.repository_format = self.controldir._format.repository_format
 
103
            format.repository_format = self.bzrdir._format.repository_format
102
104
        else:
103
105
            format.repository_format = RepositoryFormat7()
104
106
        return format
132
134
    It does not support binding.
133
135
    """
134
136
 
135
 
    def initialize(self, a_controldir, name=None, repository=None,
 
137
    def initialize(self, a_bzrdir, name=None, repository=None,
136
138
                   append_revisions_only=None):
137
 
        """Create a branch of this format in a_controldir.
 
139
        """Create a branch of this format in a_bzrdir.
138
140
 
139
 
        :param a_controldir: The bzrdir to initialize the branch in
 
141
        :param a_bzrdir: The bzrdir to initialize the branch in
140
142
        :param name: Name of colocated branch to create, if any
141
143
        :param repository: Repository for this branch (unused)
142
144
        """
143
145
        if append_revisions_only:
144
 
            raise errors.UpgradeRequired(a_controldir.user_url)
 
146
            raise errors.UpgradeRequired(a_bzrdir.user_url)
145
147
        if repository is not None:
146
148
            raise NotImplementedError(
147
149
                "initialize(repository=<not None>) on %r" % (self,))
148
 
        if not [isinstance(a_controldir._format, format) for format in
 
150
        if not [isinstance(a_bzrdir._format, format) for format in
149
151
                self._compatible_bzrdirs]:
150
 
            raise errors.IncompatibleFormat(self, a_controldir._format)
151
 
        utf8_files = [('revision-history', b''),
152
 
                      ('branch-name', b''),
 
152
            raise errors.IncompatibleFormat(self, a_bzrdir._format)
 
153
        utf8_files = [('revision-history', ''),
 
154
                      ('branch-name', ''),
153
155
                      ]
154
 
        mutter('creating branch %r in %s', self, a_controldir.user_url)
155
 
        branch_transport = a_controldir.get_branch_transport(self, name=name)
 
156
        mutter('creating branch %r in %s', self, a_bzrdir.user_url)
 
157
        branch_transport = a_bzrdir.get_branch_transport(self, name=name)
156
158
        control_files = lockable_files.LockableFiles(branch_transport,
157
159
            'branch-lock', lockable_files.TransportLock)
158
160
        control_files.create_lock()
166
168
            for (filename, content) in utf8_files:
167
169
                branch_transport.put_bytes(
168
170
                    filename, content,
169
 
                    mode=a_controldir._get_file_mode())
 
171
                    mode=a_bzrdir._get_file_mode())
170
172
        finally:
171
173
            if lock_taken:
172
174
                control_files.unlock()
173
 
        branch = self.open(a_controldir, name, _found=True,
 
175
        branch = self.open(a_bzrdir, name, _found=True,
174
176
                found_repository=None)
175
 
        self._run_post_branch_init_hooks(a_controldir, name, branch)
 
177
        self._run_post_branch_init_hooks(a_bzrdir, name, branch)
176
178
        return branch
177
179
 
178
180
    def __init__(self):
179
181
        super(BzrBranchFormat4, self).__init__()
180
 
        from .bzrdir import (
 
182
        from bzrlib.plugins.weave_fmt.bzrdir import (
181
183
            BzrDirFormat4, BzrDirFormat5, BzrDirFormat6,
182
184
            )
183
 
        self._matchingcontroldir = BzrDirFormat6()
 
185
        self._matchingbzrdir = BzrDirFormat6()
184
186
        self._compatible_bzrdirs = [BzrDirFormat4, BzrDirFormat5,
185
187
            BzrDirFormat6]
186
188
 
187
189
    def network_name(self):
188
190
        """The network name for this format is the control dirs disk label."""
189
 
        return self._matchingcontroldir.get_format_string()
 
191
        return self._matchingbzrdir.get_format_string()
190
192
 
191
193
    def get_format_description(self):
192
194
        return "Branch format 4"
193
195
 
194
 
    def open(self, a_controldir, name=None, _found=False, ignore_fallbacks=False,
 
196
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
195
197
            found_repository=None, possible_transports=None):
196
198
        """See BranchFormat.open()."""
197
199
        if name is None:
198
 
            name = a_controldir._get_selected_branch()
 
200
            name = a_bzrdir._get_selected_branch()
199
201
        if name != "":
200
202
            raise errors.NoColocatedBranchSupport(self)
201
203
        if not _found:
202
204
            # we are being called directly and must probe.
203
205
            raise NotImplementedError
204
206
        if found_repository is None:
205
 
            found_repository = a_controldir.open_repository()
 
207
            found_repository = a_bzrdir.open_repository()
206
208
        return BzrBranch4(_format=self,
207
 
                         _control_files=a_controldir._control_files,
208
 
                         a_controldir=a_controldir,
 
209
                         _control_files=a_bzrdir._control_files,
 
210
                         a_bzrdir=a_bzrdir,
209
211
                         name=name,
210
212
                         _repository=found_repository,
211
213
                         possible_transports=possible_transports)