~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2008-08-04 07:29:51 UTC
  • mto: This revision was merged to the branch mainline in revision 3603.
  • Revision ID: robertc@robertcollins.net-20080804072951-tdue3y4bp9893yx9
Add support for -x or --exclude to bzr commit, fixing bug 3117. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
                          ('xyz/m', 'm-id'),
196
196
                         ], paths)
197
197
 
 
198
    def test_commit_exclude_pending_merge_fails(self):
 
199
        """Excludes are a form of partial commit."""
 
200
        wt = self.make_branch_and_tree('.')
 
201
        self.build_tree(['foo'])
 
202
        wt.add('foo')
 
203
        wt.commit('commit one')
 
204
        wt2 = wt.bzrdir.sprout('to').open_workingtree()
 
205
        wt2.commit('change_right')
 
206
        wt.merge_from_branch(wt2.branch)
 
207
        self.assertRaises(errors.CannotCommitSelectedFileMerge,
 
208
            wt.commit, 'test', exclude=['foo'])
 
209
 
 
210
    def test_commit_exclude_excludes_modified_files(self):
 
211
        tree = self.make_branch_and_tree('.')
 
212
        self.build_tree(['a', 'b', 'c'])
 
213
        tree.smart_add(['.'])
 
214
        tree.commit('test', exclude=['b', 'c'])
 
215
        # If b was ignored it will still be 'added' in status.
 
216
        tree.lock_read()
 
217
        self.addCleanup(tree.unlock)
 
218
        changes = list(tree.iter_changes(tree.basis_tree()))
 
219
        self.assertEqual(2, len(changes))
 
220
        self.assertEqual((None, 'b'), changes[0][1])
 
221
        self.assertEqual((None, 'c'), changes[1][1])
 
222
 
198
223
    def test_commit_sets_last_revision(self):
199
224
        tree = self.make_branch_and_tree('tree')
200
225
        committed_id = tree.commit('foo', rev_id='foo')