/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

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the commit CLI of bzr."""
19
19
 
 
20
import doctest
20
21
import os
21
22
import re
22
23
import sys
23
24
 
 
25
from testtools.matchers import DocTestMatches
 
26
 
24
27
from bzrlib import (
25
 
    bzrdir,
 
28
    config,
26
29
    osutils,
27
30
    ignores,
28
31
    msgeditor,
29
 
    osutils,
30
32
    tests,
31
33
    )
32
34
from bzrlib.bzrdir import BzrDir
47
49
        self.build_tree(['hello.txt'])
48
50
        out,err = self.run_bzr('commit -m empty', retcode=3)
49
51
        self.assertEqual('', out)
50
 
        self.assertContainsRe(err, 'bzr: ERROR: No changes to commit\.'
51
 
                                  ' Use --unchanged to commit anyhow.\n')
 
52
        # Two ugly bits here.
 
53
        # 1) We really don't want 'aborting commit write group' anymore.
 
54
        # 2) bzr: ERROR: is a really long line, so we wrap it with '\'
 
55
        self.assertThat(
 
56
            err,
 
57
            DocTestMatches("""\
 
58
Committing to: ...
 
59
aborting commit write group: PointlessCommit(No changes to commit)
 
60
bzr: ERROR: No changes to commit.\
 
61
 Please 'bzr add' the files you want to commit,\
 
62
 or use --unchanged to force an empty commit.
 
63
""", flags=doctest.ELLIPSIS|doctest.REPORT_UDIFF))
52
64
 
53
65
    def test_commit_success(self):
54
66
        """Successful commit should not leave behind a bzr-commit-* file"""
758
770
        self.run_bzr(['add'])
759
771
        self.overrideEnv('EMAIL', None)
760
772
        self.overrideEnv('BZR_EMAIL', None)
 
773
        # Also, make sure that it's not inferred from mailname.
 
774
        self.overrideAttr(config, '_auto_user_id',
 
775
            lambda: (None, None))
761
776
        out, err = self.run_bzr(['commit', '-m', 'initial'], 3)
762
777
        self.assertContainsRe(err, 'Unable to determine your name')
763
778