/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/blackbox/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-06 14:53:40 UTC
  • mfrom: (5835 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5846.
  • Revision ID: john@arbash-meinel.com-20110506145340-whf3chalcyhar9ag
Merge bzr.dev 5835 in prep for release-notes updates

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,
37
38
    TestSkipped,
38
39
    UnicodeFilenameFeature,
39
40
    )
72
73
        self.run_bzr(["commit", "--unchanged", "-m", u'foo\xb5'])
73
74
        self.assertEqual('', self.run_bzr('unknowns')[0])
74
75
 
 
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
 
75
90
    def test_commit_with_path(self):
76
91
        """Commit tree with path of root specified"""
77
92
        a_tree = self.make_branch_and_tree('a')
91
106
        self.run_bzr('resolved b/a_file')
92
107
        self.run_bzr(['commit', '-m', 'merge into b', 'b'])
93
108
 
94
 
 
95
109
    def test_10_verbose_commit(self):
96
110
        """Add one file and examine verbose commit output"""
97
111
        tree = self.make_branch_and_tree('.')
321
335
        tree.add('foo.c')
322
336
        self.run_bzr('commit -m ""', retcode=3)
323
337
 
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
 
 
344
338
    def test_other_branch_commit(self):
345
339
        # this branch is to ensure consistent behaviour, whether we're run
346
340
        # inside a branch, or not.