878
877
formatter_kwargs=dict(levels=0))
881
class TestGnuChangelogFormatter(TestCaseForLogFormatter):
883
def test_gnu_changelog(self):
884
wt = self.make_standard_commit('nicky', authors=[])
885
self.assertFormatterResult('''\
886
2005-11-22 Lorem Ipsum <test@example.com>
891
wt.branch, log.GnuChangelogLogFormatter)
893
def test_with_authors(self):
894
wt = self.make_standard_commit('nicky',
895
authors=['Fooa Fooz <foo@example.com>',
896
'Bari Baro <bar@example.com>'])
897
self.assertFormatterResult('''\
898
2005-11-22 Fooa Fooz <foo@example.com>
903
wt.branch, log.GnuChangelogLogFormatter)
905
def test_verbose(self):
906
wt = self.make_standard_commit('nicky')
907
self.assertFormatterResult('''\
908
2005-11-22 John Doe <jdoe@example.com>
915
wt.branch, log.GnuChangelogLogFormatter,
916
show_log_kwargs=dict(verbose=True))
918
880
class TestGetViewRevisions(tests.TestCaseWithTransport, TestLogMixin):
920
882
def _get_view_revisions(self, *args, **kwargs):
1543
1505
def test_bugs_handler_present(self):
1544
1506
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)