iterating over revisions in a branch
Robert Collins
robertc at robertcollins.net
Wed Jan 4 23:06:44 GMT 2006
On Wed, 2006-01-04 at 23:56 +1100, Jamie Wilkinson wrote:
> Rob gave me a hint on how to iterate over revisoins in a branch:
>
> for revision_id in branch.revision_history():
> revision = branch.get_revision(revision_id)
>
> It occurred to me just now that it doesn't feel right. If I'm iterating
> over revisions, I shouldn't have to extract the revision during the body of
> the iterator loop, surely instead of the revision id I should get back the
> whole revision?
There was some serious concerns about efficiency some time back, and we
had two concepts - revision_id and revision - floating around, with
inconsistent apis here and there. I'd like us to have lazy constructed
revisions that would take the place of revisionids in all apis *except
those used to instantiate revisions or translate from the UI* (i.e.
has_revision, get_revision & RevisionSpecs). IIRC John and Aaron had
concerns that this would mask problems where a revision was not present
in the store, and some code wanted to check that it was present.
I thought that that was best checked by
'repository.has_revision(revision.id)'
Anyway, thats how we got where we are, I'd love to see this cleaned up
some way or another, just need consensus on whats the right mental
model.
Mine is 'the library apis in general deal with revisions, not revision
ids'
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060105/21b6059f/attachment.pgp
More information about the bazaar
mailing list