1543
1542
def test_bugs_handler_present(self):
1544
1543
self.properties_handler_registry.get('bugs_properties_handler')
1546
class TestLogExcludeAncestry(tests.TestCaseWithTransport):
1548
def make_branch_with_alternate_ancestries(self, relpath='.'):
1549
# See test_merge_sorted_exclude_ancestry below for the difference with
1550
# bt.per_branch.test_iter_merge_sorted_revision.
1551
# TestIterMergeSortedRevisionsBushyGraph.
1552
# make_branch_with_alternate_ancestries
1553
# and test_merge_sorted_exclude_ancestry
1554
# See the FIXME in assertLogRevnos too.
1555
builder = branchbuilder.BranchBuilder(self.get_transport(relpath))
1567
builder.start_series()
1568
builder.build_snapshot('1', None, [
1569
('add', ('', 'TREE_ROOT', 'directory', '')),])
1570
builder.build_snapshot('1.1.1', ['1'], [])
1571
builder.build_snapshot('2', ['1'], [])
1572
builder.build_snapshot('1.2.1', ['1.1.1'], [])
1573
builder.build_snapshot('1.1.2', ['1.1.1', '1.2.1'], [])
1574
builder.build_snapshot('3', ['2', '1.1.2'], [])
1575
builder.finish_series()
1576
br = builder.get_branch()
1578
self.addCleanup(br.unlock)
1581
def assertLogRevnos(self, expected_revnos, b, start, end,
1582
exclude_common_ancestry):
1583
# FIXME: the layering in log makes it hard to test intermediate levels,
1584
# I wish adding filters with their parameters were easier...
1586
iter_revs = log._calc_view_revisions(
1587
b, start, end, direction='reverse',
1588
generate_merge_revisions=True,
1589
exclude_common_ancestry=exclude_common_ancestry)
1590
self.assertEqual(expected_revnos,
1591
[revid for revid, revno, depth in iter_revs])
1593
def test_merge_sorted_exclude_ancestry(self):
1594
b = self.make_branch_with_alternate_ancestries()
1595
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '1.1.1', '2', '1'],
1597
# '2' is part of the '3' ancestry but not part of '1.1.1' ancestry so
1598
# it should be mentioned even if merge_sort order will make it appear
1600
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '2'],
1601
b, '1.1.1', '3', True)