~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

(jelmer) Merge colocated branch support back into the 2a format. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
364
364
        """
365
365
        raise NotImplementedError(self.clone)
366
366
 
367
 
    def create_prefix(self):
 
367
    def create_prefix(self, mode=None):
368
368
        """Create all the directories leading down to self.base."""
369
369
        cur_transport = self
370
370
        needed = [cur_transport]
376
376
                    "Failed to create path prefix for %s."
377
377
                    % cur_transport.base)
378
378
            try:
379
 
                new_transport.mkdir('.')
 
379
                new_transport.mkdir('.', mode=mode)
380
380
            except errors.NoSuchFile:
381
381
                needed.append(new_transport)
382
382
                cur_transport = new_transport
387
387
        # Now we only need to create child directories
388
388
        while needed:
389
389
            cur_transport = needed.pop()
390
 
            cur_transport.ensure_base()
 
390
            cur_transport.ensure_base(mode=mode)
391
391
 
392
 
    def ensure_base(self):
 
392
    def ensure_base(self, mode=None):
393
393
        """Ensure that the directory this transport references exists.
394
394
 
395
395
        This will create a directory if it doesn't exist.
399
399
        # than permission". We attempt to create the directory, and just
400
400
        # suppress FileExists and PermissionDenied (for Windows) exceptions.
401
401
        try:
402
 
            self.mkdir('.')
 
402
            self.mkdir('.', mode=mode)
403
403
        except (errors.FileExists, errors.PermissionDenied):
404
404
            return False
405
405
        else: