[MERGE] BzrDir.destroy_workingtree

Martin Pool mbp at canonical.com
Fri Sep 29 07:32:51 BST 2006


On 28 Sep 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> BzrDir.create_workingtree creates the metadata and sets up the file
> contents.  So I thought an inverse operation would be best.
> 
> A slightly different split would be:
>     def destroy_workingtree(self):
>         """See BzrDir.destroy_workingtree."""
>         wt = self.open_workingtree()
>         repository = wt.branch.repository
>         empty = repository.revision_tree(bzrlib.revision.NULL_REVISION)
>         wt.revert([], old_tree=empty)
>         self.destroy_workingtreee_metadata()
> 
>     def destroy_workingtree_metadata(self):
>         wt = self.open_workingtree()
>         wt._control_files._transport.delete_tree('.')
> 
> That would give us an inverse for create_tree, while still allowing me
> to delete only the metadata.

Nice names.
I think that would make the callers somewhat easier to read, e.g. 

  d.destroy_workingtree_metadata()

vs 

  d.destroy_workingtree(True)

-- 
Martin




More information about the bazaar mailing list