[MERGE] Enable merging PreviewTrees

Aaron Bentley aaron at aaronbentley.com
Fri Oct 10 15:57:17 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> On Thu, 2008-10-09 at 00:02 -0400, Aaron Bentley wrote:
>> Inventory objects are meant to be an implementation detail of certain
>> Tree types.  Hitting the inventory is expensive on DirState-based
>> trees,
>> and we've worked hard to eliminate .inventory access from our key
>> codepaths.  PreviewTree is the next step, because it eliminates the
>> .inventory attribute entirely.
> 
> I've replied to the prior thread about this patch, but let me note that
> we can write a more lazy inventory for dirstate - inventory supports
> lookups by name (the path2id method would seed loading the data via
> bisection, then foo[id] would succeed).

I can see how you'd think that implementing Tree.get_inventory_entry is
worse than implementing PreviewTree.inventory.  I still feel the other
way-- it's simply a convenience around the sanctioned
Tree.iter_entries_by_dir method.  If I implemented
PreviewTree.inventory, it would not conform to the Inventory API, and
that seems worse to me.

As long as Tree.iter_entries_by_dir and Tree.apply_inventory_delta are
supported methods, there will be some intermingling of InventoryEntry
and the Tree interface.  I think we'll be able to remove Tree.inventory
much sooner than Tree.apply_inventory_delta or Tree.iter_entries_by_dir,
and I think that will be useful progress.

But I think we can agree that eschewing InventoryEntries in favour of
Tree methods is better still, so here is a patch that does that.
Specifically, it implements create_from_tree, which replaces the use of
create_by_entry.  Since create_by_entry is potentially buggy when used
with WorkingTrees, and since with my changes, nothing is using it, I
have deprecated it.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvbUcACgkQ0F+nu1YWqI0ItQCdGLWwWy0FRRqwQMXPTXTn0bel
jpcAn1rIv8DGUs04jbKr0xLU3iWhezwo
=IkEi
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: merge-preview.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20081010/37ec7c21/attachment-0001.diff 


More information about the bazaar mailing list