~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Start WorkingTree -> .bzr/checkout transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
        """
147
147
        raise NotImplementedError(self.get_branch_transport)
148
148
        
 
149
    def get_workingtree_transport(self, branch_format):
 
150
        """Get the transport for use by workingtree format in this BzrDir.
 
151
 
 
152
        Note that bzr dirs that do not support format strings will raise
 
153
        IncompatibleFormat if the workingtree format they are given has
 
154
        a format string, and vice verca.
 
155
 
 
156
        If workingtree_format is None, the transport is returned with no 
 
157
        checking. if it is not None, then the returned transport is
 
158
        guaranteed to point to an existing directory ready for use.
 
159
        """
 
160
        raise NotImplementedError(self.get_workingtree_transport)
 
161
        
149
162
    def __init__(self, _transport, _format):
150
163
        """Initialize a Bzr control dir object.
151
164
        
252
265
            return self.transport
253
266
        raise errors.IncompatibleFormat(branch_format, self._format)
254
267
 
 
268
    def get_workingtree_transport(self, workingtree_format):
 
269
        """See BzrDir.get_workingtree_transport()."""
 
270
        if workingtree_format is None:
 
271
            return self.transport
 
272
        try:
 
273
            workingtree_format.get_format_string()
 
274
        except NotImplementedError:
 
275
            return self.transport
 
276
        raise errors.IncompatibleFormat(workingtree_format, self._format)
 
277
 
255
278
    def open_branch(self, unsupported=False):
256
279
        """See BzrDir.open_branch."""
257
280
        from bzrlib.branch import BzrBranchFormat4
358
381
            pass
359
382
        return self.transport.clone('branch')
360
383
 
 
384
    def get_workingtree_transport(self, workingtree_format):
 
385
        """See BzrDir.get_workingtree_transport()."""
 
386
        if workingtree_format is None:
 
387
            return self.transport.clone('checkout')
 
388
        try:
 
389
            workingtree_format.get_format_string()
 
390
        except NotImplementedError:
 
391
            raise errors.IncompatibleFormat(workingtree_format, self._format)
 
392
        try:
 
393
            self.transport.mkdir('checkout')
 
394
        except errors.FileExists:
 
395
            pass
 
396
        return self.transport.clone('checkout')
 
397
 
361
398
    def open_branch(self, unsupported=False):
362
399
        """See BzrDir.open_branch."""
363
400
        from bzrlib.branch import BranchFormat