~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2007-08-30 08:11:54 UTC
  • mfrom: (2766 +trunk)
  • mto: (2535.3.55 repo-refactor)
  • mto: This revision was merged to the branch mainline in revision 2772.
  • Revision ID: andrew.bennetts@canonical.com-20070830081154-16hebp2xwr15x2hc
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
        self.run_bzr('add foo.c')
225
225
        self.run_bzr('commit -m ""', retcode=3)
226
226
 
 
227
    def test_unsupported_encoding_commit_message(self):
 
228
        tree = self.make_branch_and_tree('.')
 
229
        self.build_tree_contents([('foo.c', 'int main() {}')])
 
230
        tree.add('foo.c')
 
231
        out,err = self.run_bzr_subprocess('commit -m "\xff"', retcode=1,
 
232
                                                    env_changes={'LANG': 'C'})
 
233
        self.assertContainsRe(err, r'bzrlib.errors.BzrError: Parameter.*is '
 
234
                                    'unsupported by the current encoding.')
 
235
 
227
236
    def test_other_branch_commit(self):
228
237
        # this branch is to ensure consistent behaviour, whether we're run
229
238
        # inside a branch, or not.
470
479
             r"Commit refused\."],
471
480
            'commit -m add-b --fixes=orange',
472
481
            working_dir='tree')
 
482
 
 
483
    def test_no_author(self):
 
484
        """If the author is not specified, the author property is not set."""
 
485
        tree = self.make_branch_and_tree('tree')
 
486
        self.build_tree(['tree/hello.txt'])
 
487
        tree.add('hello.txt')
 
488
        self.run_bzr( 'commit -m hello tree/hello.txt')
 
489
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
490
        properties = last_rev.properties
 
491
        self.assertFalse('author' in properties)
 
492
 
 
493
    def test_author_sets_property(self):
 
494
        """commit --author='John Doe <jdoe@example.com>' sets the author
 
495
           revprop.
 
496
        """
 
497
        tree = self.make_branch_and_tree('tree')
 
498
        self.build_tree(['tree/hello.txt'])
 
499
        tree.add('hello.txt')
 
500
        self.run_bzr("commit -m hello --author='John Doe <jdoe@example.com>' "
 
501
                     "tree/hello.txt")
 
502
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
503
        properties = last_rev.properties
 
504
        self.assertEqual('John Doe <jdoe@example.com>', properties['author'])
 
505
 
 
506
    def test_author_no_email(self):
 
507
        """Author's name without an email address is allowed, too."""
 
508
        tree = self.make_branch_and_tree('tree')
 
509
        self.build_tree(['tree/hello.txt'])
 
510
        tree.add('hello.txt')
 
511
        out, err = self.run_bzr("commit -m hello --author='John Doe' "
 
512
                                "tree/hello.txt")
 
513
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
514
        properties = last_rev.properties
 
515
        self.assertEqual('John Doe', properties['author'])