~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Tests for the commit CLI of bzr."""
124
124
        wt.rename_one('hello.txt', 'subdir/hello.txt')
125
125
        out, err = self.run_bzr('commit -m renamed')
126
126
        self.assertEqual('', out)
127
 
        self.assertContainsRe(err, '^Committing to: .*\n'
128
 
                              'added subdir\n'
129
 
                              'renamed hello\.txt => subdir/hello\.txt\n'
130
 
                              'Committed revision 2\.\n$')
 
127
        self.assertEqual(set([
 
128
            'Committing to: %s/' % osutils.getcwd(),
 
129
            'added subdir',
 
130
            'renamed hello.txt => subdir/hello.txt',
 
131
            'Committed revision 2.',
 
132
            '',
 
133
            ]), set(err.split('\n')))
131
134
 
132
135
    def test_verbose_commit_with_unknown(self):
133
136
        """Unknown files should not be listed by default in verbose output"""
220
223
        os.chdir('this')
221
224
        out,err = self.run_bzr('commit -m added')
222
225
        self.assertEqual('', out)
223
 
        expected = '%s/' % (osutils.getcwd(), )
224
 
        self.assertEqualDiff(
225
 
            'Committing to: %s\n'
226
 
            'modified filetomodify\n'
227
 
            'added newdir\n'
228
 
            'added newfile\n'
229
 
            'renamed dirtorename => renameddir\n'
230
 
            'renamed filetorename => renamedfile\n'
231
 
            'renamed dirtoreparent => renameddir/reparenteddir\n'
232
 
            'renamed filetoreparent => renameddir/reparentedfile\n'
233
 
            'deleted dirtoremove\n'
234
 
            'deleted filetoremove\n'
235
 
            'Committed revision 2.\n' % (expected, ),
236
 
            err)
 
226
        self.assertEqual(set([
 
227
            'Committing to: %s/' % osutils.getcwd(),
 
228
            'modified filetomodify',
 
229
            'added newdir',
 
230
            'added newfile',
 
231
            'renamed dirtorename => renameddir',
 
232
            'renamed filetorename => renamedfile',
 
233
            'renamed dirtoreparent => renameddir/reparenteddir',
 
234
            'renamed filetoreparent => renameddir/reparentedfile',
 
235
            'deleted dirtoremove',
 
236
            'deleted filetoremove',
 
237
            'Committed revision 2.',
 
238
            ''
 
239
            ]), set(err.split('\n')))
237
240
 
238
241
    def test_empty_commit_message(self):
239
242
        tree = self.make_branch_and_tree('.')
302
305
    def test_commit_a_text_merge_in_a_checkout(self):
303
306
        # checkouts perform multiple actions in a transaction across bond
304
307
        # branches and their master, and have been observed to fail in the
305
 
        # past. This is a user story reported to fail in bug #43959 where 
 
308
        # past. This is a user story reported to fail in bug #43959 where
306
309
        # a merge done in a checkout (using the update command) failed to
307
310
        # commit correctly.
308
311
        trunk = self.make_branch_and_tree('trunk')
517
520
        self.build_tree(['tree/hello.txt'])
518
521
        tree.add('hello.txt')
519
522
        self.run_bzr_error(
520
 
            ["Invalid bug identifier for %s. Commit refused." % 'lp:orange'],
 
523
            ["Did not understand bug identifier orange: Must be an integer. "
 
524
             "See \"bzr help bugs\" for more information on this feature.\n"
 
525
             "Commit refused."],
521
526
            'commit -m add-b --fixes=lp:orange',
522
527
            working_dir='tree')
523
528
 
527
532
        self.build_tree(['tree/hello.txt'])
528
533
        tree.add('hello.txt')
529
534
        self.run_bzr_error(
530
 
            [r"Invalid bug orange. Must be in the form of 'tag:id'\. "
 
535
            [r"Invalid bug orange. Must be in the form of 'tracker:id'\. "
 
536
             r"See \"bzr help bugs\" for more information on this feature.\n"
531
537
             r"Commit refused\."],
532
538
            'commit -m add-b --fixes=orange',
533
539
            working_dir='tree')
554
560
                     "tree/hello.txt"])
555
561
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
556
562
        properties = last_rev.properties
557
 
        self.assertEqual(u'John D\xf6 <jdoe@example.com>', properties['author'])
 
563
        self.assertEqual(u'John D\xf6 <jdoe@example.com>', properties['authors'])
558
564
 
559
565
    def test_author_no_email(self):
560
566
        """Author's name without an email address is allowed, too."""
565
571
                                "tree/hello.txt")
566
572
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
567
573
        properties = last_rev.properties
568
 
        self.assertEqual('John Doe', properties['author'])
 
574
        self.assertEqual('John Doe', properties['authors'])
 
575
 
 
576
    def test_multiple_authors(self):
 
577
        """Multiple authors can be specyfied, and all are stored."""
 
578
        tree = self.make_branch_and_tree('tree')
 
579
        self.build_tree(['tree/hello.txt'])
 
580
        tree.add('hello.txt')
 
581
        out, err = self.run_bzr("commit -m hello --author='John Doe' "
 
582
                                "--author='Jane Rey' tree/hello.txt")
 
583
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
584
        properties = last_rev.properties
 
585
        self.assertEqual('John Doe\nJane Rey', properties['authors'])
569
586
 
570
587
    def test_partial_commit_with_renames_in_tree(self):
571
588
        # this test illustrates bug #140419