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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2017-06-11 02:34:42 UTC
  • mfrom: (6681.2.10 more-controldir)
  • Revision ID: breezy.the.bot@gmail.com-20170611023442-p3vm7secrkqn6ckx
Some more bzrdir vs controldir fixes.

Merged from https://code.launchpad.net/~jelmer/brz/more-controldir/+merge/325453

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
At the moment every WorkingTree has its own branch.  Remote
24
24
WorkingTrees aren't supported.
25
25
 
26
 
To get a WorkingTree, call bzrdir.open_workingtree() or
 
26
To get a WorkingTree, call controldir.open_workingtree() or
27
27
WorkingTree.open(dir).
28
28
"""
29
29
 
147
147
                 _internal=False,
148
148
                 _transport=None,
149
149
                 _format=None,
150
 
                 _bzrdir=None):
 
150
                 _controldir=None):
151
151
        """Construct a WorkingTree instance. This is not a public API.
152
152
 
153
153
        :param branch: A branch to override probing for the branch.
154
154
        """
155
155
        self._format = _format
156
 
        self.controldir = _bzrdir
 
156
        self.controldir = _controldir
157
157
        if not _internal:
158
 
            raise errors.BzrError("Please use bzrdir.open_workingtree or "
 
158
            raise errors.BzrError("Please use controldir.open_workingtree or "
159
159
                "WorkingTree.open() to obtain a WorkingTree.")
160
160
        basedir = osutils.safe_unicode(basedir)
161
161
        mutter("opening working tree %r", basedir)
334
334
    def open_downlevel(path=None):
335
335
        """Open an unsupported working tree.
336
336
 
337
 
        Only intended for advanced situations like upgrading part of a bzrdir.
 
337
        Only intended for advanced situations like upgrading part of a controldir.
338
338
        """
339
339
        return WorkingTree.open(path, _unsupported=True)
340
340
 
341
341
    @staticmethod
342
342
    def find_trees(location):
343
343
        def list_current(transport):
344
 
            return [d for d in transport.list_dir('') if d != '.bzr']
345
 
        def evaluate(bzrdir):
 
344
            return [d for d in transport.list_dir('')
 
345
                    if not controldir.is_control_filename(d)]
 
346
        def evaluate(controldir):
346
347
            try:
347
 
                tree = bzrdir.open_workingtree()
 
348
                tree = controldir.open_workingtree()
348
349
            except errors.NoWorkingTree:
349
350
                return True, None
350
351
            else:
351
352
                return True, tree
352
353
        t = transport.get_transport(location)
353
 
        iterator = controldir.ControlDir.find_bzrdirs(t, evaluate=evaluate,
 
354
        iterator = controldir.ControlDir.find_controldirs(t, evaluate=evaluate,
354
355
                                              list_current=list_current)
355
356
        return [tr for tr in iterator if tr is not None]
356
357