~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_log.py

  • Committer: James Westby
  • Date: 2009-02-27 15:14:34 UTC
  • mto: This revision was merged to the branch mainline in revision 4077.
  • Revision ID: jw+debian@jameswestby.net-20090227151434-kk7lqj62fnqmj2ng
Use a new "authors" revision property to allow multiple authors

The "authors" revision property holds a "\n" separated list of
authors.

"author" is still read, but will be overriden by "authors" if
present.

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
    wt.commit('multiline\nlog\nmessage\n', rev_id='a2',
241
241
              timestamp=1132586842.411175966, timezone=-6*3600,
242
242
              committer='Joe Foo <joe@foo.com>',
243
 
              author='Joe Bar <joe@bar.com>')
 
243
              authors=['Joe Bar <joe@bar.com>'])
244
244
 
245
245
    open('c', 'wb').write('just another manic monday\n')
246
246
    wt.add('c')
679
679
                  timestamp=1132711707,
680
680
                  timezone=36000,
681
681
                  committer='Lorem Ipsum <test@example.com>',
682
 
                  author='John Doe <jdoe@example.com>')
 
682
                  authors=['John Doe <jdoe@example.com>',
 
683
                           'Jane Rey <jrey@example.com>'])
683
684
        sio = StringIO()
684
685
        formatter = log.LongLogFormatter(to_file=sio)
685
686
        log.show_log(b, formatter)
686
687
        self.assertEqualDiff('''\
687
688
------------------------------------------------------------
688
689
revno: 1
689
 
author: John Doe <jdoe@example.com>
 
690
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
690
691
committer: Lorem Ipsum <test@example.com>
691
692
branch nick: test_author_log
692
693
timestamp: Wed 2005-11-23 12:08:27 +1000
708
709
                  timestamp=1132711707,
709
710
                  timezone=36000,
710
711
                  committer='Lorem Ipsum <test@example.com>',
711
 
                  author='John Doe <jdoe@example.com>')
 
712
                  authors=['John Doe <jdoe@example.com>'])
712
713
        sio = StringIO()
713
714
        formatter = log.LongLogFormatter(to_file=sio)
714
715
        try:
748
749
                  timestamp=1132711707,
749
750
                  timezone=36000,
750
751
                  committer='Lorem Ipsum <test@example.com>',
751
 
                  author='John Doe <jdoe@example.com>')
 
752
                  authors=['John Doe <jdoe@example.com>'])
752
753
        sio = StringIO()
753
754
        formatter = log.ShortLogFormatter(to_file=sio)
754
755
        try:
783
784
                  timestamp=1132711707,
784
785
                  timezone=36000,
785
786
                  committer='Lorem Ipsum <test@example.com>',
786
 
                  author='John Doe <jdoe@example.com>',
 
787
                  authors=['John Doe <jdoe@example.com>'],
787
788
                  revprops={'first_prop':'first_value'})
788
789
        sio = StringIO()
789
790
        formatter = log.LongLogFormatter(to_file=sio)
809
810
                  timestamp=1132711707,
810
811
                  timezone=36000,
811
812
                  committer='Lorem Ipsum <test@example.com>',
812
 
                  author='John Doe <jdoe@example.com>',
 
813
                  authors=['John Doe <jdoe@example.com>'],
813
814
                  revprops={'a_prop':'test_value'})
814
815
        sio = StringIO()
815
816
        formatter = log.LongLogFormatter(to_file=sio)
959
960
                  timestamp=1132711707,
960
961
                  timezone=36000,
961
962
                  committer='Lorem Ipsum <test@example.com>',
962
 
                  author='John Doe <jdoe@example.com>')
 
963
                  authors=['John Doe <jdoe@example.com>'])
963
964
        sio = StringIO()
964
965
        formatter = log.LongLogFormatter(to_file=sio, levels=1)
965
966
        log.show_log(b, formatter)
988
989
                  timestamp=1132711707,
989
990
                  timezone=36000,
990
991
                  committer='Lorem Ipsum <test@example.com>',
991
 
                  author='John Doe <jdoe@example.com>')
 
992
                  authors=['John Doe <jdoe@example.com>'])
992
993
        sio = StringIO()
993
994
        formatter = log.LongLogFormatter(to_file=sio, levels=1)
994
995
        try:
1545
1546
        self.assertEqual('jsmith@example.com', lf.short_author(rev))
1546
1547
        rev.properties['author'] = 'John Smith jsmith@example.com'
1547
1548
        self.assertEqual('John Smith', lf.short_author(rev))
 
1549
        del rev.properties['author']
 
1550
        rev.properties['authors'] = ('John Smith <jsmith@example.com>\n'
 
1551
                'Jane Rey <jrey@example.com>')
 
1552
        self.assertEqual('John Smith', lf.short_author(rev))
1548
1553
 
1549
1554
 
1550
1555
class TestReverseByDepth(tests.TestCase):