~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Martin Pool
  • Date: 2007-10-12 08:00:07 UTC
  • mto: This revision was merged to the branch mainline in revision 2913.
  • Revision ID: mbp@sourcefrog.net-20071012080007-vf80woayyom8s8e1
Rename update_to_one_parent_via_delta to more wieldy update_basis_by_delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
            base = urlutils.local_path_to_url(base)
64
64
        if base[-1] != '/':
65
65
            base = base + '/'
66
 
 
67
 
        # Special case : windows has no "root", but does have
68
 
        # multiple lettered drives inside it. #240910
69
 
        if sys.platform == 'win32' and base == 'file:///':
70
 
            base = ''
71
 
            self._local_base = ''
72
 
            super(LocalTransport, self).__init__(base)
73
 
            return
74
 
            
75
66
        super(LocalTransport, self).__init__(base)
76
67
        self._local_base = urlutils.local_path_from_url(base)
77
68
 
105
96
    def abspath(self, relpath):
106
97
        """Return the full url to the given relative URL."""
107
98
        # TODO: url escape the result. RBC 20060523.
 
99
        assert isinstance(relpath, basestring), (type(relpath), relpath)
108
100
        # jam 20060426 Using normpath on the real path, because that ensures
109
101
        #       proper handling of stuff like
110
102
        path = osutils.normpath(osutils.pathjoin(
117
109
        This function only exists for the LocalTransport, since it is
118
110
        the only one that has direct local access.
119
111
        This is mostly for stuff like WorkingTree which needs to know
120
 
        the local working directory.  The returned path will always contain
121
 
        forward slashes as the path separator, regardless of the platform.
122
 
 
 
112
        the local working directory.
 
113
        
123
114
        This function is quite expensive: it calls realpath which resolves
124
115
        symlinks.
125
116
        """
316
307
        """See Transport.open_write_stream."""
317
308
        # initialise the file
318
309
        self.put_bytes_non_atomic(relpath, "", mode=mode)
319
 
        abspath = self._abspath(relpath)
320
 
        handle = open(abspath, 'wb')
321
 
        if mode is not None:
322
 
            self._check_mode_and_size(abspath, handle.fileno(), mode)
 
310
        handle = open(self._abspath(relpath), 'wb')
323
311
        transport._file_streams[self.abspath(relpath)] = handle
324
312
        return transport.FileFileStream(self, relpath, handle)
325
313
 
520
508
        self._local_base = urlutils._win32_local_path_from_url(base)
521
509
 
522
510
    def abspath(self, relpath):
 
511
        assert isinstance(relpath, basestring), (type(relpath), relpath)
523
512
        path = osutils.normpath(osutils.pathjoin(
524
513
                    self._local_base, urlutils.unescape(relpath)))
525
514
        return urlutils._win32_local_path_to_url(path)