47
47
"""Successful commit should not leave behind a bzr-commit-* file"""
48
48
self.run_bzr("init")
49
49
self.run_bzr("commit", "--unchanged", "-m", "message")
50
self.assertEqual('', self.capture('unknowns'))
50
self.assertEqual('', self.run_bzr(['unknowns'])[0])
52
52
# same for unicode messages
53
53
self.run_bzr("commit", "--unchanged", "-m", u'foo\xb5')
54
self.assertEqual('', self.capture('unknowns'))
54
self.assertEqual('', self.run_bzr(['unknowns'])[0])
56
56
def test_commit_with_path(self):
57
57
"""Commit tree with path of root specified"""
77
77
def test_10_verbose_commit(self):
78
78
"""Add one file and examine verbose commit output"""
80
80
self.build_tree(['hello.txt'])
81
self.runbzr("add hello.txt")
81
self.run_bzr("add hello.txt")
82
82
out,err = self.run_bzr("commit", "-m", "added")
83
83
self.assertEqual('', out)
84
84
self.assertEqual('added hello.txt\n'
142
142
def test_verbose_commit_with_unchanged(self):
143
143
"""Unchanged files should not be listed by default in verbose output"""
145
145
self.build_tree(['hello.txt', 'unchanged.txt'])
146
self.runbzr('add unchanged.txt')
147
self.runbzr('commit -m unchanged unchanged.txt')
148
self.runbzr("add hello.txt")
146
self.run_bzr('add unchanged.txt')
147
self.run_bzr('commit -m unchanged unchanged.txt')
148
self.run_bzr("add hello.txt")
149
149
out,err = self.run_bzr("commit", "-m", "added")
150
150
self.assertEqual('', out)
151
151
self.assertEqual('added hello.txt\n'
221
221
def test_empty_commit_message(self):
223
223
file('foo.c', 'wt').write('int main() {}')
224
self.runbzr(['add', 'foo.c'])
225
self.runbzr(["commit", "-m", ""] , retcode=3)
224
self.run_bzr('add foo.c')
225
self.run_bzr('commit -m ""', retcode=3)
227
227
def test_other_branch_commit(self):
228
228
# this branch is to ensure consistent behaviour, whether we're run
229
229
# inside a branch, or not.
230
230
os.mkdir('empty_branch')
231
231
os.chdir('empty_branch')
233
233
os.mkdir('branch')
234
234
os.chdir('branch')
236
236
file('foo.c', 'wt').write('int main() {}')
237
237
file('bar.c', 'wt').write('int main() {}')
239
self.runbzr(['add', 'branch/foo.c'])
240
self.runbzr(['add', 'branch'])
239
self.run_bzr(['add', 'branch/foo.c'])
240
self.run_bzr(['add', 'branch'])
241
241
# can't commit files in different trees; sane error
242
self.runbzr('commit -m newstuff branch/foo.c .', retcode=3)
243
self.runbzr('commit -m newstuff branch/foo.c')
244
self.runbzr('commit -m newstuff branch')
245
self.runbzr('commit -m newstuff branch', retcode=3)
242
self.run_bzr('commit -m newstuff branch/foo.c .', retcode=3)
243
self.run_bzr('commit -m newstuff branch/foo.c')
244
self.run_bzr('commit -m newstuff branch')
245
self.run_bzr('commit -m newstuff branch', retcode=3)
247
247
def test_out_of_date_tree_commit(self):
248
248
# check we get an error code and a clear message committing with an out
249
249
# of date checkout
250
250
self.make_branch_and_tree('branch')
251
251
# make a checkout
252
self.runbzr('checkout --lightweight branch checkout')
252
self.run_bzr('checkout --lightweight branch checkout')
253
253
# commit to the original branch to make the checkout out of date
254
self.runbzr('commit --unchanged -m message branch')
254
self.run_bzr('commit --unchanged -m message branch')
255
255
# now commit to the checkout should emit
256
256
# ERROR: Out of date with the branch, 'bzr update' is suggested
257
output = self.runbzr('commit --unchanged -m checkout_message '
257
output = self.run_bzr('commit --unchanged -m checkout_message '
258
258
'checkout', retcode=3)
259
259
self.assertEqual(output,