86
89
def get_captured_revisions(self):
87
90
return self.log_catcher.revisions
89
def assertLogRevnos(self, args, expected_revnos, working_dir='.'):
90
self.run_bzr(['log'] + args, working_dir=working_dir)
92
def assertLogRevnos(self, args, expected_revnos, working_dir='.',
94
actual_out, actual_err = self.run_bzr(['log'] + args,
95
working_dir=working_dir)
96
self.assertEqual(out, actual_out)
97
self.assertEqual(err, actual_err)
91
98
self.assertEqual(expected_revnos,
92
99
[r.revno for r in self.get_captured_revisions()])
440
447
self.assertContainsRe(log, r'tags: tag1')
450
class TestLogSignatures(TestLog):
452
def test_log_with_signatures(self):
453
self.requireFeature(features.gpgme)
455
tree = self.make_linear_branch(format='dirstate-tags')
457
log = self.run_bzr("log --signatures")[0]
458
self.assertTrue('signature: no signature' in log)
460
def test_log_without_signatures(self):
461
self.requireFeature(features.gpgme)
463
tree = self.make_linear_branch(format='dirstate-tags')
465
log = self.run_bzr("log")[0]
466
self.assertFalse('signature: no signature' in log)
443
469
class TestLogVerbose(TestLog):
512
541
def test_include_merges(self):
513
542
# Confirm --include-merges gives the same output as -n0
514
self.assertLogRevnos(['--include-merges'],
515
['2', '1.1.2', '1.2.1', '1.1.1', '1'],
516
working_dir='level0')
517
self.assertLogRevnos(['--include-merges'],
518
['2', '1.1.2', '1.2.1', '1.1.1', '1'],
519
working_dir='level0')
543
msg = ("The option '--include-merges' to 'bzr log' "
544
"has been deprecated in bzr 2.5. "
545
"Please use '--include-merged' instead.\n")
546
self.assertLogRevnos(['--include-merges'],
547
['2', '1.1.2', '1.2.1', '1.1.1', '1'],
548
working_dir='level0', err=msg)
549
self.assertLogRevnos(['--include-merges'],
550
['2', '1.1.2', '1.2.1', '1.1.1', '1'],
551
working_dir='level0', err=msg)
520
552
out_im, err_im = self.run_bzr('log --include-merges',
521
553
working_dir='level0')
522
554
out_n0, err_n0 = self.run_bzr('log -n0', working_dir='level0')
523
self.assertEqual('', err_im)
555
self.assertEqual(msg, err_im)
524
556
self.assertEqual('', err_n0)
525
557
self.assertEqual(out_im, out_n0)
559
def test_include_merged(self):
560
# Confirm --include-merged gives the same output as -n0
561
expected = ['2', '1.1.2', '1.2.1', '1.1.1', '1']
562
self.assertLogRevnos(['--include-merged'],
563
expected, working_dir='level0')
564
self.assertLogRevnos(['--include-merged'],
565
expected, working_dir='level0')
527
567
def test_force_merge_revisions_N(self):
528
568
self.assertLogRevnos(['-n2'],
529
569
['2', '1.1.2', '1.1.1', '1'],
950
998
def test_log_range_open_end(self):
951
999
self.assertLogRevnos(["-r1.."], ["2", "1"])
1001
class TestLogMatch(TestLogWithLogCatcher):
1002
def prepare_tree(self):
1003
tree = self.make_branch_and_tree('')
1005
['/hello.txt', '/goodbye.txt'])
1006
tree.add('hello.txt')
1007
tree.commit(message='message1', committer='committer1', authors=['author1'])
1008
tree.add('goodbye.txt')
1009
tree.commit(message='message2', committer='committer2', authors=['author2'])
1011
def test_message(self):
1013
self.assertLogRevnos(["-m", "message1"], ["1"])
1014
self.assertLogRevnos(["-m", "message2"], ["2"])
1015
self.assertLogRevnos(["-m", "message"], ["2", "1"])
1016
self.assertLogRevnos(["-m", "message1", "-m", "message2"], ["2", "1"])
1017
self.assertLogRevnos(["--match-message", "message1"], ["1"])
1018
self.assertLogRevnos(["--match-message", "message2"], ["2"])
1019
self.assertLogRevnos(["--match-message", "message"], ["2", "1"])
1020
self.assertLogRevnos(["--match-message", "message1",
1021
"--match-message", "message2"], ["2", "1"])
1022
self.assertLogRevnos(["--message", "message1"], ["1"])
1023
self.assertLogRevnos(["--message", "message2"], ["2"])
1024
self.assertLogRevnos(["--message", "message"], ["2", "1"])
1025
self.assertLogRevnos(["--match-message", "message1",
1026
"--message", "message2"], ["2", "1"])
1027
self.assertLogRevnos(["--message", "message1",
1028
"--match-message", "message2"], ["2", "1"])
1030
def test_committer(self):
1032
self.assertLogRevnos(["-m", "committer1"], ["1"])
1033
self.assertLogRevnos(["-m", "committer2"], ["2"])
1034
self.assertLogRevnos(["-m", "committer"], ["2", "1"])
1035
self.assertLogRevnos(["-m", "committer1", "-m", "committer2"],
1037
self.assertLogRevnos(["--match-committer", "committer1"], ["1"])
1038
self.assertLogRevnos(["--match-committer", "committer2"], ["2"])
1039
self.assertLogRevnos(["--match-committer", "committer"], ["2", "1"])
1040
self.assertLogRevnos(["--match-committer", "committer1",
1041
"--match-committer", "committer2"], ["2", "1"])
1043
def test_author(self):
1045
self.assertLogRevnos(["-m", "author1"], ["1"])
1046
self.assertLogRevnos(["-m", "author2"], ["2"])
1047
self.assertLogRevnos(["-m", "author"], ["2", "1"])
1048
self.assertLogRevnos(["-m", "author1", "-m", "author2"],
1050
self.assertLogRevnos(["--match-author", "author1"], ["1"])
1051
self.assertLogRevnos(["--match-author", "author2"], ["2"])
1052
self.assertLogRevnos(["--match-author", "author"], ["2", "1"])
1053
self.assertLogRevnos(["--match-author", "author1",
1054
"--match-author", "author2"], ["2", "1"])