/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_commit.py

  • Committer: Robert Collins
  • Date: 2008-08-04 22:07:34 UTC
  • mto: This revision was merged to the branch mainline in revision 3603.
  • Revision ID: robertc@robertcollins.net-20080804220734-xoo8j0kt3bdy26s9
Review feedback : test for PointlessCommit and that the example given in the help (excluding a subtree of a specified tree) does in fact work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
        self.assertRaises(errors.CannotCommitSelectedFileMerge,
208
208
            wt.commit, 'test', exclude=['foo'])
209
209
 
 
210
    def test_commit_exclude_exclude_changed_is_pointless(self):
 
211
        tree = self.make_branch_and_tree('.')
 
212
        self.build_tree(['a'])
 
213
        tree.smart_add(['.'])
 
214
        tree.commit('setup test')
 
215
        self.build_tree_contents([('a', 'new contents for "a"\n')])
 
216
        self.assertRaises(errors.PointlessCommit, tree.commit, 'test',
 
217
            exclude=['a'], allow_pointless=False)
 
218
 
210
219
    def test_commit_exclude_excludes_modified_files(self):
211
220
        tree = self.make_branch_and_tree('.')
212
221
        self.build_tree(['a', 'b', 'c'])
220
229
        self.assertEqual((None, 'b'), changes[0][1])
221
230
        self.assertEqual((None, 'c'), changes[1][1])
222
231
 
 
232
    def test_commit_exclude_subtree_of_selected(self):
 
233
        tree = self.make_branch_and_tree('.')
 
234
        self.build_tree(['a/', 'a/b'])
 
235
        tree.smart_add(['.'])
 
236
        tree.commit('test', exclude=['a/b'])
 
237
        # If a/b was ignored it will still be 'added' in status.
 
238
        tree.lock_read()
 
239
        self.addCleanup(tree.unlock)
 
240
        changes = list(tree.iter_changes(tree.basis_tree()))
 
241
        self.assertEqual(1, len(changes))
 
242
        self.assertEqual((None, 'a/b'), changes[0][1])
 
243
 
223
244
    def test_commit_sets_last_revision(self):
224
245
        tree = self.make_branch_and_tree('tree')
225
246
        committed_id = tree.commit('foo', rev_id='foo')