~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Martin Pool
  • Date: 2006-06-06 08:09:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060606080909-f7c9ea6defe2e751
Remove Scratch objects used by doctests

Some old doctests rely on special Scratch object which clean up
temporary directory when they're deleted.  This is a bit undesirable
because deletion is not predictable and the classes aren't used enough
to be worthwhile.

 * Remove ScratchBranch, ScratchDir, ScratchTransport, etc
 * Remove old doctests or convert to unittests
 * Incidental cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
            return True
282
282
 
283
283
 
284
 
class ScratchTransport(LocalTransport):
285
 
    """A transport that works in a temporary dir and cleans up after itself.
286
 
    
287
 
    The dir only exists for the lifetime of the Python object.
288
 
    Obviously you should not put anything precious in it.
289
 
    """
290
 
 
291
 
    def __init__(self, base=None):
292
 
        if base is None:
293
 
            base = tempfile.mkdtemp()
294
 
        super(ScratchTransport, self).__init__(base)
295
 
 
296
 
    def __del__(self):
297
 
        rmtree(self.base, ignore_errors=True)
298
 
        mutter("%r destroyed" % self)
299
 
 
300
 
 
301
284
class LocalRelpathServer(Server):
302
285
    """A pretend server for local transports, using relpaths."""
303
286