1531
1531
self.assertNotContainsRe(s.getvalue(), 'Added Revisions:')
1534
class TestRevisionNotInBranch(TestCaseForLogFormatter):
1536
def setup_a_tree(self):
1537
tree = self.make_branch_and_tree('tree')
1539
self.addCleanup(tree.unlock)
1541
'committer': 'Joe Foo <joe@foo.com>',
1542
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000
1543
'timezone': 0, # UTC
1545
tree.commit('commit 1a', rev_id='1a', **kwargs)
1546
tree.commit('commit 2a', rev_id='2a', **kwargs)
1547
tree.commit('commit 3a', rev_id='3a', **kwargs)
1550
def setup_ab_tree(self):
1551
tree = self.setup_a_tree()
1552
tree.set_last_revision('1a')
1553
tree.branch.set_last_revision_info(1, '1a')
1555
'committer': 'Joe Foo <joe@foo.com>',
1556
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000
1557
'timezone': 0, # UTC
1559
tree.commit('commit 2b', rev_id='2b', **kwargs)
1560
tree.commit('commit 3b', rev_id='3b', **kwargs)
1563
def test_one_revision(self):
1564
tree = self.setup_ab_tree()
1566
rev = revisionspec.RevisionInfo(tree.branch, None, '3a')
1567
log.show_log(tree.branch, lf, verbose=True, start_revision=rev,
1569
self.assertEqual(1, len(lf.revisions))
1570
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch
1571
self.assertEqual('3a', lf.revisions[0].rev.revision_id)
1573
def test_many_revisions(self):
1574
tree = self.setup_ab_tree()
1576
start_rev = revisionspec.RevisionInfo(tree.branch, None, '1a')
1577
end_rev = revisionspec.RevisionInfo(tree.branch, None, '3a')
1578
log.show_log(tree.branch, lf, verbose=True, start_revision=start_rev,
1579
end_revision=end_rev)
1580
self.assertEqual(3, len(lf.revisions))
1581
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch
1582
self.assertEqual('3a', lf.revisions[0].rev.revision_id)
1583
self.assertEqual(None, lf.revisions[1].revno) # Out-of-branch
1584
self.assertEqual('2a', lf.revisions[1].rev.revision_id)
1585
self.assertEqual('1', lf.revisions[2].revno) # In-branch
1587
def test_long_format(self):
1588
tree = self.setup_ab_tree()
1589
start_rev = revisionspec.RevisionInfo(tree.branch, None, '1a')
1590
end_rev = revisionspec.RevisionInfo(tree.branch, None, '3a')
1591
self.assertFormatterResult("""\
1592
------------------------------------------------------------
1594
committer: Joe Foo <joe@foo.com>
1596
timestamp: Tue 2005-11-22 00:00:00 +0000
1599
------------------------------------------------------------
1601
committer: Joe Foo <joe@foo.com>
1603
timestamp: Tue 2005-11-22 00:00:00 +0000
1606
------------------------------------------------------------
1608
committer: Joe Foo <joe@foo.com>
1610
timestamp: Tue 2005-11-22 00:00:00 +0000
1614
tree.branch, log.LongLogFormatter, show_log_kwargs={
1615
'start_revision': start_rev, 'end_revision': end_rev
1618
def test_short_format(self):
1619
tree = self.setup_ab_tree()
1620
start_rev = revisionspec.RevisionInfo(tree.branch, None, '1a')
1621
end_rev = revisionspec.RevisionInfo(tree.branch, None, '3a')
1622
self.assertFormatterResult("""\
1631
1 Joe Foo\t2005-11-22
1635
tree.branch, log.ShortLogFormatter, show_log_kwargs={
1636
'start_revision': start_rev, 'end_revision': end_rev
1639
def test_line_format(self):
1640
tree = self.setup_ab_tree()
1641
start_rev = revisionspec.RevisionInfo(tree.branch, None, '1a')
1642
end_rev = revisionspec.RevisionInfo(tree.branch, None, '3a')
1643
self.assertFormatterResult("""\
1644
Joe Foo 2005-11-22 commit 3a
1645
Joe Foo 2005-11-22 commit 2a
1646
1: Joe Foo 2005-11-22 commit 1a
1648
tree.branch, log.LineLogFormatter, show_log_kwargs={
1649
'start_revision': start_rev, 'end_revision': end_rev
1535
1653
class TestLogWithBugs(TestCaseForLogFormatter, TestLogMixin):