18
18
"""Tests for the commit CLI of bzr."""
20
from cStringIO import StringIO
26
24
from bzrlib.branch import Branch
27
import bzrlib.bzrdir as bzrdir
25
from bzrlib.bzrdir import BzrDir
28
26
from bzrlib.errors import BzrCommandError
29
27
from bzrlib.tests.blackbox import ExternalBase
30
28
from bzrlib.workingtree import WorkingTree
50
48
'Committed revision 1.\n',
53
def test_15_verbose_commit_with_unknown(self):
51
def prepare_simple_history(self):
52
"""Prepare and return a working tree with one commit of one file"""
53
# Commit with modified file should say so
54
wt = BzrDir.create_standalone_workingtree('.')
55
self.build_tree(['hello.txt', 'extra.txt'])
57
wt.commit(message='added')
60
def test_verbose_commit_modified(self):
61
# Verbose commit of modified file should say so
62
wt = self.prepare_simple_history()
63
self.build_tree_contents([('hello.txt', 'new contents')])
64
out, err = self.run_bzr("commit", "-m", "modified")
65
self.assertEqual('', out)
66
self.assertEqual('modified hello.txt\n'
67
'Committed revision 2.\n',
70
def test_verbose_commit_renamed(self):
71
# Verbose commit of renamed file should say so
72
wt = self.prepare_simple_history()
73
wt.rename_one('hello.txt', 'gutentag.txt')
74
out, err = self.run_bzr("commit", "-m", "renamed")
75
self.assertEqual('', out)
76
self.assertEqual('renamed gutentag.txt\n'
77
'Committed revision 2.\n',
80
def test_verbose_commit_moved(self):
81
# Verbose commit of file moved to new directory should say so
82
wt = self.prepare_simple_history()
85
wt.rename_one('hello.txt', 'subdir/hello.txt')
86
out, err = self.run_bzr("commit", "-m", "renamed")
87
self.assertEqual('', out)
88
self.assertEqualDiff('added subdir\n'
89
'renamed subdir/hello.txt\n'
90
'Committed revision 2.\n',
93
def test_verbose_commit_with_unknown(self):
54
94
"""Unknown files should not be listed by default in verbose output"""
55
95
# Is that really the best policy?
96
wt = BzrDir.create_standalone_workingtree('.')
57
97
self.build_tree(['hello.txt', 'extra.txt'])
58
self.runbzr("add hello.txt")
59
99
out,err = self.run_bzr("commit", "-m", "added")
60
100
self.assertEqual('', out)
61
101
self.assertEqual('added hello.txt\n'