~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_log.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-19 15:22:23 UTC
  • mfrom: (6123.11.18 log-omit-merges)
  • Revision ID: pqm@pqm.ubuntu.com-20110919152223-o7lh1428tge31dg1
(jr) Add options --omit-merges and --include-merged for bzr log and missing,
 deprecating --include-merges. (Martin von Gagern)

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
    def get_captured_revisions(self):
90
90
        return self.log_catcher.revisions
91
91
 
92
 
    def assertLogRevnos(self, args, expected_revnos, working_dir='.'):
93
 
        self.run_bzr(['log'] + args, working_dir=working_dir)
 
92
    def assertLogRevnos(self, args, expected_revnos, working_dir='.',
 
93
                        out='', err=''):
 
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)
94
98
        self.assertEqual(expected_revnos,
95
99
                         [r.revno for r in self.get_captured_revisions()])
96
100
 
536
540
 
537
541
    def test_include_merges(self):
538
542
        # Confirm --include-merges gives the same output as -n0
539
 
        self.assertLogRevnos(['--include-merges'],
540
 
                             ['2', '1.1.2', '1.2.1', '1.1.1', '1'],
541
 
                             working_dir='level0')
542
 
        self.assertLogRevnos(['--include-merges'],
543
 
                             ['2', '1.1.2', '1.2.1', '1.1.1', '1'],
544
 
                             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)
545
552
        out_im, err_im = self.run_bzr('log --include-merges',
546
553
                                      working_dir='level0')
547
554
        out_n0, err_n0 = self.run_bzr('log -n0', working_dir='level0')
548
 
        self.assertEqual('', err_im)
 
555
        self.assertEqual(msg, err_im)
549
556
        self.assertEqual('', err_n0)
550
557
        self.assertEqual(out_im, out_n0)
551
558
 
 
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')
 
566
 
552
567
    def test_force_merge_revisions_N(self):
553
568
        self.assertLogRevnos(['-n2'],
554
569
                             ['2', '1.1.2', '1.1.1', '1'],
572
587
                [('2', 0), ('1.1.2', 1), ('1.2.1', 2)],
573
588
                working_dir='level0')
574
589
 
 
590
    def test_omit_merges_with_sidelines(self):
 
591
        self.assertLogRevnos(['--omit-merges', '-n0'], ['1.2.1', '1.1.1', '1'],
 
592
                             working_dir='level0')
 
593
 
 
594
    def test_omit_merges_without_sidelines(self):
 
595
        self.assertLogRevnos(['--omit-merges', '-n1'], ['1'],
 
596
                             working_dir='level0')
 
597
 
575
598
 
576
599
class TestLogDiff(TestLogWithLogCatcher):
577
600