~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

resolve conflicts against trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
 
from cStringIO import StringIO
19
18
import os
20
19
 
21
20
from bzrlib import (
26
25
    mutabletree,
27
26
    osutils,
28
27
    revision as _mod_revision,
 
28
    tests,
29
29
    ui,
30
 
    uncommit,
31
 
    workingtree,
32
30
    )
33
 
from bzrlib.errors import (NotBranchError, NotVersionedError,
34
 
                           UnsupportedOperation)
35
 
from bzrlib.osutils import pathjoin, getcwd
36
 
from bzrlib.tests import TestCase
37
31
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
38
 
from bzrlib.trace import mutter
39
 
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
40
 
                                WorkingTree)
41
32
from bzrlib.tests.testui import ProgressRecordingUIFactory
42
33
 
43
34
 
156
147
        wt2 = wt.bzrdir.sprout('to').open_workingtree()
157
148
        wt2.commit('change_right')
158
149
        wt.merge_from_branch(wt2.branch)
159
 
        self.assertRaises(errors.CannotCommitSelectedFileMerge,
160
 
            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")
161
156
 
162
157
    def test_commit_exclude_exclude_changed_is_pointless(self):
163
158
        tree = self.make_branch_and_tree('.')
165
160
        tree.smart_add(['.'])
166
161
        tree.commit('setup test')
167
162
        self.build_tree_contents([('a', 'new contents for "a"\n')])
168
 
        self.assertRaises(errors.PointlessCommit, tree.commit, 'test',
169
 
            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")
170
169
 
171
170
    def test_commit_exclude_excludes_modified_files(self):
172
171
        tree = self.make_branch_and_tree('.')
173
172
        self.build_tree(['a', 'b', 'c'])
174
173
        tree.smart_add(['.'])
175
 
        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")
176
179
        # If b was excluded it will still be 'added' in status.
177
180
        tree.lock_read()
178
181
        self.addCleanup(tree.unlock)
185
188
        tree = self.make_branch_and_tree('.')
186
189
        self.build_tree(['a/', 'a/b'])
187
190
        tree.smart_add(['.'])
188
 
        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")
189
196
        # If a/b was excluded it will still be 'added' in status.
190
197
        tree.lock_read()
191
198
        self.addCleanup(tree.unlock)
273
280
            # older format.
274
281
            return
275
282
        tree.commit('foo', rev_id='foo', local=True)
276
 
        self.failIf(master.repository.has_revision('foo'))
 
283
        self.assertFalse(master.repository.has_revision('foo'))
277
284
        self.assertEqual(_mod_revision.NULL_REVISION,
278
285
                         (_mod_revision.ensure_null(master.last_revision())))
279
286