~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-18 02:21:57 UTC
  • mfrom: (1787 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1794.
  • Revision ID: john@arbash-meinel.com-20060618022157-6e33aa9b67c25e4f
[merge] bzr.dev 1787

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
            base = base + '/'
52
52
        super(LocalTransport, self).__init__(base)
53
53
        self._local_base = urlutils.local_path_from_url(base)
54
 
        ## mutter("_local_base: %r => %r", base, self._local_base)
55
54
 
56
55
    def should_cache(self):
57
56
        return False
315
314
            return True
316
315
 
317
316
 
 
317
class ScratchTransport(LocalTransport):
 
318
    """A transport that works in a temporary dir and cleans up after itself.
 
319
    
 
320
    The dir only exists for the lifetime of the Python object.
 
321
    Obviously you should not put anything precious in it.
 
322
    """
 
323
 
 
324
    def __init__(self, base=None):
 
325
        if base is None:
 
326
            base = tempfile.mkdtemp()
 
327
        super(ScratchTransport, self).__init__(base)
 
328
 
 
329
    def __del__(self):
 
330
        rmtree(self.base, ignore_errors=True)
 
331
        mutter("%r destroyed" % self)
 
332
 
 
333
 
318
334
class LocalRelpathServer(Server):
319
335
    """A pretend server for local transports, using relpaths."""
320
336