~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2011-07-18 14:22:20 UTC
  • mto: This revision was merged to the branch mainline in revision 6033.
  • Revision ID: john@arbash-meinel.com-20110718142220-nwylw659oip1ene9
Start at least testing the package_branch regex.
And start testing the is-up-to-date logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from itertools import izip
21
21
import os
22
 
import re
23
22
 
24
23
from bzrlib import (
25
24
    branchbuilder,
29
28
    tests,
30
29
    )
31
30
from bzrlib.tests import (
32
 
    script,
33
31
    test_log,
 
32
    features,
34
33
    )
35
34
 
36
35
 
77
76
                self.log_catcher = test_log.LogCatcher(*args, **kwargs)
78
77
                # Always return our own log formatter
79
78
                return self.log_catcher
 
79
        # Break cycle with closure over self on cleanup by removing method
 
80
        self.addCleanup(setattr, MyLogFormatter, "__new__", None)
80
81
 
81
82
        def getme(branch):
82
83
                # Always return our own log formatter class hijacking the
442
443
        self.assertContainsRe(log, r'tags: tag1')
443
444
 
444
445
 
 
446
class TestLogSignatures(TestLog):
 
447
 
 
448
    def test_log_with_signatures(self):
 
449
        self.requireFeature(features.gpgme)
 
450
 
 
451
        tree = self.make_linear_branch(format='dirstate-tags')
 
452
 
 
453
        log = self.run_bzr("log --signatures")[0]
 
454
        self.assertTrue('signature: no signature' in log)
 
455
 
 
456
    def test_log_without_signatures(self):
 
457
        self.requireFeature(features.gpgme)
 
458
 
 
459
        tree = self.make_linear_branch(format='dirstate-tags')
 
460
 
 
461
        log = self.run_bzr("log")[0]
 
462
        self.assertFalse('signature: no signature' in log)
 
463
 
 
464
 
445
465
class TestLogVerbose(TestLog):
446
466
 
447
467
    def setUp(self):
463
483
    def test_log_short_verbose(self):
464
484
        self.assertUseShortDeltaFormat(['log', '--short', '-v'])
465
485
 
 
486
    def test_log_s_verbose(self):
 
487
        self.assertUseShortDeltaFormat(['log', '-S', '-v'])
 
488
 
466
489
    def test_log_short_verbose_verbose(self):
467
490
        self.assertUseLongDeltaFormat(['log', '--short', '-vv'])
468
491
 
924
947
        self.prepare_tree()
925
948
        os.chdir("dir1")
926
949
        self.assertLogRevnos(['dir2', 'file5'], ['5', '3'])
 
950
 
 
951
 
 
952
class MainlineGhostTests(TestLogWithLogCatcher):
 
953
 
 
954
    def setUp(self):
 
955
        super(MainlineGhostTests, self).setUp()
 
956
        tree = self.make_branch_and_tree('')
 
957
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
 
958
        tree.add('')
 
959
        tree.commit('msg1', rev_id='rev1')
 
960
        tree.commit('msg2', rev_id='rev2')
 
961
 
 
962
    def test_log_range(self):
 
963
        self.assertLogRevnos(["-r1..2"], ["2", "1"])
 
964
 
 
965
    def test_log_norange(self):
 
966
        self.assertLogRevnos([], ["2", "1"])
 
967
 
 
968
    def test_log_range_open_begin(self):
 
969
        raise tests.KnownFailure("log with ghosts fails. bug #726466")
 
970
        (stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3)
 
971
        self.assertEqual(["2", "1"],
 
972
                         [r.revno for r in self.get_captured_revisions()])
 
973
        self.assertEquals("bzr: ERROR: Further revision history missing.", stderr)
 
974
 
 
975
    def test_log_range_open_end(self):
 
976
        self.assertLogRevnos(["-r1.."], ["2", "1"])
 
977
 
 
978
class TestLogMatch(TestLogWithLogCatcher):
 
979
    def prepare_tree(self):
 
980
        tree = self.make_branch_and_tree('')
 
981
        self.build_tree(
 
982
            ['/hello.txt', '/goodbye.txt'])
 
983
        tree.add('hello.txt')
 
984
        tree.commit(message='message1', committer='committer1', authors=['author1'])
 
985
        tree.add('goodbye.txt')
 
986
        tree.commit(message='message2', committer='committer2', authors=['author2'])
 
987
    
 
988
    def test_message(self):
 
989
        self.prepare_tree()
 
990
        self.assertLogRevnos(["-m", "message1"], ["1"])
 
991
        self.assertLogRevnos(["-m", "message2"], ["2"])
 
992
        self.assertLogRevnos(["-m", "message"], ["2", "1"])
 
993
        self.assertLogRevnos(["-m", "message1", "-m", "message2"], ["2", "1"])
 
994
        self.assertLogRevnos(["--match-message", "message1"], ["1"])
 
995
        self.assertLogRevnos(["--match-message", "message2"], ["2"])
 
996
        self.assertLogRevnos(["--match-message", "message"], ["2", "1"])
 
997
        self.assertLogRevnos(["--match-message", "message1", 
 
998
                              "--match-message", "message2"], ["2", "1"])
 
999
        self.assertLogRevnos(["--message", "message1"], ["1"])
 
1000
        self.assertLogRevnos(["--message", "message2"], ["2"])
 
1001
        self.assertLogRevnos(["--message", "message"], ["2", "1"])
 
1002
        self.assertLogRevnos(["--match-message", "message1", 
 
1003
                              "--message", "message2"], ["2", "1"])
 
1004
        self.assertLogRevnos(["--message", "message1", 
 
1005
                              "--match-message", "message2"], ["2", "1"])
 
1006
 
 
1007
    def test_committer(self):
 
1008
        self.prepare_tree()
 
1009
        self.assertLogRevnos(["-m", "committer1"], ["1"])
 
1010
        self.assertLogRevnos(["-m", "committer2"], ["2"])
 
1011
        self.assertLogRevnos(["-m", "committer"], ["2", "1"])
 
1012
        self.assertLogRevnos(["-m", "committer1", "-m", "committer2"], 
 
1013
                             ["2", "1"])
 
1014
        self.assertLogRevnos(["--match-committer", "committer1"], ["1"])
 
1015
        self.assertLogRevnos(["--match-committer", "committer2"], ["2"])
 
1016
        self.assertLogRevnos(["--match-committer", "committer"], ["2", "1"])
 
1017
        self.assertLogRevnos(["--match-committer", "committer1", 
 
1018
                              "--match-committer", "committer2"], ["2", "1"])
 
1019
 
 
1020
    def test_author(self):
 
1021
        self.prepare_tree()
 
1022
        self.assertLogRevnos(["-m", "author1"], ["1"])
 
1023
        self.assertLogRevnos(["-m", "author2"], ["2"])
 
1024
        self.assertLogRevnos(["-m", "author"], ["2", "1"])
 
1025
        self.assertLogRevnos(["-m", "author1", "-m", "author2"], 
 
1026
                             ["2", "1"])
 
1027
        self.assertLogRevnos(["--match-author", "author1"], ["1"])
 
1028
        self.assertLogRevnos(["--match-author", "author2"], ["2"])
 
1029
        self.assertLogRevnos(["--match-author", "author"], ["2", "1"])
 
1030
        self.assertLogRevnos(["--match-author", "author1", 
 
1031
                              "--match-author", "author2"], ["2", "1"])