iterating over revisions in a branch
Jamie Wilkinson
jaq at spacepants.org
Wed Jan 4 12:56:24 GMT 2006
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?
I.e.:
for revision in branch.revision_history():
# do stuff
# and as the id is an attribute of the revision itself, I should access
# it like so:
print revision.id
So, can anyone tell my why the iterator doesn't behave like this? (either,
why the decision was made to do it this way, or if it was never though of,
why doing it this way now is a bad idea?)
(I'd hack my own revision_history() to do this, but I'm aware of the effects
of changing the API, and can't think of a better name for the method because
the existing name suits it best IMHO.)
More information about the bazaar
mailing list