~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/memory.py

Remove shutil dependency in upgrade - create a delete_tree method for transports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
        for path in self._dirs:
146
146
            if (path.startswith(_abspath) and 
147
147
                path[len(_abspath) + 1:].find('/') == -1 and
148
 
                len(path) > len(_abspath)):
 
148
                len(path) > len(_abspath) and
 
149
                path[len(_abspath)] == '/'):
149
150
                result.append(path[len(_abspath) + 1:])
150
151
        return result
151
152
    
 
153
    def rmdir(self, relpath):
 
154
        """See Transport.rmdir."""
 
155
        _abspath = self._abspath(relpath)
 
156
        if _abspath in self._files:
 
157
            self._translate_error(IOError(errno.ENOTDIR, relpath), relpath)
 
158
        for path in self._files:
 
159
            if path.startswith(_abspath):
 
160
                self._translate_error(IOError(errno.EBUSY, relpath), relpath)
 
161
        for path in self._dirs:
 
162
            if path.startswith(_abspath) and path != _abspath:
 
163
                self._translate_error(IOError(errno.EBUSY, relpath), relpath)
 
164
        if not _abspath in self._dirs:
 
165
            raise NoSuchFile(relpath)
 
166
        del self._dirs[_abspath]
 
167
 
152
168
    def stat(self, relpath):
153
169
        """See Transport.stat()."""
154
170
        _abspath = self._abspath(relpath)
176
192
            return self._cwd[:-1]
177
193
        if relpath.endswith('/'):
178
194
            relpath = relpath[:-1]
 
195
        if relpath.startswith('./'):
 
196
            relpath = relpath[2:]
179
197
        return self._cwd + relpath
180
198
 
181
199