~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

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:
1782
1782
                 help="Read-only access of branches exported on the web.")
1783
1783
register_transport_proto('https://',
1784
1784
            help="Read-only access of branches exported on the web using SSL.")
1785
 
# The default http implementation is urllib, but https is pycurl if available
 
1785
# The default http implementation is urllib
1786
1786
register_lazy_transport('http://', 'bzrlib.transport.http._pycurl',
1787
1787
                        'PyCurlTransport')
1788
1788
register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
1789
1789
                        'HttpTransport_urllib')
 
1790
register_lazy_transport('https://', 'bzrlib.transport.http._pycurl',
 
1791
                        'PyCurlTransport')
1790
1792
register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
1791
1793
                        'HttpTransport_urllib')
1792
 
register_lazy_transport('https://', 'bzrlib.transport.http._pycurl',
1793
 
                        'PyCurlTransport')
1794
1794
 
1795
1795
register_transport_proto('ftp://', help="Access using passive FTP.")
1796
1796
register_lazy_transport('ftp://', 'bzrlib.transport.ftp', 'FtpTransport')