~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(jr) New hook set_commit_message in bzrlib.msgeditor to set a commit message
 and revision properties. (Jonathan Riddell, #274578) (Jonathan Riddell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
754
754
            "commit tree/hello.txt", stdin="n\n")
755
755
        self.assertEqual(expected, tree.last_revision())
756
756
 
 
757
    def test_set_commit_message(self):
 
758
        msgeditor.hooks.install_named_hook("set_commit_message",
 
759
                lambda commit_obj, msg: "save me some typing\n", None)
 
760
        tree = self.make_branch_and_tree('tree')
 
761
        self.build_tree(['tree/hello.txt'])
 
762
        tree.add('hello.txt')
 
763
        out, err = self.run_bzr("commit tree/hello.txt")
 
764
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
765
        self.assertEqual('save me some typing\n', last_rev.message)
 
766
 
757
767
    def test_commit_without_username(self):
758
768
        """Ensure commit error if username is not set.
759
769
        """
782
792
        self.assertEqual(out, '')
783
793
        self.assertContainsRe(err,
784
794
            'Branch.*test_checkout.*appears to be bound to itself')
785