371
372
wt.branch, log.ShortLogFormatter,
372
373
show_log_kwargs=dict(start_revision=rev, end_revision=rev))
375
def test_show_ids(self):
376
wt = self.make_branch_and_tree('parent')
377
self.build_tree(['parent/f1', 'parent/f2'])
379
self.wt_commit(wt, 'first post', rev_id='a')
380
child_wt = wt.bzrdir.sprout('child').open_workingtree()
381
self.wt_commit(child_wt, 'branch 1 changes', rev_id='b')
382
wt.merge_from_branch(child_wt.branch)
383
self.wt_commit(wt, 'merge branch 1', rev_id='c')
384
self.assertFormatterResult("""\
385
2 Joe Foo\t2005-11-22 [merge]
389
1.1.1 Joe Foo\t2005-11-22
393
1 Joe Foo\t2005-11-22
398
wt.branch, log.ShortLogFormatter,
399
formatter_kwargs=dict(levels=0,show_ids=True))
375
402
class TestShortLogFormatterWithMergeRevisions(TestCaseForLogFormatter):
659
686
self.assertEqualDiff('''custom_prop_name: test_value\n''',
689
def test_show_ids(self):
690
wt = self.make_branch_and_tree('parent')
691
self.build_tree(['parent/f1', 'parent/f2'])
693
self.wt_commit(wt, 'first post', rev_id='a')
694
child_wt = wt.bzrdir.sprout('child').open_workingtree()
695
self.wt_commit(child_wt, 'branch 1 changes', rev_id='b')
696
wt.merge_from_branch(child_wt.branch)
697
self.wt_commit(wt, 'merge branch 1', rev_id='c')
698
self.assertFormatterResult("""\
699
------------------------------------------------------------
704
committer: Joe Foo <joe@foo.com>
706
timestamp: Tue 2005-11-22 00:00:02 +0000
709
------------------------------------------------------------
713
committer: Joe Foo <joe@foo.com>
715
timestamp: Tue 2005-11-22 00:00:01 +0000
718
------------------------------------------------------------
721
committer: Joe Foo <joe@foo.com>
723
timestamp: Tue 2005-11-22 00:00:00 +0000
727
wt.branch, log.LongLogFormatter,
728
formatter_kwargs=dict(levels=0,show_ids=True))
663
731
class TestLongLogFormatterWithoutMergeRevisions(TestCaseForLogFormatter):
1543
1611
def test_bugs_handler_present(self):
1544
1612
self.properties_handler_registry.get('bugs_properties_handler')
1615
class TestLogForAuthors(TestCaseForLogFormatter):
1618
TestCaseForLogFormatter.setUp(self)
1619
self.wt = self.make_standard_commit('nicky',
1620
authors=['John Doe <jdoe@example.com>',
1621
'Jane Rey <jrey@example.com>'])
1623
def assertFormatterResult(self, formatter, who, result):
1624
formatter_kwargs = dict()
1626
author_list_handler = log.author_list_registry.get(who)
1627
formatter_kwargs['author_list_handler'] = author_list_handler
1628
TestCaseForLogFormatter.assertFormatterResult(self, result,
1629
self.wt.branch, formatter, formatter_kwargs=formatter_kwargs)
1631
def test_line_default(self):
1632
self.assertFormatterResult(log.LineLogFormatter, None, """\
1633
1: John Doe 2005-11-22 add a
1636
def test_line_committer(self):
1637
self.assertFormatterResult(log.LineLogFormatter, 'committer', """\
1638
1: Lorem Ipsum 2005-11-22 add a
1641
def test_line_first(self):
1642
self.assertFormatterResult(log.LineLogFormatter, 'first', """\
1643
1: John Doe 2005-11-22 add a
1646
def test_line_all(self):
1647
self.assertFormatterResult(log.LineLogFormatter, 'all', """\
1648
1: John Doe, Jane Rey 2005-11-22 add a
1652
def test_short_default(self):
1653
self.assertFormatterResult(log.ShortLogFormatter, None, """\
1654
1 John Doe\t2005-11-22
1659
def test_short_committer(self):
1660
self.assertFormatterResult(log.ShortLogFormatter, 'committer', """\
1661
1 Lorem Ipsum\t2005-11-22
1666
def test_short_first(self):
1667
self.assertFormatterResult(log.ShortLogFormatter, 'first', """\
1668
1 John Doe\t2005-11-22
1673
def test_short_all(self):
1674
self.assertFormatterResult(log.ShortLogFormatter, 'all', """\
1675
1 John Doe, Jane Rey\t2005-11-22
1680
def test_long_default(self):
1681
self.assertFormatterResult(log.LongLogFormatter, None, """\
1682
------------------------------------------------------------
1684
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
1685
committer: Lorem Ipsum <test@example.com>
1687
timestamp: Tue 2005-11-22 00:00:00 +0000
1692
def test_long_committer(self):
1693
self.assertFormatterResult(log.LongLogFormatter, 'committer', """\
1694
------------------------------------------------------------
1696
committer: Lorem Ipsum <test@example.com>
1698
timestamp: Tue 2005-11-22 00:00:00 +0000
1703
def test_long_first(self):
1704
self.assertFormatterResult(log.LongLogFormatter, 'first', """\
1705
------------------------------------------------------------
1707
author: John Doe <jdoe@example.com>
1708
committer: Lorem Ipsum <test@example.com>
1710
timestamp: Tue 2005-11-22 00:00:00 +0000
1715
def test_long_all(self):
1716
self.assertFormatterResult(log.LongLogFormatter, 'all', """\
1717
------------------------------------------------------------
1719
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
1720
committer: Lorem Ipsum <test@example.com>
1722
timestamp: Tue 2005-11-22 00:00:00 +0000
1727
def test_gnu_changelog_default(self):
1728
self.assertFormatterResult(log.GnuChangelogLogFormatter, None, """\
1729
2005-11-22 John Doe <jdoe@example.com>
1735
def test_gnu_changelog_committer(self):
1736
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'committer', """\
1737
2005-11-22 Lorem Ipsum <test@example.com>
1743
def test_gnu_changelog_first(self):
1744
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'first', """\
1745
2005-11-22 John Doe <jdoe@example.com>
1751
def test_gnu_changelog_all(self):
1752
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'all', """\
1753
2005-11-22 John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
1546
1760
class TestLogExcludeAncestry(tests.TestCaseWithTransport):
1548
1762
def make_branch_with_alternate_ancestries(self, relpath='.'):
1581
1795
def assertLogRevnos(self, expected_revnos, b, start, end,
1582
exclude_common_ancestry):
1796
exclude_common_ancestry, generate_merge_revisions=True):
1583
1797
# FIXME: the layering in log makes it hard to test intermediate levels,
1584
1798
# I wish adding filters with their parameters were easier...
1585
1799
# -- vila 20100413
1586
1800
iter_revs = log._calc_view_revisions(
1587
1801
b, start, end, direction='reverse',
1588
generate_merge_revisions=True,
1802
generate_merge_revisions=generate_merge_revisions,
1589
1803
exclude_common_ancestry=exclude_common_ancestry)
1590
1804
self.assertEqual(expected_revnos,
1591
1805
[revid for revid, revno, depth in iter_revs])
1593
1807
def test_merge_sorted_exclude_ancestry(self):
1594
1808
b = self.make_branch_with_alternate_ancestries()
1595
1809
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '1.1.1', '2', '1'],
1810
b, '1', '3', exclude_common_ancestry=False)
1597
1811
# '2' is part of the '3' ancestry but not part of '1.1.1' ancestry so
1598
1812
# it should be mentioned even if merge_sort order will make it appear
1600
1814
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '2'],
1601
b, '1.1.1', '3', True)
1815
b, '1.1.1', '3', exclude_common_ancestry=True)
1817
def test_merge_sorted_simple_revnos_exclude_ancestry(self):
1818
b = self.make_branch_with_alternate_ancestries()
1819
self.assertLogRevnos(['3', '2'],
1820
b, '1', '3', exclude_common_ancestry=True,
1821
generate_merge_revisions=False)
1822
self.assertLogRevnos(['3', '1.1.2', '1.2.1', '1.1.1', '2'],
1823
b, '1', '3', exclude_common_ancestry=True,
1824
generate_merge_revisions=True)