[rfc] [patch] speeding up bzr log with a tree delta iterator

John Arbash Meinel john at arbash-meinel.com
Wed Jan 25 15:57:58 GMT 2006


Denys Duchier wrote:
> Aaron Bentley <aaron.bentley at utoronto.ca> writes:
> 
> 
>>It seems to me that the single-revision case is a special case,
> 
> 
> It will become completely non-special when/if we get rid of revision-history.
> 
> 
>>| +        # iterate
>>| +        while again:
>>
>>This looks like it would be clearer as a for loop.
>>
>>e.g.
>>if reverse:
>>~  revno_iter = ((r, r, r + 1) for r in xrange(rev2, rev1 - 1, -1))
>>else:
>>~  revno_iter = ((r, r - 1, r) for r in xrange(rev1, rev2 + 1))
> 
> 
> It's a nice suggestion, but since the most important trick in the iterator is to
> slide values from the previous iteration step (esp. trees), it doesn't help much.
> 
> 
>>| -    which_revs = _enumerate_history(branch)
>>| +    revision_history = branch.revision_history()
>>| +
>>| +    if len(revision_history)>0:
>>| +        if start_revision is None:
>>| +            start_revision = 1
>>| +        if end_revision is None:
>>| +            end_revision = len(revision_history)
>>
>>Are you deliberately avoiding handling the 0-length revision history
>>case here?
> 
> 
> Oddly enough, this is explicit _handling_ of the 0-length revision history.  I
> believe it was test_simple_log that brought that case to my attention.
> 
> revno 1526 of my bzr.fix.log branch now extends "bzr log" so that it accepts a
> lone revid not in this branch's revision-history.

I'm still hesitant on the 'revno or revision-id' thing. I really would
rather see a revision id list, with a 'reverse=False' flag. I realize
why you need it.
I think a revision list would be useful in more places than just log,
since we are trying to get away from revno internally.

So I would like to see:

def revision_iter(self, revisions, reverse=False, delta=False):

The first entry in revisions is the 'base' and will not be returned, all
of the rest will be relative to the previous one.

With the iteration going backwards if 'reverse' is true, though still
the first entry (revisions[0]) is the one that isn't returned.

Alternatively, it could be another parameter 'base'. If you wanted all
of 'revisions' to be returned.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060125/d8856434/attachment.pgp 


More information about the bazaar mailing list