[PATCH] Changeset plugin passes all tests
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Jul 15 20:42:14 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I've got the changeset plugin passing all tests. The fixes involved
1. Accomodating explicit root IDs better in MockTree and elsewhere
2. Fleshing out MockTree to make it a more functional implementation of
both the Tree and Inventory interfaces
2. Fixing the way the text of a rename is decoded (we were getting
'/dir' instead of 'sub/dir'. The leading '/' caused infinite recursion.
3. Fixing calls to note_rename (it doesn't take a text_id)
4. Causing ChangesetTree to return None when asked about the text_id of
a directory or the root directory*
5. Made ChangesetTree._get_inventory simpler and more robust
On ChangesetTree._get_inventory():
In constructing and Inventory, it's necessary to always add parents
before children. The previous code tried to add parents when necessary,
but it couldn't cover all cases that way. Now it gets a list of all ids
in the new tree, sorted by path length. Since shorter paths come first,
parents are always added before children. Simple and hard to get wrong.
On ChangesetTree.inventory:
I'm not sure why ChangesetTree derives from Tree. Since we're using a
dynamic language, we don't have to use inheritance to implement that
interface.
I intended to implement both Tree and Inventory in terms of
ChangesetTree, as I did with MockTree. That would mean that
ChangesetTree would always supply consistent data.
The current inventory attribute is essentially a cache of ChangesetTree
data. However, this cache is not invalidated when the tree-construction
methods are called (e.g. ChangesetTree.note_rename()). This means that
it is possible for ChangesetTree.path2id() and
ChangesetTree.inventory.path2id() to produce different answers, and I
believe this is a bad thing, though the current client code is well-behaved.
While it would be slower to use ChangesetTree as its own inventory, I
don't know how much slower it would be. The difference might well be
negligible.
Aaron
*The root directory has its own file 'kind', but it probably shouldn't,
because that means that if you turn it into a subdirectory, its kind
will change.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC2BGW0F+nu1YWqI0RAhT3AJ9HEm7KgrfYBDj6kwiCKchfivpiHACeOebe
vf3uQitMRZZ6T6/w+S70mcE=
=rEYz
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: changeset-fixes
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050715/33130ecd/attachment.diff
More information about the bazaar
mailing list