322
322
self.assertNotContainsRe(result, 'file-a')
323
323
result = self.run_bzr('status')[0]
324
324
self.assertContainsRe(result, 'removed:\n file-a')
326
def test_strict_commit(self):
327
"""Commit with --strict works if everything is known"""
328
tree = self.make_branch_and_tree('tree')
329
self.build_tree(['tree/a'])
331
# A simple change should just work
332
self.run_bzr('commit', '--strict', '-m', 'adding a',
335
def test_strict_commit_no_changes(self):
336
"""commit --strict gives "no changes" if there is nothing to commit"""
337
tree = self.make_branch_and_tree('tree')
338
self.build_tree(['tree/a'])
340
tree.commit('adding a')
342
# With no changes, it should just be 'no changes'
343
# Make sure that commit is failing because there is nothing to do
344
self.run_bzr_error(['no changes to commit'],
345
'commit', '--strict', '-m', 'no changes',
348
# But --strict doesn't care if you supply --unchanged
349
self.run_bzr('commit', '--strict', '--unchanged', '-m', 'no changes',
352
def test_strict_commit_unknown(self):
353
"""commit --strict fails if a file is unknown"""
354
tree = self.make_branch_and_tree('tree')
355
self.build_tree(['tree/a'])
357
tree.commit('adding a')
359
# Add one file so there is a change, but forget the other
360
self.build_tree(['tree/b', 'tree/c'])
362
self.run_bzr_error(['Commit refused because there are unknown files'],
363
'commit', '--strict', '-m', 'add b',
366
# --no-strict overrides --strict
367
self.run_bzr('commit', '--strict', '-m', 'add b', '--no-strict',