[MERGE] BzrDir.destroy_workingtree
Aaron Bentley
aaron.bentley at utoronto.ca
Thu Sep 28 12:45:39 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> +1, seems reasonable.
>
> I'd just raise a fairly minor question about the parameter to it though.
> Would this be happier as two methods, one of which destroys the files
> and the other just removes the working tree control directory?
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.
> And, if
> there is a parameter, does it really need to have a default value?
It seemed like a good idea to default to behaving as the inverse of
create_tree, but I guess it doesn't *need* to.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFG7Xj0F+nu1YWqI0RAj5IAJwNOX2cKJlzNdJrmrHivpjyercBSQCfYevu
xOmOWS87E0kb6EKUCyENepU=
=vOOo
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list