[MERGE] Tree.revision_tree
Aaron Bentley
aaron.bentley at utoronto.ca
Mon Sep 11 15:05:26 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
>>Now that we've got a clean separation between repositories, branches,
>>and trees, I think we should be hesitant to go and blur those boundaries
>>again.
>
>
> I agree. Thats why the api is strict about only returning a tree if it
> actually has the data, rather than having it ever go and fetch the
> inventory from the repository.
No, I don't think we actually do agree here. Because I'm thinking about
this in terms of responsibilities, and you're thinking about it in terms
of data layout.
I think the responsibility for providing revision_trees should lie with
Repository. That matches all our existing code's expectations. What's
the expected usage of this api? It seems like it would be this:
try:
base_tree = tree.revision_tree(base_revision_id)
except NoSuchRevision:
base_tree = branch.repository.revision_tree(base_revision_id)
Is there any case in which we would do something else? If not, I think
we should try to fix the API so that we don't have to repeat chunks like
this everywhere.
>>And since only part of a tree is ever local to the WorkingTree (the
>>inventory), it's hard to say that the basis tree is "locally present",
>>either.
>
>
> Well like I say above, its about exposing what dirstate offers cleanly.
>
> Other suggestions appreciated, but I need some way of getting at it that
> is of broad scope, to change other code to use it.
My suggestion is to register working trees with their repositories, so
that repository.revision_tree() will use a cached inventory if one is
available in any live working tree that uses the repository.
A solution like this automatically upgrades all our code. It also gets
away from special-casing basis_tree.
What do you think?
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFFBW0m0F+nu1YWqI0RAoXrAJ99sHebRDZAzVXV3sVQJP0RkSp9IgCfXITW
olXWpnDe1iIUqcS5/pLXZL8=
=AC6J
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list