/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 breezy/workingtree_3.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:17:06 UTC
  • mto: (6670.4.8 move-bzr)
  • mto: This revision was merged to the branch mainline in revision 6681.
  • Revision ID: jelmer@jelmer.uk-20170610001706-xn6jiuev350246mr
Rename a number of attributes from bzrdir to controldir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
        # if needed, or, when the cache sees a change, append it to the hash
55
55
        # cache file, and have the parser take the most recent entry for a
56
56
        # given path only.
57
 
        wt_trans = self.bzrdir.get_workingtree_transport(None)
 
57
        wt_trans = self.controldir.get_workingtree_transport(None)
58
58
        cache_filename = wt_trans.local_abspath('stat-cache')
59
59
        self._hashcache = hashcache.HashCache(basedir, cache_filename,
60
 
            self.bzrdir._get_file_mode(),
 
60
            self.controldir._get_file_mode(),
61
61
            self._content_filter_stack_provider())
62
62
        hc = self._hashcache
63
63
        hc.read()
117
117
            return False
118
118
        else:
119
119
            self._transport.put_bytes('last-revision', revision_id,
120
 
                mode=self.bzrdir._get_file_mode())
 
120
                mode=self.controldir._get_file_mode())
121
121
            return True
122
122
 
123
123
    def _get_check_refs(self):
173
173
 
174
174
    _matchingbzrdir = property(__get_matchingbzrdir)
175
175
 
176
 
    def _open_control_files(self, a_bzrdir):
177
 
        transport = a_bzrdir.get_workingtree_transport(None)
 
176
    def _open_control_files(self, a_controldir):
 
177
        transport = a_controldir.get_workingtree_transport(None)
178
178
        return LockableFiles(transport, 'lock', LockDir)
179
179
 
180
 
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
 
180
    def initialize(self, a_controldir, revision_id=None, from_branch=None,
181
181
                   accelerator_tree=None, hardlink=False):
182
182
        """See WorkingTreeFormat.initialize().
183
183
 
190
190
        :param hardlink: If true, hard-link files from accelerator_tree,
191
191
            where possible.
192
192
        """
193
 
        if not isinstance(a_bzrdir.transport, LocalTransport):
194
 
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
195
 
        transport = a_bzrdir.get_workingtree_transport(self)
196
 
        control_files = self._open_control_files(a_bzrdir)
 
193
        if not isinstance(a_controldir.transport, LocalTransport):
 
194
            raise errors.NotLocalUrl(a_controldir.transport.base)
 
195
        transport = a_controldir.get_workingtree_transport(self)
 
196
        control_files = self._open_control_files(a_controldir)
197
197
        control_files.create_lock()
198
198
        control_files.lock_write()
199
199
        transport.put_bytes('format', self.as_string(),
200
 
            mode=a_bzrdir._get_file_mode())
 
200
            mode=a_controldir._get_file_mode())
201
201
        if from_branch is not None:
202
202
            branch = from_branch
203
203
        else:
204
 
            branch = a_bzrdir.open_branch()
 
204
            branch = a_controldir.open_branch()
205
205
        if revision_id is None:
206
206
            revision_id = _mod_revision.ensure_null(branch.last_revision())
207
207
        # WorkingTree3 can handle an inventory which has a unique root id.
210
210
        # are maintaining compatibility with older clients.
211
211
        # inv = Inventory(root_id=gen_root_id())
212
212
        inv = self._initial_inventory()
213
 
        wt = self._tree_class(a_bzrdir.root_transport.local_abspath('.'),
 
213
        wt = self._tree_class(a_controldir.root_transport.local_abspath('.'),
214
214
                         branch,
215
215
                         inv,
216
216
                         _internal=True,
217
217
                         _format=self,
218
 
                         _bzrdir=a_bzrdir,
 
218
                         _bzrdir=a_controldir,
219
219
                         _control_files=control_files)
220
220
        wt.lock_tree_write()
221
221
        try:
240
240
    def _initial_inventory(self):
241
241
        return inventory.Inventory()
242
242
 
243
 
    def open(self, a_bzrdir, _found=False):
244
 
        """Return the WorkingTree object for a_bzrdir
 
243
    def open(self, a_controldir, _found=False):
 
244
        """Return the WorkingTree object for a_controldir
245
245
 
246
246
        _found is a private parameter, do not use it. It is used to indicate
247
247
               if format probing has already been done.
249
249
        if not _found:
250
250
            # we are being called directly and must probe.
251
251
            raise NotImplementedError
252
 
        if not isinstance(a_bzrdir.transport, LocalTransport):
253
 
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
254
 
        wt = self._open(a_bzrdir, self._open_control_files(a_bzrdir))
 
252
        if not isinstance(a_controldir.transport, LocalTransport):
 
253
            raise errors.NotLocalUrl(a_controldir.transport.base)
 
254
        wt = self._open(a_controldir, self._open_control_files(a_controldir))
255
255
        return wt
256
256
 
257
 
    def _open(self, a_bzrdir, control_files):
 
257
    def _open(self, a_controldir, control_files):
258
258
        """Open the tree itself.
259
259
 
260
 
        :param a_bzrdir: the dir for the tree.
 
260
        :param a_controldir: the dir for the tree.
261
261
        :param control_files: the control files for the tree.
262
262
        """
263
 
        return self._tree_class(a_bzrdir.root_transport.local_abspath('.'),
 
263
        return self._tree_class(a_controldir.root_transport.local_abspath('.'),
264
264
                                _internal=True,
265
265
                                _format=self,
266
 
                                _bzrdir=a_bzrdir,
 
266
                                _bzrdir=a_controldir,
267
267
                                _control_files=control_files)