~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-29 16:34:45 UTC
  • mfrom: (1551.8.37 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20060929163445-4c546bbfc3328d82
Implement BzrDir.destroy_tree and destroy_tree_metadata

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
        """
342
342
        raise NotImplementedError(self.create_workingtree)
343
343
 
 
344
    def destroy_workingtree(self):
 
345
        """Destroy the working tree at this BzrDir.
 
346
 
 
347
        Formats that do not support this may raise UnsupportedOperation.
 
348
        """
 
349
        raise NotImplementedError(self.destroy_workingtree)
 
350
 
 
351
    def destroy_workingtree_metadata(self):
 
352
        """Destroy the control files for the working tree at this BzrDir.
 
353
 
 
354
        The contents of working tree files are not affected.
 
355
        Formats that do not support this may raise UnsupportedOperation.
 
356
        """
 
357
        raise NotImplementedError(self.destroy_workingtree_metadata)
 
358
 
344
359
    def find_repository(self):
345
360
        """Find the repository that should be used for a_bzrdir.
346
361
 
733
748
                result.set_parent_ids([revision_id])
734
749
        return result
735
750
 
 
751
    def destroy_workingtree(self):
 
752
        """See BzrDir.destroy_workingtree."""
 
753
        raise errors.UnsupportedOperation(self.destroy_workingtree, self)
 
754
 
 
755
    def destroy_workingtree_metadata(self):
 
756
        """See BzrDir.destroy_workingtree_metadata."""
 
757
        raise errors.UnsupportedOperation(self.destroy_workingtree_metadata, 
 
758
                                          self)
 
759
 
736
760
    def get_branch_transport(self, branch_format):
737
761
        """See BzrDir.get_branch_transport()."""
738
762
        if branch_format is None:
878
902
        from bzrlib.workingtree import WorkingTreeFormat
879
903
        return WorkingTreeFormat.get_default_format().initialize(self, revision_id)
880
904
 
 
905
    def destroy_workingtree(self):
 
906
        """See BzrDir.destroy_workingtree."""
 
907
        wt = self.open_workingtree()
 
908
        repository = wt.branch.repository
 
909
        empty = repository.revision_tree(bzrlib.revision.NULL_REVISION)
 
910
        wt.revert([], old_tree=empty)
 
911
        self.destroy_workingtree_metadata()
 
912
 
 
913
    def destroy_workingtree_metadata(self):
 
914
        self.transport.delete_tree('checkout')
 
915
 
881
916
    def _get_mkdir_mode(self):
882
917
        """Figure out the mode to use when creating a bzrdir subdir."""
883
918
        temp_control = LockableFiles(self.transport, '', TransportLock)