/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: Martin
  • Date: 2009-11-07 08:02:13 UTC
  • mfrom: (4789 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4809.
  • Revision ID: gzlist@googlemail.com-20091107080213-jad185091b3l69ih
Merge bzr.dev 4789 to resolve conflict from the disabling of plink auto-detection, and relocate NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        self.assertEqual(err, 'Committing to: %s\n'
171
171
                         'Committed revision 2.\n' % expected)
172
172
 
 
173
    def test_commit_sanitizes_CR_in_message(self):
 
174
        # See bug #433779, basically Emacs likes to pass '\r\n' style line
 
175
        # endings to 'bzr commit -m ""' which breaks because we don't allow
 
176
        # '\r' in commit messages. (Mostly because of issues where XML style
 
177
        # formats arbitrarily strip it out of the data while parsing.)
 
178
        # To make life easier for users, we just always translate '\r\n' =>
 
179
        # '\n'. And '\r' => '\n'.
 
180
        a_tree = self.make_branch_and_tree('a')
 
181
        self.build_tree(['a/b'])
 
182
        a_tree.add('b')
 
183
        self.run_bzr(['commit',
 
184
                      '-m', 'a string\r\n\r\nwith mixed\r\rendings\n'],
 
185
                     working_dir='a')
 
186
        rev_id = a_tree.branch.last_revision()
 
187
        rev = a_tree.branch.repository.get_revision(rev_id)
 
188
        self.assertEqualDiff('a string\n\nwith mixed\n\nendings\n',
 
189
                             rev.message)
 
190
 
173
191
    def test_commit_merge_reports_all_modified_files(self):
174
192
        # the commit command should show all the files that are shown by
175
193
        # bzr diff or bzr status when committing, even when they were not
273
291
        self.build_tree_contents([
274
292
            ('branch/foo.c', 'int main() {}'),
275
293
            ('branch/bar.c', 'int main() {}')])
276
 
        inner_tree.add('foo.c')
277
 
        inner_tree.add('bar.c')
 
294
        inner_tree.add(['foo.c', 'bar.c'])
278
295
        # can't commit files in different trees; sane error
279
296
        self.run_bzr('commit -m newstuff branch/foo.c .', retcode=3)
 
297
        # can commit to branch - records foo.c only
280
298
        self.run_bzr('commit -m newstuff branch/foo.c')
 
299
        # can commit to branch - records bar.c
281
300
        self.run_bzr('commit -m newstuff branch')
282
 
        self.run_bzr('commit -m newstuff branch', retcode=3)
 
301
        # No changes left
 
302
        self.run_bzr_error(["No changes to commit"], 'commit -m newstuff branch')
283
303
 
284
304
    def test_out_of_date_tree_commit(self):
285
305
        # check we get an error code and a clear message committing with an out