/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: Andrew Bennetts
  • Date: 2009-11-19 06:28:13 UTC
  • mfrom: (4811 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4812.
  • Revision ID: andrew.bennetts@canonical.com-20091119062813-t6sd6gwbot8nfyze
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    ignores,
26
26
    msgeditor,
27
27
    osutils,
 
28
    tests,
28
29
    )
29
30
from bzrlib.bzrdir import BzrDir
30
31
from bzrlib.tests import (
170
171
        self.assertEqual(err, 'Committing to: %s\n'
171
172
                         'Committed revision 2.\n' % expected)
172
173
 
 
174
    def test_commit_sanitizes_CR_in_message(self):
 
175
        # See bug #433779, basically Emacs likes to pass '\r\n' style line
 
176
        # endings to 'bzr commit -m ""' which breaks because we don't allow
 
177
        # '\r' in commit messages. (Mostly because of issues where XML style
 
178
        # formats arbitrarily strip it out of the data while parsing.)
 
179
        # To make life easier for users, we just always translate '\r\n' =>
 
180
        # '\n'. And '\r' => '\n'.
 
181
        a_tree = self.make_branch_and_tree('a')
 
182
        self.build_tree(['a/b'])
 
183
        a_tree.add('b')
 
184
        self.run_bzr(['commit',
 
185
                      '-m', 'a string\r\n\r\nwith mixed\r\rendings\n'],
 
186
                     working_dir='a')
 
187
        rev_id = a_tree.branch.last_revision()
 
188
        rev = a_tree.branch.repository.get_revision(rev_id)
 
189
        self.assertEqualDiff('a string\n\nwith mixed\n\nendings\n',
 
190
                             rev.message)
 
191
 
173
192
    def test_commit_merge_reports_all_modified_files(self):
174
193
        # the commit command should show all the files that are shown by
175
194
        # bzr diff or bzr status when committing, even when they were not
245
264
        self.run_bzr('commit -m ""', retcode=3)
246
265
 
247
266
    def test_unsupported_encoding_commit_message(self):
 
267
        if sys.platform == 'win32':
 
268
            raise tests.TestNotApplicable('Win32 parses arguments directly'
 
269
                ' as Unicode, so we can\'t pass invalid non-ascii')
248
270
        tree = self.make_branch_and_tree('.')
249
271
        self.build_tree_contents([('foo.c', 'int main() {}')])
250
272
        tree.add('foo.c')
255
277
        if char is None:
256
278
            raise TestSkipped('Cannot find suitable non-ascii character'
257
279
                'for user_encoding (%s)' % osutils.get_user_encoding())
258
 
        # TODO: jam 2009-07-23 This test seems to fail on Windows now. My best
259
 
        #       guess is that the change to use Unicode command lines means
260
 
        #       that we no longer pay any attention to LANG=C when decoding the
261
 
        #       commandline arguments.
262
280
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
263
281
                                          retcode=1,
264
282
                                          env_changes={'LANG': 'C'})