1
# Copyright (C) 2005, 2006 by Canonical Ltd
1
# Copyright (C) 2005, 2006 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
35
35
# If forced, it should succeed, but this is not tested here.
36
36
self.run_bzr("init")
37
37
self.build_tree(['hello.txt'])
38
result = self.run_bzr("commit", "-m", "empty", retcode=3)
39
self.assertEqual(('', 'bzr: ERROR: no changes to commit.'
40
' use --unchanged to commit anyhow\n'),
38
out,err = self.run_bzr("commit", "-m", "empty", retcode=3)
39
self.assertEqual('', out)
40
self.assertStartsWith(err, 'bzr: ERROR: no changes to commit.'
41
' use --unchanged to commit anyhow\n')
43
def test_save_commit_message(self):
44
"""Failed commit should save the message in a file"""
46
out,err = self.run_bzr("commit", "-m", "message", retcode=3)
47
self.assertEqual('', out)
48
self.assertStartsWith(err, 'bzr: ERROR: no changes to commit.'
49
' use --unchanged to commit anyhow\n'
50
'Commit message saved. To reuse the message,'
51
' do\nbzr commit --file ')
52
message_file = re.compile('bzr-commit-\S*').search(err).group()
53
self.check_file_contents(message_file, 'message')
55
def test_commit_success(self):
56
"""Successful commit should not leave behind a bzr-commit-* file"""
58
self.run_bzr("commit", "--unchanged", "-m", "message")
59
self.assertEqual('', self.capture('unknowns'))
61
# same for unicode messages
62
self.run_bzr("commit", "--unchanged", "-m", u'foo\xb5')
63
self.assertEqual('', self.capture('unknowns'))
43
65
def test_commit_with_path(self):
44
66
"""Commit tree with path of root specified"""