~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-04 15:25:07 UTC
  • mfrom: (4056.2.5 authors)
  • Revision ID: pqm@pqm.ubuntu.com-20090304152507-pbmk3iuhsrsu22it
(James) Support multiple authors for revisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
747
747
        rev_id = tree.commit('commit 1')
748
748
        rev = tree.branch.repository.get_revision(rev_id)
749
749
        self.assertFalse('author' in rev.properties)
 
750
        self.assertFalse('authors' in rev.properties)
750
751
 
751
752
    def test_commit_author(self):
752
753
        """Passing a non-empty author kwarg to MutableTree.commit should add
753
754
        the 'author' revision property.
754
755
        """
755
756
        tree = self.make_branch_and_tree('foo')
756
 
        rev_id = tree.commit('commit 1', author='John Doe <jdoe@example.com>')
 
757
        rev_id = self.callDeprecated(['The parameter author was '
 
758
                'deprecated in version 1.13. Use authors instead'],
 
759
                tree.commit, 'commit 1', author='John Doe <jdoe@example.com>')
757
760
        rev = tree.branch.repository.get_revision(rev_id)
758
761
        self.assertEqual('John Doe <jdoe@example.com>',
759
 
                         rev.properties['author'])
 
762
                         rev.properties['authors'])
 
763
        self.assertFalse('author' in rev.properties)
 
764
 
 
765
    def test_commit_empty_authors_list(self):
 
766
        """Passing an empty list to authors shouldn't add the property."""
 
767
        tree = self.make_branch_and_tree('foo')
 
768
        rev_id = tree.commit('commit 1', authors=[])
 
769
        rev = tree.branch.repository.get_revision(rev_id)
 
770
        self.assertFalse('author' in rev.properties)
 
771
        self.assertFalse('authors' in rev.properties)
 
772
 
 
773
    def test_multiple_authors(self):
 
774
        tree = self.make_branch_and_tree('foo')
 
775
        rev_id = tree.commit('commit 1',
 
776
                authors=['John Doe <jdoe@example.com>',
 
777
                         'Jane Rey <jrey@example.com>'])
 
778
        rev = tree.branch.repository.get_revision(rev_id)
 
779
        self.assertEqual('John Doe <jdoe@example.com>\n'
 
780
                'Jane Rey <jrey@example.com>', rev.properties['authors'])
 
781
        self.assertFalse('author' in rev.properties)
 
782
 
 
783
    def test_author_and_authors_incompatible(self):
 
784
        tree = self.make_branch_and_tree('foo')
 
785
        self.assertRaises(AssertionError, tree.commit, 'commit 1',
 
786
                authors=['John Doe <jdoe@example.com>',
 
787
                         'Jane Rey <jrey@example.com>'],
 
788
                author="Jack Me <jme@example.com>")
 
789
 
 
790
    def test_author_with_newline_rejected(self):
 
791
        tree = self.make_branch_and_tree('foo')
 
792
        self.assertRaises(AssertionError, tree.commit, 'commit 1',
 
793
                authors=['John\nDoe <jdoe@example.com>'])
760
794
 
761
795
    def test_commit_with_checkout_and_branch_sharing_repo(self):
762
796
        repo = self.make_repository('repo', shared=True)