ancestor: optimize _lazyancestorsiter() for contiguous chains
If there's no revision between p1 and current, p1 must be the next revision
to visit. In this case, we can get around the overhead of heappop/push
operations. Note that this is faster than using heapreplace().
'current - p1 == 1' could be generalized as 'all(r not in seen for r in
xrange(p1, current)', but Python is too slow to do such thing.
% lazy ancestor set for [], stoprev = 0, inclusive = False
membership: []
iteration: []
% lazy ancestor set for [11, 13], stoprev = 0, inclusive = False
membership: [7, 8, 3, 4, 1, 0]
iteration: [8, 7, 4, 3, 2, 1, 0]
% lazy ancestor set for [1, 3], stoprev = 0, inclusive = False
membership: [1, 0]
iteration: [1, 0]
% lazy ancestor set for [11, 13], stoprev = 0, inclusive = True
membership: [11, 13, 7, 8, 3, 4, 1, 0]
iteration: [13, 11, 8, 7, 4, 3, 2, 1, 0]
% lazy ancestor set for [11, 13], stoprev = 6, inclusive = False
membership: [7, 8]
iteration: [8, 7]
% lazy ancestor set for [11, 13], stoprev = 6, inclusive = True
membership: [11, 13, 7, 8]
iteration: [13, 11, 8, 7]
% lazy ancestor set for [11, 13], stoprev = 11, inclusive = True
membership: [11, 13]
iteration: [13, 11]
% lazy ancestor set for [11, 13], stoprev = 12, inclusive = True
membership: [13]
iteration: [13]
% lazy ancestor set for [10, 1], stoprev = 0, inclusive = True
membership: [2, 10, 4, 5, 0, 1]
iteration: [10, 5, 4, 2, 1, 0]