getting the inventory of a revision, or, Why doesn't the API look like I think it should?
Jamie Wilkinson
jaq at spacepants.org
Wed Jan 4 15:33:44 GMT 2006
Following on from my previous mail, why does one ask the Branch for a
Tree based on a Revision, instead of the Revision itself? (I know,
efficiency :)
My mental model went like this:
# To examine each of the commits in a branch
for revision in branch:
do_stuff_to(revision.inventory)
Now, it took me a while to follow the actual chain of objects, and some
hints from other plugins (thanks gannotate! :), thusly:
* Get the revisions from the branch
* Get the commit inventory from the revision
* Oh, you get an inventory from a Tree! Get the tree...
* You get the tree from the branch! Oh, don't need to get the revision
now.
* Examine the inventory from the tree given.
Needless to say, that wasn't obvious from the API. It also feels dirty to
ask the branch for the tree for a particular revision; knowing about Tree
I'd modify my model above to:
for rev in branch:
do_stuff_to(rev.tree.inventory)
So, now that I've found my first assumption about how branches and revisions
fit was wrong given that the rest of what I wanted to do was also at odds
with the API, I'm wondering if anyone can explain why? :)
I mean, bzrlib is maturing, I'm just a single hacker battling against it,
and I don't know the internals. So either I'm way off base with my
assumptions about how the API should look, or everyone else does :)
Am I on crack, or are my expectations reasonable?
More information about the bazaar
mailing list