[MERGE] BzrDir.destroy_workingtree
John Arbash Meinel
john at arbash-meinel.com
Fri Sep 29 14:37:20 BST 2006
Aaron Bentley wrote:
> Martin Pool wrote:
>>> 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)
>
> I agree. I tend to use keyword syntax when passing a raw boolean, so
> the intended usage was:
>
> d.destroy_workingtree(keep_files=True)
> or
> d.destroy_workingtree(keep_files)
>
> Anyhow, here's a new bundle that implements it. I changed to deleting
> 'checkout' using the bzrdir's transport because the previous
> implementation seemed a bit dirty.
>
> Still +1?
>
> Aaron
sure.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060929/c30c7808/attachment.pgp
More information about the bazaar
mailing list