~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib.bzrdir import BzrDir
35
35
from bzrlib.tests import (
36
36
    probe_bad_non_ascii,
37
 
    test_foreign,
38
37
    TestSkipped,
39
38
    UnicodeFilenameFeature,
40
39
    )
73
72
        self.run_bzr(["commit", "--unchanged", "-m", u'foo\xb5'])
74
73
        self.assertEqual('', self.run_bzr('unknowns')[0])
75
74
 
76
 
    def test_commit_lossy_native(self):
77
 
        """A --lossy option to commit is supported."""
78
 
        self.make_branch_and_tree('.')
79
 
        self.run_bzr('commit --lossy --unchanged -m message')
80
 
        self.assertEqual('', self.run_bzr('unknowns')[0])
81
 
 
82
 
    def test_commit_lossy_foreign(self):
83
 
        test_foreign.register_dummy_foreign_for_test(self)
84
 
        self.make_branch_and_tree('.',
85
 
            format=test_foreign.DummyForeignVcsDirFormat())
86
 
        self.run_bzr('commit --lossy --unchanged -m message')
87
 
        output = self.run_bzr('revision-info')[0]
88
 
        self.assertTrue(output.startswith('1 dummy-'))
89
 
 
90
75
    def test_commit_with_path(self):
91
76
        """Commit tree with path of root specified"""
92
77
        a_tree = self.make_branch_and_tree('a')
106
91
        self.run_bzr('resolved b/a_file')
107
92
        self.run_bzr(['commit', '-m', 'merge into b', 'b'])
108
93
 
 
94
 
109
95
    def test_10_verbose_commit(self):
110
96
        """Add one file and examine verbose commit output"""
111
97
        tree = self.make_branch_and_tree('.')
335
321
        tree.add('foo.c')
336
322
        self.run_bzr('commit -m ""', retcode=3)
337
323
 
 
324
    def test_unsupported_encoding_commit_message(self):
 
325
        if sys.platform == 'win32':
 
326
            raise tests.TestNotApplicable('Win32 parses arguments directly'
 
327
                ' as Unicode, so we can\'t pass invalid non-ascii')
 
328
        tree = self.make_branch_and_tree('.')
 
329
        self.build_tree_contents([('foo.c', 'int main() {}')])
 
330
        tree.add('foo.c')
 
331
        # LANG env variable has no effect on Windows
 
332
        # but some characters anyway cannot be represented
 
333
        # in default user encoding
 
334
        char = probe_bad_non_ascii(osutils.get_user_encoding())
 
335
        if char is None:
 
336
            raise TestSkipped('Cannot find suitable non-ascii character'
 
337
                'for user_encoding (%s)' % osutils.get_user_encoding())
 
338
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
 
339
                                          retcode=1,
 
340
                                          env_changes={'LANG': 'C'})
 
341
        self.assertContainsRe(err, r'bzrlib.errors.BzrError: Parameter.*is '
 
342
                                    'unsupported by the current encoding.')
 
343
 
338
344
    def test_other_branch_commit(self):
339
345
        # this branch is to ensure consistent behaviour, whether we're run
340
346
        # inside a branch, or not.