455
455
filtered = self._filter_merge_sorted_revisions(
456
456
self._merge_sorted_revisions_cache, start_revision_id,
457
457
stop_revision_id, stop_rule)
458
# Make sure we don't return revisions that are not part of the
459
# start_revision_id ancestry.
460
filtered = self._filter_non_ancestors(filtered)
458
461
if direction == 'reverse':
460
463
if direction == 'forward':
526
529
raise ValueError('invalid stop_rule %r' % stop_rule)
531
def _filter_non_ancestors(self, rev_iter):
532
# If we started from a dotted revno, we want to consider it as a tip
533
# and don't want to yield revisions that are not part of its
534
# ancestry. Given the order guaranteed by the merge sort, we will see
535
# uninteresting descendants of the first parent of our tip before the
537
first = rev_iter.next()
538
(rev_id, merge_depth, revno, end_of_merge) = first
541
# We start at a mainline revision so by definition, all others
542
# revisions in rev_iter are ancestors
543
for node in rev_iter:
548
pmap = self.repository.get_parent_map([rev_id])
549
parents = pmap.get(rev_id, [])
551
whitelist.update(parents)
553
# If there is no parents, there is nothing of interest left
555
# FIXME: It's hard to test this scenario here as this code is never
556
# called in that case. -- vila 20100322
559
for (rev_id, merge_depth, revno, end_of_merge) in rev_iter:
561
if rev_id in whitelist:
562
pmap = self.repository.get_parent_map([rev_id])
563
parents = pmap.get(rev_id, [])
564
whitelist.remove(rev_id)
565
whitelist.update(parents)
567
# We've reached the mainline, there is nothing left to
571
# A revision that is not part of the ancestry of our
574
yield (rev_id, merge_depth, revno, end_of_merge)
528
576
def leave_lock_in_place(self):
529
577
"""Tell this branch object not to release the physical lock when this
530
578
object is unlocked.