[MERGE] BzrDir.destroy_workingtree
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Sep 29 14:12:54 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFFHRvW0F+nu1YWqI0RAqMpAJ9UFq+vhN1Oa4WoLkYZandc8BHG2QCeL7Qs
zzXfGGQGtfcuaHUkXcIQmvY=
=qShb
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: destroy_workingtree2.patch
Type: text/x-patch
Size: 9725 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060929/31a0e6da/attachment.bin
More information about the bazaar
mailing list