~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit.py

  • Committer: Michael Ellerman
  • Date: 2005-10-17 11:59:18 UTC
  • mto: (1185.16.126)
  • mto: This revision was merged to the branch mainline in revision 1488.
  • Revision ID: michael@ellerman.id.au-20051017115918-be3eadbee7ffa6fb
Implement strict commits with --strict flag.

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
        self.assertEqual('1', inv['file1id'].revision)
247
247
        # FIXME: This should raise a KeyError I think, rbc20051006
248
248
        self.assertRaises(BzrError, inv.__getitem__, 'file2id')
 
249
 
 
250
    def test_strict_commit(self):
 
251
        """Try and commit with unknown files and strict = True, should fail."""
 
252
        from bzrlib.errors import StrictCommitFailed
 
253
        b = Branch.initialize('.')
 
254
        file('hello', 'w').write('hello world')
 
255
        b.add('hello')
 
256
        file('goodbye', 'w').write('goodbye cruel world!')
 
257
        self.assertRaises(StrictCommitFailed, b.commit,
 
258
            message='add hello but not goodbye', strict=True)
 
259
 
 
260
    def test_nonstrict_commit(self):
 
261
        """Try and commit with unknown files and strict = False, should work."""
 
262
        b = Branch.initialize('.')
 
263
        file('hello', 'w').write('hello world')
 
264
        b.add('hello')
 
265
        file('goodbye', 'w').write('goodbye cruel world!')
 
266
        b.commit(message='add hello but not goodbye', strict=False)