~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Nearly complete .bzr/checkout splitout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
 
124
124
        The WorkingTree object is returned.
125
125
        """
126
 
        t = get_transport(base)
 
126
        t = get_transport(safe_unicode(base))
127
127
        if not isinstance(t, LocalTransport):
128
128
            raise errors.NotLocalUrl(base)
129
 
        bzrdir = BzrDir.create(base)
 
129
        bzrdir = BzrDir.create_branch_and_repo(safe_unicode(base)).bzrdir
130
130
        return bzrdir.create_workingtree()
131
131
 
132
132
    def create_workingtree(self):
239
239
        """
240
240
        raise NotImplementedError(self.open_repository)
241
241
 
242
 
    def open_workingtree(self):
 
242
    def open_workingtree(self, _unsupported=False):
243
243
        """Open the workingtree object at this BzrDir if one is present.
244
244
        
245
245
        TODO: static convenience version of this?
315
315
        from bzrlib.repository import RepositoryFormat5
316
316
        return RepositoryFormat5().open(self, _found=True)
317
317
 
318
 
    def open_workingtree(self):
 
318
    def open_workingtree(self, _unsupported=False):
319
319
        """See BzrDir.create_workingtree."""
320
320
        from bzrlib.workingtree import WorkingTreeFormat2
321
321
        return WorkingTreeFormat2().open(self, _found=True)
339
339
        from bzrlib.repository import RepositoryFormat6
340
340
        return RepositoryFormat6().open(self, _found=True)
341
341
 
342
 
    def open_workingtree(self):
 
342
    def open_workingtree(self, _unsupported=False):
343
343
        """See BzrDir.create_workingtree."""
344
344
        from bzrlib.workingtree import WorkingTreeFormat2
345
345
        return WorkingTreeFormat2().open(self, _found=True)
364
364
 
365
365
    def create_workingtree(self):
366
366
        """See BzrDir.create_workingtree."""
367
 
        from bzrlib.workingtree import WorkingTreeFormat2
368
 
        return WorkingTreeFormat2().initialize(self)
 
367
        from bzrlib.workingtree import WorkingTreeFormat
 
368
        return WorkingTreeFormat.get_default_format().initialize(self)
369
369
 
370
370
    def get_branch_transport(self, branch_format):
371
371
        """See BzrDir.get_branch_transport()."""
407
407
        from bzrlib.repository import RepositoryFormat6
408
408
        return RepositoryFormat6().open(self, _found=True)
409
409
 
410
 
    def open_workingtree(self):
 
410
    def open_workingtree(self, unsupported=False):
411
411
        """See BzrDir.create_workingtree."""
412
 
        from bzrlib.workingtree import WorkingTreeFormat2
413
 
        return WorkingTreeFormat2().open(self, _found=True)
 
412
        from bzrlib.workingtree import WorkingTreeFormat
 
413
        format = WorkingTreeFormat.find_format(self)
 
414
        self._check_supported(format, unsupported)
 
415
        return format.open(self, _found=True)
414
416
 
415
417
 
416
418
class BzrDirFormat(object):