/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Martin Pool
  • Date: 2007-03-06 05:05:46 UTC
  • mto: (2255.2.213 dirstate.dogfood)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: mbp@sourcefrog.net-20070306050546-3lujsd390sq65um0
Add BzrDir.retire_bzrdir and partly fix subsume

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
from bzrlib.weave import Weave
66
66
""")
67
67
 
68
 
from bzrlib.trace import mutter
 
68
from bzrlib.trace import mutter, note
69
69
from bzrlib.transport.local import LocalTransport
70
70
 
71
71
 
352
352
        """
353
353
        raise NotImplementedError(self.create_workingtree)
354
354
 
 
355
    def retire_bzrdir(self):
 
356
        """Permanently disable the bzrdir.
 
357
 
 
358
        This is done by renaming it to give the user some ability to recover
 
359
        if there was a problem.
 
360
 
 
361
        This will have horrible consequences if anyone has anything locked or
 
362
        in use.
 
363
        """
 
364
        for i in xrange(10000):
 
365
            try:
 
366
                to_path = '.bzr.retired.%d' % i
 
367
                self.root_transport.rename('.bzr', to_path)
 
368
                note("renamed %s to %s"
 
369
                    % (self.root_transport.abspath('.bzr'), to_path))
 
370
                break
 
371
            except (errors.TransportError, IOError, errors.PathError):
 
372
                pass
 
373
 
355
374
    def destroy_workingtree(self):
356
375
        """Destroy the working tree at this BzrDir.
357
376