~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/memory.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-28 18:00:26 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060428180026-b66f2d738fb90d32
Now all MemoryTransports start with a valid root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        super(MemoryTransport, self).__init__(url)
61
61
        self._cwd = url[url.find(':') + 3:]
62
62
        # dictionaries from absolute path to file mode
63
 
        self._dirs = {}
 
63
        self._dirs = {'/':None}
64
64
        self._files = {}
65
65
        self._locks = {}
66
66
 
217
217
        if _abspath in self._files:
218
218
            return MemoryStat(len(self._files[_abspath][0]), False, 
219
219
                              self._files[_abspath][1])
220
 
        elif _abspath == '':
221
 
            return MemoryStat(0, True, None)
222
220
        elif _abspath in self._dirs:
223
221
            return MemoryStat(0, True, self._dirs[_abspath])
224
222
        else:
238
236
        if relpath.find('..') != -1:
239
237
            raise AssertionError('relpath contains ..')
240
238
        if relpath == '.':
 
239
            if (self._cwd == '/'):
 
240
                return self._cwd
241
241
            return self._cwd[:-1]
242
242
        if relpath.endswith('/'):
243
243
            relpath = relpath[:-1]
273
273
 
274
274
    def setUp(self):
275
275
        """See bzrlib.transport.Server.setUp."""
276
 
        self._dirs = {}
 
276
        self._dirs = {'/':None}
277
277
        self._files = {}
278
278
        self._locks = {}
279
279
        self._scheme = "memory+%s:///" % id(self)