~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jonathan Riddell
  • Date: 2011-09-16 11:13:47 UTC
  • mto: This revision was merged to the branch mainline in revision 6144.
  • Revision ID: jriddell@canonical.com-20110916111347-fyjk426bkl0jrbfu
gettext() show_warning usage

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    osutils,
30
30
    ignores,
31
31
    msgeditor,
32
 
    tests,
33
32
    )
34
33
from bzrlib.bzrdir import BzrDir
35
34
from bzrlib.tests import (
36
 
    probe_bad_non_ascii,
37
35
    test_foreign,
38
 
    TestSkipped,
39
36
    features,
40
37
    )
41
38
from bzrlib.tests import TestCaseWithTransport
332
329
        tree = self.make_branch_and_tree('.')
333
330
        self.build_tree_contents([('foo.c', 'int main() {}')])
334
331
        tree.add('foo.c')
335
 
        self.run_bzr('commit -m ""', retcode=3)
 
332
        self.run_bzr('commit -m ""')
336
333
 
337
334
    def test_other_branch_commit(self):
338
335
        # this branch is to ensure consistent behaviour, whether we're run
599
596
            'commit -m add-b --fixes=xxx:123',
600
597
            working_dir='tree')
601
598
 
 
599
    def test_fixes_bug_with_default_tracker(self):
 
600
        """commit --fixes=234 uses the default bug tracker."""
 
601
        tree = self.make_branch_and_tree('tree')
 
602
        self.build_tree(['tree/hello.txt'])
 
603
        tree.add('hello.txt')
 
604
        self.run_bzr_error(
 
605
            ["bzr: ERROR: No tracker specified for bug 123. Use the form "
 
606
            "'tracker:id' or specify a default bug tracker using the "
 
607
            "`bugtracker` option.\n"
 
608
            "See \"bzr help bugs\" for more information on this feature. "
 
609
            "Commit refused."],
 
610
            'commit -m add-b --fixes=123',
 
611
            working_dir='tree')
 
612
        tree.branch.get_config().set_user_option("bugtracker", "lp")
 
613
        self.run_bzr('commit -m hello --fixes=234 tree/hello.txt')
 
614
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
615
        self.assertEqual('https://launchpad.net/bugs/234 fixed',
 
616
                         last_rev.properties['bugs'])
 
617
 
602
618
    def test_fixes_invalid_bug_number(self):
603
619
        tree = self.make_branch_and_tree('tree')
604
620
        self.build_tree(['tree/hello.txt'])
616
632
        self.build_tree(['tree/hello.txt'])
617
633
        tree.add('hello.txt')
618
634
        self.run_bzr_error(
619
 
            [r"Invalid bug orange. Must be in the form of 'tracker:id'\. "
620
 
             r"See \"bzr help bugs\" for more information on this feature.\n"
621
 
             r"Commit refused\."],
622
 
            'commit -m add-b --fixes=orange',
 
635
            [r"Invalid bug orange:apples:bananas. Must be in the form of "
 
636
             r"'tracker:id'\. See \"bzr help bugs\" for more information on "
 
637
             r"this feature.\nCommit refused\."],
 
638
            'commit -m add-b --fixes=orange:apples:bananas',
623
639
            working_dir='tree')
624
640
 
625
641
    def test_no_author(self):
741
757
        tree.add('hello.txt')
742
758
        return tree
743
759
 
 
760
    def test_edit_empty_message(self):
 
761
        tree = self.make_branch_and_tree('tree')
 
762
        self.setup_editor()
 
763
        self.build_tree(['tree/hello.txt'])
 
764
        tree.add('hello.txt')
 
765
        out, err = self.run_bzr("commit tree/hello.txt", retcode=3,
 
766
            stdin="y\n")
 
767
        self.assertContainsRe(err,
 
768
            "bzr: ERROR: Empty commit message specified")
 
769
 
744
770
    def test_commit_hook_template_accepted(self):
745
771
        tree = self.setup_commit_with_template()
746
772
        out, err = self.run_bzr("commit tree/hello.txt", stdin="y\n")