224
224
self.run_bzr('add foo.c')
225
225
self.run_bzr('commit -m ""', retcode=3)
227
def test_unsupported_encoding_commit_message(self):
228
tree = self.make_branch_and_tree('.')
229
self.build_tree_contents([('foo.c', 'int main() {}')])
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.')
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')
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)
493
def test_author_sets_property(self):
494
"""commit --author='John Doe <jdoe@example.com>' sets the author
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>' "
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'])
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' "
513
last_rev = tree.branch.repository.get_revision(tree.last_revision())
514
properties = last_rev.properties
515
self.assertEqual('John Doe', properties['author'])