~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-11 03:30:21 UTC
  • mfrom: (5777.2.1 skip-exclude)
  • Revision ID: pqm@pqm.ubuntu.com-20110411033021-k2a68wj7n1zfhxrn
(jelmer) Skip tests for CommitBuilder.commit(exclude=...) for repositories
 that don't support it. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    mutabletree,
26
26
    osutils,
27
27
    revision as _mod_revision,
 
28
    tests,
28
29
    ui,
29
30
    )
30
31
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
146
147
        wt2 = wt.bzrdir.sprout('to').open_workingtree()
147
148
        wt2.commit('change_right')
148
149
        wt.merge_from_branch(wt2.branch)
149
 
        self.assertRaises(errors.CannotCommitSelectedFileMerge,
150
 
            wt.commit, 'test', exclude=['foo'])
 
150
        try:
 
151
            self.assertRaises(errors.CannotCommitSelectedFileMerge,
 
152
                wt.commit, 'test', exclude=['foo'])
 
153
        except errors.ExcludesUnsupported:
 
154
            raise tests.TestNotApplicable("excludes not supported by this "
 
155
                "repository format")
151
156
 
152
157
    def test_commit_exclude_exclude_changed_is_pointless(self):
153
158
        tree = self.make_branch_and_tree('.')
155
160
        tree.smart_add(['.'])
156
161
        tree.commit('setup test')
157
162
        self.build_tree_contents([('a', 'new contents for "a"\n')])
158
 
        self.assertRaises(errors.PointlessCommit, tree.commit, 'test',
159
 
            exclude=['a'], allow_pointless=False)
 
163
        try:
 
164
            self.assertRaises(errors.PointlessCommit, tree.commit, 'test',
 
165
                exclude=['a'], allow_pointless=False)
 
166
        except errors.ExcludesUnsupported:
 
167
            raise tests.TestNotApplicable("excludes not supported by this "
 
168
                "repository format")
160
169
 
161
170
    def test_commit_exclude_excludes_modified_files(self):
162
171
        tree = self.make_branch_and_tree('.')
163
172
        self.build_tree(['a', 'b', 'c'])
164
173
        tree.smart_add(['.'])
165
 
        tree.commit('test', exclude=['b', 'c'])
 
174
        try:
 
175
            tree.commit('test', exclude=['b', 'c'])
 
176
        except errors.ExcludesUnsupported:
 
177
            raise tests.TestNotApplicable("excludes not supported by this "
 
178
                "repository format")
166
179
        # If b was excluded it will still be 'added' in status.
167
180
        tree.lock_read()
168
181
        self.addCleanup(tree.unlock)
175
188
        tree = self.make_branch_and_tree('.')
176
189
        self.build_tree(['a/', 'a/b'])
177
190
        tree.smart_add(['.'])
178
 
        tree.commit('test', specific_files=['a'], exclude=['a/b'])
 
191
        try:
 
192
            tree.commit('test', specific_files=['a'], exclude=['a/b'])
 
193
        except errors.ExcludesUnsupported:
 
194
            raise tests.TestNotApplicable("excludes not supported by this "
 
195
                "repository format")
179
196
        # If a/b was excluded it will still be 'added' in status.
180
197
        tree.lock_read()
181
198
        self.addCleanup(tree.unlock)